Merge pull request #1546 from vishal-singh-webkul/gli-2783

Fixed: The Room is added twice in the booking if the admin clicks on the add room/reallocate button twice in the order detail page in the back-office.
This commit is contained in:
Rohit Jain
2025-07-03 19:53:38 +05:30
committed by GitHub
2 changed files with 10 additions and 14 deletions

View File

@@ -758,33 +758,25 @@ function initRoomEvents()
success : function(data) {
if (data.result)
{
if (data.refresh)
{
window.location.href = admin_order_tab_link + '&conf=3&vieworder&id_order=' + id_order;
return;
}
go = false;
window.location.href = admin_order_tab_link + '&conf=3&vieworder&id_order=' + id_order;
//commented by webkul
/*updateAmounts(data.order);
updateInvoice(data.invoices);
updateDocuments(data.documents_html);
updateShipping(data.shipping_html);*/
// Initialize all events
init();
window.location.href = admin_order_tab_link + '&conf=3&vieworder&id_order=' + id_order;
//End
// $('.partial_refund_fields').hide();
}
else
jAlert(data.error);
} else {
jAlert(data.error);
$('.submitAddRoom').removeAttr('disabled');
$('#submitAddRoom').removeAttr('disabled');
}
},
error : function(XMLHttpRequest, textStatus, errorThrown) {
jAlert("Impossible to add the room to the cart.\n\ntextStatus: '" + textStatus + "'\nerrorThrown: '" + errorThrown + "'\nresponseText:\n" + XMLHttpRequest.responseText);
},
complete: function() {
$('.submitAddRoom').removeAttr('disabled');
$('#submitAddRoom').removeAttr('disabled');
$(".loading_overlay").hide();
}
});

View File

@@ -31,13 +31,17 @@ $(document).ready(function() {
/*For reallocating rooms in the modal*/
$(document).on('click', '#realloc_allocated_rooms', function(e){
$(".loading_overlay").show();
if (RoomReallocationModal.reallocate() == false) {
$(".loading_overlay").hide();
return false;
}
});
/*For swaping rooms in the modal*/
$(document).on('click', '#swap_allocated_rooms', function(){
$(".loading_overlay").show();
if (RoomReallocationModal.swap() == false) {
$(".loading_overlay").hide();
return false;
}
});