first commit
This commit is contained in:
34
modules/dashtrends/views/index.php
Normal file
34
modules/dashtrends/views/index.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright since 2007 PrestaShop SA and Contributors
|
||||
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
|
||||
* that is bundled with this package in the file LICENSE.md.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* https://opensource.org/licenses/AFL-3.0
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to https://devdocs.prestashop.com/ for more information.
|
||||
*
|
||||
* @author PrestaShop SA and Contributors <contact@prestashop.com>
|
||||
* @copyright Since 2007 PrestaShop SA and Contributors
|
||||
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
|
||||
*/
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
||||
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
|
||||
header('Location: ../');
|
||||
exit;
|
||||
107
modules/dashtrends/views/js/dashtrends.js
Normal file
107
modules/dashtrends/views/js/dashtrends.js
Normal file
@@ -0,0 +1,107 @@
|
||||
/**
|
||||
* Copyright since 2007 PrestaShop SA and Contributors
|
||||
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
|
||||
* that is bundled with this package in the file LICENSE.md.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* https://opensource.org/licenses/AFL-3.0
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to https://devdocs.prestashop.com/ for more information.
|
||||
*
|
||||
* @author PrestaShop SA and Contributors <contact@prestashop.com>
|
||||
* @copyright Since 2007 PrestaShop SA and Contributors
|
||||
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
|
||||
*/
|
||||
var dashtrends_data;
|
||||
var dashtrends_chart;
|
||||
|
||||
function line_chart_trends(widget_name, chart_details)
|
||||
{
|
||||
if (chart_details.data[0].values.length <= 1)
|
||||
$('#dash_trends_chart1').hide();
|
||||
else
|
||||
$('#dash_trends_chart1').show();
|
||||
nv.addGraph(function() {
|
||||
var chart = nv.models.lineChart()
|
||||
.useInteractiveGuideline(true)
|
||||
.x(function(d) { return (d !== undefined ? d[0] : 0); })
|
||||
.y(function(d) { return (d !== undefined ? parseInt(d[1]) : 0); })
|
||||
.margin({left: 80});
|
||||
|
||||
chart.xAxis.tickFormat(function(d) {
|
||||
date = new Date(d*1000);
|
||||
return date.format(chart_details['date_format']);
|
||||
});
|
||||
|
||||
first_data = new Array();
|
||||
$.each(chart_details.data, function(index, value) {
|
||||
if (value.id == 'sales' || value.id == 'sales_compare')
|
||||
{
|
||||
if (value.id == 'sales')
|
||||
$('#dashtrends_toolbar dl:first').css('background-color', chart_details.data[index].color).addClass('active');
|
||||
first_data.push(chart_details.data[index]);
|
||||
}
|
||||
});
|
||||
|
||||
chart.yAxis.tickFormat(function(d) {
|
||||
return formatCurrency(parseFloat(d), currency_format, currency_sign, currency_blank);
|
||||
});
|
||||
|
||||
dashtrends_data = chart_details.data;
|
||||
dashtrends_chart = chart;
|
||||
|
||||
d3.select('#dash_trends_chart1 svg')
|
||||
.datum(first_data)
|
||||
.call(chart);
|
||||
nv.utils.windowResize(chart.update);
|
||||
|
||||
return chart;
|
||||
});
|
||||
}
|
||||
|
||||
function selectDashtrendsChart(element, type)
|
||||
{
|
||||
$('#dashtrends_toolbar dl').removeClass('active');
|
||||
current_charts = new Array();
|
||||
$.each(dashtrends_data, function(index, value) {
|
||||
if (value.id == type || value.id == type + '_compare') {
|
||||
if (value.id == type) {
|
||||
$(element).siblings().css('background-color', 'inherit').removeClass('active');
|
||||
$(element).css('background-color', dashtrends_data[index].color).addClass('active');
|
||||
}
|
||||
|
||||
current_charts.push(dashtrends_data[index]);
|
||||
value.disabled = false;
|
||||
}
|
||||
});
|
||||
|
||||
dashtrends_chart.yAxis.tickFormat(d3.format('.f'));
|
||||
|
||||
if (type == 'sales' || type == 'average_cart_value' || type == 'net_profits')
|
||||
dashtrends_chart.yAxis.tickFormat(function(d) {
|
||||
return formatCurrency(parseFloat(d), currency_format, currency_sign, currency_blank);
|
||||
});
|
||||
|
||||
if (type == 'conversion_rate')
|
||||
dashtrends_chart.yAxis.tickFormat(function(d) {
|
||||
return d3.round(d*100, 2)+' %';
|
||||
});
|
||||
|
||||
d3.select('#dash_trends_chart1 svg')
|
||||
.datum(current_charts)
|
||||
.call(dashtrends_chart);
|
||||
}
|
||||
|
||||
$(document).ready(function(){
|
||||
$('dl').tooltip();
|
||||
});
|
||||
34
modules/dashtrends/views/js/index.php
Normal file
34
modules/dashtrends/views/js/index.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright since 2007 PrestaShop SA and Contributors
|
||||
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
|
||||
* that is bundled with this package in the file LICENSE.md.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* https://opensource.org/licenses/AFL-3.0
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to https://devdocs.prestashop.com/ for more information.
|
||||
*
|
||||
* @author PrestaShop SA and Contributors <contact@prestashop.com>
|
||||
* @copyright Since 2007 PrestaShop SA and Contributors
|
||||
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
|
||||
*/
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
||||
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
|
||||
header('Location: ../');
|
||||
exit;
|
||||
@@ -0,0 +1,79 @@
|
||||
{**
|
||||
* Copyright since 2007 PrestaShop SA and Contributors
|
||||
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
|
||||
* that is bundled with this package in the file LICENSE.md.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* https://opensource.org/licenses/AFL-3.0
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to https://devdocs.prestashop.com/ for more information.
|
||||
*
|
||||
* @author PrestaShop SA and Contributors <contact@prestashop.com>
|
||||
* @copyright Since 2007 PrestaShop SA and Contributors
|
||||
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
|
||||
*}
|
||||
<script>
|
||||
var currency_format = {$currency->format|floatval};
|
||||
var currency_sign = '{$currency->sign|@addcslashes:'\''}';
|
||||
var currency_blank = {$currency->blank|intval};
|
||||
var priceDisplayPrecision = {$_PS_PRICE_DISPLAY_PRECISION_|intval};
|
||||
</script>
|
||||
<div class="clearfix"></div>
|
||||
<section id="dashtrends" class="panel widget{if $allow_push} allow_push{/if}">
|
||||
<header class="panel-heading">
|
||||
<i class="icon-bar-chart"></i> {l s='Dashboard' d='Modules.Dashtrends.Admin'}
|
||||
<span class="panel-heading-action">
|
||||
<a class="list-toolbar-btn" href="{$link->getAdminLink('AdminDashboard')|escape:'html':'UTF-8'}&profitability_conf=1" title="{l s='Configure' d='Admin.Actions'}">
|
||||
<i class="process-icon-configure"></i>
|
||||
</a>
|
||||
<a class="list-toolbar-btn" href="#" onclick="refreshDashboard('dashtrends'); return false;" title="{l s='Refresh' d='Admin.Actions'}">
|
||||
<i class="process-icon-refresh"></i>
|
||||
</a>
|
||||
</span>
|
||||
</header>
|
||||
<div id="dashtrends_toolbar" class="row">
|
||||
<dl class="col-xs-4 col-lg-2 label-tooltip" onclick="selectDashtrendsChart(this, 'sales');" data-toggle="tooltip" data-original-title="{l s='Sum of revenue (excl. tax) generated within the date range by orders considered validated.' d='Modules.Dashtrends.Admin'}" data-placement="bottom">
|
||||
<dt>{l s='Sales' d='Admin.Global'}</dt>
|
||||
<dd class="data_value size_l"><span id="sales_score"></span></dd>
|
||||
<dd class="dash_trend"><span id="sales_score_trends"></span></dd>
|
||||
</dl>
|
||||
<dl class="col-xs-4 col-lg-2 label-tooltip" onclick="selectDashtrendsChart(this, 'orders');" data-toggle="tooltip" data-original-title="{l s='Total number of orders received within the date range that are considered validated.' d='Modules.Dashtrends.Admin'}" data-placement="bottom">
|
||||
<dt>{l s='Orders' d='Admin.Global'}</dt>
|
||||
<dd class="data_value size_l"><span id="orders_score"></span></dd>
|
||||
<dd class="dash_trend"><span id="orders_score_trends"></span></dd>
|
||||
</dl>
|
||||
<dl class="col-xs-4 col-lg-2 label-tooltip" onclick="selectDashtrendsChart(this, 'average_cart_value');" data-toggle="tooltip" data-original-title="{l s='Average Cart Value is a metric representing the value of an average order within the date range. It is calculated by dividing Sales by Orders.' d='Modules.Dashtrends.Admin'}" data-placement="bottom">
|
||||
<dt>{l s='Cart Value' d='Modules.Dashtrends.Admin'}</dt>
|
||||
<dd class="data_value size_l"><span id="cart_value_score"></span></dd>
|
||||
<dd class="dash_trend"><span id="cart_value_score_trends"></span></dd>
|
||||
</dl>
|
||||
<dl class="col-xs-4 col-lg-2 label-tooltip" onclick="selectDashtrendsChart(this, 'visits');" data-toggle="tooltip" data-original-title="{l s='Total number of visits within the date range. A visit is the period of time a user is actively engaged with your website.' d='Modules.Dashtrends.Admin'}" data-placement="bottom">
|
||||
<dt>{l s='Visits' d='Admin.Global'}</dt>
|
||||
<dd class="data_value size_l"><span id="visits_score"></span></dd>
|
||||
<dd class="dash_trend"><span id="visits_score_trends"></span></dd>
|
||||
</dl>
|
||||
<dl class="col-xs-4 col-lg-2 label-tooltip" onclick="selectDashtrendsChart(this, 'conversion_rate');" data-toggle="tooltip" data-original-title="{l s='Ecommerce Conversion Rate is the percentage of visits that resulted in an validated order.' d='Modules.Dashtrends.Admin'}" data-placement="bottom">
|
||||
<dt>{l s='Conversion Rate' d='Admin.Global'}</dt>
|
||||
<dd class="data_value size_l"><span id="conversion_rate_score"></span></dd>
|
||||
<dd class="dash_trend"><span id="conversion_rate_score_trends"></span></dd>
|
||||
</dl>
|
||||
<dl class="col-xs-4 col-lg-2 label-tooltip" onclick="selectDashtrendsChart(this, 'net_profits');" data-toggle="tooltip" data-original-title="{l s='Net profit is a measure of the profitability of a venture after accounting for all Ecommerce costs. You can provide these costs by clicking on the configuration icon right above here.' d='Modules.Dashtrends.Admin'}" data-placement="bottom">
|
||||
<dt>{l s='Net Profit' d='Modules.Dashtrends.Admin'}</dt>
|
||||
<dd class="data_value size_l"><span id="net_profits_score"></span></dd>
|
||||
<dd class="dash_trend"><span id="net_profits_score_trends"></span></dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div id="dash_trends_chart1" class="chart with-transitions">
|
||||
<svg></svg>
|
||||
</div>
|
||||
</section>
|
||||
34
modules/dashtrends/views/templates/hook/index.php
Normal file
34
modules/dashtrends/views/templates/hook/index.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright since 2007 PrestaShop SA and Contributors
|
||||
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
|
||||
* that is bundled with this package in the file LICENSE.md.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* https://opensource.org/licenses/AFL-3.0
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to https://devdocs.prestashop.com/ for more information.
|
||||
*
|
||||
* @author PrestaShop SA and Contributors <contact@prestashop.com>
|
||||
* @copyright Since 2007 PrestaShop SA and Contributors
|
||||
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
|
||||
*/
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
||||
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
|
||||
header('Location: ../');
|
||||
exit;
|
||||
34
modules/dashtrends/views/templates/index.php
Normal file
34
modules/dashtrends/views/templates/index.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright since 2007 PrestaShop SA and Contributors
|
||||
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
|
||||
* that is bundled with this package in the file LICENSE.md.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* https://opensource.org/licenses/AFL-3.0
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to https://devdocs.prestashop.com/ for more information.
|
||||
*
|
||||
* @author PrestaShop SA and Contributors <contact@prestashop.com>
|
||||
* @copyright Since 2007 PrestaShop SA and Contributors
|
||||
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
|
||||
*/
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
||||
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
|
||||
header('Location: ../');
|
||||
exit;
|
||||
Reference in New Issue
Block a user