mirror of
https://github.com/solidtime-io/solidtime.git
synced 2026-08-12 02:02:15 +01:00
Make sure that time entry billable status updates when project changes,
fixes #981
This commit is contained in:
@@ -74,6 +74,18 @@ watch(
|
||||
{ immediate: true }
|
||||
);
|
||||
|
||||
watch(
|
||||
() => editableTimeEntry.value?.project_id,
|
||||
(value, oldValue) => {
|
||||
if (oldValue !== undefined && value !== oldValue && editableTimeEntry.value) {
|
||||
const project = props.projects.find((p) => p.id === value);
|
||||
if (project) {
|
||||
editableTimeEntry.value.billable = project.is_billable;
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
const localStart = computed({
|
||||
get: () =>
|
||||
editableTimeEntry.value ? getLocalizedDayJs(editableTimeEntry.value.start).format() : '',
|
||||
|
||||
@@ -67,10 +67,12 @@ function updateStartEndTime(start: string, end: string | null) {
|
||||
}
|
||||
|
||||
function updateProjectAndTask(projectId: string, taskId: string) {
|
||||
const project = props.projects.find((p) => p.id === projectId);
|
||||
props.updateTimeEntry({
|
||||
...props.timeEntry,
|
||||
project_id: projectId,
|
||||
task_id: taskId,
|
||||
billable: project ? project.is_billable : props.timeEntry.billable,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user