fix: Lieferantenfenster direkt steuerbar machen
Some checks failed
Build and Push Docker Images / build-backend (push) Successful in 46s
Build and Push Docker Images / build-frontend (push) Successful in 1m12s
Build and Push Docker Images / build-website (push) Successful in 22s
Build and Push Docker Images / build-central-services-api (push) Successful in 22s
Build and Push Docker Images / build-docs (push) Has been cancelled
Build and Push Docker Images / build-central-services-admin (push) Has been cancelled

This commit is contained in:
2026-09-09 13:04:28 +02:00
parent bb18a974dd
commit 48199b0ed7
2 changed files with 35 additions and 13 deletions

View File

@@ -22,7 +22,7 @@ const props = defineProps({
inModal: { inModal: {
type: Boolean, type: Boolean,
}, },
draggable: { floatingWindow: {
type: Boolean, type: Boolean,
default: false, default: false,
}, },
@@ -531,9 +531,8 @@ const updateItem = async () => {
> >
<template #center> <template #center>
<h1 <h1
v-if="item" v-if="item && !props.floatingWindow"
:data-draggable-handle="props.draggable ? '' : undefined" :class="['text-xl', 'font-medium']"
:class="['text-xl', 'font-medium', props.draggable ? 'cursor-move select-none' : '']"
>{{ item.id ? `${dataType.labelSingle} bearbeiten` : `${dataType.labelSingle} erstellen` }}</h1> >{{ item.id ? `${dataType.labelSingle} bearbeiten` : `${dataType.labelSingle} erstellen` }}</h1>
</template> </template>
<template #right> <template #right>
@@ -552,8 +551,8 @@ const updateItem = async () => {
Erstellen Erstellen
</UButton> </UButton>
<UButton <UButton
@pointerdown.stop v-if="!props.floatingWindow"
@click.stop="modal.close()" @click="modal.close()"
color="red" color="red"
class="ml-2" class="ml-2"
icon="i-heroicons-x-mark" icon="i-heroicons-x-mark"

View File

@@ -33,7 +33,9 @@ const items = ref([])
const item = ref({}) const item = ref({})
const isDraggableVendorCreate = computed(() => props.type === "vendors" && props.mode === "create") const isDraggableVendorCreate = computed(() => props.type === "vendors" && props.mode === "create")
const isDraggableWindowOpen = ref(true)
const draggableWindow = ref(null) const draggableWindow = ref(null)
const draggableWindowHandle = ref(null)
const initialWindowPosition = import.meta.client const initialWindowPosition = import.meta.client
? { ? {
x: Math.max(16, (window.innerWidth - Math.min(1024, window.innerWidth - 32)) / 2), x: Math.max(16, (window.innerWidth - Math.min(1024, window.innerWidth - 32)) / 2),
@@ -43,12 +45,14 @@ const initialWindowPosition = import.meta.client
const { style: draggableWindowStyle } = useDraggable(draggableWindow, { const { style: draggableWindowStyle } = useDraggable(draggableWindow, {
initialValue: initialWindowPosition, initialValue: initialWindowPosition,
onStart: (_position, event) => { handle: draggableWindowHandle,
const target = event.target
return target instanceof Element && Boolean(target.closest('[data-draggable-handle]'))
},
}) })
const closeDraggableWindow = () => {
isDraggableWindowOpen.value = false
modal.close()
}
const setupPage = async () => { const setupPage = async () => {
if(props.mode === "show") { if(props.mode === "show") {
//Load Data for Show //Load Data for Show
@@ -79,17 +83,36 @@ setupPage()
<template> <template>
<div <div
v-if="isDraggableVendorCreate" v-if="isDraggableVendorCreate && isDraggableWindowOpen"
ref="draggableWindow" ref="draggableWindow"
:style="draggableWindowStyle" :style="draggableWindowStyle"
class="fixed z-[999] flex h-[80vh] max-h-[calc(100vh-2rem)] w-[calc(100vw-2rem)] max-w-5xl flex-col overflow-hidden resize rounded-xl border border-gray-200 bg-white shadow-2xl dark:border-gray-800 dark:bg-gray-900" class="fixed z-[999] flex h-[80vh] max-h-[calc(100vh-2rem)] w-[calc(100vw-2rem)] max-w-5xl flex-col overflow-hidden resize rounded-xl border border-gray-200 bg-white shadow-2xl dark:border-gray-800 dark:bg-gray-900"
> >
<div
ref="draggableWindowHandle"
class="flex cursor-move items-center justify-between border-b border-gray-200 bg-gray-50 p-3 select-none dark:border-gray-800 dark:bg-gray-800/50"
>
<div class="flex items-center gap-2 text-gray-500">
<UIcon name="i-heroicons-building-storefront" />
<span class="text-xs font-bold uppercase tracking-wider">Lieferant erstellen</span>
</div>
<UTooltip text="Schließen">
<UButton
color="gray"
variant="ghost"
icon="i-heroicons-x-mark"
size="xs"
@pointerdown.stop
@click.stop="closeDraggableWindow"
/>
</UTooltip>
</div>
<EntityEdit <EntityEdit
v-if="loaded" v-if="loaded"
:type="props.type" :type="props.type"
:item="item" :item="item"
:inModal="true" :inModal="true"
:draggable="true" :floating-window="true"
@return-data="(data) => emit('returnData', data)" @return-data="(data) => emit('returnData', data)"
:createQuery="props.createQuery" :createQuery="props.createQuery"
:mode="props.mode" :mode="props.mode"
@@ -101,7 +124,7 @@ setupPage()
/> />
</div> </div>
<UModal v-else :fullscreen="props.mode === 'show'"> <UModal v-else-if="!isDraggableVendorCreate" :fullscreen="props.mode === 'show'">
<template #content> <template #content>
<EntityShow <EntityShow
v-if="loaded && props.mode === 'show'" v-if="loaded && props.mode === 'show'"