refactor(person-relative): update schema and form components for family data

- Change value format in radio-parents-input from '1'/'0' to 'yes'/'no'
- Remove default labels from select-education and select-job components
- Update schema to make fields optional and add new fields
- Modify family-parents-form to use new schema and improve UI
- Update patient form and models to align with schema changes
This commit is contained in:
Khafid Prayoga
2025-12-10 20:30:34 +07:00
parent 3cac23ce8a
commit 97d2b76ee3
10 changed files with 110 additions and 152 deletions
+6 -7
View File
@@ -4,7 +4,6 @@ import { type Person, genPerson } from './person'
import type { PatientFormData } from '~/schemas/patient.schema'
import type { PersonAddressFormData } from '~/schemas/person-address.schema'
import type { PersonAddressRelativeFormData } from '~/schemas/person-address-relative.schema'
import type { PersonFamiliesFormData } from '~/schemas/person-family.schema'
import type { PersonContactFormData } from '~/schemas/person-contact.schema'
import type { PersonRelativeFormData } from '~/schemas/person-relative.schema'
import type { PersonAddress } from './person-address'
@@ -32,7 +31,7 @@ export interface genPatientProps {
patient: PatientFormData
residentAddress: PersonAddressFormData
cardAddress: PersonAddressRelativeFormData
familyData: PersonFamiliesFormData
familyData: PersonRelativeFormData
contacts: PersonContactFormData
responsible: PersonRelativeFormData
}
@@ -75,15 +74,15 @@ export function genPatientEntity(props: genPatientProps, patientData: PatientEnt
}
// add data orang tua
if (familyData.shareFamilyData === '1') {
if (familyData._shareFamilyData === 'yes' && familyData.families && familyData.families.length > 0) {
for (const family of familyData.families) {
familiesContact.push({
id: family.id || 0,
relationship_code: family.relation,
name: family.name,
education_code: family.education,
occupation_name: family.occupation,
occupation_code: family.occupation,
education_code: family.education_code,
occupation_name: family.occupation_name,
occupation_code: family.occupation_code,
responsible: false,
})
}
@@ -106,7 +105,7 @@ export function genPatientEntity(props: genPatientProps, patientData: PatientEnt
}
// add penanggung jawab
if (responsible) {
if (responsible.contacts && responsible.contacts.length > 0) {
for (const contact of responsible.contacts) {
familiesContact.push({
id: contact.id || 0,