<script>
[Link]('DOMContentLoaded', function () {
// Listen for the submit button click
[Link]('scan-btn').addEventListener('click',
function (event) {
[Link](); // Prevent page reload
// Check authentication status at the time of button click
let isAuthenticated = checkAuthenticationStatus();
if (!isAuthenticated) {
alert("Please log in to Submit."); // Show alert if not
authenticated
} else {
submitForm(); // Proceed with form submission if
authenticated
}
});
function submitForm() {
// Show loader before submitting the form
var fileType = [Link]('document-
type').value;
[Link]('fileType').value = fileType;
showLoader(); // Show loading indicator
[Link]('capture-form').submit(); // Submit
the form
}
function showLoader() {
[Link]("loading").[Link] = "block";
}
function hideLoader() {
[Link]("loading").[Link] = "none";
}
// Hide loader once everything is loaded
[Link]('load', function () {
hideLoader();
});