feat: correct determination of inquiry status and conditional voucher field display
This commit is contained in:
1 parent
85998534fe
commit
1f2f2751e4
19 files changed
+468
-193
No files matched your search
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Form\Service\Condition;
|
||||
|
||||
use App\Form\Model\BookingDto;
|
||||
use App\Form\Service\Contract\FieldConditionInterface;
|
||||
|
||||
/**
|
||||
* Condition that checks if the booking is a final booking (not an inquiry).
|
||||
*
|
||||
* This condition is used to exclude certain fields (like vouchers) from inquiry
|
||||
* bookings where they are not applicable. When a booking has inquiry status ('A'),
|
||||
* fields with this condition will be excluded from the form.
|
||||
*/
|
||||
class FinalBookingOnlyCondition implements FieldConditionInterface
|
||||
{
|
||||
/**
|
||||
* Evaluates if the booking is a final booking.
|
||||
*
|
||||
* @param BookingDto $bookingDto The current booking data (create or edit)
|
||||
* @param int $participantIndex The index of the participant being evaluated
|
||||
* @param array<string, mixed> $formData Current form data (unused)
|
||||
*
|
||||
* @return bool True if booking status is 'F' (final), false if 'A' (inquiry)
|
||||
*/
|
||||
public function evaluate(BookingDto $bookingDto, int $participantIndex, array $formData): bool
|
||||
{
|
||||
return 'F' === $bookingDto->bookingStatus;
|
||||
}
|
||||
|
||||
public function getDependentFields(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Only available for final bookings (not inquiry bookings)';
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user