From 05b0c12841bd27edb6466136c5ae0283b6413d91 Mon Sep 17 00:00:00 2001 From: nico Date: Tue, 3 Nov 2026 21:47:14 +0000 Subject: [PATCH] feat(documents): expose complete title section movement in editor --- frontend/pages/createDocument/edit/[[id]].vue | 36 ++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/frontend/pages/createDocument/edit/[[id]].vue b/frontend/pages/createDocument/edit/[[id]].vue index d852c043..04002206 100644 --- a/frontend/pages/createDocument/edit/[[id]].vue +++ b/frontend/pages/createDocument/edit/[[id]].vue @@ -5,6 +5,7 @@ import { v4 as uuidv4 } from 'uuid'; import {useFunctions} from "~/composables/useFunctions.js"; import EntityModalButtons from "~/components/EntityModalButtons.vue"; import { documentTemplateHandlebars } from "~/utils/handlebars"; +import { getTitleSectionMove, moveTitleSection } from "~/utils/documentTitleSections.js"; const dataStore = useDataStore() const profileStore = useProfileStore() @@ -1017,6 +1018,24 @@ const toggleTitleSection = (rowId) => { collapsedTitleRowIds.value = nextCollapsedTitleRowIds } +const moveDocumentTitleSection = (rowId, direction) => { + if (itemInfo.value.type === 'cancellationInvoices') return + const rows = moveTitleSection(itemInfo.value.rows, rowId, direction) + if (rows === itemInfo.value.rows) return + itemInfo.value.rows = rows + setPosNumbers() +} + +const getTitleSectionMoveMenuItems = (rowId) => [ + { label: 'Titelbereich nach oben', icon: 'i-heroicons-arrow-up', direction: 'up' }, + { label: 'Titelbereich nach unten', icon: 'i-heroicons-arrow-down', direction: 'down' } +].map(({ direction, ...item }) => ({ + ...item, + disabled: itemInfo.value.type === 'cancellationInvoices' + || !getTitleSectionMove(itemInfo.value.rows, rowId, direction), + onSelect: () => moveDocumentTitleSection(rowId, direction) +})) + const hiddenDocumentRowIds = computed(() => { const hiddenRowIds = new Set() const collapsedTitleLevels = [] @@ -3116,7 +3135,7 @@ const setRowData = async (row, service = {sellingPriceComposed: {}}, product = { v-model="itemInfo.rows" handle=".handle" tag="tbody" - itemKey="pos" + itemKey="id" @end="setPosNumbers" >