- <?php
- namespace DcSiteBundle\Controller\Ford;
- use CoreBundle\Component\CoreFormFactory;
- use CoreBundle\Component\FormManager;
- use CoreBundle\Entity\Forms;
- use CoreBundle\Entity\Model;
- use CoreBundle\Entity\ViDiDepartment;
- use CoreBundle\Factory\Vehicle as VehicleFactory;
- use CoreBundle\Model\Api\OnlineService\ApiServer1C;
- use CoreBundle\Model\Vehicles\Repository;
- use CoreBundle\Model\ViDiDepartmentModel;
- use CoreBundle\Services\MediaExtensionVidi;
- use DcSiteBundle\Model\Form\ServicesOrderForm;
- use DcSiteBundle\Services\VehicleService;
- use Doctrine\ORM\EntityManagerInterface;
- use PortalBundle\Model\SeoMetaTag;
- use Symfony\Component\Filesystem\Filesystem;
- use Symfony\Component\HttpFoundation\RedirectResponse;
- use Symfony\Component\HttpFoundation\Request;
- use Symfony\Component\HttpFoundation\RequestStack;
- use Symfony\Component\HttpFoundation\Response;
- use Symfony\Component\HttpFoundation\Session\SessionInterface;
- use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
- use Symfony\Component\Routing\RouterInterface;
- use Twig\Environment;
- class ServiceController extends BaseController
- {
-     public function __construct(CoreFormFactory $coreFormFactory, SeoMetaTag $seoMetaTag, RequestStack $requestStack, RouterInterface $router, FormManager $formManager, EntityManagerInterface $em, ApiServer1C $apiServer1C, SessionInterface $session, Filesystem $filesystem, MediaExtensionVidi $mediaExtensionVidi, Repository $vehicleRepository, VehicleFactory $vehicleFactory, Environment $twig)
-     {
-         parent::__construct($coreFormFactory, $seoMetaTag, $requestStack, $router, $formManager, $em, $apiServer1C, $session, $filesystem, $mediaExtensionVidi, $vehicleRepository, $vehicleFactory, $twig);
-     }
-     public function to(): Response
-     {
-         return $this->baseFordRender('@DcSite/Ford/Service/to.html.twig', [
-             'serviceForm' => $this->CoreFormFactory()->serviceForm()->createView(),
-             'dealerName' => $this->getDealer()->getBrand()->getName()
-         ]);
-     }
-     public function regulationsTo(VehicleService $vehicleService): Response
-     {
-         $models = $vehicleService->getModelsForRegulationsTo($this->getDealer());
-         return $this->baseFordRender('@DcSite/Ford/Service/regulations-to.html.twig', [
-             'models' => $models,
-         ]);
-     }
-     public function regulationsToModel($model): Response
-     {
-         $model = $this->em->getRepository(Model::class)->findOneBy(['url' => $model]);
-         if (!$model) {
-             throw new NotFoundHttpException();
-         }
-         return $this->baseFordRender('@DcSite/Ford/Service/regulations-to-model.html.twig', [
-             'model' => $model->getId(),
-             'modelTitle' => $model->getTitle(),
-         ]);
-     }
-     public function storageTires(Request $request): Response
-     {
-         return $this->baseFordRender('@DcSite/Ford/Service/storage_tires.html.twig', [
-             'serviceOrderForm' => $this->CoreFormFactory()->servicesOrderForm(ServicesOrderForm::TIRE_HOTEL, $request->getLocale())->createView()
-         ]);
-     }
-     public function bodyRepair(): Response
-     {
-         $repairPhotoForm = $this->CoreFormFactory()->repairPhotoForm();
-         return $this->baseFordRender('@DcSite/Ford/Service/body_repair.html.twig', [
-             'repairPhotoForm' => $repairPhotoForm->createView(),
-         ]);
-     }
-     public function spares(): Response
-     {
-         $quest = new Forms();
-         $department = $this->em->getRepository(ViDiDepartment::class)
-             ->findOneBy(['dealer' => $this->getDealer(), 'type' => ViDiDepartmentModel::DEPARTMENT_TYPE_SERVICE]);
-         $quest->setDepartment($department);
-         return $this->baseFordRender('@DcSite/Ford/Service/spares.html.twig', [
-             'question' => $this->CoreFormFactory()->feedbackQuestionForm($quest, $this->getDealer())->createView(),
-             'spareForm' => $this->CoreFormFactory()->buySparePartsForm($this->getDealer())->createView(),
-         ]);
-     }
-     public function assistance(): Response
-     {
-         return $this->baseFordRender('@DcSite/Ford/Service/assistance.html.twig', [
-             'serviceOrderForm' => $this->CoreFormFactory()->servicesOrderForm(ServicesOrderForm::ASSISTANCE)->createView()
-         ]);
-     }
-     public function accessories(): RedirectResponse
-     {
-         return $this->redirect('https://shop.ford-vidi.com.ua');
-     }
-     public function interactive(): Response
-     {
-         return $this->baseFordRender('@DcSite/Ford/Service/interactive.html.twig');
-     }
-     public function multiConsultationEnter(): Response
-     {
-         return $this->baseFordRender('@DcSite/Ford/Service/consultation.html.twig');
-     }
-     public function multiConsultationForm(): Response
-     {
-         return $this->baseFordRender('@DcSite/Ford/Service/consultation-form.html.twig');
-     }
-     public function multiConsultationFormOnline(): Response
-     {
-         return $this->baseFordRender('@DcSite/Ford/Service/consultation-form-online.html.twig');
-     }
-     public function multiConsultationTestdriveForm(): Response
-     {
-         return $this->baseFordRender('@DcSite/Ford/Service/consultation-testdrive-form.html.twig');
-     }
-     public function serviceCampaigns(): Response
-     {
-         return $this->baseFordRender('@DcSite/Ford/Service/campaings.html.twig', [
-             'serviceCampaingCarForm' => $this->CoreFormFactory()->serviceCampaingCarForm()->createView(),
-         ]);
-     }
-     public function manuals(): Response
-     {
-         return $this->baseFordRender('@DcSite/Ford/Service/manuals.html.twig');
-     }
-     public function nightServiceAgreement(): Response
-     {
-         return $this->baseFordRender('@DcSite/Ford/Service/night-service-agreement.html.twig', [
-             'dealer' => $this->getDealer()
-         ]);
-     }
- }
-