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({
user: "",
profile: "",
start: "",
end: null,
notes: null,
})
const filterUser = ref(user.value.id || "")
const filterUser = ref(dataStore.getOwnProfile.id || "")
const filteredRows = computed(() => {
@@ -37,7 +37,7 @@ const filteredRows = computed(() => {
times = times.filter(i => i.profile === filterUser.value)
}
} else if(dataStore.hasRight('viewOwnTimes')) {
times = times.filter(i => i.profile === user.value.id)
times = times.filter(i => i.profile === dataStore.getOwnProfile.id)
} else {
times = []
}
@@ -49,7 +49,7 @@ const filteredRows = computed(() => {
const itemInfo = ref({
user: "",
profile: "",
start: new Date(),
end: "",
notes: null,
@@ -104,7 +104,7 @@ const configTimeMode = ref("create")
const startTime = async () => {
console.log("started")
timeInfo.value = {
user: user.value.id,
profile: dataStore.getOwnProfile.id,
start: dayjs().format("HH:mm:ssZ"),
date: dayjs().format("YYYY-MM-DD"),
tenant: dataStore.currentTenant,
@@ -121,7 +121,7 @@ const startTime = async () => {
} else if(data) {
//timeInfo.value = data[0]
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)) {
runningTimeInfo.value = 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 == dataStore.getOwnProfile.id && !time.end)
}
@@ -227,7 +227,7 @@ const setState = async (newState) => {
Start
</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
</UButton>
@@ -271,10 +271,16 @@ const setState = async (newState) => {
<UModal
v-model="showConfigTimeModal"
fullscreen
>
<UCard>
<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"}}
</h3>
<UButton color="gray" variant="ghost" icon="i-heroicons-x-mark-20-solid" class="-my-1" @click="showConfigTimeModal = false" />
</div>
</template>
<UFormGroup
label="Start:"