FEATURE: uses category-chooser for report filtering (#6174)

This commit is contained in:
Joffrey JAFFEUX
2018-07-25 13:16:35 -04:00
committed by GitHub
parent fa6b7f6b8c
commit 01d1f850e9
5 changed files with 65 additions and 51 deletions
@@ -2,8 +2,6 @@ import computed from "ember-addons/ember-computed-decorators";
export default Ember.Controller.extend({
queryParams: ["start_date", "end_date", "category_id", "group_id"],
categoryId: null,
groupId: null,
@computed("model.type")
reportOptions(type) {
@@ -16,21 +14,24 @@ export default Ember.Controller.extend({
return options;
},
@computed("category_id", "group_id", "start_date", "end_date")
filteringState(categoryId, groupId, startDate, endDate) {
return {
categoryId,
groupId,
startDate,
endDate
};
},
actions: {
onSelectStartDate(startDate) {
this.set("start_date", startDate);
},
onSelectCategory(categoryId) {
this.set("category_id", categoryId);
},
onSelectGroup(groupId) {
this.set("group_id", groupId);
},
onSelectEndDate(endDate) {
this.set("end_date", endDate);
onParamsChange(params) {
this.setProperties({
start_date: params.startDate,
category_id: params.categoryId,
group_id: params.groupId,
end_date: params.endDate
});
}
}
});