From a4a9572c9680a8a60d47338ef266132cca9f8dd8 Mon Sep 17 00:00:00 2001 From: Jon Date: Fri, 12 Jul 2024 09:16:32 +0200 Subject: [PATCH] feat: refs #7323 fixed tests, changed calendar styles and fix workerCreate --- src/components/common/VnInputTime.vue | 13 +- src/components/ui/QCalendarMonthWrapper.vue | 23 +- src/pages/Worker/Card/WorkerTimeControl.vue | 1 + .../Worker/Card/WorkerTimeControlCalendar.vue | 20 +- src/pages/Worker/Card/WorkerTimeForm.vue | 3 +- src/pages/Worker/WorkerList.vue | 196 +++++++++++++++++- src/router/modules/worker.js | 38 ++-- .../integration/worker/workerCreate.spec.js | 17 +- .../integration/worker/workerList.spec.js | 18 +- 9 files changed, 274 insertions(+), 55 deletions(-) diff --git a/src/components/common/VnInputTime.vue b/src/components/common/VnInputTime.vue index 9344ff869..e10838672 100644 --- a/src/components/common/VnInputTime.vue +++ b/src/components/common/VnInputTime.vue @@ -2,6 +2,7 @@ import { watch, computed, ref } from 'vue'; import { useI18n } from 'vue-i18n'; import { date } from 'quasar'; +import { nextTick } from 'vue'; const model = defineModel({ type: String }); const props = defineProps({ @@ -43,7 +44,7 @@ const formattedTime = computed({ if (time?.length > 5) time = dateToTime(time); if (!props.timeOnly) { const hours = time.split(':'); - const date = new Date(); + const date = Date.vnNew(); date.setHours(hours[0], hours[1], 0); time = date.toISOString(); } @@ -55,17 +56,24 @@ const formattedTime = computed({ function dateToTime(newDate) { return date.formatDate(new Date(newDate), dateFormat); } - +const timeField = ref(); watch( () => model.value, (val) => (formattedTime.value = val), { immediate: true } ); +const focusField = () => { + nextTick(() => { + const input = timeField.value.$el.querySelector('input'); + input.setSelectionRange(0, 0); + }); +};