Update the tooltip according the core

Co-authored-by: Name <sumit201@webkul.in>
This commit is contained in:
aradhana kumari
2026-08-17 20:08:46 +05:30
parent 6bcc7987c4
commit 99a38d620e
3 changed files with 19 additions and 76 deletions

View File

@@ -20,19 +20,28 @@
* @license https://opensource.org/license/osl-3-0-php Open Software License version 3.0
*}
<div id="qlo-stay-period-tooltip-tpl" style="display:none">
<div class="bootstrap tooltip_cont qlo-stay-period-tooltip">
{capture name='stay_periods_tooltip'}
<div class="bootstrap tooltip_cont">
<div class="tip_header">
<div>{l s='Stay Periods'}</div>
</div>
<table class="table qlo-stay-period-table">
<table class="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>
<tbody>
{foreach from=$stay_periods item=stay_period}
<tr>
<td class="tip_element_value">{$stay_period.from} &ndash; {$stay_period.to}</td>
<td class="tip_element_value center">{$stay_period.count}</td>
</tr>
{/foreach}
</tbody>
</table>
</div>
</div>
{/capture}
<span class="badge tooltip-trigger">+{$extra_stay_periods_count}</span>
<div class="tooltip-content" style="display: none;">{$smarty.capture.stay_periods_tooltip nofilter}</div>

View File

@@ -397,9 +397,11 @@ class AdminOrdersControllerCore extends AdminController
$uniqueStayPeriods = count($stayPeriods);
if ($uniqueStayPeriods > 1) {
$stayPeriodHtml .= ' <span class="badge qlo-stay-period-badge"'
.' data-stay-tip="'.htmlspecialchars(json_encode($stayPeriods)).'">+'
.($uniqueStayPeriods - 1).'</span>';
$this->context->smarty->assign(array(
'stay_periods' => $stayPeriods,
'extra_stay_periods_count' => $uniqueStayPeriods - 1,
));
$stayPeriodHtml .= ' '.$this->createTemplate('_stay_periods_tooltip.tpl')->fetch();
}
return $stayPeriodHtml;
}
@@ -1422,10 +1424,6 @@ class AdminOrdersControllerCore extends AdminController
$this->addJqueryUI('ui.tooltip', 'base', true);
$this->addJS(_PS_JS_DIR_.'vendor/d3.v3.min.js');
if ($this->display != 'view') {
$this->addJS(_PS_JS_DIR_.'admin/orders_stay_periods.js');
}
if ($this->display == 'view') {
if ($this->loadObject()) {
$this->addJS(_PS_JS_DIR_.'admin/orders.js');
@@ -1522,8 +1520,6 @@ 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);

View File

@@ -1,62 +0,0 @@
/*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License version 3.0
* that is bundled with this package in the file LICENSE.md
* It is also available through the world-wide-web at this URL:
* https://opensource.org/license/osl-3-0-php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to support@qloapps.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade this module to a newer
* versions in the future. If you wish to customize this module for your needs
* please refer to https://store.webkul.com/customisation-guidelines for more information.
*
* @author Webkul IN
* @copyright Since 2010 Webkul
* @license https://opensource.org/license/osl-3-0-php Open Software License version 3.0
*/
$(document).ready(function () {
if (typeof window.initStayPeriodTooltips === 'undefined') {
window.initStayPeriodTooltips = function () {
if (typeof $.fn.tooltip === 'undefined' || typeof $.ui === 'undefined' || typeof $.ui.tooltip === 'undefined') {
return;
}
$('.qlo-stay-period-badge').each(function () {
if ($(this).data('ui-tooltip')) {
return;
}
$(this).tooltip({
items: '.qlo-stay-period-badge',
content: function () {
var periods = $(this).data('stay-tip');
if (!periods || !periods.length) {
return '';
}
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();
},
close: function (event, ui) {
ui.tooltip.hover(function () {
$(this).stop(true).fadeTo(300, 1);
},
function () {
$(this).fadeOut('300', function () {
$(this).remove();
});
});
}
});
});
};
}
window.initStayPeriodTooltips();
});