mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-09 20:52:56 +01:00
Duplicate payments
This commit is contained in:
parent
0054616020
commit
fbb5826178
@ -14,7 +14,7 @@
|
||||
|
||||
@section('content')
|
||||
|
||||
{!! Former::open($url)
|
||||
{!! Former::open($payment ? $url : '')
|
||||
->addClass('col-lg-10 col-lg-offset-1 warn-on-exit main-form')
|
||||
->onsubmit('return onFormSubmit(event)')
|
||||
->method($method)
|
||||
@ -134,6 +134,7 @@
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
var canSubmitPayment = true;
|
||||
var invoices = {!! $invoices !!};
|
||||
var clients = {!! $clients !!};
|
||||
|
||||
@ -220,12 +221,13 @@
|
||||
});
|
||||
|
||||
function onFormSubmit(event) {
|
||||
if ($('#saveButton').is(':disabled')) {
|
||||
if (! canSubmitPayment) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@if ($payment)
|
||||
$('#saveButton').attr('disabled', true);
|
||||
canSubmitPayment = false;
|
||||
return true;
|
||||
@else
|
||||
// warn if amount is more than balance/credit will be created
|
||||
@ -235,6 +237,7 @@
|
||||
|
||||
if (NINJA.parseFloat(amount) <= invoice.balance || confirm("{{ trans('texts.amount_greater_than_balance') }}")) {
|
||||
$('#saveButton').attr('disabled', true);
|
||||
canSubmitPayment = false;
|
||||
submitAjax();
|
||||
return false;
|
||||
} else {
|
||||
@ -258,6 +261,8 @@
|
||||
|
||||
function handleSaveFailed(data) {
|
||||
$('#saveButton').attr('disabled', false);
|
||||
canSubmitPayment = true;
|
||||
|
||||
var error = '';
|
||||
if (data) {
|
||||
var error = firstJSONError(data.responseJSON) || data.statusText;
|
||||
|
Loading…
Reference in New Issue
Block a user