Skip to content

Commit 4281736

Browse files
Onatcerkorridor
authored andcommitted
automatically set the project billable default in time entry create modal
1 parent 9b0cf37 commit 4281736

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

resources/js/packages/ui/src/TimeEntry/TimeEntryCreateModal.vue

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,19 @@ const timeEntryDefaultValues = {
7070
7171
const timeEntry = ref({ ...timeEntryDefaultValues });
7272
73+
watch(
74+
() => timeEntry.value.project_id,
75+
(value) => {
76+
if (value) {
77+
// check if project is billable by default and set billable accordingly
78+
const project = props.projects.find((p) => p.id === value);
79+
if (project) {
80+
timeEntry.value.billable = project.is_billable;
81+
}
82+
}
83+
}
84+
);
85+
7386
const localStart = ref(
7487
getLocalizedDayJs(timeEntryDefaultValues.start).format()
7588
);

0 commit comments

Comments
 (0)