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

75 lines
2.4 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'},
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: {
fields: [
'salesPersonFk',
'name',
'isActive',
'isFreezed',
'isTaxDataChecked',
'credit',
2020-02-21 07:37:37 +00:00
'email',
'phone',
'mobile'
],
2018-04-10 09:14:33 +00:00
include: {
relation: 'salesPerson',
scope: {
fields: ['userFk'],
include: {
relation: 'user',
scope: {
fields: ['nickname']
}
}
}
},
},
2019-11-10 10:08:44 +00:00
}, {
relation: 'state',
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
}
2018-03-14 10:41:19 +00:00
ngModule.component('vnTicketCard', {
template: require('./index.html'),
controller: Controller
2018-03-14 10:41:19 +00:00
});