//added form date range picker on dashboard
This commit is contained in:
1 parent
19fc22fbf0
commit
4d3b378965
5 files changed
+77
-50
No files matched your search
@@ -34,6 +34,11 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="dashboard">
|
<div id="dashboard">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-12">
|
||||||
|
{include file="../../../../form_date_range_picker.tpl"}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-lg-3">
|
<div class="col-lg-3">
|
||||||
{$hookDashboardZoneOne}
|
{$hookDashboardZoneOne}
|
||||||
|
|||||||
@@ -24,53 +24,4 @@
|
|||||||
*}
|
*}
|
||||||
|
|
||||||
<div id="statsContainer" class="col-lg-9">
|
<div id="statsContainer" class="col-lg-9">
|
||||||
<div id="calendar" class="panel">
|
{include file="../../form_date_range_picker.tpl"}
|
||||||
<form action="{$current}&token={$token}{if $action && $table}&{$action|escape}{$table|escape}{/if}{if $identifier && $id}&{$identifier|escape}={$id|escape}{/if}{if isset($smarty.get.module)}&module={$smarty.get.module|escape}{/if}{if isset($smarty.get.id_product)}&id_product={$smarty.get.id_product|escape}{/if}" method="post" id="calendar_form" name="calendar_form" class="form-inline">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-lg-6">
|
|
||||||
<div class="btn-group">
|
|
||||||
<input type="submit" name="submitDateDay" class="btn btn-default submitDateDay" value="{$translations.Day}">
|
|
||||||
<input type="submit" name="submitDateMonth" class="btn btn-default submitDateMonth" value="{$translations.Month}">
|
|
||||||
<input type="submit" name="submitDateYear" class="btn btn-default submitDateYear" value="{$translations.Year}">
|
|
||||||
<input type="submit" name="submitDateDayPrev" class="btn btn-default submitDateDayPrev" value="{$translations.Day}-1">
|
|
||||||
<input type="submit" name="submitDateMonthPrev" class="btn btn-default submitDateMonthPrev" value="{$translations.Month}-1">
|
|
||||||
<input type="submit" name="submitDateYearPrev" class="btn btn-default submitDateYearPrev" value="{$translations.Year}-1">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-lg-6">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-8">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-xs-6">
|
|
||||||
<div class="input-group">
|
|
||||||
<label class="input-group-addon">{if isset($translations.From)}{$translations.From}{else}{l s='From:'}{/if}</label>
|
|
||||||
<input type="text" name="datepickerFrom" id="datepickerFrom" value="{$datepickerFrom|escape}" class="form-control datepicker">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-xs-6">
|
|
||||||
<div class="input-group">
|
|
||||||
<label class="input-group-addon">{if isset($translations.To)}{$translations.To}{else}{l s='From:'}{/if}</label>
|
|
||||||
<input type="text" name="datepickerTo" id="datepickerTo" value="{$datepickerTo|escape}" class="datepicker form-control">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-4">
|
|
||||||
<input type="submit" name="submitDatePicker" id="submitDatePicker" class="btn btn-default pull-right" value="{if isset($translations.Save)}{$translations.Save}{else}{l s='Save'}{/if}" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
|
||||||
$(document).ready(function() {
|
|
||||||
if ($("form#calendar_form .datepicker").length > 0)
|
|
||||||
$("form#calendar_form .datepicker").datepicker({
|
|
||||||
prevText: '',
|
|
||||||
nextText: '',
|
|
||||||
dateFormat: 'yy-mm-dd'
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
</div>
|
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
<div id="calendar" class="panel">
|
||||||
|
<form action="{$action|escape}" method="post" id="calendar_form" name="calendar_form" class="form-inline">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-6">
|
||||||
|
<div class="btn-group">
|
||||||
|
<input type="submit" name="submitDateDay" class="btn btn-default submitDateDay" value="{$translations.Day}">
|
||||||
|
<input type="submit" name="submitDateMonth" class="btn btn-default submitDateMonth" value="{$translations.Month}">
|
||||||
|
<input type="submit" name="submitDateYear" class="btn btn-default submitDateYear" value="{$translations.Year}">
|
||||||
|
<input type="submit" name="submitDateDayPrev" class="btn btn-default submitDateDayPrev" value="{$translations.Day}-1">
|
||||||
|
<input type="submit" name="submitDateMonthPrev" class="btn btn-default submitDateMonthPrev" value="{$translations.Month}-1">
|
||||||
|
<input type="submit" name="submitDateYearPrev" class="btn btn-default submitDateYearPrev" value="{$translations.Year}-1">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-8">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-xs-6">
|
||||||
|
<div class="input-group">
|
||||||
|
<label class="input-group-addon">{if isset($translations.From)}{$translations.From}{else}{l s='From:'}{/if}</label>
|
||||||
|
<input type="text" name="datepickerFrom" id="datepickerFrom" value="{$datepickerFrom|escape}" class="form-control datepicker">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-6">
|
||||||
|
<div class="input-group">
|
||||||
|
<label class="input-group-addon">{if isset($translations.To)}{$translations.To}{else}{l s='From:'}{/if}</label>
|
||||||
|
<input type="text" name="datepickerTo" id="datepickerTo" value="{$datepickerTo|escape}" class="datepicker form-control">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<input type="submit" name="submitDatePicker" id="submitDatePicker" class="btn btn-default pull-right" value="{if isset($translations.Save)}{$translations.Save}{else}{l s='Save'}{/if}" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(document).ready(function() {
|
||||||
|
if ($("form#calendar_form .datepicker").length > 0)
|
||||||
|
$("form#calendar_form .datepicker").datepicker({
|
||||||
|
prevText: '',
|
||||||
|
nextText: '',
|
||||||
|
dateFormat: 'yy-mm-dd'
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</div>
|
||||||
@@ -38,6 +38,7 @@ class AdminDashboardControllerCore extends AdminController
|
|||||||
$admin_webpath = str_ireplace(_PS_ROOT_DIR_, '', _PS_ADMIN_DIR_);
|
$admin_webpath = str_ireplace(_PS_ROOT_DIR_, '', _PS_ADMIN_DIR_);
|
||||||
$admin_webpath = preg_replace('/^'.preg_quote(DIRECTORY_SEPARATOR, '/').'/', '', $admin_webpath);
|
$admin_webpath = preg_replace('/^'.preg_quote(DIRECTORY_SEPARATOR, '/').'/', '', $admin_webpath);
|
||||||
parent::setMedia();
|
parent::setMedia();
|
||||||
|
$this->addJqueryUI('ui.datepicker');
|
||||||
$this->addJS(array(
|
$this->addJS(array(
|
||||||
__PS_BASE_URI__.$admin_webpath.'/themes/'.$this->bo_theme.'/js/vendor/d3.js',
|
__PS_BASE_URI__.$admin_webpath.'/themes/'.$this->bo_theme.'/js/vendor/d3.js',
|
||||||
__PS_BASE_URI__.$admin_webpath.'/themes/'.$this->bo_theme.'/js/vendor/nv.d3.js',
|
__PS_BASE_URI__.$admin_webpath.'/themes/'.$this->bo_theme.'/js/vendor/nv.d3.js',
|
||||||
@@ -50,9 +51,23 @@ class AdminDashboardControllerCore extends AdminController
|
|||||||
|
|
||||||
public function renderView()
|
public function renderView()
|
||||||
{
|
{
|
||||||
|
$translations = array(
|
||||||
|
'Calendar' => $this->l('Calendar', 'AdminStatsTab'),
|
||||||
|
'Day' => $this->l('Day', 'AdminStatsTab'),
|
||||||
|
'Month' => $this->l('Month', 'AdminStatsTab'),
|
||||||
|
'Year' => $this->l('Year', 'AdminStatsTab'),
|
||||||
|
'From' => $this->l('From:', 'AdminStatsTab'),
|
||||||
|
'To' => $this->l('To:', 'AdminStatsTab'),
|
||||||
|
'Save' => $this->l('Save', 'AdminStatsTab')
|
||||||
|
);
|
||||||
|
|
||||||
$this->tpl_view_vars = array(
|
$this->tpl_view_vars = array(
|
||||||
'hookDashboardZoneOne' => Hook::exec('dashboardZoneOne'),
|
'hookDashboardZoneOne' => Hook::exec('dashboardZoneOne'),
|
||||||
'hookDashboardZoneTwo' => Hook::exec('dashboardZoneTwo'),
|
'hookDashboardZoneTwo' => Hook::exec('dashboardZoneTwo'),
|
||||||
|
'translations' => $translations,
|
||||||
|
'action' => '#',
|
||||||
|
'datepickerFrom' => Tools::getValue('datepickerFrom', $this->context->employee->stats_date_from),
|
||||||
|
'datepickerTo' => Tools::getValue('datepickerTo', $this->context->employee->stats_date_to)
|
||||||
);
|
);
|
||||||
return parent::renderView();
|
return parent::renderView();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -75,6 +75,7 @@ abstract class AdminStatsTabControllerCore extends AdminPreferencesControllerCor
|
|||||||
public static function displayCalendarForm($translations, $token, $action = null, $table = null, $identifier = null, $id = null)
|
public static function displayCalendarForm($translations, $token, $action = null, $table = null, $identifier = null, $id = null)
|
||||||
{
|
{
|
||||||
$context = Context::getContext();
|
$context = Context::getContext();
|
||||||
|
|
||||||
$tpl = $context->controller->createTemplate('calendar.tpl');
|
$tpl = $context->controller->createTemplate('calendar.tpl');
|
||||||
|
|
||||||
$context->controller->addJqueryUI('ui.datepicker');
|
$context->controller->addJqueryUI('ui.datepicker');
|
||||||
@@ -85,6 +86,12 @@ abstract class AdminStatsTabControllerCore extends AdminPreferencesControllerCor
|
|||||||
$id = Tools::getValue('module');
|
$id = Tools::getValue('module');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$action = Context::getContext()->link->getAdminLink('AdminStatsTab');
|
||||||
|
$action .= ($action && $table ? '&'.Tools::safeOutput($action) : '');
|
||||||
|
$action .= ($identifier && $id ? '&'.Tools::safeOutput($identifier).'='.(int)$id : '');
|
||||||
|
$action .= ($module = Tools::getValue('module') ? '&module='.Tools::safeOutput($module) : '');
|
||||||
|
$action .= ($id_product = Tools::getValue('id_product') ? '&id_product='.Tools::safeOutput($id_product) : '');
|
||||||
|
|
||||||
$tpl->assign(array(
|
$tpl->assign(array(
|
||||||
'current' => self::$currentIndex,
|
'current' => self::$currentIndex,
|
||||||
'token' => $token,
|
'token' => $token,
|
||||||
|
|||||||
Reference in new issue
Block a user