Skip to content

Commit c672045

Browse files
committed
Fixed: Now user can update room status from check-out to check-in
1 parent a27e55c commit c672045

3 files changed

Lines changed: 20 additions & 7 deletions

File tree

admin/themes/default/template/controllers/orders/helpers/view/view.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@
148148
{if isset($refundReqBookings) && $refundReqBookings && $data.id|in_array:$refundReqBookings && $data.is_refunded}
149149
<span class="badge badge-danger">{if $data.is_cancelled}{l s='Cancelled'}{else}{l s='Refunded'}{/if}</span>
150150
{elseif $can_edit}
151-
<a class="open_room_status_form btn btn-default" href="#" data-id_hotel_booking_detail="{$data['id']}" data-id_order="{$data['id_order']}" data-id_status="{$data['id_status']}" data-id_room="{$data['id_room']}" data-date_from="{$data['date_from']|date_format:"%Y-%m-%d"}" data-date_to="{$data['date_to']|date_format:"%Y-%m-%d"}" data-check_in_time="{$data['check_in_time']}" data-check_out_time="{$data['check_out_time']}">
151+
<a class="open_room_status_form btn btn-default" href="#" data-id_hotel_booking_detail="{$data['id']}" data-id_order="{$data['id_order']}" data-id_status="{$data['id_status']}" data-id_room="{$data['id_room']}" data-date_from="{$data['date_from']|date_format:"%Y-%m-%d"}" data-date_to="{$data['date_to']|date_format:"%Y-%m-%d"}" data-check_in_time="{$data['check_in_time']}" data-check_out_time="{$data['check_out_time']}" data-check_in="{$data['check_in']}" data-check_out="{$data['check_out']}">
152152
<i class="icon-pencil"></i> {l s='Edit'}
153153
</a>
154154
{/if}

admin/themes/default/template/controllers/orders/modals/_room_status_form.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
{/foreach}
3131
</select>
3232
</div>
33-
<div class="form-group" style="display:none;">
33+
<div class="form-group room_date_field_container">
3434
<label class="control-label">{l s='Date'}</label>
3535
<div class="input-group">
3636
<input type="text" name="status_date" class="room_status_date wk-input-date" value="" />

js/admin/orders.js

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2238,6 +2238,7 @@ const RoomStatusModal = {
22382238
success: function(result) {
22392239
if (result.hasError == 0 && result.modalHtml) {
22402240
$('#footer').next('.bootstrap').append(result.modalHtml);
2241+
var currentStatus = roomObj.data('id_status');
22412242

22422243
$('#room-status-modal #room_status_id_hotel_booking_detail').val(roomObj.data('id_hotel_booking_detail'));
22432244
$('#room-status-modal #room_status_date_from').val(roomObj.data('date_from'));
@@ -2246,14 +2247,26 @@ const RoomStatusModal = {
22462247
$('#room-status-modal #room_status_id_order').val(roomObj.data('id_order'));
22472248
$('#room-status-modal .booking_order_status').val(roomObj.data('id_status'));
22482249

2249-
if (roomObj.data('id_status') == result.STATUS_CHECKED_IN) {
2250-
$('.room_status_info_form .room_status_date').val(roomObj.data('date_to') + ' ' + roomObj.data('check_out_time'));
2250+
if (currentStatus == result.STATUS_ALLOTED) {
2251+
$('.room_date_field_container').hide();
22512252
} else {
2252-
$('.room_status_info_form .room_status_date').val(roomObj.data('date_from') + ' ' + roomObj.data('check_in_time'));
2253+
$('.room_date_field_container').show();
22532254
}
22542255

2255-
$('#room-status-modal .booking_order_status option:selected').attr('disabled', 'disabled');
2256-
2256+
if (currentStatus == result.STATUS_CHECKED_OUT) {
2257+
if (roomObj.data('check_out') && roomObj.data('check_out') !== "0000-00-00 00:00:00") {
2258+
$('.room_status_info_form .room_status_date').val(roomObj.data('check_out'));
2259+
} else {
2260+
$('.room_status_info_form .room_status_date').val(roomObj.data('date_to') + ' ' + roomObj.data('check_out_time'));
2261+
}
2262+
} else {
2263+
if (roomObj.data('check_in') && roomObj.data('check_in') !== "0000-00-00 00:00:00") {
2264+
$('.room_status_info_form .room_status_date').val(roomObj.data('check_in'));
2265+
} else {
2266+
$('.room_status_info_form .room_status_date').val(roomObj.data('date_from') + ' ' + roomObj.data('check_in_time'));
2267+
}
2268+
}
2269+
22572270
$('#room-status-modal').modal('show');
22582271
} else if (result.errors) {
22592272
showErrorMessage();

0 commit comments

Comments
 (0)