update logika dan flow anjungan, master, store
This commit is contained in:
+55
-36
@@ -3,8 +3,8 @@ import { defineStore } from 'pinia';
|
||||
import { ref, computed } from 'vue';
|
||||
|
||||
export const useQueueStore = defineStore('queue', () => {
|
||||
// State
|
||||
const allPatients = ref([
|
||||
// Seed data for easy reset during dev
|
||||
const seedPatients = [
|
||||
{
|
||||
no: 1,
|
||||
jamPanggil: "12:49",
|
||||
@@ -12,10 +12,10 @@ export const useQueueStore = defineStore('queue', () => {
|
||||
noAntrian: "UM1001 | Online - 250811100163",
|
||||
shift: "Shift 1",
|
||||
klinik: "KANDUNGAN",
|
||||
fastTrack: "TIDAK",
|
||||
pembayaran: "UMUM",
|
||||
status: "waiting", // waiting, di-loket, terlambat, pending, processed
|
||||
processStage: "loket", // loket, klinik, penunjang
|
||||
fastTrack: "YA", // Fast Track Patient
|
||||
pembayaran: "BPJS",
|
||||
status: "waiting",
|
||||
processStage: "loket",
|
||||
createdAt: new Date().toISOString(),
|
||||
},
|
||||
{
|
||||
@@ -38,8 +38,8 @@ export const useQueueStore = defineStore('queue', () => {
|
||||
noAntrian: "UM1003 | Online - 250811100200",
|
||||
shift: "Shift 1",
|
||||
klinik: "SARAF",
|
||||
fastTrack: "TIDAK",
|
||||
pembayaran: "UMUM",
|
||||
fastTrack: "YA", // Fast Track Patient
|
||||
pembayaran: "BPJS",
|
||||
status: "waiting",
|
||||
processStage: "loket",
|
||||
createdAt: new Date().toISOString(),
|
||||
@@ -57,28 +57,28 @@ export const useQueueStore = defineStore('queue', () => {
|
||||
processStage: "loket",
|
||||
createdAt: new Date().toISOString(),
|
||||
},
|
||||
{
|
||||
{
|
||||
no: 5,
|
||||
jamPanggil: "12:49",
|
||||
barcode: "250811100163",
|
||||
noAntrian: "UM1001 | Online - 250811100163",
|
||||
shift: "Shift 1",
|
||||
noAntrian: "UM1005 | Online - 250811100163",
|
||||
shift: "Shift 2",
|
||||
klinik: "KANDUNGAN",
|
||||
fastTrack: "TIDAK",
|
||||
pembayaran: "UMUM",
|
||||
status: "waiting", // waiting, di-loket, terlambat, pending, processed
|
||||
processStage: "loket", // loket, klinik, penunjang
|
||||
status: "waiting",
|
||||
processStage: "loket",
|
||||
createdAt: new Date().toISOString(),
|
||||
},
|
||||
{
|
||||
no: 6,
|
||||
jamPanggil: "10:52",
|
||||
barcode: "250811100155",
|
||||
noAntrian: "UM1002 | Online - 250811100155",
|
||||
noAntrian: "UM1006 | Online - 250811100155",
|
||||
shift: "Shift 1",
|
||||
klinik: "IPD",
|
||||
fastTrack: "TIDAK",
|
||||
pembayaran: "UMUM",
|
||||
fastTrack: "YA", // Fast Track Patient
|
||||
pembayaran: "BPJS",
|
||||
status: "waiting",
|
||||
processStage: "loket",
|
||||
createdAt: new Date().toISOString(),
|
||||
@@ -87,7 +87,7 @@ export const useQueueStore = defineStore('queue', () => {
|
||||
no: 7,
|
||||
jamPanggil: "09:30",
|
||||
barcode: "250811100200",
|
||||
noAntrian: "UM1003 | Online - 250811100200",
|
||||
noAntrian: "UM1007 | Online - 250811100200",
|
||||
shift: "Shift 1",
|
||||
klinik: "SARAF",
|
||||
fastTrack: "TIDAK",
|
||||
@@ -100,7 +100,7 @@ export const useQueueStore = defineStore('queue', () => {
|
||||
no: 8,
|
||||
jamPanggil: "14:15",
|
||||
barcode: "250811100210",
|
||||
noAntrian: "UM1004 | Online - 250811100210",
|
||||
noAntrian: "UM1008 | Online - 250811100210",
|
||||
shift: "Shift 1",
|
||||
klinik: "THT",
|
||||
fastTrack: "TIDAK",
|
||||
@@ -109,24 +109,24 @@ export const useQueueStore = defineStore('queue', () => {
|
||||
processStage: "loket",
|
||||
createdAt: new Date().toISOString(),
|
||||
},
|
||||
{
|
||||
{
|
||||
no: 9,
|
||||
jamPanggil: "12:49",
|
||||
barcode: "250811100163",
|
||||
noAntrian: "UM1001 | Online - 250811100163",
|
||||
shift: "Shift 1",
|
||||
noAntrian: "UM1009 | Online - 250811100163",
|
||||
shift: "Shift 2",
|
||||
klinik: "KANDUNGAN",
|
||||
fastTrack: "TIDAK",
|
||||
pembayaran: "UMUM",
|
||||
status: "waiting", // waiting, di-loket, terlambat, pending, processed
|
||||
processStage: "loket", // loket, klinik, penunjang
|
||||
fastTrack: "YA", // Fast Track Patient
|
||||
pembayaran: "BPJS",
|
||||
status: "waiting",
|
||||
processStage: "loket",
|
||||
createdAt: new Date().toISOString(),
|
||||
},
|
||||
{
|
||||
no: 10,
|
||||
jamPanggil: "10:52",
|
||||
barcode: "250811100155",
|
||||
noAntrian: "UM1002 | Online - 250811100155",
|
||||
noAntrian: "UM1010 | Online - 250811100155",
|
||||
shift: "Shift 1",
|
||||
klinik: "IPD",
|
||||
fastTrack: "TIDAK",
|
||||
@@ -139,7 +139,7 @@ export const useQueueStore = defineStore('queue', () => {
|
||||
no: 11,
|
||||
jamPanggil: "09:30",
|
||||
barcode: "250811100200",
|
||||
noAntrian: "UM1003 | Online - 250811100200",
|
||||
noAntrian: "UM1011 | Online - 250811100200",
|
||||
shift: "Shift 1",
|
||||
klinik: "SARAF",
|
||||
fastTrack: "TIDAK",
|
||||
@@ -152,16 +152,21 @@ export const useQueueStore = defineStore('queue', () => {
|
||||
no: 12,
|
||||
jamPanggil: "14:15",
|
||||
barcode: "250811100210",
|
||||
noAntrian: "UM1004 | Online - 250811100210",
|
||||
shift: "Shift 1",
|
||||
noAntrian: "UM1012 | Online - 250811100210",
|
||||
shift: "Shift 2",
|
||||
klinik: "THT",
|
||||
fastTrack: "TIDAK",
|
||||
pembayaran: "UMUM",
|
||||
fastTrack: "YA", // Fast Track Patient
|
||||
pembayaran: "BPJS",
|
||||
status: "waiting",
|
||||
processStage: "loket",
|
||||
createdAt: new Date().toISOString(),
|
||||
},
|
||||
]);
|
||||
];
|
||||
|
||||
const cloneSeed = () => seedPatients.map(p => ({ ...p }));
|
||||
|
||||
// State
|
||||
const allPatients = ref(cloneSeed());
|
||||
|
||||
const quotaUsed = ref(5);
|
||||
const currentProcessingPatient = ref({
|
||||
@@ -198,6 +203,14 @@ export const useQueueStore = defineStore('queue', () => {
|
||||
const getPatientsByStage = (stage) => {
|
||||
return computed(() => {
|
||||
const patients = allPatients.value.filter(p => p.processStage === stage);
|
||||
|
||||
// Debug log
|
||||
console.log(`getPatientsByStage(${stage}):`, patients.length, 'patients');
|
||||
if (patients.length > 0) {
|
||||
console.log('Sample patient properties:', Object.keys(patients[0]));
|
||||
console.log('Sample fastTrack values:', patients.map(p => p.fastTrack));
|
||||
}
|
||||
|
||||
return {
|
||||
all: patients,
|
||||
waiting: patients.filter(p => p.status === 'waiting'),
|
||||
@@ -217,6 +230,12 @@ export const useQueueStore = defineStore('queue', () => {
|
||||
|
||||
const totalPasien = computed(() => allPatients.value.length);
|
||||
|
||||
const resetPatients = () => {
|
||||
allPatients.value = cloneSeed();
|
||||
quotaUsed.value = 5;
|
||||
currentProcessingPatient.value = { loket: null, klinik: null, penunjang: null };
|
||||
};
|
||||
|
||||
// Actions
|
||||
const callNext = (adminType = 'loket') => {
|
||||
const stageMap = {
|
||||
@@ -396,9 +415,9 @@ export const useQueueStore = defineStore('queue', () => {
|
||||
noAntrian: `KL${String(newNo).padStart(4, "0")} | Klinik - ${barcode}`,
|
||||
shift: "Shift 1",
|
||||
klinik: klinik.name,
|
||||
fastTrack: "UMUM",
|
||||
fastTrack: "TIDAK",
|
||||
pembayaran: "UMUM",
|
||||
status: "di-loket", // Langsung masuk tabel Di Loket Klinik
|
||||
status: "di-loket",
|
||||
processStage: "klinik",
|
||||
createdAt: timestamp.toISOString(),
|
||||
};
|
||||
@@ -426,9 +445,9 @@ export const useQueueStore = defineStore('queue', () => {
|
||||
noAntrian: `PN${String(newNo).padStart(4, "0")} | Penunjang - ${barcode}`,
|
||||
shift: "Shift 1",
|
||||
klinik: penunjang.name,
|
||||
fastTrack: "UMUM",
|
||||
fastTrack: "TIDAK",
|
||||
pembayaran: patient ? patient.pembayaran : "UMUM",
|
||||
status: "di-loket", // Langsung masuk tabel Di Loket Penunjang
|
||||
status: "di-loket",
|
||||
processStage: "penunjang",
|
||||
createdAt: timestamp.toISOString(),
|
||||
referencePatient: patient ? patient.noAntrian : null,
|
||||
|
||||
Reference in New Issue
Block a user