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);
|
|
|
|
|
2020-10-05 06:50:07 +00:00
|
|
|
this.getUpcomingCampaing();
|
|
|
|
}
|
|
|
|
|
|
|
|
getUpcomingCampaing() {
|
2020-10-05 05:53:03 +00:00
|
|
|
this.$http.get('Campaigns/upcoming').then(res => {
|
|
|
|
const filter = this.$.filter;
|
|
|
|
filter.campaign = res.data.id;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-07-24 12:22:30 +00:00
|
|
|
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
|
|
|
});
|