src/Flexy/FrontBundle/Themes/CoWorking/Controller/ResarvationController.php line 268
<?phpnamespace App\Flexy\FrontBundle\Themes\CoWorking\Controller;use App\Flexy\FrontBundle\Repository\CategoryProductFrontRepository;use App\Flexy\FrontBundle\Themes\CoWorking\Form\Mission\RequestMissionType;use App\Flexy\FrontBundle\Themes\CoWorking\Form\Order\OrderStepInfosType;use App\Flexy\FrontBundle\Themes\CoWorking\Form\Order\OrderType;use App\Flexy\ShopBundle\Entity\Customer\Customer;use App\Flexy\ShopBundle\Entity\Customer\CustomerGroup;use App\Flexy\ShopBundle\Entity\Customer\CustomerWalletPoint;use App\Flexy\ShopBundle\Entity\Order\Order;use App\Flexy\ShopBundle\Entity\Order\OrderItem;use App\Flexy\ShopBundle\Entity\Payment\Payment;use App\Flexy\ShopBundle\Entity\Payment\PaymentMethod;use App\Flexy\ShopBundle\Entity\Shipping\CityRegion;use App\Flexy\ShopBundle\Entity\Shipping\ShippingRule;use App\Flexy\ShopBundle\Entity\Shipping\ShippingVehicleType;use App\Flexy\ShopBundle\Repository\Order\OrderRepository;use App\Flexy\ShopBundle\Repository\Payment\PaymentMethodRepository;use App\Flexy\ShopBundle\Repository\Product\MetaDataExtraRepository;use Symfony\Component\HttpFoundation\JsonResponse;use App\Flexy\ShopBundle\Repository\Order\NotificationOrderRepository;use App\Flexy\FrontBundle\Themes\CoWorking\Service\QrcodeService;use App\Flexy\ShopBundle\Repository\Product\ProductRepository;use App\Flexy\ShopBundle\Repository\Order\OrderItemRepository;use App\Flexy\ShopBundle\Repository\Customer\CustomerRepository;use Symfony\Component\Security\Core\Security;use Symfony\Component\HttpFoundation\Session\SessionInterface;use App\Flexy\FrontBundle\Themes\Mutaweef\Form\RegistrationCustomerFormType;use App\Flexy\ShopBundle\Repository\Order\UnavailableRoomRepository ;use DateTime;use DatePeriod;use DateInterval;use App\Flexy\ShopBundle\Repository\Product\AttributValueRepository;use Symfony\Component\HttpFoundation\Response;use App\Flexy\ShopBundle\Repository\CategoryProductRepository;use App\Flexy\ShopBundle\Repository\Order\EventCalendarRepository;use App\Flexy\ShopBundle\Repository\Product\CategoryProductRepository as ProductCategoryProductRepository;use App\Flexy\TransportBundle\Entity\Mission;use App\Flexy\TransportBundle\Entity\RequestMission;use Doctrine\Persistence\ManagerRegistry;use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;use Symfony\Component\HttpFoundation\Request;use Symfony\Component\Routing\Annotation\Route;use Stripe;use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;#[Route('/reservation')]class ResarvationController extends AbstractController{private $security;public function __construct(Security $security){$this->security = $security;}#[Route('/reservation-paiement', name: 'reservationPaiement')]public function reservatioPaiement(PaymentMethodRepository $paymentMethodRepository,Request $request,OrderRepository $orderRepository): Response{$dateStart= $request->request->get('dateStart');$dateEnd= $request->request->get('dateEnd');$Formule= $request->request->get('duree');$amountToPay= $request->request->get("amountToPay");$orderCart = $request->getSession()->get("cart_items");$demandeSpecifique= $request->request->get("demandeSpecifique");$detailFormule = $request->request->get("detailDuree");$priceMeals = $request->request->get("priceMeals");$meals = $request->request->get("meals");$nbrApproximatif = $request->request->get("nbrApproximatif");// $paymentsMethod = $paymentMethodRepository->findBy(array('isEnabled' => true),array('code' => 'ASC'));$paymentsMethod = $paymentMethodRepository->findEnabledForFront();return $this->render('@Flexy/FrontBundle/Themes/CoWorking/templates/reservation/paiement.html.twig', ["paymentsMethod"=>$paymentsMethod,"dateStart" =>$dateStart,"dateEnd" =>$dateEnd,"Formule" =>$Formule,"detailFormule" =>$detailFormule,"orderCart"=>$orderCart,"amountToPay"=>$amountToPay,"priceMeals"=>$priceMeals,"nbrApproximatif"=>$nbrApproximatif,"meals"=>$meals,"demandeSpecifique"=>$demandeSpecifique]);}#[Route('/save-meals-session', name: 'save_meals_session', methods: ['POST'])]public function saveMealsSession(Request $request, SessionInterface $session): JsonResponse{$data = json_decode($request->getContent(), true);if ($data) {$session->set('meals', $data);return new JsonResponse(['status' => 'success', 'message' => 'Meals saved in session']);}return new JsonResponse(['status' => 'error', 'message' => 'Invalid data'], 400);}#[Route('/reservation-paiement-success', name: 'reservationSuccess')]public function reservatioPaiementSuccess(ProductRepository $productRepository,CategoryProductFrontRepository $categoryProductFrontRepository,AttributValueRepository $attributValueRepository): Response{return $this->render('@Flexy/FrontBundle/Themes/CoWorking/templates/reservation/success-paiement.html.twig');}#[Route('/qrcode', name: 'app_code')]public function qrCodeAction(Request $request,QrcodeService $qrcodeService ): Response{$qrCode=null;$qrCode = $qrcodeService->qrcode('najib benkirane');return $this->render('@Flexy/FrontBundle/Themes/CoWorking/templates/reservation/qrCode/index.html.twig', ['qrCode' => $qrCode,]);}#[Route('/api/meeting', name: 'api_meeting_rooms')]public function getProducts(ProductRepository $productRepository): JsonResponse{$products = $productRepository->findProductMeeting();$data = array_map(function ($product) {return ['id' => $product->getId(),'name' => str_replace('Meeting room ', '', $product->getName()),];}, $products);return $this->json($data);}#[Route('/calendar', name: 'showAllResourcesCalendar', methods: ['GET'])]public function showAllResourcesCalendar(ProductRepository $productRepository,OrderRepository $orderRepository, OrderItemRepository $orderItemRepository,EventCalendarRepository $eventCalendarRepository): Response{$produits = $productRepository->findBy(array('productType' => "variable", 'parentCategory'=> 4));$eventCalendar = $eventCalendarRepository->findAll();// Critères de sélection des produits$productType = "variable";$parentCategory = 4;// Critères pour les commandes (statuses)$statuses = ['paid', 'paide','paid_Pa'];// Récupérer toutes les commandes avec le statut 'paid' ou 'paide' et associées à des produits spécifiques$orders = $orderRepository->findOrdersWithStatusAndProducts($statuses, $productType, $parentCategory);// Récupérer tous les OrderItems associés à des commandes avec le statut 'paid' ou 'paide' et produits spécifiques$orderItems = $orderItemRepository->findOrderItemsByOrderStatusAndProduct($statuses, $productType, $parentCategory);return $this->render('@Flexy/FrontBundle/Themes/CoWorking/templates/reservation/calendar/index.html.twig', ['ressources' => $produits,'orderItems'=>$orderItems,'eventCalendar' =>$eventCalendar,]);}#[Route('/calendar_office', name: 'showAllResourcesOfficeCalendar', methods: ['GET'])]public function showAllResourcesOfficeCalendar(ProductRepository $productRepository,OrderRepository $orderRepository, OrderItemRepository $orderItemRepository,ProductCategoryProductRepository $productCategoryProductRepository): Response{//$produits = $productRepository->findBy(array('productType' => "variable", 'parentCategory'=> 1));$productType = 6;$type = "variable";$parentCategory = 1;$produits = $productRepository->findProductsOfficeOnePost();$produitsTwo = $productRepository->findProductsOfficeTwoPost();$produitsFour = $productRepository->findProductsOfficeFourPost();$produitsColoc = $productRepository->findProductsOfficeColoc();// Critères de sélection des produits$productType = "variable";$parentCategory = 1;// Critères pour les commandes (statuses)$statuses = ['paid', 'paide','paid_Pa'];// Récupérer toutes les commandes avec le statut 'paid' ou 'paide' et associées à des produits spécifiques$orders = $orderRepository->findOrdersWithStatusAndProducts($statuses, $productType, $parentCategory);// Récupérer tous les OrderItems associés à des commandes avec le statut 'paid' ou 'paide' et produits spécifiques//$orderItems = $orderItemRepository->findOrderItemsByOrderStatusAndProduct($statuses, $productType, $parentCategory);$orderItems = $orderItemRepository->findOrderItemsByOrderStatusAndProductOnePost($statuses, $productType, $parentCategory);$orderItemstwoposte = $orderItemRepository->findOrderItemsByOrderStatusAndProducTwo($statuses, $productType, $parentCategory);$orderItemsforposte = $orderItemRepository->findOrderItemsByOrderStatusAndProducfor($statuses, $productType, $parentCategory);$orderItemscoloc = $orderItemRepository->findOrderItemsByOrderStatusAndProductColoc($statuses, $productType, $parentCategory);// dd($orderItems);return $this->render('@Flexy/FrontBundle/Themes/CoWorking/templates/reservation/calendar/office.html.twig', ['ressources' => $produits,'ressourcesTwo' => $produitsTwo,'ressourcesFour' => $produitsFour,'ressourcesColoc' => $produitsColoc,'orderItems'=>$orderItems,'orderItemstwoposte'=>$orderItemstwoposte,'orderItemsforposte'=> $orderItemsforposte,'orderItemscoloc'=> $orderItemscoloc,]);}#[Route('/reservation-step-meeting/{id}', name: 'reservationMeetingstep1')]public function reservatioStepOneMeeting($id,ProductRepository $productRepository, SessionInterface $session,CategoryProductFrontRepository $categoryProductFrontRepository,AttributValueRepository $attributValueRepository): Response{//$session->remove('cart_items');$product = $productRepository->findBy(array('id' => $id));$name = $product[0]->getName();$dispotionU = $product[0]->getOldPrice();$dispotionTheatre = $product[0]->getQuantity();$dispotionEcole = $product[0]->getCapacity();// $products = $productRepository->findByParentCategory([1]);$attributValues = $attributValueRepository->findBy(array('product' => $product));$services = $productRepository->findBy(array('productType' => "service", 'parentCategory'=> $product[0]->getParentCategory()->getId()),array('shortDescription' => 'ASC'));$servicesCommuns = $productRepository->findBy(array('productType' => "service", 'parentCategory'=> null),array('shortDescription' => 'ASC'));return $this->render('@Flexy/FrontBundle/Themes/CoWorking/templates/reservation/reservation-meeting-step.html.twig', ["attributValues"=>$attributValues,"services"=>$services,"name" => $name,"servicesCommuns"=>$servicesCommuns,"product"=>$product[0]->getId(),"dispotionU"=>$dispotionU,"dispotionTheatre"=>$dispotionTheatre,"dispotionEcole"=> $dispotionEcole]);}#[Route('/reservation-step-freework/{id}', name: 'reservationFreeworkstep1')]public function reservatioStepOneFreework($id,ProductRepository $productRepository,SessionInterface $session,CategoryProductFrontRepository $categoryProductFrontRepository,AttributValueRepository $attributValueRepository): Response{// $session->remove('cart_items');$product = $productRepository->findBy(array('id' => $id));$name = $product[0]->getName();// $products = $productRepository->findByParentCategory([1]);$attributValues = $attributValueRepository->findBy(array('product' => $product));$services = $productRepository->findBy(array('productType' => "service", 'parentCategory'=> $product[0]->getParentCategory()->getId()),array('shortDescription' => 'ASC'));$servicesCommuns = $productRepository->findBy(array('productType' => "service", 'parentCategory'=> null),array('shortDescription' => 'ASC'));return $this->render('@Flexy/FrontBundle/Themes/CoWorking/templates/reservation/reservation-freework-step.html.twig', ["attributValues"=>$attributValues,"services"=>$services,"name" => $name,"servicesCommuns"=>$servicesCommuns,"product"=>$product[0]->getId()]);}#[Route('/reservation-step/{id}', name: 'reservationbureauxstep1')]public function reservatioStepOneBureaux($id,Request $request, ProductRepository $productRepository,ProductCategoryProductRepository $productCategoryProductRepository,AttributValueRepository $attributValueRepository): Response{//$products = $productRepository->findByParentCategory([1]);/*$orderCart = $request->getSession()->get("cart_items");dd($orderCart);*///$session->remove('cart_items');$products = $productRepository->findBy(array('parentCategory' => 1));$subcategoryProduct = $productCategoryProductRepository->findBy(array('id' => $id));$attributValues = $attributValueRepository->findProductAttri($id,1);$services = $productRepository->findBy(array('productType' => "service", 'parentCategory'=> 1),array('shortDescription' => 'ASC'));$servicesCommuns = $productRepository->findBy(array('productType' => "service", 'parentCategory'=> null),array('shortDescription' => 'ASC'));return $this->render('@Flexy/FrontBundle/Themes/CoWorking/templates/reservation/reservation-offices-step.html.twig', ['products' => $products,"attributValues"=>$attributValues,'subcategory'=> $id,'subcategoryName'=> $subcategoryProduct[0]->getName(),"services"=>$services,"servicesCommuns"=>$servicesCommuns,]);}#[Route('/reservation-step2-office/{id}', name: 'reservationstep2office')]public function reservatioStepTwo($id,CustomerRepository $customerRepository ,SessionInterface $session , AuthenticationUtils $authenticationUtils,Request $request,OrderRepository $orderRepository, OrderItemRepository $orderItemRepository,ProductRepository $productRepository,CategoryProductFrontRepository $categoryProductFrontRepository): Response{$orderCart = $request->getSession()->get("cart_items");$firstItem = reset($orderCart);$priceFirstItem = $firstItem['price'];if($priceFirstItem == 0 ) {if (!$this->isGranted('ROLE_CUSTOMER')) {//hire le lien de redirection vers le lien$session->set('redirect_to', $request->getUri());return $this->redirectToRoute('login_register', ['message' => 'warning']);}else{$user = $this->security->getUser();$customer = $customerRepository->findBy(array('user' => $user->getId()));$orderCart = $request->getSession()->get("cart_items");return $this->render('@Flexy/FrontBundle/Themes/CoWorking/templates/reservation/reservation-office-long-duration.html.twig', ['customer' => $customer,'cart' => $orderCart]);}}else{$products = $productRepository->findBy(array('parentCategory' => 1));$days= (int)$request->query->get('paramFormule');//hire le lien de redirection vers le lien$session->set('redirect_to', $request->getUri());return $this->render('@Flexy/FrontBundle/Themes/CoWorking/templates/reservation/reservation-step2-office.html.twig', ['products' => $products,'subcategory'=> $id,"days" =>$days,]);}}#[Route('/reservation-meeting-next/{id}', name: 'reservationMeetingNext')]public function reservatioMeetingNext($id,ProductRepository $productRepository,MetaDataExtraRepository $metaDataExtraRepository,Request $request, SessionInterface $session,CategoryProductFrontRepository $categoryProductFrontRepository,AttributValueRepository $attributValueRepository): Response{// $session->remove('cart_items');$days= (int)$request->query->get('paramFormule');$nbr = $request->query->get('amp;proxim');$horaire= $request->query->get('amp;Horai12') ;$time = $request->query->get('amp;time') ;$device = $request->query->get('amp;dIS34') ;// dd($device);$metaDataExtraBreakfast = $metaDataExtraRepository->findBy(array('type'=>"Pause Matin"));$metaDataExtraLunch = $metaDataExtraRepository->findBy(array('type'=>"Déjeuner"));$metaDataExtraAfternoonBreak = $metaDataExtraRepository->findBy(array('type'=>"Pause Après-midi"));return $this->render('@Flexy/FrontBundle/Themes/CoWorking/templates/reservation/reservation-meeting-next.html.twig',["days" =>$days,"Plage" => $horaire,"nbrApproximatif" =>$nbr,"time" =>$time,"device" =>$device,"breakfast"=>$metaDataExtraBreakfast,"lunch"=>$metaDataExtraLunch,"afternoonBreak"=>$metaDataExtraAfternoonBreak,"id"=>$id]);}#[Route('/reservation-step2/{id}', name: 'reservationstep2')]public function reservatioStepTwoBureaux($id,EventCalendarRepository $eventCalendarRepository,CustomerRepository $customerRepository,UnavailableRoomRepository $unavailableRoomRepository, Request $request,SessionInterface $session ,OrderRepository $orderRepository, OrderItemRepository $orderItemRepository,ProductRepository $productRepository,CategoryProductFrontRepository $categoryProductFrontRepository): Response{if ($request->query->has('paramFormule')) {$paramFormule = $request->query->get('paramFormule');if (is_numeric($paramFormule)) {$days = (int)$paramFormule;}}if ($request->query->has('days')) {$days = $request->query->get('days');}/*$days= (int)$request->query->get('paramFormule');$horaire= $request->query->get('amp;Horai12') ;$time = $request->query->get('amp;time') ;$device = $request->query->get('amp;dIS34') ;*/$horaire= $request->query->get('Plage') ;$time = $request->query->get('time') ;$device = $request->query->get('device') ;$amount_extra = $request->query->get('amount_extra');$nbrApproximatif = $request->query->get('nbrApproximatif');$orderCart = $request->getSession()->get("cart_items");$firstItem = reset($orderCart);$priceFirstItem = $firstItem['price'];if (!$this->isGranted('ROLE_CUSTOMER')) {//hire le lien de redirection vers le lien$session->set('redirect_to', $request->getUri());return $this->redirectToRoute('login_register', ['message' => 'warning']);}else{if($priceFirstItem == 0 ) {$user = $this->security->getUser();$customer = $customerRepository->findBy(array('user' => $user->getId()));$orderCart = $request->getSession()->get("cart_items");return $this->render('@Flexy/FrontBundle/Themes/CoWorking/templates/reservation/reservation-office-long-duration.html.twig', ['customer' => $customer,'cart' => $orderCart]);} else{$products = $productRepository->findBy(['id' => $id]);$currentProduct = $products[0];$currentRoomName = $currentProduct->getName();$currentRoomId = $currentProduct->getId();$currentRoomName = str_replace("Meeting room ", "", $currentRoomName);// Initialiser la disponibilité des salles et les dates non disponibles$roomAvailability = ['Univers' => true,'Newton' => true,'Einstein' => true,];$unavailableDates = ['Univers' => [],'Newton' => [],'Einstein' => [],];// Récupérer les produits Newton et Einstein/*$universProduct = $productRepository->findOneBy(['name' => 'Meeting room Univers']);$newtonProduct = $productRepository->findOneBy(['name' => 'Meeting room Newton']);$einsteinProduct = $productRepository->findOneBy(['name' => 'Meeting room Einstein']);*/$universProducts = $productRepository->findByNameLike('Univers');$newtonProducts = $productRepository->findByNameLike('Newton');$einsteinProducts = $productRepository->findByNameLike('Einstein');// Supposons qu'il n'y a qu'un produit pour chaque salle$universProduct = $universProducts[0];$newtonProduct = $newtonProducts[0];$einsteinProduct = $einsteinProducts[0];if ($currentRoomName === 'Univers') {// Chercher les éléments de commande pour Newton et Einstein$newtonOrderItems = $orderItemRepository->findByProduct([$newtonProduct->getId()]);$einsteinOrderItems = $orderItemRepository->findByProduct([$einsteinProduct->getId()]);// Combiner les éléments de commande$orderItems = array_merge($newtonOrderItems, $einsteinOrderItems);//dd($orderItems);} elseif ($currentRoomName === 'Newton' || $currentRoomName === 'Einstein') {// Chercher les éléments de commande pour Univers$universOrderItems = $orderItemRepository->findByProduct([$universProduct->getId()]);// Utiliser les éléments de commande de Univers$orderItems = $universOrderItems;//dd($orderItems);} else {$orderItems = [];}foreach ($orderItems as $orderItem) {$orders = $orderRepository->findOrdersByOrderItem($orderItem->getId());foreach ($orders as $order) {$orderRoomName = $orderItem->getProduct()->getName();$orderRoomName = str_replace("Meeting room ", "", $orderRoomName);$orderStart = $order->getStartProcessingAt();$orderEnd = $order->getStartDeliveryAt();if ($orderRoomName === 'Univers') {// Si 'Univers' est réservé, 'Newton' et 'Einstein' sont bloqués$unavailableDates['Newton'][] = ['start' => $orderStart, 'end' => $orderEnd];$unavailableDates['Einstein'][] = ['start' => $orderStart, 'end' => $orderEnd];$roomAvailability['Newton'] = false;$roomAvailability['Einstein'] = false;} elseif ($orderRoomName === 'Newton') {// Si 'Newton' est réservé, 'Univers' est bloqué$unavailableDates['Univers'][] = ['start' => $orderStart, 'end' => $orderEnd];$roomAvailability['Univers'] = false;} elseif ($orderRoomName === 'Einstein') {// Si 'Einstein' est réservé, 'Univers' est bloqué$unavailableDates['Univers'][] = ['start' => $orderStart, 'end' => $orderEnd];$roomAvailability['Univers'] = false;}}}//dd($unavailableDates);// Vérifier la disponibilité pour la salle courante$canReserve = true;if ($currentRoomName === 'Univers') {if (!$roomAvailability['Univers']) {$canReserve = false;}} elseif ($currentRoomName === 'Newton') {if (!$roomAvailability['Newton'] || !$roomAvailability['Univers']) {$canReserve = false;}} elseif ($currentRoomName === 'Einstein') {if (!$roomAvailability['Einstein'] || !$roomAvailability['Univers']) {$canReserve = false;}}$unavailableStartDates = [];foreach ($unavailableDates as $key => $dates) {foreach ($dates as $dateRange) {if (isset($dateRange['start'])) {//$startDates[$key][] = $dateRange['start']->format('Y-m-d');$unavailableStartDates[] = $dateRange['start']->format('Y-m-d');}}}//dd($unavailableStartDates);$unavailableDateWorkers = [];$UnavailableDateWork = $unavailableRoomRepository->UnavailableRoomNameLike($currentRoomName);foreach ($UnavailableDateWork as $key => $date) {$startDate = $date->getStartDate();$endDate = $date->getEndDate();// Créer une période à partir des deux dates$period = new \DatePeriod($startDate,new \DateInterval('P1D'), // Intervalle d'un jour$endDate->modify('0 day') // $endDate->modify('+1 day') Inclure le dernier jour);// Ajouter chaque date dans le tableauforeach ($period as $dateBetween) {$unavailableDateWorkers[] = $dateBetween->format('Y-m-d');}}$unavailableDateCalendars = [];$unavailableDateCalendar = $eventCalendarRepository->findBy(['product_id' => $currentRoomId]);foreach ($unavailableDateCalendar as $key => $date) {$startDate = $date->getDateStart();$endDate = $date->getEndDate();// Créer une période à partir des deux dates$period = new \DatePeriod($startDate,new \DateInterval('P1D'), // Intervalle d'un jour$endDate->modify('0 day')// Inclure le dernier jour);// Ajouter chaque date dans le tableauforeach ($period as $dateBetween) {$unavailableDateCalendars[] = $dateBetween->format('Y-m-d');}}$orderItems = $orderItemRepository->findByProduct([$id]);$relatedOrdersStart = [];$relatedOrdersEnd = [];$allDates = [];$deadlineBeforeTwetyforheursStart=[];$deadlineBeforeTwetyforheursEnd=[];$deadlineBeforeTwetyforheurs=[];foreach ($orderItems as $orderItem) {$orders = $orderRepository->findOrdersByOrderItem($orderItem->getId());// Ajoutez les commandes associées à cet élément de commande à l'ensemble des commandes.foreach ($orders as $order) {if ($order->getStatus() === 'paid' || $order->getStatus() === 'paide' || $order->getStatus() ==='paid_Pa') {$relatedOrdersStart[] = $order->getStartProcessingAt();$relatedOrdersEnd[] = $order->getStartDeliveryAt();}$createdAt = $order->getCreatedAt();$now = new \DateTime();$diffInSeconds = $now->getTimestamp() - $createdAt->getTimestamp();// La commande a été créée il y a moins de 24hif ($diffInSeconds <= 86400 && $diffInSeconds >= 0) {//$deadlineBeforeTwetyforheurs[] = $createdAt->format('Y-m-d'); //H:i:s$deadlineBeforeTwetyforheursStart[] = $order->getStartProcessingAt();$deadlineBeforeTwetyforheursEnd[] = $order->getStartDeliveryAt();}}if (!empty($deadlineBeforeTwetyforheursStart)) {$relatedOrdersStart = array_merge($relatedOrdersStart, $deadlineBeforeTwetyforheursStart);}if (!empty($deadlineBeforeTwetyforheursEnd)) {$relatedOrdersEnd = array_merge($relatedOrdersEnd, $deadlineBeforeTwetyforheursEnd);}}foreach (array_map(null, $relatedOrdersStart, $relatedOrdersEnd) as $dateRange) {[$start, $end] = $dateRange;if ($start instanceof DateTime) {$startDate = clone $start;} else {$startDate = new DateTime($start);}if ($end instanceof DateTime) {$endDate = clone $end;} else {$endDate = new DateTime($end);}if ($startDate !== null && $endDate !== null) {// Ajouter startDate$allDates[$startDate->format('Y-m-d H:i:s')] = true;// Jours entre les deux$currentDate = clone $startDate;$currentDate->modify('+1 day');while ($currentDate < $endDate) {$allDates[$currentDate->format('Y-m-d') . ' 00:00:00'] = true;$currentDate->modify('+1 day');}// Ajouter endDate$allDates[$endDate->format('Y-m-d H:i:s')] = true;}}// Finaliser sous forme de tableau indexé$allDates = array_keys($allDates);/*foreach (array_map(null, $relatedOrdersStart, $relatedOrdersEnd) as $dateRange) {[$start, $end] = $dateRange;$startDate = $start;if ($end instanceof DateTime) {$endDate = $end;} else {$endDate = new DateTime($end);}if($startDate != null ){$currentDate = clone $startDate;while ($currentDate <= $endDate) {$allDates[] = $currentDate->format('Y-m-d');$currentDate->modify('+1 day');}}foreach ($relatedOrdersEnd as $endDate) {if ($endDate instanceof DateTime) {$allDates[] = $endDate->format('Y-m-d');} else {$allDates[] = (new DateTime($endDate))->format('Y-m-d');}}}*///hire le lien de redirection vers le lien$session->set('redirect_to', $request->getUri());$nameOffice = $products[0]->getName();return $this->render('@Flexy/FrontBundle/Themes/CoWorking/templates/reservation/reservation-step2.html.twig',["nameOffice" => $nameOffice,"days" =>$days,"allDates"=> $allDates,"Plage" => $horaire,"nbrApproximatif"=>$nbrApproximatif,"time" =>$time,"device" =>$device,"amount_extra"=> $amount_extra,'roomAvailability' => $roomAvailability,'unavailableDates' => $unavailableDates,'unavailableStartDates'=> json_encode($unavailableStartDates),'unavailableDateWorkers' => $unavailableDateWorkers,'unavailableDateCalendars'=> $unavailableDateCalendars,]);}}}#[Route('/reservation-step3', name: 'reservationstep3 _recap')]public function reservatioSteptree(Request $request,CustomerRepository $customerRepository, ProductRepository $productRepository,ProductCategoryProductRepository $productCategoryProductRepository,AttributValueRepository $attributValueRepository): Response{if (!$this->isGranted('ROLE_CUSTOMER')) {/* $redirectTo = $session->get('redirect_to');dd($redirectTo);*/return $this->redirectToRoute('login_register', ['message' => 'warning']);}else{$formule = (int) $request->request->get('formule_cart');$timeStartInput = $request->request->get('timeStartInput');$timeEndInput = $request->request->get('timeEndInput');$plagehoraire= $request->request->get('plage_horaire');$device= $request->request->get('device');$demandeSpecifique = $request->request->get('demande_specifique');$amount_extra = $request->request->get('amount_extra');$nbrApproximatif = $request->request->get('nbrApproximatif');// Vérification de la plage horaireif (!empty($plagehoraire)) {// Si la plage horaire est "après-midi"if ($plagehoraire == 'apres-midi') {// Définir les heures de début et de fin pour l'après-midi$timeStartInput = '13:00';$timeEndInput = '18:00';}// Si la plage horaire est "matin"elseif ($plagehoraire == 'matin') {// Définir les heures de début et de fin pour le matin$timeStartInput = '08:00';$timeEndInput = '13:00';}}if($amount_extra == "" ){$amount_extra = 0 ;}$nombreHeures = 0;$orderCart = $request->getSession()->get("cart_items");if ($timeStartInput !== null && $timeEndInput !== null && empty($plagehoraire) ) {$timeStartInput = $timeStartInput . ':00';$timeEndInput = $timeEndInput . ':00';// Convertir les heures en objets DateTime$startTime = new \DateTime($timeStartInput);$endTime = new \DateTime($timeEndInput);// Calculer la différence entre les heures$difference = $endTime->diff($startTime);// Obtenir le nombre total d'heures// Heures + minutes$heures = $difference->h;$minutes = $difference->i;// Convertir minutes en fraction d’heure$nombreHeures = $heures + ($minutes / 60);// dd($nombreHeures);$firstItem = reset($orderCart);// Récupérer le prix actuel de l'élément//$price = $firstItem['price'];$basePrice = $firstItem['price_unit'] ?? $firstItem['price']; // On garde le prix de baseif (!isset($firstItem['price_unit'])) {$firstItem['price_unit'] = $firstItem['price'];$basePrice = $firstItem['price'];}// Sauvegarder le prix unitaire si pas encore faitif (!isset($firstItem['price_unit'])) {$firstItem['price_unit'] = $firstItem['price'];$basePrice = $firstItem['price'];}// Calcul du nouveau prix/* $updatedPrice = round($price * $nombreHeures, 2); // avec arrondi 2 décimales commit by najib$firstItem['price'] = $updatedPrice;$orderCart[key($orderCart)] = $firstItem;$request->getSession()->set("cart_items", $orderCart);*/$updatedPrice = round($basePrice * $nombreHeures, 2);$firstItem['price'] = $updatedPrice;$orderCart[key($orderCart)] = $firstItem;$request->getSession()->set("cart_items", $orderCart);}if(empty($plagehoraire) && $timeStartInput == null && $timeEndInput== null ){$timeStartInput = "08:00" ;$timeEndInput= "18:00";}$dates = explode(" to ", $request->get('date_resvation'));$date_start = $dates[0].' '.$timeStartInput; // Première date$date_end = $dates[1].' '.$timeEndInput; // Deuxième date$user = $this->security->getUser();$user = $customerRepository->findBy(array('user' => $user->getId()));//$orderCart = $request->getSession()->get("cart_items");// ... après le calcul de $nombreHeures$heuresInt = floor($nombreHeures);$minutes = round(($nombreHeures - $heuresInt) * 60);$affichageHeure = sprintf('%dh%02d', $heuresInt, $minutes); // ex: 2h30return $this->render('@Flexy/FrontBundle/Themes/CoWorking/templates/reservation/reservation-step3.html.twig',["date_start" => $date_start,"date_end" => $date_end,"customer"=>$user,"cart" =>$orderCart,"formule"=>$formule ,"nbrApproximatif" => $nbrApproximatif,"timeStartInput" =>$timeStartInput,"timeEndInput" => $timeEndInput,"plagehoraire" => $plagehoraire,"device" => $device,"heure" =>$affichageHeure,"demandeSpecifique"=>$demandeSpecifique,"amount_extra"=>$amount_extra]);}}#[Route('/notifications/count', name: 'admin_notifications_count')]public function countUnread(NotificationOrderRepository $repo): JsonResponse{$count = $repo->count(['isRead' => false]);return $this->json(['count' => $count]);}#[Route('/ajax-service-price', name: 'ajaxServicePrice', methods: ['POST',"GET"])]public function ajaxServicePrice(Request $request, ManagerRegistry $doctrine,ProductRepository $productRepository,AttributValueRepository $attributValueRepository){$price= 0 ;$serviceId= (int) $request->query->get("serviceId");//$attribut = $attributValueRepository->findBy(array('product' => $serviceId));$attribut = $request->query->get("formule");$products = $productRepository->findBy(array('id' => $serviceId));$attributPrice = array(); // Tableau pour stocker les attributs et les prixforeach($products[0]->getAttributValues() as $prod){/* $attributPrice[] = array('attribut' => $prod->getAttribut()->getName(),'price' => $prod->getPrice()); // Ajoutez chaque attribut et prix au tableau*/if ($prod->getAttribut()->getName() === $attribut) {$price = $prod->getPrice();}}if (isset($price)) {$price ;} else {$price ;//dd("prix non trouvé");}return new Response($price);}#[Route('/ajax-formule-reservation', name: 'ajaxFormuleResersation', methods: ['POST',"GET"])]public function ajaxFormuleResersation(Request $request, ManagerRegistry $doctrine,ProductRepository $productRepository,AttributValueRepository $attributValueRepository){$office = (int) $request->query->get("office");$products = $productRepository->findBy(array('id' => $office));$attributValues = $attributValueRepository->findBy(array('product' => $products));$services = $productRepository->findBy(array('productType' => "service", 'parentCategory'=> $products[0]->getParentCategory()->getId()));$servicesCommuns = $productRepository->findBy(array('productType' => "service", 'parentCategory'=> null));return $this->render("@Flexy/FrontBundle/Themes/CoWorking/templates/reservation/_completReservation.html.twig",["attributValues"=>$attributValues,"services"=>$services,"servicesCommuns"=>$servicesCommuns,"product"=> $products[0]->getId()]);}#[Route('/ajax-preview-mission', name: 'ajaxPreviewMission', methods: ['POST',"GET"])]public function ajaxPreviewMission(Request $request, ManagerRegistry $doctrine){$formMissions = $request->request->all()["missions"];$distance = 0;$fees = 0;$result = ["fees"=>0];$order = new Order();//Step 1 = Find ShippingMethod$customerGroup = $doctrine->getRepository(CustomerGroup::class)->findOneBy(["code"=>"main"]);$vehicleType = $doctrine->getRepository(ShippingVehicleType::class)->find((int)$request->request->get("vehicleType"));if(!$customerGroup){return $this->json($result);}foreach($formMissions as $key => $singleFromMission){if($key == 1 and !$request->request->get("scheduleReturn")){break;}//Step 2 = Find cityregions$collectCityRegion = $doctrine->getRepository(CityRegion::class)->find((int)$singleFromMission["collectCityRegion"]);$shippingCityRegion = $doctrine->getRepository(CityRegion::class)->find((int)$singleFromMission["shippingCityRegion"]);if(!$collectCityRegion or !$shippingCityRegion){return $this->json($result);}//Step 3 = Calculate distance by API$curl = curl_init();curl_setopt_array($curl, [CURLOPT_URL => "https://api.traveltimeapp.com/v4/routes?type=driving&origin_lat=".$collectCityRegion->getLat()."&origin_lng=".$collectCityRegion->getLng()."&destination_lat=".$shippingCityRegion->getLat()."&destination_lng=".$shippingCityRegion->getLng()."&arrival_time=2022-12-02T13:00:00Z&app_id=199062fd&api_key=f81385ce24441a6aebbd791643600522",CURLOPT_RETURNTRANSFER => true,CURLOPT_ENCODING => '',CURLOPT_MAXREDIRS => 10,CURLOPT_TIMEOUT => 30,CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,CURLOPT_CUSTOMREQUEST => 'GET',//CURLOPT_POSTFIELDS => $jsonString,CURLOPT_HTTPHEADER => ['Content-Type: application/json',],]);$response = curl_exec($curl);$err = curl_error($curl);curl_close($curl);if ($err) {return $this->json($result);} else {$results = json_decode($response, null, 512, JSON_THROW_ON_ERROR);$singleDistance = 0;foreach($results->results[0]->locations[0]->properties[0]->route->parts as $singlePart){$singleDistance = $singleDistance + $singlePart->distance ;$singleDistance = $singleDistance;$distance = ($distance + $singleDistance) ;}}$singleDistance = $singleDistance/1000;$shippingRules = $doctrine->getRepository(ShippingRule::class)->findByCustomerGroupAndVehicleType($customerGroup,$vehicleType,$singleDistance );$singleFees = 0;if((is_countable($shippingRules) ? count($shippingRules) : 0) > 0){$singleFees = $shippingRules[0]->getValueCalculation() * $singleDistance;if($singleFees < $shippingRules[0]->getShippingMethod()->getPrice()){$singleFees = $shippingRules[0]->getShippingMethod()->getPrice();}$fees = $fees + $singleFees;}$customer = $doctrine->getManager()->getRepository(Customer::class)->findOneBy(["user"=>$this->getUser()]);dd($customer);if( $customer ){$order->setCustomer($customer);$order->setCity($customer->getCity());}$mission = new Mission();$mission->setNbrAdults((int)$singleFromMission["nbrAdults"]);$mission->setNbrChildrens((int)$singleFromMission["nbrChildrens"]);$mission->setNbrBags((int)$singleFromMission["nbrChildrens"]);$datePickup = new \DateTime($this->dateToMySQL($singleFromMission["datePickup"]));$timePickup = new \DateTime($this->dateToMySQL($singleFromMission["datePickup"])." ". $singleFromMission["timePickup"]);$mission->setDatePickup($datePickup);$mission->setTimePickup($timePickup);if($key == 0){$startProcessingAt = new \DateTime($datePickup->format("Y-m-d")." ".$timePickup->format("H:i"));$order->setStartProcessingAt($startProcessingAt);}$orderItem = new OrderItem();$orderItem->setDescription("Traget :".$collectCityRegion." <=> ".$shippingCityRegion)." (".$shippingRules[0]->getShippingMethod()->getShippingVehicleType().") ";$orderItem->setPrice($singleFees);$orderItem->setQuantity(1);$shipmentItem = $orderItem->getShipmentItem();$shipmentItem->setQuantity((int)$singleFromMission["nbrAdults"]+(int)$singleFromMission["nbrChildrens"]);$shipmentItem->setOrderItem($orderItem);$shipmentItem->setCollectCityRegion($collectCityRegion);$shipmentItem->setShippingCityRegion($shippingCityRegion);if($customer){if($customer->getCityRegion()){switch ($key) {case 0:$shipmentItem->setCollectAddress($customer->getAddress());break;case 1:$shipmentItem->setShippingAddress($customer->getAddress());break;}}}$order->addOrderItem($orderItem);$order->setShippingMethod($shippingRules[0]->getShippingMethod());$mission->setShipmentItem($shipmentItem);$mission->setRelatedOrder($order);$doctrine->getManager()->persist($mission);}$fees = number_format($fees, 2);//Step 4 = Look for prices$result = ["fees"=>$fees];//Step 5 Final = Persist the booking in DB//if((boolean)$request->request->get("isBookingValid") == true){//dd($order);$doctrine->getManager()->persist($order);$doctrine->getManager()->flush();return $this->redirectToRoute("completeBookingForm",["id"=>$order->getId()]);}return $this->json($result);}#[Route('/new-office/{id}', name: 'newReservation', methods: ['POST',"GET"])]public function newMission(Request $request, ManagerRegistry $doctrine){return $this->render('@Flexy/FrontBundle/Themes/'.ucfirst($this->container->get('twig')->getGlobals()["settings"]->get()->getAssetFolderName()).'/templates/missions/_completReservationEtap1.html.twig');// $mission = new Mission();//$form = $this->createForm(MissionType::class, $mission);//$missions = $doctrine->getManager()->getRepository(Mission::class)->findBy(["relatedOrder"=>$order]);//$form->handleRequest($request);/* if ($form->isSubmitted() && $form->isValid()) {$order = new Order();$orderItem = new OrderItem();$orderItem->setDescription($mission->getDescription());$orderItem->setQuantity(1);$orderItem->setPrice(0);$order->addOrderItem($orderItem);$mission->setRelatedOrder($order);$doctrine->getManager()->persist($orderItem);$doctrine->getManager()->persist($mission);$doctrine->getManager()->persist($order);$doctrine->getManager()->flush();return $this->redirectToRoute("completeBookingFormStep2",["id"=>$order->getId()]);}$shippingVehicleTypes = $doctrine->getManager()->getRepository(ShippingVehicleType::class)->findAll();$cityRegions = $doctrine->getManager()->getRepository(CityRegion::class)->findBy(["isDefault"=>true],['name'=>"ASC"]);$customer = $doctrine->getManager()->getRepository(Customer::class)->findOneBy(["user"=>$this->getUser()]);return $this->render('@Flexy/FrontBundle/Themes/'.ucfirst($this->container->get('twig')->getGlobals()["settings"]->get()->getAssetFolderName()).'/templates/missions/formBooking.html.twig',["shippingVehicleTypes"=>$shippingVehicleTypes,"cityRegions"=>$cityRegions,"customer"=>$customer,"form"=>$form->createView()]);*/}#[Route('/completeBookingForm/{id}', name: 'completeBookingForm', methods: ['POST',"GET"])]public function completeBookingForm(Order $order,Request $request, ManagerRegistry $doctrine){$editForm = $this->createForm(OrderType::class, $order);$missions = $doctrine->getManager()->getRepository(Mission::class)->findBy(["relatedOrder"=>$order]);$editForm->handleRequest($request);if ($editForm->isSubmitted() && $editForm->isValid()) {if($this->isGranted("ROLE_CUSTOMER")){$customer = $doctrine->getManager()->getRepository(Customer::class)->findOneBy(["user"=>$this->getUser()]);if(!$order->getFirstName()){$order->setFirstName($customer->getFirstName());}if(!$order->getLastName()){$order->setLastName($customer->getLastName());}if(!$order->getEmail()){$order->setEmail($customer->getEmail());}if(!$order->getTel()){$order->setTel($customer->getPhone());}if(!$order->getAddress()){$order->setAddress($customer->getAddress());}if(!$order->getCompanyName()){$order->setCompanyName($customer->getCompanyName());}if(!$order->getPostcode()){$order->setPostcode($customer->getPostcode());}if(!$order->getCity()){$order->setCity($customer->getCity());}}$doctrine->getManager()->persist($order);$doctrine->getManager()->flush();return $this->redirectToRoute('completeBookingFormStep3',["id"=>$order->getId()]);}return $this->render('@Flexy/FrontBundle/Themes/'.$this->container->get('twig')->getGlobals()["settings"]->get()->getAssetFolderName().'/templates/missions/_completBookingForm.html.twig', ['editForm' => $editForm->createView(),"order"=>$order,"missions"=>$missions]);}#[Route('/completeBookingFormStep3/{id}', name: 'completeBookingFormStep3', methods: ['POST',"GET"])]public function completeBookingFormStep3(Order $order,Request $request, ManagerRegistry $doctrine){$editForm = $this->createForm(OrderStepInfosType::class, $order);$missions = $doctrine->getManager()->getRepository(Mission::class)->findBy(["relatedOrder"=>$order]);$editForm->handleRequest($request);if ($editForm->isSubmitted() && $editForm->isValid()) {$doctrine->getManager()->persist($order);$doctrine->getManager()->flush();return $this->redirectToRoute('completeBookingFormStep4',["id"=>$order->getId()]);}return $this->render('@Flexy/FrontBundle/Themes/'.$this->container->get('twig')->getGlobals()["settings"]->get()->getAssetFolderName().'/templates/missions/_completBookingFormStep3.html.twig', ['editForm' => $editForm->createView(),"order"=>$order,"missions"=>$missions]);}#[Route('/completeBookingFormStep4/{id}', name: 'completeBookingFormStep4', methods: ['POST',"GET"])]public function completeBookingFormStep4(Order $order,Request $request, ManagerRegistry $doctrine){$missions = $doctrine->getManager()->getRepository(Mission::class)->findBy(["relatedOrder"=>$order]);$stripe = new \Stripe\StripeClient('sk_live_sfq6AEgIbGXeiXpYRHFAm8Dm');$currentDate = new \DateTime();$amountToPay=$order->getTotalAmount()-(int)$order->getWalletPaymentAmount();if(!$order->getTokenStripe()){$paymentIntent = $stripe->paymentIntents->create(['amount' => $amountToPay * 100 ,'currency' => 'eur',//"source" => $request->request->get('stripeToken'),"description" => "Réservation le ".$currentDate->format("d/m/Y H:i"),'payment_method_types' => [//'bancontact','card',//'eps',//'giropay',//'ideal',//'p24',//'sepa_debit',//'sofort',],]);//dd($paymentIntent->id);$order->setTokenStripe($paymentIntent->id);$em =$doctrine->getManager();$em->persist($order);$em->flush();}else{$paymentIntent = $stripe->paymentIntents->retrieve($order->getTokenStripe(),[]);if($paymentIntent->status == "succeeded"){return $this->redirectToRoute("bookingSuccess");}else{$paymentIntent = $stripe->paymentIntents->update($order->getTokenStripe(),['amount' => $amountToPay * 100 ,'currency' => 'eur',]);}}$client_secret = $paymentIntent->client_secret;return $this->render('@Flexy/FrontBundle/Themes/'.$this->container->get('twig')->getGlobals()["settings"]->get()->getAssetFolderName().'/templates/missions/_completBookingFormStep4.html.twig', ["order"=>$order,"missions"=>$missions,"CLIENT_SECRET"=>$client_secret,]);}#[Route('/booking-success', name: 'bookingSuccess', methods: ['POST',"GET"])]public function bookingSuccess(Request $request, OrderRepository $orderRepository,ManagerRegistry $doctrine){$tokenTripe = $request->query->all()["payment_intent"];$order = $orderRepository->findOneBy(["tokenStripe"=>$tokenTripe]);if($order and $request->query->all()["redirect_status"] == "succeeded"){$paymentMethod = $doctrine->getManager()->getRepository(PaymentMethod::class)->findOneBy(["code"=>"stripe"]);$order->setStatus("waiting");$order->setPayedAmount($order->getTotalAmount());$order->setPaymentMethod($paymentMethod);if($order->getWalletPaymentAmount()>0){$customerWalletPoints = new CustomerWalletPoint();$customerWalletPoints->setPoints(-$order->getWalletPaymentAmount());$customerWalletPoints->setCustomer($order->getCustomer());$customerWalletPoints->setOriginOrder($order);$customerWalletPoints->setNote("Paiement par wallet en combinaison avec stripe");$doctrine->getManager()->persist($customerWalletPoints);}else{$customerWalletPoints = new CustomerWalletPoint();$valuePoints = 3;$currency = $this->container->get("twig")->getGlobals()["settings"]->get()->getCurrency();$customerWalletPoints->setPoints(3);$customerWalletPoints->setCustomer($order->getCustomer());$customerWalletPoints->setOriginOrder($order);$customerWalletPoints->setNote("Vous avez gagné ".$valuePoints." ".$currency." suite à votre réservation (Ref facture : ".$order->getOrderNumber().")");$doctrine->getManager()->persist($customerWalletPoints);}$doctrine->getManager()->persist($order);$doctrine->getManager()->flush();return $this->render("@Flexy/FrontBundle/Themes/".$this->container->get('twig')->getGlobals()["settings"]->get()->getAssetFolderName()."/checkout/success.html.twig",["order"=>$order]);}return $this->redirectToRoute("front_home");}#[Route('/preview-mail/{id}', name: 'previewMail', methods: ['POST',"GET"])]public function previewMail(Order $order,Request $request, OrderRepository $orderRepository,ManagerRegistry $doctrine){return $this->render("@Flexy/ShopBundle/templates/mails/order/success.html.twig",["order"=>$order]);}#[Route('/request-mission', name: 'requestMission', methods: ['POST',"GET"])]public function requestMission(Request $request, OrderRepository $orderRepository,ManagerRegistry $doctrine){$requestMission = new RequestMission();$form = $this->createForm(RequestMissionType::class,$requestMission);$form->handleRequest($request);if($form->isSubmitted() and $form->isValid()){$doctrine->getManager()->persist($requestMission);$doctrine->getManager()->flush();return $this->redirectToRoute("front_home");}return $this->render("@Flexy/FrontBundle/Themes/".$this->container->get('twig')->getGlobals()["settings"]->get()->getAssetFolderName()."/missions/request.html.twig",["form"=>$form->createView()]);}// AJAX#[Route('/ajax-get-time', name: 'ajaxGetTime', methods: ['POST',"GET"])]public function ajaxGetTime(Request $request){$currentDateTime = new \DateTime();$tomorrowDateTime = new \DateTime("tomorrow");$startDateTime = new \DateTime("tomorrow +1 hours");if($startDateTime->format("i") != "00"){$startDateTime->modify("+1 hours ".$startDateTime->format("H:00"));}if($request->query->get("selectedDate")){$correctFormatDate = $this->dateToMySQL($request->query->get("selectedDate"));//dd($request->query->get("selectedDate"));$startDateTime->modify($correctFormatDate);}if((int)$startDateTime->format("ymd") > (int)$tomorrowDateTime->format("ymd")){$startDateTime->modify("00:00");}else{$startDateTime->modify($currentDateTime->format("H").":00");$startDateTime->modify("+1 hours");//dd($startDateTime);}//dd($startDateTime);$optionsHTML = "";//$startDateTime->modify(" +5 minutes");while($startDateTime->format("H:i") != "23:56" ){$optionsHTML = $optionsHTML. '<option value="'.$startDateTime->format("H:i").'" >'.$startDateTime->format("H:i").'</option>';if($startDateTime->format("H:i")=="23:55"){$startDateTime->modify(" +1 minutes");}else{$startDateTime->modify(" +5 minutes");}}return $this->render('@Flexy/FrontBundle/Themes/'.$this->container->get('twig')->getGlobals()["settings"]->get()->getAssetFolderName().'/templates/ajax/ajaxGetTime.html.twig',["optionsHTML"=>$optionsHTML]);}private function dateToMySQL($date){$tabDate = explode('/' , (string) $date);$date = $tabDate[2].'-'.$tabDate[1].'-'.$tabDate[0];$date = date( 'Y-m-d', strtotime($date) );return $date;}}