From 026588c03d629439c24fbe80ecb813ce68a9e21b Mon Sep 17 00:00:00 2001 From: wbuezas Date: Tue, 2 Apr 2024 09:30:59 -0300 Subject: [PATCH] WorkerTimeForm set initial data --- src/pages/Worker/Card/WorkerTimeControl.vue | 11 ++++++++--- src/pages/Worker/Card/WorkerTimeForm.vue | 6 +++++- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/pages/Worker/Card/WorkerTimeControl.vue b/src/pages/Worker/Card/WorkerTimeControl.vue index 5b48dda42..4e8b5f10d 100644 --- a/src/pages/Worker/Card/WorkerTimeControl.vue +++ b/src/pages/Worker/Card/WorkerTimeControl.vue @@ -49,7 +49,8 @@ const weekTotalHours = ref(null); const workerTimeControlMails = ref([]); const workerTimeFormProps = reactive({ dated: null, - formType: null, + entryId: null, + entryCode: null, }); // Array utilizado por QCalendar para seleccionar un rango de fechas @@ -357,7 +358,8 @@ const getMailStates = async (date) => { const showWorkerTimeForm = (propValue, formType) => { const isEditForm = formType === 'edit'; - workerTimeFormProps.entryId = isEditForm ? propValue : null; + workerTimeFormProps.entryId = isEditForm ? propValue.id : null; + workerTimeFormProps.entryCode = isEditForm ? propValue.entryCode : null; workerTimeFormProps.dated = isEditForm ? null : propValue; workerTimeFormDialogRef.value.show(); @@ -556,7 +558,10 @@ onMounted(async () => { :id="hour.id" @on-hour-entry-deleted="updateData()" @show-worker-time-form=" - showWorkerTimeForm(hour.id, 'edit') + showWorkerTimeForm( + { id: hour.id, entryCode: hour.direction }, + 'edit' + ) " class="hour-chip" /> diff --git a/src/pages/Worker/Card/WorkerTimeForm.vue b/src/pages/Worker/Card/WorkerTimeForm.vue index 530406a5a..d6c893ad1 100644 --- a/src/pages/Worker/Card/WorkerTimeForm.vue +++ b/src/pages/Worker/Card/WorkerTimeForm.vue @@ -12,6 +12,10 @@ const $props = defineProps({ type: Number, default: null, }, + entryCode: { + type: String, + default: null, + }, dated: { type: Date, default: true, @@ -54,7 +58,7 @@ const urlCreate = computed(() => onBeforeMount(() => { workerHourEntry = isEditMode.value - ? {} + ? { direction: $props.entryCode } : { timed: new Date($props.dated), workerFk: route.params.id,