From 0c8fe855acf8c10369900371bea3e4d9529848be Mon Sep 17 00:00:00 2001 From: alexandre Date: Mon, 27 Mar 2023 09:11:29 +0200 Subject: [PATCH 1/8] refs #5418 lateral search panel added, missing e2e --- front/core/styles/variables.scss | 1 + front/salix/components/layout/style.scss | 6 +- .../front/fixed-price-search-panel/index.html | 351 +++++++++++------- .../front/fixed-price-search-panel/index.js | 53 ++- .../fixed-price-search-panel/index.spec.js | 56 +++ .../front/fixed-price-search-panel/style.scss | 71 ++++ modules/item/front/fixed-price/index.html | 10 +- 7 files changed, 396 insertions(+), 152 deletions(-) create mode 100644 modules/item/front/fixed-price-search-panel/index.spec.js create mode 100644 modules/item/front/fixed-price-search-panel/style.scss diff --git a/front/core/styles/variables.scss b/front/core/styles/variables.scss index bcc9fab66..0a00e2e1f 100644 --- a/front/core/styles/variables.scss +++ b/front/core/styles/variables.scss @@ -2,6 +2,7 @@ $font-size: 11pt; $menu-width: 256px; +$right-menu-width: 315px; $topbar-height: 56px; $mobile-width: 800px; $float-spacing: 20px; diff --git a/front/salix/components/layout/style.scss b/front/salix/components/layout/style.scss index 612366228..6697bb1b0 100644 --- a/front/salix/components/layout/style.scss +++ b/front/salix/components/layout/style.scss @@ -88,13 +88,13 @@ vn-layout { } &.right-menu { & > vn-topbar > .end { - width: 80px + $menu-width; + width: 80px + $right-menu-width; } & > .main-view { - padding-right: $menu-width; + padding-right: $right-menu-width; } [fixed-bottom-right] { - right: $menu-width; + right: $right-menu-width; } } & > .main-view { diff --git a/modules/item/front/fixed-price-search-panel/index.html b/modules/item/front/fixed-price-search-panel/index.html index 5c8a58674..ebe210277 100644 --- a/modules/item/front/fixed-price-search-panel/index.html +++ b/modules/item/front/fixed-price-search-panel/index.html @@ -1,136 +1,215 @@ - - -
-
- - - - - - - - - -
{{name}}
-
- {{category.name}} -
-
-
-
- - - - - - - - - - - - - - - - - - - - - Tags - - - - - - - - - - - - - - - - - -
-
+ + + + + + + + + + + + + + + + + + +
{{name}}
+
+ {{category.name}} +
+
+
+
+ + + + + + + + + + + + + + + + + + + + Tags + + + + + + + + + + + + + +
+ + Id/{{$ctrl.$t('Name')}}: {{$ctrl.filter.search}} + + + {{$ctrl.$t('Category')}}: {{category.selection.name}} + + + {{$ctrl.$t('Type')}}: {{type.selection.name}} + + + {{$ctrl.$t('Buyer')}}: {{buyer.selection.nickname}} + + + {{$ctrl.$t('Warehouse')}}: {{warehouse.selection.name}} + + + {{$ctrl.$t('Started')}}: {{$ctrl.filter.started | date:'dd/MM/yyyy'}} + + + {{$ctrl.$t('Ended')}}: {{$ctrl.filter.ended | date:'dd/MM/yyyy'}} + + + {{$ctrl.$t('For me')}}: {{$ctrl.filter.mine ? '✓' : '✗'}} + + + {{$ctrl.$t('Minimum price')}}: {{$ctrl.filter.hasMinPrice ? '✓' : '✗'}} + + + {{$ctrl.showTagInfo(chipTag)}} + +
+
diff --git a/modules/item/front/fixed-price-search-panel/index.js b/modules/item/front/fixed-price-search-panel/index.js index ec13765fd..0882eb5ac 100644 --- a/modules/item/front/fixed-price-search-panel/index.js +++ b/modules/item/front/fixed-price-search-panel/index.js @@ -1,19 +1,60 @@ import ngModule from '../module'; import SearchPanel from 'core/components/searchbar/search-panel'; +import './style.scss'; class Controller extends SearchPanel { - get filter() { - return this.$.filter; + constructor($element, $) { + super($element, $); } - set filter(value = {}) { - if (!value.tags) value.tags = [{}]; + $onInit() { + this.filter = { + tags: [] + }; + } - this.$.filter = value; + changeCategory(id) { + if (this.filter.categoryFk != id) { + this.filter.categoryFk = id; + this.addFilters(); + } + } + + removeItemFilter(param) { + this.filter[param] = null; + if (param == 'categoryFk') this.filter['typeFk'] = null; + this.addFilters(); + } + + removeTag(tag) { + const index = this.filter.tags.indexOf(tag); + if (index > -1) this.filter.tags.splice(index, 1); + this.addFilters(); + } + + onKeyPress($event) { + if ($event.key === 'Enter') + this.addFilters(); + } + + addFilters() { + for (let i = 0; i < this.filter.tags.length; i++) { + if (!this.filter.tags[i].value) + this.filter.tags.splice(i, 1); + } + return this.model.addFilter({}, this.filter); + } + + showTagInfo(itemTag) { + if (!itemTag.tagFk) return itemTag.value; + return `${this.tags.find(tag => tag.id == itemTag.tagFk).name}: ${itemTag.value}`; } } ngModule.vnComponent('vnFixedPriceSearchPanel', { template: require('./index.html'), - controller: Controller + controller: Controller, + bindings: { + model: '<' + } }); diff --git a/modules/item/front/fixed-price-search-panel/index.spec.js b/modules/item/front/fixed-price-search-panel/index.spec.js new file mode 100644 index 000000000..597bc108e --- /dev/null +++ b/modules/item/front/fixed-price-search-panel/index.spec.js @@ -0,0 +1,56 @@ +import './index.js'; + +describe('Item', () => { + describe('Component vnFixedPriceSearchPanel', () => { + let $element; + let controller; + + beforeEach(ngModule('item')); + + beforeEach(angular.mock.inject($componentController => { + $element = angular.element(``); + controller = $componentController('vnFixedPriceSearchPanel', {$element}); + controller.model = {addFilter: () => {}}; + })); + + describe('removeItemFilter()', () => { + it(`should remove param from filter`, () => { + controller.filter = {tags: [], categoryFk: 1, typeFk: 1}; + const expectFilter = {tags: [], categoryFk: null, typeFk: null}; + + controller.removeItemFilter('categoryFk'); + + expect(controller.filter).toEqual(expectFilter); + }); + }); + + describe('removeTag()', () => { + it(`should remove tag from filter`, () => { + const tag = {tagFk: 1, value: 'Value'}; + controller.filter = {tags: [tag]}; + const expectFilter = {tags: []}; + + controller.removeTag(tag); + + expect(controller.filter).toEqual(expectFilter); + }); + }); + + describe('showTagInfo()', () => { + it(`should show tag value`, () => { + const tag = {value: 'Value'}; + const result = controller.showTagInfo(tag); + + expect(result).toEqual('Value'); + }); + + it(`should show tag name and value`, () => { + const tag = {tagFk: 1, value: 'Value'}; + controller.tags = [{id: 1, name: 'tagName'}]; + const result = controller.showTagInfo(tag); + + expect(result).toEqual('tagName: Value'); + }); + }); + }); +}); diff --git a/modules/item/front/fixed-price-search-panel/style.scss b/modules/item/front/fixed-price-search-panel/style.scss new file mode 100644 index 000000000..a63f84f3b --- /dev/null +++ b/modules/item/front/fixed-price-search-panel/style.scss @@ -0,0 +1,71 @@ +@import "variables"; + +vn-fixed-price-search-panel vn-side-menu { + .menu { + min-width: $right-menu-width; + } + & > div { + .input { + padding-left: $spacing-md; + padding-right: $spacing-md; + border-color: $color-spacer; + border-bottom: $border-thin; + } + .horizontal { + padding-left: $spacing-md; + padding-right: $spacing-md; + grid-auto-flow: column; + grid-column-gap: $spacing-sm; + align-items: center; + } + .tags { + padding: $spacing-md; + padding-bottom: 0%; + padding-top: 0%; + align-items: center; + } + .chips { + display: flex; + flex-wrap: wrap; + padding: $spacing-md; + overflow: hidden; + max-width: 100%; + border-color: $color-spacer; + border-top: $border-thin; + } + .item-category { + padding: $spacing-sm; + justify-content: flex-start; + align-items: flex-start; + flex-wrap: wrap; + + vn-autocomplete[vn-id="category"] { + display: none; + } + + & > vn-one { + padding: $spacing-sm; + min-width: 33.33%; + text-align: center; + box-sizing: border-box; + + & > vn-icon { + padding: $spacing-sm; + background-color: $color-font-secondary; + border-radius: 50%; + cursor: pointer; + + &.active { + background-color: $color-main; + color: #fff; + } + & > i:before { + font-size: 2.6rem; + width: 16px; + height: 16px; + } + } + } + } + } +} diff --git a/modules/item/front/fixed-price/index.html b/modules/item/front/fixed-price/index.html index ce7cefe7a..be5acf368 100644 --- a/modules/item/front/fixed-price/index.html +++ b/modules/item/front/fixed-price/index.html @@ -13,14 +13,10 @@ order="name">
- - + +
Date: Mon, 27 Mar 2023 12:12:42 +0200 Subject: [PATCH 2/8] refs #5418 e2e implemented and fixed --- e2e/helpers/selectors.js | 15 ++++- ..._smartTable_searchBar_integrations.spec.js | 9 +-- e2e/paths/04-item/13_fixedPrice.spec.js | 58 +++++++++++++++++-- 3 files changed, 67 insertions(+), 15 deletions(-) diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index f4c67f002..2cbbd31c0 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -414,7 +414,7 @@ export default { saveFieldsButton: '.vn-popover.shown vn-button[label="Save"] > button' }, itemFixedPrice: { - add: 'vn-fixed-price vn-icon-button[icon="add_circle"]', + add: 'vn-fixed-price vn-icon-button[vn-tooltip="Add fixed price"]', firstItemID: 'vn-fixed-price tr:nth-child(2) vn-autocomplete[ng-model="price.itemFk"]', fourthFixedPrice: 'vn-fixed-price tr:nth-child(5)', fourthItemID: 'vn-fixed-price tr:nth-child(5) vn-autocomplete[ng-model="price.itemFk"]', @@ -426,7 +426,18 @@ export default { fourthStarted: 'vn-fixed-price tr:nth-child(5) vn-date-picker[ng-model="price.started"]', fourthEnded: 'vn-fixed-price tr:nth-child(5) vn-date-picker[ng-model="price.ended"]', fourthDeleteIcon: 'vn-fixed-price tr:nth-child(5) > td:nth-child(9) > vn-icon-button[icon="delete"]', - orderColumnId: 'vn-fixed-price th[field="itemFk"]' + orderColumnId: 'vn-fixed-price th[field="itemFk"]', + generalSearchFilter: 'vn-fixed-price-search-panel vn-textfield[ng-model="$ctrl.filter.search"]', + reignFilter: 'vn-fixed-price-search-panel vn-horizontal.item-category vn-one', + typeFilter: 'vn-fixed-price-search-panel vn-autocomplete[ng-model="$ctrl.filter.typeFk"]', + buyerFilter: 'vn-fixed-price-search-panel vn-autocomplete[ng-model="$ctrl.filter.buyerFk"]', + warehouseFilter: 'vn-fixed-price-search-panel vn-autocomplete[ng-model="$ctrl.filter.warehouseFk"]', + mineFilter: 'vn-fixed-price-search-panel vn-check[ng-model="$ctrl.filter.mine"]', + hasMinPriceFilter: 'vn-fixed-price-search-panel vn-check[ng-model="$ctrl.filter.hasMinPrice"]', + addTag: 'vn-fixed-price-search-panel vn-icon-button[icon="add_circle"]', + tagFilter: 'vn-fixed-price-search-panel vn-autocomplete[ng-model="itemTag.tagFk"]', + tagValueFilter: 'vn-fixed-price-search-panel vn-autocomplete[ng-model="itemTag.value"]', + chip: 'vn-fixed-price-search-panel vn-chip > vn-icon', }, itemCreateView: { temporalName: 'vn-item-create vn-textfield[ng-model="$ctrl.item.provisionalName"]', diff --git a/e2e/paths/01-salix/03_smartTable_searchBar_integrations.spec.js b/e2e/paths/01-salix/03_smartTable_searchBar_integrations.spec.js index ad558ace2..1c8fe0840 100644 --- a/e2e/paths/01-salix/03_smartTable_searchBar_integrations.spec.js +++ b/e2e/paths/01-salix/03_smartTable_searchBar_integrations.spec.js @@ -79,21 +79,14 @@ describe('SmartTable SearchBar integration', () => { it('should order by first id', async() => { await page.loginAndModule('developer', 'item'); await page.accessToSection('item.fixedPrice'); - await page.doSearch(); const result = await page.waitToGetProperty(selectors.itemFixedPrice.firstItemID, 'value'); expect(result).toEqual('1'); }); - it('should order by last id', async() => { + it('should order by last id, reload page and have same order', async() => { await page.waitToClick(selectors.itemFixedPrice.orderColumnId); - const result = await page.waitToGetProperty(selectors.itemFixedPrice.firstItemID, 'value'); - - expect(result).toEqual('13'); - }); - - it('should reload page and have same order', async() => { await page.reload({ waitUntil: 'networkidle2' }); diff --git a/e2e/paths/04-item/13_fixedPrice.spec.js b/e2e/paths/04-item/13_fixedPrice.spec.js index 1b0f82d83..df3b4f7a3 100644 --- a/e2e/paths/04-item/13_fixedPrice.spec.js +++ b/e2e/paths/04-item/13_fixedPrice.spec.js @@ -4,19 +4,69 @@ import getBrowser from '../../helpers/puppeteer'; describe('Item fixed prices path', () => { let browser; let page; + let httpRequest; + beforeAll(async() => { browser = await getBrowser(); page = browser.page; await page.loginAndModule('buyer', 'item'); await page.accessToSection('item.fixedPrice'); + page.on('request', req => { + if (req.url().includes(`FixedPrices/filter`)) + httpRequest = req.url(); + }); }); afterAll(async() => { await browser.close(); }); - it('should click on the add new foxed price button', async() => { - await page.doSearch(); + it('should filter using all the fields', async() => { + await page.write(selectors.itemFixedPrice.generalSearchFilter, 'item'); + await page.keyboard.press('Enter'); + + expect(httpRequest).toContain('search=item'); + + await page.click(selectors.itemFixedPrice.chip); + await page.click(selectors.itemFixedPrice.reignFilter); + + expect(httpRequest).toContain('categoryFk'); + + await page.autocompleteSearch(selectors.itemFixedPrice.typeFilter, 'Alstroemeria'); + + expect(httpRequest).toContain('typeFk'); + + await page.click(selectors.itemFixedPrice.chip); + await page.autocompleteSearch(selectors.itemFixedPrice.buyerFilter, 'buyerNick'); + + expect(httpRequest).toContain('buyerFk'); + + await page.click(selectors.itemFixedPrice.chip); + await page.autocompleteSearch(selectors.itemFixedPrice.warehouseFilter, 'Algemesi'); + + expect(httpRequest).toContain('warehouseFk'); + + await page.click(selectors.itemFixedPrice.chip); + await page.click(selectors.itemFixedPrice.mineFilter); + + expect(httpRequest).toContain('mine=true'); + + await page.click(selectors.itemFixedPrice.chip); + await page.click(selectors.itemFixedPrice.hasMinPriceFilter); + + expect(httpRequest).toContain('hasMinPrice=true'); + + await page.click(selectors.itemFixedPrice.chip); + await page.click(selectors.itemFixedPrice.addTag); + await page.autocompleteSearch(selectors.itemFixedPrice.tagFilter, 'Color'); + await page.autocompleteSearch(selectors.itemFixedPrice.tagValueFilter, 'Brown'); + + expect(httpRequest).toContain('tags'); + + await page.click(selectors.itemFixedPrice.chip); + }); + + it('should click on the add new fixed price button', async() => { await page.waitToClick(selectors.itemFixedPrice.add); await page.waitForSelector(selectors.itemFixedPrice.fourthFixedPrice); }); @@ -35,9 +85,7 @@ describe('Item fixed prices path', () => { }); it('should reload the section and check the created price has the expected ID', async() => { - await page.accessToSection('item.index'); - await page.accessToSection('item.fixedPrice'); - await page.doSearch(); + await page.goto(`http://localhost:5000/#!/item/fixed-price`); const result = await page.waitToGetProperty(selectors.itemFixedPrice.fourthItemID, 'value'); From ecbfdad1025af31ed536fde8f69e6b284fe2fbcf Mon Sep 17 00:00:00 2001 From: alexandre Date: Tue, 4 Apr 2023 09:51:07 +0200 Subject: [PATCH 3/8] refs #5418 changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c5ee05fe4..dc16a87d6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - (Facturas recibidas -> Bases negativas) Nueva sección ### Changed -- +- (Artículo -> Precio fijado) Modificado el buscador superior por uno lateral ### Fixed - From abaeeddc21c4ede37b2c0fb431effd9350e3185e Mon Sep 17 00:00:00 2001 From: alexandre Date: Tue, 11 Apr 2023 10:54:58 +0200 Subject: [PATCH 4/8] refs #5418 fix e2e --- e2e/paths/01-salix/03_smartTable_searchBar_integrations.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/paths/01-salix/03_smartTable_searchBar_integrations.spec.js b/e2e/paths/01-salix/03_smartTable_searchBar_integrations.spec.js index 70fa121fd..1c8fe0840 100644 --- a/e2e/paths/01-salix/03_smartTable_searchBar_integrations.spec.js +++ b/e2e/paths/01-salix/03_smartTable_searchBar_integrations.spec.js @@ -92,7 +92,7 @@ describe('SmartTable SearchBar integration', () => { }); const result = await page.waitToGetProperty(selectors.itemFixedPrice.firstItemID, 'value'); - expect(result).toEqual('3'); + expect(result).toEqual('13'); }); }); }); From 41f9ec63ff95d28a99fdfa5a009667b6798bc400 Mon Sep 17 00:00:00 2001 From: alexandre Date: Thu, 13 Apr 2023 13:35:11 +0200 Subject: [PATCH 5/8] refs #5418 changelog --- CHANGELOG.md | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 222f547e4..bf7887b9a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,18 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [2316.01] - 2023-05-04 + +### Added +- + +### Changed +- (Artículo -> Precio fijado) Modificado el buscador superior por uno lateral + +### Fixed +- + + ## [2314.01] - 2023-04-20 ### Added @@ -13,7 +25,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - (Facturas recibidas -> Bases negativas) Nueva sección ### Changed -- (Artículo -> Precio fijado) Modificado el buscador superior por uno lateral ### Fixed - (Clientes -> Morosos) Ahora se mantienen los elementos seleccionados al hacer sroll. From 05ceba65d6257a929572d65132653c61f90a4a93 Mon Sep 17 00:00:00 2001 From: alexandre Date: Thu, 13 Apr 2023 13:35:54 +0200 Subject: [PATCH 6/8] refs #5418 changelog --- CHANGELOG.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bf7887b9a..e89f394b0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,8 +24,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - (Monitor tickets) Muestra un icono al lado de la zona, si el ticket es frágil y se envía por agencia - (Facturas recibidas -> Bases negativas) Nueva sección -### Changed - ### Fixed - (Clientes -> Morosos) Ahora se mantienen los elementos seleccionados al hacer sroll. From ac4772e44ee6a27e019dcff3e2d40b2022a0b688 Mon Sep 17 00:00:00 2001 From: alexandre Date: Thu, 13 Apr 2023 13:46:29 +0200 Subject: [PATCH 7/8] refs #5418 mistake doing git pull origin dev --- .../231401/00-claimBeginningAfterInsert.sql | 1 + db/dump/fixtures.sql | 10 +++++----- loopback/locale/es.json | 3 ++- loopback/server/connectors/vn-mysql.js | 20 ++++++++++--------- .../claim/specs/createFromSales.spec.js | 4 ++-- modules/claim/back/models/claim-beginning.js | 12 +++++++++-- .../fixed-price/specs/editFixedPrice.spec.js | 2 +- modules/item/back/models/item-shelving.json | 3 +++ package.json | 2 +- .../expedition-pallet-label/sql/labelData.sql | 4 ++-- 10 files changed, 38 insertions(+), 23 deletions(-) create mode 100644 db/changes/231401/00-claimBeginningAfterInsert.sql diff --git a/db/changes/231401/00-claimBeginningAfterInsert.sql b/db/changes/231401/00-claimBeginningAfterInsert.sql new file mode 100644 index 000000000..230b6defb --- /dev/null +++ b/db/changes/231401/00-claimBeginningAfterInsert.sql @@ -0,0 +1 @@ +DROP TRIGGER IF EXISTS `vn`.`claimBeginning_afterInsert`; diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index 9006c6676..59d0a5eaa 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -1774,12 +1774,12 @@ INSERT INTO `vn`.`claimState`(`id`, `code`, `description`, `roleFk`, `priority`, ( 6, 'mana', 'Mana', 72, 4, 0), ( 7, 'lack', 'Faltas', 72, 2, 0); -INSERT INTO `vn`.`claim`(`id`, `ticketCreated`, `claimStateFk`, `clientFk`, `workerFk`, `responsibility`, `isChargedToMana`, `created`, `packages`, `rma`) +INSERT INTO `vn`.`claim`(`id`, `ticketCreated`, `claimStateFk`, `clientFk`, `workerFk`, `responsibility`, `isChargedToMana`, `created`, `packages`, `rma`, `ticketFk`) VALUES - (1, util.VN_CURDATE(), 1, 1101, 18, 3, 0, util.VN_CURDATE(), 0, '02676A049183'), - (2, util.VN_CURDATE(), 2, 1101, 18, 3, 0, util.VN_CURDATE(), 1, NULL), - (3, util.VN_CURDATE(), 3, 1101, 18, 1, 1, util.VN_CURDATE(), 5, NULL), - (4, util.VN_CURDATE(), 3, 1104, 18, 5, 0, util.VN_CURDATE(), 10, NULL); + (1, util.VN_CURDATE(), 1, 1101, 18, 3, 0, util.VN_CURDATE(), 0, '02676A049183', 11), + (2, util.VN_CURDATE(), 2, 1101, 18, 3, 0, util.VN_CURDATE(), 1, NULL, 16), + (3, util.VN_CURDATE(), 3, 1101, 18, 1, 1, util.VN_CURDATE(), 5, NULL, 7), + (4, util.VN_CURDATE(), 3, 1104, 18, 5, 0, util.VN_CURDATE(), 10, NULL, 8); INSERT INTO `vn`.`claimObservation` (`claimFk`, `workerFk`, `text`, `created`) VALUES diff --git a/loopback/locale/es.json b/loopback/locale/es.json index 42276efe7..33741d395 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -274,5 +274,6 @@ "This ticket cannot be signed because it has not been boxed": "Este ticket no puede firmarse porque no ha sido encajado", "Insert a date range": "Inserte un rango de fechas", "Added observation": "{{user}} añadió esta observacion: {{text}}", - "Comment added to client": "Observación añadida al cliente {{clientFk}}" + "Comment added to client": "Observación añadida al cliente {{clientFk}}", + "Cannot create a new claimBeginning from a different ticket": "No se puede crear una línea de reclamación de un ticket diferente al origen" } diff --git a/loopback/server/connectors/vn-mysql.js b/loopback/server/connectors/vn-mysql.js index 728454d86..a6fd3351a 100644 --- a/loopback/server/connectors/vn-mysql.js +++ b/loopback/server/connectors/vn-mysql.js @@ -311,7 +311,7 @@ class VnMySQL extends MySQL { return super[method].apply(this, args); this.invokeMethodP(method, [...args], model, ctx, opts) - .then(res => cb(...res), cb); + .then(res => cb(...[null].concat(res)), cb); } async invokeMethodP(method, args, model, ctx, opts) { @@ -331,8 +331,7 @@ class VnMySQL extends MySQL { const userId = opts.httpCtx && opts.httpCtx.active.accessToken.userId; const user = await Model.app.models.Account.findById(userId, { fields: ['name'] }, opts); await this.executeP(`CALL account.myUser_loginWithName(?)`, [user.name], opts); - } - else { + } else { where = ctx.where; id = ctx.id; data = ctx.data; @@ -358,9 +357,12 @@ class VnMySQL extends MySQL { } } - const res = await new Promise(resolve => { + const res = await new Promise((resolve, reject) => { const fnArgs = args.slice(0, -2); - fnArgs.push(opts, (...args) => resolve(args)); + fnArgs.push(opts, (err, ...args) => { + if (err) return reject(err); + resolve(args); + }); super[method].apply(this, fnArgs); }); @@ -375,11 +377,11 @@ class VnMySQL extends MySQL { case 'update': { switch (method) { case 'createAll': - for (const row of res[1]) + for (const row of res[0]) ids.push(row[idName]); break; case 'create': - ids.push(res[1]); + ids.push(res[0]); break; case 'update': if (data[idName] != null) @@ -387,7 +389,7 @@ class VnMySQL extends MySQL { break; } - const newWhere = ids.length ? { [idName]: ids } : where; + const newWhere = ids.length ? {[idName]: {inq: ids}} : where; const stmt = this.buildSelectStmt(op, data, idName, model, newWhere, limit); newInstances = await this.executeStmt(stmt, opts); @@ -671,4 +673,4 @@ SQLConnector.prototype.all = function find(model, filter, options, cb) { cb(error, []) } }); -}; \ No newline at end of file +}; diff --git a/modules/claim/back/methods/claim/specs/createFromSales.spec.js b/modules/claim/back/methods/claim/specs/createFromSales.spec.js index 7cf663caf..fe009c1c3 100644 --- a/modules/claim/back/methods/claim/specs/createFromSales.spec.js +++ b/modules/claim/back/methods/claim/specs/createFromSales.spec.js @@ -2,9 +2,9 @@ const models = require('vn-loopback/server/server').models; const LoopBackContext = require('loopback-context'); describe('Claim createFromSales()', () => { - const ticketId = 16; + const ticketId = 23; const newSale = [{ - id: 3, + id: 31, instance: 0, quantity: 10 }]; diff --git a/modules/claim/back/models/claim-beginning.js b/modules/claim/back/models/claim-beginning.js index 4c4b59737..4b870e5ea 100644 --- a/modules/claim/back/models/claim-beginning.js +++ b/modules/claim/back/models/claim-beginning.js @@ -10,8 +10,16 @@ module.exports = Self => { }); Self.observe('before save', async ctx => { - if (ctx.isNewInstance) return; - //await claimIsEditable(ctx); + if (ctx.isNewInstance) { + const models = Self.app.models; + const options = ctx.options; + const instance = ctx.instance; + const ticket = await models.Sale.findById(instance.saleFk, {fields: ['ticketFk']}, options); + const claim = await models.Claim.findById(instance.claimFk, {fields: ['ticketFk']}, options); + if (ticket.ticketFk != claim.ticketFk) + throw new UserError(`Cannot create a new claimBeginning from a different ticket`); + } + // await claimIsEditable(ctx); }); Self.observe('before delete', async ctx => { diff --git a/modules/item/back/methods/fixed-price/specs/editFixedPrice.spec.js b/modules/item/back/methods/fixed-price/specs/editFixedPrice.spec.js index a5e6cd35a..9c265f28a 100644 --- a/modules/item/back/methods/fixed-price/specs/editFixedPrice.spec.js +++ b/modules/item/back/methods/fixed-price/specs/editFixedPrice.spec.js @@ -50,7 +50,7 @@ describe('Item editFixedPrice()', () => { await models.FixedPrice.editFixedPrice(ctx, field, newValue, null, filter, options); - const [result] = await models.FixedPrice.filter(ctx, null, options); + const [result] = await models.FixedPrice.filter(ctx, filter, options); expect(result[field]).toEqual(newValue); diff --git a/modules/item/back/models/item-shelving.json b/modules/item/back/models/item-shelving.json index 0890350da..b24edfc53 100644 --- a/modules/item/back/models/item-shelving.json +++ b/modules/item/back/models/item-shelving.json @@ -20,6 +20,9 @@ }, "created": { "type": "date" + }, + "isChecked": { + "type": "boolean" } }, "relations": { diff --git a/package.json b/package.json index 8fa177646..607367e7b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "salix-back", - "version": "23.14.01", + "version": "23.16.01", "author": "Verdnatura Levante SL", "description": "Salix backend", "license": "GPL-3.0", diff --git a/print/templates/reports/expedition-pallet-label/sql/labelData.sql b/print/templates/reports/expedition-pallet-label/sql/labelData.sql index 0661dbe0f..b2a805251 100644 --- a/print/templates/reports/expedition-pallet-label/sql/labelData.sql +++ b/print/templates/reports/expedition-pallet-label/sql/labelData.sql @@ -12,8 +12,8 @@ SELECT ep.id palletFk, JOIN vn.expedition e ON e.id = es.expeditionFk JOIN vn.ticket t ON t.id = e.ticketFk JOIN vn.route r ON r.id = t.routeFk - LEFT JOIN vn2008.Rutas_monitor rm ON rm.Id_Ruta = r.id + LEFT JOIN vn.routesMonitor rm ON rm.routeFk = r.id LEFT JOIN vn.expeditionTruck et2 ON et2.id = rm.expeditionTruckFk WHERE ep.id = ? GROUP BY ep.id, t.routeFk - ORDER BY t.routeFk \ No newline at end of file + ORDER BY t.routeFk From 025c158b279d246b432f8b5f32a2537af095d963 Mon Sep 17 00:00:00 2001 From: alexandre Date: Thu, 13 Apr 2023 13:52:11 +0200 Subject: [PATCH 8/8] refs #5418 minor fixes --- .../03_smartTable_searchBar_integrations.spec.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/e2e/paths/01-salix/03_smartTable_searchBar_integrations.spec.js b/e2e/paths/01-salix/03_smartTable_searchBar_integrations.spec.js index 1c8fe0840..a3d747f1c 100644 --- a/e2e/paths/01-salix/03_smartTable_searchBar_integrations.spec.js +++ b/e2e/paths/01-salix/03_smartTable_searchBar_integrations.spec.js @@ -79,20 +79,27 @@ describe('SmartTable SearchBar integration', () => { it('should order by first id', async() => { await page.loginAndModule('developer', 'item'); await page.accessToSection('item.fixedPrice'); + await page.doSearch(); const result = await page.waitToGetProperty(selectors.itemFixedPrice.firstItemID, 'value'); expect(result).toEqual('1'); }); - it('should order by last id, reload page and have same order', async() => { + it('should order by last id', async() => { await page.waitToClick(selectors.itemFixedPrice.orderColumnId); + const result = await page.waitToGetProperty(selectors.itemFixedPrice.firstItemID, 'value'); + + expect(result).toEqual('3'); + }); + + it('should reload page and have same order', async() => { await page.reload({ waitUntil: 'networkidle2' }); const result = await page.waitToGetProperty(selectors.itemFixedPrice.firstItemID, 'value'); - expect(result).toEqual('13'); + expect(result).toEqual('3'); }); }); });