src/Controller/PageController.php line 60

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\Entity\Calculator;
  4. use App\Entity\Conditions;
  5. use App\Entity\CoreBanking\RlApp;
  6. use App\Entity\Files;
  7. use App\Entity\FooterInfo;
  8. use App\Entity\HomeHeader;
  9. use App\Entity\HomeSlider;
  10. use App\Entity\LoanTypes;
  11. use App\Entity\LoanTypesSlider;
  12. use App\Entity\Percent;
  13. use App\Entity\PhoneOperator;
  14. use App\Entity\User;
  15. use App\Models\Constants;
  16. use App\Service\ChatbotServices\IpCheckService;
  17. use App\Service\DetectDeviceService;
  18. use App\Service\ErrorHandlingService;
  19. use App\Service\FilesService;
  20. use Doctrine\ORM\EntityManagerInterface;
  21. use Symfony\Bridge\Twig\Mime\TemplatedEmail;
  22. use Symfony\Component\HttpFoundation\Cookie;
  23. use Symfony\Component\HttpFoundation\Request;
  24. use Symfony\Component\HttpFoundation\RequestStack;
  25. use Symfony\Component\Mailer\MailerInterface;
  26. use Symfony\Component\Mime\Address;
  27. use Symfony\Component\Routing\Annotation\Route;
  28. use Symfony\Component\Security\Core\Exception\AuthenticationException;
  29. use Symfony\Contracts\Translation\TranslatorInterface;
  30. class PageController extends BaseController
  31. {
  32.     private $em;
  33.     protected $translator;
  34.     private $detectDeviceService;
  35.     private $fileService;
  36.     public function __construct(ErrorHandlingService $errorHandlingServiceEntityManagerInterface $emTranslatorInterface $translatorDetectDeviceService $detectDeviceServiceFilesService $fileService)
  37.     {
  38.         parent::__construct($errorHandlingService);
  39.         $this->em $em;
  40.         $this->translator $translator;
  41.         $this->detectDeviceService $detectDeviceService;
  42.         $this->fileService $fileService;
  43.     }
  44.     /**
  45.      * @Route("/{_locale}", name="home",
  46.      * requirements={
  47.      *      "_locale": "am|ru"
  48.      *  },
  49.      *  defaults={
  50.      *      "_locale": "am"
  51.      *  }
  52.      * )
  53.      */
  54.     public function number(Request $request)
  55.     {
  56.         try {
  57.             $insurance $this->em->getRepository(Calculator::class)->findOneBy(["type" => "insurance"]);
  58.             $bankCard $this->em->getRepository(Calculator::class)->findOneBy(["type" => "bankCard"]);
  59.             $currentUrl 'https://' $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
  60.             $lastCharacter null;
  61.             if (strpos($currentUrl'source') !== false && strpos($currentUrl'medium') !== false && strpos($currentUrl'campaign') !== false) {
  62.                 $lastCharacter substr($currentUrl, -3);
  63.             }
  64.             $device $this->detectDeviceService->getDevice();
  65.             $socCard $request->get('num');
  66.             $amount $request->get('amount');
  67.             $duration $request->get('duration');
  68.             $amountStepPercent $request->get('amountStepPercent');
  69.             $durationStepPercent $request->get('durationStepPercent');
  70.             $isDiscountForInsure $request->get('isDiscountForInsure');
  71.             $isDiscountForBankCard $request->get('isDiscountForBankCard');
  72.             $user $this->getUser();
  73.             if (isset($user) && !$user->getisChangePassword()) {
  74.                 return $this->redirectToRoute('change-password');
  75.             }
  76.             $homeHeader $this->em->getRepository(HomeHeader::class)->findAll();
  77.             $homeSlider $this->em->getRepository(HomeSlider::class)->findAll();
  78.             $loanTypes $this->em->getRepository(LoanTypes::class)->findAll();
  79.             $loanTypesSlider $this->em->getRepository(LoanTypesSlider::class)->findAll();
  80.             $phoneOperators $this->em->getRepository(PhoneOperator::class)->findAll();
  81.             $percentRep $this->em->getRepository(Percent::class)->findOneBy(['orderNumber' => 1]);
  82.             $condition $this->em->getRepository(Conditions::class)->findOneBy(['orderNumber' => 1]);
  83.             $conditionInsurance $this->em->getRepository(Conditions::class)->findOneBy(['orderNumber' => 4]);
  84.             $baseUrl $_ENV['BASE_URL'];
  85.             $operatorsArray = [];
  86.             foreach ($phoneOperators as $code) {
  87.                 array_push($operatorsArray,$code->getCode());
  88.             }
  89. //            $recaptchaKey = $_ENV['RECAPTCHA3_KEY'];
  90.             $check false;
  91.             if ($check) {
  92.                 throw new \Exception('not_found'1);
  93.             }
  94. //            dump($socCard);die();
  95. //            $appProdSubType = $em->getRepository('App:CoreBanking\Diction')->findBy(['dataType' => 'appProdSubType']);
  96.             return $this->render('page/home.html.twig', [
  97. //                'recaptchaKey' => $recaptchaKey,
  98.                 'homeHeader' => $homeHeader,
  99.                 'homeSlider' => $homeSlider,
  100.                 'loanTypesSlider' => $loanTypesSlider,
  101.                 'loanTypes' => $loanTypes,
  102.                 'socCard' => $socCard,
  103.                 'amount' => $amount,
  104.                 'duration' => $duration,
  105.                 'amountStepPercent' => $amountStepPercent,
  106.                 'durationStepPercent' => $durationStepPercent,
  107.                 'isDiscountForInsure' => $isDiscountForInsure,
  108.                 'isDiscountForBankCard' => $isDiscountForBankCard,
  109.                 'device' => $device,
  110.                 'operatorsArray' => json_encode($operatorsArray),
  111.                 'percentData' => $percentRep,
  112.                 'conditions' => $condition,
  113.                 'conditionsInsurance' => $conditionInsurance,
  114.                 'baseUrl' => $baseUrl,
  115.                 'lastCharacterQr' => $lastCharacter,
  116.                 'insurance' => $insurance,
  117.                 'bankCard' => $bankCard,
  118. //                'appProdSubType' => $appProdSubType,
  119.             ]);
  120.         } catch (\Exception $e) {
  121.             throw new \ErrorException($e->getMessage(), $e->getCode());
  122.         }
  123.     }
  124.     /**
  125.      * @Route("/{_locale}/sms", name="sms",
  126.      * requirements={
  127.      *      "_locale": "am|ru"
  128.      *  },
  129.      *  defaults={
  130.      *      "_locale": "am"
  131.      *  }
  132.      * )
  133.      */
  134.     public function smsAction(Request $request)
  135.     {
  136.         try {
  137.             $device $this->detectDeviceService->getDevice();
  138.             $socCard $request->get('num');
  139.             $amount $request->get('amount');
  140.             $duration $request->get('duration');
  141.             $user $this->getUser();
  142.             if (isset($user) && !$user->getisChangePassword()) {
  143.                 return $this->redirectToRoute('change-password');
  144.             }
  145.             $homeHeader $this->em->getRepository(HomeHeader::class)->findAll();
  146.             $homeSlider $this->em->getRepository(HomeSlider::class)->findAll();
  147.             $loanTypes $this->em->getRepository(LoanTypes::class)->findAll();
  148.             $loanTypesSlider $this->em->getRepository(LoanTypesSlider::class)->findAll();
  149.             $phoneOperators $this->em->getRepository(PhoneOperator::class)->findAll();
  150.             $percentRep $this->em->getRepository(Percent::class)->findOneBy(['orderNumber' => 1]);
  151.             $condition $this->em->getRepository(Conditions::class)->findOneBy(['orderNumber' => 1]);
  152.             $conditionInsurance $this->em->getRepository(Conditions::class)->findOneBy(['orderNumber' => 4]);
  153.             $baseUrl $_ENV['BASE_URL'];
  154.             $operatorsArray = [];
  155.             foreach ($phoneOperators as $code) {
  156.                 array_push($operatorsArray,$code->getCode());
  157.             }
  158.             $check false;
  159.             if ($check) {
  160.                 throw new \Exception('not_found'1);
  161.             }
  162.             return $this->render('page/home.html.twig', [
  163.                 'homeHeader' => $homeHeader,
  164.                 'homeSlider' => $homeSlider,
  165.                 'loanTypesSlider' => $loanTypesSlider,
  166.                 'loanTypes' => $loanTypes,
  167.                 'socCard' => $socCard,
  168.                 'amount' => $amount,
  169.                 'duration' => $duration,
  170.                 'device' => $device,
  171.                 'operatorsArray' => json_encode($operatorsArray),
  172.                 'percentData' => $percentRep,
  173.                 'conditions' => $condition,
  174.                 'conditionsInsurance' => $conditionInsurance,
  175.                 'baseUrl' => $baseUrl,
  176.             ]);
  177.         } catch (\Exception $e) {
  178.             throw new \ErrorException($e->getMessage(), $e->getCode());
  179.         }
  180.     }
  181.     
  182.     /**
  183.      * @Route("/{_locale}/email", name="email",
  184.      * requirements={
  185.      *      "_locale": "am|ru"
  186.      *  },
  187.      *  defaults={
  188.      *      "_locale": "am"
  189.      *  }
  190.      * )
  191.      */
  192.     public function emailAction(Request $request)
  193.     {
  194.         try {
  195.             $device $this->detectDeviceService->getDevice();
  196.             $socCard $request->get('num');
  197.             $amount $request->get('amount');
  198.             $duration $request->get('duration');
  199.             $user $this->getUser();
  200.             if (isset($user) && !$user->getisChangePassword()) {
  201.                 return $this->redirectToRoute('change-password');
  202.             }
  203.             $homeHeader $this->em->getRepository(HomeHeader::class)->findAll();
  204.             $homeSlider $this->em->getRepository(HomeSlider::class)->findAll();
  205.             $loanTypes $this->em->getRepository(LoanTypes::class)->findAll();
  206.             $loanTypesSlider $this->em->getRepository(LoanTypesSlider::class)->findAll();
  207.             $phoneOperators $this->em->getRepository(PhoneOperator::class)->findAll();
  208.             $percentRep $this->em->getRepository(Percent::class)->findOneBy(['orderNumber' => 1]);
  209.             $condition $this->em->getRepository(Conditions::class)->findOneBy(['orderNumber' => 1]);
  210.             $conditionInsurance $this->em->getRepository(Conditions::class)->findOneBy(['orderNumber' => 4]);
  211.             $baseUrl $_ENV['BASE_URL'];
  212.             $operatorsArray = [];
  213.             foreach ($phoneOperators as $code) {
  214.                 array_push($operatorsArray,$code->getCode());
  215.             }
  216.             $check false;
  217.             if ($check) {
  218.                 throw new \Exception('not_found'1);
  219.             }
  220.             return $this->render('page/home.html.twig', [
  221.                 'homeHeader' => $homeHeader,
  222.                 'homeSlider' => $homeSlider,
  223.                 'loanTypesSlider' => $loanTypesSlider,
  224.                 'loanTypes' => $loanTypes,
  225.                 'socCard' => $socCard,
  226.                 'amount' => $amount,
  227.                 'duration' => $duration,
  228.                 'device' => $device,
  229.                 'operatorsArray' => json_encode($operatorsArray),
  230.                 'percentData' => $percentRep,
  231.                 'conditions' => $condition,
  232.                 'conditionsInsurance' => $conditionInsurance,
  233.                 'baseUrl' => $baseUrl,
  234.             ]);
  235.         } catch (\Exception $e) {
  236.             throw new \ErrorException($e->getMessage(), $e->getCode());
  237.         }
  238.     }
  239.     /**
  240.      * @Route("/{_locale}/requests", name="requests",
  241.      * requirements={
  242.      *      "_locale": "am|ru"
  243.      *  },
  244.      *  defaults={
  245.      *      "_locale": "am"
  246.      *  }
  247.      * )
  248.      */
  249.     public function requests(Request $request)
  250.     {
  251.         $user $this->getUser();
  252.         if (!$user) {
  253.             return $this->redirectToRoute('login');
  254.         }
  255.         $allRequest $this->em->getRepository(RlApp::class)->findBy(['socCard' => $user->getSocCardNumber()],['createdAt' => 'DESC']);
  256.         $photo $this->em->getRepository(Files::class)->findOneBy(['id' => $user->getUserAvatar()]);
  257.         if ($photo) {
  258.             $userAvatar $this->fileService->fileToBase64($photo);
  259.         } else {
  260.             $userAvatar '';
  261.         }
  262. //        dump($allRequest);die();
  263.         return $this->render('page/requests.html.twig', array(
  264.             'user' => $user,
  265.             'allRequest' => $allRequest,
  266.             'userAvatar' => $userAvatar,
  267.         ));
  268.     }
  269. //    /**
  270. //     * @Route("/{_locale}/conditions-akra-ekeng-nork", name="conditions-akra-ekeng-nork",
  271. //     * requirements={
  272. //     *      "_locale": "am|ru"
  273. //     *  },
  274. //     *  defaults={
  275. //     *      "_locale": "am"
  276. //     *  }
  277. //     * )
  278. //     */
  279. //    public function conditionsOne(Request $request)
  280. //    {
  281. //        $condition = $this->em->getRepository(Conditions::class)->findOneBy(['orderNumber' => 1]);
  282. //
  283. //        return $this->render('page/conditions-one.html.twig', array(
  284. //            'conditions' => $condition,
  285. //            
  286. //        ));
  287. //    }
  288. //    /**
  289. //     * @Route("/{_locale}/conditions-credit", name="conditions-credit",
  290. //     * requirements={
  291. //     *      "_locale": "am|ru"
  292. //     *  },
  293. //     *  defaults={
  294. //     *      "_locale": "am"
  295. //     *  }
  296. //     * )
  297. //     */
  298. //    public function conditionsTwo(Request $request)
  299. //    {
  300. //        $condition = $this->em->getRepository(Conditions::class)->findOneBy(['orderNumber' => 2]);
  301. //
  302. //        return $this->render('page/conditions-one.html.twig', array(
  303. //            'conditions' => $condition,
  304. //
  305. //        ));
  306. //    }
  307. //    /**
  308. //     * @Route("/{_locale}/conditions-open-credit", name="conditions-open-credit",
  309. //     * requirements={
  310. //     *      "_locale": "am|ru"
  311. //     *  },
  312. //     *  defaults={
  313. //     *      "_locale": "am"
  314. //     *  }
  315. //     * )
  316. //     */
  317. //    public function conditionsThree(Request $request)
  318. //    {
  319. //        $condition = $this->em->getRepository(Conditions::class)->findOneBy(['orderNumber' => 3]);
  320. //
  321. //        return $this->render('page/conditions-one.html.twig', array(
  322. //            'conditions' => $condition,
  323. //
  324. //        ));
  325. //    }
  326. //    /**
  327. //     * @Route("/{_locale}/conditions-four", name="conditions-four",
  328. //     * requirements={
  329. //     *      "_locale": "am|ru"
  330. //     *  },
  331. //     *  defaults={
  332. //     *      "_locale": "am"
  333. //     *  }
  334. //     * )
  335. //     */
  336. //    public function conditionsFour(Request $request)
  337. //    {
  338. //        $condition = $this->em->getRepository(Conditions::class)->findOneBy(['orderNumber' => 4]);
  339. //
  340. //        return $this->render('page/conditions-one.html.twig', array(
  341. //            'conditions' => $condition,
  342. //
  343. //        ));
  344. //    }
  345. //    /**
  346. //     * @Route("/{_locale}/conditions-five", name="conditions-five",
  347. //     * requirements={
  348. //     *      "_locale": "am|ru"
  349. //     *  },
  350. //     *  defaults={
  351. //     *      "_locale": "am"
  352. //     *  }
  353. //     * )
  354. //     */
  355. //    public function conditionsFive(Request $request)
  356. //    {
  357. //        $condition = $this->em->getRepository(Conditions::class)->findOneBy(['orderNumber' => 5]);
  358. //
  359. //        return $this->render('page/conditions-one.html.twig', array(
  360. //            'conditions' => $condition,
  361. //
  362. //        ));
  363. //    }
  364.     /**
  365.      * @Route("/{_locale}/credit-types-view", name="credit_types_view",
  366.      * requirements={
  367.      *      "_locale": "am|ru"
  368.      *  },
  369.      *  defaults={
  370.      *      "_locale": "am"
  371.      *  }
  372.      * )
  373.      */
  374.     public function credit_types_view(Request $request)
  375.     {
  376.         $user $this->getUser();
  377.         if (!$user) {
  378.             return $this->redirectToRoute('login');
  379.         }
  380.         $allRequest $this->em->getRepository(RlApp::class)->findBy(['socCard' => $user->getSocCardNumber()],['createdAt' => 'DESC']);
  381.         $photo $this->em->getRepository(Files::class)->findOneBy(['id' => $user->getUserAvatar()]);
  382.         if ($photo) {
  383.             $userAvatar $this->fileService->fileToBase64($photo);
  384.         } else {
  385.             $userAvatar '';
  386.         }
  387. //        dump($allRequest);die();
  388.         return $this->render('page/credit.html.twig', array(
  389.             'user' => $user,
  390.             'allRequest' => $allRequest,
  391.             'userAvatar' => $userAvatar,
  392.         ));
  393.     }
  394.     /**
  395.      * @Route("/{_locale}/info", name="info",
  396.      * requirements={
  397.      *      "_locale": "am|ru"
  398.      *  },
  399.      *  defaults={
  400.      *      "_locale": "am"
  401.      *  }
  402.      * )
  403.      */
  404.     public function info(Request $request)
  405.     {
  406.         $user $this->getUser();
  407.         if (!$user) {
  408.             return $this->redirectToRoute('login');
  409.         }
  410.         $photo $this->em->getRepository(Files::class)->findOneBy(['id' => $user->getUserAvatar()]);
  411.         if ($photo) {
  412.             $userAvatar $this->fileService->fileToBase64($photo);
  413.         } else {
  414.             $userAvatar '';
  415.         }
  416.         return $this->render('page/user_info.html.twig', array(
  417.             'user' => $user,
  418.             'userAvatar' => $userAvatar,
  419.             'username' => $user->getSocCardNumber(),
  420.         ));
  421.     }
  422.     /**
  423.      * @Route("/{_locale}/update-user-profile-information", name="update-user-profile-information",
  424.      * requirements={
  425.      *      "_locale": "am|ru"
  426.      *  },
  427.      *  defaults={
  428.      *      "_locale": "am"
  429.      *  }
  430.      * )
  431.      */
  432.     public function updateUserProfileInformationAction(Request $request)
  433.     {
  434.         try {
  435.             $user $this->getUser();
  436.             if (!$user)
  437.                 throw new AuthenticationException();
  438.             $newMail false;
  439.             if (!filter_var($_POST['mailAddress'], FILTER_VALIDATE_EMAIL)) {
  440.                 $this->addFlash('danger'$this->translator->trans('Invalid email format'));
  441.                 return $this->redirectToRoute('info');
  442.             } else {
  443.                 if ($_POST['mailAddress'] && $user->getEmail() !== $_POST['mailAddress']) {
  444.                     $checkEmail $this->em->getRepository(User::class)->findOneBy(['email' => $_POST['mailAddress']]);
  445.                     if ($checkEmail) {
  446.                         $this->addFlash('danger'$this->translator->trans('такой email уже зарегистрирован'));
  447.                         return $this->redirectToRoute('info');
  448.                     } else {
  449.                         $this->em->getRepository(User::class)->find($user->getId())->setEmail($_POST['mailAddress']);
  450.                         $this->em->getRepository(User::class)->find($user->getId())->setCheckEmail(false);
  451.                         $newMail true;
  452.                     }
  453.                 }
  454.             }
  455.             $numberPhone str_replace(["("")"" ""-""+"], ""$_POST['phoneNumber']);
  456.             $this->em->getRepository(User::class)->find($user->getId())->setPhoneNumber($numberPhone);
  457.             if (isset($_POST['isIndividual']) && $_POST['isIndividual']){
  458.                 $this->em->getRepository(User::class)->find($user->getId())->setIsIndividual(true);
  459.             } else {
  460.                 $this->em->getRepository(User::class)->find($user->getId())->setIsIndividual(false);
  461.             }
  462.             $this->em->flush();
  463.             $this->addFlash('success'$this->translator->trans('Ваши данные успешно обновлены'));
  464.             if ($newMail) {
  465.                 return $this->redirectToRoute('confirm-user-new-email');
  466.             } else {
  467.                 return $this->redirectToRoute('info');
  468.             }
  469.         } catch (\ErrorException $e) {
  470.             throw new \ErrorException($e->getMessage());
  471.         }
  472.     }
  473.     /**
  474.      * @Route("/confirm-user-new-email", name="confirm-user-new-email",
  475.      * requirements={
  476.      *      "_locale": "am|ru"
  477.      *  },
  478.      *  defaults={
  479.      *      "_locale": "am"
  480.      *  }
  481.      * )
  482.      */
  483.     public function confrimUserEmailAction($_localeMailerInterface $mailer)
  484.     {
  485.         try {
  486.             $user $this->getUser();
  487.             if (!$user)
  488.                 throw new AuthenticationException();
  489.             $code '0123456789asdfghjklmnbvcxzqwertyuiop0123456789asdfghjklmnbvcxzqwertyuiop0123456789asdfghjklmnbvcxzqwertyuiop0123456789asdfghjklmnbvcxzqwertyuiop0123456789asdfghjklmnbvcxzqwertyuiop0123456789asdfghjklmnbvcxzqwertyuiop0123456789asdfghjklmnbvcxzqwertyuiop0123456789asdfghjklmnbvcxzqwertyuiop0123456789asdfghjklmnbvcxzqwertyuiop0123456789asdfghjklmnbvcxzqwertyuiop0123456789asdfghjklmnbvcxzqwertyuiop0123456789asdfghjklmnbvcxzqwertyuiop';
  490.             $codeHash substr(str_shuffle($code), 064);
  491.             $this->em->getRepository(User::class)->find($user->getId())->setEmailHash($codeHash);
  492.             $this->em->getRepository(User::class)->find($user->getId())->setIsVerified(true);
  493.             $this->em->flush();
  494. //            $this->emailVerifier->sendEmailConfirmation('app_verify_email', $user,
  495. //                (new TemplatedEmail())
  496. //                    ->from(new Address($_ENV['FROM_EMAIL'], 'Toolbox Registration'))
  497. //                    ->to($user->getEmail())
  498. //                    ->subject('Банк ВТБ (Армения)')
  499. //                    ->htmlTemplate('Chatbot/confirm-profile-email.html.twig')
  500. //                    ->context([
  501. //                        'codeHash' => $codeHash,
  502. //                    ])
  503. //            );
  504.             return $this->redirectToRoute('info');
  505.         } catch (\ErrorException $e) {
  506.             throw new \ErrorException($e->getMessage());
  507.         }
  508.     }
  509.     /**
  510.      * @Route("/step-1", name="step_1")
  511.      */
  512.     public function step1(Request $request)
  513.     {
  514.         return $this->render('page/step_1.html.twig');
  515.     }
  516.     /**
  517.      * @Route("/step-2", name="step_2")
  518.      */
  519.     public function step2(Request $request)
  520.     {
  521.         $user $this->getUser();
  522.         if ($user) {
  523.             return $this->redirectToRoute('step_16');
  524.         }
  525.         return $this->render('page/step_2.html.twig');
  526.     }
  527.     /**
  528.      * @Route("/step-3", name="step_3")
  529.      */
  530.     public function step3(Request $request)
  531.     {
  532.         return $this->render('page/step_3.html.twig');
  533.     }
  534.     /**
  535.      * @Route("/step-5", name="step_5")
  536.      */
  537.     public function step5(Request $request)
  538.     {
  539.         return $this->render('page/step_5.html.twig');
  540.     }
  541.     /**
  542.      * @Route("/step-6", name="step_6")
  543.      */
  544.     public function step6(Request $request)
  545.     {
  546.         return $this->render('page/step_6.html.twig');
  547.     }
  548.     /**
  549.      * @Route("/step-7", name="step_7")
  550.      */
  551.     public function step7(Request $request)
  552.     {
  553.         return $this->render('page/step_7.html.twig');
  554.     }
  555.     /**
  556.      * @Route("/step-7-1", name="step_7_1")
  557.      */
  558.     public function step7_1(Request $request)
  559.     {
  560.         return $this->render('page/step_7_1.html.twig');
  561.     }
  562.     /**
  563.      * @Route("/step-8", name="step_8")
  564.      */
  565.     public function step8(Request $request)
  566.     {
  567.         return $this->render('page/step_8.html.twig');
  568.     }
  569.     /**
  570.      * @Route("/step-12", name="step_12")
  571.      */
  572.     public function step12(Request $request)
  573.     {
  574.         return $this->render('page/step_12.html.twig');
  575.     }
  576. //    /**
  577. //     * @Route("/step-16", name="step_16")
  578. //     */
  579. //    public function step16(IpCheckService $ipCheckService, Request $request, $wrongRequest = false, $shop = null, $formId = null, $cancelRequest = null, $requestId = null)
  580. //    {
  581. //        try {
  582. //            $em = $this->getDoctrine()->getManager();
  583. //            if ($shop) {
  584. //                $response = new \Symfony\Component\HttpFoundation\Response();
  585. //                $cookie = new Cookie('shop', $shop);
  586. //                $response->headers->setCookie($cookie);
  587. //                $response->sendHeaders();
  588. //            }
  589. //            $user = $this->getUser();
  590. //            if (!$user) {
  591. //                return $this->redirectToRoute('login');
  592. //            }
  593. //            $isLive = Constants::ISLIVE;
  594. //            $noApproved = false;
  595. //            $newApproved = false;
  596. //            $allShopAddress = $this->getDoctrine()->getRepository('App:Chatbot\ShopAdress')->findBy(['isVisible' => true], ['title' => 'ASC']);
  597. //            if (!$user->getApprovdedCode()) {
  598. //                return $this->redirectToRoute('beforeRegistration');
  599. //            }
  600. //            $reqCount = $this->getDoctrine()->getRepository('App:Chatbot\OnlineRequestInfo')->findBy(['userId' => $user->getId()]);
  601. //            if ($user->getEmail() === $user->getSocCardNumber() . '@mail.ru') {
  602. //                $oneReq = $this->getDoctrine()->getRepository('App:Chatbot\OnlineRequestInfo')->findBy(['userId' => $user->getId()]);
  603. //                if (count($oneReq) === 1) {
  604. //                    $noApproved = true;
  605. //                }
  606. //            } else if ($user->getEmail() !== $user->getSocCardNumber() . '@mail.ru' && !$user->getCheckEmail() && count($reqCount) > 0) {
  607. //                $newApproved = true;
  608. //            }
  609. //            if ($cancelRequest != null) {
  610. //                $currentRequest = $em->getRepository('App:Chatbot\OnlineRequestInfo')->findOneBy(['id' => $cancelRequest]);
  611. //                if ($currentRequest) {
  612. //                    $cancelClientStatus = $em->getRepository('App:Chatbot\OnlineRequestStatus')->find(8);
  613. //                    $currentRequest->setConfirmStatus($cancelClientStatus);
  614. //                    $em->flush();
  615. //                    return $this->redirectToRoute('step_6');
  616. //                }
  617. //            }
  618. //            $allRequest = $this->getDoctrine()->getRepository('App:Chatbot\OnlineRequestInfo')->findBy(['userId' => $user->getId()]);
  619. //            $lastFormSubmit = null;
  620. //            $ipBoolean = $ipCheckService->checkIp();
  621. //        }catch (\ErrorException $e){
  622. //            throw new \ErrorException($e->getMessage());
  623. //        }
  624. //
  625. //        return $this->render('page/step_16.html.twig',array(
  626. //            'allRequest' => $allRequest,
  627. //            'user' => $user,
  628. //            'noApproved' => $noApproved,
  629. //            'newApproved' => $newApproved,
  630. //            'wrongRequest' => $wrongRequest,
  631. //            'allShopAddress' => $allShopAddress,
  632. //            'isLive' => $isLive,
  633. //            'lastFormSubmit' => $lastFormSubmit,
  634. //            'ipBoolean' => $ipBoolean,
  635. //        ));
  636. //    }
  637. }