Initial Commit
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
{* this template is loaded via Ajax in the login page, to prevent login page slowdown *}
|
||||
|
||||
{* Set the default translation domain, that will be used by intl when the 'd' parameter is not set *}
|
||||
{default_translation_domain domain='hookadminhome.bo.default'}
|
||||
|
||||
<div class="panel-group" id="accordion">
|
||||
{loop type="feed" name="thelia_feeds" url="http://thelia.net/feeds/?lang={$lang_code}" limit="3"}
|
||||
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">
|
||||
<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion" href="#collapse-{$LOOP_COUNT}">
|
||||
{$TITLE|strip_tags nofilter} - {format_date timestamp=$DATE output='date'}
|
||||
</a>
|
||||
</h3>
|
||||
</div>
|
||||
<div id="collapse-{$LOOP_COUNT}" class="panel-collapse collapse {if $LOOP_COUNT == 1}in{/if}">
|
||||
<div class="panel-body">
|
||||
{* we use unescape:"htmlall" to unescape var before truncate, to prevent a cut in the middel of an HTML entity, eg &ea... *}
|
||||
<p>{$DESCRIPTION|strip_tags|unescape:"htmlall"|truncate:250:"...":true nofilter}</p>
|
||||
</div>
|
||||
<div class="panel-footer">
|
||||
<a href="{$URL nofilter}" target="_blank" class="btn btn-defaut btn-primary"><span class="glyphicon glyphicon-book"></span> {intl l='Read more'}</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/loop}
|
||||
</div>
|
||||
@@ -0,0 +1 @@
|
||||
#block-information a{color:#8A8A8A}.stats{border-right:1px solid #f0f0f0;text-align:center}.stats:last-child{border-right:none}.stats h2{margin-top:0;margin-bottom:5px;font-size:30px}.stats p{margin-top:0;text-transform:uppercase;font-size:12px}@media (max-width:991px){.stats{margin-bottom:10px}.stats:nth-child(3){border-right:none}}
|
||||
@@ -0,0 +1,39 @@
|
||||
@import "../../../../../../../../templates/backOffice/default/assets/less/bootstrap/variables.less";
|
||||
@import "../../../../../../../../templates/backOffice/default/assets/less/thelia/variables.less";
|
||||
|
||||
#block-information {
|
||||
a {
|
||||
color: #8A8A8A;
|
||||
}
|
||||
}
|
||||
|
||||
.stats {
|
||||
border-right: 1px solid @table-border-color;
|
||||
text-align: center;
|
||||
|
||||
&:last-child {
|
||||
border-right: none;
|
||||
}
|
||||
|
||||
h2 {
|
||||
margin-top: 0;
|
||||
margin-bottom: 5px;
|
||||
font-size: 30px;
|
||||
}
|
||||
|
||||
p {
|
||||
margin-top: 0;
|
||||
text-transform: uppercase;
|
||||
font-size: @font-size-base - 1; // 12px
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: @screen-sm-max) {
|
||||
.stats {
|
||||
margin-bottom: 10px;
|
||||
|
||||
&:nth-child(3) {
|
||||
border-right: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
{* Do not display shop information block if user none of the required authorizations *}
|
||||
|
||||
{capture name="shop_information_block_content"}
|
||||
{loop type="auth" name="can_view" role="ADMIN" resource="admin.customer" access="VIEW"}
|
||||
<div class="stats col-md-2 col-xs-4">
|
||||
<a href="{url path='/admin/customers'}">
|
||||
<h2>{count type="customer" current="false" backend_context="1"}</h2>
|
||||
<p>{intl l="Customers" d='hookadminhome.bo.default'}</p>
|
||||
</a>
|
||||
</div>
|
||||
{/loop}
|
||||
|
||||
{loop type="auth" name="can_view" role="ADMIN" resource="admin.category" access="VIEW"}
|
||||
<div class="stats col-md-2 col-xs-4">
|
||||
<a href="{url path='/admin/catalog'}">
|
||||
<h2>{count type="category" visible="*" backend_context="1"}</h2>
|
||||
<p>{intl l="Categories" d='hookadminhome.bo.default'}</p>
|
||||
</a>
|
||||
</div>
|
||||
{/loop}
|
||||
|
||||
{loop type="auth" name="can_view" role="ADMIN" resource="admin.product" access="VIEW"}
|
||||
<div class="stats col-md-2 col-xs-4">
|
||||
<a href="{url path='/admin/catalog'}">
|
||||
<h2>{count type="product" visible="*" backend_context="1"}</h2>
|
||||
<p>{intl l="Products" d='hookadminhome.bo.default'}</p>
|
||||
</a>
|
||||
</div>
|
||||
<div class="stats col-md-2 col-xs-4">
|
||||
<a href="{url path='/admin/catalog'}">
|
||||
<h2>{count type="product" visible="true" backend_context="1"}</h2>
|
||||
<p>{intl l="Online products" d='hookadminhome.bo.default'}</p>
|
||||
</a>
|
||||
</div>
|
||||
<div class="stats col-md-2 col-xs-4">
|
||||
<a href="{url path='/admin/catalog'}">
|
||||
<h2>{count type="product" visible="false" backend_context="1"}</h2>
|
||||
<p>{intl l="Offline products" d='hookadminhome.bo.default'}</p>
|
||||
</a>
|
||||
</div>
|
||||
{/loop}
|
||||
|
||||
{loop type="auth" name="can_view" role="ADMIN" resource="admin.order" access="VIEW"}
|
||||
<div class="stats col-md-2 col-xs-4">
|
||||
<a href="{url path='/admin/orders'}">
|
||||
<h2>{count type="order" status="*" customer="*" backend_context="1"}</h2>
|
||||
<p>{intl l="Orders" d='hookadminhome.bo.default'}</p>
|
||||
</a>
|
||||
</div>
|
||||
{/loop}
|
||||
{/capture}
|
||||
|
||||
{if trim($smarty.capture.shop_information_block_content) ne ""}
|
||||
<div class="general-block-decorator" id="block-information">
|
||||
<div class="row">
|
||||
{$smarty.capture.shop_information_block_content nofilter}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
@@ -0,0 +1,5 @@
|
||||
<script>
|
||||
(function($){
|
||||
$(".feed-list").load("{admin_viewurl view='ajax/thelia_news_feed'}");
|
||||
}(jQuery));
|
||||
</script>
|
||||
@@ -0,0 +1,3 @@
|
||||
<div class="feed-list">
|
||||
<div class="alert alert-info">{intl l="Loading Thelia lastest news..." d='hookadminhome.bo.default'}</div>
|
||||
</div>
|
||||
@@ -0,0 +1,136 @@
|
||||
{loop type="auth" name="can_view" role="ADMIN" resource="admin.order" access="VIEW"}
|
||||
<ul class="nav nav-tabs nav-justified">
|
||||
<li class="active"><a href="#statjour" data-toggle="tab">{intl l="Today" d='hookadminhome.bo.default'}</a></li>
|
||||
<li><a href="#statmois" data-toggle="tab">{intl l="This month" d='hookadminhome.bo.default'}</a></li>
|
||||
<li><a href="#statannee" data-toggle="tab">{intl l="This year" d='hookadminhome.bo.default'}</a></li>
|
||||
</ul>
|
||||
|
||||
{capture assign=defaultCurrency}
|
||||
{loop type="currency" name="default-currency" default_only="1"}
|
||||
{$SYMBOL}
|
||||
{/loop}
|
||||
{/capture}
|
||||
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane fade active in" id="statjour">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>{intl l="Overall sales" d='hookadminhome.bo.default'}</th>
|
||||
<td>{stats key="sales" startDate="today" endDate="today"} {$defaultCurrency}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{intl l="Sales excluding shipping" d='hookadminhome.bo.default'}</th>
|
||||
<td>
|
||||
{$salesNoShipping = {stats key="sales" startDate="today" endDate="today" includeShipping="false"}}
|
||||
{$salesNoShipping} {$defaultCurrency}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{intl l="Yesterday sales" d='hookadminhome.bo.default'}</th>
|
||||
<td>{stats key="sales" startDate="yesterday" endDate="yesterday"} {$defaultCurrency}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{intl l="Orders" d='hookadminhome.bo.default'}</th>
|
||||
<td>
|
||||
{$orderCount = {stats key="orders" startDate="today" endDate="today"}}
|
||||
{$orderCount}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{intl l="Average cart" d='hookadminhome.bo.default'}</th>
|
||||
<td>
|
||||
{if $orderCount == 0}
|
||||
0 {$defaultCurrency}
|
||||
{else}
|
||||
{($salesNoShipping/$orderCount)|round:"2"} {$defaultCurrency}
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-pane fade" id="statmois">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>{intl l="Overall sales" d='hookadminhome.bo.default'}</th>
|
||||
<td>{stats key="sales" startDate="this_month" endDate="this_month"} {$defaultCurrency}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{intl l="Sales excluding shipping" d='hookadminhome.bo.default'}</th>
|
||||
<td>
|
||||
{$salesNoShipping = {stats key="sales" startDate="this_month" endDate="this_month" includeShipping="false"}}
|
||||
{$salesNoShipping} {$defaultCurrency}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{intl l="Previous month sales" d='hookadminhome.bo.default'}</th>
|
||||
<td>{stats key="sales" startDate="last_month" endDate="last_month"} {$defaultCurrency}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{intl l="Orders" d='hookadminhome.bo.default'}</th>
|
||||
<td>
|
||||
{$orderCount = {stats key="orders" startDate="this_month" endDate="this_month"}}
|
||||
{$orderCount}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{intl l="Average cart" d='hookadminhome.bo.default'}</th>
|
||||
<td>
|
||||
{if $orderCount == 0}
|
||||
0 {$defaultCurrency}
|
||||
{else}
|
||||
{($salesNoShipping/$orderCount)|round:"2"} {$defaultCurrency}
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-pane fade" id="statannee">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>{intl l="Overall sales" d='hookadminhome.bo.default'}</th>
|
||||
<td>{stats key="sales" startDate="this_year" endDate="this_year"} {$defaultCurrency}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{intl l="Sales excluding shipping" d='hookadminhome.bo.default'}</th>
|
||||
<td>
|
||||
{$salesNoShipping = {stats key="sales" startDate="this_year" endDate="this_year" includeShipping="false"}}
|
||||
{$salesNoShipping} {$defaultCurrency}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{intl l="Previous year sales" d='hookadminhome.bo.default'}</th>
|
||||
<td>{stats key="sales" startDate="last_year" endDate="last_year"} {$defaultCurrency}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{intl l="Orders" d='hookadminhome.bo.default'}</th>
|
||||
<td>
|
||||
{$orderCount = {stats key="orders" startDate="this_year" endDate="this_year"}}
|
||||
{$orderCount}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{intl l="Average cart" d='hookadminhome.bo.default'}</th>
|
||||
<td>
|
||||
{if $orderCount == 0}
|
||||
0 {$defaultCurrency}
|
||||
{else}
|
||||
{($salesNoShipping/$orderCount)|round:"2"} {$defaultCurrency}
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/loop}
|
||||
@@ -0,0 +1,195 @@
|
||||
{javascripts file='assets/js/jqplot/jquery.jqplot.min.js'}
|
||||
<script src="{$asset_url}"></script>
|
||||
{/javascripts}
|
||||
{javascripts file='assets/js/jqplot/plugins/jqplot.highlighter.min.js'}
|
||||
<script type="text/javascript" src="{$asset_url}"></script>
|
||||
{/javascripts}
|
||||
{javascripts file='assets/js/jqplot/plugins/jqplot.barRenderer.min.js'}
|
||||
<script type="text/javascript" src="{$asset_url}"></script>
|
||||
{/javascripts}
|
||||
{javascripts file='assets/js/jqplot/plugins/jqplot.pieRenderer.min.js'}
|
||||
<script type="text/javascript" src="{$asset_url}"></script>
|
||||
{/javascripts}
|
||||
{javascripts file='assets/js/moment-with-locales.min.js'}
|
||||
<script src="{$asset_url}"></script>
|
||||
{/javascripts}
|
||||
{javascripts file='assets/js/bootstrap-datetimepicker/bootstrap-datetimepicker.min.js'}
|
||||
<script src="{$asset_url}"></script>
|
||||
{/javascripts}
|
||||
|
||||
<script>
|
||||
jQuery(function($) {
|
||||
{$langcode = {lang attr="code"}|substr:0:2}
|
||||
|
||||
var jQplotDate = moment();
|
||||
|
||||
$('#date-picker').val(moment().format('MM/YYYY'));
|
||||
|
||||
$('#date-picker').datetimepicker({
|
||||
locale: "{$langcode}",
|
||||
viewMode: 'months',
|
||||
format: 'MM/YYYY'
|
||||
}).on('dp.change', function (e) {
|
||||
// e.date is a moment.js date
|
||||
jQplotDate = e.date;
|
||||
|
||||
statInputActive(true);
|
||||
|
||||
retrieveJQPlotJson(
|
||||
jQplotDate,
|
||||
function () {
|
||||
statInputActive(false);
|
||||
},
|
||||
0
|
||||
);
|
||||
});
|
||||
|
||||
$("#span-calendar").click(function (e) {
|
||||
$('#date-picker').focus();
|
||||
});
|
||||
|
||||
function statInputActive(type) {
|
||||
$('#date-picker').attr('readonly', type);
|
||||
$('.js-stats-refresh').attr('disabled', type)
|
||||
}
|
||||
|
||||
var url = "{url path='/admin/home/stats'}";
|
||||
var jQplotData; // json data
|
||||
var jQPlotInstance; // global instance
|
||||
|
||||
{literal}
|
||||
|
||||
var jQPlotsOptions = {
|
||||
animate: true,
|
||||
axesDefaults: {
|
||||
tickOptions: {showMark: true, showGridline: true}
|
||||
},
|
||||
axes: {
|
||||
xaxis: {
|
||||
borderColor: '#ccc',
|
||||
ticks: [],
|
||||
tickOptions: {showGridline: false}
|
||||
},
|
||||
yaxis: {
|
||||
tickOptions: {showGridline: true, showMark: false, showLabel: false, shadow: false}
|
||||
}
|
||||
},
|
||||
seriesDefaults: {
|
||||
lineWidth: 3,
|
||||
shadow: false,
|
||||
markerOptions: {shadow: false, style: 'filledCircle', size: 12}
|
||||
},
|
||||
grid: {
|
||||
background: '#FFF',
|
||||
shadow: false,
|
||||
borderColor: '#FFF'
|
||||
},
|
||||
highlighter: {
|
||||
show: true,
|
||||
sizeAdjust: 7,
|
||||
tooltipLocation: 'n',
|
||||
tooltipContentEditor: function (str, seriesIndex, pointIndex, plot) {
|
||||
|
||||
// Return axis value : data value
|
||||
//return jQPlotsOptions.axes.xaxis.ticks[pointIndex][1] + ': ' + plot.data[seriesIndex][pointIndex][1];
|
||||
return plot.data[seriesIndex][pointIndex][1];
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Get initial data Json
|
||||
retrieveJQPlotJson(jQplotDate);
|
||||
|
||||
$('[data-toggle="jqplot"]').click(function () {
|
||||
|
||||
$(this).toggleClass('active');
|
||||
jsonSuccessLoad();
|
||||
|
||||
});
|
||||
|
||||
$('.js-stats-refresh').click(function (e) {
|
||||
statInputActive(true);
|
||||
|
||||
retrieveJQPlotJson(
|
||||
jQplotDate,
|
||||
function () {
|
||||
statInputActive(false);
|
||||
},
|
||||
1
|
||||
);
|
||||
});
|
||||
|
||||
/**
|
||||
* @param {moment} moment date
|
||||
* @param {function=} callback
|
||||
* @param {number=} flush
|
||||
*/
|
||||
function retrieveJQPlotJson(moment, callback, flush) {
|
||||
|
||||
if (typeof flush === "undefined") {
|
||||
flush = 0;
|
||||
}
|
||||
|
||||
// JS month range is [0..11], the url requires a PHP month range [1..12]
|
||||
$.getJSON(url, {month: moment.month() + 1, year: moment.year(), flush: flush})
|
||||
.done(function (data) {
|
||||
jQplotData = data;
|
||||
jsonSuccessLoad();
|
||||
if (callback) {
|
||||
callback();
|
||||
}
|
||||
})
|
||||
.fail(jsonFailLoad);
|
||||
}
|
||||
|
||||
function initJqplotData(json) {
|
||||
var series = [];
|
||||
var seriesColors = [];
|
||||
$('[data-toggle="jqplot"].active').each(function (i) {
|
||||
var position = $(this).index();
|
||||
series.push(json.series[position].data);
|
||||
seriesColors.push(json.series[position].color);
|
||||
});
|
||||
|
||||
// Number of days to display ( = data.length in one serie)
|
||||
var days = json.series[0].data.length;
|
||||
|
||||
// Add days to xaxis
|
||||
var ticks = [];
|
||||
for (var i = 1; i < (days + 1); i++) {
|
||||
ticks.push([i - 1, i]);
|
||||
}
|
||||
jQPlotsOptions.axes.xaxis.ticks = ticks;
|
||||
|
||||
// Graph title
|
||||
jQPlotsOptions.title = json.title;
|
||||
|
||||
// Graph series colors
|
||||
jQPlotsOptions.seriesColors = seriesColors;
|
||||
|
||||
return series;
|
||||
}
|
||||
|
||||
function jsonFailLoad(data) {
|
||||
$('#jqplot').html('<div class="alert alert-danger">An error occurred while reading from JSON file</div>');
|
||||
}
|
||||
|
||||
function jsonSuccessLoad() {
|
||||
|
||||
// Init jQPlot
|
||||
var series = initJqplotData(jQplotData);
|
||||
|
||||
// Start jQPlot
|
||||
if (jQPlotInstance) {
|
||||
jQPlotInstance.destroy();
|
||||
}
|
||||
jQPlotInstance = $.jqplot("jqplot", series, jQPlotsOptions);
|
||||
|
||||
$(window).bind('resize', function (event, ui) {
|
||||
jQPlotInstance.replot({resetAxes: true});
|
||||
});
|
||||
|
||||
}
|
||||
{/literal}
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,34 @@
|
||||
{loop type="auth" name="can_view" role="ADMIN" resource="admin.order" access="VIEW"}
|
||||
<div class="general-block-decorator dashboard">
|
||||
|
||||
<div class="title title-without-tabs clearfix">
|
||||
{intl l='Dashboard' d='hookadminhome.bo.default'}
|
||||
<div class="col-sm-2 input-group pull-right">
|
||||
<span id="span-calendar" class="input-group-addon">
|
||||
<span class="glyphicon glyphicon-calendar"></span>
|
||||
</span>
|
||||
<input type="text" class="form-control" id="date-picker">
|
||||
<span class="input-group-btn">
|
||||
<button type="button" class="form-control btn btn-default js-stats-refresh" data-month-offset="0"><span class="glyphicon glyphicon-refresh"></span></button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="text-center clearfix">
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-default active" data-toggle="jqplot" data-target="sales"><span class="glyphicon glyphicon-euro"></span> {intl l="Sales" d='hookadminhome.bo.default'}</button>
|
||||
<button type="button" class="btn btn-primary" data-toggle="jqplot" data-target="registration"><span class="glyphicon glyphicon-user"></span> {intl l="New customers" d='hookadminhome.bo.default'}</button>
|
||||
<button type="button" class="btn btn-success" data-toggle="jqplot" data-target="orders"><span class="glyphicon glyphicon-shopping-cart"></span> {intl l="Orders" d='hookadminhome.bo.default'}</button>
|
||||
<button type="button" class="btn btn-info" data-toggle="jqplot" data-target="first-orders"><span class="glyphicon glyphicon-thumbs-up"></span> {intl l="First orders" d='hookadminhome.bo.default'}</button>
|
||||
<button type="button" class="btn btn-danger" data-toggle="jqplot" data-target="aborted-orders"><span class="glyphicon glyphicon-thumbs-down"></span> {intl l="Aborted orders" d='hookadminhome.bo.default'}</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr/>
|
||||
|
||||
<div class="jqplot-content">
|
||||
<div id="jqplot"></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
{/loop}
|
||||
@@ -0,0 +1,18 @@
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>{intl l="Current version" d='hookadminhome.bo.default'}</th>
|
||||
<td>{$THELIA_VERSION}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{intl l="Latest version available"}</th>
|
||||
<td><a href="http://thelia.net/#download" id="latest-thelia-version">{intl l="Loading..." d='hookadminhome.bo.default'}</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{intl l="News"}</th>
|
||||
<td><a href="http://thelia.net/blog" target="_blank">{intl l="Click here" d='hookadminhome.bo.default'}</a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
Reference in New Issue
Block a user