// Code cleaning and dashgoals improvements (part 1 - not finished yet)

This commit is contained in:
Damien Metzger
2013-11-04 18:52:27 +01:00
parent 8aedd4eb04
commit 8dc29b20f0
7 changed files with 82 additions and 31 deletions
+22
View File
@@ -28,6 +28,28 @@ function dashgoals_calc_sales()
});
}
function dashgoals_changeYear(xward)
{
var new_year = dashgoals_year;
if (xward == 'forward')
new_year = dashgoals_year + 1;
else if (xward == 'backward')
new_year = dashgoals_year - 1;
$('#dashgoals_title').text($('#dashgoals_title').text().replace(dashgoals_year, new_year));
dashgoals_year = new_year;
refreshDashboard('dashgoals', false, dashgoals_year);
}
function dashgoals_changeConfYear(xward)
{
// Todo
// getModuleLink('dashgoals', 'ajax', array('year' => $('#dashgoals_conftitle').text()), $ssl = null, $id_lang = null, $id_shop = null)
if (xward == 'forward')
$('#dashgoals_conftitle').text(parseInt($('#dashgoals_conftitle').text()) + 1);
else if (xward == 'backward')
$('#dashgoals_conftitle').text(parseInt($('#dashgoals_conftitle').text()) - 1);
}
$(document).ready(function() {
$('.dashgoals_config_input').keyup(function() {
dashgoals_calc_sales();
@@ -28,16 +28,20 @@
var currency_sign = '{$currency->sign|addslashes}';
var currency_blank = {$currency->blank|intval};
var priceDisplayPrecision = 0;
var dashgoals_year = {$goals_year|intval};
</script>
<section id="dashgoals" class="panel widget">
<header class="panel-heading">
<i class="icon-bar-chart"></i> {l s='Goals' mod='dashgoals'}
<i class="icon-bar-chart"></i> <span id="dashgoals_title">{l s='Your %s Forecast' mod='dashgoals' sprintf=$goals_year}</span>
<a href="javascript:void(0);" onclick="dashgoals_changeYear('backward');" class="icon-backward"></a>
<a href="javascript:void(0);" onclick="dashgoals_changeYear('forward');" class="icon-forward"></a>
<span class="panel-heading-action">
<a class="list-toolbar-btn" href="javascript:toggleDashConfig('dashgoals');" title="configure">
<a class="list-toolbar-btn" href="javascript:void(0);" onclick="toggleDashConfig('dashgoals');" title="configure">
<i class="process-icon-configure"></i>
</a>
<a class="list-toolbar-btn" href="#" onclick="refreshDashboard('dashgoals');" title="refresh">
<a class="list-toolbar-btn" href="javascript:void(0);" onclick="refreshDashboard('dashgoals');" title="refresh">
<i class="process-icon-refresh"></i>
</a>
</span>
@@ -48,7 +52,11 @@
<table class="table table-condensed table-striped table-bordered">
<thead>
<tr>
<th>{$goals_year}</th>
<th>
<a href="javascript:void(0);" onclick="dashgoals_changeConfYear('backward');" class="icon-backward"></a>
<span id="dashgoals_conftitle">{$goals_year}</span>
<a href="javascript:void(0);" onclick="dashgoals_changeConfYear('forward');" class="icon-forward"></a>
</th>
<th>{l s='Traffic' mod='dashgoals'}</th>
<th>{l s='Conversion Rate' mod='dashgoals'}</th>
<th>{l s='Average Cart Value' mod='dashgoals'}</th>