42 lines
1.6 KiB
PHP
42 lines
1.6 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Controller\Admin\AccommodationBooking;
|
|
|
|
use App\Controller\Traits\ReturnUrlTrait;
|
|
use App\Entity\Groups\AccommodationBooking;
|
|
use App\Service\AccommodationBookingBreakdownCalculator;
|
|
use App\Service\AccommodationBookingLinkSigner;
|
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
|
use Symfony\Component\HttpFoundation\Request;
|
|
use Symfony\Component\HttpFoundation\Response;
|
|
use Symfony\Component\Routing\Attribute\Route;
|
|
use Symfony\Component\Security\Http\Attribute\IsGranted;
|
|
|
|
#[IsGranted('ROLE_GROUPS_MANAGER')]
|
|
class ShowController extends AbstractController
|
|
{
|
|
use ReturnUrlTrait;
|
|
|
|
public function __construct(
|
|
private readonly AccommodationBookingBreakdownCalculator $breakdownCalculator,
|
|
private readonly AccommodationBookingLinkSigner $linkSigner,
|
|
) {
|
|
}
|
|
|
|
#[Route('/admin/accommodation-booking/{id}', name: 'app_admin_accommodationbooking_show')]
|
|
public function index(AccommodationBooking $booking, Request $request): Response
|
|
{
|
|
$hasAccessLink = null !== $booking->getAccessLinkIssuedAt();
|
|
|
|
return $this->render('admin/accommodation_booking/show.html.twig', [
|
|
'booking' => $booking,
|
|
'priceBreakdown' => $this->breakdownCalculator->compute($booking),
|
|
'returnUrl' => $this->getReturnUrl($request, 'app_admin_accommodationbooking'),
|
|
'accessLink' => $hasAccessLink ? $this->linkSigner->sign($booking) : null,
|
|
'accessLinkExpiresAt' => $hasAccessLink ? $this->linkSigner->expiresAt($booking) : null,
|
|
]);
|
|
}
|
|
}
|