feat: panel layout for the accommodation booking edit and detail pages

This commit is contained in:
fromme committed 2026-09-30 18:06:45 +02:00
1 parent 5fdee68ccd
commit eb45693257
9 files changed
+531 -398

No files matched your search

@@ -12,6 +12,7 @@ use App\Form\Admin\Groups\AccommodationBookingType;
use App\Repository\Groups\AdditionalServiceRepository;
use App\Repository\Groups\BoardServiceRepository;
use App\Repository\UserRepository;
use App\Service\AccommodationBookingBreakdownCalculator;
use App\Service\AccommodationBookingService;
use Doctrine\ORM\EntityManagerInterface;
use Psr\Log\LoggerInterface;
@@ -33,6 +34,7 @@ class EditController extends AbstractController
private readonly AdditionalServiceRepository $additionalServiceRepo,
private readonly UserRepository $userRepo,
private readonly AccommodationBookingService $bookingService,
private readonly AccommodationBookingBreakdownCalculator $breakdownCalculator,
) {
}
@@ -128,10 +130,7 @@ class EditController extends AbstractController
// The submitted changes stay on the entity but are never flushed, so the form
// comes back filled in with the error on it. Logging is safe here: the database
// handler writes through DBAL, not the EntityManager.
return $this->render('admin/accommodation_booking/edit.html.twig', [
'booking' => $booking,
'form' => $form,
]);
return $this->renderForm($booking, $form);
}
// Editing never moves the booking on and never mails the customer: every status
@@ -160,9 +159,22 @@ class EditController extends AbstractController
return $this->redirectToRoute('app_admin_accommodationbooking_show', $parameters);
}
return $this->renderForm($booking, $form);
}
/**
* The sidebar shows the stored price, not one computed from the submitted values: after a
* refused save the entity carries the unsaved changes, and the price there is labelled as the
* state of the last save.
*
* @param FormInterface<AccommodationBooking> $form
*/
private function renderForm(AccommodationBooking $booking, FormInterface $form): Response
{
return $this->render('admin/accommodation_booking/edit.html.twig', [
'booking' => $booking,
'form' => $form,
'priceBreakdown' => $this->breakdownCalculator->compute($booking),
]);
}
@@ -18,10 +18,11 @@ class AccommodationBookingPeriodType extends AbstractType
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
// "Überschrift" rather than "Bezeichnung", which the lines below use for their own field.
->add('label', TextType::class, [
'label' => 'Bezeichnung',
'label' => 'Überschrift (optional)',
'required' => false,
'help' => 'Überschrift in der Preisaufstellung, z. B. „Vorausteam“. Ohne Bezeichnung steht dort nur der Zeitraum.',
'attr' => ['placeholder' => 'z. B. Vorausteam'],
])
->add('nights', IntegerType::class, [
'label' => 'Nächte',