diff --git a/src/components/Activities/ReportTaskComments.jsx b/src/components/Activities/ReportTaskComments.jsx index f116eb07..daa368cf 100644 --- a/src/components/Activities/ReportTaskComments.jsx +++ b/src/components/Activities/ReportTaskComments.jsx @@ -38,8 +38,8 @@ const ReportTaskComments = ({ commentsData, closeModal }) => { try { setloading(true); - // const resp = await TasksRepository.taskComments( sendComment ); - // console.timeLog( resp ) + const resp = await TasksRepository.taskComments( sendComment ); + console.timeLog( resp ) reset(); setloading(false); showToast("Successfully Sent", "success"); diff --git a/src/pages/authentication/RegisterPage.jsx b/src/pages/authentication/RegisterPage.jsx index 9f58cf68..01368df0 100644 --- a/src/pages/authentication/RegisterPage.jsx +++ b/src/pages/authentication/RegisterPage.jsx @@ -1,65 +1,108 @@ -import { useState } from "react"; +import { useEffect, useState } from "react"; import { Link } from "react-router-dom"; import "./page-auth.css"; import { AuthWrapper } from "./AuthWrapper"; -import { useForm,Controller } from 'react-hook-form'; -import { zodResolver } from '@hookform/resolvers/zod'; -import { z } from 'zod'; +import { useForm, Controller } from "react-hook-form"; +import { zodResolver } from "@hookform/resolvers/zod"; +import { z } from "zod"; import showToast from "../../services/toastService"; import AuthRepository from "../../repositories/AuthRepository"; +import { MasterRespository } from "../../repositories/MastersRepository"; const mobileNumberRegex = /^(?:\d{10}|\d{3}[-\s]?\d{3}[-\s]?\d{4})$/; const registerSchema = z.object({ - orgName:z.string().min(1,{message:"Organization Name is required"}), - email:z.string().email(), - contactPerson:z.string().min(1,{message:"Person Name is required"}), - contactNo:z.string().min(1,{message: "Phone Number is required"}) - .regex(mobileNumberRegex, {message:"Invalid phone number "}), - orgSize:z.string().min(1,{message:"please Select Organization Size "}), + organizatioinName: z + .string() + .min(1, { message: "Organization Name is required" }), + email: z.string().email(), + about: z + .string() + .min(1, { message: "Current Address is required" }) + .max(500, { message: "Address cannot exceed 500 characters" }), + contactPerson: z.string().min(1, { message: "Person Name is required" }), + contactNumber: z + .string() + .min(1, { message: "Phone Number is required" }) + .regex(mobileNumberRegex, { message: "Invalid phone number " }), + oragnizationSize: z + .string() + .min(1, { message: "please Select Organization Size " }), + industryId: z.string(), terms: z.boolean().refine((val) => val === true, { message: "Please accept the terms and conditions.", }), -} ) +}); const RegisterPage = () => { - - const {register,handleSubmit,formState: { errors }} = useForm({ - resolver:zodResolver(registerSchema) - }) - - const onSubmit= async(data)=>{ - try - { - // const response = await AuthRepository.register( data ); - - showToast("Your Registration SuccessFully !") - } catch ( error ) - { - console.log(error) - showToast(error.message,"error") - } - } + const [registered,setRegristered] = useState(false); + const [industries, setIndustries] = useState([]); + const { + register, + handleSubmit, + formState: { errors }, + } = useForm({ + resolver: zodResolver(registerSchema), + }); + + const onSubmit = async (data) => { + try { + const response = await AuthRepository.requestDemo(data); + showToast("Your Registration SuccessFully !"); + setRegristered(true); + } catch (error) { + // console.log(error); + showToast(error.message, "error"); + } + }; + useEffect(() => { + fetchIndustries(); + }, []); + + useEffect(() => { + }, [industries]); + + const fetchIndustries = async () => { + try { + const response = await MasterRespository.getIndustries(); + const industry = response.data; + setIndustries(industry); + } catch (error) { + showToast(error.message, "error"); + } + }; return ( - + <> + {!registered && (

Adventure starts here 🚀

Make your app management easy and fun!

-
+
-
- {errors.contactPerson &&
{errors.contactPerson.message}
} - + {errors.contactPerson && ( +
+ {errors.contactPerson.message} +
+ )}
- {errors.contactNo &&
{errors.contactNo.message}
} - + {errors.contactNumber && ( +
+ {errors.contactNumber.message} +
+ )}
-
+
+
- {errors.orgSize &&
{errors.orgSize.message}
} - + {errors.oragnizationSize && ( +
+ {errors.oragnizationSize.message} +
+ )} +
+
+ +
+ +
+ {errors.industryId && ( +
+ {errors.industryId.message} +
+ )}
@@ -157,8 +283,14 @@ const RegisterPage = () => {
- {errors.terms &&
{errors.terms.message}
} - + {errors.terms && ( +
+ {errors.terms.message} +
+ )}