diff --git a/package.json b/package.json index 39d49519b..cdd61435b 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,7 @@ "axios": "^1.4.0", "chromium": "^3.0.3", "croppie": "^2.6.5", + "moment": "^2.30.1", "pinia": "^2.1.3", "quasar": "^2.14.5", "validator": "^13.9.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 83dfa0469..7bf640347 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -20,6 +20,9 @@ dependencies: croppie: specifier: ^2.6.5 version: 2.6.5 + moment: + specifier: ^2.30.1 + version: 2.30.1 pinia: specifier: ^2.1.3 version: 2.1.7(typescript@5.5.4)(vue@3.4.19) @@ -832,8 +835,8 @@ packages: vue-i18n: optional: true dependencies: - '@intlify/message-compiler': 10.0.0 - '@intlify/shared': 10.0.0 + '@intlify/message-compiler': 11.0.0-rc.1 + '@intlify/shared': 11.0.0-rc.1 jsonc-eslint-parser: 1.4.1 source-map: 0.6.1 vue-i18n: 9.9.1(vue@3.4.19) @@ -847,11 +850,11 @@ packages: '@intlify/message-compiler': 9.9.1 '@intlify/shared': 9.9.1 - /@intlify/message-compiler@10.0.0: - resolution: {integrity: sha512-OcaWc63NC/9p1cMdgoNKBj4d61BH8sUW1Hfs6YijTd9656ZR4rNqXAlRnBrfS5ABq0vjQjpa8VnyvH9hK49yBw==} + /@intlify/message-compiler@11.0.0-rc.1: + resolution: {integrity: sha512-TGw2uBfuTFTegZf/BHtUQBEKxl7Q/dVGLoqRIdw8lFsp9g/53sYn5iD+0HxIzdYjbWL6BTJMXCPUHp9PxDTRPw==} engines: {node: '>= 16'} dependencies: - '@intlify/shared': 10.0.0 + '@intlify/shared': 11.0.0-rc.1 source-map-js: 1.0.2 dev: true @@ -862,8 +865,8 @@ packages: '@intlify/shared': 9.9.1 source-map-js: 1.0.2 - /@intlify/shared@10.0.0: - resolution: {integrity: sha512-6ngLfI7DOTew2dcF9WMJx+NnMWghMBhIiHbGg+wRvngpzD5KZJZiJVuzMsUQE1a5YebEmtpTEfUrDp/NqVGdiw==} + /@intlify/shared@11.0.0-rc.1: + resolution: {integrity: sha512-8tR1xe7ZEbkabTuE/tNhzpolygUn9OaYp9yuYAF4MgDNZg06C3Qny80bes2/e9/Wm3aVkPUlCw6WgU7mQd0yEg==} engines: {node: '>= 16'} dev: true @@ -887,7 +890,7 @@ packages: optional: true dependencies: '@intlify/bundle-utils': 4.0.0(vue-i18n@9.9.1) - '@intlify/shared': 10.0.0 + '@intlify/shared': 11.0.0-rc.1 '@rollup/pluginutils': 4.2.1 '@vue/compiler-sfc': 3.4.19 debug: 4.3.4(supports-color@8.1.1) @@ -4960,6 +4963,10 @@ packages: uuid: 8.3.2 dev: true + /moment@2.30.1: + resolution: {integrity: sha512-uEmtNhbDOrWPFS+hdjFCBfy9f2YoyzRpwcl+DqpC6taX21FzsTLQVbMV/W7PzNSX6x/bhC1zA3c2UQ5NzH6how==} + dev: false + /ms@2.0.0: resolution: {integrity: sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==} diff --git a/src/pages/Worker/Card/WorkerTimeControl.vue b/src/pages/Worker/Card/WorkerTimeControl.vue index 8d54cb810..0870c78b7 100644 --- a/src/pages/Worker/Card/WorkerTimeControl.vue +++ b/src/pages/Worker/Card/WorkerTimeControl.vue @@ -22,6 +22,7 @@ import { useVnConfirm } from 'composables/useVnConfirm'; import { useArrayData } from 'composables/useArrayData'; import { toTimeFormat, secondsToHoursMinutes } from 'filters/date.js'; import toDateString from 'filters/toDateString.js'; +import moment from 'moment'; import { date } from 'quasar'; const route = useRoute(); @@ -64,6 +65,7 @@ const selectedDateFormatted = ref(toDateString(defaultDate.value)); const arrayData = useArrayData('workerData'); const acl = useAcl(); +const selectedDateYear = computed(() => moment(selectedDate.value).isoWeekYear()); const worker = computed(() => arrayData.store?.data); const canSend = computed(() => acl.hasAny([{ model: 'WorkerTimeControl', props: 'sendMail', accessType: 'WRITE' }]) @@ -278,7 +280,7 @@ const fetchHours = async () => { const fetchWeekData = async () => { const where = { - year: selectedDate.value.getFullYear(), + year: selectedDateYear.value, week: selectedWeekNumber.value, }; const mail = ( @@ -343,7 +345,7 @@ const getMailStates = async (date) => { const prevMonth = month == 1 ? 12 : month - 1; const params = { month, - year: date.getFullYear(), + year: selectedDateYear.value, }; const curMonthStates = (await axios.get(url, { params })).data; @@ -370,7 +372,7 @@ const showReasonForm = () => { const updateWorkerTimeControlMail = async (state, reason) => { const params = { - year: selectedDate.value.getFullYear(), + year: selectedDateYear.value, week: selectedWeekNumber.value, state, }; @@ -400,7 +402,7 @@ const resendEmail = async () => { const params = { recipient: worker.value[0]?.user?.emailUser?.email, week: selectedWeekNumber.value, - year: selectedDate.value.getFullYear(), + year: selectedDateYear.value, workerId: Number(route.params.id), state: 'SENDED', };