2018-08-30 06:50:03 +00:00
|
|
|
import ngModule from '../module';
|
2020-04-25 09:50:04 +00:00
|
|
|
import Descriptor from 'salix/components/descriptor';
|
2018-08-30 06:50:03 +00:00
|
|
|
|
2020-04-25 09:50:04 +00:00
|
|
|
class Controller extends Descriptor {
|
2019-12-17 07:38:36 +00:00
|
|
|
get ticket() {
|
2020-04-30 10:48:52 +00:00
|
|
|
return this.entity;
|
2019-12-17 07:38:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
set ticket(value) {
|
2020-04-30 10:48:52 +00:00
|
|
|
this.entity = value;
|
|
|
|
}
|
2019-12-17 07:38:36 +00:00
|
|
|
|
2020-04-30 10:48:52 +00:00
|
|
|
get entity() {
|
|
|
|
return super.entity;
|
|
|
|
}
|
2019-12-17 07:38:36 +00:00
|
|
|
|
2020-04-30 10:48:52 +00:00
|
|
|
set entity(value) {
|
|
|
|
super.entity = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
loadData() {
|
|
|
|
const filter = {
|
|
|
|
include: [
|
|
|
|
{
|
|
|
|
relation: 'warehouse',
|
|
|
|
scope: {
|
|
|
|
fields: ['name']
|
|
|
|
}
|
|
|
|
}, {
|
|
|
|
relation: 'agencyMode',
|
|
|
|
scope: {
|
|
|
|
fields: ['name']
|
|
|
|
}
|
|
|
|
}, {
|
|
|
|
relation: 'client',
|
|
|
|
scope: {
|
|
|
|
fields: [
|
|
|
|
'salesPersonFk',
|
|
|
|
'name',
|
|
|
|
'isActive',
|
|
|
|
'isFreezed',
|
|
|
|
'isTaxDataChecked'
|
|
|
|
],
|
|
|
|
include: {
|
2020-09-15 17:43:07 +00:00
|
|
|
relation: 'salesPersonUser',
|
2020-04-30 10:48:52 +00:00
|
|
|
scope: {
|
2020-09-15 17:43:07 +00:00
|
|
|
fields: ['id', 'name']
|
2020-04-30 10:48:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}, {
|
2020-06-23 11:40:49 +00:00
|
|
|
relation: 'ticketState',
|
2020-04-30 10:48:52 +00:00
|
|
|
scope: {
|
|
|
|
fields: ['stateFk'],
|
|
|
|
include: {
|
|
|
|
relation: 'state',
|
|
|
|
fields: ['id', 'name'],
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
};
|
|
|
|
|
|
|
|
return this.getData(`Tickets/${this.id}`, {filter})
|
|
|
|
.then(res => this.entity = res.data);
|
2019-11-20 05:53:37 +00:00
|
|
|
}
|
2020-11-10 09:38:25 +00:00
|
|
|
|
|
|
|
cardReload() {
|
|
|
|
// Prevents error when not defined
|
|
|
|
}
|
|
|
|
|
|
|
|
get filter() {
|
|
|
|
return this.ticket ?
|
|
|
|
JSON.stringify({clientFk: this.ticket.clientFk}) : null;
|
|
|
|
}
|
2018-08-30 06:50:03 +00:00
|
|
|
}
|
|
|
|
|
2020-04-25 09:50:04 +00:00
|
|
|
ngModule.vnComponent('vnTicketDescriptor', {
|
2018-08-30 06:50:03 +00:00
|
|
|
template: require('./index.html'),
|
2020-04-25 09:50:04 +00:00
|
|
|
controller: Controller,
|
2018-08-30 06:50:03 +00:00
|
|
|
bindings: {
|
2019-02-04 11:24:47 +00:00
|
|
|
ticket: '<',
|
|
|
|
cardReload: '&'
|
2020-04-25 09:50:04 +00:00
|
|
|
}
|
2018-08-30 06:50:03 +00:00
|
|
|
});
|