update
This commit is contained in:
@@ -700,6 +700,48 @@ class FrontpageController extends Controller
|
||||
'openExpertiseOnLoad' => true,
|
||||
]));
|
||||
}
|
||||
public function cancelEarlyWarning(Request $request, $id)
|
||||
{
|
||||
if (!Session::has('previlage')) {
|
||||
return response()->json([
|
||||
'status' => 'Gagal',
|
||||
'message' => 'Session login tidak ditemukan.',
|
||||
], 401);
|
||||
}
|
||||
|
||||
$periksa = Periksa::select('id', 'nofoto', 'nmpasien', 'reques', 'daftar', 'status')
|
||||
->find($id);
|
||||
|
||||
if (!$periksa) {
|
||||
return response()->json([
|
||||
'status' => 'Gagal',
|
||||
'message' => 'Data pemeriksaan tidak ditemukan.',
|
||||
], 404);
|
||||
}
|
||||
|
||||
$currentStatus = trim((string) ($periksa->status ?? ''));
|
||||
if ($currentStatus !== '' && str_contains(strtolower($currentStatus), 'dibatalkan')) {
|
||||
return response()->json([
|
||||
'status' => 'Gagal',
|
||||
'message' => 'Pemeriksaan ini sudah berstatus dibatalkan.',
|
||||
], 422);
|
||||
}
|
||||
|
||||
if (strtolower($currentStatus) === 'selesai') {
|
||||
return response()->json([
|
||||
'status' => 'Gagal',
|
||||
'message' => 'Pemeriksaan yang sudah selesai tidak dapat dibatalkan dari Early Warning.',
|
||||
], 422);
|
||||
}
|
||||
|
||||
$periksa->status = 'Dibatalkan (Arsip)';
|
||||
$periksa->save();
|
||||
|
||||
return response()->json([
|
||||
'status' => 'Sukses',
|
||||
'message' => 'Status pemeriksaan berhasil diubah menjadi Dibatalkan (Arsip).',
|
||||
]);
|
||||
}
|
||||
public function pengambilan() {
|
||||
if (Session::get('previlage') == ''){
|
||||
return redirect('/login');
|
||||
|
||||
@@ -180,6 +180,18 @@
|
||||
<a href="{{ route('mikro.expertise', ['periksa' => $row['id'], 'return_to' => 'dashboard']) }}" class="btn btn-sm btn-primary">
|
||||
Expertise
|
||||
</a>
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-sm btn-danger btn-ews-cancel"
|
||||
data-id="{{ $row['id'] }}"
|
||||
data-reques="{{ $row['reques'] }}"
|
||||
data-nmpasien="{{ $row['nmpasien'] }}"
|
||||
data-daftar="{{ $row['daftar'] }}"
|
||||
data-nofoto="{{ $row['nofoto'] }}"
|
||||
data-status="{{ $row['status'] }}"
|
||||
>
|
||||
Batalkan
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
@@ -356,6 +368,46 @@ $(document).ready(function() {
|
||||
$(".btnubahfoto").click(function() {
|
||||
$('#modalupdatefoto').modal('show');
|
||||
});
|
||||
$(document).on('click', '.btn-ews-cancel', function () {
|
||||
var button = $(this);
|
||||
var id = button.data('id');
|
||||
var reques = button.data('reques') || '-';
|
||||
var nmpasien = button.data('nmpasien') || '-';
|
||||
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 + ' ?',
|
||||
type: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#d33',
|
||||
confirmButtonText: 'Ya, batalkan',
|
||||
cancelButtonText: 'Tidak'
|
||||
}, function(isConfirm) {
|
||||
if (!isConfirm) {
|
||||
return;
|
||||
}
|
||||
|
||||
$.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 () {
|
||||
window.location.reload();
|
||||
});
|
||||
}).fail(function (xhr) {
|
||||
var response = xhr.responseJSON || {};
|
||||
swal({
|
||||
title: response.status || 'Gagal',
|
||||
text: response.message || 'Tidak dapat memperbarui status pemeriksaan.',
|
||||
type: 'error',
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
$("#btnsimpanfoto").click(function(){
|
||||
var filegambar = document.getElementById('upload_file');
|
||||
$('#modalupdatefoto').modal('hide');
|
||||
|
||||
@@ -85,6 +85,7 @@ Route::group(['middleware' => 'project.ipg'], function() {
|
||||
|
||||
Route::get('dokter', [DokterController::class, 'index']);
|
||||
Route::get('reportppds', [DokterController::class, 'reportppds']);
|
||||
Route::post('dashboard/early-warning/{id}/cancel', [FrontpageController::class, 'cancelEarlyWarning'])->name('dashboard.earlyWarning.cancel');
|
||||
Route::get('dokter/getlisttem', [DokterController::class, 'getListtem'])->name('getListTemplate');
|
||||
Route::get('dokter/getlistppds', [DokterController::class, 'getListppds'])->name('getlistppds');
|
||||
Route::post('dokter/getadendum', [DokterController::class, 'getAdendum'])->name('getadendum');
|
||||
|
||||
Reference in New Issue
Block a user