Merge branch 'bootstrap' of https://github.com/PrestaShop/PrestaShop into bootstrap
This commit is contained in:
@@ -53,21 +53,11 @@
|
||||
{l s='Compare to'}
|
||||
</label>
|
||||
</span>
|
||||
<button class='btn btn-default btn-xs pull-right dropdown-toggle' data-toggle='dropdown' type="button">
|
||||
{l s='Select'}
|
||||
<i class='icon-angle-down'></i>
|
||||
</button>
|
||||
<ul class='dropdown-menu'>
|
||||
<li>
|
||||
<a href="javascript:void(0);" onclick="$('#date-start-compare').focus();"><i class="icon-cogs"></i> {l s='Custom'}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="javascript:void(0);" onclick="setPreviousPeriod()"><i class="icon-cogs"></i> {l s='Previous period'}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="javascript:void(0);" onclick="setPreviousYear()"><i class="icon-cogs"></i> {l s='Previous Year'}</a>
|
||||
</li>
|
||||
</ul>
|
||||
<select id="compare-options" name="compare_date_option" disabled="disabled">
|
||||
<option value="1"{if $compare_option == 1}selected="selected"{/if} label="{l s='Previous period'}">{l s='Previous period'}</option>
|
||||
<option value="2"{if $compare_option == 2}selected="selected"{/if} label="{l s='Previous Year'}">{l s='Previous Year'}</option>
|
||||
<option value="3"{if $compare_option == 3}selected="selected"{/if} label="{l s='Custom'}">{l s='Custom'}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-date-body" id="form-date-body-compare" style="display: none;">
|
||||
<label>{l s='From'}</label>
|
||||
@@ -253,6 +243,7 @@
|
||||
datepickerEnd.setStartCompare($("#date-start-compare").val());
|
||||
datepickerEnd.setEndCompare($("#date-end-compare").val());
|
||||
$('#form-date-body-compare').show();
|
||||
$('#compare-options').prop('disabled', false);
|
||||
$('#date-start-compare').focus();
|
||||
} else {
|
||||
datepickerStart.setStartCompare(null);
|
||||
@@ -260,10 +251,21 @@
|
||||
datepickerEnd.setStartCompare(null);
|
||||
datepickerEnd.setEndCompare(null);
|
||||
$('#form-date-body-compare').hide();
|
||||
$('#compare-options').prop('disabled', true);
|
||||
$('#date-start').focus();
|
||||
}
|
||||
})
|
||||
|
||||
$('#compare-options').change(function() {
|
||||
if (this.value == 1)
|
||||
setPreviousPeriod();
|
||||
|
||||
if (this.value == 2)
|
||||
setPreviousYear();
|
||||
|
||||
$('#date-start-compare').focus();
|
||||
});
|
||||
|
||||
{/literal}
|
||||
});
|
||||
</script>
|
||||
+19
-17
@@ -54,6 +54,7 @@ class EmployeeCore extends ObjectModel
|
||||
|
||||
public $stats_compare_from;
|
||||
public $stats_compare_to;
|
||||
public $stats_compare_option = 1;
|
||||
|
||||
/** @var string Display back office background in the specified color */
|
||||
public $bo_color;
|
||||
@@ -84,23 +85,24 @@ class EmployeeCore extends ObjectModel
|
||||
'table' => 'employee',
|
||||
'primary' => 'id_employee',
|
||||
'fields' => array(
|
||||
'lastname' => array('type' => self::TYPE_STRING, 'validate' => 'isName', 'required' => true, 'size' => 32),
|
||||
'firstname' => array('type' => self::TYPE_STRING, 'validate' => 'isName', 'required' => true, 'size' => 32),
|
||||
'email' => array('type' => self::TYPE_STRING, 'validate' => 'isEmail', 'required' => true, 'size' => 128),
|
||||
'id_lang' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt', 'required' => true),
|
||||
'passwd' => array('type' => self::TYPE_STRING, 'validate' => 'isPasswdAdmin', 'required' => true, 'size' => 32),
|
||||
'last_passwd_gen' => array('type' => self::TYPE_STRING),
|
||||
'active' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
|
||||
'id_profile' => array('type' => self::TYPE_INT, 'validate' => 'isInt', 'required' => true),
|
||||
'bo_color' => array('type' => self::TYPE_STRING, 'validate' => 'isColor', 'size' => 32),
|
||||
'default_tab' => array('type' => self::TYPE_INT, 'validate' => 'isInt'),
|
||||
'bo_theme' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'size' => 32),
|
||||
'bo_width' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt'),
|
||||
'bo_menu' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
|
||||
'stats_date_from' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
|
||||
'stats_date_to' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
|
||||
'stats_compare_from' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
|
||||
'stats_compare_to' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
|
||||
'lastname' => array('type' => self::TYPE_STRING, 'validate' => 'isName', 'required' => true, 'size' => 32),
|
||||
'firstname' => array('type' => self::TYPE_STRING, 'validate' => 'isName', 'required' => true, 'size' => 32),
|
||||
'email' => array('type' => self::TYPE_STRING, 'validate' => 'isEmail', 'required' => true, 'size' => 128),
|
||||
'id_lang' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt', 'required' => true),
|
||||
'passwd' => array('type' => self::TYPE_STRING, 'validate' => 'isPasswdAdmin', 'required' => true, 'size' => 32),
|
||||
'last_passwd_gen' => array('type' => self::TYPE_STRING),
|
||||
'active' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
|
||||
'id_profile' => array('type' => self::TYPE_INT, 'validate' => 'isInt', 'required' => true),
|
||||
'bo_color' => array('type' => self::TYPE_STRING, 'validate' => 'isColor', 'size' => 32),
|
||||
'default_tab' => array('type' => self::TYPE_INT, 'validate' => 'isInt'),
|
||||
'bo_theme' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'size' => 32),
|
||||
'bo_width' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt'),
|
||||
'bo_menu' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
|
||||
'stats_date_from' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
|
||||
'stats_date_to' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
|
||||
'stats_compare_from' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
|
||||
'stats_compare_to' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
|
||||
'stats_compare_option' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt'),
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@ class HelperCalendarCore extends Helper
|
||||
private $_compare_actions;
|
||||
private $_compare_date_from;
|
||||
private $_compare_date_to;
|
||||
private $_compare_date_option;
|
||||
private $_date_format;
|
||||
private $_date_from;
|
||||
private $_date_to;
|
||||
@@ -84,7 +85,7 @@ class HelperCalendarCore extends Helper
|
||||
$value = date('Y-m-d', strtotime("-31 days"));
|
||||
|
||||
if (!is_string($value))
|
||||
throw new PrestaShopException('Date must be string');
|
||||
throw new PrestaShopException('Date must be a string');
|
||||
|
||||
$this->_compare_date_from = $value;
|
||||
return $this;
|
||||
@@ -104,7 +105,7 @@ class HelperCalendarCore extends Helper
|
||||
$value = date('Y-m-d');
|
||||
|
||||
if (!is_string($value))
|
||||
throw new PrestaShopException('Date must be string');
|
||||
throw new PrestaShopException('Date must be a string');
|
||||
|
||||
$this->_compare_date_to = $value;
|
||||
return $this;
|
||||
@@ -118,10 +119,24 @@ class HelperCalendarCore extends Helper
|
||||
return $this->_compare_date_to;
|
||||
}
|
||||
|
||||
public function setCompareOption($value)
|
||||
{
|
||||
$this->_compare_date_option = (int)$value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getCompareOption()
|
||||
{
|
||||
if (!isset($this->_compare_date_option))
|
||||
$this->_compare_date_option = self::DEFAULT_COMPARE_OPTION;
|
||||
|
||||
return $this->_compare_date_option;
|
||||
}
|
||||
|
||||
public function setDateFormat($value)
|
||||
{
|
||||
if (!is_string($value))
|
||||
throw new PrestaShopException('Date format must be string');
|
||||
throw new PrestaShopException('Date format must be a string');
|
||||
|
||||
$this->_date_format = $value;
|
||||
return $this;
|
||||
@@ -141,7 +156,7 @@ class HelperCalendarCore extends Helper
|
||||
$value = date('Y-m-d', strtotime("-31 days"));
|
||||
|
||||
if (!is_string($value))
|
||||
throw new PrestaShopException('Date must be string');
|
||||
throw new PrestaShopException('Date must be a string');
|
||||
|
||||
$this->_date_from = $value;
|
||||
return $this;
|
||||
@@ -161,7 +176,7 @@ class HelperCalendarCore extends Helper
|
||||
$value = date('Y-m-d');
|
||||
|
||||
if (!is_string($value))
|
||||
throw new PrestaShopException('Date must be string');
|
||||
throw new PrestaShopException('Date must be a string');
|
||||
|
||||
$this->_date_to = $value;
|
||||
return $this;
|
||||
@@ -232,6 +247,7 @@ class HelperCalendarCore extends Helper
|
||||
'compare_date_to' => $this->getCompareDateTo(),
|
||||
'actions' => $this->getActions(),
|
||||
'compare_actions' => $this->getCompareActions(),
|
||||
'compare_option' => $this->getCompareOption(),
|
||||
'is_rtl' => $this->isRTL()
|
||||
));
|
||||
|
||||
|
||||
@@ -156,6 +156,7 @@ class AdminDashboardControllerCore extends AdminController
|
||||
$calendar_helper->setDateTo(Tools::getValue('date_to', $this->context->employee->stats_date_to));
|
||||
$calendar_helper->setCompareDateFrom(Tools::getValue('compare_date_from', $this->context->employee->stats_compare_from));
|
||||
$calendar_helper->setCompareDateTo(Tools::getValue('compare_date_to', $this->context->employee->stats_compare_to));
|
||||
$calendar_helper->setCompareOption(Tools::getValue('compare_date_option', $this->context->employee->stats_compare_option));
|
||||
|
||||
$this->tpl_view_vars = array(
|
||||
'hookDashboardZoneOne' => Hook::exec('dashboardZoneOne'),
|
||||
@@ -180,6 +181,7 @@ class AdminDashboardControllerCore extends AdminController
|
||||
$this->context->employee->stats_date_to = Tools::getValue('date_to');
|
||||
$this->context->employee->stats_compare_from = Tools::getValue('compare_date_from');
|
||||
$this->context->employee->stats_compare_to = Tools::getValue('compare_date_to');
|
||||
$this->context->employee->stats_compare_option = Tools::getValue('compare_date_option');
|
||||
$this->context->employee->update();
|
||||
}
|
||||
|
||||
|
||||
@@ -722,6 +722,7 @@ CREATE TABLE `PREFIX_employee` (
|
||||
`stats_date_to` date default NULL,
|
||||
`stats_compare_from` date default NULL,
|
||||
`stats_compare_to` date default NULL,
|
||||
`stats_compare_option` int(1) unsigned NOT NULL DEFAULT 1,
|
||||
`bo_color` varchar(32) default NULL,
|
||||
`bo_theme` varchar(32) default NULL,
|
||||
`default_tab` int(10) unsigned NOT NULL DEFAULT 0,
|
||||
|
||||
@@ -69,4 +69,6 @@ ALTER TABLE `PREFIX_employee` ADD `stats_compare_from` DATE NULL DEFAULT NULL
|
||||
|
||||
INSERT INTO `PREFIX_hook` (`id_hook` , `name` , `title` , `description` , `position` , `live_edit`)
|
||||
VALUES (NULL , 'displayHomeTab', 'Home Page Tabs', 'This hook displays new elements on the homepage tabs', '1', '1'),
|
||||
(NULL , 'displayHomeTabContent', 'Home Page Tabs Content', 'This hook displays new elements on the homepage tabs content', '1', '1');
|
||||
(NULL , 'displayHomeTabContent', 'Home Page Tabs Content', 'This hook displays new elements on the homepage tabs content', '1', '1');
|
||||
|
||||
ALTER TABLE `PREFIX_employee` ADD `stats_compare_option` INT( 1 ) NOT NULL DEFAULT '1' AFTER `stats_compare_to`;
|
||||
Reference in New Issue
Block a user