Cahnges in Projektzeiten and Naming

This commit is contained in:
2025-06-07 16:33:57 +02:00
parent bab0187467
commit 96cd94d77f
4 changed files with 40 additions and 25 deletions

View File

@@ -39,15 +39,17 @@
<display-projects-in-phases/>
</UDashboardCard>
<UDashboardCard
title="Anwesenheiten"
title="Anwesende"
>
<display-present-profiles/>
</UDashboardCard>
<UDashboardCard
title="Projektzeiten"
>
<display-running-time/>
</UDashboardCard>
<UDashboardCard
title="Anwesenheiten"
>
<display-running-working-time/>
</UDashboardCard>

View File

@@ -35,8 +35,11 @@ const configTimeMode = ref("create")
const platform = ref("default")
const projects = ref([])
const setup = async () => {
times.value = await useSupabaseSelect("times","*, profile(*), project(id, name)")
projects.value = await useSupabaseSelect("projects","*")
if(await useCapacitor().getIsPhone()) {
platform.value = "mobile"
@@ -179,10 +182,27 @@ const createTime = async () => {
}
}
const openTime = (row) => {
itemInfo.value = row
itemInfo.value.project = itemInfo.value.project.id
itemInfo.value.profile = itemInfo.value.profile.id
showConfigTimeModal.value = true
configTimeMode.value = "edit"
}
const updateTime = async () => {
let data = itemInfo.value
data.profile = data.profile.id
data.project = data.project.id
const {error} = await supabase
.from("times")
.update(itemInfo.value)
.update(data)
.eq('id',itemInfo.value.id)
if(error) {
@@ -191,7 +211,7 @@ const updateTime = async () => {
toast.add({title: "Zeit erfolgreich gespeichert"})
showConfigTimeModal.value = false
await dataStore.fetchTimes()
setup()
}
const format = (date) => {
@@ -230,7 +250,7 @@ const getSecondInfo = (item) => {
</script>
<template>
<UDashboardNavbar title="Zeiterfassung">
<UDashboardNavbar title="Projektzeiten">
<template #toggle>
<div v-if="platform === 'mobile'"></div>
</template>
@@ -317,7 +337,7 @@ const getSecondInfo = (item) => {
>
<UCard>
<template #header>
Zeiteintrag {{configTimeMode === 'create' ? "erstellen" : "bearbeiten"}}
Projektzeit {{configTimeMode === 'create' ? "erstellen" : "bearbeiten"}}
</template>
<UFormGroup
label="Start:"
@@ -325,7 +345,7 @@ const getSecondInfo = (item) => {
<UPopover :popper="{ placement: 'bottom-start' }">
<UButton
icon="i-heroicons-calendar-days-20-solid"
:label="itemInfo.startDate ? dayjs(itemInfo.startDate).format('DD.MM.YYYY') : 'Datum auswählen'"
:label="itemInfo.startDate ? dayjs(itemInfo.startDate).format('DD.MM.YYYY HH:mm') : 'Datum auswählen'"
variant="outline"
/>
@@ -340,7 +360,7 @@ const getSecondInfo = (item) => {
<UPopover :popper="{ placement: 'bottom-start' }">
<UButton
icon="i-heroicons-calendar-days-20-solid"
:label="itemInfo.endDate ? dayjs(itemInfo.endDate).format('DD.MM.YYYY') : 'Datum auswählen'"
:label="itemInfo.endDate ? dayjs(itemInfo.endDate).format('DD.MM.YYYY HH:mm') : 'Datum auswählen'"
variant="outline"
/>
@@ -354,13 +374,12 @@ const getSecondInfo = (item) => {
>
<USelectMenu
:options="profileStore.profiles"
v-model="itemInfo.user"
v-model="itemInfo.profile"
option-attribute="fullName"
value-attribute="id"
:disabled="(configTimeMode === 'create' ? false : itemInfo.state !== 'Entwurf') || (!dataStore.hasRight('createTime') || !useRole().hasRight('createOwnTime'))"
>
<template #label>
{{profileStore.profiles.find(profile => profile.id === itemInfo.user) ? profileStore.profiles.find(profile => profile.id === itemInfo.user).fullName : "Benutzer auswählen"}}
{{profileStore.profiles.find(profile => profile.id === itemInfo.profile) ? profileStore.profiles.find(profile => profile.id === itemInfo.profile).fullName : "Benutzer auswählen"}}
</template>
</USelectMenu>
</UFormGroup>
@@ -368,14 +387,13 @@ const getSecondInfo = (item) => {
label="Projekt:"
>
<USelectMenu
:options="dataStore.projects"
:options="projects"
v-model="itemInfo.project"
option-attribute="name"
value-attribute="id"
searchable
searchable-placeholder="Suche..."
:search-attributes="['name']"
:disabled="configTimeMode === 'create' ? false : itemInfo.state !== 'Entwurf'"
>
<template #label>
{{dataStore.projects.find(project => project.id === itemInfo.project) ? dataStore.projects.find(project => project.id === itemInfo.project).name : "Projekt auswählen"}}
@@ -390,7 +408,6 @@ const getSecondInfo = (item) => {
:options="timeTypes"
option-attribute="label"
value-attribute="label"
:disabled="configTimeMode === 'create' ? false : itemInfo.state !== 'Entwurf'"
>
<template #label>
{{itemInfo.type ? itemInfo.type : "Kategorie auswählen"}}
@@ -402,12 +419,11 @@ const getSecondInfo = (item) => {
>
<UTextarea
v-model="itemInfo.notes"
:disabled="configTimeMode === 'create' ? false : itemInfo.state !== 'Entwurf'"
/>
</UFormGroup>
<template #footer v-if="configTimeMode === 'create' || itemInfo.state === 'Entwurf'">
<template #footer>
<InputGroup>
<UButton
@click="createTime"
@@ -418,7 +434,6 @@ const getSecondInfo = (item) => {
<UButton
@click="updateTime"
v-else-if="configTimeMode === 'edit'"
v-if="itemInfo.state === 'Entwurf'"
>
Speichern
</UButton>
@@ -456,9 +471,7 @@ const getSecondInfo = (item) => {
:columns="columns"
:rows="filteredRows"
:empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Noch keine Einträge' }"
@select="(row) => {configTimeMode = 'edit';
itemInfo = row;
showConfigTimeModal = true}"
@select="(row) => openTime(row)"
>
<template #state-data="{row}">
<span