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');
|
return $this->redirectToRoute('app_booking_create_step_3');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generate cards data with validation state if form was submitted and failed
|
// Always generate card data with validation state to show completeness
|
||||||
$cardsData = (true === $form->isSubmitted() && false === $form->isValid())
|
$cardsData = $this->participantCardService->getAllCardsDataWithValidation($bookingCreateDto);
|
||||||
? $this->participantCardService->getAllCardsDataWithValidation($bookingCreateDto)
|
|
||||||
: $this->generateAllCardsData($bookingCreateDto);
|
|
||||||
|
|
||||||
// Get complete summary data (pricing, rooms, CMS data)
|
// Get complete summary data (pricing, rooms, CMS data)
|
||||||
$summaryData = $this->summaryDataService->getSummaryData($bookingCreateDto);
|
$summaryData = $this->summaryDataService->getSummaryData($bookingCreateDto);
|
||||||
|
|||||||
@@ -99,10 +99,8 @@ class IndexController extends AbstractController
|
|||||||
return $this->handleFormSubmission($request, $bookingDto, $id, $email);
|
return $this->handleFormSubmission($request, $bookingDto, $id, $email);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generate card data for all participants with validation state if form was submitted and failed
|
// Always generate card data with validation state to show completeness
|
||||||
$cardsData = (true === $form->isSubmitted() && false === $form->isValid())
|
$cardsData = $this->participantCardService->getAllCardsDataWithValidation($bookingDto);
|
||||||
? $this->participantCardService->getAllCardsDataWithValidation($bookingDto)
|
|
||||||
: $this->participantCardService->getAllCardsData($bookingDto);
|
|
||||||
|
|
||||||
// Get complete summary data (pricing, rooms, CMS data)
|
// Get complete summary data (pricing, rooms, CMS data)
|
||||||
$summaryData = $this->summaryDataService->getSummaryData($bookingDto);
|
$summaryData = $this->summaryDataService->getSummaryData($bookingDto);
|
||||||
@@ -115,6 +113,7 @@ class IndexController extends AbstractController
|
|||||||
'cardsData' => $cardsData,
|
'cardsData' => $cardsData,
|
||||||
'summaryData' => $summaryData,
|
'summaryData' => $summaryData,
|
||||||
'isDirty' => $this->fingerprintService->isDirty($bookingDto),
|
'isDirty' => $this->fingerprintService->isDirty($bookingDto),
|
||||||
|
'isSubmitted' => $form->isSubmitted(),
|
||||||
'hasValidationErrors' => $form->isSubmitted() && false === $form->isValid(),
|
'hasValidationErrors' => $form->isSubmitted() && false === $form->isValid(),
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@@ -1,23 +1,38 @@
|
|||||||
{# Compact participant card with name, room, price, and edit button #}
|
{# Compact participant card with name, room, price, and edit button #}
|
||||||
{% set isCanceled = cardData.isCanceled is defined ? cardData.isCanceled : false %}
|
{% set isCanceled = cardData.isCanceled is defined ? cardData.isCanceled : false %}
|
||||||
{% set isValid = cardData.isValid is defined ? cardData.isValid : true %}
|
{% set isValid = cardData.isValid is defined ? cardData.isValid : true %}
|
||||||
{% set errorMessages = cardData.errorMessages|default([]) %}
|
{% set isSubmitted = isSubmitted|default(false) %}
|
||||||
{% set mode = mode|default('create') %}
|
{% 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="py-4" id="participant-card-{{ index }}">
|
||||||
<div class="flex items-start space-x-4">
|
<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 }}
|
{{ participantNumber }}
|
||||||
</div>
|
</div>
|
||||||
<div class="flex-1 leading-5">
|
<div class="flex-1 leading-5">
|
||||||
<div class="font-semibold mb-1">
|
<div class="{{ html_classes('font-semibold mb-1', { 'italic': showAsIncomplete }) }}">
|
||||||
|
{% if isCanceled %}
|
||||||
{{ cardData.name }}
|
{{ cardData.name }}
|
||||||
|
{% else %}
|
||||||
|
<a href="{{ editUrl }}" class="hover:underline">{{ cardData.name }}</a>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
{% if isCanceled %}
|
{% if isCanceled %}
|
||||||
<div class="text-xs font-medium text-gray-700" {{ qa_attribute('participant-canceled', index) }}>
|
<div class="text-xs font-medium text-gray-700" {{ qa_attribute('participant-canceled', index) }}>
|
||||||
storniert
|
storniert
|
||||||
</div>
|
</div>
|
||||||
{% elseif not isValid %}
|
{% elseif showAsError %}
|
||||||
<div class="text-xs font-medium text-red-500" {{ qa_attribute('participant-invalid', index) }}>
|
<div class="text-xs font-medium text-red-500" {{ qa_attribute('participant-invalid', index) }}>
|
||||||
unvollständige/fehlerhafte Daten
|
unvollständige/fehlerhafte Daten
|
||||||
</div>
|
</div>
|
||||||
@@ -31,12 +46,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="flex flex-col justify-center">
|
<div class="flex flex-col justify-center">
|
||||||
{% if not isCanceled %}
|
{% if not isCanceled %}
|
||||||
{% if mode == 'edit' %}
|
<a href="{{ editUrl }}"
|
||||||
{% 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 }}"
|
|
||||||
class="button button--small button--primary"
|
class="button button--small button--primary"
|
||||||
{{ qa_attribute('btn-edit-participant', index) }}>
|
{{ 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>
|
<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,
|
'cardData': cardData,
|
||||||
'index': loop.index0,
|
'index': loop.index0,
|
||||||
'participantNumber': loop.index,
|
'participantNumber': loop.index,
|
||||||
'mode': 'create'
|
'mode': 'create',
|
||||||
|
'isSubmitted': isSubmitted
|
||||||
} %}
|
} %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -71,8 +71,9 @@
|
|||||||
'index': loop.index0,
|
'index': loop.index0,
|
||||||
'participantNumber': loop.index,
|
'participantNumber': loop.index,
|
||||||
'mode': 'edit',
|
'mode': 'edit',
|
||||||
|
'bookingId': bookingData.id,
|
||||||
'isCanceled': isCanceled,
|
'isCanceled': isCanceled,
|
||||||
'bookingId': bookingData.id
|
'isSubmitted': isSubmitted,
|
||||||
} %}
|
} %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user