//dashboard widget regardless refresh
This commit is contained in:
+47
-32
@@ -24,8 +24,10 @@
|
||||
|
||||
$(document).ready( function () {
|
||||
refreshDashbard();
|
||||
if (use_push)
|
||||
/*
|
||||
if (use_push)
|
||||
launchPush();
|
||||
*/
|
||||
});
|
||||
|
||||
function launchPush()
|
||||
@@ -52,44 +54,57 @@ function launchPush()
|
||||
|
||||
function refreshDashbard(module_name)
|
||||
{
|
||||
module_list = new Array();
|
||||
|
||||
if (typeof(module_name) == 'undefined')
|
||||
module_name = 0;
|
||||
else
|
||||
{
|
||||
$('.widget').each( function () {
|
||||
module_list.push($(this).attr('id'));
|
||||
$(this).addClass('loading');
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
module_list.push(module_name);
|
||||
$('#'+module_name+' section').each( function (){
|
||||
$(this).addClass('loading');
|
||||
});
|
||||
|
||||
$.ajax({
|
||||
url : dashboard_ajax_url,
|
||||
data : {
|
||||
ajax:true,
|
||||
action:'refreshDashboard',
|
||||
module:module_name
|
||||
},
|
||||
dataType: 'json',
|
||||
success : function(widgets){
|
||||
for (var name in widgets)
|
||||
{
|
||||
for (data_type in widgets[name])
|
||||
window[data_type](widgets[name][data_type]);
|
||||
}
|
||||
},
|
||||
error : function(data){
|
||||
//@TODO display errors
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function data_value(data)
|
||||
{
|
||||
for (var data_id in data)
|
||||
}
|
||||
|
||||
for (var module_id in module_list)
|
||||
{
|
||||
$('#'+data_id).html(data[data_id]);
|
||||
$('#'+data_id).closest('section').removeClass('loading');
|
||||
$.ajax({
|
||||
url : dashboard_ajax_url,
|
||||
data : {
|
||||
ajax:true,
|
||||
action:'refreshDashboard',
|
||||
module:module_list[module_id]
|
||||
},
|
||||
dataType: 'json',
|
||||
success : function(widgets){
|
||||
for (var widget_name in widgets)
|
||||
{
|
||||
for (data_type in widgets[widget_name])
|
||||
window[data_type](widget_name, widgets[widget_name][data_type]);
|
||||
}
|
||||
},
|
||||
error : function(data){
|
||||
//@TODO display errors
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function data_trends(data)
|
||||
function data_value(widget_name, data)
|
||||
{
|
||||
for (var data_id in data)
|
||||
{
|
||||
$('#'+data_id+' ').html(data[data_id]);
|
||||
$('#'+data_id+', #'+widget_name).closest('section').removeClass('loading');
|
||||
}
|
||||
}
|
||||
|
||||
function data_trends(widget_name, data)
|
||||
{
|
||||
for (var data_id in data)
|
||||
{
|
||||
@@ -102,7 +117,7 @@ function data_trends(data)
|
||||
}
|
||||
}
|
||||
|
||||
function data_table(data)
|
||||
function data_table(widget_name, data)
|
||||
{
|
||||
for (var data_id in data)
|
||||
{
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
|
||||
<section id="dashactivity" class="panel">
|
||||
<section id="dashactivity" class="panel widget">
|
||||
<div class="panel-heading">
|
||||
<i class="icon-time"></i> {l s='Recent Activity'}
|
||||
<span class="panel-heading-action">
|
||||
|
||||
@@ -318,7 +318,6 @@ class Dashproducts extends Module
|
||||
);
|
||||
|
||||
$terms = $this->getMostSearchTerms($date_from, $date_to);
|
||||
|
||||
$body = array();
|
||||
if (is_array($terms) && count($terms))
|
||||
foreach ($terms as $term)
|
||||
@@ -462,7 +461,6 @@ class Dashproducts extends Module
|
||||
GROUP BY ss.`keywords`
|
||||
ORDER BY `count_keywords` DESC
|
||||
LIMIT 0, '.(int)$limit;
|
||||
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||
}
|
||||
}
|
||||
@@ -23,11 +23,11 @@
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
|
||||
<section id="dashproducts" class="panel">
|
||||
<section id="dashproducts" class="panel widget">
|
||||
<header class="panel-heading">
|
||||
<i class="icon-bar-chart"></i> {l s='Product and Sales'}
|
||||
<span class="panel-heading-action">
|
||||
<a class="list-tooolbar-btn" href="javascript:void(0);" title="configure">
|
||||
<a class="list-tooolbar-btn" href="#" title="configure">
|
||||
<i class="process-icon-configure"></i>
|
||||
</a>
|
||||
<a class="list-tooolbar-btn" href="#" onclick="refreshDashbard('dashproducts'); return false;" title="refresh">
|
||||
@@ -111,5 +111,4 @@
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</section>
|
||||
@@ -23,7 +23,7 @@
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
|
||||
<section id="dashtrends" class="panel">
|
||||
<section id="dashtrends" class="panel widget">
|
||||
<header class="panel-heading">
|
||||
<i class="icon-bar-chart"></i> {l s='Score Trends'}
|
||||
<span class="panel-heading-action">
|
||||
|
||||
Reference in New Issue
Block a user