- {isLoading?
:
- data.map(course => (
-
handleCourseSelection(course)}
- >
-
{course.courseName}
+
+
+
+
+ {sheet.map((sheet) => (
+
+ ))}
+
- ))}
+
);
};
-export default Wadhwani;
+export default Wadhwani;
\ No newline at end of file
diff --git a/src/modules/Public/Donation/Donation.tsx b/src/modules/Public/Donation/Donation.tsx
index cb73d64e8..ff489502f 100644
--- a/src/modules/Public/Donation/Donation.tsx
+++ b/src/modules/Public/Donation/Donation.tsx
@@ -255,13 +255,31 @@ const Donation = () => {
diff --git a/src/modules/Public/Donation/pages/DonationSuccess.module.css b/src/modules/Public/Donation/pages/DonationSuccess.module.css
new file mode 100644
index 000000000..d07430fe2
--- /dev/null
+++ b/src/modules/Public/Donation/pages/DonationSuccess.module.css
@@ -0,0 +1,209 @@
+.LClandingPage {
+ position: relative;
+ overflow-x: hidden;
+}
+
+.backgroundImage {
+ top: 0;
+ position: absolute;
+ z-index: -2;
+}
+
+.backgroundImage img {
+ width: 100vw;
+ height: 110vh;
+}
+
+.LClandingPageHero {
+ position: relative;
+ height: 100vh;
+ width: 100%;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ flex-direction: column;
+ text-align: center;
+ gap: 1rem;
+ padding-top: 5rem;
+}
+
+.LClandingPageHero span {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ gap: 1rem;
+ font-size: 3.5rem;
+ color: #000;
+}
+
+.LClandingPageHero span img {
+ position: relative;
+ top: 0.75rem;
+ height: 3rem;
+}
+
+.LClandingPageHero .dash {
+ position: absolute;
+ top: -50%;
+ width: 120%;
+ height: 100%;
+ border: 5px solid #accaf6;
+ border-style: dashed;
+ border-radius: 45%;
+}
+
+.LClandingPageHero .heroTitle b:nth-child(2) {
+ font-size: 4rem;
+ color: var(--blue);
+ position: relative;
+ top: -1rem;
+ background-image: linear-gradient(to right, #ddecff, #eaf3ff);
+ border-radius: 10%;
+ height: -1rem;
+ padding: 0rem 0.5rem;
+}
+
+.LClandingPageHero p {
+ width: 75%;
+ font-weight: 600;
+ font-size: 1.1rem;
+}
+
+.DonationSection {
+ display: flex;
+ justify-content: center;
+ margin-bottom: 6rem;
+}
+
+.DonationFormElement {
+ background: #fff;
+ box-shadow: -1.6px 6.4px 32px 3.2px rgba(0, 0, 0, 0.15);
+ width: 80%;
+ padding: 2rem;
+ text-align: center;
+ border-radius: 1rem;
+}
+
+.SuccessMessage {
+ margin-bottom: 2rem;
+}
+
+.SuccessMessage h1 {
+ font-size: 2rem;
+ margin-bottom: 0.5rem;
+}
+
+.SuccessMessage p {
+ font-size: 1.2rem;
+ color: #666;
+}
+
+.ButtonContainer {
+ display: flex;
+ justify-content: center;
+ gap: 1rem; /* Added gap between buttons */
+}
+
+.homeButton {
+ background-color: var(--blue);
+ color: #fff;
+ border: none;
+ border-radius: 0.5rem;
+ padding: 0.9rem 1.4rem;
+ font-size: 1.2rem;
+ cursor: pointer;
+ transition: background-color 0.3s ease;
+}
+
+.homeButton:hover {
+ background-color: #004aad;
+}
+
+.downloadButton {
+ background-color: #fff;
+ width: auto;
+ color: var(--blue);
+ border: 2px solid var(--blue);
+ border-radius: 0.5rem;
+ padding: 0.9rem 1.4rem;
+ margin-bottom: 1rem;
+}
+
+.downloadButton:hover {
+ background-color: var(--blue);
+ color: #fff;
+}
+
+@media (max-width: 820px) {
+ .LClandingPageHero span {
+ font-size: 1.7rem;
+ gap: 0.5rem;
+ }
+
+ .LClandingPageHero span img {
+ top: 0.5rem;
+ height: 2.2rem;
+ }
+
+ .LClandingPageHero .heroTitle b:nth-child(2) {
+ font-size: 2.5rem;
+ top: 0rem;
+ }
+
+ .LClandingPageHero p {
+ width: 90%;
+ font-size: 0.8rem;
+ }
+
+ .DonationFormElement {
+ width: 90%;
+ }
+
+ .homeButton,
+ .downloadButton {
+ font-size: 1rem;
+ padding: 0.7rem 1.2rem;
+ }
+}
+
+@media (max-width: 550px) {
+ .LClandingPageHero span {
+ font-size: 1.5rem;
+ }
+
+ .LClandingPageHero span img {
+ top: 0.3rem;
+ height: 2rem;
+ }
+
+ .DonationFormElement {
+ padding: 1.5rem;
+ }
+
+ .homeButton,
+ .downloadButton {
+ font-size: 0.9rem;
+ padding: 0.5rem 1rem;
+ }
+}
+
+@media (max-width: 380px) {
+ .LClandingPageHero span {
+ font-size: 1.2rem;
+ }
+
+ .LClandingPageHero span img {
+ top: 0.1rem;
+ height: 1.5rem;
+ }
+
+ .DonationFormElement {
+ padding: 1rem;
+ }
+
+ .homeButton,
+ .downloadButton {
+ font-size: 0.8rem;
+ padding: 0.4rem 0.8rem;
+ }
+}
diff --git a/src/modules/Public/Donation/pages/DonationSuccess.tsx b/src/modules/Public/Donation/pages/DonationSuccess.tsx
new file mode 100644
index 000000000..d26d1bd67
--- /dev/null
+++ b/src/modules/Public/Donation/pages/DonationSuccess.tsx
@@ -0,0 +1,108 @@
+import { Link } from "react-router-dom";
+import { useEffect } from "react";
+import Footer from "../components/Footer";
+import Navbar from "../components/Navbar";
+import styles from "./DonationSuccess.module.css";
+import NotFound from "../../../../components/NotFound";
+
+const DonationSuccess = () => {
+ const pdfData = localStorage.getItem("pdfData");
+
+ const base64toBlob = (base64data: any) => {
+ const byteString = atob(base64data.split(",")[1]);
+ const mimeType = base64data.split(",")[0].split(":")[1].split(";")[0];
+ const arrayBuffer = new ArrayBuffer(byteString.length);
+ const uint8Array = new Uint8Array(arrayBuffer);
+ for (let i = 0; i < byteString.length; i++) {
+ uint8Array[i] = byteString.charCodeAt(i);
+ }
+ return new Blob([arrayBuffer], { type: mimeType });
+ };
+
+ const downloadReceipt = () => {
+ const base64data = localStorage.getItem("pdfData");
+
+ if (base64data) {
+ const pdfBlob = base64toBlob(base64data);
+ const pdfUrl = URL.createObjectURL(pdfBlob);
+ const link = document.createElement("a");
+ link.href = pdfUrl;
+ link.download = "downloaded-file.pdf";
+
+ document.body.appendChild(link);
+ link.click();
+
+ document.body.removeChild(link);
+ } else {
+ console.error("No PDF data found in localStorage.");
+ }
+ };
+
+ const handleUnload = () => {
+ localStorage.removeItem("pdfData");
+ };
+
+ useEffect(() => {
+ window.addEventListener("beforeunload", handleUnload);
+ return () => {
+ window.removeEventListener("beforeunload", handleUnload);
+ };
+ }, []);
+
+ return pdfData ? (
+
+
+
+
+
+
+
+
+
+
+ Thank You!{" "}
+
+ We appreciate your support
+
+
+ Your donation was successful. A confirmation email has been
+ sent.
+
+
+
+
+
+
+
Success!
+
+ Thank you for your donation. Your support means a
+ lot to us.
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ) : (
+
+
+
+ );
+};
+
+export default DonationSuccess;
diff --git a/src/modules/Public/Donation/services/api.ts b/src/modules/Public/Donation/services/api.ts
index 49c52d3d0..aa967f9ae 100644
--- a/src/modules/Public/Donation/services/api.ts
+++ b/src/modules/Public/Donation/services/api.ts
@@ -3,10 +3,10 @@ import { publicGateway } from "@/MuLearnServices/apiGateways";
import { donationRoutes } from "@/MuLearnServices/urls";
declare global {
- interface Window {
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
- Razorpay: any;
- }
+ interface Window {
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ Razorpay: any;
+ }
}
export const submitForm = async ({
@@ -15,88 +15,113 @@ export const submitForm = async ({
company,
email,
mobile,
- pan
+ pan
}: {
- amount: number;
- name: string;
- company?: string;
- email: string;
- mobile: number;
- pan: string;
-
+ amount: number;
+ name: string;
+ company?: string;
+ email: string;
+ mobile: number;
+ pan: string;
}) => {
+ const script = document.createElement("script");
+ script.src = "https://checkout.razorpay.com/v1/checkout.js";
+ document.body.appendChild(script);
+
+ publicGateway
+ .post(donationRoutes.order, {
+ amount,
+ name,
+ company,
+ email,
+ mobile
+ })
+ .then(response => {
+ const paymentId: string = response.data.response.id;
+ const paymentAmount: string = response.data.response.amount;
- const script = document.createElement('script');
- script.src = 'https://checkout.razorpay.com/v1/checkout.js';
- document.body.appendChild(script);
+ const options = {
+ key_id: import.meta.env.VITE_RAZORPAY_KEY_ID,
+ amount: paymentAmount,
+ currency: response.data.response.currency,
+ name: "Mulearn Foundation",
+ description: "Donation",
+ image: "/assets/µLearn.png",
+ order_id: paymentId,
+ handler: function (response: any) {
+ console.log(response);
- publicGateway
- .post(donationRoutes.order, {
- amount,
- name,
- company,
- email,
- mobile
- })
- .then((response) => {
- const paymentId: string = response.data.response.id;
- const paymentAmount: string = response.data.response.amount;
+ publicGateway
+ .post(donationRoutes.verify, {
+ razorpay_order_id: response.razorpay_order_id,
+ razorpay_payment_id: response.razorpay_payment_id,
+ razorpay_signature: response.razorpay_signature
+ })
+ .then(res => {
+ console.log(res?.data);
+ toast.success(
+ res?.data?.message?.general[0] ||
+ "Payment Successful"
+ );
+ // Assuming response.data contains the PDF data
- const options = {
- key_id: import.meta.env.VITE_RAZORPAY_KEY_ID,
- amount: paymentAmount,
- currency: response.data.response.currency,
- name: 'Mulearn Foundation',
- description: 'Donation',
- image: '/assets/µLearn.png',
- order_id: paymentId,
- handler: function (response: any) {
- console.log(response);
+ const pdfData = res?.data;
- publicGateway
- .post(donationRoutes.verify, {
- razorpay_order_id: response.razorpay_order_id,
- razorpay_payment_id: response.razorpay_payment_id,
- razorpay_signature: response.razorpay_signature,
- })
- .then((res) => {
- console.log(res?.data);
- toast.success(res?.data?.message?.general[0] || 'Payment Successful');
- // Assuming response.data contains the PDF data
+ // Create a new blob from the PDF data
+ const pdfBlob = new Blob([pdfData], {
+ type: "application/pdf"
+ });
- const pdfData = res?.data;
+ // // Create a URL for the blob
+ // const pdfUrl = URL.createObjectURL(pdfBlob);
- // Create a new blob from the PDF data
- const pdfBlob = new Blob([pdfData], { type: 'application/pdf' });
+ // // Open the PDF in a new window or tab
+ // // window.open(pdfUrl, '_blank');
+ // const link = document.createElement("a");
+ // link.href = pdfUrl;
+ // link.download = "downloaded-file.pdf"; // Provide a filename here
+ // document.body.appendChild(link);
+ // link.click();
+ // document.body.removeChild(link);
+ // window.location.href = "/donation/success";
- // Create a URL for the blob
- const pdfUrl = URL.createObjectURL(pdfBlob);
+ // Convert blob data to a base64 string
+ const reader = new FileReader();
+ reader.onloadend = function () {
+ const base64data = reader.result;
+ if (base64data) {
+ localStorage.setItem(
+ "pdfData",
+ base64data as string
+ );
- // Open the PDF in a new window or tab
- // window.open(pdfUrl, '_blank');
- const link = document.createElement('a');
- link.href = pdfUrl;
- link.download = 'downloaded-file.pdf'; // Provide a filename here
- document.body.appendChild(link);
- link.click();
- document.body.removeChild(link);
- })
- .catch((error) => {
- console.log(error);
- toast.error(
- JSON.stringify(error) || 'Error in Validating Payment',
- );
- });
- },
- theme: {
- color: '#456ff6',
- },
- };
+ window.location.href = "/donation/success";
+ } else {
+ console.error("Failed to read PDF data.");
+ }
+ };
+ reader.readAsDataURL(pdfBlob);
+ })
+ .catch(error => {
+ console.log(error);
+ toast.error(
+ JSON.stringify(error) ||
+ "Error in Validating Payment"
+ );
+ });
+ },
+ theme: {
+ color: "#456ff6"
+ }
+ };
- const rzp1 = new window.Razorpay(options);
- rzp1.open();
- })
- .catch((error) => {
- toast.error(error?.response?.data?.message?.general[0] || 'Error in Registering Event');
- });
+ const rzp1 = new window.Razorpay(options);
+ rzp1.open();
+ })
+ .catch(error => {
+ toast.error(
+ error?.response?.data?.message?.general[0] ||
+ "Error in Registering Event"
+ );
+ });
};