2021-02-10 14:03:11 +00:00
|
|
|
import ngModule from '../module';
|
|
|
|
import Section from 'salix/components/section';
|
|
|
|
|
|
|
|
export default class Controller extends Section {
|
2022-04-29 10:13:02 +00:00
|
|
|
constructor($element, $, vnFile) {
|
|
|
|
super($element, $, vnFile);
|
|
|
|
this.vnFile = vnFile;
|
|
|
|
}
|
|
|
|
|
2021-02-10 14:03:11 +00:00
|
|
|
exprBuilder(param, value) {
|
|
|
|
switch (param) {
|
2021-03-03 11:28:37 +00:00
|
|
|
case 'issued':
|
|
|
|
return {'ii.issued': {
|
2021-02-10 14:03:11 +00:00
|
|
|
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};
|
2021-03-02 13:59:02 +00:00
|
|
|
case 'awbCode':
|
|
|
|
return {'awb.code': value};
|
2021-02-11 14:06:41 +00:00
|
|
|
default:
|
|
|
|
return {[param]: value};
|
2021-02-10 14:03:11 +00:00
|
|
|
}
|
|
|
|
}
|
2021-03-03 11:28:37 +00:00
|
|
|
|
|
|
|
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];
|
|
|
|
}
|
2021-04-15 08:47:39 +00:00
|
|
|
|
|
|
|
preview(invoiceIn) {
|
|
|
|
this.selectedInvoiceIn = invoiceIn;
|
|
|
|
this.$.summary.show();
|
|
|
|
}
|
2022-04-29 10:13:02 +00:00
|
|
|
|
|
|
|
downloadFile(dmsId) {
|
|
|
|
this.vnFile.download(`api/dms/${dmsId}/downloadFile`);
|
|
|
|
}
|
2021-02-10 14:03:11 +00:00
|
|
|
}
|
|
|
|
|
2022-04-29 10:13:02 +00:00
|
|
|
Controller.$inject = ['$element', '$scope', 'vnFile'];
|
|
|
|
|
2021-02-10 14:03:11 +00:00
|
|
|
ngModule.vnComponent('vnInvoiceInIndex', {
|
|
|
|
template: require('./index.html'),
|
|
|
|
controller: Controller
|
|
|
|
});
|