From 8449e31fca2f080175d5f3361f784b9a5ec99f61 Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Tue, 24 Oct 2023 15:56:53 +0530 Subject: [PATCH] Added: Upgrade of rooms while realloation and Fixed: reallocation and swaping issues --- .../default/sass/controllers/_order.sass | 16 + .../controllers/orders/_product_line.tpl | 4 +- .../controllers/orders/helpers/view/view.tpl | 372 ++++++++++++------ controllers/admin/AdminOrdersController.php | 161 +++++--- img/admin/ajax-loader.gif | Bin 604 -> 3208 bytes .../classes/HotelBookingDetail.php | 353 +++++++++++------ .../AdminHotelRoomsBookingController.php | 174 +++++--- .../views/js/admin/hotel_rooms_booking.js | 207 +++++++--- .../helpers/view/_partials/booking-rooms.tpl | 4 +- .../hotel_rooms_booking/helpers/view/view.tpl | 216 +++++----- 10 files changed, 1045 insertions(+), 462 deletions(-) diff --git a/admin/themes/default/sass/controllers/_order.sass b/admin/themes/default/sass/controllers/_order.sass index c5ccaa579..cf5737a1d 100644 --- a/admin/themes/default/sass/controllers/_order.sass +++ b/admin/themes/default/sass/controllers/_order.sass @@ -16,3 +16,19 @@ 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 + diff --git a/admin/themes/default/template/controllers/orders/_product_line.tpl b/admin/themes/default/template/controllers/orders/_product_line.tpl index e68b185df..18e663c8f 100644 --- a/admin/themes/default/template/controllers/orders/_product_line.tpl +++ b/admin/themes/default/template/controllers/orders/_product_line.tpl @@ -263,7 +263,7 @@ -
+
+ + {* loader before loading data *} +
+ +
@@ -1606,7 +1649,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} @@ -1627,6 +1674,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'} {/strip} @@ -1768,41 +1816,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); @@ -1966,65 +1979,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 = ''; $.each(json_arr_rm_swp, function(key,val) { - html += ''; + html += ''; }); html += ''; + + $("#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 = ''; + $.each(json_arr_realloc_room_types, function(key, room_type) { + roomsTypesHtml += "