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,
})
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
</template>
<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 #duration-data="{row}">
{{getDuration(row).composed}}
{{row.end ? getDuration(row).composed : ""}}
</template>
</UTable>
</template>

View File

@@ -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,