src/Controller/API/APIController.php line 57

Open in your IDE?
  1. <?php
  2. namespace App\Controller\API;
  3. use App\Entity\DetailsRestoSite;
  4. use App\Repository\RepoDetailsRestoSite;
  5. use App\Repository\RestaurantRepository;
  6. use Symfony\Component\HttpFoundation\Response;
  7. use Symfony\Component\HttpFoundation\Request;
  8. use Symfony\Component\Routing\Annotation\Route;
  9. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  10. use App\Service\AgentService;
  11. use Symfony\Component\HttpFoundation\JsonResponse;
  12. use Symfony\Component\HttpFoundation\RequestStack;
  13. use Symfony\Component\Serializer\SerializerInterface;
  14. class APIController extends AbstractController{
  15.    
  16.     private $agentService;
  17.     private $serializer;
  18.     private $requestStack;
  19.     public function __construct(AgentService $agentService,RequestStack $requestStack ,SerializerInterface $serializer){
  20.        $this->agentService=$agentService;
  21.        $this->serializer=$serializer;
  22.        $this->requestStack=$requestStack;
  23.     }
  24.      /**
  25.      * @Route ("/linkMultiFileC/crtt", name="link.Multi.file.create.cdns", methods={"POST"})
  26.      * 
  27.      */
  28.     public function linkMultiFileByCreatingCodens(Request $request){
  29.       $this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
  30.       $dataRequest=json_decode($request->getContent(), true);
  31.       $r=$this->agentService->createMltiCodens($dataRequest);
  32.       $response=new Response($r,Response::HTTP_OK);
  33.       $response->headers->set('content-Type''application/json');
  34.       return $response;
  35.     }
  36.     /**
  37.     * @Route("/dlinkAllId", name="unlink_all_fiche_selected", methods={"POST"})
  38.     */
  39.     public function dlinkAllIdLinked(Request $request){
  40.       $this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
  41.       $dataRequest=json_decode($request->getContent(),true);
  42.       $r=$this->agentService->dlinkAllIdLinked($dataRequest);
  43.       $response=new Response($r,Response::HTTP_OK);
  44.       $response->headers->set('content-Type''application/json');
  45.       return $response;
  46.    }
  47.     /**
  48.      * @Route("/resto/{id}", name="resto_show", methods={"GET"})
  49.      **/
  50.     public function showRestoByID($id){
  51.         $this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
  52.         $data=$this->agentService->showResultByID($id);
  53.         $response=new Response($data);
  54.         $response->headers->set('content-Type''application/json');
  55.         return $response;
  56.     }
  57.     /**
  58.      * @Route("/resto/codens/{codens}", name="resto_show_by_codens", methods={"GET"})
  59.      **/
  60.     public function showRestoByCodens($codens){
  61.       $this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
  62.       $data=$this->agentService->showRestoByCodens($codens);
  63.       $response=new Response($data);
  64.       $response->headers->set('content-Type''application/json');
  65.       return $response;
  66.   }
  67.     /**
  68.      * @Route("/restoList/getListEtend", name="list_show", methods={"GET"})
  69.      * 
  70.      */
  71.     public function getListEtend(Request $request){
  72.         $this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
  73.         $dataRequest$request->query->get('CP');
  74.         $data=$this->agentService->showResultByCP($dataRequest);
  75.         $response=new Response($data);
  76.         $response->headers->set('content-Type''application/json');
  77.         return $response;
  78.     }
  79.     /**
  80.      * @Route ("/linkFile/uptdt", name="link.file", methods={"POST"})
  81.      * 
  82.      */
  83.     public function linkFile(Request $request){
  84.         $this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
  85.         $dataRequest=$request->request->all();
  86.         $r=$this->agentService->alterCodensValue($dataRequest['cdns'], $dataRequest['id']);
  87.         $response=new Response($r,Response::HTTP_OK);
  88.         $response->headers->set('content-Type''application/json');
  89.         return $response;
  90.     }
  91.      /**
  92.      * @Route ("/linkFileC/up/both", name="link.both.file", methods={"POST"})
  93.      * 
  94.      */
  95.     public function alterCodensValueForToFileWhoHaveBothCdns(Request $request){
  96.       $this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
  97.       $dataRequest=$request->request->all();
  98.       $r=$this->agentService->alterCodensValueForToFileWhoHaveBothCdns($dataRequest['cdnSource'], $dataRequest['cdnTarget']);
  99.       $response=new Response($r,Response::HTTP_OK);
  100.       $response->headers->set('content-Type''application/json');
  101.       return $response;
  102.     }
  103.     /**
  104.      * @Route ("/linkFileC/crtt", name="link.file.create.cdns", methods={"POST"})
  105.      * 
  106.      */
  107.     public function linkFileByCreatingCodens(Request $request){
  108.         $this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
  109.         $dataRequest=[];
  110.         // if ($request->isMethod('post')) {
  111.           $dataRequest=$request->request->all();
  112.       //  }else if($request->isMethod('get')){
  113.       //     $dataRequest=$request->query->all();
  114.       //  }
  115.         
  116.        // dd($dataRequest);
  117.         $r=$this->agentService->createCodens($dataRequest['dep'],$dataRequest['idOne'], $dataRequest['idTwo']);
  118.        //$r=$this->agentService->createCodens("44",1,248); 
  119.        $response=new Response($r,Response::HTTP_OK);
  120.         $response->headers->set('content-Type''application/json');
  121.         return $response;
  122.     }
  123.      /**
  124.       * @Route ("/restoPush/setChgtAddr", name="chagement_adresse", methods={"POST"})
  125.       */
  126.       public function setChagementAddress(Request $request){
  127.         $this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
  128.         $id=$request->request->get("id");
  129.         $cdns=base64_decode($request->request->get("cdns"));
  130.         $r=$this->agentService->setChagementAdresse($id,$cdns);
  131.         $response=new Response($r,Response::HTTP_OK);
  132.         $response->headers->set('content-Type''application/json');
  133.         return $response;
  134.       }
  135.     /**
  136.      * @Route ("/restoPush/pushComm" ,name="push_comm", methods={"POST"})
  137.      */
  138.     public function pushCommValid(Request $request ){
  139.         $this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
  140.         $dataRequest=$request->request->all();
  141.         $d=$this->agentService->pushCommentaire($dataRequest['cdns'],$dataRequest['id'],base64_decode($dataRequest['ctnt']));
  142.         $response=new Response($d,Response::HTTP_OK);
  143.         $response->headers->set('content-Type''application/json');
  144.         return $response;
  145.     }
  146.     /**
  147.      * @Route ("/delete/deleteComment", name="delete_comment", methods={"POST"})
  148.      */
  149.     public function deleteComment(Request $request){
  150.        $this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
  151.        $dataRequest=$request->request->all();
  152.        $d=$this->agentService->deleteCommentaire($dataRequest['id'],$dataRequest['cdns']);
  153.        $response=new Response($d,Response::HTTP_OK);
  154.        $response->headers->set('content-Type''application/json');
  155.        return $response;
  156.     }
  157.     /**
  158.      * @Route ("/deleteLinkage/dlink", name="dlink_fiche", methods={"POST"})
  159.      */
  160.     public function dlink(Request $request){
  161.         $this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
  162.         $dataRequest=$request->request->all();
  163.         $response=$this->agentService->dlinkV2($dataRequest['idOne'],$dataRequest['idTwo']);
  164.         $response=new Response($response,Response::HTTP_OK);
  165.         $response->headers->set('content-Type''application/json');
  166.         return $response;
  167.     }
  168.     /**
  169.      * @Route ("/deleteLinkage/dlinks", name="dlinks_fiche", methods={"POST"})
  170.      */
  171.     public function dlinks(Request $request){
  172.       $this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
  173.       $dataRequest=$request->request->all();
  174.       $response=$this->agentService->dlink($dataRequest['id']);
  175.       $response=new Response($response,Response::HTTP_OK);
  176.       $response->headers->set('content-Type''application/json');
  177.       return $response;
  178.     }
  179.     /**
  180.      * @Route ("/push/pushEvenement", name="push_evenement", methods={"POST"})
  181.      */
  182.     public function setEvenement(Request $request){
  183.         $this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
  184.         $dataRequest=$request->request->all();
  185.         $response=new Response($this->agentService->setEvenement($dataRequest['eve'],
  186.                   $dataRequest['cdS'],$dataRequest['cdns'],
  187.                   base64_decode($dataRequest['cmnt']),$dataRequest['id']),Response::HTTP_OK);
  188.         $response->headers->set('content-Type''application/json'); 
  189.         return $response;
  190.     }
  191.     /**
  192.      * @Route ("/push/closeEtab", name="close_etab", methods={"POST"})
  193.      */
  194.     public function closeEtab(Request $request){
  195.       $this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
  196.       $dataRequest=$request->request->all();
  197.       $response=new Response($this->agentService->closeEtab($dataRequest['id'],$dataRequest['cdns'],$dataRequest['cmnt']),Response::HTTP_OK);
  198.       $response->headers->set('content-Type''application/json'); 
  199.       return $response;
  200.   }
  201.     /**
  202.      * @Route ("/delete/deleteEVE", name="delete_evenement", methods={"POST"})
  203.      * 
  204.      */
  205.     public function deleteEvenement(Request $request){
  206.         $this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
  207.         $dataRequest=$request->request->all();
  208.         $response=new Response($this->agentService->deleteEvenement($dataRequest['cdns'], $dataRequest['id']));
  209.         $response->headers->set('content-Type''application/json'); 
  210.         return $response;
  211.     }
  212.     /**
  213.      * @Route( "/get/rappel", name="get_rappel", methods={"POST"})
  214.      */
  215.     public function getRappel(Request $request){
  216.         $this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
  217.         $dep=$request->request->get("dep");
  218.         $response=new Response($this->agentService->getRappel($dep));
  219.         $response->headers->set('content-Type''application/json'); 
  220.         return $response;
  221.     }
  222.     /**
  223.      * @Route("/set/rappel", name="set_rappel", methods={"POST"})
  224.      * 
  225.      */
  226.     public function setRappel(Request $request){
  227.         $this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
  228.         $dataRequest=$request->request->all();
  229.         $response=new Response($this->agentService->setRappel($dataRequest["cdns"],$dataRequest["id"]),Response::HTTP_OK);
  230.         $response->headers->set('content-Type''application/json'); 
  231.         return $response;
  232.     }
  233.     /**
  234.      * @Route("/user/duplicateFiche",name="dupicate_fiche", methods={"GET","POST"})
  235.      */
  236.     public function dupplicateFiche(Request $request){
  237.        $this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
  238.        $dataRequest=$request->request->all();
  239.        $response=new Response($this->agentService->duplicateFiche(base64_decode($dataRequest["cdns"]),$dataRequest["id"],$dataRequest["dep"]));
  240.        $response->headers->set('content-Type''application/json'); 
  241.        return $response;
  242.     }
  243.     /**
  244.      * @Route("/set/setFicheValided",name="set_true_fiche_validated", methods={"GET","POST"})
  245.      */
  246.     public function setFicheValidated(Request $request){
  247.         $this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
  248.         $dataRequest=$request->query->all();
  249.         if(count($dataRequest)==0){
  250.             $dataRequest=$request->request->all();
  251.         }
  252.         $a=$this->agentService->setFicheValidated($dataRequest['cdns'],$dataRequest['id']);
  253.         $response=new Response($a);
  254.         $response->headers->set('content-Type''application/json'); 
  255.         return $response;
  256.     }
  257.     /**
  258.      * @Route("/set/reverseRappel", name="reverse_rappel", methods={"POST"})
  259.      */
  260.     public function reverseRappel(Request $request){
  261.         $this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
  262.         $dataRequest=$request->request->all();
  263.         $a=$this->agentService->reverseRappel($dataRequest['cdns'],$dataRequest['id']);
  264.         $response=new Response($a);
  265.         $response->headers->set('content-Type''application/json'); 
  266.         return $response
  267.     }
  268.     /**
  269.      * @Route("/setDepChoice/{dep}", name="set_dep_choice", methods={"GET"})
  270.      */
  271.     public function setDepChoice($dep){
  272.         $this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
  273.         $session $this->requestStack->getSession();
  274.         $session->set('dep'$dep);
  275.         $a=new Response($this->serializer->serialize(["response"=>"ok"],'json'));
  276.         $a->headers->set('content-Type''application/json'); 
  277.         return $a
  278.      }
  279.     /**
  280.      * @Route("/setViewChoice/{view}", name="set_view_choice", methods={"GET"})
  281.      */
  282.     public function setViewChoice($view){
  283.       $this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
  284.       $session $this->requestStack->getSession();
  285.       $session->set('view'$view);
  286.         $a=new Response($this->serializer->serialize(["response"=>"ok"],'json'));
  287.         $a->headers->set('content-Type''application/json'); 
  288.         return $a
  289.      }
  290.      /**
  291.     * @Route("/setCodinseeChoice/{codinsee}", name="set_codinsee_choice") 
  292.     */
  293.     public function setCodinseeChoice($codinsee){
  294.       $this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
  295.       $session $this->requestStack->getSession();
  296.       $session->set('codinsee'$codinsee);
  297.       $a=new Response($this->serializer->serialize(["response"=>"ok"],'json'));
  298.       $a->headers->set('content-Type''application/json'); 
  299.       return $a;  
  300.     }
  301.     /**
  302.      * @Route("/getAccountDepToValidateByCodinsee/{codinsee}/{dep}",name="get_acoount_dep_validate_codinsee")
  303.      */
  304.       public function getNombreFicheTOvalidateByCodinsee($codinsee,$dep){
  305.         $this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
  306.         $nbr=$this->agentService-> getNombreFicheTOvalidateByCodinsee($dep,$codinsee);
  307.         $a=new Response($this->serializer->serialize(["nbr"=>$nbr],'json'));
  308.         $a->headers->set('content-Type''application/json'); 
  309.         return $a;  
  310.       }
  311.      /**
  312.       * @Route("/getDepByUserId", name="get_dep_by_user_id" , methods={"GET"})
  313.       */
  314.      public function getDepByUserId(Request $request){
  315.           $this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
  316.           $id=$request->query->get("id");
  317.           $a=$this->agentService->getDepByUserId($id);
  318.           $response=new Response($a);
  319.           $response->headers->set('content-Type''application/json'); 
  320.           return $response
  321.      }
  322.      /**
  323.      * @Route("/getAccountDepToDo", name="get_acount_dep_to_do", methods={"GET"})
  324.      */
  325.       public function getAccountToDo(Request $request){
  326.         $this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
  327.         $dep=$request->query->get('dep');
  328.         $response=new Response($this->agentService->getAccountToDo($dep));
  329.         $response->headers->set('content-Type''application/json'); 
  330.         return $response
  331.       }
  332.       /**
  333.        * @Route("/getAccountDepDone", name="get_account_dep_done", methods={"GET"})
  334.        */
  335.       public function getAccountDepDone(Request $request){
  336.         $this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
  337.         $dep=$request->query->get('dep');
  338.         $response=new Response($this->agentService->getAccountDepDone($dep));
  339.         $response->headers->set('content-Type''application/json'); 
  340.         return $response
  341.       }
  342.       /**
  343.        * @Route("/getAccountRappel", name="get_account_rappel", methods={"GET"})
  344.        */
  345.       public function getAccountRappel(Request $request){
  346.         $this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
  347.         $dep=$request->query->get('dep');
  348.         $response=new Response($this->agentService->getAccountRappel($dep));
  349.         $response->headers->set('content-Type''application/json'); 
  350.         return $response
  351.       }
  352.       /**
  353.        * @Route("/checkedFastFood", name="fastFood_checked", methods={"POST"})
  354.        */
  355.       public function setCheckBoxFastFood(Request $request){
  356.         $this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
  357.         $dataRequest=$request->request->all();
  358.         $response=new Response($this->agentService->setCheckBoxFastFood($dataRequest['id'],$dataRequest['b']));
  359.         $response->headers->set('content-Type''application/json'); 
  360.         return $response
  361.       }
  362.       /**
  363.        * @Route("/checkedRestaurant", name="restaurant_checked", methods={"POST"})
  364.        */
  365.       public function setCheckBoxRestaurant(Request $request){
  366.         $this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
  367.         $dataRequest=$request->request->all();
  368.         $response=new Response($this->agentService->setCheckBoxRestaurant($dataRequest['id'],$dataRequest['b']));
  369.         $response->headers->set('content-Type''application/json'); 
  370.         return $response
  371.       }
  372.       /**
  373.        * @Route("/checkedCreperie", name="creperie_checked", methods={"POST"})
  374.        */
  375.       public function setCheckBoxCreperie(Request $request){
  376.         $this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
  377.         $dataRequest=$request->request->all();
  378.         $response=new Response($this->agentService->setCheckBoxCreperie($dataRequest['id'],$dataRequest['b']));
  379.         $response->headers->set('content-Type''application/json'); 
  380.         return $response
  381.       }
  382.       /**
  383.        * @Route("/checkedBrasserie", name="brasserie_checked", methods={"POST"})
  384.        */
  385.       public function setCheckBoxBrasserie(Request $request){
  386.         $this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
  387.         $dataRequest=$request->request->all();
  388.         $response=new Response($this->agentService->setCheckBoxBrasserie($dataRequest['id'],$dataRequest['b']));
  389.         $response->headers->set('content-Type''application/json'); 
  390.         return $response
  391.       }
  392.       /**
  393.        * @Route("/checkedPizzeria", name="pizzeria_checked", methods={"POST"})
  394.        */
  395.       public function setCheckBoxPizzeria(Request $request){
  396.         $this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
  397.         $dataRequest=$request->request->all();
  398.         $response=new Response($this->agentService->setCheckBoxPizzeria($dataRequest['id'],$dataRequest['b']));
  399.         $response->headers->set('content-Type''application/json'); 
  400.         return $response
  401.       }
  402.       /**
  403.        * @Route("/checkedBoulangerie", name="boulangerie_checked", methods={"POST"})
  404.        */
  405.       public function setCheckBoxBoulangerie(Request $request){
  406.         $this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
  407.         $dataRequest=$request->request->all();
  408.         $response=new Response($this->agentService->setCheckBoxBoulangerie($dataRequest['id'],$dataRequest['b']));
  409.         $response->headers->set('content-Type''application/json'); 
  410.         return $response
  411.       }
  412.       /**
  413.        * @Route("/checkedBar", name="bar_checked", methods={"POST"})
  414.        */
  415.       public function setCheckBoxBar(Request $request){
  416.         $this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
  417.         $dataRequest=$request->request->all();
  418.         $response=new Response($this->agentService->setCheckBoxBar($dataRequest['id'],$dataRequest['b']));
  419.         $response->headers->set('content-Type''application/json'); 
  420.         return $response
  421.       }
  422.       /**
  423.        * @Route("/checkedMonde", name="cuisine_monde_checked", methods={"POST"})
  424.        */
  425.       public function setCheckBoxMonde(Request $request){
  426.         $this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
  427.         $dataRequest=$request->request->all();
  428.         $response=new Response($this->agentService->setCheckBoxMonde($dataRequest['id'],$dataRequest['b']));
  429.         $response->headers->set('content-Type''application/json'); 
  430.         return $response
  431.       }
  432.       /**
  433.        * @Route("/checkedCafe", name="cafe_checked", methods={"POST"})
  434.        */
  435.       public function setCheckBoxCafe(Request $request){
  436.         $this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
  437.         $dataRequest=$request->request->all();
  438.         $response=new Response($this->agentService->setCheckBoxCafe($dataRequest['id'],$dataRequest['b']));
  439.         $response->headers->set('content-Type''application/json'); 
  440.         return $response
  441.       }
  442.       /**
  443.        * @Route("/checkedSalonThe", name="salonThe_checked", methods={"POST"})
  444.        */
  445.       public function setCheckBoxSalonThe(Request $request){
  446.         $this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
  447.         $dataRequest=$request->request->all();
  448.         $response=new Response($this->agentService->setCheckBoxSalonThe($dataRequest['id'],$dataRequest['b']));
  449.         $response->headers->set('content-Type''application/json'); 
  450.         return $response
  451.       }
  452.       /**
  453.        * @Route("/setPasGarder", name="pas_garder", methods={"POST"})
  454.        */
  455.       public function setPasGarder(Request $request){
  456.         $this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
  457.         $dataRequest=$request->request->all();
  458.         $response=new Response($this->agentService->setPasGarder($dataRequest['id'],$dataRequest['cdns']));
  459.         $response->headers->set('content-Type''application/json'); 
  460.         return $response
  461.       }
  462.       /**
  463.        * @Route("/undoPasGarder", name="oui_garder", methods={"POST"})
  464.        */
  465.       public function undoPasGarder(Request $request){
  466.         $this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
  467.         $dataRequest=$request->request->all();
  468.         $response=new Response($this->agentService->undoPasGarder($dataRequest['id'],$dataRequest['cdns']));
  469.         $response->headers->set('content-Type''application/json'); 
  470.         return $response
  471.       }
  472.       /**
  473.        * @Route("/see/AllAboutFiche", name="see_all_about_fiche", methods={"GET"})
  474.        * 
  475.        */
  476.         public function seeAllAboutFiche(Request $request){
  477.           $this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
  478.           $id=$request->query->get("id");
  479.           $response=new Response($this->agentService->seeAllAboutFiche($id));
  480.           $response->headers->set('content-Type''application/json'); 
  481.           return $response
  482.        }
  483.        /**
  484.         *@Route("/see/Historique", name="voir_historique", methods={"POST"}) 
  485.         *
  486.         */
  487.         public function showHistorical(Request $request){
  488.           $this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
  489.           $dep=$request->request->get("dep");
  490.           $response=new Response($this->agentService->showHistorical($dep));
  491.           $response->headers->set('content-Type''application/json'); 
  492.           return $response
  493.         }
  494.         /**
  495.          * @Route("/removeToHistorique", name="annulValidation", methods={"POST"})
  496.          */
  497.         public function removeToListFicheValidad(Request $request){
  498.            $this->denyAccessUnlessGranted('ROLE_USER',null,'access denied'); 
  499.            $dataRequest=$request->request->all();
  500.            $response=new Response($this->agentService->removeToListFicheValided($dataRequest["cdns"],$dataRequest["id"]) );
  501.            $response->headers->set('content-Type''application/json'); 
  502.            return $response;
  503.         }
  504.         /**
  505.          * @Route("/undo/modif", name="undo_modif", methods={"POST"})
  506.          */
  507.         public function undo(Request $request){
  508.           $this->denyAccessUnlessGranted('ROLE_USER',null,'access denied'); 
  509.           $dataRequest=$request->request->get("id");
  510.           $response=new Response($this->agentService->undo($dataRequest) );
  511.           $response->headers->set('content-Type''application/json'); 
  512.           return $response;
  513.         }
  514.         /**
  515.         * @Route("/change/name", name="changer_nom", methods={"POST"})
  516.         * 
  517.         */
  518.         public function changeName(Request $request){
  519.           $this->denyAccessUnlessGranted('ROLE_USER',null,'access denied'); 
  520.           $dataRequest=$request->request->all();
  521.           $response=new Response($this->agentService->changeName($dataRequest["id"],$dataRequest["name"]) );
  522.           $response->headers->set('content-Type''application/json'); 
  523.           return $response;
  524.         }
  525.         /**
  526.          * @Route("/change/adresse", name="changer_adresse", methods={"POST"})
  527.          * 
  528.          */
  529.         public function changeAdresse(Request $request){
  530.           $this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
  531.           $dataRequest=$request->request->all();
  532.           $response=new Response($this->agentService->changeAddress($dataRequest["id"],$dataRequest["numvoie"],$dataRequest["typevoie"],
  533.           $dataRequest["nomvoie"],$dataRequest["codpost"], 
  534.           $dataRequest["villenorm"],$dataRequest["commune"],
  535.           $dataRequest["compvoie"]));
  536.           $response->headers->set('content-Type''application/json'); 
  537.           return $response;
  538.         }
  539.        /**
  540.         *@Route("/set/flaggoodname", name="flag_good_name", methods={"POST"}) 
  541.         *
  542.         */
  543.         public function putGoodNameFlag(Request $request){
  544.           $this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
  545.           $id=$request->request->get("id");
  546.           $response=new Response($this->agentService->setNomOk($id)); 
  547.           $response->headers->set('content-Type''application/json'); 
  548.           return $response;
  549.         }
  550.         /**
  551.         *@Route("/remove/flaggoodname", name="remove_flag_good_name", methods={"POST"}) 
  552.         *
  553.         */
  554.         public function removeGoodNameFlag(Request $request){
  555.           $this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
  556.           $id=$request->request->get("id");
  557.           $response=new Response($this->agentService->unSetNomOk($id)); 
  558.           $response->headers->set('content-Type''application/json'); 
  559.           return $response;
  560.         }
  561.         /**
  562.          * @Route("/set/goodadresseflag", name="good_adresse", methods={"POST"})
  563.          *
  564.          */
  565.         public function putGoodAdresseFlag(Request $request){
  566.           $this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
  567.           $id=$request->request->get("id");
  568.           $response=new Response($this->agentService->setAdresseOk($id)); 
  569.           $response->headers->set('content-Type''application/json'); 
  570.           return $response
  571.         }
  572.         /**
  573.          * @Route("/remove/goodadresseflag", name="remove_good_adresse", methods={"POST"})
  574.          *
  575.          */
  576.         public function removeGoodAdresseFlag(Request $request){
  577.           $this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
  578.           $id=$request->request->get("id");
  579.           $response=new Response($this->agentService->unsetAdresseOk($id)); 
  580.           $response->headers->set('content-Type''application/json'); 
  581.           return $response
  582.         }
  583.         /**
  584.          * @Route("/set/sirenok", name="set_siren_ok", methods={"POST"})
  585.          */
  586.         public function setSirenOK(Request $request ){
  587.           $this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
  588.           $dataRequest=$request->request->all();
  589.           $response=new Response($this->agentService->setSirenOk($dataRequest["id"],$dataRequest["siren"])); 
  590.           $response->headers->set('content-Type''application/json'); 
  591.           return $response
  592.         }
  593.         /**
  594.          * @Route("/change/sirenok", name="change_siren_ok", methods={"POST"})
  595.          */
  596.         public function changeSirenOK(Request $request ){
  597.           $this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
  598.           $id=$request->request->get("id");
  599.           $siren=$request->request->get("siren");
  600.           $response=new Response($this->agentService->unsetSirenOk($id,$siren)); 
  601.           $response->headers->set('content-Type''application/json'); 
  602.           return $response
  603.         }
  604.  
  605. /**
  606.          * @Route("/undo/sirenok", name="undo_siren_ok", methods={"POST"})
  607.          */
  608.         public function undoSirenOK(Request $request ){
  609.           $this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
  610.           $id=$request->request->get("id");
  611.           $response=new Response($this->agentService-> undoSirenOk($id)); 
  612.           $response->headers->set('content-Type''application/json'); 
  613.           return $response
  614.         }
  615.  
  616.          /**
  617.          * @Route("/set/telok", name="set_tel_ok", methods={"POST"})
  618.          */
  619.         public function setTelOK(Request $request ){
  620.           $this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
  621.           $dataRequest=$request->request->all();
  622.           $response=new Response($this->agentService->setTelOk($dataRequest["id"],$dataRequest["tel"])); 
  623.           $response->headers->set('content-Type''application/json'); 
  624.           return $response
  625.         }
  626.         /**
  627.         * @Route("/change/tel", name="unset_tel_ok", methods={"POST"})
  628.         */
  629.         public function changeTelOK(Request $request ){
  630.           $this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
  631.           $data=$request->request->all();
  632.           $response=new Response($this->agentService->changeTelOk($data["id"],$data["tel"])); 
  633.           $response->headers->set('content-Type''application/json'); 
  634.           return $response
  635.         }
  636.          /**
  637.         * @Route("/undo/telok", name="undo_tel_ok", methods={"POST"})
  638.         */
  639.         public function undoTelOK(Request $request ){
  640.           $this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
  641.           $data=$request->request->all();
  642.           $response=new Response($this->agentService->undoTelOk($data["id"])); 
  643.           $response->headers->set('content-Type''application/json'); 
  644.           return $response
  645.         }
  646.          /**
  647.         * @Route("/suppr/tel", name="unset_tel_ok", methods={"POST"})
  648.         */
  649.         public function supprTel(Request $request ){
  650.           $this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
  651.           $data=$request->request->all();
  652.           $response=new Response($this->agentService->supprTel($data["id"],$data["tel"])); 
  653.           $response->headers->set('content-Type''application/json'); 
  654.           return $response
  655.         }
  656.         // #[Route("/set/restaurant/details/web",name:"app_details_resto_web", methods:["POST"])]
  657.         // public function setRestaurantDetailsWeb(Request $request,RepoDetailsRestoSite $repo,SerializerInterface $serialize){
  658.         //     $dataRequest=json_decode($request->getContent(),true);
  659.         //     $denomination=$dataRequest["nom"];
  660.         //     $adresse=$dataRequest["adresse"];
  661.         //     $telephone=$dataRequest["tel"];
  662.         //     $site=$dataRequest["site"];
  663.         //     $codens=$dataRequest["codens"];
  664.         //     $id_restaurant=$dataRequest["id_r"];
  665.         //     $detailRestaurantWeb=new DetailsRestoSite();
  666.         //     $detailRestaurantWeb->setAdresse($adresse)
  667.         //     ->setDenomination($denomination)
  668.         //     ->setTelephone($telephone)
  669.         //     ->setSite($site)
  670.         //     ->setCodens($codens)
  671.         //     ->setIdRestaurant($id_restaurant);
  672.         //     $repo->add($detailRestaurantWeb,true);
  673.         //     $json=$serialize->serialize($dataRequest,'json');
  674.         //     return new JsonResponse($json,Response::HTTP_CREATED,[],true);
  675.         //}
  676.          /**
  677.          *@Route("/get/items/{dep}", name="app_get_all_item", methods={"GET"})
  678.          */
  679.         public function getAllFicheByDep($depRestaurantRepository $repo,SerializerInterface $serialize){
  680.           $restos=$repo->getAllFicheByDep($dep);
  681.           $json=$serialize->serialize($restos,'json');
  682.           return new JsonResponse($json,Response::HTTP_CREATED,[],true);
  683.            
  684.         }
  685.         /**
  686.          *@Route("/arrondissement/{codinsee}", name="get.poi.by.codinsee", methods={"GET"})
  687.          */
  688.         public function getAllFicheByCodinsee($codinseeRestaurantRepository $repo,SerializerInterface $serialize){
  689.           $restos=$repo->getAllFicheByCodinsee($codinsee);
  690.           $json=$serialize->serialize($restos,'json');
  691.           return new JsonResponse($json,Response::HTTP_CREATED,[],true);
  692.            
  693.         }
  694.         /**
  695.          *@Route("/up/pos", name="app_up_pos")
  696.          */
  697.         public function updatePoiPos(Request $requestRestaurantRepository $repo){
  698.             $contents=json_decode($request->getContent(),true);
  699.             try{
  700.                 $repo->updatePoiPosition($contents["poiX"], $contents["poiY"],$contents["id"]);
  701.                 return $this->json(["message"=>"ok"],200);
  702.             }catch(\Exception $e){
  703.                return $this->json(["erreur"=>$e],500);
  704.             }
  705.           
  706.         }
  707.         /**
  708.        * @Route("/carte/up/pos", name="app_up_pos_2")
  709.        */
  710.       public function updatePoiPosAndDuplicateIt(Request $requestRestaurantRepository $repo)
  711.       {
  712.           $contents json_decode($request->getContent(), true);
  713.           $id 0;
  714.           try {
  715.               
  716.               $id $this->agentService->getIdForExecuteProprietiesModificationFromMap($contents);
  717.               $repo->updatePoiPosition($contents["poiX"], $contents["poiY"], $id);
  718.               return $this->json(["message" => "ok"], 200);
  719.           } catch (\Exception $e) {
  720.               return $this->json(["erreur" => $e->getMessage()], 500);
  721.           }
  722.       }
  723.       /**
  724.        * @Route("/carte/up/nom", name="app_up_nom")
  725.        */
  726.       public function updateRestarantName(Request $requestRestaurantRepository $repo){
  727.           $contents json_decode($request->getContent(), true);
  728.           $id 0;
  729.           try {
  730.               $id $this->agentService->getIdForExecuteProprietiesModificationFromMap($contents);
  731.               $repo->updateDenominationF($id$contents["denominationF"]);
  732.               return $this->json(["message" => "ok"], 200);
  733.           } catch (\Exception $e) {
  734.               return $this->json(["erreur" => $e->getMessage()], 500);
  735.           }
  736.       }
  737.        /**
  738.        *  @Route("/carte/up/adresse", name="app_up_adresse")
  739.        */
  740.       public function updateRestarantNumVoie(Request $requestRestaurantRepository $repo){
  741.           $contents=json_decode($request->getContent(), true);
  742.          
  743.           $id 0;
  744.           try {
  745.               $id $this->agentService->getIdForExecuteProprietiesModificationFromMap($contents);
  746.               $repo->updateAdresse($id$contents["numvoie"],
  747.               $contents["typevoie"],
  748.               $contents["nomvoie"],
  749.               $contents["codpost"],
  750.               $contents["commune"],
  751.               $contents["villenorm"],
  752.               $contents["compvoie"]);
  753.               return $this->json(["message" => "ok"], 200);
  754.           } catch (\Exception $e) {
  755.               return $this->json(["erreur" => $e->getMessage()], 500);
  756.           }
  757.       }
  758. }