diff --git a/pages/Anjungan/AntreanMasuk/[id].vue b/pages/Anjungan/AntreanMasuk/[id].vue index 6e0330d..4afd791 100644 --- a/pages/Anjungan/AntreanMasuk/[id].vue +++ b/pages/Anjungan/AntreanMasuk/[id].vue @@ -9,7 +9,7 @@ src="/Rumah_Sakit_Umum_Daerah_Dr._Saiful_Anwar.webp" alt="RSUD Logo" class="header-logo" - /> + >

RSUD dr. Saiful Anwar Provinsi Jawa Timur

@@ -48,10 +48,11 @@ class="queue-display" :class="{ 'has-scroll': loketData.queues.length > 20 }" > -
+ +
@@ -59,14 +60,14 @@
mdi-flash
-
{{ queue.noAntrian.split(" |")[0] }}
+
{{ queue.noAntrian?.split(" |")[0] || queue.no || '' }}
mdi-minus-circle-outline @@ -89,7 +90,7 @@
-
+
@@ -101,7 +102,7 @@
-
+
@@ -175,14 +176,22 @@ const setQueueDisplayRef = (loketId, el) => { } // Get all patients with processStage 'loket' +// Force reactivity by accessing the computed result directly const loketPatients = computed(() => { try { - const result = queueStore.getPatientsByStage('loket') - if (result && result.value && Array.isArray(result.value.all)) { - return result.value.all + // Get the computed result from store + const stageResult = queueStore.getPatientsByStage('loket') + + // Access .value to get the actual computed value + // This ensures reactivity after store hydration + if (stageResult && stageResult.value) { + const patients = stageResult.value.all || [] + // Ensure it's an array and filter out any null/undefined + return Array.isArray(patients) ? patients.filter(p => p != null) : [] } return [] - } catch { + } catch (error) { + console.error('Error getting loket patients:', error) return [] } }) @@ -428,6 +437,30 @@ const startAutoScroll = () => { }) } +// Watch loketPatients to ensure reactivity after refresh +watch(loketPatients, (newPatients) => { + // Force update by accessing the computed + // This ensures reactivity after store hydration + if (newPatients && newPatients.length > 0) { + console.log('Loket patients updated:', newPatients.length) + } +}, { immediate: true, deep: true }) + +// Watch store's getPatientsByStage to ensure reactivity after refresh +watch(() => { + try { + const result = queueStore.getPatientsByStage('loket') + return result?.value?.all || [] + } catch { + return [] + } +}, (newPatients) => { + // Force reactivity update + if (newPatients && newPatients.length > 0) { + console.log('Store loket patients updated:', newPatients.length) + } +}, { immediate: true, deep: true }) + // Watch displayedLokets untuk restart auto-scroll watch(displayedLokets, () => { startAutoScroll() @@ -443,6 +476,25 @@ onMounted(() => { return } + // Force reactivity by accessing store data after delays + // This ensures store is fully hydrated after refresh + setTimeout(() => { + // Access loketPatients to trigger computed + const _ = loketPatients.value + // Access calledForCheckIn to trigger computed + const __ = calledForCheckIn.value + // Access displayedLokets to trigger computed + const ___ = displayedLokets.value + }, 100) + + // Additional delay to ensure store hydration is complete + setTimeout(() => { + // Force re-computation by accessing again + const _ = loketPatients.value + const __ = calledForCheckIn.value + const ___ = displayedLokets.value + }, 300) + updateTime() timeInterval = setInterval(updateTime, 1000) @@ -736,7 +788,7 @@ onUnmounted(() => { .ticket-number { font-size: 28px; font-weight: 800; - color: #FF8441; + color: #3556AE; letter-spacing: 1px; line-height: 1.2; } @@ -1057,7 +1109,7 @@ onUnmounted(() => { .ticket-number { font-size: 20px; - color: #E65A0D; + color: #3556AE; } .ticket-card { @@ -1103,7 +1155,7 @@ onUnmounted(() => { .ticket-number { font-size: 20px; - color: #E65A0D; + color: #3556AE; } }