src/DcSiteBundle/Controller/Ford/ServiceController.php line 111

Open in your IDE?
  1. <?php
  2. namespace DcSiteBundle\Controller\Ford;
  3. use CoreBundle\Component\CoreFormFactory;
  4. use CoreBundle\Component\FormManager;
  5. use CoreBundle\Entity\Forms;
  6. use CoreBundle\Entity\Model;
  7. use CoreBundle\Entity\ViDiDepartment;
  8. use CoreBundle\Factory\Vehicle as VehicleFactory;
  9. use CoreBundle\Model\Api\OnlineService\ApiServer1C;
  10. use CoreBundle\Model\Vehicles\Repository;
  11. use CoreBundle\Model\ViDiDepartmentModel;
  12. use CoreBundle\Services\MediaExtensionVidi;
  13. use DcSiteBundle\Model\Form\ServicesOrderForm;
  14. use DcSiteBundle\Services\VehicleService;
  15. use Doctrine\ORM\EntityManagerInterface;
  16. use PortalBundle\Model\SeoMetaTag;
  17. use Symfony\Component\Filesystem\Filesystem;
  18. use Symfony\Component\HttpFoundation\RedirectResponse;
  19. use Symfony\Component\HttpFoundation\Request;
  20. use Symfony\Component\HttpFoundation\RequestStack;
  21. use Symfony\Component\HttpFoundation\Response;
  22. use Symfony\Component\HttpFoundation\Session\SessionInterface;
  23. use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
  24. use Symfony\Component\Routing\RouterInterface;
  25. use Twig\Environment;
  26. class ServiceController extends BaseController
  27. {
  28.     public function __construct(CoreFormFactory $coreFormFactorySeoMetaTag $seoMetaTagRequestStack $requestStackRouterInterface $routerFormManager $formManagerEntityManagerInterface $emApiServer1C $apiServer1CSessionInterface $sessionFilesystem $filesystemMediaExtensionVidi $mediaExtensionVidiRepository $vehicleRepositoryVehicleFactory $vehicleFactoryEnvironment $twig)
  29.     {
  30.         parent::__construct($coreFormFactory$seoMetaTag$requestStack$router$formManager$em$apiServer1C$session$filesystem$mediaExtensionVidi$vehicleRepository$vehicleFactory$twig);
  31.     }
  32.     public function to(): Response
  33.     {
  34.         return $this->baseFordRender('@DcSite/Ford/Service/to.html.twig', [
  35.             'serviceForm' => $this->CoreFormFactory()->serviceForm()->createView(),
  36.             'dealerName' => $this->getDealer()->getBrand()->getName()
  37.         ]);
  38.     }
  39.     public function regulationsTo(VehicleService $vehicleService): Response
  40.     {
  41.         $models $vehicleService->getModelsForRegulationsTo($this->getDealer());
  42.         return $this->baseFordRender('@DcSite/Ford/Service/regulations-to.html.twig', [
  43.             'models' => $models,
  44.         ]);
  45.     }
  46.     public function regulationsToModel($model): Response
  47.     {
  48.         $model $this->em->getRepository(Model::class)->findOneBy(['url' => $model]);
  49.         if (!$model) {
  50.             throw new NotFoundHttpException();
  51.         }
  52.         return $this->baseFordRender('@DcSite/Ford/Service/regulations-to-model.html.twig', [
  53.             'model' => $model->getId(),
  54.             'modelTitle' => $model->getTitle(),
  55.         ]);
  56.     }
  57.     public function storageTires(Request $request): Response
  58.     {
  59.         return $this->baseFordRender('@DcSite/Ford/Service/storage_tires.html.twig', [
  60.             'serviceOrderForm' => $this->CoreFormFactory()->servicesOrderForm(ServicesOrderForm::TIRE_HOTEL$request->getLocale())->createView()
  61.         ]);
  62.     }
  63.     public function bodyRepair(): Response
  64.     {
  65.         $repairPhotoForm $this->CoreFormFactory()->repairPhotoForm();
  66.         return $this->baseFordRender('@DcSite/Ford/Service/body_repair.html.twig', [
  67.             'repairPhotoForm' => $repairPhotoForm->createView(),
  68.         ]);
  69.     }
  70.     public function spares(): Response
  71.     {
  72.         $quest = new Forms();
  73.         $department $this->em->getRepository(ViDiDepartment::class)
  74.             ->findOneBy(['dealer' => $this->getDealer(), 'type' => ViDiDepartmentModel::DEPARTMENT_TYPE_SERVICE]);
  75.         $quest->setDepartment($department);
  76.         return $this->baseFordRender('@DcSite/Ford/Service/spares.html.twig', [
  77.             'question' => $this->CoreFormFactory()->feedbackQuestionForm($quest$this->getDealer())->createView(),
  78.             'spareForm' => $this->CoreFormFactory()->buySparePartsForm($this->getDealer())->createView(),
  79.         ]);
  80.     }
  81.     public function assistance(): Response
  82.     {
  83.         return $this->baseFordRender('@DcSite/Ford/Service/assistance.html.twig', [
  84.             'serviceOrderForm' => $this->CoreFormFactory()->servicesOrderForm(ServicesOrderForm::ASSISTANCE)->createView()
  85.         ]);
  86.     }
  87.     public function accessories(): RedirectResponse
  88.     {
  89.         return $this->redirect('https://shop.ford-vidi.com.ua');
  90.     }
  91.     public function interactive(): Response
  92.     {
  93.         return $this->baseFordRender('@DcSite/Ford/Service/interactive.html.twig');
  94.     }
  95.     public function multiConsultationEnter(): Response
  96.     {
  97.         return $this->baseFordRender('@DcSite/Ford/Service/consultation.html.twig');
  98.     }
  99.     public function multiConsultationForm(): Response
  100.     {
  101.         return $this->baseFordRender('@DcSite/Ford/Service/consultation-form.html.twig');
  102.     }
  103.     public function multiConsultationFormOnline(): Response
  104.     {
  105.         return $this->baseFordRender('@DcSite/Ford/Service/consultation-form-online.html.twig');
  106.     }
  107.     public function multiConsultationTestdriveForm(): Response
  108.     {
  109.         return $this->baseFordRender('@DcSite/Ford/Service/consultation-testdrive-form.html.twig');
  110.     }
  111.     public function serviceCampaigns(): Response
  112.     {
  113.         return $this->baseFordRender('@DcSite/Ford/Service/campaings.html.twig', [
  114.             'serviceCampaingCarForm' => $this->CoreFormFactory()->serviceCampaingCarForm()->createView(),
  115.         ]);
  116.     }
  117.     public function manuals(): Response
  118.     {
  119.         return $this->baseFordRender('@DcSite/Ford/Service/manuals.html.twig');
  120.     }
  121.     public function nightServiceAgreement(): Response
  122.     {
  123.         return $this->baseFordRender('@DcSite/Ford/Service/night-service-agreement.html.twig', [
  124.             'dealer' => $this->getDealer()
  125.         ]);
  126.     }
  127. }