From 25483dd8f29b486c79fe7b33751a175ca4485b0c Mon Sep 17 00:00:00 2001 From: florianfederspiel Date: Sun, 28 Sep 2025 14:19:06 +0200 Subject: [PATCH 01/26] Removed TrackingTrips --- components/MainNav.vue | 4 +- pages/trackingTrips/[mode]/[[id]].client.vue | 283 ------------------- pages/trackingTrips/index.vue | 155 ---------- 3 files changed, 2 insertions(+), 440 deletions(-) delete mode 100644 pages/trackingTrips/[mode]/[[id]].client.vue delete mode 100644 pages/trackingTrips/index.vue diff --git a/components/MainNav.vue b/components/MainNav.vue index 6ecd8fb..69c45b0 100644 --- a/components/MainNav.vue +++ b/components/MainNav.vue @@ -152,11 +152,11 @@ const links = computed(() => { to: "/standardEntity/absencerequests", icon: "i-heroicons-document-text" }] : [], - { + /*{ label: "Fahrten", to: "/trackingTrips", icon: "i-heroicons-map" - }, + },*/ ] }, ... [{ diff --git a/pages/trackingTrips/[mode]/[[id]].client.vue b/pages/trackingTrips/[mode]/[[id]].client.vue deleted file mode 100644 index 159e655..0000000 --- a/pages/trackingTrips/[mode]/[[id]].client.vue +++ /dev/null @@ -1,283 +0,0 @@ - - - - - \ No newline at end of file diff --git a/pages/trackingTrips/index.vue b/pages/trackingTrips/index.vue deleted file mode 100644 index 0d3e232..0000000 --- a/pages/trackingTrips/index.vue +++ /dev/null @@ -1,155 +0,0 @@ - - - - - \ No newline at end of file From c95cc818b5fcce00665a82f885354d7ebe3051a0 Mon Sep 17 00:00:00 2001 From: florianfederspiel Date: Sun, 28 Sep 2025 14:20:02 +0200 Subject: [PATCH 02/26] Removed IncomingInvoices Create --- pages/incomingInvoices/create.vue | 674 ------------------------------ 1 file changed, 674 deletions(-) delete mode 100644 pages/incomingInvoices/create.vue diff --git a/pages/incomingInvoices/create.vue b/pages/incomingInvoices/create.vue deleted file mode 100644 index 5dff367..0000000 --- a/pages/incomingInvoices/create.vue +++ /dev/null @@ -1,674 +0,0 @@ - - - - - \ No newline at end of file From 7851dd80cae8456fbd55aaf8c88115c3ad43983f Mon Sep 17 00:00:00 2001 From: florianfederspiel Date: Sun, 28 Sep 2025 14:21:12 +0200 Subject: [PATCH 03/26] Removed Old Update and Create --- stores/data.js | 132 ------------------------------------------------- 1 file changed, 132 deletions(-) diff --git a/stores/data.js b/stores/data.js index ee235b1..78daa99 100644 --- a/stores/data.js +++ b/stores/data.js @@ -49,7 +49,6 @@ import sepaDate from "~/components/columnRenderings/sepaDate.vue"; // @ts-ignore export const useDataStore = defineStore('data', () => { - const supabase = useSupabaseClient() const profileStore = useProfileStore() const toast = useToast() const router = useRouter() @@ -2593,136 +2592,7 @@ export const useDataStore = defineStore('data', () => { }) - async function createNewItem (dataType,data,noRedirect=false){ - if(typeof(data) === 'object') { - data = {...data, tenant: profileStore.currentTenant} - } else if(typeof(data) === 'array') { - data.map(i => { - return { - ...i, - tenant: profileStore.currentTenant - } - }) - } - console.log(dataType) - if(dataTypes[dataType].numberRangeHolder) { - - if(!data[dataTypes[dataType].numberRangeHolder]) { - data[dataTypes[dataType].numberRangeHolder] = await useFunctions().useNextNumber(dataType) - } - - - } else if(dataType === "createddocuments" && data.type !== "serialInvoices") { - /*if(data.state !== "Entwurf") { - console.log(data.type) - - let type = "" - if(data.type === "advanceInvoices"){ - type = "invoices" - } else { - type = data.type - } - - const numberRange = useNumberRange(type) - data.documentNumber = await numberRange.useNextNumber() - }*/ - } - - - - const {data:supabaseData,error:supabaseError} = await supabase - .from(dataType) - .insert(data) - .select() - - if(supabaseError) { - console.log(supabaseError) - toast.add({title: "Es ist ein Fehler bei der Erstellung aufgetreten", color: "rose"}) - } else if (supabaseData) { - console.log(supabaseData) - - let returnData = supabaseData[0] - - await generateHistoryItems(dataType, supabaseData[0]) - - /*if(!["statementallocations","absencerequests", "productcategories", "servicecategories", "projecttypes", "checks", "profiles","services", "inventoryitems", "inventoryitemgroups", "incominginvoices", "costcentres", "ownaccounts"].includes(dataType) ){ - await eval( dataType + '.value.push(' + JSON.stringify(...supabaseData) + ')') - }*/ - - - toast.add({title: `${dataTypes[dataType].labelSingle} hinzugefügt`}) - if(dataTypes[dataType].redirect && !noRedirect) { - if(dataTypes[dataType].isStandardEntity) { - await router.push(dataTypes[dataType].redirectToList ? `/standardEntity/${dataType}` : `/standardEntity/${dataType}/show/${returnData.id}`) - } else { - await router.push(dataTypes[dataType].redirectToList ? `/${dataType}` : `/${dataType}/show/${returnData.id}`) - } - } - modal.close() - return supabaseData[0] - } - } - - async function updateItem (dataType, data, oldData = null, noRedirect = false) { - //console.log(dataType, data) - //Temporary Fix TODO: Remove and build Solution - data = JSON.parse(JSON.stringify(data)) - delete data.users - - if(oldData) { - oldData = JSON.parse(JSON.stringify(oldData)) - delete oldData.users - } - - const {tenants, ...newData} = data - - /*if(dataType === "createddocuments" && data.type !== "serialInvoices") { - if(data.state !== "Entwurf") { - console.log(data.type) - - let type = "" - if(data.type === "advanceInvoices"){ - type = "invoices" - } else { - type = data.type - } - - const numberRange = useNumberRange(type) - data.documentNumber = await numberRange.useNextNumber() - } - }*/ - - - - - - await generateHistoryItems(dataType,data,oldData) - - const {data:supabaseData,error: supabaseError} = await supabase - .from(dataType) - .update(newData) - .eq('id',newData.id) - .select() - - if(supabaseError) { - console.log(supabaseError) - toast.add({title: `Fehler beim Speichern`, color: 'rose'}) - } else if(supabaseData) { - //await eval(dataType + '.value[' + dataType + '.value.findIndex(i => i.id === ' + JSON.stringify(data.id) + ')] = ' + JSON.stringify(supabaseData[0])) - //if(dataType === 'profiles') await fetchProfiles() - toast.add({title: `${dataTypes[dataType].labelSingle} gespeichert`}) - if(dataTypes[dataType].redirect && !noRedirect) { - if(dataTypes[dataType].isStandardEntity) { - await router.push(dataTypes[dataType].redirectToList ? `/standardEntity/${dataType}` : `/standardEntity/${dataType}/show/${data.id}`) - } else { - await router.push(dataTypes[dataType].redirectToList ? `/${dataType}` : `/${dataType}/show/${data.id}`) - } - } - modal.close() - return supabaseData[0] - } - } @@ -2732,7 +2602,5 @@ export const useDataStore = defineStore('data', () => { return { dataTypes, documentTypesForCreation, - createNewItem, - updateItem, } }) \ No newline at end of file From c68fe876223b6c6586f6f7a3785ea4ac4edf4ed8 Mon Sep 17 00:00:00 2001 From: florianfederspiel Date: Sun, 28 Sep 2025 14:21:19 +0200 Subject: [PATCH 04/26] Removed Old Update and Create --- stores/data.js | 1 - 1 file changed, 1 deletion(-) diff --git a/stores/data.js b/stores/data.js index 78daa99..07863f1 100644 --- a/stores/data.js +++ b/stores/data.js @@ -3,7 +3,6 @@ import dayjs from "dayjs" //import {typeOf} from "uri-js/dist/esnext/util"; import {useNumberRange} from "~/composables/useNumberRange.js"; -//const supabase = createClient('https://uwppvcxflrcsibuzsbil.supabase.co','eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InV3cHB2Y3hmbHJjc2lidXpzYmlsIiwicm9sZSI6ImFub24iLCJpYXQiOjE3MDA5MzgxOTQsImV4cCI6MjAxNjUxNDE5NH0.CkxYSQH0uLfwx9GVUlO6AYMU2FMLAxGMrwEKvyPv7Oo') import projecttype from "~/components/columnRenderings/projecttype.vue" import customer from "~/components/columnRenderings/customer.vue" From 906e893bf00e26dbf0ab68046281f3a922a71ed3 Mon Sep 17 00:00:00 2001 From: florianfederspiel Date: Sun, 28 Sep 2025 14:24:17 +0200 Subject: [PATCH 05/26] Removed Rights --- pages/settings/rights.vue | 78 --------------------------------------- 1 file changed, 78 deletions(-) delete mode 100644 pages/settings/rights.vue diff --git a/pages/settings/rights.vue b/pages/settings/rights.vue deleted file mode 100644 index cdbd4ff..0000000 --- a/pages/settings/rights.vue +++ /dev/null @@ -1,78 +0,0 @@ - - - - - \ No newline at end of file From baa59f16ce4cb4222882f3c3240478d78a4327df Mon Sep 17 00:00:00 2001 From: florianfederspiel Date: Sun, 28 Sep 2025 14:24:25 +0200 Subject: [PATCH 06/26] Removed Supabase --- components/HistoryDisplay.vue | 2 -- 1 file changed, 2 deletions(-) diff --git a/components/HistoryDisplay.vue b/components/HistoryDisplay.vue index a9461fc..13e24b5 100644 --- a/components/HistoryDisplay.vue +++ b/components/HistoryDisplay.vue @@ -29,10 +29,8 @@ const setup = async () => { if(await useCapacitor().getIsPhone()) platform.value = "mobile" if(props.type && props.elementId){ - //items.value = (await supabase.from("historyitems").select().eq(props.type,props.elementId).order("created_at",{ascending: true})).data || [] items.value = await useNuxtApp().$api(`/api/resource/${props.type}/${props.elementId}/history`) } /*else { - items.value = (await supabase.from("historyitems").select().order("created_at",{ascending: true})).data || [] }*/ } From 6bb1222e0bcbb04d0eabf30ff29f2377a3c29c93 Mon Sep 17 00:00:00 2001 From: florianfederspiel Date: Sun, 28 Sep 2025 14:24:32 +0200 Subject: [PATCH 07/26] Removed Supabase --- components/DocumentDisplay.vue | 1 - 1 file changed, 1 deletion(-) diff --git a/components/DocumentDisplay.vue b/components/DocumentDisplay.vue index 0c695a9..6db5d5a 100644 --- a/components/DocumentDisplay.vue +++ b/components/DocumentDisplay.vue @@ -3,7 +3,6 @@ import DocumentDisplayModal from "~/components/DocumentDisplayModal.vue"; const toast = useToast() -const supabase = useSupabaseClient() const dataStore = useDataStore() const modal = useModal() const profileStore = useProfileStore() From 63ee3c7b9fc83c10a0402cd94995ab2d3fda2952 Mon Sep 17 00:00:00 2001 From: florianfederspiel Date: Sun, 28 Sep 2025 14:24:40 +0200 Subject: [PATCH 08/26] Removed Supabase --- components/EntityEdit.vue | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/components/EntityEdit.vue b/components/EntityEdit.vue index 0e1469c..d9c87f7 100644 --- a/components/EntityEdit.vue +++ b/components/EntityEdit.vue @@ -48,7 +48,6 @@ defineShortcuts({ }, }) -const supabase = useSupabaseClient() const router = useRouter() const route = useRoute() const dataStore = useDataStore() @@ -150,9 +149,9 @@ const loadOptions = async () => { for await(const option of optionsToLoad) { if(option.option === "countrys") { - loadedOptions.value[option.option] = (await supabase.from("countrys").select()).data + loadedOptions.value[option.option] = useEntities("countrys").selectSpecial() } else if(option.option === "units") { - loadedOptions.value[option.option] = (await supabase.from("units").select()).data + loadedOptions.value[option.option] = useEntities("units").selectSpecial() } else { loadedOptions.value[option.option] = (await useEntities(option.option).select()) From 969fa605186e60c795c0ab5aaa6ded4afc198827 Mon Sep 17 00:00:00 2001 From: florianfederspiel Date: Sun, 28 Sep 2025 14:24:46 +0200 Subject: [PATCH 09/26] Removed Supabase --- pages/roles/[mode]/[[id]].vue | 3 --- 1 file changed, 3 deletions(-) diff --git a/pages/roles/[mode]/[[id]].vue b/pages/roles/[mode]/[[id]].vue index 9487de3..2ed1e15 100644 --- a/pages/roles/[mode]/[[id]].vue +++ b/pages/roles/[mode]/[[id]].vue @@ -1,8 +1,5 @@ - - - - \ No newline at end of file diff --git a/pages/chats/create.vue b/pages/chats/create.vue deleted file mode 100644 index 659260b..0000000 --- a/pages/chats/create.vue +++ /dev/null @@ -1,119 +0,0 @@ - - - - - \ No newline at end of file diff --git a/pages/chats/index.vue b/pages/chats/index.vue deleted file mode 100644 index 47ea0ac..0000000 --- a/pages/chats/index.vue +++ /dev/null @@ -1,123 +0,0 @@ - - - - - \ No newline at end of file diff --git a/pages/chats/show/[id].vue b/pages/chats/show/[id].vue deleted file mode 100644 index 302ca65..0000000 --- a/pages/chats/show/[id].vue +++ /dev/null @@ -1,120 +0,0 @@ - - - - - \ No newline at end of file diff --git a/pages/email/new.vue b/pages/email/new.vue index ed8d53a..34d6fc9 100644 --- a/pages/email/new.vue +++ b/pages/email/new.vue @@ -1,6 +1,5 @@ - - - - \ No newline at end of file diff --git a/pages/inventory/index.vue b/pages/inventory/index.vue deleted file mode 100644 index 9d344ff..0000000 --- a/pages/inventory/index.vue +++ /dev/null @@ -1,426 +0,0 @@ - - - - - \ No newline at end of file diff --git a/pages/inventory/stocks.vue b/pages/inventory/stocks.vue deleted file mode 100644 index eabfbcd..0000000 --- a/pages/inventory/stocks.vue +++ /dev/null @@ -1,150 +0,0 @@ - - - - - \ No newline at end of file diff --git a/pages/settings/labels/[mode]/[[id]].vue b/pages/settings/labels/[mode]/[[id]].vue deleted file mode 100644 index ca0b2a0..0000000 --- a/pages/settings/labels/[mode]/[[id]].vue +++ /dev/null @@ -1,127 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/pages/settings/labels/index.vue b/pages/settings/labels/index.vue deleted file mode 100644 index d81fe8a..0000000 --- a/pages/settings/labels/index.vue +++ /dev/null @@ -1,111 +0,0 @@ - - - - - - - \ No newline at end of file From a222da19709cfce636762bbdeae8181b0a7ba553 Mon Sep 17 00:00:00 2001 From: florianfederspiel Date: Sun, 28 Sep 2025 17:45:10 +0200 Subject: [PATCH 17/26] Fixed Spaces --- pages/createDocument/show/[id].vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/createDocument/show/[id].vue b/pages/createDocument/show/[id].vue index fb3d14b..a91fc71 100644 --- a/pages/createDocument/show/[id].vue +++ b/pages/createDocument/show/[id].vue @@ -19,7 +19,7 @@ const itemInfo = ref({}) const linkedDocument =ref({}) const setupPage = async () => { if(route.params) { - if(route.params.id) itemInfo.value = await useEntities("createddocuments").selectSingle(route.params.id,"*, files(*), linkedDocument(*)") + if(route.params.id) itemInfo.value = await useEntities("createddocuments").selectSingle(route.params.id,"*,files(*),linkedDocument(*)") console.log(itemInfo.value) From 72f8064d061d4085b41a9375c405e7df9b1ae03d Mon Sep 17 00:00:00 2001 From: florianfederspiel Date: Sun, 28 Sep 2025 17:45:28 +0200 Subject: [PATCH 18/26] Fixed E-Mail Sending for New Api --- pages/email/new.vue | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pages/email/new.vue b/pages/email/new.vue index 34d6fc9..d31f20d 100644 --- a/pages/email/new.vue +++ b/pages/email/new.vue @@ -23,7 +23,9 @@ const loadedDocuments = ref([]) const loaded = ref(false) const noAccountsPresent = ref(false) const setupPage = async () => { - emailAccounts.value = await useEntities("emailAccounts").select() + //emailAccounts.value = await useEntities("emailAccounts").select() + + emailAccounts.value = await useNuxtApp().$api("/api/email/accounts") if(emailAccounts.value.length === 0) { noAccountsPresent.value = true @@ -141,7 +143,9 @@ const sendEmail = async () => { }) } - const res = await useNuxtApp().$api("/api/emailasuser/send",{ + console.log(body) + + const res = await useNuxtApp().$api("/api/email/send",{ method: "POST", body: body, }) @@ -203,7 +207,7 @@ const sendEmail = async () => { > From 5b09a11a6e2ec677568b07a9c3a392c0e955a7a2 Mon Sep 17 00:00:00 2001 From: florianfederspiel Date: Sun, 28 Sep 2025 17:45:46 +0200 Subject: [PATCH 19/26] Added API Base VAR for Runtime Config --- nuxt.config.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/nuxt.config.ts b/nuxt.config.ts index c0591f0..f888a34 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -57,5 +57,11 @@ export default defineNuxtConfig({ prefix: "Tiptap" }, + runtimeConfig: { + public: { + apiBase: '' + } + }, + compatibilityDate: '2024-12-18' }) \ No newline at end of file From 467410af6a8bd280e3c58917c473b087273cbd79 Mon Sep 17 00:00:00 2001 From: florianfederspiel Date: Sun, 28 Sep 2025 17:46:23 +0200 Subject: [PATCH 20/26] Added API Base VAR for Runtime Config --- docker-compose.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 00ef6c5..55aab3b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,9 +7,8 @@ services: # networks: # - traefik environment: - SUPABASE_URL: "https://uwppvcxflrcsibuzsbil.supabase.co" - SUPABASE_KEY: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InV3cHB2Y3hmbHJjc2lidXpzYmlsIiwicm9sZSI6ImFub24iLCJpYXQiOjE3MDA5MzgxOTQsImV4cCI6MjAxNjUxNDE5NH0.CkxYSQH0uLfwx9GVUlO6AYMU2FMLAxGMrwEKvyPv7Oo" -# labels: + NUXT_PUBLIC_API_BASE: "https://backend.fedeo.io" + # labels: # - "traefik.enable=true" # - "traefik.docker.network=traefik" # - "traefik.port=3000" From bae41efdf5453e5814abe4e3f9e3592d16291e34 Mon Sep 17 00:00:00 2001 From: florianfederspiel Date: Sun, 28 Sep 2025 17:46:41 +0200 Subject: [PATCH 21/26] Changed to PDF Viewer --- components/DocumentDisplayModal.vue | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/components/DocumentDisplayModal.vue b/components/DocumentDisplayModal.vue index 0659454..a501448 100644 --- a/components/DocumentDisplayModal.vue +++ b/components/DocumentDisplayModal.vue @@ -172,13 +172,10 @@ const moveFile = async () => {
- - /> Date: Sun, 28 Sep 2025 17:46:55 +0200 Subject: [PATCH 22/26] Disabled TIckets --- components/HelpSlideover.vue | 4 +- pages/support/[id].vue | 121 ++++------------------------------- pages/support/create.vue | 42 +++++------- pages/support/index.vue | 6 +- 4 files changed, 31 insertions(+), 142 deletions(-) diff --git a/components/HelpSlideover.vue b/components/HelpSlideover.vue index 094e1da..36cdd08 100644 --- a/components/HelpSlideover.vue +++ b/components/HelpSlideover.vue @@ -18,11 +18,11 @@ const links = [{ onClick: () => { shortcuts.value = true } -}, { +},/* { label: 'Tickets', icon: 'i-heroicons-clipboard-document', to: '/support', -}, { +},*/ { label: 'Webseite', icon: 'i-heroicons-globe-europe-africa', to: 'https://fedeo.de', diff --git a/pages/support/[id].vue b/pages/support/[id].vue index 54f98b8..4d8941e 100644 --- a/pages/support/[id].vue +++ b/pages/support/[id].vue @@ -6,12 +6,13 @@ import dayjs from "dayjs"; const supabase = useSupabaseClient() const profileStore = useProfileStore() const toast = useToast() +const auth = useAuthStore() const itemInfo = ref({}) const loaded = ref(false) const setup = async () => { - itemInfo.value = (await supabase.from("tickets").select("*, ticketmessages(*, profile(fullName, tenant, id)), created_by(*)").eq("id",useRoute().params.id).single()).data + itemInfo.value = await useEntities("tickets").selectSingle(useRoute().params.id,"*, ticketmessages(*), created_by(*)") loaded.value = true } @@ -20,85 +21,16 @@ setup() const messageContent = ref("") const addMessage = async () => { - const {data,error} = await supabase.from("ticketmessages").insert({ - profile: profileStore.activeProfile.id, - content: messageContent.value, - ticket: itemInfo.value.id, - internal: false, - type: "Nachricht" - }).select().single() - - if(error) { - toast.add({title: "Erstellen fehlgeschlagen", color: "rose"}) - } else { - toast.add({title: "Erstellen erfolgreich"}) - messageContent.value="" - setup() - if(profileStore.currentTenant !== 5) { - await useFunctions().useSendTelegramNotification(`Neue Nachricht im Ticket ${useRoute().params.id} von ${profileStore.activeProfile.fullName}: ${data.content}`) - } else if(profileStore.activeProfile.id !== itemInfo.value.created_by) { - - let notification = { - tenant: itemInfo.value.tenant, - profile: itemInfo.value.created_by.id, - initiatingProfile: profileStore.activeProfile.id, - title: `Sie haben eine neue Nachricht von ${profileStore.activeProfile.fullName} im Ticket ${itemInfo.value.title}`, - link: `/support/${itemInfo.value.id}`, - message: data.content - } - - console.log(notification) - - - const {error} = await supabase.from("notifications").insert(notification) - - - - } - - } -} - -const showAddEntryModal = ref(false) -const addEntryData = ref({}) -const addEntry = async () => { - const {data,error} = await supabase.from("ticketmessages").insert({ - profile: profileStore.activeProfile.id, - content: addEntryData.value.content, + const res = await useEntities("ticketmessages").create({ + auth_user: auth.user.user_id, + content: messageContent.value, ticket: itemInfo.value.id, - internal: addEntryData.value.internal, - type: addEntryData.value.type - }).select().single() - - if(error) { - toast.add({title: "Erstellen fehlgeschlagen", color: "rose"}) - } else { - toast.add({title: "Erstellen erfolgreich"}) - addEntryData.value = {} - setup() - showAddEntryModal.value = false - - } + internal: false, + type: "Nachricht" + }) } -const closeTicket = async () => { - const {data, error} = await supabase.from("tickets").update({status: "Geschlossen"}).eq("id",useRoute().params.id).single() - if(error) { - console.log(error) - } else { - console.log(data) - - addEntryData.value.type = "Notiz" - addEntryData.value.internal = false - addEntryData.value.content = `Ticket durch ${profileStore.activeProfile.fullName} geschlossen` - - addEntry() - - } - - setup() -} @@ -120,7 +52,7 @@ const closeTicket = async () => { {{itemInfo.title}} - + --> -
- -
-

{{item.type}} - {{item.profile.fullName}}

-

-

{{dayjs(item.created_at).format("DD.MM.YYYY HH:mm")}}

-
-
- - - -import {useFunctions} from "~/composables/useFunctions.js"; - -const supabase = useSupabaseClient() -const profileStore = useProfileStore() const router = useRouter() const itemInfo = ref({}) - +const auth = useAuthStore() const createTicket = async () => { - const {data:ticketData,error:ticketError} = await supabase.from("tickets").insert({ + const ticketRes = await useEntities("tickets").create({ title: itemInfo.value.title, - created_by: profileStore.activeProfile.id, - tenant: profileStore.currentTenant - }).select().single() + }) + + console.log(ticketRes) + + const ticketMsgRes = await useEntities("ticketmessages").create({ + ticket: ticketRes.id, + created_by: auth.user.user_id, + content: itemInfo.value.content, + internal: false + }) + + await router.push(`/support/${ticketRes.id}`) + - if(ticketError) { - console.error(ticketError) - } else { - console.log(ticketData) - const {data:messageData,error:messageError} = await supabase.from("ticketmessages").insert({ - ticket: ticketData.id, - profile: profileStore.activeProfile.id, - content: itemInfo.value.content, - internal: false - }) - if(messageError) { - console.log(messageError) - } else { - console.log(ticketData) - //useFunctions().useSendTelegramNotification(`Ticket von ${profileStore.activeProfile.fullName} erstellt : ${itemInfo.value.content}`) - router.push(`/support/${ticketData.id}`) - } - } } diff --git a/pages/support/index.vue b/pages/support/index.vue index ba014b4..d5671c5 100644 --- a/pages/support/index.vue +++ b/pages/support/index.vue @@ -1,6 +1,5 @@