From 8f444bd917e63c53fa491f5231c5c85b3fe9ecdc Mon Sep 17 00:00:00 2001 From: flfeders Date: Mon, 4 Mar 2024 20:26:30 +0100 Subject: [PATCH] Changes in Document Creation, Calendar, Notifications, Settings --- spaces/components/NotificationsSlideover.vue | 6 +- spaces/composables/useDashboard.ts | 2 +- spaces/composables/usePDFGenerator.js | 12 +- spaces/layouts/default.vue | 12 ++ spaces/pages/calendar/[mode].vue | 10 +- spaces/pages/calendar/edit/[[id]].vue | 118 +++++++++++++++++++ spaces/pages/createDocument/edit/[[id]].vue | 99 ++++++++++++---- spaces/pages/createDocument/show/[id].vue | 42 ++++--- spaces/pages/products/[mode]/[[id]].vue | 4 +- spaces/pages/projects/[mode]/[[id]].vue | 29 +++++ spaces/pages/settings/numberRanges.vue | 41 +++---- spaces/stores/data.js | 11 +- 12 files changed, 315 insertions(+), 71 deletions(-) create mode 100644 spaces/pages/calendar/edit/[[id]].vue diff --git a/spaces/components/NotificationsSlideover.vue b/spaces/components/NotificationsSlideover.vue index 09b566e..9308e30 100644 --- a/spaces/components/NotificationsSlideover.vue +++ b/spaces/components/NotificationsSlideover.vue @@ -4,12 +4,12 @@ import type { Notification } from '~/types' const { isNotificationsSlideoverOpen } = useDashboard() -const { data: notifications } = await useFetch('/api/notifications') +//const { data: notifications } = await useFetch('/api/notifications') diff --git a/spaces/composables/useDashboard.ts b/spaces/composables/useDashboard.ts index 4d7708e..7fb2f6d 100644 --- a/spaces/composables/useDashboard.ts +++ b/spaces/composables/useDashboard.ts @@ -12,7 +12,7 @@ const _useDashboard = () => { 'g-u': () => router.push('/users'), 'g-s': () => router.push('/settings'), '?': () => isHelpSlideoverOpen.value = true, - n: () => isNotificationsSlideoverOpen.value = true + n: () => isNotificationsSlideoverOpen.value = !isNotificationsSlideoverOpen.value }) watch(() => route.fullPath, () => { diff --git a/spaces/composables/usePDFGenerator.js b/spaces/composables/usePDFGenerator.js index d61f6f5..e147825 100644 --- a/spaces/composables/usePDFGenerator.js +++ b/spaces/composables/usePDFGenerator.js @@ -593,9 +593,9 @@ export const useCreatePdf = async (invoiceData,backgroundSourceBuffer) => { invoiceData.rows.forEach((row,index) => { - if(row.mode === 'free' || row.mode === 'normal'){ + if(row.mode !== 'pagebreak'){ - pages[pageCounter - 1].drawText(row.pos, { + pages[pageCounter - 1].drawText(String(row.pos), { ...getCoordinatesForPDFLib(21,rowHeight, page1), size:10, color:rgb(0,0,0), @@ -667,7 +667,13 @@ export const useCreatePdf = async (invoiceData,backgroundSourceBuffer) => { }) } - rowHeight += 14 + if(row.description) { + rowHeight += 24 + } else { + rowHeight += 14 + } + + pageIndex += 1 diff --git a/spaces/layouts/default.vue b/spaces/layouts/default.vue index ab56422..8228420 100644 --- a/spaces/layouts/default.vue +++ b/spaces/layouts/default.vue @@ -320,6 +320,18 @@ let links = [ to: "/plants", icon: "i-heroicons-clipboard-document" }, + { + label: "Einstellungen", + defaultOpen: false, + icon: "i-heroicons-cog-8-tooth", + children: [ + { + label: "Nummernkreise", + to: "/settings/numberRanges", + icon: "i-heroicons-clipboard-document-list" + } + ] + }, ] const actions = [ diff --git a/spaces/pages/calendar/[mode].vue b/spaces/pages/calendar/[mode].vue index 2056b98..6cf74e0 100644 --- a/spaces/pages/calendar/[mode].vue +++ b/spaces/pages/calendar/[mode].vue @@ -13,6 +13,7 @@ definePageMeta({ //Config const route = useRoute() +const router = useRouter() const mode = ref(route.params.mode || "grid") const supabase = useSupabaseClient() const dataStore = useDataStore() @@ -102,7 +103,10 @@ const calendarOptionsGrid = reactive({ newEventData.value.start = info.startStr newEventData.value.end = info.endStr - showNewEventModal.value = true + //showNewEventModal.value = true + + router.push(`/calendar/edit/?start=${info.startStr}&end=${info.endStr}&source=grid`) + }, eventClick: function (info){ selectedEvent.value = info.event @@ -138,7 +142,9 @@ const calendarOptionsTimeline = reactive({ newEventData.value.end = info.endStr console.log(newEventData.value) convertResourceIds() - showNewEventModal.value = true + //showNewEventModal.value = true + + router.push(`/calendar/edit/?start=${info.startStr}&end=${info.endStr}&resources=${JSON.stringify([info.resource.id])}&source=timeline`) }, eventClick: function (info){ selectedEvent.value = info.event diff --git a/spaces/pages/calendar/edit/[[id]].vue b/spaces/pages/calendar/edit/[[id]].vue new file mode 100644 index 0000000..d77f27e --- /dev/null +++ b/spaces/pages/calendar/edit/[[id]].vue @@ -0,0 +1,118 @@ + + + + + \ No newline at end of file diff --git a/spaces/pages/createDocument/edit/[[id]].vue b/spaces/pages/createDocument/edit/[[id]].vue index c7f2095..61b8e51 100644 --- a/spaces/pages/createDocument/edit/[[id]].vue +++ b/spaces/pages/createDocument/edit/[[id]].vue @@ -61,6 +61,9 @@ const tabItems = computed(() => { const setupPage = () => { if(route.params) { if(route.params.id) itemInfo.value = dataStore.getCreatedDocumentById(Number(route.params.id)) + + if(!itemInfo.value.deliveryDateType) itemInfo.value.deliveryDateType = "Lieferdatum" + } if(route.query) { @@ -165,6 +168,18 @@ const addPosition = (mode) => { } +const editRowDescription = (row) => { + rowToEdit.value = row.description + showEditRowDescription.value = true + +} +const showEditRowDescription = ref(false) +const rowToEdit = ref("") +const saveRowDescription = () => { + +} + + const removePosition = (id) => { let rows = itemInfo.value.rows.filter(row => row.id !== id) /*rows = rows.sort((a,b) => a.pos - b.pos) @@ -185,7 +200,7 @@ const documentTotal = computed(() => { let totalGross = 0 itemInfo.value.rows.forEach(row => { - if(row.mode === 'free' || row.mode === 'normal'){ + if(row.mode !== 'pagebreak'){ console.log(row) let rowPrice = Number(Number(row.quantity) * Number(row.price) * (1 - Number(row.discountPercent) /100) ).toFixed(2) console.log(rowPrice) @@ -222,8 +237,9 @@ const getDocumentData = () => { let unit = dataStore.units.find(i => i.id === row.unit) - if(row.mode === 'free' || row.mode === 'normal') { + if(row.mode !== 'pagebreak') { if(row.mode === 'normal') row.text = dataStore.getProductById(row.product).name + if(row.mode === 'service') row.text = dataStore.getServiceById(row.service).name return { ...row, @@ -323,6 +339,7 @@ const saveDocument = async () => { project: itemInfo.value.project, documentNumber: itemInfo.value.documentNumber, documentDate: itemInfo.value.documentDate, + deliveryDateType: itemInfo.value.deliveryDateType, info: { }, @@ -595,22 +612,31 @@ setupPage() - - - - + + + + + + Projekt + + @@ -674,12 +700,13 @@ setupPage() Pos. - Produkt / Leistung + Name Menge Einheit Preis Steuer Rabatt + Beschreibung Gesamt @@ -704,7 +731,7 @@ setupPage() @@ -788,6 +815,7 @@ setupPage() + + + + + + + + + + + + + + diff --git a/spaces/pages/createDocument/show/[id].vue b/spaces/pages/createDocument/show/[id].vue index fbea088..9bf4d4b 100644 --- a/spaces/pages/createDocument/show/[id].vue +++ b/spaces/pages/createDocument/show/[id].vue @@ -18,24 +18,38 @@ setupPage()