- {$part_v['room_num']|escape:'htmlall':'UTF-8'}
-
+
+ {dateFormat date=date('Y-m-d', strtotime($part_v['date_from']))} - {dateFormat date=date('Y-m-d', strtotime($part_v['date_to']))}
+
+
- {foreach from=$part_v['avai_dates'] key=sub_part_k item=sub_part_v}
+ {foreach from=$part_v['rooms'] key=sub_part_k item=sub_part_v}
- {dateFormat date=date('Y-m-d', strtotime($sub_part_v['date_from']))} - {dateFormat date=date('Y-m-d', strtotime($sub_part_v['date_to']))}
+ {$sub_part_v['room_num']}
{foreach $allotment_types as $allotment_type}
-
+
{$allotment_type.name|escape:'htmlall':'UTF-8'}
{/foreach}
-
+
+ {if $occupancy_wise_booking}
+
+
+
+ {l s='Select occupancy'}
+
+
+
+
+ {/if}
- {l s='Add To Cart' mod='hotelreservationsystem'}
+ {l s='Add To Cart' mod='hotelreservationsystem'}
{/foreach}
@@ -528,7 +730,24 @@
{addJsDef check_calender_var = $check_calender_var}
{addJsDefL name=no_rm_avail_txt}{l s='No rooms available.' js=1 mod='hotelreservationsystem'}{/addJsDefL}
{addJsDefL name=slct_rm_err}{l s='Please select a room first.' js=1 mod='hotelreservationsystem'}{/addJsDefL}
+ {addJsDef max_child_age=$max_child_age}
+ {addJsDef max_child_in_room=$max_child_in_room}
+ {addJsDef occupancy_wise_search=$occupancy_wise_search|boolval}
+ {addJsDef occupancy_wise_booking=$occupancy_wise_booking|boolval}
+ {addJsDefL name='select_age_txt'}{l s='Select age' js=1 mod='hotelreservationsystem'}{/addJsDefL}
+ {addJsDefL name='under_1_age'}{l s='Under 1' js=1 mod='hotelreservationsystem'}{/addJsDefL}
+ {addJsDefL name='room_txt'}{l s='Room' js=1 mod='hotelreservationsystem'}{/addJsDefL}
+ {addJsDefL name='rooms_txt'}{l s='Rooms' js=1 mod='hotelreservationsystem'}{/addJsDefL}
+ {addJsDefL name='remove_txt'}{l s='Remove' js=1 mod='hotelreservationsystem'}{/addJsDefL}
+ {addJsDefL name='adult_txt'}{l s='Adult' js=1 mod='hotelreservationsystem'}{/addJsDefL}
+ {addJsDefL name='adults_txt'}{l s='Adults' js=1 mod='hotelreservationsystem'}{/addJsDefL}
+ {addJsDefL name='child_txt'}{l s='Child' js=1 mod='hotelreservationsystem'}{/addJsDefL}
+ {addJsDefL name='children_txt'}{l s='Children' js=1 mod='hotelreservationsystem'}{/addJsDefL}
+ {addJsDefL name='below_txt'}{l s='Below' js=1 mod='hotelreservationsystem'}{/addJsDefL}
+ {addJsDefL name='years_txt'}{l s='years' js=1 mod='hotelreservationsystem'}{/addJsDefL}
+ {addJsDefL name='all_children_txt'}{l s='years' js=1 mod='hotelreservationsystem'}{/addJsDefL}
+ {addJsDefL name='invalid_occupancy_txt'}{l s='Invalid occupancy(adults/children) found.' js=1 mod='hotelreservationsystem'}{/addJsDefL}
{/strip}
{/if}
@@ -566,4 +785,3 @@ $(document).ready(function() {
});
-
\ No newline at end of file
diff --git a/modules/statsbestproducts/statsbestproducts.php b/modules/statsbestproducts/statsbestproducts.php
index e2e6d1179..b59657afb 100644
--- a/modules/statsbestproducts/statsbestproducts.php
+++ b/modules/statsbestproducts/statsbestproducts.php
@@ -199,7 +199,7 @@ class StatsBestProducts extends ModuleGrid
$bookingParams['date_to'] = $dateTo;
foreach ($values as &$value) {
$bookingParams['hotel_id'] = $value['id_hotel'];
- $bookingParams['room_type'] = $value['id_product'];
+ $bookingParams['id_room_type'] = $value['id_product'];
$booking_data = $objBookingDtl->getBookingData($bookingParams);
if (isset($booking_data['stats']['num_avail'])) {
$value['avail_rooms'] = $booking_data['stats']['num_avail'];
diff --git a/modules/statscheckup/statscheckup.php b/modules/statscheckup/statscheckup.php
index 545d53d96..e5f45b74d 100644
--- a/modules/statscheckup/statscheckup.php
+++ b/modules/statscheckup/statscheckup.php
@@ -260,7 +260,7 @@ class StatsCheckUp extends Module
$row['stock'] = 0;
if ($roomTypeInfo = $objHotelRoomType->getRoomTypeInfoByIdProduct($row['id_product'])) {
$bookingParams['hotel_id'] = $roomTypeInfo['id_hotel'];
- $bookingParams['room_type'] = $row['id_product'];
+ $bookingParams['id_room_type'] = $row['id_product'];
if ($booking_data = $objBookingDtl->getBookingData($bookingParams)) {
if (isset($booking_data['stats']['num_avail'])) {
$row['stock'] = $booking_data['stats']['num_avail'];
diff --git a/modules/statsproduct/statsproduct.php b/modules/statsproduct/statsproduct.php
index 5814d7c41..03bfda68a 100644
--- a/modules/statsproduct/statsproduct.php
+++ b/modules/statsproduct/statsproduct.php
@@ -362,7 +362,7 @@ class StatsProduct extends ModuleGraph
$availRooms = 0;
if ($roomTypeInfo = $objHotelRoomType->getRoomTypeInfoByIdProduct($product['id_product'])) {
$bookingParams['hotel_id'] = $roomTypeInfo['id_hotel'];
- $bookingParams['room_type'] = $product['id_product'];
+ $bookingParams['id_room_type'] = $product['id_product'];
if ($booking_data = $objBookingDtl->getBookingData($bookingParams)) {
if (isset($booking_data['stats']['num_avail'])) {
$availRooms = $booking_data['stats']['num_avail'];
diff --git a/modules/wkhotelfilterblock/wkhotelfilterblock.php b/modules/wkhotelfilterblock/wkhotelfilterblock.php
index 5eb9ce8e1..333a7a3dc 100644
--- a/modules/wkhotelfilterblock/wkhotelfilterblock.php
+++ b/modules/wkhotelfilterblock/wkhotelfilterblock.php
@@ -212,8 +212,6 @@ class wkhotelfilterblock extends Module
$max_adult = HotelRoomType::getMaxAdults($id_hotel);
$max_child = HotelRoomType::getMaxChild($id_hotel);
- $category = new Category($htl_id_category);
-
if (!($date_from = Tools::getValue('date_from'))) {
$date_from = date('Y-m-d');
$date_to = date('Y-m-d', strtotime($date_from) + 86400);
@@ -231,10 +229,27 @@ class wkhotelfilterblock extends Module
$prod_price[] = Product::getPriceStatic($value['id_product'], HotelBookingDetail::useTax());
}
}
+
+ // Create URL of category
+ $occupancy = Tools::getValue('occupancy');
+ $urlData = array (
+ 'date_from' => $date_from,
+ 'date_to' => $date_to,
+ 'occupancy' => $occupancy,
+ );
+
if (Configuration::get('PS_REWRITING_SETTINGS')) {
- $cat_link = $this->context->link->getCategoryLink($category, is_array($category->link_rewrite) ? $category->link_rewrite[$id_lang] : $this->link_rewrite, $id_lang).'?date_from='.$date_from.'&date_to='.$date_to;
+ $categoryUrl = $this->context->link->getCategoryLink(
+ new Category($htl_id_category, $this->context->language->id),
+ null,
+ $this->context->language->id
+ ).'?'.http_build_query($urlData);
} else {
- $cat_link = $this->context->link->getCategoryLink($category, is_array($category->link_rewrite) ? $category->link_rewrite[$id_lang] : $this->link_rewrite, $id_lang).'&date_from='.$date_from.'&date_to='.$date_to;
+ $categoryUrl = $this->context->link->getCategoryLink(
+ new Category($htl_id_category, $this->context->language->id),
+ null,
+ $this->context->language->id
+ ).'&'.http_build_query($urlData);
}
$currency = $this->context->currency;
@@ -252,9 +267,9 @@ class wkhotelfilterblock extends Module
'all_feat' => $all_feat,
'max_adult' => $max_adult,
'max_child' => $max_child,
- 'cat_link' => $cat_link,
+ 'cat_link' => $categoryUrl,
'ratting_img' => $ratting_img,
- 'currency' => $currency,
+ 'currency' => $this->context->currency,
'date_from' => $date_from,
'date_to' => $date_to,
'num_days' => $num_days,
diff --git a/modules/wkroomsearchblock/classes/WkRoomSearchHelper.php b/modules/wkroomsearchblock/classes/WkRoomSearchHelper.php
index 3ac635a15..f8e349442 100644
--- a/modules/wkroomsearchblock/classes/WkRoomSearchHelper.php
+++ b/modules/wkroomsearchblock/classes/WkRoomSearchHelper.php
@@ -54,6 +54,44 @@ class WkRoomSearchHelper
}
}
+ // Lets validate guest occupancy fields
+ // Get guest occupancy variable
+ $guestOccupancy = Tools::getValue('occupancy');
+ if (!count($guestOccupancy)) {
+ $errors[] = $objModule->l('Invalid occupancy', 'WkRoomSearchHelper');
+ } else {
+ $adultTypeErr = 0;
+ $childTypeErr = 0;
+ $childAgeErr = 0;
+ foreach ($guestOccupancy as $occupancy) {
+ if (!isset($occupancy['adult']) || !Validate::isUnsignedInt($occupancy['adult'])) {
+ $adultTypeErr = 1;
+ }
+ if (!isset($occupancy['children']) || !Validate::isUnsignedInt($occupancy['children'])) {
+ $childTypeErr = 1;
+ } elseif ($occupancy['children']) {
+ if (!isset($occupancy['child_ages']) || ($occupancy['children'] != count($occupancy['child_ages']))) {
+ $childAgeErr = 1;
+ } else {
+ foreach ($occupancy['child_ages'] as $childAge) {
+ if (!Validate::isUnsignedInt($childAge)) {
+ $childAgeErr = 1;
+ }
+ }
+ }
+ }
+ }
+ if ($adultTypeErr) {
+ $errors[] = $objModule->l('Invalid adults', 'WkRoomSearchHelper');
+ }
+ if ($childTypeErr) {
+ $errors[] = $objModule->l('Invalid children', 'WkRoomSearchHelper');
+ }
+ if ($childAgeErr) {
+ $errors[] = $objModule->l('Invalid children ages', 'WkRoomSearchHelper');
+ }
+ }
+
return $errors;
}
@@ -71,6 +109,10 @@ class WkRoomSearchHelper
$hotelsInfo = $objHotelInfo->hotelBranchesInfo(0, 1);
$locationEnabled = Configuration::get('WK_HOTEL_LOCATION_ENABLE');
+ $occupancyEnabled = false;
+ if (Configuration::get('PS_FRONT_SEARCH_TYPE') == HotelBookingDetail::SEARCH_TYPE_OWS) {
+ $occupancyEnabled = true;
+ }
// if room type page
if ($idProduct = Tools::getValue('id_product')) {
$objHtlRoomType = new HotelRoomType();
@@ -102,8 +144,8 @@ class WkRoomSearchHelper
$searchedData['num_days'] = $objBookingDetail->getNumberOfDays($dateFrom, $dateTo);
$searchedData['parent_data'] = $htlCategoryInfo;
- $searchedData['date_from'] = date('d-m-Y', strtotime($dateFrom));
- $searchedData['date_to'] = date('d-m-Y', strtotime($dateTo));
+ $searchedData['date_from'] = $dateFrom;
+ $searchedData['date_to'] = $dateTo;
$searchedData['htl_dtl'] = $objHotelInfo->hotelBranchesInfo(0, 1, 1, $idHotel);
$searchedData['location'] = $searchedData['htl_dtl']['city'];
@@ -123,6 +165,20 @@ class WkRoomSearchHelper
}
}
+ if ($occupancyEnabled) {
+ // send occupancy information searched by the user
+ if ($searchedData['occupancies'] = Tools::getvalue('occupancy')) {
+ $searchedData['occupancy_adults'] = array_sum(
+ array_column($searchedData['occupancies'], 'adult')
+ );
+ $searchedData['occupancy_children'] = array_sum(
+ array_column($searchedData['occupancies'], 'children')
+ );
+ $searchedData['occupancy_child_ages'] = array_sum(
+ array_column($searchedData['occupancies'], 'child_ages')
+ );
+ }
+ }
$smartyVars['search_data'] = $searchedData;
}
@@ -142,10 +198,78 @@ class WkRoomSearchHelper
$smartyVars['total_active_hotels'] = $totalActiveHotels;
$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');
$maxOrderDate = HotelOrderRestrictDate::getMaxOrderDate($idHotel);
$smartyVars['max_order_date'] = date('Y-m-d', strtotime($maxOrderDate));
+
+ // set base width for each elements
+ $search_column_widths = array(
+ 'location' => 4,
+ 'hotel' => 5,
+ 'date' => 5,
+ 'occupancy' => 5,
+ 'search' => 3
+ );
+
+ if (!$locationEnabled) {
+ unset($search_column_widths['location']);
+
+ $search_column_widths['date'] += 1;
+ $search_column_widths['search'] += 1;
+ if ($occupancyEnabled) {
+ $search_column_widths['search'] += 1;
+ $search_column_widths['occupancy'] += 1;
+ } elseif ($smartyVars['show_hotel_name'] || count($hotelsInfo) > 1) {
+ $search_column_widths['hotel'] += 1;
+ } else {
+ $search_column_widths['search'] += 1;
+ $search_column_widths['date'] += 1;
+ }
+ }
+ if (!$smartyVars['show_hotel_name'] && count($hotelsInfo) <= 1) {
+ unset($search_column_widths['hotel']);
+
+ $search_column_widths['date'] += 1;
+ $search_column_widths['search'] += 1;
+ if ($occupancyEnabled) {
+ $search_column_widths['date'] += 1;
+ $search_column_widths['occupancy'] += 2;
+ } else {
+ $search_column_widths['date'] += 1;
+ $search_column_widths['date'] += 2;
+ }
+ }
+ if (!$occupancyEnabled) {
+ unset($search_column_widths['occupancy']);
+
+ if ($smartyVars['show_hotel_name'] || count($hotelsInfo) > 1) {
+ if ($locationEnabled) {
+ $search_column_widths['hotel'] += 1;
+ $search_column_widths['location'] += 1;
+ $search_column_widths['search'] += 2;
+ $search_column_widths['date'] += 1;
+ } else {
+ $search_column_widths['hotel'] += 2;
+ $search_column_widths['search'] += 2;
+ $search_column_widths['date'] += 2;
+
+ }
+ } else {
+ $search_column_widths['date'] += 1;
+ $search_column_widths['date'] += 4;
+ }
+ }
+ $smartyVars['column_widths'] = $search_column_widths;
+ if (count($search_column_widths) == 2) {
+ $smartyVars['multiple_dates_input'] = true;
+ Media::addJSDef(array(
+ 'multiple_dates_input' => true
+ ));
+ }
+
+
Context::getContext()->smarty->assign($smartyVars);
}
}
diff --git a/modules/wkroomsearchblock/views/css/wk-category-search.css b/modules/wkroomsearchblock/views/css/wk-category-search.css
index c1b707c6a..4e619cde8 100644
--- a/modules/wkroomsearchblock/views/css/wk-category-search.css
+++ b/modules/wkroomsearchblock/views/css/wk-category-search.css
@@ -32,74 +32,29 @@
float: left;
margin-top: 0px;
border-top: 3px solid #FFF;}
- .header-rmsearch-wrapper #search_hotel_block_form .header-rmsearch-input {
- box-shadow: 0 2px 1px 0 rgba(0,0,0,0.18);
- height: 43px;}
- .header-rmsearch-wrapper #search_hotel_block_form #search_room_submit {
- padding: 15px 20px;
- text-align: unset;}
- .header-rmsearch-wrapper #search_hotel_block_form #search_room_submit .icon-arrow-right {
- font-size: 16px;}
- #search_hotel_block_form #hotel_location, #search_hotel_block_form #id_hotel_button, #search_hotel_block_form #guest_occupancy {
- padding-left: 35px};
-
-
-#search_hotel_block_form .input-date {
- padding-right: 35px;}
-/*.header-rmsearch-wrapper .location_search_results_ul {
- top: 1px;}
-.header-rmsearch-wrapper .hotel_dropdown_ul {
- top: 41px;}*/
- .header-rmsearch-wrapper .location_search_results_ul li, .header-rmsearch-wrapper .hotel_dropdown_ul li {
- padding: 10px 15px;}
-
-#search_hotel_block_form #hotel_location, #search_hotel_block_form #id_hotel_button, #search_hotel_block_form #guest_occupancy {
- padding-left: 35px;
- padding-right: 35px;}
-#search_hotel_block_form #hotel_location {
- padding-right: 15px;}
-.occupancy_info_block .occupancy_count {
- padding: 18px;
-}
-#search_hotel_block_form .form-group {
- margin-bottom: 15px;
-}
-@media (min-width: 480px) and (max-width: 767px) {
- #search_hotel_block_form #hotel_location, #search_hotel_block_form #id_hotel_button, #search_hotel_block_form #guest_occupancy {
- padding-left: 35px;
- padding-right: 35px;
- background-position: 2% 50%;}
- #search_hotel_block_form #id_hotel_button {
- background: url("../../views/img/icon-hotel.svg") no-repeat 2% 50%, url("../../views/img/icon-dropdown-arrow.svg") no-repeat 98% 50%;
- background-color: #FFF;}
- #search_hotel_block_form #guest_occupancy {
- background: url("../../views/img/icon-users.svg") no-repeat 2% 50%, url("../../views/img/icon-dropdown-arrow.svg") no-repeat 98% 50%;
- background-color: #FFF;}
- #search_hotel_block_form .input-date {
- background-position: 98% 50%;}
+ .header-rmsearch-wrapper #search_hotel_block_form {
+ grid-template-columns: 1fr;
}
-@media (min-width: 768px) {
- .occupancy_info_block .occupancy_count_block {
- width: 100%;}
- .occupancy_info_block .occupancy_count {
- width: 80%;}
- #search_hotel_block_form #hotel_location, #search_hotel_block_form #id_hotel_button, #search_hotel_block_form #guest_occupancy {
- padding-left: 30px;
- padding-right: 20px;}
-}
-@media (min-width: 768px) and (max-width: 768px) {
+ .header-rmsearch-wrapper #search_hotel_block_form #daterange_value.grid {
+ display: grid;
+ column-gap: 5px;
+ grid-template-columns: 1fr;
+ }
+ #search_hotel_block_form .header-rmsearch-input {
+ height: unset;
+ min-height: 45px;
+ }
+ /* #search_hotel_block_form #search_room_submit {
+ height: 45px;
+ } */
+ #search_hotel_block_form {
+ grid-template-columns: 1fr;
+ }
+ #search_hotel_block_form > div {
+ grid-column-end: unset!important;
+ grid-column: unset!important;}
+@media (min-width: 768px) and (max-width: 991px) {
.header-rmsearch-wrapper {
padding: 10px 5px;}
- #search_hotel_block_form #search_room_submit {
- font-size: 12px;}
- .header-rmsearch-wrapper #search_hotel_block_form #search_room_submit .icon-arrow-right {
- font-size: 12px;}
- #search_hotel_block_form .header-rmsearch-input {
- font-size: 13px;}
- .header-rmsearch-wrapper #search_hotel_block_form #search_room_submit {
- padding: 15px 10px;}
- .children_ages div {
- width: 100%;}
- .occupancy_info_block .occupancy_count {
- width: 75%;}
-}
\ No newline at end of file
+
+}
\ No newline at end of file
diff --git a/modules/wkroomsearchblock/views/css/wk-global-search.css b/modules/wkroomsearchblock/views/css/wk-global-search.css
index 8b8899e41..155e843b7 100644
--- a/modules/wkroomsearchblock/views/css/wk-global-search.css
+++ b/modules/wkroomsearchblock/views/css/wk-global-search.css
@@ -17,39 +17,102 @@
* @license https://store.webkul.com/license.html
*/
+#search_hotel_block_form.grid {
+ display: grid;
+ grid-template-columns: repeat(22, 1fr);
+ column-gap: 5px;
+}
+#search_hotel_block_form.grid > div {
+ display: grid;
+}
+#search_hotel_block_form .area-3 {
+ grid-column-end: span 3;
+}
+#search_hotel_block_form .area-4 {
+ grid-column-end: span 4;
+}
+#search_hotel_block_form .area-5 {
+ grid-column-end: span 5;
+}
+#search_hotel_block_form .area-6 {
+ grid-column-end: span 6;
+}
+#search_hotel_block_form .area-7 {
+ grid-column-end: span 7;
+}
+#search_hotel_block_form .area-8 {
+ grid-column-end: span 8;
+}
+#search_hotel_block_form .area-9 {
+ grid-column-end: span 9;
+}
+#search_hotel_block_form .area-10 {
+ grid-column-end: span 10;
+}
+#search_hotel_block_form .area-11 {
+ grid-column-end: span 11;
+}
+#search_hotel_block_form .area-14 {
+ grid-column-end: span 14;
+}
+#search_hotel_block_form .area-16 {
+ grid-column-end: span 16;
+}
+#daterange_value.grid {
+ display: grid;
+ column-gap: 5px;
+ grid-template-columns: repeat(2, 1fr);
+}
+/* #search_hotel_block_form {
+ display: grid;
+ grid-template-columns: 0.8fr repeat(3, 1fr) 0.6fr;
+ column-gap: 5px;
+}
+@media (min-width: 768px) and (max-width: 991px) {
+ #search_hotel_block_form {
+ grid-template-columns: repeat(12, 1fr);
+ grid-template-rows: repeat(2, 1fr);
+ }
+ #search_hotel_block_form > div {
+ grid-column-end: span 4;
+ }
+ #search_hotel_block_form > div:nth-child(1) {
+ grid-column: 1 / span 5;
+ }
+ #search_hotel_block_form > div:nth-child(2) {
+ grid-column: 6 / span 5;
+ }
+}
+@media (max-width: 767px) {
+ #search_hotel_block_form {
+ grid-template-columns: 1fr;
+ }
+} */
#search_hotel_block_form .header-rmsearch-input {
border-radius: 4px;
border: none;
color: #333;
font-size: 14px;
font-weight: 400;
- padding: 7px 5px 7px 12px;
border: 1px solid #555555;
- background-color: #FFF;}
+ background-color: #FFF;
+ min-height: 55px;}
#search_hotel_block_form .header-rmsearch-input:active, #search_hotel_block_form .header-rmsearch-input:focus {
border: 2px solid #1292FF;}
- #search_hotel_block_form #hotel_location, #search_hotel_block_form #id_hotel_button, #search_hotel_block_form #guest_occupancy {
- padding-left: 45px;
- padding-right: 35px;
- background-repeat: no-repeat;
- background-position: 4% 50%;}
- #search_hotel_block_form #hotel_location {
- background-image: url("../../views/img/icon-hotel.svg");}
#search_hotel_block_form #id_hotel_button {
- background: url("../../views/img/icon-hotel.svg") no-repeat 4% 50%, url("../../views/img/icon-dropdown-arrow.svg") no-repeat 96% 50%;
+ 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 {
- background: url("../../views/img/icon-users.svg") no-repeat 4% 50%, url("../../views/img/icon-dropdown-arrow.svg") no-repeat 96% 50%;
- background-color: #FFF;}
-
+ height: unset;
+ text-align: unset;
+ }
#search_hotel_block_form .input-date {
- cursor: text;
- background-image: url("../../views/img/icon-calendar.svg");
- background-repeat: no-repeat;
- padding-right: 40px;
- background-position: 96% 50%;}
- #search_hotel_block_form #hotel_location {
- padding-right: 15px;}
+ display: grid;
+ cursor: text;}
+ #search_hotel_block_form .input-date span {
+ align-self: center;}
+ #search_hotel_block_form .input-date span i {
+ transform: scale(0.8, 0.6);}
.header-rmsearch-input::-webkit-input-placeholder {
color: #333;}
.header-rmsearch-input:-moz-placeholder {
@@ -135,12 +198,110 @@
color: #333333;
line-height: 22px;
text-align: center;}
- #search_hotel_block_form .form-group {
- margin-bottom: 20px;}
#search_hotel_block_form #search_room_submit {
background-color: #1292FF;
width: 100%;
font-size: 13px;
text-transform: uppercase;
border: none;
- border-radius: 4px;}
\ No newline at end of file
+ border-radius: 4px;}
+
+
+/* occupancy */
+#search_occupancy_wrapper {
+ border: none;
+ max-height: 400px;
+ min-width: 250px;
+ overflow: auto;
+ box-shadow: 0 8px 25px -4px rgba(0,0,0,0.39);
+ left: 0px;
+ padding: 20px;}
+ #search_occupancy_wrapper .occupancy-info-separator {
+ margin-bottom: 15px;
+ margin-top: 15px;
+ margin-right: -20px;
+ margin-left: -20px;}
+ #search_occupancy_wrapper .children_age_info_block {
+ display: none;}
+ #search_occupancy_wrapper .children_age_info_block label {
+ font-size: 12px;
+ color: #777777;}
+ #search_occupancy_wrapper label {
+ font-size: 14px;
+ color: #333333;
+ font-weight: 400;}
+ #search_occupancy_wrapper .add_new_occupancy_btn {
+ font-weight: bold;
+ text-decoration: none;
+ font-size: 14px;
+ color: #0000FF;
+ line-height: 24px;}
+ #search_occupancy_wrapper .add_new_occupancy_btn:active, #search_occupancy_wrapper .add_new_occupancy_btn:focus, #search_occupancy_wrapper .add_new_occupancy_btn:hover {
+ text-decoration: none;
+ color: #0000FF;}
+ #search_occupancy_wrapper .occupancy_info_head {
+ font-size: 14px;
+ color: #333333;
+ font-weight: bold;
+ margin-bottom: 10px;}
+ #search_occupancy_wrapper .occupancy_info_head .remove-room-link {
+ font-size: 12px;
+ color: #FF4343;
+ text-align: right;}
+ #search_occupancy_wrapper .occupancy_info_block {
+ display: grid;
+ grid-template-columns: repeat(2, 1fr); }
+ #search_occupancy_wrapper .occupancy_info_block .occupancy_count_block{
+ display: grid;}
+ #search_occupancy_wrapper .occupancy_info_block .occupancy_count_block > div{
+ align-self: end;}
+ #search_occupancy_wrapper .occupancy_info_block .children_age_info_block {
+ grid-column: 1 / 3}
+ #search_occupancy_wrapper .occupancy_info_block .occupancy_count {
+ padding: 14px;
+ border: 1px solid #E1E3E7;
+ font-size: 14px;
+ font-weight: 600;
+ color: #333333;
+ text-align: center;
+ border-radius: 4px;}
+ #search_occupancy_wrapper .occupancy_info_block .occupancy_count > span {
+ min-width: 21px;
+ text-align: center;
+ display: block;}
+ #search_occupancy_wrapper .occupancy_info_block .qty_direction {
+ margin-left: 3px;
+ width: 22px;}
+ #search_occupancy_wrapper .occupancy_info_block .qty_direction a {
+ padding: 1px 5px;
+ border: 0px;
+ border: 1px solid #E1E3E7;
+ color: #333;
+ border-radius: 4px;
+ font-weight: 400;}
+ #search_occupancy_wrapper .occupancy_info_block .qty_direction .occupancy_quantity_down {
+ margin-top: 3px;}
+
+ #search_occupancy_wrapper .children_ages {
+ display: grid;
+ grid-template-columns: 1fr 1fr;
+ column-gap: 5px;
+ justify-content: space-between;
+ }
+ #search_occupancy_wrapper .children_ages select {
+ background-color: #fff;
+ height: 37px;
+ border-radius: 4px;
+ padding: 3px 5px;
+ font-size: 12px;
+ color: #333;
+ border: 1px solid #E1E3E7;
+ width: 100%;}
+
+
+@media (max-width: 411px) {
+ #search_occupancy_wrapper .occupancy_info_block .occupancy_count_block {
+ width: 100%;}
+ #search_occupancy_wrapper .occupancy_info_block .occupancy_count {
+ width: 80%;}
+}
\ No newline at end of file
diff --git a/modules/wkroomsearchblock/views/css/wk-landing-page-search.css b/modules/wkroomsearchblock/views/css/wk-landing-page-search.css
index fe89903bf..f1f5fcd26 100644
--- a/modules/wkroomsearchblock/views/css/wk-landing-page-search.css
+++ b/modules/wkroomsearchblock/views/css/wk-landing-page-search.css
@@ -35,8 +35,7 @@
width: 100%;}
.header-rmsearch-primary {
display: table-cell;
- vertical-align: middle;
- text-align: center;}
+ vertical-align: middle;}
.header-rmsearch-inner-wrapper {
margin-top: 30px;
margin-bottom: 15px;}
@@ -63,27 +62,6 @@
float: left;
margin-top: 5px;
width: 125px;}
-
-#search_hotel_block_form .header-rmsearch-input {
- height: 55px;}
-.header-rmsearch-show-xs {
- background-color: #ffffff;
- top: 0;}
-#search_hotel_block_form .header-rmsearch-input {
- height: 55px;}
-#search_hotel_block_form #search_room_submit {
- padding: 5px;
- box-shadow: 0 0 20px 0 rgba(18,146,255,0.42);}
-@media (min-width: 768px) {
- #search_hotel_block_form .input-date {
- background-position: 92% 50%;}
- #search_hotel_block_form .check_in_field_block {
- padding-right:5px;}
- #search_hotel_block_form .check_out_field_block {
- padding-left:5px;}}
-
-@media (min-width: 768px) and (max-width: 1199px) {
- #search_hotel_block_form #hotel_location, #search_hotel_block_form #id_hotel_button {
- padding-left: 40px;
- padding-right: 30px;}
-}
+/* .fancybox-inner #search_hotel_block_form {
+ grid-template-columns: 1fr;
+} */
\ No newline at end of file
diff --git a/modules/wkroomsearchblock/views/css/wk-roomtype-search.css b/modules/wkroomsearchblock/views/css/wk-roomtype-search.css
index 6aede84bc..d2976d0f0 100644
--- a/modules/wkroomsearchblock/views/css/wk-roomtype-search.css
+++ b/modules/wkroomsearchblock/views/css/wk-roomtype-search.css
@@ -23,26 +23,18 @@
background: #1A4060;
box-shadow: 0 2px 6px 0 rgba(0,0,0,0.16);
padding: 20px 0px;}
- .header-rmsearch-wrapper #search_hotel_block_form {
- padding-left: 10px;
- padding-right: 10px;}
- .header-rmsearch-wrapper .filter_header {
- font-size: 12px;
- color: #FFFFFF;
- line-height: 25px;}
- .header-rmsearch-wrapper .filter_header p {
- margin-bottom: 2px;}
- .header-rmsearch-wrapper #search_hotel_block_form .header-rmsearch-input {
- box-shadow: 0 2px 1px 0 rgba(0,0,0,0.18);
- height: 49px;}
- .header-rmsearch-wrapper #search_hotel_block_form #search_room_submit {
- padding: 15px 20px;}
- .header-rmsearch-wrapper .container {
- position: relative;}
- .header-rmsearch-wrapper .close_room_serach_wrapper {
- position: absolute;
- top: 0px;
- right: 0px;}
+ .header-rmsearch-wrapper .filter_header {
+ font-size: 12px;
+ color: #FFFFFF;
+ line-height: 25px;}
+ .header-rmsearch-wrapper .filter_header p {
+ margin-bottom: 2px;}
+ .header-rmsearch-wrapper .container {
+ position: relative;}
+ .header-rmsearch-wrapper .close_room_serach_wrapper {
+ position: absolute;
+ top: 0px;
+ right: 0px;}
/* hotel searched information wrapper css */
.header-rmsearch-details-wrapper {
@@ -72,52 +64,9 @@
background-color: #FAFAFA;}
.faded-txt {
color: #777777;}
-
- /* .header-rmsearch-wrapper .location_search_results_ul {
- top: 1px;}
- .header-rmsearch-wrapper .hotel_dropdown_ul {
- top: 46px;}*/
-#search_hotel_block_form #hotel_location, #search_hotel_block_form #id_hotel_button, #search_hotel_block_form #guest_occupancy {
- padding-left: 40px;
- padding-right: 30px;}
-.header-rmsearch-wrapper .location_search_results_ul li, .header-rmsearch-wrapper .hotel_dropdown_ul li {
- padding: 13px 15px;}
-#search_hotel_block_form .input-date {
- background-position: 95% 50%;}
-@media (min-width: 768px) and (max-width: 991px) {
- .search_room_submit_block {
- float: right;}
-}
-
@media (max-width: 991px) {
.header-rmsearch-wrapper .close_room_serach_wrapper {
top: -8px;
right: 15px;}
.close_room_serach_wrapper img {
- width: 18px;}}
-
-@media (min-width: 768px) {
- #search_hotel_block_form #hotel_location {
- background-position: 3% 50%;}}
-@media (max-width: 767px) {
- #search_hotel_block_form .input-date {
- background-position: 96% 50%;}
-
- .header-rmsearch-details-wrapper .modify_roomtype_search_btn {
- width: 100%;}
-}
-@media (min-width: 480px) and (max-width: 767px) {
- #search_hotel_block_form #hotel_location, #search_hotel_block_form #id_hotel_button, #search_hotel_block_form #guest_occupancy {
- padding-left: 35px;
- padding-right: 35px;
- background-position: 2% 50%;}
- #search_hotel_block_form #id_hotel_button {
- background: url("../../views/img/icon-hotel.svg") no-repeat 2% 50%, url("../../views/img/icon-dropdown-arrow.svg") no-repeat 98% 50%;
- background-color: #FFF;}
- #search_hotel_block_form #guest_occupancy {
- background: url("../../views/img/icon-users.svg") no-repeat 2% 50%, url("../../views/img/icon-dropdown-arrow.svg") no-repeat 98% 50%;
- background-color: #FFF;}
- #search_hotel_block_form .input-date {
- background-position: 98% 50%;}
-}
-
+ width: 18px;}}
\ No newline at end of file
diff --git a/modules/wkroomsearchblock/views/js/wk-room-search-block.js b/modules/wkroomsearchblock/views/js/wk-room-search-block.js
index f09bbb788..ba33cd21b 100644
--- a/modules/wkroomsearchblock/views/js/wk-room-search-block.js
+++ b/modules/wkroomsearchblock/views/js/wk-room-search-block.js
@@ -20,14 +20,14 @@
$(document).ready(function() {
// for screen size changes for room search
var window_width = $(window).width();
- if (window_width >= 767) {
+ if (window_width > 767) {
$('.fancy_search_header_xs').hide();
}
if ($("body").length) {
$(window).resize(function() {
var window_width = $(window).width();
- if (window_width >= 767) {
+ if (window_width > 767) {
$.fancybox.close();
$('.fancy_search_header_xs').hide();
} else {
@@ -54,89 +54,82 @@ $(document).ready(function() {
var ajax_check_var = '';
$('.location_search_results_ul').hide();
- $("#check_out_time").datepicker({
- dateFormat: 'dd-mm-yy',
- dayNamesMin: [ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
- //for calender Css
- beforeShowDay: function (date) {
- // get check-in date
- return highlightSelectedDateRange(date, $("#check_in_time").val(), $("#check_out_time").val());
- },
- beforeShow: function (input, instance) {
- // So that on translating page date is translated to NaN-NaN-NaN
- $('.ui-datepicker').addClass('notranslate');
-
- var date_to = $('#check_in_time').val();
- if (typeof date_to != 'undefined' && date_to != '') {
- var date_format = date_to.split("-");
- var selectedDate = new Date($.datepicker.formatDate('yy-mm-dd', new Date(date_format[2], date_format[1] - 1, date_format[0])));
- selectedDate.setDate(selectedDate.getDate()+1);
- $("#check_out_time").datepicker("option", "minDate", selectedDate);
- } else {
- var date_format = new Date();
- var selectedDate = new Date($.datepicker.formatDate('yy-mm-dd', new Date()));
- selectedDate.setDate(selectedDate.getDate()+1);
- $("#check_out_time").datepicker("option", "minDate", selectedDate);
- }
+ function createDateRangePicker(max_order_date, dateFrom, dateTo)
+ {
+ if (max_order_date) {
+ max_order_date = $.datepicker.parseDate('yy-mm-dd', max_order_date );
+ } else {
+ max_order_date = false;
}
- });
- $("#check_in_time").datepicker({
- dateFormat: 'dd-mm-yy',
- minDate: 0,
- dayNamesMin: [ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
- beforeShow: function (input, instance) {
- // So that on translating page date is translated to NaN-NaN-NaN
- $('.ui-datepicker').addClass('notranslate');
- },
- //for calender Css
- beforeShowDay: function (date) {
- // highlight dates of the selected date range
- return highlightSelectedDateRange(date, $("#check_in_time").val(), $("#check_out_time").val());
- },
- onClose: function() {
- // get checkout date before making any changes for the operations
- var checkOut = $("#check_out_time").val();
- var date = $("#check_in_time").val();
- var dateFormat = date.split("-");
- var selectedDate = new Date(
- $.datepicker.formatDate('yy-mm-dd', new Date(dateFormat[2], dateFormat[1] - 1, dateFormat[0]))
+ if (typeof $('#daterange_value').data('dateRangePicker') != 'undefined') {
+ if (max_order_date) {
+ if ($.datepicker.parseDate('yy-mm-dd', $('#check_out_time').val()) < max_order_date) {
+ dateFrom = dateFrom ? dateFrom :$('#check_in_time').val();
+ dateTo = dateTo ? dateTo : $('#check_out_time').val();
+ } else {
+ dateFrom = false;
+ dateTo = false;
+ }
+ }
+ $('#daterange_value').data('dateRangePicker').clear();
+ $('#daterange_value').data('dateRangePicker').destroy();
+ $("#daterange_value").off("datepicker-change");
+ }
+
+ if (max_order_date) {
+ max_order_date = $.datepicker.formatDate('dd-mm-yy', max_order_date);
+ }
+
+ if (typeof(multiple_dates_input) != 'undefined' && multiple_dates_input) {
+ $('#daterange_value').dateRangePicker({
+ startDate: $.datepicker.formatDate('dd-mm-yy', new Date()),
+ separator : ' to ',
+ setValue: function(s,s1,s2)
+ {
+ if (s1) {
+ $('#daterange_value_from').find('span').html(s1);
+ } else {
+ $(daterange_value_from).find('span').html(
+ RangePickerCheckin
+ );
+ }
+ if (s2) {
+ $('#daterange_value_to').find('span').html(s2);
+ } else {
+ $('#daterange_value_to').find('span').html(
+ RangePickerCheckin
+ );
+ }
+ },
+ endDate: max_order_date,
+ }).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));
+ });
+ } else {
+ $('#daterange_value').dateRangePicker({
+ startDate: $.datepicker.formatDate('dd-mm-yy', new Date()),
+ endDate: max_order_date,
+ }).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));
+ });
+ }
+
+ if (dateFrom && dateTo) {
+ $('#daterange_value').data('dateRangePicker').setDateRange(
+ $.datepicker.formatDate('dd-mm-yy', $.datepicker.parseDate('yy-mm-dd', dateFrom)),
+ $.datepicker.formatDate('dd-mm-yy', $.datepicker.parseDate('yy-mm-dd', dateTo))
);
- selectedDate.setDate(selectedDate.getDate() + 1);
- $("#check_out_time").datepicker("option", "minDate", selectedDate);
-
- /* open datepicker of chechout date only if
- checkout date is empty or checkin selected is equal or more than check out date */
- if (checkOut == '') {
- $("#check_out_time").datepicker( "show" );
- } else {
- // Lets make the date in the required format
- selectedDate.setDate(selectedDate.getDate() - 1);
- var currentDate = selectedDate.getDate();
- var currentMonth = selectedDate.getMonth() + 1;
- if (currentMonth < 10) {
- currentMonth = '0' + currentMonth;
- }
- if (currentDate < 10) {
- currentDate = '0' + currentDate;
- }
-
- dmy = selectedDate.getFullYear() + "-" + currentMonth + "-" + currentDate;
- checkOut = checkOut.split("-");
- checkOut = (checkOut[2]) + '-' + (checkOut[1]) + '-' + (checkOut[0]);
-
- if (checkOut <= dmy) {
- $("#check_out_time").datepicker('show');
- }
- }
}
- });
+
+ }
+
+ createDateRangePicker(false, $('#check_in_time').val(), $('#check_out_time').val());
if (typeof max_order_date != 'undefined' && typeof booking_date_to != 'undefined') {
- max_order_date_cal = new Date(max_order_date);
- $("#check_out_time").datepicker("option", "maxDate", new Date(max_order_date));
- max_order_date_cal.setDate(max_order_date_cal.getDate() - 1);
- $("#check_in_time").datepicker("option", "maxDate", max_order_date_cal);
+ createDateRangePicker(max_order_date, $('#check_in_time').val(), $('#check_out_time').val());
}
function abortRunningAjax() {
@@ -265,17 +258,7 @@ $(document).ready(function() {
$(document).on('click', '.hotel_dropdown_ul li', function() {
var max_order_date = $(this).attr('data-max_order_date');
- var max_date_from = new Date(max_order_date);
- max_date_from.setDate(max_date_from.getDate() - 1);
- var max_date_to = new Date(max_order_date);
- if($("#check_in_time").datepicker("getDate") > max_date_from) {
- $("#check_in_time").val('');
- }
- if($("#check_out_time").datepicker("getDate") > max_date_to) {
- $("#check_out_time").val('');
- }
- $("#check_in_time").datepicker("option", "maxDate", max_date_from);
- $("#check_out_time").datepicker("option", "maxDate", max_date_to);
+ createDateRangePicker(max_order_date, $('#check_in_time').val(), $('#check_out_time').val());
$("#max_order_date").val(max_order_date);
$('#id_hotel').val($(this).attr('data-id-hotel'));
$('#hotel_cat_id').val($(this).attr('data-hotel-cat-id'));
@@ -285,30 +268,14 @@ $(document).ready(function() {
// If only one hotel then set max order date on date pickers
var max_order_date = $('#max_order_date').val();
if (max_order_date != '') {
- var max_date_from = new Date(max_order_date);
- max_date_from.setDate(max_date_from.getDate() - 1);
- var max_date_to = new Date(max_order_date);
- if($("#check_in_time").datepicker("getDate") > max_date_from) {
- $("#check_in_time").val('');
- }
- if($("#check_out_time").datepicker("getDate") > max_date_to) {
- $("#check_out_time").val('');
- }
- $("#check_in_time").datepicker("option", "maxDate", max_date_from);
- $("#check_out_time").datepicker("option", "maxDate", max_date_to);
+ createDateRangePicker(max_order_date, $('#check_in_time').val(), $('#check_out_time').val());
}
// validations on the submit of the search fields
$('#search_room_submit').on('click', function(e) {
var check_in_time = $("#check_in_time").val();
var check_out_time = $("#check_out_time").val();
-
- var date_format_check_in = check_in_time.split("-");
- var new_chk_in = new Date($.datepicker.formatDate('yy-mm-dd', new Date(date_format_check_in[2], date_format_check_in[1] - 1, date_format_check_in[0])));
- var date_format_check_out = check_out_time.split("-");
- var new_chk_out = new Date($.datepicker.formatDate('yy-mm-dd', new Date(date_format_check_out[2], date_format_check_out[1] - 1, date_format_check_out[0])));
var max_order_date = $("#max_order_date").val();
- var max_order_date_format = $.datepicker.formatDate('yy-mm-dd', new Date(max_order_date));
var error = false;
var locationCatId = $('#hotel_location').attr('city_cat_id');
@@ -324,35 +291,283 @@ $(document).ready(function() {
$('#select_htl_error_p').text(hotel_name_cond);
error = true;
}
+ var date_selector
+ if (typeof(multiple_dates_input) != 'undefined' && multiple_dates_input) {
+ date_selector = '#daterange_value_from, #daterange_value_to';
+ } else {
+ date_selector = '#daterange_value';
+ }
if (check_in_time == '') {
- $("#check_in_time").addClass("error_border");
- $('#check_in_time_error_p').text(check_in_time_cond);
+ $(date_selector).addClass("error_border");
+ $('#daterange_value_error_p').text(check_in_time_cond);
error = true;
- } else if (new_chk_in < $.datepicker.formatDate('yy-mm-dd', new Date())) {
- $("#check_in_time").addClass("error_border");
- $('#check_in_time_error_p').text(less_checkin_date);
+ } else if (check_in_time < $.datepicker.formatDate('yy-mm-dd', new Date())) {
+ $(date_selector).addClass("error_border");
+ $('#daterange_value_error_p').text(less_checkin_date);
error = true;
}
if (check_out_time == '') {
- $("#check_out_time").addClass("error_border");
- $('#check_out_time_error_p').text(check_out_time_cond);
+ $(date_selector).addClass("error_border");
+ $('#daterange_value_error_p').text(check_out_time_cond);
error = true;
- } else if (new_chk_out < new_chk_in) {
- $("#check_out_time").addClass("error_border");
- $('#check_out_time_error_p').text(more_checkout_date);
+ } else if (check_out_time < check_in_time) {
+ $(date_selector).addClass("error_border");
+ $('#daterange_value_error_p').text(more_checkout_date);
error = true;
- } else if (max_order_date_format < new_chk_in) {
- $("#check_in_time").addClass("error_border");
- $('#check_in_time_error_p').text(max_order_date_err + ' ' + max_order_date);
+ } else if (max_order_date < check_in_time) {
+ $(date_selector).addClass("error_border");
+ $('#daterange_value_error_p').text(max_order_date_err + ' ' + max_order_date);
error = true;
- } else if (max_order_date_format < new_chk_out) {
- $("#check_out_time").addClass("error_border");
- $('#check_out_time_error_p').text(max_order_date_err + ' ' + max_order_date);
+ } else if (max_order_date < check_out_time) {
+ $(date_selector).addClass("error_border");
+ $('#daterange_value_error_p').text(max_order_date_err + ' ' + max_order_date);
error = true;
}
+
if (error)
return false;
else
return true;
});
+ // Occupancy field dropdown
+ // add occupancy info block
+ $('#search_occupancy_wrapper .add_new_occupancy_btn').on('click', function(e) {
+ e.preventDefault();
+
+ var occupancy_block = '';
+
+ var roomBlockIndex = parseInt($("#search_occupancy_wrapper .occupancy_info_block").last().attr('occ_block_index'));
+ roomBlockIndex += 1;
+
+ var countRooms = parseInt($('#search_occupancy_wrapper .occupancy_info_block').length);
+ countRooms += 1
+
+ occupancy_block += '';
+ occupancy_block += '
';
+ occupancy_block += '
';
+ occupancy_block += '
';
+ occupancy_block += '
';
+ occupancy_block += '
';
+ occupancy_block += '
';
+ occupancy_block += '
';
+ occupancy_block += '
';
+ $('#occupancy_inner_wrapper').append(occupancy_block);
+
+ // scroll to the latest added room
+ $("#search_occupancy_wrapper").animate({ scrollTop: $("#search_occupancy_wrapper").prop('scrollHeight') }, "slow");
+
+ setGuestOccupancy();
+ });
+
+ // remove occupancy info block
+ $(document).on('click', '#search_occupancy_wrapper .remove-room-link', function(e) {
+ e.preventDefault();
+ $(this).closest('#search_occupancy_wrapper .occupancy-room-block').remove();
+
+ $( "#search_occupancy_wrapper .room_num_wrapper" ).each(function(key, val) {
+ $(this).text(room_txt + ' - '+ (key+1) );
+ });
+
+ setGuestOccupancy();
+ });
+
+ // increase the quantity of adult and child
+ $(document).on('click', '#search_occupancy_wrapper .occupancy_quantity_up', function(e) {
+ e.preventDefault();
+ // set input field value
+ var element = $(this).closest('.occupancy_count_block').find('.num_occupancy');
+ var elementVal = parseInt(element.val()) + 1;
+
+ var childElement = $(this).closest('.occupancy_count_block').find('.num_children').length;
+ if (childElement) {
+ var totalChilds = $(this).closest('.occupancy_info_block').find('.guest_child_age').length;
+
+ if (max_child_in_room == 0 || totalChilds < max_child_in_room) {
+ element.val(elementVal);
+ $(this).closest('.occupancy_info_block').find('.children_age_info_block').show();
+
+ var roomBlockIndex = parseInt($(this).closest('.occupancy_info_block').attr('occ_block_index'));
+
+ var childAgeSelect = '';
+ childAgeSelect += '';
+ childAgeSelect += '' + select_age_txt + ' ';
+ childAgeSelect += '' + under_1_age + ' ';
+ for (let age = 1; age < max_child_age; age++) {
+ childAgeSelect += ''+age+' ';
+ }
+ childAgeSelect += ' ';
+ childAgeSelect += '
';
+
+ $(this).closest('.occupancy_info_block').find('.children_ages').append(childAgeSelect);
+
+ // set input field value
+ $(this).closest('.occupancy_count_block').find('.occupancy_count > span').text(elementVal);
+ }
+ } else {
+ element.val(elementVal);
+
+ // set input field value
+ $(this).closest('.occupancy_count_block').find('.occupancy_count > span').text(elementVal);
+ }
+
+ setGuestOccupancy();
+ });
+
+ $(document).on('click', '#search_occupancy_wrapper .occupancy_quantity_down', function(e) {
+ e.preventDefault();
+ // set input field value
+ var element = $(this).closest('.occupancy_count_block').find('.num_occupancy');
+ var elementVal = parseInt(element.val()) - 1;
+ var childElement = $(this).closest('.occupancy_count_block').find('.num_children').length;
+
+ if (childElement) {
+ if (elementVal < 0) {
+ elementVal = 0;
+ } else {
+ $(this).closest('.occupancy_info_block').find('.children_ages select').last().closest('div').remove();
+ if (elementVal <= 0) {
+ $(this).closest('.occupancy_info_block').find('.children_age_info_block').hide();
+ }
+ }
+ } else {
+ if (elementVal == 0) {
+ elementVal = 1;
+ }
+ }
+
+ element.val(elementVal);
+ // set input field value
+ $(this).closest('.occupancy_count_block').find('.occupancy_count > span').text(elementVal);
+
+ setGuestOccupancy();
+ });
+
+ // toggle occupancy block
+ $('#guest_occupancy').on('click', function(e) {
+ e.stopPropagation();
+ $("#search_occupancy_wrapper").toggle();
+ });
+
+ // close the occupancy block when clink anywhere in the body outside occupancy block
+ $('body').on('click', function(e) {
+ // @TODO better approach to be found
+ 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
+ let hasErrors = 0;
+
+ let adult = $("#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 (!adult.length || (adult.length != children.length)) {
+ hasErrors = 1;
+ showErrorMessage(invalid_occupancy_txt);
+ } else {
+ $("#search_occupancy_wrapper").find('.occupancy_count').removeClass('error_border');
+
+ // validate values of adult and children
+ adult.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()
+{
+ var adult = 0;
+ var children = 0;
+ var rooms = $('#search_occupancy_wrapper .occupancy_info_block').length;
+ $( "#search_occupancy_wrapper .num_adults" ).each(function(key, val) {
+ adult += parseInt($(this).val());
+ });
+ $( "#search_occupancy_wrapper .num_children" ).each(function(key, val) {
+ children += parseInt($(this).val());
+ });
+ var guestButtonVal = parseInt(adult) + ' ';
+ if (parseInt(adult) > 1) {
+ guestButtonVal += adults_txt;
+ } else {
+ guestButtonVal += adult_txt;
+ }
+ if (parseInt(children) > 0) {
+ if (parseInt(children) > 1) {
+ guestButtonVal += ', ' + parseInt(children) + ' ' + children_txt;
+ } else {
+ guestButtonVal += ', ' + parseInt(children) + ' ' + child_txt;
+ }
+ }
+ if (parseInt(rooms) > 1) {
+ guestButtonVal += ', ' + parseInt(rooms) + ' ' + rooms_txt;
+ } else {
+ guestButtonVal += ', ' + parseInt(rooms) + ' ' + room_txt;
+ }
+ $('#guest_occupancy > span').text(guestButtonVal);
+}
\ No newline at end of file
diff --git a/modules/wkroomsearchblock/views/templates/hook/categoryPageSearch.tpl b/modules/wkroomsearchblock/views/templates/hook/categoryPageSearch.tpl
index aa6ab0fb8..065998342 100644
--- a/modules/wkroomsearchblock/views/templates/hook/categoryPageSearch.tpl
+++ b/modules/wkroomsearchblock/views/templates/hook/categoryPageSearch.tpl
@@ -19,61 +19,10 @@
{if isset($hotels_info) && count($hotels_info)}
-
diff --git a/modules/wkroomsearchblock/views/templates/hook/roomTypePageSearch.tpl b/modules/wkroomsearchblock/views/templates/hook/roomTypePageSearch.tpl
index a58e5ed2f..95f9783e0 100644
--- a/modules/wkroomsearchblock/views/templates/hook/roomTypePageSearch.tpl
+++ b/modules/wkroomsearchblock/views/templates/hook/roomTypePageSearch.tpl
@@ -46,69 +46,11 @@
{* search form wrapper block*}