This commit is contained in:
2024-10-18 08:58:11 +02:00
parent 8dbf43b672
commit a905b1f966
9 changed files with 165 additions and 70 deletions

View File

@@ -24,10 +24,22 @@ const timeInfo = ref({
const filterUser = ref(dataStore.activeProfile.id || "")
const workingtimes = ref([])
const setupPage = async () => {
workingtimes.value = (await supabase.from("workingtimes").select().eq("profile",filterUser.value).order("startDate",{ascending: false})).data
}
setupPage()
const filteredRows = computed(() => {
let times = dataStore.workingtimes
let times = workingtimes.value
times = times.filter(i => i.profile === filterUser.value)
@@ -61,6 +73,11 @@ const columns = [
label: "Status",
sortable:true
},
{
key: "approved",
label: "Genehmigt",
sortable:true
},
{
key: "profile",
label: "Mitarbeiter",
@@ -181,6 +198,7 @@ const getDuration = (time) => {
option-attribute="fullName"
value-attribute="id"
v-model="filterUser"
@change="setupPage"
>
<template #label>
{{dataStore.getProfileById(filterUser) ? dataStore.getProfileById(filterUser).fullName : "Kein Benutzer ausgewählt"}}
@@ -222,41 +240,29 @@ const getDuration = (time) => {
</UAlert>
</div>
<UTable
class="mt-3"
:columns="columns"
:rows="filteredRows"
:empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Noch keine Einträge' }"
@select="(row) => {
router.push(`/workingtimes/edit/${row.id}`)
/*configTimeMode = '[mode]';
itemInfo = row;
showConfigTimeModal = true*/}"
router.push(`/workingtimes/edit/${row.id}`)}"
>
<!-- <template #state-data="{row}">
<span
v-if="row.state === 'Entwurf'"
class="text-rose-500"
>{{row.state}}</span>
<span
v-if="row.state === 'Eingereicht'"
class="text-cyan-500"
>{{row.state}}</span>
<span
v-if="row.state === 'Bestätigt'"
class="text-primary-500"
>{{row.state}}</span>
</template>-->
<template #expand="{ row }">
<div class="p-4">
<pre>{{ row }}</pre>
</div>
</template>
<template #profile-data="{row}">
{{dataStore.profiles.find(profile => profile.id === row.profile) ? dataStore.profiles.find(profile => profile.id === row.profile).fullName : row.profile }}
</template>
<template #approved-data="{row}">
<span v-if="row.approved" class="text-primary-500">Ja</span>
<span v-else class="text-rose-600">Nein</span>
</template>
<template #date-data="{row}">
{{dayjs(row.startDate).format("DD.MM.YYYY")}}
</template>
<template #startDate-data="{row}">
{{dayjs(row.startDate).format("HH:mm")}} Uhr
</template>