salix/modules/ticket/front/descriptor-popover/index.js

67 lines
2.0 KiB
JavaScript
Raw Normal View History

import ngModule from '../module';
2020-04-25 09:50:04 +00:00
import DescriptorPopover from 'salix/components/descriptor-popover';
2018-10-18 09:41:25 +00:00
2020-04-25 09:50:04 +00:00
class Controller extends DescriptorPopover {
2018-10-18 09:41:25 +00:00
get ticket() {
2020-04-25 09:50:04 +00:00
return this.entity;
2019-05-07 09:32:35 +00:00
}
2020-04-25 09:50:04 +00:00
loadData() {
const filter = {
2018-10-18 09:41:25 +00:00
include: [
{
relation: 'warehouse',
scope: {
fields: ['name']
}
2020-04-25 09:50:04 +00:00
}, {
relation: 'agencyMode',
scope: {
fields: ['name']
}
2020-04-25 09:50:04 +00:00
}, {
2018-10-18 09:41:25 +00:00
relation: 'client',
scope: {
2020-04-25 09:50:04 +00:00
fields: [
'salesPersonFk',
'name',
'isActive',
'isFreezed',
'isTaxDataChecked'
],
2018-10-18 09:41:25 +00:00
include: {
relation: 'salesPerson',
scope: {
fields: ['userFk'],
include: {
relation: 'user',
scope: {
fields: ['nickname']
}
}
}
2018-10-18 09:41:25 +00:00
}
}
2020-04-25 09:50:04 +00:00
}, {
relation: 'state',
2018-10-18 09:41:25 +00:00
scope: {
fields: ['stateFk'],
include: {
relation: 'state',
fields: ['id', 'name'],
2018-10-18 09:41:25 +00:00
}
}
}
]
};
2020-04-25 09:50:04 +00:00
return this.getData(`Tickets/${this.id}`, {filter})
.then(res => this.entity = res.data);
2018-10-18 09:41:25 +00:00
}
}
2020-04-25 09:50:04 +00:00
ngModule.vnComponent('vnTicketDescriptorPopover', {
slotTemplate: require('./index.html'),
controller: Controller
});