Skip to content

Commit

Permalink
Merge pull request #327 from lakshya-webkul/gli-dash-improvement
Browse files Browse the repository at this point in the history
Resolved QloApps dashboard issues
  • Loading branch information
rohit053 authored Feb 10, 2022
2 parents 25ce159 + 6b59f8f commit 63031e6
Show file tree
Hide file tree
Showing 21 changed files with 275 additions and 274 deletions.
7 changes: 3 additions & 4 deletions admin/themes/default/css/admin-theme.css

Large diffs are not rendered by default.

26 changes: 0 additions & 26 deletions admin/themes/default/css/overrides.css
Original file line number Diff line number Diff line change
@@ -1,28 +1,2 @@
/*This stylesheet should be used to add your custom styles to the back-office without using the Sass sources. It will be loaded after all the default styles. */
/*You should NOT edit any other exisiting back-office CSS file manually: they are generated by the Sass preprocessor: http://www.sass-lang.com/ . */

.datepicker2 {
background: #fff;
position: absolute;
z-index: 99999;
width: 14rem;
}

.bootstrap #datepicker .daterangepicker thead tr th {
color: #fff;
font-size: .8em;
height: 2.5em;
}

.bootstrap #datepicker .daterangepicker thead tr:first-child th {
font-size: 1.2em;
}

.form-date-actions {
bottom: -25px;
position: absolute;
width: 100%;
z-index: 999;
background-color: #fff;
border: solid 1px #ccc;
}
4 changes: 2 additions & 2 deletions admin/themes/default/js/date-range-picker.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@
month = d.getMonth(),
currentDate = this.date.valueOf();
this.picker.find('.daterangepicker-days th:eq(1)')
.text(year+' / '+DPGlobal.dates.months[month]).append('&nbsp;<small><i class="icon-angle-down"></i><small>');
.html(DPGlobal.dates.months[month]+'&nbsp;'+year).append('&nbsp;<small><i class="icon-angle-down"></i><small>');
var prevMonth = new Date(year, month-1, 28,0,0,0,0),
day = DPGlobal.getDaysInMonth(prevMonth.getFullYear(), prevMonth.getMonth());
prevMonth.setDate(day);
Expand Down Expand Up @@ -742,4 +742,4 @@
'</div>'+
'</div>';

}( window.jQuery );
}( window.jQuery );
3 changes: 3 additions & 0 deletions admin/themes/default/sass/admin-theme.sass
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,6 @@

//Print support
@import "partials/print"

//Add css
@import "partials/css"
155 changes: 155 additions & 0 deletions admin/themes/default/sass/partials/_css.sass
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
.datepicker2
background: #fff
position: absolute
z-index: 599
right: -10rem
.daterangepicker
border-radius: 5px 5px 0 0 !important
.bootstrap
#datepicker
.daterangepicker
thead
tr
th
padding: 0.7em 0.3em
text-align: center
font-weight: bold
border: 0
background-color: #fff !important
color: #555555 !important
font-size: 14px
text-transform: capitalize
&:first-child
th
font-size: unset
font-weight: bold
background-color: #00AFF0 !important
border: unset !important
color: #fff !important
padding: unset !important
text-transform: capitalize
.icon-angle-left
font-weight: bold
padding: 10px
.icon-angle-right
font-weight: bold
padding: 10px
th
&.prev
border-top-left-radius: 8px !important
border-bottom-left-radius: 8px !important
left: 2px
top: 3px
&.next
border-top-right-radius: 8px !important
border-bottom-right-radius: 8px !important
right: 2px
top: 3px
&.month-switch
top: 3px
td
padding: 5px 10px
color: #555
.ui-datepicker
width: auto !important
margin: 5px auto 0
width: auto !important
z-index: 1032 !important
.ui-datepicker-header
background-color: #00AFF0 !important
.ui-datepicker-title
color: #fff
font-style: normal
font-weight: bold
font-size: unset
thead
background-color: #f7f7f7
th
font-style: normal
font-size: 15px
line-height: 23px
color: #555555
tbody
td
&:last-child
border-right: 0px
tr
border-bottom: 1px solid #bbb
border: none
&:last-child
border-bottom: 0px
a
text-decoration: none
.form-date-actions .btn:hover, .form-date-actions .btn:focus, .form-date-actions .btn:active
outline: unset !important
text-decoration: none
.form-date-actions
bottom: -24px
position: absolute
width: 100%
z-index: 599
background-color: #fff
border: solid 1px #ccc
border-radius: 0 0 5px 5px
.ui-datepicker-prev
float: left
cursor: pointer
left: 15px !important
&::before
background-position: center -30px
font-weight: bold
font-size: 16px
color: #fff
content: "\f104"
font-family: FontAwesome
.ui-datepicker-next
float: right
cursor: pointer
&::before
background-position: center -30px
font-weight: bold
font-size: 16px
color: #fff
content: "\f105"
font-family: FontAwesome
&:hover
top: 5px !important
right: 2px !important
.ui-state-hover,
.ui-widget-content .ui-state-hover,
.ui-widget-header .ui-state-hover,
.ui-state-focus,
.ui-widget-content .ui-state-focus,
.ui-widget-header .ui-state-focus
border: unset
background: none
font-weight: none
color: none
.ui-datepicker td span,
.ui-datepicker td a
display: inline-block
text-align: center
line-height: 25px
color: #ffffff
.ui-datepicker .ui-datepicker-prev,
.ui-datepicker .ui-datepicker-next
top: 5px !important
.ui-state-default,
.ui-widget-content .ui-state-default,
.ui-widget-header .ui-state-default
border: none !important
.ui-widget-content
.ui-icon
background-image: none !important
.ui-datepicker td span, .ui-datepicker td a
text-align: center !important
padding: 4px 9px !important
.ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus
background: unset !important
border: unset !important
.ui-widget-content .ui-slider-handle, .ui-datepicker-current .ui-slider-handle
border: 1px solid #d3d3d3 !important
color: #555555 !important
background: #e6e6e6 url(images/ui-bg_glass_75_e6e6e6_1x400.png) !important
.ui-datepicker-prev-hover
top: unset !important
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
</script>

<div id="dashboard">
{$hookDashboardUnnamedOne}
{$hookDashboardTop}
<div class="row">
<div class="col-lg-12">
{if $warning}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ $(document).ready(function () {
<div class="form-group">
<div class="col-lg-1"><span class="pull-right">{include file="controllers/products/multishop/checkbox.tpl" field="wholesale_price" type="default"}</span></div>
<label class="control-label col-lg-2" for="wholesale_price">
<span class="label-tooltip" data-toggle="tooltip" title="{l s='The wholesale price is the price you paid for the room type. Do not include the tax.'}">{if !$country_display_tax_label || $tax_exclude_taxe_option}{l s='Wholesale price'}{else}{l s='Pre-tax wholesale price'}{/if}</span>
<span class="label-tooltip" data-toggle="tooltip" title="{l s='The operating cost is the expense related to the operation of the room type. Do not include the tax.'}">{if !$country_display_tax_label || $tax_exclude_taxe_option}{l s='Operating cost'}{else}{l s='Pre-tax operating cost'}{/if}</span>
</label>
<div class="col-lg-2">
<div class="input-group">
Expand Down
7 changes: 4 additions & 3 deletions controllers/admin/AdminDashboardController.php
Original file line number Diff line number Diff line change
Expand Up @@ -264,11 +264,11 @@ public function renderView()
$this->tpl_view_vars = array(
'date_from' => $this->context->employee->stats_date_from,
'date_to' => $this->context->employee->stats_date_to,
'hookDashboardTop' => Hook::exec('dashboardTop', $params),
'hookDashboardZoneOne' => Hook::exec('dashboardZoneOne', $params),
'hookDashboardZoneTwo' => Hook::exec('dashboardZoneTwo', $params),
'hookDashboardZoneThree' => Hook::exec('dashboardZoneThree', $params),
//'translations' => $translations,
'action' => '#',
'action' => self::$currentIndex,
'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 Down Expand Up @@ -324,6 +324,7 @@ public function postProcess()
}

$this->context->employee->update();
Tools::redirectAdmin(self::$currentIndex);
}
}

Expand Down Expand Up @@ -367,7 +368,7 @@ public function ajaxProcessRefreshDashboard()
'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'),
'extra' => (int)Tools::getValue('extra')
'extra' => Tools::getValue('extra')
);

die(json_encode(Hook::exec('dashboardData', $params, $id_module, true, true, (int)Tools::getValue('dashboard_use_push'))));
Expand Down
10 changes: 6 additions & 4 deletions controllers/admin/AdminStatsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -927,7 +927,7 @@ public static function getAvailBarChartData($days, $date_from)
$newFromDate = $date_from;
$availability_data = array();
$from = strtotime($date_from." 00:00:00");
$to = min(time(), strtotime($date_from."+".$days." day 23:59:59"));
$to = strtotime($date_from."+".$days." day 23:59:59");

for ($date = $from; $date <= $to; $date = strtotime("+1 days", $date)) {
$newFromDate = date('Y-m-d', strtotime($newFromDate.'+'.($days/5).'days'));
Expand Down Expand Up @@ -995,10 +995,12 @@ public static function getCancellationRate($dateFrom, $dateTo)
public static function getRevenue($dateFrom, $dateTo)
{
$result = Db::getInstance()->getValue(
'SELECT SUM(`total_paid_tax_excl` / `conversion_rate`)
FROM `'._DB_PREFIX_.'orders`
WHERE `invoice_date` BETWEEN "'.pSQL($dateFrom).' 00:00:00" AND "'.pSQL($dateTo).' 23:59:59"'
'SELECT (SUM(`total_paid_tax_excl` / `conversion_rate`) - SUM(`refunded_amount`))
FROM `'._DB_PREFIX_.'orders`
LEFT JOIN `' ._DB_PREFIX_.'order_return` ON '._DB_PREFIX_.'orders.`id_order` = '._DB_PREFIX_.'order_return.`id_order`
WHERE ' ._DB_PREFIX_.'orders.`invoice_date` BETWEEN "'.pSQL($dateFrom).' 00:00:00" AND "'.pSQL($dateTo).' 23:59:59"'
);

return Tools::displayPrice($result ? $result : 0);
}

Expand Down
4 changes: 2 additions & 2 deletions js/admin/dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ function saveDashConfig(widget_name) {
success: function(jsonData) {

if (!jsonData.has_errors) {
if (widget_name == 'dashactivity') {
if (in_array(widget_name, ['dashactivity', 'dashproducts'])) {
location.reload();
} else {
$('#' + widget_name).find('section').not('.dash_config').remove();
Expand Down Expand Up @@ -319,4 +319,4 @@ $(document).ready(function() {
}
});
});
});
});
3 changes: 2 additions & 1 deletion modules/dashactivity/views/js/dashactivity.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ function pie_chart_trends(widget_name, chart_details)
.x(function(d) { return d.key })
.y(function(d) { return d.y })
.color(d3.scale.category10().range())
.valueFormat(d3.format(".0f"))
.donut(true)
.showLabels(false)
.showLegend(false)
Expand Down Expand Up @@ -154,4 +155,4 @@ $(document).ready(function() {
$('#customers-newsletters-subtitle').html(sprintf(date_subtitle, start.format(date_format), end.format(date_format)));
$('#traffic-subtitle').html(sprintf(date_subtitle, start.format(date_format), end.format(date_format)));
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
</li>
<li>
<span class="item-label">
<a href="{$link->getAdminLink("AdminReturn")|escape:"html":"UTF-8"}" target="_blank">
<a href="{$link->getAdminLink("AdminOrderRefundRequests")|escape:"html":"UTF-8"}" target="_blank">
<span>{l s="Refunds" mod="dashactivity"}</span>
</a>
</span>
Expand Down
3 changes: 1 addition & 2 deletions modules/dashavailability/dashavailability.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@ public function hookDashboardData($params)
}
if (Configuration::get("PS_DASHBOARD_SIMULATION")) {
$from = strtotime($dateFrom." 00:00:00");
$to = min(time(), strtotime($dateFrom."+".$days." days 23:59:59"));

$to = strtotime($dateFrom."+".$days." days 23:59:59");
$data = array();
for ($date = $from; $date <= $to; $date = strtotime("+1 days", $date)) {
$availability_data["values"][] = array($date, round(rand(0, 20)));
Expand Down
Loading

0 comments on commit 63031e6

Please sign in to comment.