feat: offer contact validation flow
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Controller\Groups\Offer;
|
||||
|
||||
use App\Entity\Groups\AccommodationBooking;
|
||||
use App\Htmx\HxTrait;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController as SymfonyAbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
abstract class AbstractController extends SymfonyAbstractController
|
||||
{
|
||||
use HxTrait;
|
||||
|
||||
/**
|
||||
* A draft and an inquiry the office has not worked through yet are not ready to be
|
||||
* shown, and a discarded booking must not be viewable any more — in all three cases
|
||||
* the link behaves as if it had expired.
|
||||
*/
|
||||
protected function isCustomerVisible(AccommodationBooking $booking): bool
|
||||
{
|
||||
return $booking->isCustomerAccessible() && !$booking->isRequested() && !$booking->isDiscarded();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends the browser to a full reload of the (non-modal) offer page — this is
|
||||
* triggered from an htmx-loaded modal, so a plain render/redirect here would
|
||||
* get appended as an inert HTML fragment instead of actually navigating.
|
||||
*/
|
||||
protected function redirectToOfferPage(Request $request, string $uuid): Response
|
||||
{
|
||||
$url = $this->generateUrl('app_groups_offer_view', ['uuid' => $uuid]);
|
||||
|
||||
return $this->htmxRedirect($request, $url);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user