feat: panel layout for the accommodation booking edit and detail pages
This commit is contained in:
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),
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user