diff --git a/client/production/src/index/index.js b/client/production/src/index/index.js index 2f11c7150..1b9ab4c5b 100644 --- a/client/production/src/index/index.js +++ b/client/production/src/index/index.js @@ -65,8 +65,12 @@ export default class ProductionIndex { } ); } - _publishComment(ids, comment) { - console.log("TODO: rest to publish comment", ids, comment); + _publishComment(tickets) { + this.$http.post(`/production/api/TicketStates/sendMessage`, {tickets: tickets}).then( + () => { + this.vnApp.showMessage(this.$translate.instant('Success: message send!')); + } + ); } // End Actions Callbacks doAction(action) { @@ -74,10 +78,12 @@ export default class ProductionIndex { if (checks.length) { let ids = []; let index = []; + let tickets = []; checks.forEach( (_, i) => { ids.push(this.tickets[i].ticketFk); index.push(i); + tickets.push(this.tickets[i]); } ); switch (action) { @@ -85,7 +91,7 @@ export default class ProductionIndex { this._changeState(ids, this.actions.state.id, this.actions.state.name, index); break; case 'addComment': - this._openComment(ids); + this._publishComment(tickets); break; case 'markPrinted': this._changeState(ids, 4, 'Impreso', index); @@ -97,17 +103,11 @@ export default class ProductionIndex { } // Start modals and actions modals - _openComment(ids) { - this.child = this.vnPopover.showComponent('vn-production-comment', this.$, this.$element[0].querySelector('.actionPanel')); - var childCtrl = angular.element(this.child).isolateScope().$ctrl; - childCtrl.ids = ids; - childCtrl.onComment = (ids, comment) => this.onChildComment(ids, comment); - childCtrl.onCancel = () => this.onChildCancel(); - } moreFilters(event) { this.child = this.vnPopover.showComponent('vn-production-filter-panel', this.$, this.$element[0].querySelector('.filterPanel')); var childCtrl = angular.element(this.child).isolateScope().$ctrl; childCtrl.filter = Object.assign({}, this.filter); + childCtrl.data = Object.assign({}, {states: this.states}, {hourItems: this.hourItems}); childCtrl.onSubmit = filter => this.onChildSubmit(filter); childCtrl.onCancel = () => this.onChildCancel(); event.preventDefault(); @@ -116,10 +116,6 @@ export default class ProductionIndex { this.filterTickets(filter); this.onChildCancel(); } - onChildComment(ids, comment) { - this.onChildCancel(); - this._publishComment(ids, comment); - } onChildCancel() { angular.element(this.child).scope().$destroy(); angular.element(this.child).remove(); diff --git a/client/production/src/production-filters/production-filters.html b/client/production/src/production-filters/production-filters.html index 6b5385c31..f89f3d27a 100644 --- a/client/production/src/production-filters/production-filters.html +++ b/client/production/src/production-filters/production-filters.html @@ -11,10 +11,15 @@ value-field="id" label="Province"> - + + - +