1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 05:02:36 +01:00

Duplicate payments

This commit is contained in:
Hillel Coren 2019-09-29 12:02:30 +03:00
parent be39bf93d2
commit ae672a25b1

View File

@ -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;