From 15023967a1408bebe3052a236434c26c20ccd093 Mon Sep 17 00:00:00 2001 From: marszayn Date: Tue, 5 Aug 2025 13:57:00 +0700 Subject: [PATCH] update : fixing looping scan --- .../Transport/SpjDriver/Submit/Struk.cshtml | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/Views/Admin/Transport/SpjDriver/Submit/Struk.cshtml b/Views/Admin/Transport/SpjDriver/Submit/Struk.cshtml index d5f39c6..487f57b 100644 --- a/Views/Admin/Transport/SpjDriver/Submit/Struk.cshtml +++ b/Views/Admin/Transport/SpjDriver/Submit/Struk.cshtml @@ -97,7 +97,6 @@ type="file" id="file-upload" accept="image/*" - capture="environment" class="hidden" />

@@ -150,7 +149,8 @@ Data struk berhasil diisi otomatis! -

Periksa form di bawah dan lengkapi data jika diperlukan.

+

Scanning dihentikan. Periksa form di bawah dan lengkapi data jika diperlukan.

+

💡 Untuk scan ulang, klik "Mulai Scan Struk" atau "Upload Foto Struk"

@@ -1019,13 +1019,22 @@ // Show success message this.showScanSuccess(); + // Auto-stop scanning after successful detection + console.log('Auto-stopping scanner after successful data detection'); + setTimeout(() => { + if (this.isScanning) { + console.log('Scanner stopped automatically. User can click "Mulai Scan Struk" to scan again.'); + this.stopScanner(); + } + }, 1000); + // Scroll to form to show filled data setTimeout(() => { const formSection = document.querySelector('form'); if (formSection) { formSection.scrollIntoView({ behavior: 'smooth', block: 'start' }); } - }, 500); + }, 1500); } else { console.log('No significant data found in OCR text'); } @@ -1477,10 +1486,10 @@ showScanSuccess() { this.scanSuccess.classList.remove('hidden'); - // Auto-hide after 3 seconds + // Auto-hide after 5 seconds (longer to let user read the instructions) setTimeout(() => { this.scanSuccess.classList.add('hidden'); - }, 3000); + }, 5000); } showError(message) {