From 9d67f5fc6341a7a3a873e10a749ae2fec84d0728 Mon Sep 17 00:00:00 2001 From: aradhana kumari Date: Fri, 22 May 2026 14:51:47 +0530 Subject: [PATCH 01/35] Added: Arrival Date and Departure Date in order list Co-authored-by: Name --- controllers/admin/AdminOrdersController.php | 38 ++++++++++++++++++--- 1 file changed, 34 insertions(+), 4 deletions(-) diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index f6c236c59..bbb6241a4 100644 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -72,6 +72,8 @@ class AdminOrdersControllerCore extends AdminController ) FROM `'._DB_PREFIX_.'htl_booking_detail` hbd WHERE hbd.`id_order` = a.`id_order`) as total_guests, (SELECT SUM(DATEDIFF(hbd.`date_to`, hbd.`date_from`)) FROM `'._DB_PREFIX_.'htl_booking_detail` hbd WHERE hbd.`id_order` = a.`id_order`) as los, hbd.`id_room` AS id_room_information, + (SELECT GROUP_CONCAT(DISTINCT hbd.`date_from` ORDER BY hbd.`date_from` SEPARATOR \', \') FROM `'._DB_PREFIX_.'htl_booking_detail` hbd WHERE hbd.`id_order` = a.`id_order`) AS date_from, + (SELECT GROUP_CONCAT(DISTINCT hbd.`date_to` ORDER BY hbd.`date_to` SEPARATOR \', \') FROM `'._DB_PREFIX_.'htl_booking_detail` hbd WHERE hbd.`id_order` = a.`id_order`) AS date_to, (SELECT COUNT(spod.`id_service_product_order_detail`) FROM `'._DB_PREFIX_.'service_product_order_detail` spod WHERE spod.`id_order` = a.`id_order` AND spod.`id_htl_booking_detail`=0) as num_products'; $this->_join = ' @@ -185,16 +187,20 @@ class AdminOrdersControllerCore extends AdminController 'displayed' => false, ), 'date_from' => array( - 'title' => $this->l('Check-in'), + 'title' => $this->l('Check-in date'), 'filter_key' => 'hbd!date_from', - 'type'=>'date', - 'displayed' => false, + 'type' => 'date', + 'callback' => 'formatCheckInDates', + 'optional' => true, + 'displayed' => true, ), 'date_to' => array( 'title' => $this->l('Check-out'), 'filter_key' => 'hbd!date_to', 'type'=>'date', - 'displayed' => false, + 'callback' => 'formatCheckOutDates', + 'optional' => true, + 'displayed' => true, ), 'total_guests' => array( 'title' => $this->l('Guests'), @@ -359,6 +365,30 @@ class AdminOrdersControllerCore extends AdminController return Tools::displayPrice($echo, (int)$idCurrency); } + public function formatCheckInDates($dates, $row) + { + if (empty($dates)) { + return '--'; + } + $formatted = array(); + foreach (explode(', ', $dates) as $date) { + $formatted[] = Tools::displayDate(trim($date)); + } + return implode(', ', $formatted); + } + + public function formatCheckOutDates($dates, $row) + { + if (empty($dates)) { + return '--'; + } + $formatted = array(); + foreach (explode(', ', $dates) as $date) { + $formatted[] = Tools::displayDate(trim($date)); + } + return implode(', ', $formatted); + } + public function initPageHeaderToolbar() { if (empty($this->display)) { From 3d35223af38d2849120f6e235778d6684e3233ac Mon Sep 17 00:00:00 2001 From: aradhana kumari Date: Fri, 22 May 2026 14:54:19 +0530 Subject: [PATCH 02/35] Add the text in the checkout date Co-authored-by: Name --- controllers/admin/AdminOrdersController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index bbb6241a4..caf5f1b7e 100644 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -195,7 +195,7 @@ class AdminOrdersControllerCore extends AdminController 'displayed' => true, ), 'date_to' => array( - 'title' => $this->l('Check-out'), + 'title' => $this->l('Check-out date'), 'filter_key' => 'hbd!date_to', 'type'=>'date', 'callback' => 'formatCheckOutDates', From f86c618de054bce6c3a5d4ea1ff5f51c3d063c63 Mon Sep 17 00:00:00 2001 From: aradhana kumari Date: Fri, 12 Jun 2026 16:43:34 +0530 Subject: [PATCH 03/35] Add the Stay periods --- .../orders/_stay_periods_tooltip.tpl | 49 ++++++++++++ controllers/admin/AdminOrdersController.php | 63 +++++++++------ js/admin/orders_stay_periods.js | 80 +++++++++++++++++++ 3 files changed, 168 insertions(+), 24 deletions(-) create mode 100644 admin/themes/default/template/controllers/orders/_stay_periods_tooltip.tpl create mode 100644 js/admin/orders_stay_periods.js diff --git a/admin/themes/default/template/controllers/orders/_stay_periods_tooltip.tpl b/admin/themes/default/template/controllers/orders/_stay_periods_tooltip.tpl new file mode 100644 index 000000000..c75f4be77 --- /dev/null +++ b/admin/themes/default/template/controllers/orders/_stay_periods_tooltip.tpl @@ -0,0 +1,49 @@ +{* + * Hidden template used by orders_stay_periods.js to build the Stay Periods + * jQuery UI tooltip. The JS clones .tooltip_cont, populates .tip-body + * with the period rows, and passes the result as the tooltip content. + *} + + diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index caf5f1b7e..6c40ed276 100644 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -72,8 +72,7 @@ class AdminOrdersControllerCore extends AdminController ) FROM `'._DB_PREFIX_.'htl_booking_detail` hbd WHERE hbd.`id_order` = a.`id_order`) as total_guests, (SELECT SUM(DATEDIFF(hbd.`date_to`, hbd.`date_from`)) FROM `'._DB_PREFIX_.'htl_booking_detail` hbd WHERE hbd.`id_order` = a.`id_order`) as los, hbd.`id_room` AS id_room_information, - (SELECT GROUP_CONCAT(DISTINCT hbd.`date_from` ORDER BY hbd.`date_from` SEPARATOR \', \') FROM `'._DB_PREFIX_.'htl_booking_detail` hbd WHERE hbd.`id_order` = a.`id_order`) AS date_from, - (SELECT GROUP_CONCAT(DISTINCT hbd.`date_to` ORDER BY hbd.`date_to` SEPARATOR \', \') FROM `'._DB_PREFIX_.'htl_booking_detail` hbd WHERE hbd.`id_order` = a.`id_order`) AS date_to, + (SELECT GROUP_CONCAT(CONCAT(ps.period, \'~\', ps.cnt) ORDER BY ps.period SEPARATOR \'::\') FROM (SELECT CONCAT(hbd.`date_from`, \'|\', hbd.`date_to`) AS period, COUNT(*) AS cnt FROM `'._DB_PREFIX_.'htl_booking_detail` hbd WHERE hbd.`id_order` = a.`id_order` GROUP BY hbd.`date_from`, hbd.`date_to`) AS ps) AS stay_periods, (SELECT COUNT(spod.`id_service_product_order_detail`) FROM `'._DB_PREFIX_.'service_product_order_detail` spod WHERE spod.`id_order` = a.`id_order` AND spod.`id_htl_booking_detail`=0) as num_products'; $this->_join = ' @@ -187,19 +186,23 @@ class AdminOrdersControllerCore extends AdminController 'displayed' => false, ), 'date_from' => array( - 'title' => $this->l('Check-in date'), + 'title' => $this->l('Check-in'), 'filter_key' => 'hbd!date_from', - 'type' => 'date', - 'callback' => 'formatCheckInDates', - 'optional' => true, - 'displayed' => true, + 'type'=>'date', + 'displayed' => false, ), 'date_to' => array( - 'title' => $this->l('Check-out date'), + 'title' => $this->l('Check-out'), 'filter_key' => 'hbd!date_to', 'type'=>'date', - 'callback' => 'formatCheckOutDates', + 'displayed' => false, + ), + 'stay_periods' => array( + 'title' => $this->l('Stay Periods'), + 'type' => 'text', + 'callback' => 'formatStayPeriods', 'optional' => true, + 'search' => false, 'displayed' => true, ), 'total_guests' => array( @@ -365,28 +368,33 @@ class AdminOrdersControllerCore extends AdminController return Tools::displayPrice($echo, (int)$idCurrency); } - public function formatCheckInDates($dates, $row) + public function formatStayPeriods($value, $row) { - if (empty($dates)) { + if (empty($value)) { return '--'; } $formatted = array(); - foreach (explode(', ', $dates) as $date) { - $formatted[] = Tools::displayDate(trim($date)); + foreach (explode('::', $value) as $chunk) { + $countParts = explode('~', $chunk); + $dateParts = explode('|', $countParts[0]); + if (count($dateParts) === 2) { + $formatted[] = array( + 'from' => Tools::displayDate(trim($dateParts[0])), + 'to' => Tools::displayDate(trim($dateParts[1])), + 'count' => isset($countParts[1]) ? (int)$countParts[1] : 1, + ); + } } - return implode(', ', $formatted); - } - public function formatCheckOutDates($dates, $row) - { - if (empty($dates)) { - return '--'; + $datesDisplay = array(); + foreach (array_slice($formatted, 0, 2) as $entry) { + $datesDisplay[] = $entry['from'].' - '.$entry['to']; } - $formatted = array(); - foreach (explode(', ', $dates) as $date) { - $formatted[] = Tools::displayDate(trim($date)); - } - return implode(', ', $formatted); + + $icon = ' '; + + return implode('
', $datesDisplay).$icon; } public function initPageHeaderToolbar() @@ -1312,8 +1320,13 @@ class AdminOrdersControllerCore extends AdminController parent::setMedia(); $this->addJqueryUI('ui.datepicker'); + $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'); @@ -1425,6 +1438,8 @@ class AdminOrdersControllerCore extends AdminController $this->_new_list_header_design = true; + $this->content .= $this->context->smarty->fetch('controllers/orders/_stay_periods_tooltip.tpl'); + return parent::renderList(); } diff --git a/js/admin/orders_stay_periods.js b/js/admin/orders_stay_periods.js new file mode 100644 index 000000000..2c901344b --- /dev/null +++ b/js/admin/orders_stay_periods.js @@ -0,0 +1,80 @@ +/** + * Stay Periods tooltip initialisation for the Admin Orders list. + * Reads structured JSON from data-stay-tip on each .stay-period-tip icon, + * clones the hidden #stay-period-tpl template, fills it, and returns it + * as the jQuery UI tooltip content. + */ +$(document).ready(function () { + var closeTimer = null; + + function buildTooltip(periods) { + var $tpl = $('#stay-period-tpl .tooltip_cont').clone(); + var $body = $tpl.find('.tip-body').empty(); + + $body.append( + $('
').append( + $('').text($('#stay-period-tpl').data('label-dates')), + $('').text($('#stay-period-tpl').data('label-rooms')) + ) + ); + + $.each(periods, function (_, p) { + $body.append( + $('
').append( + $('').text(p.from + ' – ' + p.to), + $('').text(p.count) + ) + ); + }); + return $('
', { + 'class': 'ui-tooltip ui-widget ui-corner-all ui-widget-content stay-period-tooltip', + 'role' : 'tooltip' + }).append( + $('
').append($tpl) + ); + } + + function cancelClose() { + clearTimeout(closeTimer); + closeTimer = null; + } + + function scheduleClose($tip) { + cancelClose(); + closeTimer = setTimeout(function () { + $tip.fadeOut(300, function () { $tip.remove(); }); + }, 300); + } + + $(document).on('mouseenter', '.stay-period-tip', function () { + cancelClose(); + + var periods = $(this).data('stay-tip'); + if (!periods || !periods.length) { return; } + + $('.stay-period-tooltip').stop(true).remove(); + + var $icon = $(this); + var $tip = buildTooltip(periods).appendTo('body').hide().fadeIn(200); + + var iconOffset = $icon.offset(); + $tip.css({ + position : 'absolute', + zIndex : 9999, + top : iconOffset.top + ($icon.outerHeight() / 2) - ($tip.outerHeight() / 2), + left : iconOffset.left + $icon.outerWidth() + 8 + }); + + $tip.on('mouseenter', function () { + cancelClose(); + }).on('mouseleave', function () { + scheduleClose($tip); + }); + + }).on('mouseleave', '.stay-period-tip', function () { + var $tip = $('.stay-period-tooltip'); + if ($tip.length) { + scheduleClose($tip); + } + }); +}); From d3b8bfe91f03a3f9fc2c8eb987729c756bae5760 Mon Sep 17 00:00:00 2001 From: aradhana kumari Date: Fri, 12 Jun 2026 16:45:46 +0530 Subject: [PATCH 04/35] Add license --- .../orders/_stay_periods_tooltip.tpl | 25 ++++++++++++++++--- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/admin/themes/default/template/controllers/orders/_stay_periods_tooltip.tpl b/admin/themes/default/template/controllers/orders/_stay_periods_tooltip.tpl index c75f4be77..f22a3e02c 100644 --- a/admin/themes/default/template/controllers/orders/_stay_periods_tooltip.tpl +++ b/admin/themes/default/template/controllers/orders/_stay_periods_tooltip.tpl @@ -1,8 +1,25 @@ {* - * Hidden template used by orders_stay_periods.js to build the Stay Periods - * jQuery UI tooltip. The JS clones .tooltip_cont, populates .tip-body - * with the period rows, and passes the result as the tooltip content. - *} +* 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 +*} + +