diff --git a/src/app/ac/page.js b/src/app/ac/page.js index b1d62f5..ee3114c 100644 --- a/src/app/ac/page.js +++ b/src/app/ac/page.js @@ -13,6 +13,7 @@ const BookingForm = () => { contact: "", email: "", confirmEmail: "", + team:"", }); const handleChange = (e) => { @@ -42,8 +43,8 @@ const BookingForm = () => { e.preventDefault(); const currency = "INR"; - const response = await axios.post("https://ecell-orcin.vercel.app/payment/", { - amount: 1800 * 100, + const response = await axios.post("http://localhost:4000/payment/", { + amount: 10 * 100, receipt: "AAyu9414", currency, }); @@ -103,13 +104,14 @@ const BookingForm = () => { className="text-2xl text-white md:text-5xl mt-24 md:my-12 font-bold font-Nova uppercase" text="Accommodation" /> -
+
{[ { label: "Name", id: "name", type: "text" }, { label: "College", id: "college", type: "text" }, { label: "City", id: "city", type: "text" }, { label: "Contact", id: "contact", type: "text" }, + { label: "Team", id: "team", type: "text" }, { label: "Email", id: "email", type: "email" }, { label: "Confirm Email", id: "confirmEmail", type: "email" }, ].map(({ label, id, type }) => ( diff --git a/src/app/startup/page.js b/src/app/startup/page.js new file mode 100644 index 0000000..f8a7581 --- /dev/null +++ b/src/app/startup/page.js @@ -0,0 +1,229 @@ +'use client'; +import { useState } from "react"; +import axios from "axios"; +import Script from "next/script"; +import HyperText from '../../components/magicui/hyper-text' + +const BookingForm = () => { + const [formData, setFormData] = useState({ + name: "", + college: "", + city: "", + gender: "", + contact: "", + email: "", + team:"", + confirmEmail: "", + }); + + const handleChange = (e) => { + const { name, value } = e.target; + setFormData((prevData) => ({ + ...prevData, + [name]: value, + })); + }; + + const handleSubmit = async () => { + if (formData.email !== formData.confirmEmail) { + alert("Emails do not match. Please try again."); + return; + } + try { + const response = await axios.post("https://ecell-orcin.vercel.app/startup/", formData); + console.log("Task created:", response.data); + alert("Your registeration is sucessfull"); + } catch (error) { + console.error("Error creating task:", error); + alert("Something went wrong"); + } + }; + + const paymentHandler = async (e) => { + e.preventDefault(); + const currency = "INR"; + + const response = await axios.post("https://ecell-orcin.vercel.app/payment/", { + amount: 575 * 100, + receipt: "AAyu9414", + currency, + }); + + const { id: orderId, amount } = response.data; + + const options = { + key: "rzp_live_Kz0ka8aJYIo4Fc", + amount, + currency, + name: "E-Cell DTU", + description: "Test Transaction", + image: "https://example.com/your_logo", + order_id: orderId, + handler: async function (response) { + const verificationResponse = await axios.post( + "https://ecell-orcin.vercel.app/payment/verification", + { + paymentResponse: response, + } + ); + if (verificationResponse.data.msg === "success") { + alert("Payment Successful"); + await handleSubmit(); + setTimeout(() => { + window.location.href = "/"; + }, 3000); + } else { + alert("Payment Verification Failed"); + } + }, + prefill: { + name: formData.name, + email: formData.email, + contact: formData.contact, + }, + notes: { + address: formData.city, + }, + theme: { + color: "#1f2937", + }, + }; + + const rzp1 = new window.Razorpay(options); + rzp1.on("payment.failed", function (response) { + alert("Payment Failed"); + console.error("Payment Failed:", response.error); + }); + rzp1.open(); + }; + + return ( + <> +
+ + +
+ {[ + { label: "Name", id: "name", type: "text" }, + { label: "College", id: "college", type: "text" }, + { label: "City", id: "city", type: "text" }, + { label: "Contact", id: "contact", type: "text" }, + { label: "Team Name(write NA if not part of any)", id: "team", type: "text" }, + { label: "Email", id: "email", type: "email" }, + { label: "Confirm Email", id: "confirmEmail", type: "email" }, + ].map(({ label, id, type }) => ( +
+ + +
+ ))} +
+
+ + +
+ + +