Simplify the slot organisation to avoid multiple slots declaration

This commit is contained in:
2025-11-20 08:36:22 +01:00
parent 4ddbcf4037
commit 310dd61870

View File

@@ -30,7 +30,9 @@
</h3>
</template>
<template #body v-if="type === 'person' && action === 'show'">
<template #body>
<!-- person / show -->
<template v-if="type === 'person' && action === 'show'">
<on-the-fly-person
:id="id"
:type="type"
@@ -45,16 +47,18 @@
</div>
</template>
<template #body v-else-if="type === 'person' && action === 'edit'">
<!-- person / edit -->
<template v-else-if="type === 'person' && action === 'edit'">
<PersonEdit
:id="id"
:action="'edit'"
:query="''"
ref="castEditPerson"
></PersonEdit>
/>
</template>
<template #body v-else-if="type === 'thirdparty' && action === 'show'">
<!-- thirdparty / show -->
<template v-else-if="type === 'thirdparty' && action === 'show'">
<on-the-fly-thirdparty
:id="id"
:type="type"
@@ -69,11 +73,13 @@
</div>
</template>
<template #body v-else-if="type === 'thirdparty' && action === 'edit'">
<ThirdPartyEdit ref="castEditThirdParty" action="edit" :id="id"></ThirdPartyEdit>
<!-- thirdparty / edit -->
<template v-else-if="type === 'thirdparty' && action === 'edit'">
<ThirdPartyEdit ref="castEditThirdParty" action="edit" :id="id" />
</template>
<template #body v-else-if="parent">
<!-- parent provided (thirdparty create with parent) -->
<template v-else-if="parent">
<on-the-fly-thirdparty
:parent="parent"
:action="action"
@@ -82,7 +88,8 @@
/>
</template>
<template #body v-else>
<!-- default: creation wizard -->
<template v-else>
<on-the-fly-create
:action="action"
:allowed-types="allowedTypes"
@@ -90,6 +97,7 @@
ref="castNew"
/>
</template>
</template>
<template #footer>
<a
@@ -136,7 +144,6 @@ import {
} 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";
@@ -175,7 +182,7 @@ const emit = defineEmits<{
}>();
type castEditPersonType = InstanceType<typeof PersonEdit>;
type castEditThirdPartyType = InstanceType<typeof ThirdParty>;
type castEditThirdPartyType = InstanceType<typeof ThirdPartyEdit>;
const castEditPerson = useTemplateRef<castEditPersonType>('castEditPerson')
const castEditThirdParty = useTemplateRef<castEditThirdPartyType>('castEditThirdParty');