Files
sprawozdania/project/templates/customers/show.html.twig
T
2025-09-27 21:09:59 +02:00

186 lines
11 KiB
Twig

{% import 'reports/listInclude.html.twig' as sets %}
{% extends 'base.html.twig' %}
{% block body %}
<div data-controller="customer-show">
{% if client.isComplete %}
<div class="alert alert-warning"><i class="fa-solid fa-circle-info"></i> Zakończono generowanie sprawozdań!</div>
{% endif %}
<div class="row row-cols-1 row-cols-md-2 g-2">
<div class="col">
<div class="card text-center">
<div class="card-header">
<h2>{{ client.strName }}</h2>
</div>
<ul class="list-group list-group-flush">
<li class="list-group-item"><span style="font-weight: bold">Adres: </span>{{ client.strAddress }}</li>
<li class="list-group-item"><span style="font-weight: bold">NIP: </span>{{ client.intNIP }}</li>
<li class="list-group-item"><span style="font-weight: bold">E-mail: </span>{{ client.strEmail }}</li>
<li class="list-group-item"><span style="font-weight: bold">Telefon: </span>{{ client.intPhone | phone }}</li>
<li class="list-group-item"><span style="font-weight: bold">Data prawomocności: </span>{{ client.dateLegitimacy | date("d-m-Y") }}</li>
<li class="list-group-item"><span style="font-weight: bold">Data obwieszczenia: </span>{{ client.dateProclamation | date("d-m-Y") }}</li>
{% if schedules %}
<li class="list-group-item list-group-item-{{ schedules.getStatus.backgroundColor }}">
<span style="font-weight: bold">Harmonogram: </span>
{% if schedules.isDone %}
wysłano: {{ schedules.getDateDone | date("d-m-Y H:i") }}
{% else %}
Pozostały czas: <span style="font-size: 1.2em">{{ schedules.getTimeLeft }}</span> dni
{% endif %}
</li>
{% endif %}
</ul>
<div class="card-footer">
<div class='edit-client-group'>
{% if is_granted('reportView') %}
<div>
<a href="{{ path('app_base',{clientId: client.id}) }}" class="btn btn-outline-info">Wyświetl sprawozdania</a>
</div>
{% endif %}
{% if is_granted('reportEdit') %}
<div>
<form action="{{ path('app_set_complete',{id: client.id}) }}" method="post">
<input type="hidden" name="isComplete" value="1">
<input type="hidden" name="token" value="{{ csrf_token("set-complete-item") }}">
<button class="btn btn-outline-warning" type="submit">
{% if client.isComplete %}
Wznów
{% else %}
Zakończ
{% endif %}
</button>
</form>
</div>
{% endif %}
{% if not client.isComplete and is_granted('clientEdit') %}
<div>
<a href="{{ path('app_add_client',{id: client.id}) }}" class="btn btn-outline-success">Edytuj</a>
</div>
{% endif %}
{% if is_granted('clientDelete') %}
<div>
<button class="btn btn-outline-danger" type="button" data-bs-toggle="modal" data-bs-target="#removeConfirmModal">Usuń</button>
</div>
{% endif %}
</div>
</div>
</div>
{% if is_granted('reportView') %}
<div class="card text-center bg-light-subtle">
<div class="card-header">
<h2>Sprawozdania</h2>
{% if not client.isComplete and is_granted('reportEdit') %}
<form action="{{ path('app_add_next_report') }}" method="post">
<input type="hidden" name="clientId" value="{{ client.id }}">
<input type="hidden" name="token" value="{{ csrf_token('add-next-report') }}">
<button type="submit" class="btn btn-outline-primary">Dodaj następne sprawozdanie</button>
</form>
{% endif %}
</div>
<div class="card-body">
<ul class="list-group list-group-flush">
{% for report in reports %}
<li class="list-group-item d-flex align-items-center"
data-action="click->customer-show#showModal"
data-customer-show-reportid-param="{{ report.id }}"
data-customer-show-date-param="{{ report.getDateStart | date("Y-m-d") }}"
>
<span class="badge rounded-pill text-bg-primary">{{ report.number }}</span>
<span class="badge rounded-pill text-bg-light">{{ report.getDateStart | date("Y-m-d") }}</span>
{% for todo in report.getReportsTodos %}
{% if report.isReportsTodo(todo.getName) %}
<span class="badge rounded-pill text-bg-{{ todo.getName.backgroundColor }}">
<i class="fa fa-solid fa-{{ todo.getName.takeIcon }}"> </i> {{ todo.getName.takeLang }}
</span>
{% endif %}
{% endfor %}
</li>
{% endfor %}
</ul>
</div>
</div>
{% endif %}
</div>
<div class="col">
<div class="card">
<div class="card-header text-center"><h2>Notatka</h2></div>
{% if notes %}
<div class="card-body">
<p>
{% apply markdown_to_html %}
{{ notes.description }}
{% endapply %}
</p>
</div>
{% endif %}
{% if not client.isComplete and is_granted('clientEdit') %}
<div class="card-footer text-center">
<a href="{{ path('app_edit_client_note',{clientId: client.id}) }}" class="btn btn-success">Edytuj</a>
</div>
{% endif %}
</div>
<div class="card">
<div class="card-header text-center"><h2>Oznaczenie</h2></div>
<div class="card-body">
<form action="{{ path('app_client_highlight',{id: client.id}) }}" method="post">
<input type="hidden" name="token" value="{{ csrf_token('client-highlight') }}">
{% for status in highlightStatus %}
<button type="submit" name="highlight_id" value="{{ status.value }}" class="btn btn-{{ status.borderColor }}">
{{ status.buttonLang }}
</button>
{% endfor %}
</form>
</div>
</div>
</div>
</div>
<div class="modal fade" id="removeConfirmModal" tabindex="-1" aria-labelledby="removeConfirmModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h1 class="modal-title fs-5" id="removeConfirmModalLabel">Czy na pewno chcesz usunąć tego klienta?</h1>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
Usunięcie klienta spowoduje wyczyszczenie wszystkich informacji z nim związanych (w tym sprawozdania, harmonogramy).<br>
<h3>Tej operacji nie można cofnąć!</h3>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
<form action="{{ path('app_client',{id:client.id}) }}" method="post">
<input type="hidden" name="token" value="{{ csrf_token('delete-item') }}">
<input type="hidden" name="toDelete" value="1">
<input type="hidden" name="backUrl" value="{{ backUrl }}">
<button type="submit" class="btn btn-danger">Usuń</button>
</form>
</div>
</div>
</div>
</div>
<div class="modal fade" id="showReportModal" tabindex="-1" aria-labelledby="showReportModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h1 class="modal-title fs-5" id="showReportModalLabel"></h1>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
</div>
</div>
</div>
</div>
<div id="allCardsReport">
{% for report in reports %}
{{ sets.cardView(report, reportStatus, reportToDoList) }}
{% endfor %}
</div>
</div>
{% endblock %}