From 701f1e100f0de4d0a0a5ac4aea68686fdaf0ec66 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Tue, 21 Nov 2023 12:50:05 +0100 Subject: [PATCH 01/44] refs #5858 feat: add catch when patch FormModel --- src/components/FormModel.vue | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/components/FormModel.vue b/src/components/FormModel.vue index e8a9e4c17..f8daea34e 100644 --- a/src/components/FormModel.vue +++ b/src/components/FormModel.vue @@ -80,7 +80,13 @@ async function save() { }); } isLoading.value = true; - await axios.patch($props.urlUpdate || $props.url, formData.value); + try { + await axios.patch($props.urlUpdate || $props.url, formData.value); + } catch (err) { + if (err) { + isLoading.value = false; + } + } originalData.value = JSON.parse(JSON.stringify(formData.value)); hasChanges.value = false; From 333050b6a78b07921ce583266d73bd6704099d64 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Wed, 22 Nov 2023 07:12:34 +0100 Subject: [PATCH 02/44] refs #5858 feat: add format validation --- src/composables/useValidator.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/composables/useValidator.js b/src/composables/useValidator.js index bc48332a2..625f20911 100644 --- a/src/composables/useValidator.js +++ b/src/composables/useValidator.js @@ -37,6 +37,15 @@ export function useValidator() { const { t } = useI18n(); const validations = function (validation) { return { + format: (value) =>{ + const {allowNull, with: format, allowBlank} = validation; + const message = t(validation.message) || validation.message; + if(!allowBlank && value ==='') return message + if(!allowNull && value === null) return message + + const isValid = new RegExp(format).test(value) + if(!isValid) return message + }, presence: (value) => { let message = `Value can't be empty`; if (validation.message) From 4ccb11997e51ed17830dcae7349d9db9a03be9d2 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Fri, 22 Dec 2023 10:32:57 +0100 Subject: [PATCH 03/44] refs #5878 lint: eslint --- src/composables/useValidator.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/composables/useValidator.js b/src/composables/useValidator.js index 364d11391..5ad96ea1b 100644 --- a/src/composables/useValidator.js +++ b/src/composables/useValidator.js @@ -30,14 +30,14 @@ export function useValidator() { const { t } = useI18n(); const validations = function (validation) { return { - format: (value) =>{ - const {allowNull, with: format, allowBlank} = validation; + format: (value) => { + const { allowNull, with: format, allowBlank } = validation; const message = t(validation.message) || validation.message; - if(!allowBlank && value ==='') return message - if(!allowNull && value === null) return message + if (!allowBlank && value === '') return message; + if (!allowNull && value === null) return message; - const isValid = new RegExp(format).test(value) - if(!isValid) return message + const isValid = new RegExp(format).test(value); + if (!isValid) return message; }, presence: (value) => { let message = `Value can't be empty`; From 232827ef48f3aecbaf401721c5e1046471f23898 Mon Sep 17 00:00:00 2001 From: jorgep Date: Thu, 28 Dec 2023 16:02:04 +0100 Subject: [PATCH 04/44] WIP: corrective section created: refs #4466 --- src/components/CrudModel.vue | 10 +- src/components/LeftMenu.vue | 2 +- src/components/common/VnSelectFilter.vue | 2 +- src/i18n/en/index.js | 5 + src/i18n/es/index.js | 5 + .../InvoiceIn/Card/InvoiceInBasicData.vue | 3 +- src/pages/InvoiceIn/Card/InvoiceInCard.vue | 20 +- .../InvoiceIn/Card/InvoiceInCorrective.vue | 160 +++++++++++ .../InvoiceIn/Card/InvoiceInDescriptor.vue | 252 +++++++++++++++++- src/router/modules/invoiceIn.js | 30 +++ 10 files changed, 460 insertions(+), 29 deletions(-) create mode 100644 src/pages/InvoiceIn/Card/InvoiceInCorrective.vue diff --git a/src/components/CrudModel.vue b/src/components/CrudModel.vue index 75353a35a..dcffc1a28 100644 --- a/src/components/CrudModel.vue +++ b/src/components/CrudModel.vue @@ -76,8 +76,13 @@ defineExpose({ reset, hasChanges, saveChanges, + getFormData, }); +function getFormData() { + return formData.value; +} + async function fetch(data) { if (data && Array.isArray(data)) { let $index = 0; @@ -196,12 +201,13 @@ function getChanges() { const creates = []; const pk = $props.primaryKey; - for (const [i, row] of formData.value.entries()) { + console.log(pk, row); if (!row[pk]) { creates.push(row); } else if (originalData.value) { const data = getDifferences(originalData.value[i], row); + console.log(data); if (!isEmpty(data)) { updates.push({ data, @@ -211,7 +217,7 @@ function getChanges() { } } const changes = { updates, creates }; - + console.log('ddd', changes); for (let prop in changes) { if (changes[prop].length === 0) changes[prop] = undefined; } diff --git a/src/components/LeftMenu.vue b/src/components/LeftMenu.vue index 2eac97c65..253f3c161 100644 --- a/src/components/LeftMenu.vue +++ b/src/components/LeftMenu.vue @@ -50,7 +50,7 @@ function addChildren(module, route, parent) { const matches = findMatches(mainMenus, route); for (const child of matches) { - navigation.addMenuItem(module, child, parent); + if (!child.meta.hidden) navigation.addMenuItem(module, child, parent); } } } diff --git a/src/components/common/VnSelectFilter.vue b/src/components/common/VnSelectFilter.vue index 568da613f..35cb72cf2 100644 --- a/src/components/common/VnSelectFilter.vue +++ b/src/components/common/VnSelectFilter.vue @@ -102,7 +102,7 @@ const value = computed({ name="close" @click.stop="value = null" class="cursor-pointer" - size="18px" + size="xs" /> + + + + {{ t('New consignee') }} + + es: Search shelving: Buscar carros diff --git a/src/pages/Shelving/Card/ShelvingSummary.vue b/src/pages/Shelving/Card/ShelvingSummary.vue index f1f914385..5f93c4a02 100644 --- a/src/pages/Shelving/Card/ShelvingSummary.vue +++ b/src/pages/Shelving/Card/ShelvingSummary.vue @@ -24,7 +24,7 @@ const hideRightDrawer = () => { if (!isDialog) { stateStore.rightDrawer = false; } -} +}; onMounted(hideRightDrawer); onUnmounted(hideRightDrawer); const filter = { @@ -69,9 +69,13 @@ const filter = {