Changes in workingtimes.vue

This commit is contained in:
2024-03-18 09:10:18 +01:00
parent 73d3c6311a
commit 39a2f19b0d
2 changed files with 15 additions and 7 deletions

View File

@@ -25,7 +25,7 @@ const timeInfo = ref({
notes: null, notes: null,
}) })
const filterUser = ref(dataStore.getOwnProfile.id || "") const filterUser = ref(dataStore.activeProfile.id || "")
const filteredRows = computed(() => { const filteredRows = computed(() => {
@@ -152,8 +152,8 @@ const stopStartedTime = async () => {
} }
} }
if(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.getOwnProfile.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 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) const hours = Math.floor(minutes/60)
return { return {
//dezimal: dez, //dezimal: dez,
@@ -448,10 +448,10 @@ const setState = async (newState) => {
{{dayjs(row.start, "HH:mm:ss").format("HH:mm")}} Uhr {{dayjs(row.start, "HH:mm:ss").format("HH:mm")}} Uhr
</template> </template>
<template #end-data="{row}"> <template #end-data="{row}">
{{dayjs(row.end, "HH:mm:ss").format("HH:mm")}} Uhr {{row.end ? dayjs(row.end, "HH:mm:ss").format("HH:mm") + " Uhr" : ""}}
</template> </template>
<template #duration-data="{row}"> <template #duration-data="{row}">
{{getDuration(row).composed}} {{row.end ? getDuration(row).composed : ""}}
</template> </template>
</UTable> </UTable>
</template> </template>

View File

@@ -170,6 +170,7 @@ export const useDataStore = defineStore('data', () => {
const incominginvoices = ref([]) const incominginvoices = ref([])
const bankAccounts = ref([]) const bankAccounts = ref([])
const bankStatements = ref([]) const bankStatements = ref([])
const bankrequisitions = ref([])
const historyItems = ref([]) const historyItems = ref([])
const numberRanges = ref([]) const numberRanges = ref([])
const notifications = ref([]) const notifications = ref([])
@@ -316,6 +317,7 @@ export const useDataStore = defineStore('data', () => {
await fetchIncomingInvoices() await fetchIncomingInvoices()
await fetchBankAccounts() await fetchBankAccounts()
await fetchBankStatements() await fetchBankStatements()
await fetchBankRequisitions()
await fetchHistoryItems() await fetchHistoryItems()
await fetchNumberRanges() await fetchNumberRanges()
await fetchNotifications() await fetchNotifications()
@@ -363,6 +365,7 @@ export const useDataStore = defineStore('data', () => {
incominginvoices.value= [] incominginvoices.value= []
bankAccounts.value= [] bankAccounts.value= []
bankStatements.value= [] bankStatements.value= []
bankrequisitions.value= []
historyItems.value = [] historyItems.value = []
numberRanges.value = [] numberRanges.value = []
notifications.value = [] notifications.value = []
@@ -384,7 +387,7 @@ export const useDataStore = defineStore('data', () => {
} }
function hasRight (right) { 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 const grantedRights = roles.value.find(i => i.key === role).rights
if(grantedRights.includes(right)){ if(grantedRights.includes(right)){
@@ -582,6 +585,9 @@ export const useDataStore = defineStore('data', () => {
async function fetchBankStatements () { async function fetchBankStatements () {
bankStatements.value = (await supabase.from("bankstatements").select().eq('tenant', currentTenant.value).order("date", {ascending:false})).data 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 () { async function fetchEvents () {
events.value = (await supabase.from("events").select().eq('tenant', currentTenant.value)).data events.value = (await supabase.from("events").select().eq('tenant', currentTenant.value)).data
} }
@@ -1161,6 +1167,7 @@ export const useDataStore = defineStore('data', () => {
incominginvoices, incominginvoices,
bankAccounts, bankAccounts,
bankStatements, bankStatements,
bankrequisitions,
historyItems, historyItems,
numberRanges, numberRanges,
notifications, notifications,
@@ -1190,6 +1197,7 @@ export const useDataStore = defineStore('data', () => {
fetchOwnProfiles, fetchOwnProfiles,
fetchBankAccounts, fetchBankAccounts,
fetchBankStatements, fetchBankStatements,
fetchBankRequisitions,
fetchEvents, fetchEvents,
fetchContracts, fetchContracts,
fetchContacts, fetchContacts,