From 6e9ed7f79f7c9d01d1a066fa3ca6a7b992e8c840 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Tue, 16 Sep 2025 10:00:29 +0200 Subject: [PATCH] Add support for person identifiers workflow: update `PersonEdit` component, API methods, and modals for identifier handling during person creation. Adjust related types for improved consistency. --- .../vuejs/OnTheFly/components/Create.vue | 34 +++---- .../vuejs/OnTheFly/components/CreateModal.vue | 18 ++++ .../Resources/public/types.ts | 26 +++++- .../Resources/public/vuejs/_api/OnTheFly.ts | 10 ++- .../vuejs/_components/Entity/PersonText.vue | 2 +- .../vuejs/_components/OnTheFly/PersonEdit.vue | 90 +++++++++++++++---- 6 files changed, 132 insertions(+), 48 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/OnTheFly/components/Create.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/OnTheFly/components/Create.vue index ad652cdfd..68548f859 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/OnTheFly/components/Create.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/OnTheFly/components/Create.vue @@ -64,6 +64,8 @@ const props = withDefaults(defineProps(), { action: "create", query: "", }); + + const type = ref(null); const radioType = computed({ @@ -74,12 +76,14 @@ const radioType = computed({ }, }); +type PersonEditComponent = InstanceType; + type AnyComponentInstance = | InstanceType | InstanceType | null; -const castPerson = ref(null); +const castPerson = ref(null); const castThirdparty = ref(null); onMounted(() => { @@ -100,31 +104,13 @@ const containsPerson = computed(() => { return props.allowedTypes.includes("person"); }); -// Types for data structures coming from child components are not declared in TS yet. -// We conservatively type them as any to preserve runtime behavior while enabling TS in this component. -function castDataByType(): any { - switch (radioType.value) { - case "person": - // eslint-disable-next-line @typescript-eslint/no-explicit-any - return (castPerson.value as any)?.$data?.person; - case "thirdparty": { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - let data: any = (castThirdparty.value as any)?.$data?.thirdparty; - if (data && data.address !== undefined && data.address !== null) { - data.address = { id: data.address.address_id }; - } else if (data) { - data.address = null; - } - return data; - } - default: - throw Error("Invalid type of entity"); - } +function save(): void { + castPerson.value.postPerson(); } -defineExpose({ - castDataByType, -}); +defineExpose({save}); + +