64 lines
3.1 KiB
Twig
64 lines
3.1 KiB
Twig
{# Applicant block, shown only when the applicant does not travel along. #}
|
|
{% set isSubmitted = isSubmitted|default(false) %}
|
|
{% set applicantErrors = applicantErrors|default([]) %}
|
|
{% set isComplete = applicant is not null
|
|
and applicant.firstName is not empty
|
|
and applicant.lastName is not empty
|
|
and applicant.email is not empty
|
|
and applicant.mobile is not empty
|
|
and applicant.dateOfBirth is not null
|
|
and applicant.address is not null %}
|
|
{% set showAsError = applicantErrors is not empty or (not isComplete and isSubmitted) %}
|
|
|
|
<div class="mt-4 border-t border-gray-200 pt-4" id="applicant-card">
|
|
<div class="font-bold pb-2">Anmelder:in</div>
|
|
|
|
{% if applicantErrors is not empty %}
|
|
<ul class="mb-2 list-disc pl-5 text-sm text-red-500" {{ qa_attribute('applicant-errors') }}>
|
|
{% for message in applicantErrors %}
|
|
<li>{{ message }}</li>
|
|
{% endfor %}
|
|
</ul>
|
|
{% endif %}
|
|
|
|
{% if is_granted('IS_AUTHENTICATED_FULLY') %}
|
|
{# Logged in: the data comes from the account. Editing it here would create a duplicate
|
|
BusPro record, which is the same reason participant[0] is static when they travel. #}
|
|
<div class="text-sm leading-5" {{ qa_attribute('applicant-static') }}>
|
|
{% if applicant is not null and applicant.firstName is not empty %}
|
|
<div>{{ applicant.firstName }} {{ applicant.lastName }}</div>
|
|
{% if applicant.address is not null %}
|
|
<div>{{ applicant.address.street }}</div>
|
|
<div>{{ applicant.address.postCode }} {{ applicant.address.city }}</div>
|
|
{% endif %}
|
|
<div>{{ applicant.email }}</div>
|
|
{% if applicant.mobile is not empty %}<div>{{ applicant.mobile }}</div>{% endif %}
|
|
{% else %}
|
|
<div class="italic text-gray-600">Deine Daten werden aus deinem Konto übernommen.</div>
|
|
{% endif %}
|
|
</div>
|
|
{% else %}
|
|
<div class="flex items-start justify-between gap-4">
|
|
<div class="{{ html_classes('text-sm leading-5', { 'italic': not isComplete }) }}"
|
|
{{ qa_attribute('applicant-summary') }}>
|
|
{% if isComplete %}
|
|
<div>{{ applicant.firstName }} {{ applicant.lastName }}</div>
|
|
<div>{{ applicant.address.postCode }} {{ applicant.address.city }}</div>
|
|
<div>{{ applicant.email }}</div>
|
|
{% elseif showAsError %}
|
|
<div class="font-medium text-red-500" {{ qa_attribute('applicant-invalid') }}>
|
|
unvollständige/fehlerhafte Angaben
|
|
</div>
|
|
{% else %}
|
|
<div class="text-gray-600">Bitte gib deine Kontaktdaten an.</div>
|
|
{% endif %}
|
|
</div>
|
|
<a href="{{ path('app_booking_create_applicant') }}"
|
|
class="button button--secondary shrink-0"
|
|
{{ qa_attribute('btn-edit-applicant') }}>
|
|
{{ isComplete ? 'Bearbeiten' : 'Angeben' }}
|
|
</a>
|
|
</div>
|
|
{% endif %}
|
|
</div>
|