salix/modules/claim/front/card/index.js

82 lines
2.3 KiB
JavaScript
Raw Normal View History

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: [
2019-01-30 15:03:29 +00:00
{relation: 'worker',
scope: {
fields: ['userFk'],
include: {
relation: 'user',
scope: {
fields: ['nickname']
}
}
}
},
2019-01-30 07:44:15 +00:00
{
relation: 'ticket',
scope: {
fields: ['agencyModeFk'],
include: {
relation: 'agencyMode'
}
}
},
{
relation: 'claimState',
scope: {
fields: ['id', 'description']
}
},
2018-08-24 11:16:11 +00:00
{
relation: 'client',
scope: {
fields: ['salesPersonFk', 'name'],
include: {
relation: 'salesPerson',
2019-01-30 15:03:29 +00:00
scope: {
fields: ['userFk'],
include: {
relation: 'user',
scope: {
fields: ['nickname']
}
}
}
2018-08-24 11:16:11 +00:00
}
}
}
]
};
}
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
});