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