From e4fbd77c5cc23e5cf1b469b85ea9d56b9b3d2447 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cebik=E2=80=9D?= <“ebikalmatin@gmail.com”> Date: Tue, 12 Aug 2025 10:46:53 +0700 Subject: [PATCH] update post guid scan admin --- .../Transport/SpjAdmin/Scan/Index.cshtml | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/Views/Admin/Transport/SpjAdmin/Scan/Index.cshtml b/Views/Admin/Transport/SpjAdmin/Scan/Index.cshtml index 846c16b..90db7b3 100644 --- a/Views/Admin/Transport/SpjAdmin/Scan/Index.cshtml +++ b/Views/Admin/Transport/SpjAdmin/Scan/Index.cshtml @@ -680,19 +680,19 @@ const resp = await this.postGuid(guid); console.debug('process response', resp); - if (resp && resp.success) { - const now = new Date(); - const tanggal = now.toLocaleDateString('id-ID', { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' }); - const waktu = now.toLocaleTimeString('id-ID', { hour: '2-digit', minute: '2-digit' }); - this.showSuccessModal(this.originalSpjCode, tanggal, waktu); - } else { - const errorMessage = (resp && resp.message) ? resp.message : 'Kode SPJ tidak ditemukan dalam database.'; - if (errorMessage.toLowerCase().includes('sudah pernah di scan')) { - this.showAlreadyScannedModal(this.originalSpjCode); - } else { - this.showModal('error', 'SPJ Tidak Ditemukan', errorMessage, true); - } - } + if (resp.data.status === "valid") { + console.log(); + const now = new Date(); + const tanggal = now.toLocaleDateString('id-ID', { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' }); + const waktu = now.toLocaleTimeString('id-ID', { hour: '2-digit', minute: '2-digit' }); + this.showSuccessModal(trimmed, tanggal, waktu); + } + else if (resp.data.status === "exits") { + this.showModal('error', 'SPJ sudah di Scan', (resp && resp.message) ? resp.message : 'Kode SPJ sudah digunakan.', true); + }else + { + this.showModal('error', 'SPJ Tidak Ditemukan', (resp && resp.message) ? resp.message : 'Kode SPJ tidak ditemukan dalam database.', true); + } } catch (xhrOrErr) { let message = ''; if (xhrOrErr && xhrOrErr.responseJSON) {