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

102 lines
5.3 KiB
Twig

{% macro statusForm(report,reportToDoList,reportEnum) %}
<form action="{{ path('app_set_status_todo',{id:report.id}) }}" method="post">
<input type="hidden" name="token" value="{{ csrf_token('report-status') }}">
<div class="btn-group" role="group" aria-label="Todos">
{% for todo in reportToDoList %}
<button type="submit" class="btn-check" name="{{ todo.value }}" value='1' id="checkboxToDo{{ todo.value }}Id{{ report.id }}"></button>
<label class="btn
{% if report.isReportsTodo(todo) %}
btn-{{ reportEnum.checkboxColor }}
{% else %}
btn-outline-{{ reportEnum.checkboxColor }}
{% endif %}
d-flex align-items-center"
for="checkboxToDo{{ todo.value }}Id{{ report.id }}"
data-toggle="tooltip" data-placement="bottom" title="{{ todo.takeLang }}">
<i class="fa fa-solid fa-{{ todo.takeIcon }}"> </i>
</label>
{% endfor %}
</div>
</form>
{% endmacro %}
{% macro progress(report, countAllTodos) %}
<div class="progress">
{% set percentageProgress = report.isDone ? 100 : report.countTodoReports / countAllTodos * 100 %}
<div class="progress-bar progress-bar-striped bg-info"
role="progressbar"
aria-valuenow="{{ report.countTodoReports }}"
aria-valuemin="0"
aria-valuemax="{{ countAllTodos }}"
style="width: {{ percentageProgress }}%"
>
<strong>{{ percentageProgress }}%</strong>
</div>
</div>
{% endmacro %}
{% macro cardView(report, groupStatus, reportToDoList, highlightStatus) %}
<div class="card text-{{ groupStatus.textColor }} report-one {{ groupStatus.name | lower }} border-{{ report.client.highlight.borderColor }}" data-report_id="{{ report.id }}">
<div class="report-number" data-bs-toggle="modal" data-bs-target="#editSchedule{{ report.id }}">
<div class="badge bg-{{ groupStatus.takeBadgeBg }} text-dark" data-toggle="tooltip" data-placement="bottom" title="Numer sprawozdania">{{ report.number }}</div>
</div>
{% if enum(groupStatus, 'COMPLETE') and false %}
<div class="report-mark-uncompleted">
<form action="{{ path('app_set_status_todo',{id:report.id}) }}" method="post">
<input type="hidden" name="token" value="{{ csrf_token('report-status') }}">
<input type="hidden" name="unDone" value="1">
<button type="submit" class="badge bg-danger" data-toggle="tooltip" data-placement="bottom" title="Oznacz jako nie zakończone"><i class="fa fa-solid fa-remove"></i></button>
</form>
</div>
{% endif %}
<div class="card-header bg-{{ report.highlight.borderColor }}">
<h5 class="card-title">
{% if is_granted('clientView') %}
<a href="{{ path('app_client',{id: report.client.id}) }}" >{{ report.client.strName }}</a>
{% else %}
{{ report.client.strName }}
{% endif %}
</h5>
</div>
{# {% if not enum(groupStatus, 'COMPLETE') %}#}
<div class="card-body">
<p class="card-text">{{ _self.statusForm(report, reportToDoList, groupStatus) }}</p>
{% if is_granted('reportEdit') and not report.isEmailSend %}
<a class="btn btn-sm btn-outline-primary" href="{{ getMailtoLink(report) }}">Wyślij maila</a>
{% endif %}
</div>
{# {% endif %}#}
{% if enum(groupStatus, 'WORKING') %}
<div class="card-footer bg-transparent">
{{ _self.progress(report, reportToDoList|length) }}
</div>
{% endif %}
</div>
<!-- Modal -->
<div class="modal fade" id="editSchedule{{ report.id }}" tabindex="-1" aria-labelledby="editSchedule{{ report.id }}Label" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h1 class="modal-title fs-5" id="exampleModalLabel">Ustaw wyróżnienie sprawozdania</h1>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<form action="{{ path('app_report_highlight',{id: report.id}) }}" method="post">
<input type="hidden" name="token" value="{{ csrf_token('schedule-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 class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Zamknij</button>
{# <button type="button" class="btn btn-primary">Save changes</button>#}
</div>
</div>
</div>
</div>
{% endmacro %}