mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-08 20:22:42 +01:00
Clarify payment refunds
This commit is contained in:
parent
019dcfe7c6
commit
fc2a264bfb
@ -146,8 +146,9 @@ class PaymentDatatable extends EntityDatatable
|
||||
$max_refund = number_format($model->amount - $model->refunded, 2);
|
||||
$formatted = Utils::formatMoney($max_refund, $model->currency_id, $model->country_id);
|
||||
$symbol = Utils::getFromCache($model->currency_id ? $model->currency_id : 1, 'currencies')->symbol;
|
||||
$local = in_array($model->gateway_id, [GATEWAY_BRAINTREE, GATEWAY_STRIPE, GATEWAY_WEPAY]) || ! $model->gateway_id ? 0 : 1;
|
||||
|
||||
return "javascript:showRefundModal({$model->public_id}, '{$max_refund}', '{$formatted}', '{$symbol}')";
|
||||
return "javascript:showRefundModal({$model->public_id}, '{$max_refund}', '{$formatted}', '{$symbol}', {$local})";
|
||||
},
|
||||
function ($model) {
|
||||
return Auth::user()->can('editByOwner', [ENTITY_PAYMENT, $model->user_id])
|
||||
|
@ -2741,6 +2741,7 @@ $LANG = array(
|
||||
'taxes_are_not_included_help' => 'Taxes are excluded from the cost.',
|
||||
'change_requires_purge' => 'Changing this setting requires :link the account data.',
|
||||
'purging' => 'purging',
|
||||
'warning_local_refund' => 'The refund will be recorded in the app but will NOT be processed by the payment gateway.',
|
||||
|
||||
);
|
||||
|
||||
|
@ -1,83 +1,86 @@
|
||||
<div class="modal fade" id="paymentRefundModal" tabindex="-1" role="dialog" aria-labelledby="paymentRefundModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog" style="min-width:150px">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h4 class="modal-title" id="paymentRefundModalLabel">{{ trans('texts.refund_payment') }}</h4>
|
||||
</div>
|
||||
|
||||
<div class="container" style="width: 100%; padding-bottom: 0px !important">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-body">
|
||||
<div class="form-horizontal">
|
||||
<div class="form-group">
|
||||
<label for="refundAmount" class="col-sm-offset-2 col-sm-2 control-label">{{ trans('texts.amount') }}</label>
|
||||
<div class="col-sm-4">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon" id="refundCurrencySymbol"></span>
|
||||
<input type="number" class="form-control" id="refundAmount" name="refund_amount" step="0.01" min="0.01" placeholder="{{ trans('texts.amount') }}">
|
||||
</div>
|
||||
<div class="help-block">{{ trans('texts.refund_max') }} <span id="refundMax"></span></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-offset-2 col-sm-2 control-label"></label>
|
||||
<div class="col-sm-6">
|
||||
<div class="input-group">
|
||||
{!! Former::checkbox('refund_email')
|
||||
->text('send_email_to_client')
|
||||
->raw() !!}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal-dialog" style="min-width:150px">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h4 class="modal-title" id="paymentRefundModalLabel">{{ trans('texts.refund_payment') }}</h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal-footer" style="margin-top: 2px">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">{{ trans('texts.cancel') }}</button>
|
||||
<button type="button" class="btn btn-primary" id="completeRefundButton">{{ trans('texts.refund') }}</button>
|
||||
</div>
|
||||
<div class="container" style="width: 100%; padding-bottom: 0px !important">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-body">
|
||||
<div class="form-horizontal">
|
||||
<div class="form-group">
|
||||
<label for="refundAmount" class="col-sm-offset-2 col-sm-2 control-label">{{ trans('texts.amount') }}</label>
|
||||
<div class="col-sm-4">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon" id="refundCurrencySymbol"></span>
|
||||
<input type="number" class="form-control" id="refundAmount" name="refund_amount" step="0.01" min="0.01" placeholder="{{ trans('texts.amount') }}">
|
||||
</div>
|
||||
<div class="help-block">{{ trans('texts.refund_max') }} <span id="refundMax"></span></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-offset-2 col-sm-2 control-label"></label>
|
||||
<div class="col-sm-6">
|
||||
<div class="input-group">
|
||||
{!! Former::checkbox('refund_email')->text('send_email_to_client')->raw() !!}
|
||||
</div>
|
||||
</div>
|
||||
</div><br/>
|
||||
|
||||
<div id="refundLocalWarning" class="text-muted">
|
||||
{{ trans('texts.warning_local_refund') }}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal-footer" style="margin-top: 2px">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">{{ trans('texts.cancel') }}</button>
|
||||
<button type="button" class="btn btn-primary" id="completeRefundButton">{{ trans('texts.refund') }}</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
var paymentId = null;
|
||||
function showRefundModal(id, amount, formatted, symbol) {
|
||||
paymentId = id;
|
||||
$('#refundCurrencySymbol').text(symbol);
|
||||
$('#refundMax').text(formatted);
|
||||
$('#refundAmount').val(amount).attr('max', amount);
|
||||
$('#paymentRefundModal').modal('show');
|
||||
}
|
||||
var paymentId = null;
|
||||
function showRefundModal(id, amount, formatted, symbol, local) {
|
||||
paymentId = id;
|
||||
$('#refundCurrencySymbol').text(symbol);
|
||||
$('#refundMax').text(formatted);
|
||||
$('#refundAmount').val(amount).attr('max', amount);
|
||||
$('#refundLocalWarning').toggle(!!local);
|
||||
$('#paymentRefundModal').modal('show');
|
||||
}
|
||||
|
||||
function onRefundClicked(){
|
||||
$('#completeRefundButton').prop('disabled', true);
|
||||
submitForm_payment('refund', paymentId);
|
||||
}
|
||||
function onRefundClicked(){
|
||||
$('#completeRefundButton').prop('disabled', true);
|
||||
submitForm_payment('refund', paymentId);
|
||||
}
|
||||
|
||||
function onRefundEmailChange() {
|
||||
if (! isStorageSupported()) {
|
||||
return;
|
||||
function onRefundEmailChange() {
|
||||
if (! isStorageSupported()) {
|
||||
return;
|
||||
}
|
||||
var checked = $('#refund_email').is(':checked');
|
||||
localStorage.setItem('last:send_refund_email', checked ? true : '');
|
||||
}
|
||||
|
||||
$(function() {
|
||||
$('#completeRefundButton').click(onRefundClicked);
|
||||
$('#refund_email').click(onRefundEmailChange);
|
||||
|
||||
if (isStorageSupported()) {
|
||||
if (localStorage.getItem('last:send_refund_email')) {
|
||||
$('#refund_email').prop('checked', true);
|
||||
}
|
||||
var checked = $('#refund_email').is(':checked');
|
||||
localStorage.setItem('last:send_refund_email', checked ? true : '');
|
||||
}
|
||||
|
||||
$(function() {
|
||||
$('#completeRefundButton').click(onRefundClicked);
|
||||
$('#refund_email').click(onRefundEmailChange);
|
||||
|
||||
if (isStorageSupported()) {
|
||||
if (localStorage.getItem('last:send_refund_email')) {
|
||||
$('#refund_email').prop('checked', true);
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
</script>
|
||||
|
Loading…
Reference in New Issue
Block a user