feat: admin module

fix: mobile number
This commit is contained in:
2025-12-23 13:33:30 +05:30
parent 2f4858927c
commit 1a57f18d40
5 changed files with 80 additions and 6 deletions

View File

@@ -32,6 +32,7 @@ import {
IconFileText, IconFileText,
IconCircleDot, IconCircleDot,
} from "@tabler/icons-react"; } from "@tabler/icons-react";
import { useSearchParams } from "next/navigation";
interface accountData { interface accountData {
stAccountNo: string; stAccountNo: string;
@@ -48,6 +49,9 @@ export default function App() {
const [authorized, setAuthorized] = useState<boolean | null>(null); const [authorized, setAuthorized] = useState<boolean | null>(null);
const [accountDetails, setAccountDetails] = useState<accountData | null>(null); const [accountDetails, setAccountDetails] = useState<accountData | null>(null);
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
const searchParams = useSearchParams();
const passedAccNo = searchParams.get("accNo");
useEffect(() => { useEffect(() => {
const token = localStorage.getItem("access_token"); const token = localStorage.getItem("access_token");
@@ -73,6 +77,17 @@ export default function App() {
} }
}, [authorized]); }, [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) => { const handleAccountSelection = async (accNo: string | null) => {
setSelectedAccNo(accNo); setSelectedAccNo(accNo);
setAccountDetails(null); setAccountDetails(null);

View File

@@ -350,6 +350,7 @@ export default function AddBeneficiaryOthers() {
val = val.replace(/[^A-Z0-9]/g, ""); // block special chars val = val.replace(/[^A-Z0-9]/g, ""); // block special chars
setIfsccode(val); setIfsccode(val);
}} }}
readOnly={isVisibilityLocked}
maxLength={11} maxLength={11}
withAsterisk withAsterisk
/> />
@@ -437,7 +438,7 @@ export default function AddBeneficiaryOthers() {
value={nickName} value={nickName}
required required
onChange={(e) => setNickName(e.currentTarget.value)} onChange={(e) => setNickName(e.currentTarget.value)}
readOnly={isVisibilityLocked}
/> />
</Grid.Col> </Grid.Col>
<Grid.Col span={4}> <Grid.Col span={4}>

View File

@@ -178,6 +178,65 @@ export default function RootLayout({ children }: { children: React.ReactNode })
clearInterval(countdownTimer); 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 = [ const navItems = [
{ href: "/home", label: "Home", icon: IconHome }, { href: "/home", label: "Home", icon: IconHome },

View File

@@ -14,8 +14,8 @@ interface SendOtpPayload {
} }
function getStoredMobileNumber(): string { function getStoredMobileNumber(): string {
//const mobileNumber = localStorage.getItem('remitter_mobile_no'); const mobileNumber = localStorage.getItem('remitter_mobile_no');
const mobileNumber = "6297421727"; // const mobileNumber = "7890544527";
if (!mobileNumber) throw new Error('Mobile number not found.'); if (!mobileNumber) throw new Error('Mobile number not found.');
return mobileNumber; return mobileNumber;
} }

View File

@@ -68,9 +68,8 @@ export default function Login() {
async function handleVerifyOtp(mobile?: string) { async function handleVerifyOtp(mobile?: string) {
try { try {
if (mobile) { if (mobile) {
//await verifyLoginOtp(otp, mobile); await verifyLoginOtp(otp, mobile);
await verifyLoginOtp(otp, '6297421727'); // await verifyLoginOtp(otp, '7890544527');
return true; return true;
} }
} }