major fixes

This commit is contained in:
2024-09-25 16:55:03 +02:00
parent e1cb68766e
commit 598acfd77c
12 changed files with 351 additions and 236 deletions
+156 -117
View File
@@ -1,132 +1,171 @@
{% import 'reports/listInclude.html.twig' as sets %}
{% extends 'base.html.twig' %}
{% block body %}
{% 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" style="display: inline-flex;margin: auto;">
{% if is_granted('reportEdit') %}
<form action="{{ path('app_set_complete',{id: client.id}) }}" method="post" style="padding: 0 5px;">
<input type="hidden" name="isComplete" value="1">
<input type="hidden" name="token" value="{{ csrf_token("set-complete-item") }}">
<button class="btn btn-warning" type="submit">
{% if client.isComplete %}
Wznów
{% else %}
Zakończ
{% endif %}
</button>
</form>
{% endif %}
{% if not client.isComplete and is_granted('clientEdit') %}
<a href="{{ path('app_add_client',{id: client.id}) }}" class="btn btn-success">Edytuj</a>
{% endif %}
{% if is_granted('clientDelete') %}
<button class="btn btn-danger" type="button" data-bs-toggle="modal" data-bs-target="#removeConfirmModal">Usuń</button>
{% endif %}
</div>
</div>
{% if is_granted('reportView') %}
<div class="card text-center bg-light-subtle">
<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>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-primary">Dodaj następne sprawozdanie</button>
</form>
{% endif %}
<h2>{{ client.strName }}</h2>
</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">
<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>
<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 %}
{% for todo in report.getReportsTodos %}
{% if report.isReportsTodo(todo.getName) %}
<span class="badge rounded-pill text-bg-{{ todo.getName.backgroundColor }}">
{% 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>
{% endif %}
{% endfor %}
</li>
{% endfor %}
</ul>
</div>
</div>
{% endif %}
</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 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>
</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 %}
@@ -1,8 +1,18 @@
{% macro month_menu(routeName, months, currentMonth, countOverdueLeft) %}
{% macro month_menu(routeName, months, currentMonth, countOverdueLeft, clientId, client) %}
{% if client %}
<div class="row justify-content-center">
<div class="alert alert-info col-3 text-center " role="alert">
<h5 class="alert-heading"><strong>{{ client.strName }}</strong></h5>
<p>
<a href="{{ path(routeName,{monthId: 0}) }}" class="btn btn-outline-warning">Wróć do wszystkich</a>
</p>
</div>
</div>
{% endif %}
<div class="row reports-months-all">
<ul class="nav nav-underline nav-fill">
<li class="nav-item position-relative">
<a href="{{ path(routeName, {monthId:-1}) }}" class="nav-link {% if currentMonth is null %}active{% endif %}">Zaległe</a>
<a href="{{ path(routeName, {monthId:-1, clientId:clientId}) }}" class="nav-link {% if currentMonth is null %}active{% endif %}">Zaległe</a>
{% if countOverdueLeft > 0 %}
<div class="spinner-grow spinner-grow-sm text-danger overdue"></div>
{% endif %}
@@ -15,7 +25,7 @@
data-toggle="tooltip" data-bs-placement="bottom" title="Zaległe sprawozdania do zrobienia"
{% endif %}
>
<a class="nav-link {% if isCurrent %} active{% endif %}" href="{{ path(routeName,{monthId: id}) }}">
<a class="nav-link {% if isCurrent %} active{% endif %}" href="{{ path(routeName,{monthId: id, clientId:clientId}) }}">
{% if routeName=='app_schedule' %}
{{ id }}
{% else %}
+2 -36
View File
@@ -2,7 +2,7 @@
{% import 'navigation/switch_months.html.twig' as navigation %}
{% import 'reports/listInclude.html.twig' as sets %}
{% block body %}
{{ navigation.month_menu('app_base',months,currentMonth,countOverdueLeft) }}
{{ navigation.month_menu('app_base',months,currentMonth,countOverdueLeft,clientId,client) }}
<div class="
row
d-flex
@@ -17,41 +17,7 @@
<h3 class="card-header">{{ reports.status.takeLang }}</h3>
<div class="card-body">
{% for report in reports.reports %}
<div class="card text-{{ reports.status.textColor }} report-one {{ reports.status.name | lower }}">
<div class="report-number">
<div class="badge bg-{{ reports.status.takeBadgeBg }} text-dark" data-toggle="tooltip" data-placement="bottom" title="Numer sprawozdania">{{ report.number }}</div>
</div>
{% if enum(reports.status, '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">
<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(reports.status, 'COMPLETE') %}#}
<div class="card-body">
<p class="card-text">{{ sets.statusForm(report, reportToDoList, reports.status) }}</p>
</div>
{# {% endif %}#}
{% if enum(reports.status, 'WORKING') %}
<div class="card-footer bg-transparent">
{{ sets.progress(report, reportToDoList|length) }}
</div>
{% endif %}
</div>
{{ sets.cardView(report, reports.status, reportToDoList) }}
{% endfor %}
</div>
</div>
+36 -13
View File
@@ -4,19 +4,6 @@
<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>
{# <input onchange="this.form.submit()"#}
{# name="{{ todo.value }}"#}
{# type="checkbox"#}
{# class="btn-check"#}
{# id="checkboxToDo{{ todo.value }}Id{{ report.id }}"#}
{# {% if report.isReportsTodo(todo) %}#}
{# checked="checked"#}
{# {% endif %}#}
{# {% if not is_granted('reportEdit') %}#}
{# disabled#}
{# {% endif %}#}
{# autocomplete="off"#}
{# >#}
<label class="btn
{% if report.isReportsTodo(todo) %}
btn-{{ reportEnum.checkboxColor }}
@@ -46,4 +33,40 @@
<strong>{{ percentageProgress }}%</strong>
</div>
</div>
{% endmacro %}
{% macro cardView(report, groupStatus, reportToDoList) %}
<div class="card text-{{ groupStatus.textColor }} report-one {{ groupStatus.name | lower }}" data-report_id="{{ report.id }}">
<div class="report-number">
<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">
<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>
</div>
{# {% endif %}#}
{% if enum(groupStatus, 'WORKING') %}
<div class="card-footer bg-transparent">
{{ _self.progress(report, reportToDoList|length) }}
</div>
{% endif %}
</div>
{% endmacro %}