diff --git a/src/components/Activities/ReportTaskComments.jsx b/src/components/Activities/ReportTaskComments.jsx
index 0c2f7a43..cf30540e 100644
--- a/src/components/Activities/ReportTaskComments.jsx
+++ b/src/components/Activities/ReportTaskComments.jsx
@@ -8,7 +8,7 @@ import { TasksRepository } from "../../repositories/TaskRepository";
import showToast from "../../services/toastService";
import Avatar from "../common/Avatar";
import { getBgClassFromHash } from "../../utils/projectStatus";
-import {cacheData, getCachedData} from "../../slices/apiDataManager";
+import { cacheData, getCachedData } from "../../slices/apiDataManager";
const schema = z.object({
comment: z.string().min(1, "Comment cannot be empty"),
@@ -50,25 +50,30 @@ const ReportTaskComments = ({ commentsData, closeModal }) => {
setloading(true);
const resp = await TasksRepository.taskComments(sendComment);
setComment((prevItems) => [...prevItems, resp.data]);
- const taskList = getCachedData("taskList")
+ const taskList = getCachedData("taskList");
const updatedTaskList = taskList.data.map((task) => {
if (task.id === resp.data.taskAllocationId) {
- const existingComments = Array.isArray(task.comments) ? task.comments : [];
+ const existingComments = Array.isArray(task.comments)
+ ? task.comments
+ : [];
return {
...task,
- comments: [...existingComments, resp.data],
+ comments: [...existingComments, resp.data],
};
}
return task;
- })
- cacheData("taskList",{data:updatedTaskList,projectId:taskList.projectId})
+ });
+ cacheData("taskList", {
+ data: updatedTaskList,
+ projectId: taskList.projectId,
+ });
reset();
setloading(false);
showToast("Successfully Sent", "success");
// closeModal();
} catch (error) {
- setloading( false );
- console.log(error)
+ setloading(false);
+ console.log(error);
showToast(error.response.data?.message || "Something wrong", "error");
}
};
@@ -85,7 +90,15 @@ const ReportTaskComments = ({ commentsData, closeModal }) => {
onClick={closeModal}
aria-label="Close"
>
-
{`${ commentsData?.workItem?.workArea?.floor?.building?.name }`} {`${ commentsData?.workItem?.workArea?.floor?.floorName } `} {`${ commentsData?.workItem?.workArea?.areaName }`}{` ${commentsData?.workItem?.activityMaster?.activityName}`}
+
+ {`${commentsData?.workItem?.workArea?.floor?.building?.name}`}{" "}
+ {" "}
+ {`${commentsData?.workItem?.workArea?.floor?.floorName} `}{" "}
+
+ {`${commentsData?.workItem?.workArea?.areaName}`}
+
+ {` ${commentsData?.workItem?.activityMaster?.activityName}`}
+
{
className={`li-wrapper d-flex justify-content-start align-items-start my-0 `}
>
-
- {`${data?.employee?.firstName.slice(0,1)} ${data?.employee?.lastName.slice(0,1)}`}
+
+ {`${data?.employee?.firstName.slice(
+ 0,
+ 1
+ )} ${data?.employee?.lastName.slice(0, 1)}`}
@@ -115,9 +133,7 @@ const ReportTaskComments = ({ commentsData, closeModal }) => {
className=" text-muted m-0 "
style={{ fontSize: "10px" }}
>
-
- {moment.utc(data?.commentDate).local().fromNow()}
-
+ {moment.utc(data?.commentDate).local().fromNow()}
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!
-
+ )}
+ {registered && (
+ Thank you for contacting us
+ We will get back to you soon
+
+
+ Back to login
+
+ )}
+ >
);
};
diff --git a/src/repositories/AuthRepository.jsx b/src/repositories/AuthRepository.jsx
index 058693d5..b8a10e2d 100644
--- a/src/repositories/AuthRepository.jsx
+++ b/src/repositories/AuthRepository.jsx
@@ -9,6 +9,7 @@ const AuthRepository = {
register: ( data ) => api.post( 'api/auth/register', data ),
resetPassword: ( data ) => api.post( '/api/auth/reset-password', data ),
forgotPassword: (data) => api.post( '/api/auth/forgot-password', data),
+ requestDemo: (data) => api.post('/api/auth/inquiry',data),
sendMail:(data)=>api.post("/api/auth/sendmail",data)
};
diff --git a/src/repositories/MastersRepository.jsx b/src/repositories/MastersRepository.jsx
index a785c152..44724cfd 100644
--- a/src/repositories/MastersRepository.jsx
+++ b/src/repositories/MastersRepository.jsx
@@ -32,6 +32,6 @@ export const MasterRespository = {
getActivites: () => api.get( 'api/master/activities' ),
createActivity: (data) => api.post( 'api/master/activity',data ),
updateActivity:(id,data) =>api.post(`api/master/edit/${id}`,data),
-
+ getIndustries:()=> api.get('api/master/industries'),
}
\ No newline at end of file