update qr funtion

This commit is contained in:
Fanrouver
2026-01-09 08:44:27 +07:00
parent 8a4bb44354
commit 22d7205271
7 changed files with 395 additions and 192 deletions

No files matched your search

+13 -6
View File
@@ -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;
}