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