update
This commit is contained in:
@@ -386,6 +386,7 @@ class MobileApiController extends Controller
|
||||
'preliminary' => 'Preliminary Results',
|
||||
'Permohonan Verifikasi' => 'Expertise Saved (Un Verified)',
|
||||
'Permohonan Verifikasi Preliminary' => 'Otor Maldi (Un Verified)',
|
||||
'statuspewarnaanlsg' => $this->resolvePeriksaHierarchyStatus($row->status, 'Pewarnaan Langsung'),
|
||||
default => 'Pemeriksaan awal',
|
||||
};
|
||||
|
||||
@@ -424,6 +425,7 @@ class MobileApiController extends Controller
|
||||
'preliminary' => 'Preliminary Results',
|
||||
'Permohonan Verifikasi' => 'Kirim ke SPV',
|
||||
'Permohonan Verifikasi Preliminary' => 'Kirim Preliminary ke SPV',
|
||||
'statuspewarnaanlsg' => 'Pewarnaan Langsung',
|
||||
default => 'Draft',
|
||||
},
|
||||
'verifikasi' => in_array($action, ['verifikasi', 'preliminary'], true) ? 'Accepted' : '',
|
||||
@@ -435,6 +437,7 @@ class MobileApiController extends Controller
|
||||
'preliminary' => 'Preliminary Results Saved',
|
||||
'Permohonan Verifikasi' => 'Permohonan Verifikasi Terkirim',
|
||||
'Permohonan Verifikasi Preliminary' => 'Permohonan Verifikasi Preliminary Terkirim',
|
||||
'statuspewarnaanlsg' => 'Pewarnaan Langsung tersimpan',
|
||||
default => 'Draft Expertise Saved',
|
||||
},
|
||||
'item' => $this->examinationPayload($row->fresh()),
|
||||
@@ -958,6 +961,123 @@ class MobileApiController extends Controller
|
||||
};
|
||||
}
|
||||
|
||||
protected function resolvePeriksaHierarchyStatus($currentStatus, $proposedStatus): string
|
||||
{
|
||||
$currentStatus = trim((string) $currentStatus);
|
||||
$proposedStatus = trim((string) $proposedStatus);
|
||||
|
||||
if ($proposedStatus === '') {
|
||||
return $currentStatus;
|
||||
}
|
||||
|
||||
$currentRank = $this->periksaHierarchyStatusRank($currentStatus);
|
||||
$proposedRank = $this->periksaHierarchyStatusRank($proposedStatus);
|
||||
|
||||
if ($currentStatus === '') {
|
||||
return $proposedStatus;
|
||||
}
|
||||
|
||||
if ($proposedRank === null) {
|
||||
return $currentRank === null ? $proposedStatus : $currentStatus;
|
||||
}
|
||||
|
||||
if ($currentRank === null || $proposedRank >= $currentRank) {
|
||||
return $proposedStatus;
|
||||
}
|
||||
|
||||
return $currentStatus;
|
||||
}
|
||||
|
||||
protected function periksaHierarchyStatusRank($status): ?int
|
||||
{
|
||||
$normalized = $this->normalizePeriksaStatus($status);
|
||||
|
||||
if ($normalized === '') {
|
||||
return null;
|
||||
}
|
||||
|
||||
if ($normalized === 'penerimaan sampel') {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (in_array($normalized, ['pemeriksaan awal', 'pemeriksaan sampel', 'proses analisis sampel'], true)) {
|
||||
return 2;
|
||||
}
|
||||
|
||||
if (str_starts_with($normalized, 'data bd di terima') || str_starts_with($normalized, 'data bd diterima')) {
|
||||
return 3;
|
||||
}
|
||||
|
||||
if ($normalized === 'pewarnaan langsung') {
|
||||
return 4;
|
||||
}
|
||||
|
||||
if ($this->isProsesingKoloniMediaStatus($normalized)) {
|
||||
return 5;
|
||||
}
|
||||
|
||||
if (str_starts_with($normalized, 'data malditof diterima') || str_starts_with($normalized, 'data malditof di terima')) {
|
||||
return 6;
|
||||
}
|
||||
|
||||
if (str_starts_with($normalized, 'otor maldi (un verified)')) {
|
||||
return 7;
|
||||
}
|
||||
|
||||
if (str_starts_with($normalized, 'preliminary results')) {
|
||||
return 8;
|
||||
}
|
||||
|
||||
if (str_starts_with($normalized, 'data vitek di terima') || str_starts_with($normalized, 'data vitek diterima')) {
|
||||
return 9;
|
||||
}
|
||||
|
||||
if (str_starts_with($normalized, 'id/ast pending result') || $normalized === 'sedang id+ast') {
|
||||
return 10;
|
||||
}
|
||||
|
||||
if (str_starts_with($normalized, 'expertise saved (un verified)')
|
||||
|| in_array($normalized, ['expertise', 'selesai', 'final result'], true)) {
|
||||
return 11;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
protected function normalizePeriksaStatus($status): string
|
||||
{
|
||||
$status = strtolower(trim((string) $status));
|
||||
$status = str_replace(['_', '-'], ' ', $status);
|
||||
$status = preg_replace('/\s+/', ' ', $status);
|
||||
|
||||
return trim($status);
|
||||
}
|
||||
|
||||
protected function isProsesingKoloniMediaStatus(string $normalizedStatus): bool
|
||||
{
|
||||
$exactStatuses = [
|
||||
'tidak ada pertumbuhan',
|
||||
'tidak lanjut identifikasi',
|
||||
'tidak tindak lanjut identifikasi',
|
||||
'inkubasi lanjutan',
|
||||
'sub kultur',
|
||||
'menunggu kultur yg lain',
|
||||
'menunggu kultur yang lain',
|
||||
'proses identifikasi dan uji kepekaan',
|
||||
'sedang malditof',
|
||||
'pertumbuhan primer',
|
||||
];
|
||||
|
||||
if (in_array($normalizedStatus, $exactStatuses, true)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return str_starts_with($normalizedStatus, 'prosesing koloni media')
|
||||
|| str_starts_with($normalizedStatus, 'processing koloni media')
|
||||
|| str_starts_with($normalizedStatus, 'proses identifikasi')
|
||||
|| str_starts_with($normalizedStatus, 'proses uji kepekaan');
|
||||
}
|
||||
|
||||
public function earlyWarning(Request $request)
|
||||
{
|
||||
$this->requireUser($request);
|
||||
|
||||
Reference in New Issue
Block a user