Skip to content

Commit

Permalink
fix: added spinner for exam publish btn
Browse files Browse the repository at this point in the history
Fixes #1085
  • Loading branch information
blt950 committed Dec 21, 2024
1 parent 013b638 commit 061bdfe
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion resources/views/training/exam/create.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,9 @@ class="form-control"
</div>
</div>

<button type="submit" id="training-submit-btn" class="btn btn-success mt-3">Publish examination report</button>
<button type="submit" id="exam-submit-btn" class="btn btn-success mt-3" onclick="handleSubmit(event)">Publish examination report
<div class="submit-spinner spinner-border spinner-border-sm" role="status" style="display: none;">&nbsp;</div>
</button>
</form>
</div>
</div>
Expand Down Expand Up @@ -187,6 +189,13 @@ class="form-control"
var defaultDate = "{{ old('date') }}"
document.querySelector('.datepicker').flatpickr({ disableMobile: true, minDate: "{!! date('Y-m-d', strtotime('-1 months')) !!}", maxDate: "{!! date('Y-m-d') !!}", dateFormat: "d/m/Y", defaultDate: defaultDate, locale: {firstDayOfWeek: 1 } });
})
function handleSubmit(event) {
event.preventDefault();
document.querySelector('.submit-spinner').style.display = 'inherit';
event.target.disabled = true;
event.target.closest('form').submit();
}
</script>

@endsection

0 comments on commit 061bdfe

Please sign in to comment.