From 3c6d27a2853bd3afe81302aed60314f103a55130 Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Mon, 4 Mar 2019 12:04:23 +0100 Subject: [PATCH] order sales by concept #1166 --- .../changes/10-ticketGetVisibleAvailable.sql | 36 +++++++++++++++++++ e2e/paths/ticket-module/03_list_sale.spec.js | 8 ++--- front/core/components/td-editable/style.scss | 14 +++++++- .../methods/ticket/specs/getSales.spec.js | 5 ++- modules/ticket/back/methods/ticket/summary.js | 2 +- 5 files changed, 58 insertions(+), 7 deletions(-) create mode 100644 db/install/changes/10-ticketGetVisibleAvailable.sql diff --git a/db/install/changes/10-ticketGetVisibleAvailable.sql b/db/install/changes/10-ticketGetVisibleAvailable.sql new file mode 100644 index 000000000..3d49d98d4 --- /dev/null +++ b/db/install/changes/10-ticketGetVisibleAvailable.sql @@ -0,0 +1,36 @@ +DROP PROCEDURE IF EXISTS vn.ticketGetVisibleAvailable; + +DELIMITER $$ +$$ +CREATE DEFINER=`root`@`%` PROCEDURE `vn`.`ticketGetVisibleAvailable`( + vTicket INT) +BEGIN + DECLARE vVisibleCalc INT; + DECLARE vAvailableCalc INT; + DECLARE vShipped DATE; + DECLARE vWarehouse TINYINT; + DECLARE vAlertLevel INT; + + SELECT t.warehouseFk, t.shipped, ts.alertLevel INTO vWarehouse, vShipped, vAlertLevel + FROM ticket t + LEFT JOIN ticketState ts ON ts.ticketFk = vTicket + WHERE t.id = vTicket; + + IF vAlertLevel IS NULL OR vAlertLevel = 0 THEN + IF vShipped >= CURDATE() THEN + CALL cache.available_refresh(vAvailableCalc, FALSE, vWarehouse, vShipped); + END IF; + IF vShipped = CURDATE() THEN + CALL cache.visible_refresh(vVisibleCalc, FALSE, vWarehouse); + END IF; + END IF; + + SELECT s.id, s.itemFk, s.quantity, s.concept, s.price, s.reserved, s.discount, v.visible, av.available, it.image + FROM sale s + LEFT JOIN cache.visible v ON v.item_id = s.itemFk AND v.calc_id = vVisibleCalc + LEFT JOIN cache.available av ON av.item_id = s.itemFk AND av.calc_id = vAvailableCalc + LEFT JOIN item it ON it.id = s.itemFk + WHERE s.ticketFk = vTicket + ORDER BY s.concept; +END$$ +DELIMITER ; diff --git a/e2e/paths/ticket-module/03_list_sale.spec.js b/e2e/paths/ticket-module/03_list_sale.spec.js index 2813bb988..54d63e26a 100644 --- a/e2e/paths/ticket-module/03_list_sale.spec.js +++ b/e2e/paths/ticket-module/03_list_sale.spec.js @@ -15,21 +15,21 @@ describe('Ticket List sale path', () => { const value = await nightmare .waitToGetProperty(selectors.ticketSales.firstSaleColour, 'innerText'); - expect(value).toContain('Red'); + expect(value).toContain('Yellow'); }); it('should confirm the first ticket sale contains the lenght', async() => { const value = await nightmare .waitToGetProperty(selectors.ticketSales.firstSaleText, 'innerText'); - expect(value).toContain('3'); + expect(value).toContain('5'); }); it('should confirm the first ticket sale contains the price', async() => { const value = await nightmare .waitToGetProperty(selectors.ticketSales.firstSalePrice, 'innerText'); - expect(value).toContain('1.30'); + expect(value).toContain('2.30'); }); it('should confirm the first ticket sale contains the discount', async() => { @@ -43,7 +43,7 @@ describe('Ticket List sale path', () => { const value = await nightmare .waitToGetProperty(selectors.ticketSales.firstSaleImport, 'innerText'); - expect(value).toContain('19.50'); + expect(value).toContain('23'); }); it('should navigate to the catalog by pressing the new item button', async() => { diff --git a/front/core/components/td-editable/style.scss b/front/core/components/td-editable/style.scss index 5fd042980..71162e906 100644 --- a/front/core/components/td-editable/style.scss +++ b/front/core/components/td-editable/style.scss @@ -1,11 +1,23 @@ @import "variables"; vn-td-editable { - cursor: pointer; + text { + cursor: pointer; + display: block + } + outline: none; position: relative; &:not([disabled="true"]) { cursor: initial; + + + text:hover::after { + font-family: 'salixfont'; + float: right; + content: '\e900'; + display: block + } } &.selected > .text { visibility: hidden; diff --git a/modules/ticket/back/methods/ticket/specs/getSales.spec.js b/modules/ticket/back/methods/ticket/specs/getSales.spec.js index da44716cf..a2ea4de3f 100644 --- a/modules/ticket/back/methods/ticket/specs/getSales.spec.js +++ b/modules/ticket/back/methods/ticket/specs/getSales.spec.js @@ -6,6 +6,9 @@ describe('ticket getSales()', () => { expect(sales.length).toEqual(4); expect(sales[0].tags).toBeDefined(); - expect(sales[1].claim).toBeDefined(); + expect(sales[1].tags).toBeDefined(); + expect(sales[2].tags).toBeDefined(); + expect(sales[3].tags).toBeDefined(); + expect(sales[2].claim).toBeDefined(); }); }); diff --git a/modules/ticket/back/methods/ticket/summary.js b/modules/ticket/back/methods/ticket/summary.js index b47d325cd..2b1d8711c 100644 --- a/modules/ticket/back/methods/ticket/summary.js +++ b/modules/ticket/back/methods/ticket/summary.js @@ -113,7 +113,7 @@ module.exports = Self => { where: { ticketFk: ticketFk }, - order: 'itemFk ASC', + order: 'concept', include: [ {relation: 'item'}, {relation: 'claimBeginning'}