wip: group inquiries and bookings
This commit is contained in:
1 parent
6a6051e92b
commit
505bda46cf
115 files changed
+8107
-424
No files matched your search
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Controller\Admin\AccommodationBooking;
|
||||
|
||||
use App\Entity\Groups\AccommodationBooking;
|
||||
use App\Form\Admin\Groups\AccommodationBookingType;
|
||||
use App\Service\AccommodationBookingService;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
|
||||
class CreateController extends AbstractController
|
||||
{
|
||||
public function __construct(
|
||||
private readonly EntityManagerInterface $entityManager,
|
||||
private readonly LoggerInterface $logger,
|
||||
private readonly AccommodationBookingService $bookingService,
|
||||
) {
|
||||
}
|
||||
|
||||
#[Route('/admin/accommodation-booking/create', name: 'app_admin_accommodationbooking_create')]
|
||||
public function index(Request $request): Response
|
||||
{
|
||||
$booking = new AccommodationBooking();
|
||||
|
||||
$form = $this->createForm(AccommodationBookingType::class, $booking, [
|
||||
'with_accommodation' => true,
|
||||
]);
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$this->entityManager->persist($booking);
|
||||
$this->entityManager->flush();
|
||||
|
||||
$this->bookingService->issueAccessLinkForDirectBooking($booking);
|
||||
$this->bookingService->sendCustomerConfirmationEmail($booking);
|
||||
|
||||
$this->addFlash('success', 'Die Buchung wurde erstellt');
|
||||
|
||||
$this->logger->info('Created accommodation booking', [
|
||||
'id' => $booking->getId(),
|
||||
'groupName' => $booking->getGroupName(),
|
||||
]);
|
||||
|
||||
return $this->redirectToRoute('app_admin_accommodationbooking_edit', ['id' => $booking->getId()]);
|
||||
}
|
||||
|
||||
return $this->render('admin/accommodation_booking/create.html.twig', [
|
||||
'form' => $form,
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user