diff --git a/resources/js/Components/Common/TimeTracker/TimeTrackerControls.vue b/resources/js/Components/Common/TimeTracker/TimeTrackerControls.vue index 65f944bd..bf17c9d8 100644 --- a/resources/js/Components/Common/TimeTracker/TimeTrackerControls.vue +++ b/resources/js/Components/Common/TimeTracker/TimeTrackerControls.vue @@ -13,7 +13,7 @@ import type { TimeEntry, Client, } from '@/utils/api'; -import { ref } from 'vue'; +import { ref, watch } from 'vue'; import type { Dayjs } from 'dayjs'; const currentTimeEntry = defineModel('currentTimeEntry', { @@ -70,6 +70,19 @@ function onToggleButtonPress(newState: boolean) { emit('stopTimer'); } } +const tempDescription = ref(currentTimeEntry.value.description); +watch( + () => currentTimeEntry.value.description, + () => { + tempDescription.value = currentTimeEntry.value.description; + } +); +function updateTimeEntryDescription() { + if (currentTimeEntry.value.description !== tempDescription.value) { + currentTimeEntry.value.description = tempDescription.value; + emit('updateTimeEntry'); + } +}