From 21eda340a8c5dad2f9b70456cab471aa9e389f3b Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Tue, 26 Nov 2024 22:57:47 +0100 Subject: [PATCH 1/5] fix: #6818 VnLinkPhone using spanish prefix --- src/components/ui/VnLinkPhone.vue | 7 ++++--- src/filters/index.js | 2 ++ src/filters/parsePhone.js | 15 +++++++++++++++ 3 files changed, 21 insertions(+), 3 deletions(-) create mode 100644 src/filters/parsePhone.js diff --git a/src/components/ui/VnLinkPhone.vue b/src/components/ui/VnLinkPhone.vue index 4c045968f..4068498cd 100644 --- a/src/components/ui/VnLinkPhone.vue +++ b/src/components/ui/VnLinkPhone.vue @@ -1,6 +1,7 @@ diff --git a/src/filters/index.js b/src/filters/index.js index ce5c44706..1f7ac77dd 100644 --- a/src/filters/index.js +++ b/src/filters/index.js @@ -12,10 +12,12 @@ import dateRange from './dateRange'; import toHour from './toHour'; import dashOrCurrency from './dashOrCurrency'; import getParamWhere from './getParamWhere'; +import parsePhone from './parsePhone'; import isDialogOpened from './isDialogOpened'; export { isDialogOpened, + parsePhone, toLowerCase, toLowerCamel, toDate, diff --git a/src/filters/parsePhone.js b/src/filters/parsePhone.js new file mode 100644 index 000000000..b2d1ed7b8 --- /dev/null +++ b/src/filters/parsePhone.js @@ -0,0 +1,15 @@ +export default function (phone, prefix = 34) { + if (phone.startsWith('+')) { + console.log('a'); + return `${phone.slice(1)}`; + } + if (phone.startsWith('00')) { + console.log('b'); + return `${phone.slice(2)}`; + } + if (phone.startsWith(prefix) && phone.length === prefix.length + 9) { + console.log('c'); + return `${prefix}${phone.slice(prefix.length)}`; + } + return `${prefix}${phone}`; +} From 1b3500bbce1cdfcf84bb91e11b648beb892a80e1 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Tue, 26 Nov 2024 22:58:36 +0100 Subject: [PATCH 2/5] test: add vitest VnLinkPhone filter --- src/filters/parsePhone.js | 3 -- .../components/common/VnLinkPhone.spec.js | 29 +++++++++++++++++++ 2 files changed, 29 insertions(+), 3 deletions(-) create mode 100644 test/vitest/__tests__/components/common/VnLinkPhone.spec.js diff --git a/src/filters/parsePhone.js b/src/filters/parsePhone.js index b2d1ed7b8..696f55007 100644 --- a/src/filters/parsePhone.js +++ b/src/filters/parsePhone.js @@ -1,14 +1,11 @@ export default function (phone, prefix = 34) { if (phone.startsWith('+')) { - console.log('a'); return `${phone.slice(1)}`; } if (phone.startsWith('00')) { - console.log('b'); return `${phone.slice(2)}`; } if (phone.startsWith(prefix) && phone.length === prefix.length + 9) { - console.log('c'); return `${prefix}${phone.slice(prefix.length)}`; } return `${prefix}${phone}`; diff --git a/test/vitest/__tests__/components/common/VnLinkPhone.spec.js b/test/vitest/__tests__/components/common/VnLinkPhone.spec.js new file mode 100644 index 000000000..1d679d979 --- /dev/null +++ b/test/vitest/__tests__/components/common/VnLinkPhone.spec.js @@ -0,0 +1,29 @@ +import { describe, it, expect } from 'vitest'; +import parsePhone from 'src/filters/parsePhone'; + +describe.only('parsePhone filter', () => { + it("adds prefix +34 if it doesn't have one", () => { + const resultado = parsePhone('123456789', '34'); + expect(resultado).toBe('34123456789'); + }); + + it('maintains prefix +34 if it is already correct', () => { + const resultado = parsePhone('+34123456789', '34'); + expect(resultado).toBe('34123456789'); + }); + + it('converts prefix 0034 to +34', () => { + const resultado = parsePhone('0034123456789', '34'); + expect(resultado).toBe('34123456789'); + }); + + it('converts prefix 34 without symbol to +34', () => { + const resultado = parsePhone('34123456789', '34'); + expect(resultado).toBe('34123456789'); + }); + + it.only('replaces incorrect prefix with the correct one', () => { + const resultado = parsePhone('+44123456789', '34'); + expect(resultado).toBe('44123456789'); + }); +}); From bc0d7f110d0e8e1a77ce4a0e5472b68db9d86e84 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Tue, 26 Nov 2024 23:48:47 +0100 Subject: [PATCH 3/5] fix: apply dataByOrder --- src/pages/Order/OrderList.vue | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pages/Order/OrderList.vue b/src/pages/Order/OrderList.vue index ced3b9b30..c47a9b2ec 100644 --- a/src/pages/Order/OrderList.vue +++ b/src/pages/Order/OrderList.vue @@ -15,6 +15,7 @@ import CustomerDescriptorProxy from '../Customer/Card/CustomerDescriptorProxy.vu import WorkerDescriptorProxy from '../Worker/Card/WorkerDescriptorProxy.vue'; import { toDateTimeFormat } from 'src/filters/date'; import { useRoute } from 'vue-router'; +import dataByOrder from 'src/utils/dataByOrder'; const { t } = useI18n(); const { viewSummary } = useSummaryDialog(); @@ -167,7 +168,7 @@ async function fetchAgencies({ landed, addressId }) { const { data } = await axios.get('Agencies/landsThatDay', { params: { addressFk: addressId, landed }, }); - agencyList.value = data; + agencyList.value = dataByOrder(data, 'agencyMode ASC'); } const getDateColor = (date) => { From ff91ca2dfe6699ae40a6d17867baf18364280f40 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Tue, 26 Nov 2024 23:57:10 +0100 Subject: [PATCH 4/5] feat: remove More options separator --- src/i18n/locale/en.yml | 1 - src/pages/Customer/CustomerFilter.vue | 69 +++++----- src/pages/InvoiceIn/InvoiceInFilter.vue | 1 - src/pages/InvoiceOut/InvoiceOutFilter.vue | 54 ++++---- src/pages/Ticket/TicketFilter.vue | 148 +++++++++++----------- 5 files changed, 128 insertions(+), 145 deletions(-) diff --git a/src/i18n/locale/en.yml b/src/i18n/locale/en.yml index e2e0e4238..3e3df7a0f 100644 --- a/src/i18n/locale/en.yml +++ b/src/i18n/locale/en.yml @@ -861,7 +861,6 @@ components: cardDescriptor: mainList: Main list summary: Summary - moreOptions: More options leftMenu: addToPinned: Add to pinned removeFromPinned: Remove from pinned diff --git a/src/pages/Customer/CustomerFilter.vue b/src/pages/Customer/CustomerFilter.vue index 79d48a667..cd567d415 100644 --- a/src/pages/Customer/CustomerFilter.vue +++ b/src/pages/Customer/CustomerFilter.vue @@ -101,8 +101,8 @@ const exprBuilder = (param, value) => { - + { /> - + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + { outlined rounded auto-load + /> + + + + - - - - - - - + + @@ -203,7 +201,6 @@ es: Salesperson: Comercial Province: Provincia City: Ciudad - More options: Más opciones Phone: Teléfono Email: Email Zone: Zona diff --git a/src/pages/InvoiceIn/InvoiceInFilter.vue b/src/pages/InvoiceIn/InvoiceInFilter.vue index d1c0856b5..130a77960 100644 --- a/src/pages/InvoiceIn/InvoiceInFilter.vue +++ b/src/pages/InvoiceIn/InvoiceInFilter.vue @@ -184,5 +184,4 @@ es: Amount: Importe Issued: Fecha factura Id or supplier: Id o proveedor - More options: Más opciones diff --git a/src/pages/InvoiceOut/InvoiceOutFilter.vue b/src/pages/InvoiceOut/InvoiceOutFilter.vue index 9ce8cc254..dc1d833a2 100644 --- a/src/pages/InvoiceOut/InvoiceOutFilter.vue +++ b/src/pages/InvoiceOut/InvoiceOutFilter.vue @@ -83,36 +83,29 @@ const states = ref(); /> - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + @@ -149,5 +142,4 @@ es: Issued: Fecha emisión Created: Fecha creación Dued: Fecha vencimiento - More options: Más opciones diff --git a/src/pages/Ticket/TicketFilter.vue b/src/pages/Ticket/TicketFilter.vue index 6f1cac83b..bde27f30e 100644 --- a/src/pages/Ticket/TicketFilter.vue +++ b/src/pages/Ticket/TicketFilter.vue @@ -212,81 +212,78 @@ const getGroupedStates = (data) => { /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -340,7 +337,6 @@ es: With problems: Con problemas Invoiced: Facturado Routed: Enrutado - More options: Más opciones Province: Provincia Agency: Agencia Warehouse: Almacén From 72a481ae5b4aed6768b7db6be2fdbb3c7520093b Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Wed, 27 Nov 2024 01:30:42 +0100 Subject: [PATCH 5/5] test: remove only --- test/vitest/__tests__/components/common/VnLinkPhone.spec.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/vitest/__tests__/components/common/VnLinkPhone.spec.js b/test/vitest/__tests__/components/common/VnLinkPhone.spec.js index 1d679d979..e460ab2fc 100644 --- a/test/vitest/__tests__/components/common/VnLinkPhone.spec.js +++ b/test/vitest/__tests__/components/common/VnLinkPhone.spec.js @@ -1,7 +1,7 @@ import { describe, it, expect } from 'vitest'; import parsePhone from 'src/filters/parsePhone'; -describe.only('parsePhone filter', () => { +describe('parsePhone filter', () => { it("adds prefix +34 if it doesn't have one", () => { const resultado = parsePhone('123456789', '34'); expect(resultado).toBe('34123456789'); @@ -22,7 +22,7 @@ describe.only('parsePhone filter', () => { expect(resultado).toBe('34123456789'); }); - it.only('replaces incorrect prefix with the correct one', () => { + it('replaces incorrect prefix with the correct one', () => { const resultado = parsePhone('+44123456789', '34'); expect(resultado).toBe('44123456789'); });