Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated dashboard structure | Fixed dashboard widget #391

Merged
merged 1 commit into from
Jul 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion admin/themes/default/css/admin-theme.css

Large diffs are not rendered by default.

7 changes: 3 additions & 4 deletions admin/themes/default/css/admin-theme_rtl.css

Large diffs are not rendered by default.

7 changes: 3 additions & 4 deletions admin/themes/default/css/schemes/admin-theme-blue.css

Large diffs are not rendered by default.

7 changes: 3 additions & 4 deletions admin/themes/default/css/schemes/admin-theme-contrast.css

Large diffs are not rendered by default.

7 changes: 3 additions & 4 deletions admin/themes/default/css/schemes/admin-theme-flex.css

Large diffs are not rendered by default.

7 changes: 3 additions & 4 deletions admin/themes/default/css/schemes/admin-theme-fruit.css

Large diffs are not rendered by default.

7 changes: 3 additions & 4 deletions admin/themes/default/css/schemes/admin-theme-prune.css

Large diffs are not rendered by default.

7 changes: 3 additions & 4 deletions admin/themes/default/css/schemes_rtl/admin-theme-blue_rtl.css

Large diffs are not rendered by default.

Large diffs are not rendered by default.

7 changes: 3 additions & 4 deletions admin/themes/default/css/schemes_rtl/admin-theme-flex_rtl.css

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

60 changes: 1 addition & 59 deletions admin/themes/default/sass/controllers/_dashboard.sass
Original file line number Diff line number Diff line change
Expand Up @@ -132,69 +132,11 @@
.data_value
display: block
text-align: center

#dashtrends
header
margin-bottom: 0
#dashtrends_toolbar
margin: 0 -16px 10px
dl
@include box-shadow(0 0 0 2px white inset)
dt
color: #777
padding: 0
margin: 0
height: 2.6em
dd.data_value
color: #aaa
@extend .clearfix
small
font-size: 0.5em
dd.dash_trend
background-color: white
width: 80px
margin: 0 auto
@include border-radius(3px)
&:hover
dt, dd.data_value
color: $brand-primary
dt
text-decoration: underline
&.active
dt, dd.data_value
color: white
dl
cursor: pointer
margin: 0
min-height: 70px
text-align: center
background-color: white
padding: 10px
border-bottom: 1px solid #ddd
@include border-left(1px solid #ddd)
&:first-child
@include border-left(none)
&.active
background-color: $brand-primary
@include box-shadow(white 0 0 0 2px inset)
dt
color: white
dt
text-align: center
height: 37px
line-height: 1em
font: 400 1.1em/120% $headings-font-family
dd
span
font-size: 0.9em
white-space: nowrap
svg
height: 350px

#dashgoals
svg
height: 250px

#dashproducts
nav
margin-bottom: 10px
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,61 +33,110 @@
<div id="dashboard">
{$hookDashboardTop}
<div class="row">
{if $warning}
<div class="col-lg-12">
<div class="alert alert-warning">{$warning}</div>
</div>
{/if}
<div class="col-lg-12">
{if $warning}
<div class="alert alert-warning">{$warning}</div>
{/if}
<div id="calendar" class="panel">
<form action="{$action|escape}" method="post" id="calendar_form" name="calendar_form" class="form-inline">
<div class="btn-group">
<button type="button" name="submitDateDay" class="btn btn-default submitDateDay{if (!isset($preselect_date_range) || !$preselect_date_range) || (isset($preselect_date_range) && $preselect_date_range == 'day')} active{/if}">
{l s='Day'}
</button>
<button type="button" name="submitDateMonth" class="btn btn-default submitDateMonth {if isset($preselect_date_range) && $preselect_date_range == 'month'}active{/if}">
{l s='Month'}
</button>
<button type="button" name="submitDateYear" class="btn btn-default submitDateYear{if isset($preselect_date_range) && $preselect_date_range == 'year'} active{/if}">
{l s='Year'}
</button>
<button type="button" name="submitDateDayPrev" class="btn btn-default submitDateDayPrev{if isset($preselect_date_range) && $preselect_date_range == 'prev-day'} active{/if}">
{l s='Day'}-1
</button>
<button type="button" name="submitDateMonthPrev" class="btn btn-default submitDateMonthPrev{if isset($preselect_date_range) && $preselect_date_range == 'prev-month'} active{/if}">
{l s='Month'}-1
</button>
<button type="button" name="submitDateYearPrev" class="btn btn-default submitDateYearPrev{if isset($preselect_date_range) && $preselect_date_range == 'prev-year'} active{/if}">
{l s='Year'}-1
</button>
</div>
<input type="hidden" name="datepickerFrom" id="datepickerFrom" value="{$date_from|escape}" class="form-control">
<input type="hidden" name="datepickerTo" id="datepickerTo" value="{$date_to|escape}" class="form-control">
<input type="hidden" name="preselectDateRange" id="preselectDateRange" value="{if isset($preselect_date_range)}{$preselect_date_range}{/if}" class="form-control">
<div class="form-group pull-right">
<button id="datepickerExpand" class="btn btn-default" type="button">
<i class="icon-calendar-empty"></i>
<span class="hidden-xs">
{l s='From'}
<strong class="text-info" id="datepicker-from-info">{$date_from|escape}</strong>
{l s='To'}
<strong class="text-info" id="datepicker-to-info">{$date_to|escape}</strong>
<strong class="text-info" id="datepicker-diff-info"></strong>
</span>
<i class="icon-caret-down"></i>
</button>
{$calendar}
<div class="panel clearfix">
<div class="col-lg-6">
<div id="calendar">
<form action="{$action|escape}" method="post" id="calendar_form" name="calendar_form" class="form-inline">
<div class="btn-toolbar">
<div class="btn-group input-group">
<button type="button" name="submitDateDay" class="btn btn-default submitDateDay{if (!isset($preselect_date_range) || !$preselect_date_range) || (isset($preselect_date_range) && $preselect_date_range == 'day')} active{/if}">
{l s='Day'}
</button>
<button type="button" name="submitDateMonth" class="btn btn-default submitDateMonth {if isset($preselect_date_range) && $preselect_date_range == 'month'}active{/if}">
{l s='Month'}
</button>
<button type="button" name="submitDateYear" class="btn btn-default submitDateYear{if isset($preselect_date_range) && $preselect_date_range == 'year'} active{/if}">
{l s='Year'}
</button>
<button type="button" name="submitDateDayPrev" class="btn btn-default submitDateDayPrev{if isset($preselect_date_range) && $preselect_date_range == 'prev-day'} active{/if}">
{l s='Day'}-1
</button>
<button type="button" name="submitDateMonthPrev" class="btn btn-default submitDateMonthPrev{if isset($preselect_date_range) && $preselect_date_range == 'prev-month'} active{/if}">
{l s='Month'}-1
</button>
<button type="button" name="submitDateYearPrev" class="btn btn-default submitDateYearPrev{if isset($preselect_date_range) && $preselect_date_range == 'prev-year'} active{/if}">
{l s='Year'}-1
</button>
</div>
<input type="hidden" name="datepickerFrom" id="datepickerFrom" value="{$date_from|escape}" class="form-control">
<input type="hidden" name="datepickerTo" id="datepickerTo" value="{$date_to|escape}" class="form-control">
<input type="hidden" name="preselectDateRange" id="preselectDateRange" value="{if isset($preselect_date_range)}{$preselect_date_range}{/if}" class="form-control">
<div class="form-group input-group">
<button id="datepickerExpand" class="btn btn-default" type="button">
<i class="icon-calendar-empty"></i>
<span class="hidden-xs">
{l s='From'}
<strong class="text-info" id="datepicker-from-info">{$date_from|escape}</strong>
{l s='To'}
<strong class="text-info" id="datepicker-to-info">{$date_to|escape}</strong>
<strong class="text-info" id="datepicker-diff-info"></strong>
</span>
<i class="icon-caret-down"></i>
</button>
{$calendar}
</div>
</div>
</form>
</div>
</form>
</div>
<div class="col-lg-6">
<form action="{$action|escape}" method="post" class="form-inline">
<div class="text-right">
<select class="form-control stats-filter-hotel" name="stats_id_hotel">
{foreach from=$hotel_options item=hotel_option}
<option value="{$hotel_option.id_hotel}" {if $hotel_option.id_hotel == $id_hotel}selected{/if}>
{$hotel_option.hotel_name|escape:'html':'UTF-8'}
</option>
{/foreach}
</select>
<input type="hidden" id="submit-stats-hotel" name="submitStatsHotel" value="1" disabled>
</div>
</form>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-4 col-lg-3" id="hookDashboardZoneOne">
{$hookDashboardZoneOne}
</div>
<div class="col-md-8 col-lg-9" id="hookDashboardZoneTwo">
<div class="col-md-8 col-md-push-4 col-lg-7 col-lg-push-3" id="hookDashboardZoneTwo">
<div class='row'>
{$hookDashboardZoneTwo}
</div>
</div>
<div class="col-md-4 col-md-pull-8 col-lg-3 col-lg-pull-7" id="hookDashboardZoneOne">
{$hookDashboardZoneOne}
</div>
<div class="col-md-4 col-md-pull-8 col-lg-2 col-lg-pull-0" id="hookDashboardZoneThree">
<div class="row">
{$hookDashboardZoneThree}
<div class="col-sm-12">
<section class="dash_links widget panel">
<h3><i class="icon-link"></i> {l s="Useful links"}</h3>
<dl>
<dt><a href="https://qloapps.com/qlo-reservation-system/" class="_blank">{l s="Official Documentation"}</a></dt>
<dd>{l s="Qloapps User Guide"}</dd>
</dl>
<dl>
<dt><a href="https://forums.qloapps.com/" class="_blank">{l s="Qloapps Forum"}</a></dt>
<dd>{l s="Connect with the Qloapps community"}</dd>
</dl>
<dl>
<dt><a href="https://qloapps.com/addons/" class="_blank">{l s="Qloapps Addons"}</a></dt>
<dd>{l s="Enhance your store Qloapps modules"}</dd>
</dl>
<dl>
<dt><a href="https://qloapps.com/contact/" class="_blank">{l s="Contact Us!"}</a></dt>
<dd>{l s="Contact us for any help"}</dd>
</dl>
</section>
</div>
</div>
</div>

</div>
</div>
58 changes: 40 additions & 18 deletions controllers/admin/AdminDashboardController.php
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,8 @@ public function renderView()
// 'Save' => $this->l('Save', 'AdminStatsTab')
// );

$test_stats_date_update = $this->context->cookie->__get('stats_date_update');
if (!empty($test_stats_date_update) && $this->context->cookie->__get('stats_date_update') < strtotime(date('Y-m-d'))) {
$test_stats_date_update = $this->context->cookie->stats_date_update;
if (!empty($test_stats_date_update) && $this->context->cookie->stats_date_update < strtotime(date('Y-m-d'))) {
switch ($this->context->employee->preselect_date_range) {
case 'day':
$date_from = date('Y-m-d');
Expand Down Expand Up @@ -232,10 +232,14 @@ public function renderView()
$this->context->employee->stats_date_from = $date_from;
$this->context->employee->stats_date_to = $date_to;
$this->context->employee->update();
$this->context->cookie->__set('stats_date_update', strtotime(date('Y-m-d')));
$this->context->cookie->stats_date_update = strtotime(date('Y-m-d'));
$this->context->cookie->write();
}

if (!$this->context->cookie->stats_id_hotel) {
$this->context->cookie->stats_id_hotel = false;
}

$calendar_helper = new HelperCalendar();

$calendar_helper->setDateFrom(Tools::getValue('date_from', $this->context->employee->stats_date_from));
Expand All @@ -258,17 +262,31 @@ public function renderView()

$params = array(
'date_from' => $this->context->employee->stats_date_from,
'date_to' => $this->context->employee->stats_date_to
'date_to' => $this->context->employee->stats_date_to,
'id_hotel' => (int) $this->context->cookie->stats_id_hotel,
);

$objHotelInfo = new HotelBranchInformation();
$idsHotel = $objHotelInfo->getProfileAccessedHotels($this->context->employee->id_profile, 1, 1);
$hotelOptions = array(array('id_hotel' => false, 'hotel_name' => $this->l('All Hotels')));
foreach ($idsHotel as $idHotel) {
$objHotelBranchInfo = new HotelBranchInformation($idHotel, $this->context->language->id);
$hotelOptions[] = array(
'id_hotel' => (int) $idHotel,
'hotel_name' => $objHotelBranchInfo->hotel_name.', '.$objHotelBranchInfo->city,
);
}
$this->tpl_view_vars = array(
'date_from' => $this->context->employee->stats_date_from,
'date_to' => $this->context->employee->stats_date_to,
'id_hotel' => (int) $this->context->cookie->stats_id_hotel,
'hotel_options' => $hotelOptions,
'hookDashboardTop' => Hook::exec('dashboardTop', $params),
'hookDashboardZoneOne' => Hook::exec('dashboardZoneOne', $params),
'hookDashboardZoneTwo' => Hook::exec('dashboardZoneTwo', $params),
'hookDashboardZoneThree' => Hook::exec('dashboardZoneThree', $params),
//'translations' => $translations,
'action' => self::$currentIndex,
'action' => self::$currentIndex.'&token='.$this->token,
'warning' => $this->getWarningDomainName(),
'new_version_url' => Tools::getCurrentUrlProtocolPrefix()._PS_API_DOMAIN_.'/version/check_version.php?v='._PS_VERSION_.'&lang='.$this->context->language->iso_code.'&autoupgrade='.(int)(Module::isInstalled('autoupgrade') && Module::isEnabled('autoupgrade')).'&hosted_mode='.(int)defined('_PS_HOST_MODE_'),
'dashboard_use_push' => Configuration::get('PS_DASHBOARD_USE_PUSH'),
Expand All @@ -283,18 +301,6 @@ public function renderView()

public function postProcess()
{
if (Tools::isSubmit('submitDateRealTime')) {
if ($use_realtime = (int)Tools::getValue('submitDateRealTime')) {
$this->context->employee->stats_date_from = date('Y-m-d');
$this->context->employee->stats_date_to = date('Y-m-d');
$this->context->employee->stats_compare_option = HelperCalendar::DEFAULT_COMPARE_OPTION;
$this->context->employee->stats_compare_from = null;
$this->context->employee->stats_compare_to = null;
$this->context->employee->update();
}
Configuration::updateValue('PS_DASHBOARD_USE_PUSH', $use_realtime);
}

if (Tools::isSubmit('submitDateRange')) {
if (!Validate::isDate(Tools::getValue('date_from'))
|| !Validate::isDate(Tools::getValue('date_to'))) {
Expand Down Expand Up @@ -324,7 +330,22 @@ public function postProcess()
}

$this->context->employee->update();
Tools::redirectAdmin(self::$currentIndex);
Tools::redirectAdmin(self::$currentIndex.'&token='.$this->token);
}
}

if (Tools::isSubmit('submitStatsHotel')) {
$statsIdHotel = Tools::getValue('stats_id_hotel');
if ($statsIdHotel) {
$objHotelInfo = new HotelBranchInformation();
$idsHotel = $objHotelInfo->getProfileAccessedHotels($this->context->employee->id_profile, 1, 1);
if (is_array($idsHotel) && count($idsHotel) && !in_array($statsIdHotel, $idsHotel)) {
$this->errors[] = $this->l('No permission for requested hotel.');
}
}
if (!count($this->errors)) {
$this->context->cookie->stats_id_hotel = $statsIdHotel;
Tools::redirectAdmin(self::$currentIndex.'&token='.$this->token);
}
}

Expand Down Expand Up @@ -365,6 +386,7 @@ public function ajaxProcessRefreshDashboard()
$params = array(
'date_from' => $this->context->employee->stats_date_from,
'date_to' => $this->context->employee->stats_date_to,
'id_hotel' => (int) $this->context->cookie->stats_id_hotel,
'compare_from' => $this->context->employee->stats_compare_from,
'compare_to' => $this->context->employee->stats_compare_to,
'dashboard_use_push' => (int)Tools::getValue('dashboard_use_push'),
Expand Down
Loading