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

@@ -125,7 +125,7 @@ const links = computed(() => {
icon: "i-heroicons-user-group",
children: [
... profileStore.ownTenant.features.timeTracking ? [{
label: "Zeiterfassung",
label: "Projektzeiten",
to: "/times",
icon: "i-heroicons-clock"
}] : [],

View File

@@ -43,9 +43,9 @@ const startTime = async () => {
.select()
if(error) {
console.log(error)
toast.add({title: "Fehler beim starten der Zeit",color:"rose"})
toast.add({title: "Fehler beim starten der Projektzeit",color:"rose"})
} else if(data) {
toast.add({title: "Zeit erfolgreich gestartet"})
toast.add({title: "Projektzeit erfolgreich gestartet"})
runningTimeInfo.value = data[0]
//console.log(runningTimeInfo.value)
}
@@ -63,11 +63,11 @@ const stopStartedTime = async () => {
if(error) {
console.log(error)
let errorId = await useError().logError(`${status} - ${JSON.stringify(error)}`)
toast.add({title: errorId ? `Fehler beim stoppen der Zeit (Fehler ID: ${errorId})` : `Fehler beim stoppen der Zeit`,color:"rose"})
toast.add({title: errorId ? `Fehler beim stoppen der Projektzeit (Fehler ID: ${errorId})` : `Fehler beim stoppen der Projektzeit`,color:"rose"})
} else {
toast.add({title: "Zeit erfolgreich gestoppt"})
toast.add({title: "Projektzeit erfolgreich gestoppt"})
runningTimeInfo.value = {}
}
}
@@ -111,7 +111,7 @@ const stopStartedTime = async () => {
</UButton>
</div>
<div v-else>
<p>Keine Zeit gestartet</p>
<p>Keine Projektzeit gestartet</p>
<UButton
class="mt-3"
@click="startTime"

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