diff --git a/Views/Admin/Transport/SpjAdmin/Scan/Index.cshtml b/Views/Admin/Transport/SpjAdmin/Scan/Index.cshtml index 88d67a3..f38ea75 100644 --- a/Views/Admin/Transport/SpjAdmin/Scan/Index.cshtml +++ b/Views/Admin/Transport/SpjAdmin/Scan/Index.cshtml @@ -448,18 +448,30 @@ if (isValid) { console.log(`✅ Kode ${code} VALID - menampilkan success`); - this.showModal('success', 'Scan Berhasil!', - `SPJ "${code}" berhasil ditemukan dan diproses.\n\n📋 Detail SPJ:\n• Kode: ${code}\n• Status: Aktif\n• Tanggal: ${new Date().toLocaleDateString('id-ID')}`, - true); + + // Format tanggal Indonesia + 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' + }); + + // Custom modal untuk success dengan HTML yang lebih rapi + this.showSuccessModal(code, tanggal, waktu); + setTimeout(() => { this.hideResult(); this.manualInput.value = ''; }, 3000); } else { console.log(`❌ Kode ${code} TIDAK VALID - menampilkan error`); - this.showModal('error', 'SPJ Tidak Ditemukan', - `Kode SPJ "${code}" tidak ditemukan dalam database.\n\n✅ Kode Valid untuk Testing:\n• SPJ001, SPJ002, SPJ003\n• TEST123, TEST456\n• 12345, 67890\n• ABCDEF, GHIJKL`, - true); + this.showErrorModal(code); } }, 1000); } @@ -577,6 +589,100 @@ } } + showSuccessModal(code, tanggal, waktu) { + // Custom success modal dengan UI yang lebih keren + const successIcon = ` +
+ +
+ `; + + const successContent = ` +
+
+
+ ${code} +
+
+ +
+
+
Status
+
+
+ Aktif +
+
+ +
+
Waktu Scan
+
${waktu}
+
+
+ +
+
Tanggal
+
${tanggal}
+
+
+ `; + + $('#modal-icon').html(successIcon); + $('#modal-title').html('🎉 Scan Berhasil!'); + $('#modal-message').html(successContent); + $('#modal-close').html('Selesai').show(); + + $('#scan-modal').removeClass('hidden'); + + $('#scan-modal').css('opacity', '0').animate({'opacity': '1'}, 300); + $('#scan-modal .bg-white').css('transform', 'scale(0.8)').animate({ + 'transform': 'scale(1)' + }, 300); + + if (typeof lucide !== 'undefined') { + lucide.createIcons(); + } + } + + showErrorModal(code) { + // Custom error modal dengan UI yang lebih keren + const errorIcon = ` +
+ +
+ `; + + const errorContent = ` +
+
+
+ ${code} +
+
+
+
Kode SPJ tidak ditemukan
+
Silakan periksa kembali kode yang Anda masukkan
+
+
+ `; + + $('#modal-icon').html(errorIcon); + $('#modal-title').html('❌ SPJ Tidak Ditemukan'); + $('#modal-message').html(errorContent); + $('#modal-close').html('Coba Lagi').show(); + + $('#scan-modal').removeClass('hidden'); + + $('#scan-modal').css('opacity', '0').animate({'opacity': '1'}, 300); + $('#scan-modal .bg-white').css('transform', 'scale(0.8)').animate({ + 'transform': 'scale(1)' + }, 300); + + if (typeof lucide !== 'undefined') { + lucide.createIcons(); + } + } + hideModal() { $('#scan-modal').animate({'opacity': '0'}, 200, function() { $('#scan-modal').addClass('hidden');