From 49233eefcd97ff0de16e1c811ffdd4515fe2a5a5 Mon Sep 17 00:00:00 2001 From: carlossa Date: Thu, 4 May 2023 10:18:37 +0200 Subject: [PATCH 01/10] refs #5580 add button, yml --- print/templates/email/weekly-hour-record/locale/en.yml | 5 +++-- print/templates/email/weekly-hour-record/locale/es.yml | 5 +++-- .../email/weekly-hour-record/weekly-hour-record.html | 4 +++- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/print/templates/email/weekly-hour-record/locale/en.yml b/print/templates/email/weekly-hour-record/locale/en.yml index 817e5451e..b76372fb9 100644 --- a/print/templates/email/weekly-hour-record/locale/en.yml +++ b/print/templates/email/weekly-hour-record/locale/en.yml @@ -1,6 +1,7 @@ subject: Weekly time log title: Record of hours week {0} year {1} dear: Dear worker -description: Access the following link:

- {0}

+Acceda al siguiente enlace: Access the following link:
+description: Click 'SATISFIED' if you agree with the hours worked. Otherwise, press 'NOT SATISFIED', detailing the cause of the disagreement. +Hours: Hours \ No newline at end of file diff --git a/print/templates/email/weekly-hour-record/locale/es.yml b/print/templates/email/weekly-hour-record/locale/es.yml index b70862f16..95466addb 100644 --- a/print/templates/email/weekly-hour-record/locale/es.yml +++ b/print/templates/email/weekly-hour-record/locale/es.yml @@ -1,6 +1,7 @@ subject: Registro de horas semanal title: Registro de horas semana {0} año {1} dear: Estimado trabajador -description: Acceda al siguiente enlace:

- {0}

+toaccess: Acceda al siguiente enlace:
+description: Pulse 'CONFORME' si esta de acuerdo con las horas trabajadas. En caso contrario pulse 'NO CONFORME', detallando la causa de la disconformidad. +Hours: Horas \ No newline at end of file diff --git a/print/templates/email/weekly-hour-record/weekly-hour-record.html b/print/templates/email/weekly-hour-record/weekly-hour-record.html index 84abb4c61..b1eb4e0b3 100644 --- a/print/templates/email/weekly-hour-record/weekly-hour-record.html +++ b/print/templates/email/weekly-hour-record/weekly-hour-record.html @@ -3,7 +3,9 @@

{{ $t('title', [week, year]) }}

{{$t('dear')}},

-

+

+ +

{{$t('description')}}

From 9f02fc66c8515d7325b95017e306df99d589200a Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Mon, 8 May 2023 13:10:51 +0200 Subject: [PATCH 02/10] refs #5517 Show spinner when loading --- front/salix/components/log/index.html | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/front/salix/components/log/index.html b/front/salix/components/log/index.html index b7697a1fd..f41dfcceb 100644 --- a/front/salix/components/log/index.html +++ b/front/salix/components/log/index.html @@ -14,7 +14,10 @@ order="changedModel" auto-load="true"> - +
Date: Mon, 8 May 2023 16:30:21 +0200 Subject: [PATCH 03/10] refs #5517 Fix: Show spinner when loading --- e2e/paths/02-client/10_add_greuge.spec.js | 7 ++----- front/core/components/crud-model/crud-model.js | 2 +- front/core/components/th/index.js | 13 ------------- front/salix/components/log/index.html | 5 +---- modules/client/front/greuge/index/index.html | 14 +++++++------- modules/client/front/greuge/index/index.js | 5 +---- modules/order/front/volume/index.html | 6 +++--- modules/order/front/volume/index.js | 5 +++-- modules/ticket/front/volume/index.html | 9 +++++---- modules/ticket/front/volume/index.js | 5 +++-- 10 files changed, 26 insertions(+), 45 deletions(-) diff --git a/e2e/paths/02-client/10_add_greuge.spec.js b/e2e/paths/02-client/10_add_greuge.spec.js index 6ea923a28..9141c499a 100644 --- a/e2e/paths/02-client/10_add_greuge.spec.js +++ b/e2e/paths/02-client/10_add_greuge.spec.js @@ -29,19 +29,16 @@ describe('Client Add greuge path', () => { expect(message.text).toContain('Some fields are invalid'); }); - it(`should create a new greuge with all its data`, async() => { + it(`should create a new greuge with all its data and confirm the greuge was added to the list`, async() => { await page.write(selectors.clientGreuge.amount, '999'); await page.waitForTextInField(selectors.clientGreuge.amount, '999'); await page.write(selectors.clientGreuge.description, 'new armor for Batman!'); await page.waitToClick(selectors.clientGreuge.saveButton); const message = await page.waitForSnackbar(); - expect(message.text).toContain('Data saved!'); - }); - - it('should confirm the greuge was added to the list', async() => { const result = await page.waitToGetProperty(selectors.clientGreuge.firstGreugeText, 'innerText'); + expect(message.text).toContain('Data saved!'); expect(result).toContain(999); expect(result).toContain('new armor for Batman!'); expect(result).toContain('Diff'); diff --git a/front/core/components/crud-model/crud-model.js b/front/core/components/crud-model/crud-model.js index 421a79f9b..fcfe0be44 100644 --- a/front/core/components/crud-model/crud-model.js +++ b/front/core/components/crud-model/crud-model.js @@ -236,7 +236,7 @@ export default class CrudModel extends ModelProxy { this.canceler = this.$q.defer(); this.isPaging = append; - if (!append && this.status != 'ready') + if (!append) this.status = 'loading'; let params = Object.assign( diff --git a/front/core/components/th/index.js b/front/core/components/th/index.js index 341558fb1..9f1e11903 100644 --- a/front/core/components/th/index.js +++ b/front/core/components/th/index.js @@ -8,18 +8,8 @@ export default class Th { $element.on('click', () => this.onToggleOrder()); } - /** - * Changes the order if the cell has a field and defaultOrder property - */ $onInit() { if (!this.field) return; - - if (this.defaultOrder) { - this.order = this.defaultOrder; - this.table.applyOrder(this.field, this.order); - this.updateArrow(); - } - this.updateArrow(); } @@ -82,9 +72,6 @@ ngModule.vnComponent('vnTh', { template: require('./index.html'), transclude: true, controller: Th, - bindings: { - defaultOrder: '@?' - }, require: { table: '^^vnTable' } diff --git a/front/salix/components/log/index.html b/front/salix/components/log/index.html index f41dfcceb..b7697a1fd 100644 --- a/front/salix/components/log/index.html +++ b/front/salix/components/log/index.html @@ -14,10 +14,7 @@ order="changedModel" auto-load="true"> - +
- @@ -28,7 +28,7 @@ - Date + Date Created by Comment Type @@ -53,11 +53,11 @@ - \ No newline at end of file + diff --git a/modules/client/front/greuge/index/index.js b/modules/client/front/greuge/index/index.js index 7a5ccc531..4f1b77b4b 100644 --- a/modules/client/front/greuge/index/index.js +++ b/modules/client/front/greuge/index/index.js @@ -11,8 +11,7 @@ class Controller extends Section { scope: { fields: ['id', 'name'] }, - }, - { + }, { relation: 'user', scope: { fields: ['id', 'name'] @@ -24,8 +23,6 @@ class Controller extends Section { } } -Controller.$inject = ['$element', '$scope']; - ngModule.vnComponent('vnClientGreugeIndex', { template: require('./index.html'), controller: Controller diff --git a/modules/order/front/volume/index.html b/modules/order/front/volume/index.html index 7c2ff4e3d..e0053f9ed 100644 --- a/modules/order/front/volume/index.html +++ b/modules/order/front/volume/index.html @@ -12,11 +12,11 @@ @@ -24,7 +24,7 @@ - Item + Item Description Quantity m³ per quantity diff --git a/modules/order/front/volume/index.js b/modules/order/front/volume/index.js index aaadf2af6..c1bc5ec7d 100644 --- a/modules/order/front/volume/index.js +++ b/modules/order/front/volume/index.js @@ -6,9 +6,10 @@ class Controller extends Section { constructor($element, $) { super($element, $); this.filter = { - include: [{ + include: { relation: 'item' - }] + }, + order: 'itemFk' }; this.order = {}; this.ticketVolumes = []; diff --git a/modules/ticket/front/volume/index.html b/modules/ticket/front/volume/index.html index f5dd18033..ff0a86772 100644 --- a/modules/ticket/front/volume/index.html +++ b/modules/ticket/front/volume/index.html @@ -1,4 +1,5 @@ -
- -
@@ -23,7 +24,7 @@ Item - Description + Description Packing type Quantity m³ per quantity diff --git a/modules/ticket/front/volume/index.js b/modules/ticket/front/volume/index.js index a3d531898..7acecf570 100644 --- a/modules/ticket/front/volume/index.js +++ b/modules/ticket/front/volume/index.js @@ -5,9 +5,10 @@ class Controller extends Section { constructor($element, $) { super($element, $); this.filter = { - include: [{ + include: { relation: 'item' - }] + }, + order: 'concept' }; this.ticketVolumes = []; From a2e71b57a238074482aefc7387d3a4eddfa428be Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Mon, 8 May 2023 16:33:35 +0200 Subject: [PATCH 04/10] refs #5517 Front test fix --- front/core/components/th/index.spec.js | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/front/core/components/th/index.spec.js b/front/core/components/th/index.spec.js index a00f73cc9..a3bf19898 100644 --- a/front/core/components/th/index.spec.js +++ b/front/core/components/th/index.spec.js @@ -17,17 +17,6 @@ describe('Component vnTh', () => { controller.column.setAttribute('field', 'MyField'); })); - describe('onInit()', () => { - it(`should define controllers order as per defaultOrder then call setOrder()`, () => { - controller.defaultOrder = 'DESC'; - jest.spyOn(controller.table, 'setOrder'); - controller.$onInit(); - - expect(controller.order).toEqual('DESC'); - expect(controller.table.setOrder).toHaveBeenCalledWith('MyField', 'DESC'); - }); - }); - describe('toggleOrder()', () => { it(`should change the ordenation to DESC (descendant) if it was ASC (ascendant)`, () => { controller.order = 'ASC'; @@ -61,7 +50,7 @@ describe('Component vnTh', () => { expect(controller.updateArrow).not.toHaveBeenCalledWith(); }); - it(`should call toggleOrder() method if field property and + it(`should call toggleOrder() method if field property and table field property equals and then call updateArrow()`, () => { controller.table.field = 'MyField'; jest.spyOn(controller, 'toggleOrder'); @@ -73,7 +62,7 @@ describe('Component vnTh', () => { expect(controller.updateArrow).toHaveBeenCalledWith(); }); - it(`should call setOrder() method if field property and + it(`should call setOrder() method if field property and table field property doesn't equals and then call updateArrow()`, () => { controller.table.field = 'MyField2'; jest.spyOn(controller.table, 'setOrder'); From 35a888a968e5838e0b7ab532b37de9e52f583f42 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Mon, 8 May 2023 16:48:05 +0200 Subject: [PATCH 05/10] refs #5517 Pagination spinner fixes --- .../core/components/crud-model/crud-model.js | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/front/core/components/crud-model/crud-model.js b/front/core/components/crud-model/crud-model.js index fcfe0be44..041aa3ca2 100644 --- a/front/core/components/crud-model/crud-model.js +++ b/front/core/components/crud-model/crud-model.js @@ -126,20 +126,20 @@ export default class CrudModel extends ModelProxy { } } - loadMore(append) { + loadMore(overwrite) { if (!this.moreRows) return this.$q.resolve(); const filter = Object.assign({}, this.currentFilter); - if (append) + if (overwrite) filter.skip = this.orgData ? this.orgData.length : 0; - if (!append) { + if (!overwrite) { this.page += 1; filter.limit = this.page * this.limit; } - return this.sendRequest(filter, append); + return this.sendRequest(filter, overwrite, true); } clear() { @@ -231,12 +231,12 @@ export default class CrudModel extends ModelProxy { return params; } - sendRequest(filter, append) { + sendRequest(filter, overwrite, loadMore) { this.cancelRequest(); this.canceler = this.$q.defer(); - this.isPaging = append; + this.isPaging = overwrite; - if (!append) + if (!loadMore) this.status = 'loading'; let params = Object.assign( @@ -249,16 +249,16 @@ export default class CrudModel extends ModelProxy { }; return this.$http.get(this._url, options).then( - json => this.onRemoteDone(json, filter, append), - json => this.onRemoteError(json, append) + json => this.onRemoteDone(json, filter, overwrite), + json => this.onRemoteError(json, overwrite) ).finally(() => { this.isPaging = false; }); } - onRemoteDone(json, filter, append) { + onRemoteDone(json, filter, overwrite) { let data = json.data; - if (append) + if (overwrite) this.orgData = this.orgData.concat(data); else { this.orgData = data; @@ -269,8 +269,8 @@ export default class CrudModel extends ModelProxy { this.onRequestEnd(); } - onRemoteError(err, append) { - if (!append) { + onRemoteError(err, overwrite) { + if (!overwrite) { this.clear(); this.status = 'error'; } From 7a668adf181ae81a818e777afba2cf4278cae4b0 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Mon, 8 May 2023 16:50:20 +0200 Subject: [PATCH 06/10] refs #5517 pagination fixes --- .../core/components/crud-model/crud-model.js | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/front/core/components/crud-model/crud-model.js b/front/core/components/crud-model/crud-model.js index 041aa3ca2..495a7d2b0 100644 --- a/front/core/components/crud-model/crud-model.js +++ b/front/core/components/crud-model/crud-model.js @@ -126,20 +126,20 @@ export default class CrudModel extends ModelProxy { } } - loadMore(overwrite) { + loadMore(append) { if (!this.moreRows) return this.$q.resolve(); const filter = Object.assign({}, this.currentFilter); - if (overwrite) + if (append) filter.skip = this.orgData ? this.orgData.length : 0; - if (!overwrite) { + if (!append) { this.page += 1; filter.limit = this.page * this.limit; } - return this.sendRequest(filter, overwrite, true); + return this.sendRequest(filter, append, true); } clear() { @@ -231,10 +231,10 @@ export default class CrudModel extends ModelProxy { return params; } - sendRequest(filter, overwrite, loadMore) { + sendRequest(filter, append, loadMore) { this.cancelRequest(); this.canceler = this.$q.defer(); - this.isPaging = overwrite; + this.isPaging = append; if (!loadMore) this.status = 'loading'; @@ -249,16 +249,16 @@ export default class CrudModel extends ModelProxy { }; return this.$http.get(this._url, options).then( - json => this.onRemoteDone(json, filter, overwrite), - json => this.onRemoteError(json, overwrite) + json => this.onRemoteDone(json, filter, append), + json => this.onRemoteError(json, append) ).finally(() => { this.isPaging = false; }); } - onRemoteDone(json, filter, overwrite) { + onRemoteDone(json, filter, append) { let data = json.data; - if (overwrite) + if (append) this.orgData = this.orgData.concat(data); else { this.orgData = data; @@ -269,8 +269,8 @@ export default class CrudModel extends ModelProxy { this.onRequestEnd(); } - onRemoteError(err, overwrite) { - if (!overwrite) { + onRemoteError(err, append) { + if (!append) { this.clear(); this.status = 'error'; } From 8c0deb6cfa6593670db8c9f801f5eb1c154e8f4d Mon Sep 17 00:00:00 2001 From: alexm Date: Wed, 10 May 2023 09:16:19 +0200 Subject: [PATCH 07/10] test(e2e_order): fiter optimized --- CHANGELOG.md | 1 + .../00-optimiceZoneEstimatedDelivery.sql | 77 +++++++++++++++++++ modules/order/back/methods/order/filter.js | 2 +- 3 files changed, 79 insertions(+), 1 deletion(-) create mode 100644 db/changes/231801/00-optimiceZoneEstimatedDelivery.sql diff --git a/CHANGELOG.md b/CHANGELOG.md index fa318a908..91f332178 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - (Ticket -> Boxing) Arreglado selección de horas +- (Cesta -> Índice) Optimizada búsqueda diff --git a/db/changes/231801/00-optimiceZoneEstimatedDelivery.sql b/db/changes/231801/00-optimiceZoneEstimatedDelivery.sql new file mode 100644 index 000000000..209e1efc3 --- /dev/null +++ b/db/changes/231801/00-optimiceZoneEstimatedDelivery.sql @@ -0,0 +1,77 @@ +CREATE OR REPLACE +ALGORITHM = UNDEFINED VIEW `vn`.`zoneEstimatedDelivery` AS +select + `t`.`zoneFk` AS `zoneFk`, + cast(`util`.`VN_CURDATE`() + interval hour(ifnull(`zc`.`hour`, `z`.`hour`)) * 60 + minute(ifnull(`zc`.`hour`, `z`.`hour`)) minute as time) AS `hourTheoretical`, + cast(sum(`sv`.`volume`) as decimal(5, 1)) AS `totalVolume`, + cast(sum(if(`s`.`alertLevel` < 2, `sv`.`volume`, 0)) as decimal(5, 1)) AS `remainingVolume`, + greatest( + ifnull(`lhp`.`m3`, 0), + ifnull(`dl`.`minSpeed`, 0) + ) AS `speed`, + cast(`zc`.`hour` + interval -sum(if(`s`.`alertLevel` < 2, `sv`.`volume`, 0)) * 60 / greatest(ifnull(`lhp`.`m3`, 0), ifnull(`dl`.`minSpeed`, 0)) minute as time) AS `hourEffective`, + floor(-sum(if(`s`.`alertLevel` < 2, `sv`.`volume`, 0)) * 60 / greatest(ifnull(`lhp`.`m3`, 0), ifnull(`dl`.`minSpeed`, 0))) AS `minutesLess`, + cast(`zc`.`hour` + interval -sum(if(`s`.`alertLevel` < 2, `sv`.`volume`, 0)) * 60 / greatest(ifnull(`lhp`.`m3`, 0), ifnull(`dl`.`minSpeed`, 0)) minute as time) AS `etc` +from + ( + ( + ( + ( + ( + ( + ( + ( + ( + `vn`.`ticket` `t` + join `vn`.`ticketStateToday` `tst` on + ( + `tst`.`ticket` = `t`.`id` + ) + ) + join `vn`.`state` `s` on + ( + `s`.`id` = `tst`.`state` + ) + ) + join `vn`.`saleVolume` `sv` on + ( + `sv`.`ticketFk` = `t`.`id` + ) + ) + left join `vn`.`lastHourProduction` `lhp` on + ( + `lhp`.`warehouseFk` = `t`.`warehouseFk` + ) + ) + join `vn`.`warehouse` `w` on + ( + `w`.`id` = `t`.`warehouseFk` + ) + ) + join `vn`.`warehouseAlias` `wa` on + ( + `wa`.`id` = `w`.`aliasFk` + ) + ) + straight_join `vn`.`zone` `z` on + ( + `z`.`id` = `t`.`zoneFk` + ) + ) + left join `vn`.`zoneClosure` `zc` on + ( + `zc`.`zoneFk` = `t`.`zoneFk` + and `zc`.`dated` = `util`.`VN_CURDATE`() + ) + ) + left join `cache`.`departure_limit` `dl` on + ( + `dl`.`warehouse_id` = `t`.`warehouseFk` + and `dl`.`fecha` = `util`.`VN_CURDATE`() + ) + ) +where + `w`.`hasProduction` <> 0 + and cast(`t`.`shipped` as date) = `util`.`VN_CURDATE`() +group by + `t`.`zoneFk`; diff --git a/modules/order/back/methods/order/filter.js b/modules/order/back/methods/order/filter.js index 008c0e5c9..10185af7e 100644 --- a/modules/order/back/methods/order/filter.js +++ b/modules/order/back/methods/order/filter.js @@ -141,7 +141,7 @@ module.exports = Self => { let stmt; stmt = new ParameterizedSQL( - `CREATE TEMPORARY TABLE tmp.filter + `CREATE OR REPLACE TEMPORARY TABLE tmp.filter (INDEX (id)) ENGINE = MEMORY SELECT From 3b8cafc783151e990201d3ddd3b31ad253798e7b Mon Sep 17 00:00:00 2001 From: alexm Date: Wed, 10 May 2023 09:22:33 +0200 Subject: [PATCH 08/10] fix(ticketConfigSql): correct folder --- db/changes/{230801 => 231801}/00-ticketConfig.sql | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename db/changes/{230801 => 231801}/00-ticketConfig.sql (100%) diff --git a/db/changes/230801/00-ticketConfig.sql b/db/changes/231801/00-ticketConfig.sql similarity index 100% rename from db/changes/230801/00-ticketConfig.sql rename to db/changes/231801/00-ticketConfig.sql From 706c62f624e33c760b0f65ed8deed7db9f9f8b1d Mon Sep 17 00:00:00 2001 From: alexm Date: Wed, 10 May 2023 09:26:33 +0200 Subject: [PATCH 09/10] typo --- db/changes/231801/00-ticketConfig.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/changes/231801/00-ticketConfig.sql b/db/changes/231801/00-ticketConfig.sql index ca63dbf63..7c8aa83a4 100644 --- a/db/changes/231801/00-ticketConfig.sql +++ b/db/changes/231801/00-ticketConfig.sql @@ -1 +1 @@ -ALTER TABLE `vn`.`ticketConfig` ADD daysForWarningClaim INT DEFAULT 2 NOT NULL COMMENT 'dias restantes hasta que salte el aviso de reclamación fuerade plazo'; +ALTER TABLE `vn`.`ticketConfig` ADD daysForWarningClaim INT DEFAULT 2 NOT NULL COMMENT 'dias restantes hasta que salte el aviso de reclamación fuera de plazo'; From df1803a2e37a6964dd471faf13da2fdba8330a99 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Wed, 10 May 2023 10:11:52 +0200 Subject: [PATCH 10/10] refs #5517 Front test fix --- front/core/components/crud-model/index.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/front/core/components/crud-model/index.spec.js b/front/core/components/crud-model/index.spec.js index 7eab80405..e42476098 100644 --- a/front/core/components/crud-model/index.spec.js +++ b/front/core/components/crud-model/index.spec.js @@ -150,7 +150,7 @@ describe('Component vnCrudModel', () => { controller.loadMore(true); - expect(controller.sendRequest).toHaveBeenCalledWith({'skip': 2}, true); + expect(controller.sendRequest).toHaveBeenCalledWith({'skip': 2}, true, true); }); });