<?php
namespace DcSiteBundle\Controller\Honda;
use CoreBundle\Component\CoreFormFactory;
use CoreBundle\Component\FormManager;
use CoreBundle\Entity\Model;
use CoreBundle\Factory\Vehicle as VehicleFactory;
use CoreBundle\Model\Api\OnlineService\ApiServer1C;
use CoreBundle\Model\Vehicles\Repository;
use CoreBundle\Services\MediaExtensionVidi;
use DcSiteBundle\Services\VehicleService;
use Doctrine\ORM\EntityManagerInterface;
use PortalBundle\Model\SeoMetaTag;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\HttpFoundation\RedirectResponse;
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 HondaServiceController 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 signHonda(): ?Response
{
return $this->baseHondaRender('@DcSite/Honda/HondaService/order-to.html.twig', [
'serviceForm' => $this->CoreFormFactory()->serviceForm()->createView(),
'dealer' => $this->getDealer(),
'dealerName' => $this->getDealer()->getBrand()->getName()
]);
}
public function regulationsTo(VehicleService $vehicleService): ?Response
{
$models = $vehicleService->getModelsForRegulationsTo($this->getDealer());
return $this->baseHondaRender('@DcSite/Honda/HondaService/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->baseHondaRender('@DcSite/Honda/HondaService/regulations-to-model.html.twig', [
'model' => $model->getId(),
'modelTitle' => $model->getTitle(),
]);
}
public function sparesHonda(): ?Response
{
return $this->baseHondaRender('@DcSite/Honda/HondaService/spare-parts.html.twig');
}
public function autoCheckHonda(): ?Response
{
return $this->baseHondaRender('@DcSite/Honda/HondaService/auto-check.html.twig');
}
public function guaranteeHonda(): ?Response
{
return $this->baseHondaRender('@DcSite/Honda/HondaService/guarantee.html.twig');
}
public function cardSupportHonda(): ?Response
{
return $this->baseHondaRender('@DcSite/Honda/HondaService/card-support.html.twig');
}
public function bodyRepairHonda(): ?Response
{
$repairPhotoForm = $this->CoreFormFactory()->repairPhotoForm();
return $this->baseHondaRender('@DcSite/Honda/HondaService/body-repair.html.twig', [
'repairPhotoForm' => $repairPhotoForm->createView(),
]);
}
public function accessories(ContainerInterface $container): RedirectResponse
{
return $this->redirect('https://' . $container->getParameter('shop_honda_host') . '/', Response::HTTP_MOVED_PERMANENTLY);
}
public function extendedWarranty(): ?Response
{
return $this->baseHondaRender('@DcSite/Honda/HondaService/extended-warranty.html.twig', [
'servicesForm' => $this->CoreFormFactory()->extendedWarrantyForm(null, $this->getDealer())->createView(),
]);
}
public function multiConsultationEnter(): ?Response
{
return $this->baseHondaRender('@DcSite/Honda/HondaService/consultation.html.twig');
}
public function multiConsultationForm(): ?Response
{
return $this->baseHondaRender('@DcSite/Honda/HondaService/consultation-form.html.twig');
}
public function multiConsultationFormOnline(): ?Response
{
return $this->baseHondaRender('@DcSite/Honda/HondaService/consultation-form-online.html.twig');
}
public function multiConsultationTestdriveForm(): ?Response
{
return $this->baseHondaRender('@DcSite/Honda/HondaService/consultation-testdrive-form.html.twig');
}
public function nightServiceAgreement(): ?Response
{
return $this->baseHondaRender('@DcSite/Honda/HondaService/night-service-agreement.html.twig', [
'dealer' => $this->getDealer()
]);
}
}