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

View File

@ -11,10 +11,15 @@
value-field="id" value-field="id"
label="Province"> label="Province">
</vn-autocomplete> </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-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-autocomplete vn-one margin-medium-right field="$ctrl.filter.agencyFk" url="/production/api/Agencies/list" label="Agency"></vn-autocomplete>
</vn-horizontal> </vn-horizontal>
<vn-horizontal margin-large-top> <vn-horizontal margin-large-top>