diff --git a/.DS_Store b/.DS_Store index f1757f2..6bde683 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/app/Http/Controllers/AliranTunaiController.php b/app/Http/Controllers/AliranTunaiController.php index 15451aa..c44ee73 100644 --- a/app/Http/Controllers/AliranTunaiController.php +++ b/app/Http/Controllers/AliranTunaiController.php @@ -109,8 +109,10 @@ class AliranTunaiController extends Controller $requestkodlaluan = Http::get(config('api.url').'/api/get/pengguna/'.$auth_user['cawangan'],["namateller" => Auth::user()->name ])->json(); $advansur = Http::get(config('api.url').'/api/AnsuranByTarikh/'.$auth_user['cawangan'],['kodlaluan' => Auth::user()->name])->json(); - - return view('aliran_tunai.index',compact('cawangan_info','alirantunai','api_url','GT','denominasi','gadai_tebus','tuntutbaki','advansur','addtunai')); + + $tunaipast = Http::get( config('api.url') .'/api/getPastTunai/'. $auth_user['cawangan'],['kodlaluan' => Auth::user()->name])->json(); + + return view('aliran_tunai.index',compact('cawangan_info','alirantunai','api_url','GT','denominasi','gadai_tebus','tuntutbaki','advansur','addtunai','tunaipast')); } public function alirantunaiGadai(Request $request,$teller){ @@ -446,7 +448,8 @@ class AliranTunaiController extends Controller $gadaian = floatval($totalgadai); if(strtoupper(Auth::user()->name) === 'LELONG'){ - $bakisemasa = $lelongan; + $penebusanbarcodescanned = floatval($lelongan); + $bakisemasa = floatval($lelongan) - floatval($totalserahan); }else{ $bakisemasa = floatval($bakiawal) + floatval($totalpendahuluan) + floatval($penebusan) - (floatval($gadaian) + floatval($totalserahan)) - floatval($totaltuntutbaki); } @@ -580,5 +583,30 @@ class AliranTunaiController extends Controller return response($updateTunai); } + public function LaporanAliranTunai($teller) + { + $auth_user = Auth::user(); + $api_url = config('api.url'); + + $current = Carbon::now(); + $current = new Carbon(); + + $cawangan_info = Http::get(config('api.url') . '/api/cawangan/'. $auth_user['cawangan'])->json(); + $cawangan=Http::get(config('api.url').'/api/cawangan/detail/'.$auth_user['cawangan'])->json(); + $cawangan_detail=$cawangan[0]; + + $tarikh_cetak = $current->toDateString(); + + $cawangan=Http::get(config('api.url').'/api/cawangan/detail/'.$auth_user['cawangan'])->json(); + + $alirantunai = Http::get(config('api.url') . '/api/GetCurrentTunai/' . $auth_user['cawangan'],['kodlaluan' => $auth_user['name']])->json(); + + $addtunai = Http::get(config('api.url') . '/api/getAddTunai/' . $auth_user['cawangan'] . '/kodlaluan/',['kodlaluan' => $auth_user['name']])->json(); + + $teller = $auth_user['name']; + + return view('aliran_tunai.laporan.laporanalirantunai',compact('tarikh_cetak','cawangan_info','cawangan','api_url','cawangan_detail','addtunai','alirantunai','teller')); + } + } diff --git a/app/Http/Controllers/CustomersController.php b/app/Http/Controllers/CustomersController.php index 97abe7f..afc3d84 100644 --- a/app/Http/Controllers/CustomersController.php +++ b/app/Http/Controllers/CustomersController.php @@ -37,7 +37,8 @@ class CustomersController extends Controller $idtype = 'nokp'; $cawangan_info = Http::get(config('api.url') . '/api/cawangan/'. $auth_user['cawangan'])->json(); $bank = Http::get(config('api.url') . '/api/bank')->json(); - return view('customers.index',compact('search','cawangan_info','bank','api_url','idtype')); + $blacklist_search = false; + return view('customers.index',compact('search','blacklist_search','cawangan_info','bank','api_url','idtype')); } public function info(Request $request){ @@ -70,6 +71,9 @@ class CustomersController extends Controller $bank = Http::get(config('api.url') . '/api/bank')->json(); $customer_info = Http::get(config('api.url') . '/api/customers/'. $noic)->json(); + $blacklist = Http::get(config('api.url') . '/api/customer/blacklist',[ + 'nokp' => $noic + ])->json(); // if($customers_info){ // $customer_info = $customers_info[0]; // }else{ @@ -77,13 +81,23 @@ class CustomersController extends Controller // } $request->session()->forget('page_reload'); $request->session()->forget('norujukan'); - + $blacklist_search = false; $search = true; if($customer_info){ - Session::put('customer_info',$customer_info); - return redirect()->route('customer_info')->with( ['customer_info' => $customer_info,'cawangan_info'=>$cawangan_info,'api_url'=>$api_url]); + if($blacklist){ + $blacklist_search = true; + return view('customers.index',compact('blacklist_search','customer_info','search','noic','cawangan_info','bank','api_url','idtype')); + }else{ + Session::put('customer_info',$customer_info); + return redirect()->route('customer_info')->with( ['customer_info' => $customer_info,'cawangan_info'=>$cawangan_info,'api_url'=>$api_url]); + } }else{ - return view('customers.index',compact('customer_info','search','noic','cawangan_info','bank','api_url','idtype')); + if($blacklist){ + $blacklist_search = true; + return view('customers.index',compact('blacklist_search','customer_info','search','noic','cawangan_info','bank','api_url','idtype')); + }else{ + return view('customers.index',compact('blacklist_search','customer_info','search','noic','cawangan_info','bank','api_url','idtype')); + } } } diff --git a/app/Http/Controllers/GadaianController.php b/app/Http/Controllers/GadaianController.php index beb0518..4365020 100644 --- a/app/Http/Controllers/GadaianController.php +++ b/app/Http/Controllers/GadaianController.php @@ -334,7 +334,7 @@ class GadaianController extends Controller public function resitansurans($id) { - + $auth_user = Auth::user(); $totaltransaction = 0; $transaction = Http::get(config('api.url') . '/api/transaction/one/'. $id)->json(); @@ -349,8 +349,14 @@ class GadaianController extends Controller // if(sizeof($customers_info) != 0) // $customers_info = $customers_info[0]; - - return view('print.resitansuran',compact('transaction','gadai','customers_info')); + if($penebusan['nowakil']) + { + $wakil = Http::get(config('api.url') . '/api/getwakil/' . $auth_user['cawangan'] . '/code/' . $penebusan['nowakil'])->json(); + if(sizeof($wakil) != 0) + $wakil = $wakil[0]; + } + + return view('print.resitansuran',compact('transaction','gadai','customers_info','wakil')); } public function resitbelumansurans($id) diff --git a/app/Http/Controllers/KakitanganController.php b/app/Http/Controllers/KakitanganController.php index 94eacc1..fb4903c 100644 --- a/app/Http/Controllers/KakitanganController.php +++ b/app/Http/Controllers/KakitanganController.php @@ -98,27 +98,55 @@ class KakitanganController extends Controller $tunaisemalam = Http::get(config('api.url') . '/api/GetTunaiSemalam/'. $auth_user['cawangan'])->json(); - if (sizeof($tunaisemalam) > 0) + if(is_array($tunaisemalam)) { - foreach($tunaisemalam as $index=>$tunsem){ + if (sizeof($tunaisemalam) > 0) + { + foreach($tunaisemalam as $index=>$tunsem){ - $latesttunai = Http::get(config('api.url') . '/api/GetCurrentTunai/'. $auth_user['cawangan'], ['kodlaluan' => $tunsem['kodlaluan']])->json(); + $latesttunai = Http::get(config('api.url') . '/api/GetCurrentTunai/'. $auth_user['cawangan'], ['kodlaluan' => $tunsem['kodlaluan']])->json(); - if(sizeof($latesttunai) == 0) - { - $alirantunai = Http::post(config('api.url') . '/api/tunai/daftarTunai/' . $auth_user['cawangan'], [ - 'kodcaw' => $tunsem['kodcaw'], - 'teller' => $tunsem['kodlaluan'], - 'bakiawal' => $tunsem['baki'], - 'masuk' => 0.00, - 'yuran' => 0.00, - 'keluar' => 0.00, - 'baki' => $tunsem['baki'], - 'tambah' => 0.00, - 'kurang' => 0.00 - ])->json(); + if(sizeof($latesttunai) == 0) + { + $alirantunai = Http::post(config('api.url') . '/api/tunai/daftarTunai/' . $auth_user['cawangan'], [ + 'kodcaw' => $tunsem['kodcaw'], + 'teller' => $tunsem['kodlaluan'], + 'bakiawal' => $tunsem['baki'], + 'masuk' => 0.00, + 'yuran' => 0.00, + 'keluar' => 0.00, + 'baki' => $tunsem['baki'], + 'tambah' => 0.00, + 'kurang' => 0.00 + ])->json(); + } } } + + //Denominasi + $denominasi=Http::get(config('api.url').'/api/DenominasiController/'.$auth_user['cawangan'])->json(); + + if(sizeof($denominasi) == 0) + { + $denominasi=Http::post(config('api.url').'/api/DenominasiCreate/'.$auth_user['cawangan'])->json(); + } + else + { + $denominasi=$denominasi[0]; + } + + //Peti Besi Cawangan + $getVault=Http::get( config('api.url').'/api/VaultController/'.$auth_user['cawangan'])->json(); + + if(sizeof($getVault) == 0) + { + $peti_besi_terkini=Http::post(config('api.url').'/api/daftarVault/'.$auth_user['cawangan'])->json(); + $getVault = $peti_besi_terkini['bakiakhir']; + + }else{ + $getVault = $getVault[0]['bakiakhir']; + } + } return redirect()->route('home'); diff --git a/app/Http/Controllers/KhazanahController.php b/app/Http/Controllers/KhazanahController.php index c7e2df5..d5d32bf 100644 --- a/app/Http/Controllers/KhazanahController.php +++ b/app/Http/Controllers/KhazanahController.php @@ -84,6 +84,52 @@ class KhazanahController extends Controller } } + public function searchAdmin(Request $request){ + $noic = $request->noic; + $idtype = $request->customerIDType; + Session::put('noic', $noic); + $api_url = config('api.url'); + $auth_user = Auth::user(); + $cawangan_info = Http::get(config('api.url') . '/api/cawangan/'. $auth_user['cawangan'])->json(); + $bank = Http::get(config('api.url') . '/api/bank')->json(); + $customer_info = Http::get(config('api.url') . '/api/admin/customers/nokp/search',[ + 'ic' => $noic + ])->json(); + + $request->session()->forget('page_reload'); + $request->session()->forget('norujukan'); + + $search = true; + + if($customer_info){ + Session::put('customer_info_khazanah',$customer_info); + return redirect()->route('admin.customer_info')->with( ['customer_info' => $customer_info,'cawangan_info'=>$cawangan_info,'api_url'=>$api_url]); + }else{ + return view('admin.customer_index',compact('search','noic','cawangan_info','bank','api_url','idtype')); + } + } + + public function infoAdmin(Request $request){ + $auth_user = Auth::user(); + $api_url = config('api.url'); + $cawangan_info = Http::get(config('api.url') . '/api/cawangan/'. $auth_user['cawangan'])->json(); + $customer_info = Http::get(config('api.url') . '/api/admin/customers/nokp/search',[ + 'ic' => Session::get('noic') + ])->json(); + + $bakilelong = Http::get(config('api.url') . '/api/bakilelong/cawangan/' . $auth_user['cawangan'] . '/' . Session::get('noic') . '/baki')->json(); + $rugilelong = Http::get(config('api.url') . '/api/bakilelong/cawangan/' . $auth_user['cawangan'] . '/' . Session::get('noic') . '/rugi')->json(); + + $negeri = Http::get(config('api.url') . '/api/negeri/')->json(); + + + + $request->session()->forget('page_reload'); + $request->session()->forget('norujukan'); + + return view('admin.customer_info',compact('cawangan_info','api_url','customer_info','bakilelong','rugilelong','negeri')); + } + public function info(Request $request){ $auth_user = Auth::user(); $api_url = config('api.url'); @@ -271,16 +317,17 @@ class KhazanahController extends Controller $arraytuntutbaki = []; $arrayaddtunai = []; - $listUser = User::where([['cawangan', '=', $auth_user['cawangan']],['role_harian','=','teller']])->get(); - foreach($listUser as $index1 => $ls) + $teller = Http::get( config('api.url') .'/api/get/tellerwork/'. $auth_user['cawangan'])->json(); + + foreach($teller as $index1 => $ls) { - $tunai = Http::get( config('api.url') .'/api/GetCurrentTunai/'. $auth_user['cawangan'],['kodlaluan' => $ls->name])->json(); - $tunaipast = Http::get( config('api.url') .'/api/getPastTunai/'. $auth_user['cawangan'],['kodlaluan' => $ls->name])->json(); + $tunai = Http::get( config('api.url') .'/api/GetCurrentTunai/'. $auth_user['cawangan'],['kodlaluan' => $ls['kodlaluan']])->json(); + $tunaipast = Http::get( config('api.url') .'/api/getPastTunai/'. $auth_user['cawangan'],['kodlaluan' => $ls['kodlaluan']])->json(); - $gadai_tebus = Http::get(config('api.url').'/api/gadaitebus/listharini/'.$auth_user['cawangan'].'/teller/',['tarikh' => $harini->toDateString(),'teller' => $ls->name])->json(); - $tuntutbaki = Http::get(config('api.url').'/api/TuntutBaki/'.$auth_user['cawangan'].'/teller/',['teller' => $ls->name])->json(); - $addtunai = Http::get(config('api.url').'/api/getAddTunai/'.$auth_user['cawangan'].'/kodlaluan/',['kodlaluan' => $ls->name])->json(); + $gadai_tebus = Http::get(config('api.url').'/api/gadaitebus/listharini/'.$auth_user['cawangan'].'/teller/',['tarikh' => $harini->toDateString(),'teller' => $ls['kodlaluan']])->json(); + $tuntutbaki = Http::get(config('api.url').'/api/TuntutBaki/'.$auth_user['cawangan'].'/teller/',['teller' => $ls['kodlaluan']])->json(); + $addtunai = Http::get(config('api.url').'/api/getAddTunai/'.$auth_user['cawangan'].'/kodlaluan/',['kodlaluan' => $ls['kodlaluan']])->json(); array_push($arraygadaitebus,$gadai_tebus); array_push($arraytuntutbaki,$tuntutbaki); @@ -294,7 +341,7 @@ class KhazanahController extends Controller $petibesi = Http::get(config('api.url') . '/api/VaultController/all/'. $auth_user['cawangan'])->json(); - return view('khazanah.alirantunai',compact('cawangan_info','api_url','arraytunaiharini','arraytunai','listUser','petibesi','arraygadaitebus','arraytuntutbaki','arrayaddtunai')); + return view('khazanah.alirantunai',compact('cawangan_info','api_url','arraytunaiharini','arraytunai','teller','petibesi','arraygadaitebus','arraytuntutbaki','arrayaddtunai')); } @@ -329,91 +376,9 @@ class KhazanahController extends Controller public function barcodescannedtebus(Request $request) { - - $auth_user = Auth::user(); - - - $gadai = Http::get(config('api.url') . '/api/gadai/norujukan/'. $auth_user['cawangan'] .'/' .$request->norujukan_barcode)->json(); - $gadai_detail = $gadai[0]; - $hargajual=$gadai[0]['hargajualan']; - $upah12=$gadai[0]['upah12']; - $tarikh_gadai=$gadai[0]['t_gadai']; - $tebus = Http::get(config('api.url') . '/api/listpenebusanhistory/'. $auth_user['cawangan'],['norujukan' => $request->norujukan_barcode])->json(); - //dd($tebus); - $tebus_detail = $tebus[0]; - $pinjaman=$tebus[0]['pinjaman']; - $jenis_tebus=$tebus[0]['jenistebus']; - $bakipjm=$tebus[0]['bakipjm']; - $bakiupah=$tebus[0]['bakiupah']; - $rebet=$tebus[0]['rebate']; - - - - $getTunai2=Http::get(config('api.url').'/api/GetCurrentTunai/'.$auth_user['cawangan'],['kodlaluan' => $tebus_detail['teller']])->json(); - - $keluar=$getTunai2['keluar']; - $baki=$getTunai2['baki']; - $masuk=$getTunai2['masuk']; - $bakiawal=$getTunai2['bakiawal']; - $pendahuluan=$getTunai2['tambah']; - $serahan=$getTunai2['kurang']; - $totalmasuk = 0; - $bakiakhir = $getTunai2['baki']; - $totalkeluar = 0; - - $jum_bayaran=Http::get(config('api.url').'/api/transaction/one/'.$request->norujukan_barcode)->json(); - $jumlah_bayaran=$jum_bayaran['duit_masuk']; $update=Http::put(config('api.url').'/api/updatetagterima/'.$auth_user['cawangan'].'/'.$request->norujukan_barcode)->json(); - - if($update == 'success'){ - if($tebus_detail['jenistebus'] == 'P') - { - $totalmasuk = $tebus_detail['pinjaman'] + $tebus_detail['bakiupah'] + $masuk; - - $updateTunai=Http::put( config('api.url').'/api/updateTunaiGT/'.$auth_user['cawangan'], [ - 'kodlaluan' => $tebus_detail['teller'], - 'keluar'=>$keluar, - 'masuk'=>$totalmasuk, - 'bakiakhir'=>$bakiakhir - ]); - - if(empty($updateTunai)){ - dd('x masuk aliran tunai'); - } - - }else{ - - if($tebus_detail['jenistebus'] == 'S') - { - $totalmasuk = $tebus_detail['pinjaman'] + $tebus_detail['bakiupah'] + $masuk; - - $updateTunai=Http::put( config('api.url').'/api/updateTunaiGT/'.$auth_user['cawangan'], [ - 'kodlaluan' => $tebus_detail['teller'], - 'keluar'=>$keluar, - 'masuk'=>$totalmasuk, - 'bakiakhir'=>$bakiakhir - ]); - if(empty($updateTunai)){ - dd('x masuk aliran tunai'); - } - }else{ - $totalmasuk = $tebus_detail['bakipjm'] + $masuk; - - $updateTunai=Http::put( config('api.url').'/api/updateTunaiGT/'.$auth_user['cawangan'], [ - 'kodlaluan' => $tebus_detail['teller'], - 'keluar'=>$keluar, - 'masuk'=>$totalmasuk, - 'bakiakhir'=>$bakiakhir - ]); - - if(empty($updateTunai)){ - dd('x masuk aliran tunai'); - } - } - } - } return redirect()->route('khazanah.tebus'); } @@ -687,7 +652,7 @@ class KhazanahController extends Controller $updatelulus = Http::put(config('api.url') . '/api/UpdateKelulusan/' . $auth_user['cawangan'] . '/' . $norujukan,[ "pengesahan" => "operasi", 'siri' => $request->siri, - 'namaoperasi' => $request->namaoperasi + "namakhazanah" => $request->namakhazanah ])->json(); }else{ @@ -696,7 +661,7 @@ class KhazanahController extends Controller "pengesahan" => "operasi", 'siri' => $request->siri, "pembatalan" => "batal", - 'namaoperasi' => $request->namaoperasi + "namakhazanah" => $request->namakhazanah ])->json(); event(new NotifikasiKelulusan($norujukan,"batal",$request->siri,$request->komenkelulusan,$request->teller)); @@ -1060,31 +1025,6 @@ class KhazanahController extends Controller $auth_user = Auth::user(); $scan_barcode = Http::put(config('api.url').'/api/gadai/serah_marhun/khazanah/'. $auth_user['cawangan'] .'/' . $request->norujukan_barcode)->json(); - - $gadai = Http::get(config('api.url') . '/api/gadai/norujukan/'. $auth_user['cawangan'] .'/' .$request->norujukan_barcode)->json(); - $gadai_detail = $gadai[0]; - - $getTunai2=Http::get(config('api.url').'/api/GetCurrentTunai/'.$auth_user['cawangan'],['kodlaluan' => $gadai_detail['teller']])->json(); - - $keluar=$getTunai2['keluar']; - $baki=$getTunai2['baki']; - $masuk=$getTunai2['masuk']; - $bakiawal = $getTunai2['bakiawal']; - $pendahuluan=$getTunai2['tambah']; - $serahan=$getTunai2['kurang']; - $totalmasuk = 0; - $bakiakhir = $getTunai2['baki']; - $totalkeluar = 0; - $upah12=$gadai[0]['upah12']; - $totalkeluar = $gadai_detail['pinjaman'] + $keluar; - - //masuk dalam tunai aliran - $updateTunai=Http::put( config('api.url').'/api/updateTunaiGT/'.$auth_user['cawangan'], [ - 'kodlaluan' => $gadai_detail['teller'], - 'keluar' => $totalkeluar, - 'masuk' => $masuk, - 'bakiakhir' => $bakiakhir - ]); event(new NotifikasiPembayaran('TellerkepadaKhazanah')); @@ -1285,7 +1225,6 @@ class KhazanahController extends Controller ]); return redirect()->route('khazanah.serahan'); - } public function kemaskiniPendahuluan(Request $request) //Daftar Pendahuluan kepada Kaunter @@ -1447,9 +1386,6 @@ class KhazanahController extends Controller $amount = $request->amt; -// if($amount>$baki_awal){ -// return redirect()->route('khazanah.serahan')->with('message', 'Jumlah yang dipinta melebihi baki dalam peti besi!.'); -// }else{ $tarikh=$request->tarikh; $kodlaluan=$request->teller; @@ -1561,8 +1497,6 @@ class KhazanahController extends Controller } - // } - $GetLatestBakiTunai=Http::get( config('api.url').'/api/getLatestBaki/'.$auth_user['cawangan'])->json(); $sumBaki=$GetLatestBakiTunai; @@ -2333,6 +2267,7 @@ class KhazanahController extends Controller public function pendahuluanserahanHQ(Request $request) { + $auth_user = Auth::user(); $gldetail = Http::post(config('api.url').'/api/gldetailkaunter/'. $auth_user['cawangan'],[ @@ -3063,4 +2998,27 @@ class KhazanahController extends Controller return view('print.laporan_upah', compact('advansur','cawangan_detail','tarikh_cetak','mula_date','hingga_date','api_url')); } + public function lelongan($norujukan) + { + $auth_user = Auth::user(); + $api_url = config('api.url'); + $cawangan_info = Http::get(config('api.url') . '/api/cawangan/'. $auth_user['cawangan'])->json(); + + $gadaidetail = Http::get(config('api.url') . '/api/gadai/norujukan/'. $norujukan)->json(); + $noic = $gadaidetail[0][0]['nokp']; + $customerdetail = Http::get(config('api.url') . '/api/customers/'. $noic)->json(); + $nama = $customerdetail['nama']; + + $lelong = Http::get(config('api.url') . '/api/lelong/cawangan/'. $auth_user['cawangan'] . '/' . $norujukan)->json(); + + if(sizeof($lelong) > 0) + { + $lelong = $lelong[0]; + } + + $gadai = $gadaidetail[0][0]; + + return view('lelongan.index-khazanah',compact('cawangan_info','api_url','gadai','nama','lelong')); + } + } diff --git a/app/Http/Controllers/LelongController.php b/app/Http/Controllers/LelongController.php index 47f0aa5..b785ae0 100644 --- a/app/Http/Controllers/LelongController.php +++ b/app/Http/Controllers/LelongController.php @@ -56,7 +56,13 @@ class LelongController extends Controller $lelong=Http::get(config('api.url').'/api/TuntutBaki/resit/' . $auth_user['cawangan'] . '/' . $norujukan)->json(); - return view('print.resit_tuntutbaki', compact('cawangan_detail','api_url','lelong')); + $wakil = Http::get(config('api.url') . '/api/getwakil/' . $auth_user['cawangan'] . '/code/' . $lelong['nowakil'])->json(); + + // dd($wakil); + if(sizeof($wakil) != 0) + $wakil = $wakil[0]; + + return view('print.resit_tuntutbaki', compact('cawangan_detail','api_url','lelong','wakil')); } @@ -145,279 +151,14 @@ class LelongController extends Controller $serahan = $getTunai2['kurang']; $bakiakhir = $baki; - $jumlah_byr=$request->jumlah; if($request->jenis == 'T') { $bakiakhir -= $request->jumlah; - - - - $KOD_TUNAI='1000/010'; - $BAKI_LELONG='7000/090'; - - $get_lejerTunai=Http::get(config('api.url').'/api/getGlejer/'.$auth_user['cawangan'],['glcode'=>$KOD_TUNAI])->json(); - $hariIni_Tunai=$get_lejerTunai[0]['hariini']; - $kelmarin_Tunai=$get_lejerTunai[0]['kelmarin']; - $jumlah_Tunai=$get_lejerTunai[0]['jumlah']; - $kredit_Tunai=$get_lejerTunai[0]['kredit']; - $debit_Tunai=$get_lejerTunai[0]['debit']; - $recno_Tunai=$get_lejerTunai[0]['recno']; - - - $kredit_Tunai=$kredit_Tunai+$jumlah_byr; - $hariIni_Tunai=$debit_Tunai-$kredit_Tunai; - $kelmarin_Tunai=$jumlah_Tunai-$hariIni_Tunai; - $updateGlejer_Tunai=Http::put(config('api.url').'/api/kemasKiniGlejer/'.$auth_user['cawangan'],[ - 'recno'=>$recno_Tunai, - 'debit'=>$debit_Tunai, - 'kredit'=>$kredit_Tunai, - 'hariini'=>$hariIni_Tunai, - 'kelmarin' =>$kelmarin_Tunai, - - ]); - - - $get_KOD_BL=Http::get(config('api.url').'/api/getGlCode/'. $auth_user['cawangan'],['glcode'=>$BAKI_LELONG])->json(); - - $gl_cdetails_bl= $get_KOD_BL[0]; - $keterangan_bl= $get_KOD_BL[0]['descpt']; //keterangan glcode - $actype_bl= $get_KOD_BL[0]['acttype']; - - - $get_current_GLejer_Baki_Lelong=Http::get(config('api.url').'/api/getGlejer/'. $auth_user['cawangan'],['glcode'=>$BAKI_LELONG])->json(); - - if(sizeof($get_current_GLejer_Baki_Lelong)==0) - { - $jumlah_bl=0.0; - - $getGLedjer_bl_Semalam=Http::get(config('api.url').'/api/getSemalam_Glejer/'.$auth_user['cawangan'],['glcode'=>$BAKI_LELONG])->json(); - if(sizeof($getGLedjer_bl_Semalam)==0) - { - $jumlah_bl=0.0; - } - else - { - - $jumlahSemalam_bl=$getGLedjer_bl_Semalam[0]['jumlah']; - - $hariIniSemalam_bl=$getGLedjer_bl_Semalam[0]['hariini']; - $jumlah_bl=$jumlahSemalam_bl+$hariIniSemalam_bl; - - } - $jumlahBulan_ini_bl=0.0; - $get_GlejerBulan_Tahun_bl=Http::get(config('api.url').'/api/getLejerMonthYear/'.$auth_user['cawangan'],['glcode'=>$BAKI_LELONG])->json(); - if( sizeof($get_GlejerBulan_Tahun_bl)==0) - { - $jumlahBulan_ini_bl=0.0; - } - else - { - - $jumlahBulan_ini_bl=$get_GlejerBulan_Tahun_bl[0]['jumlah']; - $jumlahBulan_ini_bl=$jumlah_bl-$jumlahBulan_ini_bl; - - } - - - $Jumlah_TahunIni_bl=0.0; - $get_Glejer_Tahun_bl=Http::get(config('api.url').'/api/getLejerYear/'.$auth_user['cawangan'],['glcode'=>$BAKI_LELONG])->json(); - - if(sizeof($get_Glejer_Tahun_bl)==0) - { - $Jumlah_TahunIni_bl=0.0; - } - else - { - $JumTahunIni_bl=$get_Glejer_Tahun_bl[0]['jumlah']; - $Jumlah_TahunIni_bl=$jumlah_bl-$JumTahunIni_bl; - - } - - - $HariIni_bl=0.0; - $kelmarin_bl=$jumlah_bl-$HariIni_bl; - $daftarGlejer_bl=Http::post(config('api.url').'/api/daftarGlejer/'.$auth_user['cawangan'],[ - - 'kodcaw'=>$auth_user['cawangan'], - 'glcode'=>$BAKI_LELONG, - 'descpt'=>$keterangan_bl, - 'debit'=>$jumlah_byr, - 'kredit'=>0.0, - 'hariini'=>$HariIni_bl, - 'kelmarin'=>$kelmarin_bl, - 'jumlah'=>$jumlah_bl, - 'bulanini'=>$jumlahBulan_ini_bl, - 'tahunini'=>$Jumlah_TahunIni_bl, - 'acttype'=> $actype_bl - - ]); - - - } - else - { - - $hariIni_BL=$get_current_GLejer_Baki_Lelong[0]['hariini']; - $kelmarin_BL=$get_current_GLejer_Baki_Lelong[0]['kelmarin']; - $jumlah_BL= $get_current_GLejer_Baki_Lelong[0]['jumlah']; - $kredit_BL=$get_current_GLejer_Baki_Lelong[0]['kredit']; - $debit_BL= $get_current_GLejer_Baki_Lelong[0]['debit']; - $recno_BL=$get_current_GLejer_Baki_Lelong[0]['recno']; - - $debit_BL=$debit_BL+$jumlah_byr; - $hariIni_Tunai=$debit_BL-$kredit_BL; - $kelmarin_BL=$jumlah_BL-$hariIni_BL; - - $updateGlejer_BL=Http::put(config('api.url').'/api/kemasKiniGlejer/'.$auth_user['cawangan'],[ - 'recno'=>$recno_BL, - 'debit'=>$debit_BL, - 'kredit'=>$kredit_BL, - 'hariini'=>$hariIni_BL, - 'kelmarin' =>$kelmarin_BL, - - ]); - - } - - - } else { $bakiakhir += -($request->jumlah); - - - $KOD_TUNAI='1000/010'; - $get_lejerTunai=Http::get(config('api.url').'/api/getGlejer/'.$auth_user['cawangan'],['glcode'=>$KOD_TUNAI])->json(); - $hariIni_Tunai=$get_lejerTunai[0]['hariini']; - $kelmarin_Tunai=$get_lejerTunai[0]['kelmarin']; - $jumlah_Tunai=$get_lejerTunai[0]['jumlah']; - $kredit_Tunai=$get_lejerTunai[0]['kredit']; - $debit_Tunai=$get_lejerTunai[0]['debit']; - $recno_Tunai=$get_lejerTunai[0]['recno']; - - - $debit_Tunai=$debit_Tunai+$jumlah_byr; - $hariIni_Tunai=$debit_Tunai-$kredit_Tunai; - $kelmarin_Tunai=$jumlah_Tunai-$hariIni_Tunai; - $updateGlejer_Tunai=Http::put(config('api.url').'/api/kemasKiniGlejer/'.$auth_user['cawangan'],[ - 'recno'=>$recno_Tunai, - 'debit'=>$debit_Tunai, - 'kredit'=>$kredit_Tunai, - 'hariini'=>$hariIni_Tunai, - 'kelmarin' =>$kelmarin_Tunai, - - ]); - - - - $RUGI_LELONG='3000/020'; - - $get_KOD_RL=Http::get(config('api.url').'/api/getGlCode/'. $auth_user['cawangan'],['glcode'=>$RUGI_LELONG])->json(); - - $gl_cdetails_rl= $get_KOD_RL[0]; - $keterangan_rl= $get_KOD_RL[0]['descpt']; //keterangan glcode - $actype_rl= $get_KOD_RL[0]['acttype']; - - - $get_current_GLejer_Rugi_Lelong=Http::get(config('api.url').'/api/getGlejer/'. $auth_user['cawangan'],['glcode'=>$RUGI_LELONG])->json(); - - if(sizeof($get_current_GLejer_Rugi_Lelong)==0) - { - $jumlah_rl=0.0; - - $getGLedjer_rl_Semalam=Http::get(config('api.url').'/api/getSemalam_Glejer/'.$auth_user['cawangan'],['glcode'=>$RUGI_LELONG])->json(); - if(sizeof($getGLedjer_rl_Semalam)==0) - { - $jumlah_rl=0.0; - } - else - { - - $jumlahSemalam_rl=$getGLedjer_rl_Semalam[0]['jumlah']; - - $hariIniSemalam_rl=$getGLedjer_rl_Semalam[0]['hariini']; - $jumlah_rl=$jumlahSemalam_rl+$hariIniSemalam_rl; - - } - $jumlahBulan_ini_rl=0.0; - $get_GlejerBulan_Tahun_rl=Http::get(config('api.url').'/api/getLejerMonthYear/'.$auth_user['cawangan'],['glcode'=>$RUGI_LELONG])->json(); - if( sizeof($get_GlejerBulan_Tahun_rl)==0) - { - $jumlahBulan_ini_rl=0.0; - } - else - { - - $jumlahBulan_ini_rl=$get_GlejerBulan_Tahun_rl[0]['jumlah']; - $jumlahBulan_ini_rl=$jumlah_rl-$jumlahBulan_ini_rl; - - } - - - $Jumlah_TahunIni_rl=0.0; - $get_Glejer_Tahun_rl=Http::get(config('api.url').'/api/getLejerYear/'.$auth_user['cawangan'],['glcode'=>$RUGI_LELONG])->json(); - - if(sizeof($get_Glejer_Tahun_rl)==0) - { - $Jumlah_TahunIni_rl=0.0; - } - else - { - $JumTahunIni_rl=$get_Glejer_Tahun_rl[0]['jumlah']; - $Jumlah_TahunIni_rl=$jumlah_rl-$JumTahunIni_rl; - - } - - - $HariIni_rl=0.0; - $kelmarin_rl=$jumlah_rl-$HariIni_rl; - $daftarGlejer_bl=Http::post(config('api.url').'/api/daftarGlejer/'.$auth_user['cawangan'],[ - - 'kodcaw'=>$auth_user['cawangan'], - 'glcode'=>$RUGI_LELONG, - 'descpt'=>$keterangan_rl, - 'debit'=>0.0, - 'kredit'=>$jumlah_byr, - 'hariini'=>$HariIni_rl, - 'kelmarin'=>$kelmarin_rl, - 'jumlah'=>$jumlah_rl, - 'bulanini'=>$jumlahBulan_ini_rl, - 'tahunini'=>$Jumlah_TahunIni_rl, - 'acttype'=> $actype_rl - - ]); - - - } - else - { - - $hariIni_RL=$get_current_GLejer_Rugi_Lelong[0]['hariini']; - $kelmarin_RL=$get_current_GLejer_Rugi_Lelong[0]['kelmarin']; - $jumlah_RL= $get_current_GLejer_Rugi_Lelong[0]['jumlah']; - $kredit_RL=$get_current_GLejer_Rugi_Lelong[0]['kredit']; - $debit_RL= $get_current_GLejer_Rugi_Lelong[0]['debit']; - $recno_RL=$get_current_GLejer_Rugi_Lelong[0]['recno']; - - $kredit_RL=$kredit_RL+$jumlah_byr; - $hariIni_Tunai=$debit_RL-$kredit_RL; - $kelmarin_BL=$jumlah_RL-$hariIni_RL; - - $updateGlejer_RL=Http::put(config('api.url').'/api/kemasKiniGlejer/'.$auth_user['cawangan'],[ - 'recno'=>$recno_RL, - 'debit'=>$debit_RL, - 'kredit'=>$kredit_RL, - 'hariini'=>$hariIni_RL, - 'kelmarin' =>$kelmarin_RL, - - ]); - - } - - - } //masuk dalam tunai aliran $updateTunai=Http::put( config('api.url').'/api/updateTunaiGT/'.$auth_user['cawangan'], [ diff --git a/public/.DS_Store b/public/.DS_Store index 1b9b696..58e9ba1 100644 Binary files a/public/.DS_Store and b/public/.DS_Store differ diff --git a/public/img/loader.gif b/public/img/loader.gif new file mode 100644 index 0000000..c73bac1 Binary files /dev/null and b/public/img/loader.gif differ diff --git a/public/js/main.js b/public/js/main.js index 8137f25..64d4313 100644 --- a/public/js/main.js +++ b/public/js/main.js @@ -165,6 +165,7 @@ function kiraan(datakeyin) var valkey = $(datakeyin).val(); var amount = 0; let amountkiraan = 0; + var id = $('#jenisjenis').val(); var validate = parseFloat($('#amaundiminta').val()); @@ -178,6 +179,23 @@ function kiraan(datakeyin) amount += arr[1]; }); + if(id === 'serahan') + { + var deno = $(datakeyin).data('deno'); + + if(valkey > deno) + { + Swal.fire({ + icon: 'error', + title: 'Amaran', + text: 'Peti Besi tidak mencukupi!' + }); + + return false; + } + + } + if(amount > validate) { Swal.fire({ diff --git a/resources/views/admin/customer_index.blade.php b/resources/views/admin/customer_index.blade.php index 8e3c1ca..f413087 100644 --- a/resources/views/admin/customer_index.blade.php +++ b/resources/views/admin/customer_index.blade.php @@ -827,33 +827,7 @@ return false; } }else if(id_type=='passport'){ - if(nokp.length < 5){ - Swal.fire({ - icon: 'error', - title: 'Amaran!', - text: 'Sila Periksa Passport Pelanggan' - }); - event.preventDefault(); - return false; - } - if(nokp.indexOf(' ') > 0){ - Swal.fire({ - icon: 'error', - title: 'Amaran!', - text: 'Sila Masukkan Passport Tanpa Ruang \'Kosong\' \n e.g(AP1111111)' - }); - event.preventDefault(); - return false; - } - if(regex.test(nokp) == false){ - Swal.fire({ - icon: 'error', - title: 'Amaran!', - text: 'Sila Periksa Passport Pelanggan' - }); - event.preventDefault(); - return false; - } + } } diff --git a/resources/views/aliran_tunai/index.blade.php b/resources/views/aliran_tunai/index.blade.php index b1eb289..d4b11be 100644 --- a/resources/views/aliran_tunai/index.blade.php +++ b/resources/views/aliran_tunai/index.blade.php @@ -115,7 +115,7 @@
- +
@@ -125,8 +125,10 @@ + - @if($search == true ) + @if($search == true && $blacklist_search == false)
- +
@@ -143,7 +143,7 @@ Ar-Rahn -
- +
@@ -454,6 +455,12 @@ }); }); + $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) { + // here is the new selected tab id + var selectedTabId = e.target.id; + + }); + var tablegadai = $('#myTable').DataTable({ "scrollX": true }); @@ -487,188 +494,209 @@ $.ajax({ method:'get', - url: api_url + '/api/polis/get/', + url: api_url + '/api/check/serah/lelong', datatype:'json', data:{ 'kodcaw': "{{ $cawangan_info['kodcaw'] }}", 'norujukan': norujukan }, success:function(data){ + if(data == 0){ + - var count = Object.keys(data).length; - - if(count > 0) - { - if(data[0].tebus === 0) - { - const swalWithBootstrapButtons = Swal.mixin({ - customClass: { - confirmButton: 'btn btn-success', - cancelButton: 'btn btn-danger mr-1' - }, - buttonsStyling: false - }); - - swalWithBootstrapButtons.fire({ - title: 'Dapatkan Pengesahan Khazanah', - text: "Surat Akuan Gadaian Hilang!", - icon: 'info', - showCancelButton: true, - confirmButtonText: 'Hantar', - cancelButtonText: 'Batal', - reverseButtons: true - }).then((result) => { - if (result.isConfirmed) { - - let komen = "Surat Akuan Gadaian Hilang|" + '-' + "|" + '-' + "|" + '-' + "| Tambah Pinjaman"; - let teller = "{{ Auth::user()->name }}"; - - Swal.fire({ - title: 'Tunggu Pengesahan Daripada Khazanah.', - icon: 'info', - width: 600, - padding: '3em', - background: '#fffff', - showCancelButton: false, - showConfirmButton: false, - allowOutsideClick: false, - allowEscapeKey: false, - allowEnterKey: false - }) - let siricreated = 0; - $.ajax({ - method:'post', - url: "{{ route('khazanah.createkelulusan') }}", - data: { - "_token": "{{ csrf_token() }}", - "norujukan" : norujukan, - "komen" : komen, - "jumpinjam" : '0.00', - "teller" : teller - }, - success:function(data){ - siricreated = data; - }, - error: function(xhr, status, error) { - var err = eval("(" + xhr.responseText + ")"); - alert(xhr.responseText); - } - }); - - var pusher = new Pusher("{{ env('PUSHER_APP_KEY') }}", { - cluster: 'ap1', - encrypted: true - }); - - var channel = pusher.subscribe('notice-kelulusan'); - channel.bind('my-kelulusan', function(data) { - - - if(data.norujukan == norujukan && data.siri == siricreated && data.teller == teller) - { - if(data.kelulusan == 'lulus') - { - Swal.fire({ - icon: 'success', - title: 'Telah Disahkan' - }).then(function(){ - $.ajax({ - method:'put', - url: api_url + '/api/polis/put/', - data: { - 'kodcaw': "{{ $cawangan_info['kodcaw'] }}", - 'norujukan': norujukan, - 'tebus' : 1 - }, - success:function(data){ - location.reload(); - - }, - error: function(xhr, status, error) { - var err = eval("(" + xhr.responseText + ")"); - alert(xhr.responseText); - } - }); - }); - - } - else if(data.kelulusan == 'batal') - { - Swal.fire({ - icon: 'warning', - title: 'Telah Dibatalkan', - text: `Komen : ${data.komen}` - }).then(function(){ - return false; - }); - } - } - - }); - - - } - else if (result.dismiss === Swal.DismissReason.cancel) { - swalWithBootstrapButtons.fire( - 'Gagal', - 'Gagal mendapatkan kelulusan khazanah', - 'error' - ) - } - }); - } - else - { - $.ajax({ - method:'get', - url: api_url + '/api/check/serah/gadai', - datatype:'json', - data:{ - 'kodcaw': "{{ $cawangan_info['kodcaw'] }}", - 'norujukan': norujukan - }, - success:function(data){ - if(data == 'true'){ - window.location = urlpenebusan; - }else if(data == 'false'){ - Swal.fire({ - icon: 'error', - title: 'Amaran', - text: 'Gadaian Belum Scan Barcode' - }); - } - } - }); - } - - - - }else{ $.ajax({ method:'get', - url: api_url + '/api/check/serah/gadai', + url: api_url + '/api/polis/get/', datatype:'json', data:{ 'kodcaw': "{{ $cawangan_info['kodcaw'] }}", 'norujukan': norujukan }, success:function(data){ - if(data == 'true'){ - window.location = urlpenebusan; - }else if(data == 'false'){ - Swal.fire({ - icon: 'error', - title: 'Amaran', - text: 'Gadaian Belum Scan Barcode' - }); + + var count = Object.keys(data).length; + + if(count > 0) + { + if(data[0].tebus === 0) + { + const swalWithBootstrapButtons = Swal.mixin({ + customClass: { + confirmButton: 'btn btn-success', + cancelButton: 'btn btn-danger mr-1' + }, + buttonsStyling: false + }); + + swalWithBootstrapButtons.fire({ + title: 'Dapatkan Pengesahan Khazanah', + text: "Surat Akuan Gadaian Hilang!", + icon: 'info', + showCancelButton: true, + confirmButtonText: 'Hantar', + cancelButtonText: 'Batal', + reverseButtons: true + }).then((result) => { + if (result.isConfirmed) { + + let komen = "Surat Akuan Gadaian Hilang|" + '-' + "|" + '-' + "|" + '-' + "| Tambah Pinjaman"; + let teller = "{{ Auth::user()->name }}"; + + Swal.fire({ + title: 'Tunggu Pengesahan Daripada Khazanah.', + icon: 'info', + width: 600, + padding: '3em', + background: '#fffff', + showCancelButton: false, + showConfirmButton: false, + allowOutsideClick: false, + allowEscapeKey: false, + allowEnterKey: false + }) + let siricreated = 0; + $.ajax({ + method:'post', + url: "{{ route('khazanah.createkelulusan') }}", + data: { + "_token": "{{ csrf_token() }}", + "norujukan" : norujukan, + "komen" : komen, + "jumpinjam" : '0.00', + "teller" : teller + }, + success:function(data){ + siricreated = data; + }, + error: function(xhr, status, error) { + var err = eval("(" + xhr.responseText + ")"); + alert(xhr.responseText); + } + }); + + var pusher = new Pusher("{{ env('PUSHER_APP_KEY') }}", { + cluster: 'ap1', + encrypted: true + }); + + var channel = pusher.subscribe('notice-kelulusan'); + channel.bind('my-kelulusan', function(data) { + + + if(data.norujukan == norujukan && data.siri == siricreated && data.teller == teller) + { + if(data.kelulusan == 'lulus') + { + Swal.fire({ + icon: 'success', + title: 'Telah Disahkan' + }).then(function(){ + $.ajax({ + method:'put', + url: api_url + '/api/polis/put/', + data: { + 'kodcaw': "{{ $cawangan_info['kodcaw'] }}", + 'norujukan': norujukan, + 'tebus' : 1 + }, + success:function(data){ + location.reload(); + + }, + error: function(xhr, status, error) { + var err = eval("(" + xhr.responseText + ")"); + alert(xhr.responseText); + } + }); + }); + + } + else if(data.kelulusan == 'batal') + { + Swal.fire({ + icon: 'warning', + title: 'Telah Dibatalkan', + text: `Komen : ${data.komen}` + }).then(function(){ + return false; + }); + } + } + + }); + + + } + else if (result.dismiss === Swal.DismissReason.cancel) { + swalWithBootstrapButtons.fire( + 'Gagal', + 'Gagal mendapatkan kelulusan khazanah', + 'error' + ) + } + }); + } + else + { + $.ajax({ + method:'get', + url: api_url + '/api/check/serah/gadai', + datatype:'json', + data:{ + 'kodcaw': "{{ $cawangan_info['kodcaw'] }}", + 'norujukan': norujukan + }, + success:function(data){ + if(data == 'true'){ + window.location = urlpenebusan; + }else if(data == 'false'){ + Swal.fire({ + icon: 'error', + title: 'Amaran', + text: 'Gadaian Belum Scan Barcode' + }); + } + } + }); + } + + + + }else{ + $.ajax({ + method:'get', + url: api_url + '/api/check/serah/gadai', + datatype:'json', + data:{ + 'kodcaw': "{{ $cawangan_info['kodcaw'] }}", + 'norujukan': norujukan + }, + success:function(data){ + if(data == 'true'){ + window.location = urlpenebusan; + }else if(data == 'false'){ + Swal.fire({ + icon: 'error', + title: 'Amaran', + text: 'Gadaian Belum Scan Barcode' + }); + } + } + }); } } - }); + }); + + + }else if(data == 1){ + Swal.fire({ + icon: 'error', + title: 'Amaran', + text: 'Gadaian Sedang Dilelong..' + }); } } - }); - - + }); } @@ -723,17 +751,34 @@ }else if(jenistebus == "lelong"){ var urlroute = '{{ route("lelongan", ":id") }}'; urlroute = urlroute.replace(':id', gadai_detail["norujukan"]); - tablelelong.row.add([ - counter, - '' + gadai_detail['norujukan'] + '', - gadai_detail['t_lelong'], - gadai_detail['trkhtuntut'], - 'RM '+ formatter.format(gadai_detail['pinjaman']), - 'RM '+formatter.format(gadai_detail['hargajual']), - 'RM '+formatter.format(gadai_detail['baki']), - 'RM '+formatter.format(gadai_detail['bakiupah']), - 'RM '+formatter.format(gadai_detail['cajlelong']) - ]).draw(); + + if(gadai_detail['trkhtuntut'] == null){ + tablelelong.row.add([ + counter, + '' + gadai_detail['norujukan'] + '', + gadai_detail['t_lelong'], + gadai_detail['trkhtuntut'], + 'RM '+ formatter.format(gadai_detail['pinjaman']), + 'RM '+formatter.format(gadai_detail['hargajual']), + 'RM '+formatter.format(gadai_detail['baki']), + 'RM '+formatter.format(gadai_detail['bakiupah']), + 'RM '+formatter.format(gadai_detail['cajlelong']), + '' + ]).draw(); + }else{ + tablelelong.row.add([ + counter, + '' + gadai_detail['norujukan'] + '', + gadai_detail['t_lelong'], + gadai_detail['trkhtuntut'], + 'RM '+ formatter.format(gadai_detail['pinjaman']), + 'RM '+formatter.format(gadai_detail['hargajual']), + 'RM '+formatter.format(gadai_detail['baki']), + 'RM '+formatter.format(gadai_detail['bakiupah']), + 'RM '+formatter.format(gadai_detail['cajlelong']), + '' + ]).draw(); + } } counter = counter + 1; } @@ -741,6 +786,19 @@ }); } + function cetaktuntutbaki(e) + { + let norujukan = $(e).data('norujukan'); + + console.log(norujukan); + let urlroute = '{{ route("resit.tuntutbaki", ":id") }}'; + urlroute = urlroute.replace(':id', norujukan); + + window.open(urlroute, '_blank'); + + return; + } + function checktuntutbaki(e) { let tarikhtuntut = $(e).data('tarikhtuntut'); @@ -801,40 +859,56 @@ text: 'Sila pilih salah satu SAG' }); }else{ + + Swal.fire({ + title: 'Memuatkan...', + allowEscapeKey : false, + allowOutsideClick: false, + didOpen: function () { + Swal.showLoading() + } + }); + $.ajax({ method:'get', url:'{{ route("gadai.history") }}', data:{ "norujukan" : histid}, success:function(data) { - $('#historytebusModal').modal(); + historytebustable(data); + $.ajax({ + method: 'get', + url: api_url + '/api/transaction/' + histid, + success: function(data){ + historybayarantable(data); + + $.ajax({ + method:'get', + url: api_url + '/api/gadai/norujukan/'+histid, + success:function(gadai){ + rekodasal(gadai); + + $.ajax({ + method:'get', + url: api_url + '/api/ansuran/' + "{{ $cawangan_info['kodcaw'] }}" + '/' + histid, + success:function(ansuran){ + rekodansuran(ansuran); + + Swal.close(); + $('#historytebusModal').modal(); + } + }); + } + }); + + } + }); },error: function(xhr, status, error) { var err = eval("(" + xhr.responseText + ")"); alert(xhr.responseText); } }); - $.ajax({ - method: 'get', - url: api_url + '/api/transaction/' + histid, - success: function(data){ - historybayarantable(data); - } - }); - $.ajax({ - method:'get', - url: api_url + '/api/gadai/norujukan/'+histid, - success:function(gadai){ - rekodasal(gadai); - } - }); - $.ajax({ - method:'get', - url: api_url + '/api/ansuran/' + "{{ $cawangan_info['kodcaw'] }}" + '/' + histid, - success:function(ansuran){ - rekodansuran(ansuran); - } - }); } }else if($("input[name='options']:checked").val() == 'sudah_tebus'){ let histid = $('input[name="sudahtebus"]:checked').val(); @@ -846,39 +920,53 @@ text: 'Sila pilih salah satu SAG' }); }else{ + + Swal.fire({ + title: 'Memuatkan...', + allowEscapeKey : false, + allowOutsideClick: false, + didOpen: function () { + Swal.showLoading() + } + }); + $.ajax({ method:'get', url:'{{ route("gadai.history") }}', data:{ "norujukan" : histid}, success:function(data){ - $('#historytebusModal').modal(); historytebustable(data); + + $.ajax({ + method: 'get', + url: api_url + '/api/transaction/' + histid, + success: function(data){ + historybayarantable(data); + } + }); + $.ajax({ + method:'get', + url:api_url + '/api/gadai/norujukan/'+histid, + success:function(gadai){ + rekodasal(gadai); + } + }); + $.ajax({ + method:'get', + url: api_url + '/api/ansuran/' + "{{ $cawangan_info['kodcaw'] }}" + '/' + histid, + success:function(ansuran){ + rekodansuran(ansuran); + } + }); + + $('#historytebusModal').modal(); + Swal.close(); + },error: function(xhr, status, error) { var err = eval("(" + xhr.responseText + ")"); alert(xhr.responseText); } }); - $.ajax({ - method: 'get', - url: api_url + '/api/transaction/' + histid, - success: function(data){ - historybayarantable(data); - } - }); - $.ajax({ - method:'get', - url:api_url + '/api/gadai/norujukan/'+histid, - success:function(gadai){ - rekodasal(gadai); - } - }); - $.ajax({ - method:'get', - url: api_url + '/api/ansuran/' + "{{ $cawangan_info['kodcaw'] }}" + '/' + histid, - success:function(ansuran){ - rekodansuran(ansuran); - } - }); } } } @@ -1237,10 +1325,10 @@ return 'Masukkan No Kad Pengenalan yang betul!'; } - if(isNaN(value)) - { - return 'Kad Pengenalan hendaklah dalam bentuk nombor!' - } + // if(isNaN(value)) + // { + // return 'Kad Pengenalan hendaklah dalam bentuk nombor!' + // } } }); @@ -1494,14 +1582,161 @@ if($("input[name='options']:checked").val() == 'belum_tebus'){ let test1 = $('input[name="belum"]:checked').closest('tr').children('td:eq(2)').text(); let tarikhgadai2 = new Date(test1);tarikhgadai2.setHours(0, 0, 0, 0); - if(+harini !== +tarikhgadai2){ - Swal.fire({ - icon: 'error', - title: 'Amaran', - text: 'Hapus Gadai Tidak Dibenarkan' + + // var id = $('.tab-content .active').attr('id'); + + var activeTab = $("#navtawarruqdannottawarruq.tab-content").find(".active"); + var id = activeTab.attr('id'); + + console.log(id); + if(id == "nav-tawarruq") { + if(+harini !== +tarikhgadai2){ + Swal.fire({ + icon: 'error', + title: 'Amaran', + text: 'Hapus Gadai Tidak Dibenarkan' + }); + return false; + } + } + else { + $.ajax({ + method:'get', + url: api_url + '/api/upahlamatoday/' + kodcaw + '/' + hapusid, + success:function(data){ + console.log(data); + if(data == 1){ + + const swalWithBootstrapButtons = Swal.mixin({ + customClass: { + confirmButton: 'btn btn-success', + cancelButton: 'btn btn-danger' + }, + buttonsStyling: false + }); + + swalWithBootstrapButtons.fire({ + title: 'Dapatkan Pengesahan Khazanah', + text: "Hapus Upah Lama!", + icon: 'info', + showCancelButton: true, + confirmButtonText: 'Hantar', + cancelButtonText: 'Batal', + reverseButtons: true + }).then((result) => { + if(result.isConfirmed) { + Swal.fire({ + title: 'Tunggu Pengesahan Daripada Khazanah.', + icon: 'info', + width: 600, + padding: '3em', + background: '#fffff', + showCancelButton: false, + showConfirmButton: false, + allowOutsideClick: false, + allowEscapeKey: false, + allowEnterKey: false + }) + + let mohon = "Hapus Upah Lama"; + let id = hapusid; + + $.ajax({ + method:'post', + url: '{{ route("teller.createkelulusan") }}', + data: { + "_token": "{{ csrf_token() }}", + "norujukan" : id, + "mohon" : mohon + }, + success:function(data){ + },error: function(xhr, status, error) { + var err = eval("(" + xhr.responseText + ")"); + alert(xhr.responseText); + } + }); + + let teller = "{{ Auth::user()->name }}"; + + var pusher = new Pusher("{{ env('PUSHER_APP_KEY') }}", { + cluster: 'ap1', + encrypted: true + }); + + var channel = pusher.subscribe('notice-ubahhapus'); + channel.bind('my-ubahhapus', function(data) { + + if(data.norujukan == id && data.teller == teller) + { + if(data.kelulusan == 'lulus') + { + + Swal.fire({ + icon: 'success', + title: 'Telah Disahkan' + }).then(function(){ + + $.ajax({ + method:'post', + url: api_url + '/api/removeupahlamatoday/' + kodcaw + '/' + id, + success:function(data){ + + if(data == 1) + { + swalWithBootstrapButtons.fire( + 'Hapus!', + 'Maklumat upah lama telah dihapuskan.', + 'success' + ).then(function(){ + location.reload(); + }); + }else{ + swalWithBootstrapButtons.fire( + 'Hapus!', + 'Maklumat Upah lama tidak berjaya untuk dihapuskan.', + 'error' + ).then(function(){ + location.reload(); + }); + } + + + },error: function(xhr, status, error) { + var err = eval("(" + xhr.responseText + ")"); + alert(xhr.responseText); + } + }); + return true; + }); + } + } + }); + } + }); + + + return false; + } + else{ + Swal.fire({ + icon: 'error', + title: 'Amaran', + text: 'Hapus Upah Tidak Dibenarkan' + }); + return false; + } + },error: function(xhr, status, error) { + var err = eval("(" + xhr.responseText + ")"); + alert(xhr.responseText); + } }); + return false; } + + + // return false; + }else if($("input[name='options']:checked").val() == 'sudah_tebus'){ let test = $('input[name="sudahtebus"]:checked').closest('tr').children('td:eq(2)').text(); let tarikhgadai1 = new Date(test);tarikhgadai1.setHours(0, 0, 0, 0); @@ -1729,6 +1964,36 @@ } } + + + $('#poskod').change(function(){ + var poskod = this.value; + console.log(poskod); + $.ajax({ + method:'GET', + url:api_url+'/api/poskod/'+poskod, + success:function(poskod_detail){ + var koddaerah = poskod_detail['koddaerah']; + var kodnegeri = poskod_detail['kodnegeri']; + $.ajax({ + url:api_url+'/api/negeri/'+kodnegeri, + method:'GET', + success:function(negeri){ + console.log(negeri); + $('#kodnegeri').val(negeri['negeri']); + } + }); + $.ajax({ + url:api_url+'/api/daerah/'+koddaerah, + method:'GET', + success:function(daerah){ + $('#koddaerah').val(daerah['namadaerah']); + } + }); + } + }); + }); + function kemaskinifunc() { $('#btnkemaskini').addClass('btn-danger'); @@ -1743,6 +2008,8 @@ $('#kodbank').attr('disabled', false); $('#noakaun').attr('readonly', false); $('#nota').attr('readonly', false); + $('#alamat').attr('readonly', false); + $('#poskod').attr('readonly', false); } @@ -1762,6 +2029,8 @@ $('#kodbank').attr('disabled', true); $('#noakaun').attr('readonly', true); $('#nota').attr('readonly', true); + $('#alamat').attr('readonly', true); + $('#poskod').attr('readonly', true); } $("#kemaskiniform").submit(function(event) { @@ -1773,6 +2042,8 @@ var kodbank = $('#kodbank').val(); var noakaun = $('#noakaun').val(); var nota = $('#nota').val(); + var alamat = $('#alamat').val(); + var poskod = $('#poskod').val(); $.ajax({ method:"put", @@ -1782,7 +2053,9 @@ "telefon2": telefon2, "kodbank":kodbank, "noakaun":noakaun, - 'nota':nota + 'nota':nota, + 'alamat':alamat, + 'poskod':poskod }, success: function(success){ $('#btnsave').css('display','none'); @@ -1847,6 +2120,8 @@ $('#noakaun').attr('readonly', true); $('#kodbank').attr('disabled', true); $('#nota').attr('readonly', true); + $('#alamat').attr('readonly', true); + $('#poskod').attr('readonly', true); $('#kemaskiniform').trigger('submit'); } diff --git a/resources/views/homepage/penilai/home.blade.php b/resources/views/homepage/penilai/home.blade.php index 0b39319..332fb00 100644 --- a/resources/views/homepage/penilai/home.blade.php +++ b/resources/views/homepage/penilai/home.blade.php @@ -265,6 +265,8 @@ } window.onload = timedRefresh(100000); + //Pusher + var table_gadaian_semasa = $('#table-gadaian-semasa').DataTable({ "ordering": true }); diff --git a/resources/views/khazanah/alirantunai.blade.php b/resources/views/khazanah/alirantunai.blade.php index 44da7f9..f70fc1e 100644 --- a/resources/views/khazanah/alirantunai.blade.php +++ b/resources/views/khazanah/alirantunai.blade.php @@ -64,6 +64,10 @@ + + {{-- {{ dd($tunai) }} --}} @@ -92,9 +96,6 @@ -
@@ -106,29 +107,30 @@ {{-- {{ dd($arraytunai) }} --}} - @endforeach -
- @foreach($listUser as $index1=>$ls) + @foreach($teller as $index1=>$ls) @if($index1 == 0) -
+
Hari Ini @@ -220,26 +222,26 @@
-