import ngModule from '../module'; export default class Controller { constructor($scope) { this.$scope = $scope; this.ticketSelected = null; this.filter = { include: [ { relation: 'client', scope: { fields: ['name', 'salesPersonFk'], include: { relation: 'salesPerson', scope: { fields: ['userFk'], include: { relation: 'user', scope: { fields: ['nickname'] } } } } } }, { relation: 'company', fields: ['code'] } ] }; } exprBuilder(param, value) { switch (param) { case 'search': return {id: value}; case 'from': return {landed: {gte: value}}; case 'to': return {landed: {lte: value}}; case 'id': case 'clientFk': case 'workerFk': case 'sourceApp': case 'agencyModeFk': case 'isConfirmed': return {[param]: value}; } } showDescriptor(event, clientFk) { this.$scope.descriptor.clientFk = clientFk; this.$scope.descriptor.parent = event.target; this.$scope.descriptor.show(); event.preventDefault(); event.stopImmediatePropagation(); } onDescriptorLoad() { this.$scope.popover.relocate(); } preview(event, order) { event.preventDefault(); event.stopImmediatePropagation(); this.selectedOrder = order; this.$scope.summary.show(); } } Controller.$inject = ['$scope']; ngModule.component('vnOrderIndex', { template: require('./index.html'), controller: Controller });