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,65 +30,73 @@
</h3> </h3>
</template> </template>
<template #body v-if="type === 'person' && action === 'show'"> <template #body>
<on-the-fly-person <!-- person / show -->
:id="id" <template v-if="type === 'person' && action === 'show'">
:type="type" <on-the-fly-person
:action="action" :id="id"
ref="castPerson" :type="type"
/> :action="action"
<div v-if="hasResourceComment"> ref="castPerson"
<h3>{{ trans(ONTHEFLY_RESOURCE_COMMENT_TITLE) }}</h3> />
<blockquote class="chill-user-quote"> <div v-if="hasResourceComment">
{{ parent?.comment }} <h3>{{ trans(ONTHEFLY_RESOURCE_COMMENT_TITLE) }}</h3>
</blockquote> <blockquote class="chill-user-quote">
</div> {{ parent?.comment }}
</template> </blockquote>
</div>
</template>
<template #body v-else-if="type === 'person' && action === 'edit'"> <!-- person / edit -->
<PersonEdit <template v-else-if="type === 'person' && action === 'edit'">
:id="id" <PersonEdit
:action="'edit'" :id="id"
:query="''" :action="'edit'"
ref="castEditPerson" :query="''"
></PersonEdit> ref="castEditPerson"
</template> />
</template>
<template #body v-else-if="type === 'thirdparty' && action === 'show'"> <!-- thirdparty / show -->
<on-the-fly-thirdparty <template v-else-if="type === 'thirdparty' && action === 'show'">
:id="id" <on-the-fly-thirdparty
:type="type" :id="id"
:action="action" :type="type"
ref="castThirdparty" :action="action"
/> ref="castThirdparty"
<div v-if="hasResourceComment"> />
<h3>{{ trans(ONTHEFLY_RESOURCE_COMMENT_TITLE) }}</h3> <div v-if="hasResourceComment">
<blockquote class="chill-user-quote"> <h3>{{ trans(ONTHEFLY_RESOURCE_COMMENT_TITLE) }}</h3>
{{ parent?.comment }} <blockquote class="chill-user-quote">
</blockquote> {{ parent?.comment }}
</div> </blockquote>
</template> </div>
</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'">
</template> <ThirdPartyEdit ref="castEditThirdParty" action="edit" :id="id" />
</template>
<template #body v-else-if="parent"> <!-- parent provided (thirdparty create with parent) -->
<on-the-fly-thirdparty <template v-else-if="parent">
:parent="parent" <on-the-fly-thirdparty
:action="action" :parent="parent"
type="thirdparty" :action="action"
ref="castThirdparty" type="thirdparty"
/> ref="castThirdparty"
</template> />
</template>
<template #body v-else> <!-- default: creation wizard -->
<on-the-fly-create <template v-else>
:action="action" <on-the-fly-create
:allowed-types="allowedTypes" :action="action"
:query="query || ''" :allowed-types="allowedTypes"
ref="castNew" :query="query || ''"
/> ref="castNew"
/>
</template>
</template> </template>
<template #footer> <template #footer>
@@ -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');