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

70 lines
2.0 KiB
JavaScript

import ngModule from '../../module';
class Controller {
constructor($stateParams, $scope) {
this.$stateParams = $stateParams;
this.$scope = $scope;
this.filter = {
include: [
{
relation: 'atender',
scope: {
include: {
relation: 'user',
scope: {
fields: ['nickname']
}
}
}
},
{
relation: 'requester',
scope: {
include: {
relation: 'user',
scope: {
fields: ['nickname']
}
}
}
},
{
relation: 'sale'
}
]
};
}
removeLine(index) {
this.$scope.model.remove(index);
this.$scope.watcher.check();
this.$scope.model.save().then(() => {
this.$scope.watcher.notifySaved();
this.$scope.watcher.updateOriginalData();
});
}
// 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
});