feat: indicate incomplete participant data in cards
This commit is contained in:
@@ -97,10 +97,8 @@ class Step2Controller extends AbstractController
|
||||
return $this->redirectToRoute('app_booking_create_step_3');
|
||||
}
|
||||
|
||||
// Generate cards data with validation state if form was submitted and failed
|
||||
$cardsData = (true === $form->isSubmitted() && false === $form->isValid())
|
||||
? $this->participantCardService->getAllCardsDataWithValidation($bookingCreateDto)
|
||||
: $this->generateAllCardsData($bookingCreateDto);
|
||||
// Always generate card data with validation state to show completeness
|
||||
$cardsData = $this->participantCardService->getAllCardsDataWithValidation($bookingCreateDto);
|
||||
|
||||
// Get complete summary data (pricing, rooms, CMS data)
|
||||
$summaryData = $this->summaryDataService->getSummaryData($bookingCreateDto);
|
||||
|
||||
@@ -99,10 +99,8 @@ class IndexController extends AbstractController
|
||||
return $this->handleFormSubmission($request, $bookingDto, $id, $email);
|
||||
}
|
||||
|
||||
// Generate card data for all participants with validation state if form was submitted and failed
|
||||
$cardsData = (true === $form->isSubmitted() && false === $form->isValid())
|
||||
? $this->participantCardService->getAllCardsDataWithValidation($bookingDto)
|
||||
: $this->participantCardService->getAllCardsData($bookingDto);
|
||||
// Always generate card data with validation state to show completeness
|
||||
$cardsData = $this->participantCardService->getAllCardsDataWithValidation($bookingDto);
|
||||
|
||||
// Get complete summary data (pricing, rooms, CMS data)
|
||||
$summaryData = $this->summaryDataService->getSummaryData($bookingDto);
|
||||
@@ -115,6 +113,7 @@ class IndexController extends AbstractController
|
||||
'cardsData' => $cardsData,
|
||||
'summaryData' => $summaryData,
|
||||
'isDirty' => $this->fingerprintService->isDirty($bookingDto),
|
||||
'isSubmitted' => $form->isSubmitted(),
|
||||
'hasValidationErrors' => $form->isSubmitted() && false === $form->isValid(),
|
||||
];
|
||||
|
||||
|
||||
@@ -1,23 +1,38 @@
|
||||
{# 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 errorMessages = cardData.errorMessages|default([]) %}
|
||||
{% 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 text-2xl font-bold', { 'bg-primary-dark': isValid, 'bg-red-500': not isValid }) }}">
|
||||
<div class="{{ html_classes('w-12 h-12 inline-flex flex-shrink-0 items-center justify-center rounded-full text-white text-2xl font-bold', { 'bg-primary-dark': not showAsError, 'bg-red-500': showAsError }) }}">
|
||||
{{ participantNumber }}
|
||||
</div>
|
||||
<div class="flex-1 leading-5">
|
||||
<div class="font-semibold mb-1">
|
||||
{{ cardData.name }}
|
||||
<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 not isValid %}
|
||||
{% elseif showAsError %}
|
||||
<div class="text-xs font-medium text-red-500" {{ qa_attribute('participant-invalid', index) }}>
|
||||
unvollständige/fehlerhafte Daten
|
||||
</div>
|
||||
@@ -31,12 +46,7 @@
|
||||
</div>
|
||||
<div class="flex flex-col justify-center">
|
||||
{% if not isCanceled %}
|
||||
{% if mode == 'edit' %}
|
||||
{% set url = path('app_booking_edit_participant', {id: bookingId, index: index}) %}
|
||||
{% else %}
|
||||
{% set url = path('app_booking_create_step_2_participant', {index: index}) %}
|
||||
{% endif %}
|
||||
<a href="{{ url }}"
|
||||
<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>
|
||||
|
||||
@@ -50,7 +50,8 @@
|
||||
'cardData': cardData,
|
||||
'index': loop.index0,
|
||||
'participantNumber': loop.index,
|
||||
'mode': 'create'
|
||||
'mode': 'create',
|
||||
'isSubmitted': isSubmitted
|
||||
} %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
@@ -71,8 +71,9 @@
|
||||
'index': loop.index0,
|
||||
'participantNumber': loop.index,
|
||||
'mode': 'edit',
|
||||
'bookingId': bookingData.id,
|
||||
'isCanceled': isCanceled,
|
||||
'bookingId': bookingData.id
|
||||
'isSubmitted': isSubmitted,
|
||||
} %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user