<?php
namespace App\Controller;
use App\Entity\VisaApplicant;
use App\Form\VisaApplicantType;
use Boab\CmsBundle\Controller\BaseController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
class ApplicationController extends BaseController
{
#[Route('/application/visa', name: 'visa_application')]
public function index(Request $request): Response
{
$form = $this->createForm(VisaApplicantType::class, new VisaApplicant,[
"action" => $this->router->generate('visa_application'),
"method" => "POST"
]);
$form->handleRequest($request);
if($form->isSubmitted() && $form->isValid()){
$data = $form->getData();
return $this->redirect($this->router->generate('visa_application',['status'=>'success']));
}
return $this->render('application/visa.html.twig', [
'controller_name' => 'BookingController',
'form' => $form->createView(),
'pageTitle' => 'Visa Application'
]);
}
}