2018-03-14 10:41:19 +00:00
|
|
|
import ngModule from '../module';
|
|
|
|
|
|
|
|
class TicketCard {
|
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;
|
|
|
|
|
|
|
|
this.ticket = null;
|
|
|
|
}
|
|
|
|
|
|
|
|
_getTicket() {
|
|
|
|
let filter = {
|
2018-04-10 09:14:33 +00:00
|
|
|
include: [
|
|
|
|
{relation: 'warehouse', scope: {fields: ['name']}},
|
|
|
|
{relation: 'agencyMode', scope: {fields: ['name']}},
|
|
|
|
{
|
|
|
|
relation: 'client',
|
|
|
|
scope: {
|
|
|
|
fields: ['salesPersonFk', 'name'],
|
|
|
|
include: {
|
|
|
|
relation: 'salesPerson',
|
|
|
|
fields: ['firstName', 'name']
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
2018-05-08 07:30:55 +00:00
|
|
|
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-05-08 07:30:55 +00:00
|
|
|
let json = encodeURIComponent(JSON.stringify(filter));
|
|
|
|
this.$http.get(`/ticket/api/Tickets/${this.$state.params.id}?filter=${json}`)
|
2018-03-14 10:41:19 +00:00
|
|
|
.then(res => {
|
2018-05-08 07:30:55 +00:00
|
|
|
if (res.data)
|
|
|
|
this.ticket = res.data;
|
2018-03-14 10:41:19 +00:00
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
$onInit() {
|
|
|
|
this._getTicket();
|
|
|
|
}
|
2018-05-08 07:30:55 +00:00
|
|
|
reload() {
|
|
|
|
this._getTicket();
|
|
|
|
}
|
2018-03-14 10:41:19 +00:00
|
|
|
}
|
2018-05-08 07:30:55 +00:00
|
|
|
TicketCard.$inject = ['$http', '$state'];
|
2018-03-14 10:41:19 +00:00
|
|
|
|
|
|
|
ngModule.component('vnTicketCard', {
|
|
|
|
template: require('./ticket-card.html'),
|
|
|
|
controller: TicketCard
|
|
|
|
});
|