src/Controller/UserInterfaceController.php line 27

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.         if ($user instanceof Client) {
  33.             $serviceId $user->getServiceId();
  34.             $clientId $user->getClientId();
  35.         }
  36.         $clientAvis $callApiServices->clientAvis($serviceId$clientId);
  37.         return $this->render('user_interface/userComment.html.twig', [
  38.             'clientAvis' => $clientAvis,
  39.         ]);
  40.     }
  41.     /**
  42.      * @Route("/userOperation", name="app_userOperation")
  43.      */
  44.     public function userOperation(CallApiServices $callApiServices): Response
  45.     {
  46.         $user $this->getUser();
  47.         $serviceId $this->getParameter('app.serviceId');
  48.         $accountId $this->getParameter('app.accountId');
  49.         if ($user instanceof Client) {
  50.             $clientId $user->getClientId();
  51.         }
  52.         $clientOperations $callApiServices->clientOperations($serviceId$clientId);
  53.         $clientTransactions $callApiServices->clientTransactions($serviceId$clientId);
  54.         return $this->render('user_interface/userOperation.html.twig', [
  55.             'clientOperations' => $clientOperations,
  56.             'clientTransactions' => $clientTransactions,
  57.         ]);
  58.     }
  59.     /**
  60.      * @Route("/userConsulting", name="app_userConsulting")
  61.      */
  62.     public function userConsulting(CallApiServices $callApiServices): Response
  63.     {
  64.         $user $this->getUser();
  65.         $serviceId $this->getParameter('app.serviceId');
  66.         $accountId $this->getParameter('app.accountId');
  67.         if ($user instanceof Client) {
  68.             $clientId $user->getClientId();
  69.         }
  70.         $clientConsultations $callApiServices->clientConsultations($serviceId$clientId);
  71.         $timeConverti = [];
  72.         foreach ($clientConsultations as $consulte) {
  73.             $timeAConvertir $consulte['dureeConsultation'];
  74.             $timeConverti[] = $this->time->ConvertisseurTime($timeAConvertir);
  75.         }
  76.         return $this->render('user_interface/userConsulting.html.twig', [
  77.             'clientConsultations' => $clientConsultations,
  78.             'time' => $timeConverti
  79.         ]);
  80.     }
  81. }