mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-08 22:44:30 -04:00
Handle save invoice token error
This commit is contained in:
parent
a066071cca
commit
ca6a28e817
@ -1429,13 +1429,14 @@
|
|||||||
$('#saveButton, #emailButton, #draftButton').attr('disabled', true);
|
$('#saveButton, #emailButton, #draftButton').attr('disabled', true);
|
||||||
// if save fails ensure user can try again
|
// if save fails ensure user can try again
|
||||||
$.post('{{ url($url) }}', $('.main-form').serialize(), function(data) {
|
$.post('{{ url($url) }}', $('.main-form').serialize(), function(data) {
|
||||||
|
if (data && data.startsWith('http')) {
|
||||||
NINJA.formIsChanged = false;
|
NINJA.formIsChanged = false;
|
||||||
location.href = data;
|
location.href = data;
|
||||||
|
} else {
|
||||||
|
handleSaveFailed();
|
||||||
|
}
|
||||||
}).fail(function(data) {
|
}).fail(function(data) {
|
||||||
$('#saveButton, #emailButton, #draftButton').attr('disabled', false);
|
handleSaveFailed(data);
|
||||||
$('#emailModal div.modal-footer button').attr('disabled', false);
|
|
||||||
var error = firstJSONError(data.responseJSON) || data.statusText;
|
|
||||||
swal("{!! trans('texts.invoice_save_error') !!}", error);
|
|
||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
@else
|
@else
|
||||||
@ -1443,6 +1444,16 @@
|
|||||||
@endif
|
@endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function handleSaveFailed(data) {
|
||||||
|
$('#saveButton, #emailButton, #draftButton').attr('disabled', false);
|
||||||
|
$('#emailModal div.modal-footer button').attr('disabled', false);
|
||||||
|
var error = '';
|
||||||
|
if (data) {
|
||||||
|
var error = firstJSONError(data.responseJSON) || data.statusText;
|
||||||
|
}
|
||||||
|
swal("{!! trans('texts.invoice_save_error') !!}", error);
|
||||||
|
}
|
||||||
|
|
||||||
function submitBulkAction(value) {
|
function submitBulkAction(value) {
|
||||||
$('#bulk_action').val(value);
|
$('#bulk_action').val(value);
|
||||||
$('.bulkForm')[0].submit();
|
$('.bulkForm')[0].submit();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user