diff --git a/app/Http/Controllers/CustomersController.php b/app/Http/Controllers/CustomersController.php index ccb6a99..fec89b8 100644 --- a/app/Http/Controllers/CustomersController.php +++ b/app/Http/Controllers/CustomersController.php @@ -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, diff --git a/app/User.php b/app/User.php index dcb0041..f1419d9 100644 --- a/app/User.php +++ b/app/User.php @@ -16,7 +16,7 @@ class User extends Authenticatable * @var array */ protected $fillable = [ - 'name', 'email', 'password','roles','no_kp','no_telefon','cawangan','role_harian','perubatan', + 'name', 'email', 'password','roles','no_kp','no_telefon','cawangan','role_harian','perubatan','role_dashboard', ]; /** diff --git a/resources/views/customers/index.blade.php b/resources/views/customers/index.blade.php index 8be79de..896dc08 100644 --- a/resources/views/customers/index.blade.php +++ b/resources/views/customers/index.blade.php @@ -14,11 +14,17 @@
masukkan nombor kad pengenalan
-
+
-
+
- + +
+ +
@@ -29,14 +35,14 @@
@if($search == true )
-
@endif
- + +
+ +