added logic for passing serial number

This commit is contained in:
dhanabalan
2025-10-25 17:23:08 +05:30
parent 15965fcd05
commit 1fb8c43b28

View File

@@ -730,6 +730,8 @@ function cameraCapture() {
</div>
<input type="hidden" x-ref="hiddenInput" name="camera_capture_file">
<input type="hidden" x-ref="serialInput" name="serialNumbers">
</div>
<!-- Scripts -->
@@ -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);