Perubahan format No Antrean
This commit is contained in:
+41
-2
@@ -881,6 +881,43 @@ export const useQueueStore = defineStore('queue', () => {
|
||||
currentProcessingPatient.value[adminType] = patient;
|
||||
};
|
||||
|
||||
// Helper function untuk generate nomor antrean baru
|
||||
// Format: 2 huruf (kode klinik) + 3 digit (001-999)
|
||||
// Jika pembayaran BPJS: gunakan kode klinik dari master
|
||||
// Jika pembayaran UMUM/JKMM/SPM/DLL: gunakan "UM" sebagai prefix
|
||||
const generateQueueNumber = (clinic, paymentType) => {
|
||||
// Tentukan prefix berdasarkan jenis pembayaran
|
||||
let prefix = 'UM'; // Default untuk UMUM/JKMM/SPM/DLL
|
||||
|
||||
if (paymentType === 'BPJS') {
|
||||
// Gunakan kode klinik dari master (2 huruf)
|
||||
const clinicCode = clinic?.kode || clinic?.code || 'UM';
|
||||
prefix = clinicCode.length >= 2 ? clinicCode.substring(0, 2).toUpperCase() : 'UM';
|
||||
}
|
||||
|
||||
// Get counter untuk klinik ini per hari
|
||||
const today = new Date().toISOString().split('T')[0]; // YYYY-MM-DD
|
||||
const counterKey = `queue_counter_${prefix}_${today}`;
|
||||
|
||||
// Get current counter dari localStorage
|
||||
let counter = 0;
|
||||
if (typeof window !== 'undefined') {
|
||||
const stored = localStorage.getItem(counterKey);
|
||||
counter = stored ? parseInt(stored, 10) : 0;
|
||||
}
|
||||
|
||||
// Increment counter (max 999)
|
||||
counter = Math.min(counter + 1, 999);
|
||||
|
||||
// Save counter back to localStorage
|
||||
if (typeof window !== 'undefined') {
|
||||
localStorage.setItem(counterKey, counter.toString());
|
||||
}
|
||||
|
||||
// Format: prefix (2 huruf) + 3 digit
|
||||
return `${prefix}${String(counter).padStart(3, '0')}`;
|
||||
};
|
||||
|
||||
// Register patient from Anjungan (onsite registration)
|
||||
const registerPatientFromAnjungan = (clinic, paymentType, visitType = 'SEKARANG', visitDate = null, shift = 'Shift 1', namaDokter = null) => {
|
||||
const newNo = allPatients.value.length > 0
|
||||
@@ -896,8 +933,9 @@ export const useQueueStore = defineStore('queue', () => {
|
||||
// Generate barcode (simulasi - bisa diganti dengan API call)
|
||||
const barcode = `250811${String(Date.now()).slice(-6)}${String(newNo).padStart(3, "0")}`;
|
||||
|
||||
// Format nomor antrean: UMXXXX | Onsite - barcode
|
||||
const noAntrian = `UM${String(newNo).padStart(4, "0")} | Onsite - ${barcode}`;
|
||||
// Generate nomor antrean dengan format baru: 2 huruf + 3 digit
|
||||
const queueNumber = generateQueueNumber(clinic, paymentType);
|
||||
const noAntrian = `${queueNumber} | Onsite - ${barcode}`;
|
||||
|
||||
// Status awal untuk pasien dari anjungan adalah "menunggu" (belum dipanggil)
|
||||
// Hanya setelah dipanggil oleh admin loket, status berubah menjadi "waiting" (bisa check-in)
|
||||
@@ -1066,6 +1104,7 @@ export const useQueueStore = defineStore('queue', () => {
|
||||
setCurrentProcessing,
|
||||
registerPatientFromAnjungan,
|
||||
checkInPatient,
|
||||
generateQueueNumber,
|
||||
};
|
||||
}, {
|
||||
persist: {
|
||||
|
||||
Reference in New Issue
Block a user