2018-06-20 09:39:29 +00:00
|
|
|
import ngModule from '../module';
|
2020-03-17 13:43:46 +00:00
|
|
|
import Section from 'salix/components/section';
|
2018-06-20 09:39:29 +00:00
|
|
|
import './style.scss';
|
|
|
|
|
2020-03-17 13:43:46 +00:00
|
|
|
class Controller extends Section {
|
|
|
|
constructor($element, $) {
|
|
|
|
super($element, $);
|
2018-06-20 09:39:29 +00:00
|
|
|
|
2018-07-16 07:28:32 +00:00
|
|
|
let defaultDate = new Date();
|
|
|
|
defaultDate.setDate(defaultDate.getDate() - 75);
|
|
|
|
defaultDate.setHours(0, 0, 0, 0);
|
2018-06-20 09:39:29 +00:00
|
|
|
|
2018-07-16 07:28:32 +00:00
|
|
|
this.filter = {
|
|
|
|
where: {
|
2020-03-17 13:43:46 +00:00
|
|
|
itemFk: this.$params.id,
|
2018-07-16 07:28:32 +00:00
|
|
|
date: defaultDate
|
|
|
|
}
|
|
|
|
};
|
|
|
|
this._date = defaultDate;
|
2018-06-20 09:39:29 +00:00
|
|
|
}
|
|
|
|
|
2018-07-16 07:28:32 +00:00
|
|
|
set date(value) {
|
|
|
|
this._date = value;
|
2018-06-20 10:30:59 +00:00
|
|
|
|
2018-07-16 07:28:32 +00:00
|
|
|
if (!value) return;
|
2018-06-20 10:30:59 +00:00
|
|
|
|
2018-07-16 07:28:32 +00:00
|
|
|
this.filter.where.date = value;
|
2020-03-17 13:43:46 +00:00
|
|
|
this.$.model.refresh();
|
2018-06-20 09:39:29 +00:00
|
|
|
}
|
|
|
|
|
2018-07-16 07:28:32 +00:00
|
|
|
get date() {
|
|
|
|
return this._date;
|
2018-06-20 09:39:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-03-17 13:43:46 +00:00
|
|
|
Controller.$inject = ['$element', '$scope'];
|
2018-06-20 09:39:29 +00:00
|
|
|
|
|
|
|
ngModule.component('vnItemLastEntries', {
|
|
|
|
template: require('./index.html'),
|
|
|
|
controller: Controller,
|
|
|
|
bindings: {
|
|
|
|
item: '<'
|
|
|
|
}
|
|
|
|
});
|