- <?php
- namespace DcSiteBundle\Controller\Peugeot;
- use CoreBundle\Entity\Post;
- use CoreBundle\Model\ViDiWorkerModel;
- use DcSiteBundle\Entity\SalesContract;
- use DcSiteBundle\Entity\TermsMaintenance;
- use DcSiteBundle\Entity\Vacancy;
- use Symfony\Component\HttpFoundation\Request;
- use Symfony\Component\HttpFoundation\Response;
- use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
- class AboutController extends BaseController
- {
-     public function about(): ?Response
-     {
-         return $this->basePeugeotRender('@DcSite/Peugeot/About/about-company.html.twig');
-     }
-     public function news(): ?Response
-     {
-         $news = $this->em->getRepository(Post::class)->getNewsByDealer($this->getDealer());
-         return $this->basePeugeotRender('@DcSite/Peugeot/About/news.html.twig', ['news' => $news]);
-     }
-     public function newsSingle(\CoreBundle\Model\Post $postModel, $url): ?Response
-     {
-         $post = $postModel->initByUrl($this->getDealer(), $url);
-         return $this->basePeugeotRender('@DcSite/Peugeot/About/news-single.html.twig', [
-             'post' => $post,
-         ]);
-     }
-     public function qualityPolicy(): ?Response
-     {
-         return $this->basePeugeotRender('@DcSite/Peugeot/About/quality-policy.html.twig');
-     }
-     public function contacts(): ?Response
-     {
-         return $this->basePeugeotRender('@DcSite/Peugeot/About/contacts.html.twig');
-     }
-     public function conditionsSales(): ?Response
-     {
-         $filesByType = $this->em->getRepository(SalesContract::class)->getFilesByTypes($this->getDealer());
-         return $this->basePeugeotRender('@DcSite/Peugeot/About/conditions-of-sales.html.twig', [
-             'filesByType' => $filesByType,
-         ]);
-     }
-     public function termsMaintenance(): ?Response
-     {
-         $files = $this->em->getRepository(TermsMaintenance::class)->findBy(['dealer' => $this->getDealer()], ['begin_date' => 'ASC']);
-         return $this->basePeugeotRender('@DcSite/Peugeot/terms-maintenance.html.twig', [
-             'mainFile' => array_pop($files),
-             'files' => $files,
-             'dealer' => $this->getDealer(),
-         ]);
-     }
-     public function staff(Request $request, ViDiWorkerModel $viDiWorkerModel): ?Response
-     {
-         $workers = $viDiWorkerModel->getAllByDealer($this->getDealer(), $request->getLocale());
-         return $this->basePeugeotRender('@DcSite/Peugeot/About/staff.html.twig', [
-             'workers' => $workers,
-         ]);
-     }
-     //    Вакансії
-     public function vacancy(): ?Response
-     {
-         $vacancies = $this->em->getRepository(Vacancy::class)->getByDealer($this->getDealer());
-         return $this->basePeugeotRender('@DcSite/Peugeot/About/vacancy.html.twig', [
-             'vacancies' => $vacancies,
-         ]);
-     }
-     //    Вакансія ID
-     public function vacancyId($id): ?Response
-     {
-         $vacancy = $this->em->getRepository(Vacancy::class)->getByID($id);
-         if (!$vacancy) {
-             throw new NotFoundHttpException();
-         }
-         return $this->basePeugeotRender('@DcSite/Peugeot/About/vacancy-id.html.twig', [
-             'vacancy' => $vacancy,
-             'vacancyForm' => $this->CoreFormFactory()->vacancyForm($this->getDealer(), $vacancy)->createView(),
-         ]);
-     }
-     public function publicOffer(): ?Response
-     {
-         return $this->basePeugeotRender('@DcSite/Peugeot/About/public-offer.html.twig', ['dealer' => $this->getDealer()]);
-     }
-     public function returnRefundPolicies(): ?Response
-     {
-         return $this->basePeugeotRender('@DcSite/Peugeot/About/return-refund-policies.html.twig');
-     }
- }
-