Files
simrsx-fe/app/schemas/person-relative.schema.ts
T
Khafid Prayoga 3cac23ce8a fix edit form state
fix: id list for contacts and address list

fix warning

fix duplicate contacts responsible: true

fix edit family

fix nik required
2025-12-10 14:36:32 +07:00

23 lines
858 B
TypeScript

import { z } from 'zod'
const ResponsibleContactPersonSchema = z.object({
id: z.number().optional(),
relation: z.string({ required_error: 'Pilih jenis Penanggung Jawab' }).min(1, 'Pilih jenis Penanggung Jawab'),
name: z.string({ required_error: 'Mohon lengkapi Nama' }).min(3, 'Mohon lengkapi Nama'),
address: z.string({ required_error: 'Mohon lengkapi Alamat' }).min(3, 'Mohon lengkapi Alamat'),
phone: z
.string({ required_error: 'Mohon lengkapi Nomor HP' })
.min(8, 'Nomor HP minimal 10 digit')
.max(15, 'Nomor HP maksimal 15 digit'),
})
const ResponsiblePersonSchema = z.object({
contacts: z.array(ResponsibleContactPersonSchema).min(1, 'Minimal harus ada 1 penanggung jawab'),
})
type PersonRelativeFormData = z.infer<typeof ResponsiblePersonSchema>
export { ResponsiblePersonSchema }
export type { PersonRelativeFormData }