From 56925be41fd2023a3dbe5e47b1a3ede9d2102494 Mon Sep 17 00:00:00 2001 From: joan Date: Thu, 7 Jan 2021 14:21:17 +0100 Subject: [PATCH] 2708 - Extra community changes --- .../methods/travel/extraCommunityFilter.js | 4 +- modules/travel/back/models/travel.json | 3 ++ .../extra-community-search-panel/index.html | 12 +++-- .../extra-community-search-panel/index.js | 54 ++++++++++++++++++- .../travel/front/extra-community/index.html | 37 ++++++++----- modules/travel/front/extra-community/index.js | 6 +++ .../front/extra-community/locale/es.yml | 4 +- .../travel/front/extra-community/style.scss | 4 +- 8 files changed, 100 insertions(+), 24 deletions(-) diff --git a/modules/travel/back/methods/travel/extraCommunityFilter.js b/modules/travel/back/methods/travel/extraCommunityFilter.js index 4a49b44015..a2a355209a 100644 --- a/modules/travel/back/methods/travel/extraCommunityFilter.js +++ b/modules/travel/back/methods/travel/extraCommunityFilter.js @@ -172,8 +172,8 @@ module.exports = Self => { e.notes, CAST(SUM(i.density * b.stickers * IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000 ) as DECIMAL(10,0)) as loadedkg, CAST(SUM(167.5 * b.stickers * IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000 ) as DECIMAL(10,0)) as volumeKg - FROM entry e - JOIN tmp.travel tr ON tr.id = e.travelFk + FROM tmp.travel tr + JOIN entry e ON e.travelFk = tr.id JOIN buy b ON b.entryFk = e.id JOIN packaging pkg ON pkg.id = b.packageFk JOIN item i ON i.id = b.itemFk diff --git a/modules/travel/back/models/travel.json b/modules/travel/back/models/travel.json index df5b183b14..cd2f1d6535 100644 --- a/modules/travel/back/models/travel.json +++ b/modules/travel/back/models/travel.json @@ -37,6 +37,9 @@ "m3": { "type": "Number" }, + "kg": { + "type": "Number" + }, "cargoSupplierFk": { "type": "Number" }, diff --git a/modules/travel/front/extra-community-search-panel/index.html b/modules/travel/front/extra-community-search-panel/index.html index 85a30907a3..00b1f14a03 100644 --- a/modules/travel/front/extra-community-search-panel/index.html +++ b/modules/travel/front/extra-community-search-panel/index.html @@ -39,24 +39,28 @@ + ng-model="filter.shippedFrom" + on-change="$ctrl.shippedFrom = value"> + ng-model="filter.shippedTo" + on-change="$ctrl.shippedTo = value"> + ng-model="filter.landedFrom" + on-change="$ctrl.landedFrom = value"> + ng-model="filter.landedTo" + on-change="$ctrl.landedTo = value"> diff --git a/modules/travel/front/extra-community-search-panel/index.js b/modules/travel/front/extra-community-search-panel/index.js index 63d404b4b1..f2e4b66d9a 100644 --- a/modules/travel/front/extra-community-search-panel/index.js +++ b/modules/travel/front/extra-community-search-panel/index.js @@ -1,7 +1,59 @@ import ngModule from '../module'; import SearchPanel from 'core/components/searchbar/search-panel'; +class Controller extends SearchPanel { + constructor($, $element) { + super($, $element); + + this.filter = this.$.filter; + } + + get shippedFrom() { + return this._shippedFrom; + } + + set shippedFrom(value) { + this._shippedFrom = value; + + if (!this.filter.shippedTo) + this.filter.shippedTo = value; + } + + get shippedTo() { + return this._shippedTo; + } + + set shippedTo(value) { + this._shippedTo = value; + + if (!this.filter.shippedFrom) + this.filter.shippedFrom = value; + } + + get landedFrom() { + return this._landedFrom; + } + + set landedFrom(value) { + this._landedFrom = value; + + if (!this.filter.landedTo) + this.filter.landedTo = value; + } + + get landedTo() { + return this._landedTo; + } + + set landedTo(value) { + this._landedTo = value; + + if (!this.filter.landedFrom) + this.filter.landedFrom = value; + } +} + ngModule.vnComponent('vnExtraCommunitySearchPanel', { template: require('./index.html'), - controller: SearchPanel + controller: Controller }); diff --git a/modules/travel/front/extra-community/index.html b/modules/travel/front/extra-community/index.html index 84e6fcb854..265eddcdcd 100644 --- a/modules/travel/front/extra-community/index.html +++ b/modules/travel/front/extra-community/index.html @@ -17,11 +17,11 @@ - +
- + - + Id Supplier Freighter @@ -30,17 +30,17 @@ Bl. KG Phy. KG Vol. KG - - Wh. Out - - Shipped Wh. In - Landed + W. Shipped + + Wh. Out + + W. Landed - + + on-change="$ctrl.save(travel.id, {ref: value})"> {{::travel.stickers}} - {{::travel.kg}} + + {{travel.kg}} + + + + + {{::travel.loadedKg}} {{::travel.volumeKg}} - {{::travel.warehouseOutName}} - {{::travel.shipped | date: 'dd/MM/yyyy'}} {{::travel.warehouseInName}} + {{::travel.shipped | date: 'dd/MM/yyyy'}} + {{::travel.warehouseOutName}} {{::travel.landed | date: 'dd/MM/yyyy'}} {{::entry.supplierName}} {{::entry.ref}} - {{::entry.stickers}} + {{::entry.stickers}} 1123 {{::entry.loadedkg}} {{::entry.volumeKg}} diff --git a/modules/travel/front/extra-community/index.js b/modules/travel/front/extra-community/index.js index 221d6cb0d0..1c8db7b681 100644 --- a/modules/travel/front/extra-community/index.js +++ b/modules/travel/front/extra-community/index.js @@ -83,6 +83,12 @@ class Controller extends Section { this.$http.patch(endpoint, params) .then(() => this.vnApp.showSuccess(this.$t('Data saved!'))); } + + save(id, data) { + const endpoint = `Travels/${id}`; + this.$http.patch(endpoint, data) + .then(() => this.vnApp.showSuccess(this.$t('Data saved!'))); + } } ngModule.vnComponent('vnTravelExtraCommunity', { diff --git a/modules/travel/front/extra-community/locale/es.yml b/modules/travel/front/extra-community/locale/es.yml index e377a10111..0c47d1f05b 100644 --- a/modules/travel/front/extra-community/locale/es.yml +++ b/modules/travel/front/extra-community/locale/es.yml @@ -5,4 +5,6 @@ Bl. KG: KG Bloq. Phy. KG: KG físico Vol. KG: KG Vol. Search by travel id or reference: Buscar por id travel o referencia -Continent Out: Continente salida \ No newline at end of file +Continent Out: Continente salida +W. Shipped: F. envío +W. Landed: F. llegada \ No newline at end of file diff --git a/modules/travel/front/extra-community/style.scss b/modules/travel/front/extra-community/style.scss index e7265781dd..41544242d3 100644 --- a/modules/travel/front/extra-community/style.scss +++ b/modules/travel/front/extra-community/style.scss @@ -26,11 +26,11 @@ vn-travel-extra-community { color: $color-active } - vn-td-editable text:after { + vn-td-editable:hover text:after { font-family: 'Material Icons'; content: 'edit'; position: absolute; - margin-left: 5px; + right: -15px; color: $color-spacer }