feat: enable entering additional remarks in offer confirmation
This commit is contained in:
1 parent
582e54ddc4
commit
a5d97f1206
15 files changed
+387
-20
No files matched your search
@@ -10,9 +10,11 @@ use App\Enum\Groups\AccommodationBookingStatus;
|
||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\DateType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\EmailType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\EnumType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\IntegerType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Form\FormInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
/**
|
||||
@@ -57,6 +59,13 @@ class AccommodationBookingCreateType extends AbstractType
|
||||
],
|
||||
'choice_label' => fn (AccommodationBookingStatus $status) => $status->label(),
|
||||
])
|
||||
// Not marked required in HTML: a draft may be saved without it, and the
|
||||
// validation group below enforces it for everything else.
|
||||
->add('email', EmailType::class, [
|
||||
'label' => 'E-Mail',
|
||||
'required' => false,
|
||||
'help' => 'Für ein Angebot erforderlich — der Zugangslink und alle Benachrichtigungen gehen an diese Adresse.',
|
||||
])
|
||||
;
|
||||
}
|
||||
|
||||
@@ -64,6 +73,15 @@ class AccommodationBookingCreateType extends AbstractType
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
'data_class' => AccommodationBooking::class,
|
||||
// A draft is a scratch record, but anything the customer can be pointed at
|
||||
// needs a reachable address — see the `offer` group on the entity. The rest of
|
||||
// the contact data is collected on the edit page, which validates `edit`.
|
||||
'validation_groups' => static function (FormInterface $form): array {
|
||||
/** @var AccommodationBooking $booking */
|
||||
$booking = $form->getData();
|
||||
|
||||
return $booking->isDraft() ? ['Default'] : ['Default', 'offer'];
|
||||
},
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user