Skip to content

Commit a53410c

Browse files
authored
Merge pull request #639 from abhishek-webkul/update-refund-view-bo
Update refund request view page at back office
2 parents 7a588f2 + e5b437e commit a53410c

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

modules/hotelreservationsystem/views/js/admin/wk_refund_request.js

+30
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,34 @@ $(document).ready(function() {
4949
}
5050
$('#generateCreditSlip').change();
5151
});
52+
53+
$(document).on('keyup', '#order_return_form .table input[name^="refund_amounts"]', function() {
54+
let refundAmountInputs = $('#order_return_form .table input[name^="refund_amounts"]');
55+
56+
let disableRefundOptions = false;
57+
$(refundAmountInputs).each(function(index, element) {
58+
let val = parseFloat($(element).val().trim());
59+
if (isNaN(val)) { // if at least one amount input is empty
60+
disableRefundOptions = true;
61+
return;
62+
}
63+
});
64+
65+
if (!disableRefundOptions) {
66+
let hasAllZero = true;
67+
$(refundAmountInputs).each(function(index, element) {
68+
let val = parseFloat($(element).val().trim());
69+
if (val != 0) {
70+
hasAllZero = false;
71+
return;
72+
}
73+
});
74+
75+
if (hasAllZero) { // if all amount inputs are 0
76+
disableRefundOptions = true;
77+
}
78+
}
79+
80+
$('#generateCreditSlip, #refundTransactionAmount, #generateDiscount').attr('disabled', disableRefundOptions);
81+
});
5282
});

modules/hotelreservationsystem/views/templates/admin/order_refund_requests/helpers/view/view.tpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@
148148
{displayPrice price=$booking['refunded_amount'] currency=$orderCurrency['id']}
149149
{else}
150150
<span class="input-group-addon">{$orderCurrency['sign']|escape:'html':'UTF-8'}</span>
151-
<input placeholder="" type="text" name="refund_amounts[{$booking['id_order_return_detail']|escape:'html':'UTF-8'}]">
151+
<input placeholder="" type="text" name="refund_amounts[{$booking['id_order_return_detail']|escape:'html':'UTF-8'}]" value="{$booking['total_paid_amount'] - $booking['cancelation_charge']}">
152152
<span class="input-group-addon">{l s='tax incl.' mod='hotelreservationsystem'}</span>
153153
{/if}
154154
</div>

0 commit comments

Comments
 (0)