src/Controller/Generale/IndexController.php line 830

Open in your IDE?
  1. <?php
  2. namespace App\Controller\Generale;
  3. use App\Service\Generale;
  4. use App\Service\SessionManager;
  5. use App\Service\WSAerien;
  6. use App\Service\WSAuth;
  7. use App\Service\WSCMS;
  8. use App\Service\WSEspaceAffilie;
  9. use App\Service\WSLocationVoiture;
  10. use App\Service\WSSejourHotel;
  11. use App\Service\WSVoyagesOrganise;
  12. use App\Twig\Extension\GeneraleExtension;
  13. use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
  14. use Symfony\Component\Form\Extension\Core\Type\DateType;
  15. use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
  16. use Symfony\Component\HttpFoundation\JsonResponse;
  17. use Symfony\Component\HttpFoundation\Session\SessionInterface;
  18. use Symfony\Component\Validator\Constraints\Positive;
  19. use Symfony\Component\Form\Extension\Core\Type\EmailType;
  20. use Symfony\Component\Form\Extension\Core\Type\TextareaType;
  21. use Symfony\Component\Form\Extension\Core\Type\TextType;
  22. use Symfony\Component\Form\Extension\Core\Type\IntegerType;
  23. use Symfony\Component\Form\Extension\Core\Type\HiddenType;
  24. use Symfony\Component\Form\Extension\Core\Type\TimeType;
  25. use Symfony\Component\HttpFoundation\Request;
  26. use Symfony\Component\HttpFoundation\Response;
  27. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  28. use Symfony\Component\Routing\Annotation\Route;
  29. use Knp\Snappy\Pdf;
  30. class IndexController extends AbstractController
  31. {
  32.     public function __construct(Generale $service)
  33.     {
  34.         $this->service $service;
  35.     }
  36.     /**
  37.      * @Route("/", name="accueil")
  38.      */
  39.     public function accueil(WSCMS $WSCMSWSSejourHotel $hotelWSEspaceAffilie $affilieRequest $requestWSLocationVoiture $WSLocationVoitureWSAerien $WSAerien): Response
  40.     {
  41.         /*
  42.          * $frontBlocs = $hotel->FrontBlocs(['devise' => $this->get('session')->get('devise'), 'version' => 'blocs']);
  43.          * $hotelPromoParMois = $hotel->HotelPromoParMois(['devise' => $this->get('session')->get('devise')]);
  44.          * $hotelPromoParMois['villesgroupes'] $hotelPromoParMois['maxhotelPromoPour']
  45.          */
  46.         if (isset($_SERVER['ROUTE_ACCUEIL']))
  47.             return $this->redirectToRoute($_SERVER['ROUTE_ACCUEIL'], isset($_SERVER['PARAMS_ROUTE_ACCUEIL']) ? json_decode($_SERVER['PARAMS_ROUTE_ACCUEIL'], true) : []);
  48.         if (isset($_SERVER['DOMAINE_AMADEUS']))
  49.             $classes['Resultat'] = [
  50.                 [
  51.                     'id' => 'Y',
  52.                     'typeClasse' => 'Economy'
  53.                 ],
  54.                 [
  55.                     'id' => 'W',
  56.                     'typeClasse' => 'Premium Economy'
  57.                 ],
  58.                 [
  59.                     'id' => 'C',
  60.                     'typeClasse' => 'Business'
  61.                 ],
  62.                 [
  63.                     'id' => 'F',
  64.                     'typeClasse' => 'First'
  65.                 ]
  66.             ];
  67.         else
  68.             $classes $WSAerien->Classe();
  69.         $classe $request->get('classe');
  70.         if ($request->isMethod('POST')) {
  71.             $file $request->files->get('image');
  72.             $path sha1(uniqid(mt_rand(), TRUE)) . '.' $file->guessExtension();
  73.             $a $affilie->ProfileAgence()['ProfileAgence'];
  74.             $uploadRootDir $a['uploadRootDir'];
  75.             $amicale = [
  76.                 'amicale' => [
  77.                     'libelle' => '',
  78.                     'tel' => '',
  79.                     'fax' => '',
  80.                     'email' => '',
  81.                     'matriculeFiscale' => '',
  82.                     'registreCommercie' => '',
  83.                     'adresse' => '',
  84.                     'path' => $path
  85.                 ]
  86.             ];
  87.             $a $affilie->ProfileAgence($amicale);
  88.             if (!isset($a['Error']))
  89.                 $file->move($uploadRootDir$path);
  90.         }
  91.         /*dd($this->service);*/
  92.         return $this->render($this->service->checkCustomTemplate('accueil.html.twig'), [
  93.             'elements' => $WSCMS->Element()['Elements'],
  94.             'sliders' => $WSCMS->Slider()['Sliders'],
  95.             'hotels' => $hotel->PackTopVente()['PackTopVente'],
  96.             'hotelsRecommandes' => $hotel->PackBonPlan()['PackBonPlan'],
  97.             'lieux' => $WSLocationVoiture->LieuxPriseEnCharge(),
  98.             'lieuArrivee' => $request->get('lieu_arrivee'),
  99.             'lieuDepart' => $request->get('lieu_depart'),
  100.             'dateDebutFin' => $request->get('date_debut_fin'),
  101.             'dateDebut' => null,
  102.             'dateFin' => null,
  103.             'classes' => $classes,
  104.             'classe' => $classe,
  105.             'blocBootstrap' => $WSCMS->BlocBootstrap()['BlocsBootstrap']
  106.         ]);
  107.     }
  108.     /**
  109.      * @Route("/feature-flags", name="feature_flags")
  110.      */
  111.     public function featureFlags(SessionManager $sessionManager): Response
  112.     {
  113.         $flags $sessionManager->getAllFeatureFlags();
  114.         return $this->render('feature_flags.html.twig', [
  115.             'flags' => $flags,
  116.         ]);
  117.     }
  118.     /**
  119.      * @Route("/feature-flags/toggle/{key}", name="feature_flag_toggle")
  120.      */
  121.     public function toggleFeatureFlags(string $keySessionManager $sessionManagerRequest $request): Response
  122.     {
  123.         $newValue $sessionManager->toggleFeatureFlag($key);
  124.         if ($request->isXmlHttpRequest())
  125.             return new JsonResponse([
  126.                 'success' => true,
  127.                 'newStatus' => $newValue,
  128.             ]);
  129.         return $this->redirect($request->headers->get('referer'$this->generateUrl('feature_flags')));
  130.     }
  131.     /**
  132.      * @Route("/wishlist/toggle/{hotelId}", name="wishlist_toggle", methods={"POST"})
  133.      */
  134.     public function toggleWishlist(int $hotelIdSessionInterface $session)
  135.     {
  136.         try {
  137.             // Récupérer la liste de souhaits depuis la session
  138.             $wishlist $session->get('wishlist', []);
  139.             // Vérifier si l'hôtel est déjà dans la liste de souhaits
  140.             if (in_array($hotelId$wishlist)) {
  141.                 // Retirer l'hôtel de la liste de souhaits
  142.                 $wishlist array_filter($wishlist, function ($id) use ($hotelId) {
  143.                     return $id !== $hotelId;
  144.                 });
  145.                 $isInWishlist false;
  146.             } else {
  147.                 // Ajouter l'hôtel à la liste de souhaits
  148.                 $wishlist[] = $hotelId;
  149.                 $isInWishlist true;
  150.             }
  151.             // Mettre à jour la liste de souhaits dans la session
  152.             $session->set('wishlist'array_values($wishlist));
  153.             // Retourner une réponse JSON
  154.             return new JsonResponse([
  155.                 'success' => true,
  156.                 'isInWishlist' => $isInWishlist,
  157.             ]);
  158.         } catch (\Exception $e) {
  159.             // En cas d'erreur, retourner un message d'erreur
  160.             return new JsonResponse([
  161.                 'success' => false,
  162.                 'message' => 'Une erreur est survenue : ' $e->getMessage(),
  163.             ], 500);
  164.         }
  165.     }
  166.     /**
  167.      * @Route("/wishlist/view", name="wishlist_view")
  168.      */
  169.     public function viewWishlist(SessionInterface $session)
  170.     {
  171.         // Récupérer la liste de souhaits depuis la session
  172.         $wishlist $session->get('wishlist', []);
  173.         return $this->redirectToRoute('sejour_hotel_availability_landing_page', ['hotel' => implode('-', empty($wishlist) ? [0] : $wishlist)]);
  174.     }
  175.     /**
  176.      * @Route("/switch-connexion/{id}", name="switch_connexion")
  177.      */
  178.     public function switchConnexion($idWSAuth $authWSEspaceAffilie $affilie)
  179.     {
  180.         if (!$this->get('session')->get('ADMINISTRATOR_AGENCY') and !isset($_SESSION['ROLE_SUPPER_ADMIN'])) {
  181.             $this->addFlash('danger''accès refusé');
  182.             return $this->render('bundles/TwigBundle/Exception/error404.html.twig');
  183.         }
  184.         $infosUser $auth->infosUserAffilier(['amicale' => $id]);
  185.         if (isset($infosUser['Error']))
  186.             $this->addFlash('danger'$infosUser['Error']);
  187.         else {
  188.             $this->get('session')->set('client'$infosUser['client']);
  189.             $this->get('session')->set('solde'$affilie->Solde());
  190.         }
  191.         return $this->redirect($_SERVER['HTTP_REFERER']);
  192.     }
  193.     /**
  194.      * @Route("/verif-couponreduction/{produit}/{code}/{achat}/{vente}/{checkin}/{nuitees}/{hotel}",
  195.      *     options={"expose"=true},
  196.      *     defaults={"produit":"SHT", "hotel":null},
  197.      *     name="verif_couponreduction")
  198.      */
  199.     public function verifCouponReduction($produit$code$achat$vente$checkin$nuitees$hotelWSCMS $WSCMS): Response
  200.     {
  201.         return new JsonResponse($WSCMS->CouponReduction(['hotel' => $hotel'code' => $code'achat' => $achat'vente' => $vente'checkin' => $checkin'nuitees' => $nuitees'produit' => $produit]));
  202.     }
  203.     /**
  204.      * @Route("/referencement-by-route",
  205.      *     name="referencement_by_route")
  206.      */
  207.     public function referencementByRoute(Request $requestGeneraleExtension $ext): JsonResponse
  208.     {
  209.         $route $request->query->get('route');
  210.         $path $request->query->get('path');
  211.         $balise $request->query->get('balise');
  212.         $html $ext->referencementByRoute($route$path$balise);
  213.         return $this->json(['html' => $html]);
  214.     }
  215.     /**
  216.      * @Route("/recu-paiement",
  217.      *     options={"expose"=true},
  218.      *     name="recu_paiement")
  219.      */
  220.     public function recuPaiement(Request $requestWSCMS $WSCMS): Response
  221.     {
  222.         $params json_decode(base64_decode($_GET['params']), true);
  223.         $client $params['Client'];
  224.         $reference $params['Numéro de commande'];
  225.         $date $params['Date et l’heure de la transaction'];
  226.         $montant $params['Montant de paiement'];
  227.         unset($params['Client'], $params['Date et l’heure de la transaction'], $params['Montant de paiement'], $params['Numéro de commande']);
  228.         if ($request->get('email')) {
  229.             $pdf self::genererPDFRecuPaiement(['params' => $_GET['params']]);
  230.             $res $WSCMS->SendMailLibre([
  231.                 'mailToClient' => true,
  232.                 'email' => $request->get('email'),
  233.                 'subject' => "Reçu de paiement",
  234.                 'attach_base64' => [
  235.                     'data' => base64_encode(file_get_contents($pdf)),
  236.                     'filename' => 'reçu-paiement.pdf',
  237.                     'contentType' => mime_content_type($pdf)
  238.                 ],
  239.                 'body' => $this->renderView($this->service->checkCustomTemplate('recu-paiement.html.twig'), [
  240.                     'client' => $client,
  241.                     'date' => $date,
  242.                     'reference' => $reference,
  243.                     'montant' => $montant,
  244.                     'params' => $params,
  245.                 ])
  246.             ]);
  247.             unlink($pdf);
  248.             if (isset($res['SendMail']['Error']))
  249.                 return new Response(0);
  250.             return new Response($res['SendMail']);
  251.         }
  252.         return $this->render($this->service->checkCustomTemplate('recu-paiement.html.twig'), [
  253.             'client' => $client,
  254.             'date' => $date,
  255.             'reference' => $reference,
  256.             'montant' => $montant,
  257.             'params' => $params,
  258.         ]);
  259.     }
  260.     /**
  261.      * @Route("/pdf-recu-paiement",
  262.      *     options={"expose"=true},
  263.      *     name="pdf_recu_paiement")
  264.      */
  265.     public function pdfRecuPaiement(): Response
  266.     {
  267.         $pdf self::genererPDFRecuPaiement($_GET);
  268.         header('Content-Description: File Transfer');
  269.         header('Content-Disposition: attachment; filename=reçu-paiement.pdf');
  270.         header("Content-Type: application/pdf");
  271.         readfile($pdf);
  272.         unlink($pdf);
  273.         return new Response(" ");
  274.     }
  275.     /**
  276.      * @param $data
  277.      * @return string
  278.      *
  279.      * 1️⃣ Supprime la version actuelle (si elle existe)
  280.      *  sudo yum remove -y wkhtmltopdf
  281.      *
  282.      * 2️⃣ Installe les polices nécessaires
  283.      * sudo yum install -y xorg-x11-fonts-75dpi xorg-x11-fonts-Type1
  284.      * sudo apt install xfonts-100dpi xfonts-75dpi
  285.      *
  286.      * 3️⃣ Télécharge la version “patched” (statique) de wkhtmltopdf
  287.      * wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox-0.12.6-1.centos7.x86_64.rpm --> yum
  288.      * wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.focal_amd64.deb  --> apt
  289.      *
  290.      * 4️⃣ Installe ce paquet
  291.      * sudo yum localinstall -y wkhtmltox-0.12.6-1.centos7.x86_64.rpm
  292.      * sudo apt install ./wkhtmltox_0.12.6-1.focal_amd64.deb
  293.      *
  294.      * 5️⃣ Vérifie que l’installation est correcte
  295.      * wkhtmltopdf --version  => wkhtmltopdf 0.12.6 (with patched qt)
  296.      */
  297.     function genererPDFRecuPaiement($data)
  298.     {
  299.         /*
  300.          * sudo apt update
  301.          * sudo apt install wkhtmltopdf -y  or yum install wkhtmltopdf
  302.          * sudo cp /usr/bin/wkhtmltopdf /usr/local/bin/wkhtmltopdf
  303.          *
  304.          * ou bien
  305.          *
  306.          * yum install wget -y
  307.          * wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox-0.12.6-1.centos8.x86_64.rpm
  308.          * yum localinstall wkhtmltox-0.12.6-1.centos8.x86_64.rpm -y
  309.          * wkhtmltopdf --version
  310.          *
  311.          * exec("wkhtmltopdf '$url' $file 2>&1"); //2>&1 pour comprendre l'erreur exacte.
  312.          */
  313.         /*
  314.          * $snappy = new Pdf('/usr/local/bin/wkhtmltopdf');
  315.          *
  316.          * header('Content-Type: application/pdf');
  317.          * header('Content-Disposition: attachment; filename="file.pdf"');
  318.          * echo $snappy->getOutput('https://www.google.fr/');
  319.          */
  320.         $snappy = new Pdf('/usr/local/bin/wkhtmltopdf');
  321.         #$snappy = new Pdf($this->getParameter('kernel.project_dir') . '/vendor/h4cc/wkhtmltopdf-amd64/bin/wkhtmltopdf-amd64');
  322.         $ref uniqid();
  323.         $file "uploads/recu-paiement-$ref.pdf";
  324.         $snappy->generate($this->generateUrl('recu_paiement'$data0), $file);
  325.         return $file;
  326.     }
  327.     /**
  328.      * @Route("/header", name="header")
  329.      */
  330.     public function header()
  331.     {
  332.         return $this->render($this->service->checkCustomTemplate('header.html.twig'));
  333.     }
  334.     /**
  335.      * @Route("/footer", name="footer")
  336.      */
  337.     public function footer()
  338.     {
  339.         return $this->render($this->service->checkCustomTemplate('footer.html.twig'));
  340.     }
  341.     /**
  342.      * @Route("/blogs/{categorie}/{motcle}",  name="blogs", defaults={"categorie"="all","motcle"="all"})
  343.      */
  344.     public function listblogs($categorie$motcleWSCMS $WSCMS): Response
  345.     {
  346.         $articles $WSCMS->Article();
  347.         $categories $articles['Categories'];
  348.         $motcles $articles['MotCles'];
  349.         $articles $articles['Articles'];
  350.         if ($categorie != 'all')
  351.             $articles array_filter($articles, function ($item) use ($categorie) {
  352.                 return in_array($categoriearray_column($item['categories'], 'id'));
  353.             });
  354.         if ($motcle != 'all')
  355.             $articles array_filter($articles, function ($item) use ($motcle) {
  356.                 return in_array($motclearray_column($item['motcles'], 'id'));
  357.             });
  358.         return $this->render($this->service->checkCustomTemplate('blogs/liste-blogs.html.twig'), [
  359.             'articles' => $articles,
  360.             'categories' => $categories,
  361.             'motcles' => $motcles,
  362.         ]);
  363.     }
  364.     /**
  365.      * @Route("/details-blog/{id}/{slug}",  name="details_blog")
  366.      */
  367.     public function detailsblog($id$slugWSCMS $WSCMS): Response
  368.     {
  369.         return $this->render($this->service->checkCustomTemplate('blogs/detail-blogs.html.twig'), [
  370.             'article' => $WSCMS->Article()['Articles'][$id],
  371.             'articles' => $WSCMS->Article()['Articles']
  372.         ]);
  373.     }
  374.     /**
  375.      * @Route ("/article/{slug}", name="details-article")
  376.      */
  377.     public function article($slugWSCMS $WSCMS): Response
  378.     {
  379.         $articles $WSCMS->ArticlesElement()['ArticlesElement'];
  380.         $element = array();
  381.         $element['desktop'] = array();
  382.         $element['mobile'] = array();
  383.         foreach ($articles['desktop'] as $item) {
  384.             foreach ($item['elements'] as $_element) {
  385.                 if ($_element['slug'] == $slug) {
  386.                     $element['desktop'] = $_element;
  387.                     break(1);
  388.                 }
  389.             }
  390.         }
  391.         foreach ($articles['mobile'] as $item) {
  392.             foreach ($item['elements'] as $_element) {
  393.                 if ($_element['slug'] == $slug) {
  394.                     $element['mobile'] = $_element;
  395.                     break(1);
  396.                 }
  397.             }
  398.         }
  399.         return $this->render($this->service->checkCustomTemplate('articles/article.html.twig'), [
  400.             'articleDesktop' => $element['desktop'],
  401.             'articleMobile' => $element['mobile']
  402.         ]);
  403.     }
  404.     /**
  405.      * @Route ("/contact", name="contact")
  406.      */
  407.     public function contact(Request $requestGeneraleExtension $generaleExtensionWSCMS $WSCMS): Response
  408.     {
  409.         $infoAgence $generaleExtension->getAgence()['information'];
  410.         $form $this->createFormBuilder(null, ['csrf_protection' => true])
  411.             ->add('email'EmailType::class, array('required' => TRUE))
  412.             ->add('nom'TextType::class, array('required' => TRUE))
  413.             ->add('website'TextType::class, array('required' => false))
  414.             ->add('checkRobot'TextType::class, array('required' => false))
  415.             ->add('gsm'TextType::class, array('required' => false))
  416.             ->add('objet'ChoiceType::class, ['choices' => ['Demande information' => 'information''Reclamation' => 'reclamation',],])
  417.             ->add('piecejoint'TextareaType::class, array('required' => false))
  418.             ->add('message'TextareaType::class, array('required' => TRUE))
  419.             ->getForm();
  420.         $form->handleRequest($request);
  421.         if ($form->isSubmitted()) {
  422.             if ($form->isValid()) {
  423.                 try {
  424.                     $data $form->getData();
  425.                     // dd($data,$_POST);
  426.                     if (!empty($data['website']))
  427.                         return new Response("no web site");
  428.                     $body $this->renderView($this->service->checkCustomTemplate('contact_mail_body.html.twig'), array(
  429.                         'nom' => $data['nom'],
  430.                         'gsm' => $data['gsm'],
  431.                         'message' => $data['message'],
  432.                         'objet' => $data['objet'],
  433.                         'email' => $data['email'],
  434.                     ));
  435.                     $params = array(
  436.                         'checkRobot' => $data['checkRobot'],
  437.                         'email' => $data['email'],
  438. //                        'subject' => $data['message'],
  439.                         'subject' => $data['objet'],
  440.                         'attach_base64' => json_decode($data['piecejoint'], true),
  441.                         'body' => $body,
  442.                         'post' => $_POST,
  443.                         'page_contact' => true
  444.                     );
  445.                     $result $WSCMS->SendMailLibre($params);
  446.                     if ($result['SendMail'] == 1) {
  447.                         $msg "<span style='color:green;font-size: 14px;'>Votre message a été Envoyé avec succès !</span>";
  448.                         $this->addFlash('success''Félicitation votre message a été envoyé avec succès! ');
  449.                         return $this->redirectToRoute('contact_ok');
  450.                     } else
  451.                         $msg '<span style="color:red;font-size: 14px;">Echèc d\'envoi</span>';
  452.                 } catch (\Exception $e) {
  453.                     $msg '<span style="color:red">' $e->getMessage() . '</span>';
  454.                 }
  455.             } else
  456.                 $msg '<span style="color:red;font-size: 14px;">' . (string)$form->getErrors(truefalse) . '</span>';
  457.             return new Response($msg);
  458.         }
  459.         $configAffichage = array();
  460.         if (!is_null($WSCMS->ConfigFrontOffice()))
  461.             $configAffichage $WSCMS->ConfigFrontOffice()['ConfigFrontOffice'];
  462.         return $this->render($this->service->checkCustomTemplate('contact.html.twig'), array(
  463.             'infoAgence' => $infoAgence,
  464.             'form' => $form->createView(),
  465.             'contactPerso' => $WSCMS->ContactPerso(),
  466.             'configAffichage' => $configAffichage,
  467.         ));
  468.     }
  469.     /**
  470.      * @Route ("/envoi=Ok", name="contact_ok")
  471.      */
  472.     public function contact_ok()
  473.     {
  474.         return $this->render($this->service->checkCustomTemplate('contact_ok.html.twig'));
  475.     }
  476.     /**
  477.      * @Route ("/sendPayment", name="sendPayment")
  478.      */
  479.     public function sendPayments(Request $requestGeneraleExtension $generaleExtensionWSCMS $WSCMS): Response
  480.     {
  481.         $infoAgence $generaleExtension->getAgence()['information'];
  482.         $tabDevise = [];
  483.         foreach ($generaleExtension->getDevise() as $dev) {
  484.             $tabDevise array_merge($tabDevise, [$dev["code"] => $dev["libelle"]]);
  485.         }
  486.         $form $this->createFormBuilder(null, ['csrf_protection' => true])
  487.             ->add('montant'TextType::class, array('required' => TRUE))
  488.             ->add('devise'ChoiceType::class, ['choices' => $tabDevise])
  489.             ->add('paiement'ChoiceType::class, ['choices' => [
  490.                 'Séjour Hotel en Tunisie' => 'Séjour Hotel en Tunisie',
  491.                 'Voyages Organisés' => 'Voyages Organisés',
  492.                 'Programmes & activités' => 'Programmes & activités',
  493.                 'Billetterie' => 'Billetterie',
  494.                 'Maritime' => 'Maritime',
  495.                 'Transfert' => 'Transfert',
  496.                 'ResaBooking' => 'ResaBooking',
  497.                 'Réservation Divers' => 'Réservation Divers',
  498.                 'Mice' => 'Mice',
  499.                 'Séjour Hotel à  l \'Etranger' => 'Séjour Hotel à  l \'Etranger',
  500.                 'Bien-être' => 'Bien-être',
  501.                 'Location de voiture' => 'Location de voiture',],])
  502.             ->add('mode'ChoiceType::class, ['choices' => ['Virement bancaire' => 'Virement bancaire''Versement bancaire' => 'Versement bancaire',],])
  503.             ->add('note'TextareaType::class, array('required' => true))
  504.             ->add('piecejoint'TextareaType::class, array('required' => false))
  505.             ->add('checkRobot'TextType::class, array('required' => false))
  506.             ->add('code_formulaire'HiddenType::class, array('required' => false'data' => 'Formulaire_Payment',))
  507.             ->getForm();
  508.         $form->handleRequest($request);
  509.         if ($form->isSubmitted()) {
  510.             if ($form->isValid()) {
  511.                 /* dd($_POST);*/
  512.                 try {
  513.                     $data $form->getData();
  514.                     $body $this->renderView($this->service->checkCustomTemplate('sendPayment_mail_body.html.twig'), array(
  515.                         'montant' => $data['montant'],
  516.                         'devise' => $data['devise'],
  517.                         'paiement' => $data['paiement'],
  518.                         'mode' => $data['mode'],
  519.                         'note' => $data['note'],
  520.                     ));
  521.                     $params = array(
  522.                         'checkRobot' => $data['checkRobot'],
  523.                         'subject' => $data['note'],
  524.                         'post' => $_POST,
  525.                         'code_formulaire' => $data['code_formulaire'],
  526.                         'attach_base64' => json_decode($data['piecejoint'], true),
  527.                         'body' => $body
  528.                     );
  529.                     $result $WSCMS->SendMailLibre($params);
  530.                     /* dd($data,$params,$result);*/
  531.                     if ($result['SendMail'] == 1)
  532.                         $msg "<span style='color:green;font-size: 14px;'>Votre message a été Envoyé avec succès !</span>";
  533.                     else
  534.                         $msg '<span style="color:red;font-size: 14px;">Echèc d\'envoi</span>';
  535.                 } catch (\Exception $e) {
  536.                     $msg '<span style="color:red">' $e->getMessage() . '</span>';
  537.                 }
  538.             } else
  539.                 $msg '<span style="color:red;font-size: 14px;">' . (string)$form->getErrors(truefalse) . '</span>';
  540.             return new Response($msg);
  541.         }
  542.         $configAffichage = array();
  543.         if (!is_null($WSCMS->ConfigFrontOffice()))
  544.             $configAffichage $WSCMS->ConfigFrontOffice()['ConfigFrontOffice'];
  545.         return $this->render($this->service->checkCustomTemplate('sendPayment.html.twig'), array(
  546.             'infoAgence' => $infoAgence,
  547.             'form' => $form->createView(),
  548.             'configAffichage' => $configAffichage,
  549.         ));
  550.     }
  551.     /**
  552.      * @Route("/landing-page/{slug}",  name="landing_page")
  553.      * @Route("/hotels/landing-page/{slug}",  name="landing_page_hotels")
  554.      * @Route("/avail-hotels/landing-page/{slug}",  name="landing_page_avail_hotels")
  555.      */
  556.     public function landingPage($slugWSSejourHotel $hotelRequest $request): Response
  557.     {
  558.         $banner "{$this->service->domaineBack()}/file_manager/source/landing.webp";
  559.         if (in_array($request->get('_route'), ['landing_page_hotels''landing_page_avail_hotels'])) {
  560.             $frontBlocs $hotel->FrontBlocs(['devise' => $this->get('session')->get('devise'), 'version' => 'blocs']);
  561.             $frontBloc array_column($frontBlocsnull'slug')[$slug];
  562.             $flashPromo = ['libelle' => $frontBloc['titre']];
  563.             $details array_map(function ($hotel) {
  564.                 if (!isset($hotel['prices']['minPrixPromo']))
  565.                     if (isset($hotel['prices']['minPrix']))
  566.                         $hotel['prices']['minPrixPromo'] = $hotel['prices']['minPrix'];
  567.                     elseif (isset($hotel['prices']['prix-demi-double']))
  568.                         $hotel['prices']['minPrixPromo'] = [
  569.                             'prix' => $hotel['prices']['prix-demi-double'],
  570.                             'libelle' => null,
  571.                             'code' => null
  572.                         ];
  573.                     else
  574.                         $hotel['prices']['minPrixPromo'] = [
  575.                             'prix' => null,
  576.                             'libelle' => null,
  577.                             'code' => null
  578.                         ];
  579.                 return [
  580.                     'libelle' => $hotel['details']['libelle'],
  581.                     'sulg' => $hotel['details']['slug'],
  582.                     'photo' => $hotel['photo'],
  583.                     'prix' => $hotel['prices']['minPrixPromo']['prix'],
  584.                     'lbl_arrangement' => $hotel['prices']['minPrixPromo']['libelle'],
  585.                     'code_arrangement' => $hotel['prices']['minPrixPromo']['code'],
  586.                     'idhotel' => $hotel['details']['id'],
  587.                     'image' => $hotel['photo'],
  588.                     'etiquettes' => $hotel['prices']['etiquettes'],
  589.                     //'etiquetteHotel' => array_values(array_column(array_merge($hotel['prices']['etiquettes'],$hotel['prices']['etiquettesSaison'],$hotel['prices']['etiquettesEmplacement']),null,'libelle')),
  590.                     'star' => $hotel['details']['categorie']['nombre_etoiles'],
  591.                     'ville' => $hotel['details']['ville']['libelle'],
  592.                     'nuitees' => $hotel['prices']['nuitees'],
  593.                     'checkin' => $hotel['prices']['dateDebut']
  594.                 ];
  595.             },
  596.                 $frontBloc['hotels']);
  597.         } elseif (strpos($slug'-pack-bon-plan') !== false) {
  598.             $packBonPlan array_column($hotel->PackBonPlan()['PackBonPlan'], null'categorieId')[explode('-'$slug)[0]];
  599.             $flashPromo = ['libelle' => $packBonPlan['categorie']];
  600.             $hotels $packBonPlan['element'];
  601.             if ($packBonPlan['bannier'])
  602.                 $banner $packBonPlan['bannier'];
  603.             $details array_map(function ($hotel) {
  604.                 return [
  605.                     'libelle' => $hotel['hotel']['libelle'],
  606.                     'sulg' => $hotel['hotel']['slug'],
  607.                     'photo' => $hotel['hotel']['photo'],
  608.                     'prix' => $hotel['prix'],
  609.                     'lbl_arrangement' => $hotel['libelle_arrg'],
  610.                     'code_arrangement' => $hotel['code_arrg'],
  611.                     'idhotel' => $hotel['hotel']['id'],
  612.                     'image' => $hotel['image'],
  613.                     'etiquetteHotel' => $hotel['etiquetteHotel'],
  614.                     'star' => $hotel['hotel']['categorie']['nombre_etoiles'],
  615.                     'ville' => $hotel['hotel']['ville']['libelle'],
  616.                     'nuitees' => $hotel['nuitees'],
  617.                     'checkin' => date('Y-m-d')
  618.                     /*'source' => $hotel['hotel']['source'],*/
  619.                 ];
  620.             },
  621.                 $hotels);
  622.         } else {
  623.             $flashPromo $hotel->FlashPromo()['FlashPromo'][$slug];
  624.             $banner $flashPromo['bannier'];
  625.             $details array_map(function ($hotel) {
  626.                 $checkin date('Y-m-d');
  627.                 if ($hotel['firstCheckIn'] and new \DateTime($hotel['firstCheckIn']) >= new \DateTime())
  628.                     $checkin $hotel['firstCheckIn'];
  629.                 return [
  630.                     'libelle' => $hotel['libelle'],
  631.                     'sulg' => $hotel['slug'],
  632.                     'photo' => $hotel['image'],
  633.                     'prix' => $hotel['prix'],
  634.                     'lbl_arrangement' => $hotel['libelleArrg'],
  635.                     'code_arrangement' => $hotel['codeArrg'],
  636.                     'idhotel' => $hotel['idHotel'],
  637.                     'image' => $hotel['image'],
  638.                     'etiquetteHotel' => $hotel['etiquetteHotel'],
  639.                     'star' => $hotel['star'],
  640.                     'ville' => $hotel['ville'],
  641.                     'checkin' => $checkin,
  642.                     'nuitees' => 1
  643.                 ];
  644.             },
  645.                 $flashPromo['hotels']);
  646.         }
  647.         if (in_array($request->get('_route'), ['landing_page_hotels''landing_page_avail_hotels'])) {
  648.             $hotels array_column($details'idhotel');
  649.             return $this->redirectToRoute('sejour_hotel_availability_landing_page', [
  650.                 'checkin' => empty($details) ? "now" $details[0]['checkin'],
  651.                 'nuitees' => empty($details) ? $details[0]['nuitees'],
  652.                 'hotel' => implode('-', empty($hotels) ? [0] : $hotels)
  653.             ]);
  654.         }
  655.         return $this->render($this->service->checkCustomTemplate('SejourHotel/landing-page.html.twig'),
  656.             [
  657.                 'details' => $details,
  658.                 'banner' => $banner,
  659.                 'info' => $flashPromo
  660.             ]);
  661.     }
  662.     /**
  663.      * @Route("/landing-page-package/{slug}",  name="landing_page_package")
  664.      */
  665.     public function landingPagePackage($slugWSVoyagesOrganise $voyage): Response
  666.     {
  667.         $banner "{$this->service->domaineBack()}/file_manager/source/landing.webp";
  668.         $flashPromo $voyage->FlashPromoPackage()['FlashPromo'][$slug];
  669.         $banner $flashPromo['bannier'];
  670.         $details $packages array_map(function ($package) {
  671.             return [
  672.                 'libelle' => $package['libelle'],
  673.                 'sulg' => $package['slug'],
  674.                 'photo' => $package['image'],
  675.                 'prix' => $package['prix'],
  676.                 'idvoyage' => $package['idVoyage'],
  677.                 'image' => $package['image'],
  678.                 'type' => $package['type'],
  679.             ];
  680.         },
  681.             $flashPromo['packages']);
  682.         return $this->render($this->service->checkCustomTemplate('VoyagesOrganise/landing-page.html.twig'),
  683.             [
  684.                 'details' => $details,
  685.                 'banner' => $banner,
  686.                 'info' => $flashPromo
  687.             ]);
  688.     }
  689.     /**
  690.      * showVoyage
  691.      * showCircuits
  692.      * showTopHotelTunisie (topventes)
  693.      * showHotelsRecommandes (bonplan)
  694.      * showPackPromo (promo)
  695.      * showOmra
  696.      * showHTML
  697.      * showHTML2
  698.      * showHTML3
  699.      */
  700.     public function showvoyage(WSCMS $WSCMS): Response
  701.     {
  702.         $groupeCategories $WSCMS->Element()['Elements'];
  703.         $elements = array();
  704.         foreach ($groupeCategories as $groupeCategory) {
  705.             if ($groupeCategory['groupeCategorie'] == 'voyage')
  706.                 foreach ($groupeCategory['categories'] as $category) {
  707.                     $elements['titreBloc'] = $groupeCategory['titre'];
  708.                     $elements['description'] = $groupeCategory['description'];
  709.                     $elements['image1'] = $groupeCategory['image1'];
  710.                     $elements['lienDetails'] = $category['lienDetails'];
  711.                     if ($category['code'] == 'voyage') {
  712.                         $elements['elements'] = $category['elements'];
  713.                     }
  714.                 }
  715.         }
  716.         return $this->render($this->service->checkCustomTemplate('showVoyage.html.twig'), ['groupe' => $elements]);
  717.     }
  718.     public function showcircuits(WSCMS $WSCMS): Response
  719.     {
  720.         $groupeCategories $WSCMS->Element()['Elements'];
  721.         $elements = array();
  722.         foreach ($groupeCategories as $groupeCategory) {
  723.             if ($groupeCategory['groupeCategorie'] == 'circuits')
  724.                 foreach ($groupeCategory['categories'] as $category) {
  725.                     $elements['titreBloc'] = $groupeCategory['titre'];
  726.                     $elements['description'] = $groupeCategory['description'];
  727.                     $elements['image1'] = $groupeCategory['image1'];
  728.                     $elements['lienDetails'] = $category['lienDetails'];
  729.                     if ($category['code'] == 'circuits') {
  730.                         $elements['elements'] = $category['elements'];
  731.                     }
  732.                 }
  733.         }
  734.         return $this->render($this->service->checkCustomTemplate('showCircuits.html.twig'), ['groupe' => $elements]);
  735.     }
  736.     public function showTopHotelTunisie(WSCMS $WSCMSWSSejourHotel $hotel): Response
  737.     {
  738.         $groupeCategories $WSCMS->Element()['Elements'];
  739.         $elements = array();
  740.         foreach ($groupeCategories as $groupeCategory) {
  741.             if ($groupeCategory['groupeCategorie'] == 'TopHotelTunisie') {
  742.                 foreach ($groupeCategory['categories'] as $category) {
  743.                     $elements['titreBloc'] = $groupeCategory['titre'];
  744.                     $elements['description'] = $groupeCategory['description'];
  745.                     $elements['lienDetails'] = $category['lienDetails'];
  746.                     $elements['image1'] = $groupeCategory['image1'];
  747.                 }
  748.             }
  749.         }
  750.         return $this->render($this->service->checkCustomTemplate('show-hotels-tunisie.html.twig'), ['groupe' => $elements'hotels' => $hotel->PackTopVente()['PackTopVente']]);
  751.     }
  752.     public function showPackPromo(WSCMS $WSCMSWSSejourHotel $hotel): Response
  753.     {
  754.         $groupeCategories $WSCMS->Element()['Elements'];
  755.         $elements = array();
  756.         foreach ($groupeCategories as $groupeCategory) {
  757.             if ($groupeCategory['groupeCategorie'] == 'PackPromo') {
  758.                 foreach ($groupeCategory['categories'] as $category) {
  759.                     $elements['titreBloc'] = $groupeCategory['titre'];
  760.                     $elements['description'] = $groupeCategory['description'];
  761.                     $elements['image1'] = $groupeCategory['image1'];
  762.                     $elements['lienDetails'] = $category['lienDetails'];
  763.                 }
  764.             }
  765.         }
  766.         return $this->render($this->service->checkCustomTemplate('show-hotels-promo.html.twig'), ['groupe' => $elements'hotels' => $hotel->PackPromo()['PackPromo']]);
  767.     }
  768.     /**/
  769.     public function showTarifsChambre(?int $id_hotelWSCMS $WSCMSWSSejourHotel $hotel): Response
  770.     {
  771.         $groupeCategories $WSCMS->Element()['Elements'];
  772.         $elements = array();
  773.         foreach ($groupeCategories as $groupeCategory) {
  774.             if ($groupeCategory['groupeCategorie'] == 'TarifsChambre') {
  775.                 foreach ($groupeCategory['categories'] as $category) {
  776.                     $elements['titreBloc'] = $groupeCategory['titre'];
  777.                     $elements['description'] = $groupeCategory['description'];
  778.                     $elements['image1'] = $groupeCategory['image1'];
  779.                 }
  780.             }
  781.         }
  782.         return $this->render($this->service->checkCustomTemplate('show-tarifschambre.html.twig'), ['groupe' => $elements'hotels' => $hotel->TarifsChambre(['Hotel' => $id_hotel])['TarifsChambre']]);
  783.     }
  784.     /**/
  785.     public function showhotelsRecommandes(WSCMS $WSCMSWSSejourHotel $hotel): Response
  786.     {
  787.         $groupeCategories $WSCMS->Element()['Elements'];
  788.         $elements = array();
  789.         foreach ($groupeCategories as $groupeCategory) {
  790.             if ($groupeCategory['groupeCategorie'] == 'hotelsRecommandes') {
  791.                 foreach ($groupeCategory['categories'] as $category) {
  792.                     $elements['titreBloc'] = $groupeCategory['titre'];
  793.                     $elements['description'] = $groupeCategory['description'];
  794.                     $elements['lienDetails'] = $category['lienDetails'];
  795.                 }
  796.             }
  797.         }
  798.         return $this->render($this->service->checkCustomTemplate('show-hotels-recommande.html.twig'), ['groupe' => $elements'hotels' => $hotel->PackBonPlan()['PackBonPlan']]);
  799.     }
  800.     public function showFlashPromo(WSCMS $WSCMSWSSejourHotel $hotel): Response
  801.     {
  802.         $groupeCategories $WSCMS->Element()['Elements'];
  803.         $elements = array();
  804.         foreach ($groupeCategories as $groupeCategory) {
  805.             if ($groupeCategory['groupeCategorie'] == 'FlashPromo') {
  806.                 foreach ($groupeCategory['categories'] as $category) {
  807.                     $elements['titreBloc'] = $groupeCategory['titre'];
  808.                     $elements['description'] = $groupeCategory['description'];
  809.                     $elements['image1'] = $groupeCategory['image1'];
  810.                     $elements['lienDetails'] = $category['lienDetails'];
  811.                 }
  812.             }
  813.         }
  814.         return $this->render($this->service->checkCustomTemplate('show-flash-promo.html.twig'), ['groupe' => $elements'hotels' => $hotel->FlashPromo()['FlashPromo']]);
  815.     }
  816.     public function showOmra(WSCMS $WSCMS): Response
  817.     {
  818.         $groupeCategories $WSCMS->Element()['Elements'];
  819.         $elements = array();
  820.         foreach ($groupeCategories as $groupeCategory) {
  821.             if ($groupeCategory['groupeCategorie'] == 'Omra')
  822.                 foreach ($groupeCategory['categories'] as $category) {
  823.                     $elements['titreBloc'] = $groupeCategory['titre'];
  824.                     $elements['description'] = $groupeCategory['description'];
  825.                     $elements['image1'] = $groupeCategory['image1'];
  826.                     $elements['lienDetails'] = $category['lienDetails'];
  827.                     if ($category['code'] == 'Omra') {
  828.                         $elements['elements'] = $category['elements'];
  829.                     }
  830.                 }
  831.         }
  832.         return $this->render($this->service->checkCustomTemplate('showOmra.html.twig'), ['groupe' => $elements]);
  833.     }
  834.     public function showHTML(WSCMS $WSCMS): Response
  835.     {
  836.         $groupeCategories $WSCMS->Element()['Elements'];
  837.         $motGroupe "HTML";
  838.         $groupeCategories current(array_filter($groupeCategories, function ($item) use ($motGroupe) {
  839.             return in_array($motGroupe$item);
  840.         }));
  841.         $blocHtml $WSCMS->BlocHtml()['BlocsHtml']['BlocHtml1'];
  842.         return $this->render($this->service->checkCustomTemplate('showBlocHTML.html.twig'), ['blocsHtml' => $blocHtml]);
  843.     }
  844.     public function showHTML2(WSCMS $WSCMS): Response
  845.     {
  846.         $groupeCategories $WSCMS->Element()['Elements'];
  847.         $motGroupe "HTML2";
  848.         $groupeCategories current(array_filter($groupeCategories, function ($item) use ($motGroupe) {
  849.             return in_array($motGroupe$item);
  850.         }));
  851.         $blocHtml $WSCMS->BlocHtml()['BlocsHtml']['BlocHtml2'];
  852.         return $this->render($this->service->checkCustomTemplate('showBlocHTML2.html.twig'), ['blocsHtml' => $blocHtml]);
  853.     }
  854.     public function showHTML3(WSCMS $WSCMS): Response
  855.     {
  856.         $groupeCategories $WSCMS->Element()['Elements'];
  857.         $motGroupe "HTML3";
  858.         $groupeCategories current(array_filter($groupeCategories, function ($item) use ($motGroupe) {
  859.             return in_array($motGroupe$item);
  860.         }));
  861.         $blocHtml $WSCMS->BlocHtml()['BlocsHtml']['BlocHtml3'];
  862.         return $this->render($this->service->checkCustomTemplate('showBlocHTML3.html.twig'), ['blocsHtml' => $blocHtml]);
  863.     }
  864.     /**
  865.      * @Route ("/contact_us", name="contact_us")
  866.      */
  867.     public function contactNos(WSCMS $WSCMS): Response
  868.     {
  869.         return $this->render($this->service->checkCustomTemplate('Contactez-nous.html.twig'));
  870.     }
  871.     /**
  872.      * @Route ("/condition-vente/{produit}",name="condition_vente")
  873.      */
  874.     public function conditionVente($produitWSCMS $WSCMS): Response
  875.     {
  876.         return new Response($WSCMS->ConditionVente()['ConditionVente'][$produit]["texte"]);
  877.     }
  878.     /**
  879.      * @Route("/voyage-carte", name="voyage-carte")
  880.      */
  881.     public function voyagecarte(Request $requestGeneraleExtension $generaleExtensionWSCMS $WSCMS): Response
  882.     {
  883.         $compagnies $WSCMS->Company()['Company'];
  884.         $compagnies_choices array_column($compagnies'id''libelle');
  885.         $form $this->createFormBuilder()
  886.             ->add('email'EmailType::class, array(
  887.                 'required' => false,
  888.                 'attr' => [
  889.                     'placeholder' => 'Entrer votre email'
  890.                 ]
  891.             ))
  892.             ->add('civility'ChoiceType::class, [
  893.                 'choices' => [
  894.                     'Mr' => 'mr',
  895.                     'Mme' => 'mme',
  896.                 ],
  897.                 'expanded' => true,
  898.                 'multiple' => false,
  899.             ])
  900.             ->add('travelType'ChoiceType::class, [
  901.                 'choices' => [
  902.                     'Voyage organisé' => 'voyage-organise',
  903.                     'Voyage Combiné' => 'combine',
  904.                 ],
  905.                 'expanded' => true,
  906.                 'multiple' => false,
  907.                 'data' => 'voyage-organise',
  908.             ])
  909.             ->add('firstDestination'TextType::class, [
  910.                 'required' => true,
  911.                 'attr' => [
  912.                     'placeholder' => 'Ville/Pays pour Destination 1',
  913.                     'class' => 'destination-input'
  914.                 ]
  915.             ])
  916.             ->add('secondDestination'TextType::class, [
  917.                 'required' => false,
  918.                 'attr' => [
  919.                     'placeholder' => 'Ville/Pays pour Destination 2',
  920.                     'class' => 'destination-input'
  921.                 ]
  922.             ])
  923.             ->add('singleHotel'TextType::class, [
  924.                 'required' => true,
  925.                 'attr' => [
  926.                     'placeholder' => 'Ville',
  927.                     'class' => 'w-100',
  928.                     'name' => 'hotelCity',
  929.                     'id' => 'singleHotel'
  930.                 ]
  931.             ])
  932.             ->add('combinedHotels'TextType::class, [
  933.                 'required' => FALSE,
  934.                 'attr' => [
  935.                     'placeholder' => 'Ville',
  936.                     'class' => 'w-100',
  937.                     'name' => 'hotelCity2',
  938.                     'id' => 'combinedHotels'
  939.                 ]
  940.             ])
  941.             ->add('situation'ChoiceType::class, [
  942.                 'choices' => [
  943.                     'Single' => 'Single',
  944.                     'Couple' => 'Couple',
  945.                     'Société' => 'Société',
  946.                     'Voyage de Noces' => 'Voyage-de-Noces',
  947.                     'Famille' => 'Famille',
  948.                     'Personnes Âgées ' => 'Personnes-Âgées ',
  949.                     'groupe amis' => 'groupe-amis',
  950.                 ],
  951.                 'placeholder' => "choisissez",
  952.             ])
  953.             ->add('nbrEtoiles'ChoiceType::class, [
  954.                 'label' => "Catégorie d'Hôtel",
  955.                 'choices' => [
  956.                     '2' => 2,
  957.                     '3' => 3,
  958.                     '4' => 4,
  959.                     '5' => 5,
  960.                 ],
  961.                 'expanded' => true,
  962.                 'multiple' => false,
  963.                 'required' => true,
  964.                 'attr' => [
  965.                     'id' => 'hotelCategoryGroup',
  966.                 ],
  967.             ])
  968.             ->add('hotelSuggestions'ChoiceType::class, [
  969.                 'label' => "Suggestions d'Hôtels (max 3)",
  970.                 'choices' => [
  971.                     'Économique' => 'economique',
  972.                     'Confort' => 'confort',
  973.                 ],
  974.                 'expanded' => true,
  975.                 'multiple' => false,
  976.                 'placeholder' => false,
  977.                 'required' => false,
  978.                 'attr' => [],
  979.             ])
  980.             ->add('pension'ChoiceType::class, [
  981.                 'choices' => [
  982.                     'Petit déjeuner' => 'Petit-déjeuner',
  983.                     'Demi pension' => 'Demi-pension',
  984.                     'Pension complète' => 'Pension-complète',
  985.                     'All inclusive' => 'All inclusive',
  986.                 ],
  987.                 'placeholder' => "choisissez",
  988.             ])
  989.             ->add('transport'ChoiceType::class, [
  990.                 'choices' => [
  991.                     'Vol' => 'vol',
  992.                     'Bus' => 'bus',
  993.                     'Train' => 'train',
  994.                     'Bateau' => 'bateau',
  995.                 ],
  996.                 'placeholder' => 'Choisissez...',
  997.                 'attr' => [
  998.                     'name' => 'transport',
  999.                     'id' => 'transportSelect',
  1000.                     'required' => false,
  1001.                 ],
  1002.             ])
  1003.             ->add('flightType'ChoiceType::class, [
  1004.                 'choices' => [
  1005.                     'Indirect' => 'indirect',
  1006.                 ],
  1007.                 'placeholder' => 'Direct',
  1008.                 'attr' => [
  1009.                     'id' => 'flightTypeSelect',
  1010.                     'name' => 'flightType'
  1011.                 ],
  1012.                 'required' => false,
  1013.             ])
  1014.             ->add('airline'ChoiceType::class, [
  1015.                 'choices' => $compagnies_choices,
  1016.                 'placeholder' => 'Choisissez...',
  1017.                 'attr' => [
  1018.                     'id' => 'airlineSelect',
  1019.                     'name' => 'airline',
  1020.                     'class' => 'selectpicker',
  1021.                     'data-live-search' => 'true'
  1022.                 ],
  1023.                 'required' => false,
  1024.             ])
  1025.             ->add('transfert'CheckboxType::class, [
  1026.                 'attr' => [
  1027.                     'id' => 'transfertCheckbox',
  1028.                 ],
  1029.                 'required' => false,
  1030.             ])
  1031.             ->add('nbrPersonne'IntegerType::class, array(
  1032.                 'required' => false,
  1033.                 'attr' => [
  1034.                     'placeholder' => 'Nombre de personne ',
  1035.                     'min' => 1,
  1036.                     'max' => 100,
  1037.                 ]
  1038.             ))
  1039.             ->add('adulte'IntegerType::class, array(
  1040.                 'required' => false,
  1041.                 'attr' => [
  1042.                     'placeholder' => 'Adultes  ',
  1043.                     'min' => 0,
  1044.                     'max' => 100,
  1045.                 ]
  1046.             ))
  1047.             ->add('nbrEnfant'IntegerType::class, array(
  1048.                 'required' => false,
  1049.                 'attr' => [
  1050.                     'placeholder' => 'Nombre de enfant ',
  1051.                     'min' => 0,
  1052.                     'max' => 100,
  1053.                     'id' => 'childrenInput',
  1054.                 ]
  1055.             ))
  1056.             ->add('agesEnfants'HiddenType::class, [
  1057.                 'mapped' => true,
  1058.                 'required' => false,
  1059.                 'attr' => [
  1060.                     'id' => 'childrenAgesHidden',
  1061.                 ],
  1062.             ])
  1063.             ->add('nbrBebe'IntegerType::class, array(
  1064.                 'required' => false,
  1065.                 'attr' => [
  1066.                     'placeholder' => 'Nombre de Bébé ',
  1067.                     'min' => 0,
  1068.                     'max' => 100,
  1069.                 ]
  1070.             ))
  1071.             ->add('nom'TextType::class, array(
  1072.                 'required' => TRUE,
  1073.                 'attr' => [
  1074.                     'placeholder' => 'nom '
  1075.                 ]
  1076.             ))
  1077.             ->add('prenom'TextType::class, array(
  1078.                 'required' => TRUE,
  1079.                 'attr' => [
  1080.                     'placeholder' => ' prénom'
  1081.                 ]
  1082.             ))
  1083. //        ->add('avatar', FileType::class, array(
  1084. //            'required' => TRUE,
  1085. //            ))
  1086.             ->add('start'DateType::class, array(
  1087.                 'required' => TRUE,
  1088.                 'format' => 'yyyy-MM-dd',
  1089.                 'widget' => 'single_text',
  1090.                 'attr' => [
  1091.                     'min' => (new \DateTime())->format('Y-m-d'),
  1092.                 ]
  1093.             ))
  1094.             ->add('retourDate'DateType::class, array(
  1095.                 'required' => TRUE,
  1096.                 'format' => 'yyyy-MM-dd',
  1097.                 'widget' => 'single_text',
  1098.                 'attr' => [
  1099.                     'min' => (new \DateTime())->format('Y-m-d'),
  1100.                 ]
  1101.             ))
  1102.             ->add('startDest1'DateType::class, array(
  1103.                 'required' => false,
  1104.                 'format' => 'yyyy-MM-dd',
  1105.                 'widget' => 'single_text',
  1106.                 'attr' => [
  1107.                     'min' => (new \DateTime())->format('Y-m-d'),
  1108.                 ]
  1109.             ))
  1110.             ->add('retourDest1'DateType::class, array(
  1111.                 'required' => false,
  1112.                 'format' => 'yyyy-MM-dd',
  1113.                 'widget' => 'single_text',
  1114.                 'attr' => [
  1115.                     'min' => (new \DateTime())->format('Y-m-d'),
  1116.                 ]
  1117.             ))
  1118.             ->add('startDest2'DateType::class, array(
  1119.                 'required' => false,
  1120.                 'format' => 'yyyy-MM-dd',
  1121.                 'widget' => 'single_text',
  1122.                 'attr' => [
  1123.                     'min' => (new \DateTime())->format('Y-m-d'),
  1124.                 ]
  1125.             ))
  1126.             ->add('retourDest2'DateType::class, array(
  1127.                 'required' => false,
  1128.                 'format' => 'yyyy-MM-dd',
  1129.                 'widget' => 'single_text',
  1130.                 'attr' => [
  1131.                     'min' => (new \DateTime())->format('Y-m-d'),
  1132.                 ]
  1133.             ))
  1134.             ->add('adresse'TextType::class, array(
  1135.                 'required' => TRUE,
  1136.                 'attr' => [
  1137.                     'placeholder' => 'Entrer votre adresse'
  1138.                 ]
  1139.             ))
  1140.             ->add('destination'TextType::class, array(
  1141.                 'required' => TRUE,
  1142.                 'attr' => [
  1143.                     'placeholder' => 'Entrer votre Destination'
  1144.                 ]
  1145.             ))
  1146.             ->add('tel'TextType::class, array(
  1147.                 'required' => false,
  1148.                 'attr' => [
  1149.                     'placeholder' => 'Entrer votre Téléphone'
  1150.                 ]
  1151.             ))
  1152.             ->add('subject'TextareaType::class, array(
  1153.                 'required' => false,
  1154.                 'attr' => [
  1155.                     'placeholder' => 'Commentaire'
  1156.                 ]
  1157.             ))
  1158.             ->add('code_formulaire'HiddenType::class, array('required' => false'data' => 'demande_voyage_carte',));
  1159.         $form $form->getForm();
  1160.         $form->handleRequest($request);
  1161.         if ($request->isMethod('POST') && $request->isXmlHttpRequest()) {
  1162.             try {
  1163.                 /*  parse_str($request->request->get('form'), $form);*/
  1164.                 /*  dd($form);*/
  1165.                 $data $form->getData();
  1166.                 /* dd($data);*/
  1167.                 $body $this->renderView('FrontCommun/formulaire_mail_body.html.twig', array(
  1168.                     'nom' => $data['nom'],
  1169.                     'start' => $data['start'],
  1170.                     'email' => $data['email'],
  1171.                     'adresse' => $data['adresse'] ?? '',
  1172.                     'destination' => $data['destination'] ?? '',
  1173.                     'tel' => $data['tel'],
  1174.                     'subject' => $data['subject'],
  1175.                 ));
  1176.                 $params = array(
  1177.                     'mailToClient' => true,
  1178.                     'email' => $data['email'],
  1179.                     'subject' => $data['subject'],
  1180.                     'body' => $body,
  1181.                     'post' => $_POST,
  1182.                     'code_formulaire' => $data['code_formulaire']
  1183.                 );
  1184.                 $result $WSCMS->SendMailLibre($params);
  1185.             } catch (\Exception $e) {
  1186.                 $msg '<span style="color:red">' $e->getMessage() . '</span>';
  1187.                 return new Response($msg);
  1188.             }
  1189.             if ($result != 0) {
  1190.                 $msg "<span style='color:green'>Votre message a été Envoyé avec succès !</span>";
  1191.             } else {
  1192.                 $msg '<span style="color:red">Echèc d\'envoi</span>';
  1193.             }
  1194.             return new Response($msg);
  1195.         }
  1196.         $configAffichage = array();
  1197.         if (!is_null($WSCMS->ConfigFrontOffice()))
  1198.             $configAffichage $WSCMS->ConfigFrontOffice()['ConfigFrontOffice'];
  1199.         return $this->render($this->service->checkCustomTemplate('demande_voyage_carte.html.twig'), array(
  1200.             'form' => $form->createView(),
  1201.             'configAffichage' => $configAffichage,
  1202.         ));
  1203.     }
  1204.     /**
  1205.      * @Route("/inscriptioncomite", name="inscription-comite")
  1206.      */
  1207.     public function inscriptioncomite(Request $requestGeneraleExtension $generaleExtensionWSCMS $WSCMS): Response
  1208.     {
  1209.         $form $this->createFormBuilder()
  1210.             ->add('email'EmailType::class, array(
  1211.                 'required' => TRUE,
  1212.                 'attr' => [
  1213.                     'placeholder' => 'Entrer votre email'
  1214.                 ]
  1215.             ))
  1216.             ->add('nom_agence'TextType::class, array(
  1217.                 'required' => TRUE,
  1218.                 'attr' => [
  1219.                     'placeholder' => 'Nom du comité ou de l’Amicale'
  1220.                 ]
  1221.             ))
  1222.             ->add('nom'TextType::class, array(
  1223.                 'required' => TRUE,
  1224.                 'attr' => [
  1225.                     'placeholder' => 'Nom du Contact'
  1226.                 ]
  1227.             ))
  1228.             ->add('num_adh'IntegerType::class, array(
  1229.                 'required' => TRUE,
  1230.                 'attr' => [
  1231.                     'placeholder' => 'Nombre d’adhérent'
  1232.                 ]
  1233.             ))
  1234.             ->add('civ'ChoiceType::class, [
  1235.                     'choices' => [
  1236.                         "Mr" => "Mr",
  1237.                         "Mme" => "Mme",
  1238.                         "Mlle" => "Mlle",
  1239.                     ]
  1240.                 ]
  1241.             )
  1242. //        ->add('avatar', FileType::class, array(
  1243. //            'required' => TRUE,
  1244. //            ))
  1245.             ->add('adresse'TextType::class, array(
  1246.                 'required' => TRUE,
  1247.                 'attr' => [
  1248.                     'placeholder' => 'Entrer votre adresse'
  1249.                 ]
  1250.             ))
  1251.             ->add('tel'IntegerType::class, array(
  1252.                 'required' => TRUE,
  1253.                 'attr' => [
  1254.                     'placeholder' => 'Entrer votre Téléphone'
  1255.                 ]
  1256.             ))
  1257.             ->add('subject'HiddenType::class, [
  1258.                 'data' => 'demande-inscription',
  1259.             ]);
  1260.         $form $form->getForm();
  1261.         if ($request->isMethod('POST') && $request->isXmlHttpRequest()) {
  1262.             try {
  1263.                 parse_str($request->request->get('form'), $form);
  1264.                 $data $form['form'];
  1265.                 /* dd($data);*/
  1266.                 $body $this->renderView('FrontCommun/formulaire_mail_body.html.twig', array(
  1267.                     'nom_agence' => $data['nom_agence'],
  1268.                     'nom' => $data['nom'],
  1269.                     'num_adh' => $data['num_adh'],
  1270.                     'civ' => $data['civ'],
  1271.                     'email' => $data['email'],
  1272.                     'adresse' => $data['adresse'],
  1273.                     'tel' => $data['tel'],
  1274.                     'subject' => $data['subject'],
  1275.                 ));
  1276.                 $params = array(
  1277.                     'email' => $data['email'],
  1278.                     'subject' => $data['subject'],
  1279.                     'body' => $body,
  1280.                 );
  1281.                 $result $WSCMS->SendMailLibre($params);
  1282.                 $params['mailToClient'] = true;
  1283.                 $result $WSCMS->SendMailLibre($params);
  1284.             } catch (\Exception $e) {
  1285.                 $msg '<span style="color:red">' $e->getMessage() . '</span>';
  1286.                 return new Response($msg);
  1287.             }
  1288.             if ($result != 0) {
  1289.                 $msg "<span style='color:green'>Votre message a été Envoyé avec succès !</span>";
  1290.             } else {
  1291.                 $msg '<span style="color:red">Echèc d\'envoi</span>';
  1292.             }
  1293.             return new Response($msg);
  1294.         }
  1295.         $configAffichage = array();
  1296.         if (!is_null($WSCMS->ConfigFrontOffice()))
  1297.             $configAffichage $WSCMS->ConfigFrontOffice()['ConfigFrontOffice'];
  1298.         return $this->render($this->service->checkCustomTemplate('demande_commite.html.twig'), array(
  1299.             'form' => $form->createView(),
  1300.             'configAffichage' => $configAffichage,
  1301.         ));
  1302.     }
  1303.     /**
  1304.      * @Route("/demande_voyage_groupe", name="demande_voyage_groupe")
  1305.      */
  1306.     public function voyage_groupe(Request $requestGeneraleExtension $generaleExtensionWSCMS $WSCMS): Response
  1307.     {
  1308.         $form $this->createFormBuilder()
  1309.             ->add('email'EmailType::class, array(
  1310.                 'required' => TRUE,
  1311.                 'attr' => [
  1312.                     'placeholder' => 'Entrer votre email'
  1313.                 ]
  1314.             ))
  1315.             ->add('Type_groupe'ChoiceType::class, array(
  1316.                 'required' => TRUE,
  1317.                 'choices' => [
  1318.                     "Groupe d'amis" => "Groupe d'amis",
  1319.                     "Association" => "Association",
  1320.                     "entreprise" => "entreprise",
  1321.                 ]
  1322.             ))
  1323.             /* ->add('destination', ChoiceType::class, array(
  1324.                  'required' => TRUE,
  1325.                  'destination' => [
  1326.                      "Ain Draham" => "Ain Draham",
  1327.                      "Bizerte" => "Bizerte",
  1328.                      "Djerba" => "Djerba",
  1329.                      "Douz" => "Douz",
  1330.                      "El Jem" => "El Jem",
  1331.                      "Gafsa" => "Gafsa",
  1332.                      "Gammarth" => "Gammarth",
  1333.                      "Hammamet" => "Hammamet",
  1334.                      "Kairouan" => "Kairouan",
  1335.                      "Mahdia" => "Mahdia",
  1336.                      "Monastir" => "Monastir",
  1337.                      "Nabeul" => "Nabeul",
  1338.                      "Sbeitla" => "Sbeitla",
  1339.                      "Sfax" => "Sfax",
  1340.                      "Sousse" => "Sousse",
  1341.                      "Tabarka" => "Tabarka",
  1342.                      "Tozeur" => "Tozeur",
  1343.                      "Tunis" => "Tunis",
  1344.                      "Zarzis" => "Zarzis",
  1345.                  ]
  1346.              ))*/
  1347.             ->add('nom_hotel'TextType::class, array(
  1348.                 'required' => TRUE,
  1349.                 'attr' => [
  1350.                     'placeholder' => 'Nom de Hôtel ou catégorie'
  1351.                 ]
  1352.             ))
  1353.             ->add('start'DateType::class, array(
  1354.                 'required' => TRUE,
  1355.                 'format' => 'yyyy-MM-dd',
  1356.                 'widget' => 'single_text',
  1357.             ))
  1358.             ->add('civ'ChoiceType::class, [
  1359.                     'choices' => [
  1360.                         "Mr" => "Mr",
  1361.                         "Mme" => "Mme",
  1362.                         "Mlle" => "Mlle",
  1363.                     ]
  1364.                 ]
  1365.             )
  1366.             ->add('num_participants'IntegerType::class, array(
  1367.                 'mapped' => false,
  1368.                 'required' => false,
  1369.                 'constraints' => [new Positive()],
  1370.                 'attr' => [
  1371.                     'min' => 20
  1372.                 ]
  1373.             ))
  1374.             ->add('num_nuite'IntegerType::class, array(
  1375.                 'mapped' => false,
  1376.                 'required' => false,
  1377.                 'constraints' => [new Positive()],
  1378.                 'attr' => [
  1379.                     'min' => 1
  1380.                 ]
  1381.             ))
  1382.             ->add('num_budget'IntegerType::class, array(
  1383.                 'mapped' => false,
  1384.                 'required' => false,
  1385.                 'constraints' => [new Positive()],
  1386.                 'attr' => [
  1387.                     'placeholder' => 'Budget/personne'
  1388.                 ]
  1389.             ))
  1390.             ->add('formule'ChoiceType::class, [
  1391.                     'choices' => [
  1392.                         "Logement Petit Déjeuner" => "Logement Petit Déjeuner",
  1393.                         "Demi Pension" => "Demi Pension",
  1394.                         "Pension Complète" => "Pension Complète",
  1395.                         "Tous compris" => "Tous compris",
  1396.                     ]
  1397.                 ]
  1398.             )
  1399.             ->add('demandespec'TextareaType::class, array(
  1400.                 'required' => TRUE,
  1401.                 'attr' => [
  1402.                     'placeholder' => 'Demande spécifique'
  1403.                 ]
  1404.             ))
  1405. //        ->add('avatar', FileType::class, array(
  1406. //            'required' => TRUE,
  1407. //            ))
  1408.             ->add('nom'TextType::class, array(
  1409.                 'required' => TRUE,
  1410.                 'attr' => [
  1411.                     'placeholder' => 'Nom & prénom'
  1412.                 ]
  1413.             ))
  1414.             ->add('adresse'TextType::class, array(
  1415.                 'required' => TRUE,
  1416.                 'attr' => [
  1417.                     'placeholder' => 'Entrer votre adresse'
  1418.                 ]
  1419.             ))
  1420.             ->add('tel'IntegerType::class, array(
  1421.                 'required' => TRUE,
  1422.                 'attr' => [
  1423.                     'placeholder' => 'Entrer votre Téléphone'
  1424.                 ]
  1425.             ))
  1426.             ->add('subject'HiddenType::class, [
  1427.                 'data' => 'demande-groupe-voyage',
  1428.             ]);
  1429.         $form $form->getForm();
  1430.         if ($request->isMethod('POST') && $request->isXmlHttpRequest()) {
  1431.             try {
  1432.                 parse_str($request->request->get('form'), $form);
  1433.                 $data $form['form'];
  1434.                 /* dd($data);*/
  1435.                 $body $this->renderView('FrontCommun/formulaire_mail_body.html.twig', array(
  1436.                     'Type_groupe' => $data['Type_groupe'],
  1437.                     'num_participants' => $data['num_participants'],
  1438.                     'email' => $data['email'],
  1439.                     'civ' => $data['civ'],
  1440.                     'nom_hotel' => $data['nom_hotel'],
  1441.                     'nom' => $data['nom'],
  1442.                     'num_nuite' => $data['num_nuite'],
  1443.                     'tel' => $data['tel'],
  1444.                     'start' => $data['start'],
  1445.                     'formule' => $data['formule'],
  1446.                     'num_budget' => $data['num_budget'],
  1447.                     'adresse' => $data['adresse'],
  1448.                     'subject' => $data['subject'],
  1449.                     'demandespec' => $data['demandespec'],
  1450.                 ));
  1451.                 $params = array(
  1452.                     'email' => $data['email'],
  1453.                     'subject' => $data['subject'],
  1454.                     'body' => $body,
  1455.                 );
  1456.                 $result $WSCMS->SendMailLibre($params);
  1457.                 $params['mailToClient'] = true;
  1458.                 $result $WSCMS->SendMailLibre($params);
  1459.             } catch (\Exception $e) {
  1460.                 $msg '<span style="color:red">' $e->getMessage() . '</span>';
  1461.                 return new Response($msg);
  1462.             }
  1463.             if ($result != 0) {
  1464.                 $msg "<span style='color:green'>Votre message a été Envoyé avec succès !</span>";
  1465.             } else {
  1466.                 $msg '<span style="color:red">Echèc d\'envoi</span>';
  1467.             }
  1468.             return new Response($msg);
  1469.         }
  1470.         $configAffichage = array();
  1471.         if (!is_null($WSCMS->ConfigFrontOffice()))
  1472.             $configAffichage $WSCMS->ConfigFrontOffice()['ConfigFrontOffice'];
  1473.         return $this->render($this->service->checkCustomTemplate('formulaire_voyage_groupe.html.twig'), array(
  1474.             'form' => $form->createView(),
  1475.             'configAffichage' => $configAffichage,
  1476.         ));
  1477.     }
  1478.     /**
  1479.      * @Route("/omra", name="omra")
  1480.      */
  1481.     public function omra(Request $requestGeneraleExtension $generaleExtensionWSCMS $WSCMS): Response
  1482.     {
  1483.         $form $this->createFormBuilder()
  1484.             ->add('email'EmailType::class, array(
  1485.                 'required' => TRUE,
  1486.                 'attr' => [
  1487.                     'placeholder' => 'Entrer votre email'
  1488.                 ]
  1489.             ))
  1490.             ->add('nom'TextType::class, array(
  1491.                 'required' => TRUE,
  1492.                 'attr' => [
  1493.                     'placeholder' => 'nom & prénom'
  1494.                 ]
  1495.             ))
  1496. //        ->add('avatar', FileType::class, array(
  1497. //            'required' => TRUE,
  1498. //            ))
  1499.             ->add('start'DateType::class, array(
  1500.                 'required' => TRUE,
  1501.                 'format' => 'yyyy-MM-dd',
  1502.                 'widget' => 'single_text',
  1503.             ))
  1504.             ->add('adresse'TextType::class, array(
  1505.                 'required' => TRUE,
  1506.                 'attr' => [
  1507.                     'placeholder' => 'Entrer votre adresse'
  1508.                 ]
  1509.             ))
  1510.             ->add('tel'TextType::class, array(
  1511.                 'required' => TRUE,
  1512.                 'attr' => [
  1513.                     'placeholder' => 'Entrer votre Téléphone'
  1514.                 ]
  1515.             ))
  1516.             ->add('subject'TextareaType::class, array(
  1517.                 'required' => TRUE,
  1518.                 'attr' => [
  1519.                     'placeholder' => 'Commentaire'
  1520.                 ]
  1521.             ));
  1522.         $form $form->getForm();
  1523.         if ($request->isMethod('POST') && $request->isXmlHttpRequest()) {
  1524.             try {
  1525.                 parse_str($request->request->get('form'), $form);
  1526.                 $data $form['form'];
  1527.                 /* dd($data);*/
  1528.                 $body $this->renderView('FrontCommun/formulaire_mail_body.html.twig', array(
  1529.                     'nom' => $data['nom'],
  1530.                     'start' => $data['start'],
  1531.                     /*                    'avatar' => $data['avatar'],*/
  1532.                     'email' => $data['email'],
  1533.                     'adresse' => $data['adresse'],
  1534.                     'tel' => $data['tel'],
  1535.                     'subject' => $data['subject'],
  1536.                 ));
  1537.                 $params = array(
  1538.                     'email' => $data['email'],
  1539.                     'subject' => $data['subject'],
  1540.                     'body' => $body,
  1541.                 );
  1542.                 $result $WSCMS->SendMailLibre($params);
  1543.                 $params['mailToClient'] = true;
  1544.                 $result $WSCMS->SendMailLibre($params);
  1545.             } catch (\Exception $e) {
  1546.                 $msg '<span style="color:red">' $e->getMessage() . '</span>';
  1547.                 return new Response($msg);
  1548.             }
  1549.             if ($result != 0) {
  1550.                 $msg "<span style='color:green'>Votre message a été Envoyé avec succès !</span>";
  1551.             } else {
  1552.                 $msg '<span style="color:red">Echèc d\'envoi</span>';
  1553.             }
  1554.             return new Response($msg);
  1555.         }
  1556.         $configAffichage = array();
  1557.         if (!is_null($WSCMS->ConfigFrontOffice()))
  1558.             $configAffichage $WSCMS->ConfigFrontOffice()['ConfigFrontOffice'];
  1559.         return $this->render($this->service->checkCustomTemplate('demande_omra.html.twig'), array(
  1560.             'form' => $form->createView(),
  1561.             'configAffichage' => $configAffichage,
  1562.         ));
  1563.     }
  1564.     /**
  1565.      * @Route("/omra-carte-formulaire", name="omra_carte_formulaire")
  1566.      *
  1567.      */
  1568.     public function formOmraCarteFormulaire(Request $requestGeneraleExtension $generaleExtensionWSCMS $WSCMS): Response
  1569.     {
  1570.         $infoAgence $generaleExtension->getAgence()['information'];
  1571.         $form $this->createFormBuilder(null, ['csrf_protection' => true])
  1572.             ->add('civility'ChoiceType::class, [
  1573.                 'choices' => [
  1574.                     'Mr' => 'mr',
  1575.                     'Mme' => 'mme',
  1576.                 ],
  1577.                 'placeholder' => "choisissez",
  1578.             ])
  1579.             ->add('nom'TextType::class, array(
  1580.                 'required' => TRUE,
  1581.                 'attr' => [
  1582.                     'placeholder' => 'nom '
  1583.                 ]
  1584.             ))
  1585.             ->add('prenom'TextType::class, array(
  1586.                 'required' => TRUE,
  1587.                 'attr' => [
  1588.                     'placeholder' => ' prénom'
  1589.                 ]
  1590.             ))
  1591.             ->add('situation'ChoiceType::class, [
  1592.                 'choices' => [
  1593.                     'Single' => 'Single',
  1594.                     'Couple' => 'Couple',
  1595.                     'Société' => 'Société',
  1596.                     'Famille' => 'Famille',
  1597.                     'Amicale ' => 'amicale',
  1598.                 ],
  1599.                 'placeholder' => "choisissez",
  1600.             ])
  1601.             ->add('adulte'IntegerType::class, array(
  1602.                 'required' => false,
  1603.                 'attr' => [
  1604.                     'placeholder' => 'Adultes  ',
  1605.                     'min' => 0,
  1606.                     'max' => 100,
  1607.                 ]
  1608.             ))
  1609.             ->add('nbrEnfant'IntegerType::class, array(
  1610.                 'required' => false,
  1611.                 'attr' => [
  1612.                     'placeholder' => 'Nombre de enfant ',
  1613.                     'min' => 0,
  1614.                     'max' => 100,
  1615.                     'id' => 'nb_enfants',
  1616.                 ]
  1617.             ))
  1618.             ->add('nbrBebe'IntegerType::class, array(
  1619.                 'required' => false,
  1620.                 'attr' => [
  1621.                     'placeholder' => 'Nombre de Bébé ',
  1622.                     'min' => 0,
  1623.                     'max' => 100,
  1624.                 ]
  1625.             ))
  1626.             ->add('tel'TextType::class, array(
  1627.                 'required' => TRUE,
  1628.                 'attr' => [
  1629.                     'placeholder' => 'Entrer votre Téléphone'
  1630.                 ]
  1631.             ))
  1632.             ->add('email'EmailType::class, array(
  1633.                 'required' => TRUE,
  1634.                 'attr' => [
  1635.                     'placeholder' => 'Entrer votre email'
  1636.                 ]
  1637.             ))
  1638.             ->add('ville_depart'TextType::class, array(
  1639.                 'required' => TRUE,
  1640.                 'attr' => [
  1641.                     'placeholder' => 'ville départ'
  1642.                 ]
  1643.             ))
  1644.             ->add('destAller'ChoiceType::class, [
  1645.                 'choices' => [
  1646.                     'Jeddah' => 'Jeddah',
  1647.                     'Medina' => 'Medina',
  1648.                 ],
  1649.                 'placeholder' => "choisissez",
  1650.             ])
  1651.             ->add('destRetour'ChoiceType::class, [
  1652.                 'choices' => [
  1653.                     'Jeddah' => 'Jeddah',
  1654.                     'Medina' => 'Medina',
  1655.                 ],
  1656.                 'placeholder' => "choisissez",
  1657.             ])
  1658.             ->add('villeRetour'TextType::class, array(
  1659.                 'required' => TRUE,
  1660.                 'attr' => [
  1661.                     'placeholder' => 'ville départ'
  1662.                 ]
  1663.             ))
  1664.             ->add('dateDepart'DateType::class, array(
  1665.                 'required' => TRUE,
  1666.                 'format' => 'yyyy-MM-dd',
  1667.                 'widget' => 'single_text',
  1668.                 'attr' => [
  1669.                     'min' => (new \DateTime())->format('Y-m-d'),
  1670.                 ]
  1671.             ))
  1672.             ->add('dateRetour'DateType::class, array(
  1673.                 'required' => TRUE,
  1674.                 'format' => 'yyyy-MM-dd',
  1675.                 'widget' => 'single_text',
  1676.                 'attr' => [
  1677.                     'min' => (new \DateTime())->format('Y-m-d'),
  1678.                 ]
  1679.             ))
  1680.             ->add('flightType'ChoiceType::class, [
  1681.                 'choices' => [
  1682.                     'Direct' => 'Direct',
  1683.                     'Indirect' => 'indirect',
  1684.                 ],
  1685.                 'attr' => [
  1686.                     'id' => 'type_vol',
  1687.                 ],
  1688.                 'placeholder' => 'Sélectionnez',
  1689.                 'required' => true,
  1690.             ])
  1691.             ->add('compagnieAerien'TextType::class, array(
  1692.                 'required' => false,
  1693.                 'attr' => [
  1694.                     'placeholder' => 'Turkish Airlines'
  1695.                 ]
  1696.             ))
  1697.             ->add('escale'TextType::class, array(
  1698.                 'required' => false,
  1699.                 'attr' => [
  1700.                     'placeholder' => 'Ex: istanbul'
  1701.                 ]
  1702.             ))
  1703.             ->add('transfert'ChoiceType::class, [
  1704.                 'choices' => [
  1705.                     'Oui' => 'Oui',
  1706.                     'Non' => 'non',
  1707.                 ],
  1708.                 'expanded' => true,
  1709.                 'multiple' => false,
  1710.             ])
  1711.             ->add('moyen_transport'ChoiceType::class, [
  1712.                 'required' => false,
  1713.                 'choices' => [
  1714.                     'Bus' => 'bus',
  1715.                     'GMC' => 'GMC',
  1716.                     'train' => 'train',
  1717.                 ],
  1718.                 'placeholder' => 'Choisissez...',
  1719.                 'attr' => [
  1720.                     'id' => 'moyenTransport',
  1721.                 ],
  1722.             ])
  1723.             ->add('destinationTrain'ChoiceType::class, [
  1724.                 'required' => false,
  1725.                 'choices' => [
  1726.                     'Gare de Medina' => 'Gare-de-Medina',
  1727.                     'Gare de Jeddah' => 'Gare-de-Jeddah',
  1728.                     'Gare de Mekka' => 'Gare-de-Mekka',
  1729.                 ],
  1730.                 'placeholder' => 'Choisissez...',
  1731.                 'attr' => [
  1732.                     'id' => 'train_destination',
  1733.                 ],
  1734.             ])
  1735.             ->add('Itineraire'TextType::class, array(
  1736.                 'required' => false,
  1737.                 'attr' => [
  1738.                     'placeholder' => 'Ex: Jeddah à Medina',
  1739.                     'id' => 'train_itineraire',
  1740.                 ]
  1741.             ))
  1742.             ->add('hotelMakkah'TextType::class, array(
  1743.                 'required' => false,
  1744.                 'attr' => [
  1745.                     'placeholder' => 'Nom de l\'hôtel suggéré',
  1746.                     'id' => 'hotel_mekka',
  1747.                 ]
  1748.             ))
  1749.             ->add('hotelMedina'TextType::class, array(
  1750.                 'required' => false,
  1751.                 'attr' => [
  1752.                     'placeholder' => 'Nom de l\'hôtel suggéré',
  1753.                     'id' => 'hotel_medina',
  1754.                 ]
  1755.             ))
  1756.             ->add('pension'ChoiceType::class, [
  1757.                 'required' => true,
  1758.                 'choices' => [
  1759.                     'Petit déjeuner' => 'Petit-déjeuner',
  1760.                     'Demi pension' => 'Demi-pension',
  1761.                     'Pension complète' => 'Pension-complète',
  1762.                 ],
  1763.                 'placeholder' => "Sélectionnez",
  1764.             ])
  1765.             ->add('categorieHotel'ChoiceType::class, [
  1766.                 'required' => true,
  1767.                 'choices' => [
  1768.                     '2 Étoiles ' => '2-etoiles',
  1769.                     '3 Étoiles' => '3-etoiles',
  1770.                     '4 Étoiles' => '4-etoiles',
  1771.                     '5 Étoiles' => '5-etoiles',
  1772.                 ],
  1773.                 'placeholder' => "Sélectionnez",
  1774.             ])
  1775.             ->add('typeChambre'ChoiceType::class, [
  1776.                 'required' => false,
  1777.                 'choices' => [
  1778.                     'Single ' => 'Single',
  1779.                     'Double' => 'Double',
  1780.                     'Triple' => 'Triple',
  1781.                     'Quadruple' => 'Quadruple',
  1782.                     'Plus (5+)' => 'Plus',
  1783.                 ],
  1784.                 'placeholder' => "Type de Chambre",
  1785.             ])
  1786.             ->add('nbrPersonne'IntegerType::class, array(
  1787.                 'required' => false,
  1788.                 'attr' => [
  1789.                     'placeholder' => 'Nombre de personnes ',
  1790.                     'min' => 1,
  1791.                     'max' => 100,
  1792.                 ]
  1793.             ))
  1794.             ->add('nbJourMekkah'IntegerType::class, array(
  1795.                 'required' => false,
  1796.                 'attr' => [
  1797.                     'min' => 1,
  1798.                     'max' => 100,
  1799.                 ]
  1800.             ))
  1801.             ->add('nbJourMedina'IntegerType::class, array(
  1802.                 'required' => false,
  1803.                 'attr' => [
  1804.                     'min' => 1,
  1805.                     'max' => 100,
  1806.                 ]
  1807.             ))
  1808.             ->add('subject'TextareaType::class, array(
  1809.                 'required' => false,
  1810.                 'attr' => [
  1811.                     'placeholder' => 'Décrivez vos préférences...'
  1812.                 ]
  1813.             ))
  1814.             ->add('code_formulaire'HiddenType::class,
  1815.                 array(
  1816.                     'required' => false,
  1817.                     'data' => 'omra-formulaire' ,
  1818.                 ));
  1819.         $form $form->getForm();
  1820.         $form->handleRequest($request);
  1821.         if ($request->isMethod('POST') && $request->isXmlHttpRequest()) {
  1822.             try {
  1823.                 $data $form->getData();
  1824.                 $body $this->renderView('FrontCommun/formulaire_mail_body.html.twig', array(
  1825.                     'nom' => $data['nom'],
  1826.                     'ville_depart' => $data['ville_depart'] ,
  1827.                     'email' => $data['email'] ?? '',
  1828.                     'adulte' => $data['adulte'],
  1829.                     'nbrEnfant' => $data['nbrEnfant'],
  1830.                     'nbrBebe' => $data['nbrBebe'],
  1831.                     'civility' => $data['civility'],
  1832.                     'tel' => $data['tel'],
  1833.                     'nbJourMekkah' => $data['nbJourMekkah'],
  1834.                     'nbJourMedina' => $data['nbJourMedina'],
  1835.                     'subject' => $data['subject'],
  1836.                 ));
  1837.                 $params = array(
  1838.                     'subject' => $data['subject'],
  1839.                     'email' => $data['email'],
  1840.                     'post' => $_POST,
  1841.                     'code_formulaire' => $data['code_formulaire'],
  1842.                     'body' => $body
  1843.                 );
  1844. //               dd( $params);
  1845. //                $result = $WSCMS->SendMailLibre($params);
  1846.                 $params['mailToClient'] = true;
  1847.                 $result $WSCMS->SendMailLibre($params);
  1848.             } catch (\Exception $e) {
  1849.                 $msg '<span style="color:red">' $e->getMessage() . '</span>';
  1850.                 return new Response($msg);
  1851.             }
  1852.             if ($result != 0) {
  1853.                 $msg "<span style='color:green'>Votre message a été Envoyé avec succès !</span>";
  1854.             } else {
  1855.                 $msg '<span style="color:red">Echèc d\'envoi</span>';
  1856.             }
  1857.             return new Response($msg);
  1858.         }
  1859.         $configAffichage = array();
  1860.         if (!is_null($WSCMS->ConfigFrontOffice()))
  1861.             $configAffichage $WSCMS->ConfigFrontOffice()['ConfigFrontOffice'];
  1862.         return $this->render($this->service->checkCustomTemplate('omra_carte_formulaire.html.twig'), array(
  1863.             'infoAgence' => $infoAgence,
  1864.             'form' => $form->createView(),
  1865.             'configAffichage' => $configAffichage,
  1866.         ));
  1867.     }
  1868.     /**
  1869.      * @Route("/omra-carte", name="omra_carte_form")
  1870.      *
  1871.      */
  1872.     public function formOmraCarte(Request $requestGeneraleExtension $generaleExtensionWSCMS $WSCMS): Response
  1873.     {
  1874.         $infoAgence $generaleExtension->getAgence()['information'];
  1875.         $form $this->createFormBuilder(null, ['csrf_protection' => true])
  1876.             ->add('nombre_adultes'IntegerType::class, array(
  1877.                 'required' => TRUE,
  1878.                 'attr' => [
  1879.                     'placeholder' => 'Nombre adulte' ,
  1880.                     'min' => 1,
  1881.                     'max' => 20,
  1882.                 ]
  1883.             ))
  1884.             ->add('nombre_enfant'IntegerType::class, array(
  1885.                 'required' => TRUE,
  1886.                 'attr' => [
  1887.                     'placeholder' => 'Nombre d enfant' ,
  1888.                     'min' => 0,
  1889.                     'max' => 5,
  1890.                 ]
  1891.             ))
  1892.             ->add('nombre_bebe'IntegerType::class, array(
  1893.                 'required' => TRUE,
  1894.                 'attr' => [
  1895.                     'placeholder' => 'Nombre bébés' ,
  1896.                     'min' => 0,
  1897.                     'max' => 5,
  1898.                 ]
  1899.             ))
  1900.             ->add('civilite'ChoiceType::class, [
  1901.                 'choices' => [
  1902.                     'Mr' => 'Mr',
  1903.                     'Mme' => 'Mme',
  1904.                     'Mlle' => 'Mlle',
  1905.                 ]
  1906.             ])
  1907.             ->add('nom'TextType::class, array(
  1908.                 'required' => TRUE,
  1909.                 'attr' => [
  1910.                     'placeholder' => 'nom & prénom'
  1911.                 ]
  1912.             ))
  1913.             ->add('tel'TextType::class, array(
  1914.                 'required' => TRUE,
  1915.                 'attr' => [
  1916.                     'placeholder' => 'Entrer votre Téléphone' ,
  1917.                     'type'        => 'tel',
  1918.                     'inputmode'   => 'tel',
  1919.                     'pattern'     => '[0-9+\s\-\(\)]*',
  1920.                     'title'       => 'Veuillez saisir uniquement des chiffres',
  1921.                     'maxlength'   => 20,
  1922.                 ]
  1923.             ))
  1924.             ->add('email'EmailType::class, array(
  1925.                 'required' => TRUE,
  1926.                 'attr' => [
  1927.                     'placeholder' => 'Entrer votre email'
  1928.                 ]
  1929.             ))
  1930.             ->add('ville_depart'TextType::class, array(
  1931.                 'required' => TRUE,
  1932.                 'attr' => [
  1933.                     'placeholder' => 'ville départ' ,
  1934.                 ]
  1935.             ))
  1936.             ->add('date_depart'DateType::class, array(
  1937.                 'required' => TRUE,
  1938.                 'format' => 'yyyy-MM-dd',
  1939.                 'widget' => 'single_text',
  1940.                 'attr' => [
  1941.                     'min' => (new \DateTime('today'))->format('Y-m-d'),
  1942.                 ]
  1943.             ))
  1944.             ->add('chambre_type'ChoiceType::class, [
  1945.                 'choices' => [
  1946.                     'Single' => 'Single',
  1947.                     'Double' => 'Double',
  1948.                     'Triple' => 'Triple',
  1949.                     'Quadruple' => 'Quadruple',
  1950.                     'Junior suite' => 'Junior suite',
  1951.                     'Deluxe suite' => 'Deluxe suite',
  1952.                     'Royal suite' => 'Royal suite'
  1953.                 ]
  1954.             ])
  1955.             ->add('visa_type'ChoiceType::class, [
  1956.                 'choices' => [
  1957.                     'Touristique' => 'Touristique',
  1958.                     'Hajj' => 'Hajj',
  1959.                     'Schengen' => 'Triple',
  1960.                     'Quadruple' => 'Schengen',
  1961.                     'Omra' => 'Omra',
  1962.                     'Américain (USA)' => 'Américain (USA)'
  1963.                 ]
  1964.             ])
  1965.             ->add('list_hotel_makka'ChoiceType::class, [
  1966.                 'choices' => [
  1967.                     'Swissotel Al Maqam Makkah' => 'Swissotel Al Maqam Makkah',
  1968.                     'Swissotel Makkah' => 'Swissotel Makkah',
  1969.                     'Al Shohada Hotel' => 'Al Shohada Hotel',
  1970.                     'Jabal Omar Hyatt Regency Makkah' => 'Jabal Omar Hyatt Regency Makkah',
  1971.                     'Fairmont Makkah Clock Royal Tower' => 'Fairmont Makkah Clock Royal Tower',
  1972.                     'Raffles Makkah Palace' => 'Raffles Makkah Palace',
  1973.                     'Anjum Hotel Makkah' => 'Anjum Hotel Makkah',
  1974.                     'Pullman Zamzam Makkah' => 'Pullman Zamzam Makkah',
  1975.                     'Hilton Makkah' => 'Hilton Makkah',
  1976.                     'Shaza Makkah' => 'Shaza Makkah',
  1977.                     'Sheraton Makkah ' => 'Sheraton Makkah ',
  1978.                 ]
  1979.             ])
  1980.             ->add('list_hotel_medine'ChoiceType::class, [
  1981.                 'choices' => [
  1982.                     'Swissotel Madinah Hilton' => 'Swissotel Madinah Hilton',
  1983.                     ' Intercontinental Madinah-Dar Al Iman' => ' Intercontinental Madinah-Dar Al Iman',
  1984.                     'Hôtel pullman Zamzam Madinah' => 'Hôtel pullman Zamzam Madinah',
  1985.                     'Sofitel Shahd Al Madinah' => 'Sofitel Shahd Al Madinah',
  1986.                     'Intercontinental Dar Al Hijra' => 'Intercontinental Dar Al Hijra',
  1987.                     'Intercontinental Madinah-Dar Al Iman' => 'Intercontinental Madinah-Dar Al Iman',
  1988.                     'Dar Al Taqwa Hotel Madinah' => 'Dar Al Taqwa Hotel Madinah',
  1989.                     'Pullman Zamzam Makkah' => 'Pullman Zamzam Makkah',
  1990.                     'The Oberoi, Madina' => 'The Oberoi, Madina'
  1991.                 ]
  1992.             ])
  1993.             ->add('type_transfert'ChoiceType::class, [
  1994.                 'choices' => [
  1995.                     'TGV' => 'TGV',
  1996.                     'VOITURE' => 'VOITURE'
  1997.                 ]
  1998.             ])
  1999.             ->add('nbr_jour_makka'TextType::class, array(
  2000.                 'required' => TRUE,
  2001.                 'attr' => [
  2002.                     'placeholder' => 'Nombre de jour makka'
  2003.                 ]
  2004.             ))
  2005.             ->add('nbr_jour_medina'TextType::class, array(
  2006.                 'required' => TRUE,
  2007.                 'attr' => [
  2008.                     'placeholder' => 'Nombre de jour medine'
  2009.                 ]
  2010.             ))
  2011.             ->add('subject'TextareaType::class, array(
  2012.                 'required' => TRUE,
  2013.                 'attr' => [
  2014.                     'placeholder' => 'Commentaire'
  2015.                 ]
  2016.             ))
  2017.             ->add('code_formulaire'HiddenType::class,
  2018.                 array(
  2019.                     'required' => false,
  2020.                     'data' => 'Formulaire_Omra_carte',
  2021.                 ));
  2022.         $form $form->getForm();
  2023.         $form->handleRequest($request);
  2024.         if ($request->isMethod('POST') && $request->isXmlHttpRequest()) {
  2025.             try {
  2026.                 $data $form->getData();
  2027.                 $body $this->renderView($this->service->checkCustomTemplate('formulaire_mail_omra_carte.html.twig'), array(
  2028.                     'nom' => $data['nom'],
  2029.                     'ville_depart' => $data['ville_depart'] ?? '',
  2030.                     'email' => $data['email'],
  2031.                     'nombre_adultes' => $data['nombre_adultes'],
  2032.                     'nombre_enfant' => $data['nombre_enfant'],
  2033.                     'nombre_bebe' => $data['nombre_bebe'],
  2034.                     'civilite' => $data['civilite'],
  2035.                     'tel' => $data['tel'],
  2036.                     'chambre_type' => $data['chambre_type'],
  2037.                     'visa_type' => $data['visa_type'],
  2038.                     'list_hotel_makka' => $data['list_hotel_makka'],
  2039.                     'list_hotel_medine' => $data['list_hotel_medine'],
  2040.                     'type_transfert' => $data['type_transfert'],
  2041.                     'nbr_jour_makka' => $data['nbr_jour_makka'],
  2042.                     'nbr_jour_medina' => $data['nbr_jour_medina'],
  2043.                     'subject' => $data['subject'],
  2044.                 ));
  2045.                 $params = array(
  2046.                     'subject' => $data['subject'],
  2047.                     'email' => $data['email'],
  2048.                     'post' => $_POST,
  2049.                     'code_formulaire' => $data['code_formulaire'],
  2050.                     'body' => $body
  2051.                 );
  2052. //               dd( $params);
  2053. //                $result = $WSCMS->SendMailLibre($params);
  2054.                 $params['mailToClient'] = true;
  2055.                 $result $WSCMS->SendMailLibre($params);
  2056.             } catch (\Exception $e) {
  2057.                 $msg '<span style="color:red">' $e->getMessage() . '</span>';
  2058.                 return new Response($msg);
  2059.             }
  2060.             if ($result != 0) {
  2061.                 $msg "<span style='color:green'>Votre message a été Envoyé avec succès !</span>";
  2062.             } else {
  2063.                 $msg '<span style="color:red">Echèc d\'envoi</span>';
  2064.             }
  2065.             return new Response($msg);
  2066.         }
  2067.         $configAffichage = array();
  2068.         if (!is_null($WSCMS->ConfigFrontOffice()))
  2069.             $configAffichage $WSCMS->ConfigFrontOffice()['ConfigFrontOffice'];
  2070.         return $this->render($this->service->checkCustomTemplate('formulaire_omra_carte.html.twig'), array(
  2071.             'infoAgence' => $infoAgence,
  2072.             'form' => $form->createView(),
  2073.             'configAffichage' => $configAffichage,
  2074.         ));
  2075.     }
  2076.     /**
  2077.      * @Route("/vol", name="vol")
  2078.      */
  2079.     public function vol(Request $requestGeneraleExtension $generaleExtensionWSCMS $WSCMS): Response
  2080.     {
  2081.         if (isset($_SERVER['FLIGHTS_WORLDSOFT_SUB_DOMAINE'])) {
  2082.             if (!isset($_COOKIE['WSSESSIONID'])) {
  2083.                 $client $this->get('session')->get('client');
  2084.                 if (isset($client['amicale']['id']) and $client['amicale']['modules']['vol']) {
  2085.                     $professionalId $_SERVER['FLIGHTS_WORLDSOFT_PROFESSIONAL_ID'];
  2086.                     $partnerId $this->get('session')->get('client')['amicale']['id'];
  2087.                     $apiKey $_SERVER['FLIGHTS_WORLDSOFT_API_KEY'];
  2088.                     $ch curl_init();
  2089.                     curl_setopt($chCURLOPT_URL"{$_SERVER['FLIGHTS_WORLDSOFT_SUB_DOMAINE']}/rest/b2b/CreateSession?professionalId=$professionalId&partnerId=$partnerId&apiKey=$apiKey");
  2090.                     curl_setopt($chCURLOPT_RETURNTRANSFER1);
  2091.                     $output curl_exec($ch);
  2092.                     $info curl_getinfo($ch);
  2093.                     $curl_error curl_error($ch);
  2094.                     curl_close($ch);
  2095.                     $res json_decode($outputtrue);
  2096.                     if ($res['success'])
  2097.                         setcookie("WSSESSIONID"$res['sessionId'], 0"/"".{$_SERVER['HTTP_HOST']}"falsetrue);
  2098.                     else
  2099.                         setcookie("WSSESSIONID"$res['error'], 0"/"".{$_SERVER['HTTP_HOST']}"falsetrue);
  2100.                 }
  2101.             }
  2102.             return $this->redirect($_SERVER['FLIGHTS_WORLDSOFT_SUB_DOMAINE']);
  2103.         }
  2104.         $form $this->createFormBuilder()
  2105.             ->add('email'EmailType::class, array(
  2106.                 'required' => TRUE,
  2107.                 'attr' => [
  2108.                     'placeholder' => 'Entrer votre email'
  2109.                 ]
  2110.             ))
  2111.             ->add('nom'TextType::class, array(
  2112.                 'required' => TRUE,
  2113.                 'attr' => [
  2114.                     'placeholder' => 'nom & prénom'
  2115.                 ]
  2116.             ))->add('depart'TextType::class, array(
  2117.                 'required' => TRUE,
  2118.                 'attr' => [
  2119.                     'placeholder' => 'ville départ'
  2120.                 ]
  2121.             ))
  2122.             ->add('datedepart'DateType::class, array(
  2123.                 'required' => TRUE,
  2124.                 'format' => 'yyyy-MM-dd',
  2125.                 'widget' => 'single_text',
  2126.             ))->add('datearrive'DateType::class, array(
  2127.                 'required' => TRUE,
  2128.                 'format' => 'yyyy-MM-dd',
  2129.                 'widget' => 'single_text',
  2130.             ))
  2131.             ->add('arrive'TextType::class, array(
  2132.                 'required' => TRUE,
  2133.                 'attr' => [
  2134.                     'placeholder' => 'ville arrivée'
  2135.                 ]
  2136.             ))
  2137.             ->add('tel'TextType::class, array(
  2138.                 'required' => TRUE,
  2139.                 'attr' => [
  2140.                     'placeholder' => 'Entrer votre Téléphone'
  2141.                 ]
  2142.             ))
  2143.             ->add('company'TextType::class, array(
  2144.                 'required' => TRUE,
  2145.                 'attr' => [
  2146.                     'placeholder' => 'Compagnie souhaitée'
  2147.                 ]
  2148.             ))
  2149.             ->add('passager'TextType::class, array(
  2150.                 'required' => TRUE,
  2151.                 'attr' => [
  2152.                     'placeholder' => 'Nom passager'
  2153.                 ]
  2154.             ))
  2155.             ->add('age'TextType::class, array(
  2156.                 'required' => TRUE,
  2157.                 'attr' => [
  2158.                     'placeholder' => 'Age passager'
  2159.                 ]
  2160.             ))
  2161.             ->add('classe'ChoiceType::class, [
  2162.                 'choices' => [
  2163.                     'Economy' => 'Economy',
  2164.                     'First' => 'First',
  2165.                     'Business' => 'Business',
  2166.                 ]
  2167.             ])
  2168.             ->add('vol'ChoiceType::class, [
  2169.                 'choices' => [
  2170.                     'Aller-Retour' => 'Aller-Retour',
  2171.                     'Aller-Simple' => 'Aller-Simple',
  2172.                     'Multi-Segments' => 'Multi-Segments',
  2173.                 ],
  2174.             ])
  2175.             ->add('subject'TextareaType::class, array(
  2176.                 'required' => TRUE,
  2177.                 'attr' => [
  2178.                     'placeholder' => 'Commentaire'
  2179.                 ]
  2180.             ))
  2181.             ->getForm();
  2182.         if ($request->isMethod('POST') && $request->isXmlHttpRequest()) {
  2183.             try {
  2184.                 parse_str($request->request->get('form'), $form);
  2185.                 $data $form['form'];
  2186.                 $body $this->renderView('FrontCommun/formulaire_mail_vol.html.twig', array(
  2187.                     'nom' => $data['nom'],
  2188.                     'depart' => $data['depart'],
  2189.                     'email' => $data['email'],
  2190.                     'datedepart' => $data['datedepart'],
  2191.                     'datearrive' => $data['datearrive'],
  2192.                     'tel' => $data['tel'],
  2193.                     'classe' => $data['classe'],
  2194.                     'vol' => $data['vol'],
  2195.                     'company' => $data['company'],
  2196.                     'arrive' => $data['arrive'],
  2197.                     'ages' => $data['age'],
  2198.                     'passagers' => $data['passager'],
  2199.                     'subject' => $data['subject'],
  2200.                 ));
  2201.                 $params = array(
  2202.                     'email' => $data['email'],
  2203.                     'subject' => $data['subject'],
  2204.                     'body' => $body,
  2205.                 );
  2206.                 $result $WSCMS->SendMailLibre($params);
  2207.                 $params['mailToClient'] = true;
  2208.                 $result $WSCMS->SendMailLibre($params);
  2209.             } catch (\Exception $e) {
  2210.                 $msg '<span style="color:red">' $e->getMessage() . '</span>';
  2211.                 return new Response($msg);
  2212.             }
  2213.             if ($result != 0) {
  2214.                 $msg "<span style='color:green'>Votre message a été Envoyé avec succès !</span>";
  2215.             } else {
  2216.                 $msg '<span style="color:red">Echèc d\'envoi</span>';
  2217.             }
  2218.             return new Response($msg);
  2219.         }
  2220.         $configAffichage = array();
  2221.         if (!is_null($WSCMS->ConfigFrontOffice()))
  2222.             $configAffichage $WSCMS->ConfigFrontOffice()['ConfigFrontOffice'];
  2223.         return $this->render($this->service->checkCustomTemplate('demande_billetterie.html.twig'), array(
  2224.             'form' => $form->createView(),
  2225.             'configAffichage' => $configAffichage,
  2226.         ));
  2227.     }
  2228.     /**
  2229.      * @Route("/maritime", name="maritime")
  2230.      */
  2231.     public function maritime(Request $requestGeneraleExtension $generaleExtensionWSCMS $WSCMS): Response
  2232.     {
  2233.         $form $this->createFormBuilder()
  2234.             ->add('nomPrenom'TextType::class, array(
  2235.                 'required' => TRUE,
  2236.                 'attr' => [
  2237.                     'placeholder' => 'Nom & Prénom'
  2238.                 ]
  2239.             ))
  2240.             ->add('gsm'TextType::class, array(
  2241.                 'required' => TRUE,
  2242.                 'attr' => [
  2243.                     'placeholder' => 'GSM'
  2244.                 ]
  2245.             ))
  2246.             ->add('email'EmailType::class, array(
  2247.                 'required' => TRUE,
  2248.                 'attr' => [
  2249.                     'placeholder' => 'Email'
  2250.                 ]
  2251.             ))
  2252.             ->add('cin'TextType::class, array(
  2253.                 'required' => TRUE,
  2254.                 'attr' => [
  2255.                     'placeholder' => 'CIN'
  2256.                 ]
  2257.             ))
  2258.             ->add('typeVoyage'ChoiceType::class, [
  2259.                     'choices' => [
  2260.                         => "Aller-Retour",
  2261.                         => "Aller-Simple",
  2262.                         => "Retour-Differt",
  2263.                     ]
  2264.                 ]
  2265.             )
  2266.             ->add('typeReservation'ChoiceType::class, [
  2267.                     'required' => true,
  2268.                     'choices' => [
  2269.                         => 'Emission',
  2270.                         //2 => 'Annulation',
  2271.                         => 'Remboursement',
  2272.                         => 'Modification',
  2273.                     ]
  2274.                 ]
  2275.             )
  2276.             ->add('cabine'ChoiceType::class, [
  2277.                     'choices' => [
  2278.                         => "Fauteuil",
  2279.                         => "Cabine-Exterieur",
  2280.                         => "Cabine-Interieur",
  2281.                         => "Couchette Int",
  2282.                         => "Cab. Single Int",
  2283.                         => "Cab. Double Int",
  2284.                         => "Cab. Triple Int",
  2285.                         => "Cab. Quad Int",
  2286.                         => "Couchette Ext",
  2287.                         10 => "Cab. Single EXT",
  2288.                         11 => "Cab. Double Ext",
  2289.                         12 => "Cab. Triple Ext",
  2290.                         13 => "Cab. Quad Ext",
  2291.                         14 => "Cab Accès animaux int/ Ext",
  2292.                         15 => "Suite single",
  2293.                         16 => "Suite matrimoniale",
  2294.                         17 => "Suite familiale",
  2295.                         18 => "Suite présidentielle"
  2296.                     ]
  2297.                 ]
  2298.             )
  2299.             ->add('passagers'ChoiceType::class, [
  2300.                     'choices' => [
  2301.                         => "Résident",
  2302.                         => "Non-Résident",
  2303.                         => "Diplomat",
  2304.                         => "Etudiant",
  2305.                     ]
  2306.                 ]
  2307.             )
  2308.             ->add('lieuDepart'TextType::class, array(
  2309.                 'required' => TRUE,
  2310.                 'attr' => [
  2311.                     'placeholder' => 'Lieu départ'
  2312.                 ]
  2313.             ))
  2314.             ->add('lieuArrivee'TextType::class, array(
  2315.                 'required' => TRUE,
  2316.                 'attr' => [
  2317.                     'placeholder' => 'Lieu arrivée'
  2318.                 ]
  2319.             ))
  2320.             ->add('dateDepart'DateType::class, array(
  2321.                 'widget' => 'single_text',
  2322.                 'format' => 'yyyy-MM-dd',
  2323.             ))
  2324.             ->add('commentaire'TextareaType::class, array('required' => false));
  2325.         $form $form->getForm();
  2326.         if ($request->isMethod('POST') && $request->isXmlHttpRequest()) {
  2327.             try {
  2328.                 parse_str($request->request->get('form'), $form);
  2329.                 $data $form['form'];
  2330.                 /* dd($data);*/
  2331.                 $body $this->renderView('FrontCommun/formulaire_mail_body.html.twig', array(
  2332.                     'nom' => $data['nomPrenom'],
  2333.                     'depart' => $data['lieuDepart'],
  2334.                     'arrivee' => $data['lieuArrivee'],
  2335.                     'email' => $data['email'],
  2336.                     'datedepart' => $data['dateDepart'],
  2337.                     'tel' => $data['gsm'],
  2338.                     'passagers' => $data['passagers'],
  2339.                     'cabine' => $data['cabine'],
  2340.                     'typeVoyage' => $data['typeVoyage'],
  2341.                     'cin' => $data['cin'],
  2342.                     'typeReservation' => $data['typeReservation'],
  2343.                     'subject' => $data['commentaire'],
  2344.                 ));
  2345.                 $params = array(
  2346.                     'email' => $data['email'],
  2347.                     'subject' => $data['commentaire'],
  2348.                     'body' => $body,
  2349.                 );
  2350.                 $result $WSCMS->SendMailLibre($params);
  2351.                 $params['mailToClient'] = true;
  2352.                 $result $WSCMS->SendMailLibre($params);
  2353.             } catch (\Exception $e) {
  2354.                 $msg '<span style="color:red">' $e->getMessage() . '</span>';
  2355.                 return new Response($msg);
  2356.             }
  2357.             if ($result != 0) {
  2358.                 $msg "<span style='color:green'>Votre message a été Envoyé avec succès !</span>";
  2359.             } else {
  2360.                 $msg '<span style="color:red">Echèc d\'envoi</span>';
  2361.             }
  2362.             return new Response($msg);
  2363.         }
  2364.         $configAffichage = array();
  2365.         if (!is_null($WSCMS->ConfigFrontOffice()))
  2366.             $configAffichage $WSCMS->ConfigFrontOffice()['ConfigFrontOffice'];
  2367.         return $this->render($this->service->checkCustomTemplate('demande_maritime.html.twig'), array(
  2368.             'form' => $form->createView(),
  2369.             'configAffichage' => $configAffichage,
  2370.         ));
  2371.     }
  2372.     /**
  2373.      * @Route("/location-bus", name="location_bus")
  2374.      */
  2375.     public function locationBus(Request $requestGeneraleExtension $generaleExtensionWSCMS $WSCMS): Response
  2376.     {
  2377.         $infoAgence $generaleExtension->getAgence()['information'];
  2378.         $form $this->createFormBuilder(null, ['csrf_protection' => true])
  2379.             ->add('titre'ChoiceType::class, [
  2380.                     'choices' => [
  2381.                         "Mr" => "Mr",
  2382.                         "Mme" => "Mme",
  2383.                         "Mlle" => "Mlle",
  2384.                     ]
  2385.                 ]
  2386.             )
  2387.             ->add('nomPrenom'TextType::class, array(
  2388.                 'required' => TRUE,
  2389.                 'attr' => [
  2390.                     'placeholder' => 'Nom & Prénom'
  2391.                 ]
  2392.             ))
  2393.             ->add('typeTransfert'ChoiceType::class, [
  2394.                 'choices' => [
  2395.                     "Transfert simple" => "transfert-simple",
  2396.                     "Transfert aller-retour" => "transfert_aller_retour",
  2397.                     "Mise à disposition à la journée" => "Mise-à-disposition-à-la-journée",
  2398.                     "Mise à disposition pour plusieurs jours" => "Mise-à-isposition-pour-plusieurs-jours",
  2399.                 ],
  2400.                 'expanded' => true,
  2401.                 'multiple' => false,
  2402.                 'label' => false,
  2403.                 'data' => 'transfert-simple',
  2404.             ])
  2405.             ->add('age'TextType::class, array(
  2406.                 'required' => false,
  2407.                 'attr' => [
  2408.                     'placeholder' => 'Age'
  2409.                 ]
  2410.             ))
  2411.             ->add('tel'TextType::class, array(
  2412.                 'required' => false,
  2413.                 'attr' => [
  2414.                     'placeholder' => 'téléphone'
  2415.                 ]
  2416.             ))
  2417.             ->add('email'EmailType::class, array(
  2418.                 'required' => TRUE,
  2419.                 'attr' => [
  2420.                     'placeholder' => 'Email'
  2421.                 ]
  2422.             ))
  2423.             ->add('adresse'TextType::class, array(
  2424.                 'required' => false,
  2425.                 'attr' => [
  2426.                     'placeholder' => 'adresse'
  2427.                 ]
  2428.             ))
  2429.             ->add('ville'TextType::class, array(
  2430.                 'required' => false,
  2431.                 'attr' => [
  2432.                     'placeholder' => 'ville'
  2433.                 ]
  2434.             ))
  2435.             ->add('codePostal'TextType::class, array(
  2436.                 'required' => false,
  2437.                 'attr' => [
  2438.                     'placeholder' => 'Code Postal'
  2439.                 ]
  2440.             ))
  2441.             ->add('typeBus'ChoiceType::class, [
  2442.                 'choices' => [
  2443.                     "Grand bus" => "Grand bus",
  2444.                     "Mini bus" => "Mini bus",
  2445.                 ]
  2446.             ])
  2447.             ->add('destination'TextType::class, array(
  2448.                 'required' => TRUE,
  2449.                 'attr' => [
  2450.                     'placeholder' => 'Destination'
  2451.                 ]
  2452.             ))
  2453.             ->add('nbrPersonne'IntegerType::class, array(
  2454.                 'required' => false,
  2455.                 'attr' => [
  2456.                     'placeholder' => 'Nombre de personnes ',
  2457.                     'min' => 1,
  2458.                     'max' => 100,
  2459.                 ]
  2460.             ))
  2461.             ->add('depart'ChoiceType::class, array(
  2462.                 'required' => TRUE,
  2463.                 'choices' => [
  2464.                     "Aeroport djerba" => "Aéroport djerba",
  2465.                     "Aeroport enfidha" => "Aéroport enfidha",
  2466.                     "Aeroport monastir" => "Aéroport monastir",
  2467.                     "Aeroport tunis carthage" => "Aéroport tunis carthage",
  2468.                     "Djerba" => "Djerba",
  2469.                     "Hammamet" => "Hammamet",
  2470.                     "Nabeul" => "Nabeul",
  2471.                     "Sousse" => "Sousse",
  2472.                     "Tozeur" => "Tozeur",
  2473.                     "Tunis" => "Tunis",
  2474.                 ]
  2475.             ))
  2476.             ->add('retour'ChoiceType::class, array(
  2477.                 'required' => TRUE,
  2478.                 'choices' => [
  2479.                     "Aeroport djerba" => "Aéroport djerba",
  2480.                     "Aeroport enfidha" => "Aéroport enfidha",
  2481.                     "Aeroport monastir" => "Aéroport monastir",
  2482.                     "Aeroport tunis carthage" => "Aéroport tunis carthage",
  2483.                     "Djerba" => "Djerba",
  2484.                     "Hammamet" => "Hammamet",
  2485.                     "Nabeul" => "Nabeul",
  2486.                     "Sousse" => "Sousse",
  2487.                     "Tozeur" => "Tozeur",
  2488.                     "Tunis" => "Tunis",
  2489.                 ]
  2490.             ))
  2491.             ->add('dateDepart'DateType::class, array(
  2492.                 'widget' => 'single_text',
  2493.                 'format' => 'yyyy-MM-dd',
  2494.                 'required' => TRUE,
  2495.             ))
  2496.             ->add('dateRetour'DateType::class, array(
  2497.                 'widget' => 'single_text',
  2498.                 'format' => 'yyyy-MM-dd',
  2499.                 'required' => TRUE,
  2500.             ))
  2501.             ->add('heureDepart'TimeType::class, array(
  2502.                 'input' => 'datetime',
  2503.                 'widget' => 'choice',
  2504.                 'required' => TRUE,
  2505.             ))
  2506.             ->add('heureRetour'TimeType::class, array(
  2507.                 'input' => 'datetime',
  2508.                 'widget' => 'choice',
  2509.                 'required' => TRUE,
  2510.             ))
  2511.             ->add('commentaire'TextareaType::class,
  2512.                 array(
  2513.                     'required' => true
  2514.                 ))
  2515.             ->add('code_formulaire'HiddenType::class,
  2516.                 array(
  2517.                     'required' => false,
  2518.                     'data' => 'Demande_Location_Bus',
  2519.                 ));
  2520.         $form $form->getForm();
  2521.         $form->handleRequest($request);
  2522.         if ($request->isMethod('POST') && $request->isXmlHttpRequest()) {
  2523.             try {
  2524. //                parse_str($request->request->get('form'), $form);
  2525.                 $data $form->getData();
  2526.                 $body $this->renderView($this->service->checkCustomTemplate('formulaire_mail_location_bus.html.twig'), array(
  2527.                     'nomPrenom' => $data['nomPrenom'],
  2528.                     'titre' => $data['titre'],
  2529.                     'age' => $data['age'],
  2530.                     'adresse' => $data['adresse'],
  2531.                     'ville' => $data['ville'],
  2532.                     'codePostal' => $data['codePostal'],
  2533.                     'tel' => $data['tel'],
  2534.                     'email' => $data['email'],
  2535.                     'typeBus' => $_POST['form']['typeBus'],
  2536.                     'destination' => $data['destination'],
  2537.                     'nbrPersonne' => $data['nbrPersonne'],
  2538.                     'depart' => $data['depart'],
  2539.                     'retour' => $data['retour'],
  2540.                     'dateDepart' => !is_null($data['dateDepart']) ? $data['dateDepart']->format('d-m-Y') : '',
  2541.                     'dateRetour' => !is_null($data['dateRetour']) ? $data['dateRetour']->format('d-m-Y') : '',
  2542.                     'heureDepart' => !is_null($data['heureDepart']) ? $data['heureDepart']->format('H:i') : '',
  2543.                     'heureRetour' => !is_null($data['heureRetour']) ? $data['heureRetour']->format('H:i') : '',
  2544.                     'subject' => $data['commentaire'],
  2545.                     'typeTransfert' => $data['typeTransfert'],
  2546.                 ));
  2547.                 $_POST['form']['heureDepart'] = "{$_POST['form']['heureDepart']['hour']}:{$_POST['form']['heureDepart']['minute']}";
  2548.                 $params = array(
  2549.                     'email' => $data['email'],
  2550.                     'subject' => $data['commentaire'],
  2551.                     'post' => $_POST,
  2552.                     'code_formulaire' => $data['code_formulaire'],
  2553.                     'body' => $body,
  2554.                 );
  2555. //                dd( $_POST);
  2556. //                $result = $WSCMS->SendMailLibre($params);
  2557.                 $params['mailToClient'] = true;
  2558.                 $result $WSCMS->SendMailLibre($params);
  2559.             } catch (\Exception $e) {
  2560.                 $msg '<span style="color:red">' $e->getMessage() . '</span>';
  2561.                 return new Response($msg);
  2562.             }
  2563.             if ($result != 0) {
  2564.                 $msg "<span style='color:green'>Votre message a été Envoyé avec succès !</span>";
  2565.             } else {
  2566.                 $msg '<span style="color:red">Echèc d\'envoi</span>';
  2567.             }
  2568.             return new Response($msg);
  2569.         }
  2570.         $configAffichage = array();
  2571.         if (!is_null($WSCMS->ConfigFrontOffice()))
  2572.             $configAffichage $WSCMS->ConfigFrontOffice()['ConfigFrontOffice'];
  2573.         return $this->render($this->service->checkCustomTemplate('demande_location_bus.html.twig'), array(
  2574.             'infoAgence' => $infoAgence,
  2575.             'form' => $form->createView(),
  2576.             'configAffichage' => $configAffichage,
  2577.         ));
  2578.     }
  2579.     /**
  2580.      * @Route("/location-voiture", name="location_voiture")
  2581.      */
  2582.     public function locationVoiture(Request $requestGeneraleExtension $generaleExtensionWSCMS $WSCMS): Response
  2583.     {
  2584.         $form $this->createFormBuilder()
  2585.             ->add('titre'ChoiceType::class, [
  2586.                     'choices' => [
  2587.                         "Mr" => "Mr",
  2588.                         "Mme" => "Mme",
  2589.                         "Mlle" => "Mlle",
  2590.                     ]
  2591.                 ]
  2592.             )
  2593.             ->add('nomPrenom'TextType::class, array(
  2594.                 'required' => TRUE,
  2595.                 'attr' => [
  2596.                     'placeholder' => 'Nom & Prénom'
  2597.                 ]
  2598.             ))
  2599.             ->add('age'TextType::class, array(
  2600.                 'required' => false,
  2601.                 'attr' => [
  2602.                     'placeholder' => 'Age'
  2603.                 ]
  2604.             ))
  2605.             ->add('tel'TextType::class, array(
  2606.                 'required' => false,
  2607.                 'attr' => [
  2608.                     'placeholder' => 'téléphone'
  2609.                 ]
  2610.             ))
  2611.             ->add('email'EmailType::class, array(
  2612.                 'required' => TRUE,
  2613.                 'attr' => [
  2614.                     'placeholder' => 'Email'
  2615.                 ]
  2616.             ))
  2617.             ->add('adresse'TextType::class, array(
  2618.                 'required' => false,
  2619.                 'attr' => [
  2620.                     'placeholder' => 'adresse'
  2621.                 ]
  2622.             ))
  2623.             ->add('ville'TextType::class, array(
  2624.                 'required' => false,
  2625.                 'attr' => [
  2626.                     'placeholder' => 'ville'
  2627.                 ]
  2628.             ))
  2629.             ->add('codePostal'TextType::class, array(
  2630.                 'required' => false,
  2631.                 'attr' => [
  2632.                     'placeholder' => 'Code Postal'
  2633.                 ]
  2634.             ))
  2635.             ->add('typeVoiture'ChoiceType::class, [
  2636.                     'choices' => [
  2637.                         "Jamp" => "Jamp",
  2638.                         "4 * 4" => "4 * 4",
  2639.                     ]
  2640.                 ]
  2641.             )
  2642.             ->add('destination'TextType::class, array(
  2643.                 'required' => TRUE,
  2644.                 'attr' => [
  2645.                     'placeholder' => 'Destination'
  2646.                 ]
  2647.             ))
  2648.             ->add('nbrPersonne'TextType::class, array(
  2649.                 'required' => false,
  2650.                 'attr' => [
  2651.                     'placeholder' => 'Nombre de personnes'
  2652.                 ]
  2653.             ))
  2654.             ->add('depart'ChoiceType::class, array(
  2655.                 'required' => TRUE,
  2656.                 'choices' => [
  2657.                     "Aeroport djerba" => "Aéroport djerba",
  2658.                     "Aeroport enfidha" => "Aéroport enfidha",
  2659.                     "Aeroport monastir" => "Aéroport monastir",
  2660.                     "Aeroport tunis carthage" => "Aéroport tunis carthage",
  2661.                     "Djerba" => "Djerba",
  2662.                     "Hammmamet" => "Hammmamet",
  2663.                     "Nabeul" => "Nabeul",
  2664.                     "Sousse" => "Sousse",
  2665.                     "Tozeur" => "Tozeur",
  2666.                     "Tunis" => "Tunis",
  2667.                 ]
  2668.             ))
  2669.             ->add('retour'ChoiceType::class, array(
  2670.                 'required' => TRUE,
  2671.                 'choices' => [
  2672.                     "Aeroport djerba" => "Aéroport djerba",
  2673.                     "Aeroport enfidha" => "Aéroport enfidha",
  2674.                     "Aeroport monastir" => "Aéroport monastir",
  2675.                     "Aeroport tunis carthage" => "Aéroport tunis carthage",
  2676.                     "Djerba" => "Djerba",
  2677.                     "Hammmamet" => "Hammmamet",
  2678.                     "Nabeul" => "Nabeul",
  2679.                     "Sousse" => "Sousse",
  2680.                     "Tozeur" => "Tozeur",
  2681.                     "Tunis" => "Tunis",
  2682.                 ]
  2683.             ))
  2684.             ->add('dateDepart'DateType::class, array(
  2685.                 'widget' => 'single_text',
  2686.                 'format' => 'yyyy-MM-dd',
  2687.                 'required' => TRUE,
  2688.             ))
  2689.             ->add('dateRetour'DateType::class, array(
  2690.                 'widget' => 'single_text',
  2691.                 'format' => 'yyyy-MM-dd',
  2692.                 'required' => TRUE,
  2693.             ))
  2694.             ->add('heureDepart'TimeType::class, array(
  2695.                 'input' => 'datetime',
  2696.                 'widget' => 'choice',
  2697.                 'required' => TRUE,
  2698.             ))
  2699.             ->add('heureRetour'TimeType::class, array(
  2700.                 'input' => 'datetime',
  2701.                 'widget' => 'choice',
  2702.                 'required' => TRUE,
  2703.             ))
  2704.             ->add('commentaire'TextareaType::class, array('required' => true));
  2705.         $form $form->getForm();
  2706.         if ($request->isMethod('POST') && $request->isXmlHttpRequest()) {
  2707.             try {
  2708.                 parse_str($request->request->get('form'), $form);
  2709.                 $data $form['form'];
  2710.                 /* dd($data);*/
  2711.                 $body $this->renderView('FrontCommun/formulaire_mail_body.html.twig', array(
  2712.                     'nom' => $data['nomPrenom'],
  2713.                     'titre' => $data['titre'],
  2714.                     'age' => $data['age'],
  2715.                     'adresse' => $data['adresse'],
  2716.                     'ville' => $data['ville'],
  2717.                     'codePostal' => $data['codePostal'],
  2718.                     'tel' => $data['tel'],
  2719.                     'email' => $data['email'],
  2720.                     'typeVoiture' => $data['typeVoiture'],
  2721.                     'destination' => $data['destination'],
  2722.                     'nbrPersonne' => $data['nbrPersonne'],
  2723.                     'depart' => $data['depart'],
  2724.                     'retour' => $data['retour'],
  2725.                     'datedepart' => $data['dateDepart'],
  2726.                     'dateRetour' => $data['dateRetour'],
  2727.                     'heureDepart' => $data['heureDepart'],
  2728.                     'heureRetour' => $data['heureRetour'],
  2729.                     'subject' => $data['commentaire'],
  2730.                 ));
  2731.                 $params = array(
  2732.                     'email' => $data['email'],
  2733.                     'subject' => $data['commentaire'],
  2734.                     'body' => $body,
  2735.                 );
  2736.                 $result $WSCMS->SendMailLibre($params);
  2737.                 $params['mailToClient'] = true;
  2738.                 $result $WSCMS->SendMailLibre($params);
  2739.             } catch (\Exception $e) {
  2740.                 $msg '<span style="color:red">' $e->getMessage() . '</span>';
  2741.                 return new Response($msg);
  2742.             }
  2743.             if ($result != 0) {
  2744.                 $msg "<span style='color:green'>Votre message a été Envoyé avec succès !</span>";
  2745.             } else {
  2746.                 $msg '<span style="color:red">Echèc d\'envoi</span>';
  2747.             }
  2748.             return new Response($msg);
  2749.         }
  2750.         $configAffichage = array();
  2751.         if (!is_null($WSCMS->ConfigFrontOffice()))
  2752.             $configAffichage $WSCMS->ConfigFrontOffice()['ConfigFrontOffice'];
  2753.         return $this->render($this->service->checkCustomTemplate('demande_location_voiture.html.twig'), array(
  2754.             'form' => $form->createView(),
  2755.             'configAffichage' => $configAffichage,
  2756.         ));
  2757.     }
  2758.     /**
  2759.      * @Route("/newsletter", name="newsletter")
  2760.      */
  2761.     public function newsletter(WSCMS $WSCMS): Response
  2762.     {
  2763.         $WSCMS->NewsLetter(['email' => $_POST['email']]);
  2764.         return new Response(1);
  2765.     }
  2766.     /**
  2767.      * @Route ("/gallery", name="gallery")
  2768.      */
  2769.     public function gallery(WSCMS $WSCMS): Response
  2770.     {
  2771.         $gallery $WSCMS->Gallery()['Gallery'];
  2772.         return $this->render($this->service->checkCustomTemplate('gallery.html.twig'), [
  2773.             'gallery' => $gallery
  2774.         ]);
  2775.     }
  2776.     /**
  2777.      * @Route("/admin", name="admin")
  2778.      */
  2779.     public function admin()
  2780.     {
  2781.         return $this->redirect("{$_SERVER[$this->get('session')->get('DOMAINE_BACK'"DOMAINE_BACK")]}/admin");
  2782.     }
  2783.     /**
  2784.      * @Route("/script", name="script")
  2785.      */
  2786.     public function script()
  2787.     {
  2788.         return $this->redirectToRoute("app_script"$_GET);
  2789.     }
  2790.     /**
  2791.      * @Route("/reset-cache-webservices/{name}", defaults={"name"="all"})
  2792.      */
  2793.     public function resetCacheWebServices($name): Response
  2794.     {
  2795.         return $this->redirectToRoute('reset_cache_webservices', ['name' => $name]);
  2796.     }
  2797.     /**
  2798.      * @Route ("/agences-liste/{id}", name="agences_liste", defaults={"id"=null})
  2799.      */
  2800.     public function agencesListe()
  2801.     {
  2802.         return $this->render($this->service->checkCustomTemplate('agence/agences-liste.html.twig'));
  2803.     }
  2804.     /**
  2805.      * @Route ("/home_aerien", name="home_aerien")
  2806.      */
  2807.     public function home_aerien(WSCMS $WSCMSRequest $requestWSAerien $WSAerien): Response
  2808.     {
  2809.         $classes $WSAerien->Classe();
  2810.         $classe $request->get('classe');
  2811.         $aeroports $WSAerien->Aeroports()['Resultat'];
  2812.         return $this->render($this->service->checkCustomTemplate('Aerien/home_aerien.html.twig'), [
  2813.             'lieuDepart' => $request->get('lieu_depart'),
  2814.             'dateDebutFin' => $request->get('date_debut_fin'),
  2815.             'dateDebut' => null,
  2816.             'dateFin' => null,
  2817.             'classes' => $classes,
  2818.             'classe' => $classe,
  2819.             'aeroports' => $aeroports
  2820.         ]);
  2821.     }
  2822.     /**
  2823.      * @Route("/type-transfert", name="form_type_transfert")
  2824.      */
  2825.     public function formTypeTransfert(Request $requestGeneraleExtension $generaleExtensionWSCMS $WSCMS): Response
  2826.     {
  2827.         $infoAgence $generaleExtension->getAgence()['information'];
  2828.         $form $this->createFormBuilder(null, ['csrf_protection' => true])
  2829.             ->add('NomPrenom'TextType::class, array(
  2830.                 'required' => TRUE,
  2831.                 'attr' => [
  2832.                     'placeholder' => 'Nom & Prénom'
  2833.                 ]
  2834.             ))
  2835.             ->add('NumTel'TextType::class, [
  2836.                 'required' => false,
  2837.                 'attr' => [
  2838.                     'placeholder' => 'Numéro de téléphone',
  2839.                     'type'        => 'tel',
  2840.                     'inputmode'   => 'tel',
  2841.                     'pattern'     => '[0-9+\s\-\(\)]*',
  2842.                     'title'       => 'Veuillez saisir uniquement des chiffres',
  2843.                     'maxlength'   => 20,
  2844.                 ],
  2845.             ])
  2846.             ->add('email'EmailType::class, array(
  2847.                 'required' => TRUE,
  2848.                 'attr' => [
  2849.                     'placeholder' => 'Entrer votre email'
  2850.                 ]
  2851.             ))
  2852.             ->add('adresse'TextType::class, array(
  2853.                 'required' => false,
  2854.                 'attr' => [
  2855.                     'placeholder' => 'Adresse'
  2856.                 ]
  2857.             ))
  2858.             ->add('TypeVehicule'ChoiceType::class, [
  2859.                 'choices' => [
  2860.                     "Economie" => "Economie",
  2861.                     "Confort" => "Confort",
  2862.                     "Suv" => "Suv",
  2863.                     "Van" => "Van",
  2864.                     "Mini-Bus" => "Mini-Bus",
  2865.                 ]
  2866.             ])
  2867.             ->add('NbrPassagers'IntegerType::class, array(
  2868.                 'required' => false,
  2869.                 'attr' => [
  2870.                     'placeholder' => 'Nombre de passagers'
  2871.                 ]
  2872.             ))
  2873.             ->add('LieuDepart'TextType::class, array(
  2874.                 'required' => TRUE,
  2875.                 'attr' => [
  2876.                     'placeholder' => 'Lieu de départ'
  2877.                 ]
  2878. //                'choices' => [
  2879. //                    "Djerba" => "Djerba",
  2880. //                    "Hammamet" => "Hammamet",
  2881. //                    "Nabeul" => "Nabeul",
  2882. //                    "Sousse" => "Sousse",
  2883. //                    "Tozeur" => "Tozeur",
  2884. //                    "Tunis" => "Tunis",
  2885. //
  2886. //                ]
  2887.             ))
  2888.             ->add('DateDepart'DateType::class, array(
  2889.                 'widget' => 'single_text',
  2890.                 'format' => 'yyyy-MM-dd',
  2891.                 'required' => TRUE,
  2892.                 'attr'     => array(
  2893.                     'min' => (new \DateTime('today'))->format('Y-m-d'),   // ← bloque tout avant aujourd'hui dans le calendrier
  2894.                 ),
  2895.             ))
  2896.             ->add('HeureDepart'TimeType::class, array(
  2897.                 'input' => 'datetime',
  2898.                 'widget' => 'choice',
  2899.                 'required' => TRUE,
  2900.             ))
  2901.             ->add('LieuArrive'TextType::class, array(
  2902.                 'required' => TRUE,
  2903.                 'attr' => [
  2904.                     'placeholder' => "Lieu d’arrivée"
  2905.                 ]
  2906. //                'choices' => [
  2907. //                    "Djerba" => "Djerba",
  2908. //                    "Hammamet" => "Hammamet",
  2909. //                    "Nabeul" => "Nabeul",
  2910. //                    "Sousse" => "Sousse",
  2911. //                    "Tozeur" => "Tozeur",
  2912. //                    "Tunis" => "Tunis",
  2913. //
  2914. //                ]
  2915.             ))
  2916. //            ->add('DateArrive', DateType::class, array(
  2917. //                'widget' => 'single_text',
  2918. //                'format' => 'yyyy-MM-dd',
  2919. //                'required' => TRUE,
  2920. //            ))
  2921. //            ->add('HeureArrive', TimeType::class, array(
  2922. //                'input' => 'datetime',
  2923. //                'widget' => 'choice',
  2924. //                'required' => TRUE,
  2925. //            ))
  2926.             ->add('LieuDepartRetour'TextType::class, array(
  2927.                 'required' => TRUE,
  2928.                 'attr' => [
  2929.                     'placeholder' => "Lieu de départ retour"
  2930.                 ]
  2931. //                'choices' => [
  2932. //                    "Djerba" => "Djerba",
  2933. //                    "Hammamet" => "Hammamet",
  2934. //                    "Nabeul" => "Nabeul",
  2935. //                    "Sousse" => "Sousse",
  2936. //                    "Tozeur" => "Tozeur",
  2937. //                    "Tunis" => "Tunis",
  2938. //
  2939. //                ]
  2940.             ))
  2941.             ->add('DateDepartRetour'DateType::class, array(
  2942.                 'widget' => 'single_text',
  2943.                 'format' => 'yyyy-MM-dd',
  2944.                 'required' => TRUE,
  2945.                 'attr'     => array(
  2946.                     'min' => (new \DateTime('today'))->format('Y-m-d'),   // ← bloque tout avant aujourd'hui dans le calendrier
  2947.                 ),
  2948.             ))
  2949.             ->add('HeureDepartRetour'TimeType::class, array(
  2950.                 'input' => 'datetime',
  2951.                 'widget' => 'choice',
  2952.                 'required' => TRUE,
  2953.             ))
  2954.             ->add('LieuArriveRetour'TextType::class, array(
  2955.                 'required' => TRUE,
  2956.                 'attr' => [
  2957.                     'placeholder' => "Lieu d'arrivée retour"
  2958.                 ]
  2959.             ))
  2960. //            ->add('DateArriveRetour', DateType::class, array(
  2961. //                'widget' => 'single_text',
  2962. //                'format' => 'yyyy-MM-dd',
  2963. //                'required' => TRUE,
  2964. //            ))
  2965. //            ->add('HeureArriveRetour', TimeType::class, array(
  2966. //                'input' => 'datetime',
  2967. //                'widget' => 'choice',
  2968. //                'required' => TRUE,
  2969. //            ))
  2970.             ->add('commentaire'TextareaType::class, array(
  2971.                 'required' => false
  2972.             ))
  2973.             ->add('code_formulaire'HiddenType::class,
  2974.                 array(
  2975.                     'required' => false,
  2976.                     'data' => 'Formulaire_Type_Transfert',
  2977.                 ));
  2978.         $form $form->getForm();
  2979.         $form->handleRequest($request);
  2980.         if ($request->isMethod('POST') && $request->isXmlHttpRequest()) {
  2981.             try {
  2982.                 $data $form->getData();
  2983.                 $body $this->renderView($this->service->checkCustomTemplate('formulaire_mail_type_transfert.html.twig'), array(
  2984.                     'NomPrenom' => $data['NomPrenom'],
  2985.                     'adresse' => $data['adresse'],
  2986.                     'NumTel' => $data['NumTel'],
  2987.                     'email' => $data['email'],
  2988.                     'TypeVehicule' => $data['TypeVehicule'],
  2989.                     'NbrPassagers' => $data['NbrPassagers'],
  2990.                     'LieuDepart' => $data['LieuDepart'],
  2991.                     'DateDepart' => $data['DateDepart']->format('d-m-Y'),
  2992.                     'HeureDepart' => $data['HeureDepart']->format('H:i'),
  2993.                     'LieuArrive' => $data['LieuArrive'],
  2994. //                    'DateArrive' => $data['DateArrive']->format('d-m-Y'),
  2995. //                    'HeureArrive' => $data['HeureArrive']->format('H:i'),
  2996.                     'LieuDepartRetour' => $data['LieuDepartRetour'],
  2997.                     'DateDepartRetour' => $data['DateDepartRetour'] ? $data['DateDepartRetour']->format('d-m-Y') : null,
  2998.                     'HeureDepartRetour' => $data['HeureDepartRetour']->format('H:i'),
  2999.                     'LieuArriveRetour' => $data['LieuArriveRetour'],
  3000. //                    'DateArriveRetour' => $data['DateArriveRetour'] ? $data['DateArriveRetour']->format('d-m-Y') : null,
  3001. //                    'HeureArriveRetour' => $data['HeureArriveRetour']->format('H:i'),
  3002.                     'subject' => $data['commentaire'],
  3003.                 ));
  3004.                 $params = array(
  3005.                     'email' => $data['email'],
  3006.                     'subject' => $data['commentaire'],
  3007.                     'post' => $_POST,
  3008.                     'code_formulaire' => $data['code_formulaire'],
  3009.                     'body' => $body,
  3010.                 );
  3011.                 $params['mailToClient'] = true;
  3012.                 $result $WSCMS->SendMailLibre($params);
  3013.             } catch (\Exception $e) {
  3014.                 $msg '<span style="color:red">' $e->getMessage() . '</span>';
  3015.                 return new Response($msg);
  3016.             }
  3017.             if ($result != 0) {
  3018.                 $msg "<span style='color:green'>Votre message a été Envoyé avec succès !</span>";
  3019.             } else {
  3020.                 $msg '<span style="color:red">Echèc d\'envoi</span>';
  3021.             }
  3022.             return new Response($msg);
  3023.         }
  3024.         $configAffichage = array();
  3025.         if (!is_null($WSCMS->ConfigFrontOffice()))
  3026.             $configAffichage $WSCMS->ConfigFrontOffice()['ConfigFrontOffice'];
  3027.         return $this->render($this->service->checkCustomTemplate('form_type_transfert.html.twig'), array(
  3028.             'infoAgence' => $infoAgence,
  3029.             'form' => $form->createView(),
  3030.             'configAffichage' => $configAffichage,
  3031.         ));
  3032.     }
  3033.     /**
  3034.      * @Route("/Avis/page/{idavis}/{idreservation}/{idhotel}", name="front_avis_page")
  3035.      */
  3036.     public function front_avis_page($idavis$idhotel$idreservationWSSejourHotel $sejourHotel)
  3037.     {
  3038.         $getpageavis $sejourHotel->getAvisPageTemp(array('reservation' => $idreservation));
  3039.         $parameters = array();
  3040.         $details = array();
  3041.         if ($getpageavis['ok']) {
  3042.             $parameters $getpageavis['parameters'];
  3043.             $details $getpageavis['details'];
  3044.         }
  3045.         $ok $getpageavis['ok'];
  3046.         $message $getpageavis['message'];
  3047.         return $this->render($this->service->checkCustomTemplate('SejourHotel/avis.html.twig'), ['ok' => $ok'message' => $message'idavis' => $idavis'idHotel' => $idhotel'idReservation' => $idreservation'parameters' => $parameters'details' => $details]);
  3048.     }
  3049.     /**
  3050.      * @Route("/AvisPost/{idavis}/{idreservation}/{idhotel}", name="front_avis_post")
  3051.      */
  3052.     public function front_avis_post($idavis$idhotel$idreservationWSSejourHotel $sejourHotelRequest $request)
  3053.     {
  3054.         $data $_POST;
  3055.         $data['id'] = $idhotel;
  3056.         $data['idavis'] = $idavis;
  3057.         $data['idreservation'] = $idreservation;
  3058.         $data['recommended'] = $data['recommended'] == 'true' true false;
  3059.         $submit $sejourHotel->postAvisPageTemp($data);
  3060.         return $this->render($this->service->checkCustomTemplate('SejourHotel/avisresult.html.twig'), ['ok' => $submit['ok'], 'message' => $submit['message']]);
  3061.     }
  3062. }