feat(dashbard): Set account from filters

This commit is contained in:
Aditya Hase 2019-01-10 12:22:32 +05:30
parent 4f247a0ed5
commit 94c4740729

View file

@ -15,7 +15,22 @@ frappe.pages['dashboard'].on_page_load = function(wrapper) {
this.filters = {
timespan: "Last Week",
timegrain: "Daily",
account: "Cash - GTPL",
}
this.account_select = this.page.add_field({
fieldname: "account",
label: __("Account"),
fieldtype: "Link",
options: "Account",
get_query: {
doctype: "Account",
filters: {
company: "Gadget Technologies Pvt. Ltd.",
}
}
}).$wrapper.find("input")
this.timespan_select = this.page.add_select(__("Time Span"),
this.timespans.map(d => {
return {"label": __(d), value: d }
@ -27,6 +42,10 @@ frappe.pages['dashboard'].on_page_load = function(wrapper) {
return {"label": __(d), value: d }
})
)
this.account_select.on("change", function() {
me.filters.account = this.value
me.create_chart()
});
this.timespan_select.on("change", function() {
me.filters.timespan = this.value