Feat: add UI CRUD Surat Kontrol at Rehab Medik > kunjungan > Proses

This commit is contained in:
hasyim_kai
2025-10-27 10:21:59 +07:00
parent b90f0c1047
commit 89e0e7a2c8
22 changed files with 1307 additions and 19 deletions

No files matched your search

+40
View File
@@ -0,0 +1,40 @@
import { z } from 'zod'
const ControlLetterSchema = z.object({
sepStatus: z.string({
required_error: 'Mohon isi status SEP',
}),
SpesialisSubSpesialis: z.string({
required_error: 'Mohon isi status Spesialis/Sub Spesialis',
}),
dpjp: z.string({
required_error: 'Mohon isi status DPJP',
}),
controlDate: z.string({
required_error: 'Mohon lengkapi Tanggal Kontrol',
})
.refine(
(date) => {
// Jika kosong, return false untuk required validation
if (!date || date.trim() === '') return false
// Jika ada isi, validasi format tanggal
try {
const dateObj = new Date(date)
// Cek apakah tanggal valid dan tahun >= 1900
return !isNaN(dateObj.getTime()) && dateObj.getFullYear() >= 1900
} catch {
return false
}
},
{
message: 'Mohon lengkapi Tanggal Kontrol dengan format yang valid',
},
)
.transform((dateStr) => new Date(dateStr).toISOString()),
})
type ControlLetterFormData = z.infer<typeof ControlLetterSchema>
export { ControlLetterSchema }
export type { ControlLetterFormData }