src/Controller/PublicController.php line 1535

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use DateTime;
  4. use DatePeriod;
  5. use DateInterval;
  6. use Dompdf\Dompdf;
  7. use Dompdf\Options;
  8. use App\Entity\Ligne;
  9. use App\Entity\Centre;
  10. use App\Entity\Marque;
  11. use App\Entity\MarqueCl;
  12. use App\Entity\Modele;
  13. use App\Entity\ModeleCl;
  14. use App\Entity\Energie;
  15. use App\Entity\Promotion;
  16. use App\Entity\CentreType;
  17. use App\Entity\Partenaire;
  18. use App\Entity\Rendezvous;
  19. use App\Entity\ClientLibre;
  20. use App\Entity\CentreGroupe;
  21. use App\Entity\LigneBlocage;
  22. use App\Entity\TypeVehicule;
  23. use App\Entity\CentreHoraire;
  24. use App\Entity\RendezVousInfos;
  25. use App\Entity\CentrePrestation;
  26. use App\Entity\PromotionCreneau;
  27. use App\Controller\ApiController;
  28. use Symfony\Component\Mime\Email;
  29. use App\Entity\RendezVousVehicule;
  30. use App\Repository\ModeleClRepository;
  31. use App\Repository\ModeleRepository;
  32. use App\Entity\CentreCouponPromotion;
  33. use App\Entity\ParametreCentreGroupe;
  34. use App\Entity\RendezVousFacturation;
  35. use App\Controller\WebServiceController;
  36. use Doctrine\ORM\EntityManagerInterface;
  37. use Doctrine\Persistence\ManagerRegistry;
  38. use Psr\Log\LoggerInterface;
  39. use Symfony\Contracts\Cache\ItemInterface;
  40. use Symfony\Contracts\Cache\CacheInterface;
  41. use Symfony\Component\HttpFoundation\Request;
  42. use Symfony\Component\Mailer\MailerInterface;
  43. use Symfony\Component\HttpFoundation\Response;
  44. use Symfony\Component\Routing\Annotation\Route;
  45. use Symfony\Component\HttpFoundation\JsonResponse;
  46. use Symfony\Component\HttpFoundation\Session\SessionInterface;
  47. use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
  48. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  49. use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
  50. class PublicController extends AbstractController
  51. {
  52.     public $id;
  53.     protected $em;
  54.     protected $cache;
  55.     protected $mois;
  56.     protected $jours;
  57.     private $ApiController;
  58.     private $PaylineController;
  59.     private $WebServiceController;
  60.     private $mailer;
  61.     private $session;
  62.     public function __construct(SessionInterface $sessionApiController $ApiControllerPaylineController $PaylineControllerEntityManagerInterface $entityManagerCacheInterface $cacheMailerInterface $mailerWebServiceController $WebServiceController)
  63.     {
  64.         date_default_timezone_set('Europe/Paris');
  65.         $this->jours = array('Lundi''Mardi''Mercredi''Jeudi''Vendredi''Samedi''Dimanche');
  66.         $this->mois = array(=> "Janvier"=> "Février"=> "Mars"=> "Avril"=> "Mai"=> "Juin"=> "Juillet"=> "Août"=> "Septembre"10 => "Octobre"11 => "Novembre"12 => "Décembre");
  67.         $this->em $entityManager;
  68.         $this->cache $cache;
  69.         $this->ApiController $ApiController;
  70.         $this->PaylineController $PaylineController;
  71.         $this->WebServiceController $WebServiceController;
  72.         $this->mailer $mailer;
  73.         $this->session $session;
  74.         $ParametreCentreGroupe $this->em->getRepository(ParametreCentreGroupe::class)->findOneByUrl($_SERVER['SERVER_NAME']);
  75.         if ($ParametreCentreGroupe) {
  76.             $this->id $ParametreCentreGroupe->getCentreGroupe()->getId();
  77.             $this->session->set('centre_groupe'$ParametreCentreGroupe->getCentreGroupe()->getId());
  78.         } else {
  79.             $this->id 1;
  80.             $this->session->set('centre_groupe'$this->id);
  81.             
  82.         }
  83.     }
  84.     
  85.     #[Route('/reservation'name'reservation')]
  86.     public function reservation(Request $request)
  87.     {
  88.         $iframe $request->query->get('iframe');
  89.         if ($iframe) {
  90.             $typeCentre $request->query->get('type_centre');
  91.             $repositoryCentre $this->em->getRepository(Centre::class);
  92.             /** @var Centre $centreType */
  93.             $centre $repositoryCentre->findCentreByCentreGroupeIdAndDenomination($this->id$typeCentre);
  94.             return $this->redirectToRoute('prendre_rdv', ['iframe' => true'id' => $centre->getId()]);
  95.         }
  96.         return $this->redirectToRoute('index');
  97.     }
  98.     #[Route('/reservation-pl'name'reservation-pl')]
  99.     public function reservationPl(Request $request)
  100.     {
  101.         $iframe $request->query->get('iframe');
  102.         if ($iframe) {
  103.             $typeCentre $request->query->get('type_centre');
  104.             $repositoryCentre $this->em->getRepository(Centre::class);
  105.             /** @var Centre $centreType */
  106.             $centre $repositoryCentre->findCentreByCentreGroupeIdAndDenomination($this->id$typeCentre);
  107.             return $this->redirectToRoute('prendre_rdv', ['iframe' => true'id' => $centre->getId()]);
  108.         }
  109.         return $this->redirectToRoute('index');
  110.     }
  111.     #[Route('/'name'index')]
  112.     public function index(Request $RequestAuthenticationUtils $authenticationUtils): Response
  113.     {
  114.         $ParametreCentreGroupe $this->em->getRepository(ParametreCentreGroupe::class)->findOneByUrl($_SERVER['SERVER_NAME']);
  115.         if (!$ParametreCentreGroupe && $_SERVER['APP_ENV'] == 'prod') {
  116.             return $this->render('public/construction.html.twig', [
  117.                 'controller_name' => 'AdminController',
  118.                 'serverName' => $_SERVER['SERVER_NAME']
  119.             ]);
  120.         }
  121.         //if(empty($Request->getSession()->get('centre_groupe'))){
  122.         $Request->getSession()->set('centre_groupe'$this->id);
  123.         // $this->id = 20;
  124.         // }
  125.         $error $authenticationUtils->getLastAuthenticationError();
  126.         // last username entered by the user
  127.         $lastUsername $authenticationUtils->getLastUsername();
  128.         if ($this->getUser()) {
  129.             return $this->redirectToRoute('app_pro');
  130.         }
  131.         $centreGroupe $this->em->getRepository(CentreGroupe::class)->find($Request->getSession()->get('centre_groupe'));
  132.         $centreGroupeByGerant = [];
  133.         if($centreGroupe->getCgGerant()){
  134.             $centreGroupeByGerants $this->em->getRepository(CentreGroupe::class)->findBy(['cg_gerant'=>$centreGroupe->getCgGerant()->getId()]);
  135.             foreach ($centreGroupeByGerants  as $key => $value) {
  136.                 if($value->getId() != $Request->getSession()->get('centre_groupe')){
  137.                     $lien '';
  138.                     $type '';
  139.                     $ville '';
  140.                     $ParametreCentreGroupe $this->em->getRepository(ParametreCentreGroupe::class)->findOneBy(['centre_groupe'=>$value->getId()]);
  141.                     $lien $ParametreCentreGroupe->getPcgUrl();
  142.                     foreach ($value->getCentres() as $key => $centre) {
  143.                         $type .= $type?',':''.$centre->getCentreType()->getCtLibelePublic();
  144.                         $ville .= $ville?',':''.$centre->getCtrAdresse()->getAdrVille();
  145.                     }
  146.                     $centreGroupeByGerant []=[
  147.                         'Nom'=>$value->GetCgNom(),
  148.                         'Lien'=>$lien,
  149.                         'Type'=>$type ,
  150.                         'Ville'=>$ville ,
  151.                     ];
  152.                 }
  153.             }
  154.         }
  155.         $countCentre 0;
  156.         $firstType 1;
  157.         $arrayTypeCentre = [];
  158.         $array_horaires = array();
  159.         foreach ($centreGroupe->getCentres() as $key => $centre) {
  160.             if ($centre->getCtrParametreCentreAdmin()->isPcaActif()) {
  161.                 $countCentre++;
  162.             }
  163.             $arrayTypeCentre[] = $centre->getCentreType()->getId();
  164.             $CentreHoraires $this->em->getRepository(CentreHoraire::class)->getHoraires($centre->getId());
  165.             
  166.             $result "{}";
  167.             if ($centre->getCtrParametreCentre()->getPcGoogleBuisness()) {
  168.                  $result $this->cache->get($centre->getCtrParametreCentre()->getPcGoogleBuisness(), function (ItemInterface $item) use ($centre) {
  169.                      $item->expiresAfter(DateInterval::createFromDateString('7 days'));
  170.                          $url "https://maps.googleapis.com/maps/api/place/details/json?key=AIzaSyBs9p5zKlf3sCH5w62p-VAG9dzwzmlLEyw&place_id=" $centre->getCtrParametreCentre()->getPcGoogleBuisness() . "&language=fr-FR&reviews_sort=newest";
  171.                          $result file_get_contents($url);
  172.                      return $result;
  173.                  });
  174.             }
  175.             //      $Prestations = $this->cache->get('CentrePrestation_'.$value->getId(), function () use($value){
  176.             $CentrePrestations $this->em->getrepository(CentrePrestation::class)->findByCentreGroupeAndCentreType(
  177.                 $centre->getCentreGroupe()->getId(),
  178.                 $centre->getCentreType()->getId()
  179.             );
  180.             $Prestations = [];
  181.             foreach ($CentrePrestations as $key => $CentrePrestation) {
  182.                 $dateDebut = new datetime();
  183.                 $dateFin = new datetime();
  184.                 $dateFin->modify('+ 12 days');
  185.                 $reduction $this->ApiController->getTarifPromotionsEntreDates($CentrePrestation->getId(), $dateDebut$dateFin$CentrePrestation->getPstTarif());
  186.                 $reduction $reduction['tarif_final'];
  187.                 // dd($CentrePrestation->getPstTarif(),$reduction,$CentrePrestation->getPstTypeVisite()->getTypVstLibeleLong() );
  188.                 if ($reduction $CentrePrestation->getPstTarif()) {
  189.                     $tarif_final $reduction;
  190.                 }
  191.                 $Prestations[] = [
  192.                     'TypeVisite' => $CentrePrestation->getPstTypeVisite()->getTypVstLibeleLong(),
  193.                     'PrixInitial' => $CentrePrestation->getPstTarif(),
  194.                     'Duree' => $CentrePrestation->getPstDuree(),
  195.                     'Reduction' => $reduction $CentrePrestation->getPstTarif() ? true false,
  196.                     'PrixFinal' => $reduction $CentrePrestation->getPstTarif() ? $tarif_final $CentrePrestation->getPstTarif(),
  197.                     'PaiementEnLigne' => $CentrePrestation->isPaiementEnLigne(),
  198.                     'MessageAppelCentre' => $CentrePrestation->isMessageAppelCentre(),
  199.                     'Id' => $CentrePrestation->getId(),
  200.                     'typeVehicule' => ucfirst($CentrePrestation->getPstTypeVehicule()->getTvLibelle()),
  201.                     'ordre' => $CentrePrestation->getPstOrdre()
  202.                 ];
  203.             }
  204.             usort($Prestations, function ($a$b) {
  205.                 $aOrdre $a['ordre'];
  206.                 $bOrdre $b['ordre'];
  207.                 if ($aOrdre === null && $bOrdre === null) return 0;
  208.                 if ($aOrdre === null) return 1// $a va après
  209.                 if ($bOrdre === null) return -1// $b va après
  210.                 return $aOrdre <=> $bOrdre;
  211.             });
  212.             $array_centres[] = ['Horaires' => $CentreHoraires'avis' => json_decode($resulttrue), 'Prestations' => $Prestations];
  213.         }
  214.         if ($countCentre === 1) {
  215.             $firstType $centreGroupe->getCentres()[0]->getCentreType()->getId();
  216.         }
  217.         if ($firstType === && !in_array(1$arrayTypeCentretrue)) {
  218.             $firstType $arrayTypeCentre[0];
  219.         }
  220.         return $this->render('public/index.html.twig', [
  221.             'array_centres' => $array_centres,
  222.             'last_username' => $lastUsername,
  223.             'countcentres' => $countCentre,
  224.             'centreGroupeByGerant' => $centreGroupeByGerant,
  225.             'firstType' => $firstType
  226.         ]);
  227.     }
  228.     #[Route('/prendre_rdv'name'prendre_rdv')]
  229.     public function prendre_rdv(ManagerRegistry $doctrineRequest $Request,LoggerInterface $Logger ): Response
  230.     {
  231.         $id $Request->get('id');
  232.         if (!$Request->get('id')) {
  233.             $id $Request->getSession()->get('centre_id');
  234.         }
  235.         $Request->getSession()->set('centre_id'$id);
  236.         //  $centre = $doctrine->getRepository(Centre::class)->find($id);
  237.         $centre_id $Request->getSession()->get('centre_id');
  238.         $iframe $Request->query->get('iframe');
  239.         if ($iframe) {
  240.             $centre_id $Request->query->get('id');
  241.         }
  242.         //   dd($centre_id);
  243.         $Logger->critical('========================debut cache id_'.$centre_id.' =================');
  244.         $data_centre $this->cache->get('Centre_' $centre_id, function () use ($centre_id,$Logger) {
  245.             $Logger->critical('========================Creation cache id_'.$centre_id.' =================');
  246.             $data_centre $this->em->getRepository(Centre::class)->find($centre_id);
  247.             return $data_centre;
  248.         });
  249.         $Logger->critical('========================fin cache id_' $centre_id ' =================');
  250.         $bornes_recherche = array();
  251.         $bornes_recherche['debut'] = new DateTime();
  252.         $bornes_recherche['fin'] = clone $bornes_recherche['debut'];
  253.         $DureeMaxRdv $data_centre->getCtrParametreCentre()->getPcDureeMaxRdv() ? $data_centre->getCtrParametreCentre()->getPcDureeMaxRdv() : 60;
  254.         $bornes_recherche['fin']->modify('+' $DureeMaxRdv ' days');
  255.         // $listeMois = $this->ApiController->liste_mois($bornes_recherche['debut']->format('d-m-Y'), $bornes_recherche['fin']->format('d-m-Y'), $this->mois);
  256.         $data_marques $this->cache->get('marque', function () {
  257.             $data_marques $this->em->getrepository(Marque::class)->findBy([], ['ordre' => 'asc''marque_libele' => 'asc']);
  258.             return $data_marques;
  259.         });
  260.         $data_marques_cl $this->cache->get('marqueCl', function () {
  261.             $data_marques_cl $this->em->getrepository(MarqueCl::class)->findBy([], ['ordre' => 'asc''marque_libele' => 'asc']);
  262.             return $data_marques_cl;
  263.         });
  264.         $data_energies $this->cache->get('energie', function () {
  265.             $data_energies $this->em->getrepository(Energie::class)->findAll();
  266.             return $data_energies;
  267.         });
  268.         //  $Prestations = $this->cache->get('CentrePrestation_' . $centre->getId(), function () use ($centre) {
  269.         $CentrePrestations $this->em->getrepository(CentrePrestation::class)->findByCentreGroupeAndCentreType(
  270.             $data_centre->getCentreGroupe()->getId(),
  271.             $data_centre->getCentreType()->getId(),
  272.         );
  273.         $Prestations = [];
  274.         foreach ($CentrePrestations as $key => $CentrePrestation) {
  275.             $dateDebut = new datetime();
  276.             $dateFin = new datetime();
  277.             $dateFin->modify('+ 12 days');
  278.             $reduction $this->ApiController->getTarifPromotionsEntreDates($CentrePrestation->getId(), $dateDebut$dateFin$CentrePrestation->getPstTarif());
  279.             $reduction $reduction['tarif_final'];
  280.             // dd($CentrePrestation->getPstTarif(),$reduction,$CentrePrestation->getPstTypeVisite()->getTypVstLibeleLong() );
  281.             if ($reduction $CentrePrestation->getPstTarif()) {
  282.                 $tarif_final $reduction;
  283.             }
  284.             $Prestations[] = [
  285.                 'TypeVisite' => $CentrePrestation->getPstTypeVisite()->getTypVstLibeleLong(),
  286.                 'PrixInitial' => $CentrePrestation->getPstTarif(),
  287.                 'Duree' => $CentrePrestation->getPstDuree(),
  288.                 'Reduction' => $reduction $CentrePrestation->getPstTarif() ? true false,
  289.                 'PrixFinal' => $reduction $CentrePrestation->getPstTarif() ? $tarif_final $CentrePrestation->getPstTarif(),
  290.                 'PaiementEnLigne' => $CentrePrestation->isPaiementEnLigne(),
  291.                 'MessageAppelCentre' => $CentrePrestation->isMessageAppelCentre(),
  292.                 'Id' => $CentrePrestation->getId(),
  293.                 'ordre' => $CentrePrestation->getPstOrdre()
  294.             ];
  295.         }
  296.         usort($Prestations, function ($a$b) {
  297.             $aOrdre $a['ordre'];
  298.             $bOrdre $b['ordre'];
  299.             if ($aOrdre === null && $bOrdre === null) return 0;
  300.             if ($aOrdre === null) return 1// $a va après
  301.             if ($bOrdre === null) return -1// $b va après
  302.             return $aOrdre <=> $bOrdre;
  303.         });
  304.         $TypeVehicules $doctrine->getRepository(TypeVehicule::class)->findByCentreGroupeCentreType($data_centre->getCentreGroupe()->getId(), $data_centre->getCentreType()->getId());
  305.         $forceImmat 'false';
  306.         if ($data_centre->getCtrParametreCentre()->isPcForceImmat()) {
  307.             $forceImmat 'true';
  308.         }
  309.         $forceTelephone 'false';
  310.         if ($data_centre->getCtrParametreCentre()->isPcTelephoneNonObligatoire()) {
  311.             $forceTelephone 'true';
  312.         }
  313.         return $this->render('public/prendre_rdv.html.twig', [
  314.             'id_centre' => $id,
  315.             'centrePrestations' => $Prestations,
  316.             'centreType' => $data_centre->getCentreType()->getId(),
  317.             'parametreCentre' => $data_centre->getCtrParametreCentre(),
  318.             'typeVehicules' => $TypeVehicules,
  319.             'marques' => $data_marques,
  320.             'marquesCl' => $data_marques_cl,
  321.             'energies' => $data_energies,
  322.             //  'ListeMois' => $listeMois,
  323.             'debut' => $bornes_recherche['debut'],
  324.             'Centre' => $data_centre,
  325.             'prestation_sel' => $Request->get('prestation') ? $Request->get('prestation') : false,
  326.             'forceImmat' => $forceImmat,
  327.             'forceTelephone' => $forceTelephone
  328.         ]);
  329.     }
  330.     #[Route('/prestation_by_type_vehicule_pub/{id_type_vehicule}'name'prestation_by_type_vehicule_pub')]
  331.     public function prestation_by_type_vehicule_pub(int $id_type_vehicule)
  332.     {
  333.         $prestationsArray = [];
  334.         $data_prestations $this->em->getrepository(CentrePrestation::class)->findByCentreGroupeAndTypeVehicule($this->id$id_type_vehicule);
  335.         foreach ($data_prestations as $prestation) {
  336.             $prestationsArray[] = array(
  337.                 'id' => $prestation->getId(),
  338.                 'pst_tarif' => $prestation->getPstTarif(),
  339.                 'pst_duree' => $prestation->getPstDuree(),
  340.                 'type_visite' => $prestation->getPstTypeVisite()->getId(),
  341.                 'type_visite_libele' => $prestation->getPstTypeVisite()->getTypVstLibele(),
  342.                 'type_visite_libele_long' => $prestation->getPstTypeVisite()->getTypVstLibeleLong(),
  343.                 // 'centre_groupe' => $prestation->getCentreGroupe()->getId()
  344.             );
  345.         }
  346.         // Retourner les données en format JSON
  347.         return new JsonResponse($prestationsArray);
  348.     }
  349.     #[Route('/get_energie_prestation'name'get_energie_prestation')]
  350.     public function get_energie_prestation(Request $Request): Response
  351.     {
  352.         $data =[];
  353.         $energies = [];
  354.         $centreId $Request->getSession()->get('centre_id');
  355.         $iframe $Request->request->get('iframe');
  356.         if ($iframe == "true") {
  357.             $centreId $Request->request->get('id');
  358.         }
  359.         $centre $this->em->getrepository(centre::class)->find($centreId);
  360.         $data_Prestation $this->em->getRepository(CentrePrestation::class)->find($Request->get('prestation'));
  361.         if ($Request->get('type_centre') != 2) {
  362.             if (count($data_Prestation->getEnergie())) {
  363.                 foreach ($data_Prestation->getEnergie() as $key => $value) {
  364.                     if (array_search($value->getDenomination(), $centre->getCtrParametreCentre()->getEnergies()) !== false) {
  365.                         $energies[] = ['id' => $value->getId(), 'denomination' => $value->getDenomination()];
  366.                     }
  367.                 }
  368.             } else {
  369.                 $data_energies $this->cache->get('energie_' $centreId, function () {
  370.                     $data_energies $this->em->getrepository(Energie::class)->findAll();
  371.                     return $data_energies;
  372.                 });
  373.                 foreach ($data_energies as $key => $value) {
  374.                     if (array_search($value->getDenomination(), $centre->getCtrParametreCentre()->getEnergies()) !== false) {
  375.                         $energies[] = ['id' => $value->getId(), 'denomination' => $value->getDenomination()];
  376.                     }
  377.                 }
  378.             }
  379.         } else {
  380.             $data_energies $this->cache->get('energie', function () {
  381.                 $data_energies $this->em->getrepository(Energie::class)->findAll();
  382.                 return $data_energies;
  383.             });
  384.             foreach ($data_energies as $key => $value) {
  385.                 if (array_search($value->getDenomination(), $centre->getCtrParametreCentre()->getEnergies()) !== false) {
  386.                     $energies[] = ['id' => $value->getId(), 'denomination' => $value->getDenomination()];
  387.                 }
  388.             }
  389.         }
  390.         $paiementWeb false;
  391.         $paiementCentre true;
  392.         if ($centre->getCtrParametreCentre()->isPaiementEnLigne()) {
  393.             if ($data_Prestation->isPaiementEnLigne()) {
  394.                 $paiementWeb true;
  395.             } 
  396.             if (!$centre->getCtrParametreCentre()->isPaiementEnCentre()){
  397.                 $paiementCentre false;
  398.             }
  399.             
  400.             if (!$paiementWeb && !$paiementCentre) {
  401.                 $paiementCentre true;
  402.             }
  403.         }
  404.         
  405.         $data = [
  406.             'energies' => $energies,
  407.             'paiementWeb' => $paiementWeb,
  408.             'paiementCentre' => $paiementCentre
  409.         ];
  410.         return new JsonResponse($data);
  411.     }
  412.     #[Route('/rech_dispon_rdv'name'rech_dispon_rdv')]
  413.     public function rech_dispon_rdv(Request $Request): Response
  414.     {
  415.         // On garde le time limit au cas où, mais avec l'optimisation, ça devrait voler
  416.         set_time_limit(1000);
  417.         $type_client $Request->get('type''public');
  418.         $bornes_recherche = array();
  419.         list($annee$mois$jour) = explode("-"$Request->get('date'));
  420.         $bornes_recherche['debut'] = new DateTime();
  421.         $bornes_recherche['debut']->setDate(intval($annee),intval($mois), intval($jour));
  422.         if ($bornes_recherche['debut'] > new DateTime()) {
  423.             $bornes_recherche['debut']->setTime(00);
  424.         }
  425.         if ($bornes_recherche['debut']->format('Ymd') == (new \DateTime())->format('Ymd')) {
  426.             $bornes_recherche['debut']->setTime(date('H'), date('i'));
  427.         }
  428.         $bornes_recherche['fin'] = clone $bornes_recherche['debut'];
  429.         $bornes_recherche['fin']->setTime(2359);
  430.         // Initialisation Response et Centre (Inchangé)
  431.         $content = new Response();
  432.         $content->headers->set('Content-Type''application/json');
  433.         $centre_id $Request->getSession()->get('centre_id');
  434.         $iframe $Request->request->get('iframe');
  435.         if ($iframe == "true") { $centre_id $Request->request->get('id'); }
  436.         /** @var Centre $data_centre */
  437.         // Optimisation : Retirez le cache ici si vous modifiez souvent les centres, sinon OK
  438.         $data_centre $this->em->getRepository(Centre::class)->find($centre_id);
  439.         if ($data_centre->getCtrParametreCentre()->isPcAfficheRdv6Jours()) {
  440.             $bornes_recherche['fin']->modify('+' '6 days');
  441.         }
  442.         // Gestion Prestations (Inchangé)
  443.         if ($data_centre->getCentreType()->getId() == || $data_centre->getCentreType()->getId() == 4) {
  444.             $id_prestation $Request->get('prestation_vl');
  445.             $data_Prestation $this->em->getRepository(CentrePrestation::class)->find($id_prestation);
  446.             $duree $data_Prestation->getPstDuree();
  447.             $tarif $data_Prestation->getPstTarif();
  448.         } else {
  449.             $data_Prestation false;
  450.             $duree 0$tarif 0;
  451.             foreach ($Request->get('prestation_pl') as $key => $id_prestation) {
  452.                 $Prestation $this->em->getRepository(CentrePrestation::class)->find($id_prestation);
  453.                 $duree += $Prestation->getPstDuree();
  454.                 $tarif += $Prestation->getPstTarif();
  455.             }
  456.         }
  457.         // Récupération des lignes (Inchangé)
  458.         $data_Ligne $this->em->getRepository(Ligne::class)->findLigneAndHoraireByTypeCentre($this->id$data_centre->getCentreType()->getId());
  459.         // --- OPTIMISATION CHARGEMENT DONNÉES ---
  460.         // 1. On charge TOUS les RDV de la période pour TOUTES les lignes d'un coup
  461.         // Note: Assurez-vous que findUpcomingRendezVousByLigne accepte null pour charger tout le centre ou bouclez proprement
  462.         // Ici on optimise votre boucle existante :
  463.         foreach ($data_Ligne as $key => $ligne) {
  464.             // On s'assure que 'evts' est bien un tableau vide au départ
  465.             $data_Ligne[$key]['evts'] = [];
  466.             $rdvs $this->em->getRepository(Rendezvous::class)->findUpcomingRendezVousByLigne($key$bornes_recherche['debut'], $bornes_recherche['fin']);
  467.             foreach($rdvs as $rdv) {
  468.                 $evtFin = clone $rdv->getRdvDateHeure();
  469.                 $evtFin->modify('+' $rdv->getRdvDuree() . ' minutes');
  470.                 // On stocke les timestamp pour comparaison rapide
  471.                 $data_Ligne[$key]['evts'][] = [
  472.                     'debut' => $rdv->getRdvDateHeure(),
  473.                     'fin' => $evtFin,
  474.                     'debut_ts' => $rdv->getRdvDateHeure()->getTimestamp(),
  475.                     'fin_ts' => $evtFin->getTimestamp()
  476.                 ];
  477.             }
  478.         }
  479.         // 2. On charge TOUS les Blocages
  480.         $data_LigneBlocage $this->em->getRepository(LigneBlocage::class)->findByCentre($this->id$data_centre->getCentreType()->getId(), $bornes_recherche['debut'], $bornes_recherche['fin']);
  481.         foreach ($data_LigneBlocage as $blocage) {
  482.             $lId $blocage->getLigne()->getId();
  483.             if (isset($data_Ligne[$lId])) {
  484.                 $data_Ligne[$lId]['evts'][] = [
  485.                     'debut' => $blocage->getBlcDebut(),
  486.                     'fin' => $blocage->getBlcFin(),
  487.                     'debut_ts' => $blocage->getBlcDebut()->getTimestamp(),
  488.                     'fin_ts' => $blocage->getBlcFin()->getTimestamp()
  489.                 ];
  490.             }
  491.         }
  492.         // 3. TRI CRUCIAL : On trie les événements par date pour optimiser la recherche
  493.         foreach ($data_Ligne as $key => $ligne) {
  494.             usort($data_Ligne[$key]['evts'], function($a$b) {
  495.                 return $a['debut_ts'] <=> $b['debut_ts'];
  496.             });
  497.         }
  498.         // --- FIN PREPARATION DONNEES ---
  499.         // Initialisation Demi-journées (Inchangé)
  500.         $demijournees = array();
  501.         $demijournee = clone $bornes_recherche['debut'];
  502.         // Petite sécu : on clone pour ne pas modifier la boucle
  503.         $loopDate = clone $bornes_recherche['debut'];
  504.         $endDate = clone $bornes_recherche['fin'];
  505.         while ($loopDate <= $endDate) {
  506.             $demijournees[] = array('date' => $loopDate->format('Y-m-d'), 'jour' => $this->jours[$loopDate->format('N') - 1], 'periode' => 'matin');
  507.             $demijournees[] = array('date' => $loopDate->format('Y-m-d'), 'jour' => $this->jours[$loopDate->format('N') - 1], 'periode' => 'apres_midi');
  508.             $loopDate->modify('+ 1 day');
  509.         }
  510.         $holidays $this->ApiController->getFormateHolidays($data_centre->getCtrParametreCentre()->getHolidays(), $bornes_recherche['debut']->format('Y'));
  511.         $horaires $this->em->getRepository(CentreHoraire::class)->getHoraires($data_centre->getid());
  512.         // Calcul ouvertures (Inchangé mais nettoyé)
  513.         foreach ($demijournees as $key => $dj) {
  514.             $objet $horaires[$dj['jour']][$dj['periode']];
  515.             $dateStr $dj['date'];
  516.             $demijournees[$key]['ouverture'] = DateTime::createFromFormat('Y-m-d H:i'$dateStr ' ' $objet['ouverture']->format('H:i'));
  517.             $demijournees[$key]['fermeture'] = DateTime::createFromFormat('Y-m-d H:i'$dateStr ' ' $objet['fermeture']->format('H:i'));
  518.             $demijournees[$key]['ouvert'] = $objet['ouvert'];
  519.             if (in_array($dateStr$holidays)) { $demijournees[$key]['ouvert'] = false; }
  520.             $demijournees[$key]['jourNumber'] = $demijournees[$key]['ouverture']->format('N');
  521.             $demijournees[$key]['journeeContinue'] = $objet['journeeContinue'];
  522.         }
  523.         // Paramètres de blocage RDV
  524.         $creneaux = array();
  525.         $hourEndBlockRdv null$hourStartBlockRdv null$hourBeforeBlock null;
  526.         $now = new \DateTime();
  527.         if ($data_centre->getCtrParametreCentre()->isIsBlockRdv()) {
  528.             $hourStartBlockRdv = (new \DateTime())->setTime($data_centre->getCtrParametreCentre()->getHourStartBlockRdv(), 0);
  529.             $hourEndBlockRdv = (clone $hourStartBlockRdv)->modify('+ ' $data_centre->getCtrParametreCentre()->getNbHoursBlockRdv() . ' hours');
  530.             if ($data_centre->getCtrParametreCentre()->getNbHoursBeforeBlockRdv()) {
  531.                 $hourBeforeBlock = (new \DateTime())->modify('+ ' $data_centre->getCtrParametreCentre()->getNbHoursBeforeBlockRdv() . ' hours');
  532.             }
  533.         }
  534.         // --- CŒUR DE L'ALGO OPTIMISÉ ---
  535.         foreach ($demijournees as $demijournee) {
  536.             if (!$demijournee['ouvert']) continue;
  537.             // Limites globales de la demi-journée
  538.             $globalOuverture $demijournee['ouverture'];
  539.             $globalFermeture = clone $demijournee['fermeture'];
  540.             $globalFermeture->modify('- ' $duree ' minutes');
  541.             // On boucle sur chaque ligne pour trouver ses créneaux
  542.             foreach ($data_Ligne as $key => $ligne) {
  543.                 $periode $demijournee['periode'] == 'matin' 'am' 'pm';
  544.                 $ligneHoraire $ligne["horaires"][$demijournee['jourNumber']][$periode];
  545.                 if (!$ligneHoraire) continue; // Pas d'horaire pour cette ligne ce jour là
  546.                 // Calcul Start Ligne
  547.                 $ligneOuvertureStr $ligneHoraire['ouverture'];
  548.                 if ($demijournee['ouverture']->format('Hi') > $ligneOuvertureStr) {
  549.                     $heure = clone $demijournee['ouverture'];
  550.                 } else {
  551.                     $heure DateTime::createFromFormat('Y-m-d Hi'$demijournee['date'] . ' ' $ligneOuvertureStr);
  552.                 }
  553.                 // Calcul End Ligne
  554.                 $ligneFermetureStr $ligneHoraire['fermeture'];
  555.                 if ($ligneFermetureStr == "") {
  556.                     $dernier_creneau_ligne DateTime::createFromFormat('Y-m-d Hi'$demijournee['date'] . ' 0000');
  557.                 } else {
  558.                     $dernier_creneau_ligne DateTime::createFromFormat('Y-m-d Hi'$demijournee['date'] . ' ' $ligneFermetureStr);
  559.                 }
  560.                 $dernier_creneau_ligne->modify('- ' $duree ' minutes');
  561.                 // BOUCLE DES CRENEAUX (Time Slot)
  562.                 while (
  563.                     ($demijournee['journeeContinue'] and $periode == 'pm' and $heure <= $globalFermeture)
  564.                     or ($heure <= $globalFermeture and $heure <= $dernier_creneau_ligne)
  565.                 ) {
  566.                     $ts $heure->getTimestamp();
  567.                     // Optimisation : Si ce créneau existe déjà (trouvé sur une autre ligne), on passe !
  568.                     // Sauf si vous voulez gérer la "capacité" (nb de places dispo), mais pour "rech_dispo", une seule place suffit.
  569.                     if (isset($creneaux[$ts])) {
  570.                         $heure->modify('+ ' $duree ' minutes');
  571.                         continue;
  572.                     }
  573.                     $fin = clone $heure;
  574.                     $fin->modify('+ ' $duree ' minutes');
  575.                     $fin_ts $fin->getTimestamp();
  576.                     // 1. Vérification des bornes globales
  577.                     $creneau_disponible true;
  578.                     if ($demijournee['journeeContinue']) {
  579.                         if ($heure $bornes_recherche['debut'] or ($periode == 'pm' and $fin $globalFermeture)) {
  580.                             $creneau_disponible false;
  581.                             // Ici break est risqué si ligne suivante a des horaires différents, on laisse couler
  582.                         }
  583.                     } else {
  584.                         if ($heure $bornes_recherche['debut']) {
  585.                             $creneau_disponible false;
  586.                         }
  587.                     }
  588.                     // 2. Vérification "Block RDV" (Parametrage global)
  589.                     if ($creneau_disponible && $data_centre->getCtrParametreCentre()->isIsBlockRdv()) {
  590.                         if ($now >= $hourStartBlockRdv and $heure >= $hourStartBlockRdv and $heure $hourEndBlockRdv) {
  591.                             $creneau_disponible false;
  592.                         }
  593.                         if ($hourBeforeBlock && $hourBeforeBlock $heure) {
  594.                             $creneau_disponible false;
  595.                         }
  596.                     }
  597.                     // Variable pour stocker la fin de l'événement qui nous bloque
  598.                     $collision_end_ts null;
  599.                     // 3. Vérification des CONFLITS (En mémoire - Ultra rapide)
  600.                     if ($creneau_disponible) {
  601.                         foreach ($ligne['evts'] as $evt) {
  602.                             // Logique Overlap : (StartA < EndB) et (EndA > StartB)
  603.                             if ($evt['debut_ts'] < $fin_ts && $evt['fin_ts'] > $ts) {
  604.                                 $creneau_disponible false;
  605.                                 // IMPORTANT : On sauvegarde la fin de l'événement qui bloque
  606.                                 $collision_end_ts $evt['fin_ts'];
  607.                                 break;
  608.                             }
  609.                             // Optimisation : Si l'event commence après notre fin, inutile de continuer (car trié)
  610.                             if ($evt['debut_ts'] >= $fin_ts) {
  611.                                 break;
  612.                             }
  613.                         }
  614.                     }
  615.                     // 4. Gestion de l'ajout et de l'incrémentation
  616.                     if ($creneau_disponible) {
  617.                         // C'est libre, on ajoute le créneau
  618.                         $creneaux[$ts] = clone $heure;
  619.                         // On avance d'un pas normal (durée)
  620.                         $heure->modify('+ ' $duree ' minutes');
  621.                     } else {
  622.                         // Ce n'est pas disponible (Conflit ou Blocage global)
  623.                         // EST-CE QU'ON DOIT REMPLIR LES TROUS ?
  624.                         // Si l'option est active ET qu'on a identifié un événement bloquant
  625.                         if ($data_centre->getCtrParametreCentreAdmin()->isPcaCalendrierRemplirTrou() && $collision_end_ts) {
  626.                             // ALORS : On saute directement à la fin de l'événement bloquant
  627.                             // Cela permet de "coller" le prochain créneau au RDV existant
  628.                             $heure->setTimestamp($collision_end_ts);
  629.                         } else {
  630.                             // SINON (Pas d'option ou blocage horaire générique) :
  631.                             // On avance simplement d'un pas normal pour tester le créneau suivant de la grille
  632.                             $heure->modify('+ ' $duree ' minutes');
  633.                         }
  634.                     }
  635.                 }
  636.             }
  637.         }
  638.         ksort($creneaux);
  639.         // ... (Reste de la construction de la réponse JSON JSON inchangée) ...
  640.         // ... Copiez collez votre partie $response['message']['donnees'] ...
  641.         // PARTIE CONSTRUCTION REPONSE (Identique à votre code)
  642.         $response = array();
  643.         $response['status'] = 200;
  644.         $response['message'] = array();
  645.         $response['message']['donnees'] = array();
  646.         $date_courante = clone $bornes_recherche['debut'];
  647.         $date_courante->setTime(00);
  648.         foreach ($demijournees as $key => $demijournee) {
  649.             $jour $date_courante->diff($demijournee['ouverture']);
  650.             $jour $jour->format('%r%a');
  651.             if (!array_key_exists($jour$response['message']['donnees'])) {
  652.                 $response['message']['donnees'][$jour] = array(
  653.                     'date' => array(
  654.                         'jour' => $demijournee['ouverture']->format('d'),
  655.                         'dow' => $demijournee['jour'],
  656.                         'mois' => array(
  657.                             'numero' => $demijournee['ouverture']->format('m'),
  658.                             'nom' => $this->mois[$demijournee['ouverture']->format('n')],
  659.                         ),
  660.                         'annee' => $demijournee['ouverture']->format('Y'),
  661.                     ),
  662.                 );
  663.             }
  664.             // Initialisation de la clé
  665.             if (!isset($response['message']['donnees'][$jour][$demijournee['ouverture']->format('A')])) {
  666.                 $response['message']['donnees'][$jour][$demijournee['ouverture']->format('A')] = array(
  667.                     'elements' => 0,
  668.                     'creneaux' => array(),
  669.                     'ouvert' => $demijournee['ouvert'],
  670.                 );
  671.             }
  672.         }
  673.         // Promo (Inchangé)
  674.         if ($data_Prestation) {
  675.             $retour $this->em->getRepository(PromotionCreneau::class)->prochainePromotion($data_Prestation->getid(), new DateTime());
  676.             $response['message']['promotion'] = (bool)$retour;
  677.         }
  678.         $test false;
  679.         foreach ($creneaux as $creneau) {
  680.             $test true;
  681.             $jour $date_courante->diff($creneau);
  682.             $jour $jour->format('%r%a');
  683.             $tarif_final $tarif;
  684.             if ($data_Prestation && $type_client !== 'pro') {
  685.                 $reduction $this->ApiController->getTarifPromotionsParHoraire($data_Prestation->getid(), $creneau$tarif_final);
  686.                 $reduction $reduction['tarif_final'];
  687.                 if ($reduction $tarif_final) {
  688.                     $tarif_final $reduction;
  689.                 }
  690.             }
  691.             // Sécurité si l'index n'existe pas (cas de décalage horaire ou jour)
  692.             $ampm $creneau->format('A');
  693.             if(isset($response['message']['donnees'][$jour][$ampm])) {
  694.                 $response['message']['donnees'][$jour][$ampm]['creneaux'][] = array(
  695.                     'heure' => $creneau->format('H:i'),
  696.                     'prix' => isset($tarif_final) ? $tarif_final null,
  697.                 );
  698.                 $response['message']['donnees'][$jour][$ampm]['elements'] += 1;
  699.             }
  700.         }
  701.         $response['duree'] = $duree;
  702.         $response['tarif'] = $tarif;
  703.         $content->setContent(json_encode($response));
  704.         // Gestion Récursion
  705.         if($test == false){
  706.             $date = new DateTime($Request->get('date'));
  707.             if ($data_centre->getCtrParametreCentre()->isPcAfficheRdv6Jours()) {
  708.                 $date->modify('+ 7 days');
  709.             } else {
  710.                 $date->modify('+ 1 days');
  711.             }
  712.             $dateTest = new datetime();
  713.             if ($date->format('Y') == ($dateTest->format('Y') + 2)) {
  714.                 return $content;
  715.             }
  716.             // Optimisation : Plutôt que de rappeler la fonction, il faudrait idéalement
  717.             // boucler ici pour éviter la stack overflow, mais pour l'instant on garde votre logique
  718.             $Request->request->set("date"$date->format('Y-m-d'));
  719.             return $this->rech_dispon_rdv($Request);
  720.         }
  721.         return $content;
  722.     }
  723.     #[Route('/getModelesByMarque'name'getModelesByMarque')]
  724.     public function getModelesByMarque(ModeleRepository $modeleRepositoryModeleClRepository $modeleClRepositoryRequest $Request): JsonResponse
  725.     {
  726.         if ($Request->get('id_centre_type') == 1) {
  727.             $modeles $modeleRepository->findBy(['code_marque' => $Request->get('id_marque')], ['mdl_ordre' => 'asc''mdl_libele' => 'asc']);
  728.         } else if ($Request->get('id_centre_type') == 4) {
  729.             $modeles $modeleClRepository->findBy(['code_marque_cl' => $Request->get('id_marque')], ['mdl_ordre' => 'asc''mdl_libele' => 'asc']);
  730.         }
  731.         $modelesArray = [];
  732.         foreach ($modeles as $modele) {
  733.             $modelesArray[] = [
  734.                 'id' => $modele->getId(),
  735.                 'libele' => $modele->getMdlLibele(),
  736.             ];
  737.         }
  738.         return new JsonResponse($modelesArray);
  739.     }
  740.     #[Route('/liste_date'name'liste_date')]
  741.     public function liste_date(Request $Request)
  742.     {
  743.         list($mois1$annee) = explode("_"$Request->get('mois'));
  744.         $date = new datetime();
  745.         if ($date->format('n') == $mois1) {
  746.             $datedebut = new datetime();
  747.         } else {
  748.             $datedebut = new datetime($annee '-' $mois1 '-' '01');
  749.         }
  750.         $datefin = new datetime($datedebut->format('Y-m-t'));
  751.         $datefin->modify('+ 1 days');
  752.         $centre_id $Request->getSession()->get('centre_id');
  753.         $data_centreHoraire $this->cache->get('Horaire_' $centre_id, function () use ($centre_id) {
  754.             $data_centreHoraire $this->em->getRepository(CentreHoraire::class)->getHoraires($centre_id);
  755.             return $data_centreHoraire;
  756.         });
  757.         $dates = [];
  758.         foreach (new DatePeriod($datedebut, new DateInterval('P1D'/* pas d'un jour */$datefin) as $dt) {
  759.             if ($data_centreHoraire[$this->jours[$dt->format('N') - 1]]['matin']['ouvert'] || $data_centreHoraire[$this->jours[$dt->format('N') - 1]]['apres_midi']['ouvert']) {
  760.                 $dates[] = array(
  761.                     'DateFormat' => $dt->format('Y-m-d'),
  762.                     'Lib' => $this->jours[$dt->format('N') - 1] . ' ' $dt->format('d') . ' ' $this->mois[$dt->format('n')] . ' ' $dt->format('Y'),
  763.                 );
  764.             }
  765.         }
  766.         return new JsonResponse($dates);
  767.     }
  768.     #[Route('/add_rendezvous_client_libre'name'add_rendezvous_client_libre')]
  769.     public function add_rendezvous_client_libre(Request $RequestUrlGeneratorInterface $urlGenerator)
  770.     {
  771.         $rendezvous = new Rendezvous;
  772.         $centre_id $Request->getSession()->get('centre_id');
  773.         $iframe $Request->request->get('iframe');
  774.         if ($iframe == "true") {
  775.             $centre_id $Request->request->get('id');
  776.         }
  777.         $data_centre $this->cache->get('Centre_' $centre_id, function () use ($centre_id) {
  778.             $data_centre $this->em->getRepository(Centre::class)->find($centre_id);
  779.             return $data_centre;
  780.         });
  781.         if ('POST' == $Request->getMethod()) {
  782.             $client_libre = new ClientLibre;
  783.             $client_libre->setClNom($Request->get('nom'));
  784.             $client_libre->setClPrenom($Request->get('prenom'));
  785.             if ($Request->get('email')) {
  786.                 $client_libre->setClEmail($Request->get('email'));
  787.             }
  788.             if ($Request->get('telephone')) {
  789.                 $client_libre->setClTelephone(preg_replace('/[-.]/'''$Request->get('telephone')));
  790.             }
  791.             if ($Request->get('civilite')) {
  792.                 $client_libre->setClCivilite($Request->get('civilite'));
  793.             }
  794.             $this->em->persist($client_libre);
  795.             $rendezvous->setClientLibre($client_libre);
  796.             $duree 0;
  797.             $tarif 0;
  798.             if ($data_centre->getCentretype()->getId() == || $data_centre->getCentretype()->getId() == 4) {
  799.                 $id_prestation $Request->get('prestation_vl');
  800.                 $data_Prestation $this->cache->get('Prestation' $id_prestation, function () use ($id_prestation) {
  801.                     $data_Prestation $this->em->getRepository(CentrePrestation::class)->find($id_prestation);
  802.                     return $data_Prestation;
  803.                 });
  804.                 $duree += $data_Prestation->getPstDuree();
  805.                 $tarif += $data_Prestation->getPstTarif();
  806.                 $rendez_vous_vehicules = new RendezVousVehicule();
  807.                 if ($data_centre->getCentretype()->getId() == 1) {
  808.                     if ($Request->get('marque')) {
  809.                         $marque $this->em->getRepository(Marque::class)->find($Request->get('marque'));
  810.                         $rendez_vous_vehicules->setMarque($marque);
  811.                         if ($Request->get('modele')) {
  812.                             $modele $this->em->getRepository(Modele::class)->find($Request->get('modele'));
  813.                             if ($modele !== null) {
  814.                                 $rendez_vous_vehicules->setModele($modele);
  815.                             } else {
  816.                                 $modele $this->em->getRepository(Modele::class)->findOneBy(['code_marque' => $marque->getId(), 'mdl_libele' => 'AUTRES MODELES']);
  817.                                 if ($modele !== null) {
  818.                                     $rendez_vous_vehicules->setModele($modele);
  819.                                 } else {
  820.                                     return new Response('error');
  821.                                 }
  822.                             }
  823.                         }
  824.                     }
  825.                 } elseif ($data_centre->getCentretype()->getId() == 4) {
  826.                     if ($Request->get('marque')) {
  827.                         $marque $this->em->getRepository(MarqueCl::class)->find($Request->get('marque'));
  828.                         $rendez_vous_vehicules->setMarqueCl($marque);
  829.                         if ($Request->get('modele')) {
  830.                             $modele $this->em->getRepository(ModeleCl::class)->find($Request->get('modele'));
  831.                             if ($modele !== null) {
  832.                                 $rendez_vous_vehicules->setModeleCl($modele);
  833.                             } else {
  834.                                 $modele $this->em->getRepository(ModeleCl::class)->findOneBy(['code_marque_cl' => $marque->getId(), 'mdl_libele' => 'AUTRES MODELES']);
  835.                                 if ($modele !== null) {
  836.                                     $rendez_vous_vehicules->setModele($modele);
  837.                                 } else {
  838.                                     return new Response('error');
  839.                                 }
  840.                             }
  841.                         }
  842.                     }
  843.                 }
  844.                 if ($Request->get('energie')) {
  845.                     $test_energie $this->em->getrepository(Energie::class)->find($Request->get('energie'));
  846.                     $rendez_vous_vehicules->setEnergie($test_energie);
  847.                 }
  848.                 $rendez_vous_vehicules->setRdvVhcTypeProprietaire('Autre');
  849.                 $rendez_vous_vehicules->setRdvVhcImmatriculation($Request->get('immatriculation'));
  850.                 $this->em->persist($rendez_vous_vehicules);
  851.                 $rendezvous_infos = new RendezVousInfos();
  852.                 $rendezvous_infos->setCentrePrestation($this->em->getrepository(CentrePrestation::class)->find($data_Prestation->getId()));
  853.                 $rendezvous_infos->setVehicule($rendez_vous_vehicules);
  854.                 $rendezvous_infos->setRendezvous($rendezvous);
  855.                 $rendezvous_infos->setRdvInfDepot(false);
  856.                 $rendezvous_infos->setRdvInfConvoyage(false);
  857.                 $rendezvous_infos->setRdvInfPret(false);
  858.                 $this->em->persist($rendezvous_infos);
  859.             } else {
  860.                 foreach ($Request->get('prestation_pl') as $key => $prestation) {
  861.                     $id_prestation $prestation['prestation'];
  862.                     $data_Prestation $this->cache->get('Prestation' $id_prestation, function () use ($id_prestation) {
  863.                         $data_Prestation $this->em->getRepository(CentrePrestation::class)->find($id_prestation);
  864.                         return $data_Prestation;
  865.                     });
  866.                     $id_type_vehicule$prestation['type_vehicule'];
  867.                     $data_type_vehicule $this->em->getRepository(TypeVehicule::class)->find($id_type_vehicule);
  868.                     $duree += $data_Prestation->getPstDuree();
  869.                     $tarif += $data_Prestation->getPstTarif();
  870.                     $rendez_vous_vehicules = new RendezVousVehicule();
  871.                     // if ($Request->get('marque')) {
  872.                     $marque $this->em->getrepository(Marque::class)->find(1);
  873.                     $rendez_vous_vehicules->setMarque($marque);
  874.                     if ($Request->get('modele')) {
  875.                         $modele $this->em->getrepository(Modele::class)->find(1);
  876.                         $rendez_vous_vehicules->setModele($modele);
  877.                     }
  878.                     // }
  879.                     if ($prestation['energie']) {
  880.                         $test_energie $this->em->getrepository(Energie::class)->find($prestation['energie']);
  881.                         $rendez_vous_vehicules->setEnergie($test_energie);
  882.                     }
  883.                     $rendez_vous_vehicules->setTypeVehicule($data_type_vehicule);
  884.                     $rendez_vous_vehicules->setRdvVhcTypeProprietaire('Autre');
  885.                     $rendez_vous_vehicules->setRdvVhcImmatriculation($prestation['immat']);
  886.                     $this->em->persist($rendez_vous_vehicules);
  887.                     $rendezvous_infos = new RendezVousInfos();
  888.                     $rendezvous_infos->setCentrePrestation($this->em->getrepository(CentrePrestation::class)->find($data_Prestation->getId()));
  889.                     $rendezvous_infos->setVehicule($rendez_vous_vehicules);
  890.                     $rendezvous_infos->setRendezvous($rendezvous);
  891.                     $rendezvous_infos->setRdvInfDepot(false);
  892.                     $rendezvous_infos->setRdvInfConvoyage(false);
  893.                     $rendezvous_infos->setRdvInfPret(false);
  894.                     $this->em->persist($rendezvous_infos);
  895.                 }
  896.             }
  897.             $rendezvous->setCentre($this->em->getrepository(Centre::class)->find($data_centre->getId()));
  898.             $rendezvous->setCentreType($this->em->getrepository(CentreType::class)->find($data_centre->getCentreType()->getId()));
  899.             $rendezvous->setTokenRendezVous(md5(uniqid()));
  900.             $rendezvous->setRdvDateHeure(new Datetime($Request->get('date_rdv') . ' ' $Request->get('heure_rdv')));
  901.             $rendezvous->setRdvDuree($duree);
  902.             $rendezvous->setRdvDateCreation(new Datetime());
  903.             $rendezvous->setPartenaire($this->em->getrepository(Partenaire::class)->find(2));
  904.             if ($rendezvous->getRdvDateHeure() < new DateTime()) {
  905.                 $this->addFlash('error''La date et l\'heure de rendez ne peut être pris dans le passé, veuillez choisir un autre créneau.');
  906.                 return $this->redirectToRoute('prendre_rdv', ['id' => $centre_id]);
  907.             }
  908.             $tarif_initial $tarif;
  909.             $tarif_final $tarif_initial;
  910.             if ($Request->get('prestation_vl') or count($Request->get('prestation_pl')) == 1) {
  911.                 if ($data_centre->getCentreType()->getId() == || $data_centre->getCentreType()->getId() == 4) {
  912.                     $reduction $this->ApiController->getTarifPromotionsParHoraire($Request->get('prestation_vl'), $rendezvous->getRdvDateHeure(), $tarif_final);
  913.                 } else {
  914.                     $reduction $this->ApiController->getTarifPromotionsParHoraire($Request->get('prestation_pl')[0]['prestation'], $rendezvous->getRdvDateHeure(), $tarif_final);
  915.                 }
  916.                 // $reduction = $reduction['tarif_final'];
  917.                 if ($reduction['tarif_final'] < $tarif_final) {
  918.                     $rendezvous->setPromotion($this->em->getrepository(Promotion::class)->find($reduction['id_promotion']));
  919.                     $tarif_final $reduction['tarif_final'];
  920.                 } else {
  921.                     if ($Request->get('code_promo')) {
  922.                         $CentreCouponPromotion $this->em->getrepository(CentreCouponPromotion::class)->findByCode_Coupon_prestation($id_prestation$Request->get('code_promo'));
  923.                         if ($CentreCouponPromotion) {
  924.                             if ($CentreCouponPromotion[0]['cpn_type_reduction'] == 0) {
  925.                                 $tarif_final $CentreCouponPromotion[0]['cpn_prm_montant_remise'];
  926.                             } else {
  927.                                 $tarif_final $CentreCouponPromotion[0]['pst_tarif'] - (($CentreCouponPromotion[0]['pst_tarif'] * $CentreCouponPromotion[0]['cpn_prm_montant_remise']) / 100);
  928.                             }
  929.                             $CentreCouponPromotion1 $this->em->getrepository(CentreCouponPromotion::class)->find($CentreCouponPromotion[0]['id']);
  930.                             $CentreCouponPromotion1->setCpnPrmNbrUtilisation($CentreCouponPromotion1->getCpnPrmNbrUtilisation() + 1);
  931.                             $this->em->persist($CentreCouponPromotion1);
  932.                             $rendezvous->setCouponPromotion($CentreCouponPromotion1);
  933.                         }
  934.                     }
  935.                 }
  936.                 if ($Request->get('p_centre') == "1") {
  937.                     if ($Request->get('pay2x') == "true") {
  938.                         $tarif_final += $data_centre->getCtrParametreCentre()->GetPcOptDeuxFoisMontant();
  939.                     }
  940.                     if ($Request->get('payassucv') == "true") {
  941.                         $tarif_final += $data_centre->getCtrParametreCentre()->getPcOptAssuranceCvMontant();
  942.                     }
  943.                     if ($Request->get('paymodif') == "true") {
  944.                         $tarif_final += $data_centre->getCtrParametreCentre()->getPcOptRdvModifiableMontant();
  945.                     }
  946.                 }
  947.             }
  948.             $rendezvous->setRdvTarif($tarif_final);
  949.             if ($data_centre->getCtrParametreCentre()->isPcRappelSms()) {
  950.                 if ($Request->get('smsrappel') == "true" && $Request->get('telephone') != null) {
  951.                     $rendezvous->setRdvDemandeRappelSms(true);
  952.                 } else {
  953.                     $rendezvous->setRdvDemandeRappelSms(false);
  954.                 }
  955.             }
  956.             $debut = clone $rendezvous->getRdvDateHeure();
  957.             $fin = clone $debut;
  958.             $fin->modify('+ ' $duree ' minutes');
  959.             $Lignes $this->em->getrepository(Ligne::class)->findByLigneDisponible($data_centre->getCentreGroupe()->getid(), $debut$fin$data_centre->getCentreType()->getId());
  960.             if (!$Lignes or count($Lignes) == 0) {
  961.                 $this->addFlash('error''Ce créneau ' $rendezvous->getRdvDateHeure()->format('d/m/Y H:i') . ' n\'est plus disponible, veuillez en choisir un autre');
  962.                 return $this->redirectToRoute('prendre_rdv', ['id' => $centre_id]);
  963.             } else {
  964.                 $Ligne $this->em->getrepository(Ligne::class)->find($Lignes[0]['id']);
  965.                 $rendezvous->setLigne($Ligne);
  966.             }
  967.             // verification du paiement en ligne ou selon le choix dna la page de validation
  968.             $paiementenligne true;
  969.             if ($Request->get('p_centre') == "0") {
  970.                 $paiementenligne false;
  971.             }
  972.             if ($data_centre->getCtrParametreCentre()->IsPaiementEnLigne() == false) {
  973.                 $paiementenligne false;
  974.             }
  975.             if ($data_centre->getCtrParametreCentre()->IsPaiementEnLigne() && $paiementenligne) {
  976.                 $rendezvous->setRdvDatetimeTimeout(new datetime());
  977.                 $rendezvous->setRdvTimeOut("1020");
  978.             }
  979.             if ($Request->get('smsconfirm') == "true" && $Request->get('telephone') != null) {
  980.                 $rendezvous->setRdvDemandeConfirmationSms(true);
  981.             } else {
  982.                 $rendezvous->setRdvDemandeConfirmationSms(false);
  983.             }
  984.             $this->em->persist($rendezvous);
  985.             $this->em->flush();
  986.             //envoi rdv a autoplanning
  987.             $this->ApiController->sendAddRdvToAutoPlanning($rendezvous);
  988.             $this->ApiController->sendAddRdvToCtMalin($rendezvous);
  989.             if ($paiementenligne) {
  990.                 // envoi vers paiement en ligne
  991.                 $return $this->PaylineController->envoiPaylineComptant($rendezvous$rendezvous->getRdvTarif(), $Request$data_centre);
  992.                 if ($return['result'] == 'OK') {
  993.                     $url $return['url'];
  994.                 } else {
  995.                     $this->addFlash('error'$return['Msg']);
  996.                     $url $urlGenerator->generate('erreur', []);
  997.                 }
  998.             } else {
  999.                 // envoi email de confirmation
  1000.                 $this->ApiController->envoi_email_confirmation_client($rendezvous);
  1001.                 $this->ApiController->envoi_email_confirmation_centre($rendezvous);
  1002.                 //envoi sms de confirmation
  1003.                 if ($Request->get('smsconfirm') == "true" && $Request->get('telephone' ) != null
  1004.                     && $rendezvous->getCentre()->getCtrParametreCentre()->isPcEnvoiSmsConfirm() === true) {
  1005.                     $this->ApiController->EnvoiSmsRdvConfirm($rendezvous$Request->get('telephone'));
  1006.                 }
  1007.                 // renvoyer la page de confirmation
  1008.                 $url $urlGenerator->generate('confirmation_rdv', [
  1009.                     'id' => $rendezvous->getTokenRendezVous(),
  1010.                 ]);
  1011.             }
  1012.             //    dd($rendezvous);
  1013.         }
  1014.         return new Response($url);
  1015.     }
  1016.     #[Route('/erreur'name'erreur')]
  1017.     public function erreur(Request $Request)
  1018.     {
  1019.         return $this->render('public/erreur.html.twig', []);
  1020.     }
  1021.     #[Route('/rech_coupon_promotion'name'rech_coupon_promotion')]
  1022.     public function rech_coupon_promotion(Request $Request)
  1023.     {
  1024.         $CentreCouponPromotion $this->em->getRepository(CentreCouponPromotion::class)->findByCode_Coupon_prestation($Request->request->get('prestation'), $Request->request->get('coupon'));
  1025.         return new JsonResponse($CentreCouponPromotion $CentreCouponPromotion[0] : null);
  1026.     }
  1027.     #[Route('/confirmation_rdv/{id}'name'confirmation_rdv')]
  1028.     public function confirmation_rdv($idRequest $Request)
  1029.     {
  1030.         $Rendezvous $this->em->getRepository(Rendezvous::class)->findOneBy(['tokenRendezVous' => $id]);
  1031.         $paramCentre $Rendezvous->getCentre()->getCtrParametreCentre();
  1032.         $CentreHoraires $this->em->getRepository(CentreHoraire::class)->getHoraires($Rendezvous->getCentre()->getId());
  1033.         return $this->render('public/confirmation_rdv.html.twig', [
  1034.             'Rendezvous' => $Rendezvous,
  1035.             'CentreHoraires' => $CentreHoraires,
  1036.             'parametreCentre' => $paramCentre
  1037.         ]);
  1038.     }
  1039.     #[Route('/modification_rendez_vous/{token}'name'modification_rendez_vous')]
  1040.     public function modification_rendez_vous($tokenRequest $request)
  1041.     {
  1042.         $Rendezvous $this->em->getRepository(Rendezvous::class)->findOneBy(['tokenRendezVous' => $token]);
  1043.         $request->getSession()->set('centre_id'$Rendezvous->getCentre()->getId());
  1044.         if (!$Rendezvous) {
  1045.             $this->addFlash('error''Le rendez-vous sélectionné n\'est plus disponible. Merci de contacter le centre.');
  1046.             return $this->redirectToRoute('erreur');
  1047.         }
  1048.         if ($Rendezvous->getNombreModification() > 0) {
  1049.             $this->addFlash('error''Vous avez atteint le nombre maximum de modifications de rendez-vous autorisées. Merci de contacter le centre.');
  1050.             return $this->redirectToRoute('erreur');
  1051.         }
  1052.         // Date actuelle
  1053.         $dateActuelle = new DateTime();
  1054.         // Calcul de la différence en heures entre les deux dates
  1055.         $interval $dateActuelle->diff($Rendezvous->getRdvDateHeure());
  1056.         $heuresDifference $interval->h;
  1057.         if ($interval->24 && $interval->== 0) {
  1058.             $this->addFlash('error''Vous ne pouvez pas modifier un rendez-vous moins de 24 heures avant celui-ci. Merci de contacter le centre.');
  1059.             return $this->redirectToRoute('erreur');
  1060.         }
  1061.         $prestation_vl null;
  1062.         $prestation_pl null;
  1063.         if ($Rendezvous->getCentre()->getCentreType()->getId() == || $Rendezvous->getCentre()->getCentreType()->getId() == 4) {
  1064.             $prestation_vl $Rendezvous->getRendezVousInfos()[0]->getCentrePrestation()->getId();
  1065.         } elseif ($Rendezvous->getCentre()->getCentreType()->getId() == 2) {
  1066.             $prestation_pl '0';
  1067.             foreach ($Rendezvous->getRendezVousInfos() as $key => $RendezVousInfo) {
  1068.                 $prestation_pl .= ',' $RendezVousInfo->getCentrePrestation()->getId();
  1069.             }
  1070.         }
  1071.         return $this->render('public/modification_rdv.html.twig', [
  1072.             'Rendezvous' => $Rendezvous,
  1073.             'Centre' => $Rendezvous->getCentre(),
  1074.             'debut' => new datetime(),
  1075.             'prestation_vl' => $prestation_vl,
  1076.             'prestation_pl' => $prestation_pl,
  1077.             'centreType' => $Rendezvous->getCentre()->getCentreType()->getId(),
  1078.         ]);
  1079.     }
  1080.     #[Route('/modification_rendez_vous_up'name'modification_rendez_vous_up')]
  1081.     public function modification_rendez_vous_up(Request $RequestUrlGeneratorInterface $urlGenerator)
  1082.     {
  1083.         $Rendezvous $this->em->getRepository(Rendezvous::class)->findOneBy(['tokenRendezVous' => $Request->get('token1')]);
  1084.         if (!$Rendezvous) {
  1085.             $this->addFlash('error''Le rendez-vous sélectionné n\'est plus disponible. Merci de contacter le centre.');
  1086.             return $this->redirectToRoute('erreur');
  1087.         }
  1088.         $Rendezvous->setRdvDateHeure(new Datetime($Request->get('date_rdv1') . ' ' $Request->get('heure_rdv1')));
  1089.         $debut = clone $Rendezvous->getRdvDateHeure();
  1090.         $fin = clone $debut;
  1091.         $fin->modify('+ ' $Rendezvous->getRdvDuree() . ' minutes');
  1092.         $Lignes $this->em->getrepository(Ligne::class)->findByLigneDisponible($Rendezvous->getCentre()->getCentreGroupe()->getid(), $debut$fin$Rendezvous->getCentre()->getCentreType()->getId());
  1093.         if (!$Lignes or count($Lignes) == 0) {
  1094.             $this->addFlash('error''Ce créneau ' $Rendezvous->getRdvDateHeure()->format('d/m/Y H:i') . ' n\'est plus disponible, veuillez en choisir un autre');
  1095.             return $this->redirectToRoute('erreur');
  1096.         } else {
  1097.             $Ligne $this->em->getrepository(Ligne::class)->find($Lignes[0]['id']);
  1098.             $Rendezvous->setLigne($Ligne);
  1099.         }
  1100.         $Rendezvous->setNombreModification(1);
  1101.         $this->em->persist($Rendezvous);
  1102.         $this->em->flush();
  1103.         $this->ApiController->envoi_email_confirmation_client($Rendezvous);
  1104.         $this->ApiController->envoi_email_confirmation_centre($Rendezvous);
  1105.         //envoi sms de confirmation
  1106.         if ($Rendezvous->getCentre()->getCtrParametreCentre()->isPcEnvoiSmsConfirm() === true) {
  1107.             $this->ApiController->EnvoiSmsRdvConfirm($Rendezvous$Rendezvous->getClientLibre() ? $Rendezvous->getClientLibre()->getClTelephone() : $Rendezvous->getClientCompte()->getCliContact1Telephone());
  1108.         }
  1109.         // renvoyer la page de confirmation
  1110.         $url $urlGenerator->generate('confirmation_rdv', [
  1111.             'id' => $Rendezvous->getTokenRendezVous(),
  1112.         ]);
  1113.         return new Response($url);
  1114.     }
  1115.     #[Route('/payline_cancel_url_iframe'name'payline_cancel_url_iframe')]
  1116.     public function payline_cancel_url_iframe(Request $request)
  1117.     {
  1118.         $type $request->query->get('type');
  1119.         return $this->redirectToRoute('payline_cancel_url', ['iframe' => true'type_centre' => $type]);
  1120.     }
  1121.     #[Route('/payline_return_url_iframe'name'payline_return_url_iframe')]
  1122.     public function payline_return_url_iframe(Request $request)
  1123.     {
  1124.         $type $request->query->get('type');
  1125.         $retour $this->PaylineController->returnPaymentPayline($request);
  1126.         if ($retour['Result'] == 'OK') {
  1127.             return $this->redirectToRoute('confirmation_rdv', ['id' => $retour['token_rdv'],'iframe' => true]);
  1128.         } else {
  1129.             $type $request->query->get('type_centre');
  1130.             $this->addFlash('error'$retour['Msg']);
  1131.             return $this->redirectToRoute('erreur', ['iframe' => true'type_centre' => $type]);
  1132.         }
  1133.     }
  1134.     #[Route('/payline_cancel_url'name'payline_cancel_url')]
  1135.     public function payline_cancel_url(Request $Request)
  1136.     {
  1137.         $this->PaylineController->CancelPaymentPayline($Request);
  1138.         $this->addFlash('error''Votre rendez-vous à bien été annuler');
  1139.         $iframe $Request->query->get('iframe');
  1140.         $type $Request->query->get('type_centre');
  1141.         if ($iframe) {
  1142.             return $this->redirectToRoute('erreur', ['iframe' => true'type_centre' => $type]);
  1143.         }
  1144.         return $this->redirectToRoute('erreur');
  1145.     }
  1146.     #[Route('/payline_return_url'name'payline_return_url')]
  1147.     public function payline_return_url(Request $Request)
  1148.     {
  1149.         $retour $this->PaylineController->returnPaymentPayline($Request);
  1150.         if ($retour['Result'] == 'OK') {
  1151.             return $this->redirectToRoute('confirmation_rdv', ['id' => $retour['token_rdv']]);
  1152.         } else {
  1153.             $this->addFlash('error'$retour['Msg']);
  1154.             return $this->redirectToRoute('erreur');
  1155.         }
  1156.     }
  1157.     #[Route('/payline_notification_url'name'payline_notification_url')]
  1158.     public function payline_notification_url(Request $Request)
  1159.     {
  1160.         $retour $this->PaylineController->returnNotificationPaymentPayline($Request);
  1161.         return new Response('ok');
  1162.     }
  1163.     #[Route('/attestation_rendez_vous/{token}'name'attestation_rendez_vous_pub')]
  1164.     public function attestation_rendez_vous($token)
  1165.     {
  1166.         $RendezVous $this->em->getRepository(RendezVous::class)->findOneBy(['tokenRendezVous' => $token]);
  1167.         // Configure Dompdf according to your needs
  1168.         $pdfOptions = new Options();
  1169.         $pdfOptions->set('defaultFont''Arial');
  1170.         $pdfOptions->set('isRemoteEnabled'true);
  1171.         // $pdfOptions->set('chroot', [$this->getParameter('Directory')]);
  1172.         // Instantiate Dompdf with our options
  1173.         $dompdf = new Dompdf($pdfOptions);
  1174.         //return $this->render('admin/template/confirmation_rdv.html.twig', [
  1175.         $html $this->renderView('admin/template/confirmation_rdv.html.twig', [
  1176.             'rdv' => $RendezVous,
  1177.         ]);
  1178.         $dompdf->loadHtml($html);
  1179.         // (Optional) Setup the paper size and orientation 'portrait' or 'portrait'
  1180.         $dompdf->setPaper('A4''portrait');
  1181.         // Render the HTML as PDF
  1182.         $dompdf->render();
  1183.         $dompdf->stream('confirmation_rdv.rdf', array("Attachment" => false));
  1184.         // $output = $dompdf->output();
  1185.         // $path = 'uploads/'.$RendezVous->getCentre()->getId();
  1186.         // if (!file_exists($path)) {
  1187.         //     mkdir($path, 0777, true);
  1188.         // }
  1189.         // file_put_contents($path.'/confirmation_rdv.pdf', $output);
  1190.         return new Response('ok');
  1191.     }
  1192.     #[Route('/test_email'name'test_email')]
  1193.     public function test_email(Request $RequestMailerInterface $mailer)
  1194.     {
  1195.         set_time_limit(300000);
  1196.         // create a new cURL resource
  1197.             $ch curl_init();
  1198.             $param = array(
  1199.                 'id' => 1,
  1200.                 'cg_gerant_id' => 1,
  1201.                 'centre_groupe_css_id' => 1,
  1202.                 'cg_nom' => 'Test mon centres 2',
  1203.                 'url' => 'http: //aquila-infotech.fr/Centre_Shared_beta_test/web',
  1204.                 'url2' => '',
  1205.                 'cg_pas_horaires' => '15',
  1206.                 'cg_stay_to_date_rdv' => '1',
  1207.                 'actif' => '1',
  1208.                 'id_partenaire' => '',
  1209.             );
  1210.            // dd($param);
  1211.             // set URL and other appropriate options
  1212.             curl_setopt($chCURLOPT_URL"http://127.0.0.1:8000/centre_groupe_add_up");
  1213.             curl_setopt($chCURLOPT_HEADER0);
  1214.             curl_setopt($chCURLOPT_POSTtrue);
  1215.             curl_setopt($chCURLOPT_POSTFIELDS$param);
  1216.             curl_setopt($chCURLOPT_RETURNTRANSFER1);
  1217.             
  1218.             // grab URL and pass it to the browser
  1219.             $centre curl_exec($ch);
  1220.             // close cURL resource, and free up system resources
  1221.             curl_close($ch);
  1222.             $centres json_decode($centretrue);
  1223.            //  dd($centres);
  1224.             return new JsonResponse($centres);
  1225.     }
  1226.     #[Route('/envoi_email_contact'name'envoi_email_contact')]
  1227.     public function envoi_email_contact(Request $Request)
  1228.     { // MailerInterface $mailer
  1229.         $Centre $this->em->getRepository(Centre::class)->findOneBy(['centre_groupe' => $this->id]);
  1230.         $email = (new Email())
  1231.             ->from('noreply@notification-abs.com')
  1232.             ->to($Centre->getCtrEmail())
  1233.             //->to('h.madi@autobilan-systems.com')
  1234.             ->ReplyTo($Request->get('email'))
  1235.             ->subject('Formulaire de contact par un client')
  1236.             ->html($this->renderView('email/contact.html.twig',
  1237.                 [
  1238.                     'Request' => ['nom' => $Request->get('nom'),
  1239.                         'email' => $Request->get('email'),
  1240.                         'objet' => $Request->get('objet'),
  1241.                         'message' => $Request->get('message'),
  1242.                     ],
  1243.                 ]
  1244.             ));
  1245.         $this->mailer->send($email);
  1246.         return new Response('ok');
  1247.     }
  1248.     #[Route('/mentions_legales'name'mentions_legales')]
  1249.     public function mentions_legales()
  1250.     {
  1251.         return $this->render('public/mentions_legales.html.twig');
  1252.     }
  1253.     #[Route('/politique_de_confidentialite'name'politiques')]
  1254.     public function politiques()
  1255.     {
  1256.         $parametreCentreGroupe $this->em->getRepository(ParametreCentreGroupe::class)->findOneBy(['centre_groupe' => $this->id]);
  1257.         return $this->render('public/politiques.html.twig', [
  1258.             'parametreCentreGroupe' => $parametreCentreGroupe,
  1259.         ]);
  1260.     }
  1261.     #[Route('/Cookies_et_technologies_similaires'name'cookies')]
  1262.     public function cookies()
  1263.     {
  1264.         return $this->render('public/cookies.html.twig');
  1265.     }
  1266.     #[Route('/Politique_RGPD'name'rgpd')]
  1267.     public function rgpd()
  1268.     {
  1269.         return $this->render('public/rgpd.html.twig');
  1270.     }
  1271. }