81 lines
2.5 KiB
JavaScript
81 lines
2.5 KiB
JavaScript
import ngModule from '../module';
|
|
import ModuleCard from 'salix/components/module-card';
|
|
|
|
class Controller extends ModuleCard {
|
|
reload() {
|
|
let filter = {
|
|
include: [
|
|
{
|
|
relation: 'address'},
|
|
{
|
|
relation: 'ship'},
|
|
{
|
|
relation: 'stowaway'},
|
|
{
|
|
relation: 'warehouse',
|
|
scope: {fields: ['name']}
|
|
},
|
|
{
|
|
relation: 'invoiceOut',
|
|
scope: {fields: ['id']}
|
|
},
|
|
{
|
|
relation: 'agencyMode',
|
|
scope: {fields: ['name']}
|
|
},
|
|
{
|
|
relation: 'client',
|
|
scope: {
|
|
fields: [
|
|
'salesPersonFk',
|
|
'name',
|
|
'isActive',
|
|
'isFreezed',
|
|
'isTaxDataChecked',
|
|
'credit',
|
|
'email',
|
|
'phone',
|
|
'mobile'
|
|
],
|
|
include: {
|
|
relation: 'salesPerson',
|
|
scope: {
|
|
fields: ['userFk'],
|
|
include: {
|
|
relation: 'user',
|
|
scope: {
|
|
fields: ['nickname']
|
|
}
|
|
}
|
|
}
|
|
},
|
|
},
|
|
}, {
|
|
relation: 'ticketState',
|
|
scope: {
|
|
fields: ['stateFk'],
|
|
include: {
|
|
relation: 'state',
|
|
fields: ['id', 'name'],
|
|
}
|
|
},
|
|
},
|
|
],
|
|
};
|
|
|
|
return this.$http.get(`Tickets/${this.$params.id}`, {filter})
|
|
.then(res => this.onData(res.data));
|
|
}
|
|
|
|
onData(data) {
|
|
this.ticket = data;
|
|
return this.$http.get(`Clients/${data.client.id}/getDebt`)
|
|
.then(res => this.ticket.client.debt = res.data.debt);
|
|
}
|
|
}
|
|
|
|
ngModule.vnComponent('vnTicketCard', {
|
|
template: require('./index.html'),
|
|
controller: Controller
|
|
});
|