lock sidebar timer when running in a different organization

This commit is contained in:
Gregor Vostrak
2024-04-29 14:15:24 +02:00
parent 056c909e82
commit 492be92592

View File

@@ -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()
);
});
</script>
<template>
<div class="py-4 px-2 flex justify-between items-center">
<div class="py-4 px-2 flex justify-between items-center relative">
<div
class="absolute w-full h-full backdrop-blur-sm z-10 flex items-center justify-center"
v-if="isRunningInDifferentOrganization">
<div
class="w-full h-[calc(100%+10px)] absolute bg-default-background opacity-75 backdrop-blur-sm"></div>
<div class="flex space-x-3 items-center w-full z-20 justify-center">
<span class="text-xs text-center text-white">
The Timer is running in a different organization.
</span>
</div>
</div>
<div>
<div class="text-muted font-extrabold text-xs">Current Timer</div>
<div class="text-white font-medium text-lg py-1">