cambio en accion envio de mensaje

This commit is contained in:
Dani Herrero 2017-06-26 09:39:21 +02:00
parent a96e3a57b6
commit fcfef2c8b7
2 changed files with 17 additions and 16 deletions

View File

@ -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();

View File

@ -11,10 +11,15 @@
value-field="id"
label="Province">
</vn-autocomplete>
<vn-date-picker vn-one label="Hour" ini-opts="{enableTime:true,noCalendar:true,dateFormat:'H:i',time_24hr:true,static:true,minuteIncrement:30}" model="$ctrl.filter.hour"></n-date-picker>
<vn-autocomplete vn-one
data="$ctrl.data.hourItems"
label="Hour"
field="$ctrl.filter.hour"
>
</vn-autocomplete>
</vn-horizontal>
<vn-horizontal>
<vn-autocomplete vn-one margin-medium-right field="$ctrl.filter.stateFk" data="$ctrl.states" label="State"></vn-autocomplete>
<vn-autocomplete vn-one margin-medium-right field="$ctrl.filter.stateFk" data="$ctrl.data.states" label="State"></vn-autocomplete>
<vn-autocomplete vn-one margin-medium-right field="$ctrl.filter.agencyFk" url="/production/api/Agencies/list" label="Agency"></vn-autocomplete>
</vn-horizontal>
<vn-horizontal margin-large-top>