2018-08-24 11:16:11 +00:00
|
|
|
import ngModule from '../module';
|
|
|
|
|
|
|
|
class Controller {
|
|
|
|
constructor($http, $state) {
|
|
|
|
this.$http = $http;
|
|
|
|
this.$state = $state;
|
|
|
|
this.filter = {
|
|
|
|
include: [
|
|
|
|
{relation: 'worker', scope: {fields: ['name', 'firstName']}},
|
2019-01-30 07:44:15 +00:00
|
|
|
{
|
|
|
|
relation: 'ticket',
|
|
|
|
scope: {
|
|
|
|
fields: ['agencyModeFk'],
|
|
|
|
include: {
|
|
|
|
relation: 'agencyMode'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2018-08-24 11:16:11 +00:00
|
|
|
{relation: 'claimState', scope: {fields: ['id', 'description']}},
|
|
|
|
{
|
|
|
|
relation: 'client',
|
|
|
|
scope: {
|
|
|
|
fields: ['salesPersonFk', 'name'],
|
|
|
|
include: {
|
|
|
|
relation: 'salesPerson',
|
|
|
|
fields: ['firstName', 'name']
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2018-10-03 06:00:19 +00:00
|
|
|
$onInit() {
|
|
|
|
this.getCard();
|
|
|
|
}
|
|
|
|
|
|
|
|
getCard() {
|
2018-08-24 11:16:11 +00:00
|
|
|
let json = encodeURIComponent(JSON.stringify(this.filter));
|
|
|
|
let query = `/claim/api/Claims/${this.$state.params.id}?filter=${json}`;
|
|
|
|
this.$http.get(query).then(res => {
|
2018-12-14 11:56:21 +00:00
|
|
|
if (res.data)
|
2018-08-24 11:16:11 +00:00
|
|
|
this.claim = res.data;
|
|
|
|
});
|
|
|
|
}
|
2018-10-03 06:00:19 +00:00
|
|
|
|
2018-08-24 11:16:11 +00:00
|
|
|
reload() {
|
2018-10-03 06:00:19 +00:00
|
|
|
this.getCard();
|
2018-08-24 11:16:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Controller.$inject = ['$http', '$state'];
|
|
|
|
|
|
|
|
ngModule.component('vnClaimCard', {
|
|
|
|
template: require('./index.html'),
|
|
|
|
controller: Controller
|
|
|
|
});
|