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

78 lines
2.2 KiB
JavaScript

import ngModule from '../../module';
class Controller {
constructor($scope, $stateParams) {
this.$stateParams = $stateParams;
this.$ = $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.$.model.remove(index);
this.$.watcher.check();
this.$.model.save().then(() => {
this.$.watcher.notifySaved();
this.$.watcher.updateOriginalData();
});
}
showItemDescriptor(event, itemFk) {
this.quicklinks = {
btnThree: {
icon: 'icon-transaction',
state: `item.card.diary({
id: ${itemFk},
ticketFk: ${this.$stateParams.id}
})`,
tooltip: 'Item diary'
}
};
this.$.itemDescriptor.itemFk = itemFk;
this.$.itemDescriptor.parent = event.target;
this.$.itemDescriptor.show();
}
showWorkerDescriptor(event, workerFk) {
event.preventDefault();
event.stopImmediatePropagation();
this.selectedWorker = workerFk;
this.$.workerDescriptor.parent = event.target;
this.$.workerDescriptor.show();
}
}
Controller.$inject = ['$scope', '$stateParams'];
ngModule.component('vnTicketRequestIndex', {
template: require('./index.html'),
controller: Controller
});