From 37b9c5c4ce0a3cbafbf408f38ede60a7cdf8606d Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Mon, 2 Sep 2019 11:25:31 +0200 Subject: [PATCH 1/3] Added zone inflation field #1641 --- modules/agency/back/models/zone.json | 3 +++ modules/agency/front/basic-data/index.html | 10 ++++++++-- modules/agency/front/locale/es.yml | 3 ++- modules/ticket/front/sale/locale/es.yml | 1 + 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/modules/agency/back/models/zone.json b/modules/agency/back/models/zone.json index 9b03bee6a..997fedcc7 100644 --- a/modules/agency/back/models/zone.json +++ b/modules/agency/back/models/zone.json @@ -30,6 +30,9 @@ }, "isVolumetric": { "type": "Boolean" + }, + "inflation": { + "type": "Number" } }, "relations": { diff --git a/modules/agency/front/basic-data/index.html b/modules/agency/front/basic-data/index.html index 7eaac4ef9..5cff23eb1 100644 --- a/modules/agency/front/basic-data/index.html +++ b/modules/agency/front/basic-data/index.html @@ -5,7 +5,7 @@ form="form" save="patch"> -
+ - + + diff --git a/modules/agency/front/locale/es.yml b/modules/agency/front/locale/es.yml index ef226ef10..cae17b94b 100644 --- a/modules/agency/front/locale/es.yml +++ b/modules/agency/front/locale/es.yml @@ -10,4 +10,5 @@ Zones: Zonas New zone: Nueva zona Volumetric: Volumétrico Clone: Clonar -Search zone by id or name: Buscar zonas por identificador o nombre \ No newline at end of file +Search zone by id or name: Buscar zonas por identificador o nombre +Inflation: Inflación \ No newline at end of file diff --git a/modules/ticket/front/sale/locale/es.yml b/modules/ticket/front/sale/locale/es.yml index 753323c41..9deb3f06a 100644 --- a/modules/ticket/front/sale/locale/es.yml +++ b/modules/ticket/front/sale/locale/es.yml @@ -19,6 +19,7 @@ Available: Disponible In which day you want to add the ticket?: ¿A que dia quieres añadir el ticket? Add claim: Crear reclamación Claim: Reclamación +Transfer lines: Transferir líneas Sales to transfer: Líneas a transferir Destination ticket: Ticket destinatario Change ticket state to 'Ok': Cambiar estado del ticket a 'Ok' From 50c989a267edcddd21de6d2af28059143bc172b9 Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Mon, 2 Sep 2019 12:23:49 +0200 Subject: [PATCH 2/3] Add attendedBy and salesPerson filters #1661 --- modules/claim/back/methods/claim/filter.js | 13 ++++++-- modules/claim/front/basic-data/index.html | 2 +- modules/claim/front/search-panel/index.html | 33 +++++++++++++-------- 3 files changed, 32 insertions(+), 16 deletions(-) diff --git a/modules/claim/back/methods/claim/filter.js b/modules/claim/back/methods/claim/filter.js index 38212d004..33909eedc 100644 --- a/modules/claim/back/methods/claim/filter.js +++ b/modules/claim/back/methods/claim/filter.js @@ -44,9 +44,14 @@ module.exports = Self => { description: 'The claim state id', http: {source: 'query'} }, { - arg: 'workerFk', + arg: 'salesPersonFk', type: 'Integer', - description: 'The worker id', + description: 'The salesPerson id', + http: {source: 'query'} + }, { + arg: 'attenderFk', + type: 'Integer', + description: 'The attender worker id', http: {source: 'query'} }, { arg: 'created', @@ -86,7 +91,9 @@ module.exports = Self => { return {'c.id': value}; case 'claimStateFk': return {'cl.claimStateFk': value}; - case 'workerFk': + case 'salesPersonFk': + return {'c.salesPersonFk': value}; + case 'attenderFk': return {'cl.workerFk': value}; case 'created': return {'cl.created': value}; diff --git a/modules/claim/front/basic-data/index.html b/modules/claim/front/basic-data/index.html index d05c6ebc5..9ff12acf7 100644 --- a/modules/claim/front/basic-data/index.html +++ b/modules/claim/front/basic-data/index.html @@ -36,7 +36,7 @@ search-function="{firstName: $search}" value-field="id" where="{role: 'employee'}" - label="Worker"> + label="Attended by"> + {{firstName}} {{name}} + + + {{firstName}} {{name}} + + + + {{description}} - - {{firstName}} {{name}} - - - Date: Mon, 2 Sep 2019 14:36:54 +0200 Subject: [PATCH 3/3] ticket.basicData Update zone on changes + fixes #1668 --- .../back/methods/ticket/priceDifference.js | 12 +-- .../front/basic-data/step-one/index.html | 3 +- .../ticket/front/basic-data/step-one/index.js | 87 ++++++++++++++----- .../ticket/front/basic-data/step-two/index.js | 7 +- 4 files changed, 78 insertions(+), 31 deletions(-) diff --git a/modules/ticket/back/methods/ticket/priceDifference.js b/modules/ticket/back/methods/ticket/priceDifference.js index 552c2b991..122d20e50 100644 --- a/modules/ticket/back/methods/ticket/priceDifference.js +++ b/modules/ticket/back/methods/ticket/priceDifference.js @@ -94,14 +94,16 @@ module.exports = Self => { salesObj.items.forEach(sale => { const difComponent = map.get(sale.id); - if (difComponent) + if (difComponent) { sale.component = difComponent; + salesObj.totalNewPrice += sale.component.newPrice; + salesObj.totalDifference += sale.component.difference; + salesObj.totalUnitPrice = Math.round(salesObj.totalUnitPrice * 100) / 100; + salesObj.totalNewPrice = Math.round(salesObj.totalNewPrice * 100) / 100; + } + salesObj.totalUnitPrice += sale.price; - salesObj.totalNewPrice += sale.component.newPrice; - salesObj.totalDifference += sale.component.difference; - salesObj.totalUnitPrice = Math.round(salesObj.totalUnitPrice * 100) / 100; - salesObj.totalNewPrice = Math.round(salesObj.totalNewPrice * 100) / 100; salesObj.totalDifference = Math.round(salesObj.totalDifference * 100) / 100; }); diff --git a/modules/ticket/front/basic-data/step-one/index.html b/modules/ticket/front/basic-data/step-one/index.html index 512e1f110..1dc4c14d0 100644 --- a/modules/ticket/front/basic-data/step-one/index.html +++ b/modules/ticket/front/basic-data/step-one/index.html @@ -35,8 +35,7 @@ label="Warehouse" show-field="name" value-field="id" - field="$ctrl.ticket.warehouseFk" - initial-data="$ctrl.ticket.warehouseFk"> + field="$ctrl.warehouseId"> diff --git a/modules/ticket/front/basic-data/step-one/index.js b/modules/ticket/front/basic-data/step-one/index.js index c1f3bcb5d..379fc7148 100644 --- a/modules/ticket/front/basic-data/step-one/index.js +++ b/modules/ticket/front/basic-data/step-one/index.js @@ -39,11 +39,21 @@ class Controller { this.onChangeClient(value); } - set shipped(value) { - this.ticket.shipped = value; - this.onChangeShipped(value); + get warehouseId() { + if (this.ticket) + return this.ticket.warehouseFk; + + return null; } + set warehouseId(id) { + if (id != this.ticket.warehouseFk) { + this.ticket.warehouseFk = id; + this.onChangeWarehouse(id); + } + } + + get shipped() { if (this.ticket) return this.ticket.shipped; @@ -51,6 +61,11 @@ class Controller { return null; } + set shipped(value) { + this.ticket.shipped = value; + this.onChangeShipped(value); + } + get landed() { if (this.ticket) return this.ticket.landed; @@ -120,23 +135,6 @@ class Controller { }); } - /* - * Returns a landing date - */ - getLanded(params) { - let query = `/api/Agencies/getLanded`; - return this.$http.get(query, {params}); - } - - /* - * Returns a shipment date - */ - getShipped(params) { - let query = `/api/Agencies/getShipped`; - return this.$http.get(query, {params}); - } - - onChangeShipped(shipped) { let params = { shipped: shipped, @@ -144,6 +142,8 @@ class Controller { agencyModeFk: this.ticket.agencyModeFk, warehouseFk: this.ticket.warehouseFk }; + this.ticket.zoneFk = null; + let query = `/api/Agencies/getLanded`; this.$http.get(query, {params}).then(res => { if (res.data && res.data.landed) { @@ -164,6 +164,8 @@ class Controller { agencyModeFk: this.ticket.agencyModeFk, warehouseFk: this.ticket.warehouseFk }; + this.ticket.zoneFk = null; + let query = `/api/Agencies/getShipped`; this.$http.get(query, {params}).then(res => { if (res.data) { @@ -184,8 +186,10 @@ class Controller { this.ticket.agencyModeFk = null; const query = `/api/Zones/${zoneId}`; this.$http.get(query).then(res => { - if (res.data) + if (res.data) { this.ticket.agencyModeFk = res.data.agencyModeFk; + this.ticket.warehouseFk = res.data.warehouseFk; + } }); } @@ -214,6 +218,31 @@ class Controller { }); } + /* + * Gets a zone from an agency + */ + onChangeWarehouse(warehouseId) { + let params = { + landed: this.ticket.landed, + addressFk: this.ticket.addressFk, + agencyModeFk: this.ticket.agencyModeFk, + warehouseFk: warehouseId + }; + + this.ticket.zoneFk = null; + let query = `/api/Agencies/getShipped`; + this.$http.get(query, {params}).then(res => { + if (res.data) + this.ticket.zoneFk = res.data.id; + + if (!res.data) { + this.vnApp.showMessage( + this.$translate.instant('No delivery zone available for this parameters') + ); + } + }); + } + async onStepChange() { if (this.isFormInvalid()) { return this.vnApp.showError( @@ -242,6 +271,22 @@ class Controller { }); } + /* + * Returns a landing date + */ + getLanded(params) { + let query = `/api/Agencies/getLanded`; + return this.$http.get(query, {params}); + } + + /* + * Returns a shipment date + */ + getShipped(params) { + let query = `/api/Agencies/getShipped`; + return this.$http.get(query, {params}); + } + isFormInvalid() { return !this.ticket.clientFk || !this.ticket.addressFk || !this.ticket.agencyModeFk || !this.ticket.companyFk || !this.ticket.shipped || !this.ticket.landed diff --git a/modules/ticket/front/basic-data/step-two/index.js b/modules/ticket/front/basic-data/step-two/index.js index 1d18f6ba0..1446ac171 100644 --- a/modules/ticket/front/basic-data/step-two/index.js +++ b/modules/ticket/front/basic-data/step-two/index.js @@ -28,8 +28,8 @@ class Controller { getTotalNewPrice() { let totalNewPrice = 0; this.ticket.sale.items.forEach(item => { - let itemTotalNewPrice = item.quantity * item.component.newPrice; - totalNewPrice += itemTotalNewPrice; + if (item.component) + totalNewPrice += item.quantity * item.component.newPrice; }); this.totalNewPrice = totalNewPrice; } @@ -37,7 +37,8 @@ class Controller { getTotalDifferenceOfPrice() { let totalPriceDifference = 0; this.ticket.sale.items.forEach(item => { - totalPriceDifference += item.component.difference; + if (item.component) + totalPriceDifference += item.component.difference; }); this.totalPriceDifference = totalPriceDifference; }