diff --git a/RechteDoku.xlsx b/RechteDoku.xlsx new file mode 100644 index 0000000..2ba402f Binary files /dev/null and b/RechteDoku.xlsx differ diff --git a/app.vue b/app.vue index cec450a..d4950eb 100644 --- a/app.vue +++ b/app.vue @@ -6,8 +6,6 @@ const tenants = (await supabase.from("tenants").select()).data const dataStore = useDataStore() const viewport = useViewport() -console.log("1.") - /*watch(viewport.breakpoint, (newBreakpoint, oldBreakpoint) => { console.log('Breakpoint updated:', oldBreakpoint, '->', newBreakpoint) })*/ @@ -52,6 +50,8 @@ useSeoMeta({ + + @@ -98,7 +98,6 @@ useSeoMeta({ .scrollList { overflow-y: scroll; height: 85vh; - //margin-top: 1em; } diff --git a/components/ButtonWithConfirm.vue b/components/ButtonWithConfirm.vue index fb17fb5..fe10c44 100644 --- a/components/ButtonWithConfirm.vue +++ b/components/ButtonWithConfirm.vue @@ -18,6 +18,7 @@ const {color,variant} = props const showModal = ref(false) const emitConfirm = () => { + showModal.value = false emit('confirmed') } @@ -38,19 +39,22 @@ const emitConfirm = () => { diff --git a/components/DocumentDisplay.vue b/components/DocumentDisplay.vue index a4bcd85..d88a3ba 100644 --- a/components/DocumentDisplay.vue +++ b/components/DocumentDisplay.vue @@ -1,8 +1,12 @@ - - \ No newline at end of file diff --git a/pages/documents.vue b/pages/documents.vue deleted file mode 100644 index fbdf9fb..0000000 --- a/pages/documents.vue +++ /dev/null @@ -1,369 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/pages/editortest.vue b/pages/editortest.vue deleted file mode 100644 index 56d14d7..0000000 --- a/pages/editortest.vue +++ /dev/null @@ -1,11 +0,0 @@ - - - - - \ No newline at end of file diff --git a/pages/email/index.vue b/pages/email/index.vue index 13ce4f0..f0f4e30 100644 --- a/pages/email/index.vue +++ b/pages/email/index.vue @@ -2,6 +2,7 @@ const supabase = useSupabaseClient() const dataStore = useDataStore() +const profileStore = useProfileStore() const selectedTab = ref(0) @@ -12,7 +13,7 @@ const accountData = ref(null) const availableAccounts = ref(null) const selectedAccount = ref(null) const setupPage = async () => { - availableAccounts.value = (await supabase.from("emailAccounts").select("*").contains("profiles",[dataStore.activeProfile.id])).data + availableAccounts.value = (await supabase.from("emailAccounts").select("*").contains("profiles",[profileStore.activeProfile.id])).data console.log(availableAccounts.value) if(availableAccounts.value.length > 0) { diff --git a/pages/email/new.vue b/pages/email/new.vue index cfce0cd..87fb5f5 100644 --- a/pages/email/new.vue +++ b/pages/email/new.vue @@ -2,6 +2,7 @@ const supabase = useSupabaseClient() const dataStore = useDataStore() +const profileStore = useProfileStore() const route = useRoute() const router = useRouter() const toast = useToast() @@ -29,7 +30,7 @@ const setupPage = async () => { } else { emailData.value.account = emailAccounts.value[0].id - preloadedContent.value = `

${dataStore.activeProfile.emailSignature}` + preloadedContent.value = `

${profileStore.activeProfile.emailSignature || ""}` //Check Query if(route.query.to) emailData.value.to = route.query.to @@ -39,18 +40,28 @@ const setupPage = async () => { if(route.query.loadDocuments) { - //console.log(JSON.parse(route.query.loadDocuments)) - const {data,error} = await supabase.from("documents").select('*, createdDocument(id,documentNumber,title,contact(email))').in('id',JSON.parse(route.query.loadDocuments)) + console.log(JSON.parse(route.query.loadDocuments)) + const data = await useFiles().selectSomeDocuments(JSON.parse(route.query.loadDocuments)) + console.log(data) + + - if(error) console.log(error) if(data) loadedDocuments.value = data //console.log(loadedDocuments.value) if(loadedDocuments.value.length > 0) { - emailData.value.subject = loadedDocuments.value[0].createdDocument.title - emailData.value.to = loadedDocuments.value[0].createdDocument.contact ? loadedDocuments.value[0].createdDocument.contact.email : "" + console.log(loadedDocuments.value[0]) + emailData.value.subject = loadedDocuments.value[0].createddocument.title + if(loadedDocuments.value[0].createddocument.contact && loadedDocuments.value[0].createddocument.contact.email) { + console.log("Contact") + emailData.value.to = loadedDocuments.value[0].createddocument.contact.email + } else if(loadedDocuments.value[0].createddocument.customer && loadedDocuments.value[0].createddocument.customer.infoData.email) { + + + emailData.value.to = loadedDocuments.value[0].createddocument.customer.infoData.email + } } } @@ -121,7 +132,7 @@ const sendEmail = async () => { for await (const doc of loadedDocuments.value) { - const {data,error} = await supabase.storage.from("files").download(doc.path) + const {data,error} = await supabase.storage.from("filesdev").download(doc.path) body.attachments.push({ filename: doc.path.split("/")[doc.path.split("/").length -1], @@ -191,30 +202,39 @@ const sendEmail = async () => { /> - - - - + + + + + + + + + + + + @@ -227,7 +247,7 @@ const sendEmail = async () => { class="mx-auto w-10 h-10" /> Anhänge hochladen--> - { class="list-disc" v-for="doc in loadedDocuments" > - Dokument - {{doc.createdDocument.documentNumber}} + Dokument - {{doc.createddocument.documentNumber}} diff --git a/pages/employees/timetracking.vue b/pages/employees/timetracking.vue index 257356d..3bbd807 100644 --- a/pages/employees/timetracking.vue +++ b/pages/employees/timetracking.vue @@ -9,6 +9,7 @@ definePageMeta({ }) const dataStore = useDataStore() +const profileStore = useProfileStore() const supabase = useSupabaseClient() const user = useSupabaseUser() const toast = useToast() @@ -16,22 +17,29 @@ const toast = useToast() const timeTypes = dataStore.getTimeTypes const timeInfo = ref({ - user: "", - start: "", - end: null, + profile: "", + startDate: "", + endDate: null, notes: null, - projectId: null, + project: null, type: null }) -const filterUser = ref(user.value.id || "") +const filterUser = ref(profileStore.activeProfile.id || "") +const times = ref([]) + +const setup = async () => { + times.value = await useSupabaseSelect("times","*, profile(*)") +} + +setup() const filteredRows = computed(() => { - let times = dataStore.times + //let times = times.value - if(dataStore.hasRight('viewTimes')) { + /*if(dataStore.hasRight('viewTimes')) { if(filterUser.value !== "") { times = times.filter(i => i.user === filterUser.value) } @@ -39,9 +47,9 @@ const filteredRows = computed(() => { times = times.filter(i => i.user === user.value.id) } else { times = [] - } + }*/ - return times + return times.value }) @@ -62,42 +70,34 @@ const columns = [ { key:"state", label: "Status", - sortable:true }, { key: "user", label: "Benutzer", - sortable:true }, { - key:"start", + key:"startDate", label:"Start", - sortable:true + }, + { + key: "endDate", + label: "Ende", }, { key:"type", label:"Typ", - sortable:true - }, - { - key: "end", - label: "Ende", - sortable:true }, { key: "duration", label: "Dauer", - sortable:true }, { - key: "projectId", + key: "project", label: "Projekt", - sortable:true }, { key: "notes", label: "Notizen", - sortable:true } ] @@ -109,9 +109,9 @@ const configTimeMode = ref("create") const startTime = async () => { console.log("started") - timeInfo.value.user = user.value.id + timeInfo.value.profile = profileStore.activeProfile.id timeInfo.value.start = new Date().toISOString() - timeInfo.value.tenant = dataStore.currentTenant + timeInfo.value.tenant = profileStore.currentTenant const {data,error} = await supabase .from("times") @@ -123,7 +123,7 @@ const startTime = async () => { } else if(data) { //timeInfo.value = data[0] await dataStore.fetchTimes() - runningTimeInfo.value = dataStore.times.find(time => time.user === user.value.id && !time.end) + runningTimeInfo.value = dataStore.times.find(time => time.profile === profileStore.activeProfile.id && !time.end) } } @@ -154,15 +154,15 @@ const stopStartedTime = async () => { } } -if(dataStore.times.find(time => time.user == user.value.id && !time.end)) { - runningTimeInfo.value = dataStore.times.find(time => time.user == user.value.id && !time.end) +if(times.value.find(time => time.profile == profileStore.activeProfile.id && !time.end)) { + runningTimeInfo.value = times.value.find(time => time.profile == profileStore.activeProfile.id && !time.end) } const createTime = async () => { const {data,error} = await supabase .from("times") - .insert({...itemInfo.value, tenant: dataStore.currentTenant}) + .insert({...itemInfo.value, tenant: profileStore.currentTenant}) .select() if(error) { @@ -240,14 +240,13 @@ const setState = async (newState) => { Erstellen @@ -339,14 +338,14 @@ const setState = async (newState) => { label="Benutzer:" > @@ -444,7 +443,7 @@ const setState = async (newState) => { >{{row.state}} - + Beleg + + Beleg diff --git a/pages/index.vue b/pages/index.vue index b9e1bd3..cd4d044 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -15,48 +15,28 @@ -

{{dataStore.getProfileById(time.profile).fullName}}

+
- + + + +
@@ -64,11 +44,14 @@ - - - - \ No newline at end of file diff --git a/pages/inventoryitems/index.vue b/pages/inventoryitems/index.vue deleted file mode 100644 index d100bae..0000000 --- a/pages/inventoryitems/index.vue +++ /dev/null @@ -1,117 +0,0 @@ - - - - - \ No newline at end of file diff --git a/pages/login.vue b/pages/login.vue index 9d642f0..05c6225 100644 --- a/pages/login.vue +++ b/pages/login.vue @@ -1,5 +1,7 @@ - - - - \ No newline at end of file diff --git a/pages/plants/index.vue b/pages/plants/index.vue deleted file mode 100644 index ab21068..0000000 --- a/pages/plants/index.vue +++ /dev/null @@ -1,139 +0,0 @@ - - - - - \ No newline at end of file diff --git a/pages/productcategories/[mode]/[[id]].vue b/pages/productcategories/[mode]/[[id]].vue deleted file mode 100644 index b56c291..0000000 --- a/pages/productcategories/[mode]/[[id]].vue +++ /dev/null @@ -1,179 +0,0 @@ - - - - - \ No newline at end of file diff --git a/pages/productcategories/index.vue b/pages/productcategories/index.vue deleted file mode 100644 index fa50efc..0000000 --- a/pages/productcategories/index.vue +++ /dev/null @@ -1,139 +0,0 @@ - - - - - \ No newline at end of file diff --git a/pages/products/[mode]/[[id]].vue b/pages/products/[mode]/[[id]].vue deleted file mode 100644 index faeb1c4..0000000 --- a/pages/products/[mode]/[[id]].vue +++ /dev/null @@ -1,353 +0,0 @@ - - - - - \ No newline at end of file diff --git a/pages/products/index.vue b/pages/products/index.vue deleted file mode 100644 index a36a8c8..0000000 --- a/pages/products/index.vue +++ /dev/null @@ -1,220 +0,0 @@ - - - - - \ No newline at end of file diff --git a/pages/profiles/index.vue b/pages/profiles/index.vue index 0f9bf3a..129399e 100644 --- a/pages/profiles/index.vue +++ b/pages/profiles/index.vue @@ -1,21 +1,19 @@
- - + diff --git a/pages/workingtimes/index.vue b/pages/workingtimes/index.vue index 9256000..ff0870e 100644 --- a/pages/workingtimes/index.vue +++ b/pages/workingtimes/index.vue @@ -9,20 +9,14 @@ definePageMeta({ }) const dataStore = useDataStore() +const profileStore = useProfileStore() const supabase = useSupabaseClient() -const user = useSupabaseUser() -const toast = useToast() const router = useRouter() -const timeInfo = ref({ - profile: "", - start: "", - end: null, - notes: null, -}) -const filterUser = ref(dataStore.activeProfile.id || "") + +const filterUser = ref(profileStore.activeProfile.id || "") const workingtimes = ref([]) @@ -43,15 +37,6 @@ const filteredRows = computed(() => { times = times.filter(i => i.profile === filterUser.value) - /*if(dataStore.hasRight('viewTimes')) { - if(filterUser.value !== "") { - times = times.filter(i => i.profile === filterUser.value) - } - } else if(dataStore.hasRight('viewOwnTimes')) { - times = times.filter(i => i.profile === dataStore.getOwnProfile.id) - } else { - times = [] - }*/ return times/*.map(i => { return { @@ -115,55 +100,9 @@ const columns = [ } ] -console.log(dataStore.workingtimes) -const runningTimeInfo = ref({}) -const startTime = async () => { - console.log("started") - timeInfo.value = { - profile: dataStore.activeProfile.id, - startDate: dayjs(), - tenant: dataStore.currentTenant, - state: "Im Web gestartet" - } - const {data,error} = await supabase - .from("workingtimes") - .insert([timeInfo.value]) - .select() - if(error) { - console.log(error) - } else if(data) { - //timeInfo.value = data[0] - await dataStore.fetchWorkingTimes() - runningTimeInfo.value = timeInfo.value//dataStore.times.find(time => time.profile === dataStore.activeProfile.id && !time.endDate) - } -} - -const stopStartedTime = async () => { - runningTimeInfo.value.endDate = dayjs() - runningTimeInfo.value.state = "Im Web gestoppt" - - const {data,error} = await supabase - .from("workingtimes") - .update(runningTimeInfo.value) - .eq('id',runningTimeInfo.value.id) - .select() - console.log(data) - - if(error) { - console.log(error) - } else { - toast.add({title: "Zeit erfolgreich gestoppt"}) - runningTimeInfo.value = {} - dataStore.fetchWorkingTimes() - } -} - -if(dataStore.workingtimes.find(time => time.profile === dataStore.activeProfile.id && !time.endDate)) { - runningTimeInfo.value = dataStore.workingtimes.find(time => time.profile === dataStore.activeProfile.id && !time.end) -} const getDuration = (time) => { const minutes = Math.floor(dayjs(time.endDate).diff(dayjs(time.startDate),'minutes',true)) @@ -194,17 +133,19 @@ const expand = ref({ row: {} }) +const setEndDate = (row) => { + row.startDate = dayjs(row.startDate).toISOString() + + row.endDate = dayjs(row.endDate).set("year", dayjs(row.startDate).get("year")).set("month", dayjs(row.startDate).get("month")).set("date", dayjs(row.startDate).get("date")) + + row.endDate = dayjs(row.endDate).toISOString() +} +