Skip to content

Commit 1784542

Browse files
Abhishek KumarShreesh Arora
Abhishek Kumar
authored and
Shreesh Arora
committed
fixed dashboard issues, added third column in dashboard
1 parent 0954235 commit 1784542

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+1302
-1252
lines changed

admin/themes/default/css/admin-theme.css

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

admin/themes/default/css/admin-theme_rtl.css

+3-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

admin/themes/default/css/schemes/admin-theme-blue.css

+3-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

admin/themes/default/css/schemes/admin-theme-contrast.css

+3-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

admin/themes/default/css/schemes/admin-theme-flex.css

+3-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

admin/themes/default/css/schemes/admin-theme-fruit.css

+3-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

admin/themes/default/css/schemes/admin-theme-prune.css

+3-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

admin/themes/default/css/schemes_rtl/admin-theme-blue_rtl.css

+3-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

admin/themes/default/css/schemes_rtl/admin-theme-contrast_rtl.css

+3-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

admin/themes/default/css/schemes_rtl/admin-theme-flex_rtl.css

+3-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

admin/themes/default/css/schemes_rtl/admin-theme-fruit_rtl.css

+3-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

admin/themes/default/css/schemes_rtl/admin-theme-prune_rtl.css

+3-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

admin/themes/default/css/vendor/font-awesome/font-awesome.css

+1-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

admin/themes/default/sass/controllers/_dashboard.sass

+1-59
Original file line numberDiff line numberDiff line change
@@ -132,69 +132,11 @@
132132
.data_value
133133
display: block
134134
text-align: center
135-
136-
#dashtrends
137-
header
138-
margin-bottom: 0
139-
#dashtrends_toolbar
140-
margin: 0 -16px 10px
141-
dl
142-
@include box-shadow(0 0 0 2px white inset)
143-
dt
144-
color: #777
145-
padding: 0
146-
margin: 0
147-
height: 2.6em
148-
dd.data_value
149-
color: #aaa
150-
@extend .clearfix
151-
small
152-
font-size: 0.5em
153-
dd.dash_trend
154-
background-color: white
155-
width: 80px
156-
margin: 0 auto
157-
@include border-radius(3px)
158-
&:hover
159-
dt, dd.data_value
160-
color: $brand-primary
161-
dt
162-
text-decoration: underline
163-
&.active
164-
dt, dd.data_value
165-
color: white
166-
dl
167-
cursor: pointer
168-
margin: 0
169-
min-height: 70px
170-
text-align: center
171-
background-color: white
172-
padding: 10px
173-
border-bottom: 1px solid #ddd
174-
@include border-left(1px solid #ddd)
175-
&:first-child
176-
@include border-left(none)
177-
&.active
178-
background-color: $brand-primary
179-
@include box-shadow(white 0 0 0 2px inset)
180-
dt
181-
color: white
182-
dt
183-
text-align: center
184-
height: 37px
185-
line-height: 1em
186-
font: 400 1.1em/120% $headings-font-family
187-
dd
188-
span
189-
font-size: 0.9em
190-
white-space: nowrap
191-
svg
192-
height: 350px
193135

194136
#dashgoals
195137
svg
196138
height: 250px
197-
139+
198140
#dashproducts
199141
nav
200142
margin-bottom: 10px

admin/themes/default/template/controllers/dashboard/helpers/view/view.tpl

+95-46
Original file line numberDiff line numberDiff line change
@@ -33,61 +33,110 @@
3333
<div id="dashboard">
3434
{$hookDashboardTop}
3535
<div class="row">
36+
{if $warning}
37+
<div class="col-lg-12">
38+
<div class="alert alert-warning">{$warning}</div>
39+
</div>
40+
{/if}
3641
<div class="col-lg-12">
37-
{if $warning}
38-
<div class="alert alert-warning">{$warning}</div>
39-
{/if}
40-
<div id="calendar" class="panel">
41-
<form action="{$action|escape}" method="post" id="calendar_form" name="calendar_form" class="form-inline">
42-
<div class="btn-group">
43-
<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}">
44-
{l s='Day'}
45-
</button>
46-
<button type="button" name="submitDateMonth" class="btn btn-default submitDateMonth {if isset($preselect_date_range) && $preselect_date_range == 'month'}active{/if}">
47-
{l s='Month'}
48-
</button>
49-
<button type="button" name="submitDateYear" class="btn btn-default submitDateYear{if isset($preselect_date_range) && $preselect_date_range == 'year'} active{/if}">
50-
{l s='Year'}
51-
</button>
52-
<button type="button" name="submitDateDayPrev" class="btn btn-default submitDateDayPrev{if isset($preselect_date_range) && $preselect_date_range == 'prev-day'} active{/if}">
53-
{l s='Day'}-1
54-
</button>
55-
<button type="button" name="submitDateMonthPrev" class="btn btn-default submitDateMonthPrev{if isset($preselect_date_range) && $preselect_date_range == 'prev-month'} active{/if}">
56-
{l s='Month'}-1
57-
</button>
58-
<button type="button" name="submitDateYearPrev" class="btn btn-default submitDateYearPrev{if isset($preselect_date_range) && $preselect_date_range == 'prev-year'} active{/if}">
59-
{l s='Year'}-1
60-
</button>
61-
</div>
62-
<input type="hidden" name="datepickerFrom" id="datepickerFrom" value="{$date_from|escape}" class="form-control">
63-
<input type="hidden" name="datepickerTo" id="datepickerTo" value="{$date_to|escape}" class="form-control">
64-
<input type="hidden" name="preselectDateRange" id="preselectDateRange" value="{if isset($preselect_date_range)}{$preselect_date_range}{/if}" class="form-control">
65-
<div class="form-group pull-right">
66-
<button id="datepickerExpand" class="btn btn-default" type="button">
67-
<i class="icon-calendar-empty"></i>
68-
<span class="hidden-xs">
69-
{l s='From'}
70-
<strong class="text-info" id="datepicker-from-info">{$date_from|escape}</strong>
71-
{l s='To'}
72-
<strong class="text-info" id="datepicker-to-info">{$date_to|escape}</strong>
73-
<strong class="text-info" id="datepicker-diff-info"></strong>
74-
</span>
75-
<i class="icon-caret-down"></i>
76-
</button>
77-
{$calendar}
42+
<div class="panel clearfix">
43+
<div class="col-lg-6">
44+
<div id="calendar">
45+
<form action="{$action|escape}" method="post" id="calendar_form" name="calendar_form" class="form-inline">
46+
<div class="btn-toolbar">
47+
<div class="btn-group input-group">
48+
<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}">
49+
{l s='Day'}
50+
</button>
51+
<button type="button" name="submitDateMonth" class="btn btn-default submitDateMonth {if isset($preselect_date_range) && $preselect_date_range == 'month'}active{/if}">
52+
{l s='Month'}
53+
</button>
54+
<button type="button" name="submitDateYear" class="btn btn-default submitDateYear{if isset($preselect_date_range) && $preselect_date_range == 'year'} active{/if}">
55+
{l s='Year'}
56+
</button>
57+
<button type="button" name="submitDateDayPrev" class="btn btn-default submitDateDayPrev{if isset($preselect_date_range) && $preselect_date_range == 'prev-day'} active{/if}">
58+
{l s='Day'}-1
59+
</button>
60+
<button type="button" name="submitDateMonthPrev" class="btn btn-default submitDateMonthPrev{if isset($preselect_date_range) && $preselect_date_range == 'prev-month'} active{/if}">
61+
{l s='Month'}-1
62+
</button>
63+
<button type="button" name="submitDateYearPrev" class="btn btn-default submitDateYearPrev{if isset($preselect_date_range) && $preselect_date_range == 'prev-year'} active{/if}">
64+
{l s='Year'}-1
65+
</button>
66+
</div>
67+
<input type="hidden" name="datepickerFrom" id="datepickerFrom" value="{$date_from|escape}" class="form-control">
68+
<input type="hidden" name="datepickerTo" id="datepickerTo" value="{$date_to|escape}" class="form-control">
69+
<input type="hidden" name="preselectDateRange" id="preselectDateRange" value="{if isset($preselect_date_range)}{$preselect_date_range}{/if}" class="form-control">
70+
<div class="form-group input-group">
71+
<button id="datepickerExpand" class="btn btn-default" type="button">
72+
<i class="icon-calendar-empty"></i>
73+
<span class="hidden-xs">
74+
{l s='From'}
75+
<strong class="text-info" id="datepicker-from-info">{$date_from|escape}</strong>
76+
{l s='To'}
77+
<strong class="text-info" id="datepicker-to-info">{$date_to|escape}</strong>
78+
<strong class="text-info" id="datepicker-diff-info"></strong>
79+
</span>
80+
<i class="icon-caret-down"></i>
81+
</button>
82+
{$calendar}
83+
</div>
84+
</div>
85+
</form>
7886
</div>
79-
</form>
87+
</div>
88+
<div class="col-lg-6">
89+
<form action="{$action|escape}" method="post" class="form-inline">
90+
<div class="text-right">
91+
<select class="form-control stats-filter-hotel" name="stats_id_hotel">
92+
{foreach from=$hotel_options item=hotel_option}
93+
<option value="{$hotel_option.id_hotel}" {if $hotel_option.id_hotel == $id_hotel}selected{/if}>
94+
{$hotel_option.hotel_name|escape:'html':'UTF-8'}
95+
</option>
96+
{/foreach}
97+
</select>
98+
<input type="hidden" id="submit-stats-hotel" name="submitStatsHotel" value="1" disabled>
99+
</div>
100+
</form>
101+
</div>
80102
</div>
81103
</div>
82104
</div>
83105
<div class="row">
84-
<div class="col-md-4 col-lg-3" id="hookDashboardZoneOne">
85-
{$hookDashboardZoneOne}
86-
</div>
87-
<div class="col-md-8 col-lg-9" id="hookDashboardZoneTwo">
106+
<div class="col-md-8 col-md-push-4 col-lg-7 col-lg-push-3" id="hookDashboardZoneTwo">
88107
<div class='row'>
89108
{$hookDashboardZoneTwo}
90109
</div>
91110
</div>
111+
<div class="col-md-4 col-md-pull-8 col-lg-3 col-lg-pull-7" id="hookDashboardZoneOne">
112+
{$hookDashboardZoneOne}
113+
</div>
114+
<div class="col-md-4 col-md-pull-8 col-lg-2 col-lg-pull-0" id="hookDashboardZoneThree">
115+
<div class="row">
116+
{$hookDashboardZoneThree}
117+
<div class="col-sm-12">
118+
<section class="dash_links widget panel">
119+
<h3><i class="icon-link"></i> {l s="Useful links"}</h3>
120+
<dl>
121+
<dt><a href="https://qloapps.com/qlo-reservation-system/" class="_blank">{l s="Official Documentation"}</a></dt>
122+
<dd>{l s="Qloapps User Guide"}</dd>
123+
</dl>
124+
<dl>
125+
<dt><a href="https://forums.qloapps.com/" class="_blank">{l s="Qloapps Forum"}</a></dt>
126+
<dd>{l s="Connect with the Qloapps community"}</dd>
127+
</dl>
128+
<dl>
129+
<dt><a href="https://qloapps.com/addons/" class="_blank">{l s="Qloapps Addons"}</a></dt>
130+
<dd>{l s="Enhance your store Qloapps modules"}</dd>
131+
</dl>
132+
<dl>
133+
<dt><a href="https://qloapps.com/contact/" class="_blank">{l s="Contact Us!"}</a></dt>
134+
<dd>{l s="Contact us for any help"}</dd>
135+
</dl>
136+
</section>
137+
</div>
138+
</div>
139+
</div>
140+
92141
</div>
93142
</div>

controllers/admin/AdminDashboardController.php

+40-18
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,8 @@ public function renderView()
200200
// 'Save' => $this->l('Save', 'AdminStatsTab')
201201
// );
202202

203-
$test_stats_date_update = $this->context->cookie->__get('stats_date_update');
204-
if (!empty($test_stats_date_update) && $this->context->cookie->__get('stats_date_update') < strtotime(date('Y-m-d'))) {
203+
$test_stats_date_update = $this->context->cookie->stats_date_update;
204+
if (!empty($test_stats_date_update) && $this->context->cookie->stats_date_update < strtotime(date('Y-m-d'))) {
205205
switch ($this->context->employee->preselect_date_range) {
206206
case 'day':
207207
$date_from = date('Y-m-d');
@@ -232,10 +232,14 @@ public function renderView()
232232
$this->context->employee->stats_date_from = $date_from;
233233
$this->context->employee->stats_date_to = $date_to;
234234
$this->context->employee->update();
235-
$this->context->cookie->__set('stats_date_update', strtotime(date('Y-m-d')));
235+
$this->context->cookie->stats_date_update = strtotime(date('Y-m-d'));
236236
$this->context->cookie->write();
237237
}
238238

239+
if (!$this->context->cookie->stats_id_hotel) {
240+
$this->context->cookie->stats_id_hotel = false;
241+
}
242+
239243
$calendar_helper = new HelperCalendar();
240244

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

259263
$params = array(
260264
'date_from' => $this->context->employee->stats_date_from,
261-
'date_to' => $this->context->employee->stats_date_to
265+
'date_to' => $this->context->employee->stats_date_to,
266+
'id_hotel' => (int) $this->context->cookie->stats_id_hotel,
262267
);
263268

269+
$objHotelInfo = new HotelBranchInformation();
270+
$idsHotel = $objHotelInfo->getProfileAccessedHotels($this->context->employee->id_profile, 1, 1);
271+
$hotelOptions = array(array('id_hotel' => false, 'hotel_name' => $this->l('All Hotels')));
272+
foreach ($idsHotel as $idHotel) {
273+
$objHotelBranchInfo = new HotelBranchInformation($idHotel, $this->context->language->id);
274+
$hotelOptions[] = array(
275+
'id_hotel' => (int) $idHotel,
276+
'hotel_name' => $objHotelBranchInfo->hotel_name.', '.$objHotelBranchInfo->city,
277+
);
278+
}
264279
$this->tpl_view_vars = array(
265280
'date_from' => $this->context->employee->stats_date_from,
266281
'date_to' => $this->context->employee->stats_date_to,
282+
'id_hotel' => (int) $this->context->cookie->stats_id_hotel,
283+
'hotel_options' => $hotelOptions,
267284
'hookDashboardTop' => Hook::exec('dashboardTop', $params),
268285
'hookDashboardZoneOne' => Hook::exec('dashboardZoneOne', $params),
269286
'hookDashboardZoneTwo' => Hook::exec('dashboardZoneTwo', $params),
287+
'hookDashboardZoneThree' => Hook::exec('dashboardZoneThree', $params),
270288
//'translations' => $translations,
271-
'action' => self::$currentIndex,
289+
'action' => self::$currentIndex.'&token='.$this->token,
272290
'warning' => $this->getWarningDomainName(),
273291
'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_'),
274292
'dashboard_use_push' => Configuration::get('PS_DASHBOARD_USE_PUSH'),
@@ -283,18 +301,6 @@ public function renderView()
283301

284302
public function postProcess()
285303
{
286-
if (Tools::isSubmit('submitDateRealTime')) {
287-
if ($use_realtime = (int)Tools::getValue('submitDateRealTime')) {
288-
$this->context->employee->stats_date_from = date('Y-m-d');
289-
$this->context->employee->stats_date_to = date('Y-m-d');
290-
$this->context->employee->stats_compare_option = HelperCalendar::DEFAULT_COMPARE_OPTION;
291-
$this->context->employee->stats_compare_from = null;
292-
$this->context->employee->stats_compare_to = null;
293-
$this->context->employee->update();
294-
}
295-
Configuration::updateValue('PS_DASHBOARD_USE_PUSH', $use_realtime);
296-
}
297-
298304
if (Tools::isSubmit('submitDateRange')) {
299305
if (!Validate::isDate(Tools::getValue('date_from'))
300306
|| !Validate::isDate(Tools::getValue('date_to'))) {
@@ -324,7 +330,22 @@ public function postProcess()
324330
}
325331

326332
$this->context->employee->update();
327-
Tools::redirectAdmin(self::$currentIndex);
333+
Tools::redirectAdmin(self::$currentIndex.'&token='.$this->token);
334+
}
335+
}
336+
337+
if (Tools::isSubmit('submitStatsHotel')) {
338+
$statsIdHotel = Tools::getValue('stats_id_hotel');
339+
if ($statsIdHotel) {
340+
$objHotelInfo = new HotelBranchInformation();
341+
$idsHotel = $objHotelInfo->getProfileAccessedHotels($this->context->employee->id_profile, 1, 1);
342+
if (is_array($idsHotel) && count($idsHotel) && !in_array($statsIdHotel, $idsHotel)) {
343+
$this->errors[] = $this->l('No permission for requested hotel.');
344+
}
345+
}
346+
if (!count($this->errors)) {
347+
$this->context->cookie->stats_id_hotel = $statsIdHotel;
348+
Tools::redirectAdmin(self::$currentIndex.'&token='.$this->token);
328349
}
329350
}
330351

@@ -365,6 +386,7 @@ public function ajaxProcessRefreshDashboard()
365386
$params = array(
366387
'date_from' => $this->context->employee->stats_date_from,
367388
'date_to' => $this->context->employee->stats_date_to,
389+
'id_hotel' => (int) $this->context->cookie->stats_id_hotel,
368390
'compare_from' => $this->context->employee->stats_compare_from,
369391
'compare_to' => $this->context->employee->stats_compare_to,
370392
'dashboard_use_push' => (int)Tools::getValue('dashboard_use_push'),

0 commit comments

Comments
 (0)