amol 10 months ago
parent
commit
42ee4a073f
1 changed files with 41 additions and 32 deletions
  1. +41
    -32
      campaign.html

+ 41
- 32
campaign.html View File

@ -1428,33 +1428,35 @@ input[type=number]::-webkit-outer-spin-button {
// 2 minutes in seconds // 2 minutes in seconds
// let timeLeft = 120; // 2 minutes in seconds // let timeLeft = 120; // 2 minutes in seconds
let timerId;
// function TimerClock() {
var timerId;
let canResend = true; 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 startTimer() {
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() { function resendOTP() {
if (canResend) { if (canResend) {
// alert("New OTP sent!"); // alert("New OTP sent!");
timeLeft = 120;
let timeLeft = 120;
inputs.forEach(input => { inputs.forEach(input => {
input.value = ''; input.value = '';
input.disabled = false; input.disabled = false;
@ -1496,14 +1498,14 @@ input[type=number]::-webkit-outer-spin-button {
function verifyOTP() { function verifyOTP() {
const otp = Array.from(inputs).map(input => input.value).join(''); const otp = Array.from(inputs).map(input => input.value).join('');
if (otp.length === 6) { 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 { } else {
const invalidMsg = document.getElementById('invalid-otp-msg'); const invalidMsg = document.getElementById('invalid-otp-msg');
invalidMsg.textContent = 'Please enter a 6-digit OTP' invalidMsg.textContent = 'Please enter a 6-digit OTP'
@ -1512,6 +1514,7 @@ input[type=number]::-webkit-outer-spin-button {
} }
// } // }
function sendOTP() { function sendOTP() {
// TimerClock()
var name = $("#input-Name").val(); var name = $("#input-Name").val();
var phoneno = $("#input-PhoneNo").val(); var phoneno = $("#input-PhoneNo").val();
var email = $("#input-Email").val(); var email = $("#input-Email").val();
@ -1847,9 +1850,15 @@ input[type=number]::-webkit-outer-spin-button {
}) })
} }
function handleClosePopUp() { 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() { function handlehideARN() {
$('.arn-class').toggle(); $('.arn-class').toggle();


Loading…
Cancel
Save

Powered by TurnKey Linux.