bug fixed in production and production filters

This commit is contained in:
Daniel Herrero 2017-11-23 08:35:17 +01:00
parent 02fb54efa9
commit 5ad2c70400
3 changed files with 15 additions and 7 deletions

View File

@ -1,4 +1,4 @@
<mg-ajax path="/production/api/States/list" options="vnIndex as states" actions="$ctrl.states = states.model;"></mg-ajax> <mg-ajax path="/production/api/States/list" options="vnIndex as states" actions="$ctrl.sharedData.states = states.model;"></mg-ajax>
<mg-ajax path="/production/api/FakeProductions/list" options="vnIndexNonAuto as index"></mg-ajax> <mg-ajax path="/production/api/FakeProductions/list" options="vnIndexNonAuto as index"></mg-ajax>
<vn-card margin-large> <vn-card margin-large>
<vn-vertical pad-medium> <vn-vertical pad-medium>
@ -11,6 +11,7 @@
advanced="true" advanced="true"
popover="vn-production-filter-panel" popover="vn-production-filter-panel"
ignore-keys = "['page', 'size', 'search', 'warehouseFk']" ignore-keys = "['page', 'size', 'search', 'warehouseFk']"
data ="$ctrl.sharedData"
> >
</vn-searchbar> </vn-searchbar>
@ -30,7 +31,7 @@
</vn-horizontal> </vn-horizontal>
<vn-horizontal vn-one margin-large-bottom> <vn-horizontal vn-one margin-large-bottom>
<vn-one> <vn-one>
<vn-production-actions tickets="$ctrl.tickets" states="$ctrl.states" hour-items="$ctrl.hourItems"></vn-production-actions> <vn-production-actions tickets="$ctrl.tickets" states="$ctrl.sharedData.states" hour-items="$ctrl.sharedData.hourItems"></vn-production-actions>
</vn-one> </vn-one>
<vn-two></vn-two> <vn-two></vn-two>
</vn-horizontal> </vn-horizontal>

View File

@ -8,7 +8,7 @@ export default class ProductionIndex {
this.$http = $http; this.$http = $http;
this.filter = {}; this.filter = {};
this.tickets = []; this.tickets = [];
this.states = [];
this.checkAll = 0; this.checkAll = 0;
this.footer = { this.footer = {
total: null, total: null,
@ -16,7 +16,12 @@ export default class ProductionIndex {
meters: null meters: null
}; };
this._search = null; this._search = null;
this.hourItems = [];
this.sharedData = {
states: [],
hourItems: []
};
this.child = undefined; this.child = undefined;
this.userProfile = aclConstant.userProfile; this.userProfile = aclConstant.userProfile;
this.filter.warehouseFk = this.userProfile.warehouseId; this.filter.warehouseFk = this.userProfile.warehouseId;
@ -89,7 +94,7 @@ export default class ProductionIndex {
hour = [0, i].join(''); hour = [0, i].join('');
} }
hour += ':00'; hour += ':00';
this.hourItems.push({id: i, name: hour}); this.sharedData.hourItems.push({id: i, name: hour});
} }
this.filter.warehouseFk = this.$.displayValue = this.userProfile.warehouseId; this.filter.warehouseFk = this.$.displayValue = this.userProfile.warehouseId;
} }

View File

@ -69,7 +69,8 @@ export default class Controller {
var childCtrl = angular.element(this.child).isolateScope().$ctrl; var childCtrl = angular.element(this.child).isolateScope().$ctrl;
childCtrl.filter = Object.assign({}, this.index.filter); childCtrl.filter = Object.assign({}, this.index.filter);
childCtrl.onSubmit = filter => this.onChildSubmit(filter); childCtrl.onSubmit = filter => this.onChildSubmit(filter);
if (this.data)
childCtrl.data = Object.assign({}, this.data);
event.preventDefault(); event.preventDefault();
} }
onChildSubmit(filter) { onChildSubmit(filter) {
@ -112,7 +113,8 @@ ngModule.component('vnSearchbar', {
advanced: '=', advanced: '=',
popover: '@', popover: '@',
label: '@?', label: '@?',
ignoreKeys: '<?' ignoreKeys: '<?',
data: '<?'
}, },
controller: Controller controller: Controller
}); });