Inital commit

This commit is contained in:
2020-11-19 15:36:28 +01:00
parent 71f32f83d3
commit 66ce4ee218
18077 changed files with 2166122 additions and 35184 deletions

View File

@@ -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>

View File

@@ -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}}.homepage #date-picker{text-align:center;}

View File

@@ -0,0 +1,45 @@
@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;
}
}
}
.homepage {
#date-picker {
text-align: center;
}
}

View File

@@ -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}

View File

@@ -0,0 +1,48 @@
{loop type="currency" name="default-currency" default_only="1"}
{$defaultCurrency = $SYMBOL}
{/loop}
{if empty($startDate)}{$startDate = 'this_month'}{/if}
{if empty($startDate)}{$startDate = 'this_month'}{/if}
{if empty($prevMonthStartDate)}{$prevMonthStartDate = 'last_month'}{/if}
{if empty($prevMonthEndDate)}{$prevMonthEndDate = 'last_month'}{/if}
<div class="table-responsive">
<table class="table table-striped">
<tbody>
<tr>
<th>{intl l="Overall sales" d='hookadminhome.bo.default'}</th>
<td>{format_money number={stats key="sales" startDate=$startDate endDate=$endDate} symbol=$defaultCurrency}</td>
</tr>
<tr>
<th>{intl l="Sales excluding shipping" d='hookadminhome.bo.default'}</th>
<td>
{$salesNoShipping = {stats key="sales" startDate=$startDate endDate=$endDate includeShipping="false"}}
{format_money number=$salesNoShipping symbol=$defaultCurrency}
</td>
</tr>
<tr>
<th>{intl l="Previous month sales" d='hookadminhome.bo.default'}</th>
<td>{format_money number={stats key="sales" startDate=$prevMonthStartDate endDate=$prevMonthEndDate} symbol=$defaultCurrency}</td>
</tr>
<tr>
<th>{intl l="Orders" d='hookadminhome.bo.default'}</th>
<td>
{$orderCount = {stats key="orders" startDate=$startDate endDate=$endDate}}
{$orderCount}
</td>
</tr>
<tr>
<th>{intl l="Average cart" d='hookadminhome.bo.default'}</th>
<td>
{if $orderCount == 0}
{format_money number=0 symbol=$defaultCurrency}
{else}
{format_money number={($salesNoShipping/$orderCount)|round:"2"} symbol=$defaultCurrency}
{/if}
</td>
</tr>
</tbody>
</table>
</div>

View File

@@ -0,0 +1,7 @@
{loop type="auth" name="can_view" role="ADMIN" module="HookAdminHome" access="VIEW"}
<script>
(function ($) {
$(".feed-list").load("{admin_viewurl view='ajax/thelia_news_feed'}");
}(jQuery));
</script>
{/loop}

View File

@@ -0,0 +1,5 @@
{loop type="auth" name="can_view" role="ADMIN" module="HookAdminHome" access="VIEW"}
<div class="feed-list">
<div class="alert alert-info">{intl l="Loading Thelia lastest news..." d='hookadminhome.bo.default'}</div>
</div>
{/loop}

View File

@@ -0,0 +1,100 @@
{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" id="statjour_label"
data-toggle="tab">{intl l="Today" d='hookadminhome.bo.default'}</a></li>
<li><a href="#statmois" id="statmois_label"
data-toggle="tab">{intl l="This month" d='hookadminhome.bo.default'}</a></li>
<li><a href="#statannee" id="statannee_label"
data-toggle="tab">{intl l="This year" d='hookadminhome.bo.default'}</a></li>
</ul>
{loop type="currency" name="default-currency" default_only="1"}
{$defaultCurrency = $SYMBOL}
{/loop}
<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>{format_money number={stats key="sales" startDate="today" endDate="today"} symbol=$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"}}
{format_money number=$salesNoShipping symbol=$defaultCurrency}
</td>
</tr>
<tr>
<th>{intl l="Yesterday sales" d='hookadminhome.bo.default'}</th>
<td>{format_money number={stats key="sales" startDate="yesterday" endDate="yesterday"} symbol=$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}
{format_money number=0 symbol=$defaultCurrency}
{else}
{format_money number={($salesNoShipping/$orderCount)|round:"2"} symbol=$defaultCurrency}
{/if}
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="tab-pane fade" id="statmois">
{include file="block-month-sales-statistics.html"}
</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>{format_money number={stats key="sales" startDate="this_year" endDate="this_year"} symbol=$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"}}
{format_money number=$salesNoShipping symbol=$defaultCurrency}
</td>
</tr>
<tr>
<th>{intl l="Previous year sales" d='hookadminhome.bo.default'}</th>
<td>{format_money number={stats key="sales" startDate="last_year" endDate="last_year"} symbol=$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}
{format_money number=0 symbol=$defaultCurrency}
{else}
{format_money number={($salesNoShipping/$orderCount)|round:"2"} symbol=$defaultCurrency}
{/if}
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
{/loop}

View File

@@ -0,0 +1,207 @@
<script src="{javascript file='assets/js/jqplot/jquery.jqplot.min.js'}"></script>
<script src="{javascript file='assets/js/jqplot/plugins/jqplot.highlighter.min.js'}"></script>
<script src="{javascript file='assets/js/jqplot/plugins/jqplot.pointLabels.min.js'}"></script>
<script src="{javascript file='assets/js/moment-with-locales.min.js'}"></script>
<script src="{javascript file='assets/js/bootstrap-datetimepicker/bootstrap-datetimepicker.min.js'}"></script>
<script>
jQuery(function ($) {
{$langcode = {lang attr="code"}|substr:0:2}
var jQplotDate = moment();
var $datePicker = $('#date-picker');
var displayDateFormat = '{intl l='YYYY-MM' d='hookadminhome.bo.default'}';
$datePicker.val(moment().format(displayDateFormat));
$datePicker.datetimepicker({
locale: "{$langcode}",
viewMode: 'months',
format: displayDateFormat
}).on('dp.change', function (e) {
// Load month statistics block
$('#statmois_label').html(e.date.format(displayDateFormat)).click();
$('#statmois').load('{url path="/admin/home/month-sales-block/"}' + (e.date.month() + 1) + '/' + e.date.year());
// 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
var valueFormats; // sprintf format of tooltip text
var jQPlotsOptions = {
animate: false,
axesDefaults: {
tickOptions: {
showMark: true,
showGridline: true
}
},
axes: {
xaxis: {
borderColor: '#ccc',
ticks: [],
tickOptions: {
showGridline: false
}
},
yaxis: {
min: 0,
tickOptions: {
showGridline: true,
showMark: false,
showLabel: true,
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 $.jqplot.sprintf(
valueFormats[seriesIndex],
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
);
});
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 = [];
// Used globally !
valueFormats = [];
$('[data-toggle="jqplot"].active').each(function (i) {
var position = $(this).index();
var serie = json.series[position];
series.push(serie.data);
seriesColors.push(serie.color);
valueFormats.push(serie.valueFormat);
});
// 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">{intl l='An error occurred while reading from JSON file' js=1 d='hookadminhome.bo.default'}</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
});
});
}
});
</script>

View File

@@ -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}

View File

@@ -0,0 +1,20 @@
{loop type="auth" name="can_view" role="ADMIN" module="HookAdminHome" access="VIEW"}
<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>
{/loop}