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:
No files matched your search
@@ -18,7 +18,7 @@ import Action from '~/components/pub/my-ui/nav-footer/ba-dr-su.vue'
|
||||
import AppPatientEntryForm from '~/components/app/patient/entry-form.vue'
|
||||
import AppPersonAddressEntryForm from '~/components/app/person-address/entry-form.vue'
|
||||
import AppPersonAddressEntryFormRelative from '~/components/app/person-address/entry-form-relative.vue'
|
||||
import AppPersonFamilyParentsForm from '~/components/app/person/family-parents-form.vue'
|
||||
import AppPersonFamilyParentsForm from '~/components/app/person/family-parents-form-bak.vue'
|
||||
import AppPersonContactEntryForm from '~/components/app/person-contact/entry-form.vue'
|
||||
import AppPersonRelativeEntryForm from '~/components/app/person-relative/entry-form.vue'
|
||||
|
||||
|
||||
@@ -25,16 +25,7 @@ import { id as localeID } from 'date-fns/locale'
|
||||
// services
|
||||
import { getPatientDetail, uploadAttachment } from '~/services/patient.service'
|
||||
|
||||
import {
|
||||
isReadonly,
|
||||
isProcessing,
|
||||
isFormEntryDialogOpen,
|
||||
isRecordConfirmationOpen,
|
||||
onResetState,
|
||||
handleActionSave,
|
||||
handleActionEdit,
|
||||
handleCancelForm,
|
||||
} from '~/handlers/patient.handler'
|
||||
import { isReadonly, isProcessing, handleActionSave, handleActionEdit } from '~/handlers/patient.handler'
|
||||
|
||||
import { toast } from '~/components/pub/ui/toast'
|
||||
|
||||
@@ -180,19 +171,19 @@ const familyFormInitialValues = computed(() => {
|
||||
|
||||
if (parents.length === 0) {
|
||||
return {
|
||||
shareFamilyData: '0',
|
||||
_shareFamilyData: 'no' as const,
|
||||
families: [],
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
shareFamilyData: '1',
|
||||
_shareFamilyData: 'yes' as const,
|
||||
families: parents.map((parent: PersonRelative) => ({
|
||||
id: parent.id || 0,
|
||||
relation: parent.relationship_code || '',
|
||||
name: parent.name || '',
|
||||
education: parent.education_code || '',
|
||||
occupation: parent.occupation_name || parent.occupation_code || '',
|
||||
occupation_code: parent.occupation_code || '',
|
||||
education_code: parent.education_code || '',
|
||||
})),
|
||||
}
|
||||
})
|
||||
@@ -253,6 +244,7 @@ async function composeFormData(): Promise<PatientEntity> {
|
||||
const results = [patient, address, addressRelative, families, contacts, emergencyContact]
|
||||
const allValid = results.every((r) => r?.valid)
|
||||
|
||||
console.log(results)
|
||||
// exit, if form errors happend during validation
|
||||
// for example: dropdown not selected
|
||||
if (!allValid) return Promise.reject('Form validation failed')
|
||||
|
||||
Reference in New Issue
Block a user