src/DcSiteBundle/Controller/LandRover/ServiceController.php line 96

Open in your IDE?
  1. <?php
  2. namespace DcSiteBundle\Controller\LandRover;
  3. use CoreBundle\Component\CoreFormFactory;
  4. use CoreBundle\Component\FormManager;
  5. use CoreBundle\Entity\Model;
  6. use CoreBundle\Factory\Vehicle as VehicleFactory;
  7. use CoreBundle\Model\Api\OnlineService\ApiServer1C;
  8. use CoreBundle\Model\Vehicles\Repository;
  9. use CoreBundle\Services\MediaExtensionVidi;
  10. use DcSiteBundle\Entity\Part;
  11. use DcSiteBundle\Model\Form\ServicesOrderForm;
  12. use DcSiteBundle\Services\VehicleService;
  13. use Doctrine\ORM\EntityManagerInterface;
  14. use PortalBundle\Model\SeoMetaTag;
  15. use Symfony\Component\DependencyInjection\ContainerInterface;
  16. use Symfony\Component\Filesystem\Filesystem;
  17. use Symfony\Component\HttpFoundation\JsonResponse;
  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 accessories(ContainerInterface $container): RedirectResponse
  33.     {
  34.         return $this->redirect('https://' $container->getParameter('shop_landrover_host') . '/'Response::HTTP_MOVED_PERMANENTLY);
  35.     }
  36.     public function helpRoad(): ?Response
  37.     {
  38.         return $this->baseLandRoverRender('@DcSite/LandRover/Service/help_road.html.twig');
  39.     }
  40.     public function orderTo(): ?Response
  41.     {
  42.         return $this->baseLandRoverRender('@DcSite/LandRover/Service/order-to.html.twig', [
  43.             'serviceForm' => $this->CoreFormFactory()->serviceForm(nullnullnulltrue$this->router->generate('landrover_cokie'))->createView(),
  44.             'dealerName' => $this->getDealer()->getBrand()->getName(),
  45.             'dealerId' => $this->getDealer()->getId(),
  46.             'isNight' => false
  47.         ]);
  48.     }
  49.     public function regulationsTo(VehicleService $vehicleService): ?Response
  50.     {
  51.         $models $vehicleService->getModelsForRegulationsTo($this->getDealer());
  52.         return $this->baseLandRoverRender('@DcSite/LandRover/Service/regulations-to.html.twig', [
  53.             'models' => $models,
  54.         ]);
  55.     }
  56.     public function regulationsToModel($model): ?Response
  57.     {
  58.         $model $this->em->getRepository(Model::class)->findOneBy(['url' => $model]);
  59.         if (!$model) {
  60.             throw new NotFoundHttpException();
  61.         }
  62.         return $this->baseLandRoverRender('@DcSite/LandRover/Service/regulations-to-model.html.twig', [
  63.             'model' => $model->getId(),
  64.             'modelTitle' => $model->getTitle(),
  65.         ]);
  66.     }
  67.     public function warranty(): ?Response
  68.     {
  69.         return $this->baseLandRoverRender('@DcSite/LandRover/Service/service_warranty.html.twig');
  70.     }
  71.     public function spareParts(): ?Response
  72.     {
  73.         return $this->baseLandRoverRender('@DcSite/LandRover/Service/spare-parts.html.twig', [
  74.             'buyPartsForm' => $this->CoreFormFactory()->buyPartsForm($this->getDealer())->createView()
  75.         ]);
  76.     }
  77.     public function calculationTo(): ?Response
  78.     {
  79.         return $this->baseLandRoverRender('@DcSite/LandRover/Service/calculation_to.html.twig');
  80.     }
  81.     public function referenceMaterial(): ?Response
  82.     {
  83.         return $this->baseLandRoverRender('@DcSite/LandRover/Service/reference-material.html.twig');
  84.     }
  85. //    public function brandCollections()
  86. //    {
  87. //        return $this->$this->baseLandRoverRender('@DcSite/LandRover/Service/brand-collections.html.twig');
  88. //    }
  89.     public function bodyRepair(): ?Response
  90.     {
  91.         $repairPhotoForm $this->CoreFormFactory()->repairPhotoForm();
  92.         return $this->baseLandRoverRender('@DcSite/LandRover/Service/body-repair.html.twig', [
  93.             'repairPhotoForm' => $repairPhotoForm->createView(),
  94.         ]);
  95.     }
  96.     public function searchParts(Request $request): JsonResponse
  97.     {
  98.         $query $request->request->get('query');
  99.         $part $this->em->getRepository(Part::class)->findOneBy(['dealer' => $this->getDealer(), 'number' => $query'state' => 1]);
  100.         if (!$part) {
  101.             return new JsonResponse(['success' => false]);
  102.         }
  103.         return new JsonResponse([
  104.             'success' => true,
  105.             'data' => [
  106.                 'price' => $part->getPrice(),
  107.                 'id' => $part->getId(),
  108.                 'title' => $part->getNameByLocale($request->getLocale()),
  109.                 'art' => $part->getNumber(),
  110.             ]
  111.         ]);
  112.     }
  113.     public function warrantyIncrease(): ?Response
  114.     {
  115.         return $this->baseLandRoverRender('@DcSite/LandRover/Service/warranty-increase.html.twig');
  116.     }
  117.     public function replacementCar(): ?Response
  118.     {
  119.         return $this->baseLandRoverRender('@DcSite/LandRover/Service/replacement-car.html.twig');
  120.     }
  121.     public function multiConsultationEnter(): ?Response
  122.     {
  123.         return $this->baseLandRoverRender('@DcSite/LandRover/Service/consultation.html.twig');
  124.     }
  125.     public function multiConsultationForm(): ?Response
  126.     {
  127.         return $this->baseLandRoverRender('@DcSite/LandRover/Service/consultation-form.html.twig');
  128.     }
  129.     public function multiConsultationFormOnline(): ?Response
  130.     {
  131.         return $this->baseLandRoverRender('@DcSite/LandRover/Service/consultation-form-online.html.twig');
  132.     }
  133.     public function multiConsultationTestdriveForm(): ?Response
  134.     {
  135.         return $this->baseLandRoverRender('@DcSite/LandRover/Service/consultation-testdrive-form.html.twig');
  136.     }
  137.     public function additionalServices(Request $request): ?Response
  138.     {
  139.         return $this->baseLandRoverRender('@DcSite/LandRover/Service/additional-services.html.twig', [
  140.             'mobileServiceForm' => $this->CoreFormFactory()->servicesOrderForm(ServicesOrderForm::MOBILE_SERVICE$request->getLocale())->createView(),
  141.             'hotelForTiresForm' => $this->CoreFormFactory()->servicesOrderForm(ServicesOrderForm::TIRE_HOTEL$request->getLocale())->createView(),
  142.             'antibacterialForm' => $this->CoreFormFactory()->servicesOrderForm(ServicesOrderForm::ANTIBACTERIAL_SERVICE_CONDITIONER$request->getLocale())->createView(),
  143.             'washingRadiatorsForm' => $this->CoreFormFactory()->servicesOrderForm(ServicesOrderForm::WASHING_COOLING_RADIATORS_SERVICE$request->getLocale())->createView(),
  144.             'finishingLeatherForm' => $this->CoreFormFactory()->servicesOrderForm(ServicesOrderForm::FINISHING_LEATHER_OF_CAR_SERVICE$request->getLocale())->createView(),
  145.             'glueingProtectiveForm' => $this->CoreFormFactory()->servicesOrderForm(ServicesOrderForm::GLUEING_CAR_PROTECTIVE_PELLICLE_SERVICE$request->getLocale())->createView(),
  146.             'toningCarForm' => $this->CoreFormFactory()->servicesOrderForm(ServicesOrderForm::TONING_CAR_SERVICE$request->getLocale())->createView(),
  147.             'installationEngineProtectionForm' => $this->CoreFormFactory()->servicesOrderForm(ServicesOrderForm::INSTALLATION_ENGINE_PROTECTION_SERVICE$request->getLocale())->createView(),
  148.         ]);
  149.     }
  150. }