perubahan tiket dan alur antrean

This commit is contained in:
Fanrouver
2026-01-12 11:52:45 +07:00
parent 6e7160c935
commit 5c142273aa
13 changed files with 997 additions and 393 deletions
+12 -1
View File
@@ -91,11 +91,22 @@ export default defineEventHandler(async (event: H3Event) => {
})
}
// Helper function untuk generate barcode dengan format: YYMMDD + 5 digit random
const generateBarcode = () => {
const now = new Date();
const year = String(now.getFullYear()).slice(-2); // 2 digit tahun terakhir
const month = String(now.getMonth() + 1).padStart(2, '0'); // 2 digit bulan
const day = String(now.getDate()).padStart(2, '0'); // 2 digit tanggal
const randomCode = String(Math.floor(Math.random() * 100000)).padStart(5, '0'); // 5 digit random
return `${year}${month}${day}${randomCode}`;
};
// Generate patient data
const barcode = generateBarcode();
const newPatient: Patient = {
no: mockDB.length + 1,
jamPanggil: new Date().toLocaleTimeString('id-ID', { hour: '2-digit', minute: '2-digit' }),
barcode: `250811${String(Date.now()).slice(-6)}${String(mockDB.length + 1).padStart(3, '0')}`,
barcode: barcode,
noAntrian: `UM${String(mockDB.length + 1).padStart(4, '0')} | Onsite - ${barcode}`,
shift: body.shift || 'Shift 1',
klinik: body.clinic,