From 1a57f18d4072f910621ac1ab0d7e6c9c15e9fd86 Mon Sep 17 00:00:00 2001 From: "tomosa.sarkar" Date: Tue, 23 Dec 2025 13:33:30 +0530 Subject: [PATCH] feat: admin module fix: mobile number --- .../(main)/accounts/account_details/page.tsx | 15 +++++ .../add_beneficiary/addBeneficiaryOthers.tsx | 3 +- src/app/(main)/layout.tsx | 59 +++++++++++++++++++ src/app/_util/otp.ts | 4 +- src/app/login/page.tsx | 5 +- 5 files changed, 80 insertions(+), 6 deletions(-) diff --git a/src/app/(main)/accounts/account_details/page.tsx b/src/app/(main)/accounts/account_details/page.tsx index cf639d6..99eabe8 100644 --- a/src/app/(main)/accounts/account_details/page.tsx +++ b/src/app/(main)/accounts/account_details/page.tsx @@ -32,6 +32,7 @@ import { IconFileText, IconCircleDot, } from "@tabler/icons-react"; +import { useSearchParams } from "next/navigation"; interface accountData { stAccountNo: string; @@ -48,6 +49,9 @@ export default function App() { const [authorized, setAuthorized] = useState(null); const [accountDetails, setAccountDetails] = useState(null); const [loading, setLoading] = useState(false); + const searchParams = useSearchParams(); + const passedAccNo = searchParams.get("accNo"); + useEffect(() => { const token = localStorage.getItem("access_token"); @@ -73,6 +77,17 @@ export default function App() { } }, [authorized]); + useEffect(() => { + if (authorized && passedAccNo && accountOptions.length > 0) { + // auto select account + setSelectedAccNo(passedAccNo); + + // reuse existing logic + handleAccountSelection(passedAccNo); + } + }, [authorized, passedAccNo, accountOptions]); + + const handleAccountSelection = async (accNo: string | null) => { setSelectedAccNo(accNo); setAccountDetails(null); diff --git a/src/app/(main)/beneficiary/add_beneficiary/addBeneficiaryOthers.tsx b/src/app/(main)/beneficiary/add_beneficiary/addBeneficiaryOthers.tsx index 97395e9..2305107 100644 --- a/src/app/(main)/beneficiary/add_beneficiary/addBeneficiaryOthers.tsx +++ b/src/app/(main)/beneficiary/add_beneficiary/addBeneficiaryOthers.tsx @@ -350,6 +350,7 @@ export default function AddBeneficiaryOthers() { val = val.replace(/[^A-Z0-9]/g, ""); // block special chars setIfsccode(val); }} + readOnly={isVisibilityLocked} maxLength={11} withAsterisk /> @@ -437,7 +438,7 @@ export default function AddBeneficiaryOthers() { value={nickName} required onChange={(e) => setNickName(e.currentTarget.value)} - + readOnly={isVisibilityLocked} /> diff --git a/src/app/(main)/layout.tsx b/src/app/(main)/layout.tsx index 80dc0c3..4a42436 100644 --- a/src/app/(main)/layout.tsx +++ b/src/app/(main)/layout.tsx @@ -178,6 +178,65 @@ export default function RootLayout({ children }: { children: React.ReactNode }) clearInterval(countdownTimer); }; }, []); + + // useEffect(() => { + // const INACTIVITY_LIMIT = 5 * 60 * 1000; // 5 minutes + // let inactivityTimer: NodeJS.Timeout; + // let countdownTimer: NodeJS.Timeout; + // let isSessionExpired = false; // lock flag + + // const startLogoutCountdown = () => { + // isSessionExpired = true; // lock session + // setSessionModal(true); + // setCountdown(30); + + // countdownTimer = setInterval(() => { + // setCountdown((prev) => { + // if (prev <= 1) { + // clearInterval(countdownTimer); + // doLogout(); + // return 0; + // } + // return prev - 1; + // }); + // }, 1000); + // }; + + // const resetInactivityTimer = () => { + // // If modal already shown, ignore ALL activity + // if (isSessionExpired) return; + + // clearTimeout(inactivityTimer); + + // inactivityTimer = setTimeout(() => { + // startLogoutCountdown(); + // }, INACTIVITY_LIMIT); + // }; + + // const activityEvents = [ + // "mousemove", + // "mousedown", + // "keydown", + // "scroll", + // "touchstart", + // "click", + // ]; + + // activityEvents.forEach((event) => + // window.addEventListener(event, resetInactivityTimer) + // ); + + // // Start timer on load + // resetInactivityTimer(); + + // return () => { + // activityEvents.forEach((event) => + // window.removeEventListener(event, resetInactivityTimer) + // ); + // clearTimeout(inactivityTimer); + // clearInterval(countdownTimer); + // }; + // }, []); const navItems = [ { href: "/home", label: "Home", icon: IconHome }, diff --git a/src/app/_util/otp.ts b/src/app/_util/otp.ts index 8a0d146..7a70463 100644 --- a/src/app/_util/otp.ts +++ b/src/app/_util/otp.ts @@ -14,8 +14,8 @@ interface SendOtpPayload { } function getStoredMobileNumber(): string { - //const mobileNumber = localStorage.getItem('remitter_mobile_no'); - const mobileNumber = "6297421727"; + const mobileNumber = localStorage.getItem('remitter_mobile_no'); + // const mobileNumber = "7890544527"; if (!mobileNumber) throw new Error('Mobile number not found.'); return mobileNumber; } diff --git a/src/app/login/page.tsx b/src/app/login/page.tsx index 3724d1a..912d3e9 100644 --- a/src/app/login/page.tsx +++ b/src/app/login/page.tsx @@ -68,9 +68,8 @@ export default function Login() { async function handleVerifyOtp(mobile?: string) { try { if (mobile) { - //await verifyLoginOtp(otp, mobile); - await verifyLoginOtp(otp, '6297421727'); - + await verifyLoginOtp(otp, mobile); + // await verifyLoginOtp(otp, '7890544527'); return true; } }