Merge pull request #901 from sumitwebkul/gli-963
Added: Upgrade of rooms while reallocation and also fixed reallocation and swapping issues
This commit is contained in:
@@ -26,7 +26,23 @@
|
||||
img
|
||||
max-height: 55px
|
||||
max-width: 55px
|
||||
.loading_overlay
|
||||
display: none
|
||||
position: fixed
|
||||
left: 0
|
||||
top: 0
|
||||
height: 100%
|
||||
width: 100%
|
||||
background-color: rgba(0, 0, 0, 0.5)
|
||||
z-index: 100000
|
||||
.loading-img
|
||||
position: absolute
|
||||
top: 50%
|
||||
left: 0
|
||||
right: 0
|
||||
margin: 0 auto
|
||||
|
||||
|
||||
.room_status_info_form
|
||||
.room_status
|
||||
white-space: normal
|
||||
white-space: normal
|
||||
|
||||
@@ -259,7 +259,7 @@
|
||||
</button>
|
||||
<ul class="dropdown-menu" role="menu">
|
||||
<li>
|
||||
<a href="#" data-toggle="modal" data-target="#mySwappigModal" data-id_order="{$order->id}" data-room_num='{$data.room_num}' data-date_from='{$data.date_from}' data-date_to='{$data.date_to}' data-id_room='{$data.id_room}' data-cust_name='{$data.alloted_cust_name}' data-cust_email='{$data.alloted_cust_email}' data-avail_rm_swap='{$data.avail_rooms_to_swap|@json_encode}' data-avail_rm_realloc='{$data.avail_rooms_to_realloc|@json_encode}'>
|
||||
<a href="#" id="reallocate_room_{$data['id']}" data-room_type_name="{$data['room_type_name']}" data-toggle="modal" data-target="#mySwappigModal" data-id_htl_booking="{$data['id']}" data-room_num='{$data.room_num}' data-id_room_type='{$data.id_product}' data-cust_name='{$data.alloted_cust_name}' data-cust_email='{$data.alloted_cust_email}' data-avail_rm_swap='{$data.avail_rooms_to_swap|@json_encode}' data-avail_realloc_room_types='{$data.avail_room_types_to_realloc|@json_encode}'>
|
||||
<i class="icon-refresh"></i>
|
||||
{l s='Reallocate/Swap Room'}
|
||||
</a>
|
||||
|
||||
@@ -1509,7 +1509,7 @@
|
||||
<li role="presentation" class="active"><a href="#reallocate_room_tab" aria-controls="reallocate" role="tab" data-toggle="tab">{l s='Room Reallocation'}</a></li>
|
||||
<li role="presentation"><a href="#swap_room_tab" aria-controls="swap" role="tab" data-toggle="tab">{l s='Swap Room'}</a></li>
|
||||
</ul>
|
||||
<div class="tab-content panel active">
|
||||
<div class="tab-content active">
|
||||
<div role="tabpanel" class="tab-pane active" id="reallocate_room_tab">
|
||||
<form method="post" action="{$link->getAdminLink('AdminOrders')|escape:'html':'UTF-8'}&vieworder&id_order={$order->id|intval}">
|
||||
<div class="modal-header">
|
||||
@@ -1517,31 +1517,63 @@
|
||||
<h4 class="modal-title" id="realloc_myModalLabel">{l s='Reallocate Rooms'}</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="form-group">
|
||||
<label for="curr_room_num" class="control-label model-label">{l s='Current Room Number:'}</label>
|
||||
<input type="text" class="form-control modal_curr_room_num" name="modal_curr_room_num" readonly="true">
|
||||
<input type="hidden" class="form-control modal_date_from" name="modal_date_from">
|
||||
<input type="hidden" class="form-control modal_date_to" name="modal_date_to">
|
||||
<input type="hidden" class="form-control modal_id_room" name="modal_id_room">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="realloc_avail_rooms" class="control-label model-label">{l s='Available Rooms To Reallocate:'}</label>
|
||||
<div class="realloc_avail_rooms_container" style="width: 195px;">
|
||||
<select class="form-control" name="realloc_avail_rooms" id="realloc_avail_rooms">
|
||||
<option value="0" selected="selected">{l s='Select Rooms'}</option>
|
||||
</select>
|
||||
</div>
|
||||
<p class="error_text" id="realloc_sel_rm_err_p"></p>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label style="text-decoration:underline;margin-top:5px;" for="message-text" class="col-sm-12 control-label model-label"><i class="icon-info-circle"></i> {l s='Currently Alloted Customer Information:'}</label>
|
||||
<dl class="well list-detail">
|
||||
<dt>{l s='Name'}</dt>
|
||||
<dd class="cust_name"></dd><br>
|
||||
<dt>{l s='Email'}</dt>
|
||||
<dd class="cust_email"></dd><br>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="form-group col-sm-6">
|
||||
<label for="curr_room_num" class="control-label model-label">{l s='Current Room Number:'}</label>
|
||||
<input type="text" class="form-control modal_curr_room_num" name="modal_curr_room_num" readonly="true">
|
||||
<input type="hidden" class="form-control modal_id_htl_booking" name="id_htl_booking">
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel">
|
||||
<div class="panel-heading"><i class="icon-user"></i> {l s='Currently Alloted Customer'}</div>
|
||||
<div class="panel-content">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label model-label">{l s='Name'} :</label>
|
||||
<div class="dol-sm-9 cust_name"></div>
|
||||
</div>
|
||||
<div class="">
|
||||
<label class="col-sm-3 control-label model-label">{l s='Email'} :</label>
|
||||
<div class="dol-sm-9 cust_email"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="row">
|
||||
<div class="form-group col-sm-6">
|
||||
<label for="realloc_avail_room_type" class="control-label model-label">{l s='Room Type To Reallocate:'}</label>
|
||||
<div class="realloc_avail_room_type_container">
|
||||
<select class="form-control" name="realloc_avail_room_type" id="realloc_avail_room_type">
|
||||
<option value="0" selected="selected">{l s='Select Room Type'}</option>
|
||||
</select>
|
||||
</div>
|
||||
<p class="error_text" id="realloc_sel_rm_type_err_p"></p>
|
||||
</div>
|
||||
<div class="form-group col-sm-6">
|
||||
<label for="realloc_avail_rooms" class="control-label model-label">{l s='Room To Reallocate:'}</label>
|
||||
<div class="realloc_avail_rooms_container">
|
||||
<select class="form-control" name="realloc_avail_rooms" id="realloc_avail_rooms">
|
||||
<option value="0" selected="selected">{l s='Select Rooms'}</option>
|
||||
</select>
|
||||
</div>
|
||||
<p class="error_text" id="realloc_sel_rm_err_p"></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" id="reallocation_price_diff_block" style="display:none;">
|
||||
<div class="form-group col-sm-6">
|
||||
<label for="reallocation_price_diff" class="control-label model-label alert-warning">{l s='Price Difference'} *</label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon">{$currency->prefix}{$currency->suffix}</span>
|
||||
<input type="text" name="reallocation_price_diff" id="reallocation_price_diff" value="0" />
|
||||
<span class="input-group-addon">{l s='Tax excl.'}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="alert alert-warning col-sm-12 realloc_roomtype_change_message" style="display:none">
|
||||
<p>{l s="If room type is changed while room reallocation then all additional facilities and services will be assigned to the selected room of new room type."}</p>
|
||||
<p>{l s="If you want to change additional facilities or services, you can update by editing the room after reallocation."}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">{l s="Close" mod="hotelreservationsyatem"}</button>
|
||||
@@ -1556,29 +1588,35 @@
|
||||
<h4 class="modal-title" id="swap_myModalLabel">{l s='Swap Rooms'}</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="form-group">
|
||||
<label for="swap_curr_room_num" class="control-label model-label">{l s='Current Room Number:'}</label>
|
||||
<input type="text" class="form-control modal_curr_room_num" name="modal_curr_room_num" readonly="true">
|
||||
<input type="hidden" class="form-control modal_date_from" name="modal_date_from">
|
||||
<input type="hidden" class="form-control modal_date_to" name="modal_date_to">
|
||||
<input type="hidden" class="form-control modal_id_room" name="modal_id_room">
|
||||
<input type="hidden" class="form-control modal_id_order" name="modal_id_order">
|
||||
<div class="row">
|
||||
<div class="form-group col-sm-6">
|
||||
<label for="swap_curr_room_num" class="control-label model-label">{l s='Current Room Number:'}</label>
|
||||
<input type="text" class="form-control modal_curr_room_num" name="modal_curr_room_num" readonly="true">
|
||||
<input type="hidden" class="form-control modal_id_htl_booking" name="id_htl_booking">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="swap_avail_rooms" class="control-label model-label">{l s='Available Rooms To Swap:'}</label>
|
||||
<div class="swap_avail_rooms_container"></div>
|
||||
<p class="error_text" id="swap_sel_rm_err_p"></p>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label style="text-decoration:underline;margin-top:5px;" for="message-text" class="col-sm-12 control-label model-label"><i class="icon-info-circle"></i> {l s='Currently Alloted Customer Information:'}</label>
|
||||
<dl class="well list-detail">
|
||||
<dt>{l s='Name'}</dt>
|
||||
<dd class="cust_name"></dd><br>
|
||||
<dt>{l s='Email'}</dt>
|
||||
<dd class="cust_email"></dd><br>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel">
|
||||
<div class="panel-heading"><i class="icon-user"></i> {l s='Currently Alloted Customer'}</div>
|
||||
<div class="panel-content">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label model-label">{l s='Name'} :</label>
|
||||
<div class="dol-sm-9 cust_name"></div>
|
||||
</div>
|
||||
<div class="">
|
||||
<label class="col-sm-3 control-label model-label">{l s='Email'} :</label>
|
||||
<div class="dol-sm-9 cust_email"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="row">
|
||||
<div class="form-group col-sm-6">
|
||||
<label for="swap_avail_rooms" class="control-label model-label">{l s='Rooms To Swap:'}</label>
|
||||
<div class="swap_avail_rooms_container"></div>
|
||||
<p class="error_text" id="swap_sel_rm_err_p"></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">{l s="Close" mod="hotelreservationsyatem"}</button>
|
||||
<input type="submit" id="swap_allocated_rooms" name="swap_allocated_rooms" class="btn btn-primary" value="Swap">
|
||||
@@ -1587,6 +1625,11 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{* loader before loading data *}
|
||||
<div class="loading_overlay">
|
||||
<img src='{$link->getMediaLink("`$img_dir`admin/ajax-loader.gif")}' class="loading-img"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1620,7 +1663,11 @@
|
||||
|
||||
|
||||
{strip}
|
||||
{addJsDefL name=no_rm_avail_txt}{l s='No rooms available.' js=1}{/addJsDefL}
|
||||
{addJsDefL name=no_rm_avail_txt}{l s='No room available.' js=1}{/addJsDefL}
|
||||
{addJsDefL name=no_realloc_rm_avail_txt}{l s='No room available for reallocation.' js=1}{/addJsDefL}
|
||||
{addJsDefL name=no_realloc_rm_type_avail_txt}{l s='No room type available for reallocation.' js=1}{/addJsDefL}
|
||||
{addJsDefL name=no_swap_rm_avail_txt}{l s='No room available for swap.' js=1}{/addJsDefL}
|
||||
{addJsDefL name=slct_rm_type_err}{l s='Please select a room type first.' js=1}{/addJsDefL}
|
||||
{addJsDefL name=slct_rm_err}{l s='Please select a room first.' js=1}{/addJsDefL}
|
||||
{addJsDefL name=txtExtraDemandSucc}{l s='Updated Successfully' js=1}{/addJsDefL}
|
||||
{addJsDefL name=atleastSelectTxt}{l s='Select at least one facility to update.' js=1}{/addJsDefL}
|
||||
@@ -1641,6 +1688,7 @@
|
||||
{addJsDefL name='years_txt'}{l s='years' js=1}{/addJsDefL}
|
||||
{addJsDefL name='all_children_txt'}{l s='All Children' js=1}{/addJsDefL}
|
||||
{addJsDefL name='invalid_occupancy_txt'}{l s='Invalid occupancy(adults/children) found.' js=1}{/addJsDefL}
|
||||
{addJsDefL name='select_room_txt'}{l s='Select room' js=1}{/addJsDefL}
|
||||
{addJsDef max_child_age=$max_child_age|escape:'quotes':'UTF-8'}
|
||||
{addJsDef max_child_in_room=$max_child_in_room|escape:'quotes':'UTF-8'}
|
||||
{addJsDefL name='undo_cancellation_success'}{l s='Booking cancellation undo process is done successfully.' js=1}{/addJsDefL}
|
||||
@@ -1792,41 +1840,6 @@
|
||||
}
|
||||
});
|
||||
|
||||
function updateAdditionalServices(element)
|
||||
{
|
||||
var id_room_type_service_product_order_detail = $(element).data('id_room_type_service_product_order_detail');
|
||||
var qty = $(element).val();
|
||||
if ($.isNumeric(qty)) {
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
headers: {
|
||||
"cache-control": "no-cache"
|
||||
},
|
||||
url: "{$link->getAdminLink('AdminOrders')|addslashes}",
|
||||
dataType: 'JSON',
|
||||
cache: false,
|
||||
data: {
|
||||
id_room_type_service_product_order_detail: id_room_type_service_product_order_detail,
|
||||
qty: qty,
|
||||
action: 'updateRoomAdditionalServices',
|
||||
ajax: true
|
||||
},
|
||||
success: function(jsonData) {
|
||||
if (!jsonData.hasError) {
|
||||
if (jsonData.service_panel) {
|
||||
$('#room_type_service_product_desc').replaceWith(jsonData.service_panel);
|
||||
}
|
||||
showSuccessMessage(txtExtraDemandSucc);
|
||||
} else {
|
||||
showErrorMessage(jsonData.errors);
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$(document).on('submit', '#add_room_services_form', function(e) {
|
||||
e.preventDefault();
|
||||
var form_data = new FormData(this);
|
||||
@@ -1990,65 +2003,153 @@
|
||||
|
||||
$('#mySwappigModal').on('hidden.bs.modal', function (e)
|
||||
{
|
||||
$(".modal_id_order").val('');
|
||||
$(".modal_date_from").val('');
|
||||
$(".modal_date_to").val('');
|
||||
$(".modal_id_room").val('');
|
||||
$(".modal_id_htl_booking").val('');
|
||||
$(".modal_curr_room_num").val('');
|
||||
$(".cust_name").text('');
|
||||
$(".cust_email").text('');
|
||||
$(".swp_rm_opts").remove();
|
||||
$(".realloc_rm_type_opts").remove();
|
||||
$(".realloc_rm_opts").remove();
|
||||
});
|
||||
|
||||
$('#mySwappigModal').on('shown.bs.modal', function (e)
|
||||
{
|
||||
$(".modal_id_order").val(e.relatedTarget.dataset.id_order);
|
||||
$(".modal_date_from").val(e.relatedTarget.dataset.date_from);
|
||||
$(".modal_date_to").val(e.relatedTarget.dataset.date_to);
|
||||
$(".modal_id_room").val(e.relatedTarget.dataset.id_room);
|
||||
$(".modal_curr_room_num").val(e.relatedTarget.dataset.room_num);
|
||||
$(".loading_overlay").show();
|
||||
|
||||
$(".modal_id_htl_booking").val(e.relatedTarget.dataset.id_htl_booking);
|
||||
$(".modal_curr_room_num").val(e.relatedTarget.dataset.room_num + ', ' + e.relatedTarget.dataset.room_type_name);
|
||||
$(".cust_name").text(e.relatedTarget.dataset.cust_name);
|
||||
$(".cust_email").text(e.relatedTarget.dataset.cust_email);
|
||||
|
||||
// For Rooms Swapping
|
||||
if (e.relatedTarget.dataset.avail_rm_swap != 'false') {
|
||||
var json_arr_rm_swp = JSON.parse(e.relatedTarget.dataset.avail_rm_swap);
|
||||
// reset price difference fields
|
||||
$("#reallocation_price_diff").val(0);
|
||||
$("#reallocation_price_diff_block").hide();
|
||||
$(".realloc_roomtype_change_message").hide();
|
||||
|
||||
html = '<select class="form-control" name="swap_avail_rooms" id="swap_avail_rooms" style="width:195px;">';
|
||||
// For Rooms Swapping
|
||||
var json_arr_rm_swp = JSON.parse(e.relatedTarget.dataset.avail_rm_swap);
|
||||
if (e.relatedTarget.dataset.avail_rm_swap != 'false' && json_arr_rm_swp.length != 0) {
|
||||
html = '<select class="form-control" name="swap_avail_rooms" id="swap_avail_rooms">';
|
||||
$.each(json_arr_rm_swp, function(key,val) {
|
||||
html += '<option class="swp_rm_opts" value="'+val.id_room+'" >'+val.room_num+'</option>';
|
||||
html += '<option class="swp_rm_opts" value="'+val.id_hotel_booking+'" >'+val.room_num+'</option>';
|
||||
});
|
||||
html += '</select>';
|
||||
|
||||
$("#swap_allocated_rooms").removeAttr('disabled');
|
||||
$(".swap_avail_rooms_container").empty().append(html);
|
||||
} else {
|
||||
$(".swap_avail_rooms_container").empty().text(no_rm_avail_txt);
|
||||
$(".swap_avail_rooms_container").empty().text(no_swap_rm_avail_txt).addClass('text-danger');
|
||||
$("#swap_allocated_rooms").attr('disabled', 'disabled');
|
||||
}
|
||||
|
||||
// For Rooms Reallocation
|
||||
if (e.relatedTarget.dataset.avail_rm_realloc != 'false') {
|
||||
var json_arr_rm_realloc = JSON.parse(e.relatedTarget.dataset.avail_rm_realloc);
|
||||
|
||||
html = '<select class="form-control" name="realloc_avail_rooms" id="realloc_avail_rooms" style="width:195px;">';
|
||||
$.each(json_arr_rm_realloc, function(key,val) {
|
||||
html += '<option class="realloc_rm_opts" value="'+val.id_room+'" >'+val.room_num+'</option>';
|
||||
var json_arr_realloc_room_types = JSON.parse(e.relatedTarget.dataset.avail_realloc_room_types);
|
||||
if (e.relatedTarget.dataset.avail_realloc_room_types != 'false' && json_arr_realloc_room_types.length != 0) {
|
||||
var idCurrentRoomType = e.relatedTarget.dataset.id_room_type;
|
||||
var roomsTypesHtml = '<select data-id_htl_booking="' + e.relatedTarget.dataset.id_htl_booking + '" class="form-control" name="realloc_avail_room_type" id="realloc_avail_room_type">';
|
||||
$.each(json_arr_realloc_room_types, function(key, room_type) {
|
||||
roomsTypesHtml += "<option rooms_available='" + JSON.stringify(room_type.rooms) + "' class='realloc_rm_type_opts' value='" + room_type.id_product + "'";
|
||||
if (idCurrentRoomType == room_type.id_product) {
|
||||
roomsTypesHtml += ' selected="selected"';
|
||||
}
|
||||
roomsTypesHtml += '>' + room_type.room_type_name + '</option>';
|
||||
});
|
||||
html += '</select>';
|
||||
$(".realloc_avail_rooms_container").empty().append(html);
|
||||
roomsTypesHtml += '</select>';
|
||||
|
||||
setRoomsForReallocation(json_arr_realloc_room_types[idCurrentRoomType]['rooms']);
|
||||
|
||||
$("#realloc_allocated_rooms").removeAttr('disabled');
|
||||
$(".realloc_avail_room_type_container").empty().append(roomsTypesHtml);
|
||||
} else {
|
||||
$(".realloc_avail_rooms_container").empty().text(no_rm_avail_txt);
|
||||
$(".realloc_avail_rooms_container").empty().text(no_realloc_rm_avail_txt).addClass('text-danger');
|
||||
$(".realloc_avail_room_type_container").empty().text(no_realloc_rm_type_avail_txt).addClass('text-danger');
|
||||
$("#realloc_allocated_rooms").attr('disabled', 'disabled');
|
||||
}
|
||||
|
||||
$(".loading_overlay").hide();
|
||||
});
|
||||
|
||||
// change room type for reallocation
|
||||
$(document).on("change", "#realloc_avail_room_type", function(e) {
|
||||
$(".loading_overlay").show();
|
||||
|
||||
var idHotelBooking = $(this).data('id_htl_booking');
|
||||
$("#reallocation_price_diff").val(0);
|
||||
$("#reallocation_price_diff_block").hide();
|
||||
if (parseInt(idHotelBooking) > 0) {
|
||||
var optionSelected = $(this).find('option:selected');
|
||||
var roomsAvailable = JSON.parse(optionSelected.attr('rooms_available'));
|
||||
|
||||
// set the rooms of the selceted room type
|
||||
setRoomsForReallocation(roomsAvailable);
|
||||
|
||||
// send an ajax for fetching if price has changes in the new room type seleceted
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
headers: {
|
||||
"cache-control": "no-cache"
|
||||
},
|
||||
url: "{$link->getAdminLink('AdminOrders')|addslashes}",
|
||||
dataType: 'JSON',
|
||||
cache: false,
|
||||
data: {
|
||||
id_htl_booking: idHotelBooking,
|
||||
id_new_room_type: $(this).val(),
|
||||
action: 'changeRoomTypeToReallocate',
|
||||
ajax: true
|
||||
},
|
||||
success: function(result) {
|
||||
if (result.success == 1) {
|
||||
// has room type changed for reallocation
|
||||
if (result.has_room_type_change == 1) {
|
||||
$(".realloc_roomtype_change_message").show();
|
||||
// has room type price changed for reallocation
|
||||
if (result.has_price_changes == 1) {
|
||||
$("#reallocation_price_diff").val(result.price_diff);
|
||||
$("#reallocation_price_diff_block").show();
|
||||
}
|
||||
} else {
|
||||
$(".realloc_roomtype_change_message").hide();
|
||||
}
|
||||
$('#room_type_change_info').empty();
|
||||
if (result.is_changes_present == 1) {
|
||||
}
|
||||
} else if (typeof(result.error) != 'undefinded' && result.error) {
|
||||
showErrorMessage(result.error);
|
||||
} else {
|
||||
showErrorMessage(txtSomeErr);
|
||||
}
|
||||
|
||||
$(".loading_overlay").hide();
|
||||
},
|
||||
error: function(XMLHttpRequest, textStatus, errorThrown) {
|
||||
$(".loading_overlay").hide();
|
||||
showErrorMessage(txtSomeErr);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
$(".loading_overlay").hide();
|
||||
showErrorMessage(txtSomeErr);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
/*For reallocating rooms in the modal*/
|
||||
$("#realloc_allocated_rooms").on('click', function(e){
|
||||
$(".error_text").text('');
|
||||
var room_to_reallocate = $('#realloc_avail_rooms').val();
|
||||
var room_type_to_reallocate = $('#realloc_avail_room_type').val();
|
||||
|
||||
if (typeof room_type_to_reallocate == 'undefined' || room_type_to_reallocate == 0) {
|
||||
$("#realloc_sel_rm_type_err_p").text(slct_rm_type_err);
|
||||
return false;
|
||||
}
|
||||
if (typeof room_to_reallocate == 'undefined' || room_to_reallocate == 0) {
|
||||
$("#realloc_sel_rm_err_p").text(slct_rm_err);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
/*For swaping rooms in the modal*/
|
||||
$("#swap_allocated_rooms").on('click', function(e){
|
||||
$(".error_text").text('');
|
||||
@@ -2059,8 +2160,6 @@
|
||||
}
|
||||
});
|
||||
|
||||
/*END*/
|
||||
|
||||
// for updating customer guest details
|
||||
$('#edit_guest_details').on('click', function(e) {
|
||||
e.preventDefault();
|
||||
@@ -2128,6 +2227,57 @@
|
||||
timeFormat: 'hh:mm:ss',
|
||||
});
|
||||
});
|
||||
|
||||
function updateAdditionalServices(element)
|
||||
{
|
||||
var id_room_type_service_product_order_detail = $(element).data('id_room_type_service_product_order_detail');
|
||||
var qty = $(element).val();
|
||||
if ($.isNumeric(qty)) {
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
headers: {
|
||||
"cache-control": "no-cache"
|
||||
},
|
||||
url: "{$link->getAdminLink('AdminOrders')|addslashes}",
|
||||
dataType: 'JSON',
|
||||
cache: false,
|
||||
data: {
|
||||
id_room_type_service_product_order_detail: id_room_type_service_product_order_detail,
|
||||
qty: qty,
|
||||
action: 'updateRoomAdditionalServices',
|
||||
ajax: true
|
||||
},
|
||||
success: function(jsonData) {
|
||||
if (!jsonData.hasError) {
|
||||
if (jsonData.service_panel) {
|
||||
$('#room_type_service_product_desc').replaceWith(jsonData.service_panel);
|
||||
}
|
||||
showSuccessMessage(txtExtraDemandSucc);
|
||||
} else {
|
||||
showErrorMessage(jsonData.errors);
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function setRoomsForReallocation(roomsAvailable)
|
||||
{
|
||||
if (typeof(roomsAvailable) != 'undefined' && roomsAvailable.length) {
|
||||
var roomsHtml = '<select class="form-control" name="realloc_avail_rooms" id="realloc_avail_rooms">';
|
||||
roomsHtml += '<option class="realloc_rm_opts" value="0">---- ' + select_room_txt + ' ----</option>';
|
||||
$.each(roomsAvailable, function(key, roomInfo) {
|
||||
roomsHtml += '<option class="realloc_rm_opts" value="' + roomInfo.id_room + '">' + roomInfo.room_num + '</option>';
|
||||
});
|
||||
roomsHtml += '</select>';
|
||||
|
||||
$(".realloc_avail_rooms_container").empty().append(roomsHtml);
|
||||
} else {
|
||||
$(".realloc_avail_rooms_container").empty().text(no_realloc_rm_avail_txt);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
{/block}
|
||||
|
||||
@@ -316,6 +316,9 @@ class AdminOrdersControllerCore extends AdminController
|
||||
}
|
||||
|
||||
parent::__construct();
|
||||
|
||||
$this->_conf[52] = $this->l('Room in the booking is successfully reallocated');
|
||||
$this->_conf[53] = $this->l('Room in the booking is successfully swapped');
|
||||
}
|
||||
|
||||
public static function setOrderCurrency($echo, $tr)
|
||||
@@ -603,75 +606,94 @@ class AdminOrdersControllerCore extends AdminController
|
||||
|
||||
public function postProcess()
|
||||
{
|
||||
// by webkul for reallocation of rooms
|
||||
// Process reallocation of rooms
|
||||
if (Tools::isSubmit('realloc_allocated_rooms')) {
|
||||
if ($this->tabAccess['edit'] === '1') {
|
||||
$order_id = Tools::getValue('id_order');
|
||||
$current_room_id = Tools::getValue('modal_id_room');
|
||||
$current_room = Tools::getValue('modal_curr_room_num');
|
||||
$date_from = Tools::getValue('modal_date_from');
|
||||
$date_to = Tools::getValue('modal_date_to');
|
||||
$realloc_room_id = Tools::getValue('realloc_avail_rooms');
|
||||
$idOrder = Tools::getValue('id_order');
|
||||
$idHtlBookingFrom = Tools::getValue('id_htl_booking');
|
||||
$idNewRoomType = Tools::getValue('realloc_avail_room_type');
|
||||
$idRoomToReallocate = Tools::getValue('realloc_avail_rooms');
|
||||
$priceDiff = Tools::getValue('reallocation_price_diff');
|
||||
|
||||
if ($realloc_room_id == 0) {
|
||||
$this->errors[] = Tools::displayError('Please select a room to swap with this room.');
|
||||
}
|
||||
if ($current_room_id == 0) {
|
||||
$this->errors[] = Tools::displayError('Cuurent room is missing.');
|
||||
}
|
||||
if ($date_from == 0) {
|
||||
$this->errors[] = Tools::displayError('Check In date is missing.');
|
||||
}
|
||||
if ($date_to == 0) {
|
||||
$this->errors[] = Tools::displayError('Check Out date is missing.');
|
||||
$objBookingDetail = new HotelBookingDetail();
|
||||
if ($idRoomToReallocate) {
|
||||
// check if room is from selected room type
|
||||
if (Validate::isLoadedObject($objRoomInfo = new HotelRoomInformation($idRoomToReallocate))) {
|
||||
if ($objRoomInfo->id_product != $idNewRoomType) {
|
||||
$this->errors[] = $this->l('Invalid room selected for reallocation.');
|
||||
} elseif (!Validate::isLoadedObject($objHotelBooking = new HotelBookingDetail($idHtlBookingFrom))) {
|
||||
$this->errors[] = $this->l('Invalid booking found for reallocation.');
|
||||
} elseif (!$availableRooms = $objBookingDetail->getAvailableRoomsForReallocation(
|
||||
$objHotelBooking->date_from,
|
||||
$objHotelBooking->date_to,
|
||||
$idNewRoomType,
|
||||
$objHotelBooking->id_hotel
|
||||
)) {
|
||||
$this->errors[] = $this->l('Selected room is not available for reallocation.');
|
||||
} elseif (!in_array($idRoomToReallocate, array_column($availableRooms, 'id_room'))) {
|
||||
$this->errors[] = $this->l('Selected room is not available for reallocation.');
|
||||
} elseif (!Validate::isFloat($priceDiff)) {
|
||||
$this->errors[] = $this->l('Invalid price difference of the room types.');
|
||||
}
|
||||
} else {
|
||||
$this->errors[] = $this->l('Selected room is not available for reallocation.');
|
||||
}
|
||||
} else {
|
||||
$this->errors[] = $this->l('Please select a room to reallocate with this room.');
|
||||
}
|
||||
|
||||
if (!count($this->errors)) {
|
||||
$objBookingDetail = new HotelBookingDetail();
|
||||
$room_swapped = $objBookingDetail->reallocateRoomWithAvailableSameRoomType($current_room_id, $date_from, $date_to, $realloc_room_id);
|
||||
if (!$room_swapped) {
|
||||
$this->errors[] = Tools::displayError('Some error occured. Please try again.');
|
||||
// Finally, reallocate the room
|
||||
if ($objBookingDetail->reallocateBooking($idHtlBookingFrom, $idRoomToReallocate, $priceDiff)) {
|
||||
Tools::redirectAdmin(self::$currentIndex.'&id_order='.(int) $idOrder.'&vieworder&conf=52&token='.$this->token);
|
||||
} else {
|
||||
Tools::redirectAdmin(self::$currentIndex.'&id_order='.(int) $order_id.'&vieworder&token='.$this->token);
|
||||
$this->errors[] = $this->l('Some error occured. Please try again.');
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$this->errors[] = Tools::displayError('You do not have permission to edit this.');
|
||||
$this->errors[] = $this->l('You do not have permission to edit this.');
|
||||
}
|
||||
}
|
||||
|
||||
// Process swap of rooms
|
||||
if (Tools::isSubmit('swap_allocated_rooms')) {
|
||||
if ($this->tabAccess['edit'] === '1') {
|
||||
$order_id = Tools::getValue('id_order');
|
||||
$current_room_id = Tools::getValue('modal_id_room');
|
||||
$current_room = Tools::getValue('modal_curr_room_num');
|
||||
$date_from = Tools::getValue('modal_date_from');
|
||||
$date_to = Tools::getValue('modal_date_to');
|
||||
$swapped_room_id = Tools::getValue('swap_avail_rooms');
|
||||
$idOrder = Tools::getValue('id_order');
|
||||
$idHtlBookingFrom = Tools::getValue('id_htl_booking');
|
||||
$idHtlBookingToSwap = Tools::getValue('swap_avail_rooms');
|
||||
|
||||
if ($swapped_room_id == 0) {
|
||||
$this->errors[] = Tools::displayError('Please select a room to swap with this room.');
|
||||
}
|
||||
if ($current_room_id == 0) {
|
||||
$this->errors[] = Tools::displayError('Cuurent room is missing.');
|
||||
}
|
||||
if ($date_from == 0) {
|
||||
$this->errors[] = Tools::displayError('Check In date is missing.');
|
||||
}
|
||||
if ($date_to == 0) {
|
||||
$this->errors[] = Tools::displayError('Check Out date is missing.');
|
||||
if (!Validate::isLoadedObject($objHotelBooking = new HotelBookingDetail($idHtlBookingFrom))) {
|
||||
$this->errors[] = $this->l('Selected room is not available to swap.');
|
||||
} else {
|
||||
if (!Validate::isLoadedObject($objHotelBookingTo = new HotelBookingDetail($idHtlBookingToSwap))) {
|
||||
$this->errors[] = $this->l('Please select a room to swap with this room booking.');
|
||||
} else {
|
||||
if ($availableRooms = $objHotelBooking->getAvailableRoomsForSwapping(
|
||||
$objHotelBooking->date_from,
|
||||
$objHotelBooking->date_to,
|
||||
$objHotelBooking->id_product,
|
||||
$objHotelBooking->id_hotel,
|
||||
$objHotelBooking->id_room
|
||||
)) {
|
||||
if (!in_array($idHtlBookingToSwap, array_column($availableRooms, 'id_hotel_booking'))) {
|
||||
$this->errors[] = $this->l('Selected room is not available to swap.');
|
||||
}
|
||||
} else {
|
||||
$this->errors[] = $this->l('Selected room is not available to swap.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!count($this->errors)) {
|
||||
$objBookingDetail = new HotelBookingDetail();
|
||||
$room_swapped = $objBookingDetail->swapRoomWithAvailableSameRoomType($current_room_id, $date_from, $date_to, $swapped_room_id);
|
||||
if (!$room_swapped) {
|
||||
$this->errors[] = Tools::displayError('Some error occured. Please try again.');
|
||||
if ($objBookingDetail->swapBooking($idHtlBookingFrom, $idHtlBookingToSwap)) {
|
||||
Tools::redirectAdmin(self::$currentIndex.'&id_order='.(int)$idOrder.'&vieworder&conf=53&token='.$this->token);
|
||||
} else {
|
||||
Tools::redirectAdmin(self::$currentIndex.'&id_order='.(int) $order_id.'&vieworder&token='.$this->token);
|
||||
$this->errors[] = $this->l('Some error occured. Please try again.');
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$this->errors[] = Tools::displayError('You do not have permission to edit this.');
|
||||
$this->errors[] = $this->l('You do not have permission to edit this.');
|
||||
}
|
||||
}
|
||||
// To update order status when admin changes from order detail page
|
||||
@@ -2012,7 +2034,7 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$order_detail_data[$key]['alloted_cust_email'] = $this->l('No customer name found');
|
||||
}
|
||||
|
||||
$order_detail_data[$key]['avail_rooms_to_realloc'] = $objBookingDetail->getAvailableRoomsForReallocation($value['date_from'], $value['date_to'], $value['id_product'], $value['id_hotel']);
|
||||
$order_detail_data[$key]['avail_room_types_to_realloc'] = $objBookingDetail->getAvailableRoomsForReallocation($value['date_from'], $value['date_to'], 0, $value['id_hotel'], 1);
|
||||
$order_detail_data[$key]['avail_rooms_to_swap'] = $objBookingDetail->getAvailableRoomsForSwapping($value['date_from'], $value['date_to'], $value['id_product'], $value['id_hotel'], $value['id_room']);
|
||||
|
||||
/*Product price when order was created*/
|
||||
@@ -5593,8 +5615,6 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$product['total_wt'] = Tools::ps_round($totalPriceTaxIncl, _PS_PRICE_COMPUTE_PRECISION_) * (int)$product['cart_quantity'];
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
$order_detail = new OrderDetail();
|
||||
@@ -5970,4 +5990,43 @@ class AdminOrdersControllerCore extends AdminController
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ajax request to get room type upgrade/degrade changes information to reallocate
|
||||
public function ajaxProcessChangeRoomTypeToReallocate()
|
||||
{
|
||||
$result = array();
|
||||
$result['success'] = 0;
|
||||
$result['has_price_changes'] = 0;
|
||||
$result['has_room_type_change'] = 0;
|
||||
|
||||
$idHotelBooking = Tools::getValue('id_htl_booking');
|
||||
$idNewRoomType = Tools::getValue('id_new_room_type');
|
||||
|
||||
// if room type id is present in the ajax request or not
|
||||
if ($idNewRoomType) {
|
||||
// validate the booking is valid or not
|
||||
if (Validate::isLoadedObject($objHotelBooking = new HotelBookingDetail($idHotelBooking))) {
|
||||
$result['success'] = 1;
|
||||
// if room is changing in the reallocation
|
||||
if ($objHotelBooking->id_product != $idNewRoomType) {
|
||||
$result['has_room_type_change'] = 1;
|
||||
$newRoomTotalPrice = HotelRoomTypeFeaturePricing::getRoomTypeTotalPrice(
|
||||
$idNewRoomType,
|
||||
$objHotelBooking->date_from,
|
||||
$objHotelBooking->date_to
|
||||
);
|
||||
if ($objHotelBooking->total_price_tax_excl != $newRoomTotalPrice['total_price_tax_excl']) {
|
||||
$result['has_price_changes'] = 1;
|
||||
$result['price_diff'] = $newRoomTotalPrice['total_price_tax_excl'] - $objHotelBooking->total_price_tax_excl;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$result['error'] = $this->l('Invalid booking information. Please try again.');
|
||||
}
|
||||
} else {
|
||||
$result['error'] = $this->l('Selected room type not found. Please try again.');
|
||||
}
|
||||
|
||||
$this->ajaxDie(json_encode($result));
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 604 B After Width: | Height: | Size: 3.1 KiB |
@@ -1223,7 +1223,7 @@ class HotelBookingDetail extends ObjectModel
|
||||
{
|
||||
extract($params);
|
||||
|
||||
$sql = 'SELECT bd.`id_product`, bd.`id_room`, bd.`id_hotel`, bd.`id_customer`, bd.`booking_type`, bd.`id_status` AS booking_status, bd.`comment`, rf.`room_num`, bd.`date_from`, bd.`date_to`
|
||||
$sql = 'SELECT bd.`id`, bd.`id_product`, bd.`id_room`, bd.`id_hotel`, bd.`id_customer`, bd.`booking_type`, bd.`id_status` AS booking_status, bd.`comment`, rf.`room_num`, bd.`date_from`, bd.`date_to`
|
||||
FROM `'._DB_PREFIX_.'htl_booking_detail` AS bd
|
||||
INNER JOIN `'._DB_PREFIX_.'htl_room_information` AS rf ON (rf.`id` = bd.`id_room`)
|
||||
WHERE bd.`id_hotel`='.(int)$idHotel.' AND bd.`is_refunded` = 0 AND bd.`is_back_order` = 0 AND IF(bd.`id_status` = '. self::STATUS_CHECKED_OUT .', bd.`date_from` <= \''.pSQL($dateFrom).'\' AND bd.`check_out` >= \''.pSQL($dateTo).'\', bd.`date_from` <= \''.pSQL($dateFrom).'\' AND bd.date_to >= \''.pSQL($dateTo).'\') AND IF('.(int)$idRoomType.' > 0, rf.`id_product` = '.(int)$idRoomType.', 1) AND rf.`id_product` IN ('.$allowedIdRoomTypes.')
|
||||
@@ -1242,6 +1242,7 @@ class HotelBookingDetail extends ObjectModel
|
||||
);
|
||||
}
|
||||
$bookedRoomTypes[$booked_v['id_product']][$booked_v['id_room']]['detail'][] = array(
|
||||
'id_htl_booking' => $booked_v['id'],
|
||||
'date_from' => $booked_v['date_from'],
|
||||
'date_to' => $booked_v['date_to'],
|
||||
'id_customer' => $booked_v['id_customer'],
|
||||
@@ -1623,7 +1624,7 @@ class HotelBookingDetail extends ObjectModel
|
||||
*
|
||||
* @return [array|false] [Returs array of the available rooms for swapping if rooms found else returnss false]
|
||||
*/
|
||||
public function getAvailableRoomsForReallocation($date_from, $date_to, $id_room_type, $hotel_id)
|
||||
public function getAvailableRoomsForReallocation($date_from, $date_to, $id_room_type, $hotel_id, $room_types_to_upgrade = 0)
|
||||
{
|
||||
$context = Context::getContext();
|
||||
if (isset($context->cookie->id_cart)) {
|
||||
@@ -1636,14 +1637,14 @@ class HotelBookingDetail extends ObjectModel
|
||||
SELECT hri.`id` AS id_room
|
||||
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`='.(int)$hotel_id.' AND hri.`id_product` ='.(int)$id_room_type.'
|
||||
WHERE hri.`id_hotel`='.(int)$hotel_id.($id_room_type ? ' AND `id_product` = '.(int)$id_room_type : '').'
|
||||
AND hri.`id_status` = '. HotelRoomInformation::STATUS_TEMPORARY_INACTIVE .'
|
||||
AND (hrdd.`date_from` <= \''.pSql($date_to).'\' AND hrdd.`date_to` >= \''.pSql($date_from).'\')';
|
||||
|
||||
if (isset($current_admin_cart_id) && $current_admin_cart_id) {
|
||||
$sql = '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)$hotel_id.' AND `id_product`='.(int)$id_room_type.'
|
||||
WHERE `id_hotel`='.(int)$hotel_id.($id_room_type ? ' AND `id_product` = '.(int)$id_room_type : '').'
|
||||
AND (id_status = '. HotelRoomInformation::STATUS_ACTIVE .' or id_status = '. HotelRoomInformation::STATUS_TEMPORARY_INACTIVE .')
|
||||
AND `id` NOT IN ('.$exclude_ids.')
|
||||
AND `id` NOT IN (SELECT `id_room` FROM `'._DB_PREFIX_.'htl_cart_booking_data` WHERE `id_cart`='.
|
||||
@@ -1651,12 +1652,26 @@ class HotelBookingDetail extends ObjectModel
|
||||
} else {
|
||||
$sql = '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)$hotel_id.' AND `id_product`='.(int)$id_room_type.'
|
||||
WHERE `id_hotel`='.(int)$hotel_id.($id_room_type ? ' AND `id_product` = '.(int)$id_room_type : '').'
|
||||
AND (id_status = '. HotelRoomInformation::STATUS_ACTIVE .' or id_status = '. HotelRoomInformation::STATUS_TEMPORARY_INACTIVE .')
|
||||
AND `id` NOT IN ('.$exclude_ids.')';
|
||||
}
|
||||
$avail_rooms = Db::getInstance()->executeS($sql);
|
||||
if ($avail_rooms) {
|
||||
|
||||
if ($avail_rooms = Db::getInstance()->executeS($sql)) {
|
||||
// if requested for room type upgrade options also then get room type upgrade options
|
||||
if ($room_types_to_upgrade) {
|
||||
$availableRoomTypes = array();
|
||||
$context = Context::getContext();
|
||||
foreach ($avail_rooms as $roomInfo) {
|
||||
$availableRoomTypes[$roomInfo['id_product']]['id_product'] = $roomInfo['id_product'];
|
||||
$objProduct = new Product($roomInfo['id_product'], false, $context->language->id);
|
||||
$availableRoomTypes[$roomInfo['id_product']]['room_type_name'] = $objProduct->name;
|
||||
$availableRoomTypes[$roomInfo['id_product']]['rooms'][] = $roomInfo;
|
||||
}
|
||||
|
||||
return $availableRoomTypes;
|
||||
}
|
||||
|
||||
return $avail_rooms;
|
||||
}
|
||||
|
||||
@@ -1674,74 +1689,149 @@ class HotelBookingDetail extends ObjectModel
|
||||
*/
|
||||
public function getAvailableRoomsForSwapping($date_from, $date_to, $id_room_type, $hotel_id, $id_room)
|
||||
{
|
||||
$sql = '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)$hotel_id.' AND `id_product`='.(int)$id_room_type.'
|
||||
AND (id_status = '. HotelRoomInformation::STATUS_ACTIVE .' or id_status = '. HotelRoomInformation::STATUS_TEMPORARY_INACTIVE .')
|
||||
AND `id` IN (
|
||||
SELECT `id_room` FROM `'._DB_PREFIX_.'htl_booking_detail`
|
||||
WHERE `date_from` = \''.pSQL($date_from).'\' AND `date_to` = \''.pSQL($date_to).'\'
|
||||
AND `id_room`!='.(int)$id_room.' AND `is_refunded`=0 AND `is_back_order`=0
|
||||
)';
|
||||
$sql = 'SELECT `id` as `id_hotel_booking`, `id_room`, `id_product`, `id_hotel`, `room_num`, `comment` AS `room_comment`
|
||||
FROM `'._DB_PREFIX_.'htl_booking_detail`
|
||||
WHERE `id_hotel` = '.(int)$hotel_id.' AND `id_product` = '.(int)$id_room_type.'
|
||||
AND `date_from` = \''.pSQL($date_from).'\' AND `date_to` = \''.pSQL($date_to).'\'
|
||||
AND `id_room`!='.(int)$id_room.' AND `is_refunded` = 0 AND `is_back_order` = 0';
|
||||
|
||||
return Db::getInstance()->executeS($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated : use reallocateBooking() instead
|
||||
* [reallocateRoomWithAvailableSameRoomType :: To reallocate rooms with available rooms in case of reallocation of the room].
|
||||
* @param [int] $current_room_id [Id of the room to be reallocated]
|
||||
* @param [date] $date_from [start date of the booking of the room]
|
||||
* @param [date] $date_to [end date of the booking of the room]
|
||||
* @param [date] $swapped_room_id [Id of the room with which the $current_room_id will be reallocated]
|
||||
*
|
||||
* @param [int] $currentRoomId [id of the room to be reallocated]
|
||||
* @param [date] $dateFrom [start date of the booking of the room]
|
||||
* @param [date] $dateTo [end date of the booking of the room]
|
||||
* @param [date] $swappedRoomId [id of the room with which the $current_room_id will be reallocated]
|
||||
* @param [int] $idOrder [id of the order]
|
||||
* @return [boolean] [true if rooms successfully reallocated else returns false]
|
||||
*/
|
||||
public function reallocateRoomWithAvailableSameRoomType($currentRoomId, $dateFrom, $dateTo, $swappedRoomId)
|
||||
public function reallocateRoomWithAvailableSameRoomType($currentRoomId, $dateFrom, $dateTo, $swappedRoomId, $idOrder = 0)
|
||||
{
|
||||
$result = false;
|
||||
|
||||
$dateFrom = date('Y-m-d H:i:s', strtotime($dateFrom));
|
||||
$dateTo = date('Y-m-d H:i:s', strtotime($dateTo));
|
||||
|
||||
$idHotelCartBookingData = Db::getInstance()->getValue(
|
||||
'SELECT `id`
|
||||
FROM `'._DB_PREFIX_.'htl_cart_booking_data`
|
||||
WHERE date_from = "'.pSQL($dateFrom).'" AND date_to = "'.pSQL($dateTo).'"
|
||||
AND id_room = '.(int) $currentRoomId
|
||||
);
|
||||
|
||||
if ($idHotelCartBookingData) {
|
||||
$objHotelCartBookingData = new HotelCartBookingData($idHotelCartBookingData);
|
||||
if (Validate::isLoadedObject($objHotelCartBookingData)) {
|
||||
$objHotelCartBookingData->id_room = $swappedRoomId;
|
||||
if ($objHotelCartBookingData->save()) {
|
||||
$objHotelRoomInformation = new HotelRoomInformation($swappedRoomId);
|
||||
|
||||
$roomBookingData = $this->getRoomBookingData($currentRoomId, $objHotelCartBookingData->id_order, $dateFrom, $dateTo);
|
||||
$objHotelBookingDetail = new self($roomBookingData['id']);
|
||||
if (Validate::isLoadedObject($objHotelBookingDetail)) {
|
||||
$objHotelBookingDetail->id_room = $swappedRoomId;
|
||||
$objHotelBookingDetail->room_num = $objHotelRoomInformation->room_num;
|
||||
if ($objHotelBookingDetail->save()) {
|
||||
Hook::exec(
|
||||
'actionRoomReAllocateAfter',
|
||||
array(
|
||||
'room_id' => $currentRoomId,
|
||||
'realloc_room_id' => $swappedRoomId,
|
||||
'date_from' => $dateFrom,
|
||||
'date_to' => $dateTo,
|
||||
)
|
||||
);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($idHotelBooking = Db::getInstance()->getValue(
|
||||
'SELECT `id` FROM `'._DB_PREFIX_.'htl_booking_detail`
|
||||
WHERE date_from = \''.pSQL($dateFrom).'\'
|
||||
AND date_to = \''.pSQL($dateTo).'\'
|
||||
AND id_room = '.(int) $currentRoomId.
|
||||
((int) $idOrder ? ' AND id_order = '.(int) $idOrder : '')
|
||||
)) {
|
||||
$result = $this->reallocateBooking($idHotelBooking, $swappedRoomId);
|
||||
}
|
||||
|
||||
return false;
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reallocate the room in the booking with the available sent room
|
||||
* @param [int] $idHotelBooking : id of the hotel booking which room has to be reallocated
|
||||
* @param [int] $idRoom : id of the room which has to assigned in reallocation
|
||||
* @return boolean
|
||||
*/
|
||||
public function reallocateBooking($idHotelBooking, $idRoom, $priceDiffTaxExcl = 0)
|
||||
{
|
||||
$result = true;
|
||||
// get the cart booking data for the given booking
|
||||
if (Validate::isLoadedObject($objHotelBooking = new HotelBookingDetail($idHotelBooking))) {
|
||||
$objHotelCartBooking = new HotelCartBookingData();
|
||||
if ($cartBookingInfo = $objHotelCartBooking->getRoomRowByIdProductIdRoomInDateRange(
|
||||
$objHotelBooking->id_cart,
|
||||
$objHotelBooking->id_product,
|
||||
$objHotelBooking->date_from,
|
||||
$objHotelBooking->date_to,
|
||||
$objHotelBooking->id_room
|
||||
)) {
|
||||
// Reallocate the rooms in the room cart booking table
|
||||
if (Validate::isLoadedObject($objHotelCartBooking = new HotelCartBookingData($cartBookingInfo['id']))) {
|
||||
$objHotelCartBooking->id_room = $idRoom;
|
||||
$result &= $objHotelCartBooking->save();
|
||||
}
|
||||
}
|
||||
|
||||
// Reallocate the rooms in the room booking table
|
||||
$objHotelRoomInfo = new HotelRoomInformation($idRoom);
|
||||
$idNewRoomType = $objHotelRoomInfo->id_product;
|
||||
if ($objHotelBooking->id_product != $idNewRoomType) {
|
||||
$objHotelBooking->id_product = $idNewRoomType;
|
||||
$objProduct = new Product($idNewRoomType, false, Configuration::get('PS_LANG_DEFAULT'));
|
||||
$objHotelBooking->room_type_name = $objProduct->name;
|
||||
|
||||
// change product name in order detail table
|
||||
$objOrderDetail = new OrderDetail((int) $objHotelBooking->id_order_detail);
|
||||
$objOrderDetail->product_name = $objProduct->name;
|
||||
|
||||
// manage the prices in the order tables for the price diffrence
|
||||
if ($priceDiffTaxExcl != 0) {
|
||||
$taxCalculator = $objOrderDetail->getTaxCalculator();
|
||||
$priceDiffTaxIncl = Tools::ps_round($taxCalculator->addTaxes($priceDiffTaxExcl), _PS_PRICE_COMPUTE_PRECISION_);
|
||||
|
||||
// set price changes in htl_booking_detail table
|
||||
$objHotelBooking->total_price_tax_excl += (float)$priceDiffTaxExcl;
|
||||
$objHotelBooking->total_price_tax_incl += (float)$priceDiffTaxIncl;
|
||||
|
||||
// set price changes in order_detail table
|
||||
$roomTypeTotalPrice = HotelRoomTypeFeaturePricing::getRoomTypeTotalPrice(
|
||||
$idNewRoomType,
|
||||
$objHotelBooking->date_from,
|
||||
$objHotelBooking->date_to
|
||||
);
|
||||
|
||||
$objOrderDetail->unit_price_tax_excl = Product::getPriceStatic($idNewRoomType, false, null, _PS_PRICE_COMPUTE_PRECISION_);
|
||||
$objOrderDetail->unit_price_tax_incl = Tools::ps_round(
|
||||
$taxCalculator->addTaxes($objOrderDetail->unit_price_tax_excl),
|
||||
_PS_PRICE_COMPUTE_PRECISION_
|
||||
);
|
||||
|
||||
$objOrderDetail->total_price_tax_excl += (float)$priceDiffTaxExcl;
|
||||
$objOrderDetail->total_price_tax_incl += (float)$priceDiffTaxIncl;
|
||||
|
||||
// set price changes in orders table
|
||||
$objOrder = new Order($objOrderDetail->id_order);
|
||||
$objOrder->total_products += (float)$priceDiffTaxExcl;
|
||||
$objOrder->total_products_wt += (float)$priceDiffTaxIncl;
|
||||
$objOrder->total_paid += (float)$priceDiffTaxIncl;
|
||||
$objOrder->total_paid_tax_excl += (float)$priceDiffTaxExcl;
|
||||
$objOrder->total_paid_tax_incl += (float)$priceDiffTaxIncl;
|
||||
|
||||
$result &= $objOrder->update();
|
||||
|
||||
// update taxes in order detail
|
||||
$result &= $objOrderDetail->updateTaxAmount($objOrder);
|
||||
}
|
||||
|
||||
$result &= $objOrderDetail->update();
|
||||
}
|
||||
|
||||
$objHotelBooking->id_room = $idRoom;
|
||||
$objHotelBooking->room_num = $objHotelRoomInfo->room_num;
|
||||
// set backorder to 0 as available reallocate rooms will always be free
|
||||
$objHotelBooking->is_back_order = 0;
|
||||
$result &= $objHotelBooking->save();
|
||||
|
||||
if ($result) {
|
||||
Hook::exec(
|
||||
'actionRoomReallocateAfter',
|
||||
array(
|
||||
'id_htl_booking' => $idHotelBooking,
|
||||
'id_room' => $idRoom
|
||||
)
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$result = false;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated : use swapBooking() instead
|
||||
* [swapRoomWithAvailableSameRoomType :: To swap rooms with available rooms in case of reallocation of the room].
|
||||
* @param [int] $current_room_id [Id of the room to be swapped]
|
||||
* @param [date] $date_from [start date of the booking of the room]
|
||||
@@ -1750,70 +1840,107 @@ class HotelBookingDetail extends ObjectModel
|
||||
*
|
||||
* @return [boolean] [true if rooms successfully swapped else returns false]
|
||||
*/
|
||||
public function swapRoomWithAvailableSameRoomType($currentRoomId, $dateFrom, $dateTo, $swappedRoomId)
|
||||
public function swapRoomWithAvailableSameRoomType($idRoomFrom, $dateFrom, $dateTo, $idRoomTo, $idOrderFrom = 0, $idOrderTo = 0)
|
||||
{
|
||||
$result = false;
|
||||
|
||||
$dateFrom = date('Y-m-d H:i:s', strtotime($dateFrom));
|
||||
$dateTo = date('Y-m-d H:i:s', strtotime($dateTo));
|
||||
|
||||
$idHotelCartBookingData1 = Db::getInstance()->getValue(
|
||||
'SELECT `id` FROM `'._DB_PREFIX_.'htl_cart_booking_data` WHERE `is_refunded` = 0
|
||||
AND `date_from`=\''.pSQL($dateFrom).'\' AND `date_to`=\''.pSQL($dateTo).'\'
|
||||
AND `id_room`='.(int)$swappedRoomId
|
||||
);
|
||||
$idHotelCartBookingData2 = Db::getInstance()->getValue(
|
||||
'SELECT `id` FROM `'._DB_PREFIX_.'htl_cart_booking_data` WHERE `is_refunded` = 0
|
||||
AND `date_from`=\''.pSQL($dateFrom).'\' AND `date_to`=\''.pSQL($dateTo).'\'
|
||||
AND `id_room`='.(int)$currentRoomId
|
||||
);
|
||||
|
||||
$idHotelBookingDetail1 = Db::getInstance()->getValue(
|
||||
// Get the booking details for the given rooms as per given parameters
|
||||
$idHotelBookingFrom = Db::getInstance()->getValue(
|
||||
'SELECT `id` FROM `'._DB_PREFIX_.'htl_booking_detail` WHERE `is_refunded` = 0
|
||||
AND `date_from`=\''.pSQL($dateFrom).'\' AND `date_to`=\''.pSQL($dateTo).'\'
|
||||
AND `id_room`='.(int)$swappedRoomId
|
||||
AND `date_from`=\''.pSQL($dateFrom).'\'
|
||||
AND `date_to`=\''.pSQL($dateTo).'\'
|
||||
AND `id_room`='.(int)$idRoomFrom.
|
||||
((int) $idOrderFrom ? ' AND id_order = '.(int) $idOrderFrom : '')
|
||||
);
|
||||
$idHotelBookingDetail2 = Db::getInstance()->getValue(
|
||||
|
||||
$idHotelBookingTo = Db::getInstance()->getValue(
|
||||
'SELECT `id` FROM `'._DB_PREFIX_.'htl_booking_detail` WHERE `is_refunded` = 0
|
||||
AND `date_from`=\''.pSQL($dateFrom).'\' AND `date_to`=\''.pSQL($dateTo).'\'
|
||||
AND `id_room`='.(int)$currentRoomId
|
||||
AND `date_from`=\''.pSQL($dateFrom).'\'
|
||||
AND `date_to`=\''.pSQL($dateTo).'\'
|
||||
AND `id_room`='.(int)$idRoomTo.
|
||||
((int) $idOrderTo ? ' AND id_order = '.(int) $idOrderTo : '')
|
||||
);
|
||||
|
||||
$objHotelCartBookingData1 = new HotelCartBookingData($idHotelCartBookingData1);
|
||||
$objHotelCartBookingData2 = new HotelCartBookingData($idHotelCartBookingData2);
|
||||
|
||||
$temp = $objHotelCartBookingData1->id_room;
|
||||
$objHotelCartBookingData1->id_room = $objHotelCartBookingData2->id_room;
|
||||
$objHotelCartBookingData2->id_room = $temp;
|
||||
|
||||
$objHotelBookingDetail1 = new HotelBookingDetail($idHotelBookingDetail1);
|
||||
$objHotelBookingDetail2 = new HotelBookingDetail($idHotelBookingDetail2);
|
||||
|
||||
$temp = $objHotelBookingDetail1->id_room;
|
||||
$objHotelBookingDetail1->id_room = $objHotelBookingDetail2->id_room;
|
||||
$objHotelBookingDetail2->id_room = $temp;
|
||||
|
||||
$temp = $objHotelBookingDetail1->room_num;
|
||||
$objHotelBookingDetail1->room_num = $objHotelBookingDetail2->room_num;
|
||||
$objHotelBookingDetail2->room_num = $temp;
|
||||
|
||||
if ($objHotelCartBookingData1->save()
|
||||
&& $objHotelCartBookingData2->save()
|
||||
&& $objHotelBookingDetail1->save()
|
||||
&& $objHotelBookingDetail2->save()
|
||||
) {
|
||||
Hook::exec(
|
||||
'actionRoomSwapAfter',
|
||||
array(
|
||||
'room_id' => $currentRoomId,
|
||||
'swapped_room_id' => $swappedRoomId,
|
||||
'date_from' => $dateFrom,
|
||||
'date_to' => $dateTo,
|
||||
)
|
||||
);
|
||||
|
||||
return true;
|
||||
if ($idHotelBookingFrom && $idHotelBookingTo) {
|
||||
$result = $this->swapBooking($idHotelBookingFrom, $idHotelBookingTo);
|
||||
}
|
||||
|
||||
return false;
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function swapBooking($idHotelBookingFrom, $idHotelBookingTo)
|
||||
{
|
||||
$result = true;
|
||||
// get the cart booking data for the given booking
|
||||
if (Validate::isLoadedObject($objHotelBookingFrom = new HotelBookingDetail($idHotelBookingFrom))
|
||||
&& Validate::isLoadedObject($objHotelBookingTo = new HotelBookingDetail($idHotelBookingTo))
|
||||
) {
|
||||
// Swap the rooms in the room cart booking table
|
||||
$objHotelCartBooking = new HotelCartBookingData();
|
||||
$cartBookingInfoFrom = $objHotelCartBooking->getRoomRowByIdProductIdRoomInDateRange(
|
||||
$objHotelBookingFrom->id_cart,
|
||||
$objHotelBookingFrom->id_product,
|
||||
$objHotelBookingFrom->date_from,
|
||||
$objHotelBookingFrom->date_to,
|
||||
$objHotelBookingFrom->id_room
|
||||
);
|
||||
$cartBookingInfoTo = $objHotelCartBooking->getRoomRowByIdProductIdRoomInDateRange(
|
||||
$objHotelBookingTo->id_cart,
|
||||
$objHotelBookingTo->id_product,
|
||||
$objHotelBookingTo->date_from,
|
||||
$objHotelBookingTo->date_to,
|
||||
$objHotelBookingTo->id_room
|
||||
);
|
||||
|
||||
if ($cartBookingInfoFrom && $cartBookingInfoTo) {
|
||||
if (Validate::isLoadedObject($objHotelCartBookingFrom = new HotelCartBookingData($cartBookingInfoFrom['id']))
|
||||
&& Validate::isLoadedObject($objHotelCartBookingTo = new HotelCartBookingData($cartBookingInfoTo['id']))
|
||||
) {
|
||||
$objHotelCartBookingFrom->id_room = $objHotelCartBookingTo->id_room;
|
||||
$objHotelCartBookingTo->id_room = $objHotelCartBookingFrom->id_room;
|
||||
$result &= $objHotelCartBookingFrom->save();
|
||||
$result &= $objHotelCartBookingTo->save();
|
||||
}
|
||||
}
|
||||
|
||||
// Swap the rooms in the room booking table
|
||||
// also transfer the backorder status of the room from which room is being swapped
|
||||
$idRoomFrom = $objHotelBookingFrom->id_room;
|
||||
$roomNumFrom = $objHotelBookingFrom->room_num;
|
||||
$roomFromBackOrder = $objHotelBookingFrom->is_back_order;
|
||||
|
||||
$idRoomTo = $objHotelBookingTo->id_room;
|
||||
$roomNumTo = $objHotelBookingTo->room_num;
|
||||
$roomToBackOrder = $objHotelBookingTo->is_back_order;
|
||||
|
||||
$objHotelBookingFrom->id_room = $idRoomTo;
|
||||
$objHotelBookingFrom->room_num = $roomNumTo;
|
||||
$objHotelBookingFrom->is_back_order = $roomToBackOrder;
|
||||
|
||||
$objHotelBookingTo->id_room = $idRoomFrom;
|
||||
$objHotelBookingTo->room_num = $roomNumFrom;
|
||||
$objHotelBookingTo->is_back_order = $roomFromBackOrder;
|
||||
|
||||
$result &= $objHotelBookingFrom->save();
|
||||
$result &= $objHotelBookingTo->save();
|
||||
|
||||
if ($result) {
|
||||
Hook::exec(
|
||||
'actionRoomSwapAfter',
|
||||
array(
|
||||
'id_htl_booking_from' => $idHotelBookingFrom,
|
||||
'id_htl_booking_to' => $idHotelBookingTo
|
||||
)
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$result = false;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2033,6 +2160,7 @@ class HotelBookingDetail extends ObjectModel
|
||||
$objHtlBranchInfo = new HotelBranchInformation();
|
||||
|
||||
foreach ($order_detail_data as $key => $value) {
|
||||
$order_detail_data[$key]['room_type'] = $value['room_type_name'];
|
||||
// Check if product is still available
|
||||
if (Validate::isLoadedObject($objProduct = new Product((int) $value['id_product'], Configuration::get('PS_LANG_DEFAULT')))
|
||||
&& $productCoverImg = Product::getCover($value['id_product'])
|
||||
@@ -2046,7 +2174,6 @@ class HotelBookingDetail extends ObjectModel
|
||||
}
|
||||
|
||||
$objOrderDetail = new OrderDetail($value['id_order_detail']);
|
||||
$order_detail_data[$key]['room_type'] = $objOrderDetail->product_name;
|
||||
$order_detail_data[$key]['original_unit_price_tax_excl'] = $objOrderDetail->unit_price_tax_excl;
|
||||
$order_detail_data[$key]['original_unit_price_tax_incl'] = $objOrderDetail->unit_price_tax_incl;
|
||||
$order_detail_data[$key]['unit_price_without_reduction_tax_excl'] = $objOrderDetail->unit_price_tax_excl + $objOrderDetail->reduction_amount_tax_excl;
|
||||
|
||||
@@ -30,6 +30,9 @@ class AdminHotelRoomsBookingController extends ModuleAdminController
|
||||
|
||||
parent::__construct();
|
||||
|
||||
$this->_conf[52] = $this->l('Room in the booking is successfully reallocated');
|
||||
$this->_conf[53] = $this->l('Room in the booking is successfully swapped');
|
||||
|
||||
$this->initCart();
|
||||
}
|
||||
|
||||
@@ -149,68 +152,84 @@ class AdminHotelRoomsBookingController extends ModuleAdminController
|
||||
Tools::redirectAdmin($this->context->link->getAdminLink('AdminHotelRoomsBooking').'&'.http_build_query($urlData));
|
||||
}
|
||||
|
||||
// Process reallocation of rooms
|
||||
if (Tools::isSubmit('realloc_allocated_rooms')) {
|
||||
$current_room_id = Tools::getValue('modal_id_room');
|
||||
$current_room = Tools::getValue('modal_curr_room_num');
|
||||
$date_from = Tools::getValue('modal_date_from');
|
||||
$date_to = Tools::getValue('modal_date_to');
|
||||
$realloc_room_id = Tools::getValue('realloc_avail_rooms');
|
||||
$idOrder = Tools::getValue('id_order');
|
||||
$idHtlBookingFrom = Tools::getValue('id_htl_booking');
|
||||
$idNewRoomType = Tools::getValue('realloc_avail_room_type');
|
||||
$idRoomToReallocate = Tools::getValue('realloc_avail_rooms');
|
||||
$priceDiff = Tools::getValue('reallocation_price_diff');
|
||||
|
||||
if ($realloc_room_id == 0) {
|
||||
$this->errors[] = $this->l('Please select a room to swap with this room.');
|
||||
}
|
||||
if ($current_room_id == 0) {
|
||||
$this->errors[] = $this->l('Cuurent room is missing.');
|
||||
}
|
||||
if ($date_from == 0) {
|
||||
$this->errors[] = $this->l('Check In date is missing.');
|
||||
}
|
||||
if ($date_to == 0) {
|
||||
$this->errors[] = $this->l('Check Out date is missing.');
|
||||
$objBookingDetail = new HotelBookingDetail();
|
||||
if ($idRoomToReallocate) {
|
||||
// check if room is from selected room type
|
||||
if (Validate::isLoadedObject($objRoomInfo = new HotelRoomInformation($idRoomToReallocate))) {
|
||||
if ($objRoomInfo->id_product != $idNewRoomType) {
|
||||
$this->errors[] = $this->l('Invalid room selected for reallocation.');
|
||||
} elseif (!Validate::isLoadedObject($objHotelBooking = new HotelBookingDetail($idHtlBookingFrom))) {
|
||||
$this->errors[] = $this->l('Invalid booking found for reallocation.');
|
||||
} elseif (!$availableRooms = $objBookingDetail->getAvailableRoomsForReallocation(
|
||||
$objHotelBooking->date_from,
|
||||
$objHotelBooking->date_to,
|
||||
$idNewRoomType,
|
||||
$objHotelBooking->id_hotel
|
||||
)) {
|
||||
$this->errors[] = $this->l('Selected room is not available for reallocation.');
|
||||
} elseif (!in_array($idRoomToReallocate, array_column($availableRooms, 'id_room'))) {
|
||||
$this->errors[] = $this->l('Selected room is not available for reallocation.');
|
||||
} elseif (!Validate::isFloat($priceDiff)) {
|
||||
$this->errors[] = $this->l('Invalid price difference of the room types.');
|
||||
}
|
||||
} else {
|
||||
$this->errors[] = $this->l('Selected room is not available for reallocation.');
|
||||
}
|
||||
} else {
|
||||
$this->errors[] = $this->l('Please select a room to reallocate with this room.');
|
||||
}
|
||||
|
||||
if (!count($this->errors)) {
|
||||
$obj_booking_dtl = new HotelBookingDetail();
|
||||
$room_swapped = $obj_booking_dtl->reallocateRoomWithAvailableSameRoomType(
|
||||
$current_room_id,
|
||||
$date_from,
|
||||
$date_to,
|
||||
$realloc_room_id
|
||||
);
|
||||
if (!$room_swapped) {
|
||||
// Finally, reallocate the room
|
||||
if ($objBookingDetail->reallocateBooking($idHtlBookingFrom, $idRoomToReallocate, $priceDiff)) {
|
||||
Tools::redirectAdmin(self::$currentIndex.'&conf=52&token='.$this->token);
|
||||
} else {
|
||||
$this->errors[] = $this->l('Some error occured. Please try again.');
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Tools::isSubmit('swap_allocated_rooms')) {
|
||||
$current_room_id = Tools::getValue('modal_id_room');
|
||||
$current_room = Tools::getValue('modal_curr_room_num');
|
||||
$date_from = Tools::getValue('modal_date_from');
|
||||
$date_to = Tools::getValue('modal_date_to');
|
||||
$swapped_room_id = Tools::getValue('swap_avail_rooms');
|
||||
|
||||
if ($swapped_room_id == 0) {
|
||||
$this->errors[] = $this->l('Please select aroom to swap with thisroom.');
|
||||
}
|
||||
if ($current_room_id == 0) {
|
||||
$this->errors[] = $this->l('Cuurentroom is missing.');
|
||||
}
|
||||
if ($date_from == 0) {
|
||||
$this->errors[] = $this->l('Check In date is missing.');
|
||||
}
|
||||
if ($date_to == 0) {
|
||||
$this->errors[] = $this->l('Check Out date is missing.');
|
||||
// Process swap of rooms
|
||||
if (Tools::isSubmit('swap_allocated_rooms')) {
|
||||
$idOrder = Tools::getValue('id_order');
|
||||
$idHtlBookingFrom = Tools::getValue('id_htl_booking');
|
||||
$idHtlBookingToSwap = Tools::getValue('swap_avail_rooms');
|
||||
|
||||
if (!Validate::isLoadedObject($objHotelBooking = new HotelBookingDetail($idHtlBookingFrom))) {
|
||||
$this->errors[] = $this->l('Selected room is not available to swap.');
|
||||
} else {
|
||||
if (!Validate::isLoadedObject($objHotelBookingTo = new HotelBookingDetail($idHtlBookingToSwap))) {
|
||||
$this->errors[] = $this->l('Please select a room to swap with this room booking.');
|
||||
} else {
|
||||
if ($availableRooms = $objHotelBooking->getAvailableRoomsForSwapping(
|
||||
$objHotelBooking->date_from,
|
||||
$objHotelBooking->date_to,
|
||||
$objHotelBooking->id_product,
|
||||
$objHotelBooking->id_hotel,
|
||||
$objHotelBooking->id_room
|
||||
)) {
|
||||
if (!in_array($idHtlBookingToSwap, array_column($availableRooms, 'id_hotel_booking'))) {
|
||||
$this->errors[] = $this->l('Selected room is not available to swap.');
|
||||
}
|
||||
} else {
|
||||
$this->errors[] = $this->l('Selected room is not available to swap.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!count($this->errors)) {
|
||||
$obj_booking_dtl = new HotelBookingDetail();
|
||||
$room_swapped = $obj_booking_dtl->swapRoomWithAvailableSameRoomType(
|
||||
$current_room_id,
|
||||
$date_from,
|
||||
$date_to,
|
||||
$swapped_room_id
|
||||
);
|
||||
if (!$room_swapped) {
|
||||
$objBookingDetail = new HotelBookingDetail();
|
||||
if ($objBookingDetail->swapBooking($idHtlBookingFrom, $idHtlBookingToSwap)) {
|
||||
Tools::redirectAdmin(self::$currentIndex.'&conf=53&token='.$this->token);
|
||||
} else {
|
||||
$this->errors[] = $this->l('Some error occured. Please try again.');
|
||||
}
|
||||
}
|
||||
@@ -787,7 +806,16 @@ class AdminHotelRoomsBookingController extends ModuleAdminController
|
||||
} else {
|
||||
$booking_data['rm_data'][$key_bk_data]['data']['booked'][$booked_k1]['detail'][$kDtl]['alloted_cust_email'] = "No customer email found";
|
||||
}
|
||||
$booking_data['rm_data'][$key_bk_data]['data']['booked'][$booked_k1]['detail'][$kDtl]['avail_rooms_to_realloc'] = $obj_booking_dtl->getAvailableRoomsForReallocation($booked_v1['detail'][$kDtl]['date_from'], $booked_v1['detail'][$kDtl]['date_to'], $booked_v1['id_product'], $booked_v1['id_hotel']);
|
||||
|
||||
if (Validate::isLoadedObject($objHotelBooking = new HotelBookingDetail($bookedDtls['id_htl_booking']))) {
|
||||
$booking_data['rm_data'][$key_bk_data]['data']['booked'][$booked_k1]['detail'][$kDtl]['room_type_name'] = $objHotelBooking->room_type_name;
|
||||
$booking_data['rm_data'][$key_bk_data]['data']['booked'][$booked_k1]['detail'][$kDtl]['id_order'] = $objHotelBooking->id_order;
|
||||
|
||||
$objOrder = new Order($objHotelBooking->id_order);
|
||||
$booking_data['rm_data'][$key_bk_data]['data']['booked'][$booked_k1]['detail'][$kDtl]['currency_sign'] = (new Currency($objOrder->id_currency))->sign;
|
||||
}
|
||||
|
||||
$booking_data['rm_data'][$key_bk_data]['data']['booked'][$booked_k1]['detail'][$kDtl]['avail_room_types_to_realloc'] = $obj_booking_dtl->getAvailableRoomsForReallocation($booked_v1['detail'][$kDtl]['date_from'], $booked_v1['detail'][$kDtl]['date_to'], 0, $booked_v1['id_hotel'], 1);
|
||||
$booking_data['rm_data'][$key_bk_data]['data']['booked'][$booked_k1]['detail'][$kDtl]['avail_rooms_to_swap'] = $obj_booking_dtl->getAvailableRoomsForSwapping($booked_v1['detail'][$kDtl]['date_from'], $booked_v1['detail'][$kDtl]['date_to'], $booked_v1['id_product'], $booked_v1['id_hotel'], $booked_v1['id_room']);
|
||||
}
|
||||
}
|
||||
@@ -795,9 +823,48 @@ class AdminHotelRoomsBookingController extends ModuleAdminController
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $booking_data;
|
||||
}
|
||||
|
||||
public function ajaxProcessChangeRoomTypeToReallocate()
|
||||
{
|
||||
$result = array();
|
||||
$result['success'] = 0;
|
||||
$result['has_price_changes'] = 0;
|
||||
$result['has_room_type_change'] = 0;
|
||||
|
||||
$idHotelBooking = Tools::getValue('id_htl_booking');
|
||||
$idNewRoomType = Tools::getValue('id_new_room_type');
|
||||
|
||||
// if room type id is present in the ajax request or not
|
||||
if ($idNewRoomType) {
|
||||
// validate the booking is valid or not
|
||||
if (Validate::isLoadedObject($objHotelBooking = new HotelBookingDetail($idHotelBooking))) {
|
||||
$result['success'] = 1;
|
||||
// if room is changing in the reallocation
|
||||
if ($objHotelBooking->id_product != $idNewRoomType) {
|
||||
$result['has_room_type_change'] = 1;
|
||||
$newRoomTotalPrice = HotelRoomTypeFeaturePricing::getRoomTypeTotalPrice(
|
||||
$idNewRoomType,
|
||||
$objHotelBooking->date_from,
|
||||
$objHotelBooking->date_to
|
||||
);
|
||||
if ($objHotelBooking->total_price_tax_excl != $newRoomTotalPrice['total_price_tax_excl']) {
|
||||
$result['has_price_changes'] = 1;
|
||||
$result['price_diff'] = $newRoomTotalPrice['total_price_tax_excl'] - $objHotelBooking->total_price_tax_excl;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$result['error'] = $this->l('Invalid booking information. Please try again.');
|
||||
}
|
||||
} else {
|
||||
$result['error'] = $this->l('Selected room type not found. Please try again.');
|
||||
}
|
||||
|
||||
$this->ajaxDie(json_encode($result));
|
||||
}
|
||||
|
||||
public function setMedia()
|
||||
{
|
||||
parent::setMedia();
|
||||
@@ -830,7 +897,6 @@ class AdminHotelRoomsBookingController extends ModuleAdminController
|
||||
'add_to_cart' => $this->l('Add To Cart', null, true),
|
||||
'remove' => $this->l('Remove', null, true),
|
||||
'noRoomTypeAvlTxt' => $this->l('No room type available.', null, true),
|
||||
'no_rm_avail_txt' => $this->l('No rooms available.', null, true),
|
||||
'slct_rm_err' => $this->l('Please select a room first.', null, true),
|
||||
'product_added_cart_txt' => $this->l('Product added in cart', null, true),
|
||||
'info_icon_path' => _MODULE_DIR_.$this->module->name.'/views/img/Slices/info-icon.svg',
|
||||
@@ -848,6 +914,12 @@ class AdminHotelRoomsBookingController extends ModuleAdminController
|
||||
'all_children_txt' => $this->l('All Children', null, true),
|
||||
'invalid_occupancy_txt' => $this->l('Invalid occupancy(adults/children) found.', null, true),
|
||||
// 'check_calender_var' => $check_calender_var,
|
||||
'txtSomeErr' => $this->l('Some error occurred. Please try again.'),
|
||||
'no_rm_avail_txt' => $this->l('No room available.', null, true),
|
||||
'no_realloc_rm_avail_txt' => $this->l('No room available for reallocation.', null, true),
|
||||
'no_realloc_rm_type_avail_txt' => $this->l('No room type available for reallocation.', null, true),
|
||||
'no_swap_rm_avail_txt' => $this->l('No room available for swap.', null, true),
|
||||
'select_room_txt' => $this->l('Select room', null, true),
|
||||
);
|
||||
if (Configuration::get('PS_BACKOFFICE_SEARCH_TYPE') == HotelBookingDetail::SEARCH_TYPE_OWS ) {
|
||||
$jsVars['is_occupancy_wise_search'] = true;
|
||||
|
||||
@@ -959,60 +959,179 @@ $(document).ready(function() {
|
||||
}
|
||||
}
|
||||
|
||||
/*For swaping rooms in the modal*/
|
||||
$("#realloc_allocated_rooms").on('click', function(e) {
|
||||
$('#mySwappigModal').on('hidden.bs.modal', function (e) {
|
||||
$(".modal_curr_room_num").val('');
|
||||
$(".modal_id_htl_booking").val('');
|
||||
$("#reallocation_price_diff_block .order_currency_sign").html('');
|
||||
$(".cust_name").text('');
|
||||
$(".cust_email").text('');
|
||||
$(".swp_rm_opts").remove();
|
||||
$(".realloc_rm_type_opts").remove();
|
||||
$(".realloc_rm_opts").remove();
|
||||
});
|
||||
|
||||
$('#mySwappigModal').on('shown.bs.modal', function (e)
|
||||
{
|
||||
$(".loading_overlay").show();
|
||||
|
||||
$(".modal_id_htl_booking").val(e.relatedTarget.dataset.id_htl_booking);
|
||||
$("#reallocation_price_diff_block .order_currency_sign").html(e.relatedTarget.dataset.currency_sign);
|
||||
$(".modal_curr_room_num").val(e.relatedTarget.dataset.room_num + ', ' + e.relatedTarget.dataset.room_type_name);
|
||||
$(".cust_name").text(e.relatedTarget.dataset.cust_name);
|
||||
$(".cust_email").text(e.relatedTarget.dataset.cust_email);
|
||||
|
||||
// reset price difference fields
|
||||
$("#reallocation_price_diff").val(0);
|
||||
$("#reallocation_price_diff_block").hide();
|
||||
$(".realloc_roomtype_change_message").hide();
|
||||
|
||||
// For Rooms Swapping
|
||||
var json_arr_rm_swp = JSON.parse(e.relatedTarget.dataset.avail_rm_swap);
|
||||
if (e.relatedTarget.dataset.avail_rm_swap != 'false' && json_arr_rm_swp.length != 0) {
|
||||
html = '<select class="form-control" name="swap_avail_rooms" id="swap_avail_rooms">';
|
||||
$.each(json_arr_rm_swp, function(key,val) {
|
||||
html += '<option class="swp_rm_opts" value="'+val.id_hotel_booking+'" >'+val.room_num+'</option>';
|
||||
});
|
||||
html += '</select>';
|
||||
|
||||
$("#swap_allocated_rooms").removeAttr('disabled');
|
||||
$(".swap_avail_rooms_container").empty().append(html);
|
||||
} else {
|
||||
$(".swap_avail_rooms_container").empty().text(no_swap_rm_avail_txt).addClass('text-danger');
|
||||
$("#swap_allocated_rooms").attr('disabled', 'disabled');
|
||||
}
|
||||
|
||||
// For Rooms Reallocation
|
||||
var json_arr_realloc_room_types = JSON.parse(e.relatedTarget.dataset.avail_realloc_room_types);
|
||||
if (e.relatedTarget.dataset.avail_realloc_room_types != 'false' && json_arr_realloc_room_types.length != 0) {
|
||||
var idCurrentRoomType = e.relatedTarget.dataset.id_room_type;
|
||||
var roomsTypesHtml = '<select data-id_htl_booking="' + e.relatedTarget.dataset.id_htl_booking + '" class="form-control" name="realloc_avail_room_type" id="realloc_avail_room_type">';
|
||||
$.each(json_arr_realloc_room_types, function(key, room_type) {
|
||||
roomsTypesHtml += "<option rooms_available='" + JSON.stringify(room_type.rooms) + "' class='realloc_rm_type_opts' value='" + room_type.id_product + "'";
|
||||
if (idCurrentRoomType == room_type.id_product) {
|
||||
roomsTypesHtml += ' selected="selected"';
|
||||
}
|
||||
roomsTypesHtml += '>' + room_type.room_type_name + '</option>';
|
||||
});
|
||||
roomsTypesHtml += '</select>';
|
||||
|
||||
setRoomsForReallocation(json_arr_realloc_room_types[idCurrentRoomType]['rooms']);
|
||||
|
||||
$("#realloc_allocated_rooms").removeAttr('disabled');
|
||||
$(".realloc_avail_room_type_container").empty().append(roomsTypesHtml);
|
||||
} else {
|
||||
$(".realloc_avail_rooms_container").empty().text(no_realloc_rm_avail_txt).addClass('text-danger');
|
||||
$(".realloc_avail_room_type_container").empty().text(no_realloc_rm_type_avail_txt).addClass('text-danger');
|
||||
$("#realloc_allocated_rooms").attr('disabled', 'disabled');
|
||||
}
|
||||
|
||||
$(".loading_overlay").hide();
|
||||
});
|
||||
|
||||
// change room type for reallocation
|
||||
$(document).on("change", "#realloc_avail_room_type", function(e) {
|
||||
$(".loading_overlay").show();
|
||||
|
||||
var idHotelBooking = $(this).data('id_htl_booking');
|
||||
$("#reallocation_price_diff").val(0);
|
||||
$("#reallocation_price_diff_block").hide();
|
||||
if (parseInt(idHotelBooking) > 0) {
|
||||
var optionSelected = $(this).find('option:selected');
|
||||
var roomsAvailable = JSON.parse(optionSelected.attr('rooms_available'));
|
||||
|
||||
// set the rooms of the selceted room type
|
||||
setRoomsForReallocation(roomsAvailable);
|
||||
|
||||
// send an ajax for fetching if price has changes in the new room type seleceted
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
headers: {
|
||||
"cache-control": "no-cache"
|
||||
},
|
||||
url: rooms_booking_url,
|
||||
dataType: 'JSON',
|
||||
cache: false,
|
||||
data: {
|
||||
id_htl_booking: idHotelBooking,
|
||||
id_new_room_type: $(this).val(),
|
||||
action: 'changeRoomTypeToReallocate',
|
||||
ajax: true
|
||||
},
|
||||
success: function(result) {
|
||||
if (result.success == 1) {
|
||||
// has room type changed for reallocation
|
||||
if (result.has_room_type_change == 1) {
|
||||
$(".realloc_roomtype_change_message").show();
|
||||
// has room type price changed for reallocation
|
||||
if (result.has_price_changes == 1) {
|
||||
$("#reallocation_price_diff").val(result.price_diff);
|
||||
$("#reallocation_price_diff_block").show();
|
||||
}
|
||||
} else {
|
||||
$(".realloc_roomtype_change_message").hide();
|
||||
}
|
||||
$('#room_type_change_info').empty();
|
||||
if (result.is_changes_present == 1) {
|
||||
}
|
||||
} else if (typeof(result.error) != 'undefinded' && result.error) {
|
||||
showErrorMessage(result.error);
|
||||
} else {
|
||||
showErrorMessage(txtSomeErr);
|
||||
}
|
||||
|
||||
$(".loading_overlay").hide();
|
||||
},
|
||||
error: function(XMLHttpRequest, textStatus, errorThrown) {
|
||||
$(".loading_overlay").hide();
|
||||
showErrorMessage(txtSomeErr);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
$(".loading_overlay").hide();
|
||||
showErrorMessage(txtSomeErr);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
/*For reallocating rooms in the modal*/
|
||||
$("#realloc_allocated_rooms").on('click', function(e){
|
||||
$(".error_text").text('');
|
||||
if ($('#realloc_avail_rooms').val() == 0) {
|
||||
var room_to_reallocate = $('#realloc_avail_rooms').val();
|
||||
var room_type_to_reallocate = $('#realloc_avail_room_type').val();
|
||||
|
||||
if (typeof room_type_to_reallocate == 'undefined' || room_type_to_reallocate == 0) {
|
||||
$("#realloc_sel_rm_type_err_p").text(slct_rm_type_err);
|
||||
return false;
|
||||
}
|
||||
if (typeof room_to_reallocate == 'undefined' || room_to_reallocate == 0) {
|
||||
$("#realloc_sel_rm_err_p").text(slct_rm_err);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
$("#swap_allocated_rooms").on('click', function(e) {
|
||||
|
||||
/*For swaping rooms in the modal*/
|
||||
$("#swap_allocated_rooms").on('click', function(e){
|
||||
$(".error_text").text('');
|
||||
if ($('#swap_avail_rooms').val() == 0) {
|
||||
var room_to_swap = $('#swap_avail_rooms').val();
|
||||
if (typeof room_to_swap == 'undefined' || room_to_swap == 0) {
|
||||
$("#swap_sel_rm_err_p").text(slct_rm_err);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#mySwappigModal').on('hidden.bs.modal', function(e) {
|
||||
$(".modal_date_from").val('');
|
||||
$(".modal_date_to").val('');
|
||||
$(".modal_id_room").val('');
|
||||
$(".modal_curr_room_num").val('');
|
||||
$(".cust_name").text('');
|
||||
$(".cust_email").text('');
|
||||
$(".swp_rm_opts").remove();
|
||||
$(".realloc_rm_opts").remove();
|
||||
});
|
||||
|
||||
$('#mySwappigModal').on('shown.bs.modal', function(e) {
|
||||
$(".modal_date_from").val(e.relatedTarget.dataset.date_from);
|
||||
$(".modal_date_to").val(e.relatedTarget.dataset.date_to);
|
||||
$(".modal_id_room").val(e.relatedTarget.dataset.id_room);
|
||||
$(".modal_curr_room_num").val(e.relatedTarget.dataset.room_num);
|
||||
$(".cust_name").text(e.relatedTarget.dataset.cust_name);
|
||||
$(".cust_email").text(e.relatedTarget.dataset.cust_email);
|
||||
html = '';
|
||||
if (e.relatedTarget.dataset.avail_rm_realloc) {
|
||||
var json_arr_rm_swp = JSON.parse(e.relatedTarget.dataset.avail_rm_swap);
|
||||
$.each(json_arr_rm_swp, function(key, val) {
|
||||
html += '<option class="swp_rm_opts" value="' + val.id_room + '" >' + val.room_num + '</option>';
|
||||
function setRoomsForReallocation(roomsAvailable)
|
||||
{
|
||||
if (typeof(roomsAvailable) != 'undefined' && roomsAvailable.length) {
|
||||
var roomsHtml = '<select class="form-control" name="realloc_avail_rooms" id="realloc_avail_rooms">';
|
||||
roomsHtml += '<option class="realloc_rm_opts" value="0">---- ' + select_room_txt + ' ----</option>';
|
||||
$.each(roomsAvailable, function(key, roomInfo) {
|
||||
roomsHtml += '<option class="realloc_rm_opts" value="' + roomInfo.id_room + '">' + roomInfo.room_num + '</option>';
|
||||
});
|
||||
}
|
||||
if (html != '') {
|
||||
$("#swap_avail_rooms").append(html);
|
||||
}
|
||||
roomsHtml += '</select>';
|
||||
|
||||
html = '';
|
||||
if (e.relatedTarget.dataset.avail_rm_realloc) {
|
||||
var json_arr_rm_realloc = JSON.parse(e.relatedTarget.dataset.avail_rm_realloc);
|
||||
$.each(json_arr_rm_realloc, function(key, val) {
|
||||
html += '<option class="realloc_rm_opts" value="' + val.id_room + '" >' + val.room_num + '</option>';
|
||||
});
|
||||
}
|
||||
if (html != '') {
|
||||
$("#realloc_avail_rooms").append(html);
|
||||
}
|
||||
});
|
||||
});
|
||||
$(".realloc_avail_rooms_container").empty().append(roomsHtml);
|
||||
} else {
|
||||
$(".realloc_avail_rooms_container").empty().text(no_realloc_rm_avail_txt);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -220,7 +220,7 @@
|
||||
</td>
|
||||
<td>
|
||||
{if $rm_dtl_v['booking_type'] == HotelBookingDetail::ALLOTMENT_AUTO}
|
||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#mySwappigModal" data-room_num='{$booked_v['room_num']|escape:'htmlall':'UTF-8'}' data-date_from='{$rm_dtl_v['date_from']|escape:'htmlall':'UTF-8'}' data-date_to='{$rm_dtl_v['date_to']|escape:'htmlall':'UTF-8'}' data-id_room='{$booked_v['id_room']|escape:'htmlall':'UTF-8'}' data-cust_name="{$rm_dtl_v['alloted_cust_name']|escape:'htmlall':'UTF-8'}" data-cust_email="{$rm_dtl_v['alloted_cust_email']|escape:'htmlall':'UTF-8'}" data-avail_rm_realloc='{$rm_dtl_v['avail_rooms_to_realloc']|@json_encode}' data-avail_rm_swap='{$rm_dtl_v['avail_rooms_to_swap']|@json_encode}'>
|
||||
<button type="button" class="btn btn-primary" id="reallocate_room_{$rm_dtl_v['id_htl_booking']}" data-room_type_name="{$rm_dtl_v['room_type_name']}" data-toggle="modal" data-target="#mySwappigModal" data-id_htl_booking="{$rm_dtl_v['id_htl_booking']}" data-id_order="{$rm_dtl_v['id_order']}" data-room_num='{$booked_v['room_num']}' data-currency_sign='{$rm_dtl_v['currency_sign']}' data-id_room_type='{$booked_v['id_product']}' data-cust_name='{$rm_dtl_v['alloted_cust_name']}' data-cust_email='{$rm_dtl_v['alloted_cust_email']}' data-avail_rm_swap='{$rm_dtl_v['avail_rooms_to_swap']|@json_encode}' data-avail_realloc_room_types='{$rm_dtl_v['avail_room_types_to_realloc']|@json_encode}'>
|
||||
{l s='Reallocate Room' mod='hotelreservationsystem'}
|
||||
</button>
|
||||
{else}
|
||||
@@ -259,4 +259,4 @@
|
||||
{/foreach}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -216,94 +216,134 @@
|
||||
</div>
|
||||
<!-- Modal for reallocation of rooms -->
|
||||
<div class="modal fade" id="mySwappigModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<ul class="nav nav-tabs" role="tablist">
|
||||
<li role="presentation" class="active"><a href="#reallocate_room_tab" aria-controls="reallocate" role="tab" data-toggle="tab">{l s='Room Reallocation' mod='hotelreservationsystem'}</a></li>
|
||||
<li role="presentation"><a href="#swap_room_tab" aria-controls="swap" role="tab" data-toggle="tab">{l s='Swap Room' mod='hotelreservationsystem'}</a></li>
|
||||
</ul>
|
||||
<div class="tab-content panel active">
|
||||
<div role="tabpanel" class="tab-pane active" id="reallocate_room_tab">
|
||||
<form method="post" action="">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title" id="realloc_myModalLabel">{l s='Reallocate Rooms'}</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="form-group">
|
||||
<label for="curr_room_num" class="control-label">{l s='Current Room Number:' mod='hotelreservationsystem'}</label>
|
||||
<input type="text" class="form-control modal_curr_room_num" name="modal_curr_room_num" readonly="true">
|
||||
<input type="hidden" class="form-control modal_date_from" name="modal_date_from">
|
||||
<input type="hidden" class="form-control modal_date_to" name="modal_date_to">
|
||||
<input type="hidden" class="form-control modal_id_room" name="modal_id_room">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="realloc_avail_rooms" class="control-label">{l s='Available Rooms To Reallocate:' mod='hotelreservationsystem'}</label>
|
||||
<div style="width: 195px;">
|
||||
<select class="form-control" name="realloc_avail_rooms" id="realloc_avail_rooms">
|
||||
<option value="0" selected="selected">{l s='Select Rooms' mod='hotelreservationsystem'}</option>
|
||||
</select>
|
||||
<p class="error_text" id="realloc_sel_rm_err_p"></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label style="text-decoration:underline;margin-top:5px;" for="message-text" class="col-sm-12 control-label"><i class="icon-info-circle"></i> {l s='Currently Alloted Customer Information:' mod='hotelreservationsystem'}</label>
|
||||
<dl class="well list-detail">
|
||||
<dt>{l s='Name' mod='hotelreservationsystem'}</dt>
|
||||
<dd class="cust_name"></dd><br>
|
||||
<dt>{l s='Email' mod='hotelreservationsystem'}</dt>
|
||||
<dd class="cust_email"></dd><br>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">{l s="Close" mod="hotelreservationsyatem"}</button>
|
||||
<input type="submit" id="realloc_allocated_rooms" name="realloc_allocated_rooms" class="btn btn-primary" value="Reallocate">
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div role="tabpanel" class="tab-pane" id="swap_room_tab">
|
||||
<form method="post" action="">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title" id="swap_myModalLabel">{l s='Swap Rooms' mod='hotelreservationsystem'}</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="form-group">
|
||||
<label for="swap_curr_room_num" class="control-label">{l s='Current Room Number:' mod='hotelreservationsystem'}</label>
|
||||
<input type="text" class="form-control modal_curr_room_num" name="modal_curr_room_num" readonly="true">
|
||||
<input type="hidden" class="form-control modal_date_from" name="modal_date_from">
|
||||
<input type="hidden" class="form-control modal_date_to" name="modal_date_to">
|
||||
<input type="hidden" class="form-control modal_id_room" name="modal_id_room">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="swap_avail_rooms" class="control-label">{l s='Available Rooms To Swap:' mod='hotelreservationsystem'}</label>
|
||||
<div style="width: 195px;">
|
||||
<select class="form-control" name="swap_avail_rooms" id="swap_avail_rooms">
|
||||
<option value="0" selected="selected">{l s='Select Rooms' mod='hotelreservationsystem'}</option>
|
||||
</select>
|
||||
<p class="error_text" id="swap_sel_rm_err_p"></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label style="text-decoration:underline;margin-top:5px;" for="message-text" class="col-sm-12 control-label"><i class="icon-info-circle"></i> {l s='Currently Alloted Customer Information:' mod='hotelreservationsystem'}</label>
|
||||
<dl class="well list-detail">
|
||||
<dt>{l s='Name' mod='hotelreservationsystem'}</dt>
|
||||
<dd class="cust_name"></dd><br>
|
||||
<dt>{l s='Email' mod='hotelreservationsystem'}</dt>
|
||||
<dd class="cust_email"></dd><br>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">{l s="Close" mod="hotelreservationsyatem"}</button>
|
||||
<input type="submit" id="swap_allocated_rooms" name="swap_allocated_rooms" class="btn btn-primary" value="Swap">
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<ul class="nav nav-tabs" role="tablist">
|
||||
<li role="presentation" class="active"><a href="#reallocate_room_tab" aria-controls="reallocate" role="tab" data-toggle="tab">{l s='Room Reallocation'}</a></li>
|
||||
<li role="presentation"><a href="#swap_room_tab" aria-controls="swap" role="tab" data-toggle="tab">{l s='Swap Room'}</a></li>
|
||||
</ul>
|
||||
<div class="tab-content active">
|
||||
<div role="tabpanel" class="tab-pane active" id="reallocate_room_tab">
|
||||
<form method="post" action="">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title" id="realloc_myModalLabel">{l s='Reallocate Rooms'}</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="row">
|
||||
<div class="form-group col-sm-6">
|
||||
<label for="curr_room_num" class="control-label model-label">{l s='Current Room Number:'}</label>
|
||||
<input type="text" class="form-control modal_curr_room_num" name="modal_curr_room_num" readonly="true">
|
||||
<input type="hidden" class="form-control modal_id_htl_booking" name="id_htl_booking">
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel">
|
||||
<div class="panel-heading"><i class="icon-user"></i> {l s='Currently Alloted Customer'}</div>
|
||||
<div class="panel-content">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label model-label">{l s='Name'} :</label>
|
||||
<div class="dol-sm-9 cust_name"></div>
|
||||
</div>
|
||||
<div class="">
|
||||
<label class="col-sm-3 control-label model-label">{l s='Email'} :</label>
|
||||
<div class="dol-sm-9 cust_email"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="row">
|
||||
<div class="form-group col-sm-6">
|
||||
<label for="realloc_avail_room_type" class="control-label model-label">{l s='Room Type To Reallocate:'}</label>
|
||||
<div class="realloc_avail_room_type_container">
|
||||
<select class="form-control" name="realloc_avail_room_type" id="realloc_avail_room_type">
|
||||
<option value="0" selected="selected">{l s='Select Room Type'}</option>
|
||||
</select>
|
||||
</div>
|
||||
<p class="error_text" id="realloc_sel_rm_type_err_p"></p>
|
||||
</div>
|
||||
<div class="form-group col-sm-6">
|
||||
<label for="realloc_avail_rooms" class="control-label model-label">{l s='Room To Reallocate:'}</label>
|
||||
<div class="realloc_avail_rooms_container">
|
||||
<select class="form-control" name="realloc_avail_rooms" id="realloc_avail_rooms">
|
||||
<option value="0" selected="selected">{l s='Select Rooms'}</option>
|
||||
</select>
|
||||
</div>
|
||||
<p class="error_text" id="realloc_sel_rm_err_p"></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" id="reallocation_price_diff_block" style="display:none;">
|
||||
<div class="form-group col-sm-6">
|
||||
<label for="reallocation_price_diff" class="control-label model-label alert-warning">{l s='Price Difference'} *</label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon order_currency_sign"></span>
|
||||
<input type="text" name="reallocation_price_diff" id="reallocation_price_diff" value="0" />
|
||||
<span class="input-group-addon">{l s='Tax excl.'}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="alert alert-warning col-sm-12 realloc_roomtype_change_message" style="display:none">
|
||||
<p>{l s="If room type is changed while room reallocation then all additional facilities and services will be assigned to the selected room of new room type."}</p>
|
||||
<p>{l s="If you want to change additional facilities or services, you can update by editing the room after reallocation."}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">{l s="Close" mod="hotelreservationsyatem"}</button>
|
||||
<input type="submit" id="realloc_allocated_rooms" name="realloc_allocated_rooms" class="btn btn-primary" value="Reallocate">
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div role="tabpanel" class="tab-pane" id="swap_room_tab">
|
||||
<form method="post" action="">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title" id="swap_myModalLabel">{l s='Swap Rooms'}</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="row">
|
||||
<div class="form-group col-sm-6">
|
||||
<label for="swap_curr_room_num" class="control-label model-label">{l s='Current Room Number:'}</label>
|
||||
<input type="text" class="form-control modal_curr_room_num" name="modal_curr_room_num" readonly="true">
|
||||
<input type="hidden" class="form-control modal_id_htl_booking" name="id_htl_booking">
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel">
|
||||
<div class="panel-heading"><i class="icon-user"></i> {l s='Currently Alloted Customer'}</div>
|
||||
<div class="panel-content">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label model-label">{l s='Name'} :</label>
|
||||
<div class="dol-sm-9 cust_name"></div>
|
||||
</div>
|
||||
<div class="">
|
||||
<label class="col-sm-3 control-label model-label">{l s='Email'} :</label>
|
||||
<div class="dol-sm-9 cust_email"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="row">
|
||||
<div class="form-group col-sm-6">
|
||||
<label for="swap_avail_rooms" class="control-label model-label">{l s='Rooms To Swap:'}</label>
|
||||
<div class="swap_avail_rooms_container"></div>
|
||||
<p class="error_text" id="swap_sel_rm_err_p"></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">{l s="Close" mod="hotelreservationsyatem"}</button>
|
||||
<input type="submit" id="swap_allocated_rooms" name="swap_allocated_rooms" class="btn btn-primary" value="Swap">
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{* loader before loading data *}
|
||||
<div class="loading_overlay">
|
||||
<img src='{$link->getMediaLink("`$img_dir`admin/ajax-loader.gif")}' class="loading-img"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="date-stats-tooltop" style="display:none">
|
||||
<div class="tooltip_cont">
|
||||
@@ -336,4 +376,4 @@
|
||||
</div>
|
||||
<template id="svg-icon">
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><circle cx="8" cy="8" r="8"/><path d="M8.06536 3C8.30937 3 8.51561 3.07032 8.6841 3.21097C8.85839 3.34693 8.94553 3.51336 8.94553 3.71027C8.94553 3.90717 8.85839 4.07595 8.6841 4.2166C8.51561 4.35724 8.30937 4.42757 8.06536 4.42757C7.82135 4.42757 7.6122 4.35724 7.43791 4.2166C7.26362 4.07595 7.17647 3.90717 7.17647 3.71027C7.17647 3.51336 7.26071 3.34693 7.42919 3.21097C7.60349 3.07032 7.81554 3 8.06536 3ZM8.78867 6.3685V11.5443C8.78867 11.9475 8.82353 12.2171 8.89325 12.353C8.96877 12.4843 9.07625 12.5827 9.21569 12.6484C9.36093 12.714 9.62237 12.7468 10 12.7468V13H6.122V12.7468C6.51126 12.7468 6.77269 12.7164 6.90632 12.6554C7.03994 12.5945 7.14452 12.4937 7.22004 12.353C7.30138 12.2124 7.34205 11.9428 7.34205 11.5443V9.06188C7.34205 8.36334 7.3159 7.91092 7.26362 7.70464C7.22295 7.55462 7.15904 7.45148 7.0719 7.39522C6.98475 7.33427 6.86565 7.3038 6.7146 7.3038C6.55192 7.3038 6.35439 7.33896 6.122 7.40928L6 7.15612L8.40523 6.3685H8.78867Z" fill="white"/></svg>
|
||||
<template>
|
||||
<template>
|
||||
|
||||
Reference in New Issue
Block a user