diff --git a/package-lock.json b/package-lock.json index 315b9b8..eb29a8d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -47,6 +47,7 @@ "react-markdown": "^9.0.1", "recharts": "^2.12.7", "stripe": "^17.1.0", + "sweetalert2": "^11.14.3", "tailwind-merge": "^2.5.2", "tailwindcss-animate": "^1.0.7", "zod": "^3.23.8" @@ -8072,6 +8073,16 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/sweetalert2": { + "version": "11.14.3", + "resolved": "https://registry.npmjs.org/sweetalert2/-/sweetalert2-11.14.3.tgz", + "integrity": "sha512-6NuBHWJCv2gtw4y8PUXLB41hty+V6U2mKZMAvydL1IRPcORR0yuyq3cjFD/+ByrCk3muEFggbZX/x6HwmbVfbA==", + "license": "MIT", + "funding": { + "type": "individual", + "url": "https://github.com/sponsors/limonte" + } + }, "node_modules/tailwind-merge": { "version": "2.5.2", "resolved": "https://registry.npmjs.org/tailwind-merge/-/tailwind-merge-2.5.2.tgz", diff --git a/package.json b/package.json index cbb2384..2bed454 100644 --- a/package.json +++ b/package.json @@ -48,6 +48,7 @@ "react-markdown": "^9.0.1", "recharts": "^2.12.7", "stripe": "^17.1.0", + "sweetalert2": "^11.14.3", "tailwind-merge": "^2.5.2", "tailwindcss-animate": "^1.0.7", "zod": "^3.23.8" diff --git a/src/app/business/apply/page.tsx b/src/app/business/apply/page.tsx index a1a1064..fe94bda 100644 --- a/src/app/business/apply/page.tsx +++ b/src/app/business/apply/page.tsx @@ -1,19 +1,20 @@ "use client"; -import { Button } from "@/components/ui/button"; -import { Input } from "@/components/ui/input"; -import { Label } from "@/components/ui/label"; import { createSupabaseClient } from "@/lib/supabase/clientComponentClient"; import { useEffect, useState } from "react"; -import { Textarea } from "@/components/ui/textarea"; import { useForm, SubmitHandler } from "react-hook-form"; import { z } from "zod"; import { zodResolver } from "@hookform/resolvers/zod"; import BusinessForm from "@/components/BusinessForm"; import { businessFormSchema } from "@/types/schemas/application.schema"; +import Swal from "sweetalert2"; +import { Button } from "@/components/ui/button"; +import { Input } from "@/components/ui/input"; +import { Label } from "@/components/ui/label"; +import { Textarea } from "@/components/ui/textarea"; type businessSchema = z.infer; -export default function Apply() { - const [industry, setIndustry] = useState<{id: number, name: string }[]>([]); +export default function ApplyBusiness() { + const [industry, setIndustry] = useState<{ id: number; name: string }[]>([]); const [projectType, setProjectType] = useState([]); const [projectPitch, setProjectPitch] = useState("text"); const [applyProject, setApplyProject] = useState(false); @@ -50,7 +51,14 @@ export default function Apply() { }, ]) .select(); - console.table(data); + console.table(data); + Swal.fire({ + icon: error == null ? "success" : "error", + title: error == null ? "success" : "Error: " + error.code, + text: + error == null ? "your application has been submitted" : error.message, + confirmButtonColor: error == null ? "green" : "red", + }); }; const createPitchDeckSchema = (inputType: string) => { @@ -403,12 +411,8 @@ export default function Apply() { applyProject={applyProject} setApplyProject={setApplyProject} /> - - {/* - */} - - {/* apply first project */} - {applyProject && ( +
+ {" "}
{/* header */}
@@ -704,16 +708,7 @@ export default function Apply() { )}
- )} - {/* Submit */} - {/*
- -
*/} +
); } diff --git a/src/app/project/apply/page.tsx b/src/app/project/apply/page.tsx new file mode 100644 index 0000000..ae72c89 --- /dev/null +++ b/src/app/project/apply/page.tsx @@ -0,0 +1,311 @@ +"use client"; +import { useState } from "react"; +import { Button } from "@/components/ui/button"; +import { Input } from "@/components/ui/input"; +import { Label } from "@/components/ui/label"; +import { Textarea } from "@/components/ui/textarea"; + +export default function ApplyProject() { + const [projectType, setProjectType] = useState([]); + const [projectPitch, setProjectPitch] = useState("text"); + const [applyProject, setApplyProject] = useState(false); + const [selectedImages, setSelectedImages] = useState([]); + const [projectPitchFile, setProjectPitchFile] = useState(""); + return ( +
+ {" "} +
+ {/* header */} +
+

+ Begin Your First Fundraising Project +

+

+ Starting a fundraising project is mandatory for all businesses. This + step is crucial
+ to begin your journey and unlock the necessary tools for raising + funds. +

+ {/* project's name */} +
+ +
+ +
+
+ {errorsProject.projectName && ( +

+ {errorsProject.projectName.message as string} +

+ )} + {/* project type */} + {/* Project type} + fieldName="projectType" + choices={projectType} + // handleFunction={handleProjectFieldChange} + description={<>Please specify the primary purpose of the funds} + placeholder="Select a Project type" + selectLabel="Project type" + /> */} + {errorsProject.projectType && ( +

+ {errorsProject.projectType.message as string} +

+ )} + {/* short description */} +
+ +
+