block sag

This commit is contained in:
Afiq
2022-02-27 23:59:16 +08:00
parent 04716a2a45
commit 955328c35e
46 changed files with 1567 additions and 1562 deletions
+32 -32
View File
@@ -30,15 +30,15 @@ class CustomersController extends Controller
*
* @return \Illuminate\Http\Response
*/
public function index()
{
$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();
$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();
$blacklist_search = false;
return view('customers.index',compact('search','blacklist_search','cawangan_info','bank','api_url','idtype'));
}
@@ -46,8 +46,8 @@ class CustomersController extends Controller
public function info(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/customers/'. Session::get('noic'))->json();
$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();
// if($customers_info){
// $customer_info = $customers_info[0];
// }else{
@@ -57,9 +57,9 @@ class CustomersController extends Controller
$komoditi = Komoditi::first();
$min_komoditi = $komoditi['min_komoditi'];
$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();
$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();
$request->session()->forget('page_reload');
$request->session()->forget('norujukan');
return view('customers.info',compact('cawangan_info','api_url','customer_info','bakilelong','rugilelong','min_komoditi'));
@@ -72,11 +72,11 @@ class CustomersController extends Controller
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/customers/'. $noic)->json();
$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();
$blacklist = Http::get(config('api.url') . '/api/customer/blacklist',[
$blacklist = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/customer/blacklist',[
'nokp' => $noic
])->json();
// if($customers_info){
@@ -110,7 +110,7 @@ class CustomersController extends Controller
public function cari(Request $request)
{
$api_url = config('api.url');
$customers_info = Http::get(config('api.url') . '/api/customers/'. $request->icno)->json();
$customers_info = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/customers/'. $request->icno)->json();
if(sizeof($customers_info) > 0)
return $customers_info;
@@ -163,21 +163,21 @@ class CustomersController extends Controller
$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();
$latest_customer = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/customers/latest/' . $auth_user['cawangan'])->json();
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;
$detail_poskod = Http::get(config('api.url') . '/api/poskod/' . $request->poskod)->json();
$detail_poskod = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/poskod/' . $request->poskod)->json();
$customer_info = Http::post(config('api.url') . '/api/customers/create/'. $auth_user['cawangan'],[
$customer_info = Http::withOptions(['verify' => config('app.api_verify')])->post(config('api.url') . '/api/customers/create/'. $auth_user['cawangan'],[
'kodcaw' => $auth_user['cawangan'],
'nopelanggan' => $no_pelanggan,
'nokpbaru' => $nokpbaru,
@@ -203,7 +203,7 @@ class CustomersController extends Controller
'kodkerja'=>$request->pekerjaan,
'tujuangadai'=>$request->tujuan_gadai,
]);
Session::put('customer_info',$customer_info);
event(new PelangganNotify('lulus',$auth_user['cawangan']));
return redirect()->route('customer_info')->with( ['customer_info' => $customer_info] );
@@ -216,11 +216,11 @@ class CustomersController extends Controller
$expired = $expired->addHours(24);
$currentDateTime = Carbon::now();
$cawangan_info = Http::get(config('api.url') . '/api/cawangan/'. $auth_user['cawangan'])->json();
$cawangan_info = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/cawangan/'. $auth_user['cawangan'])->json();
$nama_cawangan = $cawangan_info["details_caw"];
$nokp = $request->noic_otp;
$customer = Http::get(config('api.url'). '/api/customers/'.$nokp)->json();
$customer = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url'). '/api/customers/'.$nokp)->json();
$recipient = '6'.$customer['telefon'];
// $recipient = '60189025461';
//pembinaan token
@@ -236,8 +236,8 @@ class CustomersController extends Controller
return implode("", array_slice($characters, 0, $length));
}
$otp_token = Http::get(config('api.url') . '/api/otp/' . $nokp) ->json();
$otp_token_used = Http::get(config('api.url') . '/api/otp/used/' . $nokp) ->json();
$otp_token = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/otp/' . $nokp) ->json();
$otp_token_used = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/otp/used/' . $nokp) ->json();
if (is_array($otp_token) || is_object($otp_token)){
if($otp_token){
@@ -248,8 +248,8 @@ class CustomersController extends Controller
return response(['error' => "Pelanggan Sudah Mendaftar Pada Customer Portal"]);
}else{
$random = token(6);
$otp_baru = Http::post(config('api.url'). '/api/otp/generateotp/' . $nokp,[
$otp_baru = Http::withOptions(['verify' => config('app.api_verify')])->post(config('api.url'). '/api/otp/generateotp/' . $nokp,[
'otptoken' => $random,
'expired' => $expired,
'kodcaw' => $auth_user['cawangan']
@@ -261,8 +261,8 @@ class CustomersController extends Controller
}
}else{
$random = token(6);
$otp_baru = Http::post(config('api.url'). '/api/otp/generateotp/' . $nokp,[
$otp_baru = Http::withOptions(['verify' => config('app.api_verify')])->post(config('api.url'). '/api/otp/generateotp/' . $nokp,[
'otptoken' => $random,
'expired' => $expired,
'kodcaw' => $auth_user['cawangan']
@@ -280,7 +280,7 @@ class CustomersController extends Controller
}else{
$random = token(6);
$otp_baru = Http::post(config('api.url'). '/api/otp/generateotp/' . $nokp,[
$otp_baru = Http::withOptions(['verify' => config('app.api_verify')])->post(config('api.url'). '/api/otp/generateotp/' . $nokp,[
'otptoken' => $random,
'expired' => $expired,
'kodcaw' => $auth_user['cawangan']
@@ -292,8 +292,8 @@ class CustomersController extends Controller
}
}else{
$random = token(6);
$otp_baru = Http::post(config('api.url'). '/api/otp/generateotp/' . $nokp,[
$otp_baru = Http::withOptions(['verify' => config('app.api_verify')])->post(config('api.url'). '/api/otp/generateotp/' . $nokp,[
'otptoken' => $random,
'expired' => $expired,
'kodcaw' => $auth_user['cawangan']
@@ -308,7 +308,7 @@ class CustomersController extends Controller
public function sendWhatsAppMessage(string $message, string $recipient)
{
$status = Http::get('http://gateway.onewaysms.com.my:10001/api.aspx',[
$status = Http::withOptions(['verify' => config('app.api_verify')])->get('http://gateway.onewaysms.com.my:10001/api.aspx',[
'apiusername' => 'APIUK330HDAFO',
'apipassword' => 'APIUK330HDAFOUK330',
'senderid' => 'INFO',