salix/modules/item/front/last-entries/index.js

45 lines
934 B
JavaScript
Raw Normal View History

2018-06-20 09:39:29 +00:00
import ngModule from '../module';
import './style.scss';
class Controller {
2018-07-16 07:28:32 +00:00
constructor($scope, $stateParams) {
this.$scope = $scope;
this.$stateParams = $stateParams;
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: {
itemFk: $stateParams.id,
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;
this.$scope.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
}
}
2018-07-16 07:28:32 +00:00
Controller.$inject = ['$scope', '$stateParams'];
2018-06-20 09:39:29 +00:00
ngModule.component('vnItemLastEntries', {
template: require('./index.html'),
controller: Controller,
bindings: {
item: '<'
}
});