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

88 lines
2.3 KiB
JavaScript
Raw Normal View History

2018-07-18 12:38:43 +00:00
import ngModule from '../module';
export default class Controller {
constructor($scope) {
this.$ = $scope;
2018-07-18 12:38:43 +00:00
this.ticketSelected = null;
2018-09-06 10:47:25 +00:00
this.filter = {
include: [
{
relation: 'client',
2019-01-30 14:10:52 +00:00
scope: {
fields: ['name', 'salesPersonFk'],
include: {
relation: 'salesPerson',
scope: {
fields: ['userFk'],
include: {
relation: 'user',
scope: {
fields: ['nickname']
}
}
}
}
}
2018-09-06 10:47:25 +00:00
},
{
relation: 'company',
fields: ['code']
}
]
};
2018-07-18 12:38:43 +00:00
}
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};
}
}
showClientDescriptor(event, clientFk) {
this.$.clientDescriptor.clientFk = clientFk;
this.$.clientDescriptor.parent = event.target;
this.$.clientDescriptor.show();
2018-09-06 10:47:25 +00:00
event.preventDefault();
event.stopImmediatePropagation();
}
showWorkerDescriptor(event, userId) {
event.preventDefault();
event.stopImmediatePropagation();
this.selectedWorker = userId;
this.$.workerDescriptor.parent = event.target;
this.$.workerDescriptor.show();
}
2018-09-06 10:47:25 +00:00
onDescriptorLoad() {
this.$.popover.relocate();
2018-09-06 10:47:25 +00:00
}
preview(event, order) {
event.preventDefault();
event.stopImmediatePropagation();
this.selectedOrder = order;
this.$.summary.show();
2018-07-18 12:38:43 +00:00
}
}
Controller.$inject = ['$scope'];
ngModule.component('vnOrderIndex', {
template: require('./index.html'),
controller: Controller
});