From 492be92592aa39f44e2cd253554a733ae75c26b1 Mon Sep 17 00:00:00 2001 From: Gregor Vostrak Date: Mon, 29 Apr 2024 14:15:24 +0200 Subject: [PATCH] lock sidebar timer when running in a different organization --- .../js/Components/CurrentSidebarTimer.vue | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/resources/js/Components/CurrentSidebarTimer.vue b/resources/js/Components/CurrentSidebarTimer.vue index b6a52c49..db2a3e3c 100644 --- a/resources/js/Components/CurrentSidebarTimer.vue +++ b/resources/js/Components/CurrentSidebarTimer.vue @@ -5,6 +5,9 @@ import { computed } from 'vue'; import dayjs from 'dayjs'; import { formatHumanReadableDuration } from '@/utils/time'; import TimeTrackerStartStop from '@/Components/Common/TimeTrackerStartStop.vue'; +import { getCurrentOrganizationId } from "@/utils/useUser"; +import { switchOrganization } from "@/utils/useOrganization"; +import SecondaryButton from "@/Components/SecondaryButton.vue"; const store = useCurrentTimeEntryStore(); const { currentTimeEntry, now, isActive } = storeToRefs(store); const { onToggleButtonPress } = store; @@ -18,10 +21,29 @@ const currentTime = computed(() => { } return formatHumanReadableDuration(0); }); + +const isRunningInDifferentOrganization = computed(() => { + return ( + currentTimeEntry.value.organization_id && + getCurrentOrganizationId() && + currentTimeEntry.value.organization_id !== getCurrentOrganizationId() + ); +});