diff --git a/assets/index.ts b/assets/index.ts index 26bcec7..827f11e 100644 --- a/assets/index.ts +++ b/assets/index.ts @@ -65,6 +65,7 @@ import tealBenefits from "../public/images/teal-benefits.svg"; import tealWorkers from "../public/images/teal-workers.svg"; import tealAwards from "../public/images/teal-awards.svg"; import tealWorkspace from "../public/images/teal-workspace.svg"; +import okay from "../public/images/okay.svg"; // Assets for technologies components @@ -235,4 +236,5 @@ export { tealWorkers, tealAwards, tealWorkspace, + okay, }; diff --git a/components/ThankModal.tsx b/components/ThankModal.tsx new file mode 100644 index 0000000..d45fc3f --- /dev/null +++ b/components/ThankModal.tsx @@ -0,0 +1,103 @@ +import React, { useEffect } from "react"; +import Button from "./Button"; +import GradientText from "./GradientText"; +import { disableBodyScroll, enableBodyScroll } from "body-scroll-lock"; +import Modal from "react-modal"; +import Image from "next/image"; +import { okay } from "../assets"; +import { useRouter } from "next/router"; + +const customStyles = { + content: { + top: "10%", + background: "#20222A", + width: "fit-content", + marginRight: "auto", + marginLeft: "auto", + zIndex: "10", + border: "2px solid #00A99D", + borderRadius: "2rem", + padding: "4% 10%", + }, +}; + +interface Props { + isShow: boolean; + toogleThankModal: () => void; +} +const ThankModal = ({ isShow, toogleThankModal }: Props) => { + const router = useRouter(); + const onAfterOpen = () => { + disableBodyScroll(document); + }; + useEffect(() => { + Modal.setAppElement("body"); + }); + const closeModal = () => { + enableBodyScroll(document); + toogleThankModal(); + }; + return ( + +
+ {/* {okay} */} + + + + + + +
+

+ Your submission has been recieved. +

+

+ We will be in touch and contact you soon. +

+
+
+
+
+
+ ); +}; + +export default ThankModal; diff --git a/components/pages-components/jobs/ApplyModal.tsx b/components/pages-components/jobs/ApplyModal.tsx new file mode 100644 index 0000000..f428b83 --- /dev/null +++ b/components/pages-components/jobs/ApplyModal.tsx @@ -0,0 +1,373 @@ +import { Formik, FormikHelpers } from "formik"; +import Image from "next/image"; +import React, { useEffect, useState } from "react"; +import Modal from "react-modal"; +import { disableBodyScroll, enableBodyScroll } from "body-scroll-lock"; + +import { add, locationTeal, work } from "../../../assets"; +import { useSetDataOnServer } from "../../../helper/careerHooks"; +import { jobValidationSchema } from "../../../helper/validate"; +import { sendCandidateDetails } from "../../../helper/webhook"; +import Button from "../../Button"; +import Divider from "../../Divider"; +import GradientText from "../../GradientText"; +import InputBox from "../../InputBox"; +import SelectBox from "../../SelectBox"; +import TextArea from "./TextArea"; +import { PropagateLoader } from "react-spinners"; + +interface initialState { + email: string; + mobile: string; + fName: string; + lName: string; + joiningIn: string; + linkedIn?: string; + portfolioURL?: string; + hiringReason?: string; + joiningReason?: string; +} + +const initialValue: initialState = { + email: "", + fName: "", + lName: "", + mobile: "", + joiningIn: "", + linkedIn: "", + portfolioURL: "", + hiringReason: "", + joiningReason: "", +}; + +const customStyles = { + content: { + top: "10%", + background: "#20222A", + width: "70%", + marginRight: "auto", + marginLeft: "auto", + zIndex: "10", + border: "2px solid #00A99D", + }, +}; + +interface Props { + showModal: { + viewDetails: boolean; + apply: boolean; + }; + setShowModal: (prop: any) => void; + toogleDetailModal: () => void; + toogleApplyModal: () => void; + toogleThankModal: () => void; +} + +const ApplyModal = ({ + showModal, + setShowModal, + toogleDetailModal, + toogleApplyModal, + toogleThankModal, +}: Props) => { + const [resume, setResume] = useState(null); + const [isShowLoader, setIsShowLoader] = useState(false); + const sendData = useSetDataOnServer(); + + const handleSubmit = async ( + value: initialState, + helper: FormikHelpers + ) => { + if (resume == null) { + window.alert("Please upload resume"); + return; + } + setIsShowLoader(true); + + const formdata = new FormData(); + formdata.append("file", resume); + + const requestOptions: any = { + method: "POST", + body: formdata, + redirect: "follow", + }; + try { + const response = await fetch( + "http://localhost:3000/api/", + requestOptions + ); + const data = await response.text(); + const { result } = JSON.parse(data); + // TODO=> Remove in Production + if (result) { + console.log(result); + closeModal(); + toogleThankModal(); + } + await sendCandidateDetails({ + ...value, + downloadLink: result, + }); + const res = await sendData("apply", { + first_name: value?.fName, + last_name: value?.lName, + email: value?.email, + phone_number: value?.mobile, + resume: result, + job_applied: 1, + hiring_reason: value?.hiringReason, + // joining_preference: value?.joiningReason, + joining_reason: value?.joiningReason, + linkedin_url: value?.linkedIn, + portfolio_url: value?.portfolioURL, + }); + if (res.status === 200) { + // window.alert("Successfully applied!"); + closeModal(); + toogleThankModal(); + } + setResume(null); + setIsShowLoader(false); + // toogleApplyModal(); + } catch (error: any) { + setIsShowLoader(false); + console.warn(error.message); + } + }; + + const handleResumeChange = (e: React.ChangeEvent) => { + const { + target: { files }, + } = e; + setResume(files[0]); + }; + + const closeModal = () => { + enableBodyScroll(document); + setShowModal((p: any) => { + return { + ...p, + apply: !p.apply, + }; + }); + }; + + const onAfterOpen = () => { + disableBodyScroll(document); + }; + + const handleViewDetails = () => { + toogleDetailModal(); + toogleApplyModal(); + }; + + useEffect(() => { + Modal.setAppElement("body"); + }); + + return ( + + + {({ handleChange, handleSubmit, handleBlur, errors, values }) => ( + +
+
+ +
+
+ + Dehradun, Uttrakhand +
+
+ + Full Time +
+
+

+ Posted 2 weeks ago +

+
+
+
+ + +
+
+
+ +

+ {resume?.name ? resume?.name : "Upload Resume"} +

+

+ Drop resume here or click to upload +

+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ { + const { name, value } = obj; + handleChange("joiningIn")(value); + }} + errorText={errors.joiningIn} + /> +
+
+ +
+
+ +
+ +
+ +