From 1fb8c43b288250ef5567c5a9a00dd5cc1979c769 Mon Sep 17 00:00:00 2001 From: dhanabalan Date: Sat, 25 Oct 2025 17:23:08 +0530 Subject: [PATCH] added logic for passing serial number --- resources/views/fields/camera-capture.blade.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/resources/views/fields/camera-capture.blade.php b/resources/views/fields/camera-capture.blade.php index 7ec32e0..42b3c92 100644 --- a/resources/views/fields/camera-capture.blade.php +++ b/resources/views/fields/camera-capture.blade.php @@ -730,6 +730,8 @@ function cameraCapture() { + + @@ -742,6 +744,7 @@ function cameraCapture() { currentFacingMode: 'user', textDetectionInterval: null, capturedPhoto: null, // store captured image + serialNumbers: [], async initCamera() { try { @@ -812,6 +815,10 @@ function cameraCapture() { const detectedText = result.data.text.trim(); alert("Detected Text:\n" + (detectedText || "[No text detected]")); + // Extract serial numbers (digits only) + const matches = detectedText.match(/\d+/g) || []; + this.serialNumbers = matches.slice(0, 4); // take first 4 serials + this.$refs.serialInput.value = JSON.stringify(this.serialNumbers); } } catch (err) { console.error("OCR verify error:", err);