From 91b08334607e1e8a820253ad97ffc609a1f9c80a Mon Sep 17 00:00:00 2001 From: jorgep Date: Thu, 20 Feb 2025 10:17:59 +0100 Subject: [PATCH 01/17] fix: refs #8198 handle potential null values in itemBalances computation --- src/pages/Item/Card/ItemDiary.vue | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pages/Item/Card/ItemDiary.vue b/src/pages/Item/Card/ItemDiary.vue index 4b6775183..31b3c328e 100644 --- a/src/pages/Item/Card/ItemDiary.vue +++ b/src/pages/Item/Card/ItemDiary.vue @@ -27,7 +27,7 @@ const user = state.getUser(); const today = Date.vnNew(); today.setHours(0, 0, 0, 0); const warehousesOptions = ref([]); -const itemBalances = computed(() => arrayDataItemBalances.store.data); +const itemBalances = computed(() => arrayDataItemBalances.store.data || []); const where = computed(() => arrayDataItemBalances.store.filter.where || {}); const showWhatsBeforeInventory = ref(false); const inventoriedDate = ref(null); @@ -313,8 +313,8 @@ async function updateWarehouse(warehouseFk) { row.lineFk == row.lastPreparedLineFk ? 'black' : row.balance < 0 - ? 'negative' - : '' + ? 'negative' + : '' " dense style="font-size: 14px" From 64f29e0696b465feee45da34da5954520af0238b Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Thu, 20 Feb 2025 13:37:17 +0100 Subject: [PATCH 02/17] fix: address --- src/pages/Ticket/Card/TicketSummary.vue | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/pages/Ticket/Card/TicketSummary.vue b/src/pages/Ticket/Card/TicketSummary.vue index 999240b7c..8cb518823 100644 --- a/src/pages/Ticket/Card/TicketSummary.vue +++ b/src/pages/Ticket/Card/TicketSummary.vue @@ -45,6 +45,15 @@ const descriptorData = useArrayData('ticketData'); onMounted(async () => { ticketUrl.value = (await getUrl('ticket/')) + entityId.value + '/'; }); +const formattedAddress = computed(() => { + if (!ticket.value) return ''; + + const address = ticket.value.address; + const postcode = address.postalCode; + const province = address.province ? `(${address.province.name})` : ''; + + return `${address.street} - ${postcode} - ${address.city} ${province}`; +}); function isEditable() { try { @@ -237,7 +246,7 @@ onMounted(async () => { /> From a3828ab8692a0aee5f8890348b29dc8d233f325e Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Thu, 20 Feb 2025 21:16:05 +0100 Subject: [PATCH 03/17] fix: handle multiple changes --- src/pages/Ticket/Card/TicketSale.vue | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/pages/Ticket/Card/TicketSale.vue b/src/pages/Ticket/Card/TicketSale.vue index 92936b26a..a083ed316 100644 --- a/src/pages/Ticket/Card/TicketSale.vue +++ b/src/pages/Ticket/Card/TicketSale.vue @@ -174,11 +174,19 @@ const getSaleTotal = (sale) => { return price - discount; }; +const getRowUpdateInputEvents = (sale) => ({ + 'keyup.enter': () => { + changeQuantity(sale); + }, + blur: () => { + changeQuantity(sale); + }, +}); + const resetChanges = async () => { arrayData.fetch({ append: false }); tableRef.value.reload(); }; -const rowToUpdate = ref(null); const changeQuantity = async (sale) => { if ( !sale.itemFk || @@ -196,11 +204,8 @@ const changeQuantity = async (sale) => { const updateQuantity = async (sale) => { try { let { quantity, id } = sale; - if (!rowToUpdate.value) return; - rowToUpdate.value = null; sale.isNew = false; - const params = { quantity: quantity }; - await axios.post(`Sales/${id}/updateQuantity`, params); + await axios.post(`Sales/${id}/updateQuantity`, { quantity }); notify('globals.dataSaved', 'positive'); tableRef.value.reload(); } catch (e) { @@ -816,9 +821,7 @@ watch( v-if="row.isNew || isTicketEditable" type="number" v-model.number="row.quantity" - @blur="changeQuantity(row)" - @keyup.enter.stop="changeQuantity(row)" - @update:model-value="() => (rowToUpdate = row)" + v-on="getRowUpdateInputEvents(row)" @focus="edit.oldQuantity = row.quantity" /> {{ row.quantity }} From e82dc90ff9a91b26d48fb882a7f351dd5d3923f3 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Fri, 21 Feb 2025 09:01:28 +0100 Subject: [PATCH 04/17] fix: ticketSale --- src/pages/Ticket/Card/TicketSale.vue | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/pages/Ticket/Card/TicketSale.vue b/src/pages/Ticket/Card/TicketSale.vue index a083ed316..f5fb50ecf 100644 --- a/src/pages/Ticket/Card/TicketSale.vue +++ b/src/pages/Ticket/Card/TicketSale.vue @@ -188,11 +188,7 @@ const resetChanges = async () => { tableRef.value.reload(); }; const changeQuantity = async (sale) => { - if ( - !sale.itemFk || - sale.quantity == null || - edit.value?.oldQuantity === sale.quantity - ) + if (!sale.itemFk || sale.quantity == null || sale?.originalQuantity === sale.quantity) return; if (!sale.id) return addSale(sale); From 8536ade5b7e13ec4e1d962863ca49fbce218a501 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Fri, 21 Feb 2025 09:01:40 +0100 Subject: [PATCH 05/17] feat: add keyup.enter --- src/pages/Ticket/Card/TicketSaleMoreActions.vue | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/pages/Ticket/Card/TicketSaleMoreActions.vue b/src/pages/Ticket/Card/TicketSaleMoreActions.vue index 4cc96e9e2..8b5537edc 100644 --- a/src/pages/Ticket/Card/TicketSaleMoreActions.vue +++ b/src/pages/Ticket/Card/TicketSaleMoreActions.vue @@ -50,6 +50,7 @@ const { dialog } = useQuasar(); const { notify } = useNotify(); const acl = useAcl(); const btnDropdownRef = ref(null); +const editManaProxyRef = ref(null); const { openConfirmationModal } = useVnConfirm(); const newDiscount = ref(null); @@ -131,13 +132,13 @@ const createClaim = () => { openConfirmationModal( t('Claim out of time'), t('Do you want to continue?'), - onCreateClaimAccepted + onCreateClaimAccepted, ); else openConfirmationModal( t('Do you want to create a claim?'), false, - onCreateClaimAccepted + onCreateClaimAccepted, ); }; @@ -216,8 +217,15 @@ const createRefund = async (withWarehouse) => { {{ t('Update discount') }} - + Date: Fri, 21 Feb 2025 11:38:32 +0100 Subject: [PATCH 06/17] fix: shipped columnFilter --- src/pages/Ticket/TicketList.vue | 44 +++++++++++++++++---------------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/src/pages/Ticket/TicketList.vue b/src/pages/Ticket/TicketList.vue index 8df19c0d9..dfa1a4e14 100644 --- a/src/pages/Ticket/TicketList.vue +++ b/src/pages/Ticket/TicketList.vue @@ -108,13 +108,11 @@ const columns = computed(() => [ }, { align: 'left', - name: 'shippedDate', + name: 'shipped', cardVisible: true, label: t('ticketList.shipped'), columnFilter: { component: 'date', - alias: 't', - inWhere: true, }, format: ({ shippedDate }) => toDate(shippedDate), }, @@ -122,6 +120,12 @@ const columns = computed(() => [ align: 'left', name: 'shipped', label: t('ticketList.hour'), + columnFilter: { + component: 'time', + attrs: { + timeOnly: true, + }, + }, format: (row) => toTimeFormat(row.shipped), }, { @@ -232,7 +236,7 @@ const columns = computed(() => [ function resetAgenciesSelector(formData) { agenciesOptions.value = []; - if(formData) formData.agencyModeId = null; + if (formData) formData.agencyModeId = null; } function redirectToLines(id) { @@ -240,7 +244,7 @@ function redirectToLines(id) { window.open(url, '_blank'); } -const onClientSelected = async (formData) => { +const onClientSelected = async (formData) => { resetAgenciesSelector(formData); await fetchClient(formData); await fetchAddresses(formData); @@ -248,14 +252,12 @@ const onClientSelected = async (formData) => { const fetchAvailableAgencies = async (formData) => { resetAgenciesSelector(formData); - const response= await getAgencies(formData, selectedClient.value); + const response = await getAgencies(formData, selectedClient.value); if (!response) return; - - const { options, agency } = response - if(options) - agenciesOptions.value = options; - if(agency) - formData.agencyModeId = agency; + + const { options, agency } = response; + if (options) agenciesOptions.value = options; + if (agency) formData.agencyModeId = agency; }; const fetchClient = async (formData) => { @@ -330,7 +332,7 @@ function openBalanceDialog(ticket) { const description = ref([]); const firstTicketClientId = checkedTickets[0].clientFk; const isSameClient = checkedTickets.every( - (ticket) => ticket.clientFk === firstTicketClientId + (ticket) => ticket.clientFk === firstTicketClientId, ); if (!isSameClient) { @@ -369,7 +371,7 @@ async function onSubmit() { description: dialogData.value.value.description, clientFk: dialogData.value.value.clientFk, email: email[0].email, - } + }, ); if (data) notify('globals.dataSaved', 'positive'); @@ -388,32 +390,32 @@ function setReference(data) { switch (data) { case 1: newDescription = `${t( - 'ticketList.creditCard' + 'ticketList.creditCard', )}, ${dialogData.value.value.description.replace( /^(Credit Card, |Cash, |Transfers, )/, - '' + '', )}`; break; case 2: newDescription = `${t( - 'ticketList.cash' + 'ticketList.cash', )}, ${dialogData.value.value.description.replace( /^(Credit Card, |Cash, |Transfers, )/, - '' + '', )}`; break; case 3: newDescription = `${newDescription.replace( /^(Credit Card, |Cash, |Transfers, )/, - '' + '', )}`; break; case 4: newDescription = `${t( - 'ticketList.transfers' + 'ticketList.transfers', )}, ${dialogData.value.value.description.replace( /^(Credit Card, |Cash, |Transfers, )/, - '' + '', )}`; break; case 3317: From ef624af3f8ae3c664b79bbce5483396f0c945d36 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Fri, 21 Feb 2025 11:44:07 +0100 Subject: [PATCH 07/17] revert: column time --- src/pages/Ticket/TicketList.vue | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/pages/Ticket/TicketList.vue b/src/pages/Ticket/TicketList.vue index dfa1a4e14..78bebc297 100644 --- a/src/pages/Ticket/TicketList.vue +++ b/src/pages/Ticket/TicketList.vue @@ -120,12 +120,6 @@ const columns = computed(() => [ align: 'left', name: 'shipped', label: t('ticketList.hour'), - columnFilter: { - component: 'time', - attrs: { - timeOnly: true, - }, - }, format: (row) => toTimeFormat(row.shipped), }, { From 680c1f9d9ca1c573f3d41c5446d01130e5c3accc Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Fri, 21 Feb 2025 11:45:41 +0100 Subject: [PATCH 08/17] perf: i18n --- src/pages/Ticket/TicketFilter.vue | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/pages/Ticket/TicketFilter.vue b/src/pages/Ticket/TicketFilter.vue index 4b50892b0..c82c0067f 100644 --- a/src/pages/Ticket/TicketFilter.vue +++ b/src/pages/Ticket/TicketFilter.vue @@ -293,6 +293,7 @@ en: clientFk: Customer orderFk: Order from: From + shipped: Shipped to: To salesPersonFk: Salesperson stateFk: State @@ -320,6 +321,7 @@ es: clientFk: Cliente orderFk: Pedido from: Desde + shipped: F. envĂ­o to: Hasta salesPersonFk: Comercial stateFk: Estado From 24b4d0071a2b9535d1cf9e6985dff50245bf98fc Mon Sep 17 00:00:00 2001 From: pablone Date: Sun, 23 Feb 2025 12:57:57 +0100 Subject: [PATCH 09/17] feat: enhance item tags with data attributes for improved testing --- src/pages/Item/Card/ItemTags.vue | 6 ++- test/cypress/integration/item/itemTag.spec.js | 41 ++++++++++--------- 2 files changed, 27 insertions(+), 20 deletions(-) diff --git a/src/pages/Item/Card/ItemTags.vue b/src/pages/Item/Card/ItemTags.vue index 5876cf8dc..5a7d7f818 100644 --- a/src/pages/Item/Card/ItemTags.vue +++ b/src/pages/Item/Card/ItemTags.vue @@ -87,7 +87,7 @@ const insertTag = (rows) => { tagFk: undefined, }" :default-remove="false" - :filter="{ + :user-filter="{ fields: ['id', 'itemFk', 'tagFk', 'value', 'priority'], where: { itemFk: route.params.id }, include: { @@ -119,6 +119,7 @@ const insertTag = (rows) => { " :required="true" :rules="validate('itemTag.tagFk')" + :data-cy="`tag${row?.tag?.name}`" /> { :label="t('itemTags.value')" :is-clearable="false" @keyup.enter.stop="(data) => itemTagsRef.onSubmit(data)" + :data-cy="`tag${row?.tag?.name}Value`" /> { name="delete" size="sm" dense + :data-cy="`deleteTag${row?.tag?.name}`" > {{ t('itemTags.removeTag') }} @@ -177,6 +180,7 @@ const insertTag = (rows) => { icon="add" shortcut="+" fab + data-cy="createNewTag" > {{ t('itemTags.addTag') }} diff --git a/test/cypress/integration/item/itemTag.spec.js b/test/cypress/integration/item/itemTag.spec.js index 10d68d08a..17423bc51 100644 --- a/test/cypress/integration/item/itemTag.spec.js +++ b/test/cypress/integration/item/itemTag.spec.js @@ -1,33 +1,36 @@ -/// describe('Item tag', () => { beforeEach(() => { cy.viewport(1920, 1080); cy.login('developer'); cy.visit(`/#/item/1/tags`); + cy.get('.q-page').should('be.visible'); + cy.waitForElement('[data-cy="itemTags"]'); }); + const createNewTag = 'createNewTag'; + const saveBtn = 'crudModelDefaultSaveBtn'; + const newTag = 'tagundefined'; + it('should throw an error adding an existent tag', () => { - cy.get('.q-page').should('be.visible'); - cy.get('.q-page-sticky > div').click(); - cy.get('.q-page-sticky > div').click(); - cy.dataCy('Tag_select').eq(7).type('Tallos'); - cy.get('.q-menu .q-item').contains('Tallos').click(); - cy.get(':nth-child(8) > [label="Value"]').type('1'); - +cy.dataCy('crudModelDefaultSaveBtn').click(); - cy.checkNotification("The tag or priority can't be repeated for an item"); + cy.dataCy(createNewTag).click(); + cy.dataCy(newTag).should('be.visible').click().type('Genero{enter}'); + cy.dataCy('tagGeneroValue').eq(1).should('be.visible'); + cy.dataCy(saveBtn).click(); + cy.get('.q-notification__message').should( + 'have.text', + "The tag or priority can't be repeated for an item", + ); }); it('should add a new tag', () => { - cy.get('.q-page').should('be.visible'); - cy.get('.q-page-sticky > div').click(); - cy.get('.q-page-sticky > div').click(); - cy.dataCy('Tag_select').eq(7).click(); - cy.get('.q-menu .q-item').contains('Ancho de la base').type('{enter}'); - cy.get(':nth-child(8) > [label="Value"]').type('50'); - cy.dataCy('crudModelDefaultSaveBtn').click(); + cy.dataCy(createNewTag).click(); + cy.dataCy(newTag).should('be.visible').click().type('Forma{enter}'); + cy.dataCy('tagFormaValue').should('be.visible').type('50'); + cy.dataCy(saveBtn).click(); + cy.checkNotification('Data saved'); - cy.dataCy('itemTags').children(':nth-child(8)').find('.justify-center > .q-icon').click(); - cy.dataCy('VnConfirm_confirm').click(); + cy.dataCy('deleteTagForma').should('be.visible').click(); + cy.dataCy('VnConfirm_confirm').should('be.visible').click(); cy.checkNotification('Data saved'); }); -}); \ No newline at end of file +}); From 3b5c4731f09e16d916f3b4878698c5457d7d45db Mon Sep 17 00:00:00 2001 From: carlossa Date: Mon, 24 Feb 2025 08:20:04 +0100 Subject: [PATCH 10/17] fix: hotfix filters --- src/pages/Customer/CustomerFilter.vue | 2 +- src/pages/Customer/CustomerList.vue | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/pages/Customer/CustomerFilter.vue b/src/pages/Customer/CustomerFilter.vue index eae97d1be..9b883daad 100644 --- a/src/pages/Customer/CustomerFilter.vue +++ b/src/pages/Customer/CustomerFilter.vue @@ -1,4 +1,3 @@ -