コード例 #1
0
 public function indexAction(Request $request)
 {
     /** @var $em EntityManager */
     /** @var AssetClassRepository $repo */
     $em = $this->get('doctrine.orm.entity_manager');
     $repo = $em->getRepository('WealthbotAdminBundle:AssetClass');
     $user = $this->getUser();
     $model = $em->getRepository('WealthbotAdminBundle:CeModel')->find($request->get('model_id'));
     $accountTypes = $em->getRepository('WealthbotRiaBundle:SubclassAccountType')->findAll();
     $assetClasses = $repo->findWithSubclassesByModelIdAndOwnerId($model->getId(), null);
     $assets = new AssetCollection($assetClasses, $model);
     $options = array('original_assets' => $assetClasses, 'original_subclasses' => $this->collectOriginalSubclassesForAssets($assetClasses));
     $form = $this->createForm(new CategoriesFormType($user, $em), $assets);
     $formHandler = new CategoriesFormHandler($form, $request, $em, $options);
     if ($request->isMethod('post') && $formHandler->process()) {
         if ($request->isXmlHttpRequest()) {
             return $this->getJsonResponse(array('status' => 'success', 'success_url' => $this->generateUrl('rx_admin_models_index_strategy', array('slug' => $model->getSlug()))));
         }
         return $this->redirect($this->generateUrl('rx_admin_models_index_strategy', array('slug' => $model->getSlug())));
     }
     if ($request->isXmlHttpRequest()) {
         $content = $this->renderView('WealthbotAdminBundle:Categories:index.html.twig', array('form' => $form->createView(), 'is_show_expected_asset' => true, 'is_show_account_type' => true, 'is_show_priority' => false, 'account_types' => $accountTypes));
         return $this->getJsonResponse(array('status' => 'form', 'content' => $content));
     }
     return $this->render('WealthbotAdminBundle:Categories:index.html.twig', array('form' => $form->createView(), 'is_show_expected_asset' => true, 'is_show_account_type' => true, 'is_show_priority' => false, 'account_types' => $accountTypes));
 }
コード例 #2
0
 public function indexAction(Request $request)
 {
     /** @var $em EntityManager */
     /** @var AssetClassRepository $repo */
     $em = $this->get('doctrine.orm.entity_manager');
     $repo = $em->getRepository('WealthbotAdminBundle:AssetClass');
     /** @var User $ria */
     $ria = $this->getUser();
     $selectedModel = $ria->getRiaCompanyInformation()->getPortfolioModel();
     $riaCompanyInfo = $ria->getRiaCompanyInformation();
     $isShowExpectedAsset = $riaCompanyInfo->getIsShowClientExpectedAssetClass();
     $isShowAccountType = $this->isShowAccountType($riaCompanyInfo);
     $isShowPriority = false;
     //$riaCompanyInfo->isShowSubclassPriority();
     $accountTypes = $em->getRepository('WealthbotRiaBundle:SubclassAccountType')->findAll();
     $assetClasses = $repo->findByModelIdAndOwnerId($selectedModel->getId(), $ria->getId());
     //var_dump($selectedModel->getId(), $assetClasses);die;
     $assets = new AssetCollection($assetClasses, $selectedModel);
     $options = array('original_assets' => $assetClasses, 'original_subclasses' => $this->collectOriginalSubclassesForAssets($assetClasses));
     $form = $this->createForm(new CategoriesFormType($ria, $em), $assets);
     $formHandler = new CategoriesFormHandler($form, $request, $em, $options);
     if ($request->isMethod('post') && $formHandler->process()) {
         if ($request->isXmlHttpRequest()) {
             return $this->getJsonResponse(array('status' => 'success', 'success_url' => $this->generateUrl('rx_ria_dashboard_models_tab', array('tab' => 'categories'))));
         }
         return $this->redirect($this->generateUrl('rx_ria_dashboard_models_tab', array('tab' => 'categories')));
     }
     if ($request->isXmlHttpRequest()) {
         $content = $this->renderView('WealthbotRiaBundle:Categories:index.html.twig', array('form' => $form->createView(), 'is_show_expected_asset' => $isShowExpectedAsset, 'is_show_account_type' => $isShowAccountType, 'is_show_priority' => $isShowPriority, 'is_show_tolerance_band' => $riaCompanyInfo->isRebalancedFrequencyToleranceBand(), 'account_types' => $accountTypes));
         return $this->getJsonResponse(array('status' => 'form', 'content' => $content));
     }
     return $this->render('WealthbotRiaBundle:Categories:index.html.twig', array('form' => $form->createView(), 'is_show_expected_asset' => $isShowExpectedAsset, 'is_show_account_type' => $isShowAccountType, 'is_show_priority' => $isShowPriority, 'is_show_tolerance_band' => $riaCompanyInfo->isRebalancedFrequencyToleranceBand(), 'account_types' => $accountTypes));
 }