automatically set the project billable default in time entry create modal

This commit is contained in:
Gregor Vostrak
2024-12-08 01:25:51 +01:00
committed by Constantin Graf
parent 9b0cf37bc7
commit 4281736a6d

View File

@@ -70,6 +70,19 @@ const timeEntryDefaultValues = {
const timeEntry = ref({ ...timeEntryDefaultValues });
watch(
() => timeEntry.value.project_id,
(value) => {
if (value) {
// check if project is billable by default and set billable accordingly
const project = props.projects.find((p) => p.id === value);
if (project) {
timeEntry.value.billable = project.is_billable;
}
}
}
);
const localStart = ref(
getLocalizedDayJs(timeEntryDefaultValues.start).format()
);