From 03231ab3f3818684ec35e4d883e3350486d7e8a4 Mon Sep 17 00:00:00 2001 From: florianfederspiel Date: Sun, 1 Jun 2025 18:23:01 +0200 Subject: [PATCH] added displayRunningTime.vue --- components/displayRunningTime.vue | 39 ++++++++++++++++++++++++------- pages/index.vue | 4 ++++ pages/mobile/index.vue | 5 ++++ 3 files changed, 40 insertions(+), 8 deletions(-) diff --git a/components/displayRunningTime.vue b/components/displayRunningTime.vue index 291d3d4..643f675 100644 --- a/components/displayRunningTime.vue +++ b/components/displayRunningTime.vue @@ -7,9 +7,18 @@ const toast = useToast() const runningTimeInfo = ref({}) +const projects = ref([]) +const platform = ref("default") + const setupPage = async () => { - runningTimeInfo.value = (await supabase.from("workingtimes").select().eq("profile", profileStore.activeProfile.id).is("endDate", null).single()).data || {} - console.log(runningTimeInfo.value) + runningTimeInfo.value = (await supabase.from("times").select().eq("profile", profileStore.activeProfile.id).is("endDate", null).single()).data || {} + + projects.value = (await useSupabaseSelect("projects")) + + if(await useCapacitor().getIsPhone()) { + platform.value = "mobile" + } + } setupPage() @@ -24,12 +33,12 @@ const startTime = async () => { profile: profileStore.activeProfile.id, startDate: dayjs(), tenant: profileStore.currentTenant, - state: "Im Web gestartet", + state: platform.value === "mobile" ? "In der App gestartet" : "Im Web gestartet", source: "Dashboard" } const {data,error} = await supabase - .from("workingtimes") + .from("times") .insert([runningTimeInfo.value]) .select() if(error) { @@ -38,16 +47,16 @@ const startTime = async () => { } else if(data) { toast.add({title: "Zeit erfolgreich gestartet"}) runningTimeInfo.value = data[0] - console.log(runningTimeInfo.value) + //console.log(runningTimeInfo.value) } } const stopStartedTime = async () => { runningTimeInfo.value.endDate = dayjs() - runningTimeInfo.value.state = "Im Web gestoppt" + runningTimeInfo.value.state = platform.value === "mobile" ? "In der App gestoppt" : "Im Web gestoppt" const {error,status} = await supabase - .from("workingtimes") + .from("times") .update(runningTimeInfo.value) .eq('id',runningTimeInfo.value.id) @@ -79,6 +88,20 @@ const stopStartedTime = async () => { v-model="runningTimeInfo.notes" /> + + + {
-

Keine Anwesenheit gestartet

+

Keine Zeit gestartet

+ + + diff --git a/pages/mobile/index.vue b/pages/mobile/index.vue index 38a2686..f10a1d8 100644 --- a/pages/mobile/index.vue +++ b/pages/mobile/index.vue @@ -23,6 +23,11 @@ const profileStore = useProfileStore() + + +