From 96cd94d77fbb29c58c996fa7a380e3df98ac2322 Mon Sep 17 00:00:00 2001 From: florianfederspiel Date: Sat, 7 Jun 2025 16:33:57 +0200 Subject: [PATCH] Cahnges in Projektzeiten and Naming --- components/MainNav.vue | 2 +- components/displayRunningTime.vue | 10 +++---- pages/index.vue | 4 ++- pages/times/index.vue | 49 +++++++++++++++++++------------ 4 files changed, 40 insertions(+), 25 deletions(-) diff --git a/components/MainNav.vue b/components/MainNav.vue index 75586b3..a2307b8 100644 --- a/components/MainNav.vue +++ b/components/MainNav.vue @@ -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" }] : [], diff --git a/components/displayRunningTime.vue b/components/displayRunningTime.vue index 643f675..e8a431a 100644 --- a/components/displayRunningTime.vue +++ b/components/displayRunningTime.vue @@ -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 () => {
-

Keine Zeit gestartet

+

Keine Projektzeit gestartet

diff --git a/pages/times/index.vue b/pages/times/index.vue index 5fa4b85..02f9717 100644 --- a/pages/times/index.vue +++ b/pages/times/index.vue @@ -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) => {