This commit is contained in:
2024-03-11 15:07:18 +01:00
parent 99b8738c31
commit 423b2638aa

View File

@@ -19,13 +19,13 @@ const toast = useToast()
const timeInfo = ref({ const timeInfo = ref({
user: "", profile: "",
start: "", start: "",
end: null, end: null,
notes: null, notes: null,
}) })
const filterUser = ref(user.value.id || "") const filterUser = ref(dataStore.getOwnProfile.id || "")
const filteredRows = computed(() => { const filteredRows = computed(() => {
@@ -37,7 +37,7 @@ const filteredRows = computed(() => {
times = times.filter(i => i.profile === filterUser.value) times = times.filter(i => i.profile === filterUser.value)
} }
} else if(dataStore.hasRight('viewOwnTimes')) { } else if(dataStore.hasRight('viewOwnTimes')) {
times = times.filter(i => i.profile === user.value.id) times = times.filter(i => i.profile === dataStore.getOwnProfile.id)
} else { } else {
times = [] times = []
} }
@@ -49,7 +49,7 @@ const filteredRows = computed(() => {
const itemInfo = ref({ const itemInfo = ref({
user: "", profile: "",
start: new Date(), start: new Date(),
end: "", end: "",
notes: null, notes: null,
@@ -104,7 +104,7 @@ const configTimeMode = ref("create")
const startTime = async () => { const startTime = async () => {
console.log("started") console.log("started")
timeInfo.value = { timeInfo.value = {
user: user.value.id, profile: dataStore.getOwnProfile.id,
start: dayjs().format("HH:mm:ssZ"), start: dayjs().format("HH:mm:ssZ"),
date: dayjs().format("YYYY-MM-DD"), date: dayjs().format("YYYY-MM-DD"),
tenant: dataStore.currentTenant, tenant: dataStore.currentTenant,
@@ -121,7 +121,7 @@ const startTime = async () => {
} else if(data) { } else if(data) {
//timeInfo.value = data[0] //timeInfo.value = data[0]
await dataStore.fetchWorkingTimes() await dataStore.fetchWorkingTimes()
runningTimeInfo.value = dataStore.times.find(time => time.profile === user.value.id && !time.end) runningTimeInfo.value = dataStore.times.find(time => time.profile === dataStore.getOwnProfile.id && !time.end)
} }
} }
@@ -153,8 +153,8 @@ const stopStartedTime = async () => {
} }
} }
if(dataStore.workingtimes.find(time => time.profile == user.value.id && !time.end)) { if(dataStore.workingtimes.find(time => time.profile == dataStore.getOwnProfile.id && !time.end)) {
runningTimeInfo.value = dataStore.workingtimes.find(time => time.profile == user.value.id && !time.end) runningTimeInfo.value = dataStore.workingtimes.find(time => time.profile == dataStore.getOwnProfile.id && !time.end)
} }
@@ -227,7 +227,7 @@ const setState = async (newState) => {
Start Start
</UButton> </UButton>
<UButton <UButton
@click="configTimeMode = 'create'; itemInfo = {start: new Date(), end: new Date(), user: user.id, state: 'Entwurf'}; showConfigTimeModal = true" @click="configTimeMode = 'create'; itemInfo = {start: new Date(), end: new Date(), profile: dataStore.getOwnProfile.id, state: 'Entwurf'}; showConfigTimeModal = true"
> >
Erstellen Erstellen
</UButton> </UButton>
@@ -271,10 +271,16 @@ const setState = async (newState) => {
<UModal <UModal
v-model="showConfigTimeModal" v-model="showConfigTimeModal"
fullscreen
> >
<UCard> <UCard>
<template #header> <template #header>
<div class="flex items-center justify-between">
<h3 class="text-base font-semibold leading-6 text-gray-900 dark:text-white">
Zeiteintrag {{configTimeMode === 'create' ? "erstellen" : "bearbeiten"}} Zeiteintrag {{configTimeMode === 'create' ? "erstellen" : "bearbeiten"}}
</h3>
<UButton color="gray" variant="ghost" icon="i-heroicons-x-mark-20-solid" class="-my-1" @click="showConfigTimeModal = false" />
</div>
</template> </template>
<UFormGroup <UFormGroup
label="Start:" label="Start:"