/** * Show the form for creating a new resource. * * @param String $rp_id * @param String $header_id * @param String $detail_id * * @return \Illuminate\Http\Response */ public function create($rp_id, $header_id, $detail_id) { if ($this->detailRepository->getDetailById(decode($detail_id))) { $detail = $this->detailRepository->getModel(); $data = ['detail' => $detail, 'questions' => $this->retailerProductRepository->getQuestionByProduct(decode($rp_id), $detail->header), 'observation' => '']; return view('client.de.question-create', compact('rp_id', 'header_id', 'detail_id', 'data')); } return redirect()->route('de.client.list', ['rp_id' => $rp_id, 'header_id' => $header_id])->with(['error_detail' => 'Ha ocurrido un error en el Cuestionario de Salud']); }
/** * Show the form for creating a new Sub Product. * * @param Guard $auth * @param $rp_id * @param $header_id * @param $sp_id * * @return RedirectResponse */ public function createSubProduct(Guard $auth, $rp_id, $header_id, $sp_id) { $key = 'clients_' . $header_id; if (Cache::has($key)) { $clients = Cache::get($key); if (!is_null($clients)) { $clients = json_decode($clients, true); $detail_id = array_shift($clients); if (!is_null($detail_id)) { if ($this->headerDeRepository->getHeaderById(decode($header_id))) { $header = $this->headerDeRepository->getModel(); $detail = $header->details()->where('id', decode($detail_id))->first(); if ($this->repository->getInsuredValue($auth->user(), $sp_id, $header, $detail->client)) { $detail->insured_value = $this->repository->insured_value; } $data = $this->getData(); $data['questions'] = $this->retailerProductRepository->getQuestionByProduct(decode($sp_id)); $data['plans'] = $this->planRepository->getPlanByProduct(decode($sp_id)); return view('vi.sp.create', compact('rp_id', 'header_id', 'sp_id', 'data', 'header', 'detail'))->with(['error_value' => $this->repository->error_value, 'amount_max' => $this->repository->amount_max]); } } } } return redirect()->route('de.issuance', ['rp_id' => $rp_id, 'header_id' => $header_id])->with(['error_header' => 'La Poliza de Vida no puede ser creada']); }
/** * Find Questions for Product Retailer * * @param $rp_id * @return array */ public function questionByProduct($rp_id) { return $this->repository->getQuestionByProduct(decode($rp_id)); }