update qr funtion
This commit is contained in:
No files matched your search
+13
-6
@@ -935,18 +935,25 @@ export const useQueueStore = defineStore('queue', () => {
|
||||
status: p.status
|
||||
})));
|
||||
|
||||
// Clean input - remove whitespace and convert to uppercase for comparison
|
||||
const cleanInput = String(patientIdOrBarcode).trim().toUpperCase();
|
||||
// Clean input - remove whitespace and normalize
|
||||
const cleanInput = String(patientIdOrBarcode).trim();
|
||||
const cleanInputUpper = cleanInput.toUpperCase();
|
||||
|
||||
// Try to find by multiple criteria:
|
||||
// 1. Exact barcode match
|
||||
// 1. Exact barcode match (case-insensitive, whitespace-insensitive)
|
||||
// 2. Parse as number and match with no
|
||||
// 3. Extract number from input (e.g., "UM0014" -> "0014" or "14") and match with noAntrian
|
||||
// 4. Check if noAntrian includes the input
|
||||
const patientIndex = allPatients.value.findIndex(p => {
|
||||
// Exact barcode match
|
||||
if (p.barcode === cleanInput || p.barcode === patientIdOrBarcode) {
|
||||
console.log('✅ Found by barcode:', p.barcode);
|
||||
// Normalize barcode untuk comparison
|
||||
const patientBarcode = String(p.barcode || '').trim();
|
||||
const patientBarcodeUpper = patientBarcode.toUpperCase();
|
||||
|
||||
// Exact barcode match (case-insensitive, whitespace-insensitive)
|
||||
if (patientBarcode === cleanInput ||
|
||||
patientBarcodeUpper === cleanInputUpper ||
|
||||
patientBarcode === patientIdOrBarcode) {
|
||||
console.log('✅ Found by barcode:', patientBarcode, '===', cleanInput);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user