45 lines
938 B
JavaScript
45 lines
938 B
JavaScript
import ngModule from '../module';
|
|
import Section from 'salix/components/section';
|
|
import './style.scss';
|
|
|
|
class Controller extends Section {
|
|
constructor($element, $) {
|
|
super($element, $);
|
|
|
|
let defaultDate = new Date();
|
|
defaultDate.setDate(defaultDate.getDate() - 75);
|
|
defaultDate.setHours(0, 0, 0, 0);
|
|
|
|
this.filter = {
|
|
where: {
|
|
itemFk: this.$params.id,
|
|
date: defaultDate
|
|
}
|
|
};
|
|
this._date = defaultDate;
|
|
}
|
|
|
|
set date(value) {
|
|
this._date = value;
|
|
|
|
if (!value) return;
|
|
|
|
this.filter.where.date = value;
|
|
this.$.model.refresh();
|
|
}
|
|
|
|
get date() {
|
|
return this._date;
|
|
}
|
|
}
|
|
|
|
Controller.$inject = ['$element', '$scope'];
|
|
|
|
ngModule.vnComponent('vnItemLastEntries', {
|
|
template: require('./index.html'),
|
|
controller: Controller,
|
|
bindings: {
|
|
item: '<'
|
|
}
|
|
});
|