From 39a2f19b0dee693d68242b717600a4e9b2281323 Mon Sep 17 00:00:00 2001 From: flfeders Date: Mon, 18 Mar 2024 09:10:18 +0100 Subject: [PATCH] Changes in workingtimes.vue --- spaces/pages/workingtimes.vue | 12 ++++++------ spaces/stores/data.js | 10 +++++++++- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/spaces/pages/workingtimes.vue b/spaces/pages/workingtimes.vue index 5d651fa..2b6f5eb 100644 --- a/spaces/pages/workingtimes.vue +++ b/spaces/pages/workingtimes.vue @@ -25,7 +25,7 @@ const timeInfo = ref({ notes: null, }) -const filterUser = ref(dataStore.getOwnProfile.id || "") +const filterUser = ref(dataStore.activeProfile.id || "") const filteredRows = computed(() => { @@ -152,8 +152,8 @@ const stopStartedTime = async () => { } } -if(dataStore.workingtimes.find(time => time.profile === dataStore.getOwnProfile.id && !time.end)) { - runningTimeInfo.value = dataStore.workingtimes.find(time => time.profile === dataStore.getOwnProfile.id && !time.end) +if(dataStore.workingtimes.find(time => time.profile === dataStore.activeProfile.id && !time.end)) { + runningTimeInfo.value = dataStore.workingtimes.find(time => time.profile === dataStore.activeProfile.id && !time.end) } @@ -203,7 +203,7 @@ const format = (date) => { } const getDuration = (time) => { - const minutes = Math.floor(dayjs(time.end, "HH:mm:ssZ").diff(dayjs(time.start, "HH:mm:ssZ"),'minutes',true)) + const minutes = Math.floor(dayjs(time.end, "HH:mm:ss").diff(dayjs(time.start, "HH:mm:ss"),'minutes',true)) const hours = Math.floor(minutes/60) return { //dezimal: dez, @@ -448,10 +448,10 @@ const setState = async (newState) => { {{dayjs(row.start, "HH:mm:ss").format("HH:mm")}} Uhr diff --git a/spaces/stores/data.js b/spaces/stores/data.js index e527f3e..f2c4428 100644 --- a/spaces/stores/data.js +++ b/spaces/stores/data.js @@ -170,6 +170,7 @@ export const useDataStore = defineStore('data', () => { const incominginvoices = ref([]) const bankAccounts = ref([]) const bankStatements = ref([]) + const bankrequisitions = ref([]) const historyItems = ref([]) const numberRanges = ref([]) const notifications = ref([]) @@ -316,6 +317,7 @@ export const useDataStore = defineStore('data', () => { await fetchIncomingInvoices() await fetchBankAccounts() await fetchBankStatements() + await fetchBankRequisitions() await fetchHistoryItems() await fetchNumberRanges() await fetchNotifications() @@ -363,6 +365,7 @@ export const useDataStore = defineStore('data', () => { incominginvoices.value= [] bankAccounts.value= [] bankStatements.value= [] + bankrequisitions.value= [] historyItems.value = [] numberRanges.value = [] notifications.value = [] @@ -384,7 +387,7 @@ export const useDataStore = defineStore('data', () => { } function hasRight (right) { - const role = profiles.value.find(i => i.id === user.value.id).role + const role = profiles.value.find(i => i.id === activeProfile.value.id).role const grantedRights = roles.value.find(i => i.key === role).rights if(grantedRights.includes(right)){ @@ -582,6 +585,9 @@ export const useDataStore = defineStore('data', () => { async function fetchBankStatements () { bankStatements.value = (await supabase.from("bankstatements").select().eq('tenant', currentTenant.value).order("date", {ascending:false})).data } + async function fetchBankRequisitions () { + bankrequisitions.value = (await supabase.from("bankrequisitions").select().eq('status', "LN")).data + } async function fetchEvents () { events.value = (await supabase.from("events").select().eq('tenant', currentTenant.value)).data } @@ -1161,6 +1167,7 @@ export const useDataStore = defineStore('data', () => { incominginvoices, bankAccounts, bankStatements, + bankrequisitions, historyItems, numberRanges, notifications, @@ -1190,6 +1197,7 @@ export const useDataStore = defineStore('data', () => { fetchOwnProfiles, fetchBankAccounts, fetchBankStatements, + fetchBankRequisitions, fetchEvents, fetchContracts, fetchContacts,