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

60 lines
1.6 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'
}
}
},
{relation: 'requester',
scope: {
include: {
relation: 'user'
}
}
},
{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
});