src/Controller/UserInterfaceController.php line 57

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\Entity\Client;
  4. use App\Services\Time;
  5. use App\Services\CallApiServices;
  6. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  7. use Symfony\Component\HttpFoundation\Response;
  8. use Symfony\Component\Routing\Annotation\Route;
  9. use Symfony\Component\Validator\Constraints\Length;
  10. class UserInterfaceController extends AbstractController
  11. {
  12.     private $time;
  13.     public function __construct(Time $time)
  14.     {
  15.         $this->time $time;
  16.     }
  17.     /**
  18.      * @Route("/user-interface", name="app_user_interface")
  19.      */
  20.     public function index(): Response
  21.     {
  22.         return $this->render('user_interface/index.html.twig', [
  23.             'controller_name' => 'UserInterfaceController',
  24.         ]);
  25.     }
  26.     /**
  27.      * @Route("/userComment", name="app_userComment", methods={"GET"})
  28.      */
  29.     public function userComment(CallApiServices $callApiServices): Response
  30.     {
  31.         $user $this->getUser();
  32.         $clientAvis "";
  33.         if ($user instanceof Client) {
  34.             $serviceId $user->getServiceId();
  35.             $clientId $user->getClientId();
  36.             $clientAvis $callApiServices->clientAvis($serviceId$clientId);
  37.         }
  38.         return $this->render('user_interface/userComment.html.twig', [
  39.             'clientAvis' => $clientAvis,
  40.         ]);
  41.     }
  42.     /**
  43.      * @Route("/userOperation", name="app_userOperation")
  44.      */
  45.     public function userOperation(CallApiServices $callApiServices): Response
  46.     {
  47.         $user $this->getUser();
  48.         $serviceId $this->getParameter('app.serviceId');
  49.         $accountId $this->getParameter('app.accountId');
  50.         if ($user instanceof Client) {
  51.             $clientId $user->getClientId();
  52.         }
  53.         $clientOperations $callApiServices->clientOperations($serviceId$clientId);
  54.         $clientTransactions $callApiServices->clientTransactions($serviceId$clientId);
  55.         return $this->render('user_interface/userOperation.html.twig', [
  56.             'clientOperations' => $clientOperations,
  57.             'clientTransactions' => $clientTransactions,
  58.         ]);
  59.     }
  60.     /**
  61.      * @Route("/userConsulting", name="app_userConsulting")
  62.      */
  63.     public function userConsulting(CallApiServices $callApiServices): Response
  64.     {
  65.         $user $this->getUser();
  66.         $serviceId $this->getParameter('app.serviceId');
  67.         $accountId $this->getParameter('app.accountId');
  68.         if ($user instanceof Client) {
  69.             $clientId $user->getClientId();
  70.         }
  71.         $clientConsultations $callApiServices->clientConsultations($serviceId$clientId);
  72.         $timeConverti = [];
  73.         foreach ($clientConsultations as $consulte) {
  74.             $timeAConvertir $consulte['dureeConsultation'];
  75.             $timeConverti[] = $this->time->ConvertisseurTime($timeAConvertir);
  76.         }
  77.         return $this->render('user_interface/userConsulting.html.twig', [
  78.             'clientConsultations' => $clientConsultations,
  79.             'time' => $timeConverti
  80.         ]);
  81.     }
  82. }