2018-03-14 10:41:19 +00:00
|
|
|
import ngModule from '../module';
|
|
|
|
|
2018-05-25 08:03:45 +00:00
|
|
|
class Controller {
|
2018-05-08 07:30:55 +00:00
|
|
|
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',
|
2018-10-29 07:33:53 +00:00
|
|
|
fields: ['firstName', 'name'],
|
|
|
|
},
|
|
|
|
},
|
2018-04-10 09:14:33 +00:00
|
|
|
},
|
|
|
|
{
|
2018-05-08 07:30:55 +00:00
|
|
|
relation: 'tracking',
|
2018-04-10 09:14:33 +00:00
|
|
|
scope: {
|
|
|
|
fields: ['stateFk'],
|
|
|
|
include: {
|
|
|
|
relation: 'state',
|
2018-10-29 07:33:53 +00:00
|
|
|
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() {
|
2018-10-29 07:33:53 +00:00
|
|
|
const json = encodeURIComponent(JSON.stringify(this.filter));
|
|
|
|
const query = `/ticket/api/Tickets/${this.$state.params.id}?filter=${json}`;
|
|
|
|
this.$http.get(query).then((res) => {
|
|
|
|
if (res.data) {
|
2018-05-31 12:48:10 +00:00
|
|
|
this.ticket = res.data;
|
2018-10-29 07:33:53 +00:00
|
|
|
}
|
2018-05-31 12:48:10 +00:00
|
|
|
});
|
2018-03-14 10:41:19 +00:00
|
|
|
}
|
|
|
|
|
2018-05-08 07:30:55 +00:00
|
|
|
reload() {
|
2018-10-03 06:00:19 +00:00
|
|
|
this.getCard();
|
2018-05-08 07:30:55 +00:00
|
|
|
}
|
2018-03-14 10:41:19 +00:00
|
|
|
}
|
2018-05-25 08:03:45 +00:00
|
|
|
|
|
|
|
Controller.$inject = ['$http', '$state'];
|
2018-03-14 10:41:19 +00:00
|
|
|
|
|
|
|
ngModule.component('vnTicketCard', {
|
2018-05-25 08:03:45 +00:00
|
|
|
template: require('./index.html'),
|
2018-10-29 07:33:53 +00:00
|
|
|
controller: Controller,
|
2018-03-14 10:41:19 +00:00
|
|
|
});
|