From b4b70d8e7c2e78774a6f06c76fceabd29e58ea69 Mon Sep 17 00:00:00 2001 From: flfeders Date: Fri, 1 Mar 2024 22:48:03 +0100 Subject: [PATCH] Changes --- .idea/vcs.xml | 1 + spaces/components/HistoryDisplay.vue | 2 +- spaces/layouts/default.vue | 136 --- spaces/pages/createDocument/edit/[[id]].vue | 901 ++++++++------------ spaces/pages/employees/timetracking.vue | 2 +- spaces/pages/index.vue | 4 +- spaces/pages/login.vue | 10 +- spaces/pages/services/[mode]/[[id]].vue | 34 +- spaces/stores/data.js | 3 +- tools/hardwareGateway/index.mjs | 20 +- 10 files changed, 420 insertions(+), 693 deletions(-) diff --git a/.idea/vcs.xml b/.idea/vcs.xml index 94a25f7..728cba2 100644 --- a/.idea/vcs.xml +++ b/.idea/vcs.xml @@ -2,5 +2,6 @@ + \ No newline at end of file diff --git a/spaces/components/HistoryDisplay.vue b/spaces/components/HistoryDisplay.vue index 3aedd26..72832f4 100644 --- a/spaces/components/HistoryDisplay.vue +++ b/spaces/components/HistoryDisplay.vue @@ -81,7 +81,7 @@ const addHistoryItem = async () => { const {data,error} = await supabase .from("historyitems") - .insert([addHistoryItemData.value]) + .insert([{...addHistoryItemData.value, tenant: dataStore.currentTenant}]) .select() if(error) { diff --git a/spaces/layouts/default.vue b/spaces/layouts/default.vue index 6d6bdd2..ab56422 100644 --- a/spaces/layouts/default.vue +++ b/spaces/layouts/default.vue @@ -5,7 +5,6 @@ import TenantDropdown from "~/components/TenantDropdown.vue"; const dataStore = useDataStore() const colorMode = useColorMode() const { isHelpSlideoverOpen } = useDashboard() -const userProfile = dataStore.getOwnProfile const supabase = useSupabaseClient() const router = useRouter() const route = useRoute() @@ -175,142 +174,7 @@ const navLinks = [ }, ] -const showUserMenu = ref(false) -const userMenuItems = ref([ - /*{ - label: "Profil", - badge: dataStore.notifications.filter(item => item.read).length, - icon: "i-heroicons-user-20-solid" - },*/ - { - label: "Nummernkreise", - icon: "i-heroicons-cog-8-tooth", - to: "/settings/numberRanges" - }, - { - label: "Einstellungen", - icon: "i-heroicons-cog-8-tooth", - to: "/settings" - }, - { - label: 'Benutzer', - icon: 'i-heroicons-user-group', - to: "/users" - } -]) -const linksold = [[{ - label: "Dashboard", - to: "/", - icon: "i-heroicons-home" -}], - [{ - label: "Aufgaben", - to: "/tasks", - icon: "i-heroicons-rectangle-stack" -}, { - label: "Plantafel", - to: "/calendar/timeline", - icon: "i-heroicons-calendar-days" - }, - { - label: "Kalender", - to: "/calendar/grid", - icon: "i-heroicons-calendar-days" - }, - { - label: "Dokumente", - to: "/documents", - icon: "i-heroicons-document" - }, - { - label: "E-Mail", - to: "/email", - icon: "i-heroicons-envelope" - }],[{ - label: "Kunden", - to: "/customers", - icon: "i-heroicons-user-group" -}, - { - label: "Lieferanten", - to: "/vendors", - icon: "i-heroicons-truck" - }, - { - label: "Ansprechpartner", - to: "/contacts", - icon: "i-heroicons-user-group" - }], [{ - label: "Belege", - to: "/receipts", - icon: "i-heroicons-document-text" -}, - /* { - label: "Bank", - to: "/banking", - icon: "i-heroicons-currency-euro" - }*/], [{ - label: "Projekte", - to: "/projects", - icon: "i-heroicons-clipboard-document-check" -}, - { - label: "Verträge", - to: "/contracts", - icon: "i-heroicons-clipboard-document" - }, - { - label: "Objekte", - to: "/plants", - icon: "i-heroicons-clipboard-document" - }],[{ - label: "Zeiterfassung", - to: "/employees/timetracking", - icon: "i-heroicons-clock" -}, - { - label: "Anwesenheiten", - to: "/workingtimes", - icon: "i-heroicons-clock" - }, - { - label: "Abwesenheiten", - to: "/absenceRequests", - icon: "i-heroicons-document-text" - }],[{ - label: "Steuerung", - to: "/inventory", - icon: "i-heroicons-square-3-stack-3d" -}, - { - label: "Artikelstamm", - to: "/products", - icon: "i-heroicons-puzzle-piece" - },{ - label: "Leistungsstamm", - to: "/services", - icon: "i-heroicons-puzzle-piece" - }, - { - label: "Lagerplätze", - to: "/spaces", - icon: "i-heroicons-square-3-stack-3d" - }, - { - label: "Fahrzeuge", - to: "/vehicles", - icon: "i-heroicons-truck" - }, { - label: "Inventar", - to: "/inventoryitems", - icon: "i-heroicons-puzzle-piece" - },],[{ - label: "Einstellungen", - to:"/settings", - icon: "i-heroicons-cog-8-tooth" -}] -] let links = [ { diff --git a/spaces/pages/createDocument/edit/[[id]].vue b/spaces/pages/createDocument/edit/[[id]].vue index 509dd28..c7f2095 100644 --- a/spaces/pages/createDocument/edit/[[id]].vue +++ b/spaces/pages/createDocument/edit/[[id]].vue @@ -397,200 +397,205 @@ setupPage() + + - - - - - + Leistungsposition - - - + Artikelposition - - - + Freitextposition - - - + Seitenumbruch - - - - - - - - - - - - - - - - -
Netto:{{documentTotal.totalNet}}
zzgl. 19 % USt:{{documentTotal.total19}}
Brutto:{{documentTotal.totalGross}}
- - - - - - + - - - - - - - + - + + + Freitextposition + + + + Seitenumbruch + + + + + + + + + + + + + + + + +
Netto:{{documentTotal.totalNet}}
zzgl. 19 % USt:{{documentTotal.total19}}
Brutto:{{documentTotal.totalGross}}
+ + + + + + + + + + + + + + - - -
- - - - - + /> + + +
+ + + + + + - diff --git a/spaces/pages/employees/timetracking.vue b/spaces/pages/employees/timetracking.vue index 86401a5..70b3b18 100644 --- a/spaces/pages/employees/timetracking.vue +++ b/spaces/pages/employees/timetracking.vue @@ -161,7 +161,7 @@ if(dataStore.times.find(time => time.user == user.value.id && !time.end)) { const createTime = async () => { const {data,error} = await supabase .from("times") - .insert([itemInfo.value]) + .insert({...itemInfo.value, tenant: dataStore.currentTenant}) .select() if(error) { diff --git a/spaces/pages/index.vue b/spaces/pages/index.vue index b26f0c9..d9ca9f2 100644 --- a/spaces/pages/index.vue +++ b/spaces/pages/index.vue @@ -11,9 +11,9 @@ - + diff --git a/spaces/pages/login.vue b/spaces/pages/login.vue index 289f1cb..9e5c10e 100644 --- a/spaces/pages/login.vue +++ b/spaces/pages/login.vue @@ -84,11 +84,17 @@ const onSubmit = async (data) => { --> - + + - - - Bearbeiten - - + Verkaufspreis: {{String(Number(currentItem.sellingPrice).toFixed(2)).replace(".",",")}} €
@@ -143,6 +127,13 @@ setupPage() v-model="itemInfo.name" /> + + + @@ -174,6 +165,7 @@ setupPage() :options="dataStore.serviceCategories" option-attribute="name" value-attribute="id" + v-model="itemInfo.serviceCategorie" > @@ -190,6 +182,14 @@ setupPage() + + + diff --git a/spaces/stores/data.js b/spaces/stores/data.js index d8ced1d..7a81e91 100644 --- a/spaces/stores/data.js +++ b/spaces/stores/data.js @@ -405,6 +405,7 @@ export const useDataStore = defineStore('data', () => { if(supabaseError) { console.log(supabaseError) + toast.add({title: "Es ist ein Fehler bei der Erstellung aufgetreten", color: "rose"}) } else if (supabaseData) { await eval( dataType + '.value.push(' + JSON.stringify(...supabaseData) + ')') toast.add({title: `${dataTypes[dataType].labelSingle} hinzugefügt`}) @@ -425,7 +426,7 @@ export const useDataStore = defineStore('data', () => { } else if(supabaseData) { await eval(dataType + '.value[' + dataType + '.value.findIndex(i => i.id === ' + JSON.stringify(data.id) + ')] = ' + JSON.stringify(supabaseData[0])) toast.add({title: `${dataTypes[dataType].labelSingle} gespeichert`}) - if(dataTypes[dataType].redirect) await router.push(`/${dataType}/show/${supabaseData[0].id}`) + if(dataTypes[dataType].redirect) await router.push(`/${dataType}/show/${data.id}`) return supabaseData } } diff --git a/tools/hardwareGateway/index.mjs b/tools/hardwareGateway/index.mjs index 72dff77..326f97c 100644 --- a/tools/hardwareGateway/index.mjs +++ b/tools/hardwareGateway/index.mjs @@ -20,27 +20,27 @@ app.get("/", async (req,res) => { app.post("/executeTimeCommand", async (req,res) => { console.log(req.body) let body = req.body - let deviceData = (await supabase.from("devices").select().eq("id",body.id).single()).data + let deviceData = (await supabase.from("devices").select().eq("id",body.deviceId).single()).data let currentTenant = deviceData.tenant console.log(deviceData) console.log(currentTenant) - if(deviceData.password === body.password) { - let userId = "" + if(deviceData.password === body.devicePassword) { + let user = {} if(!body.tokenId && !body.userId) { res.sendStatus(400) } else if(body.tokenId && !body.userId) { - userId = ((await supabase.from("profiles").select().eq("tokenId",body.tokenId).single()).data).id - console.log(userId) + user = ((await supabase.from("profiles").select().eq("tokenId",body.tokenId).single()).data) + console.log(user) } else { - userId = body.userId + user.id = body.userId } - let startedWorkingTime = (await supabase.from("workingtimes").select().eq("user",userId).is("end",null).single()).data + let startedWorkingTime = (await supabase.from("workingtimes").select().eq("user",user.id).is("end",null).single()).data if(startedWorkingTime) { //Stop Time @@ -55,7 +55,7 @@ app.post("/executeTimeCommand", async (req,res) => { console.log("Time Stopped") res.json({ - message: "Zeit gestoppt", + message: `Deine Zeit wurde gestoppt, bis bald ${user.firstName}`, type: "stopped" }) @@ -65,7 +65,7 @@ app.post("/executeTimeCommand", async (req,res) => { const {data,error} = await supabase.from("workingtimes") .insert([{ - user: userId, + user: user.id, date: dayjs().format("YYYY-MM-DD"), start: String(dayjs().format("HH:mm:ss"))+ "+01", tenant: currentTenant, @@ -78,7 +78,7 @@ app.post("/executeTimeCommand", async (req,res) => { console.log("Time Started") res.json({ - message: "Zeit gestartet", + message: `Hallo ${user.firstName}, deine Zeit wurde gestartet`, type: "started" }) }