diff --git a/modules/travel/front/descriptor-menu/index.js b/modules/travel/front/descriptor-menu/index.js index 84a510e55..975cd9134 100644 --- a/modules/travel/front/descriptor-menu/index.js +++ b/modules/travel/front/descriptor-menu/index.js @@ -7,6 +7,47 @@ class Controller extends Section { super($element, $); } + get travelId() { + return this._travelId; + } + + set travelId(value) { + this._travelId = value; + + if (value) this.loadData(); + } + + loadData() { + const filter = { + fields: [ + 'id', + 'ref', + 'shipped', + 'landed', + 'totalEntries', + 'agencyFk', + 'warehouseInFk', + 'warehouseOutFk', + 'cargoSupplierFk' + ], + include: [ + { + relation: 'warehouseIn', + scope: { + fields: ['name'] + } + }, { + relation: 'warehouseOut', + scope: { + fields: ['name'] + } + } + ] + }; + return this.$http.get(`Travels/${this.travelId}`, {filter}) + .then(res => this.travel = res.data); + } + onCloneAccept() { const params = JSON.stringify({ ref: this.travel.ref, @@ -26,6 +67,6 @@ ngModule.vnComponent('vnTravelDescriptorMenu', { template: require('./index.html'), controller: Controller, bindings: { - travel: '<', + travelId: '<', } }); diff --git a/modules/travel/front/descriptor-menu/locale/es.yml b/modules/travel/front/descriptor-menu/locale/es.yml new file mode 100644 index 000000000..117611660 --- /dev/null +++ b/modules/travel/front/descriptor-menu/locale/es.yml @@ -0,0 +1 @@ +Clone travel: Clonar envĂ­o \ No newline at end of file diff --git a/modules/travel/front/descriptor/index.html b/modules/travel/front/descriptor/index.html index 1e5d0294f..28e908d18 100644 --- a/modules/travel/front/descriptor/index.html +++ b/modules/travel/front/descriptor/index.html @@ -2,7 +2,7 @@ module="travel" description="$ctrl.travel.ref"> - +
@@ -36,11 +36,6 @@
- -
diff --git a/modules/travel/front/descriptor/index.js b/modules/travel/front/descriptor/index.js index 744166580..dc19f68af 100644 --- a/modules/travel/front/descriptor/index.js +++ b/modules/travel/front/descriptor/index.js @@ -22,27 +22,6 @@ class Controller extends Descriptor { return travelFilter; } - get entryFilter() { - let travel = this.travel; - - if (!travel || !travel.landed) return null; - - const date = new Date(travel.landed); - date.setHours(0, 0, 0, 0); - - const from = new Date(date.getTime()); - from.setDate(from.getDate() - 10); - - const to = new Date(date.getTime()); - to.setDate(to.getDate() + 10); - - return JSON.stringify({ - supplierFk: this.travel.cargoSupplierFk, - from, - to - }); - } - loadData() { const filter = { fields: [