diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index e1d0df03b..73f3b62de 100644 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -4860,6 +4860,7 @@ class AdminOrdersControllerCore extends AdminController 'tax_excl' => $totalRoomPriceAfterTE, 'tax_incl' => $totalRoomPriceAfterTI, ); + if ($update_htl_tables = $obj_booking_detail->UpdateHotelCartHotelOrderOnOrderEdit( $id_order, $id_room, diff --git a/js/admin/orders.js b/js/admin/orders.js index ac60ba167..850efcacc 100644 --- a/js/admin/orders.js +++ b/js/admin/orders.js @@ -1757,38 +1757,6 @@ $(document).ready(function() { // End: RoomAllotmentCommentModal: Processes // ====================================== - // Start: RoomReallocationModal: Processes - // For processing room reallocation and swapping - $(document).on('click', '.room_reallocate_swap', function(e) { - e.preventDefault(); - RoomReallocationModal.show($(this)); - }); - - $(document).on('hidden.bs.modal', '#room-reallocation-modal', function(){ - location.reload(); - }); - - /*For reallocating rooms in the modal*/ - $(document).on('click', '#realloc_allocated_rooms', function(e){ - if (RoomReallocationModal.reallocate() == false) { - return false; - } - }); - /*For swaping rooms in the modal*/ - $(document).on('click', '#swap_allocated_rooms', function(){ - if (RoomReallocationModal.swap() == false) { - return false; - } - }); - - // change room type for reallocation - $(document).on("change", "#realloc_avail_room_type", function(e) { - e.preventDefault(); - RoomReallocationModal.changeRoomType($(this)); - }); - // End: RoomReallocationModal: Processes - // ====================================== - // Start: AddRoomBookingModal: Processes /*For adding rooms to the order*/ $(document).on('click', '#add_room', function(e){ @@ -2345,184 +2313,6 @@ const RoomStatusModal = { } }; -// Modal object to handle room reallocation processes -const RoomReallocationModal = { - show: function(roomObj) { - $(".loading_overlay").show(); - $.ajax({ - type: 'POST', - headers: { - "cache-control": "no-cache" - }, - url: admin_order_tab_link, - dataType: 'JSON', - cache: false, - data: 'ajax=true&id_order='+id_order+'&action=InitRoomReallocationModal', - success: function(result) { - if (result.hasError == 0 && result.modalHtml) { - $('#footer').next('.bootstrap').append(result.modalHtml); - $(".modal_id_htl_booking").val(roomObj.data('id_htl_booking')); - $("input.modal_curr_room_num").val(roomObj.data('room_num')); - $("span.modal_curr_room_num").text(roomObj.data('room_num') + ', ' + roomObj.data('room_type_name')); - $(".cust_name").text(roomObj.data('cust_name')); - $(".cust_email").text(roomObj.data('cust_email')); - $(".modal_curr_allotent_type").text(roomObj.data('allotment_type_label')); - - // reset price difference fields - $("#reallocation_price_diff").val(0); - $("#reallocation_price_diff_block").hide(); - $(".realloc_roomtype_change_message").hide(); - - if (roomObj.data('allotment_type') == ALLOTMENT_MANUAL) { - $(".allotment_comment_block .modal_curr_allotment_comment").text(roomObj.data('comment')); - $(".allotment_comment_block").show(); - } else { - $(".allotment_comment_block").hide(); - } - - // For Rooms Swapping - var json_arr_rm_swp = roomObj.data('avail_rm_swap'); - if (roomObj.data('avail_rm_swap') != 'false' && json_arr_rm_swp.length != 0) { - html = ''; - $(".swap_avail_rooms_container").empty().append(html); - } else { - $(".swap_avail_rooms_container").empty().text(no_swap_rm_avail_txt).addClass('text-danger'); - $("#swap_room_tab .modal-footer").hide(); - } - - // For Rooms Reallocation - var json_arr_realloc_room_types = roomObj.data('avail_realloc_room_types'); - if (roomObj.data('avail_realloc_room_types') != 'false' && json_arr_realloc_room_types.length != 0) { - var idCurrentRoomType = roomObj.data('id_room_type'); - var roomsTypesHtml = ''; - - setRoomsForReallocation(json_arr_realloc_room_types[idCurrentRoomType]['rooms']); - - $(".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'); - $("#reallocate_room_tab .modal-footer").hide(); - } - - $('#room-reallocation-modal').modal('show'); - } else { - showErrorMessage(txtSomeErr); - } - }, - complete: function() { - $(".loading_overlay").hide(); - } - }); - }, - swap: function() { - $(".error_text").text(''); - 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; - } - - return true; - }, - reallocate: function(reallocateBtnObj) { - $(".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; - } - - return true; - }, - changeRoomType: function(roomTypeObj) { - $(".loading_overlay").show(); - var idHotelBooking = roomTypeObj.data('id_htl_booking'); - $("#reallocation_price_diff").val(0); - $("#reallocation_price_diff_block").hide(); - if (parseInt(idHotelBooking) > 0) { - var optionSelected = roomTypeObj.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: admin_order_tab_link, - dataType: 'JSON', - cache: false, - data: { - id_htl_booking: idHotelBooking, - id_new_room_type: roomTypeObj.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); - } - }, - error: function(XMLHttpRequest, textStatus, errorThrown) { - showErrorMessage(txtSomeErr); - }, - complete: function() { - $(".loading_overlay").hide(); - } - }); - } else { - $(".loading_overlay").hide(); - showErrorMessage(txtSomeErr); - return false; - } - }, - close: function() { - $('#room-reallocation-modal').modal('hide'); - }, - submit: function() { - } -}; - // Modal object to handle adding rooms to order processes const AddRoomBookingModal = { show: function() {