46911514fb
feat: implement postal region model and update address handling - Add new PostalRegion model and service - Replace postalCode with postalRegion in address-related components - Update schemas and models to use locationType_code consistently - Add usePostalRegion composable for postal code selection - Modify patient form to handle address changes more robustly feat(patient): add ID column and improve date formatting - Add patient ID column to patient list - Format dates using 'id-ID' locale in preview - Update identity number display for foreign patients - Include passport number for foreign nationals
35 lines
936 B
TypeScript
35 lines
936 B
TypeScript
import { z } from 'zod'
|
|
|
|
const PersonAddressSchema = z.object({
|
|
locationType_code: z.string({
|
|
required_error: 'Mohon pilih jenis alamat',
|
|
}),
|
|
address: z.string({
|
|
required_error: 'Mohon lengkapi alamat',
|
|
}),
|
|
province_code: z.string({
|
|
required_error: 'Mohon pilih provinsi',
|
|
}),
|
|
regency_code: z.string({
|
|
required_error: 'Mohon pilih kabupaten/kota',
|
|
}),
|
|
district_code: z.string({
|
|
required_error: 'Mohon pilih kecamatan',
|
|
}),
|
|
village_code: z.string({
|
|
required_error: 'Mohon pilih kelurahan',
|
|
}),
|
|
postalRegion_code: z.string({
|
|
required_error: 'Mohon lengkapi kode pos',
|
|
}),
|
|
// .min(5, 'Kode pos harus berupa angka 5 digit')
|
|
// .regex(/^\d+$/, 'Kode pos harus berupa angka 5 digit'),
|
|
rt: z.string().optional(),
|
|
rw: z.string().optional(),
|
|
})
|
|
|
|
type PersonAddressFormData = z.infer<typeof PersonAddressSchema>
|
|
|
|
export { PersonAddressSchema }
|
|
export type { PersonAddressFormData }
|