diff --git a/CHANGELOG.md b/CHANGELOG.md index 03812d252..6908d764a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,251 @@ +# Version 24.52 - 2024-01-07 + +### Added 🆕 + +- chore: refs #8197 remove console log by:alexm +- chore: refs #8197 replace name by:alexm +- chore: refs #8197 unnecessary file by:alexm +- feat: #8110 apply mixin in quasar components by:Javier Segarra +- feat(Account & AccountRole): refs #8197 add VnCardMain by:alexm +- feat: addDptoLink by:Jtubau +- feat: added restore ticket function in ticket descriptor menu by:Jon +- feat: add support service wip by:jorgep +- feat: focus menu searchbar by:jorgep +- feat: make additional data object by:jorgep +- feat: message to grant access by:jorgep +- feat: refs #6583 add default param by:jorgep +- feat: refs #6583 add destination opt filter by:jorgep +- feat: refs #6583 add icon by:jorgep +- feat: refs #6583 add locale by:jorgep +- feat: refs #7072 added test to computed fn total by:Jtubau +- feat: refs #7235 update invoice out global form to fetch config based on serial type by:jgallego +- feat: refs #7301 add exclude inventory supplier from list by:pablone +- feat: refs #7301 enhance VnDateBadge styling and improve ItemLastEntries component by:pablone +- feat: refs #7882 Added distribution point by:guillermo +- feat: refs #7882 Added longitude & latitude by:guillermo +- feat: refs #7936 add autocomplete on tab fn by:jorgep +- feat: refs #7936 add company filter by:jorgep +- feat: refs #7936 add currency check before fetching by:jorgep +- feat: refs #7936 add dueDated field by:jorgep +- feat: refs #7936 add number validation to VnInputNumber & new daysAgo filter in InvoiceInFilter by:jorgep +- feat: refs #7936 add optionCaption by:jorgep +- feat: refs #7936 add row click navigation to InvoiceInSerial by:jorgep +- feat: refs #7936 add unit tests by:jorgep +- feat: refs #7936 add useAccountShortToStandard composable by:jorgep +- feat: refs #7936 calculate exchange & update taxable base by:jorgep +- feat: refs #7936 enhance downloadFile function to support opening in a new tab by:jorgep +- feat: refs #7936 enhance getTotal fn & add unit tests by:jorgep +- feat: refs #7936 enhance vn-select by:jorgep +- feat: refs #7936 improve optionLabel logic in InvoiceInVat component for better handling of numeric values by:jorgep +- feat: refs #7936 limit decimal places by:jorgep +- feat: refs #7936 make fields required by:jorgep +- feat: refs #7936 show country code & isVies fields by:jorgep +- feat: refs #7936 show id & value by:jorgep +- feat: refs #7936 simplify optionLabel wip by:jorgep +- feat: refs #7936 update 'isVies' label to use global translation key by:jorgep +- feat: refs #7936 update option labels in InvoiceIn components for better clarity by:jorgep +- feat: refs #7936 use default invoice data by:jorgep +- feat: refs #8001 change request by:robert +- feat: refs #8001 ticketExpeditionGrafana by:robert +- feat: refs #8194 created VnSelectWorker component and use it in Lilium by:Jon +- feat: refs #8197 better leftMenu and VnCardMain improvements by:alexm +- feat: refs #8197 default leftMenu by:alexm +- feat: refs #8197 default sectionName by:alexm +- feat: refs #8197 keepData in VnSection by:alexm +- feat: refs #8197 vnTableFilter by:alexm +- feat: refs #8197 working rightMenu by:alexm +- feat: remove re-fetch when add element by:Javier Segarra +- feat: remove search after category by:Javier Segarra +- feat: requested changes in item module by:Jon +- feat: update quantity by:Javier Segarra +- feat(VnPaginate): refs #8197 hold data when change to Card by:alexm + +### Changed 📦 + +- perf: #6896 REMOVE COMMENTS by:Javier Segarra +- perf: qFormMixin by:Javier Segarra +- perf: qFormMixin improvement by:Javier Segarra +- perf: refs #8194 select worker component by:Jon +- perf: refs #8197 perf by:alexm +- perf: remove comments by:Javier Segarra +- perf: remove unused variables (origin/warmfix_noUsedVars) by:Javier Segarra +- refactor: added again search emit by:Jon +- refactor: add useCau composable by:jorgep +- refactor: deleted log by:Jon +- refactor: deleted onUnmounted code by:Jon +- refactor: deleted useless hidden tag by:Jon +- refactor: deleted warnings and corrected itemTag by:Jon +- refactor: drop logic by:jorgep +- refactor: ignore params when searching by id on searchbar (origin/VnSearchbar-SearchRemoveParams) by:Jon +- refactor: log error by:Jon +- refactor: refs #7936 locale by:jorgep +- refactor: refs #7936 simplify getTotal fn by:jorgep +- refactor: refs #7936 update label capitalization and replace invoice type options by:jorgep +- refactor: refs #8194 deleted unnecessary label by:Jon +- refactor: refs #8194 modified select worker template by:Jon +- refactor: refs #8194 modified select worker to allow no one filter from monitor ticket by:Jon +- refactor: refs #8194 moved translation to the correct place by:Jon +- refactor: refs #8194 requested changes by:Jon +- refactor: refs #8194 structure changes in component and related files by:Jon +- refactor: refs #8197 adapt AccountAcls to VnCardMain by:alexm +- refactor: refs #8197 adapt AccountAlias by:alexm +- refactor: refs #8197 adapt Ticket to VnCardMain by:alexm +- refactor: refs #8197 backward compatible (8197-VnCardMain_backwardCompatibility) by:alexm +- refactor: refs #8197 rename VnSectionMain to VnModule and VnCardMain to VnSection by:alexm +- refactor: refs #8288 changed invoice out spanish translation by:provira +- refactor: use locale keys by:jorgep +- refactor: use teleport to avoid qdrawer overlapping by:Jon +- refactor: use VnSelectWorker by:Jon + +### Fixed 🛠️ + +- fix: account by:carlossa +- fix: account create by:carlossa +- fix: accountList create by:carlossa +- fix(AccountList): use $refs by:alexm +- fix: add data-key by:alexm +- fix: addLocales by:Jtubau +- fix: dated field by:Jon +- fix: e2e by:jorgep +- fix: fix department filter by:carlossa +- fix: fixed translations by:Javier Segarra +- fix: fixed translations by:provira +- fix: get total from api by:Javier Segarra +- fix: handle non-object options by:jorgep +- fix: monitorPayMethodFilter by:carlossa +- fix: orderBy priority by:Javier Segarra +- fix: prevent null by:jorgep +- fix: redirection vnTable VnTableFilter by:alexm +- fix: refs #6389 fix filter trad by:carlossa +- fix: refs #6389 fix front, filters, itp by:carlossa +- fix: refs #6389 front add packing filter by:carlossa +- fix: refs #6389 front by:carlossa +- fix: refs #6389 front filters by:carlossa +- fix: refs #6389 ipt by:carlossa +- fix: refs #6389 packing by:carlossa +- fix: refs #6583 update checkbox for filtering by destination in TicketAdvanceFilter by:jorgep +- fix: refs #7031 add test e2e by:carlossa +- fix: refs #7031 fix zoneTest by:carlossa +- fix: refs #7301 unnecessary console logs from ItemLastEntries.vue by:pablone +- fix: refs #7936 changes by:jorgep +- fix: refs #7936 decimal places & locale by:jorgep +- fix: refs #7936 descriptor & dueday by:jorgep +- fix: refs #7936 exclude disabled els on tab by:jorgep +- fix: refs #7936 format tax calculation to two decimal places by:jorgep +- fix: refs #7936 improve error handling by:jorgep +- fix: refs #7936 redirection by:jorgep +- fix: refs #7936 rollback by:jorgep +- fix: refs #7936 serial by:jorgep +- fix: refs #7936 tabulation wip by:jorgep +- fix: refs #7936 test by:jorgep +- fix: refs #8114 clean by:carlossa +- fix: refs #8114 fix agencyList by:carlossa +- fix: refs #8114 fix lifeCycle hooks by:carlossa +- fix: refs #8114 fix pr by:carlossa +- fix: refs #8114 fix removeAddress by:carlossa +- fix: refs #8114 orderList by:carlossa +- fix: refs #8114 remove logs by:carlossa +- fix: refs #8197 mapKey (origin/8197-perf_vnTableInside, 8197-perf_vnTableInside) by:alexm +- fix: refs #8197 redirection (8197-perf_redirection) by:alexm +- fix: refs #8197 staticParams and redirect by:alexm +- fix: refs #8197 vnPaginate onFetch emit by:alexm +- fix: refs #8197 vnPaginate when change :id by:alexm +- fix: refs #8197 vnTableFilter in vnTable by:alexm +- fix: refs #8315 ticketBoxing test by:alexm +- fix: remove url by:carlossa +- fix: rollback by:jorgep +- fix: test by:jorgep +- fix(VnDmsList): refs #8197 add mapKey by:alexm +- revert: refs #8197 arrayData changes by:alexm +- test: refs #8197 fix e2e by:alexm +- test: refs #8315 fix claimDevelopment fixtures by:alexm +- test: refs #8315 fix clientList by:alexm +- test: refs #8315 fix VnSelect in e2e by:alexm + +# Version 24.50 - 2024-12-10 + +### Added 🆕 + +- feat: add reportFileName option by:Javier Segarra +- feat: all clients just with global series by:jgallego +- feat: improve Merge branch 'test' into dev by:Javier Segarra +- feat: manual invoice in two lines by:jgallego +- feat: manualInvoice with address by:jgallego +- feat: randomize functions and example by:Javier Segarra +- feat: refs #6999 added search when user tabs on a filter with value by:Jon +- feat: refs #6999 added tab to search in VnTable filter by:Jon +- feat: refs #7346 #7346 improve form by:Javier Segarra +- feat: refs #7346 address ordered by:jgallego +- feat: refs #7346 radioButton by:jgallego +- feat: refs #7346 style radioButton by:jgallego +- feat: refs #7346 traducciones en cammelCase (7346-manualInvoice) by:jgallego +- feat: refs #8038 added new functionality in VnSelect and refactor styles by:Jon +- feat: refs #8061 #8061 updates by:Javier Segarra +- feat: refs #8087 reactive data by:jorgep +- feat: refs #8087 refs#8087 Redadas en travel by:Carlos Andrés +- feat: refs #8138 add component ticket problems by:pablone +- feat: refs #8163 add max length and more tests by:wbuezas +- feat: refs #8163 add prop by:wbuezas +- feat: refs #8163 add VnInput insert functionality and e2e test by:wbuezas +- feat: refs #8163 limit with maxLength by:Javier Segarra +- feat: refs #8163 maxLength SupplierFD account by:Javier Segarra +- feat: refs #8163 maxLengthVnInput by:Javier Segarra +- feat: refs #8163 use VnAccountNumber in VnAccountNumber by:Javier Segarra +- feat: refs #8166 show notification by:jorgep + +### Changed 📦 + +- feat: refs #8038 added new functionality in VnSelect and refactor styles by:Jon +- perf: add dataCy by:Javier Segarra +- perf: refs #7346 #7346 Imrpove interface dialog by:Javier Segarra +- perf: refs #7346 #7346 use v-show instead v-if by:Javier Segarra +- perf: refs #8036 currentFilter by:alexm +- perf: refs #8061 filter autonomy by:Javier Segarra +- perf: refs #8061 solve conflicts and random posCode it by:Javier Segarra +- perf: refs #8061 use opts from VnSelect by:Javier Segarra +- perf: refs #8163 #8061 createNewPostCodeForm by:Javier Segarra +- perf: remove console by:Javier Segarra +- perf: remove timeout by:Javier Segarra +- perf: test command fillInForm by:Javier Segarra +- refactor: refs #8162 remove comment by:wbuezas +- refactor: remove unnecesary things by:wbuezas + +### Fixed 🛠️ + +- fix: #8016 fetching data by:Javier Segarra +- fix: icons by:jgallego +- fix: refs #7229 download file by:jorgep +- fix: refs #7229 remove catch by:jorgep +- fix: refs #7229 set url by:jorgep +- fix: refs #7229 test by:jorgep +- fix: refs #7229 url by:jorgep +- fix: refs #7229 url + test by:jorgep +- fix: refs #7304 7304 clean warning by:carlossa +- fix: refs #7304 fix list by:carlossa +- fix: refs #7304 fix warning by:carlossa +- fix: refs #7346 traslations by:jgallego +- fix: refs #7529 add save by:carlossa +- fix: refs #7529 fix e2e by:carlossa +- fix: refs #7529 fix front by:carlossa +- fix: refs #7529 fix scss by:carlossa +- fix: refs #7529 fix te2e by:carlossa +- fix: refs #7529 fix workerPit e2e by:carlossa +- fix: refs #7529 front by:carlossa +- fix: refs #8036 apply exprBuilder after save filters by:alexm +- fix: refs #8036 only add where when required by:alexm +- fix: refs #8038 solve conflicts by:Jon +- fix: refs #8061 improve code dependencies (origin/8061_improve_newCP) by:Javier Segarra +- fix: refs #8138 move component from ui folder by:pablone +- fix: refs #8138 sme minor issues by:pablone +- fix: refs #8163 #8061 createNewPostCodeForm by:Javier Segarra +- fix: refs #8163 minor problem when keypress by:Javier Segarra +- fix: refs #8166 show zone error by:jorgep +- fix: removed selectedClient by:jgallego +- refs #7529 fix workerPit by:carlossa +- revert: refs #8061 test #8061 updates by:Javier Segarra +- test: fix own test by:Javier Segarra +- test: refs #8162 #8162 fix TicketList spec by:Javier Segarra + # Version 24.48 - 2024-11-25 ### Added 🆕 diff --git a/Jenkinsfile b/Jenkinsfile index 1766e3aea..c20da8ab2 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -4,7 +4,8 @@ def PROTECTED_BRANCH def BRANCH_ENV = [ test: 'test', - master: 'production' + master: 'production', + beta: 'production' ] node { @@ -15,7 +16,8 @@ node { PROTECTED_BRANCH = [ 'dev', 'test', - 'master' + 'master', + 'beta' ].contains(env.BRANCH_NAME) // https://www.jenkins.io/doc/book/pipeline/jenkinsfile/#using-environment-variables diff --git a/cypress.config.js b/cypress.config.js index e9aeb547a..1100b59b1 100644 --- a/cypress.config.js +++ b/cypress.config.js @@ -11,6 +11,7 @@ module.exports = defineConfig({ screenshotsFolder: 'test/cypress/screenshots', supportFile: 'test/cypress/support/index.js', videosFolder: 'test/cypress/videos', + downloadsFolder: 'test/cypress/downloads', video: false, specPattern: 'test/cypress/integration/**/*.spec.js', experimentalRunAllSpecs: true, diff --git a/package.json b/package.json index 04b75a0b0..9d14e8727 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "salix-front", - "version": "24.50.0", + "version": "25.04.0", "description": "Salix frontend", "productName": "Salix", "author": "Verdnatura", @@ -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", @@ -64,4 +65,4 @@ "vite": "^5.1.4", "vitest": "^0.31.1" } -} \ No newline at end of file +} 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/test/vitest/__tests__/boot/axios.spec.js b/src/boot/__tests__/axios.spec.js similarity index 97% rename from test/vitest/__tests__/boot/axios.spec.js rename to src/boot/__tests__/axios.spec.js index 19d396ec5..b3b6f98c6 100644 --- a/test/vitest/__tests__/boot/axios.spec.js +++ b/src/boot/__tests__/axios.spec.js @@ -1,4 +1,3 @@ -import { Notify } from 'quasar'; import { onRequest, onResponseError } from 'src/boot/axios'; import { describe, expect, it, vi } from 'vitest'; @@ -27,6 +26,7 @@ describe('Axios boot', () => { expect(resultConfig).toEqual( expect.objectContaining({ headers: { + 'Accept-Language': 'en-US', Authorization: 'DEFAULT_TOKEN', }, }) diff --git a/src/boot/axios.js b/src/boot/axios.js index aee38e887..3f9fadee5 100644 --- a/src/boot/axios.js +++ b/src/boot/axios.js @@ -3,12 +3,12 @@ import { useSession } from 'src/composables/useSession'; import { Router } from 'src/router'; import useNotify from 'src/composables/useNotify.js'; import { useStateQueryStore } from 'src/stores/useStateQueryStore'; +import { i18n } from 'src/boot/i18n'; const session = useSession(); const { notify } = useNotify(); const stateQuery = useStateQueryStore(); const baseUrl = '/api/'; - axios.defaults.baseURL = baseUrl; const axiosNoError = axios.create({ baseURL: baseUrl }); @@ -16,6 +16,7 @@ const onRequest = (config) => { const token = session.getToken(); if (token.length && !config.headers.Authorization) { config.headers.Authorization = token; + config.headers['Accept-Language'] = i18n.global.locale.value; } stateQuery.add(config); return config; diff --git a/src/boot/i18n.js b/src/boot/i18n.js index b23b6d5fd..85d0772a3 100644 --- a/src/boot/i18n.js +++ b/src/boot/i18n.js @@ -1,9 +1,11 @@ import { boot } from 'quasar/wrappers'; import { createI18n } from 'vue-i18n'; import messages from 'src/i18n'; +import { useState } from 'src/composables/useState'; +const user = useState().getUser(); const i18n = createI18n({ - locale: navigator.language || navigator.userLanguage, + locale: user.value.lang || navigator.language || navigator.userLanguage, fallbackLocale: 'en', globalInjection: true, messages, diff --git a/src/boot/mainShortcutMixin.js b/src/boot/mainShortcutMixin.js new file mode 100644 index 000000000..481077e37 --- /dev/null +++ b/src/boot/mainShortcutMixin.js @@ -0,0 +1,36 @@ +import routes from 'src/router/modules'; +import { useRouter } from 'vue-router'; + +let isNotified = false; + +export default { + created: function () { + const router = useRouter(); + const keyBindingMap = routes + .filter((route) => route.meta.keyBinding) + .reduce((map, route) => { + map['Key' + route.meta.keyBinding.toUpperCase()] = route.path; + return map; + }, {}); + + const handleKeyDown = (event) => { + const { ctrlKey, altKey, code } = event; + + if (ctrlKey && altKey && keyBindingMap[code] && !isNotified) { + event.preventDefault(); + router.push(keyBindingMap[code]); + isNotified = true; + } + }; + + const handleKeyUp = (event) => { + const { ctrlKey, altKey } = event; + if (!ctrlKey || !altKey) { + isNotified = false; + } + }; + + window.addEventListener('keydown', handleKeyDown); + window.addEventListener('keyup', handleKeyUp); + }, +}; diff --git a/src/boot/qformMixin.js b/src/boot/qformMixin.js index fc7852369..187ca6dbc 100644 --- a/src/boot/qformMixin.js +++ b/src/boot/qformMixin.js @@ -1,30 +1,51 @@ -import { getCurrentInstance } from 'vue'; - +function focusFirstInput(input) { + input.focus(); +} export default { mounted: function () { - const vm = getCurrentInstance(); - if (vm.type.name === 'QForm') { - if (!['searchbarForm', 'filterPanelForm'].includes(this.$el?.id)) { - // TODO: AUTOFOCUS IS NOT FOCUSING - const that = this; - this.$el.addEventListener('keyup', function (evt) { - if (evt.key === 'Enter') { - const input = evt.target; - if (input.type == 'textarea' && evt.shiftKey) { - evt.preventDefault(); - let { selectionStart, selectionEnd } = input; - input.value = - input.value.substring(0, selectionStart) + - '\n' + - input.value.substring(selectionEnd); - selectionStart = selectionEnd = selectionStart + 1; - return; - } - evt.preventDefault(); - that.onSubmit(); - } - }); + const that = this; + + const form = document.querySelector('.q-form#formModel'); + if (!form) return; + try { + const inputsFormCard = form.querySelectorAll( + `input:not([disabled]):not([type="checkbox"])` + ); + if (inputsFormCard.length) { + focusFirstInput(inputsFormCard[0]); } + const textareas = document.querySelectorAll( + 'textarea:not([disabled]), [contenteditable]:not([disabled])' + ); + if (textareas.length) { + focusFirstInput(textareas[textareas.length - 1]); + } + const inputs = document.querySelectorAll( + 'form#formModel input:not([disabled]):not([type="checkbox"])' + ); + const input = inputs[0]; + if (!input) return; + + focusFirstInput(input); + } catch (error) { + console.error(error); } + form.addEventListener('keyup', function (evt) { + if (evt.key === 'Enter') { + const input = evt.target; + if (input.type == 'textarea' && evt.shiftKey) { + evt.preventDefault(); + let { selectionStart, selectionEnd } = input; + input.value = + input.value.substring(0, selectionStart) + + '\n' + + input.value.substring(selectionEnd); + selectionStart = selectionEnd = selectionStart + 1; + return; + } + evt.preventDefault(); + that.onSubmit(); + } + }); }, }; diff --git a/src/boot/quasar.js b/src/boot/quasar.js index 01fe68d8b..547517682 100644 --- a/src/boot/quasar.js +++ b/src/boot/quasar.js @@ -1,15 +1,18 @@ +import axios from 'axios'; import { boot } from 'quasar/wrappers'; import qFormMixin from './qformMixin'; import keyShortcut from './keyShortcut'; -import useNotify from 'src/composables/useNotify.js'; -import { CanceledError } from 'axios'; - -const { notify } = useNotify(); +import { QForm } from 'quasar'; +import { QLayout } from 'quasar'; +import mainShortcutMixin from './mainShortcutMixin'; +import { useCau } from 'src/composables/useCau'; export default boot(({ app }) => { - app.mixin(qFormMixin); + QForm.mixins = [qFormMixin]; + QLayout.mixins = [mainShortcutMixin]; + app.directive('shortcut', keyShortcut); - app.config.errorHandler = (error) => { + app.config.errorHandler = async (error) => { let message; const response = error.response; const responseData = response?.data; @@ -40,12 +43,12 @@ export default boot(({ app }) => { } console.error(error); - if (error instanceof CanceledError) { + if (error instanceof axios.CanceledError) { const env = process.env.NODE_ENV; if (env && env !== 'development') return; message = 'Duplicate request'; } - notify(message ?? 'globals.error', 'negative', 'error'); + await useCau(response, message); }; }); diff --git a/src/components/CreateNewCityForm.vue b/src/components/CreateNewCityForm.vue index 1cbba42fc..bf3830522 100644 --- a/src/components/CreateNewCityForm.vue +++ b/src/components/CreateNewCityForm.vue @@ -40,6 +40,7 @@ const onDataSaved = (...args) => { url-create="towns" model="city" @on-data-saved="onDataSaved" + data-cy="newCityForm" > diff --git a/src/components/CreateNewPostcodeForm.vue b/src/components/CreateNewPostcodeForm.vue index 232f86a49..39ebfe540 100644 --- a/src/components/CreateNewPostcodeForm.vue +++ b/src/components/CreateNewPostcodeForm.vue @@ -1,5 +1,5 @@