src/Controller/HomeController.php line 28

  1. <?php
  2. namespace App\Controller;
  3. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  4. use Symfony\Component\HttpFoundation\Response;
  5. use Symfony\Component\Routing\Annotation\Route;
  6. use Symfony\Component\HttpFoundation\Request;
  7. use Symfony\Component\Mailer\MailerInterface;
  8. use Symfony\Component\Mime\Email;
  9. use Symfony\Component\Mailer\Exception\TransportExceptionInterface;
  10. use Symfony\Component\Form\Extension\Core\Type\TextType;
  11. use Symfony\Component\Form\Extension\Core\Type\TextareaType;
  12. use App\Entity\Shipment;
  13. use App\Entity\Blog;
  14. use App\Repository\ShipmentRepository;
  15. use App\Repository\BlogRepository;
  16. use App\Repository\ImageGalleryRepository;
  17. use App\Repository\TrackingUpdateRepository;
  18. use App\Repository\SettingsInfoRepository;
  19. use App\Service\CookieService;
  20. class HomeController extends AbstractController
  21. {  
  22.      /**
  23.      * @Route("/", name="home")
  24.      */
  25.     public function index(): Response
  26.     {            
  27.         return $this->render('home/index.html.twig', [
  28.             'controller_name' => 'HomeController',            
  29.         ]);
  30.     }
  31.     /**
  32.      * @Route("/about", name="home_about")
  33.      */
  34.     public function about(): Response
  35.     {
  36.         return $this->render('home/about.html.twig', [
  37.             'controller_name' => 'HomeController',
  38.         ]);
  39.     }
  40.     /**
  41.      * @Route("/mission-vision", name="home_mission")
  42.      */
  43.     public function mission(): Response
  44.     {
  45.         return $this->render('home/mission.html.twig', [
  46.             'controller_name' => 'HomeController',
  47.         ]);
  48.     }
  49.     /**
  50.      * @Route("/team", name="home_team")
  51.      */
  52.     public function team(): Response
  53.     {
  54.         return $this->render('home/team.html.twig', [
  55.             'controller_name' => 'HomeController',
  56.         ]);
  57.     }
  58.     /**
  59.      * @Route("/mdmessage", name="home_mdmessage")
  60.      */
  61.     public function mdmessage(): Response
  62.     {
  63.         return $this->render('home/mdmessage.html.twig', [
  64.             'controller_name' => 'HomeController',
  65.         ]);
  66.     }
  67.     /**
  68.      * @Route("/guideline", name="home_guideline")
  69.      */
  70.     public function guideline(): Response
  71.     {
  72.         return $this->render('home/guideline.html.twig', [
  73.             'controller_name' => 'HomeController',
  74.         ]);
  75.     }
  76.     /**
  77.      * @Route("/terms", name="home_terms")
  78.      */
  79.     public function terms(): Response
  80.     {
  81.         return $this->render('home/terms.html.twig', [
  82.             'controller_name' => 'HomeController',
  83.         ]);
  84.     }
  85.     /**
  86.      * @Route("/all-services", name="home_allservices")
  87.      */
  88.     public function allservices(): Response
  89.     {
  90.         return $this->render('home/allservices.html.twig', [
  91.             'controller_name' => 'HomeController',
  92.         ]);
  93.     }
  94.     /**
  95.      * @Route("/customs-clearing", name="home_customsclearing")
  96.      */
  97.     public function customsclering(): Response
  98.     {
  99.         return $this->render('home/customsclering.html.twig', [
  100.             'controller_name' => 'HomeController',
  101.         ]);
  102.     }
  103.     /**
  104.      * @Route("/air-freight", name="home_airfreight")
  105.      */
  106.     public function airfreight(): Response
  107.     {
  108.         return $this->render('home/airfreight.html.twig', [
  109.             'controller_name' => 'HomeController',
  110.         ]);
  111.     }
  112.      /**
  113.      * @Route("/ocean-freight", name="home_oceanfreight")
  114.      */
  115.     public function oceanfreight(): Response
  116.     {
  117.         return $this->render('home/oceanfreight.html.twig', [
  118.             'controller_name' => 'HomeController',
  119.         ]);
  120.     }
  121.     /**
  122.      * @Route("/worldwide-express", name="home_express")
  123.      */
  124.     public function express(): Response
  125.     {
  126.         return $this->render('home/express.html.twig', [
  127.             'controller_name' => 'HomeController',
  128.         ]);
  129.     }
  130.     
  131.     /**
  132.      * @Route("/hand-carry", name="home_hand_carry")
  133.      */
  134.     public function handCarry(): Response
  135.     {
  136.         return $this->render('home/hand_carry.html.twig', [
  137.             'controller_name' => 'HomeController',
  138.         ]);
  139.     }
  140.     /**
  141.      * @Route("/saexpress", name="home_saexpress")
  142.      */
  143.     public function saexpress(): Response
  144.     {
  145.         return $this->render('home/saexpress.html.twig', [
  146.             'controller_name' => 'HomeController',
  147.         ]);
  148.     }
  149.     /**
  150.      * @Route("/sunnyint", name="home_sunnyint")
  151.      */
  152.     public function sunnyint(): Response
  153.     {
  154.         return $this->render('home/sunnyint.html.twig', [
  155.             'controller_name' => 'HomeController',
  156.         ]);
  157.     }
  158.     /**
  159.      * @Route("/eccf", name="home_eccf")
  160.      */
  161.     public function eccf(): Response
  162.     {
  163.         return $this->render('home/eccf.html.twig', [
  164.             'controller_name' => 'HomeController',
  165.         ]);
  166.     }
  167.     
  168.     /**
  169.      * @Route("/volumetric-weight", name="home_volumetricweight")
  170.      */
  171.     public function volumetricweight(): Response
  172.     {
  173.         return $this->render('home/volumetricweight.html.twig', [
  174.             'controller_name' => 'HomeController',
  175.         ]);
  176.     }
  177.     /**
  178.      * @Route("/contact", name="home_contact")
  179.      */
  180.     public function contact(Request $requestMailerInterface $mailer): Response
  181.     {
  182.         $confactform $this->createFormBuilder(null)  
  183.             ->add('fullName'TextType::class, [ 
  184.                 'attr' => ['placeholder' => 'Full Name*',],              
  185.                 'label' => false,
  186.                 
  187.                 ])
  188.         
  189.             ->add('email'TextType::class, [
  190.                 'attr' => ['placeholder' => 'Email*',],              
  191.                 'label' => false,
  192.                 
  193.                 ])
  194.             ->add('contactno'TextType::class, [   
  195.                 'attr' => [ 'placeholder' => 'Phone*',],           
  196.                 'label' => false,
  197.                             
  198.                     ])
  199.             ->add('subject'TextType::class, [   
  200.                 'attr' => ['placeholder' => 'Subject*',],            
  201.                 'label' => false,
  202.                 
  203.                         ])
  204.             ->add('message'TextareaType::class, [ 
  205.                 'attr' => ['cols' => '85''rows' => '3','placeholder' => 'Message*',],           
  206.                 'label' => false,
  207.                 
  208.                 ])        
  209.             ->getForm();
  210.         $confactform->handleRequest($request);
  211.        
  212.         if ($confactform->isSubmitted() && $confactform->isValid()) {
  213.            
  214.             $fullName =  $confactform->get('fullName')->getData();
  215.             $email =  $confactform->get('email')->getData();
  216.             $contactno =  $confactform->get('contactno')->getData();
  217.             $subject =  $confactform->get('subject')->getData();
  218.             $message =  $confactform->get('message')->getData();
  219.             // $strPosition = strpos(strtolower($subject), "sexy");            
  220.             // if($strPosition > -1)
  221.             // return $this->redirectToRoute('home_contact');
  222.             // $strPosition = strpos(strtolower($subject), "sex");            
  223.             // if($strPosition > -1)
  224.             // return $this->redirectToRoute('home_contact');
  225.             // $strPosition = strpos(strtolower($subject), "porn");            
  226.             // if($strPosition > -1)
  227.             // return $this->redirectToRoute('home_contact');
  228.             // $strPosition = strpos(strtolower($subject), "xxx");            
  229.             // if($strPosition > -1)
  230.             // return $this->redirectToRoute('home_contact');
  231.             // $strPosition = strpos(strtolower($message), "sexy");            
  232.             // if($strPosition > -1)
  233.             // return $this->redirectToRoute('home_contact');
  234.             // $strPosition = strpos(strtolower($message), "sex");            
  235.             // if($strPosition > -1)
  236.             // return $this->redirectToRoute('home_contact');
  237.             // $strPosition = strpos(strtolower($message), "porn");            
  238.             // if($strPosition > -1)
  239.             // return $this->redirectToRoute('home_contact');
  240.             // $strPosition = strpos(strtolower($message), "xxx");            
  241.             // if($strPosition > -1)
  242.             // return $this->redirectToRoute('home_contact');
  243.                       
  244.             // $email = (new Email())
  245.             //     ->from('contact@ewexltd.com')
  246.             //     ->to('afexsazib@gmail.com')
  247.             //     ->addTo('sunny.int96@gmail.com')
  248.             //     ->cc('ewexltdbd@gmail.com')
  249.             //     ->addCc('ewexltd@gmail.com') 
  250.             //     ->bcc('malayaroy99@gmail.com')  
  251.             //     //->replyTo('fabien@example.com')
  252.             //     //->priority(Email::PRIORITY_HIGH)
  253.             //     ->subject('Email from Contact of ewexltd.com Website')
  254.             //     ->text('Sending emails is fun again!')
  255.             //     ->html('<p> Sender Details Information: </p> <p> Full Name: '.$fullName.'<br> Email: '.$email.' <br> Contact No: '.$contactno.'<br> Subject : '.$subject .'<br> Message: '.$message.'</p><p>**The Email is a system-generated email.</p>');
  256.            
  257.             // try {
  258.                 
  259.             //     $mailer->send($email);
  260.             //     $this->addFlash('notice', 'Email has been sent successfully!');
  261.             //     return $this->redirectToRoute('home_contact');
  262.             // } catch (TransportExceptionInterface $e) {
  263.               
  264.             //     $this->addFlash('notice', 'Email not sent, Please try again.');
  265.             //     return $this->redirectToRoute('home_contact');
  266.             // }
  267.             return $this->redirectToRoute('home_contact');
  268.        }
  269.         return $this->render('home/contact.html.twig', [
  270.             'controller_name' => 'HomeController',
  271.             'confactform' => $confactform->createView(),
  272.         ]);
  273.     }
  274.     /**
  275.      * @Route("/progress", name="home_progress")
  276.      */
  277.     public function progress(): Response
  278.     {
  279.         return $this->render('home/progress.html.twig', [
  280.             'controller_name' => 'HomeController',
  281.         ]);
  282.     }
  283.     /**
  284.      * @Route("/gallery", name="home_gallery")
  285.      */
  286.     public function gallery(): Response
  287.     {
  288.         return $this->render('home/gallery.html.twig', [
  289.             'controller_name' => 'HomeController',
  290.         ]);
  291.     } 
  292.  
  293.     #[Route('/tracking'name'home_tracking')]
  294.     public function tracking(CookieService $cookieService): Response
  295.     {
  296.         $beforeAwbno $cookieService->getLastTrackingId();
  297.         return $this->render('home/tracking.html.twig', [
  298.             'controller_name' => 'HomeController',
  299.             'beforeAwbno' => $beforeAwbno,
  300.         ]);
  301.     }
  302.   
  303.     #[Route('/track'name'home_track')]
  304.     public function trackResult(Request $requestShipmentRepository $shipmentRepositoryTrackingUpdateRepository $trackingUpdateRepositoryCookieService $cookieService): Response
  305.     {
  306.         $data $request->request->get('awbNo');    
  307.         
  308.         $shipment $shipmentRepository->findOneBy(['hawbNo' => $data'trackingStatus' => ]);
  309.         if($shipment !== null)
  310.         {
  311.             $response $cookieService->setLastTrackingId($shipment->getHawbNo());           
  312.         }
  313.         else
  314.         {
  315.             $response null;
  316.         }
  317.         $trackingGroupBy $trackingUpdateRepository->findGroupByTrackingUpdate($data);
  318.         $beforeAwbno $cookieService->getLastTrackingId();
  319.                
  320.         return $this->render('home/trackResult.html.twig', [
  321.             'shipments' => $shipment,
  322.             'trackingGroupBy' => $trackingGroupBy,
  323.             'beforeAwbno' => $beforeAwbno,
  324.         ],
  325.         $response );
  326.     }
  327.     #[Route('/{hawbNo}/tracklink'name'home_tracking_link')]
  328.     public function trackingResultLink(Shipment $shipmentTrackingUpdateRepository $trackingUpdateRepositoryCookieService $cookieService)
  329.     { 
  330.         $beforeAwbno $cookieService->getLastTrackingId();
  331.         $trackingGroupBy $trackingUpdateRepository->findGroupByTrackingUpdate($shipment->getHawbNo());
  332.         return $this->render('home/trackResult.html.twig', [
  333.             'shipments' => $shipment,
  334.             'trackingGroupBy' => $trackingGroupBy,
  335.             'beforeAwbno' => $beforeAwbno,
  336.         ]);
  337.    
  338.     }
  339. }