fix initial occupancy feature issue
This commit is contained in:
@@ -62,7 +62,7 @@
|
||||
<div class="fixed-width-xl room_check_in_div">
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon">{l s='Check In'}</div>
|
||||
<input type="text" class="form-control edit_product_date_from" name="edit_product[date_from]" value="{$data.date_from|date_format:"%d-%m-%Y"}" readonly/>
|
||||
<input type="text" class="form-control edit_product_date_from" name="edit_product[date_from]" value="{$data.date_from|date_format:"%d-%m-%Y"}"/>
|
||||
<div class="input-group-addon"><i class="icon-calendar"></i></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -70,7 +70,7 @@
|
||||
<div class="fixed-width-xl room_check_out_div">
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon">{l s='Check Out'}</div>
|
||||
<input type="text" class="form-control edit_product_date_to" name="edit_product[date_to]" value="{$data.date_to|date_format:"%d-%m-%Y"}" readonly/>
|
||||
<input type="text" class="form-control edit_product_date_to" name="edit_product[date_to]" value="{$data.date_to|date_format:"%d-%m-%Y"}"/>
|
||||
<div class="input-group-addon"><i class="icon-calendar"></i></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -529,9 +529,14 @@ class ProductControllerCore extends FrontController
|
||||
$bookingParams['occupancy'] = $occupancy;
|
||||
$quantity = count($occupancy);
|
||||
} else {
|
||||
// when room selection is done using qty, occupancy parameter will contain the number of rooms.
|
||||
$quantity = $occupancy;
|
||||
}
|
||||
|
||||
if ($quantity <= 0) {
|
||||
$quantity = 1;
|
||||
}
|
||||
|
||||
if ($hotelRoomData = $objBookingDetail->DataForFrontSearch($bookingParams)) {
|
||||
$totalAvailableRooms = $hotelRoomData['stats']['num_avail'];
|
||||
$quantity = ($quantity > $totalAvailableRooms) ? $totalAvailableRooms : $quantity;
|
||||
|
||||
@@ -1154,6 +1154,30 @@ function init()
|
||||
$(".add_product_date_from").datepicker("option", "maxDate", selectedDate);
|
||||
}
|
||||
});
|
||||
|
||||
$(".edit_product_date_from").datepicker(
|
||||
{
|
||||
showOtherMonths: true,
|
||||
dateFormat: 'dd-mm-yy',
|
||||
onSelect: function(selectedDate) {
|
||||
var date_format = selectedDate.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);
|
||||
$(".edit_product_date_to").datepicker("option", "minDate", selectedDate);
|
||||
},
|
||||
});
|
||||
|
||||
$(".edit_product_date_to").datepicker(
|
||||
{
|
||||
showOtherMonths: true,
|
||||
dateFormat: 'dd-mm-yy',
|
||||
onSelect: function(selectedDate) {
|
||||
var date_format = selectedDate.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);
|
||||
$(".edit_product_date_from").datepicker("option", "maxDate", selectedDate);
|
||||
}
|
||||
});
|
||||
/*End*/
|
||||
}
|
||||
|
||||
|
||||
@@ -568,7 +568,7 @@ class AdminHotelRoomsBookingController extends ModuleAdminController
|
||||
$obj_cart_book_data->comment = $comment;
|
||||
$obj_cart_book_data->date_from = $date_from;
|
||||
$obj_cart_book_data->date_to = $date_to;
|
||||
if (Configuration::get('PS_BACKOFFICE_ROOM_BOOKING_TYPE') == HotelBookingDetail::PS_FRONT_ROOM_UNIT_SELECTION_TYPE_OCCUPANCY) {
|
||||
if (Configuration::get('PS_BACKOFFICE_ROOM_BOOKING_TYPE') == HotelBookingDetail::PS_FRONT_ROOM_UNIT_SELECTION_TYPE_OCCUPANCY && is_array($occupancy)) {
|
||||
$room_occupancy = array_shift($occupancy);
|
||||
$obj_cart_book_data->adults = $room_occupancy['adults'];
|
||||
$obj_cart_book_data->children = $room_occupancy['children'];
|
||||
|
||||
@@ -268,7 +268,7 @@ $(document).ready(function() {
|
||||
function getBookingOccupancyDetails(bookingform)
|
||||
{
|
||||
let occupancy;
|
||||
if (parseInt(occupancy_required_for_booking)) {
|
||||
if (occupancy_required_for_booking) {
|
||||
let selected_occupancy = $(bookingform).find(".occupancy_info_block.selected")
|
||||
if (selected_occupancy.length) {
|
||||
occupancy = [];
|
||||
|
||||
Reference in New Issue
Block a user