Updated: Use table in the tooltip
Co-authored-by: Name <sumit201@webkul.in>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/**
|
||||
{**
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License version 3.0
|
||||
@@ -18,16 +18,21 @@
|
||||
* @author Webkul IN
|
||||
* @copyright Since 2010 Webkul
|
||||
* @license https://opensource.org/license/osl-3-0-php Open Software License version 3.0
|
||||
*/
|
||||
*}
|
||||
|
||||
.qlo-stay-period-tooltip .tip-body {
|
||||
display: block;
|
||||
}
|
||||
.qlo-stay-period-tooltip .qlo-stay-period-row {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.qlo-stay-period-tooltip .qlo-stay-period-row-header {
|
||||
border-bottom: 1px solid #ddd;
|
||||
padding-bottom: 6px;
|
||||
}
|
||||
<div id="qlo-stay-period-tooltip-tpl" style="display:none">
|
||||
<div class="bootstrap tooltip_cont qlo-stay-period-tooltip">
|
||||
<div class="tip_header">
|
||||
<div>{l s='Stay Periods'}</div>
|
||||
</div>
|
||||
<table class="table qlo-stay-period-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="tip_element_head">{l s='Duration'}</th>
|
||||
<th class="tip_element_head">{l s='Rooms'}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody></tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
@@ -398,10 +398,7 @@ class AdminOrdersControllerCore extends AdminController
|
||||
|
||||
if ($uniqueStayPeriods > 1) {
|
||||
$stayPeriodHtml .= ' <span class="badge qlo-stay-period-badge"'
|
||||
.' data-stay-tip="'.htmlspecialchars(json_encode($stayPeriods)).'"'
|
||||
.' data-label-title="'.htmlspecialchars($this->l('Stay Periods')).'"'
|
||||
.' data-label-duration="'.htmlspecialchars($this->l('Duration')).'"'
|
||||
.' data-label-rooms="'.htmlspecialchars($this->l('Rooms')).'">+'
|
||||
.' data-stay-tip="'.htmlspecialchars(json_encode($stayPeriods)).'">+'
|
||||
.($uniqueStayPeriods - 1).'</span>';
|
||||
}
|
||||
return $stayPeriodHtml;
|
||||
@@ -1402,7 +1399,6 @@ class AdminOrdersControllerCore extends AdminController
|
||||
|
||||
if ($this->display != 'view') {
|
||||
$this->addJS(_PS_JS_DIR_.'admin/orders_stay_periods.js');
|
||||
$this->addCSS(__PS_BASE_URI__.$this->admin_webpath.'/themes/'.$this->bo_theme.'/css/controllers/order-stay-periods.css');
|
||||
}
|
||||
|
||||
if ($this->display == 'view') {
|
||||
@@ -1501,6 +1497,8 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$this->content .= $this->context->smarty->fetch('controllers/orders/_resolvable_overbookings.tpl');
|
||||
}
|
||||
|
||||
$this->content .= $this->context->smarty->fetch('controllers/orders/_stay_periods_tooltip.tpl');
|
||||
|
||||
if (Tools::isSubmit('submitBulkupdateOrderStatus'.$this->table)) {
|
||||
if (Tools::getIsset('cancel')) {
|
||||
Tools::redirectAdmin(self::$currentIndex.'&token='.$this->token);
|
||||
|
||||
@@ -33,28 +33,17 @@ $(document).ready(function () {
|
||||
$(this).tooltip({
|
||||
items: '.qlo-stay-period-badge',
|
||||
content: function () {
|
||||
var $badge = $(this);
|
||||
var periods = $badge.data('stay-tip');
|
||||
var periods = $(this).data('stay-tip');
|
||||
if (!periods || !periods.length) {
|
||||
return '';
|
||||
}
|
||||
var html = '<div class="tooltip_cont qlo-stay-period-tooltip">';
|
||||
html += '<div class="tip_header"><div class="tip_date">' + $badge.data('label-title') + '</div></div>';
|
||||
html += '<div class="tip-body">';
|
||||
html += '<div class="qlo-stay-period-row qlo-stay-period-row-header">'
|
||||
+ '<span class="tip_element_head">' + $badge.data('label-duration') + '</span>'
|
||||
+ '<span class="tip_element_head">' + $badge.data('label-rooms') + '</span>'
|
||||
+ '</div>';
|
||||
$.each(periods, function (_, p) {
|
||||
html += '<div class="qlo-stay-period-row">'
|
||||
+ '<span class="tip_element_value">' + p.from + ' – ' + p.to + '</span>'
|
||||
+ '<span class="tip_element_value">' + p.count + '</span>'
|
||||
+ '</div>';
|
||||
});
|
||||
html += '</div></div>';
|
||||
return html;
|
||||
var rows = $.map(periods, function (p) {
|
||||
return '<tr><td class="tip_element_value">' + p.from + ' – ' + p.to + '</td>'
|
||||
+ '<td class="tip_element_value">' + p.count + '</td></tr>';
|
||||
}).join('');
|
||||
$('#qlo-stay-period-tooltip-tpl tbody').html(rows);
|
||||
return $('#qlo-stay-period-tooltip-tpl').html();
|
||||
},
|
||||
position: { my: 'left top+10', at: 'left bottom', collision: 'flipfit', within: '#content' },
|
||||
close: function (event, ui) {
|
||||
ui.tooltip.hover(function () {
|
||||
$(this).stop(true).fadeTo(300, 1);
|
||||
|
||||
Reference in New Issue
Block a user