salix/client/claim/src/index/index.js

70 lines
1.7 KiB
JavaScript
Raw Normal View History

2018-08-07 09:57:11 +00:00
import ngModule from '../module';
export default class Controller {
constructor($scope) {
this.$ = $scope;
this.ticketSelected = null;
this.filter = {
include: [
{
2018-08-07 10:48:55 +00:00
relation: 'client',
2018-08-07 09:57:11 +00:00
scope: {
fields: ['name']
}
2018-08-07 10:48:55 +00:00
},
{
relation: 'worker',
2018-08-07 09:57:11 +00:00
scope: {
2018-08-07 10:48:55 +00:00
fields: ['firstName', 'name']
2018-08-07 09:57:11 +00:00
}
2018-08-07 10:48:55 +00:00
},
{
relation: 'claimState',
2018-08-07 09:57:11 +00:00
scope: {
2018-08-07 10:48:55 +00:00
fields: ['description']
2018-08-07 09:57:11 +00:00
}
}
],
2018-08-07 10:48:55 +00:00
order: 'claimStateFk ASC, created DESC'
2018-08-07 09:57:11 +00:00
};
}
2018-08-31 12:35:20 +00:00
exprBuilder(param, value) {
switch (param) {
case 'search':
return /^\d+$/.test(value)
? {id: value}
: {client: {regexp: value}};
case 'client':
return {[param]: {regexp: value}};
case 'created':
return {created: {between: [value, value]}};
case 'id':
case 'clientFk':
case 'workerFk':
case 'claimStateFk':
return {[param]: value};
}
}
2018-08-31 12:35:20 +00:00
showDescriptor(event, clientFk) {
this.$.descriptor.clientFk = clientFk;
this.$.descriptor.parent = event.target;
this.$.descriptor.show();
event.preventDefault();
event.stopImmediatePropagation();
}
onDescriptorLoad() {
this.$.popover.relocate();
}
2018-08-07 09:57:11 +00:00
}
Controller.$inject = ['$scope'];
ngModule.component('vnClaimIndex', {
template: require('./index.html'),
controller: Controller
});