verify marhun verify register
This commit is contained in:
@@ -14,13 +14,13 @@
|
||||
<div class="card-body">
|
||||
<div class="text-center">
|
||||
<h5 class="text-uppercase">masukkan nombor kad pengenalan</h5>
|
||||
<form name="frmsearch" action="{{ route('customer.search') }}" method="GET" onsubmit="verifyIC()">
|
||||
<form name="frmsearch" action="{{ route('customer.search') }}" method="GET">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-7">
|
||||
<div class="input-group my-3">
|
||||
<input type="text" class="form-control" name="noic" placeholder="No Kad Pengenalan Pelanggan" aria-label="No Kad Pengenalan Pelanggan" autocomplete="off" value="{{$search == false ? '' : $noic ?? ''}}" aria-describedby="button-addon2">
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-outline-primary" type="submit" id="button-addon2">Sahkan</button>
|
||||
<button class="btn btn-outline-primary" type="submit" id="button-addon2">Cari</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -44,7 +44,7 @@
|
||||
<h5 class="modal-title" id="ModalLabel">Daftar Pelanggan</h5>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form action="{{ route('customer.store') }}" method="POST">
|
||||
<form action="{{ route('customer.store') }}" onsubmit="verifycustomer()" method="POST">
|
||||
@csrf
|
||||
<div class="row form-group">
|
||||
<div class="col-md-6">
|
||||
@@ -249,15 +249,113 @@
|
||||
});
|
||||
});
|
||||
|
||||
function verifyIC()
|
||||
{
|
||||
var a = $('input[name="noic"]').val();
|
||||
|
||||
|
||||
function verifycustomer(){
|
||||
var customername = $('#name').val();
|
||||
var customeralamat = $('#alamat').val();
|
||||
var customerposkod = $('#poskod').val();
|
||||
var customerphone = $('#main_phone').val();
|
||||
var customerphone_alternate = $('#alternate_phone').val();
|
||||
|
||||
if(customername == ''){
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'Amaran!',
|
||||
text: 'Sila Masukkan Nama Pelanggan'
|
||||
});
|
||||
event.preventDefault();
|
||||
return false;
|
||||
}
|
||||
if(customeralamat == ''){
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'Amaran!',
|
||||
text: 'Sila Masukkan Alamat Pelanggan'
|
||||
});
|
||||
event.preventDefault();
|
||||
return false;
|
||||
}
|
||||
if(customerposkod == ''){
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'Amaran!',
|
||||
text: 'Sila Masukkan Poskod'
|
||||
});
|
||||
event.preventDefault();
|
||||
return false;
|
||||
}else{
|
||||
if(customerposkod.length != 5){
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'Amaran!',
|
||||
text: 'Sila Periksa Poskod'
|
||||
});
|
||||
event.preventDefault();
|
||||
return false;
|
||||
}else{
|
||||
if($.isNumeric(customerposkod) == false){
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'Amaran!',
|
||||
text: 'Sila Periksa Poskod'
|
||||
});
|
||||
event.preventDefault();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(customerphone == ''){
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'Amaran!',
|
||||
text: 'Sila Masukkan No Telefon Pelanggan'
|
||||
});
|
||||
event.preventDefault();
|
||||
return false;
|
||||
}else{
|
||||
if(customerphone.length < 8 && customerphone.length > 12){
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'Amaran!',
|
||||
text: 'Sila Periksa No Telefon Pelanggan'
|
||||
});
|
||||
event.preventDefault();
|
||||
return false;
|
||||
}else{
|
||||
if($.isNumeric(customerphone) == false){
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'Amaran!',
|
||||
text: 'Sila Masukkan Nombor Sahaja Pada No Telefon Pelanggan'
|
||||
});
|
||||
event.preventDefault();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(customerphone_alternate != ''){
|
||||
if(customerphone_alternate.length < 8 && customerphone_alternate.length > 12){
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'Amaran!',
|
||||
text: 'Sila Periksa No Telefon Pelanggan'
|
||||
});
|
||||
event.preventDefault();
|
||||
return false;
|
||||
}else{
|
||||
if($.isNumeric(customerphone_alternate) == false){
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'Amaran!',
|
||||
text: 'Sila Masukkan Nombor Sahaja Pada No Telefon Pelanggan'
|
||||
});
|
||||
event.preventDefault();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
function identifyIC(noic){
|
||||
if(noic.match(/^(\d{2})(\d{2})(\d{2})-?\d{2}-?\d{4}$/)) {
|
||||
var year = noic.slice(0,2);
|
||||
|
||||
@@ -409,48 +409,77 @@
|
||||
$('#daftar_marhun').modal('hide');
|
||||
}
|
||||
else{
|
||||
$.ajax({
|
||||
method:'POST',
|
||||
url: api_url + '/api/marhun/'+kodcaw,
|
||||
dataType:'json',
|
||||
data:{
|
||||
'norujukan': norujukan,
|
||||
'marhun' : marhun,
|
||||
'nota':nota,
|
||||
'karat' : karat,
|
||||
'berat_emas' :berat_emas,
|
||||
'harga' : harga,
|
||||
'nilai_marhun' : nilai_marhun
|
||||
},
|
||||
success:function(successdata){
|
||||
Swal.fire({
|
||||
icon: 'success',
|
||||
title: 'Berjaya!',
|
||||
text: 'Tambah Marhun Berjaya'
|
||||
});
|
||||
$('#nota').val('').trigger("change");
|
||||
$('#marhun').val(0);
|
||||
$('#karat').val(0);
|
||||
$('#berat_emas').val("");
|
||||
$('#harga').val("");
|
||||
$('#nilai_marhun').val("");
|
||||
|
||||
jumlah_marhun += 1;
|
||||
jumlah_nilai_marhun += Number(nilai_marhun);
|
||||
$('#bilangan_marhun').val(formatter.format(jumlah_marhun));
|
||||
$('#jumlah_nilai_marhun').val(formatter.format(jumlah_nilai_marhun));
|
||||
getMarhun(norujukan);
|
||||
$('#daftar_marhun').modal('hide');
|
||||
},
|
||||
error: function(xhRequest, ErrorText, thrownError){
|
||||
if(marhun == null){
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'Amaran!',
|
||||
text: 'Sila Pilih Marhun'
|
||||
});
|
||||
event.preventDefault();
|
||||
return false;
|
||||
}else{
|
||||
if(karat == null){
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'Amaran!',
|
||||
text: 'Tambah Marhun Tidak Berjaya'
|
||||
text: 'Sila Pilih Karat'
|
||||
});
|
||||
console.log(xhRequest);
|
||||
event.preventDefault();
|
||||
return false;
|
||||
}else{
|
||||
if($.isNumeric(berat_emas) == false){
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'Amaran!',
|
||||
text: 'Sila Masukkan Berat Marhun'
|
||||
});
|
||||
event.preventDefault();
|
||||
return false;
|
||||
}else{
|
||||
$.ajax({
|
||||
method:'POST',
|
||||
url: api_url + '/api/marhun/'+kodcaw,
|
||||
dataType:'json',
|
||||
data:{
|
||||
'norujukan': norujukan,
|
||||
'marhun' : marhun,
|
||||
'nota':nota,
|
||||
'karat' : karat,
|
||||
'berat_emas' :berat_emas,
|
||||
'harga' : harga,
|
||||
'nilai_marhun' : nilai_marhun
|
||||
},
|
||||
success:function(data){
|
||||
Swal.fire({
|
||||
icon: 'success',
|
||||
title: 'Berjaya!',
|
||||
text: 'Tambah Marhun Berjaya'
|
||||
});
|
||||
$('#nota').val('').trigger("change");
|
||||
$('#marhun').val(0);
|
||||
$('#karat').val(0);
|
||||
$('#berat_emas').val("");
|
||||
$('#harga').val("");
|
||||
$('#nilai_marhun').val("");
|
||||
|
||||
jumlah_marhun += 1;
|
||||
jumlah_nilai_marhun += Number(nilai_marhun);
|
||||
$('#bilangan_marhun').val(formatter.format(jumlah_marhun));
|
||||
$('#jumlah_nilai_marhun').val(formatter.format(jumlah_nilai_marhun));
|
||||
getMarhun(norujukan);
|
||||
},
|
||||
error: function(xhRequest, ErrorText, thrownError){
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'Amaran!',
|
||||
text: 'Tambah Marhun Tidak Berjaya'
|
||||
});
|
||||
console.log(xhRequest);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -464,54 +493,85 @@
|
||||
var nilaimarhun = $('#nilai_marhun').val();
|
||||
var nilai_marhun = Number(nilaimarhun.replace(/[^0-9.-]+/g,""));
|
||||
var nota_array = $('#nota').val();
|
||||
console.log($.isNumeric(berat_emas));
|
||||
if(nota_array != null){
|
||||
var nota = nota_array.toString();
|
||||
}else{
|
||||
var nota = '';
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
method:'POST',
|
||||
url: api_url + '/api/marhun/'+kodcaw,
|
||||
dataType:'json',
|
||||
data:{
|
||||
'norujukan': norujukan,
|
||||
'marhun' : marhun,
|
||||
'nota':nota,
|
||||
'karat' : karat,
|
||||
'berat_emas' :berat_emas,
|
||||
'harga' : harga,
|
||||
'nilai_marhun' : nilai_marhun
|
||||
},
|
||||
success:function(data){
|
||||
Swal.fire({
|
||||
icon: 'success',
|
||||
title: 'Berjaya!',
|
||||
text: 'Tambah Marhun Berjaya'
|
||||
});
|
||||
$('#nota').val('').trigger("change");
|
||||
$('#marhun').val(0);
|
||||
$('#karat').val(0);
|
||||
$('#berat_emas').val("");
|
||||
$('#harga').val("");
|
||||
$('#nilai_marhun').val("");
|
||||
|
||||
jumlah_marhun += 1;
|
||||
jumlah_nilai_marhun += Number(nilai_marhun);
|
||||
$('#bilangan_marhun').val(formatter.format(jumlah_marhun));
|
||||
$('#jumlah_nilai_marhun').val(formatter.format(jumlah_nilai_marhun));
|
||||
getMarhun(norujukan);
|
||||
},
|
||||
error: function(xhRequest, ErrorText, thrownError){
|
||||
if(marhun == null){
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'Amaran!',
|
||||
text: 'Sila Pilih Marhun'
|
||||
});
|
||||
event.preventDefault();
|
||||
return false;
|
||||
}else{
|
||||
if(karat == null){
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'Amaran!',
|
||||
text: 'Tambah Marhun Tidak Berjaya'
|
||||
text: 'Sila Pilih Karat'
|
||||
});
|
||||
console.log(xhRequest);
|
||||
event.preventDefault();
|
||||
return false;
|
||||
}else{
|
||||
if($.isNumeric(berat_emas) == false){
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'Amaran!',
|
||||
text: 'Sila Masukkan Berat Marhun'
|
||||
});
|
||||
event.preventDefault();
|
||||
return false;
|
||||
}else{
|
||||
$.ajax({
|
||||
method:'POST',
|
||||
url: api_url + '/api/marhun/'+kodcaw,
|
||||
dataType:'json',
|
||||
data:{
|
||||
'norujukan': norujukan,
|
||||
'marhun' : marhun,
|
||||
'nota':nota,
|
||||
'karat' : karat,
|
||||
'berat_emas' :berat_emas,
|
||||
'harga' : harga,
|
||||
'nilai_marhun' : nilai_marhun
|
||||
},
|
||||
success:function(data){
|
||||
Swal.fire({
|
||||
icon: 'success',
|
||||
title: 'Berjaya!',
|
||||
text: 'Tambah Marhun Berjaya'
|
||||
});
|
||||
$('#nota').val('').trigger("change");
|
||||
$('#marhun').val(0);
|
||||
$('#karat').val(0);
|
||||
$('#berat_emas').val("");
|
||||
$('#harga').val("");
|
||||
$('#nilai_marhun').val("");
|
||||
|
||||
jumlah_marhun += 1;
|
||||
jumlah_nilai_marhun += Number(nilai_marhun);
|
||||
$('#bilangan_marhun').val(formatter.format(jumlah_marhun));
|
||||
$('#jumlah_nilai_marhun').val(formatter.format(jumlah_nilai_marhun));
|
||||
getMarhun(norujukan);
|
||||
},
|
||||
error: function(xhRequest, ErrorText, thrownError){
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'Amaran!',
|
||||
text: 'Tambah Marhun Tidak Berjaya'
|
||||
});
|
||||
console.log(xhRequest);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
});
|
||||
|
||||
function verifyGadai(func){
|
||||
var kodcaw = $('#kodcaw').val();
|
||||
|
||||
Reference in New Issue
Block a user