From 689de106c7842ca9a07bea28a1f643008682971e Mon Sep 17 00:00:00 2001 From: Etienne Roudeix Date: Wed, 30 Oct 2013 17:00:38 +0100 Subject: [PATCH] admin home stats --- .../Controller/Admin/HomeController.php | 2 +- templates/admin/default/home.html | 228 +++++++++--------- 2 files changed, 115 insertions(+), 115 deletions(-) diff --git a/core/lib/Thelia/Controller/Admin/HomeController.php b/core/lib/Thelia/Controller/Admin/HomeController.php index 90b0c6655..c30e61985 100644 --- a/core/lib/Thelia/Controller/Admin/HomeController.php +++ b/core/lib/Thelia/Controller/Admin/HomeController.php @@ -43,7 +43,7 @@ class HomeController extends BaseAdminController { $data = new \stdClass(); - $data->title = "Stats on [...]"; + $data->title = "Stats on " . $this->getRequest()->request->get('month', date('m')) . "/" . $this->getRequest()->request->get('month', date('Y')); /* sales */ $saleSeries = new \stdClass(); diff --git a/templates/admin/default/home.html b/templates/admin/default/home.html index 378c75354..fd6d85a4a 100755 --- a/templates/admin/default/home.html +++ b/templates/admin/default/home.html @@ -266,133 +266,133 @@ {/javascripts} - + // Init series data and colors + initJqplotData(series, seriesColors, options, data); + + // Add days to xaxis + for(var i = 1; i < (days+1); i++){ + ticks.push([i-1, i]); + } + + // Start jqplot + var elementId = $elem.attr('id'); + jqplot = $.jqplot(elementId, series, options); + + $('[data-toggle="jqplot"]').each(function(){ + + $(this).click(function(){ + + if($('[data-toggle="jqplot-serie"].active').length > 1 || !$(this).hasClass('active')){ + + // Active button and jqplot-serie management + $(this).toggleClass('active'); + + var id = $(this).data('target'); + $('[data-toggle="jqplot-serie"]#' + id).toggleClass('active'); + + // Reinit variables + series = []; + seriesColors = []; + + // Init series data and colors + initJqplotData(series, seriesColors, options, data); + + // Restart jqplot + jqplot.destroy(); + jqplot = $.jqplot(elementId, series, options); + } + + }); + + }); + + $(window).bind('resize', function(event, ui) { + jqplot.replot( { resetAxes: true } ); + }); + + } + + }); + + {/javascripts} {/block} \ No newline at end of file