82 lines
2.2 KiB
JavaScript
82 lines
2.2 KiB
JavaScript
import ngModule from '../module';
|
|
|
|
class Controller {
|
|
constructor($http, $state) {
|
|
this.$http = $http;
|
|
this.$state = $state;
|
|
this.filter = {
|
|
include: [
|
|
{relation: 'worker',
|
|
scope: {
|
|
fields: ['userFk'],
|
|
include: {
|
|
relation: 'user',
|
|
scope: {
|
|
fields: ['nickname']
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
relation: 'ticket',
|
|
scope: {
|
|
fields: ['agencyModeFk'],
|
|
include: {
|
|
relation: 'agencyMode'
|
|
}
|
|
}
|
|
},
|
|
{
|
|
relation: 'claimState',
|
|
scope: {
|
|
fields: ['id', 'description']
|
|
}
|
|
},
|
|
{
|
|
relation: 'client',
|
|
scope: {
|
|
fields: ['salesPersonFk', 'name'],
|
|
include: {
|
|
relation: 'salesPerson',
|
|
scope: {
|
|
fields: ['userFk'],
|
|
include: {
|
|
relation: 'user',
|
|
scope: {
|
|
fields: ['nickname']
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|
|
]
|
|
};
|
|
}
|
|
|
|
$onInit() {
|
|
this.getCard();
|
|
}
|
|
|
|
getCard() {
|
|
let json = encodeURIComponent(JSON.stringify(this.filter));
|
|
let query = `Claims/${this.$state.params.id}?filter=${json}`;
|
|
this.$http.get(query).then(res => {
|
|
if (res.data)
|
|
this.claim = res.data;
|
|
});
|
|
}
|
|
|
|
reload() {
|
|
this.getCard();
|
|
}
|
|
}
|
|
|
|
Controller.$inject = ['$http', '$state'];
|
|
|
|
ngModule.component('vnClaimCard', {
|
|
template: require('./index.html'),
|
|
controller: Controller
|
|
});
|