push loket perbaikan sedang dilayani
This commit is contained in:
+101
-31
@@ -365,22 +365,55 @@ export const useQueueStore = defineStore('queue', () => {
|
||||
return { success: false, message: "Tidak ada pasien yang menunggu untuk dipanggil" };
|
||||
}
|
||||
|
||||
// Update status dari 'menunggu' menjadi 'waiting' (sudah dipanggil, bisa check-in)
|
||||
// Track waktu panggilan untuk multiple calls detection
|
||||
const callTimestamp = new Date().toISOString();
|
||||
const index = allPatients.value.findIndex(p => p.no === nextPatient.no);
|
||||
if (index !== -1) {
|
||||
allPatients.value[index] = {
|
||||
...allPatients.value[index],
|
||||
status: "waiting",
|
||||
lastCalledAt: callTimestamp // Track waktu panggilan untuk multiple calls
|
||||
// Untuk adminType 'loket', tambahkan delay 5 detik sebelum status berubah
|
||||
// Ini untuk simulasi multiple loket memanggil bersamaan
|
||||
if (adminType === 'loket') {
|
||||
// Set status pending call dengan timestamp
|
||||
const pendingCallTimestamp = new Date().toISOString();
|
||||
const index = allPatients.value.findIndex(p => p.no === nextPatient.no);
|
||||
if (index !== -1) {
|
||||
allPatients.value[index] = {
|
||||
...allPatients.value[index],
|
||||
status: "pending-call", // Status sementara sebelum delay
|
||||
pendingCallAt: pendingCallTimestamp
|
||||
};
|
||||
}
|
||||
|
||||
// Set timeout 5 detik untuk mengubah status menjadi 'waiting'
|
||||
setTimeout(() => {
|
||||
const patientIndex = allPatients.value.findIndex(p => p.no === nextPatient.no);
|
||||
if (patientIndex !== -1 && allPatients.value[patientIndex].status === 'pending-call') {
|
||||
const callTimestamp = new Date().toISOString();
|
||||
allPatients.value[patientIndex] = {
|
||||
...allPatients.value[patientIndex],
|
||||
status: "waiting",
|
||||
lastCalledAt: callTimestamp, // Track waktu panggilan untuk multiple calls
|
||||
pendingCallAt: undefined // Clear pending call timestamp
|
||||
};
|
||||
}
|
||||
}, 5000); // Delay 5 detik
|
||||
|
||||
return {
|
||||
success: true,
|
||||
message: `Memanggil pasien ${nextPatient.noAntrian.split(" |")[0]} (akan dipanggil dalam 5 detik)`,
|
||||
};
|
||||
} else {
|
||||
// Untuk adminType selain loket, langsung update status
|
||||
const callTimestamp = new Date().toISOString();
|
||||
const index = allPatients.value.findIndex(p => p.no === nextPatient.no);
|
||||
if (index !== -1) {
|
||||
allPatients.value[index] = {
|
||||
...allPatients.value[index],
|
||||
status: "waiting",
|
||||
lastCalledAt: callTimestamp // Track waktu panggilan untuk multiple calls
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
success: true,
|
||||
message: `Memanggil pasien ${nextPatient.noAntrian.split(" |")[0]}`,
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
success: true,
|
||||
message: `Memanggil pasien ${nextPatient.noAntrian.split(" |")[0]}`,
|
||||
};
|
||||
};
|
||||
|
||||
const callMultiplePatients = (count, adminType = 'loket') => {
|
||||
@@ -426,24 +459,61 @@ export const useQueueStore = defineStore('queue', () => {
|
||||
|
||||
const patientsToCall = combinedList.slice(0, maxCallable);
|
||||
|
||||
// Update status dari 'menunggu' menjadi 'waiting' (sudah dipanggil, bisa check-in)
|
||||
// Track waktu panggilan untuk multiple calls detection - semua dipanggil dengan timestamp yang sama
|
||||
const callTimestamp = new Date().toISOString();
|
||||
patientsToCall.forEach((patient) => {
|
||||
const index = allPatients.value.findIndex(p => p.no === patient.no);
|
||||
if (index !== -1) {
|
||||
allPatients.value[index] = {
|
||||
...allPatients.value[index],
|
||||
status: "waiting",
|
||||
lastCalledAt: callTimestamp // Track waktu panggilan untuk multiple calls
|
||||
};
|
||||
}
|
||||
});
|
||||
// Untuk adminType 'loket', tambahkan delay 5 detik sebelum status berubah
|
||||
// Ini untuk simulasi multiple loket memanggil bersamaan
|
||||
if (adminType === 'loket') {
|
||||
// Set status pending call dengan timestamp
|
||||
const pendingCallTimestamp = new Date().toISOString();
|
||||
patientsToCall.forEach((patient) => {
|
||||
const index = allPatients.value.findIndex(p => p.no === patient.no);
|
||||
if (index !== -1) {
|
||||
allPatients.value[index] = {
|
||||
...allPatients.value[index],
|
||||
status: "pending-call", // Status sementara sebelum delay
|
||||
pendingCallAt: pendingCallTimestamp
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
// Set timeout 5 detik untuk mengubah status menjadi 'waiting'
|
||||
setTimeout(() => {
|
||||
const callTimestamp = new Date().toISOString();
|
||||
patientsToCall.forEach((patient) => {
|
||||
const patientIndex = allPatients.value.findIndex(p => p.no === patient.no);
|
||||
if (patientIndex !== -1 && allPatients.value[patientIndex].status === 'pending-call') {
|
||||
allPatients.value[patientIndex] = {
|
||||
...allPatients.value[patientIndex],
|
||||
status: "waiting",
|
||||
lastCalledAt: callTimestamp, // Track waktu panggilan untuk multiple calls
|
||||
pendingCallAt: undefined // Clear pending call timestamp
|
||||
};
|
||||
}
|
||||
});
|
||||
}, 5000); // Delay 5 detik
|
||||
|
||||
return {
|
||||
success: true,
|
||||
message: `Memanggil ${patientsToCall.length} pasien ke loket (akan dipanggil dalam 5 detik)`,
|
||||
};
|
||||
} else {
|
||||
// Untuk adminType selain loket, langsung update status
|
||||
const callTimestamp = new Date().toISOString();
|
||||
patientsToCall.forEach((patient) => {
|
||||
const index = allPatients.value.findIndex(p => p.no === patient.no);
|
||||
if (index !== -1) {
|
||||
allPatients.value[index] = {
|
||||
...allPatients.value[index],
|
||||
status: "waiting",
|
||||
lastCalledAt: callTimestamp // Track waktu panggilan untuk multiple calls
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
return {
|
||||
success: true,
|
||||
message: `Memanggil ${patientsToCall.length} pasien ke loket`,
|
||||
};
|
||||
return {
|
||||
success: true,
|
||||
message: `Memanggil ${patientsToCall.length} pasien ke loket`,
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
const processPatient = (patient, action, adminType = 'loket') => {
|
||||
|
||||
Reference in New Issue
Block a user