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()
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 () => {
-
- />
{
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())
diff --git a/components/EntityShowSubCreatedDocuments.vue b/components/EntityShowSubCreatedDocuments.vue
index f4bf6f6..4aba719 100644
--- a/components/EntityShowSubCreatedDocuments.vue
+++ b/components/EntityShowSubCreatedDocuments.vue
@@ -2,7 +2,6 @@
import dayjs from "dayjs";
import {useSum} from "~/composables/useSum.js";
-import {useSupabaseSelect} from "~/composables/useSupabase.js";
defineShortcuts({
/*'/': () => {
//console.log(searchinput)
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/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 || []
}*/
}
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/components/PDFViewer.vue b/components/PDFViewer.client.vue
similarity index 76%
rename from components/PDFViewer.vue
rename to components/PDFViewer.client.vue
index 6bf2b71..c79e4bb 100644
--- a/components/PDFViewer.vue
+++ b/components/PDFViewer.client.vue
@@ -1,12 +1,14 @@
-
-
-
-
-
-
-
-
-
- {{selectedStatement}}
-
-
-
-
-
-
-
-
-
- {{dataStore.bankAccounts.find(account => account.id === selectedAccount) ? dataStore.bankAccounts.find(account => account.id === selectedAccount).iban : "Kontoauswählen"}}
-
-
-
-
-
-
-
-
- {{row.amount.toFixed(2) + " €"}}
-
-
- {{row.amount.toFixed(2) + " €"}}
-
-
-
- {{dayjs(row.date).format("DD.MM.YY")}}
-
-
-
-
-
\ 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 @@
-
-
-
-
-
-
- Chats
-
-
-
- Chat Erstellen
-
-
-
- Erstellen
-
-
- Abbrechen
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{selectedProfiles.length > 0 ? selectedProfiles.map(i => profileStore.getProfileById(i).fullName).join(", ") : "Keine Benutzer ausgewählt"}}
-
-
-
-
-
-
-
-
-
\ 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 @@
-
-
-
-
-
-
-
-
-
-
-
- + Chat
-
-
-
-
-
-
- Spalten
-
-
-
-
- router.push(`/chats/show/${i.id}`) "
- :empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Keine Chats anzuzeigen' }"
- >
-
- {{row.name}}
- {{row.name}}
-
-
- {{row.profiles.map(i => i.fullName).join(", ")}}
-
-
-
-
-
\ 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/createDocument/edit/[[id]].vue b/pages/createDocument/edit/[[id]].vue
index d27017c..ae889d1 100644
--- a/pages/createDocument/edit/[[id]].vue
+++ b/pages/createDocument/edit/[[id]].vue
@@ -134,7 +134,6 @@ const setupPage = async () => {
if (route.query.loadMode === "deliveryNotes") {
let linkedDocuments = (await useEntities("createddocuments").select()).filter(i => JSON.parse(route.query.linkedDocuments).includes(i.id))
- //let linkedDocuments = (await supabase.from("createddocuments").select().in("id", JSON.parse(route.query.linkedDocuments))).data
//TODO: Implement Checking for Same Customer, Contact and Project
@@ -203,7 +202,6 @@ const setupPage = async () => {
} else if (route.query.loadMode === "finalInvoice") {
let linkedDocuments = (await useEntities("createddocuments").select()).filter(i => JSON.parse(route.query.linkedDocuments).includes(i.id))
- //let linkedDocuments = (await supabase.from("createddocuments").select().in("id", JSON.parse(route.query.linkedDocuments))).data
//TODO: Implement Checking for Same Customer, Contact and Project
@@ -3030,12 +3028,17 @@ const setRowData = async (row, service = {sellingPriceComposed: {}}, product = {
>
Show
-->
-
+
+
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)
diff --git a/pages/email/new.vue b/pages/email/new.vue
index ed8d53a..d31f20d 100644
--- a/pages/email/new.vue
+++ b/pages/email/new.vue
@@ -1,6 +1,5 @@
-
-
-
-
-
-
{{item.label}}
-
-
-
-
-
-
-
- Abschicken
-
-
- Zurücksetzen
-
-
-
-
-
- Dieses Formular wurde bereits abgeschickt. Möchten Sie erneut Daten abschicken, sprechen Sie bitte Ihren Ansprechpartner an, um das Formular freizuschalten.
-
-
-
-
-
\ No newline at end of file
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 @@
-
-
-
-
-
-
- Speichern
-
-
-
-
-
-
loadFile(documentId)"
- />
-
- Keine Dateien zum zuweisen verfügbar
-
-
-
-
-
-
-
-
-
-
Status: {{itemInfo.state}}
-
Datum: {{dayjs(itemInfo.date).format('DD.MM.YYYY')}}
-
Fälligkeitsdatum: {{dayjs(itemInfo.dueDate).format('DD.MM.YYYY')}}
-
Lieferant: {{dataStore.getVendorById(itemInfo.vendor).name}}
-
Bezahlt: {{itemInfo.paid}}
-
Beschreibung: {{itemInfo.description}}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/pages/incomingInvoices/edit/[id].vue b/pages/incomingInvoices/edit/[id].vue
index b3eacfc..dee9b2b 100644
--- a/pages/incomingInvoices/edit/[id].vue
+++ b/pages/incomingInvoices/edit/[id].vue
@@ -2,7 +2,6 @@
import InputGroup from "~/components/InputGroup.vue";
import dayjs from "dayjs";
import HistoryDisplay from "~/components/HistoryDisplay.vue";
-import {useSupabaseSelect} from "~/composables/useSupabase.js";
diff --git a/pages/incomingInvoices/index.vue b/pages/incomingInvoices/index.vue
index 217244c..8d12d6e 100644
--- a/pages/incomingInvoices/index.vue
+++ b/pages/incomingInvoices/index.vue
@@ -51,7 +51,6 @@ const type = "incominginvoices"
const dataType = dataStore.dataTypes[type]
const setupPage = async () => {
- //items.value = await useSupabaseSelect("incominginvoices","*, vendor(id,name), statementallocations(id,amount)","created_at",false)
items.value = await useEntities(type).select("*, vendor(id,name), statementallocations(id,amount)",sort.value.column,sort.value.direction === "asc")
}
diff --git a/pages/incomingInvoices/show/[id].vue b/pages/incomingInvoices/show/[id].vue
index 7f4b47f..181f352 100644
--- a/pages/incomingInvoices/show/[id].vue
+++ b/pages/incomingInvoices/show/[id].vue
@@ -5,7 +5,6 @@ import dayjs from "dayjs";
const dataStore = useDataStore()
const profileStore = useProfileStore()
-const supabase = useSupabaseClient()
const route = useRoute()
const router = useRouter()
@@ -43,7 +42,6 @@ const loading = ref(true)
const setupPage = async () => {
if((mode.value === "show") && route.params.id){
- //itemInfo.value = await useSupabaseSelectSingle("incominginvoices",route.params.id,"*, files(*), vendor(*)")
itemInfo.value = await useEntities("incominginvoices").selectSingle(route.params.id,"*, files(*), vendor(*)")
if(process.dev) console.log(itemInfo.value)
currentDocument.value = await useFiles().selectDocument(itemInfo.value.files[0].id)
diff --git a/pages/index.vue b/pages/index.vue
index 8491f49..e231764 100644
--- a/pages/index.vue
+++ b/pages/index.vue
@@ -66,23 +66,8 @@ definePageMeta({
middleware: 'redirect-to-mobile-index'
})
-
-import DisplayPresentProfiles from "~/components/noAutoLoad/displayPresentProfiles.vue";
-
-
-
-const dataStore = useDataStore()
-const profileStore = useProfileStore()
-const toast = useToast()
-const router = useRouter()
-
const { isNotificationsSlideoverOpen } = useDashboard()
-
-
-
-const user = useSupabaseUser()
-
const setup = async () => {
}
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 @@
-
-
-
-
-
-
- Abbrechen
-
-
- Bestätigen
-
-
-
-
-
-
-
- Wareneingang
- Warenausgang
- Umlagern
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{dataStore.spaces.find(space => space.id === inventoryChangeData.sourceSpaceId) ? dataStore.spaces.find(space => space.id === inventoryChangeData.sourceSpaceId).description : "Kein Lagerplatz ausgewählt"}}
-
-
-
-
-
-
- {{dataStore.getProjectById(inventoryChangeData.sourceProjectId) ? dataStore.getProjectById(inventoryChangeData.sourceProjectId).name : "Kein Projekt ausgewählt"}}
-
-
-
-
-
-
-
-
-
- {{dataStore.products.find(product => product.id === inventoryChangeData.productId) ? dataStore.products.find(product => product.id === inventoryChangeData.productId).name : "Bitte Artikel auswählen"}}
-
-
-
-
-
-
-
-
-
- {{dataStore.spaces.find(space => space.id === inventoryChangeData.destinationSpaceId) ? dataStore.spaces.find(space => space.id === inventoryChangeData.destinationSpaceId).description : "Kein Lagerplatz ausgewählt"}}
-
-
-
-
-
-
- {{dataStore.getProjectById(inventoryChangeData.destinationProjectId) ? dataStore.getProjectById(inventoryChangeData.destinationProjectId).name : "Kein Projekt ausgewählt"}}
-
-
-
-
-
-
-
-
-
-
-
-
-
- +
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ 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 @@
-
-
-
-
-
-
-
-
-
- + Artikel
-
-
-
-
-
-
-
-
- Spalten
-
-
-
-
- router.push(`/products/show/${i.id}`) "
- :empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Keine Artikel anzuzeigen' }"
- >
-
- {{row.name}}
-
- {{row.name}}
-
-
-
-
- {{`${dataStore.getStockByProductId(row.id)} ${(dataStore.units.find(unit => unit.id === row.unit) ? dataStore.units.find(unit => unit.id === row.unit).name : "")}`}}
-
-
-
-
-
-
-
-
-
\ No newline at end of file
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/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 @@
-
-
-
-
-
-
-
-
-
-
-
- + Label
-
-
-
-
- router.push(`/settings/labels/show/${i.id}`)"
- class="w-full"
- :ui="{ divide: 'divide-gray-200 dark:divide-gray-800' }"
- :empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Keine Artikel anzuzeigen' }"
- >
-
- {{row.name}}
-
- {{row.name}}
-
-
-
-
-
-
-
-
-
\ No newline at end of file
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
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 @@
-
-
-
-
-
- Fahrten
-
-
-
- {{itemInfo ? `Fahrt vom: ${dayjs(itemInfo.startTime).format("DD.MM.YY HH:mm")} über ${(itemInfo.distance/1000).toFixed(2)} km` : '' }}
-
-
-
- Abbrechen
-
-
- Entwurf
-
-
- Festschreiben
-
-
- Bearbeiten
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Festgeschrieben:
- {{itemInfo.fixed ? "Ja" : "Nein"}}
-
-
- Fahrzeug:
- {{itemInfo.trackingDevice.vehicle.licensePlate}}
-
-
- Typ:
- {{itemInfo.type ? itemInfo.type : "-"}}
-
-
- Fahrer:
- {{profiles.find(i => i.id === itemInfo.driver) ? profiles.find(i => i.id === itemInfo.driver).fullName : "-"}}
-
-
- Startzeit:
- {{dayjs(itemInfo.startTime).format("DD.MM.YY HH:mm")}}
-
-
- Endzeit:
- {{dayjs(itemInfo.endTime).format("DD.MM.YY HH:mm")}}
-
-
- Entfernung:
- {{(itemInfo.distance/1000).toFixed(2)}} km
-
-
- Beschreibung:
- {{itemInfo.description ? itemInfo.description : "-" }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{profiles.find(profile => profile.id === itemInfo.driver) ? profiles.find(profile => profile.id === itemInfo.driver).fullName : 'Kein Fahrer ausgewählt'}}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ 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 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Spalten
-
-
-
-
- router.push(`/trackingTrips/show/${i.id}`) "
- :empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Keine Fahrten anzuzeigen' }"
- >
-
-
-
-
-
- {{row.vehicle.licensePlate}}
- {{row.vehicle.licensePlate}}
-
-
- {{dayjs(row.startTime).format("DD.MM.YY HH:mm")}}
-
-
- {{dayjs(row.endTime).format("DD.MM.YY HH:mm")}}
-
-
- {{row.distance > 0 ? (row.distance/1000).toFixed(2) : 0 }} km
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/plugins/api.ts b/plugins/api.ts
index 0975c08..7853e35 100644
--- a/plugins/api.ts
+++ b/plugins/api.ts
@@ -1,8 +1,10 @@
import {Preferences} from "@capacitor/preferences";
export default defineNuxtPlugin(() => {
+ const config = useRuntimeConfig()
+
const api = $fetch.create({
- baseURL: /*"http://192.168.1.227:3100"*/ "https://backend.fedeo.io",
+ baseURL: config.public.apiBase,/*"http://192.168.1.227:3100" "https://backend.fedeo.io"*/
credentials: "include",
async onRequest({options}) {
// Token aus Cookie holen
diff --git a/stores/data.js b/stores/data.js
index ee235b1..efd076a 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"
@@ -49,7 +48,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()
@@ -1566,6 +1564,18 @@ export const useDataStore = defineStore('data', () => {
}
]
},
+ tickets: {
+ isArchivable: true,
+ label: "Tickets",
+ labelSingle: "Ticket",
+
+ },
+ ticketmessages: {
+ isArchivable: true,
+ label: "Nachrichten",
+ labelSingle: "Nachricht",
+
+ },
files: {
isArchivable: true,
label: "Dateien",
@@ -2593,136 +2603,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 +2613,5 @@ export const useDataStore = defineStore('data', () => {
return {
dataTypes,
documentTypesForCreation,
- createNewItem,
- updateItem,
}
})
\ No newline at end of file