feat: enable entering additional remarks in offer confirmation

This commit is contained in:
Björn Fromme
2026-08-17 15:30:17 +02:00
parent 582e54ddc4
commit a5d97f1206
15 changed files with 387 additions and 20 deletions
+6 -2
View File
@@ -5,6 +5,7 @@ declare(strict_types=1);
namespace App\Controller\Groups;
use App\Entity\Groups\AccommodationBooking;
use App\Form\Model\OfferAcceptDto;
use App\Form\OfferAcceptConfirmationType;
use App\Htmx\HxTrait;
use App\Model\AccommodationBookingContext;
@@ -97,13 +98,16 @@ class OfferController extends AbstractController
return $this->redirectToOfferPage($request, $uuid);
}
$confirmationForm = $this->createForm(OfferAcceptConfirmationType::class, null, [
$dto = new OfferAcceptDto(remarks: $booking->getRemarks());
$confirmationForm = $this->createForm(OfferAcceptConfirmationType::class, $dto, [
'terms_url' => $this->termsUrlProvider->forAccommodation($booking->getAccommodation()),
]);
$confirmationForm->handleRequest($request);
if ($confirmationForm->isSubmitted() && $confirmationForm->isValid()) {
$this->bookingService->acceptBooking($booking);
// The textarea is prefilled, so the submitted value is the complete remark —
// an emptied field arrives as null and must clear the stored one, not keep it.
$this->bookingService->acceptBooking($booking, $dto->remarks ?? '');
$this->addFlash('success', 'Deine Buchung ist bestätigt.');
return $this->redirectToOfferPage($request, $uuid);