1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-20 00:11:35 +02:00

Clarify credit error

This commit is contained in:
Hillel Coren 2020-03-29 09:25:52 +03:00
parent 43f38d9d84
commit fceb82ea51

View File

@ -263,13 +263,25 @@
$('#saveButton').attr('disabled', false); $('#saveButton').attr('disabled', false);
canSubmitPayment = true; canSubmitPayment = true;
var error = ''; var error = '{{ trans('texts.error_refresh_page') }}';
if (data) { if (data) {
var error = firstJSONError(data.responseJSON) || data.statusText; error = firstPaymentError(data.responseJSON);
} }
swal({!! json_encode(trans('texts.error_refresh_page')) !!}, error);
swal({title: '{{ trans('texts.an_error_occurred') }}', text: error});
} }
function firstPaymentError(json) {
json = json['errors'];
for (var key in json) {
if ( ! json.hasOwnProperty(key)) {
continue;
}
return json[key] + '';
}
return '';
}
function submitAction(action) { function submitAction(action) {
$('#action').val(action); $('#action').val(action);
$('.main-form').submit(); $('.main-form').submit();