src/DcSiteBundle/Controller/NissanArmada/FinanceController.php line 76

Open in your IDE?
  1. <?php
  2. namespace DcSiteBundle\Controller\NissanArmada;
  3. use CoreBundle\Component\CoreFormFactory;
  4. use CoreBundle\Component\FormManager;
  5. use CoreBundle\Entity\Forms;
  6. use CoreBundle\Factory\Vehicle as VehicleFactory;
  7. use CoreBundle\Model\Api\OnlineService\ApiServer1C;
  8. use CoreBundle\Model\Vehicles\Repository;
  9. use CoreBundle\Model\ViDiDepartmentModel;
  10. use CoreBundle\Model\ViDiWorkerModel;
  11. use CoreBundle\Services\MediaExtensionVidi;
  12. use DcSiteBundle\Model\Form\ServicesOrderForm;
  13. use Doctrine\ORM\EntityManagerInterface;
  14. use PortalBundle\Model\SeoMetaTag;
  15. use Symfony\Component\Filesystem\Filesystem;
  16. use Symfony\Component\HttpFoundation\Request;
  17. use Symfony\Component\HttpFoundation\RequestStack;
  18. use Symfony\Component\HttpFoundation\Response;
  19. use Symfony\Component\HttpFoundation\Session\SessionInterface;
  20. use Symfony\Component\Routing\RouterInterface;
  21. use Twig\Environment;
  22. class FinanceController extends BaseController
  23. {
  24.     public function __construct(CoreFormFactory $coreFormFactorySeoMetaTag $seoMetaTagRequestStack $requestStackRouterInterface $routerFormManager $formManagerEntityManagerInterface $emApiServer1C $apiServer1CSessionInterface $sessionFilesystem $filesystemMediaExtensionVidi $mediaExtensionVidiRepository $vehicleRepositoryVehicleFactory $vehicleFactoryEnvironment $twig)
  25.     {
  26.         parent::__construct($coreFormFactory$seoMetaTag$requestStack$router$formManager$em$apiServer1C$session$filesystem$mediaExtensionVidi$vehicleRepository$vehicleFactory$twig);
  27.     }
  28.     public function insurance(): Response
  29.     {
  30.         return $this->baseNissanArmada('@DcSite/Nissan_Armada/Finance/insurance.html.twig', [
  31.             'insuranceForm' => $this->CoreFormFactory()->orderCallForm(null$this->getDealer())->createView(),
  32.             'questionForm' => $this->CoreFormFactory()->fbDefQuestionForm('Заявка на страховку'ViDiDepartmentModel::DEPARTMENT_TYPE_FINANCEnull$this->getDealer())->createView()
  33.         ]);
  34.     }
  35.     public function korp(): ?Response
  36.     {
  37.         return $this->baseNissanArmada('@DcSite/Nissan_Armada/Finance/korp-clientam.html.twig', [
  38.             'serviceOrderForm' => $this->CoreFormFactory()->servicesOrderForm(ServicesOrderForm::CORPORATIVE_PROGRAM)->createView()
  39.         ]);
  40.     }
  41.     public function kredit(Request $requestViDiWorkerModel $viDiWorkerModel): ?Response
  42.     {
  43.         $departments $viDiWorkerModel->getAllByDealer($this->getDealer(), $request->getLocale());
  44.         $needDepartment $request->getLocale() == 'ru' 'Отдел продаж' 'Відділ продажу';
  45.         $team array_filter($departments, fn($department) => $department['departmentTitle'] === $needDepartment);
  46.         $form $this->CoreFormFactory()
  47.             ->callMeForm(new Forms(), true);
  48.         $form->get('dealer')->setData($this->getDealer());
  49.         return $this->baseNissanArmada('@DcSite/Nissan_Armada/Finance/kredit.html.twig', [
  50.             'creditForm' => $this->CoreFormFactory()->creditForm($this->getDealer())->createView(),
  51.             'brandId' => $this->getDealer()->getBrand()->getId(),
  52.             'dealerId' => $this->getDealer()->getId(),
  53.             'team' => current($team),
  54.             'callMeForm' => $form->createView(),
  55.             'serviceOrderForm' => $this->CoreFormFactory()->servicesOrderForm(ServicesOrderForm::LOYALTY)->createView()
  56.         ]);
  57.     }
  58.     public function leasing(): ?Response
  59.     {
  60.         return $this->baseNissanArmada('@DcSite/Nissan_Armada/Finance/leasing.html.twig', [
  61.             'leasingCalculatorForm' => $this->CoreFormFactory()->leasingForm()->createView(),
  62.         ]);
  63.     }
  64.     public function assistance(): ?Response
  65.     {
  66.         return $this->baseNissanArmada('@DcSite/Nissan_Armada/Finance/nissan-assistance.html.twig');
  67.     }
  68.     public function nissanFinance(): ?Response
  69.     {
  70.         return $this->baseNissanArmada('@DcSite/Nissan_Armada/Finance/nissan-finance.html.twig', [
  71.             'serviceOrderForm' => $this->CoreFormFactory()->servicesOrderForm(ServicesOrderForm::CREDIT)->createView()
  72.         ]);
  73.     }
  74.     public function tradeIn(): ?Response
  75.     {
  76.         return $this->baseNissanArmada('@DcSite/Nissan_Armada/Finance/trade-in.html.twig', [
  77.             'serviceOrderForm' => $this->CoreFormFactory()->servicesOrderForm(ServicesOrderForm::CREDIT)->createView()
  78.         ]);
  79.     }
  80.     public function loyality(): ?Response
  81.     {
  82.         return $this->baseNissanArmada('@DcSite/Nissan_Armada/Finance/loyality.html.twig', [
  83.             'serviceOrderForm' => $this->CoreFormFactory()->servicesOrderForm(ServicesOrderForm::LOYALTY)->createView()
  84.         ]);
  85.     }
  86.     public function airport(Request $request): ?Response
  87.     {
  88.         return $this->baseNissanArmada('@DcSite/Nissan_Armada/Finance/airport.html.twig', [
  89.             'serviceOrderForm' => $this->CoreFormFactory()->servicesOrderForm(ServicesOrderForm::AIRPORT_SERVICE$request->getLocale())->createView(),
  90.         ]);
  91.     }
  92.     public function selectPage(): ?Response
  93.     {
  94.         return $this->baseNissanArmada('@DcSite/Nissan_Armada/Finance/vidi-select.html.twig');
  95.     }
  96.     //FOR BUSSINES
  97.     public function forBussines(): ?Response
  98.     {
  99.         return $this->baseNissanArmada('@DcSite/Nissan_Armada/Finance/for-bussines.html.twig', [
  100.             'corpSalesForm' => $this->CoreFormFactory()->corpSalesForm($this->getDealer())->createView()
  101.         ]);
  102.     }
  103.     //landing page
  104.     public function landingTradeIn(): ?Response
  105.     {
  106.         return $this->baseNissanArmada('@DcSite/Nissan_Armada/Finance/landing-trade-in.html.twig');
  107.     }
  108.     public function landingSelectPage(): ?Response
  109.     {
  110.         return $this->baseNissanArmada('@DcSite/Nissan_Armada/Finance/landing-vidi-select.html.twig');
  111.     }
  112.     // Sms landing page
  113.     public function SmsLandingTradeIn(Request $request): ?Response
  114.     {
  115.         if ($this->checkSend($request)) {
  116.             return $this->baseNissanArmada('@DcSite/Nissan_Armada/Finance/sms-landing-vidi-select.html.twig');
  117.         }
  118.         $this->sendSmsLead($request);
  119.         return $this->baseNissanArmada('@DcSite/Nissan_Armada/Finance/sms-landing-vidi-select.html.twig');
  120.     }
  121. }