src/Controller/DashboardController.php line 568

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use Dompdf\Dompdf;
  4. use App\Entity\DfGeneraliste;
  5. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  6. use Symfony\Component\HttpFoundation\Response;
  7. use Symfony\Component\Routing\Annotation\Route;
  8. use App\Entity\RemplacentGeneraliste;
  9. use App\Form\RemplacentGeneralisteType;
  10. use App\Entity\Prescriptions;
  11. use App\Entity\Consultation;
  12. use App\Entity\Examenbiologique;
  13. use App\Entity\Examenmorphologique;
  14. use App\Form\ConsultationType;
  15. use App\Form\Consultation2Type;
  16. use App\Form\Consultation2ModifType;
  17. use App\Entity\Nomenclature2023;
  18. use App\Form\Nomenclature2023Type;
  19. use Knp\Component\Pager\PaginatorInterface;
  20. use App\Form\DfGeneraliste1Type;
  21. use App\Form\DfGeneraliste11Type;
  22. use Doctrine\ORM\EntityManagerInterface;
  23. use App\Entity\SecretairesGeneraliste;
  24. use App\Form\SecretairesGeneraliste2Type;
  25. use App\Entity\Patients;
  26. use App\Entity\Reservationgeneraliste;
  27. use App\Form\PatientsType;
  28. use App\Form\PatientsAgendaType;
  29. use App\Form\PatientsInfoType;
  30. use App\Form\ReservationgeneralisteType;
  31. use Symfony\Component\HttpFoundation\Request;
  32. use Doctrine\Persistence\ManagerRegistry as PersistenceManagerRegistry;
  33. use Symfony\Component\Security\Core\User\UserInterface;
  34. use Symfony\Component\Validator\Constraints\DateTime;
  35. use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface;
  36. use App\Entity\User;
  37. use App\Form\SecretairesGeneralisteType;
  38. use Symfony\Component\Form\Extension\Core\Type\SubmitType;
  39. use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
  40. use Symfony\Component\Form\Extension\Core\Type\TextType;
  41. use Symfony\Component\Form\Extension\Core\Type\TimeType;
  42. use App\Form\DfGeneralisteType;
  43. use App\Form\PrescriptionType;
  44. use Symfony\Component\Security\Core\Encoder\UserPasswordEncoder;
  45. use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
  46. use Symfony\Component\Validator\Constraints\Date;
  47. class DashboardController extends AbstractController
  48. {
  49.     /**
  50.      * @Route("/", name="app_home")
  51.      */
  52.     public function index(): Response
  53.     {
  54.         return $this->render('dashboard/index.html.twig', [
  55.             'controller_name'=> 'controller_name'
  56.         ]);
  57.     }
  58.     /**
  59.      * @Route("dashboard/infoconsultation", name="infoconsultation_dashboard", methods={"GET", "POST"})
  60.      */
  61.     public function infoConsultation(Request $requestPatients $reservationgeneralisteEntityManagerInterface $entityManager): Response
  62.     {
  63.         
  64.         $resPatient $entityManager->getRepository(Reservationgeneraliste::class);
  65.         $idRes $resPatient->findOneBy(['resdoc' => '19''respatient'=> '120''datres'=>'2024-07-18']);
  66.         
  67.         $consultationRepository $entityManager->getRepository(Consultation::class);
  68.         $infoConsultations $consultationRepository->findOneBy(['id' => $idRes]);  
  69.         var_dump($infoConsultations);
  70.     }
  71.     /**
  72.      * @Route("/dashboard", name="app_dashboard", methods={"GET", "POST"})
  73.      */
  74.     public function indexdashboard(PersistenceManagerRegistry $doctrine,  EntityManagerInterface $entityManagerUserInterface $userRequest $request): Response
  75.     {
  76.         $em=$doctrine->getManager();
  77.         //$em= $doctrine;
  78.         
  79.         //$medecinsRepository = $em->getRepository(DfGeneraliste::class);
  80.         $user $this->getUser();
  81.         //$medecinsRepository = $em->getRepository(SecretairesGeneraliste::class);
  82.         //$user = $this->getUser();
  83.         $roleUser $user->getRoles();
  84.         //var_dump($roleUser[0]);
  85.         //var_dump("sofiane");
  86.         //$roleUser = ["ROLE_ADMIN"];
  87.         //exit(\Doctrine\Common\Util\Debug::dump($roleUser));
  88.  
  89.        
  90.     
  91.         
  92.     if($roleUser[0]=="ROLE_ADMIN"){
  93.         $medecinsRepository $em->getRepository(DfGeneraliste::class);
  94.         $profileDocteur $medecinsRepository->findOneBy(['email' => $user->getUsername()]);     
  95.       
  96.         $resPatient $entityManager->getRepository(Reservationgeneraliste::class);
  97.         $resPatientbyDoc $resPatient->findBy(['resdoc' => $profileDocteur->getId()]);
  98.         //$resPatientbyDoc = $resPatient->findBy(['resdoc' => $profileDocteur->getId(), 'dateres' => '2024-07-26']);
  99.         $resPatientbyDoc2 $resPatient->findOneBy(['resdoc' => $profileDocteur->getId()]);
  100.         
  101.         $patientRepository $entityManager->getRepository(Patients::class);
  102.         //$profilePatient23 = $patientRepository->findOneBy(['id' => $resPatientbyDoc2->getRespatient()]);    
  103.         
  104.         //$resPatientbyDoc23 = $resPatient->findOneBy(['respatient' => $profilePatient23->getId()]);
  105.       
  106.         //$idRes = $resPatient->findOneBy(['resdoc' => 19, 'respatient'=> 121]);
  107.         $consultationRepository $entityManager->getRepository(Consultation::class);
  108.         $consultationExamenBioRepository $entityManager->getRepository(Examenbiologique::class);
  109.         $consultationExamenMorphoRepository $entityManager->getRepository(Examenmorphologique::class);
  110.         $consultationPrescriptionRepository $entityManager->getRepository(Prescriptions::class);
  111.         $infoConsultations null;
  112.         $infoConsultationsExamenBio null;
  113.         $infoConsultationsExamenMorpho null;
  114.         if($resPatientbyDoc2){
  115.         $infoConsultations $consultationRepository->findById(['id' => $resPatientbyDoc2->getId()]);  
  116.             
  117.         //var_dump($infoConsultations);    
  118.           
  119.     }
  120.     $test = [];
  121.         $testconsult = [];
  122.         foreach ($resPatientbyDoc as $key) {
  123.             $test[] = $key->getRespatient();
  124.             $testconsult[] = $key->getId();
  125.         }
  126.         $patients $entityManager
  127.             ->getRepository(Patients::class)
  128.             ->findById($test);
  129.         $infoConsultations $entityManager
  130.             ->getRepository(Consultation::class)
  131.             ->findBy(['numres' => $testconsult]);
  132.         $infoConsultations2 $entityManager
  133.             ->getRepository(Consultation::class)
  134.             ->findOneBy(['numres' => $testconsult]);
  135.         //var_dump(count($test));
  136.         //var_dump(count($testconsult));
  137.         //var_dump(count($patients));
  138.         //var_dump(count($infoConsultations));
  139.      
  140.         $infoConsultationsExamenBio $consultationExamenBioRepository->findOneBy(['idconsultation' => $infoConsultations]);  
  141.         $infoConsultationsExamenMorpho $consultationExamenMorphoRepository->findOneBy(['idconsultation' => $infoConsultations]);  
  142.         $infoConsultationsPrescription $consultationPrescriptionRepository->findOneBy(['id' => $infoConsultations]);  
  143.         //array result
  144.         $infoConsultationsExamenBio $consultationExamenBioRepository->findBy(['idconsultation' => $infoConsultations]);  
  145.         $infoConsultationsExamenMorpho $consultationExamenMorphoRepository->findBy(['idconsultation' => $infoConsultations]);  
  146.         $infoConsultationsPrescription $consultationPrescriptionRepository->findBy(['id' => $infoConsultations]);  
  147.         //var_dump($infoConsultationsExamenBio->getId());    
  148.         //var_dump(count($infoConsultationsExamenBio));  
  149.         
  150.  
  151.         
  152.         $consultation = new Consultation();  
  153.         $formConsultation $this->createForm(Consultation2Type::class, $consultation);
  154.         $formConsultation->handleRequest($request);
  155.         $consultationmodif = new Consultation();  
  156.         $formConsultationmodif $this->createForm(Consultation2ModifType::class, $consultationmodif);
  157.         $formConsultationmodif->handleRequest($request);
  158.         $fPrescription = new Prescriptions();
  159.         $formPrescription $this->createForm(PrescriptionType::class, $fPrescription);
  160.         $formPrescription->handleRequest($request);
  161.         $formMed $this->createFormBuilder()
  162.                 ->add('medicament'TextType::class,  array('property_path' => 'userinput'))
  163.                 ->getForm();
  164.                 $formMedok $this->createFormBuilder()
  165.                 ->add('medicament'TextType::class,  array('property_path' => 'userinput''required' => false))
  166.                 ->getForm();
  167.             $nomenclature2023s $entityManager
  168.                 ->getRepository(Nomenclature2023::class)
  169.                 ->findAll();
  170.         
  171.         if ($request->isMethod('post') && $formConsultation->isSubmitted() && $formConsultation->isValid()) {
  172.             
  173.             $idRes $resPatient->findOneBy(['resdoc' => $profileDocteur->getId(), 'respatient'=> $formConsultation->get('idresform')->getData()]);
  174.             $consultation->setNumres($idRes);
  175.             $entityManager->persist($consultation);
  176.             $entityManager->flush();
  177.             $profileCurrentPatient $patientRepository->findOneBy(['id' => $formConsultation->get('idresform')->getData()]);    
  178.             $profileCurrentPatient->setNom($formConsultation->get('nompatient')->getData());
  179.             $entityManager->persist($profileCurrentPatient);
  180.             $entityManager->flush();
  181.             $resCurrentPatient $resPatient->findOneBy(['resdoc' => $profileDocteur->getId(), 'respatient'=> $formConsultation->get('idresform')->getData()]);   
  182.             $resCurrentPatient->setAtcdPersoMedicaux($formConsultation->get('Atcdpersomedicaux')->getData());
  183.             $resCurrentPatient->setconsultationDone("1");
  184.             $entityManager->persist($resCurrentPatient);
  185.             $entityManager->flush();
  186.             $examenBio = new Examenbiologique();
  187.             $examenBio->setNomexamen($formConsultation->get("nomexamencomplementairebio")->getData());
  188.             $examenBio->setDateexamen($formConsultation->get("examencomplementairebiodate")->getData());
  189.             $examenBio->setConclusionexamen($formConsultation->get("examencomplementairebioconclusion")->getData());
  190.             $examenBio->setIdconsultation($consultation);
  191.             $entityManager->persist($examenBio);
  192.             $entityManager->flush();
  193.             $examenMorpho = new Examenmorphologique();
  194.             $examenMorpho->setNomexamen($formConsultation->get("nomexamencomplementairemorpho")->getData());
  195.             $examenMorpho->setDateexamen($formConsultation->get("examencomplementairemorphodate")->getData());
  196.             $examenMorpho->setConclusionexamen($formConsultation->get("examencomplementairemorphoconclusion")->getData());
  197.             $examenMorpho->setIdconsultation($consultation);
  198.             $entityManager->persist($examenMorpho);
  199.             $entityManager->flush();
  200.             //echo("sofiane dump");
  201.             //echo($prescription);
  202.             $prescription $formConsultation->get("prescription")->getData();
  203.             $prescription explode (";;"$prescription); 
  204.             foreach ($prescription as $ppp) {
  205.                 $prescri = new Prescriptions();
  206.                 $prescri->setId($consultation);
  207.                 $prescri->setPrescription($ppp);
  208.                 $entityManager->persist($prescri);
  209.                 $entityManager->flush();
  210.               } 
  211.     
  212.             return $this->redirectToRoute('app_dashboard', [], Response::HTTP_SEE_OTHER);
  213.         }
  214.         if ($request->isMethod('post') && $formConsultationmodif->isSubmitted() && $formConsultationmodif->isValid()) {
  215.             
  216.             $idRes $resPatient->findOneBy(['resdoc' => $profileDocteur->getId(), 'respatient'=> $formConsultationmodif->get('idresform')->getData()]);
  217.             $consultationmodif $consultationRepository->findOneBy(['numres' => $idRes]);  
  218.             $consultationmodif->setAnamnese($formConsultationmodif->get('anamnese')->getData());
  219.             $consultationmodif->setConstantehemodynamique($formConsultationmodif->get('constantehemodynamique')->getData());
  220.             $consultationmodif->setSignesfonctionnels($formConsultationmodif->get('signesfonctionnels')->getData());
  221.             $consultationmodif->setSignesgeneraux($formConsultationmodif->get('signesgeneraux')->getData());
  222.             $consultationmodif->setSignesphysiques($formConsultationmodif->get('signesphysiques')->getData());
  223.             $consultationmodif->setConclusion($formConsultationmodif->get('conclusion')->getData());
  224.             //$entityManager->persist($consultationmodif);
  225.             $entityManager->flush();
  226.             $profileCurrentPatient $patientRepository->findOneBy(['id' => $formConsultationmodif->get('idresform')->getData()]);    
  227.             $profileCurrentPatient->setNom($formConsultationmodif->get('nompatient')->getData());
  228.             $profileCurrentPatient->setPrenom($formConsultationmodif->get('prenompatient')->getData());
  229.             $profileCurrentPatient->setSexe($formConsultationmodif->get('genrepatient')->getData());
  230.             $profileCurrentPatient->setDatenaissance($formConsultationmodif->get('datenaissancepatient')->getData());
  231.             $profileCurrentPatient->setLieunaissance($formConsultationmodif->get('lieunaissancepatient')->getData());
  232.             $profileCurrentPatient->setOrigine($formConsultationmodif->get('originepatient')->getData());
  233.             $profileCurrentPatient->setAdresse($formConsultationmodif->get('adressepatient')->getData());
  234.             $profileCurrentPatient->setSituationfamille($formConsultationmodif->get('situationfamillialepatient')->getData());
  235.             $profileCurrentPatient->getNombreenfant($formConsultationmodif->get('nombreenfantspatient')->getData());
  236.             //$entityManager->persist($profileCurrentPatient);
  237.             $entityManager->flush();
  238.             $resCurrentPatient $resPatient->findOneBy(['resdoc' => $profileDocteur->getId(), 'respatient'=> $formConsultationmodif->get('idresform')->getData()]);   
  239.             $resCurrentPatient->setAtcdPersoMedicaux($formConsultationmodif->get('Atcdpersomedicaux')->getData());
  240.             $resCurrentPatient->setAtcdPersoAllergieMedicaux($formConsultationmodif->get('Atcdpersoallergimedicam')->getData());
  241.             $resCurrentPatient->setAtcdpersochirurgicaux($formConsultationmodif->get('Atcdpersochurirgoco')->getData());
  242.             $resCurrentPatient->setAtcdPersoTraitementEnCours($formConsultationmodif->get('Atcdpersotraitencours')->getData());
  243.             $resCurrentPatient->setAtcdFamilleParentalMedicaux($formConsultationmodif->get('Atcdfammileparentalmedico')->getData());
  244.             $resCurrentPatient->setAtcdFamilleParentalChirurgicaux($formConsultationmodif->get('Atcdfammileparentalchirurgico')->getData());
  245.             $resCurrentPatient->setAtcdFamilleMaladiesCronique($formConsultationmodif->get('Atcdfammilemaladicronic')->getData());
  246.             $resCurrentPatient->setAtcdFamilleMaternelMedicaux($formConsultationmodif->get('Atcdfammilematrnalmedico')->getData());
  247.             $resCurrentPatient->setAtcdFamilleMaternelChirurgicaux($formConsultationmodif->get('Atcdfammilematrnalchirurgico')->getData());
  248.             $resCurrentPatient->setMotifpatient($formConsultationmodif->get('motifconsultationpatient')->getData());
  249.             
  250.             $resCurrentPatient->setconsultationDone("1");
  251.             //$entityManager->persist($resCurrentPatient);
  252.             $entityManager->flush();
  253.             $examenBio $entityManager->getRepository(Examenbiologique::class);
  254.             $examenBio $examenBio->findOneBy(['idconsultation' => $consultationmodif]);
  255.             if (($examenBio)){
  256.             $examenBio->setNomexamen($formConsultationmodif->get("nomexamencomplementairebio")->getData());
  257.             $examenBio->setDateexamen($formConsultationmodif->get("examencomplementairebiodate")->getData());
  258.             $examenBio->setConclusionexamen($formConsultationmodif->get("examencomplementairebioconclusion")->getData());
  259.             $entityManager->flush();
  260.             }else{
  261.             $examenBio =  new Examenbiologique();
  262.             $examenBio->setNomexamen($formConsultationmodif->get("nomexamencomplementairebio")->getData());
  263.             $examenBio->setDateexamen($formConsultationmodif->get("examencomplementairebiodate")->getData());
  264.             $examenBio->setConclusionexamen($formConsultationmodif->get("examencomplementairebioconclusion")->getData());
  265.             $examenBio->setIdconsultation($consultationmodif);
  266.             $entityManager->persist($examenBio);
  267.             $entityManager->flush();
  268.             }
  269.             
  270.             $examenMorpho $entityManager->getRepository(Examenmorphologique::class);
  271.             $examenMorpho $examenMorpho->findOneBy(['idconsultation' => $consultationmodif]);
  272.             if (($examenMorpho)){
  273.             
  274.             $examenMorpho->setNomexamen($formConsultationmodif->get("nomexamencomplementairemorpho")->getData());
  275.             $examenMorpho->setDateexamen($formConsultationmodif->get("examencomplementairemorphodate")->getData());
  276.             $examenMorpho->setConclusionexamen($formConsultationmodif->get("examencomplementairemorphoconclusion")->getData());
  277.             $entityManager->flush();
  278.             }else{
  279.                 $examenMorpho =  new Examenmorphologique();
  280.                 $examenMorpho->setNomexamen($formConsultationmodif->get("nomexamencomplementairemorpho")->getData());
  281.                 $examenMorpho->setDateexamen($formConsultationmodif->get("examencomplementairemorphodate")->getData());
  282.                 $examenMorpho->setConclusionexamen($formConsultationmodif->get("examencomplementairemorphoconclusion")->getData());
  283.                 $examenMorpho->setIdconsultation($consultationmodif);
  284.                 $entityManager->persist($examenMorpho);
  285.                 $entityManager->flush();
  286.             }
  287.             
  288.             $prescriptionActu $entityManager->getRepository(Prescriptions::class);
  289.             $prescriptionActu $prescriptionActu->findBy(['id' => $consultationmodif]);
  290.             foreach ($prescriptionActu as $presa) {
  291.                 $entityManager->remove($presa);
  292.                 $entityManager->flush();
  293.             }
  294.             $prescription $formConsultationmodif->get("prescription")->getData();
  295.             $prescription explode (";;"$prescription); 
  296.             foreach ($prescription as $ppp) {
  297.                 if($ppp != ''){
  298.                 $prescri = new Prescriptions();
  299.                 $prescri->setId($consultationmodif);
  300.                 $prescri->setPrescription($ppp);
  301.                 $entityManager->persist($prescri);
  302.                 $entityManager->flush();
  303.                 }
  304.               } 
  305.             return $this->redirectToRoute('app_dashboard', [], Response::HTTP_SEE_OTHER);
  306.               }
  307.    
  308.             return $this->render('dashboard/doctor.html.twig', [
  309.                 'currentUser' => $profileDocteur,
  310.                 'patients' => $patients,
  311.                 'patientsDate' => $resPatientbyDoc,
  312.                 'consultationForm' => $formConsultation->createView(),
  313.                 'consultationFormok' => $formConsultationmodif->createView(),
  314.                 'consultationForm2' => $formConsultation->createView(),
  315.                 'medform' =>$formMed->createView(),
  316.                 'medformok' =>$formMedok->createView(),
  317.                 'medform2' =>$formMed->createView(),
  318.                 'nomenclature2023' => $nomenclature2023s,
  319.                 'prescriptionForm' => $formPrescription->createView(),
  320.                 'infoConsultaion' => $infoConsultations
  321.                 'infoConsultaionExamBio' => $infoConsultationsExamenBio,
  322.                 'infoConsultaionExamMorpho' => $infoConsultationsExamenMorpho,
  323.                 'infoConsultaionPrescription' => $infoConsultationsPrescription,
  324.             ]);
  325.         
  326.     }
  327.     if($roleUser[0]=="ROLE_REMPLACANT"){
  328.         $medecinsRepository $em->getRepository(RemplacentGeneraliste::class);
  329.         $profileDocteur $medecinsRepository->findOneBy(['email' => $user->getUsername()]);     
  330.       
  331.         $resPatient $entityManager->getRepository(Reservationgeneraliste::class);
  332.         $resPatientbyDoc $resPatient->findBy(['resdoc' => $profileDocteur->getIdadmin()]);
  333.         $test = [];
  334.         foreach ($resPatientbyDoc as $key) {
  335.             $test[] = $key->getRespatient();
  336.         }
  337.         $patients $entityManager
  338.             ->getRepository(Patients::class)
  339.             ->findById($test);
  340.             return $this->render('dashboard/doctor.html.twig', [
  341.                 'currentUser' => $profileDocteur,
  342.                 'patients' => $patients,
  343.                 'patientsDate' => $resPatientbyDoc,
  344.             ]);
  345.     }
  346.     if($roleUser[0]=="ROLE_USER"){
  347.         $medecinsRepository $em->getRepository(DfGeneraliste::class);
  348.         $secretaireRepository $em->getRepository(SecretairesGeneraliste::class);
  349.         $user $this->getUser();
  350.         $profileSecretaire $secretaireRepository->findOneBy(['email' => $user->getUsername()]);
  351.         $profileDocteur$medecinsRepository->findOneBy(['id' => $profileSecretaire->getIdadmin()]);     
  352.        
  353.           
  354.         
  355.         $resPatient $entityManager->getRepository(Reservationgeneraliste::class);
  356.         $resPatientbyDoc $resPatient->findBy(['resdoc' => $profileDocteur->getId()]);
  357.         $resPatientbyDoc2 $resPatient->findOneBy(['resdoc' => $profileDocteur->getId()]);
  358.         $consultationRepository $entityManager->getRepository(Consultation::class);
  359.         $infoConsultations $consultationRepository->findById(['id' => $resPatientbyDoc2->getId()]);  
  360.         $resPatient $entityManager->getRepository(Reservationgeneraliste::class);
  361.         $resPatientbyDoc $resPatient->findBy(['resdoc' => $profileSecretaire->getIdadmin()]);
  362.      
  363.         $test = [];
  364.         $testconsult = [];
  365.         foreach ($resPatientbyDoc as $key) {
  366.             $test[] = $key->getRespatient();
  367.             $testconsult[] = $key->getId();
  368.         }
  369.         $patients $entityManager
  370.             ->getRepository(Patients::class)
  371.             ->findById($test);
  372.         $infoConsultations $entityManager
  373.             ->getRepository(Consultation::class)
  374.             ->findBy(['numres' => $testconsult]);
  375.   
  376.             $paiementSec = new Reservationgeneraliste();
  377.             $formPaySec $this->createForm(ReservationgeneralisteType::class, $paiementSec);
  378.             $formPaySec->handleRequest($request);
  379.             return $this->render('dashboard/doctor.html.twig', [
  380.                 'currentUser' => $profileSecretaire,
  381.                 'docteurUser' => $profileDocteur,
  382.                 'patients' => $patients,
  383.                 'patientsDate' => $resPatientbyDoc,
  384.                 'paysec' => $formPaySec->createView(), 
  385.                 'infoConsultaion' => $infoConsultations
  386.         
  387.             ]);
  388.     }  
  389.     return $this->render('dashboard/index.html.twig', [
  390.         'controller_name'=> 'controller_name'
  391.     ]);
  392.     }
  393.     /**
  394.      * @Route("dashboard/{idpaie}/paiementConsultation", name="paiementConsultation_app", methods={"GET", "POST"})
  395.      */
  396.     public function paiementConsultation(Request $requestEntityManagerInterface $entityManager): Response
  397.     {
  398.         $resPatient $entityManager->getRepository(Reservationgeneraliste::class);
  399.         //var_dump($request->get('_route'));
  400.         //var_dump($request->get('idpaie'));
  401.         
  402.         $resPatientbyDoc $resPatient->findOneBy(['id' => $request->get('idpaie')]);
  403.         $resPatientbyDoc->setpaiementConsultation("1");
  404.         $entityManager->persist($resPatientbyDoc);
  405.         $entityManager->flush();
  406.         return $this->redirectToRoute('app_dashboard');
  407.     }
  408.     /**
  409.      * @Route("dashboard/{idannul}/annulReservation", name="annulReservation_app", methods={"GET", "POST"})
  410.      */
  411.     public function annulReservation(Request $requestEntityManagerInterface $entityManager): Response
  412.     {
  413.         $resPatient $entityManager->getRepository(Reservationgeneraliste::class);
  414.         //var_dump($request->get('_route'));
  415.         //var_dump($request->get('idannul'));
  416.         
  417.         $resPatientbyDoc $resPatient->findOneBy(['id' => $request->get('idannul')]);
  418.         $resPatientbyDoc->setreservationAnnule("1");
  419.         $entityManager->persist($resPatientbyDoc);
  420.         $entityManager->flush();
  421.         return $this->redirectToRoute('app_dashboard');
  422.     }
  423.     /**
  424.      * @Route("/registration", name="app_registration")
  425.      */
  426.     public function registration(Request $requestUserPasswordEncoderInterface $passEncoder): Response
  427.     {
  428.         
  429.         $Genetaliste = new DfGeneraliste;
  430.         $form $this->createForm(DfGeneralisteType::class, $Genetaliste);
  431.         $form->handleRequest($request);
  432.         if ($request->isMethod('post') && $form->isValid()) {
  433.             $data=$form['avecRDV']->getData();
  434.             $user = new User;
  435.             $user->setUsername($Genetaliste->getEmail());
  436.             $user->setPassword($passEncoder->encodePassword($user$Genetaliste->getPassword()));
  437.             $user->setRoles(["ROLE_ADMIN"]);
  438.             if(!($data)) {
  439.                 $Genetaliste->setAvecRdv(false);
  440.             } else {
  441.                 $Genetaliste->setAvecRdv(true);
  442.             }
  443.             
  444.             
  445.             $Genetaliste->setPassword($passEncoder->encodePassword($user$Genetaliste->getPassword()));
  446.             $Genetaliste->setSpecialite('Médecin Générale');
  447.             $Genetaliste->setRoles(["ROLE_ADMIN"]);
  448.             $em $this->getDoctrine()->getManager();
  449.             $em->persist($Genetaliste);
  450.             $em->flush();
  451.             $em->persist($user);
  452.             $em->flush();
  453.             
  454.            
  455.         return $this->redirect($this->generateUrl('app_login'));
  456.         
  457.         }
  458.         return $this->render('dashboard/registration.html.twig', [
  459.             'registrationMedecinG' => $form->createView(),
  460.         ]);
  461.     }
  462.     /**
  463.      * @Route("dashboard/profile", name="doctor_profile", methods={"GET", "POST"})
  464.      */
  465.     public function profile(PersistenceManagerRegistry $doctrineRequest $requestUserInterface $user): Response
  466.     {
  467.         $em=$doctrine->getManager();
  468.         //$em= $doctrine;
  469.         $medecinsRepository $em->getRepository(DfGeneraliste::class);
  470.         $user $this->getUser();
  471.         $profileDocteur $medecinsRepository->findBy(['email' => $user->getUsername()]);
  472.         $profileDocteurr $medecinsRepository->findOneBy(['email' => $user->getUsername()]);
  473.         //$profileDocteur = $medecinsRepository->findBy(['id' => $user->getUsername()]);
  474.         $dfGeneraliste = new DfGeneraliste();
  475.         $form $this->createForm(DfGeneraliste1Type::class, $dfGeneraliste);
  476.         $form->handleRequest($request);
  477.         return $this->renderForm('dashboard/profile.html.twig',  [
  478.             'profileDocteur' => $profileDocteur,
  479.             'form' => $form
  480.             'currentUser' => $profileDocteurr ]);
  481.     }
  482.     /**
  483.      * @Route("dashboard/stats", name="doctor_stats", methods={"GET", "POST"})
  484.      */
  485.     public function stats(PersistenceManagerRegistry $doctrine,EntityManagerInterface $entityManagerRequest $requestUserInterface $user): Response
  486.     {
  487.         $em=$doctrine->getManager();
  488.         //$em= $doctrine;
  489.         $medecinsRepository $em->getRepository(DfGeneraliste::class);
  490.         $user $this->getUser();
  491.         $profileDocteur $medecinsRepository->findBy(['email' => $user->getUsername()]);
  492.         $profileDocteurr $medecinsRepository->findOneBy(['email' => $user->getUsername()]);
  493.         //$profileDocteur = $medecinsRepository->findBy(['id' => $user->getUsername()]);
  494.         $resPatient $entityManager->getRepository(Reservationgeneraliste::class);
  495.         $resPatientbyDoc $resPatient->findBy(['resdoc' => $profileDocteurr->getId()]);
  496.         $test = [];
  497.         foreach ($resPatientbyDoc as $key) {
  498.             $test[] = $key->getRespatient();
  499.         }
  500.         $patients$entityManager
  501.             ->getRepository(Patients::class)
  502.             ->findById($test);
  503.         $patientsHomme $entityManager
  504.             ->getRepository(Patients::class)
  505.             //->findById($test);
  506.             ->findBy(['id' => $test"sexe"=>"Homme"]);
  507.         $patientsFemme $entityManager
  508.             ->getRepository(Patients::class)
  509.             //->findById($test);
  510.             ->findBy(['id' => $test"sexe"=>"Femme"]);
  511.         $dfGeneraliste = new DfGeneraliste();
  512.         $form $this->createForm(DfGeneralisteType::class, $dfGeneraliste);
  513.         $form->handleRequest($request);
  514.         return $this->renderForm('dashboard/stats.html.twig',  [
  515.             'profileDocteur' => $profileDocteur,
  516.             'form' => $form
  517.             'currentUser' => $profileDocteurr,
  518.             'patients' => $patients
  519.             'patientsHomme' => $patientsHomme
  520.             'patientsFemme' => $patientsFemme ]);
  521.     }
  522.     /**
  523.      * @Route("dashboard/consultation", name="app_consultation",  methods={"GET", "POST"})
  524.      */
  525.     public function consultation(PersistenceManagerRegistry $doctrineRequest $requestUserInterface $userEntityManagerInterface $entityManager): Response
  526.     {
  527.         $em=$doctrine->getManager();
  528.         //$em= $doctrine;
  529.         $medecinsRepository $em->getRepository(DfGeneraliste::class);
  530.         $user $this->getUser();
  531.         $profileDocteur $medecinsRepository->findBy(['email' => $user->getUsername()]);
  532.         $profileDocteurr $medecinsRepository->findOneBy(['email' => $user->getUsername()]);
  533.         //$profileDocteur = $medecinsRepository->findBy(['id' => $user->getUsername()]);
  534.         $consultation = new Consultation();  
  535.         $formConsultation $this->createForm(Consultation1Type::class, $consultation);
  536.         $formConsultation ->add('save'SubmitType::class, [
  537.             'attr' => ['class' => 'save'],
  538.         ]);
  539.         $formConsultation->handleRequest($request);
  540.         
  541.         //$formConsultation = $this->createForm(ConsultationType::class, $consultation);
  542.         if ($request->isMethod('post') && $formConsultation->isValid()) {
  543.             $entityManager->flush();
  544.             return $this->redirectToRoute('app_dashboard', [], Response::HTTP_SEE_OTHER);
  545.         }
  546.         return $this->render('dashboard/consultation.html.twig',  [
  547.             'profileDocteur' => $profileDocteur,
  548.             'currentUser' => $profileDocteurr,
  549.             'consultationForm' => $formConsultation->createView() ]);
  550.     }
  551.     /**
  552.      * @Route("dashboard/profile/{id}/edit", name="app_profileDoc_edit", methods={"GET", "POST"})
  553.      */
  554.     public function edit(PersistenceManagerRegistry $doctrine,  UserInterface $userRequest $requestDfGeneraliste $dfGeneralisteEntityManagerInterface $entityManager): Response
  555.     {
  556.         
  557.         $em=$doctrine->getManager();
  558.         //$em= $doctrine;
  559.         $medecinsRepository $em->getRepository(DfGeneraliste::class);
  560.         $user $this->getUser();
  561.         $profileDocteur $medecinsRepository->findOneBy(['email' => $user->getUsername()]);
  562.         $form $this->createForm(DfGeneraliste1Type::class, $dfGeneraliste);
  563.         $form->handleRequest($request);
  564.         if ($form->isSubmitted() && $form->isValid()) {
  565.             $entityManager->flush();
  566.             return $this->redirectToRoute('doctor_profile', [], Response::HTTP_SEE_OTHER);
  567.         }
  568.         return $this->render('dashboard/editprofile.html.twig', [
  569.             'df_generaliste' => $dfGeneraliste,
  570.             'form' => $form->createView(),
  571.             'currentUser' => $profileDocteur,
  572.         ]);
  573.     }
  574.     /**
  575.      * @Route("dashboard/listeSecretaire", name="app_listesecretaires")
  576.      */
  577.     public function secretaireprofile(PersistenceManagerRegistry $doctrineRequest $requestEntityManagerInterface $entityManagerUserInterface $user): Response
  578.     {
  579.         
  580.         $em=$doctrine->getManager();
  581.         //$em= $doctrine;
  582.         $medecinsRepository $em->getRepository(DfGeneraliste::class);
  583.         $user $this->getUser();
  584.         $profileDocteur $medecinsRepository->findOneBy(['email' => $user->getUsername()]);
  585.         $secretairesGeneralistes $entityManager
  586.         ->getRepository(SecretairesGeneraliste::class)
  587.         //->findBy(['emailDoctor' => $user->getUsername()]); 
  588.         ->findAll();
  589.         $secretairesGeneraliste = new SecretairesGeneraliste();
  590.         $formSec $this->createForm(SecretairesGeneralisteType::class, $secretairesGeneraliste);
  591.         $formSec->handleRequest($request);
  592.         $SecretaireGeneraliste = new SecretairesGeneraliste;
  593.         $formSecretaire $this->createForm(SecretairesGeneralisteType::class, $SecretaireGeneraliste);
  594.         $formSecretaire->handleRequest($request);
  595.         //$formSecretaire->add('save', SubmitType::class, ['label' => "Enregistrement"]);
  596.         
  597.         
  598.         return $this->render('dashboard/secretaires_generaliste.html.twig', [
  599.             'secretaires_generalistes' => $secretairesGeneralistes,
  600.             'form' => $formSec->createView(),
  601.             'formEnregSec' => $formSecretaire->createView(),
  602.             'currentUser' => $profileDocteur,
  603.         ]);
  604.     }
  605.     /**
  606.      * @Route("dashboard/listeRemplacent", name="app_listeremplacent")
  607.      */
  608.     public function listeRemplacent(PersistenceManagerRegistry $doctrineEntityManagerInterface $entityManagerUserInterface $user): Response
  609.     {
  610.         
  611.         $em=$doctrine->getManager();
  612.         //$em= $doctrine;
  613.         $medecinsRepository $em->getRepository(DfGeneraliste::class);
  614.         $user $this->getUser();
  615.         $RemplacantGeneraliste = new RemplacentGeneraliste;
  616.         $formRemplacant $this->createForm(RemplacentGeneralisteType::class, $RemplacantGeneraliste);
  617.         $profileDocteur $medecinsRepository->findOneBy(['email' => $user->getUsername()]);
  618.         
  619.         $remplacentGeneralistes $entityManager
  620.         ->getRepository(RemplacentGeneraliste::class)
  621.         ->findAll();
  622.         //->findBy(['emailDoctor' => $user->getUsername()]); 
  623.         
  624.         return $this->renderForm('dashboard/remplacent_generaliste.html.twig', [
  625.             'remplacent_generalistes' => $remplacentGeneralistes,
  626.             'currentUser' => $profileDocteur,
  627.             'formEnregRemp' =>$formRemplacant,
  628.         ]);
  629.     }
  630.     /**
  631.      * @Route("dashboard/{id}/remplacentEdit", name="app_remplacent_edit", methods={"GET", "POST"})
  632.      */
  633.     public function remplacentedit(Request $requestRemplacentGeneraliste $remplacentGeneralisteEntityManagerInterface $entityManagerPersistenceManagerRegistry $doctrineUserInterface $user): Response
  634.     {
  635.         $em=$doctrine->getManager();
  636.         //$em= $doctrine;
  637.         $medecinsRepository $em->getRepository(DfGeneraliste::class);
  638.         $user $this->getUser();
  639.         $profileDocteur $medecinsRepository->findOneBy(['email' => $user->getUsername()]);
  640.         
  641.         $formremp $this->createForm(RemplacentGeneralisteType::class, $remplacentGeneraliste);
  642.         $formremp->handleRequest($request);
  643.         if ($formremp->isSubmitted() && $formremp->isValid()) {
  644.             $entityManager->flush();
  645.             return $this->redirectToRoute('app_listeremplacent', [], Response::HTTP_SEE_OTHER);
  646.         }
  647.         return $this->renderForm('dashboard/remplacent_edit.html.twig', [
  648.             'remplacent_generaliste' => $remplacentGeneraliste,
  649.             'form' => $formremp,
  650.             'currentUser' => $profileDocteur,
  651.         ]);
  652.     }
  653.         /**
  654.      * @Route("dashboard/calendrierPatients", name="app_calendrierPatients")
  655.      */
  656.     public function calendarpatients(EntityManagerInterface $entityManagerUserInterface $user): Response
  657.     {
  658.      
  659.         //$medecinsRepository = $entityManager->getRepository(DfGeneraliste::class);
  660.         $medecinsRepository $entityManager->getRepository(SecretairesGeneraliste::class);
  661.         $user $this->getUser();
  662.         $profileDocteur $medecinsRepository->findOneBy(['email' => $user->getUsername()]);
  663.             
  664.       
  665.         $resPatient $entityManager->getRepository(Reservationgeneraliste::class);
  666.         $resPatientbyDoc $resPatient->findBy(['resdoc' => $profileDocteur->getIdadmin()]);
  667.         //$resPatientbyDoc = $resPatient->findBy(['resdoc' => $profileDocteur->getId()]);
  668.         $test = [];
  669.         foreach ($resPatientbyDoc as $key) {
  670.             $test[] = $key->getRespatient();
  671.         }
  672.         $patients $entityManager
  673.             ->getRepository(Patients::class)
  674.             ->findById($test);
  675.         return $this->render('dashboard/calendrierPatients.html.twig', [
  676.             'patients' => $patients,
  677.             'patientsDate' => $resPatientbyDoc,
  678.             'currentUser' => $profileDocteur,
  679.         ]);
  680.     }
  681.       /**
  682.      * @Route("dashboard/calendrierPatientsday/{day}", name="app_calendrierPatientsday", methods={"GET", "POST"} )
  683.      * 
  684.      */
  685.     public function calendarpatientsday(EntityManagerInterface $entityManagerUserInterface $userRequest $request): Response
  686.     {
  687.      
  688.         $medecinsRepository $entityManager->getRepository(DfGeneraliste::class);
  689.         $user $this->getUser();
  690.         $profileDocteur $medecinsRepository->findOneBy(['email' => $user->getUsername()]);
  691.             
  692.       
  693.         $resPatient $entityManager->getRepository(Reservationgeneraliste::class);
  694.         $resPatientbyDoc $resPatient->findBy(['resdoc' => $profileDocteur->getId(), 'dateres' =>  new \DateTime($request->attributes->get('day')) ]);
  695.         $test = [];
  696.         foreach ($resPatientbyDoc as $key) {
  697.             $test[] = $key->getRespatient();
  698.         }
  699.         $patients $entityManager
  700.             ->getRepository(Patients::class)
  701.             ->findById($test);
  702.         return $this->render('dashboard/calendrierPatientsDay.html.twig', [
  703.             'patientsday' => $patients,
  704.             'patientsDateday' => $resPatientbyDoc,
  705.             'currentUser' => $profileDocteur,
  706.         ]);
  707.     }
  708.     
  709.      /**
  710.      * @Route("dashoard/calendrierPatients/{day}/newPatient", name="app_calendrierPatientsNew", methods={"GET", "POST"})
  711.      */
  712.     public function new(Request $requestEntityManagerInterface $entityManagerUserInterface $user): Response
  713.     {
  714.         /*if ($form->isSubmitted() && $form->isValid()) {
  715.             $entityManager->persist($reservationgeneraliste);
  716.             $entityManager->flush();
  717.             return $this->redirectToRoute('app_calendrierPatients', [], Response::HTTP_SEE_OTHER);
  718.         }
  719.         return $this->renderForm('dashboard/newPatient.html.twig', [
  720.             'reservationgeneraliste' => $reservationgeneraliste,
  721.             'form' => $form,
  722.         ]);*/
  723.         $user $this->getUser();
  724.         $roleUser $user->getRoles();
  725.         if($roleUser[0]=="ROLE_ADMIN"){
  726.             $medecinsRepository $entityManager->getRepository(DfGeneraliste::class);
  727.             
  728.         
  729.             $profileDocteur $medecinsRepository->findOneBy(['email' => $user->getUsername()]);
  730.             $patient = new Patients();
  731.             $form $this->createForm(PatientsAgendaType::class, $patient);
  732.             $form->handleRequest($request);
  733.         
  734.             $patient->setPassword('12345');
  735.             $patient->setFromwho('Docteur');
  736.             $patient->setNbabsence(0);
  737.             $reservationgeneraliste = new Reservationgeneraliste();
  738.             $formRes $this->createForm(ReservationgeneralisteType::class, $reservationgeneraliste);
  739.             $formRes->handleRequest($request);
  740.             
  741.             if ($form->isSubmitted() && $form->isValid()) {
  742.                 $entityManager->persist($patient);
  743.                 $entityManager->flush();
  744.             $reservationgeneraliste->setRespatient($patient);
  745.             $reservationgeneraliste->setResdoc($profileDocteur);
  746.             //$reservationgeneraliste->setNompatientord($patient->getNom());
  747.             //$reservationgeneraliste->setPrenompatientord($patient->getPrenom());
  748.             $reservationgeneraliste->setEmaildoc($user->getUsername());
  749.             
  750.             //$reservationgeneraliste->setDatenaisspatientord(new \DateTime());
  751.             //$reservationgeneraliste->setSexepatientord($patient->getSexe());
  752.             $reservationgeneraliste->setMotifPatient("Consultation");
  753.             $reservationgeneraliste->setDateres(new \DateTime($request->attributes->get('day')));
  754.             $reservationgeneraliste->setHeureres('10:00-10:30');
  755.             
  756.             $reservationgeneraliste->setFromwho('Docteur');
  757.             $reservationgeneraliste->setreservationAnnule(0);
  758.             $reservationgeneraliste->setconsultationDone(0);
  759.             $reservationgeneraliste->setpaiementConsultation(0);
  760.                 $entityManager->persist($reservationgeneraliste);
  761.                 $entityManager->flush();
  762.                 return $this->redirectToRoute('app_calendrierPatients', [], Response::HTTP_SEE_OTHER);
  763.             }
  764.             return $this->renderForm('dashboard/newPatient.html.twig', [
  765.                 'patient' => $patient,
  766.                 'form' => $form,
  767.                 'currentUser' => $profileDocteur,
  768.             ]);
  769.         }
  770.         if($roleUser[0]=="ROLE_USER"){
  771.             $medecinsRepository $entityManager->getRepository(DfGeneraliste::class);
  772.             $secretaireRepository $entityManager->getRepository(SecretairesGeneraliste::class);
  773.  
  774.            
  775.     
  776.             $profileSecretaire $secretaireRepository->findOneBy(['email' => $user->getUsername()]);
  777.             $profileDocteur$medecinsRepository->findOneBy(['id' => $profileSecretaire->getIdadmin()]);     
  778.          
  779.             //$profileDocteur = $medecinsRepository->findOneBy(['email' => $user->getUsername()]);
  780.     
  781.     
  782.             $patient = new Patients();
  783.             $form $this->createForm(PatientsAgendaType::class, $patient);
  784.             $form->handleRequest($request);
  785.     
  786.           
  787.             $patient->setPassword('12345');
  788.             $patient->setFromwho('Secretaire');
  789.             $patient->setNbabsence(0);
  790.     
  791.     
  792.             $reservationgeneraliste = new Reservationgeneraliste();
  793.             $formRes $this->createForm(ReservationgeneralisteType::class, $reservationgeneraliste);
  794.             $formRes->handleRequest($request);
  795.     
  796.             
  797.     
  798.     
  799.     
  800.             if ($form->isSubmitted() && $form->isValid()) {
  801.                 $entityManager->persist($patient);
  802.                 $entityManager->flush();
  803.     
  804.     
  805.     
  806.                 $reservationgeneraliste->setRespatient($patient);
  807.                 $reservationgeneraliste->setResdoc($profileDocteur);
  808.         
  809.                 //$reservationgeneraliste->setNompatientord($patient->getNom());
  810.                 //$reservationgeneraliste->setPrenompatientord($patient->getPrenom());
  811.         
  812.                 $reservationgeneraliste->setEmaildoc($profileDocteur->getEmail());
  813.         
  814.                 
  815.                 //$reservationgeneraliste->setDatenaisspatientord(new \DateTime());
  816.                 //$reservationgeneraliste->setSexepatientord($patient->getSexe());
  817.                 $reservationgeneraliste->setAtcdPersoMedicaux($form->get("Atcdpersomedicaux")->getData());
  818.                 $reservationgeneraliste->setAtcdpersochirurgicaux($form->get("Atcdpersochurirgoco")->getData());
  819.                 $reservationgeneraliste->setAtcdPersoAllergieMedicaux($form->get("Atcdpersoallergimedicam")->getData());
  820.                 $reservationgeneraliste->setAtcdPersoTraitementEnCours($form->get("Atcdpersotraitencours")->getData());
  821.                 $reservationgeneraliste->setAtcdFamilleParentalMedicaux($form->get("Atcdfammileparentalmedico")->getData());
  822.                 $reservationgeneraliste->setAtcdFamilleParentalChirurgicaux($form->get("Atcdfammileparentalchirurgico")->getData());
  823.                 $reservationgeneraliste->setAtcdFamilleMaternelMedicaux($form->get("Atcdfammilematrnalmedico")->getData());
  824.                 $reservationgeneraliste->setAtcdFamilleMaternelChirurgicaux($form->get("Atcdfammilematrnalchirurgico")->getData());
  825.                 $reservationgeneraliste->setAtcdFamilleMaladiesCronique($form->get("Atcdfammilemaladicronic")->getData());
  826.         
  827.                 $reservationgeneraliste->setMotifPatient("Consultation");
  828.         
  829.                 $reservationgeneraliste->setDateres(new \DateTime($request->attributes->get('day')));
  830.                 $reservationgeneraliste->setHeureres('10:00-10:30');
  831.                 
  832.                 
  833.                 $reservationgeneraliste->setFromwho('Secretaire');
  834.                 
  835.                 $reservationgeneraliste->setreservationAnnule(0);
  836.                 $reservationgeneraliste->setconsultationDone(0);
  837.                 $reservationgeneraliste->setpaiementConsultation(0);
  838.         
  839.                 $entityManager->persist($reservationgeneraliste);
  840.                 $entityManager->flush();
  841.     
  842.                 return $this->redirectToRoute('app_calendrierPatients', [], Response::HTTP_SEE_OTHER);
  843.             }
  844.     
  845.             return $this->renderForm('dashboard/newPatient.html.twig', [
  846.                 'patient' => $patient,
  847.                 'formSecretaireReservation' => $form,
  848.                 'formSecretaireReservation2' => $formRes,
  849.                 'currentUser' => $profileSecretaire,
  850.             ]);
  851.             }
  852.     }
  853.     /**
  854.      * @Route("dashboard/nomenclature", name="app_listeMedicament")
  855.      */
  856.     public function listeMedicament(PersistenceManagerRegistry $doctrineEntityManagerInterface $entityManagerUserInterface $userRequest $request): Response
  857.     {
  858.         $em=$doctrine->getManager();
  859.         //$em= $doctrine;
  860.         $medecinsRepository $em->getRepository(DfGeneraliste::class);
  861.         $user $this->getUser();
  862.         $profileDocteur $medecinsRepository->findOneBy(['email' => $user->getUsername()]);
  863.         
  864.         $nomenclature2023s $entityManager
  865.             ->getRepository(Nomenclature2023::class)
  866.             ->findBy([], ['dci' => 'ASC']);
  867.             //->findAll();
  868.         /*$nomenclature2023s = $paginator->paginate(
  869.             $nomenclature2023s,
  870.             $request->query->getInt('page', 1),
  871.             13
  872.         );*/
  873.         return $this->render('dashboard/nomenclature2023.html.twig', [
  874.             'nomenclature2023s' => $nomenclature2023s,
  875.             'currentUser' => $profileDocteur,
  876.         ]);
  877.     }
  878.      /**
  879.      * @Route("dashboard/eordonance", name="app_e-ordonance")
  880.      */
  881.     public function eordonance(PersistenceManagerRegistry $doctrineEntityManagerInterface $entityManagerUserInterface $user): Response
  882.     {
  883.         $em=$doctrine->getManager();
  884.         //$em= $doctrine;
  885.         $medecinsRepository $em->getRepository(DfGeneraliste::class);
  886.         $user $this->getUser();
  887.         $profileDocteur $medecinsRepository->findOneBy(['email' => $user->getUsername()]);
  888.         $formMed $this->createFormBuilder()
  889.                 /*->add('medicament', EntityType::class, [
  890.                     // looks for choices from this entity
  891.                     'class' => Nomenclature2023Type::class,
  892.                 
  893.                     // uses the User.username property as the visible option string
  894.                     'choice_label' => 'dci',
  895.                 
  896.                     // used to render a select box, check boxes or radios
  897.                     // 'multiple' => true,
  898.                     // 'expanded' => true,
  899.                 ])*/ 
  900.                 ->add('medicament'TextType::class,  array('property_path' => 'userinput'))
  901.                 //->add('saveMedi',SubmitType::class, ['label'=>"Ajouter"])
  902.                 ->getForm();
  903.             $nomenclature2023s $entityManager
  904.                 ->getRepository(Nomenclature2023::class)
  905.                 ->findAll();
  906.                 
  907.   
  908.         return $this->render('dashboard/eordonance.html.twig', [
  909.             'currentUser' => $profileDocteur,
  910.             'medform' =>$formMed->createView(),
  911.             'nomenclature2023' => $nomenclature2023s,
  912.         ]);
  913.     }
  914.          /**
  915.      * @Route("dashboard/eordonanceconsultation", name="app_e-ordonanceconsultation")
  916.      */
  917.     public function eordonanceConsultation(PersistenceManagerRegistry $doctrineEntityManagerInterface $entityManagerUserInterface $user): Response
  918.     {
  919.         $em=$doctrine->getManager();
  920.         //$em= $doctrine;
  921.         $medecinsRepository $em->getRepository(DfGeneraliste::class);
  922.         $user $this->getUser();
  923.         $profileDocteur $medecinsRepository->findOneBy(['email' => $user->getUsername()]);
  924.         $resPatient $entityManager->getRepository(Reservationgeneraliste::class);
  925.         $resPatientbyDoc $resPatient->findBy(['resdoc' => $profileDocteur]);
  926.         $test = [];
  927.         foreach ($resPatientbyDoc as $key) {
  928.             $test[] = $key->getRespatient();
  929.         }
  930.         $patients $entityManager
  931.             ->getRepository(Patients::class)
  932.             ->findById($test);
  933.         $formMed $this->createFormBuilder()
  934.                 /*->add('medicament', EntityType::class, [
  935.                     // looks for choices from this entity
  936.                     'class' => Nomenclature2023Type::class,
  937.                 
  938.                     // uses the User.username property as the visible option string
  939.                     'choice_label' => 'dci',
  940.                 
  941.                     // used to render a select box, check boxes or radios
  942.                     // 'multiple' => true,
  943.                     // 'expanded' => true,
  944.                 ])*/ 
  945.                 ->add('medicament'TextType::class,  array('property_path' => 'userinput'))
  946.                 //->add('saveMedi',SubmitType::class, ['label'=>"Ajouter"])
  947.                 ->getForm();
  948.             $nomenclature2023s $entityManager
  949.                 ->getRepository(Nomenclature2023::class)
  950.                 ->findAll();
  951.                
  952.                 
  953.   
  954.         return $this->render('dashboard/eordonanceconsultation.html.twig', [
  955.             'currentUser' => $profileDocteur,
  956.             'medform' =>$formMed->createView(),
  957.             'nomenclature2023' => $nomenclature2023s,
  958.             'patients' => $patients,
  959.         ]);
  960.     }
  961.       
  962.     /**
  963.      * @Route("dashboard/calendrierTravail", name="docotr_calendrier_travail")
  964.      */
  965.     public function calendartravail(PersistenceManagerRegistry $doctrine,  UserInterface $user): Response
  966.     {
  967.         $em=$doctrine->getManager();
  968.         //$em= $doctrine;
  969.         
  970.         $user $this->getUser();
  971.         $roleUser $user->getRoles();
  972.         if($roleUser[0]=="ROLE_ADMIN"){
  973.         $medecinsRepository $em->getRepository(DfGeneraliste::class);
  974.         $profileDocteur $medecinsRepository->findOneBy(['email' => $user->getUsername()]);
  975.         $profileDocteurs $medecinsRepository->findBy(['email' => $user->getUsername()]);
  976.         
  977.         return $this->render('dashboard/calendrierTravail.html.twig', [
  978.             
  979.             'currentUser' => $profileDocteur,
  980.             'profileDocteur' => $profileDocteurs,
  981.         ]);
  982.         }
  983.         if($roleUser[0]=="ROLE_USER"){
  984.             //need DQL
  985.             $medecinsRepository $em->getRepository(DfGeneraliste::class);
  986.             $secretaireRepository $em->getRepository(SecretairesGeneraliste::class);
  987.             $profileSecretaire $secretaireRepository->findOneBy(['email' => $user->getUsername()]);
  988.             $profileDocteur$medecinsRepository->findBy(['id' => $profileSecretaire->getIdadmin()]);     
  989.           
  990.     
  991.             return $this->render('dashboard/calendrierTravail.html.twig', [
  992.                 
  993.                 'currentUser' => $profileSecretaire,
  994.                 'profileDocteur' => $profileDocteur,
  995.             ]);
  996.             }
  997.     }
  998.     
  999.      /**
  1000.      * @Route("dashboard/listePatients", name="docotr_liste_patients")
  1001.      */
  1002.     public function listPatients(EntityManagerInterface $entityManagerUserInterface $user): Response
  1003.     {
  1004.         
  1005.         $user $this->getUser();
  1006.         $roleUser $user->getRoles();
  1007.         if($roleUser[0]=="ROLE_ADMIN"){
  1008.         $medecinsRepository $entityManager->getRepository(DfGeneraliste::class);
  1009.         $profileDocteur $medecinsRepository->findOneBy(['email' => $user->getUsername()]);
  1010.             
  1011.       
  1012.         $resPatient $entityManager->getRepository(Reservationgeneraliste::class);
  1013.         $resPatientbyDoc $resPatient->findBy(['resdoc' => $profileDocteur->getId()]);
  1014.         
  1015.         $test = [];
  1016.         foreach ($resPatientbyDoc as $key) {
  1017.             $test[] = $key->getRespatient();
  1018.         }
  1019.         $patients $entityManager
  1020.             ->getRepository(Patients::class)
  1021.             ->findById($test);
  1022.             //->findBy(['id' => 4]);
  1023.             //->findAll();
  1024.         return $this->render('dashboard/patients.html.twig', [
  1025.             //'patients' => $patients,//before modification
  1026.             'patients' => $patients//$resPatientbyDoc,
  1027.             'currentUser' => $profileDocteur,
  1028.         ]);
  1029.         }
  1030.         if($roleUser[0]=="ROLE_USER"){
  1031.             
  1032.             $secretaireRepository $entityManager->getRepository(SecretairesGeneraliste::class);
  1033.             $profileSecretaire $secretaireRepository->findOneBy(['email' => $user->getUsername()]);
  1034.             
  1035.             $medecinsRepository $entityManager->getRepository(DfGeneraliste::class);
  1036.             $profileDocteur$medecinsRepository->findOneBy(['id' => $profileSecretaire->getIdadmin()]);     
  1037.         
  1038.           
  1039.             $resPatient $entityManager->getRepository(Reservationgeneraliste::class);
  1040.             $resPatientbyDoc $resPatient->findBy(['resdoc' => $profileSecretaire->getIdadmin()]);
  1041.             
  1042.             $test = [];
  1043.             foreach ($resPatientbyDoc as $key) {
  1044.                 $test[] = $key->getRespatient();
  1045.             }
  1046.     
  1047.             $patients $entityManager
  1048.                 ->getRepository(Patients::class)
  1049.                 ->findById($test);
  1050.                 //->findBy(['id' => 4]);
  1051.                 //->findAll();
  1052.     
  1053.             return $this->render('dashboard/patients.html.twig', [
  1054.                 //'patients' => $patients,//before modification
  1055.                 'patients' => $patients//$resPatientbyDoc,
  1056.                 'currentUser' => $profileSecretaire,
  1057.                 'docteurUser' => $profileDocteur,
  1058.             ]);
  1059.             }
  1060.     }
  1061.      /**
  1062.      * @Route("dashboard/listePatientsSelect", name="docotr_liste_patientsSelect")
  1063.      */
  1064.     public function listPatientsSelect(EntityManagerInterface $entityManagerUserInterface $user): Response
  1065.     {
  1066.         $medecinsRepository $entityManager->getRepository(DfGeneraliste::class);
  1067.         $user $this->getUser();
  1068.         $profileDocteur $medecinsRepository->findOneBy(['email' => $user->getUsername()]);
  1069.             
  1070.       
  1071.         $resPatient $entityManager->getRepository(Reservationgeneraliste::class);
  1072.         $resPatientbyDoc $resPatient->findBy(['resdoc' => $profileDocteur->getId()]);
  1073.         
  1074.         $test = [];
  1075.         foreach ($resPatientbyDoc as $key) {
  1076.             $test[] = $key->getRespatient();
  1077.         }
  1078.         $patients $entityManager
  1079.             ->getRepository(Patients::class)
  1080.             ->findById($test);
  1081.             //->findBy(['id' => 4]);
  1082.             //->findAll();
  1083.         return $this->render('dashboard/patientsSelect.html.twig', [
  1084.             //'patients' => $patients,//before modification
  1085.             'patients' => $patients//$resPatientbyDoc,
  1086.             'currentUser' => $profileDocteur,
  1087.         ]);
  1088.     }
  1089.     /**
  1090.      * @Route("dashboard/registerSecretaire", name="app_registration_secretaire")
  1091.      */
  1092.     public function registerSecretaire(Request $requestPersistenceManagerRegistry $doctrine,  UserInterface $userUserPasswordEncoderInterface $passEncoder): Response
  1093.     {
  1094.         $SecretaireGeneraliste = new SecretairesGeneraliste;
  1095.         $formSecretaire $this->createForm(SecretairesGeneralisteType::class, $SecretaireGeneraliste);
  1096.         $formSecretaire->add('save'SubmitType::class, ['label' => "Enregistrement"]);
  1097.         $formSecretaire->handleRequest($request);
  1098.         $em $doctrine->getManager();
  1099.             $medecinsRepository $em->getRepository(DfGeneraliste::class);
  1100.            
  1101.             $profileDocteur $medecinsRepository->findOneBy(['email' => $user->getUsername()]);
  1102.         if ($request->isMethod('post') && $formSecretaire->isValid()) {
  1103.             //return new JsonResponse($request->request->all());
  1104.             //$em=$doctrine->getManager();
  1105.             //$data=$form->getData();
  1106.             $user $this->getUser();
  1107.             //$em= $doctrine;
  1108.             
  1109.             $userSecretaire = new SecretairesGeneraliste;
  1110.             $userSecretaire->setNamesecretaire($SecretaireGeneraliste->getNamesecretaire());
  1111.             $userSecretaire->setEmail($SecretaireGeneraliste->getEmail());
  1112.             //$userSecretaire->setPassword($SecretaireGeneraliste->getPassword());
  1113.             $userSecretaire->setPassword($passEncoder->encodePassword($user$SecretaireGeneraliste->getPassword()));
  1114.             $userSecretaire->setEmailDoctor($user->getUsername());
  1115.            
  1116.             $userSecretaire->setIdadmin($profileDocteur);
  1117.             $userSecretaire->setRoles(["ROLE_USER"]);
  1118.             $em $this->getDoctrine()->getManager();
  1119.             $em->persist($userSecretaire);
  1120.             $em->flush();
  1121.             return $this->redirect($this->generateUrl('app_listesecretaires'));
  1122.         }
  1123.         return $this->render('dashboard/registerSecretaire.html.twig', [
  1124.             'form_secretaire' => $formSecretaire->createView(),
  1125.             'currentUser' => $profileDocteur,
  1126.         ]);
  1127.     }
  1128.      /**
  1129.      * @Route("dashboard/registerRemplacant", name="app_registration_remplacant")
  1130.      */
  1131.     public function registerRemplacant(Request $requestPersistenceManagerRegistry $doctrine,  UserInterface $userUserPasswordEncoderInterface $passEncoder): Response
  1132.     {
  1133.         $RemplacantGeneraliste = new RemplacentGeneraliste;
  1134.         $formRemplacant $this->createForm(RemplacentGeneralisteType::class, $RemplacantGeneraliste);
  1135.         $formRemplacant->add('save'SubmitType::class, ['label' => "Enregistrement"]);
  1136.         $formRemplacant->handleRequest($request);
  1137.         $em $doctrine->getManager();
  1138.             $medecinsRepository $em->getRepository(DfGeneraliste::class);
  1139.            
  1140.             $profileDocteur $medecinsRepository->findOneBy(['email' => $user->getUsername()]);
  1141.         if ($request->isMethod('post') && $formRemplacant->isValid()) {
  1142.             //return new JsonResponse($request->request->all());
  1143.             //$em=$doctrine->getManager();
  1144.             //$data=$form->getData();
  1145.             $user $this->getUser();
  1146.             //$em= $doctrine;
  1147.             
  1148.             $userRemplacant = new RemplacentGeneraliste;
  1149.             $userRemplacant->setNameremplacent($RemplacantGeneraliste->getNameRemplacent());
  1150.             $userRemplacant->setEmail($RemplacantGeneraliste->getEmail());
  1151.             //$userRemplacant->setPassword($RemplacantGeneraliste->getPassword());
  1152.             $userRemplacant->setPassword($passEncoder->encodePassword($user$RemplacantGeneraliste->getPassword()));
  1153.             $userRemplacant->setEmailDoctor($user->getUsername());
  1154.            
  1155.             $userRemplacant->setIdadmin($profileDocteur);
  1156.             $userRemplacant->setRoles(["ROLE_USER"]);
  1157.             $em $this->getDoctrine()->getManager();
  1158.             $em->persist($userRemplacant);
  1159.             $em->flush();
  1160.             $user = new User;
  1161.             $user->setUsername($RemplacantGeneraliste->getEmail());
  1162.             $user->setPassword($passEncoder->encodePassword($user$RemplacantGeneraliste->getPassword()));
  1163.             $user->setRoles("ROLE_REMPLACANT");
  1164.             $em->persist($user);
  1165.             $em->flush();
  1166.             return $this->redirect($this->generateUrl('app_listeremplacent'));
  1167.         }
  1168.         return $this->render('dashboard/registerRemplacant.html.twig', [
  1169.             'form_remplacant' => $formRemplacant->createView(),
  1170.             'currentUser' => $profileDocteur,
  1171.         ]);
  1172.     }
  1173.     /**
  1174.      * @Route("dashboard/{id}/editCalendrierTravail", name="app_df_generaliste_editxx", methods={"GET", "POST"})
  1175.      */
  1176.     public function editxx(Request $requestDfGeneraliste $dfGeneralisteEntityManagerInterface $entityManager): Response
  1177.     {
  1178.         $form $this->createForm(DfGeneraliste11Type::class, $dfGeneraliste);
  1179.         $form->add('ReposSamedi'CheckboxType::class, [
  1180.             'mapped' => false,
  1181.             'label'    => ' ',
  1182.             'required' => false,
  1183.         ]);
  1184.         $form->add('SamedistartTime'TimeType::class, [
  1185.             'mapped' => false,
  1186.             'input'  => 'datetime',
  1187.             'widget' => 'choice',
  1188.             'minutes' => [0153045],
  1189.             'hours' => [67891011],
  1190.         ]);
  1191.        
  1192.         $form->add('SamediendTime'TimeType::class, [
  1193.             'mapped' => false,
  1194.             'input'  => 'datetime',
  1195.             'widget' => 'choice',
  1196.             'minutes' => [0153045],
  1197.             'hours' => [151617181920],
  1198.         ]);
  1199.         $form->add('ReposDimanche'CheckboxType::class, [
  1200.             'mapped' => false,
  1201.             'label'    => ' ',
  1202.             'required' => false,
  1203.         ]);
  1204.         $form->add('DimanchestartTime'TimeType::class, [
  1205.             'mapped' => false,
  1206.             'input'  => 'datetime',
  1207.             'widget' => 'choice',
  1208.             'minutes' => [0153045],
  1209.             'hours' => [67891011],
  1210.         ]);
  1211.        
  1212.         $form->add('DimancheendTime'TimeType::class, [
  1213.             'mapped' => false,
  1214.             'input'  => 'datetime',
  1215.             'widget' => 'choice',
  1216.             'minutes' => [0153045],
  1217.             'hours' => [151617181920],
  1218.         ]);
  1219.         $form->add('ReposLundi'CheckboxType::class, [
  1220.             'mapped' => false,
  1221.             'label'    => ' ',
  1222.             'required' => false,
  1223.         ]);
  1224.         $form->add('LundistartTime'TimeType::class, [
  1225.             'mapped' => false,
  1226.             'input'  => 'datetime',
  1227.             'widget' => 'choice',
  1228.             'minutes' => [0153045],
  1229.             'hours' => [67891011],
  1230.         ]);
  1231.        
  1232.         $form->add('LundiendTime'TimeType::class, [
  1233.             'mapped' => false,
  1234.             'input'  => 'datetime',
  1235.             'widget' => 'choice',
  1236.             'minutes' => [0153045],
  1237.             'hours' => [151617181920],
  1238.         ]);
  1239.         $form->add('ReposMardi'CheckboxType::class, [
  1240.             'mapped' => false,
  1241.             'label'    => ' ',
  1242.             'required' => false,
  1243.         ]);
  1244.         $form->add('MardistartTime'TimeType::class, [
  1245.             'mapped' => false,
  1246.             'input'  => 'datetime',
  1247.             'widget' => 'choice',
  1248.             'minutes' => [0153045],
  1249.             'hours' => [67891011],
  1250.         ]);
  1251.        
  1252.         $form->add('MardiendTime'TimeType::class, [
  1253.             'mapped' => false,
  1254.             'input'  => 'datetime',
  1255.             'widget' => 'choice',
  1256.             'minutes' => [0153045],
  1257.             'hours' => [151617181920],
  1258.         ]);
  1259.         $form->add('ReposMercredi'CheckboxType::class, [
  1260.             'mapped' => false,
  1261.             'label'    => ' ',
  1262.             'required' => false,
  1263.         ]);
  1264.         $form->add('MercredistartTime'TimeType::class, [
  1265.             'mapped' => false,
  1266.             'input'  => 'datetime',
  1267.             'widget' => 'choice',
  1268.             'minutes' => [0153045],
  1269.             'hours' => [67891011],
  1270.         ]);
  1271.        
  1272.         $form->add('MercrediendTime'TimeType::class, [
  1273.             'mapped' => false,
  1274.             'input'  => 'datetime',
  1275.             'widget' => 'choice',
  1276.             'minutes' => [0153045],
  1277.             'hours' => [151617181920],
  1278.         ]);
  1279.         $form->add('ReposJeudi'CheckboxType::class, [
  1280.             'mapped' => false,
  1281.             'label'    => ' ',
  1282.             'required' => false,
  1283.         ]);
  1284.         $form->add('JeudistartTime'TimeType::class, [
  1285.             'mapped' => false,
  1286.             'input'  => 'datetime',
  1287.             'widget' => 'choice',
  1288.             'minutes' => [0153045],
  1289.             'hours' => [67891011],
  1290.         ]);
  1291.        
  1292.         $form->add('JeudiendTime'TimeType::class, [
  1293.             'mapped' => false,
  1294.             'input'  => 'datetime',
  1295.             'widget' => 'choice',
  1296.             'minutes' => [0153045],
  1297.             'hours' => [151617181920],
  1298.         ]);
  1299.         $form->add('ReposVendredi'CheckboxType::class, [
  1300.             'mapped' => false,
  1301.             'label'    => ' ',
  1302.             'required' => false,
  1303.         ]);
  1304.         $form->add('VendredistartTime'TimeType::class, [
  1305.             'mapped' => false,
  1306.             'input'  => 'datetime',
  1307.             'widget' => 'choice',
  1308.             'minutes' => [0153045],
  1309.             'hours' => [67891011],
  1310.         ]);
  1311.        
  1312.         $form->add('VendrediendTime'TimeType::class, [
  1313.             'mapped' => false,
  1314.             'input'  => 'datetime',
  1315.             'widget' => 'choice',
  1316.             'minutes' => [0153045],
  1317.             'hours' => [151617181920],
  1318.         ]);
  1319.         $form->handleRequest($request);
  1320.         if ($form->isSubmitted() && $form->isValid()) {
  1321.             $entityManager->flush();
  1322.             return $this->redirectToRoute('docotr_calendrier_travail', [], Response::HTTP_SEE_OTHER);
  1323.         }
  1324.         return $this->renderForm('dashboard/editCalendrierTravail.html.twig', [
  1325.             'df_generaliste' => $dfGeneraliste,
  1326.             //'form' => $form,
  1327.             'registrationMedecinG' => $form,
  1328.         ]);
  1329.     }
  1330.      /**
  1331.      * @Route("dashboard/{id}/editPatient", name="infopatients_edit", methods={"GET", "POST"})
  1332.      */
  1333.     public function editPatient(Request $requestPatients $reservationgeneralisteEntityManagerInterface $entityManager): Response
  1334.     {
  1335.         $form $this->createForm(PatientsInfoType::class, $reservationgeneraliste);
  1336.         $form->handleRequest($request);
  1337.         if ($form->isSubmitted() && $form->isValid()) {
  1338.             $entityManager->flush();
  1339.             return $this->redirectToRoute('docotr_liste_patients', [], Response::HTTP_SEE_OTHER);
  1340.         }
  1341.         return $this->renderForm('dashboard/editPatient.html.twig', [
  1342.             'reservationgeneraliste' => $reservationgeneraliste,
  1343.             'form' => $form,
  1344.         ]);
  1345.     }
  1346.     /**
  1347.      * @Route("dashboard/{id}/editPatientReservation", name="infopatients_edit_reservation_dashboard", methods={"GET", "POST"})
  1348.      */
  1349.     public function editPatientReservationDashboard(Request $requestPatients $reservationgeneralisteEntityManagerInterface $entityManager): Response
  1350.     {
  1351.         $reservationgeneralistem $entityManager->getRepository(Reservationgeneraliste::class); 
  1352.         $currentpatient $reservationgeneralistem->findOneBy(['respatient'=>$reservationgeneraliste->getId()]);
  1353.         
  1354.         
  1355.         $form $this->createForm(PatientsAgendaType::class, $reservationgeneraliste);
  1356.         
  1357.         //$currentpatient = $reservationgeneralistem->findOneBy(['ResPatient'=>$reservationgeneraliste->getId()]);
  1358.         /*$form->add('RDVtime', ChoiceType::class, [
  1359.             'mapped' => false,
  1360.             'choices'  => [
  1361.                 '10:30-11:00' => '10:30-11:00',
  1362.                 '11:00-11:30' => '11:00-11:30',
  1363.                 '11:30-12:00' => '11:30-12:00',
  1364.                
  1365.             ],
  1366.         ]);*/
  1367.         $form->get('Atcdpersomedicaux')->setData($currentpatient->getAtcdPersoMedicaux());
  1368.         $form->get('Atcdpersochurirgoco')->setData($currentpatient->getAtcdpersochirurgicaux());
  1369.         $form->get('Atcdpersoallergimedicam')->setData($currentpatient->getAtcdPersoAllergieMedicaux());
  1370.         $form->get('Atcdpersotraitencours')->setData($currentpatient->getAtcdPersoTraitementEnCours());
  1371.         $form->get('Atcdfammileparentalmedico')->setData($currentpatient->getAtcdFamilleParentalMedicaux());
  1372.         $form->get('Atcdfammileparentalchirurgico')->setData($currentpatient->getAtcdFamilleParentalChirurgicaux());
  1373.         $form->get('Atcdfammilematrnalmedico')->setData($currentpatient->getAtcdFamilleMaternelMedicaux());
  1374.         $form->get('Atcdfammilematrnalchirurgico')->setData($currentpatient->getAtcdFamilleMaternelChirurgicaux());
  1375.         $form->get('Atcdfammilemaladicronic')->setData($currentpatient->getAtcdFamilleMaladiesCronique());
  1376.         $form->get('Motif')->setData($currentpatient->getMotifpatient());
  1377.         $form->handleRequest($request);
  1378.         if ($form->isSubmitted() && $form->isValid()) {
  1379.             $currentpatient->setAtcdPersoMedicaux($form->get("Atcdpersomedicaux")->getData());
  1380.             $currentpatient->setAtcdpersochirurgicaux($form->get("Atcdpersochurirgoco")->getData());
  1381.             $currentpatient->setAtcdPersoAllergieMedicaux($form->get("Atcdpersoallergimedicam")->getData());
  1382.             $currentpatient->setAtcdPersoTraitementEnCours($form->get("Atcdpersotraitencours")->getData());
  1383.             $currentpatient->setAtcdFamilleParentalMedicaux($form->get("Atcdfammileparentalmedico")->getData());
  1384.             $currentpatient->setAtcdFamilleParentalChirurgicaux($form->get("Atcdfammileparentalchirurgico")->getData());
  1385.             $currentpatient->setAtcdFamilleMaternelMedicaux($form->get("Atcdfammilematrnalmedico")->getData());
  1386.             $currentpatient->setAtcdFamilleMaternelChirurgicaux($form->get("Atcdfammilematrnalchirurgico")->getData());
  1387.             $currentpatient->setAtcdFamilleMaladiesCronique($form->get("Atcdfammilemaladicronic")->getData());
  1388.     
  1389.             $currentpatient->setMotifPatient($form->get("Motif")->getData());
  1390.     
  1391.             $entityManager->flush();
  1392.             $entityManager->persist($currentpatient);
  1393.             $entityManager->flush();
  1394.             return $this->redirectToRoute('app_calendrierPatients', [], Response::HTTP_SEE_OTHER);
  1395.         }
  1396.         return $this->renderForm('dashboard/editPatientReservation.html.twig', [
  1397.             'reservationgeneraliste' => $reservationgeneraliste,
  1398.             'form' => $form,
  1399.         ]);
  1400.     }
  1401.     
  1402.     /**
  1403.      * @Route("dashboard/{id}/editPatientReservation", name="infopatients_edit_reservation", methods={"GET", "POST"})
  1404.      */
  1405.     public function editPatientReservation(Request $requestPatients $reservationgeneralisteEntityManagerInterface $entityManager): Response
  1406.     {
  1407.         $form $this->createForm(PatientsAgendaType::class, $reservationgeneraliste);
  1408.         
  1409.         /*$form->add('RDVtime', ChoiceType::class, [
  1410.             'mapped' => false,
  1411.             'choices'  => [
  1412.                 '10:30-11:00' => '10:30-11:00',
  1413.                 '11:00-11:30' => '11:00-11:30',
  1414.                 '11:30-12:00' => '11:30-12:00',
  1415.                
  1416.             ],
  1417.         ]);
  1418.         $form->add('Motif', TextType::class, [
  1419.             'mapped' => false,
  1420.         ]);*/
  1421.         $form->handleRequest($request);
  1422.         if ($form->isSubmitted() && $form->isValid()) {
  1423.             $entityManager->flush();
  1424.             return $this->redirectToRoute('app_calendrierPatients', [], Response::HTTP_SEE_OTHER);
  1425.         }
  1426.         return $this->renderForm('dashboard/editPatientReservation.html.twig', [
  1427.             'reservationgeneraliste' => $reservationgeneraliste,
  1428.             'form' => $form,
  1429.         ]);
  1430.     }
  1431.     /**
  1432.      * @Route("dashboard/ordonance/{[patient]}", name="app_ordonancePatient", methods={"GET", "POST"})
  1433.      */
  1434.     public function inordonancePatient(PersistenceManagerRegistry $doctrineEntityManagerInterface $entityManagerUserInterface $userRequest $request): Response
  1435.     {
  1436.         $em=$doctrine->getManager();
  1437.         //$em= $doctrine;
  1438.         $medecinsRepository $em->getRepository(DfGeneraliste::class);
  1439.         $user $this->getUser();
  1440.         $profileDocteur $medecinsRepository->findOneBy(['email' => $user->getUsername()]);
  1441.    
  1442.     
  1443.         $data = [
  1444.             //'imageSrc'  => $this->imageToBase64($this->getParameter('kernel.project_dir') . '/public/img/profileDr.png'),
  1445.             'name'         => $profileDocteur->getNomMedecinFr(),
  1446.             'address'      => $profileDocteur->getRegion(),
  1447.             'mobileNumber' => $profileDocteur->getTelephone1(),
  1448.             'mobileNumber2' => $profileDocteur->getTelephone2(),
  1449.             'mobileNumber3' => $profileDocteur->getTelephone3(),
  1450.             'patient'        => $request->get('patient')
  1451.         ];
  1452.         $html =  $this->renderView('ordonance_patient/index.html.twig'$data);
  1453.         $dompdf = new Dompdf();
  1454.         $dompdf->loadHtml($html);
  1455.         $dompdf->render();
  1456.         return new Response (
  1457.             $dompdf->stream('resume', ["Attachment" => false]),
  1458.             Response::HTTP_OK,
  1459.             ['Content-Type' => 'application/pdf']
  1460.         );
  1461.         return $this->render('ordonance_patient/index.html.twig', [
  1462.             'controller_name' => 'OrdonancePatientController',
  1463.             
  1464.         ]);
  1465.         
  1466.     }
  1467.     private function imageToBase64($path) {
  1468.         $path $path;
  1469.         $type pathinfo($pathPATHINFO_EXTENSION);
  1470.         $data file_get_contents($path);
  1471.         $base64 'data:image/' $type ';base64,' base64_encode($data);
  1472.         return $base64;
  1473.     }
  1474.     
  1475.      /**
  1476.      * @Route("Dashboard/listeSecretaire/{id}/edit", name="app_secretaires_generaliste_d_edit", methods={"GET", "POST"})
  1477.      */
  1478.     public function editsecretaire(PersistenceManagerRegistry $doctrine,  UserInterface $user,Request $requestSecretairesGeneraliste $secretairesGeneralisteEntityManagerInterface $entityManager): Response
  1479.     {
  1480.         $form $this->createForm(SecretairesGeneraliste2Type::class, $secretairesGeneraliste);
  1481.         $form->handleRequest($request);
  1482.         $em $doctrine->getManager();
  1483.         $medecinsRepository $em->getRepository(DfGeneraliste::class);
  1484.            
  1485.         $profileDocteur $medecinsRepository->findOneBy(['email' => $user->getUsername()]);
  1486.         if ($form->isSubmitted() && $form->isValid()) {
  1487.             $entityManager->flush();
  1488.             return $this->redirectToRoute('app_listesecretaires', [], Response::HTTP_SEE_OTHER);
  1489.         }
  1490.         return $this->renderForm('dashboard/secretaires_generaliste_edit.html.twig', [
  1491.             'secretaires_generaliste' => $secretairesGeneraliste,
  1492.             'form' => $form,
  1493.             'currentUser' => $profileDocteur,
  1494.         ]);
  1495.     }
  1496.     /**
  1497.      * @Route("dashboard/listeRemplacent/{id}", name="app_remplacent_generaliste_d_delete", methods={"POST"})
  1498.      */
  1499.     public function deleteRemplacent(Request $requestRemplacentGeneraliste $remplacentGeneralisteEntityManagerInterface $entityManager): Response
  1500.     {
  1501.         if ($this->isCsrfTokenValid('delete'.$remplacentGeneraliste->getId(), $request->request->get('_token'))) {
  1502.             $entityManager->remove($remplacentGeneraliste);
  1503.             $entityManager->flush();
  1504.         }
  1505.         return $this->redirectToRoute('app_listeremplacent', [], Response::HTTP_SEE_OTHER);
  1506.     }
  1507.      /**
  1508.      * @Route("/{id}", name="app_patients_delete_Calendar", methods={"POST"})
  1509.      */
  1510.     public function deletePatientFromCalendreir(Request $requestPatients $patientEntityManagerInterface $entityManager): Response
  1511.     {
  1512.         if ($this->isCsrfTokenValid('delete'.$patient->getId(), $request->request->get('_token'))) {
  1513.             $entityManager->remove($patient);
  1514.             $entityManager->flush();
  1515.         }
  1516.         return $this->redirectToRoute('app_calendrierPatients', [], Response::HTTP_SEE_OTHER);
  1517.     }
  1518.     /**
  1519.      * @Route("dashboard/listesecretaire/{id}", name="app_secretaires_generaliste_delete", methods={"POST"})
  1520.      */
  1521.     public function delete(Request $requestSecretairesGeneraliste $secretairesGeneralisteEntityManagerInterface $entityManager): Response
  1522.     {
  1523.         if ($this->isCsrfTokenValid('delete'.$secretairesGeneraliste->getId(), $request->request->get('_token'))) {
  1524.             $entityManager->remove($secretairesGeneraliste);
  1525.             $entityManager->flush();
  1526.         }
  1527.         return $this->redirectToRoute('app_listesecretaires', [], Response::HTTP_SEE_OTHER);
  1528.     }
  1529.  
  1530. }
  1531.