salix/modules/client/front/consumption-search-panel/index.js

37 lines
911 B
JavaScript
Raw Normal View History

2020-06-12 07:18:19 +00:00
import ngModule from '../module';
import SearchPanel from 'core/components/searchbar/search-panel';
2020-10-05 05:53:03 +00:00
class Controller extends SearchPanel {
constructor($, $element) {
super($, $element);
this.$http.get('Campaigns/upcoming').then(res => {
const filter = this.$.filter;
filter.campaign = res.data.id;
console.log(res.data);
});
}
get campaignSelection() {
return this._campaignSelection;
}
set campaignSelection(value) {
this._campaignSelection = value;
if (!value) return;
const filter = this.$.filter;
const from = new Date(value.dated);
from.setDate(from.getDate() - value.scopeDays);
filter.to = value.dated;
filter.from = from;
}
}
ngModule.vnComponent('vnConsumptionSearchPanel', {
2020-06-12 07:18:19 +00:00
template: require('./index.html'),
2020-10-05 05:53:03 +00:00
controller: Controller
2020-06-12 07:18:19 +00:00
});