Files
myep-team/templates/administrative/questionnaire/detail.html.twig
T

63 lines
3.8 KiB
Twig

{% extends 'administrative/layout.html.twig' %}
{% block title %}{{ definition.title }}{% if response.leg %}: {{ response.leg.label }}{% endif %}{% endblock %}
{% block content %}
{% set context = response.context %}
<a href="{{ returnUrl }}" class="inline-flex items-center gap-x-1 pb-4 text-sm font-bold text-brand hover:text-brand-dark">
{{ icon('arrow-left', 'w-4 h-4 shrink-0') }}
<span>zurück</span>
</a>
<h1 class="text-2xl font-bold pb-1">
{{ definition.title }}{% if response.leg %}: {{ response.leg.label }}{% endif %}
</h1>
<p class="pb-6 text-muted">
{{ response.destination ? context.destinationProduct|default('-') : context.teamerName|default('-') }}, abgeschickt am {{ response.submittedAt|date('d.m.Y, H:i') }} Uhr
</p>
<div class="grid lg:grid-cols-3 gap-6 items-start">
<div class="lg:col-span-2">
{% include 'questionnaire/_answers.html.twig' with { 'answers': response.answers, 'context': context } %}
</div>
<aside class="card p-5">
{# the snapshot taken on submit, so it shows the placement or travel as it was answered for #}
<h2 class="section-title pb-3">
{{ response.destination ? 'Reise' : 'Einsatz' }}
</h2>
<dl class="grid grid-cols-[minmax(0,8rem)_minmax(0,1fr)] gap-x-4 gap-y-2">
{% for label, value in response.destination ? {
'Destination': context.destinationProduct|default(null),
'Haus': context.hotel|default(null) ? context.hotel ~ ' (' ~ context.hotelCode ~ ')' : null,
'Reisetermin': context.dateFrom|default(null) ? context.dateFrom|date('d.m.Y') ~ ' - ' ~ context.dateTo|date('d.m.Y') : null,
'Wochenteam': context.teamers|default([])|map(teamer => teamer.name ~ ' (' ~ teamer.jobProfileName ~ ')')|join(', ') ?: null,
'Abgeschickt von': response.updatedBy ?? response.createdBy,
} : {
'Teamer:in': context.teamerName|default(null),
'Jobprofil': context.jobProfileName|default(null),
'Destination': context.destinationProduct|default(null),
'Haus': context.hotel|default(null) ? context.hotel ~ ' (' ~ context.hotelCode ~ ')' : null,
'Einsatztermin': context.dateFrom|default(null) ? context.dateFrom|date('d.m.Y') ~ ' - ' ~ context.dateTo|date('d.m.Y') : null,
'Busbegleitung ab': context.escortPickup|default(null) ? context.escortPickup.city ~ ', ' ~ context.escortPickup.street ~ (context.escortPickup.time ? ', ' ~ context.escortPickup.time ~ ' Uhr' : '') : null,
'Abfahrt Hinfahrt': context.escortPickupDate|default(null) ? context.escortPickupDate|date('d.m.Y') : null,
} %}
<dt class="text-muted">{{ label }}</dt>
<dd class="break-words">{{ (value ?? '-') }}</dd>
{% endfor %}
</dl>
{% if siblings is not empty %}
<h2 class="section-title mt-5 border-t border-line pt-4 pb-2">
Zum selben Einsatz
</h2>
<ul class="flex flex-col gap-y-1">
{% for sibling in siblings %}
<li>
<a href="{{ path('app_administrative_questionnaire_detail', { 'uuid': sibling.response.uuid, 'r': app.request.query.get('r') }) }}" class="font-bold text-brand underline underline-offset-2 hover:text-brand-dark">
{{ sibling.title }}{% if sibling.response.leg %}: {{ sibling.response.leg.label }}{% endif %}
</a>
</li>
{% endfor %}
</ul>
{% endif %}
</aside>
</div>
{% endblock %}