From 8a96f5885877451f919753cae2223d109c172c28 Mon Sep 17 00:00:00 2001 From: Dwi Swandhana Date: Tue, 7 Apr 2026 12:21:24 +0700 Subject: [PATCH] update --- .../views/dokter/dashborad.blade.php | 86 +++++++++++-------- 1 file changed, 48 insertions(+), 38 deletions(-) diff --git a/htdocs/resources/views/dokter/dashborad.blade.php b/htdocs/resources/views/dokter/dashborad.blade.php index a4c5b5ec..41c25598 100644 --- a/htdocs/resources/views/dokter/dashborad.blade.php +++ b/htdocs/resources/views/dokter/dashborad.blade.php @@ -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', + }) + } }); + }); }); @endpush