Refactor Gender and ResidentialAddress types and update associated components for improved consistency and type safety.

- Replaced `gender` string union with `Gender` type in `Person` interfaces.
- Added `ResidentialAddress` type to standardize address handling within `Person`.
- Updated `PersonRenderBox.vue` to utilize new properties and improve null safety with optional chaining.
- Corrected prop defaults and fixed typo in
This commit is contained in:
2025-10-25 00:58:17 +02:00
parent ffac143ab9
commit df6087d468
3 changed files with 18 additions and 9 deletions

View File

@@ -50,7 +50,7 @@ export type GenderTranslation = "male" | "female" | "neutral" | "unknown";
export interface Gender {
type: "chill_main_gender";
id: number;
label: string;
label: TranslatableString;
genderTranslation: GenderTranslation;
}

View File

@@ -14,7 +14,7 @@ import {
DateTimeWrite,
SetGender,
SetCenter,
SetCivility,
SetCivility, Gender,
} from "ChillMainAssets/types";
import { StoredObject } from "ChillDocStoreAssets/types";
import { Thirdparty } from "../../../ChillThirdPartyBundle/Resources/public/types";
@@ -45,17 +45,25 @@ export interface Person {
phonenumber: string;
mobilenumber: string;
email: string;
gender: "woman" | "man" | "other";
gender: Gender;
centers: Center[];
civility: Civility | null;
current_household_id: number;
current_residential_addresses: Address[];
current_residential_addresses: ResidentialAddress[];
/**
* The person id as configured by the user
*/
personId: string;
}
export interface ResidentialAddress {
address: Address | null;
endDate: DateTime | null;
hostPerson: Person | null;
hostThirdParty: Thirdparty | null;
startDate: DateTime | null;
}
export interface PersonIdentifierWrite {
type: "person_identifier";
definition_id: number;

View File

@@ -122,8 +122,8 @@
</span>
<address-render-box
v-if="addr.hostPerson.address"
:address="addr.hostPerson.address"
v-if="addr.hostPerson?.current_household_address"
:address="addr.hostPerson.current_household_address"
:is-multiline="isMultiline"
/>
</div>
@@ -288,7 +288,8 @@ interface Props {
}
const props = withDefaults(defineProps<Props>(), {
render: "bloc", options: {
render: "bloc",
options: () => ({
addInfo: true,
addEntity: false,
addAltNames: true,
@@ -296,13 +297,13 @@ const props = withDefaults(defineProps<Props>(), {
addId: true,
addLink: false,
hLevel: 3,
entityDisplayingLong: true,
entityDisplayLong: true,
addCenter: true,
addNoData: true,
isMultiline: true,
isHolder: false,
addHouseholdLink: true
}
}),
});
const isMultiline = computed<boolean>(() => {