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