From 51c574442f8d7d6749574184e84b8ab7dc31ea34 Mon Sep 17 00:00:00 2001 From: Amirah Date: Tue, 26 Dec 2023 11:52:41 +0800 Subject: [PATCH] function wakil khazanah dan penilai --- app/Http/Controllers/WakilController.php | 285 ++++++++++++++++++ .../views/homepage/khazanah/home.blade.php | 4 + .../views/homepage/penilai/home.blade.php | 9 +- resources/views/khazanah/saginfo.blade.php | 182 +++++++++++ resources/views/khazanah/wakil.blade.php | 256 ++++++++++++++++ resources/views/print/surat_wakil.blade.php | 264 ++++++++++++++++ routes/web.php | 10 + 7 files changed, 1008 insertions(+), 2 deletions(-) create mode 100644 app/Http/Controllers/WakilController.php create mode 100644 resources/views/khazanah/saginfo.blade.php create mode 100644 resources/views/khazanah/wakil.blade.php create mode 100644 resources/views/print/surat_wakil.blade.php diff --git a/app/Http/Controllers/WakilController.php b/app/Http/Controllers/WakilController.php new file mode 100644 index 0000000..9f075ca --- /dev/null +++ b/app/Http/Controllers/WakilController.php @@ -0,0 +1,285 @@ +middleware('auth'); + } + + public function indexwakil() + { + $search = false; + + $api_url = config('api.url'); + $auth_user = Auth::user(); + $idtype = 'nokp'; + $cawangan_info = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/cawangan/' . $auth_user['cawangan'])->json(); + $bank = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/bank')->json(); + + return view('khazanah.wakil', compact('search', 'cawangan_info', 'bank', 'api_url', 'idtype', 'auth_user')); + } + + public function suratwakil(Request $request) + { + $noic = $request->noic; + // $idtype = $request->customerIDType; + Session::put('noic', $noic); + $api_url = config('api.url'); + $auth_user = Auth::user(); + $cawangan_info = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/cawangan/' . $auth_user['cawangan'])->json(); + + $bank = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/bank')->json(); + $customer_info = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/customers/' . $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('khazanah.sag_info') + ->with([ + 'customer_info' => $customer_info, + 'cawangan_info' => $cawangan_info, + 'api_url' => $api_url + ]); + } else { + + return view('khazanah.wakil', compact('search', 'noic', 'cawangan_info', 'bank', 'api_url', 'idtype')); + } + } + + public function sagInfo(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(); + $customer_info = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/customers/' . Session::get('noic'))->json(); + + + $bakilelong = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/bakilelong/cawangan/' . $auth_user['cawangan'] . '/' . Session::get('noic') . '/baki')->json(); + $rugilelong = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/bakilelong/cawangan/' . $auth_user['cawangan'] . '/' . Session::get('noic') . '/rugi')->json(); + + $negeri = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/negeri/')->json(); + + + + $request->session()->forget('page_reload'); + $request->session()->forget('norujukan'); + + + return view('khazanah.saginfo', compact('cawangan_info', 'api_url', 'customer_info', 'bakilelong', 'rugilelong', 'negeri')); + } + + public function printSuratWakil($norujukan, Request $request) + { + + $api_url = config('api.url'); + $auth_user = Auth::user(); + $current = Carbon::now(); + $current = new Carbon(); + $t_cetak = $current->toDateString(); + + $tarikh_cetak = date('d/m/Y'); + + $check_norujukan = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/checksurat/' . $auth_user['cawangan'] . '/' . $norujukan)->json(); + if ($check_norujukan == $norujukan) { + //get details gadai && detail customer + $update_wakil = Http::withOptions(['verify' => config('app.api_verify')])->put(config('api.url') . '/api/updatewakil/' . $auth_user['cawangan'] . '/' . $norujukan)->json(); + + $gadai = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/gadai/norujukan/' . $norujukan)->json(); + $gadai_details = $gadai[0][0]; + + $noic = $gadai_details['nokp']; + $customer_detail = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/customers/' . $noic)->json(); + + $cawangan = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/cawangan/detail/' . $auth_user['cawangan'])->json(); + $cawangan_detail = $cawangan[0]; + + $nosiri = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/nosiri/wakil/' . $auth_user['cawangan'] . '/' . $norujukan)->json(); + + // $nosiri = $getNoSiri[0]; + // $pdf=PDF::loadView('print.surat_wakil', compact('customer_detail','current','auth_user','api_url','cawangan_detail')) + // ->setPaper('A4','potrait'); + // return $pdf->download('notislelong_'.'.pdf'); + // dd($gadai_details); + + + return view('print.surat_wakil', compact('customer_detail', 'current', 'auth_user', 'api_url', 'cawangan_detail', 'tarikh_cetak', 'gadai_details', 'noic', 'nosiri')); + } else { + + // insert into wakil_surat + + $current_year = substr($current->year, 2, 2); + $current_month = sprintf("%02d", $current->month); + $current_day = sprintf("%02d", $current->day); + + + $surat_wakil = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/wakil/' . $auth_user['cawangan'] . '/' . $t_cetak)->json(); + if ($surat_wakil) { + $new_suratid = $surat_wakil['nosiri'] + 1; + } else { + $new_suratid = 1; + } + + + $new_surat = sprintf("%04d", $new_suratid); + + $no_surat = 'WK' . $current_year . $current_month . $current_day . '-' . $new_surat; + Session::put('norujukan', $norujukan); + Session::put('no_surat', $no_surat); + Session::put('page_reload', true); + $gadai = Http::withOptions(['verify' => config('app.api_verify')])->post(config('api.url') . '/api/wakil/' . $auth_user['cawangan'], [ + 'nosiri' => $new_suratid, + 'no_surat' => $no_surat, + 'norujukan' => $norujukan, + 't_cetak' => $t_cetak, + + ]); + + //get details gadai && detail customer + + $gadai = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/gadai/norujukan/' . $norujukan)->json(); + $gadai_details = $gadai[0][0]; + + $noic = $gadai_details['nokp']; + $customer_detail = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/customers/' . $noic)->json(); + + $cawangan = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/cawangan/detail/' . $auth_user['cawangan'])->json(); + + $cawangan_detail = $cawangan[0]; + + $nosiri = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/nosiri/wakil/' . $auth_user['cawangan'] . '/' . $norujukan)->json(); + + // $pdf=PDF::loadView('print.surat_wakil', compact('customer_detail','current','auth_user','api_url','cawangan_detail')) + // ->setPaper('A4','potrait'); + // return $pdf->download('notislelong_'.'.pdf'); + + return view('print.surat_wakil', compact('customer_detail', 'current', 'auth_user', 'api_url', 'cawangan_detail', 'tarikh_cetak', 'gadai_details', 'noic', 'nosiri')); + } + } + + public function printSuratWakilPenilai($norujukan, Request $request) + { + + $api_url = config('api.url'); + $auth_user = Auth::user(); + $current = Carbon::now(); + $current = new Carbon(); + $t_cetak = $current->toDateString(); + + $tarikh_cetak = date('d-m-Y'); + + $check_norujukan = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/checksurat/' . $auth_user['cawangan'] . '/' . $norujukan)->json(); + + if ($check_norujukan == $norujukan) { + + //get details gadai && detail customer + + $update_wakil = Http::withOptions(['verify' => config('app.api_verify')])->put(config('api.url') . '/api/updatewakil/' . $auth_user['cawangan'] . '/' . $norujukan)->json(); + + $gadai = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/gadai/norujukan/' . $norujukan)->json(); + $gadai_details = $gadai[0][0]; + + $noic = $gadai_details['nokp']; + $customer_detail = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/customers/' . $noic)->json(); + + $cawangan = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/cawangan/detail/' . $auth_user['cawangan'])->json(); + + $cawangan_detail = $cawangan[0]; + + $nosiri = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/nosiri/wakil/' . $auth_user['cawangan'] . '/' . $norujukan)->json(); + + // $pdf=PDF::loadView('print.surat_wakil', compact('customer_detail','current','auth_user','api_url','cawangan_detail')) + // ->setPaper('A4','potrait'); + // return $pdf->download('notislelong_'.'.pdf'); + // dd($gadai_details); + + + return view('print.surat_wakil', compact('customer_detail', 'current', 'auth_user', 'api_url', 'cawangan_detail', 'tarikh_cetak', 'gadai_details', 'noic', 'nosiri')); + } else { + + // insert into wakil_surat + + $current_year = substr($current->year, 2, 2); + $current_month = sprintf("%02d", $current->month); + $current_day = sprintf("%02d", $current->day); + + + $surat_wakil = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/wakil/' . $auth_user['cawangan'] . '/' . $t_cetak)->json(); + if ($surat_wakil) { + $new_suratid = $surat_wakil['nosiri'] + 1; + } else { + $new_suratid = 1; + } + + + $new_surat = sprintf("%04d", $new_suratid); + + $no_surat = 'WK' . $current_year . $current_month . $current_day . '-' . $new_surat; + Session::put('norujukan', $norujukan); + Session::put('no_surat', $no_surat); + Session::put('page_reload', true); + $gadai = Http::withOptions(['verify' => config('app.api_verify')])->post(config('api.url') . '/api/wakil/' . $auth_user['cawangan'], [ + 'nosiri' => $new_suratid, + 'no_surat' => $no_surat, + 'norujukan' => $norujukan, + 't_cetak' => $t_cetak, + + ]); + + //get details gadai && detail customer + + $gadai = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/gadai/norujukan/' . $norujukan)->json(); + $gadai_details = $gadai[0][0]; + + $noic = $gadai_details['nokp']; + $customer_detail = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/customers/' . $noic)->json(); + + $cawangan = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/cawangan/detail/' . $auth_user['cawangan'])->json(); + + $cawangan_detail = $cawangan[0]; + + $nosiri = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/nosiri/wakil/' . $auth_user['cawangan'] . '/' . $norujukan)->json(); + + + // $pdf=PDF::loadView('print.surat_wakil', compact('customer_detail','current','auth_user','api_url','cawangan_detail')) + // ->setPaper('A4','potrait'); + // return $pdf->download('notislelong_'.'.pdf'); + + return view('print.surat_wakil', compact('customer_detail', 'current', 'auth_user', 'api_url', 'cawangan_detail', 'tarikh_cetak', 'gadai_details', 'noic', 'nosiri')); + } + } +} diff --git a/resources/views/homepage/khazanah/home.blade.php b/resources/views/homepage/khazanah/home.blade.php index 06cf5b3..fb3cc51 100644 --- a/resources/views/homepage/khazanah/home.blade.php +++ b/resources/views/homepage/khazanah/home.blade.php @@ -257,6 +257,10 @@ Pendahuluan - Serahan +
+ Surat Wakil +
{{--
diff --git a/resources/views/homepage/penilai/home.blade.php b/resources/views/homepage/penilai/home.blade.php index 06029b6..e763993 100644 --- a/resources/views/homepage/penilai/home.blade.php +++ b/resources/views/homepage/penilai/home.blade.php @@ -135,6 +135,8 @@ Pembiayaan (RM) Nilai Marhun (RM) Berat (g) + Surat Wakil + @@ -143,14 +145,14 @@ @foreach($gadaian_semasa as $index=>$gadaian) {{ $count }} - + @php $customer_info = Http::withOptions(['verify' => config('app.api_verify')])->get($api_url . '/api/customers/'. $gadaian['nokp'])->json(); echo ($customer_info['nama']); @endphp {{ $gadaian['nokp'] }} - + @php $marhun = Http::withOptions(['verify' => config('app.api_verify')])->get($api_url . '/api/marhun/' . $gadaian['norujukan'] )->json(); @endphp @@ -159,6 +161,7 @@ {{ number_format($gadaian['pinjaman'],2) }} {{ number_format($gadaian['nilaimarhun'],2) }} {{ number_format($gadaian['berat'],2) }} + @php $count++; @endphp @endforeach @@ -182,6 +185,7 @@ Pembiayaan (RM) Nilai Marhun (RM) Berat (g) + @@ -204,6 +208,7 @@ {{ number_format($gadaian['pinjaman'],2) }} {{ number_format($gadaian['nilaimarhun'],2) }} {{ number_format($gadaian['berat'],2) }} + @php $count++; @endphp @endforeach diff --git a/resources/views/khazanah/saginfo.blade.php b/resources/views/khazanah/saginfo.blade.php new file mode 100644 index 0000000..7efbbdd --- /dev/null +++ b/resources/views/khazanah/saginfo.blade.php @@ -0,0 +1,182 @@ +@extends('layouts.app') + + + +@section('content') +@include('modal.historytebus') +@include('modal.wakil') +
+
+
+ + + +
+
+
+
+ Nama +
+
+ +
+
+
+
+
+
+ No Kad Pengenalan +
+
+ @php + if($customer_info['kpbaru'] != null){ + $noic = $customer_info['kpbaru']; + }else{ + $noic = $customer_info['kplama']; + } + @endphp + +
+
+
+
+ +
+
+ No Telefon +
+
+ +
+
+ +
+ +
+ + +
+
+ Alamat +
+
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ + + + + + + + + + +
BilNo RujukanTarikh GadaiTempohSurat Wakil
+
+
+ +
+
+
+
+
+ + + + +@endsection diff --git a/resources/views/khazanah/wakil.blade.php b/resources/views/khazanah/wakil.blade.php new file mode 100644 index 0000000..5209bbe --- /dev/null +++ b/resources/views/khazanah/wakil.blade.php @@ -0,0 +1,256 @@ +@extends('layouts.app') + +@section('content') + +
+
+
+ + + +
+
+
+
masukkan nombor kad pengenalan
+
+
+
+
+ +
+ +
+
+ +
+
+
+
+
+
+ +
+
+ + + + +
+
+
+ +@endsection diff --git a/resources/views/print/surat_wakil.blade.php b/resources/views/print/surat_wakil.blade.php new file mode 100644 index 0000000..6bdb2e5 --- /dev/null +++ b/resources/views/print/surat_wakil.blade.php @@ -0,0 +1,264 @@ + + + + + + + + + + +
+
+

KOPERASI PERMODALAN KELANTAN BERHAD (D-5-0228)

+

{{ $cawangan_detail['namacaw'] }}

+

{{ $cawangan_detail['alamat1'] }}

+

{{ $cawangan_detail['alamat2'] }}

+

{{ $cawangan_detail['notel'] }}

+
+
+
+ User Image +
+
+
+
Tarikh Cetak: {{$tarikh_cetak}}
+
+
No Siri: {{$nosiri}}
+ +
+
+ +
+

SURAT PERLANTIKAN WAKIL
TUJUAN PENYELESAIAN PEMBIAYAAN DI AR-RAHN

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Nama Pelanggan: {{$customer_detail['nama']}}
No Surat Akuan Gadai: {{$gadai_details['norujukan']}}Nilai Marhun: RM{{number_format($gadai_details['nilaimarhun'],2) }}
No MyKad / Passport: {{$noic}}Nilai Pembiayaan: RM{{number_format($gadai_details['pinjaman'],2)}}
No Telefon: {{$customer_detail['telefon']}}Baki Pembiayaan: RM{{number_format($gadai_details['bakipjm'],2)}}
Harga Jualan: RM{{number_format($gadai_details['hargajualan'],2)}}
+ +
+ + + + + +
Saya seperti nama di atas, ingin memaklumkan kepada Ar-Rahn Koperasi Permodalan Kelantan Berhad + bagi Cawangan Kota Bharu 2, bahawa saya tidak dapat hadir untuk menyelesaikan pembiayaan saya. +
+ + + + + +
1. Saya melantik wakil bagi pihak diri saya untuk menyelesaikan pembiayaan saya. Maklumat wakil + adalah seperti berikut:
+ + + + + + + + + + + + + + +
Nama + :
No. Kad Pengenalan + :
No. Telefon + :
Hubungan + :
+ + + + + + +
2. Saya mengaku tidak akan membuat apa-apa TUNTUTAN @ GANTI RUGI atas kebarangkalian @ + kerugian yang berlaku disebabkan perlantikan wakil bagi menyelesaikan pembiayaan saya.
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Tandatangan PelangganTandatangan Wakil
__________________________________________________________________
Nama: {{$customer_detail['nama']}}Nama:
Tarikh:Tarikh:
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
Tandatangan Pengurus Cawangan
_________________________________
Nama:
Tarikh:
+ +
+ +
+

*Penting:

+

  a) Sila lampirkan bersama:

+

     i. Salinan kad pengenalan diri pelanggan dan kad pengenalan diri wakil yang dilantik. +

+

     ii. SAG asal pelanggan

+

 b) Pastikan tandatangan pelanggan adalah sama dengan tandatangan di Surat Akuan Gadaian.

+
+ + + + + + + + + + \ No newline at end of file diff --git a/routes/web.php b/routes/web.php index fee14ec..22f6d4f 100644 --- a/routes/web.php +++ b/routes/web.php @@ -409,6 +409,16 @@ Route::get('/arcc/pelanggan',['as'=>'arcc.pelanggan','uses'=>'CallCenterControll Route::get('/arcc/searchpelanggan',['as'=>'arcc.searchpelanggan','uses'=>'CallCenterController@search'])->middleware('auth','callcenter'); Route::get('/arcc/customer_info',['as'=>'arcc.customer_info','uses'=>'CallCenterController@info'])->middleware('auth','callcenter'); +//surat wakil +Route::get('/khazanah/indexwakil',['as'=>'khazanah.indexwakil','uses'=>'WakilController@indexwakil'])->middleware('auth','khazanah'); +Route::get('/khazanah/suratwakil',['as'=>'khazanah.suratwakil','uses'=>'WakilController@suratwakil'])->middleware('auth','khazanah'); +Route::get('/khazanah/sag_info',['as'=>'khazanah.sag_info','uses'=>'WakilController@sagInfo'])->middleware('auth','khazanah'); +Route::get('/khazanah/print.suratwakil/{norujukan}',['as'=>'khazanah.print.suratwakil','uses'=>'WakilController@printSuratWakil'])->middleware('auth','khazanah'); +Route::get('/penilai/print.suratwakil/{norujukan}',['as'=>'penilai.print.suratwakil','uses'=>'WakilController@printSuratWakilPenilai'])->middleware('auth','penilai'); + + + + Route::get('supports/driver/mykad-reader',['as'=>'mykadreader.driver', function(){ return view('supports.driver.mykad-reader.download');