910b641750
feat(patient): add edit functionality to patient form - Modify genPatientEntity to accept existing patient data for updates - Add handleActionEdit handler for edit mode - Update form to handle both create and edit modes - Rename patient ref to patientDetail for clarity refactor(patient): update marital status codes and job options mapping - Change marital status enum values to standardized codes (S, M, D, W) - Simplify job options and marital status options mapping using mapToComboboxOptList - Add error handling in patient data loading ajust styling text based on combobox wip: edit patient redirect refactor(models): update type definitions and form field handling - Add field-name prop to SelectDob component for better form handling - Update Person and Patient interfaces to use null for optional fields - Add maritalStatus_code field to Person interface - Improve type safety by replacing undefined with null for optional fields fix casting radio str to boolean and parsing date error
59 lines
1.7 KiB
TypeScript
59 lines
1.7 KiB
TypeScript
import { type Base, genBase } from './_base'
|
|
import type { PersonAddress } from './person-address'
|
|
import type { PersonContact } from './person-contact'
|
|
import type { PersonRelative } from './person-relative'
|
|
import type { Ethnic } from './ethnic'
|
|
import type { Language } from './language'
|
|
import type { Regency } from './regency'
|
|
|
|
export interface Person extends Base {
|
|
name: string
|
|
// alias?: string
|
|
frontTitle?: string | null
|
|
endTitle?: string | null
|
|
birthDate?: string
|
|
birthRegency_code?: string | null
|
|
gender_code?: string | null
|
|
residentIdentityNumber?: string | null
|
|
passportNumber?: string | null
|
|
drivingLicenseNumber?: string | null
|
|
religion_code?: string | null
|
|
education_code?: string | null
|
|
occupation_code?: string | null
|
|
occupation_name?: string | null
|
|
ethnic_code?: string | null
|
|
language_code?: string | null
|
|
nationality?: string | null
|
|
communicationIssueStatus?: boolean
|
|
disability?: string | null
|
|
residentIdentityFileUrl?: string | null
|
|
passportFileUrl?: string | null
|
|
drivingLicenseFileUrl?: string | null
|
|
familyIdentityFileUrl?: string | null
|
|
maritalStatus_code?: string
|
|
|
|
// preload data for detail patient
|
|
birthRegency?: Regency | null
|
|
addresses?: PersonAddress[] | null
|
|
contacts?: PersonContact[] | null
|
|
relatives?: PersonRelative[] | null
|
|
ethnic?: Ethnic | null
|
|
language?: Language | null
|
|
}
|
|
|
|
export function genPerson(): Person {
|
|
return {
|
|
...genBase(),
|
|
frontTitle: '',
|
|
name: '',
|
|
endTitle: '',
|
|
}
|
|
}
|
|
|
|
export function parseName(person: Person): string {
|
|
if (!person) return ''
|
|
const fullName = [person.frontTitle, person.name, person.endTitle].filter(Boolean).join(' ').trim()
|
|
|
|
return fullName
|
|
}
|