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