fix sweet alert

This commit is contained in:
afiq
2021-02-10 12:44:28 +08:00
parent dc3b466e01
commit e4019f662e
6 changed files with 1130 additions and 1366 deletions
+2 -2
View File
@@ -901,8 +901,8 @@
}, 3000);
}else if (result.dismiss === Swal.DismissReason.cancel) {
swalWithBootstrapButtons.fire(
'Cancelled',
'Your imaginary file is safe :)',
'Batal',
'Maklumat Gadaian Tidak Berjaya Dihapuskan',
'error'
)
}
+170 -207
View File
@@ -222,30 +222,28 @@
</div>
<script>
var api_url = "<?php echo $api_url ?>";
$('form input').keydown(function (e) {
if (e.keyCode == 13) {
e.preventDefault();
return false;
}
});
function disableF5(e) { if ((e.which || e.keyCode) == 116) e.preventDefault(); };
$(document).ready( function () {
$.ajax({
method: 'get',
url: api_url + '/api/marhun/' + "{{ $norujukan }}",
success:function(data)
{
success:function(data){
let count = 0;
let jumlah = 0;
$.each(data,function(index,marhun)
{
$.each(marhun,function(index,mar)
{
$.each(data,function(index,marhun){
$.each(marhun,function(index,mar){
jumlah += Number(mar['n_marhun']);
count++;
})
})
$('#bilangan_marhun').val(count);
$('#jumlah_nilai_marhun').val(formatter.format(jumlah));
}
});
@@ -387,11 +385,9 @@
});
});
if (count == 1)
{
if (count == 1){
$('.buttonpunya').html("<button onclick='editmarhun(this)' class='btn btn-primary'><i class='fas fa-edit'></i></button>");
}
if(total_nilai_marhun > 0 && total_nilai_marhun < 401){
kadarupah = 1.25/100;
@@ -438,8 +434,7 @@
});
}
function deletemarhun(e)
{
function deletemarhun(e){
let marhun = $(e).closest('tr').children('td:eq(1)').text();let selectedrow = $(e).closest('tr');let recnozz = tablemarhun.row(selectedrow).data();
let norujuk = $('#norujukan').val();
@@ -451,24 +446,20 @@
"norujukan" : norujuk,
"recno" : recnozz[1]
},
success:function(data)
{
console.log(data);
success:function(data){
location.reload();
},error: function(xhr, status, error) {
var err = eval("(" + xhr.responseText + ")");
alert(xhr.responseText);
var err = eval("(" + xhr.responseText + ")");
alert(xhr.responseText);
}
});
}
function editmarhun(e)
{
function editmarhun(e){
let norujuk = $('#norujukan').val();let selectedrow = $(e).closest('tr');let recno = tablemarhun.row(selectedrow).data();
let nm = recno[3];let karat = recno[4];let berat = recno[5];
let harga = recno[7];
$('#sltkarat').val(karat);
$('#berat').val(berat);
$('#nilaimarhun').val(nm.substring(2));
@@ -488,8 +479,7 @@
$('#harga1').val(hargaref);
});
function calculationharga(e)
{
function calculationharga(e){
let berat = $(e).val();
let total = 0;
let harga = $('#harga1').val();
@@ -497,7 +487,6 @@
total = berat * harga;
$('#nilaimarhun').val(total.toFixed(2));
}
$('#pinjaman').on('input',function(){
@@ -757,16 +746,8 @@
}
else{
if(pinjaman > Number(pembiyaan_max_pelulus)+10){
// Swal.fire({
// icon: 'error',
// title: 'Amaran!',
// text: 'Pembiayaan Memerlukan Kelulusan Operasi'
// });
// event.preventDefault();
// return false;
const swalWithBootstrapButtons = Swal.mixin
({
const swalWithBootstrapButtons = Swal.mixin({
customClass: {
confirmButton: 'btn btn-success',
cancelButton: 'btn btn-danger'
@@ -775,111 +756,101 @@
})
swalWithBootstrapButtons.fire({
title: 'Dapatkan Pengesahan Daripada Operasi?',
text: "Tetapan margin melebihi 75% untuk Operasi!",
icon: 'info',
showCancelButton: true,
confirmButtonText: 'Setuju!',
cancelButtonText: 'Batal',
reverseButtons: true
title: 'Dapatkan Pengesahan Daripada Operasi?',
text: "Tetapan margin melebihi 75% untuk Operasi!",
icon: 'info',
showCancelButton: true,
confirmButtonText: 'Setuju!',
cancelButtonText: 'Batal',
reverseButtons: true
}).then((result) => {
if (result.isConfirmed) {
let norujukan = $('#norujukan').val();
if (result.isConfirmed) {
let norujukan = $('#norujukan').val();
Swal.fire({
title: 'Tunggu Pengesahan Daripada Operasi.',
icon: 'info',
width: 600,
padding: '3em',
background: '#fffff',
showCancelButton: false,
showConfirmButton: false,
allowOutsideClick: false,
allowEscapeKey: false,
allowEnterKey: false
Swal.fire({
title: 'Tunggu Pengesahan Daripada Operasi.',
icon: 'info',
width: 600,
padding: '3em',
background: '#fffff',
showCancelButton: false,
showConfirmButton: false,
allowOutsideClick: false,
allowEscapeKey: false,
allowEnterKey: false
})
$.ajax({
method:'post',
url: "{{ route('operasi.createkelulusan') }}",
data: {
"_token": "{{ csrf_token() }}",
"norujukan" : norujukan
// "teller" : teller,
// "dategadai" : dategadai,
// "bilgadai" : noic,
// "jumpinjam" : jumpinjam,
// "teller" : teller
method:'post',
url: "{{ route('operasi.createkelulusan') }}",
data: {
"_token": "{{ csrf_token() }}",
"norujukan" : norujukan
// "teller" : teller,
// "dategadai" : dategadai,
// "bilgadai" : noic,
// "jumpinjam" : jumpinjam,
// "teller" : teller
},
success:function(data){
console.log(data);
},error: function(xhr, status, error) {
var err = eval("(" + xhr.responseText + ")");
alert(xhr.responseText);
}
});
//TIME INTERVAL
let timerInterval;
timerInterval = setInterval(function(){
$.ajax({
method:'get',
url: "{{ route('operasi.getkelulusan') }}",
data: {
"norujukan" : norujukan
},
success:function(data){
console.log(data);
if(data != '')
{
clearInterval(timerInterval);
Swal.fire({
icon: 'success',
title: 'Anda Berjaya Menerima Pengesahan'
}).then(function(){
$(func).attr("onSubmit","return true;");
$(func).submit();
return true;
});
}
},error: function(xhr, status, error) {
var err = eval("(" + xhr.responseText + ")");
alert(xhr.responseText);
}
});
//TIME INTERVAL
let timerInterval;
timerInterval = setInterval(function()
{
$.ajax({
method:'get',
url: "{{ route('operasi.getkelulusan') }}",
data: {
"norujukan" : norujukan
},
success:function(data){
if(data != '')
{
clearInterval(timerInterval);
Swal.fire({
icon: 'success',
title: 'Anda Berjaya Menerima Pengesahan'
}).then(function(){
$(func).attr("onSubmit","return true;");
$(func).submit();
return true;
});
}
},error: function(xhr, status, error) {
var err = eval("(" + xhr.responseText + ")");
alert(xhr.responseText);
}
});
}, 3000);
} else if (
/* Read more about handling dismissals below */
result.dismiss === Swal.DismissReason.cancel
) {
swalWithBootstrapButtons.fire(
'Cancelled',
'Your imaginary file is safe :)',
'error'
)
}
}, 3000);
} else if (result.dismiss === Swal.DismissReason.cancel){
swalWithBootstrapButtons.fire(
'Batal',
'Malumat Gadaian Tidak Berjaya Disimpan',
'error'
)
}
});
event.preventDefault();
return false;
event.preventDefault();
return false;
}else if(pinjaman > Number(pembiayaan_max_teller)+10){
const swalWithBootstrapButtons = Swal.mixin
({
const swalWithBootstrapButtons = Swal.mixin({
customClass: {
confirmButton: 'btn btn-success',
cancelButton: 'btn btn-danger'
@@ -888,107 +859,99 @@
})
swalWithBootstrapButtons.fire({
title: 'Dapatkan Pengesahan Daripada Khazanah?',
text: "Tetapan margin melebihi 70% untuk Khazanah!",
icon: 'info',
showCancelButton: true,
confirmButtonText: 'Setuju!',
cancelButtonText: 'Batal',
reverseButtons: true
title: 'Dapatkan Pengesahan Daripada Khazanah?',
text: "Tetapan margin melebihi 70% untuk Khazanah!",
icon: 'info',
showCancelButton: true,
confirmButtonText: 'Setuju!',
cancelButtonText: 'Batal',
reverseButtons: true
}).then((result) => {
if (result.isConfirmed) {
if (result.isConfirmed) {
let norujukan = $('#norujukan').val();
let norujukan = $('#norujukan').val();
Swal.fire({
title: 'Tunggu Pengesahan Daripada Khazanah.',
icon: 'info',
width: 600,
padding: '3em',
background: '#fffff',
showCancelButton: false,
showConfirmButton: false,
allowOutsideClick: false,
allowEscapeKey: false,
allowEnterKey: false
Swal.fire({
title: 'Tunggu Pengesahan Daripada Khazanah.',
icon: 'info',
width: 600,
padding: '3em',
background: '#fffff',
showCancelButton: false,
showConfirmButton: false,
allowOutsideClick: false,
allowEscapeKey: false,
allowEnterKey: false
})
$.ajax({
method:'post',
url: "{{ route('khazanah.createkelulusan') }}",
data: {
"_token": "{{ csrf_token() }}",
"norujukan" : norujukan
// "teller" : teller,
// "dategadai" : dategadai,
// "bilgadai" : noic,
// "jumpinjam" : jumpinjam,
// "teller" : teller
method:'post',
url: "{{ route('khazanah.createkelulusan') }}",
data: {
"_token": "{{ csrf_token() }}",
"norujukan" : norujukan
// "teller" : teller,
// "dategadai" : dategadai,
// "bilgadai" : noic,
// "jumpinjam" : jumpinjam,
// "teller" : teller
},
success:function(data){
console.log(data);
},error: function(xhr, status, error) {
var err = eval("(" + xhr.responseText + ")");
alert(xhr.responseText);
}
});
//TIME INTERVAL
let timerInterval;
timerInterval = setInterval(function(){
$.ajax({
method:'get',
url: "{{ route('khazanah.getkelulusan') }}",
data: {
"norujukan" : norujukan
},
success:function(data){
console.log(data);
if(data != '')
{
clearInterval(timerInterval);
Swal.fire({
icon: 'success',
title: 'Anda Berjaya Menerima Pengesahan'
}).then(function(){
$(func).attr("onSubmit","return true;");
$(func).submit();
return true;
});
}
},error: function(xhr, status, error) {
var err = eval("(" + xhr.responseText + ")");
alert(xhr.responseText);
}
});
//TIME INTERVAL
let timerInterval;
timerInterval = setInterval(function()
{
$.ajax({
method:'get',
url: "{{ route('khazanah.getkelulusan') }}",
data: {
"norujukan" : norujukan
},
success:function(data){
if(data != '')
{
clearInterval(timerInterval);
Swal.fire({
icon: 'success',
title: 'Anda Berjaya Menerima Pengesahan'
}).then(function(){
$(func).attr("onSubmit","return true;");
$(func).submit();
return true;
});
}
},error: function(xhr, status, error) {
var err = eval("(" + xhr.responseText + ")");
alert(xhr.responseText);
}
});
}, 3000);
});
}, 3000);
} else if (
/* Read more about handling dismissals below */
result.dismiss === Swal.DismissReason.cancel
) {
swalWithBootstrapButtons.fire(
'Cancelled',
'Your imaginary file is safe :)',
'error'
)
}
} else if (result.dismiss === Swal.DismissReason.cancel) {
swalWithBootstrapButtons.fire(
'Batal',
'Maklumat Gadaian Tidak Berjaya Disimpan',
'error'
)
}
});
event.preventDefault();
return false;
event.preventDefault();
return false;
}
}
Swal.fire({
+10 -15
View File
@@ -772,8 +772,8 @@
}, 3000);
}else if (result.dismiss === Swal.DismissReason.cancel){
swalWithBootstrapButtons.fire(
'Cancelled',
'Your imaginary file is safe :)',
'Batal',
'Maklumat Gadaian Tidak Berjaya Disimpan',
'error'
)
}
@@ -873,8 +873,8 @@
}, 3000);
} else if (result.dismiss === Swal.DismissReason.cancel) {
swalWithBootstrapButtons.fire(
'Cancelled',
'Your imaginary file is safe :)',
'Batal',
'Maklumat Gadaian Tidak Berjaya Disimpan',
'error'
)
}
@@ -898,8 +898,7 @@
}
function deletemarhun(e)
{
function deletemarhun(e){
let marhun = $(e).closest('tr').children('td:eq(1)').text();let selectedrow = $(e).closest('tr');let recnozz = tablemarhun.row(selectedrow).data();
let norujuk = $('#norujukan').val();
@@ -911,19 +910,16 @@
"norujukan" : norujuk,
"recno" : recnozz[1]
},
success:function(data)
{
console.log(data);
success:function(data){
location.reload();
},error: function(xhr, status, error) {
var err = eval("(" + xhr.responseText + ")");
alert(xhr.responseText);
var err = eval("(" + xhr.responseText + ")");
alert(xhr.responseText);
}
});
}
function editmarhun(e)
{
function editmarhun(e){
let norujuk = $('#norujukan').val();let selectedrow = $(e).closest('tr');let recno = tablemarhun.row(selectedrow).data();
let nm = recno[3];let karat = recno[4];let berat = recno[5];
let harga = recno[7];
@@ -946,8 +942,7 @@
$('#harga1').val(hargaref);
});
function calculationharga(e)
{
function calculationharga(e){
let berat = $(e).val();
let total = 0;
let harga = $('#harga1').val();
+45 -47
View File
@@ -304,7 +304,6 @@
});
});
});
});
var total_marhun_pilih = 0;
@@ -388,60 +387,59 @@
})
$.ajax({
method:'post',
url: '{{ route("teller.createkelulusan") }}',
data: {
"_token" : "{{ csrf_token() }}",
"norujukan" : norujukan,
"mohon" : mohon
},
success:function(data){
console.log("created");
$.ajax({
method:'post',
url: '{{ route("teller.createkelulusan") }}',
data: {
"_token" : "{{ csrf_token() }}",
"norujukan" : norujukan,
"mohon" : mohon
},
success:function(data){
console.log("created");
},error: function(xhr, status, error) {
var err = eval("(" + xhr.responseText + ")");
alert(xhr.responseText);
console.log(err);
}
});
},error: function(xhr, status, error) {
var err = eval("(" + xhr.responseText + ")");
alert(xhr.responseText);
console.log(err);
}
});
//TIME INTERVAL
let timerInterval;
//TIME INTERVAL
let timerInterval;
timerInterval = setInterval(function(){
$.ajax({
method:'get',
url: "{{ route('teller.getkelulusan') }}",
data: {
"norujukan" : norujukan
},
success:function(data){
console.log(data);
if(data != 0){
console.log('berjaya');
clearInterval(timerInterval);
Swal.fire({
icon: 'success',
title: 'Anda Berjaya Menerima Pengesahan'
}).then(function(){
$("#print_submit_belum_serah").submit();
timerInterval = setInterval(function(){
$.ajax({
method:'get',
url: "{{ route('teller.getkelulusan') }}",
data: {
"norujukan" : norujukan
},
success:function(data){
console.log(data);
if(data != 0){
console.log('berjaya');
clearInterval(timerInterval);
Swal.fire({
icon: 'success',
title: 'Anda Berjaya Menerima Pengesahan'
}).then(function(){
$("#print_submit_belum_serah").submit();
});
}
},error: function(xhr, status, error) {
var err = eval("(" + xhr.responseText + ")");
alert(xhr.responseText);
}
});
}
},error: function(xhr, status, error) {
var err = eval("(" + xhr.responseText + ")");
alert(xhr.responseText);
}
});
}, 3000);
}, 3000);
}else if (result.dismiss === Swal.DismissReason.cancel) {
}else if (result.dismiss === Swal.DismissReason.cancel) {
swalWithBootstrapButtons.fire(
'Cancelled',
'Your imaginary file is safe :)',
'Batal',
'Tidak Berjaya Mendapatkan Kelulusan Khazanah',
'error'
)
}
@@ -117,8 +117,7 @@ function carila()
Swal.fire({
icon: 'error',
title: 'Amaran',
text: 'Tiada maklumat pelanggan!',
footer: '<a href>Why do I have this issue?</a>'
text: 'Tiada maklumat pelanggan!'
});
$('#form-display').hide();
}
File diff suppressed because it is too large Load Diff