/**
  * Do complete, sendmail to admin, save to database, render view to user
  *
  * @author Ngoc Nguyen + Dung Le + Tu Tran + My Vo
  *
  * @param  String $catalogItem
  * @param  Prj02Catalog $prj02Catalog
  * @param  CatalogForm $catalogForm FormRequest for validate
  *
  * @return View
  */
 public function postComplete($catalogItem, Prj02Catalog $prj02Catalog, CatalogForm $catalogForm)
 {
     $prj02Catalog->fill($catalogForm->all());
     // Do before save
     $form = \Helper::getFormTable($catalogItem);
     // Array item for send mail
     $arrItem = $catalogForm->all();
     // Do before save and send mail
     if ($form !== 'input-r1-3') {
         $arrItem['ext7'] = $arrItem['ext7'] === 'h' ? '申し込む' : '申し込まない';
         $this->beforeSaveCustom($prj02Catalog, $form);
     }
     $prj02Catalog->save();
     // Get subject, URL
     $arrItem['URL'] = \Helper::getItemInfo("constants.system_catalog.{$catalogItem}")['URL'];
     $arrItem['subject'] = \Helper::getItemInfo("constants.system_catalog.{$catalogItem}")['MailSubjectAdmin'];
     $arrItem['CATALOG_ITEM'] = 'catalog_' . $catalogItem;
     // Send mail admin
     \Helper::sendMailAdmin($arrItem, $arrItem['subject']);
     //Put session for R2
     \Session::put('ext1', \Session::get('info_input')['ext1']);
     \Session::put('ext2', \Session::get('info_input')['ext2']);
     \Session::put('ext3', \Session::get('info_input')['ext3']);
     // Clear session
     \Session::regenerateToken();
     \Session::forget('dct');
     \Session::forget('id');
     \Session::forget('info_input');
     \Session::forget('cat_item');
     return redirect()->route('catalog-finish', $catalogItem);
 }
 public function postComplete(Prj02Catalog $prj02Catalog, CatalogFormR3 $catalogFormR3)
 {
     $prj02Catalog->fill($catalogFormR3->all());
     $systemData = \Helper::getItemInfo("constants.system_catalog.{$this->catalogItem}");
     $prj02Catalog->form = $systemData['form'];
     $prj02Catalog->uid = $systemData['uid'];
     $prj02Catalog->save();
     // Get subject, URL
     $arrItem = $prj02Catalog->toArray();
     $arrItem['URL'] = $systemData['URL'];
     $arrItem['subject'] = $systemData['MailSubjectAdmin'];
     $arrItem['CATALOG_ITEM'] = $this->catalogItem;
     // Send Mail to Admin only
     \Helper::sendMailAdmin($arrItem, $arrItem['subject']);
     // Regenerate Session
     \Session::regenerateToken();
     \Session::remove('r3-form-dct');
     \Session::remove('r3-form-input');
     // Redirect complete html on this action with get method
     return \redirect()->route('catalog-complete-r3');
 }