diff --git a/app/Http/Controllers/CustomersController.php b/app/Http/Controllers/CustomersController.php index d0a1155..a32c055 100644 --- a/app/Http/Controllers/CustomersController.php +++ b/app/Http/Controllers/CustomersController.php @@ -113,15 +113,50 @@ class CustomersController extends Controller $jantina = 'P'; } $split_date = explode('/',$request->tarikh_lahir); + $tarikh_lahir = $split_date[2].'-'.$split_date[1].'-'.$split_date[0]; + $tarikhlahir = Carbon::parse($tarikh_lahir); $auth_user = Auth::user(); $latest_customer = Http::get(config('api.url') . '/api/customers/latest/' . $auth_user['cawangan'])->json(); - - $nosiri_latest = $latest_customer['nosiri']+1; + + if($latest_customer == null){ + $nosiri_latest = 1; + } + else{ + $nosiri_latest = $latest_customer['nosiri']+1; + } + $count = sprintf("%08d", $nosiri_latest); $no_pelanggan = $request->bangsa . substr($request->noic,6,2).'-'.$count; // dd($tarikh_lahir); + $detail_poskod = Http::get(config('api.url') . '/api/poskod/' . $request->poskod)->json(); + // dd($auth_user); + $sent_data = [ + 'kodcaw' => $auth_user['cawangan'], + 'nopelanggan' => $no_pelanggan, + 'nokp' => $request->noic, + 'nama' => $request->name, + 't_lahir' => $tarikhlahir->toDateString(), + 'jantina' => $jantina, + 'alamat' => $request->alamat, + 'poskod' => $request->poskod, + 'koddaerah' => $detail_poskod['koddaerah'], + 'kodnegeri' => $detail_poskod['kodnegeri'], + 'telefon' => $request->main_phone, + 'bumiputra' => $bumiputera, + 'warganegara' => $warganegara, + 'bangsa' => $request->bangsa, + 'kodugama' => $request->agama, + 'kodbank' => $request->bank_name, + 'noakaun' => $request->no_akaun, + 'teller' => $auth_user['name'], + 'telefon2' => $request->alternate_phone, + 'nosiri' => $nosiri_latest + ]; + + $customer_info = Http::post(config('api.url') . '/api/customers/'. $auth_user['cawangan'],$sent_data); + dd($sent_data); Session::put('customer_info',$customer_info); return redirect()->route('customer_info')->with( ['customer_info' => $customer_info] ); diff --git a/config/session.php b/config/session.php index 4e0f66c..645d39b 100644 --- a/config/session.php +++ b/config/session.php @@ -196,6 +196,6 @@ return [ | */ - 'same_site' => 'lax', + 'same_site' => null, ]; diff --git a/resources/views/customers/index.blade.php b/resources/views/customers/index.blade.php index 3758d41..27c2acf 100644 --- a/resources/views/customers/index.blade.php +++ b/resources/views/customers/index.blade.php @@ -50,7 +50,7 @@
Nama
-
+
No KP
Tarikh Lahir
@@ -60,17 +60,17 @@
Jantina
Alamat
-
+
Poskod
-
+
Daerah
Negeri
No Telefon 1
-
+
No Telefon 2
-
+
@@ -87,11 +87,11 @@
Ahli
@@ -140,8 +140,34 @@ @endforeach
-
No Akaun Bank
-
+
No Akaun
+
+
Tujuan Gadai
+ @php + $tujuangadai = Http::get($api_url . '/api/tujuangadai')->json(); + @endphp +
+ +
+
Pekerjaan
+ @php + $pekerjaan = Http::get($api_url . '/api/pekerjaan')->json(); + @endphp +
+ +
+
Nota
+
diff --git a/resources/views/print/sag.blade.php b/resources/views/print/sag.blade.php index 62b66d7..44d7cd1 100644 --- a/resources/views/print/sag.blade.php +++ b/resources/views/print/sag.blade.php @@ -5,11 +5,11 @@ - --> + + +
+ @if (Route::has('login')) + + @endif + +
+
+ Laravel +
+ + +
+
+ + + diff --git a/routes/web.php b/routes/web.php index 1d1d222..9ab0e6b 100644 --- a/routes/web.php +++ b/routes/web.php @@ -99,4 +99,8 @@ Route::get('laporan/ringkasanterkumpul/cetak',['as'=>'ringkasanterkumpul.laporan -Route::post('/barcodescanned',['as'=>'barcode.scanned','uses'=>'KhazanahController@barcodescanned'])->middleware('auth','khazanah'); \ No newline at end of file +Route::post('/barcodescanned',['as'=>'barcode.scanned','uses'=>'KhazanahController@barcodescanned'])->middleware('auth','khazanah'); + +Route::get('/test',function(){ + return view('test'); +}); \ No newline at end of file