mirror of
https://github.com/solidtime-io/solidtime.git
synced 2026-10-14 00:33:17 +01:00
add billable rate restriction for free organizations
This commit is contained in:
@@ -17,6 +17,7 @@ import type {
|
||||
} from '@/packages/api/src';
|
||||
import TagDropdown from '@/packages/ui/src/Tag/TagDropdown.vue';
|
||||
import BillableIcon from '@/packages/ui/src/Icons/BillableIcon.vue';
|
||||
import { useBillableRatesLock } from '@/packages/ui/src/utils/useBillableRatesLock';
|
||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '..';
|
||||
import { Button } from '@/packages/ui/src/Buttons';
|
||||
import DatePicker from '@/packages/ui/src/Input/DatePicker.vue';
|
||||
@@ -64,6 +65,7 @@ watch(show, (value) => {
|
||||
});
|
||||
|
||||
const editableTimeEntry = ref<TimeEntry | null>(null);
|
||||
const { locked: billableRatesLocked } = useBillableRatesLock();
|
||||
|
||||
watch(
|
||||
() => props.timeEntry,
|
||||
@@ -134,6 +136,11 @@ async function deleteEntry() {
|
||||
}
|
||||
}
|
||||
|
||||
// Organizations with locked billable rates can not make a non-billable time entry billable
|
||||
const billableOptionLocked = computed(
|
||||
() => billableRatesLocked.value && !props.timeEntry?.billable
|
||||
);
|
||||
|
||||
const billableProxy = computed({
|
||||
get: () =>
|
||||
editableTimeEntry.value ? (editableTimeEntry.value.billable ? 'true' : 'false') : 'false',
|
||||
@@ -245,7 +252,9 @@ const typeProxy = computed({
|
||||
</SelectValue>
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="true">Billable</SelectItem>
|
||||
<SelectItem value="true" :disabled="billableOptionLocked"
|
||||
>Billable</SelectItem
|
||||
>
|
||||
<SelectItem value="false">Non Billable</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
|
||||
Reference in New Issue
Block a user