Files
myep-team/templates/administrative/statistics/feedback_by_destination.html.twig
T

96 lines
5.0 KiB
Twig

{% extends 'administrative/layout.html.twig' %}
{% block title %}Feedback pro Destination{% endblock %}
{% block content %}
<div class="flex items-start justify-between pb-4">
<h1 class="text-2xl font-bold">
Feedback pro Destination
</h1>
</div>
<div class="bg-white rounded-lg shadow p-4 mb-8">
{{ form_start(form, { attr: { class: 'flex flex-wrap items-end gap-4' } }) }}
<div class="flex-1 min-w-[150px]">
{{ form_row(form.dateFrom) }}
</div>
<div class="flex-1 min-w-[150px]">
{{ form_row(form.dateTo) }}
</div>
<div class="flex gap-2">
{{ form_widget(form.apply, { attr: { class: 'btn btn--small' } }) }}
{{ form_widget(form.reset, { attr: { class: 'btn btn--small btn--secondary' } }) }}
</div>
{{ form_end(form) }}
</div>
{% if filterDto.active %}
<p class="text-sm text-gray-600 mb-4">
Filter aktiv:
{% if filterDto.dateFrom %}von {{ filterDto.dateFrom|date('d.m.Y') }}{% endif %}
{% if filterDto.dateTo %}bis {{ filterDto.dateTo|date('d.m.Y') }}{% endif %}
</p>
{% endif %}
{% if statistics is empty %}
<div class="bg-white rounded-lg shadow p-8 text-center text-gray-500">
Keine Daten im ausgewählten Zeitraum vorhanden.
</div>
{% else %}
<div class="bg-white rounded-lg shadow overflow-hidden">
<table class="w-full text-sm">
<thead>
<tr class="bg-gray-50 border-b">
<th class="px-4 py-3 text-left font-semibold">Destination</th>
<th class="px-4 py-3 text-right font-semibold">Erwartet</th>
<th class="px-4 py-3 text-right font-semibold">Abgegeben</th>
<th class="px-4 py-3 text-right font-semibold">Fehlend</th>
<th class="px-4 py-3 text-right font-semibold">Quote</th>
</tr>
</thead>
<tbody>
{% for stat in statistics %}
<tr class="border-b hover:bg-gray-50">
<td class="px-4 py-3 font-medium">{{ stat.hotelCode }}</td>
<td class="px-4 py-3 text-right">{{ stat.totalDispositions }}</td>
<td class="px-4 py-3 text-right">{{ stat.providedFeedbacks }}</td>
<td class="px-4 py-3 text-right">{{ stat.missingFeedbacks }}</td>
<td class="px-4 py-3 text-right">
<span class="{{ html_classes('inline-flex items-center px-2 py-0.5 rounded text-xs font-medium', {
'bg-green-100 text-green-800': stat.percentageProvided >= 80,
'bg-yellow-100 text-yellow-800': stat.percentageProvided >= 50 and stat.percentageProvided < 80,
'bg-red-100 text-red-800': stat.percentageProvided < 50
}) }}">{{ stat.percentageProvided|number_format(1, ',', '.') }}%</span>
</td>
</tr>
{% endfor %}
</tbody>
<tfoot>
{% set totalExpected = 0 %}
{% set totalProvided = 0 %}
{% set totalMissing = 0 %}
{% for stat in statistics %}
{% set totalExpected = totalExpected + stat.totalDispositions %}
{% set totalProvided = totalProvided + stat.providedFeedbacks %}
{% set totalMissing = totalMissing + stat.missingFeedbacks %}
{% endfor %}
{% set totalPercentage = totalExpected > 0 ? (totalProvided / totalExpected * 100) : 0 %}
<tr class="bg-gray-100 font-semibold">
<td class="px-4 py-3">Gesamt</td>
<td class="px-4 py-3 text-right">{{ totalExpected }}</td>
<td class="px-4 py-3 text-right">{{ totalProvided }}</td>
<td class="px-4 py-3 text-right">{{ totalMissing }}</td>
<td class="px-4 py-3 text-right">
<span class="{{ html_classes('inline-flex items-center px-2 py-0.5 rounded text-xs font-medium', {
'bg-green-100 text-green-800': totalPercentage >= 80,
'bg-yellow-100 text-yellow-800': totalPercentage >= 50 and totalPercentage < 80,
'bg-red-100 text-red-800': totalPercentage < 50
}) }}">{{ totalPercentage|number_format(1, ',', '.') }}%</span>
</td>
</tr>
</tfoot>
</table>
</div>
{% endif %}
{% endblock %}