2018-03-14 10:41:19 +00:00
|
|
|
import ngModule from '../module';
|
|
|
|
|
|
|
|
class TicketCard {
|
|
|
|
constructor($http, $state, $timeout) {
|
|
|
|
this.$http = $http;
|
|
|
|
this.$state = $state;
|
|
|
|
this.$timeout = $timeout;
|
|
|
|
|
|
|
|
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']
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
relation: 'ticketTracking',
|
|
|
|
scope: {
|
|
|
|
fields: ['stateFk'],
|
|
|
|
include: {
|
|
|
|
relation: 'state',
|
|
|
|
fields: ['name']
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
2018-03-14 10:41:19 +00:00
|
|
|
};
|
|
|
|
this.$http.get(`/ticket/api/Tickets/${this.$state.params.id}?filter=${JSON.stringify(filter)}`)
|
|
|
|
.then(res => {
|
|
|
|
if (res.data && res.data.id) {
|
|
|
|
this.$timeout(() => {
|
|
|
|
this.ticket = res.data;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
$onInit() {
|
|
|
|
this._getTicket();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
TicketCard.$inject = ['$http', '$state', '$timeout'];
|
|
|
|
|
|
|
|
ngModule.component('vnTicketCard', {
|
|
|
|
template: require('./ticket-card.html'),
|
|
|
|
controller: TicketCard
|
|
|
|
});
|