<?php
namespace App\Controller\API;
use App\Entity\DetailsRestoSite;
use App\Repository\RepoDetailsRestoSite;
use App\Repository\RestaurantRepository;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use App\Service\AgentService;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\Serializer\SerializerInterface;
class APIController extends AbstractController{
private $agentService;
private $serializer;
private $requestStack;
public function __construct(AgentService $agentService,RequestStack $requestStack ,SerializerInterface $serializer){
$this->agentService=$agentService;
$this->serializer=$serializer;
$this->requestStack=$requestStack;
}
/**
* @Route ("/linkMultiFileC/crtt", name="link.Multi.file.create.cdns", methods={"POST"})
*
*/
public function linkMultiFileByCreatingCodens(Request $request){
$this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
$dataRequest=json_decode($request->getContent(), true);
$r=$this->agentService->createMltiCodens($dataRequest);
$response=new Response($r,Response::HTTP_OK);
$response->headers->set('content-Type', 'application/json');
return $response;
}
/**
* @Route("/dlinkAllId", name="unlink_all_fiche_selected", methods={"POST"})
*/
public function dlinkAllIdLinked(Request $request){
$this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
$dataRequest=json_decode($request->getContent(),true);
$r=$this->agentService->dlinkAllIdLinked($dataRequest);
$response=new Response($r,Response::HTTP_OK);
$response->headers->set('content-Type', 'application/json');
return $response;
}
/**
* @Route("/resto/{id}", name="resto_show", methods={"GET"})
**/
public function showRestoByID($id){
$this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
$data=$this->agentService->showResultByID($id);
$response=new Response($data);
$response->headers->set('content-Type', 'application/json');
return $response;
}
/**
* @Route("/resto/codens/{codens}", name="resto_show_by_codens", methods={"GET"})
**/
public function showRestoByCodens($codens){
$this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
$data=$this->agentService->showRestoByCodens($codens);
$response=new Response($data);
$response->headers->set('content-Type', 'application/json');
return $response;
}
/**
* @Route("/restoList/getListEtend", name="list_show", methods={"GET"})
*
*/
public function getListEtend(Request $request){
$this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
$dataRequest= $request->query->get('CP');
$data=$this->agentService->showResultByCP($dataRequest);
$response=new Response($data);
$response->headers->set('content-Type', 'application/json');
return $response;
}
/**
* @Route ("/linkFile/uptdt", name="link.file", methods={"POST"})
*
*/
public function linkFile(Request $request){
$this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
$dataRequest=$request->request->all();
$r=$this->agentService->alterCodensValue($dataRequest['cdns'], $dataRequest['id']);
$response=new Response($r,Response::HTTP_OK);
$response->headers->set('content-Type', 'application/json');
return $response;
}
/**
* @Route ("/linkFileC/up/both", name="link.both.file", methods={"POST"})
*
*/
public function alterCodensValueForToFileWhoHaveBothCdns(Request $request){
$this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
$dataRequest=$request->request->all();
$r=$this->agentService->alterCodensValueForToFileWhoHaveBothCdns($dataRequest['cdnSource'], $dataRequest['cdnTarget']);
$response=new Response($r,Response::HTTP_OK);
$response->headers->set('content-Type', 'application/json');
return $response;
}
/**
* @Route ("/linkFileC/crtt", name="link.file.create.cdns", methods={"POST"})
*
*/
public function linkFileByCreatingCodens(Request $request){
$this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
$dataRequest=[];
// if ($request->isMethod('post')) {
$dataRequest=$request->request->all();
// }else if($request->isMethod('get')){
// $dataRequest=$request->query->all();
// }
// dd($dataRequest);
$r=$this->agentService->createCodens($dataRequest['dep'],$dataRequest['idOne'], $dataRequest['idTwo']);
//$r=$this->agentService->createCodens("44",1,248);
$response=new Response($r,Response::HTTP_OK);
$response->headers->set('content-Type', 'application/json');
return $response;
}
/**
* @Route ("/restoPush/setChgtAddr", name="chagement_adresse", methods={"POST"})
*/
public function setChagementAddress(Request $request){
$this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
$id=$request->request->get("id");
$cdns=base64_decode($request->request->get("cdns"));
$r=$this->agentService->setChagementAdresse($id,$cdns);
$response=new Response($r,Response::HTTP_OK);
$response->headers->set('content-Type', 'application/json');
return $response;
}
/**
* @Route ("/restoPush/pushComm" ,name="push_comm", methods={"POST"})
*/
public function pushCommValid(Request $request ){
$this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
$dataRequest=$request->request->all();
$d=$this->agentService->pushCommentaire($dataRequest['cdns'],$dataRequest['id'],base64_decode($dataRequest['ctnt']));
$response=new Response($d,Response::HTTP_OK);
$response->headers->set('content-Type', 'application/json');
return $response;
}
/**
* @Route ("/delete/deleteComment", name="delete_comment", methods={"POST"})
*/
public function deleteComment(Request $request){
$this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
$dataRequest=$request->request->all();
$d=$this->agentService->deleteCommentaire($dataRequest['id'],$dataRequest['cdns']);
$response=new Response($d,Response::HTTP_OK);
$response->headers->set('content-Type', 'application/json');
return $response;
}
/**
* @Route ("/deleteLinkage/dlink", name="dlink_fiche", methods={"POST"})
*/
public function dlink(Request $request){
$this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
$dataRequest=$request->request->all();
$response=$this->agentService->dlinkV2($dataRequest['idOne'],$dataRequest['idTwo']);
$response=new Response($response,Response::HTTP_OK);
$response->headers->set('content-Type', 'application/json');
return $response;
}
/**
* @Route ("/deleteLinkage/dlinks", name="dlinks_fiche", methods={"POST"})
*/
public function dlinks(Request $request){
$this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
$dataRequest=$request->request->all();
$response=$this->agentService->dlink($dataRequest['id']);
$response=new Response($response,Response::HTTP_OK);
$response->headers->set('content-Type', 'application/json');
return $response;
}
/**
* @Route ("/push/pushEvenement", name="push_evenement", methods={"POST"})
*/
public function setEvenement(Request $request){
$this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
$dataRequest=$request->request->all();
$response=new Response($this->agentService->setEvenement($dataRequest['eve'],
$dataRequest['cdS'],$dataRequest['cdns'],
base64_decode($dataRequest['cmnt']),$dataRequest['id']),Response::HTTP_OK);
$response->headers->set('content-Type', 'application/json');
return $response;
}
/**
* @Route ("/push/closeEtab", name="close_etab", methods={"POST"})
*/
public function closeEtab(Request $request){
$this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
$dataRequest=$request->request->all();
$response=new Response($this->agentService->closeEtab($dataRequest['id'],$dataRequest['cdns'],$dataRequest['cmnt']),Response::HTTP_OK);
$response->headers->set('content-Type', 'application/json');
return $response;
}
/**
* @Route ("/delete/deleteEVE", name="delete_evenement", methods={"POST"})
*
*/
public function deleteEvenement(Request $request){
$this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
$dataRequest=$request->request->all();
$response=new Response($this->agentService->deleteEvenement($dataRequest['cdns'], $dataRequest['id']));
$response->headers->set('content-Type', 'application/json');
return $response;
}
/**
* @Route( "/get/rappel", name="get_rappel", methods={"POST"})
*/
public function getRappel(Request $request){
$this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
$dep=$request->request->get("dep");
$response=new Response($this->agentService->getRappel($dep));
$response->headers->set('content-Type', 'application/json');
return $response;
}
/**
* @Route("/set/rappel", name="set_rappel", methods={"POST"})
*
*/
public function setRappel(Request $request){
$this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
$dataRequest=$request->request->all();
$response=new Response($this->agentService->setRappel($dataRequest["cdns"],$dataRequest["id"]),Response::HTTP_OK);
$response->headers->set('content-Type', 'application/json');
return $response;
}
/**
* @Route("/user/duplicateFiche",name="dupicate_fiche", methods={"GET","POST"})
*/
public function dupplicateFiche(Request $request){
$this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
$dataRequest=$request->request->all();
$response=new Response($this->agentService->duplicateFiche(base64_decode($dataRequest["cdns"]),$dataRequest["id"],$dataRequest["dep"]));
$response->headers->set('content-Type', 'application/json');
return $response;
}
/**
* @Route("/set/setFicheValided",name="set_true_fiche_validated", methods={"POST"})
*/
public function setFicheValidated(Request $request){
$this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
$dataRequest=$request->request->all();
$a=$this->agentService->setFicheValidated($dataRequest['cdns'],$dataRequest['id']);
$response=new Response($a);
$response->headers->set('content-Type', 'application/json');
return $response;
}
/**
* @Route("/set/reverseRappel", name="reverse_rappel", methods={"POST"})
*/
public function reverseRappel(Request $request){
$this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
$dataRequest=$request->request->all();
$a=$this->agentService->reverseRappel($dataRequest['cdns'],$dataRequest['id']);
$response=new Response($a);
$response->headers->set('content-Type', 'application/json');
return $response;
}
/**
* @Route("/setDepChoice/{dep}", name="set_dep_choice", methods={"GET"})
*/
public function setDepChoice($dep){
$this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
$session = $this->requestStack->getSession();
$session->set('dep', $dep);
$a=new Response($this->serializer->serialize(["response"=>"ok"],'json'));
$a->headers->set('content-Type', 'application/json');
return $a;
}
/**
* @Route("/setViewChoice/{view}", name="set_view_choice", methods={"GET"})
*/
public function setViewChoice($view){
$this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
$session = $this->requestStack->getSession();
$session->set('view', $view);
$a=new Response($this->serializer->serialize(["response"=>"ok"],'json'));
$a->headers->set('content-Type', 'application/json');
return $a;
}
/**
* @Route("/setCodinseeChoice/{codinsee}", name="set_codinsee_choice")
*/
public function setCodinseeChoice($codinsee){
$this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
$session = $this->requestStack->getSession();
$session->set('codinsee', $codinsee);
$a=new Response($this->serializer->serialize(["response"=>"ok"],'json'));
$a->headers->set('content-Type', 'application/json');
return $a;
}
/**
* @Route("/getAccountDepToValidateByCodinsee/{codinsee}/{dep}",name="get_acoount_dep_validate_codinsee")
*/
public function getNombreFicheTOvalidateByCodinsee($codinsee,$dep){
$this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
$nbr=$this->agentService-> getNombreFicheTOvalidateByCodinsee($dep,$codinsee);
$a=new Response($this->serializer->serialize(["nbr"=>$nbr],'json'));
$a->headers->set('content-Type', 'application/json');
return $a;
}
/**
* @Route("/getDepByUserId", name="get_dep_by_user_id" , methods={"GET"})
*/
public function getDepByUserId(Request $request){
$this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
$id=$request->query->get("id");
$a=$this->agentService->getDepByUserId($id);
$response=new Response($a);
$response->headers->set('content-Type', 'application/json');
return $response;
}
/**
* @Route("/getAccountDepToDo", name="get_acount_dep_to_do", methods={"GET"})
*/
public function getAccountToDo(Request $request){
$this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
$dep=$request->query->get('dep');
$response=new Response($this->agentService->getAccountToDo($dep));
$response->headers->set('content-Type', 'application/json');
return $response;
}
/**
* @Route("/getAccountDepDone", name="get_account_dep_done", methods={"GET"})
*/
public function getAccountDepDone(Request $request){
$this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
$dep=$request->query->get('dep');
$response=new Response($this->agentService->getAccountDepDone($dep));
$response->headers->set('content-Type', 'application/json');
return $response;
}
/**
* @Route("/getAccountRappel", name="get_account_rappel", methods={"GET"})
*/
public function getAccountRappel(Request $request){
$this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
$dep=$request->query->get('dep');
$response=new Response($this->agentService->getAccountRappel($dep));
$response->headers->set('content-Type', 'application/json');
return $response;
}
/**
* @Route("/checkedFastFood", name="fastFood_checked", methods={"POST"})
*/
public function setCheckBoxFastFood(Request $request){
$this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
$dataRequest=$request->request->all();
$response=new Response($this->agentService->setCheckBoxFastFood($dataRequest['id'],$dataRequest['b']));
$response->headers->set('content-Type', 'application/json');
return $response;
}
/**
* @Route("/checkedRestaurant", name="restaurant_checked", methods={"POST"})
*/
public function setCheckBoxRestaurant(Request $request){
$this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
$dataRequest=$request->request->all();
$response=new Response($this->agentService->setCheckBoxRestaurant($dataRequest['id'],$dataRequest['b']));
$response->headers->set('content-Type', 'application/json');
return $response;
}
/**
* @Route("/checkedCreperie", name="creperie_checked", methods={"POST"})
*/
public function setCheckBoxCreperie(Request $request){
$this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
$dataRequest=$request->request->all();
$response=new Response($this->agentService->setCheckBoxCreperie($dataRequest['id'],$dataRequest['b']));
$response->headers->set('content-Type', 'application/json');
return $response;
}
/**
* @Route("/checkedBrasserie", name="brasserie_checked", methods={"POST"})
*/
public function setCheckBoxBrasserie(Request $request){
$this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
$dataRequest=$request->request->all();
$response=new Response($this->agentService->setCheckBoxBrasserie($dataRequest['id'],$dataRequest['b']));
$response->headers->set('content-Type', 'application/json');
return $response;
}
/**
* @Route("/checkedPizzeria", name="pizzeria_checked", methods={"POST"})
*/
public function setCheckBoxPizzeria(Request $request){
$this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
$dataRequest=$request->request->all();
$response=new Response($this->agentService->setCheckBoxPizzeria($dataRequest['id'],$dataRequest['b']));
$response->headers->set('content-Type', 'application/json');
return $response;
}
/**
* @Route("/checkedBoulangerie", name="boulangerie_checked", methods={"POST"})
*/
public function setCheckBoxBoulangerie(Request $request){
$this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
$dataRequest=$request->request->all();
$response=new Response($this->agentService->setCheckBoxBoulangerie($dataRequest['id'],$dataRequest['b']));
$response->headers->set('content-Type', 'application/json');
return $response;
}
/**
* @Route("/checkedBar", name="bar_checked", methods={"POST"})
*/
public function setCheckBoxBar(Request $request){
$this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
$dataRequest=$request->request->all();
$response=new Response($this->agentService->setCheckBoxBar($dataRequest['id'],$dataRequest['b']));
$response->headers->set('content-Type', 'application/json');
return $response;
}
/**
* @Route("/checkedMonde", name="cuisine_monde_checked", methods={"POST"})
*/
public function setCheckBoxMonde(Request $request){
$this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
$dataRequest=$request->request->all();
$response=new Response($this->agentService->setCheckBoxMonde($dataRequest['id'],$dataRequest['b']));
$response->headers->set('content-Type', 'application/json');
return $response;
}
/**
* @Route("/checkedCafe", name="cafe_checked", methods={"POST"})
*/
public function setCheckBoxCafe(Request $request){
$this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
$dataRequest=$request->request->all();
$response=new Response($this->agentService->setCheckBoxCafe($dataRequest['id'],$dataRequest['b']));
$response->headers->set('content-Type', 'application/json');
return $response;
}
/**
* @Route("/checkedSalonThe", name="salonThe_checked", methods={"POST"})
*/
public function setCheckBoxSalonThe(Request $request){
$this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
$dataRequest=$request->request->all();
$response=new Response($this->agentService->setCheckBoxSalonThe($dataRequest['id'],$dataRequest['b']));
$response->headers->set('content-Type', 'application/json');
return $response;
}
/**
* @Route("/setPasGarder", name="pas_garder", methods={"POST"})
*/
public function setPasGarder(Request $request){
$this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
$dataRequest=$request->request->all();
$response=new Response($this->agentService->setPasGarder($dataRequest['id'],$dataRequest['cdns']));
$response->headers->set('content-Type', 'application/json');
return $response;
}
/**
* @Route("/undoPasGarder", name="oui_garder", methods={"POST"})
*/
public function undoPasGarder(Request $request){
$this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
$dataRequest=$request->request->all();
$response=new Response($this->agentService->undoPasGarder($dataRequest['id'],$dataRequest['cdns']));
$response->headers->set('content-Type', 'application/json');
return $response;
}
/**
* @Route("/see/AllAboutFiche", name="see_all_about_fiche", methods={"GET"})
*
*/
public function seeAllAboutFiche(Request $request){
$this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
$id=$request->query->get("id");
$response=new Response($this->agentService->seeAllAboutFiche($id));
$response->headers->set('content-Type', 'application/json');
return $response;
}
/**
*@Route("/see/Historique", name="voir_historique", methods={"POST"})
*
*/
public function showHistorical(Request $request){
$this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
$dep=$request->request->get("dep");
$response=new Response($this->agentService->showHistorical($dep));
$response->headers->set('content-Type', 'application/json');
return $response;
}
/**
* @Route("/removeToHistorique", name="annulValidation", methods={"POST"})
*/
public function removeToListFicheValidad(Request $request){
$this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
$dataRequest=$request->request->all();
$response=new Response($this->agentService->removeToListFicheValided($dataRequest["cdns"],$dataRequest["id"]) );
$response->headers->set('content-Type', 'application/json');
return $response;
}
/**
* @Route("/undo/modif", name="undo_modif", methods={"POST"})
*/
public function undo(Request $request){
$this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
$dataRequest=$request->request->get("id");
$response=new Response($this->agentService->undo($dataRequest) );
$response->headers->set('content-Type', 'application/json');
return $response;
}
/**
* @Route("/change/name", name="changer_nom", methods={"POST"})
*
*/
public function changeName(Request $request){
$this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
$dataRequest=$request->request->all();
$response=new Response($this->agentService->changeName($dataRequest["id"],$dataRequest["name"]) );
$response->headers->set('content-Type', 'application/json');
return $response;
}
/**
* @Route("/change/adresse", name="changer_adresse", methods={"POST"})
*
*/
public function changeAdresse(Request $request){
$this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
$dataRequest=$request->request->all();
$response=new Response($this->agentService->changeAddress($dataRequest["id"],$dataRequest["numvoie"],$dataRequest["typevoie"],
$dataRequest["nomvoie"],$dataRequest["codpost"],
$dataRequest["villenorm"],$dataRequest["commune"],
$dataRequest["compvoie"]));
$response->headers->set('content-Type', 'application/json');
return $response;
}
/**
*@Route("/set/flaggoodname", name="flag_good_name", methods={"POST"})
*
*/
public function putGoodNameFlag(Request $request){
$this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
$id=$request->request->get("id");
$response=new Response($this->agentService->setNomOk($id));
$response->headers->set('content-Type', 'application/json');
return $response;
}
/**
*@Route("/remove/flaggoodname", name="remove_flag_good_name", methods={"POST"})
*
*/
public function removeGoodNameFlag(Request $request){
$this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
$id=$request->request->get("id");
$response=new Response($this->agentService->unSetNomOk($id));
$response->headers->set('content-Type', 'application/json');
return $response;
}
/**
* @Route("/set/goodadresseflag", name="good_adresse", methods={"POST"})
*
*/
public function putGoodAdresseFlag(Request $request){
$this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
$id=$request->request->get("id");
$response=new Response($this->agentService->setAdresseOk($id));
$response->headers->set('content-Type', 'application/json');
return $response;
}
/**
* @Route("/remove/goodadresseflag", name="remove_good_adresse", methods={"POST"})
*
*/
public function removeGoodAdresseFlag(Request $request){
$this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
$id=$request->request->get("id");
$response=new Response($this->agentService->unsetAdresseOk($id));
$response->headers->set('content-Type', 'application/json');
return $response;
}
/**
* @Route("/set/sirenok", name="set_siren_ok", methods={"POST"})
*/
public function setSirenOK(Request $request ){
$this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
$dataRequest=$request->request->all();
$response=new Response($this->agentService->setSirenOk($dataRequest["id"],$dataRequest["siren"]));
$response->headers->set('content-Type', 'application/json');
return $response;
}
/**
* @Route("/change/sirenok", name="change_siren_ok", methods={"POST"})
*/
public function changeSirenOK(Request $request ){
$this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
$id=$request->request->get("id");
$siren=$request->request->get("siren");
$response=new Response($this->agentService->unsetSirenOk($id,$siren));
$response->headers->set('content-Type', 'application/json');
return $response;
}
/**
* @Route("/undo/sirenok", name="undo_siren_ok", methods={"POST"})
*/
public function undoSirenOK(Request $request ){
$this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
$id=$request->request->get("id");
$response=new Response($this->agentService-> undoSirenOk($id));
$response->headers->set('content-Type', 'application/json');
return $response;
}
/**
* @Route("/set/telok", name="set_tel_ok", methods={"POST"})
*/
public function setTelOK(Request $request ){
$this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
$dataRequest=$request->request->all();
$response=new Response($this->agentService->setTelOk($dataRequest["id"],$dataRequest["tel"]));
$response->headers->set('content-Type', 'application/json');
return $response;
}
/**
* @Route("/change/tel", name="unset_tel_ok", methods={"POST"})
*/
public function changeTelOK(Request $request ){
$this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
$data=$request->request->all();
$response=new Response($this->agentService->changeTelOk($data["id"],$data["tel"]));
$response->headers->set('content-Type', 'application/json');
return $response;
}
/**
* @Route("/undo/telok", name="undo_tel_ok", methods={"POST"})
*/
public function undoTelOK(Request $request ){
$this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
$data=$request->request->all();
$response=new Response($this->agentService->undoTelOk($data["id"]));
$response->headers->set('content-Type', 'application/json');
return $response;
}
/**
* @Route("/suppr/tel", name="unset_tel_ok", methods={"POST"})
*/
public function supprTel(Request $request ){
$this->denyAccessUnlessGranted('ROLE_USER',null,'access denied');
$data=$request->request->all();
$response=new Response($this->agentService->supprTel($data["id"],$data["tel"]));
$response->headers->set('content-Type', 'application/json');
return $response;
}
// #[Route("/set/restaurant/details/web",name:"app_details_resto_web", methods:["POST"])]
// public function setRestaurantDetailsWeb(Request $request,RepoDetailsRestoSite $repo,SerializerInterface $serialize){
// $dataRequest=json_decode($request->getContent(),true);
// $denomination=$dataRequest["nom"];
// $adresse=$dataRequest["adresse"];
// $telephone=$dataRequest["tel"];
// $site=$dataRequest["site"];
// $codens=$dataRequest["codens"];
// $id_restaurant=$dataRequest["id_r"];
// $detailRestaurantWeb=new DetailsRestoSite();
// $detailRestaurantWeb->setAdresse($adresse)
// ->setDenomination($denomination)
// ->setTelephone($telephone)
// ->setSite($site)
// ->setCodens($codens)
// ->setIdRestaurant($id_restaurant);
// $repo->add($detailRestaurantWeb,true);
// $json=$serialize->serialize($dataRequest,'json');
// return new JsonResponse($json,Response::HTTP_CREATED,[],true);
//}
/**
*@Route("/get/items/{dep}", name="app_get_all_item", methods={"GET"})
*/
public function getAllFicheByDep($dep, RestaurantRepository $repo,SerializerInterface $serialize){
$restos=$repo->getAllFicheByDep($dep);
$json=$serialize->serialize($restos,'json');
return new JsonResponse($json,Response::HTTP_CREATED,[],true);
}
/**
*@Route("/up/pos", name="app_up_pos")
*/
public function updatePoiPos(Request $request, RestaurantRepository $repo){
$contents=json_decode($request->getContent(),true);
try{
$repo->updatePoiPosition($contents["poiX"], $contents["poiY"],$contents["id"]);
return $this->json(["message"=>"ok"],200);
}catch(\Exception $e){
return $this->json(["erreur"=>$e],500);
}
}
}