From bbd41886958d55942f4a39a67e2d18524353bd35 Mon Sep 17 00:00:00 2001 From: Bernat Date: Wed, 13 Feb 2019 13:19:15 +0100 Subject: [PATCH 01/16] #9848 fix test and update fixtures --- .../order-row/specs/addToOrder.spec.js | 12 +- .../methods/ticket/specs/getSales.spec.js | 2 +- .../changes/1.2-CHECK/02-orderAddItem.sql | 108 +++++++++++ services/db/install/dump/fixtures.sql | 182 +++++++++--------- 4 files changed, 206 insertions(+), 98 deletions(-) create mode 100644 services/db/install/changes/1.2-CHECK/02-orderAddItem.sql diff --git a/modules/order/back/methods/order-row/specs/addToOrder.spec.js b/modules/order/back/methods/order-row/specs/addToOrder.spec.js index e938cb859..13dfe26fb 100644 --- a/modules/order/back/methods/order-row/specs/addToOrder.spec.js +++ b/modules/order/back/methods/order-row/specs/addToOrder.spec.js @@ -3,16 +3,16 @@ const app = require('vn-loopback/server/server'); describe('order addToOrder()', () => { let rowToDelete; afterAll(async() => { - await app.models.OrderRow.removes({rows: [rowToDelete], actualOrderId: 16}); + await app.models.OrderRow.removes({rows: [rowToDelete], actualOrderId: 20}); }); it('should add a row to a given order', async() => { - let unmodifiedRows = await app.models.OrderRow.find({where: {orderFk: 16}}); + let unmodifiedRows = await app.models.OrderRow.find({where: {orderFk: 20}}); - expect(unmodifiedRows.length).toBe(4); + expect(unmodifiedRows.length).toBe(1); let params = { - orderFk: 16, + orderFk: 20, items: [{ itemFk: 1, quantity: 1, @@ -22,10 +22,10 @@ describe('order addToOrder()', () => { await app.models.OrderRow.addToOrder(params); - let modifiedRows = await app.models.OrderRow.find({where: {orderFk: 16}}); + let modifiedRows = await app.models.OrderRow.find({where: {orderFk: 20}}); rowToDelete = modifiedRows[modifiedRows.length - 1].id; - expect(modifiedRows.length).toBe(5); + expect(modifiedRows.length).toBe(2); }); }); diff --git a/modules/ticket/back/methods/ticket/specs/getSales.spec.js b/modules/ticket/back/methods/ticket/specs/getSales.spec.js index 121b02195..da44716cf 100644 --- a/modules/ticket/back/methods/ticket/specs/getSales.spec.js +++ b/modules/ticket/back/methods/ticket/specs/getSales.spec.js @@ -1,7 +1,7 @@ const app = require('vn-loopback/server/server'); describe('ticket getSales()', () => { - it('should return the sales of a ticket', async () => { + it('should return the sales of a ticket', async() => { let sales = await app.models.Ticket.getSales(16); expect(sales.length).toEqual(4); diff --git a/services/db/install/changes/1.2-CHECK/02-orderAddItem.sql b/services/db/install/changes/1.2-CHECK/02-orderAddItem.sql new file mode 100644 index 000000000..35bee1117 --- /dev/null +++ b/services/db/install/changes/1.2-CHECK/02-orderAddItem.sql @@ -0,0 +1,108 @@ +USE `hedera`; +DROP procedure IF EXISTS `orderAddItem`; + +DELIMITER $$ +USE `hedera`$$ +CREATE DEFINER=`root`@`%` PROCEDURE `orderAddItem`(IN `vOrder` INT, IN `vWarehouse` INT, IN `vItem` INT, IN `vAmount` INT) +BEGIN + DECLARE vRow INT; + DECLARE vAdd INT; + DECLARE vAvailable INT; + DECLARE vDone BOOL; + DECLARE vGrouping INT; + DECLARE vRate INT; + DECLARE vShipment DATE; + DECLARE vPrice DECIMAL(10,2); + DECLARE vDate DATE; + DECLARE vAddress INT; + DECLARE vAgencyMode INT; + DECLARE cur CURSOR FOR + SELECT grouping, price, rate + FROM tmp.bionic_price + WHERE warehouse_id = vWarehouse + AND item_id = vItem + ORDER BY grouping DESC; + + DECLARE CONTINUE HANDLER FOR NOT FOUND + SET vDone = TRUE; + + DECLARE EXIT HANDLER FOR SQLEXCEPTION + BEGIN + ROLLBACK; + RESIGNAL; + END; + + SELECT date_send, address_id, agency_id + INTO vDate, vAddress, vAgencyMode + FROM `order` + WHERE id = vOrder; + + CALL vn2008.bionic_from_item(vDate, vAddress, vAgencyMode, vItem); + + START TRANSACTION; + + SELECT shipped INTO vShipment + FROM tmp.travel_tree + WHERE warehouseFk = vWarehouse; + + SELECT available INTO vAvailable + FROM tmp.bionic_lot + WHERE warehouse_id = vWarehouse + AND item_id = vItem; + + IF vAmount > IFNULL(vAvailable, 0) + THEN + CALL util.throw ('ORDER_ROW_UNAVAILABLE'); + END IF; + + OPEN cur; + + l: LOOP + SET vDone = FALSE; + FETCH cur INTO vGrouping, vPrice, vRate; + + IF vDone THEN + LEAVE l; + END IF; + + SET vAdd = vAmount - MOD(vAmount, vGrouping); + SET vAmount = vAmount - vAdd; + + IF vAdd = 0 THEN + ITERATE l; + END IF; + + INSERT INTO order_row SET + order_id = vOrder, + item_id = vItem, + warehouse_id = vWarehouse, + shipment = vShipment, + rate = vRate, + amount = vAdd, + price = vPrice; + + SET vRow = LAST_INSERT_ID(); + + INSERT INTO order_component (order_row_id, component_id, price) + SELECT vRow, c.component_id, c.cost + FROM tmp.bionic_component c + JOIN bi.tarifa_componentes t + ON t.Id_Componente = c.component_id + AND (t.tarifa_class IS NULL OR t.tarifa_class = vRate) + WHERE c.warehouse_id = vWarehouse + AND c.item_id = vItem; + END LOOP; + + CLOSE cur; + + IF vAmount > 0 + THEN + CALL util.throw ('AMOUNT_NOT_MATCH_GROUPING'); + END IF; + + COMMIT; + CALL vn2008.bionic_free (); +END$$ + +DELIMITER ; + diff --git a/services/db/install/dump/fixtures.sql b/services/db/install/dump/fixtures.sql index 8ebe1bab9..d0ca86a36 100644 --- a/services/db/install/dump/fixtures.sql +++ b/services/db/install/dump/fixtures.sql @@ -860,103 +860,109 @@ INSERT INTO `vn`.`deliveryMethod`(`id`, `code`, `description`) INSERT INTO `hedera`.`order`(`id`, `date_send`, `customer_id`, `delivery_method_id`, `agency_id`, `address_id`, `company_id`, `note`, `source_app`, `confirmed`, `date_make`, `first_row_stamp`, `confirm_date`) VALUES - (1 , DATE_ADD(CURDATE(), INTERVAL -15 DAY) , 101, 1, 1, 121, 442, NULL, 'TPV', 1, DATE_ADD(CURDATE(), INTERVAL -15 DAY) , DATE_ADD(CURDATE(), INTERVAL -15 DAY) , DATE_ADD(CURDATE(), INTERVAL -15 DAY) ), - (2 , DATE_ADD(CURDATE(), INTERVAL -10 DAY) , 101, 2, 1, 121, 442, NULL, 'WEB', 1, DATE_ADD(CURDATE(), INTERVAL -10 DAY) , DATE_ADD(CURDATE(), INTERVAL -10 DAY) , DATE_ADD(CURDATE(), INTERVAL -10 DAY) ), - (3 , DATE_ADD(CURDATE(), INTERVAL -5 DAY) , 102, 3, 2, 122, 442, NULL, 'ANDROID', 1, DATE_ADD(CURDATE(), INTERVAL -5 DAY) , DATE_ADD(CURDATE(), INTERVAL -5 DAY) , DATE_ADD(CURDATE(), INTERVAL -5 DAY) ), - (4 , DATE_ADD(CURDATE(), INTERVAL -4 DAY) , 102, 1, 2, 122, 442, NULL, 'SALIX', 1, DATE_ADD(CURDATE(), INTERVAL -4 DAY) , DATE_ADD(CURDATE(), INTERVAL -4 DAY) , DATE_ADD(CURDATE(), INTERVAL -4 DAY) ), - (5 , DATE_ADD(CURDATE(), INTERVAL -3 DAY) , 103, 2, 3, 123, 442, NULL, 'SALIX', 1, DATE_ADD(CURDATE(), INTERVAL -3 DAY) , DATE_ADD(CURDATE(), INTERVAL -3 DAY) , DATE_ADD(CURDATE(), INTERVAL -3 DAY) ), - (6 , DATE_ADD(CURDATE(), INTERVAL -2 DAY) , 103, 3, 3, 123, 442, NULL, 'SALIX', 1, DATE_ADD(CURDATE(), INTERVAL -2 DAY) , DATE_ADD(CURDATE(), INTERVAL -2 DAY) , DATE_ADD(CURDATE(), INTERVAL -2 DAY) ), - (7 , DATE_ADD(CURDATE(), INTERVAL -1 DAY) , 104, 1, 4, 124, 442, NULL, 'SALIX', 1, DATE_ADD(CURDATE(), INTERVAL -1 DAY) , DATE_ADD(CURDATE(), INTERVAL -1 DAY) , DATE_ADD(CURDATE(), INTERVAL -1 DAY) ), + (1 , DATE_ADD(CURDATE(), INTERVAL -15 DAY), 101, 1, 1, 121, 442, NULL, 'TPV', 1, DATE_ADD(CURDATE(), INTERVAL -15 DAY) , DATE_ADD(CURDATE(), INTERVAL -15 DAY) , DATE_ADD(CURDATE(), INTERVAL -15 DAY) ), + (2 , DATE_ADD(CURDATE(), INTERVAL -10 DAY), 101, 2, 1, 121, 442, NULL, 'WEB', 1, DATE_ADD(CURDATE(), INTERVAL -10 DAY) , DATE_ADD(CURDATE(), INTERVAL -10 DAY) , DATE_ADD(CURDATE(), INTERVAL -10 DAY) ), + (3 , DATE_ADD(CURDATE(), INTERVAL -5 DAY), 102, 3, 2, 122, 442, NULL, 'ANDROID', 1, DATE_ADD(CURDATE(), INTERVAL -5 DAY) , DATE_ADD(CURDATE(), INTERVAL -5 DAY) , DATE_ADD(CURDATE(), INTERVAL -5 DAY) ), + (4 , DATE_ADD(CURDATE(), INTERVAL -4 DAY), 102, 1, 2, 122, 442, NULL, 'SALIX', 1, DATE_ADD(CURDATE(), INTERVAL -4 DAY) , DATE_ADD(CURDATE(), INTERVAL -4 DAY) , DATE_ADD(CURDATE(), INTERVAL -4 DAY) ), + (5 , DATE_ADD(CURDATE(), INTERVAL -3 DAY), 103, 2, 3, 123, 442, NULL, 'SALIX', 1, DATE_ADD(CURDATE(), INTERVAL -3 DAY) , DATE_ADD(CURDATE(), INTERVAL -3 DAY) , DATE_ADD(CURDATE(), INTERVAL -3 DAY) ), + (6 , DATE_ADD(CURDATE(), INTERVAL -2 DAY), 103, 3, 3, 123, 442, NULL, 'SALIX', 1, DATE_ADD(CURDATE(), INTERVAL -2 DAY) , DATE_ADD(CURDATE(), INTERVAL -2 DAY) , DATE_ADD(CURDATE(), INTERVAL -2 DAY) ), + (7 , DATE_ADD(CURDATE(), INTERVAL -1 DAY), 104, 1, 4, 124, 442, NULL, 'SALIX', 1, DATE_ADD(CURDATE(), INTERVAL -1 DAY) , DATE_ADD(CURDATE(), INTERVAL -1 DAY) , DATE_ADD(CURDATE(), INTERVAL -1 DAY) ), (8 , DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 104, 2, 4, 124, 442, NULL, 'SALIX', 1, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH)), (9 , DATE_ADD(CURDATE(), INTERVAL -2 MONTH), 105, 3, 5, 125, 442, NULL, 'SALIX', 1, DATE_ADD(CURDATE(), INTERVAL -2 MONTH), DATE_ADD(CURDATE(), INTERVAL -2 MONTH), DATE_ADD(CURDATE(), INTERVAL -2 MONTH)), (10, DATE_ADD(CURDATE(), INTERVAL -3 MONTH), 105, 1, 6, 125, 442, NULL, 'SALIX', 1, DATE_ADD(CURDATE(), INTERVAL -3 MONTH), DATE_ADD(CURDATE(), INTERVAL -3 MONTH), DATE_ADD(CURDATE(), INTERVAL -3 MONTH)), - (11, CURDATE() , 101, 2, 7, 121, 442, NULL, 'SALIX', 1, CURDATE() , CURDATE() , CURDATE() ), + (11, CURDATE(), 101, 2, 7, 121, 442, NULL, 'SALIX', 1, CURDATE() , CURDATE() , CURDATE() ), (12, DATE_ADD(CURDATE(), INTERVAL +1 MONTH), 101, 3, 1, 121, 442, NULL, 'SALIX', 1, DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(CURDATE(), INTERVAL +1 MONTH)), (13, DATE_ADD(CURDATE(), INTERVAL +2 MONTH), 101, 1, 2, 121, 442, NULL, 'SALIX', 1, DATE_ADD(CURDATE(), INTERVAL +2 MONTH), DATE_ADD(CURDATE(), INTERVAL +2 MONTH), DATE_ADD(CURDATE(), INTERVAL +2 MONTH)), (14, DATE_ADD(CURDATE(), INTERVAL +3 MONTH), 101, 2, 2, 121, 442, NULL, 'SALIX', 1, DATE_ADD(CURDATE(), INTERVAL +3 MONTH), DATE_ADD(CURDATE(), INTERVAL +3 MONTH), DATE_ADD(CURDATE(), INTERVAL +3 MONTH)), (15, DATE_ADD(CURDATE(), INTERVAL +4 MONTH), 101, 3, 3, 121, 442, NULL, 'SALIX', 1, DATE_ADD(CURDATE(), INTERVAL +4 MONTH), DATE_ADD(CURDATE(), INTERVAL +4 MONTH), DATE_ADD(CURDATE(), INTERVAL +4 MONTH)), - (16, DATE_ADD(CURDATE(), INTERVAL +4 DAY) , 101, 1, 1, 121, 442, NULL, 'SALIX', 0, CURDATE() , CURDATE() , CURDATE() ), - (17, CURDATE() , 106, 2, 4, 126, 442, NULL, 'SALIX', 0, CURDATE() , CURDATE() , CURDATE() ), - (18, CURDATE() , 107, 3, 4, 127, 442, NULL, 'SALIX', 0, CURDATE() , CURDATE() , CURDATE() ), - (19, CURDATE() , 108, 1, 5, 128, 442, NULL, 'SALIX', 0, CURDATE() , CURDATE() , CURDATE() ), - (20, CURDATE() , 109, 2, 5, 119, 442, NULL, 'SALIX', 0, CURDATE() , CURDATE() , CURDATE() ), - (21, CURDATE() , 110, 3, 5, 129, 442, NULL, 'SALIX', 0, CURDATE() , CURDATE() , CURDATE() ); + (16, DATE_ADD(CURDATE(), INTERVAL +4 DAY), 101, 1, 1, 121, 442, NULL, 'SALIX', 0, CURDATE() , CURDATE() , CURDATE() ), + (17, CURDATE(), 106, 2, 4, 126, 442, NULL, 'SALIX', 0, CURDATE() , CURDATE() , CURDATE() ), + (18, CURDATE(), 107, 3, 4, 127, 442, NULL, 'SALIX', 0, CURDATE() , CURDATE() , CURDATE() ), + (19, CURDATE(), 108, 1, 5, 128, 442, NULL, 'SALIX', 0, CURDATE() , CURDATE() , CURDATE() ), + (20, CURDATE(), 109, 2, 1, 119, 442, NULL, 'SALIX', 0, CURDATE() , CURDATE() , CURDATE() ), + (21, CURDATE(), 110, 3, 5, 129, 442, NULL, 'SALIX', 0, CURDATE() , CURDATE() , CURDATE() ); INSERT INTO `hedera`.`orderRow`(`id`, `orderFk`, `itemFk`, `warehouseFk`, `shipment`, `amount`, `price`, `rate`, `created`, `saleFk`) VALUES - ( 1, 1, 1, 1, DATE_ADD(CURDATE(), INTERVAL -15 DAY), 5, 9.10, 0, DATE_ADD(CURDATE(), INTERVAL -15 DAY), 1), - ( 2, 1, 2, 1, DATE_ADD(CURDATE(), INTERVAL -15 DAY), 10, 1.07, 0, DATE_ADD(CURDATE(), INTERVAL -15 DAY), 2), - ( 3, 1, 1, 1, DATE_ADD(CURDATE(), INTERVAL -15 DAY), 2, 9.10, 0, DATE_ADD(CURDATE(), INTERVAL -15 DAY), 3), - ( 4, 1, 4, 1, DATE_ADD(CURDATE(), INTERVAL -15 DAY), 20, 3.06, 0, DATE_ADD(CURDATE(), INTERVAL -15 DAY), 4), - ( 5, 2, 1, 1, DATE_ADD(CURDATE(), INTERVAL -10 DAY), 10, 9.10, 0, DATE_ADD(CURDATE(), INTERVAL -10 DAY), 5), - ( 6, 3, 1, 2, DATE_ADD(CURDATE(), INTERVAL -5 DAY), 15, 6.50, 0, DATE_ADD(CURDATE(), INTERVAL -5 DAY), 6), - ( 7, 11, 2, 1, CURDATE(), 15, 1.30, 0, CURDATE(), 7), - ( 8, 11, 4, 1, CURDATE(), 10, 3.26, 0, CURDATE(), 8), - ( 9, 16, 1, 1, CURDATE(), 5, 9.10, 0, CURDATE(), 9), - ( 10, 16, 2, 1, CURDATE(), 10, 1.07, 0, CURDATE(), 10), - ( 11, 16, 1, 1, CURDATE(), 2, 9.10, 0, CURDATE(), 11), - ( 12, 16, 4, 1, CURDATE(), 20, 3.06, 0, CURDATE(), 12); + (1, 1, 1, 1, DATE_ADD(CURDATE(), INTERVAL -15 DAY), 5, 9.10, 0, DATE_ADD(CURDATE(), INTERVAL -15 DAY), 1), + (2, 1, 2, 1, DATE_ADD(CURDATE(), INTERVAL -15 DAY), 10, 1.07, 0, DATE_ADD(CURDATE(), INTERVAL -15 DAY), 2), + (3, 1, 1, 1, DATE_ADD(CURDATE(), INTERVAL -15 DAY), 2, 9.10, 0, DATE_ADD(CURDATE(), INTERVAL -15 DAY), 3), + (4, 1, 4, 1, DATE_ADD(CURDATE(), INTERVAL -15 DAY), 20, 3.06, 0, DATE_ADD(CURDATE(), INTERVAL -15 DAY), 4), + (5, 2, 1, 1, DATE_ADD(CURDATE(), INTERVAL -10 DAY), 10, 9.10, 0, DATE_ADD(CURDATE(), INTERVAL -10 DAY), 5), + (6, 3, 1, 2, DATE_ADD(CURDATE(), INTERVAL -5 DAY), 15, 6.50, 0, DATE_ADD(CURDATE(), INTERVAL -5 DAY), 6), + (7, 11, 2, 1, CURDATE(), 15, 1.30, 0, CURDATE(), 7), + (8, 11, 4, 1, CURDATE(), 10, 3.26, 0, CURDATE(), 8), + (9, 16, 1, 1, CURDATE(), 5, 9.10, 0, CURDATE(), 9), + (10, 16, 2, 1, CURDATE(), 10, 1.07, 0, CURDATE(), 10), + (11, 16, 1, 1, CURDATE(), 2, 9.10, 0, CURDATE(), 11), + (12, 16, 4, 1, CURDATE(), 20, 3.06, 0, CURDATE(), 12), + (13, 20, 1, 1, CURDATE(), 2, 9.10, 0, CURDATE(), NULL); INSERT INTO `hedera`.`orderRowComponent`(`rowFk`, `componentFk`, `price`) VALUES - ( 1, 15, 0.58), - ( 1, 23, 6.5), - ( 1, 28, 20.72), - ( 1, 29, -18.72), - ( 1, 39, 0.02), - ( 2, 15, 0.058), - ( 2, 21, 0.002), - ( 2, 28, 5.6), - ( 2, 29, -4.6), - ( 2, 39, 0.01), - ( 3, 15, 0.58), - ( 3, 23, 6.5), - ( 3, 28, 20.72), - ( 3, 29, -18.72), - ( 3, 39, 0.02), - ( 4, 15, 0.051), - ( 4, 21, -0.001), - ( 4, 28, 20.72), - ( 4, 29, -19.72), - ( 4, 37, 2), - ( 4, 39, 0.01), - ( 5, 15, 0.58), - ( 5, 23, 6.5), - ( 5, 28, 20.72), - ( 5, 29, -18.72), - ( 5, 39, 0.02), - ( 6, 23, 6.5), - ( 7, 15, 0.29), - ( 7, 28, 5.6), - ( 7, 29, -4.6), - ( 7, 39, 0.01), - ( 8, 15, 0.254), - ( 8, 21, -0.004), - ( 8, 28, 20.72), - ( 8, 29, -19.72), - ( 8, 37, 2), - ( 8, 39, 0.01), - ( 9, 15, 0.58), - ( 9, 23, 6.5), - ( 9, 28, 20.72), - ( 9, 29, -18.72), - ( 9, 39, 0.02), - ( 10, 15, 0.058), - ( 10, 21, 0.002), - ( 10, 28, 5.6), - ( 10, 29, -4.6), - ( 10, 39, 0.01), - ( 11, 15, 0.58), - ( 11, 23, 6.5), - ( 11, 28, 20.72), - ( 11, 29, -18.72), - ( 11, 39, 0.02), - ( 12, 15, 0.051), - ( 12, 22, -0.001), - ( 12, 28, 20.72), - ( 12, 29, -19.72), - ( 12, 37, 2), - ( 12, 39, 0.01); + (1, 15, 0.58), + (1, 23, 6.5), + (1, 28, 20.72), + (1, 29, -18.72), + (1, 39, 0.02), + (2, 15, 0.058), + (2, 21, 0.002), + (2, 28, 5.6), + (2, 29, -4.6), + (2, 39, 0.01), + (3, 15, 0.58), + (3, 23, 6.5), + (3, 28, 20.72), + (3, 29, -18.72), + (3, 39, 0.02), + (4, 15, 0.051), + (4, 21, -0.001), + (4, 28, 20.72), + (4, 29, -19.72), + (4, 37, 2), + (4, 39, 0.01), + (5, 15, 0.58), + (5, 23, 6.5), + (5, 28, 20.72), + (5, 29, -18.72), + (5, 39, 0.02), + (6, 23, 6.5), + (7, 15, 0.29), + (7, 28, 5.6), + (7, 29, -4.6), + (7, 39, 0.01), + (8, 15, 0.254), + (8, 21, -0.004), + (8, 28, 20.72), + (8, 29, -19.72), + (8, 37, 2), + (8, 39, 0.01), + (9, 15, 0.58), + (9, 23, 6.5), + (9, 28, 20.72), + (9, 29, -18.72), + (9, 39, 0.02), + (10, 15, 0.058), + (10, 21, 0.002), + (10, 28, 5.6), + (10, 29, -4.6), + (10, 39, 0.01), + (11, 15, 0.58), + (11, 23, 6.5), + (11, 28, 20.72), + (11, 29, -18.72), + (11, 39, 0.02), + (12, 15, 0.051), + (12, 22, -0.001), + (12, 28, 20.72), + (12, 29, -19.72), + (12, 37, 2), + (12, 39, 0.01), + (13, 15, 0.58), + (13, 23, 6.5), + (13, 28, 20.72), + (13, 29, -18.72), + (13, 39, 0.02); INSERT INTO `vn`.`clientContact`(`id`, `clientFk`, `name`, `phone`) VALUES @@ -1042,13 +1048,7 @@ INSERT INTO `vn`.`orderTicket`(`orderFk`, `ticketFk`) (12, 12), (13, 13), (14, 14), - (15, 15), - (16, 16), - (17, 17), - (18, 18), - (19, 19), - (20, 20), - (21, 21); + (15, 15); INSERT INTO `vn`.`userConfig` (`userFk`, `warehouseFk`, `companyFk`) VALUES From 1f759b6b8c590378e19fcff6c1b0047787dbe982 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Wed, 13 Feb 2019 14:01:37 +0100 Subject: [PATCH 02/16] Style fixes --- Jenkinsfile | 21 +++--- front/core/components/dialog/style.scss | 2 +- .../components/icon-button/icon-button.js | 2 +- front/core/components/icon-button/style.scss | 16 +++-- front/core/components/table/style.scss | 70 ++++++++++--------- front/salix/components/home/style.scss | 4 +- front/salix/components/main-menu/style.scss | 3 +- front/salix/components/topbar/style.scss | 2 +- front/salix/styles/descriptor.scss | 3 +- front/salix/styles/misc.scss | 12 ++-- front/salix/styles/summary.scss | 2 +- front/salix/styles/variables.scss | 8 ++- gulpfile.js | 2 +- modules/client/front/index/index.html | 4 +- modules/item/front/index/style.scss | 2 +- modules/item/front/last-entries/style.scss | 14 ++-- modules/item/front/summary/style.scss | 2 +- .../item/front/ticket-descriptor/style.scss | 25 +++---- modules/ticket/front/index/index.html | 2 +- modules/ticket/front/index/style.scss | 47 ++----------- modules/ticket/front/sale/style.scss | 24 +++---- 21 files changed, 126 insertions(+), 141 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index e1215375e..234abd8dd 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -15,7 +15,7 @@ pipeline { stage('Checkout') { steps { script { - env.COMPOSE_PROJECT_NAME = env.JOB_NAME.replace('/', '-'); + env.COMPOSE_PROJECT_NAME = env.JOB_NAME.replace('/', '-') env.GIT_COMMITTER_EMAIL = sh( script: 'git --no-pager show -s --format="%ae"', returnStdout: true @@ -24,21 +24,24 @@ pipeline { switch (env.BRANCH_NAME) { case 'master': env.PORT = 5002 - break; - case 'test': + break + case 'test': env.PORT = 5001 - break; + break + case 'test': + env.PORT = 5000 + break } switch (env.BRANCH_NAME) { case 'master': env.NODE_ENV = 'production' - break; - case 'test': + break + case 'test': env.NODE_ENV = 'test' - break; + break case 'dev': env.NODE_ENV = 'development' - break; + break } } echo "Committer: ${env.GIT_COMMITTER_EMAIL}" @@ -57,7 +60,7 @@ pipeline { } stage('Test') { when { - branch 'dev'; + branch 'dev' } environment { NODE_ENV = "" diff --git a/front/core/components/dialog/style.scss b/front/core/components/dialog/style.scss index c63d02e15..8fad14e03 100644 --- a/front/core/components/dialog/style.scss +++ b/front/core/components/dialog/style.scss @@ -22,7 +22,7 @@ & > div { position: relative; box-shadow: 0 0 .4em $color-shadow; - background-color: white; + background-color: $color-bg-panel; border-radius: .2em; overflow: auto; padding: 2em; diff --git a/front/core/components/icon-button/icon-button.js b/front/core/components/icon-button/icon-button.js index 100c76179..b4022ccec 100644 --- a/front/core/components/icon-button/icon-button.js +++ b/front/core/components/icon-button/icon-button.js @@ -6,7 +6,7 @@ export default class IconButton { if ($element[0].getAttribute('tabindex') == null) $element[0].tabIndex = 0; - $element.on("keyup", event => this.onKeyDown(event, $element)); + $element.on('keyup', event => this.onKeyDown(event, $element)); let button = $element[0].querySelector('button'); $element[0].addEventListener('click', event => { if (this.disabled || button.disabled) diff --git a/front/core/components/icon-button/style.scss b/front/core/components/icon-button/style.scss index 0874c5758..d5932fa39 100644 --- a/front/core/components/icon-button/style.scss +++ b/front/core/components/icon-button/style.scss @@ -3,16 +3,20 @@ vn-icon-button { outline: 0; color: $color-main; + display: inline-block; - button { - background: transparent !important; - background-color: transparent !important; - display: inline-block; + & > button { + background-color: transparent; + display: block; color: inherit; border: 0; + padding: .25em; - &.mdl-button--colored { - color: inherit; + &:hover { + background-color: initial; + } + & > vn-icon { + display: block; } } } diff --git a/front/core/components/table/style.scss b/front/core/components/table/style.scss index f05c6f4e1..65f2344c9 100644 --- a/front/core/components/table/style.scss +++ b/front/core/components/table/style.scss @@ -15,7 +15,7 @@ vn-table { display: table-header-group; border-bottom: .15em solid $color-spacer; - vn-th[field] { + & > * > vn-th[field] { position: relative; overflow: visible; cursor: pointer; @@ -49,17 +49,22 @@ vn-table { border-top: .15em solid $color-spacer; display: table-footer-group } - vn-tr, a.vn-tr { + & > * > vn-tr, + & > * > a.vn-tr { display: table-row } vn-thead, vn-tbody, vn-tfoot { & > * { display: table-row; - - vn-th { - font-weight: bold + + & > vn-th { + font-weight: bold; + padding-top: 1em; + padding-bottom: .8em; } - vn-td, vn-th, vn-td-editable { + & > vn-th, + & > vn-td, + & > vn-td-editable { vertical-align: middle; display: table-cell; text-align: left; @@ -87,11 +92,6 @@ vn-table { color: #f7931e; } } - vn-th { - font-weight: bold; - padding-top: 1em; - padding-bottom: .8em; - } & > :last-child { padding-right: 1em; } @@ -99,18 +99,13 @@ vn-table { padding-left: 1em; } } - a.vn-tr { + & > a.vn-tr { color: inherit; } } vn-tbody > * { border-bottom: .1em solid $color-spacer-light; - &, - & > vn-td, - & > vn-td > .chip { - transition: background-color 200ms ease-in-out; - } &:last-child { border-bottom: none; } @@ -124,37 +119,44 @@ vn-table { &.notice, & > .notice, & > vn-td > .notice { - color: white; - background-color: $color-notice; + color: $color-font-bg; + background-color: $color-notice-medium; } &.success, & > .success, & > vn-td > .success { - color: white; - background-color: $color-success; + color: $color-font-bg; + background-color: $color-success-medium; } &.warning, & > .warning, & > vn-td > .warning { - color: white; - background-color: $color-main; + color: $color-font-bg; + background-color: $color-main-medium; } &.alert, & > .alert, & > vn-td > .alert { - color: white; - background-color: $color-alert; + color: $color-font-bg; + background-color: $color-alert-medium; + } + & > [actions] { + width: 1px; + + & > * { + vertical-align: middle; + } } } - } - vn-empty-rows { - display: table-caption; - caption-side: bottom; - text-align: center; - padding: 1.5em; - width: 100%; - box-sizing: border-box; - color: $color-font-secondary; + & > vn-empty-rows { + display: table-caption; + caption-side: bottom; + text-align: center; + padding: 1.5em; + width: 100%; + box-sizing: border-box; + color: $color-font-secondary; + } } vn-autocomplete { div.mdl-textfield { diff --git a/front/salix/components/home/style.scss b/front/salix/components/home/style.scss index 6c1e1762b..72322d0e0 100644 --- a/front/salix/components/home/style.scss +++ b/front/salix/components/home/style.scss @@ -24,7 +24,7 @@ vn-home { overflow:hidden; border-radius: 6px; background-color: $color-main; - color: white; + color: $color-font-dark; display: flex; flex-direction: column; height: 8em; @@ -54,7 +54,7 @@ vn-home { text-overflow: ellipsis; white-space: nowrap; overflow: hidden; - color: white; + color: inherit; margin: 0; /* & > .bind-letter { diff --git a/front/salix/components/main-menu/style.scss b/front/salix/components/main-menu/style.scss index c4e0f7a88..fb7acf296 100644 --- a/front/salix/components/main-menu/style.scss +++ b/front/salix/components/main-menu/style.scss @@ -1,4 +1,5 @@ @import "effects"; +@import "variables"; vn-main-menu { display: flex; @@ -31,7 +32,7 @@ vn-main-menu { vn-menu.vn-popover > div > div.content > ul { list-style-type: none; margin: 0; - color: white; + color: $color-font-dark; & > li { @extend %clickable-light; diff --git a/front/salix/components/topbar/style.scss b/front/salix/components/topbar/style.scss index 5c0ea23bd..dc5273dbf 100644 --- a/front/salix/components/topbar/style.scss +++ b/front/salix/components/topbar/style.scss @@ -2,7 +2,7 @@ vn-topbar { display: flex; - color: white; + color: $color-font-dark; box-sizing: border-box; background-color: $color-header; align-items: center; diff --git a/front/salix/styles/descriptor.scss b/front/salix/styles/descriptor.scss index af72b9c41..782a57e66 100644 --- a/front/salix/styles/descriptor.scss +++ b/front/salix/styles/descriptor.scss @@ -8,10 +8,9 @@ & > .header { display: flex; background: $color-main; - color: white; justify-content: space-between; align-items: stretch; - color: white; + color: $color-font-dark; & > * { min-width: 1.8em; diff --git a/front/salix/styles/misc.scss b/front/salix/styles/misc.scss index d02d4676a..266994d26 100644 --- a/front/salix/styles/misc.scss +++ b/front/salix/styles/misc.scss @@ -20,7 +20,7 @@ input[type=reset]::-moz-focus-inner { } a , .link{ - color: $color-main; + color: $color-font-link; text-decoration: none; } .link { @@ -148,11 +148,9 @@ vn-tool-bar { max-width: 36em; margin: 0 auto; } - a.vn-list-item { @extend %clickable; } - .vn-list-item { padding: $pad-medium; border-bottom: $border-thin solid $color-spacer-light; @@ -180,7 +178,13 @@ a.vn-list-item { } } } - } + } +} +vn-empty-rows.vn-list-item { + text-align: center; + padding: 1.5em; + box-sizing: border-box; + color: $color-font-secondary; } /** START - FORM ELEMENTS DISABLED **/ diff --git a/front/salix/styles/summary.scss b/front/salix/styles/summary.scss index 2dd5b58fe..fd1e99a22 100644 --- a/front/salix/styles/summary.scss +++ b/front/salix/styles/summary.scss @@ -9,7 +9,7 @@ padding: $pad-small; border: none; background: $color-main; - color: white; + color: $color-font-dark; margin: 0; text-align: center; line-height: 1.3em; diff --git a/front/salix/styles/variables.scss b/front/salix/styles/variables.scss index 418c605a6..b794d5610 100644 --- a/front/salix/styles/variables.scss +++ b/front/salix/styles/variables.scss @@ -28,8 +28,10 @@ $border-thick: .15em; $color-header: #3d3d3d; $color-bg: #e5e5e5; $color-bg-dark: #3d3d3d; -$color-font:#222222; +$color-font: #222222; $color-font-secondary: #9b9b9b; +$color-font-dark: white; +$color-font-bg: rgba(0, 0, 0, .7); $color-active: #3d3d3d; $color-active-font: white; $color-bg-panel: white; @@ -47,6 +49,7 @@ $color-hover-cd: rgba(0, 0, 0, .1); $color-hover-dc: .7; $color-disabled: .6; +$color-font-link: darken($color-main, 10%); $color-main-medium: lighten($color-main, 20%); $color-main-light: lighten($color-main, 35%); $color-success-medium: lighten($color-success, 20%); @@ -63,6 +66,8 @@ $color-bg: #222; $color-bg-dark: #222; $color-font: white; $color-font-secondary: #777; +$color-font-dark: white; +$color-font-bg: rgba(0, 0, 0, .8); $color-active: #666; $color-active-font: white; $color-bg-panel: #3c3b3b; @@ -80,6 +85,7 @@ $color-hover-cd: rgba(255, 255, 255, .1); $color-hover-dc: .7; $color-disabled: .6; +$color-font-link: lighten($color-main, 10%); $color-main-medium: darken($color-main, 20%); $color-main-light: darken($color-main, 35%); $color-success-medium: darken($color-success, 20%); diff --git a/gulpfile.js b/gulpfile.js index d69dd5d0d..d668b98ae 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -115,7 +115,7 @@ async function backTestDocker() { if (argv['random']) await execP(`docker rm -fv ${containerId}`); } -backTestDocker.description = `Runs backend tests using in site container`; +backTestDocker.description = `Runs backend tests restoring fixtures first`; function backTest(done) { const nodemon = require('gulp-nodemon'); diff --git a/modules/client/front/index/index.html b/modules/client/front/index/index.html index 07b394073..32f01c7e4 100644 --- a/modules/client/front/index/index.html +++ b/modules/client/front/index/index.html @@ -22,11 +22,11 @@ ng-repeat="client in clients track by client.id" client="::client"> - No results - Enter a new search diff --git a/modules/item/front/index/style.scss b/modules/item/front/index/style.scss index b73c1e32c..d360f8337 100644 --- a/modules/item/front/index/style.scss +++ b/modules/item/front/index/style.scss @@ -5,7 +5,7 @@ vn-item-product { .id { background-color: $color-main; - color: white; + color: $color-font-dark; margin-bottom: 0em; } .image { diff --git a/modules/item/front/last-entries/style.scss b/modules/item/front/last-entries/style.scss index c22d7073c..c2e03b6ed 100644 --- a/modules/item/front/last-entries/style.scss +++ b/modules/item/front/last-entries/style.scss @@ -1,21 +1,23 @@ @import "variables"; + vn-item-last-entries { .round { background-color: $color-spacer; border-radius: 25px; float: right; width: 25px; - color: white; + color: $color-font-dark; text-align: center; font-weight: bold; } - & vn-horizontal { + vn-horizontal { justify-content: center; } - & vn-date-picker { - flex: none!important; - & .mdl-textfield{ - width: 400px!important; + vn-date-picker { + flex: none !important; + + .mdl-textfield{ + width: 400px !important; } } @media screen and (max-width: 1440px) { diff --git a/modules/item/front/summary/style.scss b/modules/item/front/summary/style.scss index 6f4823c30..bb7e5d227 100644 --- a/modules/item/front/summary/style.scss +++ b/modules/item/front/summary/style.scss @@ -9,7 +9,7 @@ vn-item-summary { .item-state { padding: .4em; background-color: $color-main; - color: white; + color: $color-font-dark; p { font-size: .8em; diff --git a/modules/item/front/ticket-descriptor/style.scss b/modules/item/front/ticket-descriptor/style.scss index 32fd7d9dc..ae7f338d0 100644 --- a/modules/item/front/ticket-descriptor/style.scss +++ b/modules/item/front/ticket-descriptor/style.scss @@ -1,10 +1,12 @@ @import "variables"; vn-dialog.modal-form { - vn-horizontal.header{ + vn-horizontal.header { background-color: $color-main; - h5{ - color: white; + color: $color-font-dark; + + h5 { + color: inherit; margin: 0 auto; } } @@ -14,23 +16,22 @@ vn-dialog.modal-form { table { width: 100% } - &>div{ - padding: 0!important; + & > div { + padding: 0 !important; } vn-textfield { width: 100%; } - .buttons{ - margin-top: 0!important; + .buttons { + margin-top: 0 !important; } - - p{ + p { display: none; } - button.close > vn-icon{ - color: white!important; + button.close > vn-icon { + color: white !important; } vn-ticket-sale-edit-discount > div { - padding-bottom: 0!important; + padding-bottom: 0 !important; } } \ No newline at end of file diff --git a/modules/ticket/front/index/index.html b/modules/ticket/front/index/index.html index 6e2038ea6..50e801e59 100644 --- a/modules/ticket/front/index/index.html +++ b/modules/ticket/front/index/index.html @@ -82,7 +82,7 @@ {{::ticket.agencyMode}} {{::ticket.warehouse}} {{::ticket.total | currency: 'EUR': 2}} - + vn-icon{ From fca040112a0cf5e36efb469c11cc86242c2d4900 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Wed, 13 Feb 2019 16:26:49 +0100 Subject: [PATCH 03/16] Jenkinsfile fixes --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 234abd8dd..754b7a288 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -70,7 +70,7 @@ pipeline { steps { nodejs('node-lts') { sh 'karma start --junit' - sh 'gulp backTestDocker --junit --random --run-chown' + sh 'gulp backTestDockerOnce --junit --random --run-chown' } } } From 2a48e183e93f6e85151465a50fe553357410d474 Mon Sep 17 00:00:00 2001 From: Gerard Date: Thu, 14 Feb 2019 09:59:54 +0100 Subject: [PATCH 04/16] information added to the table --- modules/item/back/methods/item/filter.js | 5 +++-- modules/item/front/index/index.html | 4 ++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/modules/item/back/methods/item/filter.js b/modules/item/back/methods/item/filter.js index cc047c608..5f7f4f675 100644 --- a/modules/item/back/methods/item/filter.js +++ b/modules/item/back/methods/item/filter.js @@ -36,7 +36,7 @@ module.exports = Self => { t.name type, u.nickname userNickname, intr.description AS intrastat, i.stems, ori.code AS origin, t.name AS type, - ic.name AS category + ic.name AS category, i.density, tc.description AS taxClass FROM item i JOIN itemType t ON t.id = i.typeFk LEFT JOIN itemCategory ic ON ic.id = t.categoryFk @@ -44,7 +44,8 @@ module.exports = Self => { JOIN account.user u ON u.id = w.userFk LEFT JOIN intrastat intr ON intr.id = i.intrastatFk LEFT JOIN producer pr ON pr.id = i.producerFk - LEFT JOIN origin ori ON ori.id = i.originFk` + LEFT JOIN origin ori ON ori.id = i.originFk + LEFT JOIN taxClass tc ON tc.id = i.taxClassFk` ); if (tags) { diff --git a/modules/item/front/index/index.html b/modules/item/front/index/index.html index d4def30a2..6bf0720d2 100644 --- a/modules/item/front/index/index.html +++ b/modules/item/front/index/index.html @@ -31,6 +31,8 @@ Intrastat Origin Sales person + Density + Tax class Active @@ -59,6 +61,8 @@ {{::item.intrastat}} {{::item.origin}} {{::item.userNickname}} + {{::item.density}} + {{::item.taxClass}} Date: Thu, 14 Feb 2019 11:24:04 +0100 Subject: [PATCH 05/16] added category to item search panel --- modules/item/front/locale/es.yml | 2 +- modules/item/front/search-panel/index.html | 23 ++++++++++++++++------ modules/item/front/search-panel/index.js | 8 ++++++++ 3 files changed, 26 insertions(+), 7 deletions(-) diff --git a/modules/item/front/locale/es.yml b/modules/item/front/locale/es.yml index 065ba3316..56a0cd7d5 100644 --- a/modules/item/front/locale/es.yml +++ b/modules/item/front/locale/es.yml @@ -1,6 +1,6 @@ Item: Artículo View item: Ver artículo -Category: Categoría +Category: Reino Description: Descripción Size: Medida Type: Tipo diff --git a/modules/item/front/search-panel/index.html b/modules/item/front/search-panel/index.html index 868ccad5f..e297a421d 100644 --- a/modules/item/front/search-panel/index.html +++ b/modules/item/front/search-panel/index.html @@ -25,17 +25,21 @@ + + - - + + + + Date: Thu, 14 Feb 2019 11:41:06 +0100 Subject: [PATCH 06/16] tests fixed --- front/salix/components/user-configuration-popover/index.js | 4 ++-- modules/item/front/descriptor/index.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/front/salix/components/user-configuration-popover/index.js b/front/salix/components/user-configuration-popover/index.js index 5f8eeb330..446cb1153 100644 --- a/front/salix/components/user-configuration-popover/index.js +++ b/front/salix/components/user-configuration-popover/index.js @@ -92,7 +92,7 @@ class Controller { this.company = value; if (value && (!window.localStorage.localCompanyFk || window.localStorage.localCompanyFk === 'null')) - window.localStorage.setItem('localCompanyFk', value); + window.localStorage.setItem('defaultCompanyFk', value); this.setUserConfig('companyFk', value); } @@ -118,7 +118,7 @@ class Controller { if (res.data && res.data.warehouseFk) { this.warehouse = res.data.warehouseFk; if (res.data.warehouseFk && !window.localStorage.localWarehouseFk) - window.localStorage.setItem('localWarehouseFk', res.data.warehouseFk); + window.localStorage.setItem('defaultWarehouseFk', res.data.warehouseFk); } if (res.data && res.data.companyFk) { diff --git a/modules/item/front/descriptor/index.js b/modules/item/front/descriptor/index.js index 552ccd85a..79e669b87 100644 --- a/modules/item/front/descriptor/index.js +++ b/modules/item/front/descriptor/index.js @@ -28,7 +28,7 @@ class Controller { get warehouseFk() { if (!this._warehouseFk) - this._warehouseFk = parseInt(window.localStorage.localWarehouseFk); + this._warehouseFk = parseInt(window.localStorage.defaultWarehouseFk); return this._warehouseFk; } From 16f92ce646eaf998ac013528292ea535c1399966 Mon Sep 17 00:00:00 2001 From: Gerard Date: Thu, 14 Feb 2019 12:05:46 +0100 Subject: [PATCH 07/16] changed Type traduction --- modules/item/front/locale/es.yml | 2 +- modules/item/front/search-panel/index.html | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/modules/item/front/locale/es.yml b/modules/item/front/locale/es.yml index 56a0cd7d5..78fa7ab8f 100644 --- a/modules/item/front/locale/es.yml +++ b/modules/item/front/locale/es.yml @@ -3,7 +3,7 @@ View item: Ver artículo Category: Reino Description: Descripción Size: Medida -Type: Tipo +Type: Familia Name: Nombre Full name: Nombre completo Relevancy: Relevancia diff --git a/modules/item/front/search-panel/index.html b/modules/item/front/search-panel/index.html index e297a421d..2231deefc 100644 --- a/modules/item/front/search-panel/index.html +++ b/modules/item/front/search-panel/index.html @@ -33,7 +33,6 @@ Date: Thu, 14 Feb 2019 12:06:14 +0100 Subject: [PATCH 08/16] #1112 ticket.sale --- modules/ticket/back/methods/sale/updateDiscount.js | 6 ++++-- modules/ticket/front/sale/editDiscount.js | 3 +-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/modules/ticket/back/methods/sale/updateDiscount.js b/modules/ticket/back/methods/sale/updateDiscount.js index a90597726..1c1db1927 100644 --- a/modules/ticket/back/methods/sale/updateDiscount.js +++ b/modules/ticket/back/methods/sale/updateDiscount.js @@ -60,8 +60,10 @@ module.exports = Self => { await model.Sale.update({id: params.editLines[i].id}, {discount: params.editLines[i].discount}); } - query = ` + if (usesMana) { + query = ` call vn.manaSpellersRequery(?)`; - await Self.rawSql(query, [ticket[0].client().salesPersonFk]); + await Self.rawSql(query, [ticket[0].client().salesPersonFk]); + } }; }; diff --git a/modules/ticket/front/sale/editDiscount.js b/modules/ticket/front/sale/editDiscount.js index 9f41230e9..c4c73b016 100644 --- a/modules/ticket/front/sale/editDiscount.js +++ b/modules/ticket/front/sale/editDiscount.js @@ -51,9 +51,8 @@ class Controller { }).catch(e => { this.vnApp.showError(e.data.error.message); }); - } else { + } else this.vnApp.showError(this.$translate.instant('There is no changes to save')); - } } clear() { From e49512d15215b5b9819d657e4c1c4c6140b94a60 Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Thu, 14 Feb 2019 14:47:05 +0100 Subject: [PATCH 09/16] updated fonts --- front/core/styles/salixfont.css | 113 +++++++++++++++++++------------ front/core/styles/salixfont.svg | 12 +++- front/core/styles/salixfont.ttf | Bin 21688 -> 23724 bytes front/core/styles/salixfont.woff | Bin 21764 -> 23800 bytes 4 files changed, 79 insertions(+), 46 deletions(-) diff --git a/front/core/styles/salixfont.css b/front/core/styles/salixfont.css index bfd4b0f6e..8e9a02963 100644 --- a/front/core/styles/salixfont.css +++ b/front/core/styles/salixfont.css @@ -1,8 +1,9 @@ @font-face { font-family: 'salixfont'; - src: url('./salixfont.ttf?1qesj4') format('truetype'), - url('./salixfont.woff?1qesj4') format('woff'), - url('./salixfont.svg?1qesj4#salixfont') format('svg'); + src: + url('./salixfont.ttf?wtrl3') format('truetype'), + url('./salixfont.woff?wtrl3') format('woff'), + url('./salixfont.svg?wtrl3#salixfont') format('svg'); font-weight: normal; font-style: normal; } @@ -22,36 +23,15 @@ -moz-osx-font-smoothing: grayscale; } -.icon-columndelete:before { - content: "\e90f"; -} -.icon-columnadd:before { - content: "\e944"; -} -.icon-linesplit:before { - content: "\e945"; -} -.icon-linedelete:before { - content: "\e946"; -} -.icon-item:before { - content: "\e941"; -} -.icon-basket:before { - content: "\e942"; -} -.icon-worker:before { - content: "\e943"; -} -.icon-reserve:before { - content: "\e92f"; -} -.icon-services:before { - content: "\e93f"; +.icon-pets:before { + content: "\e94e"; } .icon-100:before { content: "\e940"; } +.icon-accessory:before { + content: "\e90a"; +} .icon-actions:before { content: "\e900"; } @@ -61,12 +41,18 @@ .icon-albaran:before { content: "\e902"; } +.icon-apps:before { + content: "\e948"; +} .icon-artificial:before { content: "\e903"; } .icon-barcode:before { content: "\e904"; } +.icon-basket:before { + content: "\e942"; +} .icon-bin:before { content: "\e905"; } @@ -82,18 +68,21 @@ .icon-clone:before { content: "\e909"; } -.icon-accessory:before { - content: "\e90a"; +.icon-columnadd:before { + content: "\e944"; +} +.icon-columndelete:before { + content: "\e90f"; } .icon-components:before { content: "\e90b"; } -.icon-handmade:before { - content: "\e90c"; -} .icon-consignatarios:before { content: "\e90d"; } +.icon-control:before { + content: "\e93f"; +} .icon-credit:before { content: "\e90e"; } @@ -103,8 +92,8 @@ .icon-details:before { content: "\e911"; } -.icon-fiscal:before { - content: "\e912"; +.icon-disabled:before { + content: "\e91b"; } .icon-doc:before { content: "\e913"; @@ -112,36 +101,63 @@ .icon-entry:before { content: "\e914"; } +.icon-exit:before { + content: "\e947"; +} .icon-eye:before { content: "\e915"; } +.icon-fiscal:before { + content: "\e912"; +} .icon-flower:before { content: "\e916"; } .icon-frozen:before { content: "\e917"; } +.icon-greenery:before { + content: "\e93c"; +} .icon-greuge:before { content: "\e918"; } .icon-grid:before { content: "\e919"; } +.icon-handmade:before { + content: "\e90c"; +} .icon-history:before { content: "\e91a"; } -.icon-disabled:before { - content: "\e91b"; +.icon-info:before { + content: "\e949"; +} +.icon-invoices1:before { + content: "\e94a"; } .icon-invoices:before { content: "\e91c"; } +.icon-item:before { + content: "\e941"; +} .icon-languaje:before { content: "\e91d"; } +.icon-linedelete:before { + content: "\e946"; +} .icon-lines:before { content: "\e91e"; } +.icon-linesplit:before { + content: "\e945"; +} +.icon-linesprepaired:before { + content: "\e94b"; +} .icon-logout:before { content: "\e91f"; } @@ -181,18 +197,24 @@ .icon-plant:before { content: "\e92b"; } -.icon-stowaway:before { - content: "\e92c"; -} .icon-recovery:before { content: "\e92d"; } .icon-regentry:before { content: "\e92e"; } +.icon-reserve:before { + content: "\e92f"; +} +.icon-revision:before { + content: "\e94c"; +} .icon-risk:before { content: "\e930"; } +.icon-services:before { + content: "\e94d"; +} .icon-settings:before { content: "\e931"; } @@ -208,6 +230,9 @@ .icon-splur:before { content: "\e935"; } +.icon-stowaway:before { + content: "\e92c"; +} .icon-supplier:before { content: "\e936"; } @@ -226,12 +251,12 @@ .icon-transaction:before { content: "\e93b"; } -.icon-greenery:before { - content: "\e93c"; -} .icon-volume:before { content: "\e93d"; } .icon-web:before { content: "\e93e"; } +.icon-worker:before { + content: "\e943"; +} \ No newline at end of file diff --git a/front/core/styles/salixfont.svg b/front/core/styles/salixfont.svg index aa5ec8c3c..d6654ec1e 100644 --- a/front/core/styles/salixfont.svg +++ b/front/core/styles/salixfont.svg @@ -9,7 +9,7 @@ - + @@ -70,7 +70,7 @@ - + @@ -78,4 +78,12 @@ + + + + + + + + \ No newline at end of file diff --git a/front/core/styles/salixfont.ttf b/front/core/styles/salixfont.ttf index 3bf8cbdda44bb89d9ed84908eec6494e51699c41..7c0ac2492e9e53d1af4eb16ed47a939da5cb585b 100644 GIT binary patch delta 2477 zcmZWrZEV}d8NSm|q(qYzWlE$)i!vojq$SI;Eb7Bw%F@(b7bmkV=d)hy*8QO4z-ipI zShF^mjQj}DcG-{$9a1CMkNz0CWk5E#>pCDmye-`?yTFVE=!_v7u%QXI0R#4xZAg^8 zq>{iv4|lwK@9yQjeBS3d@T2eJAN~y25k?5Lp%p|>e)2$nA<#j86=tqNd*->5^ULz# zt?LNkDA)%V=3ichUI5$aeG5xpw{Km#b`k8;2pyr0zcBxN$okPw5ITAW*2~9Xg1JV) z{-Ym&ojiW>mD78$?_;n(1)u#(r=ELk{)x5OQG{lau;Kla^QV{5OZb;yZ-A}6IDhhm zxg)=Q670W%!*`cYz5EIU3gy^0opnUW|1PY50Z+V*_u+}P{rK1TSqjbFTPLez9R*Mb zbs~ry#}jlo7?P}bpqUgSe5G=NG7J_IvPDv8+{B}2?zMbh)wg%A+M9>3W~$lY;cPW?*GgB{ zJ=>}bE|RQnF5F$MrZ=0LYkwL4#M@Zx{#xUY%69^Q>%Daf!3TArZlpJEs4;`+L93*f zEDt&{JNs6;rzic^?Cgmh+8$FMQ`L$rY3yvRHp^;~T-3D3 zbaRiUS>hpeUs~;#lrIhx%R3SUc!E?uM_o5ThAHk0sc}S()g3BBYJt`!&>X}DS_7%sc8&Af zmyN}t=6MeqUd%j7XHR0JTt1qJhgR>$ebegCO~$mCE}-(M>A=O$t?$C}9Zmxd>% z%jE-;!+LH&({s7=Hl-9~+bD7ibI;O-ius+4Cql54O!ay;AMn0;A`qygjJ~X4lmk%8 zhLP^9)T1;s_C3nM#;NhCdhbIrjnayUm4|eCeHw4(x-eUVb{x*Q7mh2cu&WFZ7^EiL?x;j|L|CpA%5_ksBS)B$3ZO8k zj`-XGj7uqZBoE?&7!FJBA+%u{#mfB!$IqE{oN~BApn*r(eW81*6Bc;j))u$|VE`I8 z%B{od(A_`Z-41~;A(|20xSh+uaNk#Hg;$p2)&QK}EfYF6kIIi`b^4WU|O z2yVtmrx2Ocgbu>+ysqj`@`N;RGXYMvR3l4B)Z`<)p!hQ};a#Ou@N2S|5*UW?;NT@B z8Bt4u=T+%(MYA-yM~)7wVh^t|0$ zrlZkrA;Jm)LWpNnFUgWf=yui^lLV1aUP2pDQRAa+reG>kPU(~*LxMldWoo)=`q_Y= z_-Ji9-#0=+EJav`rUi-+M&$LSKCxFO?Yyy=Wpli(4M*ylq6xi{T2ugrP^Tdm#RV?n zm%XAi(Ptczh?gQkfAY0r^Bw&wePSn}1Rh`%3{lF8ib*IWQY<)_a6lQL%Ie>f=>rV z|ApEpM}FwjH$IF%=o`PAs;CEA^X?+tY6yXS!I^_L*T~oY;kDe+N=S7o{{hma<7)r_ delta 749 zcmXw%Nla5g7{|YP?{%g7@__OlbfdM>SZE8ygd)U>5JV8Gq9I^e9uO!rfkRD*aA>@j zXACZ>!~;?BWI5o1RwdB`kboCVjPXD`aFMt~Ojw*(;!M8z&+l7iCNuNo8CrORCIA6I z4om_GrOoF(UbRjdl|bPOL9xA3$O2a^1o%$z`VQ>YQurO%)>q!&TS zL55r-GeCnCoKOND{vP8{SjsKN03L+S?=pFMmZn*DeE$|2xxKeTNCo5Hx3VH`h2#3t z6Xet>H3=OD84B=PEzl14`KoZ|Nr|%(l}W@74?2bdwsIdH%diBhQ4zwCfWJc6#pv_W zhwQBgX#EbG#VR&x4YbdKbNJWcrqV^Jhdr*Sk`p91Nh_3tbCj}@^~l8H{W(HLv2IH0 zAqgsYbT8=&23=^9cVB36FZr}GUH+iPtl>046GxeJGM!(hl5jOg7{3mYs7XlPU3LWl z(jOaEMKFzZ zI{59&c@xhqHhV;ZPqypR I->)p9fAs~i)c^nh diff --git a/front/core/styles/salixfont.woff b/front/core/styles/salixfont.woff index 75b97ffde7fa6cacb3c13e60e669b242adf742c7..2a9a880f52056e7351bcdcfa84e5312fba9b60ee 100644 GIT binary patch delta 2548 zcmZWrTWs6b89qmcA}yMBIN0IeUkJq%5-mtoi?*_JT- zNjZkI9`Gm6<^Rv+`@ipiuYHJb{Q^s8ruXeb7(qF93$^>-A0gcQ+hOsotkihn=~D~K z2;t)}aM&~X=;pP>g%`cPE6{G+Heqq;I}Y?+Md(q=vm2MLUOfKn!ZQdx_FM2Ndlt2S z{PA()eEOf`C~D4Wbenhqagxws5Ip z1g#1zQ;|zWvlkbzk)|22);26WB*mh%kv2=kGNZ?IY!8*I7~}WOVT7-pb1$bS-7m-9 znZ%dZk5+Tngqm&Fgln+D9FBa76-iYel;HK30CEvtS}+){u%*fnBFXB;;+>UhcEjCRt?d6S*!;Nb+s*#YABF+ZyK5AJ19hS< zWHfWBlu3+;T{22`0G*thdn4P^lYL`u?&Pj|#eve~yOhQqgzZHK1w8mE3T83U^9W@i zcme|w-W$-4jlxkS4-{i3DFti=mGw!b*tvH$;b%q)CA09hA zj^rAzP7T)+7RN*3Oi3QrCaHFY=E$U0PRJSPgdtO@8#>RyT$6;OnRaSY(!pOhfXqN6 zk5C(coP^SVUJez2PR9RHr^R4>7k@;6wW1GrTn08fyU7v&W>no}FYRDw-4*PtxR4^x znqLsLvFJF9t%d!>527lXMGktQmAHZ8V6nU_cK|V{=PPXXb7orN?meX;n+(lJkP}(5 zhah{Ea;4>HM10x<4PuQbZGk30nQ$!7rQ_7OkaO8QG2*@%K%*ye_j5mx9xIn0OY6~< z?Gs(M`wP>lE^&{Vn(pr}mHG>{RLX1B2Kq~*wV87H(DbNL7}ShH;Z289hGfSqa*Ok{ zsbU_~F}ouVB1B5vncl$0J(0L4!{JKC?8}>GISi$2n)yC6QwfLN%hMyH(=(Ow%+`>m z4GwDBke5E<6W^21L39kAYhHTf$?mVPzlGp^)Nf8qeN%HEzn`<_{`(2r{N>caM(+;u z#%V>w$`1ElokEBP_5J~p_%=F$&ZCRyC+Lsp-@qSVPRu}huy{{eChg@0`dgI_9LxE) zldr&-FC$PRTu-qMPg1g{*m7m4+yDuC+VwK(Cv?JBsxM8*ZzDI>`sCbX`KrXb~bZCDc0;=swAsL(9KaEvxAOA;ZNbSct^Mg=Lh zO_C4Wq@5UJ3ZV(F@N}5xGNRNNl-0b@CvwalRyKudks;Vkk+_hU)`UHT;dw(f9_9&g zZ!%#{wpBAvNYdgHyr6_~Dd8O@E`&5$%m@racnAm*(w$ICLg0+_prYBD+#@GPRk4TH z7=bToye39_<;0LInVitY^Nl#mQ#{LDp?eG%(|T!!WwXg-mylqEFd-x`Zj@w6ByU3NF+#+NT~ajqWiY- zM4uQZl)wXwf+J-Hu$vg4565|yo-`w9D5`!JX1p5rcYH~1<3^$xD%HywWpD?(gY5oe;!*LH z*i*3&V$++_mb{+$e&S!sGs@M@1Dz|$eDYFqEp@Dm(gOOF{?qiq^q-9j#(H<5`}IsJ lbIZJF{>r>zMXj2(V*S2nx##EE*__aO-pAn3YVOb${vUS2=KKHv delta 823 zcmX|=Nla5g7{_Pcd)*hh&{rufU1@D;EYLy`TdlEH6j@YIK~gNsYYCK+(8QV$;m{Zl zUf>ynnpER~7`RyuZkR?nmrl%o& zttk`&5TMaY0TGTZ&j4gUchKWby7jPaE?NrYK-z1j}t>8(tIelV0iNsKNe4>kaiW-J2586doYmbM!v@L zw~=WQ^W@#!U_6pS7hk}IhCF@n?O-I{i?kpr%wWQoKAaj#3@1^q8~=SI+L7dMRt%59 z5PKHZ!%%h-E<+^;l>vr4>v&b;f?0a(J zWC01ndpQcAYnwp_c*x#r={&)+)xZiK*Xn|Ypx0dGMr#EM-lI?t(TUenjT=(AE9w2b zvf3;6Sj|QgS0yi`-A3eLMXe3xb9|TXu-GRgNM?){OZsOhNsZ1W;Bt3o2mz&YQhXOl zP^iao+#?)gQ?1R;dAD4kDC(CPWQ@$OVJMA4pzsK!JSK2Z>rp@wHemDig53{5R)1!R zW5!PgF~wEA>@4v81R@Fv0Ic>$PXCMSx658#{l1<*1Oy5wAIBP^j19E?;DpgG%m&&I zjOI;3PzXxE4X^^W1Wkm9*W^($LpiB5r;b<0zt7(k6bgbui*P`g5iSY8h?>Pg@lElp z1W39hkEIsrx^%0cQdTZY%ihQh@}T^Va!@&;N~v Date: Thu, 14 Feb 2019 20:17:22 +0100 Subject: [PATCH 10/16] =?UTF-8?q?#1060=20a=C3=B1adir=20al=20componente=20c?= =?UTF-8?q?heck=20la=20popiedad=20intermediate?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- e2e/helpers/extensions.js | 25 ++++ e2e/helpers/selectors.js | 47 ++++---- .../claim-module/01_edit_basic_data.spec.js | 8 +- .../client-module/03_edit_fiscal_data.spec.js | 112 +++++++----------- .../client-module/04_edit_pay_method.spec.js | 24 ++-- .../client-module/07_edit_web_access.spec.js | 7 +- .../12_lock_of_verified_data.spec.js | 35 +++--- .../02_edit_item_basic_data.spec.js | 6 +- front/core/components/check/check.html | 12 +- front/core/components/check/check.js | 61 +++++----- front/core/directives/acl.js | 2 +- front/core/vendor.js | 5 +- front/package-lock.json | 17 ++- front/package.json | 3 + 14 files changed, 183 insertions(+), 181 deletions(-) diff --git a/e2e/helpers/extensions.js b/e2e/helpers/extensions.js index e311df432..958c92d02 100644 --- a/e2e/helpers/extensions.js +++ b/e2e/helpers/extensions.js @@ -441,6 +441,31 @@ let actions = { .waitToClick(`vn-left-menu li > a[ui-sref="${sectionRoute}"]`) .then(done) .catch(done); + }, + + checkboxState: function(selector, done) { + this.wait(selector) + .evaluate(checkboxSelector => { + return document.querySelector(checkboxSelector).getAttribute('class'); + }, selector) + .then(elementClass => { + let classList = elementClass.split(' '); + let className; + + if (classList.includes('md-checked')) + className = 'checked'; + if (classList.includes('md-intermediate')) + className = 'intermediate'; + if (!classList.includes('md-intermediate') && !classList.includes('md-checked')) + className = 'unchecked'; + + if (!className) + throw new Error(`selector: ${selector} is not a md-checkbox`); + + done(null, className); + }) + .then(done) + .catch(done); } }; diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 941c86038..77ecc3867 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -57,34 +57,29 @@ export default { fiscalDataButton: `vn-left-menu a[ui-sref="client.card.fiscalData"]`, socialNameInput: `${components.vnTextfield}[name="socialName"]`, fiscalIdInput: `${components.vnTextfield}[name="fi"]`, - equalizationTaxCheckboxLabel: `vn-check[label='Is equalizated'] > label > input`, + equalizationTaxCheckbox: `vn-check[label='Is equalizated'] md-checkbox`, acceptPropagationButton: `vn-client-fiscal-data > vn-confirm button[response=ACCEPT]`, addressInput: `${components.vnTextfield}[name="street"]`, cityInput: `${components.vnTextfield}[name="city"]`, postcodeInput: `${components.vnTextfield}[name="postcode"]`, provinceAutocomplete: `vn-autocomplete[field="$ctrl.client.provinceFk"]`, countryAutocomplete: `vn-autocomplete[field="$ctrl.client.countryFk"]`, - activeCheckboxLabel: `vn-check[label="Active"] > label`, - activeCheckboxInput: `vn-check[label="Active"] input`, - frozenCheckboxLabel: `vn-check[label="Frozen"] > label`, - frozenCheckboxInput: `vn-check[label="Frozen"] input`, - invoiceByAddressCheckboxInput: `vn-check[label='Invoice by address'] > label > input`, - verifiedDataCheckbox: `vn-check[label="Verified data"] input`, - verifiedDataCheckboxInput: `vn-check[label="Verified data"] > label > input`, - hasToInvoiceCheckboxLabel: `vn-check[label='Has to invoice'] > label`, - hasToInvoiceCheckboxInput: `vn-check[label='Has to invoice'] input`, - invoiceByMailCheckboxLabel: `vn-check[label='Invoice by mail'] > label`, - invoiceByMailCheckboxInput: `vn-check[label='Invoice by mail'] input`, - viesCheckboxInput: `vn-check[label='Vies'] > label > input`, + activeCheckbox: `vn-check[label="Active"] md-checkbox`, + frozenCheckbox: `vn-check[label="Frozen"] md-checkbox`, + invoiceByAddressCheckbox: `vn-check[label='Invoice by address'] md-checkbox`, + verifiedDataCheckbox: `vn-check[label="Verified data"] md-checkbox`, + hasToInvoiceCheckbox: `vn-check[label='Has to invoice'] md-checkbox`, + invoiceByMailCheckbox: `vn-check[label='Invoice by mail'] md-checkbox`, + viesCheckbox: `vn-check[label='Vies'] md-checkbox`, saveButton: `${components.vnSubmit}` }, clientPayMethod: { payMethodAutocomplete: `vn-autocomplete[field="$ctrl.client.payMethodFk"]`, IBANInput: `${components.vnTextfield}[name="iban"]`, dueDayInput: `${components.vnTextfield}[name="dueDay"]`, - receivedCoreLCRCheckbox: `vn-check[label='Received LCR'] > label > input`, - receivedCoreVNLCheckbox: `vn-check[label='Received core VNL'] > label > input`, - receivedB2BVNLCheckbox: `vn-check[label='Received B2B VNL'] > label > input`, + receivedCoreLCRCheckbox: `vn-check[label='Received LCR'] md-checkbox`, + receivedCoreVNLCheckbox: `vn-check[label='Received core VNL'] md-checkbox`, + receivedB2BVNLCheckbox: `vn-check[label='Received B2B VNL'] md-checkbox`, swiftBicAutocomplete: 'vn-client-billing-data vn-autocomplete[field="$ctrl.client.bankEntityFk"]', clearswiftBicButton: `vn-client-billing-data vn-autocomplete[field="$ctrl.client.bankEntityFk"] > div > div > div > vn-icon > i`, newBankEntityButton: 'vn-client-billing-data vn-icon-button[vn-tooltip="New bank entity"] > button', @@ -96,7 +91,7 @@ export default { clientAddresses: { addressesButton: `vn-left-menu a[ui-sref="client.card.address.index"]`, createAddress: `vn-client-address-index ${components.vnFloatButton}`, - defaultCheckboxInput: `vn-check[label='Default'] > label > input`, + defaultCheckboxInput: `vn-check[label='Default'] md-checkbox`, consigneeInput: `${components.vnTextfield}[name="nickname"]`, streetAddressInput: `${components.vnTextfield}[name="street"]`, postcodeInput: `${components.vnTextfield}[name="postalCode"]`, @@ -109,8 +104,8 @@ export default { secondMakeDefaultStar: 'vn-client-address-index vn-card vn-horizontal:nth-child(2) vn-icon-button[icon="star_border"]', firstEditButton: `vn-client-address-index vn-icon-button[icon='edit']`, secondEditButton: `vn-client-address-index vn-horizontal:nth-child(2) vn-icon-button[icon='edit']`, - activeCheckbox: `vn-check[label='Enabled'] > label > input`, - equalizationTaxCheckboxLabel: `vn-client-address-edit vn-check[label='Is equalizated'] > label > input`, + activeCheckbox: `vn-check[label='Enabled'] md-checkbox`, + equalizationTaxCheckbox: `vn-client-address-edit vn-check[label="Is equalizated"] md-checkbox`, firstObservationTypeAutocomplete: `vn-client-address-edit [name=observations] :nth-child(1) [field="observation.observationTypeFk"]`, firstObservationDescriptionInput: `vn-client-address-edit [name=observations] :nth-child(1) [model="observation.description"] input`, secondObservationTypeAutocomplete: `vn-client-address-edit [name=observations] :nth-child(2) [field="observation.observationTypeFk"]`, @@ -122,7 +117,7 @@ export default { }, clientWebAccess: { webAccessButton: `vn-left-menu a[ui-sref="client.card.webAccess"]`, - enableWebAccessCheckbox: `vn-check[label='Enable web access'] > label > input`, + enableWebAccessCheckbox: `vn-check[label='Enable web access'] md-checkbox`, userNameInput: `${components.vnTextfield}[name="name"]`, saveButton: `${components.vnSubmit}` }, @@ -205,7 +200,7 @@ export default { originAutocomplete: `vn-autocomplete[field="$ctrl.item.originFk"]`, expenceAutocomplete: `vn-autocomplete[field="$ctrl.item.expenceFk"]`, longNameInput: `vn-textfield[field="$ctrl.item.longName"] input`, - isActiveCheckbox: `vn-check[label='Active'] > label > input`, + isActiveCheckbox: `vn-check[label='Active'] md-checkbox`, submitBasicDataButton: `${components.vnSubmit}` }, itemTags: { @@ -350,7 +345,7 @@ export default { firstSaleReservedIcon: 'vn-ticket-sale vn-tr:nth-child(1) > vn-td:nth-child(2) > vn-icon:nth-child(3)', firstSaleColour: `vn-ticket-sale vn-tr:nth-child(1) vn-td:nth-child(5) section:nth-child(1)`, firstSaleLength: `vn-ticket-sale vn-tr:nth-child(1) vn-td:nth-child(5) section:nth-child(3)`, - firstSaleCheckbox: `vn-ticket-sale vn-tr:nth-child(1) vn-check[field="sale.checked"] label`, + firstSaleCheckbox: `vn-ticket-sale vn-tr:nth-child(1) vn-check[field="sale.checked"] md-checkbox`, secondSaleClaimIcon: 'vn-ticket-sale > vn-vertical > vn-card > div > vn-vertical > vn-table > div > vn-tbody > vn-tr:nth-child(2) > vn-td:nth-child(2) > a > vn-icon', secondSaleColour: `vn-ticket-sale vn-tr:nth-child(2) vn-td:nth-child(5) section:nth-child(5)`, secondSalePrice: `vn-ticket-sale vn-tr:nth-child(2) vn-td:nth-child(7)`, @@ -358,9 +353,9 @@ export default { secondSaleImport: `vn-ticket-sale vn-tr:nth-child(2) vn-td:nth-child(9)`, secondSaleText: `vn-table div > vn-tbody > vn-tr:nth-child(2)`, totalImport: 'vn-ticket-sale > vn-vertical > vn-card > div > vn-vertical > vn-horizontal > vn-one > p:nth-child(3) > strong', - selectAllSalesCheckbox: `vn-ticket-sale vn-thead vn-check label`, - secondSaleCheckbox: `vn-ticket-sale vn-tr:nth-child(2) vn-check[field="sale.checked"] label`, - thirdSaleCheckbox: `vn-ticket-sale vn-tr:nth-child(3) vn-check[field="sale.checked"] label`, + selectAllSalesCheckbox: `vn-ticket-sale vn-thead vn-check md-checkbox`, + secondSaleCheckbox: `vn-ticket-sale vn-tr:nth-child(2) vn-check[field="sale.checked"] md-checkbox`, + thirdSaleCheckbox: `vn-ticket-sale vn-tr:nth-child(3) vn-check[field="sale.checked"] md-checkbox`, deleteSaleButton: 'vn-ticket-sale vn-tool-bar > vn-button[icon="delete"]', transferSaleButton: 'vn-ticket-sale vn-tool-bar > vn-button[icon="call_split"]', moveToTicketInput: 'vn-ticket-sale vn-popover.transfer vn-textfield[model="$ctrl.moveToTicketFk"] input', @@ -441,7 +436,7 @@ export default { }, claimBasicData: { claimStateAutocomplete: 'vn-claim-basic-data vn-autocomplete[field="$ctrl.claim.claimStateFk"]', - isPaidWithManaCheckbox: 'vn-check[field="$ctrl.claim.isChargedToMana"] > label > input', + isPaidWithManaCheckbox: 'vn-check[field="$ctrl.claim.isChargedToMana"] md-checkbox', responsabilityInputRange: `vn-input-range`, observationInput: `vn-textarea[label="Observation"] textarea`, saveButton: `${components.vnSubmit}` diff --git a/e2e/paths/claim-module/01_edit_basic_data.spec.js b/e2e/paths/claim-module/01_edit_basic_data.spec.js index 0b7c4e5c8..a53356f45 100644 --- a/e2e/paths/claim-module/01_edit_basic_data.spec.js +++ b/e2e/paths/claim-module/01_edit_basic_data.spec.js @@ -33,12 +33,10 @@ describe('Claim edit basic data path', () => { }); it('should confirm the Is paid with mana checkbox is checked', async() => { - const value = await nightmare - .evaluate(selector => { - return document.querySelector(selector).checked; - }, selectors.claimBasicData.isPaidWithManaCheckbox); + const result = await nightmare + .checkboxState(selectors.claimBasicData.isPaidWithManaCheckbox); - expect(value).toBeTruthy(); + expect(result).toBe('checked'); }); it('should confirm the claim observation was edited', async() => { diff --git a/e2e/paths/client-module/03_edit_fiscal_data.spec.js b/e2e/paths/client-module/03_edit_fiscal_data.spec.js index 2326a1108..e8b4ada00 100644 --- a/e2e/paths/client-module/03_edit_fiscal_data.spec.js +++ b/e2e/paths/client-module/03_edit_fiscal_data.spec.js @@ -15,12 +15,9 @@ describe('Client Edit fiscalData path', () => { it(`should click on the 1st edit icon to check EQtax isnt checked`, async() => { const result = await nightmare .waitToClick(selectors.clientAddresses.firstEditButton) - .wait(selectors.clientAddresses.equalizationTaxCheckboxLabel) - .evaluate(selector => { - return document.querySelector(selector).checked; - }, selectors.clientAddresses.equalizationTaxCheckboxLabel); + .checkboxState(selectors.clientAddresses.equalizationTaxCheckbox); - expect(result).toBeFalsy(); + expect(result).toBe('unchecked'); }); // Confirms all addresses have EQtax false for future propagation test step 2 @@ -28,12 +25,9 @@ describe('Client Edit fiscalData path', () => { const result = await nightmare .waitToClick(selectors.clientAddresses.addressesButton) .waitToClick(selectors.clientAddresses.secondEditButton) - .wait(selectors.clientAddresses.equalizationTaxCheckboxLabel) - .evaluate(selector => { - return document.querySelector(selector).checked; - }, selectors.clientAddresses.equalizationTaxCheckboxLabel); + .checkboxState(selectors.clientAddresses.equalizationTaxCheckbox); - expect(result).toBeFalsy(); + expect(result).toBe('unchecked'); }); it(`should click on the fiscal data button`, async() => { @@ -47,9 +41,10 @@ describe('Client Edit fiscalData path', () => { it('should not be able to edit the verified data checkbox', async() => { const result = await nightmare + .wait(selectors.clientFiscalData.verifiedDataCheckbox) .evaluate(selector => { - return document.querySelector(selector).disabled; - }, selectors.clientFiscalData.verifiedDataCheckboxInput); + return document.querySelector(selector).getAttribute('disabled'); + }, selectors.clientFiscalData.verifiedDataCheckbox); expect(result).toBeTruthy(); }); @@ -78,14 +73,14 @@ describe('Client Edit fiscalData path', () => { .write(selectors.clientFiscalData.cityInput, 'N/A') .autocompleteSearch(selectors.clientFiscalData.countryAutocomplete, 'Francia') .autocompleteSearch(selectors.clientFiscalData.provinceAutocomplete, 'Province two') - .waitToClick(selectors.clientFiscalData.activeCheckboxLabel) - .waitToClick(selectors.clientFiscalData.frozenCheckboxLabel) - .waitToClick(selectors.clientFiscalData.hasToInvoiceCheckboxLabel) - .waitToClick(selectors.clientFiscalData.viesCheckboxInput) - .waitToClick(selectors.clientFiscalData.invoiceByMailCheckboxLabel) - .waitToClick(selectors.clientFiscalData.invoiceByAddressCheckboxInput) - .waitToClick(selectors.clientFiscalData.equalizationTaxCheckboxLabel) - .waitToClick(selectors.clientFiscalData.verifiedDataCheckboxInput) + .waitToClick(selectors.clientFiscalData.activeCheckbox) + .waitToClick(selectors.clientFiscalData.frozenCheckbox) + .waitToClick(selectors.clientFiscalData.hasToInvoiceCheckbox) + .waitToClick(selectors.clientFiscalData.viesCheckbox) + .waitToClick(selectors.clientFiscalData.invoiceByMailCheckbox) + .waitToClick(selectors.clientFiscalData.invoiceByAddressCheckbox) + .waitToClick(selectors.clientFiscalData.equalizationTaxCheckbox) + .waitToClick(selectors.clientFiscalData.verifiedDataCheckbox) .waitToClick(selectors.clientFiscalData.saveButton) .waitForLastSnackbar(); @@ -94,7 +89,7 @@ describe('Client Edit fiscalData path', () => { it('should receive an error if the fiscal id contains A or B at the beginning', async() => { const result = await nightmare - .waitToClick(selectors.clientFiscalData.viesCheckboxInput) + .waitToClick(selectors.clientFiscalData.viesCheckbox) .clearInput(selectors.clientFiscalData.fiscalIdInput) .write(selectors.clientFiscalData.fiscalIdInput, 'A94980061C') .waitToClick(selectors.clientFiscalData.saveButton) @@ -135,12 +130,9 @@ describe('Client Edit fiscalData path', () => { it(`should click on the 1st edit icon to confirm EQtax is checked`, async() => { const result = await nightmare .waitToClick(selectors.clientAddresses.firstEditButton) - .wait(selectors.clientAddresses.equalizationTaxCheckboxLabel) - .evaluate(selector => { - return document.querySelector(selector).checked; - }, selectors.clientAddresses.equalizationTaxCheckboxLabel); + .checkboxState(selectors.clientAddresses.equalizationTaxCheckbox); - expect(result).toBeTruthy(); + expect(result).toBe('checked'); }); // confirm all addresses have now EQtax checked step 3 @@ -148,19 +140,16 @@ describe('Client Edit fiscalData path', () => { const result = await nightmare .waitToClick(selectors.clientAddresses.addressesButton) .waitToClick(selectors.clientAddresses.secondEditButton) - .wait(selectors.clientAddresses.equalizationTaxCheckboxLabel) - .evaluate(selector => { - return document.querySelector(selector).checked; - }, selectors.clientAddresses.equalizationTaxCheckboxLabel); + .checkboxState(selectors.clientAddresses.equalizationTaxCheckbox); - expect(result).toBeTruthy(); + expect(result).toBe('checked'); }); it('should navigate back to fiscal data and uncheck EQtax then check VIES', async() => { const result = await nightmare .waitToClick(selectors.clientFiscalData.fiscalDataButton) - .waitToClick(selectors.clientFiscalData.viesCheckboxInput) - .waitToClick(selectors.clientFiscalData.equalizationTaxCheckboxLabel) + .waitToClick(selectors.clientFiscalData.viesCheckbox) + .waitToClick(selectors.clientFiscalData.equalizationTaxCheckbox) .waitToClick(selectors.clientFiscalData.saveButton) .waitForLastSnackbar(); @@ -227,74 +216,58 @@ describe('Client Edit fiscalData path', () => { it('should confirm active checkbox is unchecked', async() => { const result = await nightmare - .evaluate(selector => { - return document.querySelector(selector).checked; - }, selectors.clientFiscalData.activeCheckboxLabel); + .checkboxState(selectors.clientFiscalData.activeCheckbox); - expect(result).toBeFalsy(); + expect(result).toBe('unchecked'); }); it('should confirm frozen checkbox is unchecked', async() => { const result = await nightmare - .evaluate(selector => { - return document.querySelector(selector).checked; - }, selectors.clientFiscalData.frozenCheckboxLabel); + .checkboxState(selectors.clientFiscalData.frozenCheckbox); - expect(result).toBeFalsy(); + expect(result).toBe('unchecked'); }); it('should confirm Has to invoice checkbox is unchecked', async() => { const result = await nightmare - .evaluate(selector => { - return document.querySelector(selector).checked; - }, selectors.clientFiscalData.hasToInvoiceCheckboxLabel); + .checkboxState(selectors.clientFiscalData.hasToInvoiceCheckbox); - expect(result).toBeFalsy(); + expect(result).toBe('unchecked'); }); it('should confirm Vies checkbox is checked', async() => { const result = await nightmare - .evaluate(selector => { - return document.querySelector(selector).checked; - }, selectors.clientFiscalData.viesCheckboxInput); + .checkboxState(selectors.clientFiscalData.viesCheckbox); - expect(result).toBeTruthy(); + expect(result).toBe('checked'); }); it('should confirm Invoice by mail checkbox is unchecked', async() => { const result = await nightmare - .evaluate(selector => { - return document.querySelector(selector).checked; - }, selectors.clientFiscalData.invoiceByMailCheckboxLabel); + .checkboxState(selectors.clientFiscalData.invoiceByMailCheckbox); - expect(result).toBeFalsy(); + expect(result).toBe('unchecked'); }); it('should confirm invoice by address checkbox is unchecked', async() => { const result = await nightmare - .evaluate(selector => { - return document.querySelector(selector).checked; - }, selectors.clientFiscalData.invoiceByAddressCheckboxInput); + .checkboxState(selectors.clientFiscalData.invoiceByAddressCheckbox); - expect(result).toBeFalsy(); + expect(result).toBe('unchecked'); }); it('should confirm Equalization tax checkbox is unchecked', async() => { const result = await nightmare - .evaluate(selector => { - return document.querySelector(selector).checked; - }, selectors.clientFiscalData.equalizationTaxCheckboxLabel); + .checkboxState(selectors.clientFiscalData.equalizationTaxCheckbox); - expect(result).toBeFalsy(); + expect(result).toBe('unchecked'); }); it('should confirm Verified data checkbox is checked', async() => { const result = await nightmare - .evaluate(selector => { - return document.querySelector(selector).checked; - }, selectors.clientFiscalData.verifiedDataCheckboxInput); + .checkboxState(selectors.clientFiscalData.verifiedDataCheckbox); - expect(result).toBeTruthy(); + expect(result).toBe('checked'); }); // confirm invoice by address checkbox gets checked if the EQtax differs between addresses step 1 @@ -311,7 +284,7 @@ describe('Client Edit fiscalData path', () => { it(`should click on the 1st edit icon to access the address details and uncheck EQtax checkbox`, async() => { const result = await nightmare .waitToClick(selectors.clientAddresses.firstEditButton) - .waitToClick(selectors.clientAddresses.equalizationTaxCheckboxLabel) + .waitToClick(selectors.clientAddresses.equalizationTaxCheckbox) .waitToClick(selectors.clientAddresses.saveButton) .waitForLastSnackbar(); @@ -322,12 +295,9 @@ describe('Client Edit fiscalData path', () => { it('should navigate back to fiscal data to confirm invoice by address is now checked', async() => { const result = await nightmare .waitToClick(selectors.clientFiscalData.fiscalDataButton) - .wait(selectors.clientFiscalData.invoiceByAddressCheckboxInput) - .evaluate(selector => { - return document.querySelector(selector).checked; - }, selectors.clientFiscalData.invoiceByAddressCheckboxInput); + .checkboxState(selectors.clientFiscalData.invoiceByAddressCheckbox); - expect(result).toBeTruthy(); + expect(result).toBe('checked'); }); }); }); diff --git a/e2e/paths/client-module/04_edit_pay_method.spec.js b/e2e/paths/client-module/04_edit_pay_method.spec.js index 5af4c894f..a8b58ca11 100644 --- a/e2e/paths/client-module/04_edit_pay_method.spec.js +++ b/e2e/paths/client-module/04_edit_pay_method.spec.js @@ -98,29 +98,23 @@ describe('Client Edit pay method path', () => { }); it('should confirm Received LCR checkbox is checked', async() => { - const checkedBox = await nightmare - .evaluate(selector => { - return document.querySelector(selector).checked; - }, selectors.clientPayMethod.receivedCoreLCRCheckbox); + const result = await nightmare + .checkboxState(selectors.clientPayMethod.receivedCoreLCRCheckbox); - expect(checkedBox).toBeTruthy(); + expect(result).toBe('checked'); }); it('should confirm Received core VNL checkbox is unchecked', async() => { - const checkedBox = await nightmare - .evaluate(selector => { - return document.querySelector(selector).checked; - }, selectors.clientPayMethod.receivedCoreVNLCheckbox); + const result = await nightmare + .checkboxState(selectors.clientPayMethod.receivedCoreVNLCheckbox); - expect(checkedBox).toBeFalsy(); + expect(result).toBe('unchecked'); }); it('should confirm Received B2B VNL checkbox is unchecked', async() => { - const checkedBox = await nightmare - .evaluate(selector => { - return document.querySelector(selector).checked; - }, selectors.clientPayMethod.receivedB2BVNLCheckbox); + const result = await nightmare + .checkboxState(selectors.clientPayMethod.receivedB2BVNLCheckbox); - expect(checkedBox).toBeFalsy(); + expect(result).toBe('unchecked'); }); }); diff --git a/e2e/paths/client-module/07_edit_web_access.spec.js b/e2e/paths/client-module/07_edit_web_access.spec.js index 6f8ef2843..999b1c123 100644 --- a/e2e/paths/client-module/07_edit_web_access.spec.js +++ b/e2e/paths/client-module/07_edit_web_access.spec.js @@ -28,12 +28,9 @@ describe('Client Edit web access path', () => { .wait(selectors.clientBasicData.nameInput) .waitToClick(selectors.clientsIndex.othersButton) .waitToClick(selectors.clientWebAccess.webAccessButton) - .wait(selectors.clientWebAccess.enableWebAccessCheckbox) - .evaluate(selector => { - return document.querySelector(selector).checked; - }, selectors.clientWebAccess.enableWebAccessCheckbox); + .checkboxState(selectors.clientWebAccess.enableWebAccessCheckbox); - expect(result).toBeFalsy(); + expect(result).toBe('unchecked'); }); it('should confirm web access name have been updated', async() => { diff --git a/e2e/paths/client-module/12_lock_of_verified_data.spec.js b/e2e/paths/client-module/12_lock_of_verified_data.spec.js index 5c4d0e87b..971d1e5f9 100644 --- a/e2e/paths/client-module/12_lock_of_verified_data.spec.js +++ b/e2e/paths/client-module/12_lock_of_verified_data.spec.js @@ -15,9 +15,9 @@ describe('Client lock verified data path', () => { it('should confirm verified data button is disabled for salesPerson', async() => { const result = await nightmare .wait(200) - .wait(selectors.clientFiscalData.verifiedDataCheckboxInput) + .wait(selectors.clientFiscalData.verifiedDataCheckbox) .evaluate(selector => { - return document.querySelector(selector).disabled; + return document.querySelector(selector).getAttribute('disabled'); }, selectors.clientFiscalData.verifiedDataCheckbox); expect(result).toBeTruthy(); @@ -92,17 +92,17 @@ describe('Client lock verified data path', () => { it('should confirm verified data button is enabled for administrative', async() => { const result = await nightmare - .wait(selectors.clientFiscalData.verifiedDataCheckboxInput) + .wait(selectors.clientFiscalData.verifiedDataCheckbox) .evaluate(selector => { return document.querySelector(selector).disabled; }, selectors.clientFiscalData.verifiedDataCheckbox); - expect(result).not.toBeTruthy(); + expect(result).toBeFalsy(); }); it('should check the Verified data checkbox', async() => { const result = await nightmare - .waitToClick(selectors.clientFiscalData.verifiedDataCheckboxInput) + .waitToClick(selectors.clientFiscalData.verifiedDataCheckbox) .waitToClick(selectors.clientFiscalData.saveButton) .waitForLastSnackbar(); @@ -112,12 +112,9 @@ describe('Client lock verified data path', () => { it('should confirm Verified data checkbox is checked', async() => { const result = await nightmare .reloadSection('client.card.fiscalData') - .wait(selectors.clientFiscalData.verifiedDataCheckboxInput) - .evaluate(selector => { - return document.querySelector(selector).checked; - }, selectors.clientFiscalData.verifiedDataCheckboxInput); + .checkboxState(selectors.clientFiscalData.verifiedDataCheckbox); - expect(result).toBeTruthy(); + expect(result).toBe('checked'); }); it('should again edit the social name', async() => { @@ -189,12 +186,12 @@ describe('Client lock verified data path', () => { it('should confirm verified data button is disabled once again for salesPerson', async() => { const result = await nightmare - .wait(selectors.clientFiscalData.verifiedDataCheckboxInput) + .wait(selectors.clientFiscalData.verifiedDataCheckbox) .evaluate(selector => { - return document.querySelector(selector).disabled; + return document.querySelector(selector).getAttribute('disabled'); }, selectors.clientFiscalData.verifiedDataCheckbox); - expect(result).toBe(true); + expect(result).toBeTruthy(); }); it('should not be able to save change throwing a verified data error', async() => { @@ -258,9 +255,9 @@ describe('Client lock verified data path', () => { it('should confirm verified data button is enabled for salesAssistant', async() => { const result = await nightmare - .wait(selectors.clientFiscalData.verifiedDataCheckboxInput) + .wait(selectors.clientFiscalData.verifiedDataCheckbox) .evaluate(selector => { - return document.querySelector(selector).disabled; + return document.querySelector(selector).getAttribute('disabled'); }, selectors.clientFiscalData.verifiedDataCheckbox); expect(result).toBeFalsy(); @@ -334,12 +331,12 @@ describe('Client lock verified data path', () => { it('should confirm verified data button is enabled once again', async() => { const result = await nightmare - .wait(selectors.clientFiscalData.verifiedDataCheckboxInput) + .wait(selectors.clientFiscalData.verifiedDataCheckbox) .evaluate(selector => { - return document.querySelector(selector).disabled; + return document.querySelector(selector).getAttribute('disabled'); }, selectors.clientFiscalData.verifiedDataCheckbox); - expect(result).toBe(true); + expect(result).toBeTruthy(); }); it('should confirm the form is enabled for salesPerson', async() => { @@ -349,7 +346,7 @@ describe('Client lock verified data path', () => { return document.querySelector(selector).disabled; }, 'vn-textfield[field="$ctrl.client.socialName"] > div'); - expect(result).not.toBe(true); + expect(result).toBeFalsy(); }); }); }); diff --git a/e2e/paths/item-module/02_edit_item_basic_data.spec.js b/e2e/paths/item-module/02_edit_item_basic_data.spec.js index 3a06a2a77..15cea353a 100644 --- a/e2e/paths/item-module/02_edit_item_basic_data.spec.js +++ b/e2e/paths/item-module/02_edit_item_basic_data.spec.js @@ -89,10 +89,8 @@ describe('Item Edit basic data path', () => { it('should confirm isActive checkbox is unchecked', async() => { const result = await nightmare - .evaluate(selector => { - return document.querySelector(selector).checked; - }, selectors.itemBasicData.isActiveCheckbox); + .checkboxState(selectors.itemBasicData.isActiveCheckbox); - expect(result).toBeFalsy(); + expect(result).toBe('unchecked'); }); }); diff --git a/front/core/components/check/check.html b/front/core/components/check/check.html index b2f5558b2..59fbd1192 100644 --- a/front/core/components/check/check.html +++ b/front/core/components/check/check.html @@ -1,7 +1,11 @@ - + + {{::$ctrl.label}} + diff --git a/front/core/components/check/check.js b/front/core/components/check/check.js index 99098ce89..8b8434da1 100644 --- a/front/core/components/check/check.js +++ b/front/core/components/check/check.js @@ -1,44 +1,46 @@ import ngModule from '../../module'; -import Input from '../../lib/input'; import './style.scss'; -export default class Controller extends Input { - constructor($element, $scope, $attrs) { - super($element, $scope); - componentHandler.upgradeElement(this.element.firstChild); - this.mdlElement = this.element.firstChild.MaterialCheckbox; - this.input.addEventListener('change', () => this.onChange()); +export default class Controller { + constructor($attrs) { this.hasInfo = Boolean($attrs.info); this.info = $attrs.info || null; } - set field(value) { + + set checkValue(value) { + this.checkIntermediate(); + if (this.isIntermediate) + value = false; + this._field = value; - this.input.checked = value == true; - this.mdlUpdate(); + this._checkValue = value; } + + get checkValue() { + return this._checkValue; + } + + set field(value) { + this.checkValue = value; + } + get field() { + if (!this._field && this.isIntermediate) + return null; + return this._field; } - $onInit() { - if (this.model) { - this.model.$render = () => { - this.input.checked = this.model.$viewValue || false; - this.mdlUpdate(); - }; - this.$element.on('blur keyup change', () => { - this.$.$evalAsync(() => { - this.model.$setViewValue(this.input.checked); - }); - }); + + checkIntermediate() { + if ((this.intermediate || (this._field === false && this.tripleState)) && !this.isIntermediate) { + this.isIntermediate = true; + return; } - } - onChange() { - this._field = this.input.checked == true; - this.$.$applyAsync(); - this.emit('change'); + + this.isIntermediate = false; } } -Controller.$inject = ['$element', '$scope', '$attrs']; +Controller.$inject = ['$attrs']; ngModule.component('vnCheck', { template: require('./check.html'), @@ -48,9 +50,10 @@ ngModule.component('vnCheck', { }, bindings: { field: '=?', - onChange: '&?', label: '@?', disabled: ' Date: Thu, 14 Feb 2019 20:18:10 +0100 Subject: [PATCH 11/16] changed hide for on-hide binding --- modules/ticket/front/sale/editDiscount.js | 4 ++-- modules/ticket/front/sale/index.html | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/ticket/front/sale/editDiscount.js b/modules/ticket/front/sale/editDiscount.js index c4c73b016..34dc0c48e 100644 --- a/modules/ticket/front/sale/editDiscount.js +++ b/modules/ticket/front/sale/editDiscount.js @@ -44,7 +44,7 @@ class Controller { } if (modified) { this.$http.post(`/ticket/api/Sales/updateDiscount`, {editLines}).then(() => { - this.hide(); + this.onHide(); this.vnApp.showSuccess(this.$translate.instant('Data saved!')); this.clear(); modified = false; @@ -69,6 +69,6 @@ ngModule.component('vnTicketSaleEditDiscount', { edit: ' + on-hide="$ctrl.hideEditPopover()"> @@ -204,7 +204,7 @@ mana="$ctrl.mana" bulk="true" edit="$ctrl.edit" - hide="$ctrl.hideEditDialog()"> + on-hide="$ctrl.hideEditDialog()"> From e373e603bf350309e3aa47171a42f8ec9f90f941 Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Fri, 15 Feb 2019 08:02:29 +0100 Subject: [PATCH 12/16] checkbox component noew emits change event --- front/core/components/check/check.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/front/core/components/check/check.js b/front/core/components/check/check.js index 8b8434da1..decc2ab8c 100644 --- a/front/core/components/check/check.js +++ b/front/core/components/check/check.js @@ -1,8 +1,10 @@ import ngModule from '../../module'; +import Component from '../../lib/component'; import './style.scss'; -export default class Controller { - constructor($attrs) { +export default class Controller extends Component { + constructor($element, $scope, $attrs) { + super($element, $scope); this.hasInfo = Boolean($attrs.info); this.info = $attrs.info || null; } @@ -13,6 +15,10 @@ export default class Controller { value = false; this._field = value; + + if (this._checkValue !== undefined && this._checkValue !== null) + this.emit('change', {value: this.field}); + this._checkValue = value; } @@ -32,7 +38,7 @@ export default class Controller { } checkIntermediate() { - if ((this.intermediate || (this._field === false && this.tripleState)) && !this.isIntermediate) { + if ((this.intermediate || (!this._field && this.tripleState)) && !this.isIntermediate) { this.isIntermediate = true; return; } @@ -40,7 +46,7 @@ export default class Controller { this.isIntermediate = false; } } -Controller.$inject = ['$attrs']; +Controller.$inject = ['$element', '$scope', '$attrs']; ngModule.component('vnCheck', { template: require('./check.html'), From fe2c74c8c88717995a47a207f5f054bed0116fa5 Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Fri, 15 Feb 2019 08:40:18 +0100 Subject: [PATCH 13/16] fixed event emiter --- front/core/components/check/check.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/front/core/components/check/check.js b/front/core/components/check/check.js index decc2ab8c..9c67cb502 100644 --- a/front/core/components/check/check.js +++ b/front/core/components/check/check.js @@ -16,7 +16,7 @@ export default class Controller extends Component { this._field = value; - if (this._checkValue !== undefined && this._checkValue !== null) + if (typeof this._checkValue === 'boolean') this.emit('change', {value: this.field}); this._checkValue = value; From c3903b8d514e0ba3d6b0349ca29d2b1d48716396 Mon Sep 17 00:00:00 2001 From: Gerard Date: Fri, 15 Feb 2019 08:49:44 +0100 Subject: [PATCH 14/16] added tripleState setter --- front/core/components/check/check.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/front/core/components/check/check.js b/front/core/components/check/check.js index 9c67cb502..63d049264 100644 --- a/front/core/components/check/check.js +++ b/front/core/components/check/check.js @@ -37,13 +37,23 @@ export default class Controller extends Component { return this._field; } + set tripleState(value) { + this._tripleState = value; + this.checkIntermediate(); + } + + get tripleState() { + return this._tripleState; + } + checkIntermediate() { if ((this.intermediate || (!this._field && this.tripleState)) && !this.isIntermediate) { this.isIntermediate = true; return; } - this.isIntermediate = false; + if (!this.intermediate) + this.isIntermediate = false; } } Controller.$inject = ['$element', '$scope', '$attrs']; From 90a4e5a7d1a42bbdf53521965c8cbeb82c4ae924 Mon Sep 17 00:00:00 2001 From: Gerard Date: Fri, 15 Feb 2019 11:03:27 +0100 Subject: [PATCH 15/16] #1144 fixed bugs with $destroy --- front/core/components/searchbar/searchbar.js | 5 +++-- modules/order/front/filter/index.js | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/front/core/components/searchbar/searchbar.js b/front/core/components/searchbar/searchbar.js index 6555b707e..f5ead38a4 100644 --- a/front/core/components/searchbar/searchbar.js +++ b/front/core/components/searchbar/searchbar.js @@ -61,7 +61,8 @@ export default class Controller extends Component { if (event.defaultPrevented) return; event.preventDefault(); - this.$panel = this.$compile(`<${this.panel}/>`)(this.$.$new()); + this.$panelScope = this.$.$new(); + this.$panel = this.$compile(`<${this.panel}/>`)(this.$panelScope); let panel = this.$panel.isolateScope().$ctrl; panel.filter = this._filter; panel.onSubmit = filter => this.onPanelSubmit(filter); @@ -72,7 +73,7 @@ export default class Controller extends Component { } onPopoverClose() { - this.$panel.scope().$destroy(); + this.$panelScope.$destroy(); this.$panel.remove(); this.$panel = null; } diff --git a/modules/order/front/filter/index.js b/modules/order/front/filter/index.js index c2bfb8e4b..8a80a80e2 100644 --- a/modules/order/front/filter/index.js +++ b/modules/order/front/filter/index.js @@ -136,7 +136,8 @@ class Controller { if (event.defaultPrevented) return; event.preventDefault(); - this.$panel = this.$compile(``)(this.$scope.$new()); + this.$panelScope = this.$scope.$new(); + this.$panel = this.$compile(``)(this.$panelScope); const panel = this.$panel.isolateScope().$ctrl; panel.filter = this.filter; panel.onSubmit = filter => this.onPanelSubmit(filter); @@ -153,7 +154,7 @@ class Controller { } onPopoverClose() { - this.$panel.scope().$destroy(); + this.$panelScope.$destroy(); this.$panel.remove(); this.$panel = null; } From 4f851c9eed79c1e242b1deb3538fd47660171e2c Mon Sep 17 00:00:00 2001 From: Gerard Date: Fri, 15 Feb 2019 11:05:14 +0100 Subject: [PATCH 16/16] #1111 poder buscar pedidos confirmados o sin confirmar --- modules/order/front/search-panel/index.html | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/order/front/search-panel/index.html b/modules/order/front/search-panel/index.html index 07dbdf1bc..691fb4642 100644 --- a/modules/order/front/search-panel/index.html +++ b/modules/order/front/search-panel/index.html @@ -60,6 +60,7 @@