change notifikasi dan hapus gadai dan history

This commit is contained in:
hafifierahman
2021-01-10 02:19:09 +08:00
parent cb545eb387
commit f9463f308c
8 changed files with 118 additions and 81 deletions
+62 -15
View File
@@ -289,7 +289,7 @@
</table>
<div class="text-center">
<button class="btn btn-primary" onclick="ubahfunc()">Ubah</button>
<button class="btn btn-primary" onclick="ubahfunc(this)">Ubah</button>
<button class="btn btn-primary" onclick="hapusfunc()">Hapus</button>
<button class="btn btn-primary" onclick="histfunc()">History</button>
</div>
@@ -493,9 +493,10 @@
}
function ubahfunc()
function ubahfunc(e)
{
if($("input[name='options']:checked").val() == 'belum_tebus'){
let ubahid = $('input[name="belum"]:checked').val();
if(ubahid == null)
@@ -515,8 +516,7 @@
data:{ "norujukan" : ubahid},
success:function(data)
{
$('#historytebusModal').modal();
historytebustable(data);
},error: function(xhr, status, error) {
var err = eval("(" + xhr.responseText + ")");
alert(xhr.responseText);
@@ -526,13 +526,19 @@
}
else if($("input[name='options']:checked").val() == 'sudah_tebus'){
let ubahid = $('input[name="sudahtebus"]:checked').val();
Swal.fire({
icon: 'error',
title: 'Oops...',
text: 'Ubah hanya untuk belum tebus sahaja!',
footer: '<a href>Why do I have this issue?</a>'
});
}
}
function hapusfunc()
{
let kodcaw = "{{ $cawangan_info['kodcaw'] }}";
if($("input[name='options']:checked").val() == 'belum_tebus'){
let hapusid = $('input[name="belum"]:checked').val();
@@ -554,11 +560,27 @@
reverseButtons: true
}).then((result) => {
if (result.isConfirmed) {
swalWithBootstrapButtons.fire(
'Deleted!',
'Your file has been deleted.',
'success'
)
$.ajax({
method:'put',
url:'http://localhost:8000/api/gadai/hapus/' + kodcaw + '/' + hapusid,
success:function(data)
{
console.log(data);
swalWithBootstrapButtons.fire(
'Deleted!',
'Your file has been deleted.',
'success'
).then(function () {
location.reload();
});
},error: function(xhr, status, error) {
var err = eval("(" + xhr.responseText + ")");
alert(xhr.responseText);
}
});
} else if (
/* Read more about handling dismissals below */
result.dismiss === Swal.DismissReason.cancel
@@ -593,11 +615,36 @@
reverseButtons: true
}).then((result) => {
if (result.isConfirmed) {
swalWithBootstrapButtons.fire(
'Deleted!',
'Your file has been deleted.',
'success'
)
$.ajax({
method:'put',
url:'http://localhost:8000/api/tebus/hapus/' + kodcaw + '/' + hapusid,
success:function(data)
{
if(data != "Bukan-Tebus")
{
swalWithBootstrapButtons.fire(
'Deleted!',
'Your file has been deleted.',
'success'
).then(function () {
location.reload();
});
}
else
{
swalWithBootstrapButtons.fire(
'Amaran!',
'Hapus Hanya Untuk Jenis Tebus Sahaja!',
'error'
)
}
},error: function(xhr, status, error) {
var err = eval("(" + xhr.responseText + ")");
alert(xhr.responseText);
}
});
} else if (
/* Read more about handling dismissals below */
result.dismiss === Swal.DismissReason.cancel