update
This commit is contained in:
@@ -726,6 +726,7 @@ class DokterController extends Controller
|
||||
$criticalSample = CriticalValueSample::firstOrNew(['periksa_id' => $periksa->id]);
|
||||
$criticalSample->nofoto = $periksa->nofoto;
|
||||
$criticalSample->noregister = $periksa->noregister;
|
||||
$criticalSample->asalpasien = $periksa->asalpasien;
|
||||
$criticalSample->nmpasien = $periksa->nmpasien;
|
||||
$criticalSample->nm_spesimen = $periksa->nm_spesimen;
|
||||
|
||||
@@ -766,19 +767,74 @@ class DokterController extends Controller
|
||||
'highlightId' => $highlightId,
|
||||
]);
|
||||
}
|
||||
public function criticalValueNotificationSummary()
|
||||
{
|
||||
if (Session::get('id') === null) {
|
||||
return response()->json([
|
||||
'count' => 0,
|
||||
'menu_html' => view('notifications.partials.critical-bell', [
|
||||
'count' => 0,
|
||||
'items' => collect(),
|
||||
])->render(),
|
||||
]);
|
||||
}
|
||||
|
||||
$count = CriticalValueSample::whereNull('followed_up_at')->count();
|
||||
$items = CriticalValueSample::whereNull('followed_up_at')
|
||||
->orderBy('critical_set_at', 'asc')
|
||||
->limit(8)
|
||||
->get();
|
||||
|
||||
return response()->json([
|
||||
'count' => (int) $count,
|
||||
'menu_html' => view('notifications.partials.critical-bell', [
|
||||
'count' => (int) $count,
|
||||
'items' => $items,
|
||||
])->render(),
|
||||
]);
|
||||
}
|
||||
public function criticalValueNotificationOpen($id)
|
||||
{
|
||||
$criticalSample = CriticalValueSample::findOrFail($id);
|
||||
$this->markCriticalValueAsRead($criticalSample);
|
||||
|
||||
return redirect()
|
||||
->route('criticalValueNotifications', ['highlight' => $criticalSample->id])
|
||||
->with('success', 'Sample nilai kritis sudah ditandai sudah ditindaklanjuti.');
|
||||
->route('criticalValueNotifications', ['highlight' => $id]);
|
||||
}
|
||||
public function criticalValueNotificationMarkRead($id)
|
||||
{
|
||||
$criticalSample = CriticalValueSample::findOrFail($id);
|
||||
$this->markCriticalValueAsRead($criticalSample);
|
||||
if (!empty($criticalSample->followed_up_at)) {
|
||||
return redirect()
|
||||
->route('criticalValueNotifications', ['highlight' => $criticalSample->id])
|
||||
->with('success', 'Sample nilai kritis ini sudah ditindaklanjuti sebelumnya.');
|
||||
}
|
||||
|
||||
$followUpMethod = trim((string) request('caratindaklanjut', ''));
|
||||
$followUpRecipient = trim((string) request('penerima_laporan', ''));
|
||||
$followUpReason = trim((string) request('alasan_belum_laporkan', ''));
|
||||
|
||||
// If method is empty -> not reported, reason is required.
|
||||
// If method is filled -> reported, recipient is required.
|
||||
if ($followUpMethod === '') {
|
||||
if ($followUpReason === '') {
|
||||
return back()->with('error', 'Alasan belum dilaporkan wajib diisi jika belum dilaporkan.');
|
||||
}
|
||||
} else {
|
||||
$allowed = ['Telpon', 'Whatshap', 'Email', 'Ketemu di Jalan'];
|
||||
if (!in_array($followUpMethod, $allowed, true)) {
|
||||
return back()->with('error', 'Cara tindak lanjut tidak valid.');
|
||||
}
|
||||
if ($followUpRecipient === '') {
|
||||
return back()->with('error', 'Penerima laporan wajib diisi jika sudah dilaporkan.');
|
||||
}
|
||||
}
|
||||
|
||||
$criticalSample->followed_up_at = Carbon::now();
|
||||
$criticalSample->followed_up_by_user_id = Session('id');
|
||||
$criticalSample->followed_up_by_name = Session('nama');
|
||||
$criticalSample->follow_up_status = $followUpMethod === '' ? 'not_reported' : 'reported';
|
||||
$criticalSample->follow_up_method = $followUpMethod !== '' ? $followUpMethod : null;
|
||||
$criticalSample->follow_up_recipient = $followUpRecipient !== '' ? $followUpRecipient : null;
|
||||
$criticalSample->follow_up_reason = $followUpReason !== '' ? $followUpReason : null;
|
||||
$criticalSample->save();
|
||||
|
||||
return redirect()
|
||||
->route('criticalValueNotifications', ['highlight' => $criticalSample->id])
|
||||
|
||||
Reference in New Issue
Block a user