2018-03-14 10:41:19 +00:00
|
|
|
import ngModule from '../module';
|
2019-11-10 10:08:44 +00:00
|
|
|
import ModuleCard from 'salix/components/module-card';
|
2018-03-14 10:41:19 +00:00
|
|
|
|
2019-11-10 10:08:44 +00:00
|
|
|
class Controller extends ModuleCard {
|
|
|
|
reload() {
|
|
|
|
let filter = {
|
2018-04-10 09:14:33 +00:00
|
|
|
include: [
|
2019-03-29 06:29:09 +00:00
|
|
|
{relation: 'address'},
|
2019-01-21 07:44:21 +00:00
|
|
|
{relation: 'ship'},
|
|
|
|
{relation: 'stowaway'},
|
2018-04-10 09:14:33 +00:00
|
|
|
{
|
2019-11-10 10:08:44 +00:00
|
|
|
relation: 'warehouse',
|
|
|
|
scope: {fields: ['name']}
|
|
|
|
}, {
|
|
|
|
relation: 'invoiceOut',
|
|
|
|
scope: {fields: ['id']}
|
|
|
|
}, {
|
|
|
|
relation: 'agencyMode',
|
|
|
|
scope: {fields: ['name']}
|
|
|
|
}, {
|
2018-04-10 09:14:33 +00:00
|
|
|
relation: 'client',
|
|
|
|
scope: {
|
2019-11-06 07:20:45 +00:00
|
|
|
fields: [
|
|
|
|
'salesPersonFk',
|
|
|
|
'name',
|
|
|
|
'isActive',
|
|
|
|
'isFreezed',
|
|
|
|
'isTaxDataChecked',
|
|
|
|
'credit',
|
2020-02-21 07:37:37 +00:00
|
|
|
'email',
|
|
|
|
'phone',
|
|
|
|
'mobile'
|
2019-11-06 07:20:45 +00:00
|
|
|
],
|
2018-04-10 09:14:33 +00:00
|
|
|
include: {
|
|
|
|
relation: 'salesPerson',
|
2019-01-31 13:14:39 +00:00
|
|
|
scope: {
|
|
|
|
fields: ['userFk'],
|
|
|
|
include: {
|
|
|
|
relation: 'user',
|
|
|
|
scope: {
|
|
|
|
fields: ['nickname']
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2018-10-29 07:33:53 +00:00
|
|
|
},
|
|
|
|
},
|
2019-11-10 10:08:44 +00:00
|
|
|
}, {
|
2020-06-23 11:40:49 +00:00
|
|
|
relation: 'ticketState',
|
2018-04-10 09:14:33 +00:00
|
|
|
scope: {
|
|
|
|
fields: ['stateFk'],
|
|
|
|
include: {
|
|
|
|
relation: 'state',
|
2018-11-14 13:33:25 +00:00
|
|
|
fields: ['id', 'name'],
|
|
|
|
}
|
2018-10-29 07:33:53 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
2018-03-14 10:41:19 +00:00
|
|
|
};
|
2018-05-31 12:48:10 +00:00
|
|
|
|
2020-03-30 15:30:03 +00:00
|
|
|
return this.$http.get(`Tickets/${this.$params.id}`, {filter})
|
2019-11-10 10:08:44 +00:00
|
|
|
.then(res => this.onData(res.data));
|
2018-10-03 06:00:19 +00:00
|
|
|
}
|
|
|
|
|
2019-11-10 10:08:44 +00:00
|
|
|
onData(data) {
|
|
|
|
this.ticket = data;
|
2020-03-30 15:30:03 +00:00
|
|
|
return this.$http.get(`Clients/${data.client.id}/getDebt`)
|
2019-11-10 10:08:44 +00:00
|
|
|
.then(res => this.ticket.client.debt = res.data.debt);
|
2018-05-08 07:30:55 +00:00
|
|
|
}
|
2018-03-14 10:41:19 +00:00
|
|
|
}
|
2018-05-25 08:03:45 +00:00
|
|
|
|
2020-07-24 12:22:30 +00:00
|
|
|
ngModule.vnComponent('vnTicketCard', {
|
2018-05-25 08:03:45 +00:00
|
|
|
template: require('./index.html'),
|
2018-11-14 13:33:25 +00:00
|
|
|
controller: Controller
|
2018-03-14 10:41:19 +00:00
|
|
|
});
|