77 lines
1.9 KiB
JavaScript
77 lines
1.9 KiB
JavaScript
import ngModule from '../module';
|
|
|
|
export default class Controller {
|
|
constructor($scope) {
|
|
this.$ = $scope;
|
|
this.ticketSelected = null;
|
|
|
|
this.filter = {
|
|
include: [
|
|
{
|
|
relation: 'client',
|
|
scope: {
|
|
fields: ['name']
|
|
}
|
|
},
|
|
{
|
|
relation: 'worker',
|
|
scope: {
|
|
fields: ['firstName', 'name']
|
|
}
|
|
},
|
|
{
|
|
relation: 'claimState',
|
|
scope: {
|
|
fields: ['description']
|
|
}
|
|
}
|
|
],
|
|
order: 'claimStateFk ASC, created DESC'
|
|
};
|
|
}
|
|
|
|
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};
|
|
}
|
|
}
|
|
|
|
showDescriptor(event, clientFk) {
|
|
this.$.descriptor.clientFk = clientFk;
|
|
this.$.descriptor.parent = event.target;
|
|
this.$.descriptor.show();
|
|
event.preventDefault();
|
|
event.stopImmediatePropagation();
|
|
}
|
|
|
|
preview(event, claim) {
|
|
this.claimSelected = claim;
|
|
this.$.dialogSummaryClaim.show();
|
|
event.preventDefault();
|
|
event.stopImmediatePropagation();
|
|
}
|
|
|
|
onDescriptorLoad() {
|
|
this.$.popover.relocate();
|
|
}
|
|
}
|
|
|
|
Controller.$inject = ['$scope'];
|
|
|
|
ngModule.component('vnClaimIndex', {
|
|
template: require('./index.html'),
|
|
controller: Controller
|
|
});
|