mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-18 13:05:42 +00:00
Add a progress spinner to modal forms
This commit is contained in:
@ -730,6 +730,9 @@ function submitFormData(fields, options) {
|
||||
data = options.processBeforeUpload(data);
|
||||
}
|
||||
|
||||
// Show the progress spinner
|
||||
$(options.modal).find('#modal-progress-spinner').show();
|
||||
|
||||
// Submit data
|
||||
upload_func(
|
||||
options.url,
|
||||
@ -737,10 +740,13 @@ function submitFormData(fields, options) {
|
||||
{
|
||||
method: options.method,
|
||||
success: function(response) {
|
||||
$(options.modal).find('#modal-progress-spinner').hide();
|
||||
handleFormSuccess(response, options);
|
||||
},
|
||||
error: function(xhr) {
|
||||
|
||||
$(options.modal).find('#modal-progress-spinner').hide();
|
||||
|
||||
switch (xhr.status) {
|
||||
case 400:
|
||||
handleFormErrors(xhr.responseJSON, fields, options);
|
||||
|
@ -72,6 +72,7 @@ function createNewModal(options={}) {
|
||||
<!-- Extra buttons can be inserted here -->
|
||||
</div>
|
||||
<span class='flex-item' style='flex-grow: 1;'></span>
|
||||
<h4><span id='modal-progress-spinner' class='fas fa-circle-notch fa-spin' style='display: none;'></span></h4>
|
||||
<button type='button' class='btn btn-secondary' id='modal-form-close' data-bs-dismiss='modal'>{% trans "Cancel" %}</button>
|
||||
<button type='button' class='btn btn-primary' id='modal-form-submit'>{% trans "Submit" %}</button>
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user