register passport

This commit is contained in:
Afiq
2021-01-18 14:48:44 +08:00
parent d70eb2e7d2
commit 1ed798f664
5 changed files with 466 additions and 22 deletions
+14 -3
View File
@@ -33,9 +33,10 @@ class CustomersController extends Controller
$search = false;
$api_url = config('api.url');
$auth_user = Auth::user();
$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'));
return view('customers.index',compact('search','cawangan_info','bank','api_url','idtype'));
}
public function info(Request $request){
@@ -54,7 +55,9 @@ class CustomersController extends Controller
}
public function search(Request $request){
// dd($request->all());
$noic = $request->noic;
$idtype = $request->customerIDType;
Session::put('noic', $noic);
$api_url = config('api.url');
$auth_user = Auth::user();
@@ -75,7 +78,7 @@ class CustomersController extends Controller
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'));
return view('customers.index',compact('customer_info','search','noic','cawangan_info','bank','api_url','idtype'));
}
}
@@ -109,6 +112,13 @@ class CustomersController extends Controller
*/
public function store(Request $request)
{
if($request->idtype == 'nokp'){
$nokpbaru = $request->noic;
$nokplama = '';
}elseif($request->idtype == 'passport'){
$nokpbaru = '';
$nokplama = $request->noic;
}
if($request->warganegara){
$warganegara = 'Y';
}else{
@@ -146,7 +156,8 @@ class CustomersController extends Controller
$customer_info = Http::post(config('api.url') . '/api/customers/create/'. $auth_user['cawangan'],[
'kodcaw' => $auth_user['cawangan'],
'nopelanggan' => $no_pelanggan,
'nokp' => $request->noic,
'nokpbaru' => $nokpbaru,
'nokplama' => $nokplama,
'nama' => $request->name,
't_lahir' => $tarikhlahir->toDateString(),
'jantina' => $jantina,