| * @return \Illuminate\Http\Response | * @return \Illuminate\Http\Response | ||||
| */ | */ | ||||
| private function searchCompoundAll($jenis,$modul,$status,$start_date,$end_date,$day3, $day7){ | private function searchCompoundAll($jenis,$modul,$status,$start_date,$end_date,$day3, $day7){ | ||||
| $dateS = Carbon::createFromFormat('Y-m-d', $start_date); | $dateS = Carbon::createFromFormat('Y-m-d', $start_date); | ||||
| $start = $dateS->copy()->startOfDay(); | $start = $dateS->copy()->startOfDay(); | ||||
| if($end_date != ''){ | if($end_date != ''){ | ||||
| $dateE = Carbon::createFromFormat('Y-m-d', $end_date); | $dateE = Carbon::createFromFormat('Y-m-d', $end_date); | ||||
| $end = $dateE->copy()->endOfDay(); | $end = $dateE->copy()->endOfDay(); | ||||
| else | else | ||||
| { | { | ||||
| $compound = Compound::where('jenis', $jenis)->whereBetween('created_at', array($start, $end)); | $compound = Compound::where('jenis', $jenis)->whereBetween('created_at', array($start, $end)); | ||||
| } | |||||
| } | |||||
| if($modul == 'All'){ | if($modul == 'All'){ | ||||
| $compound = $compound; | $compound = $compound; | ||||
| }else if($modul == '06-07'){ | }else if($modul == '06-07'){ | ||||
| else | else | ||||
| { | { | ||||
| $compound = Compound::where('jenis', $jenis); | $compound = Compound::where('jenis', $jenis); | ||||
| } | |||||
| } | |||||
| if($modul == 'All'){ | if($modul == 'All'){ | ||||
| $compound = $compound; | $compound = $compound; | ||||
| } | } | ||||
| private function filterCompoundByEnforcer($enforcer,$jenis,$modul,$status,$start_date,$end_date,$day3, $day7){ | private function filterCompoundByEnforcer($enforcer,$jenis,$modul,$status,$start_date,$end_date,$day3, $day7){ | ||||
| if(!empty($start_date)){ | if(!empty($start_date)){ | ||||
| $compound = $this->searchCompoundAll($jenis,$modul,$status,$start_date,$end_date,$day3, $day7); | $compound = $this->searchCompoundAll($jenis,$modul,$status,$start_date,$end_date,$day3, $day7); | ||||
| }else{ | }else{ | ||||
| $compound = $this->searchCompoundAllWithoutDate($jenis,$modul,$status,$day3, $day7); | $compound = $this->searchCompoundAllWithoutDate($jenis,$modul,$status,$day3, $day7); | ||||
| } | } | ||||
| if($enforcer == 'All'){ | if($enforcer == 'All'){ | ||||
| private function filterCompoundByFaulty($enforcer,$faulty,$jenis,$modul,$status,$start_date,$end_date,$department,$day3, $day7){ | private function filterCompoundByFaulty($enforcer,$faulty,$jenis,$modul,$status,$start_date,$end_date,$department,$day3, $day7){ | ||||
| $compound = $this->filterCompoundByEnforcer($enforcer,$jenis,$modul,$status,$start_date,$end_date,$day3, $day7); | $compound = $this->filterCompoundByEnforcer($enforcer,$jenis,$modul,$status,$start_date,$end_date,$day3, $day7); | ||||
| if($faulty == 'All'){ | if($faulty == 'All'){ | ||||
| return $compound->whereIn('jbkod',$department); | return $compound->whereIn('jbkod',$department); | ||||
| }else { | }else { | ||||
| private function searchKpd($enforcer,$faulty,$jenis,$modul,$status,$start_date,$end_date,$department,$plate_no,$kpd,$day3, $day7){ | private function searchKpd($enforcer,$faulty,$jenis,$modul,$status,$start_date,$end_date,$department,$plate_no,$kpd,$day3, $day7){ | ||||
| $compound = $this->searchPlateNo($enforcer,$faulty,$jenis,$modul,$status,$start_date,$end_date,$department,$plate_no,$day3, $day7); | $compound = $this->searchPlateNo($enforcer,$faulty,$jenis,$modul,$status,$start_date,$end_date,$department,$plate_no,$day3, $day7); | ||||
| if(!empty($kpd)){ | if(!empty($kpd)){ | ||||
| $compound = $compound->where('kpd',$kpd); | |||||
| if($modul == '02'){ | |||||
| $compound = $compound->where('kpd',$kpd)->orWhere('non', $kpd); | |||||
| } | |||||
| else{ | |||||
| $compound = $compound->where('kpd',$kpd); | |||||
| } | |||||
| return $compound; | return $compound; | ||||
| }else{ | }else{ | ||||
| $compound = $compound->whereIn('status', ['Belum Bayar', 'Berbayar', 'Batal']); | $compound = $compound->whereIn('status', ['Belum Bayar', 'Berbayar', 'Batal']); | ||||
| // $day3 = 3; | // $day3 = 3; | ||||
| // $day7 = ''; | // $day7 = ''; | ||||
| ///////////////////////////////////////////////////////////////////////////////// | |||||
| ///////////////////////////////////////////////////////////////////////////////// | |||||
| $per_page = $request->per_page; | $per_page = $request->per_page; | ||||
| $kpd = $request->kpd; | $kpd = $request->kpd; | ||||
| } | } | ||||
| if ($request->has('day7')) { | if ($request->has('day7')) { | ||||
| $day3 = $request->day7; //has() checks if param exist and filled | $day3 = $request->day7; //has() checks if param exist and filled | ||||
| } | |||||
| } | |||||
| // if (!empty($start_date)) { | // if (!empty($start_date)) { | ||||
| // } | // } | ||||
| $nested_data = array(); | $nested_data = array(); | ||||
| $compound = $this->searchCompanyName($enforcer,$faulty,$jenis,$modul,$status,$start_date,$end_date,$department,$plate_no,$kpd,$company_no,$nric,$license,$namaP,$company_name, $day3, $day7)->orderBy('created_at','ASC')->get(); | $compound = $this->searchCompanyName($enforcer,$faulty,$jenis,$modul,$status,$start_date,$end_date,$department,$plate_no,$kpd,$company_no,$nric,$license,$namaP,$company_name, $day3, $day7)->orderBy('created_at','ASC')->get(); | ||||
| // info($compound); | // info($compound); | ||||
| return \DataTables::of(CompoundResource::collection($compound))->addIndexColumn() | return \DataTables::of(CompoundResource::collection($compound))->addIndexColumn() | ||||
| $curr = Carbon::now(); | $curr = Carbon::now(); | ||||
| $dtC = Carbon::parse($row['created_at'])->setTimezone('Asia/Kuala_Lumpur'); | $dtC = Carbon::parse($row['created_at'])->setTimezone('Asia/Kuala_Lumpur'); | ||||
| if($curr->diffInDays($dtC) <= 3){ | |||||
| if($curr->diffInDays($dtC) <= 3){ | |||||
| $html = 'New'; | $html = 'New'; | ||||
| }else{ $html = ''; } | }else{ $html = ''; } | ||||
| return $html; | return $html; | ||||
| if ($row['modul'] == '02') { | if ($row['modul'] == '02') { | ||||
| $data = '<b>Selesai</b><div style="margin-top: 8px"><span></span><br/></div>'; | $data = '<b>Selesai</b><div style="margin-top: 8px"><span></span><br/></div>'; | ||||
| $data .= '<div style="margin-top: 8px"><span>Catatan: </span><br/>'.$row['catatan_dari_admin'].'</div>'; | |||||
| $data .= '<div style="margin-top: 8px"><span>Catatan: </span><br/>'.$row['catatan_dari_admin'].'</div>'; | |||||
| } | } | ||||
| else{ | else{ | ||||
| $data = '<b>'.$row['status'].'</b><div style="margin-top: 8px"><span>Bayaran: </span><br/>'; | $data = '<b>'.$row['status'].'</b><div style="margin-top: 8px"><span>Bayaran: </span><br/>'; | ||||
| $data .= 'RM '.$row['amount_payment'].'</div>'; | $data .= 'RM '.$row['amount_payment'].'</div>'; | ||||
| $data .= '<div style="margin-top: 8px"><span>Catatan: </span><br/>'.$row['catatan_dari_admin'].'</div>'; | |||||
| } | |||||
| $data .= '<div style="margin-top: 8px"><span>Catatan: </span><br/>'.$row['catatan_dari_admin'].'</div>'; | |||||
| } | |||||
| if($row['updated_by'] !== null ){ | if($row['updated_by'] !== null ){ | ||||
| $data .= '<div style="margin-top: 8px"><span>Kemaskini: </span><br/>'; | $data .= '<div style="margin-top: 8px"><span>Kemaskini: </span><br/>'; | ||||
| $data .= '<div style="margin-top: 8px"><span>Kemaskini: </span><br/>'; | $data .= '<div style="margin-top: 8px"><span>Kemaskini: </span><br/>'; | ||||
| $data .= $row['updated_at'].' <br/>'.$row['updates_by'].'</div>'; | $data .= $row['updated_at'].' <br/>'.$row['updates_by'].'</div>'; | ||||
| } | } | ||||
| } | |||||
| } | |||||
| }else if($row['status'] == 'Belum Bayar' && $row['updated_by'] !== null){ | }else if($row['status'] == 'Belum Bayar' && $row['updated_by'] !== null){ | ||||
| $data = '<b>'.$row['status'].'</b>'; | $data = '<b>'.$row['status'].'</b>'; | ||||
| $data .= '<div style="margin-top: 8px"><span>Catatan: </span><br/>'.$row['catatan_dari_admin'].'</div>'; | $data .= '<div style="margin-top: 8px"><span>Catatan: </span><br/>'.$row['catatan_dari_admin'].'</div>'; | ||||
| $data .= '<div style="margin-top: 8px"><span>Kemaskini: </span><br/>'; | $data .= '<div style="margin-top: 8px"><span>Kemaskini: </span><br/>'; | ||||
| $data .= $row['updated_at'].' <br/>'.$row['updated_by']['no_badan'].'</div>'; | |||||
| $data .= $row['updated_at'].' <br/>'.$row['updated_by']['no_badan'].'</div>'; | |||||
| }else if($row['status'] == 'Batal' && $row['updated_by'] !== null){ | }else if($row['status'] == 'Batal' && $row['updated_by'] !== null){ | ||||
| $data = '<b>'.$row['status'].'</b>'; | $data = '<b>'.$row['status'].'</b>'; | ||||
| $data .= '<div style="margin-top: 8px"><span>Catatan: </span><br/>'.$row['catatan_dari_admin'].'</div>'; | $data .= '<div style="margin-top: 8px"><span>Catatan: </span><br/>'.$row['catatan_dari_admin'].'</div>'; | ||||
| $data .= '<div style="margin-top: 8px"><span>Kemaskini: </span><br/>'; | $data .= '<div style="margin-top: 8px"><span>Kemaskini: </span><br/>'; | ||||
| $data .= $row['updated_at'].' <br/>'.$row['updated_by']['no_badan'].'</div>'; | |||||
| $data .= $row['updated_at'].' <br/>'.$row['updated_by']['no_badan'].'</div>'; | |||||
| }else if($row['status'] == 'Buang' && $row['updated_by'] !== null){ | }else if($row['status'] == 'Buang' && $row['updated_by'] !== null){ | ||||
| $data = '<b>'.$row['status'].'</b>'; | $data = '<b>'.$row['status'].'</b>'; | ||||
| $data .= '<div style="margin-top: 8px"><span>Catatan: </span><br/>'.$row['catatan_dari_admin'].'</div>'; | $data .= '<div style="margin-top: 8px"><span>Catatan: </span><br/>'.$row['catatan_dari_admin'].'</div>'; | ||||
| //check the lastest compound number stored in dbase filtered by jenis | //check the lastest compound number stored in dbase filtered by jenis | ||||
| $compound = Compound::where('jenis', $jenis)->withTrashed()->latest()->first(); | $compound = Compound::where('jenis', $jenis)->withTrashed()->latest()->first(); | ||||
| //sanitize compound number to return only integer | //sanitize compound number to return only integer | ||||
| $kpd = filter_var($compound['kpd'], FILTER_SANITIZE_NUMBER_INT); | $kpd = filter_var($compound['kpd'], FILTER_SANITIZE_NUMBER_INT); | ||||
| $kpd = '0'.$kpd; | $kpd = '0'.$kpd; | ||||
| } | } | ||||
| }while(!empty(Compound::where('jenis', $jenis)->where('kpd', $tag.$kpd)->first())); | |||||
| }while(!empty(Compound::where('jenis', $jenis)->where('kpd', $tag.$kpd)->first())); | |||||
| } | } | ||||
| //return kpd with tag | |||||
| //return kpd with tag | |||||
| $kpd = $tag . $kpd; | $kpd = $tag . $kpd; | ||||
| return $kpd; | return $kpd; | ||||
| if($request->jenis == 'Parkir') | if($request->jenis == 'Parkir') | ||||
| { | { | ||||
| if(!empty($faulty)){ | |||||
| if(!empty($faulty)){ | |||||
| $countKPD = $this->compound->withTrashed()->count(); | $countKPD = $this->compound->withTrashed()->count(); | ||||
| do { | do { | ||||
| "penguatkuasa" => '-', | "penguatkuasa" => '-', | ||||
| "cpn_created" => Carbon::now()->toDateTimeString(), | "cpn_created" => Carbon::now()->toDateTimeString(), | ||||
| ]; | ]; | ||||
| $file = ConfidentialFile::create($fileData); | $file = ConfidentialFile::create($fileData); | ||||
| $saved = $file->compound()->create($compoundData); | $saved = $file->compound()->create($compoundData); | ||||
| } | } | ||||
| }elseif(($request->jenis == 'Pelbagai_KT') || ($request->jenis == 'Pelbagai_JPB') || ($request->jenis == 'Pelbagai_PA') || ($request->jenis == 'Pelbagai_LESEN')){ | }elseif(($request->jenis == 'Pelbagai_KT') || ($request->jenis == 'Pelbagai_JPB') || ($request->jenis == 'Pelbagai_PA') || ($request->jenis == 'Pelbagai_LESEN')){ | ||||
| $kpd = $request->kpd; | $kpd = $request->kpd; | ||||
| $compound = Compound::where('jenis', $request->jenis)->where('kpd', $kpd)->first(); | $compound = Compound::where('jenis', $request->jenis)->where('kpd', $kpd)->first(); | ||||
| info($compound); | info($compound); | ||||
| if (!empty($compound)) { | if (!empty($compound)) { | ||||
| $saved = ''; | $saved = ''; | ||||
| if($compound->modul != '03') | if($compound->modul != '03') | ||||
| { | { | ||||
| if($request->jenis == 'Pelbagai_KT'){ | if($request->jenis == 'Pelbagai_KT'){ | ||||
| $compound->jenis = $request->jenis; | $compound->jenis = $request->jenis; | ||||
| $compound->nama = $request->namaP; | $compound->nama = $request->namaP; | ||||
| $compound->identity = $request->noIc; | $compound->identity = $request->noIc; | ||||
| $compound->no_telefon = $request->tel; | $compound->no_telefon = $request->tel; | ||||
| $compound->no_akaun_lesen = $request->lesen; | $compound->no_akaun_lesen = $request->lesen; | ||||
| $compound->cpn_created = Carbon::now()->toDateTimeString(); | $compound->cpn_created = Carbon::now()->toDateTimeString(); | ||||
| }elseif($request->jenis == 'Pelbagai_JPB'){ | }elseif($request->jenis == 'Pelbagai_JPB'){ | ||||
| $compound->jenis = $request->jenis; | $compound->jenis = $request->jenis; | ||||
| $compound->no_telefon = $request->tel; | $compound->no_telefon = $request->tel; | ||||
| $compound->no_akaun_lesen = $request->lesen; | $compound->no_akaun_lesen = $request->lesen; | ||||
| $compound->cpn_created = Carbon::now()->toDateTimeString(); | $compound->cpn_created = Carbon::now()->toDateTimeString(); | ||||
| }elseif($request->jenis == 'Pelbagai_PA'){ | }elseif($request->jenis == 'Pelbagai_PA'){ | ||||
| $compound->jenis = $request->jenis; | $compound->jenis = $request->jenis; | ||||
| $compound->nama = $request->namaP; | $compound->nama = $request->namaP; | ||||
| $compound->identity = $request->noIc; | $compound->identity = $request->noIc; | ||||
| $compound->no_akaun_lesen = $request->lesen; | $compound->no_akaun_lesen = $request->lesen; | ||||
| $compound->bil_haiwan = $request->lesen; | $compound->bil_haiwan = $request->lesen; | ||||
| $compound->cpn_created = Carbon::now()->toDateTimeString(); | $compound->cpn_created = Carbon::now()->toDateTimeString(); | ||||
| }elseif($request->jenis == 'Pelbagai_LESEN'){ | }elseif($request->jenis == 'Pelbagai_LESEN'){ | ||||
| $compound->jenis = $request->jenis; | $compound->jenis = $request->jenis; | ||||
| $compound->nama = $request->namaP; | $compound->nama = $request->namaP; | ||||
| $compound->identity = $request->noIc; | $compound->identity = $request->noIc; | ||||
| $compound->no_telefon = $request->tel; | $compound->no_telefon = $request->tel; | ||||
| $compound->no_akaun_lesen = $request->lesen; | $compound->no_akaun_lesen = $request->lesen; | ||||
| $compound->cpn_created = Carbon::now()->toDateTimeString(); | $compound->cpn_created = Carbon::now()->toDateTimeString(); | ||||
| } | } | ||||
| $saved = $compound->save(); | $saved = $compound->save(); | ||||
| // $tawaran = $compound->jumlah_asal_kompaun; | // $tawaran = $compound->jumlah_asal_kompaun; | ||||
| // } | // } | ||||
| $this->dispatch(new StoreCompound($request->all(), $kpd, $staff->_id, $no_siri)); | $this->dispatch(new StoreCompound($request->all(), $kpd, $staff->_id, $no_siri)); | ||||
| array_push($data, array('kpd' => $kpd)); | array_push($data, array('kpd' => $kpd)); | ||||
| $this->dispatch(new StoreCompoundEPBT($request->all(), $kpd, $staff->StaffDetail->full_name, $staff->StaffDetail->no_badan, $faulty->nama)); | $this->dispatch(new StoreCompoundEPBT($request->all(), $kpd, $staff->StaffDetail->full_name, $staff->StaffDetail->no_badan, $faulty->nama)); | ||||
| return $this->sendResponse($data, 'Berjaya simpan rekod kompaun!'); | return $this->sendResponse($data, 'Berjaya simpan rekod kompaun!'); | ||||
| // } | // } | ||||
| } | |||||
| } | |||||
| } | } | ||||
| else{ | else{ | ||||
| return $this->sendResponse('', 'Kompaun ini tidak dijumpai!'); | |||||
| } | |||||
| } | |||||
| return $this->sendResponse('', 'Kompaun ini tidak dijumpai!'); | |||||
| } | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| if($request->jenis == 'Parkir'){ | if($request->jenis == 'Parkir'){ | ||||
| //for compound numbering | //for compound numbering | ||||
| $countKPD = $this->compound->withTrashed()->count(); | |||||
| $countKPD = $this->compound->withTrashed()->count(); | |||||
| $no_siri = date('yn').'-'.$countKPD.'-0'; | $no_siri = date('yn').'-'.$countKPD.'-0'; | ||||
| $compoundData = [ | $compoundData = [ | ||||
| 'jenis' => 'Parkir', | 'jenis' => 'Parkir', | ||||
| 'kpd' => 'KPD'.$countKPD, | 'kpd' => 'KPD'.$countKPD, | ||||
| }elseif($request->jenis == 'Pelbagai_JPB'){ | }elseif($request->jenis == 'Pelbagai_JPB'){ | ||||
| $kpd = $this->generateCompoundNumber($request->jenis, 'JPB'); | $kpd = $this->generateCompoundNumber($request->jenis, 'JPB'); | ||||
| $no_siri = date('yn').'-'.filter_var($kpd, FILTER_SANITIZE_NUMBER_INT).'-2'; | $no_siri = date('yn').'-'.filter_var($kpd, FILTER_SANITIZE_NUMBER_INT).'-2'; | ||||
| $compoundData = [ | $compoundData = [ | ||||
| elseif($request->jenis == 'Pelbagai_LESEN'){ | elseif($request->jenis == 'Pelbagai_LESEN'){ | ||||
| //HN bcs other N stands for notice. compound number no need front N | //HN bcs other N stands for notice. compound number no need front N | ||||
| $kpd = $this->generateCompoundNumber($request->jenis, 'HN'); | |||||
| $kpd = $this->generateCompoundNumber($request->jenis, 'HN'); | |||||
| $no_siri = date('yn').'-'.filter_var($kpd, FILTER_SANITIZE_NUMBER_INT).'-3'; | $no_siri = date('yn').'-'.filter_var($kpd, FILTER_SANITIZE_NUMBER_INT).'-3'; | ||||
| $compoundData = [ | $compoundData = [ | ||||
| elseif($request->jenis == 'Pelbagai_PA'){ | elseif($request->jenis == 'Pelbagai_PA'){ | ||||
| $kpd = $this->generateCompoundNumber($request->jenis, 'PA'); | $kpd = $this->generateCompoundNumber($request->jenis, 'PA'); | ||||
| $no_siri = date('yn').'-'.filter_var($kpd, FILTER_SANITIZE_NUMBER_INT).'-4'; | $no_siri = date('yn').'-'.filter_var($kpd, FILTER_SANITIZE_NUMBER_INT).'-4'; | ||||
| $compoundData = [ | $compoundData = [ | ||||
| return $this->sendResponse($data, 'Berjaya simpan rekod notis!'); | return $this->sendResponse($data, 'Berjaya simpan rekod notis!'); | ||||
| // } | // } | ||||
| } | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| $data = array(); | $data = array(); | ||||
| $faulty = Faulty::where('_id',$request->get('seksyen'))->first(); | $faulty = Faulty::where('_id',$request->get('seksyen'))->first(); | ||||
| if(!empty($faulty)){ | |||||
| if(!empty($faulty)){ | |||||
| $kpd = ''; | $kpd = ''; | ||||
| $no_siri =''; | |||||
| $no_siri =''; | |||||
| // $countKPD = $this->compound->withTrashed()->count(); | // $countKPD = $this->compound->withTrashed()->count(); | ||||
| // do { | // do { | ||||
| if($request->jenis == 'Parkir') | if($request->jenis == 'Parkir') | ||||
| { | { | ||||
| //for compound numbering | //for compound numbering | ||||
| $countKPD = $this->compound->withTrashed()->count(); | |||||
| $countKPD = $this->compound->withTrashed()->count(); | |||||
| $no_siri = date('yn').'-'.$countKPD.'-0'; | $no_siri = date('yn').'-'.$countKPD.'-0'; | ||||
| $fileData = [ | $fileData = [ | ||||
| 'no_siri' => $no_siri, | 'no_siri' => $no_siri, | ||||
| ]; | ]; | ||||
| $file = ConfidentialFile::create($fileData); | $file = ConfidentialFile::create($fileData); | ||||
| $saved = $file->compound()->create($compoundData); | $saved = $file->compound()->create($compoundData); | ||||
| if($saved){ | if($saved){ | ||||
| // $compound = Compound::with('ConfidentialFile')->where('kpd',$kpd)->first(); | // $compound = Compound::with('ConfidentialFile')->where('kpd',$kpd)->first(); | ||||
| // if(!empty($compound)){ | // if(!empty($compound)){ | ||||
| // } | // } | ||||
| $this->dispatch(new StoreCompound($request->all(), $kpd, $staff->_id, $no_siri)); | $this->dispatch(new StoreCompound($request->all(), $kpd, $staff->_id, $no_siri)); | ||||
| array_push($data, array('kpd' => $kpd)); | array_push($data, array('kpd' => $kpd)); | ||||
| $this->dispatch(new StoreCompoundEPBT($request->all(), $kpd, $staff->StaffDetail->full_name, $staff->StaffDetail->no_badan, $faulty->nama)); | $this->dispatch(new StoreCompoundEPBT($request->all(), $kpd, $staff->StaffDetail->full_name, $staff->StaffDetail->no_badan, $faulty->nama)); | ||||
| return $this->sendResponse($data, 'Berjaya simpan rekod kompaun!'); | return $this->sendResponse($data, 'Berjaya simpan rekod kompaun!'); | ||||
| } | |||||
| } | |||||
| return $this->sendResponse('Tidak Berjaya!', 'Kesalahan tidak dijumpai!'); | |||||
| } | |||||
| } | |||||
| return $this->sendResponse('Tidak Berjaya!', 'Kesalahan tidak dijumpai!'); | |||||
| } | } | ||||
| } | } | ||||
| $compound->catatan_dari_admin = $request->remark; | $compound->catatan_dari_admin = $request->remark; | ||||
| $compound->update_by = $request->current_id; | $compound->update_by = $request->current_id; | ||||
| $saved = $compound->save(); | $saved = $compound->save(); | ||||
| if($saved){ | if($saved){ | ||||
| $gDate = $compound->created_at->format('F Y'); | $gDate = $compound->created_at->format('F Y'); | ||||
| }else{ | }else{ | ||||
| return $this->sendResponse('', 'Berjaya kemaskini status. Sila rujuk kompaun ini di modul kategori "Kompaun/Notis DiBatalkan" '); | return $this->sendResponse('', 'Berjaya kemaskini status. Sila rujuk kompaun ini di modul kategori "Kompaun/Notis DiBatalkan" '); | ||||
| } | } | ||||
| }else{ | }else{ | ||||
| $response = [ | $response = [ | ||||
| 'success' => false, 'message' => 'Notis ini tidak berjaya dikemaskini', | 'success' => false, 'message' => 'Notis ini tidak berjaya dikemaskini', | ||||
| } | } | ||||
| } | } | ||||
| }else{ | }else{ | ||||
| if($compound->status != 'Berbayar' && $compound->status != $request->status){ | if($compound->status != 'Berbayar' && $compound->status != $request->status){ | ||||
| // $compound->amount_payment = $request->amount; | // $compound->amount_payment = $request->amount; | ||||
| $compound->update_by = $request->current_id; | $compound->update_by = $request->current_id; | ||||
| $saved = $compound->save(); | $saved = $compound->save(); | ||||
| if($saved){ | if($saved){ | ||||
| $gDate = $compound->created_at->format('F Y'); | $gDate = $compound->created_at->format('F Y'); | ||||
| }else{ | }else{ | ||||
| return $this->sendResponse('', 'Berjaya kemaskini status. Sila rujuk notis ini di modul kategori "Kompaun/Notis DiBatalkan" '); | return $this->sendResponse('', 'Berjaya kemaskini status. Sila rujuk notis ini di modul kategori "Kompaun/Notis DiBatalkan" '); | ||||
| } | } | ||||
| }else{ | }else{ | ||||
| $response = [ | $response = [ | ||||
| 'success' => false, 'message' => 'Notis ini tidak berjaya dikemaskini', | 'success' => false, 'message' => 'Notis ini tidak berjaya dikemaskini', | ||||
| $compound->amount_payment = $request->amount; | $compound->amount_payment = $request->amount; | ||||
| $compound->update_by = $request->current_id; | $compound->update_by = $request->current_id; | ||||
| $saved = $compound->save(); | $saved = $compound->save(); | ||||
| if($saved){ | if($saved){ | ||||
| $gDate = $compound->created_at->format('F Y'); | $gDate = $compound->created_at->format('F Y'); | ||||
| }else{ | }else{ | ||||
| return $this->sendResponse('', 'Berjaya kemaskini status. Sila rujuk kompaun ini di modul kategori "Kompaun DiBatalkan" '); | return $this->sendResponse('', 'Berjaya kemaskini status. Sila rujuk kompaun ini di modul kategori "Kompaun DiBatalkan" '); | ||||
| } | } | ||||
| }else{ | }else{ | ||||
| $response = [ | $response = [ | ||||
| 'success' => false, 'message' => 'Kompaun ini tidak berjaya dikemaskini', | 'success' => false, 'message' => 'Kompaun ini tidak berjaya dikemaskini', | ||||
| } | } | ||||
| } | } | ||||
| }else{ | }else{ | ||||
| if($compound->status != 'Berbayar' && $compound->status != $request->status){ | if($compound->status != 'Berbayar' && $compound->status != $request->status){ | ||||
| $compound->amount_payment = $request->amount; | $compound->amount_payment = $request->amount; | ||||
| $compound->update_by = $request->current_id; | $compound->update_by = $request->current_id; | ||||
| $saved = $compound->save(); | $saved = $compound->save(); | ||||
| if($saved){ | if($saved){ | ||||
| $gDate = $compound->created_at->format('F Y'); | $gDate = $compound->created_at->format('F Y'); | ||||
| }else{ | }else{ | ||||
| return $this->sendResponse('', 'Berjaya kemaskini status. Sila rujuk kompaun ini di modul kategori "Kompaun DiBatalkan" '); | return $this->sendResponse('', 'Berjaya kemaskini status. Sila rujuk kompaun ini di modul kategori "Kompaun DiBatalkan" '); | ||||
| } | } | ||||
| }else{ | }else{ | ||||
| $response = [ | $response = [ | ||||
| 'success' => false, 'message' => 'Kompaun ini tidak berjaya dikemaskini', | 'success' => false, 'message' => 'Kompaun ini tidak berjaya dikemaskini', |