salix/modules/ticket/front/request/index/index.js

78 lines
2.2 KiB
JavaScript
Raw Normal View History

2018-11-21 07:58:34 +00:00
import ngModule from '../../module';
class Controller {
constructor($scope, $stateParams) {
2018-11-21 07:58:34 +00:00
this.$stateParams = $stateParams;
this.$ = $scope;
2018-11-21 07:58:34 +00:00
this.filter = {
include: [
{
relation: 'atender',
2018-12-21 11:35:34 +00:00
scope: {
include: {
relation: 'user',
scope: {
fields: ['nickname']
}
2018-12-21 11:35:34 +00:00
}
}
},
{
relation: 'requester',
2018-12-21 11:35:34 +00:00
scope: {
include: {
relation: 'user',
scope: {
fields: ['nickname']
}
2018-12-21 11:35:34 +00:00
}
}
},
{
relation: 'sale'
}
2018-11-21 07:58:34 +00:00
]
};
}
removeLine(index) {
this.$.model.remove(index);
this.$.watcher.check();
this.$.model.save().then(() => {
this.$.watcher.notifySaved();
this.$.watcher.updateOriginalData();
2018-11-21 07:58:34 +00:00
});
}
showItemDescriptor(event, itemFk) {
2018-11-21 07:58:34 +00:00
this.quicklinks = {
btnThree: {
icon: 'icon-transaction',
state: `item.card.diary({
id: ${itemFk},
2018-11-21 07:58:34 +00:00
ticketFk: ${this.$stateParams.id}
})`,
tooltip: 'Item diary'
}
};
this.$.itemDescriptor.itemFk = itemFk;
this.$.itemDescriptor.parent = event.target;
this.$.itemDescriptor.show();
}
showWorkerDescriptor(event, userId) {
event.preventDefault();
event.stopImmediatePropagation();
this.selectedWorker = userId;
this.$.workerDescriptor.parent = event.target;
this.$.workerDescriptor.show();
2018-11-21 07:58:34 +00:00
}
}
Controller.$inject = ['$scope', '$stateParams'];
2018-11-21 07:58:34 +00:00
ngModule.component('vnTicketRequestIndex', {
template: require('./index.html'),
controller: Controller
});