From f7c1dc0a5d7a555450ddd3d6dc1d97932713ef07 Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Wed, 16 Aug 2023 13:25:07 +0530 Subject: [PATCH 001/371] Improve room search UX --- js/daterangepicker/qlodaterangepicker.js | 3 +- .../views/css/wk-global-search.css | 25 +++ .../views/js/wk-room-search-block.js | 187 ++++++++++++++++-- .../views/templates/hook/searchForm.tpl | 3 + .../css/daterangepicker.css | 3 + 5 files changed, 201 insertions(+), 20 deletions(-) diff --git a/js/daterangepicker/qlodaterangepicker.js b/js/daterangepicker/qlodaterangepicker.js index 369ea9325..7e4186a97 100644 --- a/js/daterangepicker/qlodaterangepicker.js +++ b/js/daterangepicker/qlodaterangepicker.js @@ -31,7 +31,8 @@ minDays: 2, startOfWeek: 'monday', hoveringTooltip: false, - container: '#page', + container: page_name == 'index' ? '#date-range-picker-container' : '#page', + inline: page_name == 'index', customArrowPrevSymbol: '', customArrowNextSymbol: '', getValue: function() diff --git a/modules/wkroomsearchblock/views/css/wk-global-search.css b/modules/wkroomsearchblock/views/css/wk-global-search.css index a9f773a21..1eeacfa62 100644 --- a/modules/wkroomsearchblock/views/css/wk-global-search.css +++ b/modules/wkroomsearchblock/views/css/wk-global-search.css @@ -63,6 +63,15 @@ column-gap: 5px; grid-template-columns: repeat(2, 1fr); } +#date-range-picker-container { + position: absolute; +} +#date-range-picker-container.top { + bottom: 82px; +} +#date-range-picker-container.bottom { + top: 85px; +} /* #search_hotel_block_form { display: grid; grid-template-columns: 0.8fr repeat(3, 1fr) 0.6fr; @@ -169,6 +178,17 @@ background-color: #379bf0; color: #FFFFFF;} +.header-rmsearch-wrapper .location_search_results_ul.top { + top: unset; + bottom: 55px; } +.header-rmsearch-wrapper .location_search_results_ul.bottom { + top: 100%; } +.header-rmsearch-wrapper .hotel_dropdown_ul.top { + top: unset; + bottom: 100%; } +.header-rmsearch-wrapper .hotel_dropdown_ul.bottom { + top: 100%; } + .header-rmsearch-wrapper .label-desc-txt { font-size: 12px; @@ -217,6 +237,11 @@ box-shadow: 0 8px 25px -4px rgba(0,0,0,0.39); left: 0px; padding: 20px;} + #search_occupancy_wrapper.top { + top: unset; + bottom: 100%; } + #search_occupancy_wrapper.bottom { + top: 100%; } #search_occupancy_wrapper .occupancy-info-separator { margin-bottom: 15px; margin-top: 15px; diff --git a/modules/wkroomsearchblock/views/js/wk-room-search-block.js b/modules/wkroomsearchblock/views/js/wk-room-search-block.js index bfb5f13bc..7dcb7b66f 100644 --- a/modules/wkroomsearchblock/views/js/wk-room-search-block.js +++ b/modules/wkroomsearchblock/views/js/wk-room-search-block.js @@ -17,6 +17,43 @@ * @license https://store.webkul.com/license.html */ +const BookingSearchManager = { + inputSteps: { + 'location': { + selector: '#hotel_location', + activate: function() { $('#hotel_location').focus(); }, + inputHasValue: function () { return ($('#hotel_location').val() != '') && ($('#location_category_id').val() != ''); }, + }, + 'hotel': { + selector: '#id_hotel_button', + activate: function() { $('#id_hotel_button').click(); }, + inputHasValue: function () { return ($('#id_hotel').val() != '') && ($('#hotel_cat_id').val() != ''); }, + }, + 'date_range': { + selector: '#daterange_value', + activate: function() { $('#daterange_value').data('dateRangePicker').open(); }, + inputHasValue: function () { return ($('#check_in_time').val() != '') && ($('#check_out_time').val() != ''); }, + }, + 'occupancy': { + selector: '#guest_occupancy', + activate: function() { if ($('#search_occupancy_wrapper').css('display') == 'none') { $('#guest_occupancy').click().focus(); } }, + inputHasValue: function () { return false; }, + }, + 'submit': { + selector: '#search_room_submit', + activate: function() { $('#search_room_submit').focus(); }, + inputHasValue: function () { return false; }, + }, + }, + activateStep: function (step, force = false) { + if (step in this.inputSteps) { + if (force || !this.inputSteps[step].inputHasValue()) { + this.inputSteps[step].activate(); + } + } + }, +} + $(document).ready(function() { // for screen size changes for room search var window_width = $(window).width(); @@ -123,6 +160,8 @@ $(document).ready(function() { }).on('datepicker-change', function(event,obj){ $('#check_in_time').val($.datepicker.formatDate('yy-mm-dd', obj.date1)); $('#check_out_time').val($.datepicker.formatDate('yy-mm-dd', obj.date2)); + }).on('datepicker-closed', function() { + BookingSearchManager.activateStep('occupancy'); }); } @@ -184,30 +223,43 @@ $(document).ready(function() { }); // set data on clicking the searched location on dropdown + var focusHotelSelection = true; $(document).on('click', '.location_search_results_ul li', function(e) { + let currentLocationName = $('#hotel_location').val(); + let currentLocationId = $('#location_category_id').val(); + + $('.location_search_results_ul').empty().hide(); $('#hotel_location').attr('value', $(this).html()); $('#location_category_id').val($(this).val()); - $('.location_search_results_ul').empty().hide(); + // check if current location as same as previous one + if (currentLocationName != $(this).html() && currentLocationId != $(this).val()) { + $.ajax({ + url: autocomplete_search_url, + data: { + location_category_id: $('#location_category_id').val(), + }, + method: 'POST', + dataType: 'json', + success: function(result) { + if (result.status == 'success') { + $('#hotel_cat_id').val(''); + $('#hotel_cat_name').html('Select Hotel'); + $('.hotel_dropdown_ul').empty(); + $('.hotel_dropdown_ul').html(result.data); - $.ajax({ - url: autocomplete_search_url, - data: { - location_category_id: $('#location_category_id').val(), - }, - method: 'POST', - dataType: 'json', - success: function(result) { - if (result.status == 'success') { - $('#hotel_cat_id').val(''); - $('#hotel_cat_name').html('Select Hotel'); - $('.hotel_dropdown_ul').empty(); - $('.hotel_dropdown_ul').html(result.data); - } else { - alert(no_results_found_cond); + if (focusHotelSelection) { + BookingSearchManager.activateStep('hotel'); + focusHotelSelection = false; + } + } else { + alert(no_results_found_cond); + } } - } - }); + }); + } else { + BookingSearchManager.activateStep('hotel'); + } }); // navigate to prev and next li in the location/hotel dropdown @@ -268,6 +320,7 @@ $(document).ready(function() { $('#id_hotel').val($(this).attr('data-id-hotel')); $('#hotel_cat_id').val($(this).attr('data-hotel-cat-id')); $('#hotel_cat_name').html($(this).html()); + BookingSearchManager.activateStep('date_range'); }); // If only one hotel then set max order date on date pickers @@ -539,6 +592,7 @@ $(document).ready(function() { if (hasErrors == 0) { $("#search_occupancy_wrapper").hide(); $("#search_hotel_block_form #guest_occupancy").removeClass('error_border'); + BookingSearchManager.activateStep('submit'); } else { $("#search_hotel_block_form #guest_occupancy").addClass('error_border'); return false; @@ -547,6 +601,53 @@ $(document).ready(function() { } } }); + + if (page_name == 'index') { + // set search dropdown position handlers + $('#hotel_location, #id_hotel_button, #guest_occupancy').focus(function () { + setBookingSearchDropdownPositions(); + setBookingSearchCalendarPositions(); + }); + + $('#daterange_value').click(function () { + setBookingSearchDropdownPositions(); + setBookingSearchCalendarPositions(); + }); + } + + // handle Tab/Enter keypresses on input fields - start + $(document).on('keydown', '.location_search_results_ul li', function (e) { + if (e.which == 9 || e.which == 13) { // Tab/Enter key + if (e.which == 9) { + $(this).click(); + } + if ($('#id_hotel_button').length) { + focusHotelSelection = true; + } + } + }); + + $(document).on('keydown', '.hotel_dropdown_ul li', function (e) { + if (e.which == 9 || e.which == 13) { // Tab/Enter key + if (e.which == 9) { + $(this).click(); + } + if ($('#daterange_value').length) { + $('#daterange_value').click(); + } + } + }); + + $(document).on('keydown', '#guest_occupancy', function (e) { + e.preventDefault(); + if (e.which == 9) { // Tab key + if ($('#search_occupancy_wrapper').css('display') != 'none') { + $('#guest_occupancy').click(); + } + BookingSearchManager.activateStep('submit'); + } + }); + // handle Tab keypresses on input fields - end }); // function to set occupancy infor in guest occupancy field(search form) function setGuestOccupancy() @@ -579,4 +680,52 @@ function setGuestOccupancy() guestButtonVal += ', ' + parseInt(rooms) + ' ' + room_txt; } $('#guest_occupancy > span').text(guestButtonVal); -} \ No newline at end of file +} + +function setBookingSearchDropdownPositions() { + let inputFieldsAndDropdowns = [ + { input: $('#hotel_location'), dropdown: $('.location_search_results_ul')}, + { input: $('#id_hotel_button'), dropdown: $('.dropdown-menu.hotel_dropdown_ul')}, + { input: $('#guest_occupancy'), dropdown: $('#search_occupancy_wrapper')}, + ]; + + $(inputFieldsAndDropdowns).each(function (i, inputFieldAndDropdown) { + // find available space + let inputFieldHeight = inputFieldAndDropdown.input.outerHeight(); + let spaceTop = inputFieldAndDropdown.input.offset().top - $(window).scrollTop(); + let spaceBottom = $(window).height() - inputFieldHeight - spaceTop; + let cssMaxHeight = inputFieldAndDropdown.dropdown.css('max-height') || '292px'; + let dropdownMaxHeight = parseInt(cssMaxHeight.replace('px', '')); + dropdownMaxHeight = Math.max(dropdownMaxHeight, 292); // 292 is height of the calendar + + let dropdownClass = 'bottom'; + if (spaceBottom < dropdownMaxHeight && spaceTop > spaceBottom) { + dropdownClass = 'top'; + } + + // position dropdown + inputFieldAndDropdown.dropdown.removeClass('top bottom').addClass(dropdownClass); + }); +} + +function setBookingSearchCalendarPositions() { + let calendarInputFields = [ + { input: $('#daterange_value'), calendarContainer: $('#date-range-picker-container')}, + ]; + + $(calendarInputFields).each(function (i, calendarInputField) { + // find available space + let inputFieldHeight = calendarInputField.input.outerHeight(); + let spaceTop = calendarInputField.input.offset().top - $(window).scrollTop(); + let spaceBottom = $(window).height() - inputFieldHeight - spaceTop; + let calendarHeight = 292; // 292 is height of the calendar + + let calendarContainerClass = 'bottom'; + if (spaceBottom < calendarHeight && spaceTop > spaceBottom) { + calendarContainerClass = 'top'; + } + + // position calendar + calendarInputField.calendarContainer.removeClass('top bottom').addClass(calendarContainerClass); + }); +} diff --git a/modules/wkroomsearchblock/views/templates/hook/searchForm.tpl b/modules/wkroomsearchblock/views/templates/hook/searchForm.tpl index 79e7bcf2f..a515da256 100644 --- a/modules/wkroomsearchblock/views/templates/hook/searchForm.tpl +++ b/modules/wkroomsearchblock/views/templates/hook/searchForm.tpl @@ -57,6 +57,9 @@
{l s='Check-in' mod='wkroomsearchblock'}    {l s='Check-out' mod='wkroomsearchblock'}
+ {if isset($is_index_page) && $is_index_page} +
+ {/if} {/if} diff --git a/themes/hotel-reservation-theme/css/daterangepicker.css b/themes/hotel-reservation-theme/css/daterangepicker.css index 5d07270cd..f1b6cbe07 100644 --- a/themes/hotel-reservation-theme/css/daterangepicker.css +++ b/themes/hotel-reservation-theme/css/daterangepicker.css @@ -29,6 +29,9 @@ margin-top: -4px; padding: 10px; } +#index .date-picker-wrapper.no-shortcuts { + margin-top: 0; +} .date-picker-wrapper .month-wrapper{ border: none; background-color: transparent; From e6964d725880f5faeab7df47e7ddc094d56baf99 Mon Sep 17 00:00:00 2001 From: Shreesh Arora Date: Fri, 13 Oct 2023 14:40:51 +0530 Subject: [PATCH 002/371] update recommendation section update process --- classes/Tools.php | 11 +-- classes/controller/AdminController.php | 71 ++++++++++++++++--- .../admin/AdminDashboardController.php | 13 +--- .../admin/AdminModulesCatalogController.php | 13 +--- js/admin.js | 4 +- 5 files changed, 70 insertions(+), 42 deletions(-) diff --git a/classes/Tools.php b/classes/Tools.php index 58ab06580..88daf16eb 100644 --- a/classes/Tools.php +++ b/classes/Tools.php @@ -3402,14 +3402,9 @@ exit; $post_data .= '&method=listing&action=install-modules'; $post_data .= defined('_PS_HOST_MODE_') ? '-od' : ''; break; - case 'catalog-recommendation': - $protocols[] = 'http'; - $post_data .= '&method=content&action=catalogRecommendation'; - $post_data .= defined('_PS_HOST_MODE_') ? '-od' : ''; - break; - case 'dashboard-recommendation': - $protocols[] = 'http'; - $post_data .= '&method=content&action=dashboardRecommendation'; + case 'recommendation': + $post_data .= '&method=recommendation&controller='; + $post_data .= (isset($params['controller']) ? $params['controller'] : Context::getContext()->controller->controller_name); $post_data .= defined('_PS_HOST_MODE_') ? '-od' : ''; break; case 'check-version': diff --git a/classes/controller/AdminController.php b/classes/controller/AdminController.php index ea3a469f7..9c246856b 100644 --- a/classes/controller/AdminController.php +++ b/classes/controller/AdminController.php @@ -398,6 +398,9 @@ class AdminControllerCore extends Controller /** @var int level for permissions View/read */ const LEVEL_VIEW = 1; + /** @var string path for recomendation content */ + const RECOMMENDATION_CONTENT = ''; + public function __construct() { global $timer_start; @@ -3946,17 +3949,64 @@ class AdminControllerCore extends Controller public function ajaxProcessGetRecommendationContent() { $response = array('success' => false); - if (isset($this->context->cookie->{$this->controller_name.'_closed'}) && $this->context->cookie->{$this->controller_name.'_closed'}) { - $response['success'] = true; - } else { - if (method_exists($this, 'getRecommendationContent')) { - if ($content = $this->getRecommendationContent()) { - $response['success'] = true; - $response['content'] = $content; + if ($this->context->controller->getRecommendationFilePath()) { + $response = $this->getRecommendationContent(); + } + $this->context->cookie->write(); + $this->ajaxDie(json_encode($response)); + } + + public function getRecommendationContent() + { + $content = array( + 'success' => false, + 'cache' => true, + 'html' => '' + ); + + if ($recommendationContent = $this->updateRecommendationContent()) { + $content['cache'] = false; + } + if (!isset($this->context->cookie->{$this->controller_name.'_closed'}) || !$this->context->cookie->{$this->controller_name.'_closed'}) { + if (file_exists(_PS_ROOT_DIR_.$this->context->controller->getRecommendationFilePath())) { + $content['success'] = true; + $content['html'] = file_get_contents(_PS_ROOT_DIR_.$this->context->controller->getRecommendationFilePath()); + } + } + + return $content; + } + + public function updateRecommendationContent() + { + if (!Tools::isFresh($this->context->controller->getRecommendationFilePath(), _TIME_1_DAY_, false)) { + if ($recommendationContent = Tools::addonsRequest( + 'recommendation', + array('controller' => $this->context->controller->controller_name) + )) { + $recommendationContent = json_decode($recommendationContent, true); + if (isset($this->context->cookie->{$this->context->controller->controller_name.'_key'})) { + if ($this->context->cookie->{$this->context->controller->controller_name.'_key'} != $recommendationContent['key']) { + unset($this->context->cookie->{$this->context->controller->controller_name.'_closed'}); + } + } + $this->context->cookie->{$this->context->controller->controller_name.'_key'} = $recommendationContent['key']; + if (isset($recommendationContent['success']) && $recommendationContent['success']) { + @file_put_contents( + _PS_ROOT_DIR_.$this->context->controller->getRecommendationFilePath(), + $recommendationContent['html'] + ); + } elseif (file_exists(_PS_ROOT_DIR_.$this->context->controller->getRecommendationFilePath())) { + unlink(_PS_ROOT_DIR_.$this->context->controller->getRecommendationFilePath()); + } + return $recommendationContent; + } else { + if (file_exists(_PS_ROOT_DIR_.$this->context->controller->getRecommendationFilePath())) { + unlink(_PS_ROOT_DIR_.$this->context->controller->getRecommendationFilePath()); } } } - $this->ajaxDie(json_encode($response)); + return false; } public function ajaxProcessRecommendationClosed() @@ -3966,6 +4016,11 @@ class AdminControllerCore extends Controller $this->ajaxDie(json_encode($response)); } + public function getRecommendationFilePath() + { + return static::RECOMMENDATION_CONTENT; + } + /** * Save list visible columns * diff --git a/controllers/admin/AdminDashboardController.php b/controllers/admin/AdminDashboardController.php index 5f2d57bac..361b00e07 100644 --- a/controllers/admin/AdminDashboardController.php +++ b/controllers/admin/AdminDashboardController.php @@ -27,7 +27,7 @@ class AdminDashboardControllerCore extends AdminController { - const DASHBOARD_RECOMMENDATION_CONTENT = '/cache/dashboard_recommendation.html'; + const RECOMMENDATION_CONTENT = '/cache/dashboard_recommendation.html'; public function __construct() { @@ -493,15 +493,4 @@ class AdminDashboardControllerCore extends AdminController die(json_encode($return)); } - - public function getRecommendationContent() - { - if (!Tools::isFresh(self::DASHBOARD_RECOMMENDATION_CONTENT, _TIME_1_DAY_, false)) { - @file_put_contents(_PS_ROOT_DIR_.self::DASHBOARD_RECOMMENDATION_CONTENT, Tools::addonsRequest('dashboard-recommendation')); - } - if (file_exists(_PS_ROOT_DIR_.self::DASHBOARD_RECOMMENDATION_CONTENT)) { - return Tools::file_get_contents(_PS_ROOT_DIR_.self::DASHBOARD_RECOMMENDATION_CONTENT); - } - return false; - } } diff --git a/controllers/admin/AdminModulesCatalogController.php b/controllers/admin/AdminModulesCatalogController.php index 6b8e7f953..f8e498b3f 100644 --- a/controllers/admin/AdminModulesCatalogController.php +++ b/controllers/admin/AdminModulesCatalogController.php @@ -23,7 +23,7 @@ class AdminModulesCatalogControllerCore extends AdminController public $modules; - const CATALOG_RECOMMENDATION_CONTENT = '/cache/catalog_recommendation.html'; + const RECOMMENDATION_CONTENT = '/cache/catalog_recommendation.html'; const ELEMENT_TYPE_MODULE = 1; const ELEMENT_TYPE_THEME = 2; @@ -240,17 +240,6 @@ class AdminModulesCatalogControllerCore extends AdminController ); } - public function getRecommendationContent() - { - if (!Tools::isFresh(self::CATALOG_RECOMMENDATION_CONTENT, _TIME_1_DAY_, false)) { - @file_put_contents(_PS_ROOT_DIR_.self::CATALOG_RECOMMENDATION_CONTENT, Tools::addonsRequest('catalog-recommendation')); - } - if (file_exists(_PS_ROOT_DIR_.self::CATALOG_RECOMMENDATION_CONTENT)) { - return Tools::file_get_contents(_PS_ROOT_DIR_.self::CATALOG_RECOMMENDATION_CONTENT); - } - return false; - } - public function sortList(&$list, $type) { diff --git a/js/admin.js b/js/admin.js index 4d474721a..e81956a6c 100644 --- a/js/admin.js +++ b/js/admin.js @@ -1616,9 +1616,9 @@ function loadRecommendation() token: token }, success: function(res) { - if (res.success && res.content && res.content.trim()) { + if (res.success && res.html && res.html.trim()) { $('#recommendation-wrapper-skeleton').fadeIn('slow'); - $('#recommendation-wrapper').html(res.content); + $('#recommendation-wrapper').html(res.html); let images = $('#recommendation-wrapper img'); let loaded = 0; let total = $(images).length; From 87ac2f128e29e59566debac0e129b18bb8d68a42 Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Tue, 17 Oct 2023 17:47:07 +0530 Subject: [PATCH 003/371] Improve search flow --- .../classes/HotelHelper.php | 1 + .../AdminHotelGeneralSettingsController.php | 17 + .../classes/WkRoomSearchHelper.php | 1 + .../controllers/front/autocompletesearch.php | 42 +- .../wkroomsearchblock/views/css/chosen.css | 483 ++++++++++++++++++ .../views/img/chosen-sprite.png | Bin 0 -> 646 bytes .../views/img/chosen-sprite@2x.png | Bin 0 -> 872 bytes .../views/js/wk-room-search-block.js | 120 +++-- .../views/templates/front/hotel-options.tpl | 27 + .../views/templates/front/index.php | 29 ++ .../templates/front/location-options.tpl | 24 + .../views/templates/hook/searchForm.tpl | 36 +- .../wkroomsearchblock/wkroomsearchblock.php | 5 + 13 files changed, 707 insertions(+), 78 deletions(-) create mode 100644 modules/wkroomsearchblock/views/css/chosen.css create mode 100644 modules/wkroomsearchblock/views/img/chosen-sprite.png create mode 100644 modules/wkroomsearchblock/views/img/chosen-sprite@2x.png create mode 100644 modules/wkroomsearchblock/views/templates/front/hotel-options.tpl create mode 100644 modules/wkroomsearchblock/views/templates/front/index.php create mode 100644 modules/wkroomsearchblock/views/templates/front/location-options.tpl diff --git a/modules/hotelreservationsystem/classes/HotelHelper.php b/modules/hotelreservationsystem/classes/HotelHelper.php index 447e95354..0cbce162e 100644 --- a/modules/hotelreservationsystem/classes/HotelHelper.php +++ b/modules/hotelreservationsystem/classes/HotelHelper.php @@ -199,6 +199,7 @@ class HotelHelper Configuration::updateValue('WK_HOTEL_LOCATION_ENABLE', 1); Configuration::updateValue('WK_HOTEL_NAME_ENABLE', 1); + Configuration::updateValue('WK_HOTEL_NAME_SEARCH_THRESHOLD', 5); Configuration::updateValue('WK_ROOM_LEFT_WARNING_NUMBER', 10); Configuration::updateValue('WK_HTL_ESTABLISHMENT_YEAR', 2010); diff --git a/modules/hotelreservationsystem/controllers/admin/AdminHotelGeneralSettingsController.php b/modules/hotelreservationsystem/controllers/admin/AdminHotelGeneralSettingsController.php index 74e120141..2a907425a 100644 --- a/modules/hotelreservationsystem/controllers/admin/AdminHotelGeneralSettingsController.php +++ b/modules/hotelreservationsystem/controllers/admin/AdminHotelGeneralSettingsController.php @@ -81,6 +81,15 @@ class AdminHotelGeneralSettingsController extends ModuleAdminController 'hint' => $this->l('This option can be disabled if only one active hotel in the website. In case of more than one active hotel, Hotel Name will always be shown in the search panel.'), ), + 'WK_HOTEL_NAME_SEARCH_THRESHOLD' => array( + 'title' => $this->l('Hotel name search threshold'), + 'type' => 'text', + 'required' => true, + 'validation' => 'isUnsignedInt', + 'hint' => $this->l('Enter the number of hotels after which user can search hotel by name.'), + 'desc' => $this->l('Set to 0 to always show the search box.'), + 'class' => 'fixed-width-xxl', + ), ), 'submit' => array( 'title' => $this->l('Save'), @@ -290,6 +299,8 @@ class AdminHotelGeneralSettingsController extends ModuleAdminController public function postProcess() { if (Tools::isSubmit('submitOptions'.$this->table)) { + $hotelNameSearchThreshold = Tools::getValue('WK_HOTEL_NAME_SEARCH_THRESHOLD'); + // check if field is atleast in default language. Not available in default prestashop $defaultLangId = Configuration::get('PS_LANG_DEFAULT'); $objDefaultLanguage = Language::getLanguage((int) $defaultLangId); @@ -302,6 +313,12 @@ class AdminHotelGeneralSettingsController extends ModuleAdminController // End occupancy fields validation + if (!$hotelNameSearchThreshold && $hotelNameSearchThreshold !== '0') { + $this->errors[] = $this->l('Hotel name search threshold field is required.'); + } elseif (!Validate::isUnsignedInt(Tools::getValue('WK_HOTEL_NAME_SEARCH_THRESHOLD'))) { + $this->errors[] = $this->l('Hotel name search threshold field is invalid.'); + } + if (!trim(Tools::getValue('WK_HTL_CHAIN_NAME_'.$defaultLangId))) { $this->errors[] = $this->l('Hotel chain name is required at least in ').$objDefaultLanguage['name']; } else { diff --git a/modules/wkroomsearchblock/classes/WkRoomSearchHelper.php b/modules/wkroomsearchblock/classes/WkRoomSearchHelper.php index 7ab3d7138..236dbeaae 100644 --- a/modules/wkroomsearchblock/classes/WkRoomSearchHelper.php +++ b/modules/wkroomsearchblock/classes/WkRoomSearchHelper.php @@ -226,6 +226,7 @@ class WkRoomSearchHelper $smartyVars['hotels_info'] = $hotelsInfo; $smartyVars['show_hotel_name'] = Configuration::get('WK_HOTEL_NAME_ENABLE'); $smartyVars['max_child_age'] = Configuration::get('WK_GLOBAL_CHILD_MAX_AGE'); + $smartyVars['hotel_name_search_threshold'] = (int) Configuration::get('WK_HOTEL_NAME_SEARCH_THRESHOLD'); $maxOrderDate = HotelOrderRestrictDate::getMaxOrderDate($idHotel); $smartyVars['max_order_date'] = date('Y-m-d', strtotime($maxOrderDate)); diff --git a/modules/wkroomsearchblock/controllers/front/autocompletesearch.php b/modules/wkroomsearchblock/controllers/front/autocompletesearch.php index 4a051c103..487e9c2d2 100644 --- a/modules/wkroomsearchblock/controllers/front/autocompletesearch.php +++ b/modules/wkroomsearchblock/controllers/front/autocompletesearch.php @@ -29,29 +29,39 @@ class WkRoomSearchBlockAutoCompleteSearchModuleFrontController extends ModuleFro $location_category_id = Tools::getValue('location_category_id'); $obj_htl_info = new HotelBranchInformation(); if (isset($search_data) && $search_data) { - $return_data = $obj_htl_info->getHotelCategoryTree($search_data); - if ($return_data) { - $html = ''; - foreach ($return_data as $value) { - $html .= '
  • '. - $value['name'].'
  • '; - } + $locationCategories = $obj_htl_info->getHotelCategoryTree($search_data); + if ($locationCategories) { + $this->context->smarty->assign(array('location_categories' => $locationCategories)); + $html = $this->context->smarty->fetch( + $this->module->getTemplatePath('location-options.tpl') + ); $result['status'] = 'success'; $result['data'] = $html; } } elseif (isset($location_category_id) && $location_category_id) { - $cat_ids = Category::getAllCategoriesName($location_category_id); - if ($cat_ids) { - $html = ''; - foreach ($cat_ids as $value) { - if ($hotel_info = $obj_htl_info->hotelBranchInfoByCategoryId($value['id_category'])) { - $maxOrderDate = HotelOrderRestrictDate::getMaxOrderDate($hotel_info['id']); + $locationCategories = Category::getAllCategoriesName($location_category_id); + if ($locationCategories) { + $hotelsInfo = array(); + foreach ($locationCategories as $category) { + if ($hotelInfo = $obj_htl_info->hotelBranchInfoByCategoryId($category['id_category'])) { + $maxOrderDate = HotelOrderRestrictDate::getMaxOrderDate($hotelInfo['id']); $maxOrderDate = date('Y-m-d', strtotime($maxOrderDate)); - $html .= '
  • '. - $hotel_info['hotel_name'].'
  • '; + + $hotelsInfo[] = array( + 'id_hotel' => $hotelInfo['id'], + 'id_category' => $hotelInfo['id_category'], + 'hotel_name' => $hotelInfo['hotel_name'], + 'max_order_date' => $maxOrderDate, + ); } } + + $this->context->smarty->assign(array('hotels_info' => $hotelsInfo)); + $html = $this->context->smarty->fetch( + $this->module->getTemplatePath('hotel-options.tpl') + ); + + $result['status'] = 'success'; $result['data'] = $html; } else { diff --git a/modules/wkroomsearchblock/views/css/chosen.css b/modules/wkroomsearchblock/views/css/chosen.css new file mode 100644 index 000000000..c53604007 --- /dev/null +++ b/modules/wkroomsearchblock/views/css/chosen.css @@ -0,0 +1,483 @@ +/** + * 2010-2023 Webkul. + * + * NOTICE OF LICENSE + * + * All right is reserved, + * Please go through LICENSE.txt file inside our module + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade this module to newer + * versions in the future. If you wish to customize this module for your + * needs please refer to CustomizationPolicy.txt file inside our module for more information. + * + * @author Webkul IN + * @copyright 2010-2023 Webkul IN + * @license LICENSE.txt + */ + +/* @group Base */ +.chosen-container { + position: relative; + vertical-align: middle; + font-size: 14px; + zoom: 1; + display: inline; + -moz-user-select: -moz-none; + -ms-user-select: none; + -webkit-user-select: none; + user-select: none; +} +.chosen-container .chosen-drop { + position: absolute; + top: 0; + left: -9999px; + z-index: 1010; + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; + box-sizing: border-box; + width: 100%; + border-top: 0; + box-shadow: 0 4px 5px rgba(0, 0, 0, 0.15); +} +.chosen-container.chosen-container-single-nosearch .chosen-drop { + top: 100%; +} +.chosen-container.chosen-with-drop .chosen-drop { + left: 0; +} +.chosen-container a { + cursor: pointer; +} + +/* @end */ +/* @group Single Chosen */ +.chosen-container-single .chosen-single { + position: relative; + display: block; + overflow: hidden; + padding-left: 35px; + height: 100%; + border: 1px solid #aaa; + border-radius: 4px; + background-clip: padding-box; + box-shadow: 0 0 3px #fff inset, 0 1px 1px rgba(0, 0, 0, 0.1); + color: #444; + text-decoration: none; + white-space: nowrap; + line-height: 24px; + background: #fff url('../img/icon-hotel.svg') no-repeat 10px 50%; +} +.chosen-container-single.error_border .chosen-single { + border: 2px solid red !important; +} + +.chosen-container-single .chosen-default { + color: #999; +} +.chosen-container-single .chosen-single span { + display: block; + overflow: hidden; + margin-right: 26px; + text-overflow: ellipsis; + white-space: nowrap; + position: relative; + top: 15px; + color: #333; +} +.chosen-container-single .chosen-single-with-deselect span { + margin-right: 38px; +} +.chosen-container-single .chosen-single abbr { + position: absolute; + top: 6px; + right: 26px; + display: block; + width: 12px; + height: 12px; + background: url('chosen-sprite.png') -42px 1px no-repeat; + font-size: 1px; +} +.chosen-container-single .chosen-single abbr:hover { + background-position: -42px -10px; +} +.chosen-container-single.chosen-disabled .chosen-single abbr:hover { + background-position: -42px -10px; +} +.chosen-container-single .chosen-single div { + position: absolute; + top: 0; + right: 0; + display: block; + width: 18px; + height: 100%; +} +.chosen-container-single .chosen-single div b { + display: block; + width: 100%; + height: 100%; + background: url('../../../../themes/hotel-reservation-theme/img/icon/icon-dropdown-arrow.svg') no-repeat calc(100% - 8px) 50%; +} +.chosen-container-single .chosen-search { + position: relative; + z-index: 1010; + margin: 0; + white-space: nowrap; + background: #fff; + border-radius: 4px; + height: 55px; +} +.chosen-container-single .chosen-search::after { + content: ''; + position: absolute; + top: 16px; + right: 1px; + height: 22px; + width: 19px; + background: url('../../../../themes/hotel-reservation-theme/img/icon/icon-dropdown-arrow.svg') no-repeat calc(100% - 8px) 50%; + /* background: url('../img/icon-hotel.svg') no-repeat 9px 50%; */ +} +.chosen-container-single .chosen-search input[type="text"] { + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; + box-sizing: border-box; + margin: 0; + padding: 0; + padding-left: 35px; + width: 100%; + height: 100%; + outline: 0; + border: none; + font-size: 1em; + line-height: normal; + border-radius: 4px; + background: url('../img/icon-hotel.svg') no-repeat 9px 50%; +} +.chosen-container-single.chosen-container-active .chosen-search input[type="text"] { + border: 2px solid #1292FF; + box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6); + transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s; +} +.chosen-container-single .chosen-drop { + margin-top: -1px; + border-radius: 0 0 4px 4px; + background-clip: padding-box; +} +.chosen-container-single.chosen-container-single-nosearch .chosen-search { + position: absolute; + left: -9999px; +} + +/* @end */ +/* @group Results */ +.chosen-container .chosen-results { + position: relative; + overflow-x: hidden; + overflow-y: auto; + max-height: 240px; + background: #fff; + margin-top: 2px; + margin-bottom: 0; +} +.chosen-container .chosen-results li { + display: none; + margin: 0; + padding: 15px; + list-style: none; + color: #333; +} +.chosen-container .chosen-results li.active-result { + display: list-item; + cursor: pointer; +} +.chosen-container .chosen-results li.disabled-result { + display: list-item; + color: #ccc; + cursor: default; +} +.chosen-container .chosen-results li.highlighted { + background-color: #379bf0; + color: #fff; +} +.chosen-container .chosen-results li.no-results { + display: list-item; + background: #f4f4f4; +} +.chosen-container .chosen-results li.group-result { + display: list-item; + font-weight: bold; + cursor: default; +} +.chosen-container .chosen-results li.group-option { + padding-left: 15px; +} +.chosen-container .chosen-results li em { + font-style: normal; + text-decoration: underline; +} + +/* @end */ +/* @group Multi Chosen */ +.chosen-container-multi .chosen-choices { + position: relative; + overflow: hidden; + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; + box-sizing: border-box; + margin: 0; + padding: 0; + width: 100%; + height: auto !important; + height: 1%; + border: 1px solid #aaa; + background-color: #fff; + background-image: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4gPHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PGxpbmVhckdyYWRpZW50IGlkPSJncmFkIiBncmFkaWVudFVuaXRzPSJvYmplY3RCb3VuZGluZ0JveCIgeDE9IjAuNSIgeTE9IjAuMCIgeDI9IjAuNSIgeTI9IjEuMCI+PHN0b3Agb2Zmc2V0PSIxJSIgc3RvcC1jb2xvcj0iI2VlZWVlZSIvPjxzdG9wIG9mZnNldD0iMTUlIiBzdG9wLWNvbG9yPSIjZmZmZmZmIi8+PC9saW5lYXJHcmFkaWVudD48L2RlZnM+PHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgZmlsbD0idXJsKCNncmFkKSIgLz48L3N2Zz4g'); + background-size: 100%; + background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(1%, #eeeeee), color-stop(15%, #ffffff)); + background-image: -moz-linear-gradient(#eeeeee 1%, #ffffff 15%); + background-image: -webkit-linear-gradient(#eeeeee 1%, #ffffff 15%); + background-image: linear-gradient(#eeeeee 1%, #ffffff 15%); + cursor: text; +} +.chosen-container-multi .chosen-choices li { + float: left; + list-style: none; +} +.chosen-container-multi .chosen-choices li.search-field { + margin: 0; + padding: 0; + white-space: nowrap; +} +.chosen-container-multi .chosen-choices li.search-field input[type="text"] { + margin: 1px 0; + padding: 5px; + height: 15px; + outline: 0; + border: 0 !important; + background: transparent !important; + box-shadow: none; + color: #666; + font-size: 100%; + line-height: normal; + border-radius: 0; +} +.chosen-container-multi .chosen-choices li.search-field .default { + color: #999; +} +.chosen-container-multi .chosen-choices li.search-choice { + position: relative; + margin: 3px 0 3px 5px; + padding: 3px 20px 3px 5px; + border: 1px solid #aaa; + border-radius: 3px; + background-color: #e4e4e4; + background-image: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4gPHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PGxpbmVhckdyYWRpZW50IGlkPSJncmFkIiBncmFkaWVudFVuaXRzPSJvYmplY3RCb3VuZGluZ0JveCIgeDE9IjAuNSIgeTE9IjAuMCIgeDI9IjAuNSIgeTI9IjEuMCI+PHN0b3Agb2Zmc2V0PSIyMCUiIHN0b3AtY29sb3I9IiNmNGY0ZjQiLz48c3RvcCBvZmZzZXQ9IjUwJSIgc3RvcC1jb2xvcj0iI2YwZjBmMCIvPjxzdG9wIG9mZnNldD0iNTIlIiBzdG9wLWNvbG9yPSIjZThlOGU4Ii8+PHN0b3Agb2Zmc2V0PSIxMDAlIiBzdG9wLWNvbG9yPSIjZWVlZWVlIi8+PC9saW5lYXJHcmFkaWVudD48L2RlZnM+PHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgZmlsbD0idXJsKCNncmFkKSIgLz48L3N2Zz4g'); + background-size: 100%; + background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #f4f4f4), color-stop(50%, #f0f0f0), color-stop(52%, #e8e8e8), color-stop(100%, #eeeeee)); + background-image: -moz-linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%); + background-image: -webkit-linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%); + background-image: linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%); + background-clip: padding-box; + box-shadow: 0 0 2px #fff inset, 0 1px 0 rgba(0, 0, 0, 0.05); + color: #333; + line-height: 13px; + cursor: default; +} +.chosen-container-multi .chosen-choices li.search-choice .search-choice-close { + position: absolute; + top: 4px; + right: 3px; + display: block; + width: 12px; + height: 12px; + background: url('chosen-sprite.png') -42px 1px no-repeat; + font-size: 1px; +} +.chosen-container-multi .chosen-choices li.search-choice .search-choice-close:hover { + background-position: -42px -10px; +} +.chosen-container-multi .chosen-choices li.search-choice-disabled { + padding-right: 5px; + border: 1px solid #ccc; + background-color: #e4e4e4; + background-image: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4gPHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PGxpbmVhckdyYWRpZW50IGlkPSJncmFkIiBncmFkaWVudFVuaXRzPSJvYmplY3RCb3VuZGluZ0JveCIgeDE9IjAuNSIgeTE9IjAuMCIgeDI9IjAuNSIgeTI9IjEuMCI+PHN0b3Agb2Zmc2V0PSIyMCUiIHN0b3AtY29sb3I9IiNmNGY0ZjQiLz48c3RvcCBvZmZzZXQ9IjUwJSIgc3RvcC1jb2xvcj0iI2YwZjBmMCIvPjxzdG9wIG9mZnNldD0iNTIlIiBzdG9wLWNvbG9yPSIjZThlOGU4Ii8+PHN0b3Agb2Zmc2V0PSIxMDAlIiBzdG9wLWNvbG9yPSIjZWVlZWVlIi8+PC9saW5lYXJHcmFkaWVudD48L2RlZnM+PHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgZmlsbD0idXJsKCNncmFkKSIgLz48L3N2Zz4g'); + background-size: 100%; + background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #f4f4f4), color-stop(50%, #f0f0f0), color-stop(52%, #e8e8e8), color-stop(100%, #eeeeee)); + background-image: -moz-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%); + background-image: -webkit-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%); + background-image: linear-gradient(to bottom, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%); + color: #666; +} +.chosen-container-multi .chosen-choices li.search-choice-focus { + background: #d4d4d4; +} +.chosen-container-multi .chosen-choices li.search-choice-focus .search-choice-close { + background-position: -42px -10px; +} +.chosen-container-multi .chosen-results { + margin: 0; + padding: 0; +} +.chosen-container-multi .chosen-drop .result-selected { + display: list-item; + color: #ccc; + cursor: default; +} + +/* @end */ +/* @group Active */ +.chosen-container-active .chosen-single { + border: 2px solid #1292FF; + box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6); + transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s; +} +.chosen-container-active.chosen-with-drop .chosen-single div { + border-left: none; + background: transparent; +} +.chosen-container-active .chosen-choices { + border: 1px solid #5897fb; + box-shadow: 0 0 5px rgba(0, 0, 0, 0.3); +} +.chosen-container-active .chosen-choices li.search-field input[type="text"] { + color: #111 !important; +} + +/* @end */ +/* @group Disabled Support */ +.chosen-disabled { + opacity: 0.5 !important; + cursor: default; +} +.chosen-disabled .chosen-single { + cursor: default; +} +.chosen-disabled .chosen-choices .search-choice .search-choice-close { + cursor: default; +} + +/* chosen-drop top - start */ +.hotel-selector-wrap .chosen-container .chosen-drop.top .chosen-results { + position: absolute; + width: 100%; + bottom: calc(100% + 2px); +} +.hotel-selector-wrap .chosen-container.chosen-container-single-nosearch .chosen-drop.top .chosen-results { + position: absolute; + width: 100%; + bottom: calc(100% + 55px); +} +/* chosen-drop top - end */ + + +/* @end */ +/* @group Right to Left */ +.chosen-rtl { + text-align: right; +} +.chosen-rtl .chosen-single { + overflow: visible; + padding: 0 8px 0 0; +} +.chosen-rtl .chosen-single span { + margin-right: 0; + margin-left: 26px; + direction: rtl; +} +.chosen-rtl .chosen-single-with-deselect span { + margin-left: 38px; +} +.chosen-rtl .chosen-single div { + right: auto; + left: 3px; +} +.chosen-rtl .chosen-single abbr { + right: auto; + left: 26px; +} +.chosen-rtl .chosen-choices li { + float: right; +} +.chosen-rtl .chosen-choices li.search-field input[type="text"] { + direction: rtl; +} +.chosen-rtl .chosen-choices li.search-choice { + margin: 3px 5px 3px 0; + padding: 3px 5px 3px 19px; +} +.chosen-rtl .chosen-choices li.search-choice .search-choice-close { + right: auto; + left: 4px; +} +.chosen-rtl.chosen-container-single-nosearch .chosen-search, +.chosen-rtl .chosen-drop { + left: 9999px; +} +.chosen-rtl.chosen-container-single .chosen-results { + margin: 0 0 4px 4px; + padding: 0 4px 0 0; +} +.chosen-rtl .chosen-results li.group-option { + padding-right: 15px; + padding-left: 0; +} +.chosen-rtl.chosen-container-active.chosen-with-drop .chosen-single div { + border-right: none; +} +.chosen-rtl .chosen-search input[type="text"] { + padding: 4px 5px 4px 20px; + background: #fff url('chosen-sprite.png') no-repeat -30px -20px; + background: url('chosen-sprite.png') no-repeat -30px -20px, url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4gPHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PGxpbmVhckdyYWRpZW50IGlkPSJncmFkIiBncmFkaWVudFVuaXRzPSJvYmplY3RCb3VuZGluZ0JveCIgeDE9IjAuNSIgeTE9IjAuMCIgeDI9IjAuNSIgeTI9IjEuMCI+PHN0b3Agb2Zmc2V0PSIxJSIgc3RvcC1jb2xvcj0iI2VlZWVlZSIvPjxzdG9wIG9mZnNldD0iMTUlIiBzdG9wLWNvbG9yPSIjZmZmZmZmIi8+PC9saW5lYXJHcmFkaWVudD48L2RlZnM+PHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgZmlsbD0idXJsKCNncmFkKSIgLz48L3N2Zz4g'); + background: url('chosen-sprite.png') no-repeat -30px -20px, -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(1%, #eeeeee), color-stop(15%, #ffffff)); + background: url('chosen-sprite.png') no-repeat -30px -20px, -moz-linear-gradient(#eeeeee 1%, #ffffff 15%); + background: url('chosen-sprite.png') no-repeat -30px -20px, -webkit-linear-gradient(#eeeeee 1%, #ffffff 15%); + background: url('chosen-sprite.png') no-repeat -30px -20px, linear-gradient(#eeeeee 1%, #ffffff 15%); + direction: rtl; +} +.chosen-rtl.chosen-container-single .chosen-single div b { + background-position: 6px 2px; +} +.chosen-rtl.chosen-container-single.chosen-with-drop .chosen-single div b { + background-position: -12px 2px; +} + +.chosen-container .chosen-drop.dropup { + border-bottom: 0; + border-top: 1px solid #aaa; + top: auto; + bottom: 40px; +} + +.chosen-container.chosen-with-drop .chosen-single.dropup { + background-image: none; +} + +.chosen-container.chosen-with-drop .chosen-drop.dropup { + box-shadow: none; + margin-bottom: -16px; +} + +/* @end */ +/* @group Retina compatibility */ +@media only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (min-resolution: 144dpi) { + .chosen-rtl .chosen-search input[type="text"], + .chosen-container-single .chosen-single abbr, + .chosen-container-single .chosen-single div b, + .chosen-container-single .chosen-search input[type="text"], + .chosen-container-multi .chosen-choices .search-choice .search-choice-close, + .chosen-container .chosen-results-scroll-down span, + .chosen-container .chosen-results-scroll-up span { + background-image: url('chosen-sprite@2x.png') !important; + background-size: 52px 37px !important; + background-repeat: no-repeat !important; + } +} +/* @end */ + +/* search results page - start */ +#category .chosen-container-single .chosen-single span { + min-height: 45px; + top: 11px; +} +/* search results page - end */ \ No newline at end of file diff --git a/modules/wkroomsearchblock/views/img/chosen-sprite.png b/modules/wkroomsearchblock/views/img/chosen-sprite.png new file mode 100644 index 0000000000000000000000000000000000000000..3611ae4ace1c4b1cbeacd6145b5a79cbc72e0bdc GIT binary patch literal 646 zcmV;10(t$3P)0006_Nkl&pbAC0n?)s%2x5M$#UgGxI1~gymp~v; zh<`zGaTJP5BybQY4tlRo;SIcmE0t>ueW3>*u6N;@_u;;|BoL8PuhZ#FWY9$(flan1oVvxDBL8~}0Q5z;^2p>Ov z7}Q$E7=l>$BZLUt1*uKMCaQwKYf$lsJCyerWMd+%BeGH6f_f&Vpy%=$BN%uK%Ahxi zF+%Jj=Pc-WXF;djSiJw|m4>cN%^Fi|FBZ!E{_yJLS?RI<3U696XLkQSs z{{&kQJ$K(#5CgC1;GbA>mjm56zJZ^-Hg2_ASKI_K@CybPh7Rq}8ud``)NM~eZx}qT z)oK?Lf>t!B;%Uh}*P+)Ef?jbx#w|BNEVb(l{2LK}m#fw4xx>ddF;&j}!S{N-e!<&Q z?kvzyI_AT@H-u4tUz1h&GCh8>?TnA~?BZ7WGP<9`r gQ6DuZO!_~60ju@{TzXF%TmS$707*qoM6N<$g2#CqL;wH) literal 0 HcmV?d00001 diff --git a/modules/wkroomsearchblock/views/img/chosen-sprite@2x.png b/modules/wkroomsearchblock/views/img/chosen-sprite@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..ffe4d7d1121ca45cd35783696940050c690a8676 GIT binary patch literal 872 zcmeAS@N?(olHy`uVBq!ia0vp^89?mC!3-o5mOWetq|OBRgt-3y{~yTgfB`oc01C8& zL0el}Lqh|Q1oD8A5J8A6G6@lfkU;ftMr&&;+$f+RkloVK0wm!8C|FWb0x`e2xj8g6 z6i7l;BAWwL4-tfu5G@ccP!{MmqnYOy06pVW666=m!0_*bfx(A_gav;C1PU5HKT!C5 z;g7@l4POuZ{>hQBP{j4uqq`I2WP9&Sn{}I8xJi*&v*QL&+Dw-Bf-CQLyLk0Ht2-;T zynum$iPO`?F{C2y?bYjfj|~J`6Xz~`vM4Ef+U{Vpli%)D%kKSey_RG0Bi9Xw4jtOb z@!)?~_%DVelO793W#Pl3vjdNCDTnGGb(^YY+BbF2;mJK!nq}@nBGoHxCn#7X*gdxr z+~ZQF6rpL6;MDP)JzehcJBL53AM-QU?@65Plc4-}1EW@`H@EEGrnFmTubZ~5iUzVn zrZYyBIm|RmW$3F@+wkq2)c>|mGh5Rv3%(p~zjStyruBl(TP2_51LpTH2noN*e&}J; z1;$+4EpJ(Mb+^1}Fv>ms%b`r}+KYy~zf5x(4?8l28%eNnEHzx({;NGP)_hX&tEw9t zSKv=Qjt(d#~b;F7hbDdUu$OUK8iumkkl&-=~$APCd2zdqHg6@=Z#Pt*5RY_s@Hw*YS9+ z^u)7AmzM6Ux!dus_!gJY)Vtf?+t>a3wO2S)_Vct=T}#@RuG(h!d8WYZS9Tst+VfKv zt~zntPsvfyqLY`klZSPslCz_dlcSRJLa$Px)_+W2Y&u!?oJrIMCNTz2S3j3^P6 spaceBottom) { - dropdownClass = 'top'; - } + dropdownHeightMax = Math.max(dropdownHeightMax, dropdownHeight); + spaceTopMax = Math.max(spaceTopMax, spaceTop); + spaceBottomMax = Math.max(spaceBottomMax, spaceBottom); + }); - // position dropdown + let dropdownClass = 'bottom'; + if (spaceBottomMax < dropdownHeightMax && spaceTopMax > spaceBottomMax) { + dropdownClass = 'top'; + } + + $(inputFieldsAndDropdowns).each(function (i, inputFieldAndDropdown) { inputFieldAndDropdown.dropdown.removeClass('top bottom').addClass(dropdownClass); }); } diff --git a/modules/wkroomsearchblock/views/templates/front/hotel-options.tpl b/modules/wkroomsearchblock/views/templates/front/hotel-options.tpl new file mode 100644 index 000000000..8c4c9912a --- /dev/null +++ b/modules/wkroomsearchblock/views/templates/front/hotel-options.tpl @@ -0,0 +1,27 @@ +{** + * 2010-2023 Webkul. + * + * NOTICE OF LICENSE + * + * All right is reserved, + * Please go through LICENSE.txt file inside our module + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade this module to newer + * versions in the future. If you wish to customize this module for your + * needs please refer to CustomizationPolicy.txt file inside our module for more information. + * + * @author Webkul IN + * @copyright 2010-2023 Webkul IN + * @license LICENSE.txt + *} + + +{if isset($hotels_info) && is_array($hotels_info)} + {foreach from=$hotels_info item=hotel_info} + + {/foreach} +{/if} diff --git a/modules/wkroomsearchblock/views/templates/front/index.php b/modules/wkroomsearchblock/views/templates/front/index.php new file mode 100644 index 000000000..1ad696d30 --- /dev/null +++ b/modules/wkroomsearchblock/views/templates/front/index.php @@ -0,0 +1,29 @@ +{$category.name} + {/foreach} +{/if} diff --git a/modules/wkroomsearchblock/views/templates/hook/searchForm.tpl b/modules/wkroomsearchblock/views/templates/hook/searchForm.tpl index a515da256..ad5a675eb 100644 --- a/modules/wkroomsearchblock/views/templates/hook/searchForm.tpl +++ b/modules/wkroomsearchblock/views/templates/hook/searchForm.tpl @@ -1,7 +1,7 @@
    {if isset($location_enabled) && $location_enabled}
    - + {else}
    From 911055e5a5749e4868d1f43740d70b808054a3fb Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Thu, 28 Dec 2023 14:52:26 +0530 Subject: [PATCH 009/371] Fix hotel field issue --- modules/wkroomsearchblock/views/js/wk-room-search-block.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/wkroomsearchblock/views/js/wk-room-search-block.js b/modules/wkroomsearchblock/views/js/wk-room-search-block.js index 66e647ada..6f6e13477 100644 --- a/modules/wkroomsearchblock/views/js/wk-room-search-block.js +++ b/modules/wkroomsearchblock/views/js/wk-room-search-block.js @@ -688,10 +688,12 @@ $(document).ready(function() { // handle Tab/Enter keypresses on input fields - start $(document).on('keydown', '#hotel_location', function (e) { if (e.which == 9) { // Tab key - if ($('.location_search_results_ul').is(':visible')) { - e.preventDefault(); + e.preventDefault(); + if ($('.location_search_results_ul').is(':visible')) { $('.location_search_results_ul li:first').focus().click(); + } else { + BookingSearchManager.activateStep('hotel'); } } }); From d938b6e10d57575145f6757578b83bba49a35d3b Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Thu, 28 Dec 2023 15:35:11 +0530 Subject: [PATCH 010/371] Fix calendar issue --- .../wkroomsearchblock/views/js/wk-room-search-block.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/modules/wkroomsearchblock/views/js/wk-room-search-block.js b/modules/wkroomsearchblock/views/js/wk-room-search-block.js index 6f6e13477..3c006972f 100644 --- a/modules/wkroomsearchblock/views/js/wk-room-search-block.js +++ b/modules/wkroomsearchblock/views/js/wk-room-search-block.js @@ -275,8 +275,14 @@ $(document).ready(function() { } }); + // fix for: if user pressed Tab after selecting only one date + $('body').on('keydown', function(e) { + if (e.which == 9 && $('#date-range-picker-container').is(':visible')) { + $('#daterange_value').data('dateRangePicker').close(); + } + }); + // set data on clicking the searched location on dropdown - var focusHotelSelection = true; $(document).on('click', '.location_search_results_ul li', function(e) { e.preventDefault(); From d8063e7e2762b168a719a986002c33177109aa97 Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Thu, 28 Dec 2023 19:36:26 +0530 Subject: [PATCH 011/371] Fix occupancy and calendar issues --- .../views/js/wk-room-search-block.js | 142 ++++++++++++------ 1 file changed, 94 insertions(+), 48 deletions(-) diff --git a/modules/wkroomsearchblock/views/js/wk-room-search-block.js b/modules/wkroomsearchblock/views/js/wk-room-search-block.js index 3c006972f..ad4c75220 100644 --- a/modules/wkroomsearchblock/views/js/wk-room-search-block.js +++ b/modules/wkroomsearchblock/views/js/wk-room-search-block.js @@ -155,10 +155,13 @@ $(document).ready(function() { } }, endDate: max_order_date, + }).on('datepicker-first-date-selected', function() { + calendarFirstDateSelected = true; }).on('datepicker-change', function(event,obj){ $('#check_in_time').val($.datepicker.formatDate('yy-mm-dd', obj.date1)); $('#check_out_time').val($.datepicker.formatDate('yy-mm-dd', obj.date2)); focusNextOnCalendarClose = true; + calendarFirstDateSelected = false; }).on('datepicker-open', function() { $('#daterange_value').addClass('focused').focus(); }).on('datepicker-close', function() { @@ -181,14 +184,18 @@ $(document).ready(function() { startDate: $.datepicker.formatDate('dd-mm-yy', new Date()), startDate: start_date, endDate: max_order_date, + }).on('datepicker-first-date-selected', function() { + calendarFirstDateSelected = true; }).on('datepicker-change', function(event,obj){ $('#check_in_time').val($.datepicker.formatDate('yy-mm-dd', obj.date1)); $('#check_out_time').val($.datepicker.formatDate('yy-mm-dd', obj.date2)); focusNextOnCalendarClose = true; + calendarFirstDateSelected = false; }).on('datepicker-open', function() { $('#daterange_value').addClass('focused').focus(); }).on('datepicker-close', function() { $('#daterange_value').removeClass('focused').blur(); + calendarFirstDateSelected = false; }).on('datepicker-closed', function() { if (search_auto_focus_next_field && focusNextOnCalendarClose) { if (is_occupancy_wise_search) { @@ -265,7 +272,7 @@ $(document).ready(function() { } }); - var focusNextOnCalendarClose = true; + var focusNextOnCalendarClose = true, calendarFirstDateSelected = false;; // check if user clicked outside calendar $('body').on('click', function(e) { if ($('#date-range-picker-container').is(':visible')) { @@ -275,10 +282,22 @@ $(document).ready(function() { } }); - // fix for: if user pressed Tab after selecting only one date + // fix for: if user pressed Tab after selecting only first date $('body').on('keydown', function(e) { - if (e.which == 9 && $('#date-range-picker-container').is(':visible')) { + if (e.which == 9 + && $('#date-range-picker-container').is(':visible') + && calendarFirstDateSelected + ) { + e.preventDefault(); $('#daterange_value').data('dateRangePicker').close(); + + setTimeout(function () { + if (is_occupancy_wise_search) { + BookingSearchManager.activateStep('occupancy'); + } else { + BookingSearchManager.activateStep('submit'); + } + }, 10); } }); @@ -378,9 +397,8 @@ $(document).ready(function() { if (search_auto_focus_next_field) { setTimeout(function () { $('#id_hotel_button').data('chosen').close_field(); + BookingSearchManager.activateStep('date_range'); }, 10); - - BookingSearchManager.activateStep('date_range'); } } @@ -619,6 +637,54 @@ $(document).ready(function() { $("#search_occupancy_wrapper").toggle(); }); + function validateOccupancies() { + let hasErrors = 0; + + let adults = $("#search_occupancy_wrapper").find(".num_adults").map(function(){return $(this).val();}).get(); + let children = $("#search_occupancy_wrapper").find(".num_children").map(function(){return $(this).val();}).get(); + let child_ages = $("#search_occupancy_wrapper").find(".guest_child_age").map(function(){return $(this).val();}).get(); + + // start validating above values + if (!adults.length || (adults.length != children.length)) { + hasErrors = 1; + showErrorMessage(invalid_occupancy_txt); + } else { + $("#search_occupancy_wrapper").find('.occupancy_count').removeClass('error_border'); + + // validate values of adults and children + adults.forEach(function (item, index) { + if (isNaN(item) || parseInt(item) < 1) { + hasErrors = 1; + $("#search_occupancy_wrapper .num_adults").eq(index).closest('.occupancy_count_block').find('.occupancy_count').addClass('error_border'); + } + if (isNaN(children[index])) { + hasErrors = 1; + $("#search_occupancy_wrapper .num_children").eq(index).closest('.occupancy_count_block').find('.occupancy_count').addClass('error_border'); + } + }); + + // validate values of selected child ages + $("#search_occupancy_wrapper").find('.guest_child_age').removeClass('error_border'); + child_ages.forEach(function (age, index) { + age = parseInt(age); + if (isNaN(age) || (age < 0) || (age >= parseInt(max_child_age))) { + hasErrors = 1; + $("#search_occupancy_wrapper .guest_child_age").eq(index).addClass('error_border'); + } + }); + } + + if (hasErrors == 0) { + $("#search_occupancy_wrapper").hide(); + $("#search_hotel_block_form #guest_occupancy").removeClass('error_border'); + } else { + $("#search_hotel_block_form #guest_occupancy").addClass('error_border'); + return false; + } + + return true; + } + // close the occupancy block when clink anywhere in the body outside occupancy block $('body').on('click', function(e) { // @TODO better approach to be found @@ -626,54 +692,21 @@ $(document).ready(function() { if ($('#search_occupancy_wrapper').css('display') !== 'none') { if (!($(e.target).closest("#search_occupancy_wrapper").length)) { // Before closing the occupancy block validate the vaules inside - let hasErrors = 0; - - let adults = $("#search_occupancy_wrapper").find(".num_adults").map(function(){return $(this).val();}).get(); - let children = $("#search_occupancy_wrapper").find(".num_children").map(function(){return $(this).val();}).get(); - let child_ages = $("#search_occupancy_wrapper").find(".guest_child_age").map(function(){return $(this).val();}).get(); - - // start validating above values - if (!adults.length || (adults.length != children.length)) { - hasErrors = 1; - showErrorMessage(invalid_occupancy_txt); - } else { - $("#search_occupancy_wrapper").find('.occupancy_count').removeClass('error_border'); - - // validate values of adults and children - adults.forEach(function (item, index) { - if (isNaN(item) || parseInt(item) < 1) { - hasErrors = 1; - $("#search_occupancy_wrapper .num_adults").eq(index).closest('.occupancy_count_block').find('.occupancy_count').addClass('error_border'); - } - if (isNaN(children[index])) { - hasErrors = 1; - $("#search_occupancy_wrapper .num_children").eq(index).closest('.occupancy_count_block').find('.occupancy_count').addClass('error_border'); - } - }); - - // validate values of selected child ages - $("#search_occupancy_wrapper").find('.guest_child_age').removeClass('error_border'); - child_ages.forEach(function (age, index) { - age = parseInt(age); - if (isNaN(age) || (age < 0) || (age >= parseInt(max_child_age))) { - hasErrors = 1; - $("#search_occupancy_wrapper .guest_child_age").eq(index).addClass('error_border'); - } - }); - } - - if (hasErrors == 0) { - $("#search_occupancy_wrapper").hide(); - $("#search_hotel_block_form #guest_occupancy").removeClass('error_border'); - } else { - $("#search_hotel_block_form #guest_occupancy").addClass('error_border'); - return false; - } + return validateOccupancies(); } } } }); + $('body').on('keydown', function(e) { + if (e.which == 9 && $('#search_occupancy_wrapper:visible').length) { + e.preventDefault(); + if (validateOccupancies()) { + BookingSearchManager.activateStep('submit'); + } + } + }); + if (page_name == 'index') { $('#hotel_location, #id_hotel_button, #guest_occupancy').focus(function () { setBookingSearchPositions(); @@ -732,6 +765,19 @@ $(document).ready(function() { } }); + $(document).on('keydown', '#id_hotel_button_chosen .chosen-search input', function (e) { + if (e.which == 9 && $('#date-range-picker-container').is(':visible')) { // Tab key + e.preventDefault(); + $('#daterange_value').data('dateRangePicker').close(); + + if (is_occupancy_wise_search) { + BookingSearchManager.activateStep('occupancy'); + } else { + BookingSearchManager.activateStep('submit'); + } + } + }); + $(document).on('keydown', '#daterange_value', function (e) { if (e.which == 9) { // Tab key e.preventDefault(); From 730841d8c4ac223d6aa28005e1c2e1a19d44e2df Mon Sep 17 00:00:00 2001 From: abhishek-webkul <84142535+abhishek-webkul@users.noreply.github.com> Date: Thu, 15 Feb 2024 20:25:33 +0530 Subject: [PATCH 012/371] 2023 -> 2024 --- modules/wkroomsearchblock/views/css/chosen.css | 4 ++-- .../views/templates/front/hotel-options-dropdown.tpl | 4 ++-- .../views/templates/front/hotel-options-select.tpl | 4 ++-- modules/wkroomsearchblock/views/templates/front/index.php | 4 ++-- .../views/templates/front/location-options.tpl | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/modules/wkroomsearchblock/views/css/chosen.css b/modules/wkroomsearchblock/views/css/chosen.css index b5b31fd7a..779c5e4c7 100644 --- a/modules/wkroomsearchblock/views/css/chosen.css +++ b/modules/wkroomsearchblock/views/css/chosen.css @@ -1,5 +1,5 @@ /** - * 2010-2023 Webkul. + * 2010-2024 Webkul. * * NOTICE OF LICENSE * @@ -13,7 +13,7 @@ * needs please refer to CustomizationPolicy.txt file inside our module for more information. * * @author Webkul IN - * @copyright 2010-2023 Webkul IN + * @copyright 2010-2024 Webkul IN * @license LICENSE.txt */ diff --git a/modules/wkroomsearchblock/views/templates/front/hotel-options-dropdown.tpl b/modules/wkroomsearchblock/views/templates/front/hotel-options-dropdown.tpl index 9f6431809..8939516b2 100644 --- a/modules/wkroomsearchblock/views/templates/front/hotel-options-dropdown.tpl +++ b/modules/wkroomsearchblock/views/templates/front/hotel-options-dropdown.tpl @@ -1,5 +1,5 @@ {** - * 2010-2023 Webkul. + * 2010-2024 Webkul. * * NOTICE OF LICENSE * @@ -13,7 +13,7 @@ * needs please refer to CustomizationPolicy.txt file inside our module for more information. * * @author Webkul IN - * @copyright 2010-2023 Webkul IN + * @copyright 2010-2024 Webkul IN * @license LICENSE.txt *} diff --git a/modules/wkroomsearchblock/views/templates/front/hotel-options-select.tpl b/modules/wkroomsearchblock/views/templates/front/hotel-options-select.tpl index 8c4c9912a..b6dd9cd0d 100644 --- a/modules/wkroomsearchblock/views/templates/front/hotel-options-select.tpl +++ b/modules/wkroomsearchblock/views/templates/front/hotel-options-select.tpl @@ -1,5 +1,5 @@ {** - * 2010-2023 Webkul. + * 2010-2024 Webkul. * * NOTICE OF LICENSE * @@ -13,7 +13,7 @@ * needs please refer to CustomizationPolicy.txt file inside our module for more information. * * @author Webkul IN - * @copyright 2010-2023 Webkul IN + * @copyright 2010-2024 Webkul IN * @license LICENSE.txt *} diff --git a/modules/wkroomsearchblock/views/templates/front/index.php b/modules/wkroomsearchblock/views/templates/front/index.php index 1ad696d30..089d93577 100644 --- a/modules/wkroomsearchblock/views/templates/front/index.php +++ b/modules/wkroomsearchblock/views/templates/front/index.php @@ -1,6 +1,6 @@ Date: Thu, 29 Feb 2024 16:42:11 +0530 Subject: [PATCH 013/371] Fix placeholder issue --- modules/wkroomsearchblock/views/js/wk-room-search-block.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/wkroomsearchblock/views/js/wk-room-search-block.js b/modules/wkroomsearchblock/views/js/wk-room-search-block.js index ad4c75220..dc8226e9b 100644 --- a/modules/wkroomsearchblock/views/js/wk-room-search-block.js +++ b/modules/wkroomsearchblock/views/js/wk-room-search-block.js @@ -268,7 +268,7 @@ $(document).ready(function() { && e.target.id != 'hotel_location' ) { $('.location_search_results_ul').hide(); - $('#hotel_location').val(hotel_location_txt); + $('#hotel_location').attr('placeholder', hotel_location_txt); } }); From 3b2fef1c0166d67cd5fa980f773566d38add13c9 Mon Sep 17 00:00:00 2001 From: Shreesh Arora Date: Wed, 20 Mar 2024 19:34:17 +0530 Subject: [PATCH 014/371] get localization pack info from api.qloapps.com --- controllers/admin/AdminLocalizationController.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/controllers/admin/AdminLocalizationController.php b/controllers/admin/AdminLocalizationController.php index d6f8adb30..aaba53ffa 100644 --- a/controllers/admin/AdminLocalizationController.php +++ b/controllers/admin/AdminLocalizationController.php @@ -175,7 +175,7 @@ class AdminLocalizationControllerCore extends AdminController if (($iso_localization_pack = Tools::getValue('iso_localization_pack')) && Validate::isFileName($iso_localization_pack)) { if (Tools::getValue('download_updated_pack') == '1' || defined('_PS_HOST_MODE_')) { - $pack = @Tools::file_get_contents(_PS_API_URL_.'/localization/'.$version.'/'.$iso_localization_pack.'.xml'); + $pack = @Tools::file_get_contents(_QLO_API_URL_.'/localization/'.$version.'/'.$iso_localization_pack.'.xml'); } else { $pack = false; } @@ -226,7 +226,7 @@ class AdminLocalizationControllerCore extends AdminController $localizations_pack = false; $this->tpl_option_vars['options_content'] = $this->renderOptions(); - $xml_localization = Tools::simplexml_load_file(_PS_API_URL_.'/rss/localization.xml'); + $xml_localization = Tools::simplexml_load_file(_QLO_API_URL_.'/xml/localization.xml'); if (!$xml_localization) { $localization_file = _PS_ROOT_DIR_.'/localization/localization.xml'; if (file_exists($localization_file)) { @@ -248,7 +248,7 @@ class AdminLocalizationControllerCore extends AdminController } if (!$localizations_pack) { - return $this->displayWarning($this->l('Cannot connect to '._PS_API_URL_)); + return $this->displayWarning($this->l('Cannot connect to '._QLO_API_URL_)); } // Add local localization .xml files to the list if they are not already there From 7431fe587964ab64b63f23bdc702e7db814e01c7 Mon Sep 17 00:00:00 2001 From: Shreesh Arora Date: Thu, 21 Mar 2024 19:29:56 +0530 Subject: [PATCH 015/371] update recommendation content file path constant name and fixed key not exist issue --- classes/controller/AdminController.php | 19 ++++++++++--------- .../admin/AdminDashboardController.php | 2 +- .../admin/AdminModulesCatalogController.php | 2 +- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/classes/controller/AdminController.php b/classes/controller/AdminController.php index 9c246856b..0c802a493 100644 --- a/classes/controller/AdminController.php +++ b/classes/controller/AdminController.php @@ -399,7 +399,7 @@ class AdminControllerCore extends Controller const LEVEL_VIEW = 1; /** @var string path for recomendation content */ - const RECOMMENDATION_CONTENT = ''; + const RECOMMENDATION_CONTENT_FILE_PATH = ''; public function __construct() { @@ -3967,9 +3967,9 @@ class AdminControllerCore extends Controller if ($recommendationContent = $this->updateRecommendationContent()) { $content['cache'] = false; } - if (!isset($this->context->cookie->{$this->controller_name.'_closed'}) || !$this->context->cookie->{$this->controller_name.'_closed'}) { - if (file_exists(_PS_ROOT_DIR_.$this->context->controller->getRecommendationFilePath())) { - $content['success'] = true; + if (file_exists(_PS_ROOT_DIR_.$this->context->controller->getRecommendationFilePath())) { + $content['success'] = true; + if (!isset($this->context->cookie->{$this->controller_name.'_closed'}) || !$this->context->cookie->{$this->controller_name.'_closed'}) { $content['html'] = file_get_contents(_PS_ROOT_DIR_.$this->context->controller->getRecommendationFilePath()); } } @@ -3985,10 +3985,11 @@ class AdminControllerCore extends Controller array('controller' => $this->context->controller->controller_name) )) { $recommendationContent = json_decode($recommendationContent, true); - if (isset($this->context->cookie->{$this->context->controller->controller_name.'_key'})) { - if ($this->context->cookie->{$this->context->controller->controller_name.'_key'} != $recommendationContent['key']) { - unset($this->context->cookie->{$this->context->controller->controller_name.'_closed'}); - } + if (!isset($this->context->cookie->{$this->context->controller->controller_name.'_key'})) { + $this->context->cookie->{$this->context->controller->controller_name.'_key'} = ''; + } + if ($this->context->cookie->{$this->context->controller->controller_name.'_key'} != $recommendationContent['key']) { + unset($this->context->cookie->{$this->context->controller->controller_name.'_closed'}); } $this->context->cookie->{$this->context->controller->controller_name.'_key'} = $recommendationContent['key']; if (isset($recommendationContent['success']) && $recommendationContent['success']) { @@ -4018,7 +4019,7 @@ class AdminControllerCore extends Controller public function getRecommendationFilePath() { - return static::RECOMMENDATION_CONTENT; + return static::RECOMMENDATION_CONTENT_FILE_PATH; } /** diff --git a/controllers/admin/AdminDashboardController.php b/controllers/admin/AdminDashboardController.php index 361b00e07..2c365ef6b 100644 --- a/controllers/admin/AdminDashboardController.php +++ b/controllers/admin/AdminDashboardController.php @@ -27,7 +27,7 @@ class AdminDashboardControllerCore extends AdminController { - const RECOMMENDATION_CONTENT = '/cache/dashboard_recommendation.html'; + const RECOMMENDATION_CONTENT_FILE_PATH = '/cache/dashboard_recommendation.html'; public function __construct() { diff --git a/controllers/admin/AdminModulesCatalogController.php b/controllers/admin/AdminModulesCatalogController.php index f8e498b3f..4bb3defe0 100644 --- a/controllers/admin/AdminModulesCatalogController.php +++ b/controllers/admin/AdminModulesCatalogController.php @@ -23,7 +23,7 @@ class AdminModulesCatalogControllerCore extends AdminController public $modules; - const RECOMMENDATION_CONTENT = '/cache/catalog_recommendation.html'; + const RECOMMENDATION_CONTENT_FILE_PATH = '/cache/catalog_recommendation.html'; const ELEMENT_TYPE_MODULE = 1; const ELEMENT_TYPE_THEME = 2; From 2ef62c630c6db766413469acd4690d880215af36 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Thu, 28 Mar 2024 16:04:48 +0530 Subject: [PATCH 016/371] Added: Done button into the occupacy block in the front office --- .../views/css/wk-global-search.css | 8 ++- .../views/js/wk-room-search-block.js | 51 +++++++++++++++++ .../views/templates/hook/searchForm.tpl | 26 ++++++++- .../_partials/occupancy_field.tpl | 7 ++- .../hotel-reservation-theme/js/occupancy.js | 56 +++++++++++++++++++ 5 files changed, 143 insertions(+), 5 deletions(-) diff --git a/modules/wkroomsearchblock/views/css/wk-global-search.css b/modules/wkroomsearchblock/views/css/wk-global-search.css index d70fd2e11..59f781dc3 100644 --- a/modules/wkroomsearchblock/views/css/wk-global-search.css +++ b/modules/wkroomsearchblock/views/css/wk-global-search.css @@ -206,6 +206,12 @@ text-transform: uppercase; border: none; border-radius: 4px;} + .select_occupancy_btn { + background-color: #1292FF; + font-size: 13px; + border: none; + padding: 5px 20px; + border-radius: 4px;} /* occupancy */ @@ -216,7 +222,7 @@ overflow: auto; box-shadow: 0 8px 25px -4px rgba(0,0,0,0.39); left: 0px; - padding: 20px;} + padding: 12px 20px;} #search_occupancy_wrapper .occupancy-info-separator { margin-bottom: 15px; margin-top: 15px; diff --git a/modules/wkroomsearchblock/views/js/wk-room-search-block.js b/modules/wkroomsearchblock/views/js/wk-room-search-block.js index f5d180d16..6080b36c5 100644 --- a/modules/wkroomsearchblock/views/js/wk-room-search-block.js +++ b/modules/wkroomsearchblock/views/js/wk-room-search-block.js @@ -569,6 +569,57 @@ $(document).ready(function() { } } }); + $(document).on('click', '#search_occupancy_wrapper .select_occupancy_btn', function(e) { + e.preventDefault(); + if ($('#search_occupancy_wrapper').length) { + if ($('#search_occupancy_wrapper').css('display') !== 'none') { + // Before closing the occupancy block validate the vaules inside + let hasErrors = 0; + + let adults = $("#search_occupancy_wrapper").find(".num_adults").map(function(){return $(this).val();}).get(); + let children = $("#search_occupancy_wrapper").find(".num_children").map(function(){return $(this).val();}).get(); + let child_ages = $("#search_occupancy_wrapper").find(".guest_child_age").map(function(){return $(this).val();}).get(); + + // start validating above values + if (!adults.length || (adults.length != children.length)) { + hasErrors = 1; + showErrorMessage(invalid_occupancy_txt); + } else { + $("#search_occupancy_wrapper").find('.occupancy_count').removeClass('error_border'); + + // validate values of adults and children + adults.forEach(function (item, index) { + if (isNaN(item) || parseInt(item) < 1) { + hasErrors = 1; + $("#search_occupancy_wrapper .num_adults").eq(index).closest('.occupancy_count_block').find('.occupancy_count').addClass('error_border'); + } + if (isNaN(children[index])) { + hasErrors = 1; + $("#search_occupancy_wrapper .num_children").eq(index).closest('.occupancy_count_block').find('.occupancy_count').addClass('error_border'); + } + }); + + // validate values of selected child ages + $("#search_occupancy_wrapper").find('.guest_child_age').removeClass('error_border'); + child_ages.forEach(function (age, index) { + age = parseInt(age); + if (isNaN(age) || (age < 0) || (age >= parseInt(max_child_age))) { + hasErrors = 1; + $("#search_occupancy_wrapper .guest_child_age").eq(index).addClass('error_border'); + } + }); + } + + if (hasErrors == 0) { + $("#search_occupancy_wrapper").hide(); + $("#search_hotel_block_form #guest_occupancy").removeClass('error_border'); + } else { + $("#search_hotel_block_form #guest_occupancy").addClass('error_border'); + return false; + } + } + } + }); }); // function to set occupancy infor in guest occupancy field(search form) function setGuestOccupancy() diff --git a/modules/wkroomsearchblock/views/templates/hook/searchForm.tpl b/modules/wkroomsearchblock/views/templates/hook/searchForm.tpl index 9629b5e69..3f93b5dc2 100644 --- a/modules/wkroomsearchblock/views/templates/hook/searchForm.tpl +++ b/modules/wkroomsearchblock/views/templates/hook/searchForm.tpl @@ -1,3 +1,22 @@ +{* +* Copyright since 2010 Webkul. +* +* NOTICE OF LICENSE +* +* All right is reserved, +* Please go through this link for complete license : https://store.webkul.com/license.html +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade this module to 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 IN +* @license https://store.webkul.com/license.html +*} + {if isset($location_enabled) && $location_enabled}
    @@ -201,9 +220,12 @@
    {/if}
    - + + + +
    diff --git a/themes/hotel-reservation-theme/_partials/occupancy_field.tpl b/themes/hotel-reservation-theme/_partials/occupancy_field.tpl index c16039713..ccd9b288e 100644 --- a/themes/hotel-reservation-theme/_partials/occupancy_field.tpl +++ b/themes/hotel-reservation-theme/_partials/occupancy_field.tpl @@ -175,11 +175,14 @@ {/if} - + + + + \ No newline at end of file diff --git a/themes/hotel-reservation-theme/js/occupancy.js b/themes/hotel-reservation-theme/js/occupancy.js index 2cb25784d..0fd907f81 100644 --- a/themes/hotel-reservation-theme/js/occupancy.js +++ b/themes/hotel-reservation-theme/js/occupancy.js @@ -160,6 +160,62 @@ $(document).ready(function(){ } }); + $(document).on('click', '.booking_occupancy_wrapper .select_occupancy_btn', function(e) { + e.preventDefault(); + if ($('.booking_occupancy_wrapper:visible').length) { + var occupancy_wrapper = $('.booking_occupancy_wrapper:visible'); + $(occupancy_wrapper).find(".occupancy_info_block").addClass('selected'); + setRoomTypeGuestOccupancy(occupancy_wrapper); + + let hasErrors = 0; + + let adults = $(occupancy_wrapper).find(".num_adults").map(function(){return $(this).val();}).get(); + let children = $(occupancy_wrapper).find(".num_children").map(function(){return $(this).val();}).get(); + let child_ages = $(occupancy_wrapper).find(".guest_child_age").map(function(){return $(this).val();}).get(); + + // start validating above values + if (!adults.length || (adults.length != children.length)) { + hasErrors = 1; + showErrorMessage(invalid_occupancy_txt); + } else { + $(occupancy_wrapper).find('.occupancy_count').removeClass('error_border'); + + // validate values of adults and children + adults.forEach(function (item, index) { + if (isNaN(item) || parseInt(item) < 1) { + hasErrors = 1; + $(occupancy_wrapper).find(".num_adults").eq(index).closest('.occupancy_count_block').find('.occupancy_count').addClass('error_border'); + } + if (isNaN(children[index])) { + hasErrors = 1; + $(occupancy_wrapper).find(".num_children").eq(index).closest('.occupancy_count_block').find('.occupancy_count').addClass('error_border'); + } + }); + + // validate values of selected child ages + $(occupancy_wrapper).find('.guest_child_age').removeClass('error_border'); + child_ages.forEach(function (age, index) { + age = parseInt(age); + if (isNaN(age) || (age < 0) || (age >= parseInt(max_child_age))) { + hasErrors = 1; + $(occupancy_wrapper).find(".guest_child_age").eq(index).addClass('error_border'); + } + }); + } + if (hasErrors == 0) { + if (!($(e.target).closest(".ajax_add_to_cart_button").length + || $(e.target).closest(".exclusive.book_now_submit").length + )) { + $(occupancy_wrapper).parent().removeClass('open'); + $(occupancy_wrapper).siblings(".booking_guest_occupancy").removeClass('error_border'); + $(document).trigger( "QloApps:updateRoomOccupancy", [occupancy_wrapper]); + } + } else { + $(occupancy_wrapper).siblings(".booking_guest_occupancy").addClass('error_border'); + } + } + }); + $(document).on('click', function(e) { if ($('.booking_occupancy_wrapper:visible').length) { var occupancy_wrapper = $('.booking_occupancy_wrapper:visible'); From eee9b34aa8f5cee0573b3d3e5b1772559090d08a Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Thu, 28 Mar 2024 19:45:43 +0530 Subject: [PATCH 017/371] Updated: Service product updation process on the front in the product controller --- .../_partials/service-products-list-row.tpl | 7 +- .../hotel-reservation-theme/css/product.css | 10 +- themes/hotel-reservation-theme/js/product.js | 282 +++++++++++------- themes/hotel-reservation-theme/product.tpl | 5 +- 4 files changed, 187 insertions(+), 117 deletions(-) diff --git a/themes/hotel-reservation-theme/_partials/service-products-list-row.tpl b/themes/hotel-reservation-theme/_partials/service-products-list-row.tpl index bf16754d8..7b2aef6a6 100644 --- a/themes/hotel-reservation-theme/_partials/service-products-list-row.tpl +++ b/themes/hotel-reservation-theme/_partials/service-products-list-row.tpl @@ -45,13 +45,18 @@ {if !$PS_CATALOG_MODE && !$order_date_restrict && ($product.show_price && !isset($restricted_country_mode))} {if !$priceDisplay}{convertPrice price=$product.price_tax_incl}{else}{convertPrice price=$product.price_tax_exc}{/if}{if $product.price_calculation_method == Product::PRICE_CALCULATION_METHOD_PER_DAY}{l s='/Night'}{/if} + {if $product.allow_multiple_quantity && $product.available_for_order} + + {l s='Maximum '} {$product.max_quantity} {l s='quantity can be added'}. + + {/if} {/if}
    {if ($product.show_price && !isset($restricted_country_mode))} {if $product.available_for_order && !$PS_CATALOG_MODE && !$order_date_restrict && !((isset($restricted_country_mode) && $restricted_country_mode))} - + {if $product.allow_multiple_quantity && $product.available_for_order}
    diff --git a/themes/hotel-reservation-theme/css/product.css b/themes/hotel-reservation-theme/css/product.css index cd1528066..4668110e1 100644 --- a/themes/hotel-reservation-theme/css/product.css +++ b/themes/hotel-reservation-theme/css/product.css @@ -1528,7 +1528,7 @@ ul.service-product-nav > li:hover { .service_product_action_block { display: flex; justify-content: space-between; - align-items: end; + align-items: center; flex-wrap: wrap; } .service-product-element .service-product-img { @@ -1543,6 +1543,14 @@ ul.service-product-nav > li:hover { font-size: 14px; line-height: 22px; } +.service-product-max-quantity-info, .service-product-selected-quantity-info { + display: block; + font-size: 12px; + line-height: 22px; + font-style: italic; + color: #959595; + font-weight: 400; +} .service-product-element .service-product-price { font-weight: 600; font-size: 22px; diff --git a/themes/hotel-reservation-theme/js/product.js b/themes/hotel-reservation-theme/js/product.js index 90fe2eb4e..5fbd02469 100644 --- a/themes/hotel-reservation-theme/js/product.js +++ b/themes/hotel-reservation-theme/js/product.js @@ -1118,6 +1118,7 @@ $(document).ready(function() { } $(this).closest('.qty_container').find('.qty_count span').text(newQuantity); qtyfield.val(newQuantity); + updateServiceQuantity(this); }); // The button to decrement the product value @@ -1132,6 +1133,7 @@ $(document).ready(function() { $(this).closest('.qty_container').find('.qty_count span').text(1); qtyfield.val(1); } + updateServiceQuantity(this); }); var ajax_check_var = ''; @@ -1204,90 +1206,110 @@ $(document).ready(function() { } } - function addProductToRoomType(that) { - var id_product = $(that).data('id-product'); - var qty = $('input#service_product_qty_'+id_product).val(); - if (typeof(qty) == 'undefined') { - qty = 1; - } - var added_service_product = []; - $('#additional_products input.service_product').each(function () { - added_service_product.push({ - 'id_product': $(this).data('id_product'), - 'quantity':$(this).val(), - }); - }); - $.ajax({ - type: 'POST', - headers: { - "cache-control": "no-cache" - }, - url: product_controller_url, - dataType: 'JSON', - cache: false, - data: { - date_from: $('#room_check_in').val(), - date_to: $('#room_check_out').val(), - qty: qty, - id_product: $('#product_page_product_id').val(), - service_product: id_product, - added_service_product: added_service_product, - action: 'checkServiceProductWithRoomType', - ajax: true, - token: static_token - }, - success: function(result) { - if (result.success) { - if (result.add) { - if ($('input#service_product_'+ id_product).length) { - var prevQty = $('input#service_product_'+ id_product).val(); - if (parseInt(prevQty) > 0) { - qty = parseInt(qty) + parseInt(prevQty); - } - $('input#service_product_'+ id_product).val(qty); - } else { - $('').attr({ - id: 'service_product_'+ id_product, - name: 'service_product['+ id_product +'][]', - class: 'service_product', - 'data-id_product': id_product, - value: qty - }).appendTo('#additional_products'); - } - } - // reset input - $(that).closest('.service_product_action_block').find('input.service_product_qty').val(1); - $(that).closest('.service_product_action_block').find('.qty_count span').text(1); - if (result.msg) { - if (result.add) { - showSuccessMessage(result.msg); - } else { - showErrorMessage(result.msg); - } - } - BookingForm.refresh(); - } else { - if (result.error) { - showErrorMessage(result.error); - } - } - }, - error: function(jqXHR, textStatus, errorThrown) - { - if ((textStatus != 'error' || errorThrown != '') && textStatus != 'abort') - showErrorMessage(textStatus + ': ' + errorThrown); - } - }); - } - - function removeRoomtypeProduct(that) - { - var id_product = $(that).data('id_product'); + $(document).on('click', '.remove_roomtype_product', function(){ + showSuccessMessage(cart_extra_service_remove); + var id_product = $(this).data('id-product'); $(document).find('input#service_product_'+ id_product).remove(); BookingForm.refresh(); - } + $(this).closest('.service_product_action_block').find('input.service_product_qty').val(1); + $(this).closest('.service_product_action_block').find('.qty_count span').text(1); + }); }); +function addProductToRoomType(that) { + var id_product = $(that).data('id-product'); + var qty = $('input#service_product_qty_'+id_product).val(); + if (typeof(qty) == 'undefined') { + qty = 1; + } + var added_service_product = []; + $('#additional_products input.service_product').each(function () { + added_service_product.push({ + 'id_product': $(this).data('id_product'), + 'quantity':$(this).val(), + }); + }); + $.ajax({ + type: 'POST', + headers: { + "cache-control": "no-cache" + }, + url: product_controller_url, + dataType: 'JSON', + cache: false, + data: { + date_from: $('#room_check_in').val(), + date_to: $('#room_check_out').val(), + qty: qty, + id_product: $('#product_page_product_id').val(), + service_product: id_product, + added_service_product: added_service_product, + action: 'checkServiceProductWithRoomType', + ajax: true, + token: static_token + }, + success: function(result) { + if (result.success) { + if (result.add) { + if ($('input#service_product_'+ id_product).length) { + var prevQty = $('input#service_product_'+ id_product).val(); + if (parseInt(prevQty) > 0) { + qty = parseInt(qty) + parseInt(prevQty); + } + $('input#service_product_'+ id_product).val(qty); + } else { + $('').attr({ + id: 'service_product_'+ id_product, + name: 'service_product['+ id_product +'][]', + class: 'service_product', + 'data-id_product': id_product, + value: qty + }).appendTo('#additional_products'); + } + } + // reset input + if (result.add) { + showSuccessMessage(cart_extra_service_add); + } else { + showErrorMessage(result.msg); + } + BookingForm.refresh(); + } else { + if (result.error) { + showErrorMessage(result.error); + } + } + }, + error: function(jqXHR, textStatus, errorThrown) + { + if ((textStatus != 'error' || errorThrown != '') && textStatus != 'abort') + showErrorMessage(textStatus + ': ' + errorThrown); + } + }); +} + +function removeRoomtypeProduct(that) { + var id_product = $(that).data('id_product'); + $(document).find('input#service_product_'+ id_product).remove(); + BookingForm.refresh(); +} + +function updateServiceQuantity(that) { + var buttonElement = $(that).closest('.service_product_action_block').find('.btn-service-product'); + if ($(buttonElement).hasClass('remove_roomtype_product')) { + var id_product = $(buttonElement).data('id-product'); + var newQuantity = parseInt($('#service_product_qty_'+id_product).val()); + var oldQuantity = parseInt($('#service_product_'+id_product).val()); + if (newQuantity != oldQuantity) { + $('#service_product_'+id_product).val(newQuantity); + BookingForm.refresh().then(function (res) { + showSuccessMessage(cart_extra_service_update); + }); + } + } +} + + function initMap() { const map = new google.maps.Map($('#room_type_map_tab .map-wrap').get(0), { zoom: 10, @@ -1363,6 +1385,8 @@ var BookingForm = { disableRoomTypeDemands(0); disableRoomTypeServices(0); } + + updateSelectedServices(); }, initDatepicker: function(max_order_date, preparation_time, dateFrom, dateTo) { let start_date = new Date(); @@ -1439,42 +1463,47 @@ var BookingForm = { return data; }, refresh: function(resetOccupancy = false) { - BookingForm.currentRequest = $.ajax({ - url: product_controller_url, - type: 'POST', - headers: { 'cache-control': 'no-cache' }, - dataType: 'JSON', - cache: false, - data: $.extend({ - ajax: true, - action: 'refreshBookingForm', - }, BookingForm.getFormData()), - beforeSend: function() { - if(BookingForm.currentRequest != null) { - BookingForm.currentRequest.abort(); - } - $('.book_now_submit').prop('disabled', true).find('span:not(#booking_action_loader)').hide(); - $('#booking_action_block').find('#booking_action_loader').addClass('active'); - }, - success: function(response) { - if (response.status == true) { - $('.booking-form').replaceWith(response.html_booking_form); - BookingForm.init(); - - if (resetOccupancy) { - BookingForm.resetOccupancy(); + return new Promise((resolve, reject) => { + BookingForm.currentRequest = $.ajax({ + url: product_controller_url, + type: 'POST', + headers: { 'cache-control': 'no-cache' }, + dataType: 'JSON', + cache: false, + data: $.extend({ + ajax: true, + action: 'refreshBookingForm', + }, BookingForm.getFormData()), + beforeSend: function() { + if(BookingForm.currentRequest != null) { + BookingForm.currentRequest.abort(); } + $('.book_now_submit').prop('disabled', true).find('span:not(#booking_action_loader)').hide(); + $('#booking_action_block').find('#booking_action_loader').addClass('active'); + }, + success: function(response) { + if (response.status == true) { + $('.booking-form').replaceWith(response.html_booking_form); + BookingForm.init(); + + if (resetOccupancy) { + BookingForm.resetOccupancy(); + } + resolve(response); + } + }, + error: function(jqXHR) { + reject(jqXHR); + if (jqXHR.readyState == 0) { + showErrorMessage(no_internet_txt); + } + }, + complete: function() { + resolve(true); + $('.book_now_submit').prop('disabled', false).find('span:not(#booking_action_loader)').show(); + $('#booking_action_block').find('#booking_action_loader').removeClass('active'); } - }, - error: function(jqXHR) { - if (jqXHR.readyState == 0) { - showErrorMessage(no_internet_txt); - } - }, - complete: function() { - $('.book_now_submit').prop('disabled', false).find('span:not(#booking_action_loader)').show(); - $('#booking_action_block').find('#booking_action_loader').removeClass('active'); - } + }); }); }, resetOccupancy: function () { @@ -1482,6 +1511,31 @@ var BookingForm = { } } +function updateSelectedServices() +{ + var room_service_products = getRoomsServiceProducts(); + $('.btn-service-product').text(select_txt); + $('.btn-service-product').addClass('btn-success'); + $('.btn-service-product').addClass('add_roomtype_product'); + $('.btn-service-product').removeClass('btn-danger'); + $('.btn-service-product').removeClass('remove_roomtype_product'); + if (room_service_products.length) { + $(room_service_products).each(function(index, value) { + var element = '.selected_room_type_product_'+value['id_product']; + if ($(element).parent().find('.service_product_qty').length) { + $('#service_product_qty_'+value['id_product']).val(value.quantity); + $(element).parent().find('.qty_count span').text(value.quantity) + } + + $(element).text(unselect_txt); + $(element).removeClass('btn-success'); + $(element).removeClass('add_roomtype_product'); + $(element).addClass('btn-danger'); + $(element).addClass('remove_roomtype_product'); + }); + } +} + function loadHotelImagesByPage(page = 1) { page = parseInt(page); diff --git a/themes/hotel-reservation-theme/product.tpl b/themes/hotel-reservation-theme/product.tpl index 0e22ce119..2fee426ff 100644 --- a/themes/hotel-reservation-theme/product.tpl +++ b/themes/hotel-reservation-theme/product.tpl @@ -785,7 +785,10 @@ {addJsDefL name=wrong_qty_cond}{l s='you are trying for a invalid quantity.' js=1}{/addJsDefL} {addJsDefL name=select_txt}{l s='Select' js=1}{/addJsDefL} {addJsDefL name=remove_txt}{l s='Remove' js=1}{/addJsDefL} - {addJsDefL name=cart_extra_service_add}{l s='Service is added to cart' js=1}{/addJsDefL} + {addJsDefL name=cart_extra_service_add}{l s='Service added' js=1}{/addJsDefL} + {addJsDefL name=unselect_txt}{l s='UnSelect' js=1}{/addJsDefL} + {addJsDefL name=cart_extra_service_remove}{l s='Service removed' js=1}{/addJsDefL} + {addJsDefL name=cart_extra_service_update}{l s='Service updated' js=1}{/addJsDefL} {/strip} {/if} \ No newline at end of file From b5eef16554822c3c1801a9a120b4d283996d1e77 Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Wed, 3 Apr 2024 15:06:33 +0530 Subject: [PATCH 018/371] Code organization --- js/daterangepicker/qlodaterangepicker.js | 59 +- .../controllers/front/autocompletesearch.php | 25 +- .../views/css/wk-global-search.css | 33 +- .../views/js/wk-room-search-block.js | 724 ++++++++++-------- ...l-options-select.tpl => hotel-options.tpl} | 0 .../views/templates/hook/searchForm.tpl | 44 +- .../css/daterangepicker.css | 6 +- themes/hotel-reservation-theme/css/global.css | 4 +- 8 files changed, 461 insertions(+), 434 deletions(-) rename modules/wkroomsearchblock/views/templates/front/{hotel-options-select.tpl => hotel-options.tpl} (100%) diff --git a/js/daterangepicker/qlodaterangepicker.js b/js/daterangepicker/qlodaterangepicker.js index 7e4186a97..401d2b6bc 100644 --- a/js/daterangepicker/qlodaterangepicker.js +++ b/js/daterangepicker/qlodaterangepicker.js @@ -22,6 +22,9 @@ var dateRangePickerOrg = $.fn.dateRangePicker; $.fn.dateRangePicker = function(opt) { if(typeof opt === "object") { + let container = $(this).parent(); + container.css({ position: 'relative' }); + const custom_opt = { format: 'DD-MM-YYYY', showTopbar: false, @@ -31,15 +34,14 @@ minDays: 2, startOfWeek: 'monday', hoveringTooltip: false, - container: page_name == 'index' ? '#date-range-picker-container' : '#page', - inline: page_name == 'index', + container: container, + inline: true, customArrowPrevSymbol: '', customArrowNextSymbol: '', - getValue: function() - { + getValue: function() { return $(this).find('span').html(); }, - setValue: function(s, s1, s2) { + setValue: function(s) { if (s) { $(this).find('span').html(s.replace('to', '  ')); } else { @@ -49,15 +51,56 @@ } } } + $.each(opt, function(index) { delete custom_opt[index]; }); $.extend(true, opt, custom_opt); - } var args = Array.prototype.slice.call(arguments,0); - return dateRangePickerOrg.apply(this, args); + + const dateRangePickerInput = dateRangePickerOrg.apply(this, args); + const calendarDom = $(dateRangePickerInput).data('dateRangePicker').getDatePicker(); + + dateRangePickerInput.on('datepicker-open', function() { + const positionClass = getPositionClass(dateRangePickerInput, calendarDom); + $(calendarDom).removeClass('top bottom').addClass(positionClass); + setPosition(dateRangePickerInput, calendarDom, positionClass) + }); + + return dateRangePickerInput; + + // helper function definitions + function getPositionClass(dateRangePickerInput, calendarDom) { + const inputElementHeight = dateRangePickerInput.outerHeight(); + const spaceTop = dateRangePickerInput.offset().top - $(window).scrollTop(); + const spaceBottom = $(window).height() - inputElementHeight - spaceTop; + const maxHeightNeeded = $(calendarDom).get(0).scrollHeight; + + let positionClass = 'bottom'; + // determine position class + if (spaceBottom < maxHeightNeeded && spaceTop > spaceBottom) { + positionClass = 'top'; + } + + return positionClass; + } + + function setPosition(dateRangePickerInput, calendarDom, positionClass) { + const inputElementHeight = dateRangePickerInput.outerHeight(); + + const css = {}; + if (positionClass == 'top') { + css.top = 'unset'; + css.bottom = inputElementHeight; + } else { + css.bottom = 'unset'; + css.top = $(dateRangePickerInput).position().top + inputElementHeight; + } + + $(calendarDom).css(css); + } } -})(jQuery); \ No newline at end of file +})(jQuery); diff --git a/modules/wkroomsearchblock/controllers/front/autocompletesearch.php b/modules/wkroomsearchblock/controllers/front/autocompletesearch.php index 696179ef5..9dfa3bed5 100644 --- a/modules/wkroomsearchblock/controllers/front/autocompletesearch.php +++ b/modules/wkroomsearchblock/controllers/front/autocompletesearch.php @@ -22,9 +22,10 @@ class WkRoomSearchBlockAutoCompleteSearchModuleFrontController extends ModuleFro { public function initContent() { - $result = array(); $this->display_column_left = false; $this->display_column_right = false; + + $result = array('status' => false); $search_data = Tools::getValue('to_search_data'); $location_category_id = Tools::getValue('location_category_id'); $obj_htl_info = new HotelBranchInformation(); @@ -35,7 +36,7 @@ class WkRoomSearchBlockAutoCompleteSearchModuleFrontController extends ModuleFro $html = $this->context->smarty->fetch( $this->module->getTemplatePath('location-options.tpl') ); - $result['status'] = 'success'; + $result['status'] = true; $result['data'] = $html; } } elseif (isset($location_category_id) && $location_category_id) { @@ -57,23 +58,15 @@ class WkRoomSearchBlockAutoCompleteSearchModuleFrontController extends ModuleFro } $this->context->smarty->assign(array('hotels_info' => $hotelsInfo)); - $html_select = $this->context->smarty->fetch( - $this->module->getTemplatePath('hotel-options-select.tpl') + $html = $this->context->smarty->fetch( + $this->module->getTemplatePath('hotel-options.tpl') ); - $html_dropdown = $this->context->smarty->fetch( - $this->module->getTemplatePath('hotel-options-dropdown.tpl') - ); - - $result['status'] = 'success'; - $result['data_select'] = $html_select; - $result['data_dropdown'] = $html_dropdown; - } else { - $result['status'] = 'failed2'; + $result['status'] = true; + $result['html_hotel_options'] = $html; } - } else { - $result['status'] = 'failed3'; } - die(json_encode($result)); + + $this->ajaxDie(json_encode($result)); } } diff --git a/modules/wkroomsearchblock/views/css/wk-global-search.css b/modules/wkroomsearchblock/views/css/wk-global-search.css index 5196325af..89acdfa75 100644 --- a/modules/wkroomsearchblock/views/css/wk-global-search.css +++ b/modules/wkroomsearchblock/views/css/wk-global-search.css @@ -63,21 +63,9 @@ column-gap: 5px; grid-template-columns: repeat(2, 1fr); } -#date-range-picker-container { - position: absolute; -} -#date-range-picker-container.top { - bottom: 82px; -} -#date-range-picker-container.bottom { - top: 85px; -} .fancybox-wrap #search_hotel_block_form .form-group.xs-calendar { position: relative; } -.fancybox-wrap #search_hotel_block_form #date-range-picker-container { - top: 56px; -} /* #search_hotel_block_form { display: grid; grid-template-columns: 0.8fr repeat(3, 1fr) 0.6fr; @@ -115,6 +103,9 @@ #search_hotel_block_form .header-rmsearch-input:active, #search_hotel_block_form .header-rmsearch-input:focus { border: 2px solid #1292FF;} #search_hotel_block_form #id_hotel_button { + appearance: none; + width: 100%; + padding-left: 35px; background: url("../../views/img/icon-hotel.svg") no-repeat 10px 50%, url("../../views/img/icon-dropdown-arrow.svg") no-repeat calc(100% - 10px) 50%; background-color: #FFF;} #search_hotel_block_form #guest_occupancy { @@ -157,15 +148,6 @@ position: relative;} .header-rmsearch-wrapper .dropdown-menu { margin: 0px;} -.header-rmsearch-wrapper .hotel_dropdown_ul { - position: absolute; - font-size: 14px; - font-weight: 400; - padding: 0px; - width: 100%; - box-shadow: 0 8px 25px -4px rgba(0,0,0,0.39); - max-height: 145px; - overflow-y: auto;} .header-rmsearch-wrapper .location_search_results_ul { position: absolute; font-size: 14px; @@ -176,7 +158,7 @@ box-shadow: 0 8px 25px -4px rgba(0,0,0,0.39); max-height: 145px; overflow-y: auto;} - .header-rmsearch-wrapper .location_search_results_ul li, .header-rmsearch-wrapper .hotel_dropdown_ul li { + .header-rmsearch-wrapper .location_search_results_ul li { background-color: #fff; color: #333333; cursor: pointer; @@ -184,7 +166,7 @@ font-size: 14px; list-style: outside none none; padding: 15px;} - .header-rmsearch-wrapper .location_search_results_ul li:hover, .header-rmsearch-wrapper .location_search_results_ul li:focus, .header-rmsearch-wrapper .location_search_results_ul li:active, .header-rmsearch-wrapper .hotel_dropdown_ul li:hover, .header-rmsearch-wrapper .hotel_dropdown_ul li:focus, .header-rmsearch-wrapper .hotel_dropdown_ul li:active { + .header-rmsearch-wrapper .location_search_results_ul li:hover, .header-rmsearch-wrapper .location_search_results_ul li:focus, .header-rmsearch-wrapper .location_search_results_ul li:active { background-color: #379bf0; color: #FFFFFF;} @@ -193,11 +175,6 @@ bottom: 55px; } .header-rmsearch-wrapper .location_search_results_ul.bottom { top: 100%; } -.header-rmsearch-wrapper .hotel_dropdown_ul.top { - top: unset; - bottom: 100%; } -.header-rmsearch-wrapper .hotel_dropdown_ul.bottom { - top: 100%; } .header-rmsearch-wrapper .label-desc-txt { diff --git a/modules/wkroomsearchblock/views/js/wk-room-search-block.js b/modules/wkroomsearchblock/views/js/wk-room-search-block.js index 9e458db28..f0c1d2dba 100644 --- a/modules/wkroomsearchblock/views/js/wk-room-search-block.js +++ b/modules/wkroomsearchblock/views/js/wk-room-search-block.js @@ -20,31 +20,294 @@ const BookingSearchManager = { inputSteps: { 'location': { - selector: '#hotel_location', - activate: function() { $('#hotel_location').focus(); }, - inputHasValue: function () { return ($('#hotel_location').val() != '') && ($('#location_category_id').val() != ''); }, + init: function() { + $('.location_search_results_ul').hide(); + + // search location with users searched characters + $(document).on('keyup', '#hotel_location', function(e) { + BookingSearchManager.inputSteps['location'].onInput.call(this, e); + }); + + // set data on clicking the searched location on dropdown + $(document).on('click', '.location_search_results_ul li', function(e) { + e.preventDefault(); + + BookingSearchManager.inputSteps['location'].onInputComplete.call(this, e); + }); + + // handle Tab key press on hotel location field + $(document).on('keydown', '#hotel_location', function (e) { + if (e.which == 9) { // Tab key + e.preventDefault(); + + if ($('.location_search_results_ul').is(':visible')) { + $('.location_search_results_ul li:first').focus().click(); + } else { + BookingSearchManager.activateStep('hotel'); + } + } + }); + + // handle Tab key press on hotel location list + $(document).on('keydown', '.location_search_results_ul li', function (e) { + if (e.which == 9) { // Tab key + e.preventDefault(); + $(this).click(); + } + }); + + // navigate to prev and next li in the location dropdown + $('body').on('keydown', '.location_search_results_ul li', function(e) { + if (e.which == 40 || e.which == 38) { + var ulElement = $(this).closest('ul'); + var ulLength = ulElement.find('li').length; + $(this).blur(); + ulElement.scrollTop($(this).index() * $(this).outerHeight()); + if (e.which == 40) { + if ($(this).index() != (ulLength - 1)) { + $(this).next('li.search_result_li').focus(); + } else { + ulElement.find('li:first').focus(); + } + } else if (e.which == 38) { + if ($(this).index()) { + $(this).prev('li.search_result_li').focus(); + } else { + ulElement.find('li:last').focus(); + } + } + } + }); + }, + activate: function() { + $('#hotel_location').focus(); + }, + inputHasValue: function () { + return ($('#hotel_location').val() != '') && ($('#location_category_id').val() != ''); + }, + onInput: function (e) { + if (e.which == 13) { + return; + } + + if (($('.location_search_results_ul').is(':visible')) && (e.which == 40 || e.which == 38)) { + $(this).blur(); + if (e.which == 40) { + $('.location_search_results_ul li:first').focus(); + } else if (e.which == 38) { + $('.location_search_results_ul li:last').focus(); + } + } else { + $('.location_search_results_ul').empty().hide(); + if ($(this).val() != '') { + abortRunningAjax(); + ajax_check_var = $.ajax({ + url: autocomplete_search_url, + data: { + to_search_data: $(this).val(), + }, + method: 'POST', + dataType: 'json', + success: function(result) { + if (result.status) { + $('.location_search_results_ul').html(result.data); + $('.location_search_results_ul').show(); + } + } + }); + } + } + }, + onInputComplete: function (e) { + e.preventDefault(); + + $('.location_search_results_ul').empty().hide(); + $('#hotel_location').attr('value', $(this).html()); + $('#location_category_id').val($(this).val()); + + // fetch hotels for selected location + $.ajax({ + url: autocomplete_search_url, + data: { + location_category_id: $('#location_category_id').val(), + }, + method: 'POST', + dataType: 'json', + success: function(result) { + if (result.status) { + $('#hotel_cat_id').val(''); + $('#id_hotel_button').html(result.html_hotel_options); + $('#id_hotel_button').trigger('chosen:updated'); + + if (search_auto_focus_next_field) { + BookingSearchManager.activateStep('hotel'); + } + } else { + alert(no_results_found_cond); + } + } + }); + }, }, 'hotel': { - selector: '#id_hotel_button', - activate: function() { $('#id_hotel_button').trigger('chosen:open'); }, - inputHasValue: function () { return ($('#id_hotel').val() != '') && ($('#hotel_cat_id').val() != ''); }, + init: function() { + $('select#id_hotel_button').chosen({ + search_contains: true, + disable_search: !hotel_name_has_search, + width: '100%', + }); + + $(document).on('change', '#id_hotel_button', function() { + if ($(this).find('option:selected').val().trim() != '') { + $('#id_hotel_button_chosen .chosen-search input').blur(); + BookingSearchManager.inputSteps['hotel'].onInputComplete.call(this); + } + }); + + // prevents calendar from closing on hotel selection + $(document).on('click', '#id_hotel_button_chosen li', function(e) { + e.stopPropagation(); + }); + + $(document).on('keydown', '#id_hotel_button_chosen.chosen-container-active', function (e) { + if (e.which == 9) { // Tab key + e.preventDefault(); + if ($('#daterange_value').length) { + $('#daterange_value').focus(); + $('#daterange_value').click(); + } + } + }); + + $(document).on('keydown', '#id_hotel_button_chosen .chosen-search input', function (e) { + if (e.which == 9 && $('#daterange_value').siblings('.date-picker-wrapper').is(':visible')) { // Tab key + e.preventDefault(); + $('#daterange_value').data('dateRangePicker').close(); + + if (is_occupancy_wise_search) { + BookingSearchManager.activateStep('occupancy'); + } else { + BookingSearchManager.activateStep('submit'); + } + } + }); + + // if chosen will not be initialized add placeholder to hotel select element as first option + if (!BookingSearchManager.isBrowserSupported()) { + $('select#id_hotel_button option').first().html(select_htl_txt); + } + + if (hotel_name_has_search) { + $('select#id_hotel_button').on('chosen:showing_dropdown', function() { + $(this).siblings('.chosen-container').find('.chosen-single').addClass('invisible') + }); + + $('select#id_hotel_button').on('chosen:hiding_dropdown', function() { + $(this).siblings('.chosen-container').find('.chosen-single').removeClass('invisible') + }); + } + }, + activate: function() { + $('#id_hotel_button').trigger('chosen:open'); + }, + inputHasValue: function () { + return ($('#id_hotel').val() != '') && ($('#hotel_cat_id').val() != ''); + }, + onInputComplete: function () { + $('#id_hotel_button_chosen .chosen-search input').blur(); + const selectedHotel = $(this).find('option:selected'); + + if ($(selectedHotel).val().trim() != '') { + const maxOrderDate = $(selectedHotel).attr('data-max_order_date'); + const preparationTime = $(selectedHotel).attr('data-preparation_time') + + createDateRangePicker(maxOrderDate, preparationTime, $('#check_in_time').val(), $('#check_out_time').val()); + + $('#max_order_date').val(maxOrderDate); + $('#preparation_time').val(preparationTime); + $('#id_hotel').val($(selectedHotel).attr('data-id-hotel')); + $('#hotel_cat_id').val($(selectedHotel).attr('data-hotel-cat-id')); + + if (search_auto_focus_next_field) { + setTimeout(function () { + if ($('#id_hotel_button').data('chosen') != undefined) { + $('#id_hotel_button').data('chosen').close_field(); + } + + BookingSearchManager.activateStep('date_range'); + }, 10); + } + } else { + $('#id_hotel').val(''); + $('#hotel_cat_id').val(''); + } + }, }, 'date_range': { - selector: '#daterange_value', - activate: function() { $('#daterange_value').data('dateRangePicker').open(); }, - inputHasValue: function () { return ($('#check_in_time').val() != '') && ($('#check_out_time').val() != ''); }, + init: function() { + $(document).on('keydown', '#daterange_value', function (e) { + if (e.which == 9) { // Tab key + e.preventDefault(); + $('#daterange_value').removeClass('focused').blur(); + + if ($('#daterange_value').data('dateRangePicker') != undefined) { + $('#daterange_value').data('dateRangePicker').close(); + } + + if (is_occupancy_wise_search) { + BookingSearchManager.activateStep('occupancy'); + } else { + BookingSearchManager.activateStep('submit'); + } + } + }); + }, + activate: function() { + $('#daterange_value').data('dateRangePicker').open(); + }, + inputHasValue: function () { + return ($('#check_in_time').val() != '') && ($('#check_out_time').val() != ''); + }, }, 'occupancy': { - selector: '#guest_occupancy', - activate: function() { if ($('#search_occupancy_wrapper').css('display') == 'none') { $('#guest_occupancy').click().focus(); } }, - inputHasValue: function () { return false; }, + init: function() { + $(document).on('keydown', '#guest_occupancy', function (e) { + if (e.which == 9) { // Tab key + e.preventDefault(); + if ($('#search_occupancy_wrapper').css('display') != 'none') { + $('#guest_occupancy').click(); + } + + BookingSearchManager.activateStep('submit'); + } + }); + }, + activate: function() { + if ($('#search_occupancy_wrapper').css('display') == 'none') { + $('#guest_occupancy').click().focus(); + } + }, + inputHasValue: function () { + return false; + }, }, 'submit': { - selector: '#search_room_submit', - activate: function() { $('#search_room_submit').focus(); }, - inputHasValue: function () { return false; }, + activate: function() { + $('#search_room_submit').focus(); + }, + inputHasValue: function () { + return false; + }, }, }, + init: function () { + this.inputSteps['location'].init(); + this.inputSteps['hotel'].init(); + this.inputSteps['date_range'].init(); + if (is_occupancy_wise_search) { + this.inputSteps['occupancy'].init(); + } + }, activateStep: function (step) { if (step in this.inputSteps) { this.inputSteps[step].activate(); @@ -53,10 +316,28 @@ const BookingSearchManager = { allFieldsFilled: function () { return this.inputSteps['hotel'].inputHasValue() && this.inputSteps['date_range'].inputHasValue() - } + }, + isBrowserSupported: function() { // defined as it is from chosen to decide if chosen will be initialized + if (window.navigator.appName === "Microsoft Internet Explorer") { + return document.documentMode >= 8; + } + if (/iP(od|hone)/i.test(window.navigator.userAgent)) { + return false; + } + if (/Android/i.test(window.navigator.userAgent)) { + if (/Mobile/i.test(window.navigator.userAgent)) { + return false; + } + } + + return true; + }, } $(document).ready(function() { + // initialize booking search fields + BookingSearchManager.init(); + // for screen size changes for room search var window_width = $(window).width(); if (window_width > 767) { @@ -84,24 +365,17 @@ $(document).ready(function() { helpers: { overlay: { closeClick: false } //Disable click outside event }, - 'beforeShow': function() { - $('#date-range-picker-container').closest('.form-group').addClass('xs-calendar'); - }, 'afterClose': function() { $('.header-rmsearch-container').show(); $('#xs_room_search_form').show(); - - $('#date-range-picker-container').closest('.form-group').removeClass('xs-calendar'); }, }); }); /*END*/ var ajax_check_var = ''; - $('.location_search_results_ul').hide(); - function createDateRangePicker(max_order_date, preparation_time, dateFrom, dateTo) - { + createDateRangePicker = function (max_order_date, preparation_time, dateFrom, dateTo) { let start_date = new Date(); if (preparation_time) { start_date.setDate(start_date.getDate() + parseInt(preparation_time)); @@ -177,6 +451,8 @@ $(document).ready(function() { BookingSearchManager.activateStep('submit'); } } + + focusNextOnCalendarClose = false; } }); } else { @@ -207,6 +483,8 @@ $(document).ready(function() { BookingSearchManager.activateStep('submit'); } } + + focusNextOnCalendarClose = false; } }); } @@ -217,207 +495,21 @@ $(document).ready(function() { $.datepicker.formatDate('dd-mm-yy', $.datepicker.parseDate('yy-mm-dd', dateTo)) ); } - } - function abortRunningAjax() { + abortRunningAjax = function () { if (ajax_check_var) { ajax_check_var.abort(); } } - // search location with users searched characters - $(document).on('keyup', "#hotel_location", function(e) { - if (e.which == 13) { - return; - } - - if (($('.location_search_results_ul').is(':visible')) && (e.which == 40 || e.which == 38)) { - $(this).blur(); - if (e.which == 40) { - $(".location_search_results_ul li:first").focus(); - } else if (e.which == 38) { - $(".location_search_results_ul li:last").focus(); - } - } else { - $('.location_search_results_ul').empty().hide(); - if ($(this).val() != '') { - abortRunningAjax(); - ajax_check_var = $.ajax({ - url: autocomplete_search_url, - data: { - to_search_data: $(this).val(), - }, - method: 'POST', - dataType: 'json', - success: function(result) { - if (result.status == 'success') { - $('.location_search_results_ul').html(result.data); - $('.location_search_results_ul').show(); - } - } - }); - } - } - }); - - // if user clicks anywhere and location li is visible then close it - $('body').on('click', function(e) { - if ($('.location_search_results_ul').is(':visible') - && e.target.className != 'search_result_li' - && e.target.id != 'hotel_location' - ) { - $('.location_search_results_ul').hide(); - $('#hotel_location').attr('placeholder', hotel_location_txt); - } - }); - - var focusNextOnCalendarClose = true, calendarFirstDateSelected = false;; - // check if user clicked outside calendar - $('body').on('click', function(e) { - if ($('#date-range-picker-container').is(':visible')) { - if (!$(e.target).closest('.form-group').find('#date-range-picker-container').length) { - focusNextOnCalendarClose = false; - } - } - }); - - // fix for: if user pressed Tab after selecting only first date - $('body').on('keydown', function(e) { - if (e.which == 9 - && $('#date-range-picker-container').is(':visible') - && calendarFirstDateSelected - ) { - e.preventDefault(); - $('#daterange_value').data('dateRangePicker').close(); - - setTimeout(function () { - if (is_occupancy_wise_search) { - BookingSearchManager.activateStep('occupancy'); - } else { - BookingSearchManager.activateStep('submit'); - } - }, 10); - } - }); - - // set data on clicking the searched location on dropdown - $(document).on('click', '.location_search_results_ul li', function(e) { - e.preventDefault(); - - $('.location_search_results_ul').empty().hide(); - $('#hotel_location').attr('value', $(this).html()); - $('#location_category_id').val($(this).val()); - - // fetch hotels for selected location - $.ajax({ - url: autocomplete_search_url, - data: { - location_category_id: $('#location_category_id').val(), - }, - method: 'POST', - dataType: 'json', - success: function(result) { - if (result.status == 'success') { - $('#hotel_cat_id').val(''); - $('#id_hotel_button').html(result.data_select); - $('.hotel_dropdown_ul').empty(); - $('.hotel_dropdown_ul').html(result.data_dropdown); - $('#id_hotel_button').trigger('chosen:updated'); - - if (search_auto_focus_next_field) { - BookingSearchManager.activateStep('hotel'); - } - } else { - alert(no_results_found_cond); - } - } - }); - - $('#id_hotel_button_chosen .chosen-search input').blur(); - }); - - // prevents calendar from closing on hotel selection - $(document).on('click', '#id_hotel_button_chosen li', function(e) { - e.stopPropagation(); - }); - - // navigate to prev and next li in the location/hotel dropdown - $('body').on('keyup', 'li.search_result_li', function(e) { - if (e.which == 40 || e.which == 38) { - var ulElement = $(this).closest('ul'); - var ulLength = ulElement.find('li').length; - $(this).blur(); - ulElement.scrollTop($(this).index() * $(this).outerHeight()); - if (e.which == 40) { - if ($(this).index() != (ulLength - 1)) { - $(this).next('li.search_result_li').focus(); - } else { - ulElement.find("li:first").focus(); - } - } else if (e.which == 38) { - if ($(this).index()) { - $(this).prev('li.search_result_li').focus(); - } else { - ulElement.find("li:last").focus(); - } - } - } - }); - - // if user is selecting the location by keydown / up key - $(document).on('keydown', 'body', function(e) { - if ((e.which == 40 || e.which == 38) && ($('.location_search_results_ul li.search_result_li').is(':visible') || $('.hotel_dropdown_ul li.search_result_li').is(':visible'))) { - return false; - } else if (e.which == 13 && e.target.className == 'search_result_li') { - e.target.click(); - } else if (e.which == 9 && $('.location_search_results_ul').is(':visible')) { - if ($('.location_search_results_ul .search_result_li').length) { - $('.location_search_results_ul li.search_result_li:first').click(); - } - } else if (e.which == 9 && $('.hotel_dropdown_ul').is(':visible')) { - if ($('.hotel_dropdown_ul .search_result_li').length) { - $('.hotel_dropdown_ul li.search_result_li:first').click(); - } - } - }); - - function selectHotelFromList(selectedHotel) { - let max_order_date = $(selectedHotel).attr('data-max_order_date'); - let preparation_time = $(selectedHotel).attr('data-preparation_time') - - createDateRangePicker(max_order_date, preparation_time, $('#check_in_time').val(), $('#check_out_time').val()); - - $("#max_order_date").val(max_order_date); - $('#preparation_time').val(preparation_time); - $('#id_hotel').val($(selectedHotel).attr('data-id-hotel')); - $('#hotel_cat_id').val($(selectedHotel).attr('data-hotel-cat-id')); - $('#hotel_cat_name').html($(selectedHotel).html()); - - if (search_auto_focus_next_field) { - setTimeout(function () { - $('#id_hotel_button').data('chosen').close_field(); - BookingSearchManager.activateStep('date_range'); - }, 10); - } - } - - $(document).on('change', '#id_hotel_button', function() { - $('#id_hotel_button_chosen .chosen-search input').blur(); - selectHotelFromList($(this).find('option:selected')); - }); - - $(document).on('click', '.hotel_dropdown_ul li', function() { - selectHotelFromList($(this)); - }); - // If only one hotel then set max order date on date pickers var max_order_date = $('#max_order_date').val(); var preparation_time = $('#preparation_time').val(); createDateRangePicker(max_order_date, preparation_time, $('#check_in_time').val(), $('#check_out_time').val()); // validations on the submit of the search fields - $('#search_room_submit').on('click', function(e) { + $(document).on('click', '#search_room_submit', function() { var check_in_time = $("#check_in_time").val(); var check_out_time = $("#check_out_time").val(); var max_order_date = $("#max_order_date").val(); @@ -474,9 +566,10 @@ $(document).ready(function() { else return true; }); + // Occupancy field dropdown // add occupancy info block - $('#search_occupancy_wrapper .add_new_occupancy_btn').on('click', function(e) { + $(document).on('click', '#search_occupancy_wrapper .add_new_occupancy_btn', function(e) { e.preventDefault(); var occupancy_block = ''; @@ -653,7 +746,7 @@ $(document).ready(function() { // toggle occupancy block $('#guest_occupancy').on('click', function(e) { e.stopPropagation(); - if ($('#date-range-picker-container').is(':visible')) { + if ($('#daterange_value').siblings('.date-picker-wrapper').is(':visible')) { $('#daterange_value').data('dateRangePicker').close(); } $("#search_occupancy_wrapper").toggle(); @@ -707,28 +800,95 @@ $(document).ready(function() { return true; } - // close the occupancy block when clink anywhere in the body outside occupancy block + // Body Events - start + var focusNextOnCalendarClose = true; + var calendarFirstDateSelected = false; $('body').on('click', function(e) { - // @TODO better approach to be found + // if user clicks anywhere and location li is visible then close it + if ($('.location_search_results_ul').is(':visible') + && e.target.className != 'search_result_li' + && e.target.id != 'hotel_location' + ) { + $('.location_search_results_ul').hide(); + $('#hotel_location').attr('placeholder', hotel_location_txt); + } + + // check if user clicked outside calendar + if ($('#daterange_value').siblings('.date-picker-wrapper').is(':visible')) { + if (!$(e.target).closest('.form-group').find('.date-picker-wrapper').length) { + focusNextOnCalendarClose = false; + } + } + + // close the occupancy block when clink anywhere in the body outside occupancy block if ($('#search_occupancy_wrapper').length) { if ($('#search_occupancy_wrapper').css('display') !== 'none') { if (!($(e.target).closest("#search_occupancy_wrapper").length)) { - // Before closing the occupancy block validate the vaules inside + // Before closing the occupancy block validate the values inside return validateOccupancies(); } } } }); + var isEnterKeyHeldOnLocation = false; $('body').on('keydown', function(e) { + let preventDefault = false; + + // fix for: if user pressed Tab after selecting only first date + if (e.which == 9 + && $('#daterange_value').siblings('.date-picker-wrapper').is(':visible') + && calendarFirstDateSelected + ) { + preventDefault = true; + $('#daterange_value').data('dateRangePicker').close(); + + setTimeout(function () { + if (is_occupancy_wise_search) { + BookingSearchManager.activateStep('occupancy'); + } else { + BookingSearchManager.activateStep('submit'); + } + }, 10); + } + + // if user is selecting the location by Up, Down, Enter or Tab keys + if ((e.which == 40 || e.which == 38) && $('.location_search_results_ul li.search_result_li').is(':visible')) { + return false; + } else if (e.which == 13 && e.target.className == 'search_result_li') { + // select location only after held Enter key is unheld + preventDefault = true; + isEnterKeyHeldOnLocation = true; + } else if (e.which == 9 && $('.location_search_results_ul').is(':visible')) { + preventDefault = true; + $(e.target).click(); + } + + // check if submit button must be focused if (e.which == 9 && $('#search_occupancy_wrapper:visible').length) { - e.preventDefault(); + preventDefault = true; if (validateOccupancies()) { BookingSearchManager.activateStep('submit'); } } + + if (preventDefault) { + e.preventDefault(); + } }); + // select location only after held Enter key is unheld + $('body').on('keyup', function(e) { + if ($(e.target).is('.location_search_results_ul li') + && isEnterKeyHeldOnLocation + && e.which == 13 + ) { + $(e.target).click(); + } + }); + // Body Events - end + + // set positions of popups when required if (page_name == 'index') { $('#hotel_location, #id_hotel_button, #guest_occupancy').focus(function () { setBookingSearchPositions(); @@ -745,112 +905,8 @@ $(document).ready(function() { setBookingSearchPositions(); }); } - - // handle Tab/Enter keypresses on input fields - start - $(document).on('keydown', '#hotel_location', function (e) { - if (e.which == 9) { // Tab key - e.preventDefault(); - - if ($('.location_search_results_ul').is(':visible')) { - $('.location_search_results_ul li:first').focus().click(); - } else { - BookingSearchManager.activateStep('hotel'); - } - } - }); - - $(document).on('keydown', '.location_search_results_ul li', function (e) { - if (e.which == 9) { // Tab key - e.preventDefault(); - $(this).click(); - } - }); - - $(document).on('keydown', '.hotel_dropdown_ul li', function (e) { - if (e.which == 9 || e.which == 13) { // Tab/Enter key - if (e.which == 9) { - $(this).click(); - } - if ($('#daterange_value').length) { - $('#daterange_value').click(); - } - } - }); - - $(document).on('keydown', '#id_hotel_button_chosen.chosen-container-active', function (e) { - if (e.which == 9) { // Tab key - e.preventDefault(); - if ($('#daterange_value').length) { - $('#daterange_value').focus(); - $('#daterange_value').click(); - } - } - }); - - $(document).on('keydown', '#id_hotel_button_chosen .chosen-search input', function (e) { - if (e.which == 9 && $('#date-range-picker-container').is(':visible')) { // Tab key - e.preventDefault(); - $('#daterange_value').data('dateRangePicker').close(); - - if (is_occupancy_wise_search) { - BookingSearchManager.activateStep('occupancy'); - } else { - BookingSearchManager.activateStep('submit'); - } - } - }); - - $(document).on('keydown', '#daterange_value', function (e) { - if (e.which == 9) { // Tab key - e.preventDefault(); - $('#daterange_value').removeClass('focused').blur(); - - if ($('#daterange_value').data('dateRangePicker') != undefined) { - $('#daterange_value').data('dateRangePicker').close(); - } - - if (is_occupancy_wise_search) { - BookingSearchManager.activateStep('occupancy'); - } else { - BookingSearchManager.activateStep('submit'); - } - } - }); - - $(document).on('keydown', '#guest_occupancy', function (e) { - if (e.which == 9) { // Tab key - e.preventDefault(); - if ($('#search_occupancy_wrapper').css('display') != 'none') { - $('#guest_occupancy').click(); - } - - BookingSearchManager.activateStep('submit'); - } - }); - // handle Tab/Enter keypresses on input fields - end - - $('select#id_hotel_button').chosen({ - search_contains: true, - disable_search: !hotel_name_has_search, - width: '100%', - }); - - if (hotel_name_has_search) { - $('select#id_hotel_button').on('chosen:showing_dropdown', function() { - $(this).siblings('.chosen-container').find('.chosen-single').addClass('invisible') - }); - - $('select#id_hotel_button').on('chosen:hiding_dropdown', function() { - $(this).siblings('.chosen-container').find('.chosen-single').removeClass('invisible') - }); - } - - // if hotel chosen is not intialized use dropdown - if ($('select#id_hotel_button').data('chosen') === undefined) { - $('#search_hotel_block_form .hotel-select-wrap').addClass('hide'); - $('#search_hotel_block_form .hotel-dropdown-wrap').removeClass('hide'); - } }); + // function to set occupancy infor in guest occupancy field(search form) function setGuestOccupancy() { @@ -884,44 +940,35 @@ function setGuestOccupancy() $('#guest_occupancy > span').text(guestButtonVal); } -// position dropdowns and the calendar +// position dropdowns function setBookingSearchPositions() { // calculate available spaces let searchForm = $('#search_hotel_block_form'); let inputFieldsAndDropdowns = [ { input: $('#hotel_location'), dropdown: $('.location_search_results_ul')}, - { input: $('#id_hotel_button'), dropdown: $('.hotel_dropdown_ul')}, { input: $('.hotel-selector-wrap'), dropdown: $('#id_hotel_button_chosen .chosen-drop')}, { input: $('#guest_occupancy'), dropdown: $('#search_occupancy_wrapper')}, ]; - let calendarInputField = { input: $('#daterange_value'), calendarContainer: $('#date-range-picker-container')}; - let positionClass = 'bottom'; if (!searchForm.closest('.fancybox-wrap').length) { let searchFormHeight = searchForm.outerHeight(); let spaceTop = searchForm.offset().top - $(window).scrollTop(); let spaceBottom = $(window).height() - searchFormHeight - spaceTop; - let calendarHeight = 292; - // calculate max height for dropdowns let maxHeightNeeded = 0; $(inputFieldsAndDropdowns).each(function (i, inputFieldAndDropdown) { if (!inputFieldAndDropdown.input.length) return false; // find needed space height - let cssMaxHeight = inputFieldAndDropdown.dropdown.css('max-height') || calendarHeight + 'px'; - let dropdownHeight = parseInt(cssMaxHeight.replace('px', '')); - dropdownHeight = Math.max(dropdownHeight || 0, calendarHeight); - - maxHeightNeeded = Math.max(maxHeightNeeded, dropdownHeight); + let cssMaxHeight = parseInt(inputFieldAndDropdown.dropdown.css('max-height')); + if (Number.isInteger(cssMaxHeight)) { + maxHeightNeeded = Math.max(maxHeightNeeded, cssMaxHeight); + } }); - // manage calendar now - maxHeightNeeded = Math.max(maxHeightNeeded, calendarHeight); - // determine position class if (spaceBottom < maxHeightNeeded && spaceTop > spaceBottom) { positionClass = 'top'; @@ -932,7 +979,4 @@ function setBookingSearchPositions() { $(inputFieldsAndDropdowns).each(function (i, inputFieldAndDropdown) { inputFieldAndDropdown.dropdown.removeClass('top bottom').addClass(positionClass); }); - - // position calendar - calendarInputField.calendarContainer.removeClass('top bottom').addClass(positionClass); } diff --git a/modules/wkroomsearchblock/views/templates/front/hotel-options-select.tpl b/modules/wkroomsearchblock/views/templates/front/hotel-options.tpl similarity index 100% rename from modules/wkroomsearchblock/views/templates/front/hotel-options-select.tpl rename to modules/wkroomsearchblock/views/templates/front/hotel-options.tpl diff --git a/modules/wkroomsearchblock/views/templates/hook/searchForm.tpl b/modules/wkroomsearchblock/views/templates/hook/searchForm.tpl index 2dbe8961d..1703b29bf 100644 --- a/modules/wkroomsearchblock/views/templates/hook/searchForm.tpl +++ b/modules/wkroomsearchblock/views/templates/hook/searchForm.tpl @@ -21,37 +21,13 @@ -
    -
    - -
    -
    -
    - {if isset($hotels_info) && count($hotels_info)} - - {/if} +
    +
    {/if} @@ -65,18 +41,12 @@
    {l s='Check-out' mod='wkroomsearchblock'}
    - {if isset($is_index_page) && $is_index_page} -
    - {/if}
    {else}
    {l s='Check-in' mod='wkroomsearchblock'}    {l s='Check-out' mod='wkroomsearchblock'}
    - {if isset($is_index_page) && $is_index_page} -
    - {/if}
    {/if} diff --git a/themes/hotel-reservation-theme/css/daterangepicker.css b/themes/hotel-reservation-theme/css/daterangepicker.css index f1b6cbe07..a84b58ff0 100644 --- a/themes/hotel-reservation-theme/css/daterangepicker.css +++ b/themes/hotel-reservation-theme/css/daterangepicker.css @@ -26,11 +26,11 @@ box-shadow: 0 4px 10px 0 rgb(0 0 0 / 26%); } .date-picker-wrapper.no-shortcuts { - margin-top: -4px; padding: 10px; } -#index .date-picker-wrapper.no-shortcuts { - margin-top: 0; +.date-picker-wrapper.top, +.date-picker-wrapper.bottom { + position: absolute; } .date-picker-wrapper .month-wrapper{ border: none; diff --git a/themes/hotel-reservation-theme/css/global.css b/themes/hotel-reservation-theme/css/global.css index 50095cd66..6d8662914 100644 --- a/themes/hotel-reservation-theme/css/global.css +++ b/themes/hotel-reservation-theme/css/global.css @@ -6533,8 +6533,8 @@ table.table_block td { .input-date span i, .form-control .input-date span i { transform: scale(0.8, 0.6);} -.input-hotel, .form-control .input-hotel, .input-location, .form-control .input-location { - background: url("../img/icon/icon-location.svg") no-repeat 10px 50%; +.input-location, .form-control .input-location { + background: url("../img/icon/icon-location.svg") no-repeat 6px 50%; padding-left: 35px; background-color: #FFF; } From 43374957176ffec7416e35056c2d28ab71cad9d8 Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Wed, 3 Apr 2024 15:10:49 +0530 Subject: [PATCH 019/371] Remove unwanted file hotel-options-dropdown.tpl --- .../front/hotel-options-dropdown.tpl | 26 ------------------- 1 file changed, 26 deletions(-) delete mode 100644 modules/wkroomsearchblock/views/templates/front/hotel-options-dropdown.tpl diff --git a/modules/wkroomsearchblock/views/templates/front/hotel-options-dropdown.tpl b/modules/wkroomsearchblock/views/templates/front/hotel-options-dropdown.tpl deleted file mode 100644 index 8939516b2..000000000 --- a/modules/wkroomsearchblock/views/templates/front/hotel-options-dropdown.tpl +++ /dev/null @@ -1,26 +0,0 @@ -{** - * 2010-2024 Webkul. - * - * NOTICE OF LICENSE - * - * All right is reserved, - * Please go through LICENSE.txt file inside our module - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade this module to newer - * versions in the future. If you wish to customize this module for your - * needs please refer to CustomizationPolicy.txt file inside our module for more information. - * - * @author Webkul IN - * @copyright 2010-2024 Webkul IN - * @license LICENSE.txt - *} - -{if isset($hotels_info) && is_array($hotels_info)} - {foreach from=$hotels_info item=hotel_info} -
  • - {$hotel_info.hotel_name} -
  • - {/foreach} -{/if} From 9cfb77554a08f220fd4204b571407d812f197bd0 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Wed, 3 Apr 2024 15:13:35 +0530 Subject: [PATCH 020/371] Fixed: Notice in Admin products when QloApps is installed without the demo data --- controllers/admin/AdminProductsController.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/controllers/admin/AdminProductsController.php b/controllers/admin/AdminProductsController.php index 3763fb057..0a5bbcf7e 100644 --- a/controllers/admin/AdminProductsController.php +++ b/controllers/admin/AdminProductsController.php @@ -245,9 +245,10 @@ class AdminProductsControllerCore extends AdminController ); } else { $hotels = HotelBranchInformation::getProfileAccessedHotels($this->context->employee->id_profile, 1); + $hotelsArray = array(); foreach ($hotels as $hotel) { $addressInfo = HotelBranchInformation::getAddress($hotel['id_hotel']); - $this->hotelsArray[$hotel['id_hotel']] = $hotel['hotel_name'].', '.$addressInfo['city']; + $hotelsArray[$hotel['id_hotel']] = $hotel['hotel_name'].', '.$addressInfo['city']; } $this->fields_list['hotel_name'] = array( @@ -256,7 +257,7 @@ class AdminProductsControllerCore extends AdminController 'multiple' => true, 'operator' => 'or', 'filter_key' => 'hrt!id_hotel', - 'list' => $this->hotelsArray, + 'list' => $hotelsArray, 'optional' => true, 'class' => 'chosen', 'remove_onchange' => true, @@ -401,7 +402,10 @@ class AdminProductsControllerCore extends AdminController $idLocationsCategory = Configuration::get('PS_LOCATIONS_CATEGORY'); $this->objLocationsCategory = new Category($idLocationsCategory, $this->context->language->id); $nestedCategories = Category::getNestedCategories($idLocationsCategory); - if ($nestedCategories) { + if (isset($nestedCategories[$idLocationsCategory]['children']) + && is_array($nestedCategories[$idLocationsCategory]['children']) + && count($nestedCategories[$idLocationsCategory]['children']) + ) { foreach ($nestedCategories[$idLocationsCategory]['children'] as $childCategory) { $this->buildCategoryOptions($childCategory); } @@ -617,7 +621,7 @@ class AdminProductsControllerCore extends AdminController // convert price with the currency from context $this->_list[$i]['price'] = Tools::convertPrice($this->_list[$i]['price'], $this->context->currency, true, $this->context); $this->_list[$i]['price_tmp'] = Product::getPriceStatic($this->_list[$i]['id_product'], true, null, - (int)Configuration::get('PS_PRICE_DISPLAY_PRECISION'), null, false, true, 1, true, null, null, null, $nothing, true, true, + (int)Configuration::get('PS_PRICE_DISPLAY_PRECISION'), null, false, true, 1, true, null, null, null, null, true, true, $context); } } From 55cf83563a2fe25ad09920aaeecfae4f1d960e76 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Wed, 3 Apr 2024 18:53:21 +0530 Subject: [PATCH 021/371] Fixed: Room type duplication was not creating a perfect copy of existing the room type --- modules/hotelreservationsystem/classes/HotelRoomType.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/hotelreservationsystem/classes/HotelRoomType.php b/modules/hotelreservationsystem/classes/HotelRoomType.php index a5445ec18..6c0a80fd4 100644 --- a/modules/hotelreservationsystem/classes/HotelRoomType.php +++ b/modules/hotelreservationsystem/classes/HotelRoomType.php @@ -107,6 +107,11 @@ class HotelRoomType extends ObjectModel $objHotelRoomType->id_hotel = $idHotelNew; $objHotelRoomType->adults = $roomType['adults']; $objHotelRoomType->children = $roomType['children']; + $objHotelRoomType->max_adults = $roomType['max_adults']; + $objHotelRoomType->max_children = $roomType['max_children']; + $objHotelRoomType->max_guests = $roomType['max_guests']; + $objHotelRoomType->min_los = $roomType['min_los']; + $objHotelRoomType->max_los = $roomType['max_los']; if ($objHotelRoomType->save()) { $objHotelRoomType->updateCategories(); return $returnId ? $objHotelRoomType->id : true; From 52b6e3f87edaa744e9c6ed099a1fcba40dc05425 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Fri, 5 Apr 2024 11:32:07 +0530 Subject: [PATCH 022/371] Fixed: Defaul dates in the booking form, search block, if prepration time is applied to the hotel --- controllers/front/ProductController.php | 8 +++++--- .../controllers/front/autocompletesearch.php | 3 ++- .../views/js/wk-room-search-block.js | 13 +++++++++++++ 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/controllers/front/ProductController.php b/controllers/front/ProductController.php index ec77ebd09..d44e46489 100644 --- a/controllers/front/ProductController.php +++ b/controllers/front/ProductController.php @@ -341,8 +341,13 @@ class ProductControllerCore extends FrontController $date_from = Tools::getValue('date_from'); $date_to = Tools::getValue('date_to'); + $preparationTime = (int) HotelOrderRestrictDate::getPreparationTime($hotel_id); if (!($date_from = Tools::getValue('date_from'))) { $date_from = date('Y-m-d'); + if ($preparationTime) { + $date_from = date('Y-m-d', strtotime('+ '.$preparationTime.' day')); + } + // set date to according to los $objHotelRoomTypeRestrictionDateRange = new HotelRoomTypeRestrictionDateRange(); $los = $objHotelRoomTypeRestrictionDateRange->getRoomTypeLengthOfStay($this->product->id, $date_from); @@ -368,9 +373,6 @@ class ProductControllerCore extends FrontController } } /*End*/ - // booking preparation time - $preparationTime = (int) HotelOrderRestrictDate::getPreparationTime($hotel_id); - $objHotelImage = new HotelImage(); $hotelImageLink = null; if ($coverImage = HotelImage::getCover($hotel_id)) { diff --git a/modules/wkroomsearchblock/controllers/front/autocompletesearch.php b/modules/wkroomsearchblock/controllers/front/autocompletesearch.php index 4a051c103..4d5eec20a 100644 --- a/modules/wkroomsearchblock/controllers/front/autocompletesearch.php +++ b/modules/wkroomsearchblock/controllers/front/autocompletesearch.php @@ -46,9 +46,10 @@ class WkRoomSearchBlockAutoCompleteSearchModuleFrontController extends ModuleFro foreach ($cat_ids as $value) { if ($hotel_info = $obj_htl_info->hotelBranchInfoByCategoryId($value['id_category'])) { $maxOrderDate = HotelOrderRestrictDate::getMaxOrderDate($hotel_info['id']); + $preparationTime = (int) HotelOrderRestrictDate::getPreparationTime($hotel_info['id']); $maxOrderDate = date('Y-m-d', strtotime($maxOrderDate)); $html .= '
  • '. + $hotel_info['id_category'].'" data-max_order_date="'.$maxOrderDate.'" data-preparation_time="'.$preparationTime.'">'. $hotel_info['hotel_name'].'
  • '; } } diff --git a/modules/wkroomsearchblock/views/js/wk-room-search-block.js b/modules/wkroomsearchblock/views/js/wk-room-search-block.js index f5d180d16..d85c25e5b 100644 --- a/modules/wkroomsearchblock/views/js/wk-room-search-block.js +++ b/modules/wkroomsearchblock/views/js/wk-room-search-block.js @@ -62,6 +62,14 @@ $(document).ready(function() { if (preparation_time) { start_date.setDate(start_date.getDate() + parseInt(preparation_time)); start_date.setHours(0, 0, 0, 0); + let selecteDateFrom = new Date(Date.parse(dateFrom)); + let selecteDateTo = new Date(Date.parse(dateTo)); + if (selecteDateFrom < start_date + || selecteDateTo < start_date + ) { + $('#check_in_time').val(''); + $('#check_out_time').val(''); + } } if (max_order_date) { @@ -203,6 +211,11 @@ $(document).ready(function() { $('#hotel_cat_name').html('Select Hotel'); $('.hotel_dropdown_ul').empty(); $('.hotel_dropdown_ul').html(result.data); + // Resetting the data from previously selected hotel + $('#preparation_time').val(0); + var max_order_date = $('#max_order_date').val(); + var preparation_time = 0; + createDateRangePicker(max_order_date, preparation_time, $('#check_in_time').val(), $('#check_out_time').val()); } else { alert(no_results_found_cond); } From 3be6a07a3d22752c9e10e96e73de2f9f07b41532 Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Mon, 8 Apr 2024 14:41:48 +0530 Subject: [PATCH 023/371] Algo improvements for better data --- .../classes/HotelBookingDetail.php | 30 +++++++++++-------- 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/modules/hotelreservationsystem/classes/HotelBookingDetail.php b/modules/hotelreservationsystem/classes/HotelBookingDetail.php index f721a255b..047e1de46 100644 --- a/modules/hotelreservationsystem/classes/HotelBookingDetail.php +++ b/modules/hotelreservationsystem/classes/HotelBookingDetail.php @@ -385,6 +385,7 @@ class HotelBookingDetail extends ObjectModel $partiallyAvailRoomTypes = $partiallyAvailRoomTypes['partiallyAvailRooms']; } + // Now we will formate the data after geting search result according to search type $roomTypesDetail = $objRoomType->getRoomTypeDetailByRoomTypeIds($allowedIdRoomTypes); if ($roomTypesDetail) { // Formate data for response @@ -503,15 +504,12 @@ class HotelBookingDetail extends ObjectModel $sql1 = 'SELECT `id` AS `id_room`, `id_product`, `id_hotel`, `room_num`, `comment` AS `room_comment` FROM `'._DB_PREFIX_.'htl_room_information` WHERE `id_hotel`='.(int)$idHotel.' AND `id_status` = '. HotelRoomInformation::STATUS_INACTIVE.' AND IF('.(int)$idRoomType.' > 0, `id_product` = '.(int)$idRoomType.', 1) AND `id_product` IN ('.$allowedIdRoomTypes.')'; - // if ($idRoomType) { - // $sql1 .= ' AND `id_product` ='.(int)$idRoomType; - // } // check room is temperory inactive $sql2 = 'SELECT hri.`id` AS `id_room`, hri.`id_product`, hri.`id_hotel`, hri.`room_num`, hri.`comment` AS `room_comment` FROM `'._DB_PREFIX_.'htl_room_information` AS hri INNER JOIN `'._DB_PREFIX_.'htl_room_disable_dates` AS hrdd ON (hrdd.`id_room_type` = hri.`id_product` AND hrdd. id_room = hri.`id`) - WHERE hri.`id_hotel`='.$idHotel.' AND hri.`id_status` = '. HotelRoomInformation::STATUS_TEMPORARY_INACTIVE .' AND hrdd.`date_from` < \''.pSql($dateTo).'\' AND hrdd.`date_to` > \''.pSql($dateFrom).'\' AND IF('.(int)$idRoomType.' > 0, hri.`id_product` = '.(int)$idRoomType.', 1) AND hri.`id_product` IN ('.$allowedIdRoomTypes.')'; + WHERE hri.`id_hotel`='.$idHotel.' AND hri.`id_status` = '. HotelRoomInformation::STATUS_TEMPORARY_INACTIVE .' AND hrdd.`date_from` <= \''.pSql($dateFrom).'\' AND hrdd.`date_to` >= \''.pSql($dateTo).'\' AND IF('.(int)$idRoomType.' > 0, hri.`id_product` = '.(int)$idRoomType.', 1) AND hri.`id_product` IN ('.$allowedIdRoomTypes.')'; $sql = $sql1.' UNION '.$sql2; @@ -567,6 +565,7 @@ class HotelBookingDetail extends ObjectModel return $cartRoomTypes; } + /** * $params = array( * 'idHotel' => ..., @@ -906,7 +905,6 @@ class HotelBookingDetail extends ObjectModel ); } - /** * $params = array( * 'idHotel' => ..., @@ -1096,7 +1094,7 @@ class HotelBookingDetail extends ObjectModel } unset($datetimeObj); - // If all dates rae covered + // If all dates are covered if (!$datesToCover) { // array in ascending order of dates ksort($dateWiseRoomTypes); @@ -1106,19 +1104,28 @@ class HotelBookingDetail extends ObjectModel if (!empty($idCart) && !empty($idGuest)) { $sql = 'SELECT `id_product`, `id_room`, `date_from` FROM `'._DB_PREFIX_.'htl_cart_booking_data` - WHERE `id_hotel` = '.(int)$idHotel.' AND `id_cart` = '.(int)$idCart.' AND `id_guest` = '.(int)$idGuest.' AND `is_refunded` = 0 AND `is_back_order` = 0 AND IF('.(int)$idRoomType.' > 0, `id_product` = '.(int)$idRoomType.', 1) AND `id_product` IN ('.$allowedIdRoomTypes.')'; + WHERE `id_hotel` = '.(int)$idHotel.' AND `id_cart` = '.(int)$idCart.' AND `id_guest` = '.(int)$idGuest.' AND `is_refunded` = 0 AND `is_back_order` = 0 AND IF('.(int)$idRoomType.' > 0, `id_product` = '.(int)$idRoomType.', 1) AND `id_product` IN ('.$allowedIdRoomTypes.') AND ('; $datetimeObj = new DateTime(); + $countIteration = 0; foreach ($timeStampWiseRooms as $timeStamp => $roomList) { + $countIteration++; + $datetimeObj->setTimestamp($timeStamp); $partialDateFrom = $datetimeObj->format('Y-m-d H:i:s'); $datetimeObj->modify('+1 day'); $partialDateTo = $datetimeObj->format('Y-m-d H:i:s'); - $sql .= ' AND (`date_from` = \''.pSQL($partialDateFrom).'\' AND `date_to` = \''.pSQL($partialDateTo).'\' AND `id_room` IN ('.implode(",", $roomList).'))'; + $sql .= '(`date_from` = \''.pSQL($partialDateFrom).'\' AND `date_to` = \''.pSQL($partialDateTo).'\' AND `id_room` IN ('.implode(",", $roomList).'))'; + + if (count($timeStampWiseRooms) > $countIteration) { + $sql .= ' OR '; + } } - unset($datetimeObj); + $sql .= ')'; + + unset($datetimeObj, $countIteration); $partiallyAvailCartRooms = Db::getInstance()->executeS($sql); if ($partiallyAvailCartRooms) { @@ -1215,9 +1222,8 @@ class HotelBookingDetail extends ObjectModel $partiallyAvailRooms = array(); $dateWiseRoomTypes = array(); } - unset($datesToCover); - unset($timeStampWiseRooms); - unset($partiallyAvailRooms); + + unset($datesToCover, $timeStampWiseRooms, $partiallyAvailRooms); } return array( From 242c52b625fa6cc1fc0b74208b15b2d860e7d3b6 Mon Sep 17 00:00:00 2001 From: Shreesh Arora Date: Tue, 9 Apr 2024 10:33:10 +0530 Subject: [PATCH 024/371] update room type page service product seletion process --- .../_partials/booking-form.tpl | 2 +- .../_partials/service-products-list-row.tpl | 2 +- themes/hotel-reservation-theme/js/product.js | 127 ++++-------------- 3 files changed, 27 insertions(+), 104 deletions(-) diff --git a/themes/hotel-reservation-theme/_partials/booking-form.tpl b/themes/hotel-reservation-theme/_partials/booking-form.tpl index d8ca234d9..b7afa1894 100644 --- a/themes/hotel-reservation-theme/_partials/booking-form.tpl +++ b/themes/hotel-reservation-theme/_partials/booking-form.tpl @@ -87,7 +87,7 @@

    {displayPrice price=$product['price']}

    - +
    {/foreach} diff --git a/themes/hotel-reservation-theme/_partials/service-products-list-row.tpl b/themes/hotel-reservation-theme/_partials/service-products-list-row.tpl index 7b2aef6a6..b070bd5fd 100644 --- a/themes/hotel-reservation-theme/_partials/service-products-list-row.tpl +++ b/themes/hotel-reservation-theme/_partials/service-products-list-row.tpl @@ -45,7 +45,7 @@ {if !$PS_CATALOG_MODE && !$order_date_restrict && ($product.show_price && !isset($restricted_country_mode))} {if !$priceDisplay}{convertPrice price=$product.price_tax_incl}{else}{convertPrice price=$product.price_tax_exc}{/if}{if $product.price_calculation_method == Product::PRICE_CALCULATION_METHOD_PER_DAY}{l s='/Night'}{/if} - {if $product.allow_multiple_quantity && $product.available_for_order} + {if $product.allow_multiple_quantity && $product.available_for_order && $product.max_quantity > 0} {l s='Maximum '} {$product.max_quantity} {l s='quantity can be added'}. diff --git a/themes/hotel-reservation-theme/js/product.js b/themes/hotel-reservation-theme/js/product.js index 9ae909fc2..62ee003f6 100644 --- a/themes/hotel-reservation-theme/js/product.js +++ b/themes/hotel-reservation-theme/js/product.js @@ -1205,93 +1205,43 @@ $(document).ready(function() { ajax_check_var.abort(); } } - - $(document).on('click', '.remove_roomtype_product', function(){ - showSuccessMessage(cart_extra_service_remove); - var id_product = $(this).data('id-product'); - $(document).find('input#service_product_'+ id_product).remove(); - BookingForm.refresh(); - $(this).closest('.service_product_action_block').find('input.service_product_qty').val(1); - $(this).closest('.service_product_action_block').find('.qty_count span').text(1); - }); }); - function addProductToRoomType(that) { var id_product = $(that).data('id-product'); var qty = $('input#service_product_qty_'+id_product).val(); if (typeof(qty) == 'undefined') { qty = 1; } - var added_service_product = []; - $('#additional_products input.service_product').each(function () { - added_service_product.push({ - 'id_product': $(this).data('id_product'), - 'quantity':$(this).val(), - }); - }); - $.ajax({ - type: 'POST', - headers: { - "cache-control": "no-cache" - }, - url: product_controller_url, - dataType: 'JSON', - cache: false, - data: { - date_from: $('#room_check_in').val(), - date_to: $('#room_check_out').val(), - qty: qty, - id_product: $('#product_page_product_id').val(), - service_product: id_product, - added_service_product: added_service_product, - action: 'checkServiceProductWithRoomType', - ajax: true, - token: static_token - }, - success: function(result) { - if (result.success) { - if (result.add) { - if ($('input#service_product_'+ id_product).length) { - var prevQty = $('input#service_product_'+ id_product).val(); - if (parseInt(prevQty) > 0) { - qty = parseInt(qty) + parseInt(prevQty); - } - $('input#service_product_'+ id_product).val(qty); - } else { - $('').attr({ - id: 'service_product_'+ id_product, - name: 'service_product['+ id_product +'][]', - class: 'service_product', - 'data-id_product': id_product, - value: qty - }).appendTo('#additional_products'); - } - } - // reset input - if (result.add) { - showSuccessMessage(cart_extra_service_add); - } else { - showErrorMessage(result.msg); - } - BookingForm.refresh(); - } else { - if (result.error) { - showErrorMessage(result.error); - } - } - }, - error: function(jqXHR, textStatus, errorThrown) - { - if ((textStatus != 'error' || errorThrown != '') && textStatus != 'abort') - showErrorMessage(textStatus + ': ' + errorThrown); - } + $(that).prop('disabled', true); + + if ($('#additional_products input#service_product_'+ id_product).length) { + $('input#service_product_'+ id_product).val(qty); + } else { + $('').attr({ + id: 'service_product_'+ id_product, + name: 'service_product['+ id_product +'][]', + class: 'service_product', + 'data-id_product': id_product, + value: qty + }).appendTo('#additional_products'); + } + BookingForm.refresh().then(function (res) { + $(that).text(unselect_txt).removeClass('btn-success').removeClass('add_roomtype_product').addClass('btn-danger').addClass('remove_roomtype_product'); + showSuccessMessage(cart_extra_service_add); + $(that).prop('disabled', false); }); } function removeRoomtypeProduct(that) { - var id_product = $(that).data('id_product'); + var id_product = $(that).data('id-product'); $(document).find('input#service_product_'+ id_product).remove(); - BookingForm.refresh(); + $('.selected_room_type_product_'+ id_product).text(select_txt).removeClass('btn-danger').removeClass('remove_roomtype_product').addClass('btn-success').addClass('add_roomtype_product'); + $('.selected_room_type_product_'+ id_product).closest('.service_product_action_block').find('input.service_product_qty').val(1); + $('.selected_room_type_product_'+ id_product).closest('.service_product_action_block').find('.qty_count span').text(1); + $(that).prop('disabled', true); + BookingForm.refresh().then(function (res) { + showSuccessMessage(cart_extra_service_remove); + }); } function updateServiceQuantity(that) { @@ -1385,8 +1335,6 @@ var BookingForm = { disableRoomTypeDemands(0); disableRoomTypeServices(0); } - - updateSelectedServices(); }, initDatepicker: function(max_order_date, preparation_time, dateFrom, dateTo) { let start_date = new Date(); @@ -1509,31 +1457,6 @@ var BookingForm = { } } -function updateSelectedServices() -{ - var room_service_products = getRoomsServiceProducts(); - $('.btn-service-product').text(select_txt); - $('.btn-service-product').addClass('btn-success'); - $('.btn-service-product').addClass('add_roomtype_product'); - $('.btn-service-product').removeClass('btn-danger'); - $('.btn-service-product').removeClass('remove_roomtype_product'); - if (room_service_products.length) { - $(room_service_products).each(function(index, value) { - var element = '.selected_room_type_product_'+value['id_product']; - if ($(element).parent().find('.service_product_qty').length) { - $('#service_product_qty_'+value['id_product']).val(value.quantity); - $(element).parent().find('.qty_count span').text(value.quantity) - } - - $(element).text(unselect_txt); - $(element).removeClass('btn-success'); - $(element).removeClass('add_roomtype_product'); - $(element).addClass('btn-danger'); - $(element).addClass('remove_roomtype_product'); - }); - } -} - function loadHotelImagesByPage(page = 1) { page = parseInt(page); From 9ef91b0bff9670197ebb135c300dbe212c1c0192 Mon Sep 17 00:00:00 2001 From: Shreesh Arora Date: Tue, 9 Apr 2024 12:09:10 +0530 Subject: [PATCH 025/371] improved services panel html structucture and variables used --- .../_partials/service-products-list-row.tpl | 45 ++++++++++--------- .../hotel-reservation-theme/css/product.css | 9 +--- .../js/modules/blockcart/ajax-cart.js | 4 +- themes/hotel-reservation-theme/js/product.js | 15 +++---- themes/hotel-reservation-theme/product.tpl | 9 ++-- 5 files changed, 38 insertions(+), 44 deletions(-) diff --git a/themes/hotel-reservation-theme/_partials/service-products-list-row.tpl b/themes/hotel-reservation-theme/_partials/service-products-list-row.tpl index b070bd5fd..cdf711495 100644 --- a/themes/hotel-reservation-theme/_partials/service-products-list-row.tpl +++ b/themes/hotel-reservation-theme/_partials/service-products-list-row.tpl @@ -43,32 +43,33 @@
    {if !$PS_CATALOG_MODE && !$order_date_restrict && ($product.show_price && !isset($restricted_country_mode))} - +
    {if !$priceDisplay}{convertPrice price=$product.price_tax_incl}{else}{convertPrice price=$product.price_tax_exc}{/if}{if $product.price_calculation_method == Product::PRICE_CALCULATION_METHOD_PER_DAY}{l s='/Night'}{/if} {if $product.allow_multiple_quantity && $product.available_for_order && $product.max_quantity > 0} - - {l s='Maximum '} {$product.max_quantity} {l s='quantity can be added'}. - - {/if} - - {/if} - -
    - {if ($product.show_price && !isset($restricted_country_mode))} - {if $product.available_for_order && !$PS_CATALOG_MODE && !$order_date_restrict && !((isset($restricted_country_mode) && $restricted_country_mode))} - - {if $product.allow_multiple_quantity && $product.available_for_order} -
    - -
    - {if isset($product.quantity_added) && $product.quantity_added}{$product.quantity_added|escape:'html':'UTF-8'}{else}1{/if} -
    -
    - - -
    +
    + {l s='Maximum'} {$product.max_quantity} {l s='quantity can be added'}.
    {/if} +
    + {/if} + + {if ($product.show_price && !isset($restricted_country_mode))} + {if $product.available_for_order && !$PS_CATALOG_MODE && !$order_date_restrict && !((isset($restricted_country_mode) && $restricted_country_mode))} +
    + {if $product.allow_multiple_quantity && $product.available_for_order} +
    + +
    + {if isset($product.quantity_added) && $product.quantity_added}{$product.quantity_added|escape:'html':'UTF-8'}{else}1{/if} +
    +
    + + +
    +
    + {/if} + +
    {/if} {/if}
    diff --git a/themes/hotel-reservation-theme/css/product.css b/themes/hotel-reservation-theme/css/product.css index 4668110e1..cd83c176b 100644 --- a/themes/hotel-reservation-theme/css/product.css +++ b/themes/hotel-reservation-theme/css/product.css @@ -1543,10 +1543,9 @@ ul.service-product-nav > li:hover { font-size: 14px; line-height: 22px; } -.service-product-max-quantity-info, .service-product-selected-quantity-info { - display: block; +.service-max-quantity-info { font-size: 12px; - line-height: 22px; + line-height: 1.3; font-style: italic; color: #959595; font-weight: 400; @@ -1562,10 +1561,6 @@ ul.service-product-nav > li:hover { .service-product-element .service-product-actions { display: flex; - justify-content: space-between; -} -.service-product-element .service-product-actions > div { - flex-grow: 1; } .service-product-element .qty_container > * { diff --git a/themes/hotel-reservation-theme/js/modules/blockcart/ajax-cart.js b/themes/hotel-reservation-theme/js/modules/blockcart/ajax-cart.js index c1cb4b1e7..d50619262 100644 --- a/themes/hotel-reservation-theme/js/modules/blockcart/ajax-cart.js +++ b/themes/hotel-reservation-theme/js/modules/blockcart/ajax-cart.js @@ -1277,10 +1277,10 @@ function disableRoomTypeDemands(show) { function disableRoomTypeServices(disable) { if (disable) { - $('#service_products_cont').find('button.add_roomtype_product').attr('disabled', 'disabled'); + $('#service_products_cont').find('button.select_room_service').attr('disabled', 'disabled'); $('#service_products_cont').find('.qty_container .qty_direction a').attr('disabled', 'disabled'); } else { - $('#service_products_cont').find('button.add_roomtype_product').removeAttr('disabled'); + $('#service_products_cont').find('button.select_room_service').removeAttr('disabled'); $('#service_products_cont').find('.qty_container .qty_direction a').removeAttr('disabled'); } } diff --git a/themes/hotel-reservation-theme/js/product.js b/themes/hotel-reservation-theme/js/product.js index 62ee003f6..4974d31e2 100644 --- a/themes/hotel-reservation-theme/js/product.js +++ b/themes/hotel-reservation-theme/js/product.js @@ -1226,21 +1226,20 @@ function addProductToRoomType(that) { }).appendTo('#additional_products'); } BookingForm.refresh().then(function (res) { - $(that).text(unselect_txt).removeClass('btn-success').removeClass('add_roomtype_product').addClass('btn-danger').addClass('remove_roomtype_product'); - showSuccessMessage(cart_extra_service_add); - $(that).prop('disabled', false); + $(that).text(unselect_txt).removeClass('btn-success').removeClass('add_roomtype_product').addClass('btn-danger').addClass('remove_roomtype_product').prop('disabled', false); + showSuccessMessage(service_added_txt); }); } function removeRoomtypeProduct(that) { var id_product = $(that).data('id-product'); $(document).find('input#service_product_'+ id_product).remove(); - $('.selected_room_type_product_'+ id_product).text(select_txt).removeClass('btn-danger').removeClass('remove_roomtype_product').addClass('btn-success').addClass('add_roomtype_product'); - $('.selected_room_type_product_'+ id_product).closest('.service_product_action_block').find('input.service_product_qty').val(1); - $('.selected_room_type_product_'+ id_product).closest('.service_product_action_block').find('.qty_count span').text(1); + $('.select_room_service_'+ id_product).closest('.service_product_action_block').find('input.service_product_qty').val(1); + $('.select_room_service_'+ id_product).closest('.service_product_action_block').find('.qty_count span').text(1); $(that).prop('disabled', true); BookingForm.refresh().then(function (res) { - showSuccessMessage(cart_extra_service_remove); + $('.select_room_service_'+ id_product).text(select_txt).removeClass('btn-danger').removeClass('remove_roomtype_product').addClass('btn-success').addClass('add_roomtype_product').prop('disabled', false); + showSuccessMessage(service_removed_txt); }); } @@ -1253,7 +1252,7 @@ function updateServiceQuantity(that) { if (newQuantity != oldQuantity) { $('#service_product_'+id_product).val(newQuantity); BookingForm.refresh().then(function (res) { - showSuccessMessage(cart_extra_service_update); + showSuccessMessage(service_updated_txt); }); } } diff --git a/themes/hotel-reservation-theme/product.tpl b/themes/hotel-reservation-theme/product.tpl index 2fee426ff..3a0b1b80f 100644 --- a/themes/hotel-reservation-theme/product.tpl +++ b/themes/hotel-reservation-theme/product.tpl @@ -785,10 +785,9 @@ {addJsDefL name=wrong_qty_cond}{l s='you are trying for a invalid quantity.' js=1}{/addJsDefL} {addJsDefL name=select_txt}{l s='Select' js=1}{/addJsDefL} {addJsDefL name=remove_txt}{l s='Remove' js=1}{/addJsDefL} - {addJsDefL name=cart_extra_service_add}{l s='Service added' js=1}{/addJsDefL} - {addJsDefL name=unselect_txt}{l s='UnSelect' js=1}{/addJsDefL} - {addJsDefL name=cart_extra_service_remove}{l s='Service removed' js=1}{/addJsDefL} - {addJsDefL name=cart_extra_service_update}{l s='Service updated' js=1}{/addJsDefL} - + {addJsDefL name=unselect_txt}{l s='Unselect' js=1}{/addJsDefL} + {addJsDefL name=service_added_txt}{l s='Service added' js=1}{/addJsDefL} + {addJsDefL name=service_removed_txt}{l s='Service removed' js=1}{/addJsDefL} + {addJsDefL name=service_updated_txt}{l s='Service updated' js=1}{/addJsDefL} {/strip} {/if} \ No newline at end of file From 21597693548eb63ec092cca8a00aae1b92ca4ae9 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Wed, 17 Apr 2024 11:15:04 +0530 Subject: [PATCH 026/371] Update the icon for the invoice in search list --- admin/themes/default/template/search_form.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/themes/default/template/search_form.tpl b/admin/themes/default/template/search_form.tpl index ac11075f7..b7c2e195a 100644 --- a/admin/themes/default/template/search_form.tpl +++ b/admin/themes/default/template/search_form.tpl @@ -64,7 +64,7 @@
  • - {l s='Invoices'} + {l s='Invoices'}
  • From 021a003ab334d8f57c1aea1fe9779bcf2579cf11 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Wed, 17 Apr 2024 13:09:38 +0530 Subject: [PATCH 027/371] Updated error message for guest account to customer account transformation --- controllers/front/GuestTrackingController.php | 9 +++++++-- controllers/front/OrderOpcController.php | 8 +++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/controllers/front/GuestTrackingController.php b/controllers/front/GuestTrackingController.php index ab05a2876..ad2a0cb29 100644 --- a/controllers/front/GuestTrackingController.php +++ b/controllers/front/GuestTrackingController.php @@ -95,8 +95,13 @@ class GuestTrackingControllerCore extends FrontController } elseif (!Tools::getValue('password')) { $this->errors[] = Tools::displayError('Invalid password.'); } elseif (!$customer->transformToCustomer($this->context->language->id, Tools::getValue('password'))) { - // @todo clarify error message - $this->errors[] = Tools::displayError('An error occurred while transforming a guest into a registered customer.'); + if (!$customer->isGuest()) { + $this->errors[] = Tools::displayError('This account is already registered as a customer.'); + }else if (!Validate::isPasswd(Tools::getValue('password'))) { + $this->errors[] = Tools::displayError('Invalid password.'); + } else { + $this->errors[] = Tools::displayError('An error occurred while transforming a guest into a registered customer.'); + } } else { $this->context->smarty->assign('transformSuccess', true); } diff --git a/controllers/front/OrderOpcController.php b/controllers/front/OrderOpcController.php index 465c6a7ca..e109721a6 100644 --- a/controllers/front/OrderOpcController.php +++ b/controllers/front/OrderOpcController.php @@ -176,7 +176,13 @@ class OrderOpcControllerCore extends ParentOrderController if ($customer->transformToCustomer($this->context->language->id, $passwd)) { $this->context->updateCustomer($customer); } else { - $this->errors[] = Tools::displayError('An error occurred while transforming your account into a registered customer.'); + if (!$customer->isGuest()) { + $this->errors[] = Tools::displayError('This account is already registered as a customer.'); + }else if (!Validate::isPasswd($passwd)) { + $this->errors[] = Tools::displayError('Invalid password.'); + } else { + $this->errors[] = Tools::displayError('An error occurred while transforming your account into a registered customer.'); + } } } From cd58f81cbcab68f7f7d291b5342fe76464971192 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Wed, 17 Apr 2024 13:31:20 +0530 Subject: [PATCH 028/371] Added:Admin is show global max order date and global preparation time in AdminAddHotel while editing hotel --- .../controllers/admin/AdminAddHotelController.php | 2 ++ .../views/templates/admin/add_hotel/helpers/form/form.tpl | 2 ++ 2 files changed, 4 insertions(+) diff --git a/modules/hotelreservationsystem/controllers/admin/AdminAddHotelController.php b/modules/hotelreservationsystem/controllers/admin/AdminAddHotelController.php index 1d0e738b3..9b6f35bbf 100644 --- a/modules/hotelreservationsystem/controllers/admin/AdminAddHotelController.php +++ b/modules/hotelreservationsystem/controllers/admin/AdminAddHotelController.php @@ -183,6 +183,8 @@ class AdminAddHotelController extends ModuleAdminController $smartyVars['state_var'] = $stateOptions; $smartyVars['enabledDisplayMap'] = Configuration::get('PS_API_KEY') && Configuration::get('WK_GOOGLE_ACTIVE_MAP'); $smartyVars['ps_img_dir'] = _PS_IMG_.'l/'; + $smartyVars['MAX_GLOBAL_BOOKING_DATE'] = date('Y-m-d', strtotime(Configuration::get('MAX_GLOBAL_BOOKING_DATE'))); + $smartyVars['GLOBAL_PREPARATION_TIME'] = Configuration::get('GLOBAL_PREPARATION_TIME'); $this->context->smarty->assign($smartyVars); diff --git a/modules/hotelreservationsystem/views/templates/admin/add_hotel/helpers/form/form.tpl b/modules/hotelreservationsystem/views/templates/admin/add_hotel/helpers/form/form.tpl index 4ef90c7d8..53a919257 100644 --- a/modules/hotelreservationsystem/views/templates/admin/add_hotel/helpers/form/form.tpl +++ b/modules/hotelreservationsystem/views/templates/admin/add_hotel/helpers/form/form.tpl @@ -357,6 +357,7 @@ +
    {l s='Global max order date:' mod='hotelreservationsystem'} {dateFormat date=$MAX_GLOBAL_BOOKING_DATE}
  • {elseif $field['type'] == 'bool'} From ec11eea527598abdf7688f1b34e33e11e4f23707 Mon Sep 17 00:00:00 2001 From: Shreesh Arora Date: Fri, 19 Apr 2024 11:02:43 +0530 Subject: [PATCH 032/371] Updated: room type operating cost validation message --- controllers/admin/AdminProductsController.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/controllers/admin/AdminProductsController.php b/controllers/admin/AdminProductsController.php index 811207d39..2f44e93c3 100644 --- a/controllers/admin/AdminProductsController.php +++ b/controllers/admin/AdminProductsController.php @@ -2199,10 +2199,14 @@ class AdminProductsControllerCore extends AdminController } if (!$res) { - $this->errors[] = sprintf( - Tools::displayError('The %s field is invalid.'), - call_user_func(array($className, 'displayFieldName'), $field, $className) - ); + if (Tools::strtolower($field) == 'wholesale_price') { + $this->errors[] = Tools::displayError('The Pre-tax operating cost field is invalid.'); + } else { + $this->errors[] = sprintf( + Tools::displayError('The %s field is invalid.'), + call_user_func(array($className, 'displayFieldName'), $field, $className) + ); + } } } } From 8d5a26969692d2ab57b75b8c1baaf1a6c66ac6c6 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Fri, 19 Apr 2024 11:21:25 +0530 Subject: [PATCH 033/371] Fixed: error on checkout if the user choses other lanuage than default language --- classes/order/OrderHistory.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/order/OrderHistory.php b/classes/order/OrderHistory.php index 874171009..1d09988c0 100644 --- a/classes/order/OrderHistory.php +++ b/classes/order/OrderHistory.php @@ -449,7 +449,7 @@ class OrderHistoryCore extends ObjectModel ); if ($idHotel = HotelBookingDetail::getIdHotelByIdOrder($order->id)) { - $objHotelBranchInformation = new HotelBranchInformation($idHotel, $order->id_lang); + $objHotelBranchInformation = new HotelBranchInformation($idHotel); $fields = array_merge( $objHotelBranchInformation->getFields(), $objHotelBranchInformation->getFieldsLang()[$order->id_lang], From 417d863ea54364afc9fdd17affc824e053af645c Mon Sep 17 00:00:00 2001 From: Shreesh Arora Date: Fri, 19 Apr 2024 11:39:04 +0530 Subject: [PATCH 034/371] Fixed: Invalid customer voucher amount when changing currency --- themes/hotel-reservation-theme/discount.tpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/themes/hotel-reservation-theme/discount.tpl b/themes/hotel-reservation-theme/discount.tpl index ea4ba715f..b011b1ec2 100644 --- a/themes/hotel-reservation-theme/discount.tpl +++ b/themes/hotel-reservation-theme/discount.tpl @@ -53,7 +53,7 @@ {/if} {if $discountDetail.reduction_amount > 0} {if $discountDetail.reduction_percent > 0} + {/if} - {convertPrice price=$discountDetail.reduction_amount} ({if $discountDetail.reduction_tax == 1}{l s='Tax included'}{else}{l s='Tax excluded'}{/if}) + {displayPrice price=$discountDetail.reduction_amount currency=$discountDetail.reduction_currency} ({if $discountDetail.reduction_tax == 1}{l s='Tax included'}{else}{l s='Tax excluded'}{/if}) {/if} {if $discountDetail.free_shipping} {if $discountDetail.reduction_percent > 0 || $discountDetail.reduction_amount > 0} + {/if} @@ -73,7 +73,7 @@ {if $discountDetail.minimal == 0} {l s='None'} {else} - {convertPrice price=$discountDetail.minimal} ({if $discountDetail.minimum_amount_tax == 1}{l s='Tax included'}{else}{l s='Tax excluded'}{/if}) + {displayPrice price=$discountDetail.minimal currency=$discountDetail.reduction_currency} ({if $discountDetail.minimum_amount_tax == 1}{l s='Tax included'}{else}{l s='Tax excluded'}{/if}) {/if} From b2e3973e8ae01d5cee4b570819e958c0b719ccf5 Mon Sep 17 00:00:00 2001 From: Shreesh Arora Date: Fri, 19 Apr 2024 12:30:44 +0530 Subject: [PATCH 035/371] Fixed: Auto generated advance price rule are visible in room type configuration --- .../classes/HotelRoomTypeFeaturePricing.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/hotelreservationsystem/classes/HotelRoomTypeFeaturePricing.php b/modules/hotelreservationsystem/classes/HotelRoomTypeFeaturePricing.php index f4be56fd3..5dbfbd1db 100644 --- a/modules/hotelreservationsystem/classes/HotelRoomTypeFeaturePricing.php +++ b/modules/hotelreservationsystem/classes/HotelRoomTypeFeaturePricing.php @@ -794,14 +794,14 @@ class HotelRoomTypeFeaturePricing extends ObjectModel * @param [int] $id_product [id of the product] * @return [array] [returns all feature prices by product] */ - public function getFeaturePricesbyIdProduct($id_product) + public function getFeaturePricesbyIdProduct($id_product, $id_cart = 0, $id_guest = 0, $id_room = 0) { $idLang = Context::getContext()->language->id; return Db::getInstance()->executeS( 'SELECT hrfp.*, hrfpl.`feature_price_name` FROM `'._DB_PREFIX_.'htl_room_type_feature_pricing` hrfp LEFT JOIN `'._DB_PREFIX_.'htl_room_type_feature_pricing_lang` hrfpl ON(hrfp.`id_feature_price` = hrfpl.`id_feature_price` AND hrfpl.`id_lang` = '.(int)$idLang.') - WHERE `id_product` = '.(int)$id_product + WHERE `id_product` = '.(int)$id_product.' AND `id_cart` = '.(int)$id_cart.' AND `id_guest` = '.(int)$id_guest.' AND `id_room` = '.(int)$id_room ); } From 8b749566a43c8b5982751ef703679dbcbbc4afdd Mon Sep 17 00:00:00 2001 From: Shreesh Arora Date: Fri, 19 Apr 2024 15:15:12 +0530 Subject: [PATCH 036/371] Fixed: Service product associated room types are shown according to hotel permission --- .../admin/AdminNormalProductsController.php | 39 ++----------------- 1 file changed, 3 insertions(+), 36 deletions(-) diff --git a/controllers/admin/AdminNormalProductsController.php b/controllers/admin/AdminNormalProductsController.php index 87a959951..b0c0715b8 100644 --- a/controllers/admin/AdminNormalProductsController.php +++ b/controllers/admin/AdminNormalProductsController.php @@ -186,19 +186,17 @@ class AdminNormalProductsControllerCore extends AdminController $id_shop = Shop::isFeatureActive() && Shop::getContext() == Shop::CONTEXT_SHOP? (int)$this->context->shop->id : 'a.id_shop_default'; $this->_join .= ' JOIN `'._DB_PREFIX_.'product_shop` sa ON (a.`id_product` = sa.`id_product` AND sa.id_shop = '.$id_shop.') - LEFT JOIN `'._DB_PREFIX_.'htl_room_type` hrt ON (a.`id_product` = hrt.`id_product`) - LEFT JOIN `'._DB_PREFIX_.'htl_branch_info` hb ON (hrt.`id_hotel` = hb.`id`) - LEFT JOIN `'._DB_PREFIX_.'htl_branch_info_lang` hbl ON (hb.`id` = hbl.`id` AND b.`id_lang` = hbl.`id_lang`) LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON ('.$alias.'.`id_category_default` = cl.`id_category` AND b.`id_lang` = cl.`id_lang` AND cl.id_shop = '.$id_shop.') LEFT JOIN `'._DB_PREFIX_.'shop` shop ON (shop.id_shop = '.$id_shop.') LEFT JOIN `'._DB_PREFIX_.'image_shop` image_shop ON (image_shop.`id_product` = a.`id_product` AND image_shop.`cover` = 1 AND image_shop.id_shop = '.$id_shop.') LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_image` = image_shop.`id_image`) LEFT JOIN `'._DB_PREFIX_.'product_download` pd ON (pd.`id_product` = a.`id_product` AND pd.`active` = 1) LEFT JOIN `'._DB_PREFIX_.'htl_room_type_service_product` rsp ON (rsp.`id_product` = a.`id_product`) - LEFT JOIN `'._DB_PREFIX_.'address` aa ON (aa.`id_hotel` = hb.`id`)'; + LEFT JOIN `'._DB_PREFIX_.'htl_room_type` hrt ON (rsp.`id_element` = hrt.`id_product` AND rsp.`element_type` = '.(int)RoomTypeServiceProduct::WK_ELEMENT_TYPE_ROOM_TYPE.') + '.HotelBranchInformation::addHotelRestriction(false, 'hrt'); $this->_select .= ' IF(a.`auto_add_to_cart`, "'.$this->l('Yes').'", "'.$this->l('No').'") as auto_added, IF(a.`auto_add_to_cart`, 1, 0) as badge_success, IF(a.`show_at_front`, "'.$this->l('Yes').'", "'.$this->l('No').'") as show_at_front_txt, IF(a.`price_calculation_method` = '.(int)Product::PRICE_CALCULATION_METHOD_PER_DAY.', "'.$this->l('Per Day').'", "'.$this->l('Per Booking').'") as price_calculation_method_txt, (SELECT COUNT(hri.`id`) FROM `'._DB_PREFIX_.'htl_room_information` hri WHERE hri.`id_product` = a.`id_product`) as num_rooms, '; - $this->_select .= ' COUNT(rsp.`id_product`) as products_associated, hrt.`adults`, hrt.`children`, hb.`id` as id_hotel, aa.`city`, hbl.`hotel_name`, '; + $this->_select .= ' COUNT(hrt.`id_product`) as products_associated, '; $this->_select .= 'shop.`name` AS `shopname`, a.`id_shop_default`, '; $this->_select .= $alias_image.'.`id_image` AS `id_image`, cl.`name` AS `name_category`, '.$alias.'.`price`, 0 AS `price_final`, a.`is_virtual`, pd.`nb_downloadable`, sav.`quantity` AS `sav_quantity`, '.$alias.'.`active`, IF(sav.`quantity`<=0, 1, 0) AS `badge_danger`'; @@ -368,15 +366,6 @@ class AdminNormalProductsControllerCore extends AdminController return '--'; } - public function getHotelName($hotelName, $row) - { - if ($hotelName && isset($row['city'])) { - return $hotelName.' - '.$row['city']; - } - - return '--'; - } - public static function getQuantities($hotelName, $tr) { if ((int)$tr['is_virtual'] == 1 && $tr['nb_downloadable'] == 0) { @@ -3531,15 +3520,6 @@ class AdminNormalProductsControllerCore extends AdminController )); $data->assign($this->tpl_form_vars); - $objRoomType = new HotelRoomType(); - $objHotelInfo = new HotelBranchInformation(); - $data->assign('htl_info', $objHotelInfo->hotelsNameAndId()); - if ($hotelRoomType = $objRoomType->getRoomTypeInfoByIdProduct($product->id)) { - $data->assign('htl_room_type', $hotelRoomType); - $hotelFullInfo = $objHotelInfo->hotelBranchInfoById($hotelRoomType['id_hotel']); - $data->assign('htl_full_info', $hotelFullInfo); - } - $this->tpl_form_vars['product'] = $product; $this->tpl_form_vars['custom_form'] = $data->fetch(); } @@ -4113,19 +4093,6 @@ class AdminNormalProductsControllerCore extends AdminController } } - public function ajaxProcessGetIdHotelByIdProduct() - { - $response = array('status' => 'failed'); - $idProduct = Tools::getValue('id_product'); - $objHotelRoomType = new HotelRoomType(); - $roomTypeInfo = $objHotelRoomType->getRoomTypeInfoByIdProduct($idProduct); - if ($roomTypeInfo) { - $response['status'] = 'success'; - $response['id_hotel'] = (int)$roomTypeInfo['id_hotel']; - } - die(json_encode($response)); - } - public function processImageLegends() { if (Tools::getValue('key_tab') == 'Images' && Tools::getValue('submitAddproductAndStay') == 'update_legends' && Validate::isLoadedObject($product = new Product((int)Tools::getValue('id_product')))) { From 8279b0f64aa2389e6d01347ced03a9d3bfb1f4e2 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Fri, 19 Apr 2024 16:37:17 +0530 Subject: [PATCH 037/371] Fixed: Creation of to sperate HotelAdvancedPayment for a same room type from two seprates tabs --- controllers/admin/AdminProductsController.php | 6 ++++-- .../hotelreservationsystem/classes/HotelAdvancedPayment.php | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/controllers/admin/AdminProductsController.php b/controllers/admin/AdminProductsController.php index 811207d39..6988d73bd 100644 --- a/controllers/admin/AdminProductsController.php +++ b/controllers/admin/AdminProductsController.php @@ -1089,16 +1089,18 @@ class AdminProductsControllerCore extends AdminController } $id_product = Tools::getValue('id_product'); - $id_adv_pmt = Tools::getValue('id_adv_pmt'); if ($id_adv_pmt) { $obj_adv_pmt = new HotelAdvancedPayment($id_adv_pmt); } else { $obj_adv_pmt = new HotelAdvancedPayment(); + if ($id_adv_pmt = $obj_adv_pmt->getIdAdvPaymentByIdProduct($id_product)) { + // To prevent duplication from two separate tabs + $obj_adv_pmt = new HotelAdvancedPayment($id_adv_pmt); + } } $adv_payment_active = Tools::getValue('adv_payment_active'); - $obj_adv_pmt->id_product = $id_product; $obj_adv_pmt->active = $adv_payment_active; diff --git a/modules/hotelreservationsystem/classes/HotelAdvancedPayment.php b/modules/hotelreservationsystem/classes/HotelAdvancedPayment.php index 1cc539d75..076663010 100644 --- a/modules/hotelreservationsystem/classes/HotelAdvancedPayment.php +++ b/modules/hotelreservationsystem/classes/HotelAdvancedPayment.php @@ -68,7 +68,7 @@ class HotelAdvancedPayment extends ObjectModel */ public function getIdAdvPaymentByIdProduct($id_product) { - $result = Db::getInstance()->getRow("SELECT * FROM `"._DB_PREFIX_."htl_advance_payment` WHERE `id_product`=".$id_product); + $result = Db::getInstance()->getRow("SELECT * FROM `"._DB_PREFIX_."htl_advance_payment` WHERE `id_product`=".(int) $id_product); if ($result) { return $result; From 5bb2378fdaff68feeaa1af65d0dd7727b5198af3 Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Sat, 20 Apr 2024 10:21:42 +0530 Subject: [PATCH 038/371] Fixed: Getting fatal error on order detail page if entered invalid order ID in URL --- controllers/admin/AdminOrdersController.php | 75 ++++++++++----------- 1 file changed, 37 insertions(+), 38 deletions(-) diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index 9c6d1fe61..f4165de35 100644 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -482,44 +482,44 @@ class AdminOrdersControllerCore extends AdminController { if ($this->display == 'view') { /** @var Order $order */ - $order = $this->loadObject(); + if (Validate::isLoadedObject($order = $this->loadObject())) { + // hotel link in header + if ($idHotel = HotelBookingDetail::getIdHotelByIdOrder($order->id)) { + $this->toolbar_btn['hotel'] = array( + 'href' => $this->context->link->getAdminLink('AdminAddHotel').'&id='.$idHotel.'&updatehtl_branch_info', + 'desc' => $this->l('View Hotel'), + 'class' => 'icon-building', + 'target' => true, + ); + } - // hotel link in header - if ($idHotel = HotelBookingDetail::getIdHotelByIdOrder($order->id)) { - $this->toolbar_btn['hotel'] = array( - 'href' => $this->context->link->getAdminLink('AdminAddHotel').'&id='.$idHotel.'&updatehtl_branch_info', - 'desc' => $this->l('View Hotel'), - 'class' => 'icon-building', - 'target' => true, + if (Configuration::get('PS_INVOICE') && $order->hasInvoice() && !$this->lite_display) { + $this->toolbar_btn['file'] = array( + 'short' => $this->l('Invoice'), + 'href' => $this->context->link->getAdminLink('AdminPdf').'&submitAction=generateInvoicePDF&id_order='.$order->id, + 'desc' => $this->l('View invoice'), + 'class' => 'icon-file-text', + 'target' => true, + ); + } + + $this->toolbar_btn['print'] = array( + 'short' => $this->l('Print'), + 'href' => 'javascript:window.print()', + 'desc' => $this->l('Print order'), + 'class' => 'icon-print', ); - } - if (Configuration::get('PS_INVOICE') && $order->hasInvoice() && !$this->lite_display) { - $this->toolbar_btn['file'] = array( - 'short' => $this->l('Invoice'), - 'href' => $this->context->link->getAdminLink('AdminPdf').'&submitAction=generateInvoicePDF&id_order='.$order->id, - 'desc' => $this->l('View invoice'), - 'class' => 'icon-file-text', - 'target' => true, - ); - } - - $this->toolbar_btn['print'] = array( - 'short' => $this->l('Print'), - 'href' => 'javascript:window.print()', - 'desc' => $this->l('Print order'), - 'class' => 'icon-print', - ); - - if (((int) $order->isReturnable()) && !$order->hasCompletelyRefunded(Order::ORDER_COMPLETE_CANCELLATION_OR_REFUND_REQUEST_FLAG)) { - $this->toolbar_btn['cancel'] = array( - 'short' => ((float) $order->getTotalPaid()) ? $this->l('Refund') : $this->l('Cancel'), - 'href' => '#refundForm', - 'id' => 'desc-order-standard_refund', - 'desc' => ((float) $order->getTotalPaid()) ? $this->l('Initiate refund') : $this->l('Cancel bookings'), - 'class' => 'icon-exchange', - 'target' => true, - ); + if (((int) $order->isReturnable()) && !$order->hasCompletelyRefunded(Order::ORDER_COMPLETE_CANCELLATION_OR_REFUND_REQUEST_FLAG)) { + $this->toolbar_btn['cancel'] = array( + 'short' => ((float) $order->getTotalPaid()) ? $this->l('Refund') : $this->l('Cancel'), + 'href' => '#refundForm', + 'id' => 'desc-order-standard_refund', + 'desc' => ((float) $order->getTotalPaid()) ? $this->l('Initiate refund') : $this->l('Cancel bookings'), + 'class' => 'icon-exchange', + 'target' => true, + ); + } } } @@ -2475,9 +2475,8 @@ class AdminOrdersControllerCore extends AdminController public function renderView() { - $order = new Order(Tools::getValue('id_order')); - if (!Validate::isLoadedObject($order)) { - $this->errors[] = Tools::displayError('The order cannot be found within your database.'); + if (!Validate::isLoadedObject($order = new Order(Tools::getValue('id_order')))) { + return; } $this->content .= $this->renderKpis(); From 1a72a65037055b76e3200a8d091f3ab359b101bb Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Sat, 20 Apr 2024 10:38:05 +0530 Subject: [PATCH 039/371] Fixed: Name of the guest user is not present on order detail page in backoffice --- .../default/template/controllers/orders/helpers/view/view.tpl | 1 + 1 file changed, 1 insertion(+) diff --git a/admin/themes/default/template/controllers/orders/helpers/view/view.tpl b/admin/themes/default/template/controllers/orders/helpers/view/view.tpl index f28080e92..d875932f1 100644 --- a/admin/themes/default/template/controllers/orders/helpers/view/view.tpl +++ b/admin/themes/default/template/controllers/orders/helpers/view/view.tpl @@ -542,6 +542,7 @@
    +
     {$customer->firstname} {$customer->lastname}
     {$customer->email}
    {if $addresses.invoice->phone_mobile || $addresses.invoice->phone}
     {if $addresses.invoice->phone_mobile}{$addresses.invoice->phone_mobile}{else}{$addresses.invoice->phone}{/if}
    From 994664c23b67bb90b6f3ecf893676b00e704445d Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Sat, 20 Apr 2024 11:58:42 +0530 Subject: [PATCH 040/371] Fixed: Should not allow admin to add rooms if order status is already canceled or refunded. --- .../default/template/controllers/orders/helpers/view/view.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/themes/default/template/controllers/orders/helpers/view/view.tpl b/admin/themes/default/template/controllers/orders/helpers/view/view.tpl index f28080e92..6c4efed72 100644 --- a/admin/themes/default/template/controllers/orders/helpers/view/view.tpl +++ b/admin/themes/default/template/controllers/orders/helpers/view/view.tpl @@ -869,7 +869,7 @@
     {l s='Rooms Booking Detail'} {$order_detail_data|@count} - {if !$order->hasBeenDelivered()} + {if !$order->hasBeenDelivered() && $currentState->id != Configuration::get('PS_OS_REFUND') && $currentState->id != Configuration::get('PS_OS_CANCELED')} From 5ce9749d747c939f1a77ae5d4acaf15f2a698b0a Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Sat, 20 Apr 2024 13:11:07 +0530 Subject: [PATCH 041/371] Fixed: Validation messages should be present on the same page when invalid text is added in the notes on admin order detail page. --- .../template/controllers/orders/modals/_document_note.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/themes/default/template/controllers/orders/modals/_document_note.tpl b/admin/themes/default/template/controllers/orders/modals/_document_note.tpl index ecb8e98e5..2fbbb25bd 100644 --- a/admin/themes/default/template/controllers/orders/modals/_document_note.tpl +++ b/admin/themes/default/template/controllers/orders/modals/_document_note.tpl @@ -18,7 +18,7 @@ *}