|
|
@ -1385,33 +1385,35 @@ input[type=number]::-webkit-outer-spin-button { |
|
|
|
|
|
|
|
// 2 minutes in seconds |
|
|
|
// let timeLeft = 120; // 2 minutes in seconds |
|
|
|
let timerId; |
|
|
|
let canResend = true; |
|
|
|
let timeLeft = 120; |
|
|
|
|
|
|
|
function startTimer() { |
|
|
|
timerId = setInterval(() => { |
|
|
|
if (timeLeft <= 0) { |
|
|
|
clearInterval(timerId); |
|
|
|
timerDisplay.textContent = "Code expired"; |
|
|
|
timerDisplay.classList.add('expired'); |
|
|
|
// inputs.forEach(input => input.disabled = true); |
|
|
|
$("#otp-not-found").css("display","block") |
|
|
|
// canResend = false; |
|
|
|
} else { |
|
|
|
const minutes = Math.floor(timeLeft / 60); |
|
|
|
const seconds = timeLeft % 60; |
|
|
|
timerDisplay.textContent = `(${minutes}:${seconds.toString().padStart(2, '0')})`; |
|
|
|
timeLeft--; |
|
|
|
} |
|
|
|
}, 1000); |
|
|
|
} |
|
|
|
// function TimerClock() { |
|
|
|
|
|
|
|
var timerId; |
|
|
|
function startTimer() { |
|
|
|
let canResend = true; |
|
|
|
let timeLeft = 120; |
|
|
|
timerId = setInterval(() => { |
|
|
|
if (timeLeft <= 0) { |
|
|
|
clearInterval(timerId); |
|
|
|
timerDisplay.textContent = "Code expired"; |
|
|
|
timerDisplay.classList.add('expired'); |
|
|
|
// inputs.forEach(input => input.disabled = true); |
|
|
|
$("#otp-not-found").css("display","block") |
|
|
|
// canResend = false; |
|
|
|
} else { |
|
|
|
const minutes = Math.floor(timeLeft / 60); |
|
|
|
const seconds = timeLeft % 60; |
|
|
|
timerDisplay.textContent = `(${minutes}:${seconds.toString().padStart(2, '0')})`; |
|
|
|
timeLeft--; |
|
|
|
} |
|
|
|
}, 1000); |
|
|
|
} |
|
|
|
// } |
|
|
|
|
|
|
|
function resendOTP() { |
|
|
|
if (canResend) { |
|
|
|
// alert("New OTP sent!"); |
|
|
|
|
|
|
|
timeLeft = 120; |
|
|
|
let timeLeft = 120; |
|
|
|
inputs.forEach(input => { |
|
|
|
input.value = ''; |
|
|
|
input.disabled = false; |
|
|
@ -1453,14 +1455,14 @@ input[type=number]::-webkit-outer-spin-button { |
|
|
|
function verifyOTP() { |
|
|
|
const otp = Array.from(inputs).map(input => input.value).join(''); |
|
|
|
if (otp.length === 6) { |
|
|
|
if (timeLeft > 0) { |
|
|
|
handleVerifyOTP(otp) |
|
|
|
// alert(`Verifying OTP: ${otp}`); |
|
|
|
} else { |
|
|
|
const invalidMsg = document.getElementById('invalid-otp-msg'); |
|
|
|
invalidMsg.textContent = 'OTP has expired. Please request a new one.' |
|
|
|
// alert('OTP has expired. Please request a new one.'); |
|
|
|
} |
|
|
|
handleVerifyOTP(otp) |
|
|
|
// if (timeLeft > 0) { |
|
|
|
// // alert(`Verifying OTP: ${otp}`); |
|
|
|
// } else { |
|
|
|
// const invalidMsg = document.getElementById('invalid-otp-msg'); |
|
|
|
// invalidMsg.textContent = 'OTP has expired. Please request a new one.' |
|
|
|
// // alert('OTP has expired. Please request a new one.'); |
|
|
|
// } |
|
|
|
} else { |
|
|
|
const invalidMsg = document.getElementById('invalid-otp-msg'); |
|
|
|
invalidMsg.textContent = 'Please enter a 6-digit OTP' |
|
|
@ -1469,6 +1471,7 @@ input[type=number]::-webkit-outer-spin-button { |
|
|
|
} |
|
|
|
// } |
|
|
|
function sendOTP() { |
|
|
|
// TimerClock() |
|
|
|
var name = $("#input-Name").val(); |
|
|
|
var phoneno = $("#input-PhoneNo").val(); |
|
|
|
var email = $("#input-Email").val(); |
|
|
@ -1804,9 +1807,15 @@ input[type=number]::-webkit-outer-spin-button { |
|
|
|
}) |
|
|
|
} |
|
|
|
function handleClosePopUp() { |
|
|
|
$(document).ready(function () { |
|
|
|
$(".closeDialog").trigger("click"); |
|
|
|
}); |
|
|
|
// $(document).ready(function () { |
|
|
|
const invalidMsg = document.getElementById('invalid-otp-msg'); |
|
|
|
invalidMsg.textContent = '' |
|
|
|
inputs.forEach(input => { |
|
|
|
input.value = ''; |
|
|
|
}); |
|
|
|
clearInterval(timerId); |
|
|
|
$(".closeDialog").trigger("click"); |
|
|
|
// }); |
|
|
|
} |
|
|
|
function handlehideARN() { |
|
|
|
$('.arn-class').toggle(); |
|
|
|