From db7f56eae33c65048091f012b7e2d4dd016c7eb2 Mon Sep 17 00:00:00 2001 From: Nur Izzati Zulkifli Date: Thu, 4 Jan 2024 15:50:48 +0800 Subject: [PATCH] tambah function notis peringatan kedua arcc dan tambah baik pertama --- app/Http/Controllers/CallCenterController.php | 283 +++++++++++++++- public/img/surat.png | Bin 0 -> 569 bytes .../bycawdetailnotisperingatan.blade.php | 35 +- .../bycawdetailnotisperingatankedua.blade.php | 312 +++++++++++++++++ .../detailnotisperingatan.blade.php | 7 +- .../detailnotisperingatankedua.blade.php | 245 ++++++++++++++ .../listcariansagnotispertama.blade.php | 313 ++++++++++++++++++ .../callcenter/notisperingatankedua.blade.php | 254 ++++++++++++++ .../notisperingatanpertama.blade.php | 279 ++++++++++++++++ .../callcenter/rekodnotisperingatan.blade.php | 19 +- .../rekodnotisperingatankedua.blade.php | 261 +++++++++++++++ .../suratnotisperingatankedua.blade.php | 214 ++++++++++++ .../views/homepage/callcenter/home.blade.php | 2 +- routes/web.php | 11 + 14 files changed, 2202 insertions(+), 33 deletions(-) create mode 100644 public/img/surat.png create mode 100644 resources/views/callcenter/bycawdetailnotisperingatankedua.blade.php create mode 100644 resources/views/callcenter/detailnotisperingatankedua.blade.php create mode 100644 resources/views/callcenter/listcariansagnotispertama.blade.php create mode 100644 resources/views/callcenter/notisperingatankedua.blade.php create mode 100644 resources/views/callcenter/notisperingatanpertama.blade.php create mode 100644 resources/views/callcenter/rekodnotisperingatankedua.blade.php create mode 100644 resources/views/callcenter/suratnotisperingatankedua.blade.php diff --git a/app/Http/Controllers/CallCenterController.php b/app/Http/Controllers/CallCenterController.php index 9fdab5a..5018b97 100644 --- a/app/Http/Controllers/CallCenterController.php +++ b/app/Http/Controllers/CallCenterController.php @@ -8,6 +8,7 @@ use Illuminate\Support\Facades\Session; use Illuminate\Support\Facades\Http; use Illuminate\Support\Facades\Auth; use Carbon\Carbon; +use PDF; class CallCenterController extends Controller @@ -22,21 +23,14 @@ class CallCenterController extends Controller $api_url = config('api.url'); $cawangan_info = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/cawangan/'. $auth_user['cawangan'])->json(); - $kelulusan = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/ListOperasi/')->json(); + return view('callcenter.notisperingatan',compact('cawangan_info','api_url')); + } + public function notisperingatanpertama(Request $request){ + $auth_user = Auth::user(); + $api_url = config('api.url'); + $cawangan_info = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/cawangan/'. $auth_user['cawangan'])->json(); - $arraykelulusan = []; - - - foreach($kelulusan as $index=>$lulus) - { - foreach($lulus['kelulusanall'] as $index=>$kel) - { - array_push($arraykelulusan,["cawangan" => $lulus['cawangan'], "cawangankod" => $lulus['cawangankod'],"namateller" => $kel['teller'], 'siri' => $kel['siri'] , "norujukan" => $kel['norujukan'], 'pinjaman' => $kel['jumpinj'],'komen' => $kel['komen'], 'nilaimarhun' => ($kel['nilaimarhun'] ?? '-'), 'berat' => ($kel['berat'] ?? '-'),'margin' => ($kel['margin'] ?? '-'), 'status' => ($kel['status'] ?? '-'), 'pelulus' => $kel['pelulus']]); - } - } - - - return view('callcenter.notisperingatan',compact('cawangan_info','api_url','arraykelulusan')); + return view('callcenter.notisperingatanpertama',compact('cawangan_info','api_url')); } public function cariansag(Request $request) @@ -50,6 +44,7 @@ class CallCenterController extends Controller $tarikh_cetak = $current->toDateString(); $daritempoh = $request->daritempoh; $hinggatempoh = $request->hinggatempoh; + $cawangan_all = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url').'/arcc/cawangan',[ 'daritempoh' => $daritempoh, @@ -85,6 +80,46 @@ class CallCenterController extends Controller )); } + public function cariansagnotispertama(Request $request) + { + // dd($request->all()); + $request->radaktif === 'aktif'; + $api_url = config('api.url'); + $auth_user = Auth::user(); + $current = Carbon::now(); + $current = new Carbon(); + $tarikh_cetak = $current->toDateString(); + $fasa = $request->fasa; + + + $cawangan_all = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url').'/arcc/cawangan',[ + 'fasa' => $fasa, + ])->json(); + // dd($cawangan_all ); + + $senarai = []; + foreach($cawangan_all as $cawangan){ + $kodcaw = $cawangan['kodcaw']; + $datagadai = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url').'/arcc/cariannotispertama/'.$kodcaw,[ + 'fasa' => $fasa + ])->json(); + + $data = [ + 'kodcaw'=>$cawangan['kodcaw'], + 'caw_name'=>$cawangan['details_caw'], + 'datagadai' => $datagadai ? $datagadai : '', + ]; + + array_push($senarai,$data); + } + + return view('callcenter.listcariansagnotispertama', compact( + 'kodcaw', + 'senarai', + 'fasa' + )); + } + public function janadatanotisperingatan(Request $request) { $current = Carbon::now(); @@ -129,6 +164,46 @@ class CallCenterController extends Controller return redirect()->route('arcc.notisperingatan')->with('success','Berjaya Daftar Notis Peringatan.'); } + public function janadatanotispertama(Request $request) + { + $current = Carbon::now(); + $current = new Carbon(); + $currentNow = Carbon::now(); + $senarai = []; + $tarikh_savedaftarnotis = $current->toDateString(); + $fasa = $request->fasa; + $kodcaw = $request->kodcaw; + $selected_caw = $request->caw; + // dd($selected_caw); + if(!empty($selected_caw)) + { + $getbatchnotispertama=Http::withOptions(['verify' => config('app.api_verify')])->get( config('api.url').'/arcc/getbatchnotispertama',[ + 'fasa' => $fasa + ])->json(); + $newbatchnotis=$getbatchnotispertama; + + foreach($selected_caw as $index=>$caw){ + $cawangan_info = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/cawangan/'. $caw)->json(); + // dd($cawangan_info); + $insertnotispertama = Http::withOptions(['verify' => config('app.api_verify')])->post(config('api.url').'/arcc/insertnotispertama/'.$caw ,[ + 'fasa' => $fasa, + 'kodcaw' => $caw, + 'notisid' => $newbatchnotis + ])->json(); + + $data = [ + 'kodcaw'=>$caw, + 'caw_name'=>$cawangan_info['details_caw'], + 'datagadai' => $insertnotispertama ? $insertnotispertama : '', + ]; + + array_push($senarai,$data); + } + return redirect()->route('arcc.notisperingatanpertama')->with('success','Berjaya Daftar Notis Peringatan Pertama.'); + }else{ + return redirect()->route('arcc.notisperingatanpertama')->with('failed','Maaf,Tiada Cawangan Dipilih Sila Cuba Lagi...'); + } + } public function rekodnotisperingatan() { @@ -187,7 +262,7 @@ class CallCenterController extends Controller if($request->type == 'whatsapp') { - $blastwhatsapp = Http::withOptions(['verify' => config('app.api_verify')])->post(config('api.url').'/arcc/blastwasapbysag/'.$auth_user['cawangan'], + $blastwhatsapp = Http::withOptions(['verify' => config('app.api_verify')])->post(config('api.url').'/arcc/notis/blastwasapbysag/'.$auth_user['cawangan'], ['kodcaw' => $kodcaw,'notisid' => $notisid, 'namapengguna' => $auth_user['name'],])->json(); if($blastwhatsapp == 'success'){ return redirect()->route('arcc.bycawnotisperingatan',['kodcaw' => $kodcaw, 'notisid' => $notisid]) @@ -211,7 +286,7 @@ class CallCenterController extends Controller if($request->type == 'whatsapp') { - $blastwhatsapp = Http::withOptions(['verify' => config('app.api_verify')])->post(config('api.url').'/arcc/blastwasapbysag', + $blastwhatsapp = Http::withOptions(['verify' => config('app.api_verify')])->post(config('api.url').'/arcc/notis/blastwasapbysag', ['kodcaw' => $kodcaw,'notisid' => $notisid, 'namapengguna' => $auth_user['name'],])->json(); if($blastwhatsapp == 'success'){ return redirect()->route('arcc.bycawnotisperingatan',['kodcaw' => $kodcaw, 'notisid' => $notisid]) @@ -286,5 +361,181 @@ class CallCenterController extends Controller return view('callcenter.' . $cawangan_info['version'] . '.info',compact('cawangan_info','api_url','customer_info','bakilelong','rugilelong','negeri')); } + public function notisperingatankedua(Request $request){ + $auth_user = Auth::user(); + $api_url = config('api.url'); + $cawangan_info = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/cawangan/'. $auth_user['cawangan'])->json(); + + return view('callcenter.notisperingatankedua',compact('cawangan_info','api_url')); + } + + + public function kemaskininotisperingatan($notisid) + { + $auth_user = Auth::user(); + $api_url = config('api.url'); + + $senarai = []; + + $detailnotis = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url'). '/arcc/getcawnotis/'.$notisid)->json(); + foreach($detailnotis as $info) + { + $kemaskininotisperingatan = Http::withOptions(['verify' => config('app.api_verify')])->post(config('api.url'). '/arcc/kemaskininotisperingatan', [ + 'kodcaw' => $info[0]['kodcaw'], + 'notisid' => $notisid + ])->json(); + + if($kemaskininotisperingatan == 'success'){ + return redirect()->route('arcc.detailnotisperingatan',['notisid' => $notisid]) + ->with('success','Data Telah Dikemaskini.'); + }elseif($kemaskininotisperingatan == 'failed'){ + return redirect()->route('arcc.detailnotisperingatan',['notisid' => $notisid]) + ->with('failed','Data Tidak Dikemaskini. Sila Semak Semula...'); + } + } + return view('callcenter.detailnotisperingatan',compact('detailnotis','senarai','notisid')); + } + + public function cariansagnotiskedua(Request $request) + { + // dd($request->all()); + $api_url = config('api.url'); + $auth_user = Auth::user(); + $current = Carbon::now(); + $current = new Carbon(); + $tarikh_cetak = $current->toDateString(); + $fasa = $request->fasa; + + $notis = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url').'/arcc/cariannotiskedua',[ + 'fasa' => $fasa + ])->json(); + + + return redirect()->route('arcc.notisperingatankedua')->with('success','Berjaya Daftar Notis Peringatan Kedua.'); + } + + public function rekodnotisperingatankedua() + { + $auth_user = Auth::user(); + $api_url = config('api.url'); + + $arrayinfo = []; + + // $notis = Notis::select('tarikh_notis','id') + // ->groupBy('tarikh_notis') + // ->get(); + $notis = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url'). '/arcc/senarainotisperingatan')->json(); + // dd($notis); + foreach($notis as $info) + { + $getcawnotis = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url'). '/arcc/getcawnotis/'.$info['id'])->json(); + + array_push($arrayinfo, ['info'=> $info,'cawnotis' => $getcawnotis]); + } + // dd($arrayinfo); + return view('callcenter.rekodnotisperingatankedua',compact('notis','arrayinfo')); + } + + public function detailnotisperingatankedua($notisid) + { + $auth_user = Auth::user(); + $api_url = config('api.url'); + + $senarai = []; + + $detailnotis = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url'). '/arcc/getcawnotis/'.$notisid)->json(); + foreach($detailnotis as $info) + { + $getcawnotiskeduabycaw = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url'). '/arcc/getcawnotiskeduabycaw', [ + 'kodcaw' => $info[0]['kodcaw'], + 'notisid' => $notisid + ])->json(); + + $data = [ + 'detailnotis' => $info ? $info : '', + 'getcawnotisbycaw' => $getcawnotiskeduabycaw ? $getcawnotiskeduabycaw : '', + ]; + + array_push($senarai,$data); + } + return view('callcenter.detailnotisperingatankedua',compact('detailnotis','senarai','notisid')); + } + + public function bycawnotisperingatankedua($kodcaw,$notisid, Request $request) + { + + $auth_user = Auth::user(); + $api_url = config('api.url'); + $cawangan_info = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/cawangan/'. $kodcaw)->json(); + $bycawnotisperingatankedua = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url'). '/arcc/bycawnotisperingatankedua/'.$kodcaw.'/'.$notisid)->json(); + + // if($request->type == 'whatsapp') + // { + + // $blastwhatsapp = Http::withOptions(['verify' => config('app.api_verify')])->post(config('api.url').'/arcc/blastwasapbysag/'.$auth_user['cawangan'], + // ['kodcaw' => $kodcaw,'notisid' => $notisid, 'namapengguna' => $auth_user['name'],])->json(); + // if($blastwhatsapp == 'success'){ + // return redirect()->route('arcc.bycawnotisperingatankedua',['kodcaw' => $kodcaw, 'notisid' => $notisid]) + // ->with('success','Blast Whatsapp Dalam Proses.'); + // } + // elseif($blastwhatsapp == 'failed'){ + // return redirect()->route('arcc.bycawnotisperingatankedua',['kodcaw' => $kodcaw, 'notisid' => $notisid]) + // ->with('failed','Blast Whatsapp Tidak Berjaya, Sila Semak Semula Rekod Blasted.'); + // } + + // } + + return view('callcenter.bycawdetailnotisperingatankedua',compact('cawangan_info','bycawnotisperingatankedua','kodcaw','notisid','api_url')); + } + + public function blastkedua($kodcaw,$notisid,Request $request) + { + $current = Carbon::now(); + $current = new Carbon(); + $tarikh_cetak = $current->toDateString(); + $auth_user = Auth::user(); + $api_url = config('api.url'); + $cawangan_info = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/cawangan/'. $kodcaw)->json(); + $bycawnotisperingatan = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url'). '/arcc/bycawnotisperingatan/'.$kodcaw.'/'.$notisid)->json(); + if($request->type == 'whatsapp') + { + + $blastwhatsappkedua = Http::withOptions(['verify' => config('app.api_verify')])->post(config('api.url').'/arcc/notis/blastwasapbysagkedua', + ['kodcaw' => $kodcaw,'notisid' => $notisid, 'namapengguna' => $auth_user['name'],])->json(); + if($blastwhatsappkedua == 'success'){ + return redirect()->route('arcc.bycawnotisperingatankedua',['kodcaw' => $kodcaw, 'notisid' => $notisid]) + ->with('success','Blast Whatsapp Dalam Proses.'); + } + elseif($blastwhatsappkedua == 'failed'){ + return redirect()->route('arcc.bycawnotisperingatankedua',['kodcaw' => $kodcaw, 'notisid' => $notisid]) + ->with('failed','Blast Whatsapp Tidak Berjaya, Sila Semak Semula Rekod Blasted.'); + } + + } + elseif($request->type == 'pdf') + { + if($request->fasa == 1) + { + $datanotiskedua = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url'). '/arcc/getdatanotiskedua/'. $kodcaw.'/'.$notisid. '/' . 'fasa1')->json(); + $fasa = 'fasa1'; + }else{ + // dd(false); + $datanotiskedua = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url'). '/arcc/getdatanotiskedua/'. $kodcaw.'/'.$notisid. '/' . 'fasa2')->json(); + $fasa = 'fasa2'; + // dd($datanotiskedua); + } + $cawangan_info = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/cawangan/'. $kodcaw)->json(); + $cawangan = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url').'/api/cawangan/detail/'.$kodcaw)->json(); + $cawangan_detail=$cawangan[0]; + + // return view('print.notislelong', compact('cawangan_info','notislelong','api_url','cawangan_detail','lelong','tarikh_cetak')); + // dd($datanotiskedua); + $pdf=PDF::loadView('callcenter.suratnotisperingatankedua', compact('cawangan_info','api_url','cawangan_detail','datanotiskedua','fasa','tarikh_cetak'))->setPaper('A4','potrait'); + return $pdf->download('notisperingatankedua_'.$tarikh_cetak.'_'.$fasa.'.pdf'); + + } + return view('callcenter.bycawdetailnotisperingatan',compact('cawangan_info','bycawnotisperingatan','kodcaw','notisid')); + } + } diff --git a/public/img/surat.png b/public/img/surat.png new file mode 100644 index 0000000000000000000000000000000000000000..76a3783eafbb577be37367a2b67e78a4a35d1259 GIT binary patch literal 569 zcmV-90>=G`P)Px#1ZP1_K>z@;j|==^1poj5AY({UO#lFTCIA3{ga82g0001h=l}q9FaQARU;qF* zm;eA5aGbhPJOBUy32;bRa{vGmbN~PnbOGLGA9w%&0isDnK~y+T%~MS)gkcmtL&`#l zqBL39h+kk~F(zvZKY*l^vLPi|SsNA>O3KHKd@L}&^Eu>Ogawfd$uuK|8I2h;!?@04 z1|?0C4R4*E`<#34Irn+q_XYmLlg}aazl07+NqA_kgcxffoz=0!R0k>6L7>&balZ|b z^$6CuMuVzbCC(tNjqo8O9d_p)3#ji&Y$27!G zA=xK(h}~}>|FjGVs+x01Q;iZx%33UMt$Jd=#K!X`~s z9|FT9*c_mca|Ck1eb7qolFf7y8yk5~PV$}!NNA4S1_dgVKnjmANMef4N}U(vp@?;e zBG=q|Aa1(d^fTt!Ulv$5%9zs_$|C}|-6W{2MBXvOaZQk;cF1ur#Ktu={*@0!Y7M1f z0oS9EN##!GPmIxx&E5`j>WIqqBX16yw3Hx##DqArrGex2@eObif7cg+J-k>>@)Pf7 zu1u$~^9xQ%&P>&`73RWHkPVA22IzBO$;;Br0`WzE|1Z7)hL@p=s>b$q00000NkvXX Hu0mjfC&1`8 literal 0 HcmV?d00001 diff --git a/resources/views/callcenter/bycawdetailnotisperingatan.blade.php b/resources/views/callcenter/bycawdetailnotisperingatan.blade.php index f188f76..3e47160 100644 --- a/resources/views/callcenter/bycawdetailnotisperingatan.blade.php +++ b/resources/views/callcenter/bycawdetailnotisperingatan.blade.php @@ -92,15 +92,15 @@ @section('content') -
+