Files
myep/templates/booking/_participant_card.html.twig
T

72 lines
4.0 KiB
Twig

{# Compact participant card with name, room, price, and edit button #}
{% set isCanceled = cardData.isCanceled is defined ? cardData.isCanceled : false %}
{% set isValid = cardData.isValid is defined ? cardData.isValid : true %}
{% set isSubmitted = isSubmitted|default(false) %}
{% set mode = mode|default('create') %}
{# Determine display states #}
{% set showAsError = not isValid and isSubmitted %}
{% set showAsIncomplete = not isValid and not isSubmitted %}
{# Build edit URL for linking #}
{% if mode == 'edit' %}
{% set editUrl = path('app_booking_edit_participant', {id: bookingId, index: index}) %}
{% else %}
{% set editUrl = path('app_booking_create_step_2_participant', {index: index}) %}
{% endif %}
<div class="py-4" id="participant-card-{{ index }}">
<div class="flex items-start space-x-4">
<div class="{{ html_classes('w-12 h-12 inline-flex flex-shrink-0 items-center justify-center rounded-full text-white font-bold', {
'bg-primary-dark': not showAsError and booking_theme() == 'base',
'bg-sbw-primary': not showAsError and booking_theme() == 'sbw',
'bg-snz-primary-dark': not showAsError and booking_theme() == 'snz',
'bg-ser-primary': not showAsError and booking_theme() == 'ser',
'bg-red-500': showAsError,
'text-2xl': participantNumber < 100,
'text-xl': participantNumber >= 100,
}) }}">
{{ participantNumber }}
</div>
<div class="flex-1 leading-5">
<div class="{{ html_classes('font-semibold mb-1', { 'italic': showAsIncomplete }) }}">
{% if isCanceled %}
{{ cardData.name }}
{% else %}
<a href="{{ editUrl }}" class="hover:underline">{{ cardData.name }}</a>
{% endif %}
</div>
{% if isCanceled %}
<div class="text-xs font-medium text-gray-700" {{ qa_attribute('participant-canceled', index) }}>
storniert
</div>
{% elseif showAsError %}
<div class="text-xs font-medium text-red-500" {{ qa_attribute('participant-invalid', index) }}>
unvollständige/fehlerhafte Daten
</div>
{% else %}
<div class="text-gray-600" {{ qa_attribute('participant-room-name', index) }}>
{{ cardData.roomName }}
<br>
{% if cardData.price.showDash %}
-
{% elseif cardData.isCanceled %}
{{ cardData.price.amount|format_currency('EUR') }} Stornokosten
{% else %}
{{ cardData.price.amount|format_currency('EUR') }}
{% endif %}
</div>
{% endif %}
</div>
<div class="flex flex-col justify-center">
{% if not isCanceled %}
<a href="{{ editUrl }}"
class="button button--small button--primary"
{{ qa_attribute('btn-edit-participant', index) }}>
<svg class="w-6 h-6" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256"><rect width="256" height="256" fill="none"/><path d="M92.69,216H48a8,8,0,0,1-8-8V163.31a8,8,0,0,1,2.34-5.65L165.66,34.34a8,8,0,0,1,11.31,0L221.66,79a8,8,0,0,1,0,11.31L98.34,213.66A8,8,0,0,1,92.69,216Z" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="16"/><line x1="136" y1="64" x2="192" y2="120" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="16"/><line x1="164" y1="92" x2="68" y2="188" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="16"/><line x1="95.49" y1="215.49" x2="40.51" y2="160.51" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="16"/></svg>
</a>
{% endif %}
</div>
</div>
</div>