feat: implement queue display and management system for loket and clinic modules voice over

This commit is contained in:
Fanrouver
2026-06-09 08:51:15 +07:00
parent f81dd57a16
commit 8b9c4725de
4 changed files with 145 additions and 12 deletions

No files matched your search

+10
View File
@@ -531,6 +531,11 @@ export const useQueueStore = defineStore('queue', () => {
*/
const syncApiPatientStatus = (patient, newStatus) => {
if (!patient) return;
// Bersihkan LocalStorage fallback jika status sudah bukan pending/terlambat
if (newStatus !== 'pending' && newStatus !== 'terlambat' && patient.barcode) {
localStorage.removeItem(`patient-status-${patient.barcode}`);
}
// Allow syncing if strictly 'api' OR if we can find a matching ID in the API store
// This handles cases where we have an 'onsite' patient locally that corresponds to an API patient
@@ -2224,6 +2229,10 @@ const fetchPatientsForLoket = async (loketId, force = false) => {
allPatients.value[patientIndex] = updatedPatient;
// Set currentProcessingPatient with isolated key
currentProcessingPatient.value[storageKey] = updatedPatient;
if (shouldUpdateStatus) {
syncApiPatientStatus(updatedPatient, "di-loket");
}
// POST to external API when patient is being processed (sedang diproses)
try {
@@ -2261,6 +2270,7 @@ const fetchPatientsForLoket = async (loketId, force = false) => {
};
allPatients.value[patientIndex] = updatedPatient;
currentProcessingPatient.value[storageKey] = updatedPatient;
syncApiPatientStatus(updatedPatient, "di-loket");
} else {
currentProcessingPatient.value[storageKey] = patient;
}