From b09ecefad4ec93451ef9f6d70bfe927ddc7eb771 Mon Sep 17 00:00:00 2001 From: guillermo Date: Thu, 4 Apr 2024 14:12:16 +0200 Subject: [PATCH 01/12] feat: refs #6636 Added pickup in claim --- src/components/common/VnLog.vue | 4 +-- src/i18n/en/index.js | 9 +++++- src/i18n/es/index.js | 9 +++++- src/pages/Claim/Card/ClaimBasicData.vue | 28 ++++++++++++++----- src/pages/Claim/Card/ClaimSummary.vue | 7 ++--- .../__tests__/components/common/VnLog.spec.js | 4 +-- 6 files changed, 44 insertions(+), 17 deletions(-) diff --git a/src/components/common/VnLog.vue b/src/components/common/VnLog.vue index 794e4cc8f..c1cc78f54 100644 --- a/src/components/common/VnLog.vue +++ b/src/components/common/VnLog.vue @@ -1030,7 +1030,7 @@ en: ticketCreated: Created created: Created isChargedToMana: Charged to mana - hasToPickUp: Has to pick Up + pickup: Type of pickup dmsFk: Document ID text: Description claimStateFk: Claim State @@ -1069,7 +1069,7 @@ es: ticketCreated: Creado created: Creado isChargedToMana: Cargado a maná - hasToPickUp: Se debe recoger + pickup: Se debe recoger dmsFk: ID documento text: Descripción claimStateFk: Estado de la reclamación diff --git a/src/i18n/en/index.js b/src/i18n/en/index.js index 5e0bba5c0..650ae78ce 100644 --- a/src/i18n/en/index.js +++ b/src/i18n/en/index.js @@ -545,6 +545,7 @@ export default { assignedTo: 'Assigned', attendedBy: 'Attended by', created: 'Created', + pickup: 'Pickup', state: 'State', details: 'Details', item: 'Item', @@ -566,13 +567,19 @@ export default { responsible: 'Responsible', worker: 'Worker', redelivery: 'Redelivery', + null: 'No', + agency: 'Agency', + delivery: 'Delivery', }, basicData: { customer: 'Customer', assignedTo: 'Assigned', created: 'Created', state: 'State', - picked: 'Picked', + pickup: 'Pickup', + null: 'No', + agency: 'Agency', + delivery: 'Delivery', }, photo: { fileDescription: 'Claim id {claimId} from client {clientName} id {clientId}', diff --git a/src/i18n/es/index.js b/src/i18n/es/index.js index a4aa9d8cc..1525f6ac6 100644 --- a/src/i18n/es/index.js +++ b/src/i18n/es/index.js @@ -544,6 +544,7 @@ export default { assignedTo: 'Asignada a', attendedBy: 'Atendida por', created: 'Creada', + pickup: 'Recogida', state: 'Estado', details: 'Detalles', item: 'Artículo', @@ -565,13 +566,19 @@ export default { responsible: 'Responsable', worker: 'Trabajador', redelivery: 'Devolución', + null: 'No', + agency: 'Agencia', + delivery: 'Reparto', }, basicData: { customer: 'Cliente', assignedTo: 'Asignada a', created: 'Creada', state: 'Estado', - picked: 'Recogida', + pickup: 'Recogida', + null: 'No', + agency: 'Agencia', + delivery: 'Reparto', }, photo: { fileDescription: diff --git a/src/pages/Claim/Card/ClaimBasicData.vue b/src/pages/Claim/Card/ClaimBasicData.vue index c7c5ab8a2..57ecc6cad 100644 --- a/src/pages/Claim/Card/ClaimBasicData.vue +++ b/src/pages/Claim/Card/ClaimBasicData.vue @@ -24,7 +24,7 @@ const claimFilter = { 'workerFk', 'claimStateFk', 'packages', - 'hasToPickUp', + 'pickup', ], include: [ { @@ -51,6 +51,13 @@ function setClaimStates(data) { claimStatesCopy.value = data; } +// Simulate ENUM +let optionsList = [ + { id: null, description: t('claim.basicData.null') }, + { id: 'agency', description: t('claim.basicData.agency') }, + { id: 'delivery', description: t('claim.basicData.delivery') }, +]; + const workerFilter = { options: workers, filterFn: (options, value) => { @@ -168,13 +175,20 @@ const statesFilter = { type="number" /> - -
- + +
diff --git a/src/pages/Claim/Card/ClaimSummary.vue b/src/pages/Claim/Card/ClaimSummary.vue index 612e0d755..19e3f00ef 100644 --- a/src/pages/Claim/Card/ClaimSummary.vue +++ b/src/pages/Claim/Card/ClaimSummary.vue @@ -220,10 +220,9 @@ function openDialog(dmsId) { /> - diff --git a/test/vitest/__tests__/components/common/VnLog.spec.js b/test/vitest/__tests__/components/common/VnLog.spec.js index b654bff9b..53d2732a0 100644 --- a/test/vitest/__tests__/components/common/VnLog.spec.js +++ b/test/vitest/__tests__/components/common/VnLog.spec.js @@ -38,10 +38,10 @@ describe('VnLog', () => { action: 'update', changedModel: 'Claim', oldInstance: { - hasToPickUp: false, + pickup: null, }, newInstance: { - hasToPickUp: true, + pickup: 'agency', }, creationDate: '2023-09-18T12:25:34.000Z', changedModelId: '1', From 58b9eb1c78735d22404bf5ad170fe50d67910e57 Mon Sep 17 00:00:00 2001 From: guillermo Date: Fri, 5 Apr 2024 07:29:25 +0200 Subject: [PATCH 02/12] feat: refs #6636 Requested changes --- src/pages/Claim/Card/ClaimBasicData.vue | 1 - 1 file changed, 1 deletion(-) diff --git a/src/pages/Claim/Card/ClaimBasicData.vue b/src/pages/Claim/Card/ClaimBasicData.vue index 57ecc6cad..38d5d1ed5 100644 --- a/src/pages/Claim/Card/ClaimBasicData.vue +++ b/src/pages/Claim/Card/ClaimBasicData.vue @@ -185,7 +185,6 @@ const statesFilter = { :label="t('claim.basicData.pickup')" map-options use-input - @filter="(value, update) => filter(value, update, statesFilter)" :input-debounce="0" > From 9310d863aa719790fd2e94028b6afff8e21003d4 Mon Sep 17 00:00:00 2001 From: guillermo Date: Fri, 5 Apr 2024 07:39:05 +0200 Subject: [PATCH 03/12] fix: refs #6636 Icon save and reset --- src/components/FormModel.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/FormModel.vue b/src/components/FormModel.vue index 060a18bcc..39e8a72f5 100644 --- a/src/components/FormModel.vue +++ b/src/components/FormModel.vue @@ -132,12 +132,12 @@ const formUrl = computed(() => $props.url); const defaultButtons = computed(() => ({ save: { color: 'primary', - icon: 'restart_alt', + icon: 'save', label: 'globals.save', }, reset: { color: 'primary', - icon: 'save', + icon: 'restart_alt', label: 'globals.reset', }, ...$props.defaultButtons, From 1a15ccec2c96e51ab289899d7e8d686479e11e86 Mon Sep 17 00:00:00 2001 From: guillermo Date: Fri, 5 Apr 2024 11:01:48 +0200 Subject: [PATCH 04/12] fix: refs #6636 Call getEnumValues method --- src/pages/Claim/Card/ClaimBasicData.vue | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/pages/Claim/Card/ClaimBasicData.vue b/src/pages/Claim/Card/ClaimBasicData.vue index 38d5d1ed5..56717c628 100644 --- a/src/pages/Claim/Card/ClaimBasicData.vue +++ b/src/pages/Claim/Card/ClaimBasicData.vue @@ -9,6 +9,7 @@ import VnRow from 'components/ui/VnRow.vue'; import VnInput from 'src/components/common/VnInput.vue'; import VnInputDate from 'components/common/VnInputDate.vue'; +import axios from 'axios'; import { useSession } from 'src/composables/useSession'; const route = useRoute(); @@ -50,13 +51,20 @@ function setClaimStates(data) { claimStates.value = data; claimStatesCopy.value = data; } - -// Simulate ENUM -let optionsList = [ - { id: null, description: t('claim.basicData.null') }, - { id: 'agency', description: t('claim.basicData.agency') }, - { id: 'delivery', description: t('claim.basicData.delivery') }, -]; +let optionsList; +async function getEnumValues() { + optionsList = [{ id: null, description: t('claim.basicData.null') }]; + const { data } = await axios.get(`Applications/get-enum-values`, { + params: { + schema: 'vn', + table: 'claim', + column: 'pickup', + }, + }); + for (let value of data) + optionsList.push({ id: value, description: t(`claim.basicData.${value}`) }); +} +getEnumValues(); const workerFilter = { options: workers, From 8de3ea16a6c79020bc5442e1c054db6a3cb90c46 Mon Sep 17 00:00:00 2001 From: jorgep Date: Mon, 8 Apr 2024 15:15:18 +0200 Subject: [PATCH 05/12] fix: refs #6992 add queryParams --- CHANGELOG.md | 4 ++++ src/composables/useArrayData.js | 16 ++++++++++------ test/cypress/integration/vnSearchBar.spec.js | 2 +- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 555b4f0ba..9f493764a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added +### Fixed + +- (General) => Se vuelven a mostrar los parámetros en la url al aplicar un filtro + ## [2414.01] - 2024-04-04 ### Added diff --git a/src/composables/useArrayData.js b/src/composables/useArrayData.js index b6b81f2d5..403683415 100644 --- a/src/composables/useArrayData.js +++ b/src/composables/useArrayData.js @@ -105,7 +105,7 @@ export function useArrayData(key, userOptions) { for (const row of response.data) store.data.push(row); } else { store.data = response.data; - if (!document.querySelectorAll('[role="dialog"]')) + if (!document.querySelectorAll('[role="dialog"]').length) updateRouter && updateStateParams(); } @@ -188,11 +188,15 @@ export function useArrayData(key, userOptions) { if (store.userParams && Object.keys(store.userParams).length !== 0) query.params = JSON.stringify(store.userParams); - if (router) - router.replace({ - path: route.path, - query: query, - }); + const url = new URL(window.location.href); + const { hash: currentHash } = url; + const [currentRoute] = currentHash.split('?'); + + const params = new URLSearchParams(); + for (const param in query) params.append(param, query[param]); + + url.hash = currentRoute + '?' + params.toString(); + window.history.pushState({}, '', url); } const totalRows = computed(() => (store.data && store.data.length) || 0); diff --git a/test/cypress/integration/vnSearchBar.spec.js b/test/cypress/integration/vnSearchBar.spec.js index 3db789773..f1f3a9e82 100644 --- a/test/cypress/integration/vnSearchBar.spec.js +++ b/test/cypress/integration/vnSearchBar.spec.js @@ -36,7 +36,7 @@ describe('VnSearchBar', () => { const checkCardListAndUrl = (expectedLength) => { cy.get(cardList).then(($cardList) => { expect($cardList.find('.q-card').length).to.equal(expectedLength); - cy.url().then((currentUrl) => expect(currentUrl).to.equal(url)); + cy.url().then((currentUrl) => expect(currentUrl).to.contain(url)); }); }; }); From 16548dadefd7638bd8fa20efbd0292eaf3ce0fd0 Mon Sep 17 00:00:00 2001 From: jorgep Date: Mon, 8 Apr 2024 16:38:36 +0200 Subject: [PATCH 06/12] feat: refs #6992 add test --- src/composables/useArrayData.js | 2 +- .../composables/useArrayData.spec.js | 27 +++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 test/vitest/__tests__/composables/useArrayData.spec.js diff --git a/src/composables/useArrayData.js b/src/composables/useArrayData.js index 403683415..a212cb744 100644 --- a/src/composables/useArrayData.js +++ b/src/composables/useArrayData.js @@ -196,7 +196,7 @@ export function useArrayData(key, userOptions) { for (const param in query) params.append(param, query[param]); url.hash = currentRoute + '?' + params.toString(); - window.history.pushState({}, '', url); + window.history.pushState({}, '', url.hash); } const totalRows = computed(() => (store.data && store.data.length) || 0); diff --git a/test/vitest/__tests__/composables/useArrayData.spec.js b/test/vitest/__tests__/composables/useArrayData.spec.js new file mode 100644 index 000000000..09bfc256f --- /dev/null +++ b/test/vitest/__tests__/composables/useArrayData.spec.js @@ -0,0 +1,27 @@ +import { describe, expect, it, beforeAll } from 'vitest'; +import { axios } from 'app/test/vitest/helper'; +import { useArrayData } from 'composables/useArrayData'; + +describe('useArrayData', () => { + let arrayData; + beforeAll(() => { + axios.get.mockResolvedValue({ data: [] }); + arrayData = useArrayData('InvoiceIn', { url: 'invoice-in/list' }); + Object.defineProperty(window.location, 'href', { + writable: true, + value: 'localhost:9000/invoice-in/list', + }); + window.history.pushState = (data, title, url) => (window.location.href = url); + global.URL = class URL { + constructor(url) { + this.hash = url.split('localhost:9000/')[1]; + } + }; + }); + + it('should add the params to the url', async () => { + arrayData.store.userParams = { supplierFk: 2 }; + arrayData.updateStateParams(); + expect(window.location.href).contain('params=%7B%22supplierFk%22%3A2%7D'); + }); +}); From 65626446fd3b3ecf4969149609a1e2486bed7f94 Mon Sep 17 00:00:00 2001 From: Jon Date: Tue, 9 Apr 2024 13:01:29 +0200 Subject: [PATCH 07/12] refactor: refs #7186 fixed style and tab --- src/pages/InvoiceIn/Card/InvoiceInVat.vue | 38 ++++++++++++++++++----- 1 file changed, 31 insertions(+), 7 deletions(-) diff --git a/src/pages/InvoiceIn/Card/InvoiceInVat.vue b/src/pages/InvoiceIn/Card/InvoiceInVat.vue index 3eb9365d2..fa0ad12db 100644 --- a/src/pages/InvoiceIn/Card/InvoiceInVat.vue +++ b/src/pages/InvoiceIn/Card/InvoiceInVat.vue @@ -32,6 +32,13 @@ const invoiceInFormRef = ref(); const expensesRef = ref(); const newExpenseRef = ref(); +const $props = defineProps({ + actionIcon: { + type: String, + default: 'add', + }, +}); + const columns = computed(() => [ { name: 'expense', @@ -94,6 +101,11 @@ const columns = computed(() => [ field: (row) => row.foreignValue, align: 'left', }, + { + get() { + return $props.actionIcon; + }, + } ]); const filter = { @@ -207,17 +219,19 @@ async function addExpense() { @click.stop="value = null" class="cursor-pointer" /> - {{ t('Create expense') }} - + @@ -470,6 +484,16 @@ async function addExpense() { .q-item { min-height: 0; } +.default-icon { + cursor: pointer; + color: $primary; + border-radius: 50px; + + &.--add-icon { + color: var(--vn-text-color); + background-color: $primary; + } +} es: From 15d4b54ddaaa343b28c7fe124ad709fff8e5c729 Mon Sep 17 00:00:00 2001 From: Jon Date: Tue, 9 Apr 2024 13:34:45 +0200 Subject: [PATCH 08/12] refactor: refs #7186 fixed changes --- src/pages/InvoiceIn/Card/InvoiceInVat.vue | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/pages/InvoiceIn/Card/InvoiceInVat.vue b/src/pages/InvoiceIn/Card/InvoiceInVat.vue index fa0ad12db..02ec0fd38 100644 --- a/src/pages/InvoiceIn/Card/InvoiceInVat.vue +++ b/src/pages/InvoiceIn/Card/InvoiceInVat.vue @@ -32,7 +32,7 @@ const invoiceInFormRef = ref(); const expensesRef = ref(); const newExpenseRef = ref(); -const $props = defineProps({ +defineProps({ actionIcon: { type: String, default: 'add', @@ -101,11 +101,6 @@ const columns = computed(() => [ field: (row) => row.foreignValue, align: 'left', }, - { - get() { - return $props.actionIcon; - }, - } ]); const filter = { From 6349a3e790db734d0d0f0208b71dc065cbab0a49 Mon Sep 17 00:00:00 2001 From: jorgep Date: Tue, 9 Apr 2024 15:08:54 +0200 Subject: [PATCH 09/12] feat: refs #6992 comments --- src/composables/useArrayData.js | 3 +-- test/vitest/__tests__/composables/useArrayData.spec.js | 4 ++++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/composables/useArrayData.js b/src/composables/useArrayData.js index a212cb744..2c5a579c8 100644 --- a/src/composables/useArrayData.js +++ b/src/composables/useArrayData.js @@ -1,5 +1,5 @@ import { onMounted, ref, computed } from 'vue'; -import { useRouter, useRoute } from 'vue-router'; +import { useRoute } from 'vue-router'; import axios from 'axios'; import { useArrayDataStore } from 'stores/useArrayDataStore'; import { buildFilter } from 'filters/filterPanel'; @@ -15,7 +15,6 @@ export function useArrayData(key, userOptions) { const store = arrayDataStore.get(key); const hasMoreData = ref(false); - const router = useRouter(); const route = useRoute(); let canceller = null; diff --git a/test/vitest/__tests__/composables/useArrayData.spec.js b/test/vitest/__tests__/composables/useArrayData.spec.js index 09bfc256f..ae0ca7368 100644 --- a/test/vitest/__tests__/composables/useArrayData.spec.js +++ b/test/vitest/__tests__/composables/useArrayData.spec.js @@ -11,7 +11,11 @@ describe('useArrayData', () => { writable: true, value: 'localhost:9000/invoice-in/list', }); + + // Mock the window.history.pushState method within useArrayData window.history.pushState = (data, title, url) => (window.location.href = url); + + // Mock the URL constructor within useArrayData global.URL = class URL { constructor(url) { this.hash = url.split('localhost:9000/')[1]; From 83bf8183f0c0dd1ab6a3dc48d97b43ddce04dec1 Mon Sep 17 00:00:00 2001 From: jorgep Date: Tue, 9 Apr 2024 15:12:54 +0200 Subject: [PATCH 10/12] fix: refs #6992 warning console & formModel hook --- src/components/FormModel.vue | 20 ++++++++++---------- src/components/common/VnCurrency.vue | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/components/FormModel.vue b/src/components/FormModel.vue index 8787371bc..a7af0044b 100644 --- a/src/components/FormModel.vue +++ b/src/components/FormModel.vue @@ -101,16 +101,16 @@ onMounted(async () => { }); onBeforeRouteLeave((to, from, next) => { - if (!hasChanges.value) next(); - - quasar.dialog({ - component: VnConfirm, - componentProps: { - title: t('Unsaved changes will be lost'), - message: t('Are you sure exit without saving?'), - promise: () => next(), - }, - }); + if (hasChanges.value) + quasar.dialog({ + component: VnConfirm, + componentProps: { + title: t('Unsaved changes will be lost'), + message: t('Are you sure exit without saving?'), + promise: () => next(), + }, + }); + else next(); }); onUnmounted(() => { diff --git a/src/components/common/VnCurrency.vue b/src/components/common/VnCurrency.vue index 660c4e979..b892e5012 100644 --- a/src/components/common/VnCurrency.vue +++ b/src/components/common/VnCurrency.vue @@ -5,7 +5,7 @@ import { useCapitalize } from 'src/composables/useCapitalize'; import VnInput from 'src/components/common/VnInput.vue'; const props = defineProps({ - modelValue: { type: String, default: '' }, + modelValue: { type: [String, Number], default: '' }, }); const { t } = useI18n(); From f9de26933a7d782ec048bbd6c414c8f4644b4dfe Mon Sep 17 00:00:00 2001 From: Jon Date: Wed, 10 Apr 2024 08:00:36 +0200 Subject: [PATCH 11/12] refactor: refs #7186 fill-icon change --- src/pages/InvoiceIn/Card/InvoiceInVat.vue | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/pages/InvoiceIn/Card/InvoiceInVat.vue b/src/pages/InvoiceIn/Card/InvoiceInVat.vue index 02ec0fd38..b170cc4b5 100644 --- a/src/pages/InvoiceIn/Card/InvoiceInVat.vue +++ b/src/pages/InvoiceIn/Card/InvoiceInVat.vue @@ -219,9 +219,7 @@ async function addExpense() { :name="actionIcon" :size="actionIcon === 'add' ? 'xs' : 'sm'" :class="['default-icon', { '--add-icon': actionIcon === 'add' }]" - :style="{ - 'font-variation-settings': `'FILL' ${1}`, - }" + :style="fill-icon" > {{ t('Create expense') }} From 09ceefb7c5a0fe8a09e35ef6ef30a8529206a40c Mon Sep 17 00:00:00 2001 From: Jon Date: Wed, 10 Apr 2024 08:49:54 +0200 Subject: [PATCH 12/12] style: refs #7186 fixed style --- src/pages/InvoiceIn/Card/InvoiceInVat.vue | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/pages/InvoiceIn/Card/InvoiceInVat.vue b/src/pages/InvoiceIn/Card/InvoiceInVat.vue index b170cc4b5..5d3e82824 100644 --- a/src/pages/InvoiceIn/Card/InvoiceInVat.vue +++ b/src/pages/InvoiceIn/Card/InvoiceInVat.vue @@ -217,9 +217,8 @@ async function addExpense() { {{ t('Create expense') }} @@ -479,13 +478,8 @@ async function addExpense() { } .default-icon { cursor: pointer; - color: $primary; border-radius: 50px; - - &.--add-icon { - color: var(--vn-text-color); - background-color: $primary; - } + background-color: $primary; }