import ngModule from '../module'; import Section from 'salix/components/section'; export default class Controller extends Section { exprBuilder(param, value) { switch (param) { case 'issued': return {'ii.issued': { between: this.dateRange(value)} }; case 'id': case 'supplierFk': case 'supplierRef': case 'serialNumber': case 'serial': case 'created': case 'isBooked': return {[`ii.${param}`]: value}; case 'account': case 'fi': return {[`s.${param}`]: value}; case 'awbCode': return {'awb.code': value}; default: return {[param]: value}; } } dateRange(value) { const minHour = new Date(value); minHour.setHours(0, 0, 0, 0); const maxHour = new Date(value); maxHour.setHours(23, 59, 59, 59); return [minHour, maxHour]; } preview(invoiceIn) { this.selectedInvoiceIn = invoiceIn; this.$.summary.show(); } } ngModule.vnComponent('vnInvoiceInIndex', { template: require('./index.html'), controller: Controller });