added logic for passing serial number
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user