mirror of
https://github.com/solidtime-io/solidtime.git
synced 2026-08-14 03:02:15 +01:00
add is_billable support for create / update project and in timetracker, fixes ST-217
This commit is contained in:
committed by
Constantin Graf
parent
d9244d1ab4
commit
7fb58ea341
@@ -18,6 +18,7 @@ import { getCurrentOrganizationId } from '@/utils/useUser';
|
||||
import { switchOrganization } from '@/utils/useOrganization';
|
||||
import SecondaryButton from '@/Components/SecondaryButton.vue';
|
||||
import TimeTrackerRangeSelector from '@/Components/Common/TimeTracker/TimeTrackerRangeSelector.vue';
|
||||
import { useProjectsStore } from '@/utils/useProjects';
|
||||
|
||||
const page = usePage<{
|
||||
auth: {
|
||||
@@ -48,6 +49,22 @@ onMounted(async () => {
|
||||
}
|
||||
});
|
||||
|
||||
function setBillableDefaultForProject() {
|
||||
const projectssStore = useProjectsStore();
|
||||
const { projects } = storeToRefs(projectssStore);
|
||||
const project = projects.value.find(
|
||||
(project) => project.id === currentTimeEntry.value.project_id
|
||||
);
|
||||
if (project) {
|
||||
currentTimeEntry.value.billable = project.is_billable;
|
||||
}
|
||||
}
|
||||
|
||||
function updateProject() {
|
||||
setBillableDefaultForProject();
|
||||
updateTimeEntry();
|
||||
}
|
||||
|
||||
function updateTimeEntry() {
|
||||
if (currentTimeEntry.value.id) {
|
||||
useCurrentTimeEntryStore().updateTimer();
|
||||
@@ -108,7 +125,7 @@ function switchToTimeEntryOrganization() {
|
||||
<div class="flex items-center justify-between pl-2">
|
||||
<div class="flex items-center w-[130px] sm:w-auto">
|
||||
<TimeTrackerProjectTaskDropdown
|
||||
@changed="updateTimeEntry"
|
||||
@changed="updateProject"
|
||||
v-model:project="currentTimeEntry.project_id"
|
||||
v-model:task="
|
||||
currentTimeEntry.task_id
|
||||
|
||||
Reference in New Issue
Block a user