Merge branch 'backend' into 'master'
kodcaw See merge request online-sistem1/kaunter!17
This commit is contained in:
@@ -151,12 +151,12 @@ class CustomersController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function getOTP(Request $request){
|
public function getOTP(Request $request){
|
||||||
|
$auth_user = Auth::user();
|
||||||
$expired = Carbon::now();
|
$expired = Carbon::now();
|
||||||
$expired = new Carbon();
|
$expired = new Carbon();
|
||||||
$expired = $expired->addHours(24);
|
$expired = $expired->addHours(24);
|
||||||
|
|
||||||
$nokp = $request->noic_otp;
|
$nokp = $request->noic;
|
||||||
|
|
||||||
//pembinaan token
|
//pembinaan token
|
||||||
function token($length) {
|
function token($length) {
|
||||||
@@ -170,39 +170,34 @@ class CustomersController extends Controller
|
|||||||
shuffle($characters);
|
shuffle($characters);
|
||||||
return implode("", array_slice($characters, 0, $length));
|
return implode("", array_slice($characters, 0, $length));
|
||||||
}
|
}
|
||||||
$random = token(6);
|
|
||||||
// dd($expired);
|
|
||||||
$otp_baru = Http::post(config('url.api') . '/api/otp/generateotp/' . $nokp,[
|
|
||||||
'otptoken' => $random,
|
|
||||||
'expired' => $expired,
|
|
||||||
]);
|
|
||||||
// dd($otp_baru);
|
|
||||||
return redirect()->route('customer_info');
|
|
||||||
// $otp_token = Http::get(config('api.url') . '/api/otp/' . $nokp) ->json();
|
|
||||||
// // dd($nokp);
|
|
||||||
// if (is_array($otp_token) || is_object($otp_token)){
|
|
||||||
// if($otp_token){
|
|
||||||
// return redirect()->route('customer_info');
|
|
||||||
// }else{
|
|
||||||
// $random = token(6);
|
|
||||||
|
|
||||||
// $otp_baru = Http::post(config('url.api'). '/api/otp/create/' . $nokp,[
|
|
||||||
// 'otptoken' => $random,
|
|
||||||
// 'expired' => $expired
|
|
||||||
// ]);
|
|
||||||
|
|
||||||
// return redirect()->route('customer_info');
|
|
||||||
// }
|
|
||||||
// }else{
|
|
||||||
// $random = token(6);
|
|
||||||
|
|
||||||
// $otp_baru = Http::post(config('url.api'). '/api/otp/create/' . $nokp,[
|
$otp_token = Http::get(config('api.url') . '/api/otp/' . $nokp) ->json();
|
||||||
// 'otptoken' => $random,
|
|
||||||
// 'expired' => $expired
|
|
||||||
// ]);
|
|
||||||
|
|
||||||
// return redirect()->route('customer_info');
|
if (is_array($otp_token) || is_object($otp_token)){
|
||||||
// }
|
if($otp_token){
|
||||||
|
return response(['error' => "OTP Akaun Telah Di Jana"]);
|
||||||
|
}else{
|
||||||
|
$random = token(6);
|
||||||
|
|
||||||
|
$otp_baru = Http::post(config('api.url'). '/api/otp/generateotp/' . $nokp,[
|
||||||
|
'otptoken' => $random,
|
||||||
|
'expired' => $expired,
|
||||||
|
'kodcaw' => $auth_user['cawangan']
|
||||||
|
]);
|
||||||
|
|
||||||
|
return response()->json(['otp'=>$random]);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
$random = token(6);
|
||||||
|
|
||||||
|
$otp_baru = Http::post(config('api.url'). '/api/otp/generateotp/' . $nokp,[
|
||||||
|
'otptoken' => $random,
|
||||||
|
'expired' => $expired,
|
||||||
|
'kodcaw' => $auth_user['cawangan']
|
||||||
|
]);
|
||||||
|
|
||||||
|
return response()->json(['otp'=>$random]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -124,18 +124,15 @@
|
|||||||
<div class="row justify-content-center">
|
<div class="row justify-content-center">
|
||||||
<div class="col-md-7">
|
<div class="col-md-7">
|
||||||
<div class="input-group my-3" id="otp_form">
|
<div class="input-group my-3" id="otp_form">
|
||||||
<form action="{{ route('customer.otp') }}" method="post">
|
<input type="text" class="form-control" name="noic_otp" readonly placeholder="No Kad Pengenalan Pelanggan" id="noic_otp" aria-label="No Kad Pengenalan Pelanggan" autocomplete="off" value="" aria-describedby="button-addon2">
|
||||||
@csrf
|
<div class="input-group-append">
|
||||||
<input type="text" class="form-control" name="noic_otp" readonly placeholder="No Kad Pengenalan Pelanggan" id="noic_otp" aria-label="No Kad Pengenalan Pelanggan" autocomplete="off" value="" aria-describedby="button-addon2">
|
<button class="btn btn-outline-primary" type="button" id="jana_otp">Jana OTP</button>
|
||||||
<div class="input-group-append">
|
</div>
|
||||||
<button class="btn btn-outline-primary" type="submit" id="jana_otp">Jana OTP</button>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
</div>
|
||||||
<div id="otp_generate" style="display:none;">
|
<div id="otp_generate" style="display:none;">
|
||||||
<div class="row form-group">
|
<div class="row form-group">
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
OTP Token
|
OTP Token :
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
<span id="otp_number"></span>
|
<span id="otp_number"></span>
|
||||||
@@ -446,27 +443,36 @@
|
|||||||
$('#opt_modal').modal('show');
|
$('#opt_modal').modal('show');
|
||||||
});
|
});
|
||||||
|
|
||||||
// $('#jana_otp').click(function(){
|
$('#jana_otp').click(function(){
|
||||||
// var noic = $('#noic_otp').val();
|
var noic = $('#noic_otp').val();
|
||||||
|
|
||||||
// $.ajax({
|
$.ajax({
|
||||||
// method:'get',
|
method:'get',
|
||||||
// url: "{{ route('customer.otp') }}",
|
url: "{{ route('customer.otp') }}",
|
||||||
// data:{
|
data:{
|
||||||
// 'noic' : noic
|
'noic' : noic
|
||||||
// },
|
},
|
||||||
// success: function(otp_token){
|
dataType:'json',
|
||||||
// console.log(otp_token);
|
success: function(otp_token){
|
||||||
// // $('#otp_form').hide();
|
console.log(otp_token['error']);
|
||||||
// // $('#otp_generate').show();
|
if(otp_token['error']){
|
||||||
// // $('#otp_number').text();
|
Swal.fire({
|
||||||
// },
|
icon: 'error',
|
||||||
// error: function(xhRequest, ErrorText, thrownError){
|
title: 'Amaran!',
|
||||||
// alert('Gadai Tidak Berjaya');
|
text: otp_token['error']
|
||||||
// console.log(xhRequest);
|
});
|
||||||
// }
|
}else if(otp_token['otp']){
|
||||||
// });
|
$('#otp_form').hide();
|
||||||
// })
|
$('#otp_generate').show();
|
||||||
|
$('#otp_number').text(otp_token['otp']);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function(xhRequest, ErrorText, thrownError){
|
||||||
|
// alert('Gadai Tidak Berjaya');
|
||||||
|
console.log(xhRequest);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
+1
-1
@@ -42,7 +42,7 @@ Route::post('/customer/store',['as'=>'customer.store','uses'=>'CustomersControll
|
|||||||
Route::post('/gadai/store',['as'=>'gadai.store','uses'=>'GadaianController@store'])->middleware('auth','teller');
|
Route::post('/gadai/store',['as'=>'gadai.store','uses'=>'GadaianController@store'])->middleware('auth','teller');
|
||||||
Route::get('/gadai/batal',['as'=>'gadai.batal','uses'=>'GadaianController@batal'])->middleware('auth','teller');
|
Route::get('/gadai/batal',['as'=>'gadai.batal','uses'=>'GadaianController@batal'])->middleware('auth','teller');
|
||||||
Route::get('/gadai/batal',['as'=>'gadai.batal','uses'=>'GadaianController@batal'])->middleware('auth','teller');
|
Route::get('/gadai/batal',['as'=>'gadai.batal','uses'=>'GadaianController@batal'])->middleware('auth','teller');
|
||||||
Route::post('/customer/otp',['as'=>'customer.otp','uses'=>'CustomersController@getOTP'])->middleware('auth','teller');
|
Route::get('/customer/otp',['as'=>'customer.otp','uses'=>'CustomersController@getOTP'])->middleware('auth','teller');
|
||||||
|
|
||||||
//Penilai
|
//Penilai
|
||||||
Route::get('/gadaiansemasa',['as'=>'gadaian.semasa','uses'=>'GadaianController@gadaiansemasa'])->middleware('auth','penilai');
|
Route::get('/gadaiansemasa',['as'=>'gadaian.semasa','uses'=>'GadaianController@gadaiansemasa'])->middleware('auth','penilai');
|
||||||
|
|||||||
Reference in New Issue
Block a user