diff --git a/pages/CheckInPasien/checkIn.vue b/pages/CheckInPasien/checkIn.vue index 6d05cc7..c6980cd 100644 --- a/pages/CheckInPasien/checkIn.vue +++ b/pages/CheckInPasien/checkIn.vue @@ -123,8 +123,8 @@
- mdi-information - Arahkan kamera ke QR code. Pastikan QR code berada dalam kotak pemindaian. + mdi-information + Arahkan kamera ke QR code. Pastikan QR code berada dalam kotak pemindaian.
@@ -313,72 +313,75 @@ :class="getStatusClass(item.status)" > -
-
- -
- - {{ getStatusIcon(item.status) }} - {{ getStatusText(item.status) }} - - - {{ item.method }} - -
- - -
-

- mdi-account-circle - {{ item.patientId }} -

-
- - -
- - mdi-ticket - {{ item.klinikQueueNumber }} - - - mdi-credit-card - {{ item.pembayaran }} - -
- - -
- - mdi-clock-outline - {{ formatTime(item.checkInTime) }} - -
+
+ +
+ + {{ getStatusIcon(item.status) }} + {{ getStatusText(item.status) }} + + + {{ item.method }} + +
+ + +
+

+ mdi-ticket + {{ item.klinikQueueNumber || item.queueNumber || 'N/A' }} +

+
+ + +
+ + mdi-account-circle + {{ item.patientId }} + + + mdi-credit-card + {{ item.pembayaran }} + +
+ + +
+ + mdi-clock-outline + {{ formatTime(item.checkInTime) }} +
@@ -887,24 +890,24 @@
- +

- mdi-account-circle - {{ item.patientId }} + mdi-ticket + {{ item.klinikQueueNumber || item.queueNumber || 'N/A' }}

- +
- mdi-ticket - {{ item.klinikQueueNumber }} + mdi-account-circle + {{ item.patientId }} { 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: {