<?php
namespace App\Controller;
use App\Entity\Appel;
use App\Entity\AppelStatut;
use App\Entity\AppelSujet;
use App\Entity\Apprenant;
use App\Entity\Compagne;
use App\Entity\Incident;
use App\Entity\Rdv;
use App\Entity\Tache;
use App\Entity\Utilisateur;
use App\Form\AppelType;
use App\Service\InwiApi;
use App\Service\NewDoceboApi;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
/**
* @Route("crm")
*/
class CrmController extends AbstractController
{
/**
* @Route("/index/OP", name="crm_index")
*/
public function index()
{
$em = $this->getDoctrine()->getManager();
$user = $this->getUser();
$appelRepo = $this->getDoctrine()->getRepository(Appel::class);
$rdvRepo = $this->getDoctrine()->getRepository(Rdv::class);
$dateDebutRdv = date('Y-m-d', strtotime('-1 days')) . "T00:00";
$listRdvs = $rdvRepo->findAllMyRdvByDate($user, $dateDebutRdv);
$dateDebut = date('Y-m-d');
$dateFin = date('Y-m-d');
$compagneRepo = $em->getRepository(Compagne::class);
$compagneActive = $compagneRepo->getActivesCampagnes();
foreach ($compagneActive as $compagne) {
$objectif = 0;
$ValideNumbers = $this->getDoctrine()->getRepository(Apprenant::class)->findApprenantsValidesByCampagneTwo($compagne);
$objectif = count($ValideNumbers);
$compagne->setObjectif($objectif);
$em->persist($compagne);
}
$em->flush();
return $this->render('crm/index.html.twig', [
'compagnes' => $compagneActive,
'appelRepo' => $appelRepo,
'dateDebut' => $dateDebut,
'dateFin' => $dateFin,
'listRdvs' => $listRdvs
]);
}
/**
* Détails de la compagne
* @Route("/compagne/{id}/OP", name="crm_compagne")
*/
public function compagne(Compagne $compagne)
{
return $this->render('crm/compagne.html.twig', [
'compagne' => $compagne,
]);
}
/**
* Afficher le details des Cdrs d'une appel par date
* @Route("/by-user/{userId}/OP", name="cdrs_by_user")
*/
public function cdrsByUser($userId)
{
die("To do");
$dateDebut = '';
$dateFin = '';
if (isset($_POST['rangeDate'])) {
$rangeDate = $_POST['rangeDate'];
$dates = explode(" - ", $rangeDate);
$begin = explode("/", $dates[0]);
$dateDebut = $begin[2] . "-" . $begin[1] . "-" . $begin[0];
$end = explode("/", $dates[1]);
$dateFin = $end[2] . "-" . $end[1] . "-" . $end[0];
}
$userRepo = $this->getDoctrine()->getRepository(Utilisateur::class);
$userByExto = $userRepo->findOneById($userId);
$UserCdrs = $userByExto->getCdrsByDate($dateDebut, $dateFin);
$appelRepo = $this->getDoctrine()->getRepository(Appel::class);
return $this->render('IdeoDashBundle:ucm/cdr:cdr_extension.html.twig', [
'userByExto' => $userByExto,
'UserCdrs' => $UserCdrs,
'dateDebut' => $dateDebut,
'dateFin' => $dateFin,
'appelRepo' => $appelRepo
]);
// return new JsonResponse('thank you');
}
/**
* changer la mission de l'agent Emission/Reception
* @Route("/changeMissionAgent/{idMission}", name="change_mission_agent_ajax")
**/
public function changeMissionAgentAjax($idMission = 0)
{
$user = $this->getUser();
$em = $this->getDoctrine()->getManager();
$user->setAgentMission($idMission);
$em->persist($user);
$em->flush();
$response = "La mission de l'agent a été bien changée => " . $idMission;
$resp = new Response(json_encode($response, JSON_UNESCAPED_UNICODE));
$resp->headers->set('Content-Type', 'application/json');
return $resp;
}
/**
* Afficher l'affiche de l'apprenant et demarrer un appel pour un RDV
* @Route("/callapprenantrdv/{id}/{rdvid}", name="crm_call_apprenant_rdv")
* @return void
*/
public function callApprenantRdv(Apprenant $apprenant, $rdvid = -1)
{
$em = $this->getDoctrine()->getManager();
$ApprenantRepo = $em->getRepository(Apprenant::class);
$compagne = $ApprenantRepo->getLastCompagne($apprenant);
if (!is_object($compagne)) {
$compagne = null;
}
if (!is_object($apprenant)) {
$this->addFlash('success', 'Vous ne pouvez pas appeler l\'apprnenants');
return $this->redirectToRoute('crm_index');
}
// recuperer la liste des Utilisateurs SPOP
$utilisateurs = $em->getRepository(Utilisateur::class)->findSPOP();
// recuperer la liste des Utilisateurs SPOP
$appelStatuts = $em->getRepository(AppelStatut::class)->findByRole("ROLE_SP");
// recuperer la liste des sujets des appels
$appelSujets = $em->getRepository(AppelSujet::class)->findByRole("ROLE_SP");
return $this->render('crm/callApprenant.html.twig', [
'compagne' => $compagne,
'apprenant' => $apprenant,
'utilisateursSPOP' => $utilisateurs,
'appelStatuts' => $appelStatuts,
'appelSujets' => $appelSujets,
'rdv' => $rdvid
]);
}
/**
* Ajouter un RDV en ajax
* @Route("/addRdv/{id}", name="add_rdv_ajax")
* @return void
**/
public function addRdvAjax(Apprenant $apprenant)
{
if ($_POST['dateNotif'] != '') {
$user = $this->getUser();
$em = $this->getDoctrine()->getManager();
$rdv = new rdv();
$rdv->setApprenant($apprenant);
$sujetRdv = $em->getRepository(AppelSujet::class)->findOneById($_POST['sujetRdv']);
$rdv->setSujet($sujetRdv);
if (strlen($_POST['dateNotif']) <= 16)
$rdv->setDate($_POST['dateNotif'] . 'T' . $_POST['creneaux']);
$rdv->setAgentEmetteur($user);
$recep = $em->getRepository(Utilisateur::class)->findById($_POST['utilisateurs']);
$rdv->setAgentRecepteur($recep[0]);
$rdv->setStatut(0);
$rdv->setCommentaire($_POST['commentaire']);
$rdv->setDateInsert(date("Y-m-d\TH:i:s", strtotime("+0 hour")));
$rdv->setEtat(1);
$em->persist($rdv);
$em->flush();
$response["success"] = "Rdv a été ajouté";
$resp = new Response(json_encode($response, JSON_UNESCAPED_UNICODE));
$resp->headers->set('Content-Type', 'application/json');
return $resp;
}
}
/**
* Historiser Appel
* @Route("/historiser-appel/{id}", name="historiser_appel")
* @return void
**/
public function historiser_appel(Apprenant $apprenant)
{
$em = $this->getDoctrine()->getManager();
$user = $this->getUser();
$appel = new Appel();
$ApprenantRepo = $em->getRepository(Apprenant::class);
$sujet = $em->getRepository(AppelSujet::class)->findOneById($_POST['sujet']);
$statut = $em->getRepository(AppelStatut::class)->findOneById($_POST['statut']);
$appel->setApprenant($apprenant);
$appel->setSujet($sujet);
$appel->setAgent($user);
$appel->setStatut($statut);
$appel->setDetails($_POST["details"]);
$appel->setDate(date("Y-m-d\TH:i:s", strtotime('1 hour')));
$appel->setType($_POST["type"]);
$appel->setBrouillon($_POST['brouillon']);
$appel->setQualification($_POST['qualification']);
$apprenant->setCreneau($_POST['creneau1'] . " - " . $_POST['creneau2']);
$apprenant->setQualificationWebi($_POST['qualiCv']);
if ($_POST['task']) {
$tache = $em->getRepository(Tache::class)->findOneById($_POST['task']);
$appel->setTache($tache);
$calls = $em->getRepository(Appel::class)->findByTache($tache);
if (!$calls) {
$tache->getCompagne()->setTentative($tache->getCompagne()->getTentative() + 1);
$em->persist($tache);
$em->flush();
}
} else {
$appel->setTache(null);
$tache = 0;
}
$compagne = $ApprenantRepo->getLastCompagne($apprenant);
if (!is_object($compagne)) {
$compagne = null;
}
if (is_object($compagne)) {
// incrémenter le nombre des apprants qu'on appelé au moins une seule fois
if ($em->getRepository(Tache::class)->findtasksApprenantByCampagne($compagne, $apprenant)) {
$tache = $em->getRepository(Tache::class)->findtasksApprenantByCampagne($compagne, $apprenant)[0];
$calls = $em->getRepository(Appel::class)->findByTache($tache);
if (!$calls) {
// ssi l'apprenant n'a pas d'appels incrémenter par 1
$compagne->setTentative($compagne->getTentative() + 1);
$em->persist($compagne);
$em->flush();
}
}
/********************************
// incrementer la progression de la campagne
*/
$idStatut = $appel->getStatut()->getId();
if ($_POST['qualification'] == 1) {
$appel->setQualification(1);
$compagne->setProgression($compagne->getProgression() + 1);
if ($tache and $tache->getEtat() != 1) {
$tache->setEtat(1);
}
} elseif ($idStatut == 2) {
// Si le status (A RAPPELER) empecher le systeme de rappel automatiquement l'apprenant
if ($tache) {
$tache->setEtat(2);
}
} else {
if ($tache) {
$tache->setEtat(0);
}
}
// incrementer la couche de la tache
// $tache->setCouche($tache->getCouche()+1);
if (is_object($tache)) {
$em->persist($tache);
$em->flush();
}
}
// enregistrer l'appel
if (is_object($compagne) and is_object($tache)) {
$appel->setTache($tache);
}
// if ($_POST["statutIncident"]) {
// $incident = new Incident();
// $incident->setEntite($_POST["entite"]);
// $incident->setVille($_POST["ville"]);
// $incident->setMaterielUtilise($_POST["materiel_utilise"]);
// $incident->setConnexion($_POST["connexion"]);
// $incident->setNavigateur($_POST["navigateur"]);
// $incident->setOutilTechnique($_POST["outil_technique"]);
// $incident->setSujet($_POST["sujetInci"]);
// $incident->setDescription($_POST["description"]);
// $incident->setDate($_POST["dateInci"]);
// $incident->setApprenant($apprenant);
// $em->persist($incident);
// $em->flush();
// $appel->setIncident($incident);
// }
$em->persist($appel);
$em->flush();
$em->persist($apprenant);
$em->flush();
//send sms to get rate of call
if (in_array($appel->getStatut()->getId(), [1, 17]) and !empty($appel->getId())) {
$emetteur = "BeLearning";
if ($apprenant->getInscriptions()) {
foreach ($apprenant->getInscriptions() as $ins) {
$emetteur = $ins->getProjet()->getClient()->getSmsLabel();
}
}
$site_url = (isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] == 'on' || $_SERVER['HTTPS'] == 1) || isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') ? 'https://' . $_SERVER['HTTP_HOST'] : 'http://' . $_SERVER['HTTP_HOST'];
$link = $site_url . "/apprenant/evaluer-appel/" . $appel->getId();
$smsApi = new InwiApi();
$resp = $smsApi->sendRateSms($emetteur, $apprenant->getGsm(), $link);
}
// changer le status du RDV actuel
if (isset($_POST['rdv']) and $_POST['rdv'] != -1 and $_POST['rdv'] > 0) {
$rdv = $em->getRepository(Rdv::class)->findOneById($_POST['rdv']);
$rdv->setStatut(1);
$em->persist($rdv);
$em->flush();
}
$response["success"] = "L'appel a été cloturé";
$this->addFlash('success', "L'historisation a été bien ajouté");
$resp = new Response(json_encode($response, JSON_UNESCAPED_UNICODE));
$resp->headers->set('Content-Type', 'application/json');
return $resp;
}
/**
* Historiser Appel Auto lorsque l'opérateur oublier l'historisation d'appel
* @Route("/historiser-appel-auto/{id}", name="historiser_appel_auto")
* @return void
**/
public function historiser_appel_auto(Apprenant $apprenant)
{
$em = $this->getDoctrine()->getManager();
$user = $this->getUser();
$appel = new Appel();
$sujet = $em->getRepository(AppelSujet::class)->findOneById(1);
$statut = $em->getRepository(AppelStatut::class)->findOneById(1);
$appel->setApprenant($apprenant);
$appel->setSujet($sujet);
$appel->setAgent($user);
$appel->setStatut($statut);
$appel->setDate(date("Y-m-d\TH:i:s", strtotime('1 hour')));
$appel->setType(1);
// enregitrer cette hitorisation en tant que brouillon
$appel->setBrouillon(1);
$appel->setQualification(0);
$em->persist($appel);
$em->flush();
$this->addFlash('success', "L'historisation a été bien ajouté");
$response["success"] = "L'historisation a été bien ajouté";
$resp = new Response(json_encode($response, JSON_UNESCAPED_UNICODE));
$resp->headers->set('Content-Type', 'application/json');
return $resp;
}
/**
* Historiser Appel
* @Route("/historiser-appel-boucle/{id}/{compagne}", name="historiser_appel_boucle")
**/
public function historiser_appel_boucle(Apprenant $apprenant, Compagne $compagne)
{
$em = $this->getDoctrine()->getManager();
$user = $this->getUser();
$appel = new Appel();
$sujet = $em->getRepository(AppelSujet::class)->findOneById($_POST['sujet']);
$statut = $em->getRepository(AppelStatut::class)->findOneById($_POST['statut']);
$appel->setApprenant($apprenant);
$appel->setSujet($sujet);
$appel->setAgent($user);
$appel->setStatut($statut);
$appel->setDetails($_POST["details"]);
$appel->setDate(date("Y-m-d\TH:i:s", strtotime('1 hour')));
$appel->setType($_POST["type"]);
$appel->setBrouillon($_POST['brouillon']);
$appel->setQualification($_POST['qualification']);
$apprenant->setCreneau($_POST['creneau1'] . " - " . $_POST['creneau2']);
$apprenant->setQualificationWebi($_POST['qualiCv']);
if (is_object($compagne)) {
// incrémenter le nombre des apprants qu'on appelé au moins une seule fois
$tache = $em->getRepository(Tache::class)->findtasksApprenantByCampagne($compagne, $apprenant)[0];
$calls = $em->getRepository(Appel::class)->findByTache($tache);
if (!$calls) {
// ssi l'apprenant n'a pas d'appels incrimenter par 1
$compagne->setTentative($compagne->getTentative() + 1);
}
// incrementer la progression de la campagne
$idStatut = $appel->getStatut()->getId();
if ($_POST['qualification'] == 1) {
$appel->setQualification(1);
$compagne->setProgression($compagne->getProgression() + 1);
if ($tache and $tache->getEtat() != 1) {
$tache->setEtat(1);
}
} elseif ($idStatut == 2) {
// Si le status (A RAPPELER) empecher le systeme de rappel automatiquement l'apprenant
$tache->setEtat(2);
} else {
$tache->setEtat(0);
}
// incrementer la couche de la tache
$tache->setCouche($tache->getCouche() + 1);
$em->persist($tache);
$em->flush();
}
// $compagne->setCouche($tache->getCouche());
$em->persist($compagne);
$em->flush();
// enregistrer l'appel
if (is_object($compagne)) {
$appel->setTache($tache);
}
// if ($_POST["statutIncident"]) {
// $incident = new Incident();
// $incident->setEntite($_POST["entite"]);
// $incident->setVille($_POST["ville"]);
// $incident->setMaterielUtilise($_POST["materiel_utilise"]);
// $incident->setConnexion($_POST["connexion"]);
// $incident->setNavigateur($_POST["navigateur"]);
// $incident->setOutilTechnique($_POST["outil_technique"]);
// $incident->setSujet($_POST["sujetInci"]);
// $incident->setDescription($_POST["description"]);
// $incident->setDate($_POST["dateInci"]);
// $incident->setApprenant($apprenant);
// $em->persist($incident);
// $em->flush();
// $appel->setIncident($incident);
// }
$em->persist($appel);
$em->flush();
$em->persist($apprenant);
$em->flush();
// disable priority calling whene call is done
$apprenant->setPriority(0);
$em->persist($apprenant);
$em->flush();
//send sms to get rate of call
if (in_array($appel->getStatut()->getId(), [1, 17]) and !empty($appel->getId())) {
$emetteur = "BeLearning";
if ($apprenant->getInscriptions()) {
foreach ($apprenant->getInscriptions() as $ins) {
$emetteur = $ins->getProjet()->getClient()->getSmsLabel();
}
}
$site_url = (isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] == 'on' || $_SERVER['HTTPS'] == 1) || isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') ? 'https://' . $_SERVER['HTTP_HOST'] : 'http://' . $_SERVER['HTTP_HOST'];
$link = $site_url . "/apprenant/evaluer-appel/" . $appel->getId();
$smsApi = new InwiApi();
$resp = $smsApi->sendRateSms($emetteur, $apprenant->getGsm(), $link);
}
// ajouter l'appel au RDV s'il existe
// $idRdvAppel = $request->request->get('idRdvAppel');
// if ($idRdvAppel != 0) {
// $newRdv = $em->getRepository(Rdv::class)->findOneById($idRdvAppel);
// $newRdv->setAppel($appel);
// $em->persist($newRdv);
// $em->flush();
// }
$response["success"] = "L'appel a été cloturé";
$this->addFlash('success', "L'historisation a été bien ajouté");
$resp = new Response(json_encode($response, JSON_UNESCAPED_UNICODE));
$resp->headers->set('Content-Type', 'application/json');
return $resp;
}
/**
* Appeler les apprenants d'une compagne
* @Route("/calling/{id}", name="crm_calling")
* @return void
*/
public function startCalling(Compagne $compagne)
{
$em = $this->getDoctrine()->getManager();
$user = $this->getUser();
// RECUPERE LE FORMULAIRE DE STORISATION
$appel = new Appel();
$form = $this->createForm(AppelType::class, $appel);
// recuperer un seul apprenant non abouti
$apprenant = $compagne->getApprenantByAgent($user);
$response = $this->CloseOrNextCampagne($compagne, $apprenant);
if ($response != "Ok") {
return $response;
}
// recuperer la liste des Utilisateurs SPOP
$utilisateurs = $em->getRepository(Utilisateur::class)->findSPOP();
// recuperer la liste des Utilisateurs SPOP
$appelStatuts = $em->getRepository(AppelStatut::class)->findByRole("ROLE_SP");
// recuperer la liste des sujets des appels
$appelSujets = $em->getRepository(AppelSujet::class)->findByRole("ROLE_SP");
return $this->render('crm/callApprenantCompagne.html.twig', [
'compagne' => $compagne,
'apprenant' => $apprenant,
'form' => $form->createView(),
'utilisateursSPOP' => $utilisateurs,
'appelStatuts' => $appelStatuts,
'appelSujets' => $appelSujets
]);
}
/**
* Cette fonction est pour objectif de verifier s'il faut passer à la couche suivante ou continuer dans la couche currente
*
* @return void
*/
public function CloseOrNextCampagne($compagne, $apprenant)
{
$em = $this->getDoctrine()->getManager();
$NewCoucheCompagne = 0;
$response = 0;
$codeOperation = 0;
$campagneCurrentCoucheObjtif = $compagne->getCurrentCouche()->getObjectif();
$campagneCurrentCoucheTantative = $compagne->getCurrentCouche()->getTentative();
$campagneObjectif = $compagne->getObjectif();
$campagneProgress = $compagne->getProgression();
if ($campagneObjectif == $campagneProgress) {
// fermer la campagne
$compagne->setState(3);
$em->persist($compagne);
$em->flush();
$response = 4;
} elseif ($compagne->getState() != 2) {
// afficher un message Flash si la campagne est en mode Pause
$response = 1;
$codeOperation = 400;
} elseif (!is_object($apprenant)) {
if ($campagneCurrentCoucheTantative == $campagneCurrentCoucheObjtif) {
$NewCoucheCompagne = 1;
$codeOperation = 100;
} else {
$response = 3;
}
} elseif ($campagneCurrentCoucheTantative == $campagneCurrentCoucheObjtif) {
// tester si il faut passer à la couche suivante
// fermer la compagne et passer à la couche suivante
$NewCoucheCompagne = 1;
$codeOperation = 200;
} else {
// tester si la couche candidat est superieur ou egal au couche campagne
// passer à la couche suivante
$tache = $em->getRepository(Tache::class)->findtasksApprenantByCampagne($compagne, $apprenant)[0];
if ($tache->getCouche() >= $compagne->getCouche()) {
$NewCoucheCompagne = 1;
$codeOperation = 300;
}
}
if ($NewCoucheCompagne == 1) {
$compagne->newCouche();
$compagne->setState(1);
$compagne->setCouche((int)$compagne->getCouche() + 1);
$em->persist($compagne);
$em->flush();
$response = 2;
}
if ($response == 1) {
$this->addFlash(
'success',
'Infos (' . $codeOperation . ') !! La ' . $compagne->getNom() . ' est en mode Pause. Merci de contacter l\'équipe GP pour l\'activer '
);
return $this->redirectToRoute('crm_index');
} elseif ($response == 2) {
$this->addFlash(
'success',
'Felicitation (' . $codeOperation . ') !! La couche ' . ((int)$compagne->getCouche() - 1) . ' de La ' . $compagne->getNom() . ' est terminé. Merci de passer à la suivante'
);
return $this->redirectToRoute('crm_index');
} elseif ($response == 3) {
$this->addFlash(
'success',
'Vous ne pouvez pas appeler les apprnenants de La campagne ' . $compagne->getNom() . '. Veuillez réessayer demain'
);
return $this->redirectToRoute('crm_index');
} elseif ($response == 4) {
$this->addFlash(
'success',
'Felicitation !! vous avez atteint l\'objectif. La campagne ' . $compagne->getNom() . ' est terminée'
);
return $this->redirectToRoute('crm_index');
} else {
return "Ok";
}
}
/**
* recuperer un apprenant par téléphone en ajax
* @Route("/getapprenant/{phonenumber}", name="crm_get_apprenant")
* @return void
*/
public function getApprenantAjax($phonenumber)
{
$em = $this->getDoctrine()->getManager();
$ApprenantRepo = $em->getRepository(Apprenant::class);
$Apprenant = $ApprenantRepo->getByPhoneNumber($phonenumber);
$client = $ApprenantRepo->getClient($Apprenant);
if (is_object($Apprenant)) {
$apprennatArray = [
'statut' => true,
'id' => $Apprenant->getId(),
'fullName' => $Apprenant->getFirstname() . ' ' . $Apprenant->getLastname(),
'client' => $client->getNom(),
'gsm' => $Apprenant->getGsm()
];
} else {
$apprennatArray = [
'statut' => false,
'msg' => "aucun apprenant correspondant"
];
}
return new JsonResponse($apprennatArray);
}
/**
* Afficher l'affiche de l'apprenant
* @Route("/showapprenant/{id}/OP", name="crm_show_apprenant")
* @return void
*/
public function showApprenant(Apprenant $apprenant)
{
$em = $this->getDoctrine()->getManager();
$ApprenantRepo = $em->getRepository(Apprenant::class);
$compagne = $ApprenantRepo->getLastCompagne($apprenant);
if (!is_object($compagne)) {
$compagne = null;
}
if (!is_object($apprenant)) {
$this->addFlash('success', 'Vous ne pouvez pas appeler l\'apprnenants');
return $this->redirectToRoute('crm_index');
}
// recuperer la liste des Utilisateurs SPOP
$utilisateurs = $em->getRepository(Utilisateur::class)->findSPOP();
// recuperer la liste des Utilisateurs SPOP
$appelStatuts = $em->getRepository(AppelStatut::class)->findAll();
// recuperer la liste des sujets des appels
$appelSujets = $em->getRepository(AppelSujet::class)->findAll();
return $this->render('crm/showApprenant.html.twig', [
'compagne' => $compagne,
'apprenant' => $apprenant,
'utilisateursSPOP' => $utilisateurs,
'appelStatuts' => $appelStatuts,
'appelSujets' => $appelSujets
]);
}
/**
* Afficher l'affiche de l'apprenant et demarrer un appel pour un RDV Coach
* @Route("/callapprenantrdvCoach/{id}/{rdvid}/OP", name="crm_call_apprenant_rdv_coach")
* @return void
*/
public function callApprenantRdvCoach(Apprenant $apprenant, $rdvid = -1)
{
$em = $this->getDoctrine()->getManager();
if (!is_object($apprenant)) {
$this->addFlash('success', 'Vous ne pouvez pas appeler l\'apprnenants');
return $this->redirectToRoute('crm_index');
}
$appelSujets = $em->getRepository(AppelSujet::class)->findAll();
$appelStatuts = $em->getRepository(AppelStatut::class)->findBy(["role" => "ROLE_OP"]);
return $this->render('crm/callApprenantCoach.html.twig', [
'apprenant' => $apprenant,
'applesSujets' => $appelSujets,
'appelStatuts' => $appelStatuts,
'rdv' => $rdvid
]);
}
}