Skip to content

Commit

Permalink
automatically set the project billable default in time entry create m…
Browse files Browse the repository at this point in the history
…odal
  • Loading branch information
Onatcer committed Dec 8, 2024
1 parent 1e3b6c0 commit 4406939
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions resources/js/packages/ui/src/TimeEntry/TimeEntryCreateModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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()
);
Expand Down

0 comments on commit 4406939

Please sign in to comment.