diff --git a/app/components/app/patient/entry-form.vue b/app/components/app/patient/entry-form.vue index 26f18c56..341bdcd5 100644 --- a/app/components/app/patient/entry-form.vue +++ b/app/components/app/patient/entry-form.vue @@ -27,8 +27,35 @@ import { } from './fields' interface FormData extends PatientFormData {} + +// Type untuk initial values (sebelum transform schema) +interface PatientFormInput { + identityNumber?: string + drivingLicenseNumber?: string + passportNumber?: string + fullName?: string + isNewBorn?: 'YA' | 'TIDAK' + gender?: string + birthPlace?: string + birthDate?: string + education?: string + job?: string + maritalStatus?: string + nationality?: string + ethnicity?: string + language?: string + religion?: string + communicationBarrier?: 'YA' | 'TIDAK' + disability?: 'YA' | 'TIDAK' + disabilityType?: string + note?: string + residentIdentityFile?: File + familyIdentityFile?: File +} + interface Props { - initialValues?: FormData + isReadonly: boolean + initialValues?: PatientFormInput } const props = defineProps() @@ -37,7 +64,7 @@ const formSchema = toTypedSchema(PatientSchema) const { values, resetForm, setValues, validate } = useForm({ name: 'patientForm', validationSchema: formSchema, - initialValues: props.initialValues && {}, + initialValues: (props.initialValues ?? {}) as any, validateOnMount: false, }) @@ -61,6 +88,7 @@ defineExpose({ label="No. KTP" placeholder="Masukkan NIK" numeric-only + :is-disabled="isReadonly" /> @@ -183,6 +227,7 @@ defineExpose({ placeholder="Unggah scan dokumen KTP" :accept="['pdf', 'jpg', 'png']" :max-size-mb="1" + :is-disabled="isReadonly" /> diff --git a/app/components/app/patient/fields/input-name.vue b/app/components/app/patient/fields/input-name.vue index db9005f1..14a27e63 100644 --- a/app/components/app/patient/fields/input-name.vue +++ b/app/components/app/patient/fields/input-name.vue @@ -17,6 +17,7 @@ defineProps<{ labelClass?: string maxLength?: number isRequired?: boolean + isDisabled?: boolean }>() @@ -40,6 +41,7 @@ defineProps<{ () const { @@ -55,6 +56,7 @@ const genderOptions = [
() const { @@ -55,6 +56,7 @@ const dissabilityOptions = [
() const { @@ -55,6 +56,7 @@ const nationalityOptions = [
() const { @@ -34,7 +35,10 @@ const newbornOptions = [