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

76 lines
3.5 KiB
Twig

{% extends 'administrative/layout.html.twig' %}
{% block title %}Bewertungen nach Destination{% endblock %}
{% block content %}
<div class="flex items-start justify-between pb-4">
<h1 class="text-2xl font-bold">
Bewertungen nach 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>
<p class="text-sm text-gray-600 mb-4">
Zeitraum: {{ filterDto.effectiveDateFrom|date('d.m.Y') }} &ndash; {{ filterDto.effectiveDateTo|date('d.m.Y') }}
<span class="text-gray-400">
{% if filterDto.usingDefaultRange %}(Standard: letzte 12 Monate){% else %}(Filter aktiv){% endif %}
</span>
</p>
{% if destinations 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">
<div class="overflow-x-auto">
<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>
{% for feedbackSet in feedbackSets %}
<th class="px-4 py-3 text-center font-semibold">{{ feedbackSet.name }}</th>
{% endfor %}
</tr>
</thead>
<tbody>
{% for code, data in destinations %}
<tr class="border-b hover:bg-gray-50">
<td class="px-4 py-3 font-medium">{{ code }}</td>
{% for feedbackSetId, feedbackSet in feedbackSets %}
<td class="px-4 py-3 text-center">
{% if data[feedbackSetId] is defined %}
{% set avg = data[feedbackSetId].average %}
{% set count = data[feedbackSetId].count %}
<span class="font-semibold {% if avg >= 4 %}text-green-600{% elseif avg >= 3 %}text-yellow-600{% else %}text-red-600{% endif %}">
{{ avg|number_format(2, ',', '.') }}
</span>
<span class="text-gray-400 text-xs">({{ count }})</span>
{% else %}
<span class="text-gray-300">-</span>
{% endif %}
</td>
{% endfor %}
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
{% endif %}
{% endblock %}