2018-08-07 09:57:11 +00:00
|
|
|
import ngModule from '../module';
|
2019-01-16 14:05:35 +00:00
|
|
|
import './style.scss';
|
2018-08-07 09:57:11 +00:00
|
|
|
|
|
|
|
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: {
|
2019-01-30 14:10:52 +00:00
|
|
|
fields: ['userFk'],
|
|
|
|
include: {
|
|
|
|
relation: 'user',
|
|
|
|
scope: {
|
|
|
|
fields: ['nickname']
|
|
|
|
}
|
|
|
|
}
|
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
|
|
|
|
2018-09-04 13:08:36 +00:00
|
|
|
exprBuilder(param, value) {
|
|
|
|
switch (param) {
|
|
|
|
case 'search':
|
|
|
|
return /^\d+$/.test(value)
|
|
|
|
? {id: value}
|
2019-01-21 10:45:53 +00:00
|
|
|
: {client: {like: `%${value}%`}};
|
2018-09-04 13:08:36 +00:00
|
|
|
case 'client':
|
2019-01-21 10:45:53 +00:00
|
|
|
return {[param]: {like: `%${value}%`}};
|
2018-09-04 13:08:36 +00:00
|
|
|
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();
|
|
|
|
}
|
|
|
|
|
2018-09-05 11:47:15 +00:00
|
|
|
preview(event, claim) {
|
|
|
|
this.claimSelected = claim;
|
|
|
|
this.$.dialogSummaryClaim.show();
|
|
|
|
event.preventDefault();
|
|
|
|
event.stopImmediatePropagation();
|
|
|
|
}
|
|
|
|
|
2018-08-31 12:35:20 +00:00
|
|
|
onDescriptorLoad() {
|
|
|
|
this.$.popover.relocate();
|
|
|
|
}
|
2018-08-07 09:57:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Controller.$inject = ['$scope'];
|
|
|
|
|
|
|
|
ngModule.component('vnClaimIndex', {
|
|
|
|
template: require('./index.html'),
|
|
|
|
controller: Controller
|
|
|
|
});
|