src/DcSiteBundle/Controller/Morris_Garage/FinanceController.php line 62

Open in your IDE?
  1. <?php
  2. namespace DcSiteBundle\Controller\Morris_Garage;
  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\ViDiWorkerModel;
  10. use CoreBundle\Services\MediaExtensionVidi;
  11. use Doctrine\ORM\EntityManagerInterface;
  12. use PortalBundle\Model\SeoMetaTag;
  13. use Symfony\Component\Filesystem\Filesystem;
  14. use Symfony\Component\HttpFoundation\Request;
  15. use Symfony\Component\HttpFoundation\RequestStack;
  16. use Symfony\Component\HttpFoundation\Response;
  17. use Symfony\Component\HttpFoundation\Session\SessionInterface;
  18. use Symfony\Component\Routing\RouterInterface;
  19. use Twig\Environment;
  20. class FinanceController extends BaseController
  21. {
  22.     public function __construct(CoreFormFactory $coreFormFactorySeoMetaTag $seoMetaTagRequestStack $requestStackRouterInterface $routerFormManager $formManagerEntityManagerInterface $emApiServer1C $apiServer1CSessionInterface $sessionFilesystem $filesystemMediaExtensionVidi $mediaExtensionVidiRepository $vehicleRepositoryVehicleFactory $vehicleFactoryEnvironment $twig)
  23.     {
  24.         parent::__construct($coreFormFactory$seoMetaTag$requestStack$router$formManager$em$apiServer1C$session$filesystem$mediaExtensionVidi$vehicleRepository$vehicleFactory$twig);
  25.     }
  26.     public function credit(Request $requestViDiWorkerModel $viDiWorkerModel): ?Response
  27.     {
  28.         $departments $viDiWorkerModel->getAllByDealer($this->getDealer(), $request->getLocale());
  29.         $needDepartment $request->getLocale() == 'ru' 'Отдел продаж' 'Відділ продажу';
  30.         $team array_filter($departments, fn($department) => $department['departmentTitle'] === $needDepartment);
  31.         $form $this->CoreFormFactory()
  32.             ->callMeForm(new Forms(), true);
  33.         $form->get('dealer')->setData($this->getDealer());
  34.         return $this->baseMorrisGarageRender('@DcSite/Morris_Garage/Finance/credit.html.twig', [
  35.             'creditForm' => $this->CoreFormFactory()->creditForm($this->getDealer())->createView(),
  36.             'brandId' => $this->getDealer()->getBrand()->getId(),
  37.             'dealerId' => $this->getDealer()->getId(),
  38.             'team' => current($team),
  39.             'callMeForm' => $form->createView(),
  40.         ]);
  41.     }
  42.     public function tradeIn(): ?Response
  43.     {
  44.         return $this->baseMorrisGarageRender('@DcSite/Morris_Garage/Finance/trade-in.html.twig');
  45.     }
  46.     public function leasing(): ?Response
  47.     {
  48.         return $this->baseMorrisGarageRender('@DcSite/Morris_Garage/Finance/leasing.html.twig', [
  49.             'leasingCalculatorForm' => $this->get('core.form.factory')->leasingForm()->createView(),
  50.         ]);
  51.     }
  52.     public function warranty(): ?Response
  53.     {
  54.         return $this->baseMorrisGarageRender('@DcSite/Morris_Garage/Finance/warranty.html.twig');
  55.     }
  56.     public function insurance(): ?Response
  57.     {
  58.         return $this->baseMorrisGarageRender('@DcSite/Morris_Garage/Finance/insurance.html.twig');
  59.     }
  60.     public function selectPage(): ?Response
  61.     {
  62.         return $this->baseMorrisGarageRender('@DcSite/Morris_Garage/Finance/vidi-select.html.twig');
  63.     }
  64.     //FOR BUSSINES
  65.     public function forBussines(): ?Response
  66.     {
  67.         return $this->baseMorrisGarageRender('@DcSite/Morris_Garage/Finance/for-bussines.html.twig', [
  68.             'corpSalesForm' => $this->CoreFormFactory()->corpSalesForm($this->getDealer())->createView()
  69.         ]);
  70.     }
  71.     //landing page
  72.     public function landingTradeIn(): ?Response
  73.     {
  74.         return $this->baseMorrisGarageRender('@DcSite/Morris_Garage/Finance/landing-trade-in.html.twig');
  75.     }
  76.     public function landingSelectPage(): ?Response
  77.     {
  78.         return $this->baseMorrisGarageRender('@DcSite/Morris_Garage/Finance/landing-vidi-select.html.twig');
  79.     }
  80.     // Sms landing page
  81.     public function SmsLandingTradeIn(Request $request): ?Response
  82.     {
  83.         if ($this->checkSend($request)) {
  84.             return $this->baseMorrisGarageRender('@DcSite/Morris_Garage/Finance/sms-landing-vidi-select.html.twig');
  85.         }
  86.         $this->sendSmsLead($request);
  87.         return $this->baseMorrisGarageRender('@DcSite/Morris_Garage/Finance/sms-landing-vidi-select.html.twig');
  88.     }
  89. }