From f165dae15d7ddbced31bcf36c0581fde84fc8968 Mon Sep 17 00:00:00 2001 From: Vincent Augagneur Date: Mon, 2 Sep 2013 17:22:51 +0200 Subject: [PATCH] //now you can refresh each dashboard module you want --- js/admin-dashboard.js | 16 ++++++++++------ modules/dashactivity/dashactivity.php | 1 - .../templates/hook/dashboard_zone_one.tpl | 2 +- .../templates/hook/dashboard_zone_two.tpl | 2 +- modules/dashtrends/dashtrends.php | 19 ++++++++++++++++++- 5 files changed, 30 insertions(+), 10 deletions(-) diff --git a/js/admin-dashboard.js b/js/admin-dashboard.js index ee24317c8..5229d0324 100644 --- a/js/admin-dashboard.js +++ b/js/admin-dashboard.js @@ -31,14 +31,18 @@ function refreshDashbard(module_name) { if (typeof(module_name) == 'undefined') module_name = 0; - datas = { - ajax:true, - action:'refreshDashboard', - module:module_name - }; + else + $('#'+module_name+' section').each( function (){ + $(this).addClass('loading'); + }); + $.ajax({ url : dashboard_ajax_url, - data : datas, + data : { + ajax:true, + action:'refreshDashboard', + module:module_name + }, dataType: 'json', success : function(widgets){ for (var name in widgets) diff --git a/modules/dashactivity/dashactivity.php b/modules/dashactivity/dashactivity.php index 0e95d13bd..13205e299 100644 --- a/modules/dashactivity/dashactivity.php +++ b/modules/dashactivity/dashactivity.php @@ -54,7 +54,6 @@ class Dashactivity extends Module public function hookDashboardDatas($params) { - sleep(2); return array( 'data_value' => array( 'order_nbr' => 365, diff --git a/modules/dashactivity/views/templates/hook/dashboard_zone_one.tpl b/modules/dashactivity/views/templates/hook/dashboard_zone_one.tpl index 693ddf0b7..f24e72649 100644 --- a/modules/dashactivity/views/templates/hook/dashboard_zone_one.tpl +++ b/modules/dashactivity/views/templates/hook/dashboard_zone_one.tpl @@ -30,7 +30,7 @@ - + diff --git a/modules/dashproducts/views/templates/hook/dashboard_zone_two.tpl b/modules/dashproducts/views/templates/hook/dashboard_zone_two.tpl index 2fd535a8e..2d7f7c070 100644 --- a/modules/dashproducts/views/templates/hook/dashboard_zone_two.tpl +++ b/modules/dashproducts/views/templates/hook/dashboard_zone_two.tpl @@ -30,7 +30,7 @@ - + diff --git a/modules/dashtrends/dashtrends.php b/modules/dashtrends/dashtrends.php index f4c59f8a2..124281d73 100644 --- a/modules/dashtrends/dashtrends.php +++ b/modules/dashtrends/dashtrends.php @@ -54,6 +54,23 @@ class Dashtrends extends Module public function hookDashboardDatas($params) { - return array(); + return array( + 'data_value' => array( + 'sales_score' => Tools::displayPrice(151.365), + 'orders_score' => 120, + 'cart_value_score' => Tools::displayPrice(35), + 'visits_score' => 12, + 'convertion_rate_score' => 4, + 'net_profits_score' => Tools::displayPrice(42), + ), + 'data_trends' => array( + 'sales_score_trends' => array('way' => 'up', 'value' => 0.66), + 'orders_score_trends' => array('way' => 'down', 'value' => 0.66), + 'cart_value_score_trends' => array('way' => 'up', 'value' => 0.66), + 'visits_score_trends' => array('way' => 'down', 'value' => 0.66), + 'convertion_rate_score_trends' => array('way' => 'up', 'value' => 0.66), + 'net_profits_score_trends' => array('way' => 'up', 'value' => 0.66) + ) + ); } } \ No newline at end of file