fix wakil and imbangduga
This commit is contained in:
@@ -16,30 +16,24 @@
|
|||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
<div class="card-body text-center">
|
<div class="card-body text-center">
|
||||||
<div class="row form-group">
|
<div class="row form-group">
|
||||||
<div class="col-md-2">
|
<div class="col-md-2"></div>
|
||||||
</div>
|
<div class="col-md-15"></div>
|
||||||
<div class="col-md-15">
|
</div>
|
||||||
</div>
|
<div class="container">
|
||||||
|
<form method="post" onsubmit="loadingmodal()">
|
||||||
|
@csrf
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-2">Tarikh</div>
|
||||||
|
<div class="col-sm-4"><input type="text" class="form-control" placeholder="Pilih Tarikh" aria-label="Tarikh" id="datetimepicker2" name="datetimepicker2" autocomplete="off" aria-describedby="basic-addon1"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="container">
|
|
||||||
<form method="post">
|
|
||||||
@csrf
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-sm-2">Tarikh</div>
|
|
||||||
<div class="col-sm-4"><input type="text" class="form-control" placeholder="Pilih Tarikh" aria-label="Tarikh" id="datetimepicker2" name="datetimepicker2" autocomplete="off" aria-describedby="basic-addon1"></div>
|
|
||||||
</div>
|
|
||||||
<br>
|
<br>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
<div class="col-sm-3"></div>
|
||||||
<div class="col-sm-3"></div>
|
<div class="col-sm-1"> <input type="submit" class="btn btn-success ml-md-1" id="submit_button" name="submit_button" value="Cetak Laporan " formaction="{{route('imbangduga.cetak')}}"></div>
|
||||||
<div class="col-sm-1"> <input type="submit" class="btn btn-success ml-md-1" id="submit_button" name="submit_button" value="Cetak Laporan " formaction="{{route('imbangduga.cetak')}}">
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
</form>
|
||||||
</form>
|
</div>
|
||||||
</div><!--end section form-->
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -60,6 +54,18 @@
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function loadingmodal()
|
||||||
|
{
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Memuatkan...',
|
||||||
|
allowEscapeKey : false,
|
||||||
|
allowOutsideClick: false,
|
||||||
|
didOpen: function () {
|
||||||
|
Swal.showLoading()
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@endsection
|
@endsection
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-4">
|
<div class="col-4">
|
||||||
<input type="text" class="form-control" id="nowakil" name="nowakil" readonly/>
|
<input type="text" class="form-control" id="nowakil" name="nowakil" readonly/>
|
||||||
|
<span name="errornowakil" style="color:red;"></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -28,6 +29,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-7">
|
<div class="col-7">
|
||||||
<input type="text" class="form-control" id="nokpwakil" name="nokpwakil" readonly/>
|
<input type="text" class="form-control" id="nokpwakil" name="nokpwakil" readonly/>
|
||||||
|
<span name="errornokpwakil" style="color:red;"></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -37,6 +39,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-8">
|
<div class="col-8">
|
||||||
<input type="text" class="form-control" id="namawakil" name="namawakil"/>
|
<input type="text" class="form-control" id="namawakil" name="namawakil"/>
|
||||||
|
<span name="errornamawakil" style="color:red;"></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -47,6 +50,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-8">
|
<div class="col-8">
|
||||||
<input type="text" class="form-control" id="alamatwakil" name="alamatwakil"/>
|
<input type="text" class="form-control" id="alamatwakil" name="alamatwakil"/>
|
||||||
|
<span name="erroralamatwakil" style="color:red;"></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -56,6 +60,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-6">
|
<div class="col-6">
|
||||||
<input type="text" class="form-control" id="notelwakil" name="notelwakil"/>
|
<input type="text" class="form-control" id="notelwakil" name="notelwakil"/>
|
||||||
|
<span name="errornotelwakil" style="color:red;"></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -65,6 +70,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-8">
|
<div class="col-8">
|
||||||
<input type="text" class="form-control" name="notawakil" id="notawakil"/>
|
<input type="text" class="form-control" name="notawakil" id="notawakil"/>
|
||||||
|
<span name="errornotawakil" style="color:red;"></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -2428,7 +2428,7 @@
|
|||||||
function wakilfunction(e)
|
function wakilfunction(e)
|
||||||
{
|
{
|
||||||
let wakil = $('#wakiltxt').val();
|
let wakil = $('#wakiltxt').val();
|
||||||
console.log(wakil);
|
|
||||||
if(wakil === null || wakil === '')
|
if(wakil === null || wakil === '')
|
||||||
{
|
{
|
||||||
Swal.fire(
|
Swal.fire(
|
||||||
@@ -2460,7 +2460,7 @@
|
|||||||
allowOutsideClick: false,
|
allowOutsideClick: false,
|
||||||
allowEscapeKey: false,
|
allowEscapeKey: false,
|
||||||
allowEnterKey: false,
|
allowEnterKey: false,
|
||||||
confirmButtonText: '<i class="fa fa-thumbs-up"></i> Daftar Dulu Boss!',
|
confirmButtonText: 'Daftar',
|
||||||
icon: 'info',
|
icon: 'info',
|
||||||
title: 'Maklumat anda tiada dalam senarai wakil! Tekan button okay untuk mendaftar!'
|
title: 'Maklumat anda tiada dalam senarai wakil! Tekan button okay untuk mendaftar!'
|
||||||
}).then(function(){
|
}).then(function(){
|
||||||
@@ -2510,74 +2510,194 @@
|
|||||||
let nota = $('#notawakil').val();
|
let nota = $('#notawakil').val();
|
||||||
let nokp = $('#nokpwakil').val();
|
let nokp = $('#nokpwakil').val();
|
||||||
|
|
||||||
|
let boolnowakil = false;let boolnama = false;let boolalamat = false;let booltelefon = false;let boolnota = false;let boolnokp = false;
|
||||||
|
|
||||||
if(nowakil === null || nowakil === '')
|
if(nowakil === null || nowakil === '')
|
||||||
{
|
{
|
||||||
Swal.fire(
|
$("[name='errornowakil']").show();
|
||||||
'Amaran!',
|
$("[name='errornowakil']").text("*No wakil tidak dijana lagi!");
|
||||||
'Sila tunggu no wakil untuk proses dahulu sebelum tekan terima!',
|
$("[name='nowakil']").addClass('is-invalid');
|
||||||
'error'
|
|
||||||
)
|
boolnowakil = true;
|
||||||
|
}else{
|
||||||
|
$("[name='errornowakil']").hide();
|
||||||
|
$("[name='nowakil']").removeClass('is-invalid');
|
||||||
|
|
||||||
|
boolnowakil = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(nama === null || nama === '')
|
||||||
|
{
|
||||||
|
$("[name='errornamawakil']").show();
|
||||||
|
$("[name='errornamawakil']").text("*Isikan nama dalam kotak!");
|
||||||
|
$("[name='namawakil']").addClass('is-invalid');
|
||||||
|
|
||||||
|
boolnama = true;
|
||||||
|
}else{
|
||||||
|
$("[name='errornamawakil']").hide();
|
||||||
|
$("[name='namawakil']").removeClass('is-invalid');
|
||||||
|
|
||||||
|
boolnama = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(alamat === null || alamat === '')
|
||||||
|
{
|
||||||
|
$("[name='erroralamatwakil']").show();
|
||||||
|
$("[name='erroralamatwakil']").text("*Isikan alamat dalam kotak!");
|
||||||
|
$("[name='alamatwakil']").addClass('is-invalid');
|
||||||
|
|
||||||
|
boolalamat = true;
|
||||||
|
}else{
|
||||||
|
$("[name='erroralamatwakil']").hide();
|
||||||
|
$("[name='alamatwakil']").removeClass('is-invalid');
|
||||||
|
|
||||||
|
boolalamat = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(telefon === null || telefon === '')
|
||||||
|
{
|
||||||
|
$("[name='errornotelwakil']").show();
|
||||||
|
$("[name='errornotelwakil']").text("*Isikan telefon dalam kotak!");
|
||||||
|
$("[name='notelwakil']").addClass('is-invalid');
|
||||||
|
|
||||||
|
booltelefon = true;
|
||||||
|
}else{
|
||||||
|
$("[name='errornotelwakil']").hide();
|
||||||
|
$("[name='notelwakil']").removeClass('is-invalid');
|
||||||
|
|
||||||
|
booltelefon = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(nota === null || nota === '')
|
||||||
|
{
|
||||||
|
$("[name='errornotawakil']").show();
|
||||||
|
$("[name='errornotawakil']").text("*Isikan nota dalam kotak!");
|
||||||
|
$("[name='notawakil']").addClass('is-invalid');
|
||||||
|
|
||||||
|
boolnota = true;
|
||||||
|
}else{
|
||||||
|
$("[name='errornotawakil']").hide();
|
||||||
|
$("[name='notawakil']").removeClass('is-invalid');
|
||||||
|
|
||||||
|
boolnota = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(nokp === null || nokp === '')
|
||||||
|
{
|
||||||
|
$("[name='errornokpwakil']").show();
|
||||||
|
$("[name='errornokpwakil']").text("*Isikan nokp dalam kotak!");
|
||||||
|
$("[name='nokpwakil']").addClass('is-invalid');
|
||||||
|
|
||||||
|
boolnokp = true;
|
||||||
|
}else{
|
||||||
|
$("[name='errornokpwakil']").hide();
|
||||||
|
$("[name='nokpwakil']").removeClass('is-invalid');
|
||||||
|
|
||||||
|
boolnokp = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(boolnowakil == false && boolnama == false && boolalamat == false && booltelefon == false && boolnota == false && boolnokp == false)
|
||||||
|
{
|
||||||
|
$.ajax({
|
||||||
|
method:'POST',
|
||||||
|
url: "{{ route('wakil.create') }}",
|
||||||
|
data:{
|
||||||
|
"_token": "{{ csrf_token() }}",
|
||||||
|
"nopelanggan" : nopelanggan,
|
||||||
|
"nowakil" : nowakil,
|
||||||
|
"nama" : nama,
|
||||||
|
"hubungan" : hubungan,
|
||||||
|
"alamat" : alamat,
|
||||||
|
"telefon" : telefon,
|
||||||
|
"nota" : nota,
|
||||||
|
"icno" : nokp
|
||||||
|
},
|
||||||
|
success:function(data){
|
||||||
|
|
||||||
|
if(data == 1)
|
||||||
|
{
|
||||||
|
$('#WakilModal').hide();
|
||||||
|
$('#WakilModal').modal('hide');
|
||||||
|
nw = nowakil;
|
||||||
|
Swal.fire({
|
||||||
|
allowOutsideClick: false,
|
||||||
|
allowEscapeKey: false,
|
||||||
|
allowEnterKey: false,
|
||||||
|
confirmButtonText: '<i class="fa fa-thumbs-up"></i> Baik Boss!',
|
||||||
|
icon: 'success',
|
||||||
|
title: 'Berjaya Mendaftar Wakil Pelanggan!'
|
||||||
|
}).then(function(){
|
||||||
|
$('#wakiltxt').prop( "disabled", true );
|
||||||
|
$('#caribtn').html("Ubah");
|
||||||
|
$('#caribtn').attr("onclick","ubahwakil(this)");
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
},error: function (request, status, error) {
|
||||||
|
console.log(request.responseText);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return true;
|
||||||
|
|
||||||
|
}else{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$.ajax({
|
|
||||||
method:'POST',
|
|
||||||
url: "{{ route('wakil.create') }}",
|
|
||||||
data:{
|
|
||||||
"_token": "{{ csrf_token() }}",
|
|
||||||
"nopelanggan" : nopelanggan,
|
|
||||||
"nowakil" : nowakil,
|
|
||||||
"nama" : nama,
|
|
||||||
"hubungan" : hubungan,
|
|
||||||
"alamat" : alamat,
|
|
||||||
"telefon" : telefon,
|
|
||||||
"nota" : nota,
|
|
||||||
"icno" : nokp
|
|
||||||
},
|
|
||||||
success:function(data){
|
|
||||||
|
|
||||||
if(data == 1)
|
|
||||||
{
|
|
||||||
$('#WakilModal').hide();
|
|
||||||
$('#WakilModal').modal('hide');
|
|
||||||
nw = nowakil;
|
|
||||||
Swal.fire({
|
|
||||||
allowOutsideClick: false,
|
|
||||||
allowEscapeKey: false,
|
|
||||||
allowEnterKey: false,
|
|
||||||
confirmButtonText: '<i class="fa fa-thumbs-up"></i> Baik Boss!',
|
|
||||||
icon: 'success',
|
|
||||||
title: 'Berjaya Mendaftar Wakil Pelanggan!'
|
|
||||||
}).then(function(){
|
|
||||||
$('#wakiltxt').prop( "disabled", true );
|
|
||||||
$('#caribtn').html("Ubah");
|
|
||||||
$('#caribtn').attr("onclick","ubahwakil(this)");
|
|
||||||
|
|
||||||
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
},error: function (request, status, error) {
|
|
||||||
console.log(request.responseText);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$('#WakilModal').on('hidden.bs.modal', function (e) {
|
||||||
|
|
||||||
|
$("[name='errornowakil']").hide();
|
||||||
|
$("[name='nowakil']").removeClass('is-invalid');
|
||||||
|
|
||||||
|
$("[name='errornamawakil']").hide();
|
||||||
|
$("[name='namawakil']").removeClass('is-invalid');
|
||||||
|
|
||||||
|
$("[name='erroralamatwakil']").hide();
|
||||||
|
$("[name='alamatwakil']").removeClass('is-invalid');
|
||||||
|
|
||||||
|
$("[name='errornotelwakil']").hide();
|
||||||
|
$("[name='notelwakil']").removeClass('is-invalid');
|
||||||
|
|
||||||
|
$("[name='errornotawakil']").hide();
|
||||||
|
$("[name='notawakil']").removeClass('is-invalid');
|
||||||
|
|
||||||
|
$("[name='errornokpwakil']").hide();
|
||||||
|
$("[name='nokpwakil']").removeClass('is-invalid');
|
||||||
|
|
||||||
|
$(this).find(".invalid-feedback").hide();
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
function daftarfunction(id)
|
function daftarfunction(id)
|
||||||
{
|
{
|
||||||
$('#nokpwakil').val(id);
|
$('#nokpwakil').val(id);
|
||||||
|
|
||||||
$.ajax({
|
|
||||||
|
$.ajax({
|
||||||
method:'GET',
|
method:'GET',
|
||||||
url: "{{ route('wakil.caricustomer') }}",
|
url: "{{ route('wakil.caricustomer') }}",
|
||||||
data:{ "icno" : id },
|
data:{ "icno" : id },
|
||||||
success:function(data){
|
success:function(data){
|
||||||
|
|
||||||
$('#WakilModal').modal();
|
|
||||||
$('#namawakil').val('');
|
$('#namawakil').val('');
|
||||||
$('#alamatwakil').val(data['']);
|
$('#alamatwakil').val(data['']);
|
||||||
$('#notelwakil').val(data['']);
|
$('#notelwakil').val(data['']);
|
||||||
|
|
||||||
|
if(data != 'no-data')
|
||||||
|
{
|
||||||
|
$('#namawakil').val(data['nama']);
|
||||||
|
$('#alamatwakil').val(data['alamat1']);
|
||||||
|
$('#notelwakil').val(data['telefon']);
|
||||||
|
$('#nopelangganwakil').val(data['nopelanggan']);
|
||||||
|
}
|
||||||
|
|
||||||
//get first wakil
|
//get first wakil
|
||||||
$.ajax({
|
$.ajax({
|
||||||
method:'GET',
|
method:'GET',
|
||||||
@@ -2587,22 +2707,34 @@
|
|||||||
let firstwakil = parseInt(getfirstwakil);
|
let firstwakil = parseInt(getfirstwakil);
|
||||||
|
|
||||||
$('#nowakil').val(firstwakil+1);
|
$('#nowakil').val(firstwakil+1);
|
||||||
|
|
||||||
|
Swal.close();
|
||||||
|
$('#WakilModal').modal();
|
||||||
|
|
||||||
|
},error: function (request, status, error) {
|
||||||
|
console.log(request.responseText);
|
||||||
|
Swal.close();
|
||||||
|
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Punyai Ralat dalam API wakil...',
|
||||||
|
icon: 'error'
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
|
|
||||||
if(data != 'no-data')
|
|
||||||
{
|
|
||||||
$('#namawakil').val(data['nama']);
|
|
||||||
$('#alamatwakil').val(data['alamat1']);
|
|
||||||
$('#notelwakil').val(data['telefon']);
|
|
||||||
$('#nopelangganwakil').val(data['nopelanggan']);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
},error: function (request, status, error) {
|
},error: function (request, status, error) {
|
||||||
console.log(request.responseText);
|
console.log(request.responseText);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Memuatkan...',
|
||||||
|
allowEscapeKey : false,
|
||||||
|
allowOutsideClick: false,
|
||||||
|
didOpen: function () {
|
||||||
|
Swal.showLoading()
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user