From 02d89e5774f69a44c3cb35e267e9618ab48b178c Mon Sep 17 00:00:00 2001 From: alexm Date: Wed, 24 Nov 2021 08:51:07 +0100 Subject: [PATCH 01/14] feat(item): add field genericFk in basic-data --- modules/entry/front/buy/import/index.js | 2 +- modules/item/back/models/item.json | 9 ++ modules/item/front/basic-data/index.html | 111 ++++++++++++++++++++ modules/item/front/basic-data/index.js | 59 +++++++++++ modules/item/front/basic-data/locale/es.yml | 3 +- 5 files changed, 182 insertions(+), 2 deletions(-) diff --git a/modules/entry/front/buy/import/index.js b/modules/entry/front/buy/import/index.js index 2f13b2746..a88476240 100644 --- a/modules/entry/front/buy/import/index.js +++ b/modules/entry/front/buy/import/index.js @@ -133,7 +133,7 @@ class Controller extends Section { case 'producerFk': case 'typeFk': case 'size': - case 'ink': + case 'inkFk': where[key] = value; } } diff --git a/modules/item/back/models/item.json b/modules/item/back/models/item.json index fd4b6b079..d78e929ed 100644 --- a/modules/item/back/models/item.json +++ b/modules/item/back/models/item.json @@ -143,6 +143,10 @@ }, "isFloramondo": { "type": "boolean" + }, + "genericFk": { + "type": "number", + "description": "Generic item" } }, "relations": { @@ -176,6 +180,11 @@ "model": "Expense", "foreignKey": "expenseFk" }, + "id": { + "type": "belongsTo", + "model": "Item", + "foreignKey": "genericFk" + }, "tags": { "type": "hasMany", "model": "ItemTag", diff --git a/modules/item/front/basic-data/index.html b/modules/item/front/basic-data/index.html index cec7a063f..02dd08ebc 100644 --- a/modules/item/front/basic-data/index.html +++ b/modules/item/front/basic-data/index.html @@ -137,6 +137,27 @@ ng-model="$ctrl.item.compression" rule> + + + {{::id}} - {{::name}} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ID + Item + Size + Producer + Color + + + + + + + {{::item.id}} + + + {{::item.name}} + {{::item.size}} + {{::item.producer.name}} + {{::item.ink.name}} + + + + + + + \ No newline at end of file diff --git a/modules/item/front/basic-data/index.js b/modules/item/front/basic-data/index.js index 1a256c65b..f37836fc8 100644 --- a/modules/item/front/basic-data/index.js +++ b/modules/item/front/basic-data/index.js @@ -17,6 +17,65 @@ class Controller extends Section { return this.$http.patch(query, this.newIntrastat) .then(res => this.item.intrastatFk = res.data.id); } + + itemSearchFunc($search) { + return /^\d+$/.test($search) + ? {id: $search} + : {name: {like: '%' + $search + '%'}}; + } + + showFilterDialog(item) { + this.activeItem = item; + this.itemFilterParams = {}; + this.itemFilter = { + include: [ + { + relation: 'producer', + scope: { + fields: ['name'] + } + }, + { + relation: 'ink', + scope: { + fields: ['name'] + } + } + ] + }; + + this.$.filterDialog.show(); + } + + selectItem(id) { + this.activeItem['id'] = id; + this.$.filterDialog.hide(); + } + + filter() { + const filter = this.itemFilter; + const params = this.itemFilterParams; + const where = {}; + for (let key in params) { + const value = params[key]; + if (!value) continue; + + switch (key) { + case 'name': + where[key] = {like: `%${value}%`}; + break; + case 'producerFk': + case 'typeFk': + case 'size': + case 'inkFk': + where[key] = value; + } + } + + filter.where = where; + + this.$.itemsModel.applyFilter(filter); + } } ngModule.vnComponent('vnItemBasicData', { diff --git a/modules/item/front/basic-data/locale/es.yml b/modules/item/front/basic-data/locale/es.yml index 9fd3ca3c4..d59752ebb 100644 --- a/modules/item/front/basic-data/locale/es.yml +++ b/modules/item/front/basic-data/locale/es.yml @@ -10,4 +10,5 @@ New intrastat: Nuevo intrastat Identifier: Identificador Fragile: Frágil Is shown at website, app that this item cannot travel (wreath, palms, ...): Se muestra en la web, app que este artículo no puede viajar (coronas, palmas, ...) -Multiplier: Multiplicador \ No newline at end of file +Multiplier: Multiplicador +Generic: Genérico \ No newline at end of file From 5931692fac54f1d8c89ccb9e9f42d134ac1372c5 Mon Sep 17 00:00:00 2001 From: alexm Date: Wed, 24 Nov 2021 09:21:41 +0100 Subject: [PATCH 02/14] test(item_basic-data): add genericFk e2e --- db/dump/fixtures.sql | 37 +++++++++++++------------ e2e/helpers/selectors.js | 1 + e2e/paths/04-item/02_basic_data.spec.js | 25 +++++++++++------ 3 files changed, 37 insertions(+), 26 deletions(-) diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index dd21ca847..c2879e26d 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -796,25 +796,26 @@ INSERT INTO `vn`.`itemFamily`(`code`, `description`) ('SER', 'Services'), ('VT', 'Sales'); -INSERT INTO `vn`.`item`(`id`, `typeFk`, `size`, `inkFk`, `stems`, `originFk`, `description`, `producerFk`, `intrastatFk`, `expenceFk`, `comment`, `relevancy`, `image`, `subName`, `minPrice`, `stars`, `family`, `isFloramondo`) +INSERT INTO `vn`.`item`(`id`, `typeFk`, `size`, `inkFk`, `stems`, `originFk`, `description`, `producerFk`, `intrastatFk`, + `expenceFk`, `comment`, `relevancy`, `image`, `subName`, `minPrice`, `stars`, `family`, `isFloramondo, genericFk`) VALUES - (1, 2, 70, 'YEL', 1, 1, NULL, 1, 06021010, 2000000000, NULL, 0, '1', NULL, 0, 1, 'VT', 0), - (2, 2, 70, 'BLU', 1, 2, NULL, 1, 06021010, 2000000000, NULL, 0, '2', NULL, 0, 2, 'VT', 0), - (3, 1, 60, 'YEL', 1, 3, NULL, 1, 05080000, 4751000000, NULL, 0, '3', NULL, 0, 5, 'VT', 0), - (4, 1, 60, 'YEL', 1, 1, 'Increases block', 1, 05080000, 4751000000, NULL, 0, '4', NULL, 0, 3, 'VT', 0), - (5, 3, 30, 'RED', 1, 2, NULL, 2, 06021010, 4751000000, NULL, 0, '5', NULL, 0, 3, 'VT', 0), - (6, 5, 30, 'RED', 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '6', NULL, 0, 4, 'VT', 0), - (7, 5, 90, 'BLU', 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '7', NULL, 0, 4, 'VT', 0), - (8, 2, 70, 'YEL', 1, 1, NULL, 1, 06021010, 2000000000, NULL, 0, '8', NULL, 0, 5, 'VT', 0), - (9, 2, 70, 'BLU', 1, 2, NULL, 1, 06021010, 2000000000, NULL, 0, '9', NULL, 0, 4, 'VT', 1), - (10, 1, 60, 'YEL', 1, 3, NULL, 1, 05080000, 4751000000, NULL, 0, '10', NULL, 0, 4, 'VT', 0), - (11, 1, 60, 'YEL', 1, 1, NULL, 1, 05080000, 4751000000, NULL, 0, '11', NULL, 0, 4, 'VT', 0), - (12, 3, 30, 'RED', 1, 2, NULL, 2, 06021010, 4751000000, NULL, 0, '12', NULL, 0, 3, 'VT', 0), - (13, 5, 30, 'RED', 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '13', NULL, 0, 2, 'VT', 1), - (14, 5, 90, 'BLU', 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 4, 'VT', 1), - (15, 4, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 0, 'EMB', 0), - (16, 6, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 0, 'EMB', 0), - (71, 6, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 0, 'VT', 0); + (9, 2, 70, 'BLU', 1, 2, NULL, 1, 06021010, 2000000000, NULL, 0, '9', NULL, 0, 4, 'VT', 1, NULL), + (2, 2, 70, 'BLU', 1, 2, NULL, 1, 06021010, 2000000000, NULL, 0, '2', NULL, 0, 2, 'VT', 0, 9), + (3, 1, 60, 'YEL', 1, 3, NULL, 1, 05080000, 4751000000, NULL, 0, '3', NULL, 0, 5, 'VT', 0, NULL), + (1, 2, 70, 'YEL', 1, 1, NULL, 1, 06021010, 2000000000, NULL, 0, '1', NULL, 0, 1, 'VT', 0, NULL), + (4, 1, 60, 'YEL', 1, 1, 'Increases block', 1, 05080000, 4751000000, NULL, 0, '4', NULL, 0, 3, 'VT', 0, NULL), + (5, 3, 30, 'RED', 1, 2, NULL, 2, 06021010, 4751000000, NULL, 0, '5', NULL, 0, 3, 'VT', 0, NULL), + (6, 5, 30, 'RED', 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '6', NULL, 0, 4, 'VT', 0, NULL), + (7, 5, 90, 'BLU', 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '7', NULL, 0, 4, 'VT', 0, NULL), + (8, 2, 70, 'YEL', 1, 1, NULL, 1, 06021010, 2000000000, NULL, 0, '8', NULL, 0, 5, 'VT', 0, NULL), + (10, 1, 60, 'YEL', 1, 3, NULL, 1, 05080000, 4751000000, NULL, 0, '10', NULL, 0, 4, 'VT', 0, NULL), + (11, 1, 60, 'YEL', 1, 1, NULL, 1, 05080000, 4751000000, NULL, 0, '11', NULL, 0, 4, 'VT', 0, NULL), + (12, 3, 30, 'RED', 1, 2, NULL, 2, 06021010, 4751000000, NULL, 0, '12', NULL, 0, 3, 'VT', 0, NULL), + (13, 5, 30, 'RED', 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '13', NULL, 0, 2, 'VT', 1, NULL), + (14, 5, 90, 'BLU', 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 4, 'VT', 1, NULL), + (15, 4, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 0, 'EMB', 0, NULL), + (16, 6, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 0, 'EMB', 0, NULL), + (71, 6, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 0, 'VT', 0, NULL); -- Update the taxClass after insert of the items UPDATE `vn`.`itemTaxCountry` SET `taxClassFk` = 2 diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index d8ebaa069..b95ecbd7f 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -382,6 +382,7 @@ export default { relevancy: 'vn-item-basic-data vn-input-number[ng-model="$ctrl.item.relevancy"]', origin: 'vn-autocomplete[ng-model="$ctrl.item.originFk"]', compression: 'vn-item-basic-data vn-input-number[ng-model="$ctrl.item.compression"]', + generic: 'vn-autocomplete[ng-model="$ctrl.item.genericFk"]', isFragile: 'vn-check[ng-model="$ctrl.item.isFragile"]', longName: 'vn-textfield[ng-model="$ctrl.item.longName"]', isActiveCheckbox: 'vn-check[label="Active"]', diff --git a/e2e/paths/04-item/02_basic_data.spec.js b/e2e/paths/04-item/02_basic_data.spec.js index defefe279..ff3bda13f 100644 --- a/e2e/paths/04-item/02_basic_data.spec.js +++ b/e2e/paths/04-item/02_basic_data.spec.js @@ -1,7 +1,7 @@ import selectors from '../../helpers/selectors.js'; import getBrowser from '../../helpers/puppeteer'; -describe('Item Edit basic data path', () => { +fdescribe('Item Edit basic data path', () => { let browser; let page; beforeAll(async() => { @@ -23,15 +23,17 @@ describe('Item Edit basic data path', () => { it(`should edit the item basic data`, async() => { await page.clearInput(selectors.itemBasicData.name); await page.write(selectors.itemBasicData.name, 'Rose of Purity'); - await page.autocompleteSearch(selectors.itemBasicData.type, 'Anthurium'); - await page.autocompleteSearch(selectors.itemBasicData.intrastat, 'Coral y materiales similares'); - await page.clearInput(selectors.itemBasicData.relevancy); - await page.write(selectors.itemBasicData.relevancy, '1'); - await page.autocompleteSearch(selectors.itemBasicData.origin, 'Spain'); - await page.clearInput(selectors.itemBasicData.compression); - await page.write(selectors.itemBasicData.compression, '2'); await page.clearInput(selectors.itemBasicData.longName); await page.write(selectors.itemBasicData.longName, 'RS Rose of Purity'); + await page.autocompleteSearch(selectors.itemBasicData.type, 'Anthurium'); + await page.autocompleteSearch(selectors.itemBasicData.intrastat, 'Coral y materiales similares'); + await page.autocompleteSearch(selectors.itemBasicData.origin, 'Spain'); + await page.clearInput(selectors.itemBasicData.relevancy); + await page.write(selectors.itemBasicData.relevancy, '1'); + await page.clearInput(selectors.itemBasicData.compression); + await page.write(selectors.itemBasicData.compression, '2'); + await page.clearInput(selectors.itemBasicData.generic); + await page.autocompleteSearch(selectors.itemBasicData.generic, '9'); await page.waitToClick(selectors.itemBasicData.isActiveCheckbox); await page.waitToClick(selectors.itemBasicData.priceInKgCheckbox); await page.waitToClick(selectors.itemBasicData.isFragile); @@ -101,6 +103,13 @@ describe('Item Edit basic data path', () => { expect(result).toEqual('2'); }); + it(`should confirm the item generic was edited`, async() => { + const result = await page + .waitToGetProperty(selectors.itemBasicData.generic, 'value'); + + expect(result).toEqual('9 - Melee Reinforced weapon combat fist 15cm'); + }); + it(`should confirm the item long name was edited`, async() => { const result = await page .waitToGetProperty(selectors.itemBasicData.longName, 'value'); From eea94136288f49e02f03f8ad2479264d451ffd5c Mon Sep 17 00:00:00 2001 From: alexm Date: Fri, 26 Nov 2021 08:34:32 +0100 Subject: [PATCH 03/14] fix(item_basic-data): controller, test e2e and model --- db/dump/fixtures.sql | 45 +++++++++++++----------- e2e/paths/04-item/02_basic_data.spec.js | 6 ++-- modules/item/back/models/item.json | 6 +--- modules/item/front/basic-data/index.html | 2 ++ modules/item/front/basic-data/index.js | 2 +- 5 files changed, 32 insertions(+), 29 deletions(-) diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index c2879e26d..4eb97cf50 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -796,31 +796,32 @@ INSERT INTO `vn`.`itemFamily`(`code`, `description`) ('SER', 'Services'), ('VT', 'Sales'); -INSERT INTO `vn`.`item`(`id`, `typeFk`, `size`, `inkFk`, `stems`, `originFk`, `description`, `producerFk`, `intrastatFk`, - `expenceFk`, `comment`, `relevancy`, `image`, `subName`, `minPrice`, `stars`, `family`, `isFloramondo, genericFk`) +INSERT INTO `vn`.`item`(`id`, `typeFk`, `size`, `inkFk`, `stems`, `originFk`, `description`, `producerFk`, `intrastatFk`, `expenceFk`, + `comment`, `relevancy`, `image`, `subName`, `minPrice`, `stars`, `family`, `isFloramondo`, `genericFk`) VALUES - (9, 2, 70, 'BLU', 1, 2, NULL, 1, 06021010, 2000000000, NULL, 0, '9', NULL, 0, 4, 'VT', 1, NULL), - (2, 2, 70, 'BLU', 1, 2, NULL, 1, 06021010, 2000000000, NULL, 0, '2', NULL, 0, 2, 'VT', 0, 9), - (3, 1, 60, 'YEL', 1, 3, NULL, 1, 05080000, 4751000000, NULL, 0, '3', NULL, 0, 5, 'VT', 0, NULL), - (1, 2, 70, 'YEL', 1, 1, NULL, 1, 06021010, 2000000000, NULL, 0, '1', NULL, 0, 1, 'VT', 0, NULL), - (4, 1, 60, 'YEL', 1, 1, 'Increases block', 1, 05080000, 4751000000, NULL, 0, '4', NULL, 0, 3, 'VT', 0, NULL), - (5, 3, 30, 'RED', 1, 2, NULL, 2, 06021010, 4751000000, NULL, 0, '5', NULL, 0, 3, 'VT', 0, NULL), - (6, 5, 30, 'RED', 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '6', NULL, 0, 4, 'VT', 0, NULL), - (7, 5, 90, 'BLU', 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '7', NULL, 0, 4, 'VT', 0, NULL), - (8, 2, 70, 'YEL', 1, 1, NULL, 1, 06021010, 2000000000, NULL, 0, '8', NULL, 0, 5, 'VT', 0, NULL), - (10, 1, 60, 'YEL', 1, 3, NULL, 1, 05080000, 4751000000, NULL, 0, '10', NULL, 0, 4, 'VT', 0, NULL), - (11, 1, 60, 'YEL', 1, 1, NULL, 1, 05080000, 4751000000, NULL, 0, '11', NULL, 0, 4, 'VT', 0, NULL), - (12, 3, 30, 'RED', 1, 2, NULL, 2, 06021010, 4751000000, NULL, 0, '12', NULL, 0, 3, 'VT', 0, NULL), - (13, 5, 30, 'RED', 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '13', NULL, 0, 2, 'VT', 1, NULL), - (14, 5, 90, 'BLU', 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 4, 'VT', 1, NULL), - (15, 4, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 0, 'EMB', 0, NULL), - (16, 6, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 0, 'EMB', 0, NULL), - (71, 6, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 0, 'VT', 0, NULL); + (1, 2, 70, 'YEL', 1, 1, NULL, 1, 06021010, 2000000000, NULL, 0, '1', NULL, 0, 1, 'VT', 0, NULL), + (2, 2, 70, 'BLU', 1, 2, NULL, 1, 06021010, 2000000000, NULL, 0, '2', NULL, 0, 2, 'VT', 0, NULL), + (3, 1, 60, 'YEL', 1, 3, NULL, 1, 05080000, 4751000000, NULL, 0, '3', NULL, 0, 5, 'VT', 0, NULL), + (4, 1, 60, 'YEL', 1, 1, 'Increases block', 1, 05080000, 4751000000, NULL, 0, '4', NULL, 0, 3, 'VT', 0, NULL), + (5, 3, 30, 'RED', 1, 2, NULL, 2, 06021010, 4751000000, NULL, 0, '5', NULL, 0, 3, 'VT', 0, NULL), + (6, 5, 30, 'RED', 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '6', NULL, 0, 4, 'VT', 0, NULL), + (7, 5, 90, 'BLU', 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '7', NULL, 0, 4, 'VT', 0, NULL), + (8, 2, 70, 'YEL', 1, 1, NULL, 1, 06021010, 2000000000, NULL, 0, '8', NULL, 0, 5, 'VT', 0, NULL), + (9, 2, 70, 'BLU', 1, 2, NULL, 1, 06021010, 2000000000, NULL, 0, '9', NULL, 0, 4, 'VT', 1, NULL), + (10, 1, 60, 'YEL', 1, 3, NULL, 1, 05080000, 4751000000, NULL, 0, '10', NULL, 0, 4, 'VT', 0, NULL), + (11, 1, 60, 'YEL', 1, 1, NULL, 1, 05080000, 4751000000, NULL, 0, '11', NULL, 0, 4, 'VT', 0, NULL), + (12, 3, 30, 'RED', 1, 2, NULL, 2, 06021010, 4751000000, NULL, 0, '12', NULL, 0, 3, 'VT', 0, NULL), + (13, 5, 30, 'RED', 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '13', NULL, 0, 2, 'VT', 1, NULL), + (14, 5, 90, 'BLU', 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 4, 'VT', 1, NULL), + (15, 4, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 0, 'EMB', 0, NULL), + (16, 6, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 0, 'EMB', 0, NULL), + (71, 6, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 0, 'VT', 0, NULL); -- Update the taxClass after insert of the items UPDATE `vn`.`itemTaxCountry` SET `taxClassFk` = 2 WHERE `itemFk` IN(4, 5, 6, 7, 11, 12, 13, 14, 15, 16, 71); + INSERT INTO `vn`.`priceFixed`(`id`, `itemFk`, `rate0`, `rate1`, `rate2`, `rate3`, `started`, `ended`, `bonus`, `warehouseFk`, `created`) VALUES (1, 1, 0, 0, 2.5, 2, CURDATE(), DATE_ADD(CURDATE(), INTERVAL +1 MONTH), 0, 1, CURDATE()), @@ -2419,4 +2420,8 @@ INSERT INTO `vn`.`expeditionScan` (`id`, `expeditionFk`, `scanned`, `palletFk`) (9, 9, CURDATE(), 1), (10, 10, CURDATE(), 1); -CALL `cache`.`last_buy_refresh`(FALSE); \ No newline at end of file +CALL `cache`.`last_buy_refresh`(FALSE); + +-- Update the genericFk after insert of the items + UPDATE `vn`.`item` SET `genericFk` = 9 + WHERE `id` = 2; \ No newline at end of file diff --git a/e2e/paths/04-item/02_basic_data.spec.js b/e2e/paths/04-item/02_basic_data.spec.js index ff3bda13f..0bbb6ad12 100644 --- a/e2e/paths/04-item/02_basic_data.spec.js +++ b/e2e/paths/04-item/02_basic_data.spec.js @@ -1,7 +1,7 @@ import selectors from '../../helpers/selectors.js'; import getBrowser from '../../helpers/puppeteer'; -fdescribe('Item Edit basic data path', () => { +describe('Item Edit basic data path', () => { let browser; let page; beforeAll(async() => { @@ -33,7 +33,7 @@ fdescribe('Item Edit basic data path', () => { await page.clearInput(selectors.itemBasicData.compression); await page.write(selectors.itemBasicData.compression, '2'); await page.clearInput(selectors.itemBasicData.generic); - await page.autocompleteSearch(selectors.itemBasicData.generic, '9'); + await page.autocompleteSearch(selectors.itemBasicData.generic, '16'); await page.waitToClick(selectors.itemBasicData.isActiveCheckbox); await page.waitToClick(selectors.itemBasicData.priceInKgCheckbox); await page.waitToClick(selectors.itemBasicData.isFragile); @@ -107,7 +107,7 @@ fdescribe('Item Edit basic data path', () => { const result = await page .waitToGetProperty(selectors.itemBasicData.generic, 'value'); - expect(result).toEqual('9 - Melee Reinforced weapon combat fist 15cm'); + expect(result).toEqual('16 - Pallet'); }); it(`should confirm the item long name was edited`, async() => { diff --git a/modules/item/back/models/item.json b/modules/item/back/models/item.json index d78e929ed..9b78264f7 100644 --- a/modules/item/back/models/item.json +++ b/modules/item/back/models/item.json @@ -143,10 +143,6 @@ }, "isFloramondo": { "type": "boolean" - }, - "genericFk": { - "type": "number", - "description": "Generic item" } }, "relations": { @@ -180,7 +176,7 @@ "model": "Expense", "foreignKey": "expenseFk" }, - "id": { + "generic": { "type": "belongsTo", "model": "Item", "foreignKey": "genericFk" diff --git a/modules/item/front/basic-data/index.html b/modules/item/front/basic-data/index.html index 02dd08ebc..3bf1fc10b 100644 --- a/modules/item/front/basic-data/index.html +++ b/modules/item/front/basic-data/index.html @@ -158,6 +158,8 @@ + + Date: Fri, 26 Nov 2021 08:40:20 +0100 Subject: [PATCH 04/14] remove unnecessary intro and comment --- db/dump/fixtures.sql | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index 4eb97cf50..b480a6d78 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -821,7 +821,6 @@ INSERT INTO `vn`.`item`(`id`, `typeFk`, `size`, `inkFk`, `stems`, `originFk`, `d UPDATE `vn`.`itemTaxCountry` SET `taxClassFk` = 2 WHERE `itemFk` IN(4, 5, 6, 7, 11, 12, 13, 14, 15, 16, 71); - INSERT INTO `vn`.`priceFixed`(`id`, `itemFk`, `rate0`, `rate1`, `rate2`, `rate3`, `started`, `ended`, `bonus`, `warehouseFk`, `created`) VALUES (1, 1, 0, 0, 2.5, 2, CURDATE(), DATE_ADD(CURDATE(), INTERVAL +1 MONTH), 0, 1, CURDATE()), @@ -2422,6 +2421,5 @@ INSERT INTO `vn`.`expeditionScan` (`id`, `expeditionFk`, `scanned`, `palletFk`) CALL `cache`.`last_buy_refresh`(FALSE); --- Update the genericFk after insert of the items - UPDATE `vn`.`item` SET `genericFk` = 9 - WHERE `id` = 2; \ No newline at end of file +UPDATE `vn`.`item` SET `genericFk` = 9 + WHERE `id` = 2; \ No newline at end of file From e13f2d4ae30c524026a84e49c269bd19a2bc75bd Mon Sep 17 00:00:00 2001 From: vicent Date: Fri, 26 Nov 2021 10:06:13 +0100 Subject: [PATCH 05/14] feat(route_ticket): add column province and change order other columns --- .../back/methods/route/getSuggestedTickets.js | 8 +++++++- modules/route/front/tickets/index.html | 16 +++++++++++----- modules/route/front/tickets/locale/es.yml | 3 ++- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/modules/route/back/methods/route/getSuggestedTickets.js b/modules/route/back/methods/route/getSuggestedTickets.js index 49d7c1977..c1d6b67fe 100644 --- a/modules/route/back/methods/route/getSuggestedTickets.js +++ b/modules/route/back/methods/route/getSuggestedTickets.js @@ -55,7 +55,13 @@ module.exports = Self => { { relation: 'address', scope: { - fields: ['id', 'street', 'postalCode', 'city'], + fields: ['street', 'city', 'provinceFk', 'phone', 'nickname', 'postalCode'], + include: { + relation: 'province', + scope: { + fields: ['name'] + } + } } }, ] diff --git a/modules/route/front/tickets/index.html b/modules/route/front/tickets/index.html index 6329dbb1a..7d515b67c 100644 --- a/modules/route/front/tickets/index.html +++ b/modules/route/front/tickets/index.html @@ -142,10 +142,15 @@ Ticket Client - Packages - Warehouse - Postcode + Province + + + Population + + + PC Address + Warehouse @@ -165,10 +170,11 @@ {{::ticket.nickname}} - {{::ticket.packages}} - {{::ticket.warehouse.name}} + {{::ticket.address.province.name}} + {{::ticket.address.city}} {{::ticket.address.postalCode}} {{::ticket.address.street}} + {{::ticket.warehouse.name}} diff --git a/modules/route/front/tickets/locale/es.yml b/modules/route/front/tickets/locale/es.yml index 6fa29e5ca..d4ab440a7 100644 --- a/modules/route/front/tickets/locale/es.yml +++ b/modules/route/front/tickets/locale/es.yml @@ -10,4 +10,5 @@ Ticket not found: No se ha encontrado el ticket The selected ticket is not suitable for this route: El ticket seleccionado no es apto para esta ruta PC: CP The route's vehicle doesn't have a departing warehouse: El vehículo de la ruta no tiene un almacén de salida -The route doesn't have a vehicle: La ruta no tiene un vehículo \ No newline at end of file +The route doesn't have a vehicle: La ruta no tiene un vehículo +Population: Población \ No newline at end of file From d1add9ef84fe828a5c1b0558099072aa0c609d1d Mon Sep 17 00:00:00 2001 From: vicent Date: Fri, 26 Nov 2021 13:16:44 +0100 Subject: [PATCH 06/14] sql changes --- .../10390-constitution/00-department.sql | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 db/changes/10390-constitution/00-department.sql diff --git a/db/changes/10390-constitution/00-department.sql b/db/changes/10390-constitution/00-department.sql new file mode 100644 index 000000000..e882296ad --- /dev/null +++ b/db/changes/10390-constitution/00-department.sql @@ -0,0 +1,33 @@ +UPDATE vn.department + SET notificationEmail='direccioncomercial@verdnatura.es' + WHERE id=96; +UPDATE vn.department + SET notificationEmail='direccioncomercial@verdnatura.es' + WHERE id=95; +UPDATE vn.department + SET notificationEmail='direccioncomercial@verdnatura.es' + WHERE id=115; +UPDATE vn.department + SET notificationEmail='direccioncomercial@verdnatura.es' + WHERE id=123; +UPDATE vn.department + SET notificationEmail='direccioncomercial@verdnatura.es' + WHERE id=94; +UPDATE vn.department + SET notificationEmail='direccioncomercial@verdnatura.es' + WHERE id=101; +UPDATE vn.department + SET notificationEmail='direccioncomercial@verdnatura.es' + WHERE id=80; +UPDATE vn.department + SET notificationEmail='direccioncomercial@verdnatura.es' + WHERE id=125; +UPDATE vn.department + SET notificationEmail='direccioncomercial@verdnatura.es' + WHERE id=98; +UPDATE vn.department + SET notificationEmail='direccioncomercial@verdnatura.es' + WHERE id=92; +UPDATE vn.department + SET notificationEmail='' + WHERE id=43; \ No newline at end of file From 65053f5f28da9d81ed63f67693240c2baa886891 Mon Sep 17 00:00:00 2001 From: alexm Date: Fri, 26 Nov 2021 13:26:48 +0100 Subject: [PATCH 07/14] feat(worker_time-control): add timestamp url param --- modules/worker/front/routes.json | 2 +- modules/worker/front/time-control/index.html | 1 + modules/worker/front/time-control/index.js | 10 +++++++++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/modules/worker/front/routes.json b/modules/worker/front/routes.json index 4bad33dd0..47334d841 100644 --- a/modules/worker/front/routes.json +++ b/modules/worker/front/routes.json @@ -83,7 +83,7 @@ "worker": "$ctrl.worker" } }, { - "url": "/time-control", + "url": "/time-control?timestamp", "state": "worker.card.timeControl", "component": "vn-worker-time-control", "description": "Time control", diff --git a/modules/worker/front/time-control/index.html b/modules/worker/front/time-control/index.html index 66d6f282e..170d88b21 100644 --- a/modules/worker/front/time-control/index.html +++ b/modules/worker/front/time-control/index.html @@ -91,6 +91,7 @@ diff --git a/modules/worker/front/time-control/index.js b/modules/worker/front/time-control/index.js index 96913c505..1f6251391 100644 --- a/modules/worker/front/time-control/index.js +++ b/modules/worker/front/time-control/index.js @@ -15,7 +15,15 @@ class Controller extends Section { } $postLink() { - this.date = new Date(); + const timestamp = this.$params.timestamp; + let initialDate = new Date(); + + if (timestamp) { + initialDate = new Date(timestamp * 1000); + this.$.calendar.defaultDate = initialDate; + } + + this.date = initialDate; } get worker() { From 442bf1940e01d5c601141c69a900427bd0f2b670 Mon Sep 17 00:00:00 2001 From: vicent Date: Fri, 26 Nov 2021 13:28:12 +0100 Subject: [PATCH 08/14] delete last commit, uploaed by error --- .../10390-constitution/00-department.sql | 33 ------------------- 1 file changed, 33 deletions(-) delete mode 100644 db/changes/10390-constitution/00-department.sql diff --git a/db/changes/10390-constitution/00-department.sql b/db/changes/10390-constitution/00-department.sql deleted file mode 100644 index e882296ad..000000000 --- a/db/changes/10390-constitution/00-department.sql +++ /dev/null @@ -1,33 +0,0 @@ -UPDATE vn.department - SET notificationEmail='direccioncomercial@verdnatura.es' - WHERE id=96; -UPDATE vn.department - SET notificationEmail='direccioncomercial@verdnatura.es' - WHERE id=95; -UPDATE vn.department - SET notificationEmail='direccioncomercial@verdnatura.es' - WHERE id=115; -UPDATE vn.department - SET notificationEmail='direccioncomercial@verdnatura.es' - WHERE id=123; -UPDATE vn.department - SET notificationEmail='direccioncomercial@verdnatura.es' - WHERE id=94; -UPDATE vn.department - SET notificationEmail='direccioncomercial@verdnatura.es' - WHERE id=101; -UPDATE vn.department - SET notificationEmail='direccioncomercial@verdnatura.es' - WHERE id=80; -UPDATE vn.department - SET notificationEmail='direccioncomercial@verdnatura.es' - WHERE id=125; -UPDATE vn.department - SET notificationEmail='direccioncomercial@verdnatura.es' - WHERE id=98; -UPDATE vn.department - SET notificationEmail='direccioncomercial@verdnatura.es' - WHERE id=92; -UPDATE vn.department - SET notificationEmail='' - WHERE id=43; \ No newline at end of file From 2f7295020cb8ee3715f2589d22aa91f79e05bdb1 Mon Sep 17 00:00:00 2001 From: vicent Date: Fri, 26 Nov 2021 13:30:40 +0100 Subject: [PATCH 09/14] update column notificationEmail --- .../10390-constitution/00-department.sql | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 db/changes/10390-constitution/00-department.sql diff --git a/db/changes/10390-constitution/00-department.sql b/db/changes/10390-constitution/00-department.sql new file mode 100644 index 000000000..e882296ad --- /dev/null +++ b/db/changes/10390-constitution/00-department.sql @@ -0,0 +1,33 @@ +UPDATE vn.department + SET notificationEmail='direccioncomercial@verdnatura.es' + WHERE id=96; +UPDATE vn.department + SET notificationEmail='direccioncomercial@verdnatura.es' + WHERE id=95; +UPDATE vn.department + SET notificationEmail='direccioncomercial@verdnatura.es' + WHERE id=115; +UPDATE vn.department + SET notificationEmail='direccioncomercial@verdnatura.es' + WHERE id=123; +UPDATE vn.department + SET notificationEmail='direccioncomercial@verdnatura.es' + WHERE id=94; +UPDATE vn.department + SET notificationEmail='direccioncomercial@verdnatura.es' + WHERE id=101; +UPDATE vn.department + SET notificationEmail='direccioncomercial@verdnatura.es' + WHERE id=80; +UPDATE vn.department + SET notificationEmail='direccioncomercial@verdnatura.es' + WHERE id=125; +UPDATE vn.department + SET notificationEmail='direccioncomercial@verdnatura.es' + WHERE id=98; +UPDATE vn.department + SET notificationEmail='direccioncomercial@verdnatura.es' + WHERE id=92; +UPDATE vn.department + SET notificationEmail='' + WHERE id=43; \ No newline at end of file From e4d7d957eb697bdb9e30e925da37835172ccf01a Mon Sep 17 00:00:00 2001 From: joan Date: Fri, 26 Nov 2021 14:48:55 +0100 Subject: [PATCH 10/14] Rectified icons --- front/core/styles/icons/salixfont.css | 16 ++++++++-------- modules/client/front/descriptor/index.html | 2 +- modules/client/front/routes.json | 2 +- modules/supplier/front/routes.json | 2 +- modules/ticket/front/index/index.html | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/front/core/styles/icons/salixfont.css b/front/core/styles/icons/salixfont.css index 8136b5fa6..1ecfe8978 100644 --- a/front/core/styles/icons/salixfont.css +++ b/front/core/styles/icons/salixfont.css @@ -129,13 +129,13 @@ .icon-columndelete:before { content: "\e91d"; } -.icon-complementos:before { +.icon-accessory:before { content: "\e91e"; } .icon-components:before { content: "\e91f"; } -.icon-confeccion:before { +.icon-handmade:before { content: "\e920"; } .icon-consignatarios:before { @@ -180,7 +180,7 @@ .icon-fixedPrice:before { content: "\e92e"; } -.icon-flor:before { +.icon-flower:before { content: "\e92f"; } .icon-frozen:before { @@ -207,7 +207,7 @@ .icon-history:before { content: "\e937"; } -.icon-Inactivo:before { +.icon-disabled:before { content: "\e938"; } .icon-info:before { @@ -285,7 +285,7 @@ .icon-photo:before { content: "\e951"; } -.icon-planta:before { +.icon-plant:before { content: "\e952"; } .icon-stowaway:before { @@ -300,13 +300,13 @@ .icon-regentry:before { content: "\e956"; } -.icon-reserva:before { +.icon-reserve:before { content: "\e957"; } .icon-revision:before { content: "\e958"; } -.icon-riesgo:before { +.icon-risk:before { content: "\e959"; } .icon-services:before { @@ -372,7 +372,7 @@ .icon-unavailable:before { content: "\e96e"; } -.icon-verde:before { +.icon-greenery:before { content: "\e96f"; } .icon-volume:before { diff --git a/modules/client/front/descriptor/index.html b/modules/client/front/descriptor/index.html index d5beca282..505a3ed0a 100644 --- a/modules/client/front/descriptor/index.html +++ b/modules/client/front/descriptor/index.html @@ -82,7 +82,7 @@ + icon="icon-invoice">
diff --git a/modules/client/front/routes.json b/modules/client/front/routes.json index ac5e78d99..765fbc637 100644 --- a/modules/client/front/routes.json +++ b/modules/client/front/routes.json @@ -16,7 +16,7 @@ {"state": "client.card.note.index", "icon": "insert_drive_file"}, {"state": "client.card.credit.index", "icon": "credit_card"}, {"state": "client.card.greuge.index", "icon": "work"}, - {"state": "client.card.balance.index", "icon": "icon-invoices"}, + {"state": "client.card.balance.index", "icon": "icon-invoice"}, {"state": "client.card.recovery.index", "icon": "icon-recovery"}, {"state": "client.card.webAccess", "icon": "cloud"}, {"state": "client.card.log", "icon": "history"}, diff --git a/modules/supplier/front/routes.json b/modules/supplier/front/routes.json index 9be6b7a85..3d3814f5d 100644 --- a/modules/supplier/front/routes.json +++ b/modules/supplier/front/routes.json @@ -13,7 +13,7 @@ {"state": "supplier.card.fiscalData", "icon": "account_balance"}, {"state": "supplier.card.billingData", "icon": "icon-payment"}, {"state": "supplier.card.address.index", "icon": "icon-delivery"}, - {"state": "supplier.card.account", "icon": "icon-accounts"}, + {"state": "supplier.card.account", "icon": "icon-account"}, {"state": "supplier.card.contact", "icon": "contact_phone"}, {"state": "supplier.card.log", "icon": "history"}, {"state": "supplier.card.consumption", "icon": "show_chart"} diff --git a/modules/ticket/front/index/index.html b/modules/ticket/front/index/index.html index 096f57e05..852675f76 100644 --- a/modules/ticket/front/index/index.html +++ b/modules/ticket/front/index/index.html @@ -167,7 +167,7 @@ tooltip-position="left"> Date: Mon, 29 Nov 2021 10:10:53 +0100 Subject: [PATCH 11/14] remove unnecesary on-accept --- modules/entry/front/buy/import/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/entry/front/buy/import/index.js b/modules/entry/front/buy/import/index.js index a88476240..2f13b2746 100644 --- a/modules/entry/front/buy/import/index.js +++ b/modules/entry/front/buy/import/index.js @@ -133,7 +133,7 @@ class Controller extends Section { case 'producerFk': case 'typeFk': case 'size': - case 'inkFk': + case 'ink': where[key] = value; } } From 49e9fcaa7ccbdfc0e149e2bca6e284de05ed4d93 Mon Sep 17 00:00:00 2001 From: alexm Date: Mon, 29 Nov 2021 10:11:47 +0100 Subject: [PATCH 12/14] remove unnecesary on-accept --- modules/entry/front/buy/import/index.html | 1 - modules/entry/front/buy/import/index.js | 2 +- modules/item/front/basic-data/index.html | 1 - 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/modules/entry/front/buy/import/index.html b/modules/entry/front/buy/import/index.html index ada92fcc3..154e74ffc 100644 --- a/modules/entry/front/buy/import/index.html +++ b/modules/entry/front/buy/import/index.html @@ -113,7 +113,6 @@ diff --git a/modules/entry/front/buy/import/index.js b/modules/entry/front/buy/import/index.js index 2f13b2746..a88476240 100644 --- a/modules/entry/front/buy/import/index.js +++ b/modules/entry/front/buy/import/index.js @@ -133,7 +133,7 @@ class Controller extends Section { case 'producerFk': case 'typeFk': case 'size': - case 'ink': + case 'inkFk': where[key] = value; } } diff --git a/modules/item/front/basic-data/index.html b/modules/item/front/basic-data/index.html index 3bf1fc10b..e926e3180 100644 --- a/modules/item/front/basic-data/index.html +++ b/modules/item/front/basic-data/index.html @@ -230,7 +230,6 @@ From 85e3b47408e70048290b816d7227624b98945f49 Mon Sep 17 00:00:00 2001 From: alexm Date: Mon, 29 Nov 2021 15:22:16 +0100 Subject: [PATCH 13/14] test(worker_time-control): tested url parameter timestamp --- e2e/helpers/puppeteer.js | 2 +- .../worker/front/time-control/index.spec.js | 23 +++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/e2e/helpers/puppeteer.js b/e2e/helpers/puppeteer.js index dace276be..abd76b434 100644 --- a/e2e/helpers/puppeteer.js +++ b/e2e/helpers/puppeteer.js @@ -27,7 +27,7 @@ export async function getBrowser() { args, defaultViewport: null, headless: headless, - slowMo: 5, // slow down by ms + slowMo: 1, // slow down by ms // ignoreDefaultArgs: ['--disable-extensions'], // executablePath: '/usr/bin/google-chrome-stable', // executablePath: '/usr/bin/firefox-developer-edition', diff --git a/modules/worker/front/time-control/index.spec.js b/modules/worker/front/time-control/index.spec.js index 920f13e7c..39a47c47f 100644 --- a/modules/worker/front/time-control/index.spec.js +++ b/modules/worker/front/time-control/index.spec.js @@ -129,5 +129,28 @@ describe('Component vnWorkerTimeControl', () => { expect(controller.fetchHours).toHaveBeenCalledWith(); }); }); + + describe('$postLink() ', () => { + it(`should set the controller date as today if no timestamp is defined`, () => { + controller.$.model = {applyFilter: jest.fn().mockReturnValue(Promise.resolve())}; + controller.$params = {timestamp: undefined}; + controller.$postLink(); + + expect(controller.date).toEqual(jasmine.any(Date)); + }); + + it(`should set the controller date using the received timestamp`, () => { + const date = 'Wed, 31 Dec 1969 23:00:00 GMT'; + const timestamp = 1; + + controller.$.model = {applyFilter: jest.fn().mockReturnValue(Promise.resolve())}; + controller.$.calendar = {}; + controller.$params = {timestamp: timestamp}; + + controller.$postLink(); + + expect(controller.date.toUTCString()).toEqual(date); + }); + }); }); }); From 594f258232435b841c11b956aaec32aa1d66a987 Mon Sep 17 00:00:00 2001 From: alexm Date: Tue, 30 Nov 2021 07:16:43 +0100 Subject: [PATCH 14/14] modify js date format --- modules/worker/front/time-control/index.spec.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/worker/front/time-control/index.spec.js b/modules/worker/front/time-control/index.spec.js index 39a47c47f..4f317a5e6 100644 --- a/modules/worker/front/time-control/index.spec.js +++ b/modules/worker/front/time-control/index.spec.js @@ -140,8 +140,8 @@ describe('Component vnWorkerTimeControl', () => { }); it(`should set the controller date using the received timestamp`, () => { - const date = 'Wed, 31 Dec 1969 23:00:00 GMT'; const timestamp = 1; + const date = new Date(timestamp); controller.$.model = {applyFilter: jest.fn().mockReturnValue(Promise.resolve())}; controller.$.calendar = {}; @@ -149,7 +149,7 @@ describe('Component vnWorkerTimeControl', () => { controller.$postLink(); - expect(controller.date.toUTCString()).toEqual(date); + expect(controller.date.toDateString()).toEqual(date.toDateString()); }); }); });