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: [
|
2020-07-30 10:51:19 +00:00
|
|
|
{
|
2022-07-01 07:15:07 +00:00
|
|
|
relation: 'address'
|
|
|
|
},
|
2020-07-30 10:51:19 +00:00
|
|
|
{
|
2022-07-01 07:15:07 +00:00
|
|
|
relation: 'zone'
|
|
|
|
},
|
2018-04-10 09:14:33 +00:00
|
|
|
{
|
2019-11-10 10:08:44 +00:00
|
|
|
relation: 'warehouse',
|
|
|
|
scope: {fields: ['name']}
|
2020-07-30 10:51:19 +00:00
|
|
|
},
|
|
|
|
{
|
2019-11-10 10:08:44 +00:00
|
|
|
relation: 'invoiceOut',
|
|
|
|
scope: {fields: ['id']}
|
2020-07-30 10:51:19 +00:00
|
|
|
},
|
|
|
|
{
|
2019-11-10 10:08:44 +00:00
|
|
|
relation: 'agencyMode',
|
|
|
|
scope: {fields: ['name']}
|
2020-07-30 10:51:19 +00:00
|
|
|
},
|
|
|
|
{
|
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',
|
2022-11-15 09:37:12 +00:00
|
|
|
'mobile',
|
|
|
|
'hasInvoiceElectronic',
|
2019-11-06 07:20:45 +00:00
|
|
|
],
|
2018-04-10 09:14:33 +00:00
|
|
|
include: {
|
2020-09-15 17:43:07 +00:00
|
|
|
relation: 'salesPersonUser',
|
2019-01-31 13:14:39 +00:00
|
|
|
scope: {
|
2020-09-15 17:43:07 +00:00
|
|
|
fields: ['id', 'name']
|
2019-01-31 13:14:39 +00:00
|
|
|
}
|
2018-10-29 07:33:53 +00:00
|
|
|
},
|
|
|
|
},
|
2022-07-01 07:15:07 +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
|
|
|
});
|