diff options
Diffstat (limited to 'addons/website/static/src/js/backend/dashboard.js')
| -rw-r--r-- | addons/website/static/src/js/backend/dashboard.js | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/addons/website/static/src/js/backend/dashboard.js b/addons/website/static/src/js/backend/dashboard.js index 9ece194ab1e..393709b91db 100644 --- a/addons/website/static/src/js/backend/dashboard.js +++ b/addons/website/static/src/js/backend/dashboard.js @@ -64,6 +64,7 @@ var Dashboard = AbstractAction.extend(ControlPanelMixin, { return this._rpc({ route: '/website/fetch_dashboard_data', params: { + website_id: this.website_id || false, date_from: this.date_from.year()+'-'+(this.date_from.month()+1)+'-'+this.date_from.date(), date_to: this.date_to.year()+'-'+(this.date_to.month()+1)+'-'+this.date_to.date(), }, @@ -72,6 +73,7 @@ var Dashboard = AbstractAction.extend(ControlPanelMixin, { self.dashboards_data = result.dashboards; self.currency_id = result.currency_id; self.groups = result.groups; + self.websites = result.websites; }); }, @@ -245,6 +247,16 @@ var Dashboard = AbstractAction.extend(ControlPanelMixin, { }, + on_website_button: function(website_id) { + var self = this; + this.website_id = website_id; + $.when(this.fetch_data()).then(function() { + self.$('.o_website_dashboard').empty(); + self.render_dashboards(); + self.render_graphs(); + }); + }, + on_reverse_breadcrumb: function() { var self = this; web_client.do_push_state({}); @@ -293,10 +305,15 @@ var Dashboard = AbstractAction.extend(ControlPanelMixin, { this.$searchview = $(QWeb.render("website.DateRangeButtons", { widget: this, })); - this.$searchview.click('button.js_date_range', function(ev) { + this.$searchview.find('button.js_date_range').click(function(ev) { + self.$searchview.find('button.js_date_range.active').removeClass('active'); + $(ev.target).addClass('active'); self.on_date_range_button($(ev.target).data('date')); - $(this).find('button.js_date_range.active').removeClass('active'); + }); + this.$searchview.find('button.js_website').click(function(ev) { + self.$searchview.find('button.js_website.active').removeClass('active'); $(ev.target).addClass('active'); + self.on_website_button($(ev.target).data('website-id')); }); } this.update_control_panel({ |
