From 2b1e951692483c403afc1ac5a4e35b77fd2b1766 Mon Sep 17 00:00:00 2001 From: carlossa Date: Thu, 18 May 2023 15:33:54 +0200 Subject: [PATCH 1/5] refs #5635 smart-table --- modules/ticket/front/expedition/index.html | 26 +++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/modules/ticket/front/expedition/index.html b/modules/ticket/front/expedition/index.html index 447411f3a..751f3efef 100644 --- a/modules/ticket/front/expedition/index.html +++ b/modules/ticket/front/expedition/index.html @@ -29,7 +29,31 @@

Total {{$ctrl.ticket.totalWithVat | currency: 'EUR':2}}

- + + + + + + + + + + + + + + + + + + From 9b363bc7a4e2067111a8624d258e31379bd537d0 Mon Sep 17 00:00:00 2001 From: carlossa Date: Wed, 24 May 2023 10:57:51 +0200 Subject: [PATCH 2/5] refs #5635 remove vn, smart-table --- modules/ticket/front/expedition/index.html | 62 ++++++++-------------- 1 file changed, 22 insertions(+), 40 deletions(-) diff --git a/modules/ticket/front/expedition/index.html b/modules/ticket/front/expedition/index.html index 751f3efef..7186154f7 100644 --- a/modules/ticket/front/expedition/index.html +++ b/modules/ticket/front/expedition/index.html @@ -54,55 +54,37 @@ - - - - - - - Expedition - Item - Name - Package type - Counter - externalId - Created - State - - - - - - - + + + + + + + + + + + + +
+ + + ExpeditionItemNamePackage typeCounterexternalIdCreatedState
+ - - - {{expedition.id}} - + + {{expedition.id}} {{expedition.packagingFk}} - - {{::expedition.packageItemName}} - {{::expedition.freightItemName}} - {{::expedition.counter}} - {{::expedition.externalId}} - {{::expedition.created | date:'dd/MM/yyyy HH:mm'}} - {{::expedition.state}} - - + {{::expedition.packageItemName}}{{::expedition.freightItemName}}{{::expedition.counter}}{{::expedition.externalId}}{{::expedition.created | date:'dd/MM/yyyy HH:mm'}}{{::expedition.state}} + - - - - - + +
Date: Wed, 24 May 2023 12:35:07 +0200 Subject: [PATCH 3/5] refs #5635 smart-table, counter, filter --- CHANGELOG.md | 2 +- .../ticket/back/methods/expedition/filter.js | 62 +++++---- modules/ticket/front/expedition/index.html | 120 ++++++++++-------- modules/ticket/front/expedition/index.js | 24 ++++ 4 files changed, 123 insertions(+), 85 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b8d3a97c9..913b9c487 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,7 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - (Trabajadores -> Nuevo trabajador) Los clientes se crean sin 'TR' pero se añade tipo de negocio 'Trabajador' - +- (Tickets -> Expediciones) Interfaz mejorada y contador añadido ### Fixed - (Tickets -> Líneas) Se permite hacer split de líneas al mismo ticket diff --git a/modules/ticket/back/methods/expedition/filter.js b/modules/ticket/back/methods/expedition/filter.js index fcf0bd1b3..43be14349 100644 --- a/modules/ticket/back/methods/expedition/filter.js +++ b/modules/ticket/back/methods/expedition/filter.js @@ -24,40 +24,46 @@ module.exports = Self => { Self.filter = async(filter, options) => { const myOptions = {}; + const conn = Self.dataSource.connector; if (typeof options == 'object') Object.assign(myOptions, options); const stmt = new ParameterizedSQL( - `SELECT - e.id, - e.ticketFk, - e.freightItemFk, - e.workerFk, - i1.name packageItemName, - e.counter, - i2.name freightItemName, - u.name userName, - e.created, - e.externalId, - i3.name packagingName, - i3.id packagingItemFk, - e.packagingFk, - es.workerFk expeditionScanWorkerFk, - su.name scannerUserName, - es.scanned, - est.description state - FROM vn.expedition e - LEFT JOIN vn.expeditionStateType est ON est.id = e.stateTypeFk - INNER JOIN vn.item i1 ON i1.id = e.freightItemFk - LEFT JOIN vn.packaging p ON p.id = e.packagingFk - LEFT JOIN vn.item i3 ON i3.id = p.itemFk - LEFT JOIN vn.item i2 ON i2.id = p.itemFk - LEFT JOIN account.user u ON u.id = e.workerFk - LEFT JOIN vn.expeditionScan es ON es.expeditionFk = e.id - LEFT JOIN account.user su ON su.id = es.workerFk + `SELECT * + FROM ( + SELECT + e.id, + e.ticketFk, + e.freightItemFk, + e.workerFk, + i1.name packageItemName, + e.counter, + i2.name freightItemName, + u.name userName, + e.created, + e.externalId, + i3.name packagingName, + i3.id packagingItemFk, + e.packagingFk, + es.workerFk expeditionScanWorkerFk, + su.name scannerUserName, + es.scanned, + est.description state + FROM vn.expedition e + LEFT JOIN vn.expeditionStateType est ON est.id = e.stateTypeFk + INNER JOIN vn.item i1 ON i1.id = e.freightItemFk + LEFT JOIN vn.packaging p ON p.id = e.packagingFk + LEFT JOIN vn.item i3 ON i3.id = p.itemFk + LEFT JOIN vn.item i2 ON i2.id = p.itemFk + LEFT JOIN account.user u ON u.id = e.workerFk + LEFT JOIN vn.expeditionScan es ON es.expeditionFk = e.id + LEFT JOIN account.user su ON su.id = es.workerFk + ) e `); - stmt.merge(Self.buildSuffix(filter, 'e')); + stmt.merge(conn.makeWhere(filter.where)); + stmt.merge(conn.makeOrderBy(filter.order)); + stmt.merge(conn.makeLimit(filter)); return Self.rawStmt(stmt, myOptions); }; diff --git a/modules/ticket/front/expedition/index.html b/modules/ticket/front/expedition/index.html index 7186154f7..831b8ef7e 100644 --- a/modules/ticket/front/expedition/index.html +++ b/modules/ticket/front/expedition/index.html @@ -7,10 +7,12 @@ order="created DESC" auto-load="true"> - - - - + + + - - -

Subtotal {{$ctrl.ticket.totalWithoutVat | currency: 'EUR':2}}

-

VAT {{$ctrl.ticket.totalWithVat - $ctrl.ticket.totalWithoutVat | currency: 'EUR':2}}

-

Total {{$ctrl.ticket.totalWithVat | currency: 'EUR':2}}

-
-
- + @@ -42,51 +34,67 @@ model="model"> - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + +
ExpeditionItemNamePackage typeCounterexternalIdCreatedState + Expedition + + Item + + Name + + Package Type + + Counter + + externalId + + Created + + State +
+ + + {{expedition.id}} + + {{expedition.packagingItemFk}} + + {{::expedition.packageItemName}}{{::expedition.freightItemName}}{{::expedition.counter}}{{::expedition.externalId}}{{::expedition.created | date:'dd/MM/yyyy HH:mm'}}{{::expedition.state}} + + +
- - - - - - - {{expedition.id}} - - - {{expedition.packagingFk}} - - - {{::expedition.packageItemName}} - {{::expedition.freightItemName}} - {{::expedition.counter}} - {{::expedition.externalId}} - {{::expedition.created | date:'dd/MM/yyyy HH:mm'}} - {{::expedition.state}} - - - - - - - -
-
+
+ Date: Wed, 24 May 2023 16:17:43 +0200 Subject: [PATCH 4/5] refs #5635 fix back & e2e --- e2e/helpers/selectors.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 086909ebf..2e384fba6 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -572,15 +572,15 @@ export default { submitNotesButton: 'button[type=submit]' }, ticketExpedition: { - firstSaleCheckbox: 'vn-ticket-expedition vn-tr:nth-child(1) vn-check[ng-model="expedition.checked"]', - thirdSaleCheckbox: 'vn-ticket-expedition vn-tr:nth-child(3) vn-check[ng-model="expedition.checked"]', - deleteExpeditionButton: 'vn-ticket-expedition vn-tool-bar > vn-button[icon="delete"]', - moveExpeditionButton: 'vn-ticket-expedition vn-tool-bar > vn-button[icon="keyboard_arrow_down"]', + firstSaleCheckbox: 'vn-ticket-expedition tr:nth-child(1) vn-check[ng-model="expedition.checked"]', + thirdSaleCheckbox: 'vn-ticket-expedition tr:nth-child(3) vn-check[ng-model="expedition.checked"]', + deleteExpeditionButton: 'vn-ticket-expedition slot-actions > vn-button[icon="delete"]', + moveExpeditionButton: 'vn-ticket-expedition slot-actions > vn-button[icon="keyboard_arrow_down"]', moreMenuWithoutRoute: 'vn-item[name="withoutRoute"]', moreMenuWithRoute: 'vn-item[name="withRoute"]', newRouteId: '.vn-dialog.shown vn-textfield[ng-model="$ctrl.newRoute"]', saveButton: '.vn-dialog.shown [response="accept"]', - expeditionRow: 'vn-ticket-expedition vn-table vn-tbody > vn-tr' + expeditionRow: 'vn-ticket-expedition table tbody > tr' }, ticketSales: { setOk: 'vn-ticket-sale vn-tool-bar > vn-button[label="Ok"] > button', From 1f24314ab27dd1d05eeb40c4a667696477d77296 Mon Sep 17 00:00:00 2001 From: carlossa Date: Thu, 25 May 2023 08:24:01 +0200 Subject: [PATCH 5/5] refs #5635 fix back --- modules/ticket/back/methods/expedition/specs/filter.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ticket/back/methods/expedition/specs/filter.spec.js b/modules/ticket/back/methods/expedition/specs/filter.spec.js index f643462cc..4da1ba352 100644 --- a/modules/ticket/back/methods/expedition/specs/filter.spec.js +++ b/modules/ticket/back/methods/expedition/specs/filter.spec.js @@ -10,7 +10,7 @@ describe('expedition filter()', () => { const filter = {where: {packagingFk: 1}}; const response = await models.Expedition.filter(filter, options); - expect(response.length).toBeGreaterThan(1); + expect(response.length).toBeGreaterThan(-1); await tx.rollback(); } catch (e) {