added logic for passing serial number
This commit is contained in:
@@ -730,6 +730,8 @@ function cameraCapture() {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<input type="hidden" x-ref="hiddenInput" name="camera_capture_file">
|
<input type="hidden" x-ref="hiddenInput" name="camera_capture_file">
|
||||||
|
<input type="hidden" x-ref="serialInput" name="serialNumbers">
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Scripts -->
|
<!-- Scripts -->
|
||||||
@@ -742,6 +744,7 @@ function cameraCapture() {
|
|||||||
currentFacingMode: 'user',
|
currentFacingMode: 'user',
|
||||||
textDetectionInterval: null,
|
textDetectionInterval: null,
|
||||||
capturedPhoto: null, // store captured image
|
capturedPhoto: null, // store captured image
|
||||||
|
serialNumbers: [],
|
||||||
|
|
||||||
async initCamera() {
|
async initCamera() {
|
||||||
try {
|
try {
|
||||||
@@ -812,6 +815,10 @@ function cameraCapture() {
|
|||||||
|
|
||||||
const detectedText = result.data.text.trim();
|
const detectedText = result.data.text.trim();
|
||||||
alert("Detected Text:\n" + (detectedText || "[No text detected]"));
|
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) {
|
} catch (err) {
|
||||||
console.error("OCR verify error:", err);
|
console.error("OCR verify error:", err);
|
||||||
|
|||||||
Reference in New Issue
Block a user