Merge branch 'master' of https://gitlab.com/online-sistem1/kaunter into pipi
This commit is contained in:
@@ -12,6 +12,8 @@ use Illuminate\Support\Facades\Session;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
use Carbon\Carbon;
|
||||
|
||||
class CustomersController extends Controller
|
||||
{
|
||||
private $customer_ic;
|
||||
@@ -148,13 +150,59 @@ class CustomersController extends Controller
|
||||
//
|
||||
}
|
||||
|
||||
public function getOTP()
|
||||
{
|
||||
$auth_user = Auth::user();
|
||||
$api_url = config('api.url');
|
||||
$cawangan_info = Http::get(config('api.url') . '/api/cawangan/'. $auth_user['cawangan'])->json();
|
||||
public function getOTP(Request $request){
|
||||
|
||||
return view('onetimepassword.home',compact('cawangan_info','api_url'));
|
||||
$expired = Carbon::now();
|
||||
$expired = new Carbon();
|
||||
$expired = $expired->addHours(24);
|
||||
|
||||
$nokp = $request->noic_otp;
|
||||
|
||||
//pembinaan token
|
||||
function token($length) {
|
||||
$characters = array(
|
||||
"A","B","C","D","E","F","G","H","J","K","L","M",
|
||||
"N","P","Q","R","S","T","U","V","W","X","Y","Z",
|
||||
"a","b","c","d","e","f","g","h","i","j","k","m",
|
||||
"n","o","p","q","r","s","t","u","v","w","x","y","z",
|
||||
"1","2","3","4","5","6","7","8","9");
|
||||
if ($length < 0 || $length > count($characters)) return null;
|
||||
shuffle($characters);
|
||||
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,[
|
||||
// 'otptoken' => $random,
|
||||
// 'expired' => $expired
|
||||
// ]);
|
||||
|
||||
// return redirect()->route('customer_info');
|
||||
// }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -25,9 +25,6 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- <input type="text" id="noic" style="width:400px" name="noic" placeholder="No Kad Pengenalan Pelanggan" autocomplete="off" value="{{$search == false ? '' : $noic ?? ''}}"/>
|
||||
<input type="submit" class="btn btn-primary" value="Sahkan" /> -->
|
||||
</form>
|
||||
</div>
|
||||
@if($search == true )
|
||||
|
||||
@@ -1,117 +1,163 @@
|
||||
@extends('layouts.app')
|
||||
<!-- Modal -->
|
||||
<div class="modal fade" id="exampleModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered modal-xl">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="exampleModalLabel">Maklumat Pelaggan</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form id="kemaskiniform">
|
||||
<div class='row form-group'>
|
||||
<div class='col-md-6'>
|
||||
<div class='form-group row col-md-12'>
|
||||
<div class='col-md-5'>
|
||||
Nama
|
||||
</div>
|
||||
<div class='col-md-7'>
|
||||
<input type="text" readonly name='nama' id='nama' value="{{ $customer_info['nama'] }}" class='form-control'>
|
||||
</div>
|
||||
</div>
|
||||
<div class='form-group row col-md-12'>
|
||||
<div class='col-md-5'>
|
||||
No KP
|
||||
</div>
|
||||
<div class='col-md-7'>
|
||||
<input type="text" readonly name='icno' id='icno' value="{{ $customer_info['kpbaru'] }}" class='form-control'>
|
||||
</div>
|
||||
</div>
|
||||
<div class='form-group row col-md-12'>
|
||||
<div class='col-md-5'>
|
||||
No Pelanggan
|
||||
</div>
|
||||
<div class='col-md-7'>
|
||||
<input type="text" readonly name='nopelanggan' id='nopelanggan' value="{{ $customer_info['nopelanggan'] }}" class='form-control'>
|
||||
</div>
|
||||
</div>
|
||||
<div class='form-group row col-md-12'>
|
||||
<div class='col-md-5'>
|
||||
No Telefon 1
|
||||
</div>
|
||||
<div class='col-md-7'>
|
||||
<input type="text" readonly name='' id='telefon' value="{{ $customer_info['telefon'] }}" class='form-control'>
|
||||
<span id="errortelefon" style="color:red;"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class='form-group row col-md-12'>
|
||||
<div class='col-md-5'>
|
||||
No Telefon 2
|
||||
</div>
|
||||
<div class='col-md-7'>
|
||||
<input type="text" readonly name='telefon2' id='telefon2' value="{{ $customer_info['telefon2'] }}" class='form-control'>
|
||||
<span id="errortelefon2" style="color:red;"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal fade" id="customer_detail" tabindex="-1" aria-labelledby="customer_detailLabel" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered modal-xl">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="customer_detailLabel">Maklumat Pelanggan</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class='col-md-6'>
|
||||
<div class='form-group row col-md-12'>
|
||||
<div class='col-md-4'>
|
||||
Alamat
|
||||
<div class="modal-body">
|
||||
<form id="kemaskiniform">
|
||||
<div class='row form-group'>
|
||||
<div class='col-md-6'>
|
||||
<div class='form-group row col-md-12'>
|
||||
<div class='col-md-5'>
|
||||
Nama
|
||||
</div>
|
||||
<div class='col-md-7'>
|
||||
<input type="text" readonly name='nama' id='nama' value="{{ $customer_info['nama'] }}" class='form-control'>
|
||||
</div>
|
||||
</div>
|
||||
<div class='form-group row col-md-12'>
|
||||
<div class='col-md-5'>
|
||||
No KP
|
||||
</div>
|
||||
<div class='col-md-7'>
|
||||
<input type="text" readonly name='icno' id='icno' value="{{ $customer_info['kpbaru'] }}" class='form-control'>
|
||||
</div>
|
||||
</div>
|
||||
<div class='form-group row col-md-12'>
|
||||
<div class='col-md-5'>
|
||||
No Pelanggan
|
||||
</div>
|
||||
<div class='col-md-7'>
|
||||
<input type="text" readonly name='nopelanggan' id='nopelanggan' value="{{ $customer_info['nopelanggan'] }}" class='form-control'>
|
||||
</div>
|
||||
</div>
|
||||
<div class='form-group row col-md-12'>
|
||||
<div class='col-md-5'>
|
||||
No Telefon 1
|
||||
</div>
|
||||
<div class='col-md-7'>
|
||||
<input type="text" readonly name='' id='telefon' value="{{ $customer_info['telefon'] }}" class='form-control'>
|
||||
<span id="errortelefon" style="color:red;"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class='form-group row col-md-12'>
|
||||
<div class='col-md-5'>
|
||||
No Telefon 2
|
||||
</div>
|
||||
<div class='col-md-7'>
|
||||
<input type="text" readonly name='telefon2' id='telefon2' value="{{ $customer_info['telefon2'] }}" class='form-control'>
|
||||
<span id="errortelefon2" style="color:red;"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class='col-md-6'>
|
||||
<div class='form-group row col-md-12'>
|
||||
<div class='col-md-4'>
|
||||
Alamat
|
||||
</div>
|
||||
<div class='col-md-8'>
|
||||
<textarea style="resize:none" name="alamat" id="alamat" cols="30" rows="3" readonly class='form-control'>{{ $customer_info['alamat1'] }}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class='form-group row col-md-12'>
|
||||
<div class='col-md-4'>
|
||||
Poskod
|
||||
</div>
|
||||
<div class='col-md-8'>
|
||||
<input type="text" readonly name='poskod' id='poskod' value="{{ $customer_info['poskod'] }}" class='form-control'>
|
||||
</div>
|
||||
</div>
|
||||
<div class='form-group row col-md-12'>
|
||||
<div class='col-md-4'>
|
||||
Daerah
|
||||
</div>
|
||||
<div class='col-md-8'>
|
||||
@php
|
||||
$daerah = Http::get($api_url . '/api/daerah/' . $customer_info['koddaerah'])->json();
|
||||
@endphp
|
||||
<input type="text" readonly name='koddaerah' id='koddaerah' value="{{ $daerah['namadaerah'] }}" class='form-control'>
|
||||
</div>
|
||||
</div>
|
||||
<div class='form-group row col-md-12'>
|
||||
<div class='col-md-4'>
|
||||
Negeri
|
||||
</div>
|
||||
<div class='col-md-8'>
|
||||
@php
|
||||
$negeri = Http::get($api_url . '/api/negeri/' . $customer_info['kodnegeri'])->json();
|
||||
@endphp
|
||||
<input type="text" readonly name='kodnegeri' id='kodnegeri' value="{{ $negeri['negeri'] }}" class='form-control'>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class='col-md-8'>
|
||||
<textarea style="resize:none" name="alamat" id="alamat" cols="30" rows="3" readonly class='form-control'>{{ $customer_info['alamat1'] }}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class='form-group row col-md-12'>
|
||||
<div class='col-md-4'>
|
||||
Poskod
|
||||
</div>
|
||||
<div class='col-md-8'>
|
||||
<input type="text" readonly name='poskod' id='poskod' value="{{ $customer_info['poskod'] }}" class='form-control'>
|
||||
</div>
|
||||
</div>
|
||||
<div class='form-group row col-md-12'>
|
||||
<div class='col-md-4'>
|
||||
Daerah
|
||||
</div>
|
||||
<div class='col-md-8'>
|
||||
<input type="text" readonly name='koddaerah' id='koddaerah' value="{{ $customer_info['koddaerah'] }}" class='form-control'>
|
||||
</div>
|
||||
</div>
|
||||
<div class='form-group row col-md-12'>
|
||||
<div class='col-md-4'>
|
||||
Negeri
|
||||
</div>
|
||||
<div class='col-md-8'>
|
||||
<input type="text" readonly name='kodnegeri' id='kodnegeri' value="{{ $customer_info['kodnegeri'] }}" class='form-control'>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<div class="mr-5 form-group float-right">
|
||||
<button type="button" class="btn btn-primary" onclick="kemaskinifunc()" id="btnkemaskini">Kemaskini</button>
|
||||
<button type="button" class="btn btn-primary" id="btnotp">Daftar Akaun Online</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="opt_modal" tabindex="-1" aria-labelledby="opt_modalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered modal-lg">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="opt_modalLabel">Daftar Akaun Online</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="text-center">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-7">
|
||||
<div class="input-group my-3" id="otp_form">
|
||||
<form action="{{ route('customer.otp') }}" method="post">
|
||||
@csrf
|
||||
<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">
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-outline-primary" type="submit" id="jana_otp">Jana OTP</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div id="otp_generate" style="display:none;">
|
||||
<div class="row form-group">
|
||||
<div class="col-md-4">
|
||||
OTP Token
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<span id="otp_number"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<div class="mr-5 form-group float-right">
|
||||
<button type="button" class="btn btn-primary" onclick="kemaskinifunc()" id="btnkemaskini">Kemaskini</button>
|
||||
<button type="button" class="btn btn-primary" id="btnotp">OTP</button>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@section('content')
|
||||
<div class="container">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-12">
|
||||
<div class="col-md-12 col-lg-12">
|
||||
<a href="{{ url('/pelanggan') }}"><i class="fas fa-arrow-left"></i> Kembali</a>
|
||||
<h3 class="text-center text-uppercase">maklumat pelanggan</h3>
|
||||
|
||||
@@ -150,7 +196,7 @@
|
||||
</label>
|
||||
</div>
|
||||
<div class='col-md-3'>
|
||||
<button class='btn btn-primary' data-toggle="modal" data-target="#exampleModal">Maklumat Pelanggan</button>
|
||||
<button class='btn btn-primary' data-toggle="modal" data-target="#customer_detail">Maklumat Pelanggan</button>
|
||||
</div>
|
||||
<div class="col-md-3 text-right">
|
||||
<a class="button btn btn-primary" style="margin-right:-50px" href="{{ route('gadaian',['noic'=>$customer_info['kpbaru'] ]) }}">Daftar Gadai</a>
|
||||
@@ -283,7 +329,7 @@
|
||||
$('#btnkemaskini').addClass('btn-primary');
|
||||
$('#btnkemaskini').text('Kemaskini');
|
||||
$('#btnkemaskini').attr('onclick','kemaskinifunc()');
|
||||
$('#btnotp').text('OTP');
|
||||
$('#btnotp').text('Daftar Akuan Online');
|
||||
$('#btnotp').attr('onclick','#');
|
||||
|
||||
document.getElementById("kemaskiniform").reset();
|
||||
@@ -381,7 +427,7 @@
|
||||
$('#btnkemaskini').addClass('btn-primary');
|
||||
$('#btnkemaskini').text('Kemaskini');
|
||||
$('#btnkemaskini').attr('onclick','kemaskinifunc()');
|
||||
$('#btnotp').text('OTP');
|
||||
$('#btnotp').text('Daftar Akuan Online');
|
||||
$('#btnotp').attr('onclick','#');
|
||||
|
||||
//attribute nak readonly false
|
||||
@@ -393,6 +439,35 @@
|
||||
|
||||
}
|
||||
|
||||
$('#btnotp').click(function(){
|
||||
$('#customer_detail').modal('hide');
|
||||
var noic = $('#noic').val();
|
||||
$('#noic_otp').val(noic);
|
||||
$('#opt_modal').modal('show');
|
||||
});
|
||||
|
||||
// $('#jana_otp').click(function(){
|
||||
// var noic = $('#noic_otp').val();
|
||||
|
||||
// $.ajax({
|
||||
// method:'get',
|
||||
// url: "{{ route('customer.otp') }}",
|
||||
// data:{
|
||||
// 'noic' : noic
|
||||
// },
|
||||
// success: function(otp_token){
|
||||
// console.log(otp_token);
|
||||
// // $('#otp_form').hide();
|
||||
// // $('#otp_generate').show();
|
||||
// // $('#otp_number').text();
|
||||
// },
|
||||
// error: function(xhRequest, ErrorText, thrownError){
|
||||
// alert('Gadai Tidak Berjaya');
|
||||
// console.log(xhRequest);
|
||||
// }
|
||||
// });
|
||||
// })
|
||||
|
||||
|
||||
</script>
|
||||
@endsection
|
||||
|
||||
@@ -476,7 +476,6 @@
|
||||
'nilai_marhun' : nilaimarhun
|
||||
},
|
||||
success:function(successdata){
|
||||
alert('Tambah Marhun Berjaya');
|
||||
Swal.fire({
|
||||
icon: 'success',
|
||||
title: 'Berjaya!',
|
||||
@@ -497,7 +496,6 @@
|
||||
$('#daftar_marhun').modal('hide');
|
||||
},
|
||||
error: function(xhRequest, ErrorText, thrownError){
|
||||
// alert('Tambah Marhun Tidak Berjaya');
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'Amaran!',
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
<body onload="startTime()">
|
||||
<div id="app">
|
||||
<nav class="navbar navbar-expand-md navbar-light bg-white shadow-sm">
|
||||
<div class="container">
|
||||
<div class="container-fluid">
|
||||
<a class="navbar-brand" href="{{ url('/') }}">
|
||||
<img src="{{ asset('img/logo_arrahn_baru.png') }}" class="logo-arrahn-header" alt="Logo Ar Rahn" /> ar-rahn
|
||||
</a>
|
||||
|
||||
+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::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('/customer/otp',['as'=>'customer.otp','uses'=>'CustomersController@getOTP'])->middleware('auth','teller');
|
||||
Route::post('/customer/otp',['as'=>'customer.otp','uses'=>'CustomersController@getOTP'])->middleware('auth','teller');
|
||||
|
||||
//Penilai
|
||||
Route::get('/gadaiansemasa',['as'=>'gadaian.semasa','uses'=>'GadaianController@gadaiansemasa'])->middleware('auth','penilai');
|
||||
|
||||
Reference in New Issue
Block a user