diff --git a/src/app/(main)/accounts/account_statement/accountStatement.tsx b/src/app/(main)/accounts/account_statement/accountStatement.tsx index 3a9033b..96fa2e0 100644 --- a/src/app/(main)/accounts/account_statement/accountStatement.tsx +++ b/src/app/(main)/accounts/account_statement/accountStatement.tsx @@ -207,7 +207,10 @@ export default function AccountStatementPage() { size={22} style={{ cursor: "pointer" }} onClick={() => - generatePDF(selectedAccNo || "", availableBalance || "0", transactions) + generatePDF(selectedAccNo || "", availableBalance || "0", transactions, + localStorage.getItem("remitter_name") || "", + startDate ? dayjs(startDate).format("DD/MM/YYYY") : "", + endDate ? dayjs(endDate).format("DD/MM/YYYY") : "") } /> - + diff --git a/src/app/(main)/home/page.tsx b/src/app/(main)/home/page.tsx index 986bb0d..48c9757 100644 --- a/src/app/(main)/home/page.tsx +++ b/src/app/(main)/home/page.tsx @@ -41,20 +41,18 @@ export default function Home() { sessionStorage.clear(); router.push("/login"); }; - // const handleBeforeUnload = () => { - // // logout on tab close / refresh - // localStorage.removeItem("access_token"); - // sessionStorage.removeItem("access_token"); - // localStorage.removeItem("remitter_name"); - // localStorage.removeItem("pswExpiryDate"); - // localStorage.clear(); - // sessionStorage.clear(); - // }; + const handleBeforeUnload = () => { + // logout on tab close / refresh + localStorage.removeItem("access_token"); + sessionStorage.removeItem("access_token"); + localStorage.clear(); + sessionStorage.clear(); + }; window.addEventListener("popstate", handlePopState); - // window.addEventListener("beforeunload", handleBeforeUnload); + window.addEventListener("beforeunload", handleBeforeUnload); return () => { window.removeEventListener("popstate", handlePopState); - // window.addEventListener("beforeunload", handleBeforeUnload); + window.addEventListener("beforeunload", handleBeforeUnload); }; }, []); diff --git a/src/app/(main)/layout.tsx b/src/app/(main)/layout.tsx index f56c78e..c245356 100644 --- a/src/app/(main)/layout.tsx +++ b/src/app/(main)/layout.tsx @@ -9,9 +9,6 @@ import logo from '@/app/image/logo1.jpg'; import NextImage from 'next/image'; import { notifications } from '@mantine/notifications'; import { useDisclosure } from '@mantine/hooks'; -import { Dialog } from '@mantine/core'; - - export default function RootLayout({ children }: { children: React.ReactNode }) { const router = useRouter(); @@ -89,18 +86,16 @@ export default function RootLayout({ children }: { children: React.ReactNode }) }; const handleBeforeUnload = (e: BeforeUnloadEvent) => { // logout on tab close / refresh - // localStorage.removeItem("access_token"); - // sessionStorage.removeItem("access_token"); - // localStorage.removeItem("remitter_name"); - // localStorage.removeItem("pswExpiryDate"); - // localStorage.clear(); - // sessionStorage.clear(); + localStorage.removeItem("access_token"); + sessionStorage.removeItem("access_token"); + localStorage.clear(); + sessionStorage.clear(); }; window.addEventListener("popstate", handlePopState); - // window.addEventListener("beforeunload", handleBeforeUnload); + window.addEventListener("beforeunload", handleBeforeUnload); return () => { window.removeEventListener("popstate", handlePopState); - // window.addEventListener("beforeunload", handleBeforeUnload); + window.addEventListener("beforeunload", handleBeforeUnload); }; }, []); @@ -276,7 +271,7 @@ export default function RootLayout({ children }: { children: React.ReactNode }) - diff --git a/src/app/ForgetPassword/page.tsx b/src/app/ForgetPassword/page.tsx index 21c0f99..9e58864 100644 --- a/src/app/ForgetPassword/page.tsx +++ b/src/app/ForgetPassword/page.tsx @@ -120,18 +120,18 @@ export default function ForgetLoginPwd() { } } - useEffect(() => { - const token = localStorage.getItem("access_token"); - if (!token) { - SetAuthorized(false); - router.push("/login"); - } - else { - SetAuthorized(true); - } - }, []); + // useEffect(() => { + // const token = localStorage.getItem("access_token"); + // if (!token) { + // SetAuthorized(false); + // router.push("/login"); + // } + // else { + // SetAuthorized(true); + // } + // }, []); - if (authorized) { + // if (authorized) { return (
@@ -265,5 +265,5 @@ export default function ForgetLoginPwd() {
); - } + // } } \ No newline at end of file diff --git a/src/app/SetPassword/page.module.css b/src/app/SetPassword/page.module.css deleted file mode 100644 index 7fb5753..0000000 --- a/src/app/SetPassword/page.module.css +++ /dev/null @@ -1,62 +0,0 @@ -.root { - width: 100vw; - height: 100vh; - - } - -.title { - color: light-dark(var(--mantine-color-black), var(--mantine-color-white)); - font-family: - Greycliff CF, - var(--mantine-font-family); -} - - - .mobileImage { - @media (min-width: 48em) { - display: none; - } - } - -.desktopImage { - object-fit: cover; - width: 100%; - height: 100%; - @media (max-width: 47.99em) { - display: none; - } - } - -.carousel-wrapper { - width: 100%; - max-width: 800px; - margin: 0 auto; - overflow: hidden; -} - -.gradient-control { - width: 15%; - height: 100%; - position: absolute; - top: 0; - z-index: 2; - background-color: transparent; - display: flex; - align-items: center; - justify-content: center; - opacity: 0.6; - color: white; - pointer-events: all; -} - -/* First control is left */ -.gradient-control:first-of-type { - left: 0; - background-image: linear-gradient(to right, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.0001)); -} - -/* Last control is right */ -.gradient-control:last-of-type { - right: 0; - background-image: linear-gradient(to left, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.0001)); -} diff --git a/src/app/SetPassword/page.tsx b/src/app/SetPassword/page.tsx index a60cba8..07da2ff 100644 --- a/src/app/SetPassword/page.tsx +++ b/src/app/SetPassword/page.tsx @@ -157,14 +157,10 @@ export default function SetLoginPwd() { router.push("/login"); } } - useEffect(() => { - const loadCaptcha = async () => { - const newCaptcha = await generateCaptcha(); - setCaptcha(newCaptcha); - }; - loadCaptcha(); + useEffect(() => { + regenerateCaptcha(); }, []); - + useEffect(() => { let interval: number | undefined; if (timerActive && countdown > 0) { @@ -195,7 +191,7 @@ export default function SetLoginPwd() { if (authorized) { return ( -
+
(null); const validUsers = [ { cif: "11111111111", mobile: "7890544527" }, @@ -72,7 +73,7 @@ export default function ValidateUser() { }; const handleSubmitOtp = () => { - if(!otp){ + if (!otp) { notifications.show({ title: "Invalid OTP", message: "Please Enter OTP Before You Submit.", @@ -100,17 +101,72 @@ export default function ValidateUser() { } + useEffect(() => { + const headerData = [ + "THE KANGRA CENTRAL CO-OPERATIVE BANK LTD.", + "कांगड़ा केन्द्रीय सहकारी बैंक सीमित", + ]; + let index = 0; + const interval = setInterval(() => { + index = (index + 1) % headerData.length; + if (headerRef.current) { + headerRef.current.textContent = headerData[index]; + } + }, 2000); + return () => clearInterval(interval); + }, []); + return (
- - ebanking + + ebanking + + THE KANGRA CENTRAL CO-OPERATIVE BANK LTD. + + + Head Office : Dharmshala, District: Kangra(H.P), Pin: 176215 + + {/* + + + + */} Change Password Image @@ -123,10 +179,10 @@ export default function ValidateUser() { // @ts-ignore Welcome {" "}{Cif} )} -
{ + { e.preventDefault(); - isCifValidated?handleSubmitOtp():handleValidateUser(e); - }}> + isCifValidated ? handleSubmitOtp() : handleValidateUser(e); + }}> { const html2pdf = require("html2pdf.js"); - // Header with logo + bank name + generated date - const headerHTML = ` -
-
- Bank Logo -

The Kangra Central Co Operative Bank

-
-
- Report generated: ${dayjs().format("DD/MM/YYYY HH:mm")} -
-
-
- `; - - // Table rows + // Build rows const rows = txns.map( (t: any) => ` + ${t.date} ${t.name} - ${t.date} ${parseFloat(t.amount).toLocaleString("en-IN", { @@ -38,20 +27,34 @@ export const generatePDF = ( ` ); + // Content for first page const content = `
- ${headerHTML} -

Account Statement

+
+
+ Bank Logo +

The Kangra Central Co Operative Bank

+
+
+ Report generated: ${dayjs().format("DD/MM/YYYY HH:mm")} +
+
+
+ +

Account Statement

Account No: ${accountNo}

-

Available Balance: ₹ ${parseFloat( - balance - ).toLocaleString("en-IN", { minimumFractionDigits: 2 })}

- +

Account Holder: ${customerName}

+

Statement Period: ${periodFrom} to ${periodTo}

+

Available Balance: ₹ ${parseFloat(balance).toLocaleString( + "en-IN", + { minimumFractionDigits: 2 } + )}

+ - - + + @@ -59,15 +62,12 @@ export const generatePDF = ( ${rows.join("")}
NameDateDateDescription Amount (₹)
- -
`; - // PDF options const opt = { - margin: [10, 10, 20, 10], // bottom margin for page count - filename: `AccountStatement_${accountNo}.pdf`, + margin: [20, 10, 20, 10], + filename: `AccountStatement_${accountNo}_${dayjs().format("DD/MM/YYYY HH:mm")}.pdf`, image: { type: "jpeg", quality: 0.98 }, html2canvas: { scale: 2 }, jsPDF: { unit: "mm", format: "a4", orientation: "portrait" }, @@ -81,12 +81,29 @@ export const generatePDF = ( .get("pdf") .then((pdf: any) => { const totalPages = pdf.internal.getNumberOfPages(); - for (let i = 1; i <= totalPages; i++) { + const pageWidth = pdf.internal.pageSize.getWidth(); + + for (let i = 2; i <= totalPages; i++) { pdf.setPage(i); pdf.setFontSize(10); + + // ✅ Left side Account No + pdf.setFont("helvetica", "bold"); + // pdf.text(`Account No: ${accountNo}`, 15, 18); + + // ✅ Centered Statement Period + pdf.text( + `Statement Period: ${periodFrom} to ${periodTo}`, + pageWidth / 2, + 18, + { align: "center" } + ); + + // Footer page numbers + pdf.setFontSize(9); pdf.text( `Page ${i} of ${totalPages}`, - pdf.internal.pageSize.getWidth() - 40, + pageWidth - 40, pdf.internal.pageSize.getHeight() - 10 ); } diff --git a/src/app/administrator/home/ViewUserConfiguration.tsx b/src/app/administrator/home/ViewUserConfiguration.tsx index 0e5e7bf..2dc4bf8 100644 --- a/src/app/administrator/home/ViewUserConfiguration.tsx +++ b/src/app/administrator/home/ViewUserConfiguration.tsx @@ -126,7 +126,7 @@ export default function ViewUserRights() { {new Date(userData.created_at).toLocaleString()} - User Active Status: + User Status: Active