salix/modules/ticket/front/card/index.js

77 lines
2.3 KiB
JavaScript
Raw Normal View History

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: [
{
relation: 'address'
},
{
relation: 'zone'
},
2018-04-10 09:14:33 +00:00
{
2019-11-10 10:08:44 +00:00
relation: 'warehouse',
scope: {fields: ['name']}
},
{
2019-11-10 10:08:44 +00:00
relation: 'invoiceOut',
scope: {fields: ['id']}
},
{
2019-11-10 10:08:44 +00:00
relation: 'agencyMode',
scope: {fields: ['name']}
},
{
2018-04-10 09:14:33 +00:00
relation: 'client',
scope: {
fields: [
'salesPersonFk',
'name',
'isActive',
'isFreezed',
'isTaxDataChecked',
'credit',
2020-02-21 07:37:37 +00:00
'email',
'phone',
'mobile',
'hasInvoiceElectronic',
],
2018-04-10 09:14:33 +00:00
include: {
relation: 'salesPersonUser',
scope: {
fields: ['id', 'name']
}
},
},
},
{
2020-06-23 11:40:49 +00:00
relation: 'ticketState',
2018-04-10 09:14:33 +00:00
scope: {
fields: ['stateFk'],
include: {
relation: 'state',
fields: ['id', 'name'],
}
},
},
],
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-03-14 10:41:19 +00:00
}
ngModule.vnComponent('vnTicketCard', {
template: require('./index.html'),
controller: Controller
2018-03-14 10:41:19 +00:00
});