feat: filter documents

This commit is contained in:
Björn Fromme
2024-08-27 12:38:19 +02:00
parent 5ac77e9e9c
commit bcaab582cc
12 changed files with 476 additions and 191 deletions
+119 -97
View File
@@ -3,104 +3,126 @@
{% block title %}Dokumentenübersicht{% endblock %}
{% block content %}
<h1 class="text-2xl font-bold pb-8">
<div class="flex items-start justify-between pb-4">
<h1 class="text-2xl font-bold">
Dokumentenübersicht
</h1>
<div class="data-table-wrapper">
<div class="data-table-wrapper__inner">
<table class="data-table">
<thead>
<tr>
<th>
{{ knp_pagination_sortable(pagination, 'Einsatz&shy;zeitraum', 'destination.dateFrom') }}
</th>
<th>
{{ knp_pagination_sortable(pagination, 'Destination', 'destination.product') }}
</th>
<th>
{{ knp_pagination_sortable(pagination, 'Jobprofil', 'job_profile.name') }}
</th>
<th>
{{ knp_pagination_sortable(pagination, 'Dokument', 'upload.type') }}
</th>
<th>
{{ knp_pagination_sortable(pagination, 'Teamer:in', 'teamer.lastName') }}
</th>
<th>
{{ knp_pagination_sortable(pagination, 'Status', 'upload.status') }}
</th>
<th></th>
</tr>
</thead>
<tbody>
{% for upload in pagination %}
{% set disposition = upload.disposition %}
{% set assignment = disposition.assignment %}
<tr>
<td>
{{ assignment.destination.dateFrom|date('d.m.Y') }}
-
{{ assignment.destination.dateTo|date('d.m.Y') }}
</td>
<td>
<div class="flex items-start space-x-2">
{{ icon('flag-' ~ assignment.destination.country, 'w-5 h-5 shrink-0') }}
<div class="flex-1">
{{ assignment.destination.product }}
<br>
{{ assignment.destination.hotel }}
</div>
</div>
</td>
<td>
{{ assignment.jobProfile.name }}
</td>
<td>
{{ ('label.document.type.' ~ upload.type)|trans }}
</td>
<td>
{{ disposition.teamer }}
</td>
<td>
{{ upload.status|upload_status_badge }}
</td>
<td>
<div class="flex items-center space-x-2 justify-end">
{% if is_granted('DELETE', upload) %}
<button type="button"
class="text-red-500"
hx-get="{{ path('app_administrative_document_delete', { 'uuid': upload.uuid }) }}"
hx-target="body"
hx-swap="beforeend">
{{ icon('delete') }}
</button>
{% endif %}
{% if is_granted('CHECK', upload) %}
<button type="button"
hx-get="{{ path('app_administrative_document_check', { 'uuid': upload.uuid }) }}"
hx-target="body"
hx-swap="beforeend">
{{ icon('edit') }}
</button>
{% endif %}
<a href="{{ path('app_common_download', { 'uuid': upload.uuid, 'inline': true }) }}"
target="_blank"
title="Download">
{{ icon('eye') }}
</a>
</div>
</td>
</tr>
{% else %}
<tr>
<td colspan="7">
Keine Daten...
</td>
</tr>
{% endfor %}
</tbody>
</table>
{{ knp_pagination_render(pagination) }}
</div>
<div class="flex flex-col items-end space-y-2 md:flex-row md:items-center md:space-x-2 md:space-y-0">
<button type="button"
class="{{ html_classes('btn btn--small', { 'btn--secondary': filterDto.active }) }}"
title="Filter"
hx-get="{{ path('app_common_document_filter', { 'r': return_url() }) }}"
hx-target="body"
hx-swap="beforeend">
{{ icon('filter', 'w-4 h-4 shrink-0') }}
{% if filterDto.active %}
<span class="whitespace-nowrap">{{ filterDto.activeFiltersCount }} Filter aktiv</span>
{% else %}
<span>Filter</span>
{% endif %}
</button>
{% if filterDto.active %}
<a href="{{ path('app_common_document_filter_reset', { 'r': return_url() }) }}" class="btn btn--small btn--secondary">
Reset
</a>
{% endif %}
</div>
</div>
<div class="data-table-wrapper">
<div class="data-table-wrapper__inner">
<table class="data-table">
<thead>
<tr>
<th>
{{ knp_pagination_sortable(pagination, 'Einsatz&shy;zeitraum', 'destination.dateFrom') }}
</th>
<th>
{{ knp_pagination_sortable(pagination, 'Destination', 'destination.product') }}
</th>
<th>
{{ knp_pagination_sortable(pagination, 'Jobprofil', 'job_profile.name') }}
</th>
<th>
{{ knp_pagination_sortable(pagination, 'Dokument', 'upload.type') }}
</th>
<th>
{{ knp_pagination_sortable(pagination, 'Teamer:in', 'teamer.lastName') }}
</th>
<th>
{{ knp_pagination_sortable(pagination, 'Status', 'upload.status') }}
</th>
<th></th>
</tr>
</thead>
<tbody>
{% for upload in pagination %}
{% set disposition = upload.disposition %}
{% set assignment = disposition.assignment %}
<tr>
<td>
{{ assignment.destination.dateFrom|date('d.m.Y') }}
-
{{ assignment.destination.dateTo|date('d.m.Y') }}
</td>
<td>
<div class="flex items-start space-x-2">
{{ icon('flag-' ~ assignment.destination.country, 'w-5 h-5 shrink-0') }}
<div class="flex-1">
{{ assignment.destination.product }}
<br>
{{ assignment.destination.hotel }}
</div>
</div>
</td>
<td>
{{ assignment.jobProfile.name }}
</td>
<td>
{{ ('label.document.type.' ~ upload.type)|trans }}
</td>
<td>
{{ disposition.teamer }}
</td>
<td>
{{ upload.status|upload_status_badge }}
</td>
<td>
<div class="flex items-center space-x-2 justify-end">
{% if is_granted('DELETE', upload) %}
<button type="button"
class="text-red-500"
hx-get="{{ path('app_administrative_document_delete', { 'uuid': upload.uuid }) }}"
hx-target="body"
hx-swap="beforeend">
{{ icon('delete') }}
</button>
{% endif %}
{% if is_granted('CHECK', upload) %}
<button type="button"
hx-get="{{ path('app_administrative_document_check', { 'uuid': upload.uuid }) }}"
hx-target="body"
hx-swap="beforeend">
{{ icon('edit') }}
</button>
{% endif %}
<a href="{{ path('app_common_download', { 'uuid': upload.uuid, 'inline': true }) }}"
target="_blank"
title="Download">
{{ icon('eye') }}
</a>
</div>
</td>
</tr>
{% else %}
<tr>
<td colspan="7">
Keine Daten...
</td>
</tr>
{% endfor %}
</tbody>
</table>
{{ knp_pagination_render(pagination) }}
</div>
</div>
{% endblock %}
@@ -0,0 +1,19 @@
{% extends 'htmx_modal.html.twig' %}
{% block title %}Dokumente filtern{% endblock %}
{% block content %}
{{ form_start(filterForm, { 'attr': { 'hx-post': app.request.uri, 'hx-target': '#htmx-modal', 'hx-swap': 'outerHTML' } }) }}
<div class="flex flex-col space-y-2 pb-4">
{{ form_row(filterForm.type) }}
{{ form_row(filterForm.teamer) }}
{{ form_row(filterForm.dateFrom) }}
{{ form_row(filterForm.dateTo) }}
</div>
<div class="flex items-center space-x-2">
{{ form_widget(filterForm.apply, { 'attr': { 'class': 'btn' } }) }}
{{ form_widget(filterForm.reset, { 'attr': { 'class': 'btn btn--secondary' } }) }}
</div>
{{ form_rest(filterForm) }}
{{ form_end(filterForm) }}
{% endblock %}