Files
simrsx-fe/app/schemas/person-contact.schema.ts
T
Khafid Prayoga f3474eb0b5 refactor(patient-contact): improve contact form components and validation
- Remove hardcoded contact limit and use prop instead
- Add ButtonAction component to form exports
- Enhance contact schema validation with better error messages
- Refactor contact type select component to use doc-entry components
- Improve form layout and consistency between contact and relative forms
2025-11-24 14:08:01 +07:00

16 lines
573 B
TypeScript

import { z } from 'zod'
const PersonContactBaseSchema = z.object({
contactType: z.string({ required_error: 'Mohon pilih tipe kontak' }).min(1, 'Mohon pilih tipe kontak'),
contactNumber: z.string({ required_error: 'Nomor kontak harus diisi' }).min(8, 'Nomor minimal 8 digit'),
})
const PersonContactListSchema = z.object({
contacts: z.array(PersonContactBaseSchema).min(1, 'Minimal 1 kontak'),
})
type PersonContactFormData = z.infer<typeof PersonContactListSchema>
export { PersonContactListSchema, PersonContactBaseSchema }
export type { PersonContactFormData }