salix/client/ticket/src/card/index.js

59 lines
1.6 KiB
JavaScript
Raw Normal View History

2018-03-14 10:41:19 +00:00
import ngModule from '../module';
class Controller {
constructor($http, $state) {
2018-03-14 10:41:19 +00:00
this.$http = $http;
this.$state = $state;
2018-10-03 06:00:19 +00:00
this.filter = {
2018-04-10 09:14:33 +00:00
include: [
{relation: 'warehouse', scope: {fields: ['name']}},
{relation: 'agencyMode', scope: {fields: ['name']}},
{
relation: 'client',
scope: {
2018-05-31 06:57:25 +00:00
fields: ['salesPersonFk', 'name', 'isActive', 'isFreezed', 'isTaxDataChecked'],
2018-04-10 09:14:33 +00:00
include: {
relation: 'salesPerson',
fields: ['firstName', 'name']
}
}
},
{
relation: 'tracking',
2018-04-10 09:14:33 +00:00
scope: {
fields: ['stateFk'],
include: {
relation: 'state',
fields: ['name']
}
}
}
]
2018-03-14 10:41:19 +00:00
};
2018-10-03 06:00:19 +00:00
}
2018-05-31 12:48:10 +00:00
2018-10-03 06:00:19 +00:00
$onInit() {
this.getCard();
}
getCard() {
let json = encodeURIComponent(JSON.stringify(this.filter));
2018-05-31 06:57:25 +00:00
let query = `/ticket/api/Tickets/${this.$state.params.id}?filter=${json}`;
this.$http.get(query).then(res => {
2018-05-31 12:48:10 +00:00
if (res.data)
this.ticket = res.data;
});
2018-03-14 10:41:19 +00:00
}
reload() {
2018-10-03 06:00:19 +00:00
this.getCard();
}
2018-03-14 10:41:19 +00:00
}
Controller.$inject = ['$http', '$state'];
2018-03-14 10:41:19 +00:00
ngModule.component('vnTicketCard', {
template: require('./index.html'),
controller: Controller
2018-03-14 10:41:19 +00:00
});