From df073cce2ff1af05cc8afa0c6f27adaeb6c2c383 Mon Sep 17 00:00:00 2001 From: jgallego Date: Wed, 19 May 2021 17:04:13 +0200 Subject: [PATCH 1/2] refactor tod usa get sales --- modules/ticket/back/methods/ticket/summary.js | 16 +--------------- modules/ticket/front/summary/index.html | 11 +++++------ 2 files changed, 6 insertions(+), 21 deletions(-) diff --git a/modules/ticket/back/methods/ticket/summary.js b/modules/ticket/back/methods/ticket/summary.js index 08de35482..760a71e2b 100644 --- a/modules/ticket/back/methods/ticket/summary.js +++ b/modules/ticket/back/methods/ticket/summary.js @@ -22,7 +22,7 @@ module.exports = Self => { Self.summary = async ticketFk => { let models = Self.app.models; let summaryObj = await getTicketData(Self, ticketFk); - summaryObj.sales = await getSales(models.Sale, ticketFk); + summaryObj.sales = await models.Ticket.getSales(ticketFk); summaryObj.packagings = await models.TicketPackaging.find({ where: {ticketFk: ticketFk}, include: [{relation: 'packaging', @@ -102,20 +102,6 @@ module.exports = Self => { return await Self.findOne(filter); } - async function getSales(Sale, ticketFk) { - let filter = { - where: { - ticketFk: ticketFk - }, - order: 'concept', - include: [ - {relation: 'item'}, - {relation: 'claimBeginning'} - ] - }; - return await Sale.find(filter); - } - async function getRequests(Self, ticketFk) { let filter = { where: { diff --git a/modules/ticket/front/summary/index.html b/modules/ticket/front/summary/index.html index 6c25f2665..1441024ba 100644 --- a/modules/ticket/front/summary/index.html +++ b/modules/ticket/front/summary/index.html @@ -120,6 +120,7 @@ Item + Available Quantity Description Price @@ -137,12 +138,6 @@ vn-tooltip="{{::$ctrl.$t('Claim')}}: {{::sale.claimBeginning.claimFk}}"> - - @@ -152,6 +147,10 @@ {{sale.itemFk | zeroFill:6}} + + {{::sale.available}} + + {{::sale.quantity}} {{::sale.item.name}} From b7bcb4bd176875fd1ea0c116d4f0fa20a8f1a2cd Mon Sep 17 00:00:00 2001 From: jgallego Date: Wed, 19 May 2021 19:15:47 +0200 Subject: [PATCH 2/2] selectores --- e2e/helpers/selectors.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 69425a1b7..143196d18 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -461,8 +461,8 @@ export default { itemDescriptorPopover: '.vn-popover.shown vn-item-descriptor', itemDescriptorPopoverItemDiaryButton: 'vn-item-descriptor a[href="#!/item/2/diary?warehouseFk=5&lineFk=16"]', popoverDiaryButton: '.vn-popover.shown vn-item-descriptor vn-icon[icon="icon-transaction"]', - firstSaleQuantity: 'vn-ticket-summary [name="sales"] vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(3)', - firstSaleDiscount: 'vn-ticket-summary [name="sales"] vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(6)', + firstSaleQuantity: 'vn-ticket-summary [name="sales"] vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(4)', + firstSaleDiscount: 'vn-ticket-summary [name="sales"] vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(7)', invoiceOutRef: 'vn-ticket-summary > vn-card > vn-horizontal > vn-one:nth-child(1) > vn-label-value:nth-child(7) > section > span', setOk: 'vn-ticket-summary vn-button[label="SET OK"] > button', descriptorTicketId: 'vn-ticket-descriptor > vn-descriptor-content > div > div.body > div.top > div'