import ngModule from '../module'; import Descriptor from 'salix/components/descriptor'; class Controller extends Descriptor { get entry() { return this.entity; } set entry(value) { this.entity = value; } get travelFilter() { return this.entry && JSON.stringify({ agencyFk: this.entry.travel.agencyFk }); } get entryFilter() { if (!this.entry) return null; const date = new Date(this.entry.travel.landed); date.setHours(0, 0, 0, 0); const from = new Date(date.getTime()); from.setDate(from.getDate() - 10); const to = new Date(date.getTime()); to.setDate(to.getDate() + 10); return JSON.stringify({ supplierFk: this.entry.supplierFk, from, to }); } showEntryReport() { this.vnReport.show('entry-order', { entryId: this.entry.id }); } } ngModule.vnComponent('vnEntryDescriptor', { template: require('./index.html'), controller: Controller, bindings: { entry: '<' } });