// And now it works!

This commit is contained in:
Damien Metzger
2013-11-05 15:02:36 +01:00
parent a5552f3f85
commit 9a86f2c32b
4 changed files with 16 additions and 24 deletions
+11 -17
View File
@@ -35,36 +35,30 @@ function dashgoals_changeYear(xward)
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)
{
if (xward == 'forward')
$('#dashgoals_conftitle').text(parseInt($('#dashgoals_conftitle').text()) + 1);
else if (xward == 'backward')
$('#dashgoals_conftitle').text(parseInt($('#dashgoals_conftitle').text()) - 1);
$.ajax({
url: dashgoals_ajax_link,
data: {
ajax: true,
action: 'changeconfyear',
year: parseInt($('#dashgoals_conftitle').text())
year: new_year
},
success : function(result){
$('#dashgoals_config').fadeOut();
$('#dashgoals_title').text($('#dashgoals_title').text().replace(dashgoals_year, new_year));
var hide_conf = $('#dashgoals_config').hasClass('hide');
$('#dashgoals_config').replaceWith(result);
$('#dashgoals_config').removeClass('hide').fadeIn();
dashgoals_calc_sales();
if (!hide_conf)
$('#dashgoals_config').removeClass('hide');
$('.dashgoals_config_input').off();
$('.dashgoals_config_input').keyup(function() { dashgoals_calc_sales(); });
dashgoals_year = new_year;
refreshDashboard('dashgoals', false, dashgoals_year);
}
});
}
$(document).ready(function() {
$('.dashgoals_config_input').keyup(function() {
dashgoals_calc_sales();
});
$('.dashgoals_config_input').keyup(function() { dashgoals_calc_sales(); });
dashgoals_calc_sales();
});
@@ -29,11 +29,7 @@
<table class="table table-condensed table-striped table-bordered">
<thead>
<tr>
<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>{$goals_year}</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>