perbaikan ambil tiket
This commit is contained in:
No files matched your search
+16
-11
@@ -1600,18 +1600,15 @@ const fetchPatientsForLoket = async (loketId, force = false) => {
|
||||
return loketPayments.some(lp => {
|
||||
const normalized = String(lp).toUpperCase().trim();
|
||||
|
||||
// Handle exact match
|
||||
if (normalized === patientCategory) return true;
|
||||
const result = (normalized === patientCategory) ||
|
||||
(patientCategory === 'UMUM' && (normalized.includes('UMUM') || normalized.includes('MANDIRI'))) ||
|
||||
(patientCategory === 'JKN' && (normalized.includes('JKN') || normalized.includes('BPJS'))) ||
|
||||
(patientCategory === 'EKSEKUTIF' && (normalized.includes('EKSEKUTIF') || normalized.includes('VIP'))) ||
|
||||
(normalized === 'BPJS' && patientCategory === 'JKN') ||
|
||||
(normalized === 'JKN' && patientCategory === 'JKN');
|
||||
|
||||
// Handle partial matches for complex payment types like "UMUM / JKMM / SPM / DLL"
|
||||
if (patientCategory === 'UMUM' && normalized.includes('UMUM')) return true;
|
||||
if (patientCategory === 'JKN' && (normalized.includes('JKN') || normalized.includes('BPJS'))) return true;
|
||||
if (patientCategory === 'EKSEKUTIF' && (normalized.includes('EKSEKUTIF') || normalized.includes('VIP'))) return true;
|
||||
|
||||
// Handle alias: BPJS = JKN (only this alias is allowed)
|
||||
if (normalized === 'BPJS' && patientCategory === 'JKN') return true;
|
||||
|
||||
return false;
|
||||
console.log(` - Checking loket accepts "${lp}" (normalized: "${normalized}") vs patient category "${patientCategory}": ${result}`);
|
||||
return result;
|
||||
});
|
||||
};
|
||||
|
||||
@@ -3008,7 +3005,15 @@ const fetchPatientsForLoket = async (loketId, force = false) => {
|
||||
console.log('📋 [queueStore] Payment Type:', paymentType, '| Clinic:', clinic.name, '| Clinic Code:', clinic.kode);
|
||||
|
||||
// 1. Find appropriate idloket based on BOTH clinic code AND payment type
|
||||
// IMPROVED: Check specifically for API-source lokets (id < 1000)
|
||||
const apiLoketsExist = loketStore.lokets?.some(l => l.source === 'api' || l.id < 1000);
|
||||
if (!apiLoketsExist) {
|
||||
console.log('🔄 [queueStore] API loket data empty, fetching from API...');
|
||||
await loketStore.fetchLoketFromAPI();
|
||||
}
|
||||
const allLokets = loketStore.lokets || [];
|
||||
|
||||
|
||||
|
||||
// Determine payment type for matching (normalize BPJS to JKN for API compatibility)
|
||||
const paymentTypeForMatching = paymentType === "BPJS" ? "JKN" : paymentType;
|
||||
|
||||
Reference in New Issue
Block a user