diff --git a/src/pages/Worker/Card/WorkerTimeControl.vue b/src/pages/Worker/Card/WorkerTimeControl.vue index 74346638c..83d41c2af 100644 --- a/src/pages/Worker/Card/WorkerTimeControl.vue +++ b/src/pages/Worker/Card/WorkerTimeControl.vue @@ -34,6 +34,10 @@ const weekdayStore = useWeekdayStore(); const weekDays = ref([]); const { openConfirmationModal } = useVnConfirm(); const { getWeekOfYear } = date; +const defaultDate = computed(() => { + const timestamp = route.query.timestamp; + return timestamp ? new Date(timestamp * 1000) : Date.vnNew(); +}); const workerTimeFormDialogRef = ref(null); const workerTimeReasonFormDialogRef = ref(null); @@ -56,7 +60,7 @@ const workerTimeFormProps = reactive({ // Array utilizado por QCalendar para seleccionar un rango de fechas const selectedCalendarDates = ref([]); // Date formateada para bindear al componente QDate -const selectedDateFormatted = ref(toDateString(Date.vnNew())); +const selectedDateFormatted = ref(toDateString(defaultDate.value)); const arrayData = useArrayData('workerData'); @@ -423,7 +427,7 @@ onBeforeMount(() => { }); onMounted(async () => { - await setDate(Date.vnNew()); + await setDate(defaultDate.value); await getMailStates(selectedDate.value); stateStore.rightDrawer = true; });