src/OfficeBrain/Bundle/RequestInfoBundle/Controller/RequestInfoController.php line 37

Open in your IDE?
  1. <?php
  2. namespace App\OfficeBrain\Bundle\RequestInfoBundle\Controller;
  3. // use Symfony\Bundle\FrameworkBundle\Controller\Controller;
  4. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  5. use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
  6. use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
  7. use App\OfficeBrain\Bundle\RequestInfoBundle\Form\RequestInfoType;
  8. use App\OfficeBrain\Bundle\RequestInfoBundle\Form\CommentRequestInfoType;
  9. use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
  10. use Symfony\Component\HttpFoundation\Request;
  11. use Symfony\Component\HttpFoundation\Response;
  12. use Symfony\Component\HttpFoundation\JsonResponse;
  13. use App\OfficeBrain\Bundle\RequestInfoBundle\Entity\GuestUser;
  14. use App\OfficeBrain\Bundle\RequestInfoBundle\Entity\RequestInfo;
  15. use App\OfficeBrain\Bundle\RequestInfoBundle\Entity\CommentRequestInfo;
  16. use App\OfficeBrain\Bundle\RequestInfoBundle\Form\GuestUserType;
  17. use App\OfficeBrain\Bundle\RequestInfoBundle\Manager\Service\RequestInfoService;
  18. use App\OfficeBrain\Bundle\CoreBundle\Service\OBCommon;
  19. use Symfony\Component\HttpFoundation\RequestStack;
  20. use Symfony\Component\Routing\RouterInterface;
  21. use Symfony\Component\Validator\Validator\ValidatorInterface;
  22. use App\OfficeBrain\Bundle\CoreBundle\Manager\Service\CoreService;
  23. use App\OfficeBrain\Bundle\UserBundle\Manager\Service\UserService;
  24. use App\OfficeBrain\Bundle\QueueBundle\Manager\Service\ApiManager as QueueApiManager;
  25. /**
  26.  *
  27.  * @author Employee Id: 4203
  28.  * 
  29.  * OB eCommerce Product - Request Info
  30.  * 
  31.  * - Do inquiry of Product
  32.  * 
  33.  */
  34. class RequestInfoController extends AbstractController
  35. {
  36.     protected $user;
  37.     protected $form;
  38.     protected $request;
  39.     protected $formData;
  40.     protected $responseArray;
  41.     protected $erpIntegration;
  42.     protected $queueApiManager;
  43.     protected $commonLibraryManager;
  44.     /**
  45.      *
  46.      * @author Employee Id: 4203
  47.      *
  48.      * Desciption: Define member variables with thier default value
  49.      *
  50.      * @param NULL
  51.      *
  52.      * @return NULL
  53.      *
  54.      * @throws NULL
  55.      *
  56.      */
  57.     public function __construct(RequestInfoService $requestInfoServiceRequestStack $requestStackRouterInterface $routerValidatorInterface $validatorCoreService $coreServiceUserService $userServiceQueueApiManager $queueApiManager)
  58.     {
  59.         $commonLibraryManager = new OBCommon($router$validator$requestStack);
  60.         $this->user null;
  61.         $this->form null;
  62.         $this->request null;
  63.         $this->formData null;
  64.         $this->erpIntegration null;
  65.         $this->responseArray = array();
  66.         $this->queueApiManager $queueApiManager->getQueueInstance();
  67.         $this->commonLibraryManager $commonLibraryManager;
  68.         $this->requestInfoService $requestInfoService->getRequestInfoManager();
  69.         $this->coreService $coreService->getCoreExtended();
  70.         $this->locale null;
  71.         $this->productId null;
  72.         $this->productSlug null;
  73.         $this->userManager $userService->getUserExtended();
  74.     }
  75.     /**
  76.      *
  77.      * @author Employee Id: 4203
  78.      *
  79.      * Desciption: Unset member variables
  80.      *
  81.      * @param NULL
  82.      *
  83.      * @return NULL
  84.      *
  85.      * @throws NULL
  86.      *
  87.      */
  88.     public function __destruct() 
  89.     {
  90.         unset($this->user);
  91.         unset($this->form);
  92.         unset($this->request);
  93.         unset($this->formData);
  94.         unset($this->erpIntegration);
  95.         unset($this->queueApiManager);
  96.         unset($this->commonLibraryManager);
  97.         unset($this->productId);
  98.         unset($this->productSlug);
  99.         unset($this->locale);
  100.         unset($this->productId);
  101.         unset($this->productSlug);
  102.         unset($this->locale);
  103.         unset($this->userManager);
  104.         unset($this->coreService);
  105.         unset($this->requestInfoService);
  106.     }
  107.     
  108.     /**
  109.      *
  110.      * @author Employee Id: 4203
  111.      *
  112.      * Desciption: Create and initialize various required object and member variables
  113.      *
  114.      * @param NULL
  115.      *
  116.      * @return NULL
  117.      *
  118.      * @throws NULL
  119.      *
  120.      */
  121.     public function initAction(Request $request)
  122.     {
  123.         $this->request $request;
  124.         $this->projectSetting $this->request->get('project_setting');
  125.         $this->userId $this->projectSetting['user_id'];
  126.         $this->productId $this->request->get('product_id',null);
  127.         $this->productSlug $this->request->get('product_slug',null);
  128.         $this->cultureId $this->projectSetting['culture_id'];
  129.         $this->locale $this->projectSetting['culture_code'];
  130.         $this->responseArray = array();
  131.         $this->configurationRule $this->projectSetting['configuration_rule']['transaction']['request_info'];
  132.         // $this->requestInfoManager = $this->get('office_brain_request_info_manager');
  133.         $this->requestInfoManager $this->requestInfoService;
  134.         // $this->commonLibraryManager = $this->get('office_brain_common_library');
  135.         $this->commonLibraryManager $this->commonLibraryManager;
  136.         // $this->coreManager = $this->get('office_brain_core_manager');
  137.         $this->coreManager $this->coreService;
  138.         $this->erpIntegration $this->projectSetting['configuration_rule']['erp_integration'];
  139.          
  140.         if ($this->queueApiManager) {
  141.             $this->request->attributes->set('object''RequestInfo');
  142.             $this->queueApiManager $this->queueApiManager;
  143.         }
  144.         // $this->userManager = $this->get('office_brain_user_manager');
  145.         $this->userManager $this->userManager;
  146.     }
  147.     
  148.     /**
  149.      * @author Employee Id: 4203
  150.      * 
  151.      * Description : Use to render request info section.
  152.      * 
  153.      * @param 1 : No paramater
  154.      * 
  155.      * @return type : Form view.
  156.      * 
  157.      * @throws Exception: Null
  158.      *
  159.      * @Route("/{_locale}/request-info/{product_slug}",
  160.      * name="office_brain_requestinfobundle_requestinfo_productdetailrequestinfo",
  161.      * options={"expose"=true}
  162.      * )
  163.      * @Template()
  164.      * @Method({"GET"})
  165.      */
  166.     public function productDetailRequestInfoAction(Request $request)
  167.     {
  168.         $this->initAction($request);
  169.         return $this->requestInfoManager->getProductDetailBySlug($this->productSlug$this->locale);
  170.     }
  171.     
  172.     /**
  173.      *
  174.      * @author Employee Id: 4203
  175.      *
  176.      * Desciption: Use to render request info form. 
  177.      *
  178.      * @param NULL
  179.      *
  180.      * @return Html Response 
  181.      *
  182.      * @throws NULL
  183.      * 
  184.      * @Route("/{_locale}/add-request-info/{product_id}",
  185.      *  name="office_brain_requestinfobundle_requestinfo_addrequestinfo"
  186.      * )
  187.      * 
  188.      * @Template("OfficeBrain/Bundle/RequestInfoBundle/RequestInfo/addRequestInfo.html.twig")
  189.      * 
  190.      * @Method({"GET"})
  191.      * 
  192.      */
  193.     public function addRequestInfoAction(Request $request)
  194.     {
  195.         $this->initAction($request);
  196.         // $this->form = $this->createForm(new RequestInfoType($this->configurationRule, $this->coreManager), new RequestInfo());
  197.         $this->form $this->createForm(RequestInfoType::class, new RequestInfo(), [
  198.             'configurationRule' => $this->configurationRule,
  199.             'coreManager' => $this->coreManager,
  200.         ]);
  201.         $this->responseArray['form'] = $this->form->createView();
  202.         $this->responseArray['product_id'] = $this->productId;
  203.         return $this->responseArray;
  204.     }
  205.     
  206.     /**
  207.      *
  208.      * @author Employee Id: 4203
  209.      *
  210.      * Desciption: Use to submit request info form. 
  211.      *
  212.      * @param NULL
  213.      *
  214.      * @return Html Response 
  215.      *
  216.      * @throws NULL
  217.      *
  218.      * @Route("/{_locale}/add-request-info",
  219.      *  name="office_brain_requestinfobundle_requestinfo_processrequestinfosubmit"
  220.      * )
  221.      * 
  222.      * @Template("OfficeBrain/Bundle/RequestInfoBundle/RequestInfo/addRequestInfo.html.twig")
  223.      * 
  224.      * @Method({"POST"})
  225.      * 
  226.      */
  227.     public function addRequestInfoSubmitAction(Request $request)
  228.     {
  229.         $option null;    
  230.         $this->initAction($request);
  231.         $stateId $this->request->get('state');
  232.         $option['distributor'] = $this->getStateWiseDistributors(array('state_id'=>$stateId));
  233.         // $this->form = $this->createForm(new RequestInfoType($this->configurationRule, $this->coreManager, $option), new RequestInfo());
  234.         $this->form $this->createForm(RequestInfoType::class, new RequestInfo(), [
  235.             'configurationRule' => $this->configurationRule,
  236.             'coreManager' => $this->coreManager,
  237.             'options' => $option,
  238.         ]);
  239.         $this->form->handleRequest($this->request);
  240.             
  241.         $productId $this->form->getData()->product_id;
  242.         if ($this->form->isSubmitted() && $this->form->isValid()) {
  243.             $result $this->requestInfoManager->setRequestInfo($this->form->getData());
  244.             switch ($result['status']) {
  245.                 case 'ADD_SUCCESS_IN_SESSION':
  246.                     $this->responseArray['status'] = 'success';
  247.                     break;
  248.                 case 'ALLREADY_IN_SESSION':
  249.                     $this->responseArray['status'] = 'error';
  250.                     break;
  251.                 case 'ADD_SUCCESS_SINGLE_GUEST':
  252.                     if ($this->request->isXmlHttpRequest()) {
  253.                         $this->responseArray['status'] = 'success';
  254.                         $this->responseArray['popup_url'] = $this->generateUrl('office_brain_userbundle_login_login_popup',array('refer_url'=>'office_brain_requestinfobundle_requestinfo_addgguestuser'));
  255.                     }
  256.                     break;
  257.                 case 'ADD_RECORD_SUCCESSFULLY':
  258.                     if ($this->request->isXmlHttpRequest()) {
  259.                         $requestInfoObj $result['data'];
  260.                         if (is_array($this->erpIntegration) && $this->erpIntegration['orderManagement'] == && !empty($this->queueApiManager)) {
  261.                             if ($requestInfoObj->getGuestId() == 0) {
  262.                                 $this->queueApiManager->mapQueue("create"$requestInfoObj);
  263.                             }
  264.                         }
  265.                         $this->requestInfoManager->sendRequestInfoEmail($requestInfoObj);
  266.                         $this->responseArray['status'] = 'success';
  267.                         $this->responseArray['goto_url'] = $this->generateUrl('office_brain_requestinfobundle_requestinfo_thankupage');
  268.                         unset($requestInfoObj);
  269.                     }
  270.                     break;
  271.             }
  272.             unset($result);
  273.             unset($requestInfo);
  274.             
  275.             return new JsonResponse($this->responseArray);
  276.         } elseif ($this->request->isXmlHttpRequest()) {
  277.             return new JsonResponse($this->commonLibraryManager->prepareFormJsonError($this->form));
  278.         }
  279.         return array('form' => $this->form->createView(), 'product_id'=>$productId);
  280.     }
  281.     
  282.     private function getStateWiseDistributors($stateId){
  283.         $returnDistributors = array();
  284.         
  285.         $tempDistributors $this->userManager->getDistributors(array('state_id'=>$stateId));
  286.         foreach ($tempDistributors as $dist){
  287.             $returnDistributors[$dist['id']] = $dist['firstName'].' '.$dist['lastName'];
  288.         }
  289.         
  290.         return $returnDistributors;
  291.     }
  292.     /**
  293.      *
  294.      * @author Employee Id: 4203
  295.      *
  296.      * Desciption: Use to submit request info form. 
  297.      *
  298.      * @param NULL
  299.      *
  300.      * @return Html Response 
  301.      *
  302.      * @throws NULL
  303.      *
  304.      * @Route("/{_locale}/add-guest-user",
  305.      *  name="office_brain_requestinfobundle_requestinfo_addgguestuser"
  306.      * )
  307.      * 
  308.      * @Template("OfficeBrain/Bundle/RequestInfoBundle/RequestInfo/addGuestUser.html.twig")
  309.      * 
  310.      * @Method({"GET"})
  311.      * 
  312.      */
  313.     public function addGuestUserAction(Request $request)
  314.     {
  315.         $this->initAction($request);
  316.         // $this->form = $this->createForm(new GuestUserType(), new GuestUser());
  317.         $this->form $this->createForm(GuestUserType::class, new GuestUser());
  318.         return array('form'=>$this->form->createView());
  319.     }
  320.     
  321.     /**
  322.      *
  323.      * @author Employee Id: 4203
  324.      *
  325.      * Desciption: Use to submit guest user info form.
  326.      *
  327.      * @param NULL
  328.      *
  329.      * @return Html Response 
  330.      *
  331.      * @throws NULL
  332.      *
  333.      * @Route("/{_locale}/add-guest-user",
  334.      *  name="office_brain_requestinfobundle_requestinfo_processaddgguestusersubmit"
  335.      * )
  336.      * 
  337.      * @Template()
  338.      * 
  339.      * @Method({"POST"})
  340.      * 
  341.      */
  342.     public function processAddGuestUserAction(Request $request)
  343.     {
  344.         $this->initAction($request);
  345.         // $this->form = $this->createForm(new GuestUserType(), new GuestUser());
  346.         $this->form $this->createForm(GuestUserType::class, new GuestUser());
  347.         $this->form->handleRequest($this->request);
  348.         if ($this->form->isValid()){
  349.             $result $this->requestInfoManager->setGuestInfo($this->form->getData());
  350.             $requestInfoObj $result['data'];
  351.             switch ($result['status']) {
  352.                 case 'ADD_RECORD_SUCCESSFULLY':
  353.                     
  354.                     /*if(is_array($this->erpIntegration) && $this->erpIntegration['orderManagement'] == 1 && !empty($this->queueApiManager)) {
  355.                         $this->queueApiManager->mapQueue("create", $requestInfoObj);
  356.                     }*/
  357.                     $this->requestInfoManager->sendRequestInfoEmail($requestInfoObj);
  358.                     $this->responseArray['status'] = 'success';
  359.                     $this->responseArray['goto_url'] = $this->generateUrl('office_brain_requestinfobundle_requestinfo_thankupage');
  360.                     
  361.                     return new JsonResponse($this->responseArray);
  362.                 }
  363.             }
  364.             else if ($this->request->isXmlHttpRequest ()) {
  365.                 return new JsonResponse($this->commonLibraryManager->prepareFormJsonError($this->form));
  366.             }
  367.     }
  368.     
  369.     /**
  370.      *
  371.      * @author Employee Id: 4203
  372.      *
  373.      * Desciption: Use to submit guest user info form.
  374.      *
  375.      * @param NULL
  376.      *
  377.      * @return Html Response 
  378.      *
  379.      * @throws NULL
  380.      *
  381.      * @Route("/{_locale}/list-request-info",
  382.      *  name="office_brain_requestinfobundle_requestinfo_listrequestinfo"
  383.      * )
  384.      * 
  385.      * @Template("OfficeBrain/Bundle/RequestInfoBundle/RequestInfo/listRequestInfo.html.twig")
  386.      * 
  387.      * @Method({"GET"})
  388.      * 
  389.      */
  390.     public function listRequestInfoAction(Request $request)
  391.     {
  392.         $this->initAction($request);
  393.         if( $this->userId==0){
  394.             if ($this->request->isXmlHttpRequest()) {
  395.                 $this->responseArray['status'] = 'error';
  396.                 $this->responseArray['error_type'] = 'loginError';
  397.                 $this->responseArray['page_url'] = $this->generateUrl('office_brain_userbundle_login_login');
  398.                 return new JsonResponse($this->responseArray);
  399.             }else{
  400.                 return $this->redirect($this->generateUrl('office_brain_userbundle_login_login'));
  401.             }
  402.         }
  403.         $this->responseArray['data'] = $this->requestInfoManager->getRequestInfoList();
  404.         return $this->responseArray;
  405.     }
  406.     
  407.     /**
  408.      *
  409.      * @author Employee Id: 4248
  410.      *
  411.      * Desciption: Use to submit guest user info form.
  412.      *
  413.      * @param NULL
  414.      *
  415.      * @return Html Response 
  416.      *
  417.      * @throws NULL
  418.      * 
  419.      * @Route("/{_locale}/my-inquiries-list",
  420.      *  name="office_brain_requestinfobundle_requestinfo_myinquirylist"
  421.      * )
  422.      * 
  423.      * @Template("OfficeBrain/Bundle/RequestInfoBundle/RequestInfo/myInquiryList.html.twig")
  424.      * 
  425.      * @Method({"GET"})
  426.      * 
  427.      */
  428.     public function myInquiryListAction(Request $request)
  429.     {
  430.         $this->initAction($request);
  431.         if( $this->userId==0){
  432.             if ($this->request->isXmlHttpRequest()) {
  433.                 $this->responseArray['status'] = 'error';
  434.                 $this->responseArray['error_type'] = 'loginError';
  435.                 $this->responseArray['page_url'] = $this->generateUrl('office_brain_userbundle_login_login');
  436.                 return new JsonResponse($this->responseArray);
  437.             }else{
  438.                 return $this->redirect($this->generateUrl('office_brain_userbundle_login_login'));
  439.             }
  440.         }
  441.         $this->responseArray['data'] = $this->requestInfoManager->getRequestInfoList();
  442.         return $this->responseArray;
  443.     }
  444.     
  445.     /**
  446.      *
  447.      * @author Employee Id: 4248
  448.      *
  449.      * Desciption: Use to submit guest user info form.
  450.      *
  451.      * @param NULL
  452.      *
  453.      * @return Html Response 
  454.      *
  455.      * @throws NULL
  456.      *
  457.      * @Route("/{_locale}/detail-request-info/{request_info_id}",
  458.      *  name="office_brain_requestinfobundle_requestinfo_detailrequestinfo"
  459.      * )
  460.      * 
  461.      * @Template("OfficeBrain/Bundle/RequestInfoBundle/RequestInfo/detailRequestInfo.html.twig")
  462.      * 
  463.      * @Method({"GET"})
  464.      * 
  465.      */
  466.     public function detailRequestInfoAction(Request $request)
  467.     {    
  468.         $this->initAction($request);
  469.         if( $this->userId==0){
  470.             if ($this->request->isXmlHttpRequest()) {
  471.                 $this->responseArray['status'] = 'error';
  472.                 $this->responseArray['error_type'] = 'loginError';
  473.                 $this->responseArray['page_url'] = $this->generateUrl('office_brain_userbundle_login_login');
  474.                 return new JsonResponse($this->responseArray);
  475.             }else{
  476.                 return $this->redirect($this->generateUrl('office_brain_userbundle_login_login'));
  477.             }
  478.         }
  479.         $this->responseArray['data'] = $this->requestInfoManager->getRequestInfoDetailById();
  480.         return $this->responseArray;
  481.     }
  482.     
  483.     /**
  484.      *
  485.      * @author Employee Id: 4248
  486.      *
  487.      * Desciption: Use to submit guest user info form.
  488.      *
  489.      * @param NULL
  490.      *
  491.      * @return Html Response 
  492.      *
  493.      * @throws NULL
  494.      *
  495.      * @Route("/{_locale}/add-comment-request-info/{request_id}/{user_id}",
  496.      *  name="office_brain_requestinfobundle_requestinfo_addcommentrequestinfo"
  497.      * )
  498.      * 
  499.      * @Template("OfficeBrain/Bundle/RequestInfoBundle/RequestInfo/addCommentRequestInfo.html.twig")
  500.      * @Method({"GET"})
  501.      */
  502.     public function addCommentRequestInfoAction(Request $request)
  503.     {
  504.         $this->initAction($request);
  505.         $userDetail $this->requestInfoManager->getUserDetail($this->request->get('user_id'),'user');
  506.         // $this->form=$this->createForm(new CommentRequestInfoType(), new CommentRequestInfo() );
  507.         $this->form=$this->createForm(CommentRequestInfoType::class, new CommentRequestInfo() );
  508.         $this->responseArray['form']=$this->form->createView ();
  509.         $this->responseArray['request_id'] = $this->request->get('request_id');
  510.         $this->responseArray['user_name'] = $userDetail->getFirstName().' '.$userDetail->getLastName();
  511.         return $this->responseArray;
  512.     }
  513.     
  514.     /**
  515.      *
  516.      * @author Employee Id: 4248
  517.      *
  518.      * Desciption: Use to submit guest user info form.
  519.      *
  520.      * @param NULL
  521.      *
  522.      * @return Html Response 
  523.      *
  524.      * @throws NULL
  525.      *
  526.      * @Route("/{_locale}/add-comment-request-info",
  527.      *  name="office_brain_requestinfobundle_requestinfo_processcommnentrequestinfosubmit"
  528.      * )
  529.      * 
  530.      * @Template("OfficeBrain/Bundle/RequestInfoBundle/RequestInfo/addCommentRequestInfo.html.twig")
  531.      * 
  532.      * @Method({"POST"})
  533.      * 
  534.      */
  535.     public function addCommentRequestInfoSubmitAction(Request $request)
  536.     {
  537.         $this->initAction($request);
  538.         if( $this->userId==0){
  539.             if ($this->request->isXmlHttpRequest()) {
  540.                 $this->responseArray['status'] = 'error';
  541.                 $this->responseArray['error_type'] = 'loginError';
  542.                 $this->responseArray['page_url'] = $this->generateUrl('office_brain_userbundle_login_login');
  543.                 return new JsonResponse($this->responseArray);
  544.             }else{
  545.                 return $this->redirect($this->generateUrl('office_brain_userbundle_login_login'));
  546.             }
  547.         } 
  548.         $this->form $this->createForm(new CommentRequestInfoType(), new CommentRequestInfo());
  549.         $this->form->handleRequest($this->request);
  550.         $requestId $this->form->getData ()->requestInfoId;
  551.         if ($this->form->isValid()){
  552.             $result=$this->requestInfoManager->setCommentRequestInfo($this->form->getData());
  553.             switch ($result['status']) {
  554.                 case 'COMMENT_ADDED_SUCESSFULLY':
  555.                     if ($this->request->isXmlHttpRequest ()) {
  556.                 
  557.                         $this->responseArray['status'] = 'success';
  558.                         $this->responseArray['success_message'] = $this->get('translator')->trans('request_info.comment_added_successfully');
  559.                         $this->responseArray['url'] = $this->generateUrl('office_brain_requestinfobundle_requestinfo_listcommentrequestinfo',array('request_info_id'=>$requestId));
  560.                         return new JsonResponse $this->responseArray );
  561.                     }
  562.                     break;
  563.             }
  564.         }
  565.         else if ($this->request->isXmlHttpRequest ()) {
  566.              
  567.             return new JsonResponse $this->commonLibraryManager->prepareFormJsonError($this->form) );
  568.         }
  569.         return array (
  570.                 'form' => $this->form->createView (),
  571.                 'request_id'=>$requestId
  572.         );
  573.     }
  574.     
  575.     /**
  576.      *
  577.      * @author Employee Id: 4248
  578.      *
  579.      * Desciption: Use to submit guest user info form.
  580.      *
  581.      * @param NULL
  582.      *
  583.      * @return Html Response 
  584.      *
  585.      * @throws NULL
  586.      *
  587.      * @Route("/{_locale}/list-comment-request-info/{request_info_id}",
  588.      *  name="office_brain_requestinfobundle_requestinfo_listcommentrequestinfo"
  589.      * )
  590.      * 
  591.      * @Method({"GET"})
  592.      * 
  593.      * @Template("OfficeBrain/Bundle/RequestInfoBundle/RequestInfo/listCommentRequestInfo.html.twig")
  594.      *  
  595.      */
  596.     public function listCommentRequestInfoAction(Request $request)
  597.     {
  598.         $this->initAction($request);
  599.         $this->responseArray['data'] = $this->requestInfoManager->getCommentRequestInfoList();
  600.         return $this->responseArray;
  601.     }
  602.     /**
  603.      *
  604.      * @author Employee Id: 4248
  605.      *
  606.      * Desciption: product thank you page
  607.      *
  608.      * @param NULL
  609.      *
  610.      * @return Html Response 
  611.      *
  612.      * @throws NULL
  613.      *
  614.      * @Route("/{_locale}/request-info-thank-you",
  615.      *     name="office_brain_requestinfobundle_requestinfo_thankupage"
  616.      * )
  617.      * 
  618.      * @Method({"GET"})
  619.      * 
  620.      * @Template()
  621.      * 
  622.      */
  623.     public function thankYouRequestInfoAction(Request $request)
  624.     {
  625.         $this->initAction($request);
  626.         $this->requestInfoManager->setContinueProdDetailURL($this->commonLibraryManager->getRefererRouteName(), $this->commonLibraryManager->getRefererUrl());
  627.         return array();
  628.     }    
  629.     
  630.     /**
  631.      *
  632.      * @author Employee Id: 4074
  633.      *
  634.      * Desciption: This function allow user go back to page from where he/she came to Request Info.
  635.      *
  636.      * @param NULL
  637.      *
  638.      * @return Html Response 
  639.      *
  640.      * @throws NULL
  641.      *
  642.      * @Route("/{_locale}/continue-request-info-from-product-detail",
  643.      *     name="office_brain_requestinfobundle_continue_request_info"
  644.      * )
  645.      *
  646.      * @Method({"GET"})
  647.      *
  648.      */
  649.     public function continueRequestInfoAction(Request $request)
  650.     {
  651.         /* $this->initAction($request);
  652.         return $this->redirect($this->requestInfoManager->getContinueProdDetailURL()); */
  653.         return $this->redirect($this->generateUrl('office_brain_searchbundle_search_continueshopping'));
  654.     }
  655.     
  656.     /**
  657.      *
  658.      * @author Employee Id: 4203
  659.      *
  660.      * Desciption: Use to dalete a record
  661.      *
  662.      * @param NULL
  663.      *
  664.      * @return Html Response 
  665.      *
  666.      * @throws NULL
  667.      *
  668.      * @Route("/{_locale}/delete-request-info/{request_info_id}",
  669.      *  name="office_brain_requestinfobundle_requestinfo_deleterequestinfo"
  670.      * )
  671.      * 
  672.      * @Method({"GET"})
  673.      * 
  674.      * @Template()
  675.      * 
  676.      */
  677.     public function deleteRequestInfoAction(Request $request)
  678.     {
  679.         $this->initAction($request);
  680.         if( $this->userId==0){
  681.             if ($this->request->isXmlHttpRequest()) {
  682.                 $this->responseArray['status'] = 'error';
  683.                 $this->responseArray['error_type'] = 'loginError';
  684.                 $this->responseArray['page_url'] = $this->generateUrl('office_brain_userbundle_login_login');
  685.                 return new JsonResponse($this->responseArray);
  686.             }else{
  687.                 return $this->redirect($this->generateUrl('office_brain_userbundle_login_login'));
  688.             }
  689.         }
  690.         $requestInfoDetail $this->requestInfoManager->deleteRequestInfoDetailById();
  691.         switch ($requestInfoDetail['status']) {
  692.             case 'ERROR_NOT_FOUND':
  693.                 $this->responseArray['error_message'] = $this->get('translator')->trans('request_info.no_record');
  694.                 break;
  695.             case 'SUCCESS':
  696.                 $this->responseArray['status'] = 'success';
  697.                 $this->responseArray['inquiry_list'] = 'inquiry';
  698.                 $this->responseArray['success_message'] = $this->get('translator')->trans('request_info.remove_success_message');
  699.                 break;
  700.         }
  701.         if ($this->request->isXmlHttpRequest()) {
  702.             return new JsonResponse($this->responseArray);
  703.         }
  704.     }
  705.     
  706.     /**
  707.      *
  708.      * @author Employee Id: 4203
  709.      *
  710.      * Desciption: Use to submit Commemt Request Info form.
  711.      *
  712.      * @param NULL
  713.      *
  714.      * @return Html Response 
  715.      *
  716.      * @throws NULL
  717.      *
  718.      * @Route("/{_locale}/customer-detail/{user_id}/{user_type}",
  719.      *  name="office_brain_requestinfobundle_requestinfo_customerdetailinfo"
  720.      * )
  721.      * 
  722.      * @Method({"GET"})
  723.      * 
  724.      * @Template("OfficeBrain/Bundle/RequestInfoBundle/RequestInfo/customerDetailInfo.html.twig") 
  725.      * 
  726.      */
  727.     public function customerDetailInfoAction(Request $request)
  728.     {
  729.         $this->initAction($request);
  730.         $this->responseArray['user_detail'] = $this->requestInfoManager->getUserDetail($this->request->get('user_id'), $this->request->get('user_type'));
  731.         return $this->responseArray;
  732.     }
  733.     
  734.     /**
  735.      *
  736.      * @author Employee Id: 410175
  737.      *
  738.      * Desciption: get All state wise distributors
  739.      *
  740.      * @param NULL
  741.      *
  742.      * @return Html Response
  743.      *
  744.      * @throws NULL
  745.      *
  746.      * @Route("/{_locale}/select-distributors",
  747.      *  name="office_brain_requestinfobundle_requestinfo_selectdistributors",
  748.      *  options={"expose"=true}
  749.      * )
  750.      *
  751.      * @Method({"POST"})
  752.      *
  753.      * @Template()
  754.      *
  755.      */
  756.     public function selectDistributorsAction(Request $request)
  757.     {
  758.         $this->initAction($request);
  759.         $filter['stateId'] = $this->request->get('stateId');
  760.         $data['distributors'] = $this->userManager->getDistributors($filter);
  761.         if ($this->request->isXmlHttpRequest()) {
  762.             return new JsonResponse($data);
  763.         }
  764.         return $data;
  765.     }
  766. }