diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index 4bf15b1..5296414 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -52,4 +52,12 @@ class HomeController extends Controller return view('homepage.'.$auth_user['roles'].'.home',compact('cawangan_info','api_url')); } } + + public function poskod(){ + $api_url = config('api.url'); + $auth_user = Auth::user(); + $cawangan_info = Http::get(config('api.url') . '/api/cawangan/'. $auth_user['cawangan'])->json(); + + return view('admin.poskod',compact('cawangan_info','api_url','auth_user')); + } } diff --git a/app/Http/Controllers/KhazanahController.php b/app/Http/Controllers/KhazanahController.php index 3e51ed9..b1780d2 100644 --- a/app/Http/Controllers/KhazanahController.php +++ b/app/Http/Controllers/KhazanahController.php @@ -41,7 +41,11 @@ class KhazanahController 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('khazanah.index',compact('search','cawangan_info','bank','api_url','idtype')); + if($auth_user->roles == 'admin'){ + return view('admin.customer_index',compact('search','cawangan_info','bank','api_url','idtype','auth_user')); + }else{ + return view('khazanah.index',compact('search','cawangan_info','bank','api_url','idtype','auth_user')); + } } public function search(Request $request){ @@ -66,12 +70,66 @@ class KhazanahController extends Controller if($customer_info){ Session::put('customer_info_khazanah',$customer_info); - return redirect()->route('khazanah.customer_info')->with( ['customer_info' => $customer_info,'cawangan_info'=>$cawangan_info,'api_url'=>$api_url]); + if($auth_user->roles == 'admin'){ + return redirect()->route('admin.customer_info')->with( ['customer_info' => $customer_info,'cawangan_info'=>$cawangan_info,'api_url'=>$api_url]); + }else{ + return redirect()->route('khazanah.customer_info')->with( ['customer_info' => $customer_info,'cawangan_info'=>$cawangan_info,'api_url'=>$api_url]); + } }else{ - return view('khazanah.index',compact('search','noic','cawangan_info','bank','api_url','idtype')); + if($auth_user->roles == 'admin'){ + return view('admin.customer_index',compact('search','noic','cawangan_info','bank','api_url','idtype')); + }else{ + return view('khazanah.index',compact('search','noic','cawangan_info','bank','api_url','idtype')); + } } } + 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'); @@ -92,7 +150,12 @@ class KhazanahController extends Controller $request->session()->forget('page_reload'); $request->session()->forget('norujukan'); - return view('khazanah.info',compact('cawangan_info','api_url','customer_info','bakilelong','rugilelong','negeri')); + + if($auth_user->roles == 'admin'){ + return view('admin.customer_info',compact('cawangan_info','api_url','customer_info','bakilelong','rugilelong','negeri')); + }else{ + return view('khazanah.info',compact('cawangan_info','api_url','customer_info','bakilelong','rugilelong','negeri')); + } } public function menu() @@ -312,91 +375,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'); } @@ -1043,31 +1024,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')); diff --git a/app/Http/Controllers/PenebusanController.php b/app/Http/Controllers/PenebusanController.php index b505a4a..5e16f3c 100644 --- a/app/Http/Controllers/PenebusanController.php +++ b/app/Http/Controllers/PenebusanController.php @@ -544,12 +544,8 @@ class PenebusanController extends Controller 'marhun' => $request->marhun, 'jenisbayarantebus' => $request->jenisbayarantebus, 'teller' => $request->teller - ])->successful(); + ])->json(); - if(!$updatetebus) - { - return response('fail'); - } ////////////////////// /// MAKING NEW SAG//// @@ -570,12 +566,7 @@ class PenebusanController extends Controller 'nopelanggan' => $request->nopelanggan, 'nokp' => $request->noic, 'sirig' => $new_sirig - ])->successful(); - - if(!$gadai) - { - return response('fail'); - } + ])->json(); ////////////////////// @@ -605,7 +596,7 @@ class PenebusanController extends Controller 'upah12' => $keuntungan12bulan, 'hargajualan' => $hargajualan, 'kuantiti_marhun' => $request->kuantiti_marhun - ])->successful(); + ])->$request->acceptsJson()(); $komuditi = Http::put(config('api.url').'/api/komuditi/transaksi',[ 'unit_komuditi' => round($request->pinjaman, 2), @@ -620,7 +611,7 @@ class PenebusanController extends Controller $updatehistorygadaian = Http::put(config('api.url').'/api/gadai/updatehistory/'. $auth_user['cawangan'] .'/' . $norujukanbaru,[ 'historygadaian' => $request->norujukan - ])->successful(); + ])->json(); /////////////////////////// /// MARHUN UPDATE TABLE//// @@ -657,7 +648,7 @@ class PenebusanController extends Controller 'berat_emas' => $array1['berat'], 'harga' => $array1['harga'], 'nilai_marhun' => $array1['n_marhun'] - ])->successful(); + ])->json(); } diff --git a/config/database.php b/config/database.php index a159328..66d8670 100644 --- a/config/database.php +++ b/config/database.php @@ -61,7 +61,6 @@ return [ 'options' => extension_loaded('pdo_mysql') ? array_filter([ PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'), ]) : [], - 'unix_socket' => env('UNIX_SOCKET', '/Applications/MAMP/tmp/mysql/mysql.sock'), ], 'pgsql' => [ diff --git a/resources/views/admin/customer_index.blade.php b/resources/views/admin/customer_index.blade.php new file mode 100644 index 0000000..f413087 --- /dev/null +++ b/resources/views/admin/customer_index.blade.php @@ -0,0 +1,834 @@ +@extends('layouts.app_operasi') + +@section('content') + +
+
+
+ + + +
+
+
+
masukkan nombor kad pengenalan
+
+
+
+
+ +
+ +
+
+ +
+
+
+
+
+
+ @if($search == true ) +
+ +
+ @endif +
+
+ + + + +
+
+
+ +@endsection \ No newline at end of file diff --git a/resources/views/admin/customer_info.blade.php b/resources/views/admin/customer_info.blade.php new file mode 100644 index 0000000..067d5d2 --- /dev/null +++ b/resources/views/admin/customer_info.blade.php @@ -0,0 +1,363 @@ +@extends('layouts.app_operasi') + + +@section('content') +@include('modal.historytebus') +@include('modal.wakil') +@include('modal.agh') + + +
+
+
+ + +
+
+
+
+
+
+
+ Nama +
+
+ +
+
+
+
+ No KP +
+
+ +
+
+
+
+ No Pelanggan +
+
+ +
+
+
+
+ No Telefon 1 +
+
+ + +
+
+
+
+ No Telefon 2 +
+
+ + +
+
+
+
+ Bank +
+
+ @php + $bank = Http::get($api_url . '/api/bank')->json(); + @endphp + + +
+
+
+
+ No Akaun +
+
+ + +
+
+
+
+
+
+ Alamat +
+
+ +
+
+
+
+ Poskod +
+
+ +
+
+
+
+ Daerah +
+
+ @php + $poskod = Http::get($api_url . '/api/poskod/'. $customer_info['poskod'])->json(); + if(empty($poskod)){ + $poskod = array('koddaerah'=>'NIL','kodnegeri' => 'NIL'); + } + $daerah = Http::get($api_url . '/api/daerah/' . $poskod['koddaerah'])->json(); + @endphp + +
+
+
+
+ Negeri +
+
+ @php + $negeri = Http::get($api_url . '/api/negeri/' . $poskod['kodnegeri'])->json(); + @endphp + +
+
+
+
+ Nota +
+
+ +
+
+
+
+
+ + +
+
+
+
+
+
+
+ + +@endsection diff --git a/resources/views/admin/poskod.blade.php b/resources/views/admin/poskod.blade.php new file mode 100644 index 0000000..7b30aa2 --- /dev/null +++ b/resources/views/admin/poskod.blade.php @@ -0,0 +1,53 @@ +@extends('layouts.app_operasi') + +@section('content') + +
+
+
+ + + +
+
+
+
masukkan poskod
+
+
+
+
+ +
+ +
+
+
+
+
+
+ @if($search ?? '' == true ) +
+ +
+ @endif +
+
+
+
+
+ +@endsection \ No newline at end of file diff --git a/resources/views/homepage/admin/home.blade.php b/resources/views/homepage/admin/home.blade.php index 6c00060..26281b3 100644 --- a/resources/views/homepage/admin/home.blade.php +++ b/resources/views/homepage/admin/home.blade.php @@ -15,6 +15,8 @@
Kakitangan + Pelanggan +
diff --git a/resources/views/khazanah/info.blade.php b/resources/views/khazanah/info.blade.php index d452fab..d855799 100644 --- a/resources/views/khazanah/info.blade.php +++ b/resources/views/khazanah/info.blade.php @@ -511,7 +511,7 @@ gadai_detail['t_matang'], 'RM '+formatter.format(gadai_detail['pinjaman']), (((Number(gadai_detail['pinjaman'])/Number(gadai_detail['nilaimarhun']))*100).toFixed(2)).toLocaleString("en-GB") + '%', - gadai_detail['jbg'] + gadai_detail['tempoh'] ]).draw(); }else{ tablegadai.row.add([ @@ -534,7 +534,7 @@ gadai_detail['t_update'], 'RM '+formatter.format(gadai_detail['bakipjm']), (((Number(gadai_detail['pinjaman'])/Number(gadai_detail['nilaimarhun']))*100).toFixed(2)).toLocaleString("en-GB") + '%', - gadai_detail['jbg'] + gadai_detail['tempoh'] ]).draw(); }else if(jenistebus == "lelong"){ var urlroute = '{{ route("lelongan", ":id") }}'; diff --git a/resources/views/print/sag.blade.php b/resources/views/print/sag.blade.php index 610e3cf..ff9af6a 100644 --- a/resources/views/print/sag.blade.php +++ b/resources/views/print/sag.blade.php @@ -446,7 +446,7 @@ NO MYKAD - {{$gadai_detail['nokp']}} + {{$gadai_detail['nokp']}} TARIKH PEMBIAYAAN @php @@ -889,7 +889,7 @@ NO MYKAD - {{$gadai_detail['nokp']}} + {{$gadai_detail['nokp']}} TARIKH PEMBIAYAAN @php diff --git a/routes/web.php b/routes/web.php index 38c387e..91d4a77 100644 --- a/routes/web.php +++ b/routes/web.php @@ -278,3 +278,7 @@ Route::post('admin/kakitangan/delete',['as'=>'admin.kakitangan.delete','uses'=>' Route::get('admin/kakitangan/edit',['as'=>'admin.kakitangan.edit','uses'=>'KakitanganController@editKakitangan'])->middleware('auth','admin'); Route::post('admin/kakitangan/edit/store',['as'=>'admin.kakitangan.edit.store','uses'=>'KakitanganController@editStoreKakitangan'])->middleware('auth','admin'); Route::get('admin/kakitangan/resetcredentials',['as'=>'admin.kakitangan.resetcredentials','uses'=>'KakitanganController@resetCredentials'])->middleware('auth','admin'); +Route::get('admin/pelanggan',['as'=>'admin.pelanggan','uses'=>'KhazanahController@index'])->middleware('auth','admin'); +Route::get('admin/customer_info',['as'=>'admin.customer_info','uses'=>'KhazanahController@infoAdmin'])->middleware('auth','admin'); +Route::get('admin/searchpelanggan',['as'=>'admin.searchpelanggan','uses'=>'KhazanahController@searchAdmin'])->middleware('auth','admin'); +Route::get('admin/poskod',['as'=>'admin.poskod','uses'=>'HomeController@poskod']); \ No newline at end of file diff --git a/tests/Feature/DenominasiTest.php b/tests/Feature/DenominasiTest.php deleted file mode 100644 index 6e93fe6..0000000 --- a/tests/Feature/DenominasiTest.php +++ /dev/null @@ -1,23 +0,0 @@ -actingAs($user); - $response = $this->get('/'); - - $response->assertStatus(200); - } -}