salix/modules/order/front/index/index.js

66 lines
1.6 KiB
JavaScript

import ngModule from '../module';
import './style.scss';
export default class Controller {
constructor($scope) {
this.$scope = $scope;
this.ticketSelected = null;
this.filter = {
include: [
{
relation: 'client',
fields: ['name']
},
{
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
});