feat: implement queue display system with localized store, composables, and administrative dashboard pages

This commit is contained in:
Fanrouver
2026-06-02 09:14:38 +07:00
parent ffdb88d13c
commit 047b39064d
12 changed files with 2345 additions and 46 deletions

No files matched your search

+28 -20
View File
@@ -395,19 +395,27 @@ export const useQueueStore = defineStore('queue', () => {
refreshedSomething = true;
}
if (!refreshedSomething) {
const interestingLokets = Object.keys(activeLoketInterest.value);
const interestingClinics = Object.keys(activeClinicInterest.value);
if (interestingLokets.length > 0) {
interestingLokets.forEach(loketId => { fetchPatientsForLoket(loketId, true); });
refreshedSomething = true;
}
if (interestingClinics.length > 0) {
interestingClinics.forEach(kodeKlinik => { fetchPatientsForClinic(kodeKlinik, true); });
refreshedSomething = true;
}
// ALWAYS refresh our own active interests when a WebSocket message is received,
// because shared lists (e.g. unassigned patients in 'menunggu') might have changed.
const interestingLokets = Object.keys(activeLoketInterest.value);
const interestingClinics = Object.keys(activeClinicInterest.value);
if (interestingLokets.length > 0) {
interestingLokets.forEach(loketId => {
if (String(loketId) !== String(targetLoketId)) {
fetchPatientsForLoket(loketId, true);
refreshedSomething = true;
}
});
}
if (interestingClinics.length > 0) {
interestingClinics.forEach(kodeKlinik => {
if (String(kodeKlinik) !== String(targetKlinikId)) {
fetchPatientsForClinic(kodeKlinik, true);
refreshedSomething = true;
}
});
}
if (!refreshedSomething) {
@@ -422,7 +430,7 @@ export const useQueueStore = defineStore('queue', () => {
url: wsBaseUrl,
clientId: wsClientId,
fallbackPostUrl: '/stats-api/ws',
reconnectInterval: 5000, // 5 seconds between reconnect attempts
reconnectInterval: 2000, // 2 seconds between reconnect attempts
maxReconnectAttempts: 9999, // Effectively infinite — never give up on remote machines
onOpen: () => {
console.log('✅ [queueStore] WebSocket connected');
@@ -3284,12 +3292,12 @@ const fetchPatientsForLoket = async (loketId, force = false) => {
console.log('✅ Check-in successful locally, patient status updated to di-loket');
// Sync to API
const apiSyncResult = await checkInPatientViaApi(allPatients.value[patientIndex].barcode);
if (!apiSyncResult.success) {
console.warn('⚠️ Check-in API sync failed:', apiSyncResult.message);
// We still return true because local state is updated, but we could also return failure if critical
}
// Sync to API in background (fire-and-forget to avoid blocking UI)
checkInPatientViaApi(allPatients.value[patientIndex].barcode).then(apiSyncResult => {
if (!apiSyncResult.success) {
console.warn('⚠️ Check-in API sync failed:', apiSyncResult.message);
}
});
return {
success: true,