fix kemaskini button aliran tunai v3

This commit is contained in:
fifi97
2021-05-10 00:15:53 +08:00
parent bd232b3201
commit 6e1e785216
2 changed files with 59 additions and 92 deletions
+31 -80
View File
@@ -283,37 +283,6 @@
var tele = "{{ $auth_user['name'] }}";
// function kemaskiniupah()
// {
// $.ajax({
// type: 'get',
// url: "{{ route('kemaskini.upah') }}",
// // data: { "namateller" : tele },
// success: function(data){
// console.log(data);
// if(data == 1)
// {
// Swal.fire({
// icon: 'success',
// title: 'Kemaskini!',
// text: 'Proses Kemaskini!'
// }).then(function() {
// location.reload();
// });
// }else{
// Swal.fire({
// icon: 'warning',
// title: 'Peringatan',
// text: 'Telah Dikemaskini!'
// });
// }
// }
// });
// }
function periksaalirantunai()
{
@@ -321,7 +290,6 @@
type: 'get',
url: "{{ route('periksa.alirantunai') }}",
success: function(balasbalik){
console.log(balasbalik);
if(balasbalik == 'sama')
{
Swal.fire({
@@ -332,60 +300,43 @@
}else{
Swal.fire({
title: 'Kemaskini aliran tunai?',
html:
'<div class="col-12"><h4 class="btn btn-success col-12 mr-2 font-weight-bold">Pendahuluan : RM ' + formatter.format(balasbalik['pendahuluan']) + '</h4>' +
'<h4 class="btn btn-danger col-12 font-weight-bold">Serahan : RM ' + formatter.format(balasbalik['serahan']) + '</h4></div>' +
'<div class="col-12"><h4 class="btn btn-success col-12 mr-2 font-weight-bold">Tebus : RM ' + formatter.format(balasbalik['penebusan']) + '</h4>' +
'<h4 class="btn btn-danger col-12 font-weight-bold">Gadai : RM ' + formatter.format(balasbalik['gadaian']) + '</h4></div>' +
'<h4 class="btn btn-info font-weight-bold col-12">Baki : RM ' + formatter.format(balasbalik['bakisemasa']) + '</h4>',
showCancelButton: true,
confirmButtonText: `Kemaskini`,
cancelButtonText: 'Batal'
}).then((result) => {
if (result.isConfirmed) {
$.ajax({
type: 'get',
url: "{{ route('kemaskini.alirantunai') }}",
data: { "bakiakhir" : balasbalik['bakisemasa'],
"pendahuluan" : balasbalik['pendahuluan'],
"serahan" : balasbalik['serahan'],
"gadaian" : balasbalik['gadaian'],
"penebusan" : balasbalik['penebusan']
},
success: function(balas){
console.log(balas);
if(balas == 'berjaya')
{
Swal.fire({
icon: 'success',
title: 'Berjaya',
text: 'Kemaskini Berjaya!',
closeOnClickOutside: false
}).then(function() {
location.reload();
});
$.ajax({
type: 'get',
url: "{{ route('kemaskini.alirantunai') }}",
data: { "bakiakhir" : balasbalik['bakisemasa'],
"pendahuluan" : balasbalik['pendahuluan'],
"serahan" : balasbalik['serahan'],
"gadaian" : balasbalik['gadaian'],
"penebusan" : balasbalik['penebusan']
},
success: function(balas){
if(balas == 'berjaya')
{
Swal.fire({
icon: 'success',
title: 'Berjaya',
text: 'Kemaskini Berjaya!',
closeOnClickOutside: false
}).then(function() {
location.reload();
});
}else{
Swal.fire({
icon: 'danger',
title: 'Tidak Berjaya',
text: 'Kemaskini tidak berjaya!',
closeOnClickOutside: false
}).then(function() {
location.reload();
});
}
}
}else{
Swal.fire({
icon: 'danger',
title: 'Tidak Berjaya',
text: 'Kemaskini tidak berjaya!',
closeOnClickOutside: false
}).then(function() {
location.reload();
});
}
});
}
});
}
}
}
});
}