salix/modules/entry/front/descriptor/index.js

52 lines
1.1 KiB
JavaScript
Raw Normal View History

2020-01-10 10:52:35 +00:00
import ngModule from '../module';
2020-04-25 09:50:04 +00:00
import Descriptor from 'salix/components/descriptor';
2020-01-10 10:52:35 +00:00
2020-04-25 09:50:04 +00:00
class Controller extends Descriptor {
2020-02-21 11:48:34 +00:00
get entry() {
return this.entity;
2020-02-21 11:48:34 +00:00
}
set entry(value) {
this.entity = value;
}
2020-02-21 11:48:34 +00:00
get travelFilter() {
2020-05-06 12:38:09 +00:00
return this.entry && JSON.stringify({
agencyFk: this.entry.travel.agencyFk
});
}
2020-02-21 11:48:34 +00:00
get entryFilter() {
2020-05-06 12:38:09 +00:00
if (!this.entry) return null;
const date = new Date(this.entry.travel.landed);
date.setHours(0, 0, 0, 0);
2020-02-21 11:48:34 +00:00
const from = new Date(date.getTime());
2020-02-21 11:48:34 +00:00
from.setDate(from.getDate() - 10);
const to = new Date(date.getTime());
to.setDate(to.getDate() + 10);
2020-02-21 11:48:34 +00:00
return JSON.stringify({
2020-05-06 12:38:09 +00:00
supplierFk: this.entry.supplierFk,
from,
to
});
2020-02-21 11:48:34 +00:00
}
showEntryReport() {
2020-06-12 12:28:29 +00:00
this.vnReport.show('entry-order', {
entryId: this.entry.id
});
}
2020-01-10 10:52:35 +00:00
}
2020-04-25 09:50:04 +00:00
ngModule.vnComponent('vnEntryDescriptor', {
2020-01-10 10:52:35 +00:00
template: require('./index.html'),
2020-04-25 09:50:04 +00:00
controller: Controller,
2020-01-10 10:52:35 +00:00
bindings: {
2020-04-25 09:50:04 +00:00
entry: '<'
}
2020-01-10 10:52:35 +00:00
});