This commit is contained in:
Dwi Swandhana
2026-04-07 12:21:24 +07:00
parent 15095734b1
commit 8a96f58858
@@ -376,7 +376,6 @@ $(document).ready(function() {
var daftar = button.data('daftar') || '-';
var nofoto = button.data('nofoto') || '-';
var statusAwal = button.data('status') || '-';
swal({
title: 'Konfirmasi Pembatalan',
text: 'Apakah anda yakin merubah status untuk pemeriksaan ' + reques + ' untuk nama ' + nmpasien + ' yang di order pada ' + daftar + ' dengan accession number ' + nofoto + ' dengan status awal ' + statusAwal + ' ?',
@@ -385,13 +384,22 @@ $(document).ready(function() {
confirmButtonColor: '#d33',
confirmButtonText: 'Ya, batalkan',
cancelButtonText: 'Tidak'
}, function(isConfirm) {
}).then(function(result) {
var confirmed = false;
if (typeof result === 'boolean') {
confirmed = result;
} else if (result) {
confirmed = !!(result.value || result.isConfirmed);
}
if (!confirmed) return;
button.prop('disabled', true);
$.post('{{ url("dashboard/early-warning") }}/' + id + '/cancel', { _token: '{{ csrf_token() }}' }, function (data) {
swal({
title: data.status || 'Sukses',
text: data.message || 'Status berhasil diperbarui.',
type: 'success',
}, function () {
}).then(function () {
window.location.reload();
});
}).fail(function (xhr) {
@@ -401,53 +409,55 @@ $(document).ready(function() {
text: response.message || 'Tidak dapat memperbarui status pemeriksaan.',
type: 'error',
});
}).always(function () {
button.prop('disabled', false);
});
});
});
$("#btnsimpanfoto").click(function(){
var filegambar = document.getElementById('upload_file');
$("#btnsimpanfoto").click(function(){
var filegambar = document.getElementById('upload_file');
$('#modalupdatefoto').modal('hide');
var form_data = new FormData();
form_data.append('file', filegambar.files[0]);
form_data.append('_token', '{{csrf_token()}}');
$.ajax({
url: '{{ url("user/updatefoto") }}',
data: form_data,
type: 'POST',
contentType: false,
processData: false,
success: function (data) {
var status = data.status;
var message = data.message;
if (status == 'Failed'){
swal({
title: status,
text: message,
type: 'warning',
})
}else {
$("html, body").animate({ scrollTop: 0 }, "slow");
$.toast({
heading: status,
text: message,
position: 'top-right',
loaderBg: '#5ba035',
icon: 'success',
hideAfter: 15000,
stack: 1
});
}
return false;
},
error: function (xhr, status, error) {
$.ajax({
url: '{{ url("user/updatefoto") }}',
data: form_data,
type: 'POST',
contentType: false,
processData: false,
success: function (data) {
var status = data.status;
var message = data.message;
if (status == 'Failed'){
swal({
title: status,
text: error,
text: message,
type: 'warning',
})
}
});
}else {
$("html, body").animate({ scrollTop: 0 }, "slow");
$.toast({
heading: status,
text: message,
position: 'top-right',
loaderBg: '#5ba035',
icon: 'success',
hideAfter: 15000,
stack: 1
});
}
return false;
},
error: function (xhr, status, error) {
swal({
title: status,
text: error,
type: 'warning',
})
}
});
});
});
</script>
@endpush