Merge branch 'dev' of github.com:dikstub-rssa/simrs-fe into feat/patient-63-adjustment
This commit is contained in:
No files matched your search
@@ -3,7 +3,7 @@ import type { CreateDto } from '~/models/consultation'
|
||||
|
||||
const ConsultationSchema = z.object({
|
||||
date: z.string({ required_error: 'Tanggal harus diisi' }),
|
||||
dstUnit_id: z.number({ required_error: 'Unit harus diisi' }),
|
||||
dstUnit_code: z.string({ required_error: 'Unit harus diisi' }),
|
||||
problem: z.string({ required_error: 'Uraian harus diisi' }).min(20, 'Uraian minimum 20 karakter'),
|
||||
})
|
||||
|
||||
|
||||
@@ -4,8 +4,9 @@ import { InternalReferenceSchema } from './internal-reference.schema'
|
||||
// Check In
|
||||
const CheckInSchema = z.object({
|
||||
// registeredAt: z.string({ required_error: 'Tanggal masuk harus diisi' }),
|
||||
responsible_doctor_id: z.number({ required_error: 'Dokter harus diisi' }).gt(0, 'Dokter harus diisi'),
|
||||
adm_employee_id: z.number({ required_error: 'PJA harus diisi' }).gt(0, 'PJA harus diisi'),
|
||||
responsible_doctor_code: z.string({ required_error: 'Dokter harus diisi' }),
|
||||
// adm_employee_id: z.number({ required_error: 'PJA harus diisi' }).gt(0, 'PJA harus diisi'),
|
||||
registeredAt: z.string({ required_error: 'waktu harus diisi' }),
|
||||
})
|
||||
type CheckInFormData = z.infer<typeof CheckInSchema>
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ const IntegrationBpjsSchema = z
|
||||
.optional(),
|
||||
destinationClinic: z
|
||||
.string({ required_error: ERROR_MESSAGES.required.destinationClinic })
|
||||
.min(1, ERROR_MESSAGES.required.destinationClinic),
|
||||
.min(1, ERROR_MESSAGES.required.destinationClinic).optional(),
|
||||
attendingDoctor: z
|
||||
.string({ required_error: ERROR_MESSAGES.required.attendingDoctor })
|
||||
.min(1, ERROR_MESSAGES.required.attendingDoctor),
|
||||
@@ -89,7 +89,7 @@ const IntegrationBpjsSchema = z
|
||||
cataract: z.string({ required_error: ERROR_MESSAGES.required.cataract }).min(1, ERROR_MESSAGES.required.cataract),
|
||||
clinicExcecutive: z
|
||||
.string({ required_error: ERROR_MESSAGES.required.clinicExcecutive })
|
||||
.min(1, ERROR_MESSAGES.required.clinicExcecutive),
|
||||
.min(1, ERROR_MESSAGES.required.clinicExcecutive).optional(),
|
||||
subSpecialistId: z
|
||||
.string({ required_error: ERROR_MESSAGES.required.subSpecialistId })
|
||||
.min(1, ERROR_MESSAGES.required.subSpecialistId)
|
||||
|
||||
@@ -2,10 +2,12 @@ import { z } from 'zod'
|
||||
|
||||
const ERROR_MESSAGES = {
|
||||
required: {
|
||||
doctorId: 'Dokter wajib diisi',
|
||||
doctor_code: 'Dokter wajib diisi',
|
||||
registerDate: 'Tanggal Daftar wajib diisi',
|
||||
paymentType: 'Jenis Pembayaran wajib diisi',
|
||||
subSpecialistId: 'Subspesialis wajib diisi',
|
||||
paymentMethod_code: 'Jenis Pembayaran wajib diisi',
|
||||
unit_code: 'Spesialis wajib diisi',
|
||||
// specialist_code: 'Spesialis wajib diisi',
|
||||
// subSpecialist_code: 'Subspesialis wajib diisi',
|
||||
patientCategory: 'Kelompok Peserta wajib diisi',
|
||||
cardNumber: 'No. Kartu BPJS wajib diisi',
|
||||
sepType: 'Jenis SEP wajib diisi',
|
||||
@@ -21,22 +23,22 @@ const IntegrationEncounterSchema = z
|
||||
patientName: z.string().optional(),
|
||||
nationalIdentity: z.string().optional(),
|
||||
medicalRecordNumber: z.string().optional(),
|
||||
|
||||
|
||||
// Visit data
|
||||
doctorId: z
|
||||
.string({ required_error: ERROR_MESSAGES.required.doctorId })
|
||||
.min(1, ERROR_MESSAGES.required.doctorId),
|
||||
subSpecialistId: z
|
||||
.string({ required_error: ERROR_MESSAGES.required.subSpecialistId })
|
||||
.min(1, ERROR_MESSAGES.required.subSpecialistId)
|
||||
doctor_code: z
|
||||
.string({ required_error: ERROR_MESSAGES.required.doctor_code })
|
||||
.min(1, ERROR_MESSAGES.required.doctor_code),
|
||||
unit_code: z
|
||||
.string({ required_error: ERROR_MESSAGES.required.unit_code })
|
||||
.min(1, ERROR_MESSAGES.required.unit_code)
|
||||
.optional(),
|
||||
registerDate: z
|
||||
.string({ required_error: ERROR_MESSAGES.required.registerDate })
|
||||
.min(1, ERROR_MESSAGES.required.registerDate),
|
||||
paymentType: z
|
||||
.string({ required_error: ERROR_MESSAGES.required.paymentType })
|
||||
.min(1, ERROR_MESSAGES.required.paymentType),
|
||||
|
||||
paymentMethod_code: z
|
||||
.string({ required_error: ERROR_MESSAGES.required.paymentMethod_code })
|
||||
.min(1, ERROR_MESSAGES.required.paymentMethod_code),
|
||||
|
||||
// BPJS related fields
|
||||
patientCategory: z
|
||||
.string()
|
||||
@@ -51,10 +53,9 @@ const IntegrationEncounterSchema = z
|
||||
.min(1, ERROR_MESSAGES.required.sepType)
|
||||
.optional(),
|
||||
sepNumber: z
|
||||
.string()
|
||||
.min(1, ERROR_MESSAGES.required.sepNumber)
|
||||
.string({ required_error: ERROR_MESSAGES.required.sepNumber })
|
||||
.optional(),
|
||||
|
||||
|
||||
// File uploads
|
||||
sepFile: z
|
||||
.any()
|
||||
@@ -76,7 +77,7 @@ const IntegrationEncounterSchema = z
|
||||
.refine(
|
||||
(data) => {
|
||||
// If payment type is jkn, then patient category is required
|
||||
if (data.paymentType === 'jkn') {
|
||||
if (data.paymentMethod_code === 'jkn') {
|
||||
return data.patientCategory && data.patientCategory.trim() !== ''
|
||||
}
|
||||
return true
|
||||
@@ -89,7 +90,7 @@ const IntegrationEncounterSchema = z
|
||||
.refine(
|
||||
(data) => {
|
||||
// If payment type is jkn, then card number is required
|
||||
if (data.paymentType === 'jkn') {
|
||||
if (data.paymentMethod_code === 'jkn') {
|
||||
return data.cardNumber && data.cardNumber.trim() !== ''
|
||||
}
|
||||
return true
|
||||
@@ -102,7 +103,7 @@ const IntegrationEncounterSchema = z
|
||||
.refine(
|
||||
(data) => {
|
||||
// If payment type is jkn, then SEP type is required
|
||||
if (data.paymentType === 'jkn') {
|
||||
if (data.paymentMethod_code === 'jkn') {
|
||||
return data.sepType && data.sepType.trim() !== ''
|
||||
}
|
||||
return true
|
||||
@@ -115,7 +116,7 @@ const IntegrationEncounterSchema = z
|
||||
.refine(
|
||||
(data) => {
|
||||
// If payment type is jkn and SEP type is selected, then SEP number is required
|
||||
if (data.paymentType === 'jkn' && data.sepType && data.sepType.trim() !== '') {
|
||||
if (data.paymentMethod_code === 'jkn' && data.sepType && data.sepType.trim() !== '') {
|
||||
return data.sepNumber && data.sepNumber.trim() !== ''
|
||||
}
|
||||
return true
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
import { z } from 'zod'
|
||||
|
||||
type KfrFormData = z.infer<typeof KfrSchema>
|
||||
const KfrSchema = z.object({
|
||||
subjective: z.string({required_error: 'Mohon lengkapi Form',}),
|
||||
objective: z.string({required_error: 'Mohon lengkapi Form',}),
|
||||
assesment: z.string({required_error: 'Mohon lengkapi Form',}),
|
||||
planningGoal: z.string({required_error: 'Mohon lengkapi Form',}),
|
||||
planningAction: z.string({required_error: 'Mohon lengkapi Form',}),
|
||||
planningEducation: z.string({required_error: 'Mohon lengkapi Form',}),
|
||||
planningFrequency: z.number({required_error: 'Mohon lengkapi Form',}),
|
||||
followUpPlan: z.enum(['EVALUASI', 'RUJUK', "SELESAI"], {required_error: 'Mohon lengkapi status pasien', }),
|
||||
followUpPlanDesc: z.string({required_error: 'Mohon lengkapi Form',}),
|
||||
})
|
||||
|
||||
export { KfrSchema, }
|
||||
export type { KfrFormData, }
|
||||
@@ -0,0 +1,12 @@
|
||||
import { z } from 'zod'
|
||||
import type { MaterialPackageItem } from '~/models/material-package-item'
|
||||
|
||||
const MaterialSchema = z.object({
|
||||
materialPackage_code: z.string({ required_error: 'Kode harus diisi' }).min(1, 'Kode minimum 1 karakter'),
|
||||
material_code: z.string({ required_error: 'Nama harus diisi' }).min(1, 'Nama minimum 1 karakter'),
|
||||
})
|
||||
|
||||
type MaterialFormData = z.infer<typeof MaterialSchema> & Partial<MaterialPackageItem>
|
||||
|
||||
export { MaterialSchema }
|
||||
export type { MaterialFormData }
|
||||
@@ -0,0 +1,12 @@
|
||||
import { z } from 'zod'
|
||||
import type { MaterialPackage } from '~/models/material-package'
|
||||
|
||||
const MaterialSchema = z.object({
|
||||
code: z.string({ required_error: 'Kode harus diisi' }).min(1, 'Kode minimum 1 karakter'),
|
||||
name: z.string({ required_error: 'Nama harus diisi' }).min(1, 'Nama minimum 1 karakter'),
|
||||
})
|
||||
|
||||
type MaterialFormData = z.infer<typeof MaterialSchema> & Partial<MaterialPackage>
|
||||
|
||||
export { MaterialSchema }
|
||||
export type { MaterialFormData }
|
||||
@@ -0,0 +1,27 @@
|
||||
import { z } from 'zod'
|
||||
|
||||
const PrbMedicineSchema = z.object({
|
||||
a1: z.string({
|
||||
required_error: 'Mohon isi',
|
||||
}).optional(),
|
||||
a2: z.string({
|
||||
required_error: 'Mohon isi',
|
||||
}),
|
||||
a3: z.string({
|
||||
required_error: 'Mohon isi',
|
||||
}),
|
||||
a4: z.string({
|
||||
required_error: 'Mohon isi',
|
||||
}).optional(),
|
||||
a5: z.string({
|
||||
required_error: 'Mohon isi',
|
||||
}),
|
||||
a6: z.string({
|
||||
required_error: 'Mohon isi',
|
||||
}),
|
||||
})
|
||||
|
||||
type PrbMedicineFormData = z.infer<typeof PrbMedicineSchema>
|
||||
|
||||
export { PrbMedicineSchema }
|
||||
export type { PrbMedicineFormData }
|
||||
@@ -0,0 +1,47 @@
|
||||
import { z } from 'zod'
|
||||
|
||||
const PrbSchema = z.object({
|
||||
sepStatus: z.string({
|
||||
required_error: 'Mohon isi status SEP',
|
||||
}).default('SEP Internal'),
|
||||
unit_code: z.string({
|
||||
required_error: 'Mohon isi Unit',
|
||||
}),
|
||||
specialist_code: z.string({
|
||||
required_error: 'Mohon isi Spesialis',
|
||||
}),
|
||||
subspecialist_code: z.string({
|
||||
required_error: 'Mohon isi Sub Spesialis',
|
||||
}),
|
||||
doctor_code: z.string({
|
||||
required_error: 'Mohon isi DPJP',
|
||||
}),
|
||||
encounter_code: z.string().optional(),
|
||||
date: 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 PrbFormData = z.infer<typeof PrbSchema>
|
||||
|
||||
export { PrbSchema }
|
||||
export type { PrbFormData }
|
||||
@@ -153,6 +153,32 @@ export const ObjectSchema = z.object({
|
||||
'head-to-toe': z.record(z.string()).default({}),
|
||||
})
|
||||
|
||||
export const InitialNursingSchema = z.object({
|
||||
'pri-complain': z.string().default(''),
|
||||
'med-type': z.string().default(''),
|
||||
'med-name': z.string().default(''),
|
||||
'med-reaction': z.string().default(''),
|
||||
'food-type': z.string().default(''),
|
||||
'food-name': z.string().default(''),
|
||||
'food-reaction': z.string().default(''),
|
||||
'other-type': z.string().default(''),
|
||||
'other-name': z.string().default(''),
|
||||
'other-reaction': z.string().default(''),
|
||||
'pain-asst': z.string().default(''),
|
||||
'pain-scale': z.string().default(''),
|
||||
'pain-time': z.string().default(''),
|
||||
'pain-duration': z.string().default(''),
|
||||
'pain-freq': z.string().default(''),
|
||||
'pain-loc': z.string().default(''),
|
||||
'nut-screening': z.string().default(''),
|
||||
'spiritual-asst': z.string().default(''),
|
||||
'general-condition': z.string().default(''),
|
||||
'support-exam': z.string().default(''),
|
||||
'risk-fall': z.string().default(''),
|
||||
bracelet: z.string().default(''),
|
||||
'bracelet-alg': z.string().default(''),
|
||||
})
|
||||
|
||||
const AssessmentSchema = z.object({
|
||||
'early-diag': AssessmentSectionSchema,
|
||||
'late-diag': AssessmentSectionSchema,
|
||||
@@ -179,6 +205,14 @@ const InstructionSchema = z.object({
|
||||
other: z.string().default(''),
|
||||
})
|
||||
|
||||
export const CprjSoapiSchema = z.object({
|
||||
subjective: z.string().default(''),
|
||||
objective: z.string().default(''),
|
||||
assesment: z.string().default(''),
|
||||
plan: z.string().default(''),
|
||||
review: z.string().default(''),
|
||||
})
|
||||
|
||||
export const SoapSchema = z.object({
|
||||
subject: SubjectSchema,
|
||||
object: ObjectSchema,
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
import { z } from 'zod'
|
||||
|
||||
const SurgeryReportSchema = z.object({
|
||||
sepStatus: z.string({
|
||||
required_error: 'Mohon isi status SEP',
|
||||
}).default('SEP Internal'),
|
||||
unit_code: z.string({
|
||||
required_error: 'Mohon isi Unit',
|
||||
}),
|
||||
specialist_code: z.string({
|
||||
required_error: 'Mohon isi Spesialis',
|
||||
}),
|
||||
subspecialist_code: z.string({
|
||||
required_error: 'Mohon isi Sub Spesialis',
|
||||
}),
|
||||
doctor_code: z.string({
|
||||
required_error: 'Mohon isi DPJP',
|
||||
}),
|
||||
encounter_code: z.string().optional(),
|
||||
date: 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 SurgeryReportFormData = z.infer<typeof SurgeryReportSchema>
|
||||
|
||||
export { SurgeryReportSchema }
|
||||
export type { SurgeryReportFormData }
|
||||
@@ -0,0 +1,159 @@
|
||||
import { z } from 'zod'
|
||||
|
||||
const TherapyProtocolSchema = z.object({
|
||||
examinationDate: z.string({
|
||||
required_error: 'Pilih tanggal pemeriksaan',
|
||||
}),
|
||||
relationshipToInsured: z.enum(['spouse', 'child'], {
|
||||
required_error: 'Pilih hubungan',
|
||||
}),
|
||||
anamnesis: z.string({
|
||||
required_error: 'Mohon lengkapi catatan anamnesa',
|
||||
}),
|
||||
medicalHistory: z.string({
|
||||
required_error: 'Mohon lengkapi catatan riwayat penyakit',
|
||||
}),
|
||||
medicationHistory: z.string({
|
||||
required_error: 'Mohon lengkapi catatan riwayat obat',
|
||||
}),
|
||||
|
||||
supportDiagnosis: z.array(
|
||||
z.object({
|
||||
diagnosis: z.string({
|
||||
required_error: 'Isi diagnosis',
|
||||
}),
|
||||
}),
|
||||
{
|
||||
required_error: 'Isi diagnosis',
|
||||
},
|
||||
),
|
||||
functionalDiagnosis: z.array(
|
||||
z
|
||||
.object({
|
||||
diagnosis: z.string({}),
|
||||
})
|
||||
.optional(),
|
||||
{
|
||||
required_error: 'Isi diagnosis',
|
||||
},
|
||||
),
|
||||
treatmentDiagnosis: z.array(
|
||||
z.object({
|
||||
diagnosis: z.string({
|
||||
required_error: 'Isi diagnosis',
|
||||
}),
|
||||
}),
|
||||
{
|
||||
required_error: 'Isi diagnosis',
|
||||
},
|
||||
),
|
||||
supportExamination: z.string({
|
||||
required_error: 'Mohon lengkapi catatan pemeriksaan penunjang',
|
||||
}),
|
||||
|
||||
recommendation: z.string({
|
||||
required_error: 'Mohon lengkapi catatan anjuran',
|
||||
}),
|
||||
evaluation: z.string({
|
||||
required_error: 'Mohon lengkapi catatan evaluasi',
|
||||
}),
|
||||
isWorkRelatedDisease: z.string({
|
||||
required_error: 'Pilih apakah penyakit berkaitan dengan pekerjaan',
|
||||
}),
|
||||
})
|
||||
|
||||
|
||||
|
||||
const PickerItemSchema = z.object({
|
||||
id: z.number().optional(),
|
||||
code: z.string(),
|
||||
name: z.string()
|
||||
})
|
||||
|
||||
const TherapyProtocolMedicRehabilitationSchema = z.object({
|
||||
form1ExaminationDate: z.string({
|
||||
required_error: 'Pilih tanggal pemeriksaan',
|
||||
}),
|
||||
form1Diagnose: z.string({
|
||||
required_error: 'Mohon lengkapi catatan diagnosa',
|
||||
}),
|
||||
form1TherapyRequest: z.string({
|
||||
required_error: 'Mohon lengkapi catatan terapi',
|
||||
}),
|
||||
form1TargetPeriod: z.number({
|
||||
required_error: 'Mohon lengkapi catatan terapi',
|
||||
}),
|
||||
form1TherapyTarget: z.string({
|
||||
required_error: 'Mohon lengkapi catatan terapi',
|
||||
}),
|
||||
|
||||
form2RelationshipToInsured: z.enum(['spouse', 'child'], {
|
||||
required_error: 'Pilih hubungan',
|
||||
}),
|
||||
anamnesis: z.string({
|
||||
required_error: 'Mohon lengkapi catatan anamnesa',
|
||||
}),
|
||||
form2PhysicalExamination: z.string({
|
||||
required_error: 'Mohon lengkapi catatan pemeriksaan fisik',
|
||||
}),
|
||||
|
||||
medicalDiagnoses: z.array(PickerItemSchema).default([]),
|
||||
functionDiagnoses: z.array(PickerItemSchema).default([]),
|
||||
procedures: z.array(PickerItemSchema).default([]),
|
||||
|
||||
supportingExams: z.string({
|
||||
required_error: 'Mohon lengkapi catatan pemeriksaan penunjang',
|
||||
}),
|
||||
evaluation: z.string({
|
||||
required_error: 'Mohon lengkapi catatan evaluasi',
|
||||
}),
|
||||
instruction: z.string({
|
||||
required_error: 'Mohon lengkapi catatan anjuran',
|
||||
}),
|
||||
workCauseStatus: z.enum(['YA', 'TIDAK'], {
|
||||
required_error: 'Pilih apakah penyakit berkaitan dengan pekerjaan',
|
||||
}),
|
||||
|
||||
form3ExaminationDate: z.string({
|
||||
required_error: 'Pilih tanggal pemeriksaan',
|
||||
}),
|
||||
form3Diagnose: z.string({
|
||||
required_error: 'Mohon lengkapi catatan diagnosa',
|
||||
}),
|
||||
form3TherapyRequest: z.string({
|
||||
required_error: 'Mohon lengkapi catatan terapi',
|
||||
}),
|
||||
form3ProgramActivities: z.array(
|
||||
z.string({
|
||||
required_error: 'Mohon lengkapi Program/Kegiatan',
|
||||
}),
|
||||
{
|
||||
required_error: 'Isi Program/Kegiatan',
|
||||
},
|
||||
).default(['']),
|
||||
})
|
||||
|
||||
|
||||
// {
|
||||
// "encounter_id": 4,
|
||||
// "doctor_code": "doc-3",
|
||||
// "anamnesis": "",
|
||||
// "medicalDiagnoses": "", //json
|
||||
// "functionDiagnoses": "", //json
|
||||
// "procedures":"",
|
||||
// "supportingExams":"",
|
||||
// "instruction":"",
|
||||
// "evaluation":"",
|
||||
// "workCauseStatus":"YA",
|
||||
// "frequency":1,
|
||||
// "intervalUnit_code":"day",
|
||||
// "duration":30,
|
||||
// "durationUnit_code":"min"
|
||||
// }
|
||||
|
||||
|
||||
type TherapyProtocolFormData = z.infer<typeof TherapyProtocolSchema>
|
||||
type TherapyProtocolMedicRehabilitationFormData = z.infer<typeof TherapyProtocolMedicRehabilitationSchema>
|
||||
|
||||
export { TherapyProtocolSchema, TherapyProtocolMedicRehabilitationSchema }
|
||||
export type { TherapyProtocolFormData, TherapyProtocolMedicRehabilitationFormData }
|
||||
@@ -0,0 +1,47 @@
|
||||
import { z } from 'zod'
|
||||
|
||||
const VaccineDataSchema = z.object({
|
||||
sepStatus: z.string({
|
||||
required_error: 'Mohon isi status SEP',
|
||||
}).default('SEP Internal'),
|
||||
unit_code: z.string({
|
||||
required_error: 'Mohon isi Unit',
|
||||
}),
|
||||
specialist_code: z.string({
|
||||
required_error: 'Mohon isi Spesialis',
|
||||
}),
|
||||
subspecialist_code: z.string({
|
||||
required_error: 'Mohon isi Sub Spesialis',
|
||||
}),
|
||||
doctor_code: z.string({
|
||||
required_error: 'Mohon isi DPJP',
|
||||
}),
|
||||
encounter_code: z.string().optional(),
|
||||
date: 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 VaccineDataFormData = z.infer<typeof VaccineDataSchema>
|
||||
|
||||
export { VaccineDataSchema }
|
||||
export type { VaccineDataFormData }
|
||||
@@ -16,4 +16,4 @@ const VerificationSchema = z.object({
|
||||
type VerificationFormData = z.infer<typeof VerificationSchema>
|
||||
|
||||
export { VerificationSchema, }
|
||||
export type { VerificationFormData, }
|
||||
export type { VerificationFormData, }
|
||||
Reference in New Issue
Block a user