From 71e146e4f05aad29cb952f44092a2da5978e7dd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Fri, 24 Oct 2025 16:20:58 +0200 Subject: [PATCH] fix for ThirdParty create flow. - Added `parent` property handling in `ThirdPartyEdit.vue`, `Create.vue`, and related components for better association with parent entities. - Updated `Thirdparty` and `ThirdPartyWrite` types to include `parent` property and ensure type safety. - Adjusted translations and messages to reflect the new parent entity association concept. --- .../vuejs/OnTheFly/components/Create.vue | 1 + .../vuejs/OnTheFly/components/CreateModal.vue | 1 + .../Resources/public/types.ts | 14 ++- .../Entity/ThirdPartyRenderBox.vue | 115 +++++++++--------- .../_components/OnTheFly/ThirdPartyEdit.vue | 64 ++++++---- .../translations/messages.fr.yml | 2 +- 6 files changed, 111 insertions(+), 86 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 a4f344a82..e000b6fac 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/OnTheFly/components/Create.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/OnTheFly/components/Create.vue @@ -43,6 +43,7 @@ v-if="type === 'thirdparty'" :action="action" :query="query" + :parent="parent" ref="castThirdparty" @onThirdPartyCreated="onThirdPartyCreated" type="" diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/OnTheFly/components/CreateModal.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/OnTheFly/components/CreateModal.vue index 5b92b6370..e55fe2314 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/OnTheFly/components/CreateModal.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/OnTheFly/components/CreateModal.vue @@ -53,6 +53,7 @@ defineExpose({ save }); :allowedTypes="props.allowedTypes" :action="props.action" :query="props.query" + :parent="props.parent" @onPersonCreated="onPersonCreated" @onThirdPartyCreated="onThirdPartyCreated" > diff --git a/src/Bundle/ChillThirdPartyBundle/Resources/public/types.ts b/src/Bundle/ChillThirdPartyBundle/Resources/public/types.ts index e0ae41a5a..ddb097cb2 100644 --- a/src/Bundle/ChillThirdPartyBundle/Resources/public/types.ts +++ b/src/Bundle/ChillThirdPartyBundle/Resources/public/types.ts @@ -2,7 +2,7 @@ import { Address, Center, Civility, - DateTime, + DateTime, SetCivility, User, } from "ChillMainAssets/types"; @@ -15,6 +15,7 @@ export interface BaseThirdParty { acronym: string | null; active: boolean; address: Address | null; + contactDataAnonymous: boolean; createdAt: DateTime; createdBy: User | null; email: string | null; @@ -22,6 +23,7 @@ export interface BaseThirdParty { id: number; nameCompany: string | null; telephone: string | null; + telephone2: string | null; updatedAt: DateTime | null; updatedBy: User | null; } @@ -50,7 +52,7 @@ export interface ThirdpartyChild extends BaseThirdParty { kind: "child"; civility: Civility | null; contactDataAnonymous: boolean; - parent: Thirdparty | null; + parent: ThirdpartyCompany; profession: string; firstname: string; /** @@ -109,10 +111,15 @@ export interface ThirdpartyCategory { }; } +export interface SetThirdParty { + readonly type: "thirdparty"; + id: number; +} + export interface ThirdPartyWrite { readonly type: "thirdparty"; kind: ThirdPartyKind; - civility: Civility | null; + civility: SetCivility | null; profession: string; firstname: string; /** @@ -126,4 +133,5 @@ export interface ThirdPartyWrite { address_id: number; } comment: string; + parent: SetThirdParty|null; } diff --git a/src/Bundle/ChillThirdPartyBundle/Resources/public/vuejs/_components/Entity/ThirdPartyRenderBox.vue b/src/Bundle/ChillThirdPartyBundle/Resources/public/vuejs/_components/Entity/ThirdPartyRenderBox.vue index 3413861ae..c84fecbf4 100644 --- a/src/Bundle/ChillThirdPartyBundle/Resources/public/vuejs/_components/Entity/ThirdPartyRenderBox.vue +++ b/src/Bundle/ChillThirdPartyBundle/Resources/public/vuejs/_components/Entity/ThirdPartyRenderBox.vue @@ -5,7 +5,7 @@
- + {{ thirdparty.text }} {{ thirdparty.text }} @@ -27,7 +27,7 @@ />
-

+

@@ -44,13 +44,13 @@ {{ getProfession[0] }}

-
  • +
  • - {{ $t("child_of") }} + {{ trans(THIRDPARTY_MESSAGES_CHILD_OF)}} @@ -128,65 +128,60 @@ -