mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-11-09 21:58:28 +00:00
Add edit functionality for ThirdParty in OnTheFly.vue and refactor ThirdPartyEdit for consistency.
- Implemented dynamic component rendering in `OnTheFly.vue` for `thirdparty` type based on the `action` (`show`, `edit`, etc.). - Added `ThirdPartyEdit` component with API integration for editing third parties. - Introduced `thirdpartyToWriteThirdParty` function in the API for mapping `Thirdparty` to `ThirdPartyWrite` structure. - Centralized validation handling in `ThirdPartyEdit.vue` using `useViolationList` composable and enhanced template conditions. - Updated and extended API functions (`patchThirdparty`, etc.) and types to support third-party editing.
This commit is contained in:
@@ -54,7 +54,7 @@
|
||||
></PersonEdit>
|
||||
</template>
|
||||
|
||||
<template #body v-else-if="type === 'thirdparty'">
|
||||
<template #body v-else-if="type === 'thirdparty' && action === 'show'">
|
||||
<on-the-fly-thirdparty
|
||||
:id="id"
|
||||
:type="type"
|
||||
@@ -69,6 +69,10 @@
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template #body v-else-if="type === 'thirdparty' && action === 'edit'">
|
||||
<ThirdPartyEdit ref="castEditThirdParty" action="edit" :id="id"></ThirdPartyEdit>
|
||||
</template>
|
||||
|
||||
<template #body v-else-if="parent">
|
||||
<on-the-fly-thirdparty
|
||||
:parent="parent"
|
||||
@@ -131,6 +135,8 @@ import {
|
||||
THIRDPARTY_ADDCONTACT_TITLE,
|
||||
} from "translator";
|
||||
import PersonEdit from "ChillPersonAssets/vuejs/_components/OnTheFly/PersonEdit.vue";
|
||||
import ThirdPartyEdit from "ChillThirdPartyAssets/vuejs/_components/OnTheFly/ThirdPartyEdit.vue";
|
||||
import ThirdParty from "ChillThirdPartyAssets/vuejs/_components/OnTheFly/ThirdParty.vue";
|
||||
|
||||
// Types
|
||||
type EntityType = "person" | "thirdparty";
|
||||
@@ -169,7 +175,9 @@ const emit = defineEmits<{
|
||||
}>();
|
||||
|
||||
type castEditPersonType = InstanceType<typeof PersonEdit>;
|
||||
type castEditThirdPartyType = InstanceType<typeof ThirdParty>;
|
||||
const castEditPerson = useTemplateRef<castEditPersonType>('castEditPerson')
|
||||
const castEditThirdParty = useTemplateRef<castEditThirdPartyType>('castEditThirdParty');
|
||||
|
||||
const modal = ref<{ showModal: boolean; modalDialogClass: string }>({
|
||||
showModal: false,
|
||||
@@ -311,9 +319,15 @@ async function saveAction() {
|
||||
if (null !== person) {
|
||||
emit("saveFormOnTheFly", {type: props.type, data: person})
|
||||
}
|
||||
} else if (props.type === 'thirdparty') {
|
||||
const thirdParty = await castEditThirdParty.value?.postThirdParty();
|
||||
if (null !== thirdParty) {
|
||||
emit("saveFormOnTheFly", {type: props.type, data: thirdParty })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
defineExpose({
|
||||
openModal,
|
||||
closeModal,
|
||||
|
||||
Reference in New Issue
Block a user