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

70 lines
2.0 KiB
JavaScript
Raw Normal View History

2018-11-21 07:58:34 +00:00
import ngModule from '../../module';
class Controller {
constructor($stateParams, $scope) {
this.$stateParams = $stateParams;
this.$scope = $scope;
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.$scope.model.remove(index);
this.$scope.watcher.check();
this.$scope.model.save().then(() => {
this.$scope.watcher.notifySaved();
2018-11-21 08:13:40 +00:00
this.$scope.watcher.updateOriginalData();
2018-11-21 07:58:34 +00:00
});
}
// Item Descriptor
showDescriptor(event, sale) {
this.quicklinks = {
btnThree: {
icon: 'icon-transaction',
state: `item.card.diary({
id: ${sale.itemFk},
ticketFk: ${this.$stateParams.id}
})`,
tooltip: 'Item diary'
}
};
this.$scope.descriptor.itemFk = sale.itemFk;
this.$scope.descriptor.parent = event.target;
this.$scope.descriptor.show();
}
}
Controller.$inject = ['$stateParams', '$scope'];
ngModule.component('vnTicketRequestIndex', {
template: require('./index.html'),
controller: Controller
});