From 77f2d7740decc2a22d9315a8645c6ecc9998abad Mon Sep 17 00:00:00 2001 From: amit sharma Date: Fri, 14 Aug 2026 17:21:43 +0530 Subject: [PATCH 1/4] Fixed: centralize tooltip initialization Co-authored-by: Name --- admin/themes/default/img/icon-info.svg | 4 + admin/themes/default/js/admin-theme.js | 41 ++++++ .../default/sass/partials/_tooltip.sass | 29 ++++- .../template/controllers/orders/form.tpl | 1 + .../controllers/products/connected-rooms.tpl | 77 +++-------- .../default/template/helpers/tooltip.tpl | 36 +++++ .../AdminOrderRefundRequestsController.php | 1 - .../views/css/admin/wk_refund_request.css | 4 +- .../views/js/admin/hotel_rooms_booking.js | 123 +++--------------- .../views/js/admin/wk_refund_request.js | 39 ------ .../helpers/view/view.tpl | 16 +-- 11 files changed, 156 insertions(+), 215 deletions(-) create mode 100644 admin/themes/default/img/icon-info.svg create mode 100644 admin/themes/default/template/helpers/tooltip.tpl diff --git a/admin/themes/default/img/icon-info.svg b/admin/themes/default/img/icon-info.svg new file mode 100644 index 000000000..5d4d44d02 --- /dev/null +++ b/admin/themes/default/img/icon-info.svg @@ -0,0 +1,4 @@ + + + + diff --git a/admin/themes/default/js/admin-theme.js b/admin/themes/default/js/admin-theme.js index 1aa61350d..7136a41b3 100644 --- a/admin/themes/default/js/admin-theme.js +++ b/admin/themes/default/js/admin-theme.js @@ -479,3 +479,44 @@ $(document).ready(function() { $(this).prop('selected', false); }); }); //end dom ready + +function initTooltip($target, contentFn, items) { + var $elements = $target || $('.tooltip-trigger'); + if (!$elements.length) { + return; + } + $elements.each(function () { + var $this = $(this); + if (!contentFn && $this.data('ui-tooltip')) { + return; + } + $this.tooltip({ + content: contentFn || $this.next('.tooltip-content').html(), + items: items || 'span', + trigger: 'hover', + tooltipClass: 'tooltip-popup', + open: function (event, ui) { + if (event.buttons == 1 || event.buttons == 3) { + ui.tooltip.remove(); + } + if (typeof event.originalEvent === 'undefined') { + return false; + } + var $id = $(ui.tooltip).attr('id'); + if ($('div.ui-tooltip').not('#' + $id).length) { + return false; + } + }, + close: function (event, ui) { + ui.tooltip.hover( + function () { $(this).stop(true).fadeTo(300, 1); }, + function () { $(this).fadeOut(300, function () { $(this).remove(); }); } + ); + } + }); + }); +} + +$(document).ready(function () { + initTooltip(); +}); diff --git a/admin/themes/default/sass/partials/_tooltip.sass b/admin/themes/default/sass/partials/_tooltip.sass index 986d49667..d1f445386 100644 --- a/admin/themes/default/sass/partials/_tooltip.sass +++ b/admin/themes/default/sass/partials/_tooltip.sass @@ -1,5 +1,4 @@ .tooltip_cont - min-width: 280px width: 100% font-size: 14px font-weight: 600 @@ -7,6 +6,7 @@ margin-bottom: 10px .tip-body > div margin-bottom: 6px + margin-right: 10px .tip_element_head font-size: 12px @@ -28,3 +28,30 @@ border: none padding: 10px box-shadow: 0px 0px 15px 0px rgba(0, 0, 0, 0.15) + width: auto + +.tooltip-trigger + cursor: pointer + display: inline-block + vertical-align: middle + + + +.ui-tooltip.tooltip-popup + ul + margin: 0 + padding: 0 0 0 16px + list-style: disc + li + padding: 2px 0 + +.tooltip-popup-row + display: flex + justify-content: space-between + align-items: center + gap: 12px + margin: 3px 0 + white-space: nowrap + label + font-weight: 600 + margin: 0 diff --git a/admin/themes/default/template/controllers/orders/form.tpl b/admin/themes/default/template/controllers/orders/form.tpl index 1482462e9..378fd1d96 100644 --- a/admin/themes/default/template/controllers/orders/form.tpl +++ b/admin/themes/default/template/controllers/orders/form.tpl @@ -1396,6 +1396,7 @@ { $("#customer_cart_details").empty(); $("#customer_cart_details").append(res.cart_detail_html); + initTooltip(); displaySummary(res); } diff --git a/admin/themes/default/template/controllers/products/connected-rooms.tpl b/admin/themes/default/template/controllers/products/connected-rooms.tpl index 6017e4269..4da9bf497 100644 --- a/admin/themes/default/template/controllers/products/connected-rooms.tpl +++ b/admin/themes/default/template/controllers/products/connected-rooms.tpl @@ -20,63 +20,22 @@ * @license https://opensource.org/license/osl-3-0-php Open Software License version 3.0 *} {if isset($htl_connected_rooms) && $htl_connected_rooms|@count > 0} - - - + {capture name='connected_room_tooltip'} +
+
{l s='Connected Rooms'}
+
+ {foreach from=$htl_connected_rooms.connected_room_types item=group} +
+
{$group.room_type_name|escape:'html':'UTF-8'}
+
+ {foreach from=$group.connected_rooms item=room name=connected_rooms} + {$room.name|escape:'html':'UTF-8'}{if !$smarty.foreach.connected_rooms.last}, {/if} + {/foreach} +
+
+ {/foreach} +
+
+ {/capture} + {include file='helpers/tooltip.tpl' tooltip_content=$smarty.capture.connected_room_tooltip allow_html=true tooltip_icon_class='icon-random' tooltip_icon_style='color: #008abd;'} {/if} - diff --git a/admin/themes/default/template/helpers/tooltip.tpl b/admin/themes/default/template/helpers/tooltip.tpl new file mode 100644 index 000000000..ff07a3178 --- /dev/null +++ b/admin/themes/default/template/helpers/tooltip.tpl @@ -0,0 +1,36 @@ +{* +* 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 +*} + + + {if isset($tooltip_icon_class) && $tooltip_icon_class} + + {else} + + {/if} + + diff --git a/modules/hotelreservationsystem/controllers/admin/AdminOrderRefundRequestsController.php b/modules/hotelreservationsystem/controllers/admin/AdminOrderRefundRequestsController.php index 8edfba919..81fba0d1a 100644 --- a/modules/hotelreservationsystem/controllers/admin/AdminOrderRefundRequestsController.php +++ b/modules/hotelreservationsystem/controllers/admin/AdminOrderRefundRequestsController.php @@ -350,7 +350,6 @@ class AdminOrderRefundRequestsController extends ModuleAdminController 'isRefundCompleted' => $objOrderReturn->hasBeenCompleted(), 'paymentMethods' => $paymentMethods, 'name_controller' => Tools::getValue('controller'), - 'info_icon_path' => $this->context->link->getMediaLink(_MODULE_DIR_.'hotelreservationsystem/views/img/Slices/icon-info.svg'), 'expiry_date' => time() + (3600 * 24 * 365.25) ) ); diff --git a/modules/hotelreservationsystem/views/css/admin/wk_refund_request.css b/modules/hotelreservationsystem/views/css/admin/wk_refund_request.css index e3cd83c23..69fc03b56 100644 --- a/modules/hotelreservationsystem/views/css/admin/wk_refund_request.css +++ b/modules/hotelreservationsystem/views/css/admin/wk_refund_request.css @@ -24,9 +24,9 @@ body.adminorderrefundrequests .ui-tooltip { padding: 10px; box-shadow: 0px 0px 15px 0px #00000026; } -.ui-tooltip.price_info-tooltip span { +.ui-tooltip.tooltip-popup span { margin-left: 15px; } -.ui-tooltip.price_info-tooltip label { +.ui-tooltip.tooltip-popup label { font-weight: 600; } \ No newline at end of file diff --git a/modules/hotelreservationsystem/views/js/admin/hotel_rooms_booking.js b/modules/hotelreservationsystem/views/js/admin/hotel_rooms_booking.js index 225f08bd2..5c8025f2c 100644 --- a/modules/hotelreservationsystem/views/js/admin/hotel_rooms_booking.js +++ b/modules/hotelreservationsystem/views/js/admin/hotel_rooms_booking.js @@ -60,118 +60,34 @@ $(document).ready(function() { } else { $(info.el).closest('td').find('.day-info svg circle').attr('fill', '#FF3838'); } - $(info.el).closest('td').find('.day-info').tooltip({ - content: function() - { - $('#date-stats-tooltop .tip_date').text(info.event.extendedProps.data.date_format); - $.each(info.event.extendedProps.data.stats, function(elem, val) { - if (elem == 'num_part_avai') { - $('#date-stats-tooltop').find('.'+elem).hide().find('.tip_element_value').text(''); - } else { - $('#date-stats-tooltop').find('.'+elem).show().find('.tip_element_value').text(val); - } - }); - return $('#date-stats-tooltop').html(); - }, - items: "div", - trigger : 'hover', - show: { - delay: 100, - }, - hide: { - delay: 300, - }, - open: function(event, ui) - { - if(event.buttons == 1 || event.buttons == 3){ - ui.tooltip.remove(); - } - - if (typeof(event.originalEvent) === 'undefined') { - return false; - } - - var $id = $(ui.tooltip).attr('id'); - - // close any lingering tooltips - if ($('div.ui-tooltip').not('#' + $id).length) { - return false; - } - - // ajax function to pull in data and add it to the tooltip goes here - }, - close: function(event, ui) - { - ui.tooltip.hover(function() { - $(this).stop(true).fadeTo(300, 1); - }, - function() { - $(this).fadeOut('300', function() - { - $(this).remove(); - }); - }); - } - }); - info.event.remove(); - } else { - $(info.el).tooltip({ - content: function() - { - $('#date-stats-tooltop .tip_date').text(info.event.extendedProps.data.date_from_format + ' - ' +info.event.extendedProps.data.date_to_format); + initTooltip($(info.el).closest('td').find('.day-info'), function() { + $('#date-stats-tooltop .tip_date').text(info.event.extendedProps.data.date_format); $.each(info.event.extendedProps.data.stats, function(elem, val) { if (elem == 'num_part_avai') { - if (val > 0) { - $('#date-stats-tooltop').find('.'+elem).show().find('.tip_element_value').text(val); - } else { - $('#date-stats-tooltop').find('.'+elem).hide().find('.tip_element_value').text(''); - } + $('#date-stats-tooltop').find('.'+elem).hide().find('.tip_element_value').text(''); } else { - $('#date-stats-tooltop').find('.'+elem).find('.tip_element_value').text(val); + $('#date-stats-tooltop').find('.'+elem).show().find('.tip_element_value').text(val); } }); return $('#date-stats-tooltop').html(); - }, - items: "div", - trigger : 'hover', - show: { - delay: 100, - }, - hide: { - delay: 300, - }, - open: function(event, ui) - { - if(event.buttons == 1 || event.buttons == 3){ - ui.tooltip.remove(); - } - - if (typeof(event.originalEvent) === 'undefined') { - return false; + }, 'div'); + info.event.remove(); + } else { + initTooltip($(info.el), function() { + $('#date-stats-tooltop .tip_date').text(info.event.extendedProps.data.date_from_format + ' - ' +info.event.extendedProps.data.date_to_format); + $.each(info.event.extendedProps.data.stats, function(elem, val) { + if (elem == 'num_part_avai') { + if (val > 0) { + $('#date-stats-tooltop').find('.'+elem).show().find('.tip_element_value').text(val); + } else { + $('#date-stats-tooltop').find('.'+elem).hide().find('.tip_element_value').text(''); } - - var $id = $(ui.tooltip).attr('id'); - - // close any lingering tooltips - if ($('div.ui-tooltip').not('#' + $id).length) { - return false; - } - - // ajax function to pull in data and add it to the tooltip goes here - }, - close: function(event, ui) - { - ui.tooltip.hover(function() { - $(this).stop(true).fadeTo(300, 1); - }, - function() { - $(this).fadeOut('300', function() - { - $(this).remove(); - }); - }); + } else { + $('#date-stats-tooltop').find('.'+elem).find('.tip_element_value').text(val); } }); + return $('#date-stats-tooltop').html(); + }, 'div'); } }, dayCellDidMount: (arg) => { @@ -515,6 +431,7 @@ $(document).ready(function() { } else { showSuccessMessage(removed_room_success_txt); $("#htl_rooms_list").empty().append(result.data.room_tpl); + initTooltip(); refreshCartData(); refreshStatsData(); calendar.refetchEvents(); diff --git a/modules/hotelreservationsystem/views/js/admin/wk_refund_request.js b/modules/hotelreservationsystem/views/js/admin/wk_refund_request.js index 7bf27b61f..a74ad4bf1 100644 --- a/modules/hotelreservationsystem/views/js/admin/wk_refund_request.js +++ b/modules/hotelreservationsystem/views/js/admin/wk_refund_request.js @@ -41,45 +41,6 @@ $(document).ready(function() { $('#voucher_expiry').parent().removeClass('has-error'); }); - // initialize tootip for room price - if ($('#rooms_refund_info .price_info').length) { - $('#rooms_refund_info .price_info').each(function (i, element) { - $(this).find('img').tooltip({ - content: $(this).closest('td').find('.price_info_container').html(), - items: "span", - trigger : 'hover', - tooltipClass: "price_info-tooltip", - open: function(event, ui) - { - if (typeof(event.originalEvent) === 'undefined') - { - return false; - } - - var $id = $(ui.tooltip).attr('id'); - - if ($('div.ui-tooltip').not('#' + $id).length) { - return false; - } - }, - close: function(event, ui) - { - ui.tooltip.hover(function() - { - $(this).stop(true).fadeTo(400, 1); - }, - function() - { - $(this).fadeOut('400', function() - { - $(this).remove(); - }); - }); - } - }); - }); - } - $(document).on('change', '#refundTransactionAmount', function() { if ($(this).is(':checked')) { $(".refund_transaction_fields").show(200); diff --git a/modules/hotelreservationsystem/views/templates/admin/order_refund_requests/helpers/view/view.tpl b/modules/hotelreservationsystem/views/templates/admin/order_refund_requests/helpers/view/view.tpl index d8cadf9e9..3847481bf 100644 --- a/modules/hotelreservationsystem/views/templates/admin/order_refund_requests/helpers/view/view.tpl +++ b/modules/hotelreservationsystem/views/templates/admin/order_refund_requests/helpers/view/view.tpl @@ -171,10 +171,7 @@ {dateFormat date=$booking['date_from'] full=$is_full_date} {l s='To' mod='hotelreservationsystem'} {dateFormat date=$booking['date_to'] full=$is_full_date} {displayPrice price=($booking['total_price_tax_incl'] + $booking['extra_service_total_price_tax_incl']) currency=$orderCurrency['id']} - -   - - + {/capture} + {include file='helpers/tooltip.tpl' tooltip_content=$smarty.capture.refund_total_tooltip allow_html=true} {displayPrice price=($booking['room_paid_amount'] + $booking['extra_service_total_paid_amount']) currency=$orderCurrency['id']} - -   - - + {/capture} + {include file='helpers/tooltip.tpl' tooltip_content=$smarty.capture.refund_paid_tooltip allow_html=true} {if !$isRefundCompleted} From 2329fa80c6c1e1ef3a7ca5652178634c3f7ae55b Mon Sep 17 00:00:00 2001 From: azhar bhat Date: Mon, 17 Aug 2026 19:54:14 +0530 Subject: [PATCH 2/4] code optimized --- admin/themes/default/js/admin-theme.js | 7 +- .../controllers/products/connected-rooms.tpl | 2 +- .../default/template/helpers/tooltip.tpl | 16 ++- .../views/js/admin/hotel_rooms_booking.js | 115 +++++++++--------- .../helpers/view/view.tpl | 4 +- 5 files changed, 77 insertions(+), 67 deletions(-) diff --git a/admin/themes/default/js/admin-theme.js b/admin/themes/default/js/admin-theme.js index 7136a41b3..04acc90b5 100644 --- a/admin/themes/default/js/admin-theme.js +++ b/admin/themes/default/js/admin-theme.js @@ -478,6 +478,7 @@ $(document).ready(function() { $('.no-htl-access-option').on('click', function() { $(this).prop('selected', false); }); + initTooltip(); }); //end dom ready function initTooltip($target, contentFn, items) { @@ -515,8 +516,4 @@ function initTooltip($target, contentFn, items) { } }); }); -} - -$(document).ready(function () { - initTooltip(); -}); +} \ No newline at end of file diff --git a/admin/themes/default/template/controllers/products/connected-rooms.tpl b/admin/themes/default/template/controllers/products/connected-rooms.tpl index 4da9bf497..5fe24f98c 100644 --- a/admin/themes/default/template/controllers/products/connected-rooms.tpl +++ b/admin/themes/default/template/controllers/products/connected-rooms.tpl @@ -37,5 +37,5 @@ {/capture} - {include file='helpers/tooltip.tpl' tooltip_content=$smarty.capture.connected_room_tooltip allow_html=true tooltip_icon_class='icon-random' tooltip_icon_style='color: #008abd;'} + {include file='helpers/tooltip.tpl' tooltip_content=$smarty.capture.connected_room_tooltip tooltip_icon_class='icon-random' tooltip_icon_style='color: #008abd;' } {/if} diff --git a/admin/themes/default/template/helpers/tooltip.tpl b/admin/themes/default/template/helpers/tooltip.tpl index ff07a3178..2f5571204 100644 --- a/admin/themes/default/template/helpers/tooltip.tpl +++ b/admin/themes/default/template/helpers/tooltip.tpl @@ -21,16 +21,24 @@ *} - {if isset($tooltip_icon_class) && $tooltip_icon_class} + {if isset($tooltip_trigger_html) && $tooltip_trigger_html} + {$tooltip_trigger_html nofilter} + {elseif isset($tooltip_title) && $tooltip_title} + + {if isset($tooltip_icon_class) && $tooltip_icon_class} + + {/if} + {$tooltip_title|escape:'html':'UTF-8'} + {elseif isset($tooltip_icon_class) && $tooltip_icon_class} {else} {/if} diff --git a/modules/hotelreservationsystem/views/js/admin/hotel_rooms_booking.js b/modules/hotelreservationsystem/views/js/admin/hotel_rooms_booking.js index 056fff315..79d4bb846 100644 --- a/modules/hotelreservationsystem/views/js/admin/hotel_rooms_booking.js +++ b/modules/hotelreservationsystem/views/js/admin/hotel_rooms_booking.js @@ -23,7 +23,8 @@ $(document).ready(function() { // calender - if ($('#fullcalendar').length) { + + if ($('#fullcalendar').length) { var calendar = new FullCalendar.Calendar($('#fullcalendar').get(0), { initialView: 'dayGridMonth', initialDate: initialDate, @@ -53,66 +54,70 @@ $(document).ready(function() { if (info.event.extendedProps.is_notification) { var $cell = $(info.el).closest('td'); $cell.css('background-color', info.event.backgroundColor); - initTooltip($cell, function() { - $('#date-stats-tooltop .tip_date').text(info.event.extendedProps.data.date_format); - $.each(info.event.extendedProps.data.stats, function(elem, val) { - if (elem == 'num_part_avai') { - $('#date-stats-tooltop').find('.'+elem).hide().find('.tip_element_value').text(''); - } else { - $('#date-stats-tooltop').find('.'+elem).show().find('.tip_element_value').text(val); + if (typeof initTooltip === 'function') { + initTooltip($cell, function() { + $('#date-stats-tooltop .tip_date').text(info.event.extendedProps.data.date_format); + $.each(info.event.extendedProps.data.stats, function(elem, val) { + if (elem == 'num_part_avai') { + $('#date-stats-tooltop').find('.'+elem).hide().find('.tip_element_value').text(''); + } else { + $('#date-stats-tooltop').find('.'+elem).show().find('.tip_element_value').text(val); + } + }); + return $('#date-stats-tooltop').html(); + }, 'td'); + $cell.tooltip('option', { + position: { + my: "left top", + at: "left+50% bottom-50%", + collision: "flipfit" + }, + open: function(event, ui) + { + if(event.buttons == 1 || event.buttons == 3){ + ui.tooltip.remove(); + } + + if (typeof(event.originalEvent) === 'undefined') { + return false; + } + + // suppress cell tooltip when hovering the search result bar + if ($(event.originalEvent.target).closest('.search-result-event').length) { + ui.tooltip.remove(); + $(this).removeData('ui-tooltip-id').removeAttr('aria-describedby'); + return false; + } + + var $id = $(ui.tooltip).attr('id'); + + // close any lingering tooltips + if ($('div.ui-tooltip').not('#' + $id).length) { + return false; + } } }); - return $('#date-stats-tooltop').html(); - }, 'td'); - $cell.tooltip('option', { - position: { - my: "left top", - at: "left+50% bottom-50%", - collision: "flipfit" - }, - open: function(event, ui) - { - if(event.buttons == 1 || event.buttons == 3){ - ui.tooltip.remove(); - } - - if (typeof(event.originalEvent) === 'undefined') { - return false; - } - - // suppress cell tooltip when hovering the search result bar - if ($(event.originalEvent.target).closest('.search-result-event').length) { - ui.tooltip.remove(); - $(this).removeData('ui-tooltip-id').removeAttr('aria-describedby'); - return false; - } - - var $id = $(ui.tooltip).attr('id'); - - // close any lingering tooltips - if ($('div.ui-tooltip').not('#' + $id).length) { - return false; - } - } - }); + } } else { $(info.el).addClass('search-result-event'); - initTooltip($(info.el), function() { - $('#date-stats-tooltop .tip_date').text(info.event.extendedProps.data.date_from_format + ' - ' +info.event.extendedProps.data.date_to_format); - $.each(info.event.extendedProps.data.stats, function(elem, val) { - if (elem == 'num_part_avai') { - if (val > 0) { - $('#date-stats-tooltop').find('.'+elem).show().find('.tip_element_value').text(val); + if (typeof initTooltip === 'function') { + initTooltip($(info.el), function() { + $('#date-stats-tooltop .tip_date').text(info.event.extendedProps.data.date_from_format + ' - ' +info.event.extendedProps.data.date_to_format); + $.each(info.event.extendedProps.data.stats, function(elem, val) { + if (elem == 'num_part_avai') { + if (val > 0) { + $('#date-stats-tooltop').find('.'+elem).show().find('.tip_element_value').text(val); + } else { + $('#date-stats-tooltop').find('.'+elem).hide().find('.tip_element_value').text(''); + } } else { - $('#date-stats-tooltop').find('.'+elem).hide().find('.tip_element_value').text(''); + $('#date-stats-tooltop').find('.'+elem).find('.tip_element_value').text(val); } - } else { - $('#date-stats-tooltop').find('.'+elem).find('.tip_element_value').text(val); - } - }); - return $('#date-stats-tooltop').html(); - }, 'div'); - $(info.el).tooltip('option', 'track', true); + }); + return $('#date-stats-tooltop').html(); + }, 'div'); + $(info.el).tooltip('option', 'track', true); + } info.el.style.borderLeftColor = info.event.extendedProps.data.eventColor; resizeSearchResultEventBar($(info.el)); } diff --git a/modules/hotelreservationsystem/views/templates/admin/order_refund_requests/helpers/view/view.tpl b/modules/hotelreservationsystem/views/templates/admin/order_refund_requests/helpers/view/view.tpl index 3847481bf..79ea77d21 100644 --- a/modules/hotelreservationsystem/views/templates/admin/order_refund_requests/helpers/view/view.tpl +++ b/modules/hotelreservationsystem/views/templates/admin/order_refund_requests/helpers/view/view.tpl @@ -181,7 +181,7 @@ {displayPrice price=$booking['extra_service_total_price_tax_incl'] currency=$orderCurrency['id']} {/capture} - {include file='helpers/tooltip.tpl' tooltip_content=$smarty.capture.refund_total_tooltip allow_html=true} + {include file='helpers/tooltip.tpl' tooltip_content=$smarty.capture.refund_total_tooltip} {displayPrice price=($booking['room_paid_amount'] + $booking['extra_service_total_paid_amount']) currency=$orderCurrency['id']} @@ -195,7 +195,7 @@ {displayPrice price=$booking['extra_service_total_paid_amount'] currency=$orderCurrency['id']} {/capture} - {include file='helpers/tooltip.tpl' tooltip_content=$smarty.capture.refund_paid_tooltip allow_html=true} + {include file='helpers/tooltip.tpl' tooltip_content=$smarty.capture.refund_paid_tooltip } {if !$isRefundCompleted} From 329e3023e8fa22ddee71f554a1076cacbd8ad170 Mon Sep 17 00:00:00 2001 From: azhar bhat Date: Mon, 17 Aug 2026 20:43:43 +0530 Subject: [PATCH 3/4] fix: code optimization --- admin/themes/default/js/modernizr-loads.js | 8 +- .../default/template/helpers/tooltip.tpl | 10 +- .../views/js/admin/hotel_rooms_booking.js | 126 +++++++++--------- 3 files changed, 73 insertions(+), 71 deletions(-) diff --git a/admin/themes/default/js/modernizr-loads.js b/admin/themes/default/js/modernizr-loads.js index aa738e542..2009122da 100644 --- a/admin/themes/default/js/modernizr-loads.js +++ b/admin/themes/default/js/modernizr-loads.js @@ -3,6 +3,10 @@ Modernizr.load([ test: window.matchMedia, nope: ["themes/default/js/vendor/matchMedia.js", "themes/default/js/vendor/matchMedia.addListener.js"] }, - "themes/default/js/vendor/enquire.min.js", - "themes/default/js/admin-theme.js", + { + load: ["themes/default/js/vendor/enquire.min.js", "themes/default/js/admin-theme.js"], + complete: function() { + $(document).trigger('QloApps:adminThemeReady'); + } + } ]); \ No newline at end of file diff --git a/admin/themes/default/template/helpers/tooltip.tpl b/admin/themes/default/template/helpers/tooltip.tpl index 2f5571204..dde9e5866 100644 --- a/admin/themes/default/template/helpers/tooltip.tpl +++ b/admin/themes/default/template/helpers/tooltip.tpl @@ -21,14 +21,8 @@ *} - {if isset($tooltip_trigger_html) && $tooltip_trigger_html} - {$tooltip_trigger_html nofilter} - {elseif isset($tooltip_title) && $tooltip_title} - - {if isset($tooltip_icon_class) && $tooltip_icon_class} - - {/if} - {$tooltip_title|escape:'html':'UTF-8'} + {if isset($tooltip_title) && $tooltip_title} + {$tooltip_title nofilter} {elseif isset($tooltip_icon_class) && $tooltip_icon_class} {else} diff --git a/modules/hotelreservationsystem/views/js/admin/hotel_rooms_booking.js b/modules/hotelreservationsystem/views/js/admin/hotel_rooms_booking.js index 79d4bb846..5017805f5 100644 --- a/modules/hotelreservationsystem/views/js/admin/hotel_rooms_booking.js +++ b/modules/hotelreservationsystem/views/js/admin/hotel_rooms_booking.js @@ -23,9 +23,9 @@ $(document).ready(function() { // calender - - if ($('#fullcalendar').length) { - var calendar = new FullCalendar.Calendar($('#fullcalendar').get(0), { + var calendar; + function initBookingCalendar() { + calendar = new FullCalendar.Calendar($('#fullcalendar').get(0), { initialView: 'dayGridMonth', initialDate: initialDate, events: { @@ -54,70 +54,66 @@ $(document).ready(function() { if (info.event.extendedProps.is_notification) { var $cell = $(info.el).closest('td'); $cell.css('background-color', info.event.backgroundColor); - if (typeof initTooltip === 'function') { - initTooltip($cell, function() { - $('#date-stats-tooltop .tip_date').text(info.event.extendedProps.data.date_format); - $.each(info.event.extendedProps.data.stats, function(elem, val) { - if (elem == 'num_part_avai') { - $('#date-stats-tooltop').find('.'+elem).hide().find('.tip_element_value').text(''); - } else { - $('#date-stats-tooltop').find('.'+elem).show().find('.tip_element_value').text(val); - } - }); - return $('#date-stats-tooltop').html(); - }, 'td'); - $cell.tooltip('option', { - position: { - my: "left top", - at: "left+50% bottom-50%", - collision: "flipfit" - }, - open: function(event, ui) - { - if(event.buttons == 1 || event.buttons == 3){ - ui.tooltip.remove(); - } - - if (typeof(event.originalEvent) === 'undefined') { - return false; - } - - // suppress cell tooltip when hovering the search result bar - if ($(event.originalEvent.target).closest('.search-result-event').length) { - ui.tooltip.remove(); - $(this).removeData('ui-tooltip-id').removeAttr('aria-describedby'); - return false; - } - - var $id = $(ui.tooltip).attr('id'); - - // close any lingering tooltips - if ($('div.ui-tooltip').not('#' + $id).length) { - return false; - } + initTooltip($cell, function() { + $('#date-stats-tooltop .tip_date').text(info.event.extendedProps.data.date_format); + $.each(info.event.extendedProps.data.stats, function(elem, val) { + if (elem == 'num_part_avai') { + $('#date-stats-tooltop').find('.'+elem).hide().find('.tip_element_value').text(''); + } else { + $('#date-stats-tooltop').find('.'+elem).show().find('.tip_element_value').text(val); } }); - } + return $('#date-stats-tooltop').html(); + }, 'td'); + $cell.tooltip('option', { + position: { + my: "left top", + at: "left+50% bottom-50%", + collision: "flipfit" + }, + open: function(event, ui) + { + if(event.buttons == 1 || event.buttons == 3){ + ui.tooltip.remove(); + } + + if (typeof(event.originalEvent) === 'undefined') { + return false; + } + + // suppress cell tooltip when hovering the search result bar + if ($(event.originalEvent.target).closest('.search-result-event').length) { + ui.tooltip.remove(); + $(this).removeData('ui-tooltip-id').removeAttr('aria-describedby'); + return false; + } + + var $id = $(ui.tooltip).attr('id'); + + // close any lingering tooltips + if ($('div.ui-tooltip').not('#' + $id).length) { + return false; + } + } + }); } else { $(info.el).addClass('search-result-event'); - if (typeof initTooltip === 'function') { - initTooltip($(info.el), function() { - $('#date-stats-tooltop .tip_date').text(info.event.extendedProps.data.date_from_format + ' - ' +info.event.extendedProps.data.date_to_format); - $.each(info.event.extendedProps.data.stats, function(elem, val) { - if (elem == 'num_part_avai') { - if (val > 0) { - $('#date-stats-tooltop').find('.'+elem).show().find('.tip_element_value').text(val); - } else { - $('#date-stats-tooltop').find('.'+elem).hide().find('.tip_element_value').text(''); - } + initTooltip($(info.el), function() { + $('#date-stats-tooltop .tip_date').text(info.event.extendedProps.data.date_from_format + ' - ' +info.event.extendedProps.data.date_to_format); + $.each(info.event.extendedProps.data.stats, function(elem, val) { + if (elem == 'num_part_avai') { + if (val > 0) { + $('#date-stats-tooltop').find('.'+elem).show().find('.tip_element_value').text(val); } else { - $('#date-stats-tooltop').find('.'+elem).find('.tip_element_value').text(val); + $('#date-stats-tooltop').find('.'+elem).hide().find('.tip_element_value').text(''); } - }); - return $('#date-stats-tooltop').html(); - }, 'div'); - $(info.el).tooltip('option', 'track', true); - } + } else { + $('#date-stats-tooltop').find('.'+elem).find('.tip_element_value').text(val); + } + }); + return $('#date-stats-tooltop').html(); + }, 'div'); + $(info.el).tooltip('option', 'track', true); info.el.style.borderLeftColor = info.event.extendedProps.data.eventColor; resizeSearchResultEventBar($(info.el)); } @@ -141,6 +137,14 @@ $(document).ready(function() { }); } + if ($('#fullcalendar').length) { + if (typeof initTooltip === 'function') { + initBookingCalendar(); + } else { + $(document).on('QloApps:adminThemeReady', initBookingCalendar); + } + } + function resizeSearchResultEventBar($bar) { requestAnimationFrame(function() { var $td = $bar.closest('td'); From fec4938fc031b0b14eed3fa2bc2c94c997cec956 Mon Sep 17 00:00:00 2001 From: azhar bhat Date: Tue, 18 Aug 2026 12:24:47 +0530 Subject: [PATCH 4/4] Correct: function names Co-authored-by: Name --- admin/themes/default/js/modernizr-loads.js | 2 +- .../views/js/admin/hotel_rooms_booking.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/admin/themes/default/js/modernizr-loads.js b/admin/themes/default/js/modernizr-loads.js index 2009122da..f4142963e 100644 --- a/admin/themes/default/js/modernizr-loads.js +++ b/admin/themes/default/js/modernizr-loads.js @@ -6,7 +6,7 @@ Modernizr.load([ { load: ["themes/default/js/vendor/enquire.min.js", "themes/default/js/admin-theme.js"], complete: function() { - $(document).trigger('QloApps:adminThemeReady'); + $(document).trigger('admin-theme.js.ready'); } } ]); \ No newline at end of file diff --git a/modules/hotelreservationsystem/views/js/admin/hotel_rooms_booking.js b/modules/hotelreservationsystem/views/js/admin/hotel_rooms_booking.js index 5017805f5..8d37728d8 100644 --- a/modules/hotelreservationsystem/views/js/admin/hotel_rooms_booking.js +++ b/modules/hotelreservationsystem/views/js/admin/hotel_rooms_booking.js @@ -141,7 +141,7 @@ $(document).ready(function() { if (typeof initTooltip === 'function') { initBookingCalendar(); } else { - $(document).on('QloApps:adminThemeReady', initBookingCalendar); + $(document).on('admin-theme.js.ready', initBookingCalendar); } }