diff --git a/src/components/Project/ManageProjectInfo.jsx b/src/components/Project/ManageProjectInfo.jsx
index a03077f9..3aad8e60 100644
--- a/src/components/Project/ManageProjectInfo.jsx
+++ b/src/components/Project/ManageProjectInfo.jsx
@@ -26,6 +26,7 @@ const ManageProjectInfo = ({ project, handleSubmitForm, onClose }) => {
.object({
...(project?.id ? { id: z.string().optional() } : {}),
name: z.string().min(1, { message: "Project Name is required" }),
+ shortName: z.string().optional(),
contactPerson: z
.string()
.min( 1, {message: "Contact Person Name is required"} )
@@ -72,6 +73,7 @@ const ManageProjectInfo = ({ project, handleSubmitForm, onClose }) => {
defaultValues: {
id: project?.id || "",
name: project?.name || "",
+ shortName: project?.shortName || "",
contactPerson: project?.contactPerson || "",
projectAddress: project?.projectAddress || "",
startDate: formatDate(project?.startDate) || currentDate,
@@ -88,6 +90,7 @@ const ManageProjectInfo = ({ project, handleSubmitForm, onClose }) => {
? {
id: project?.id || "",
name: project?.name || "",
+ shortName: project?.shortName || "",
contactPerson: project?.contactPerson || "",
projectAddress: project?.projectAddress || "",
startDate: formatDate(project?.startDate) || "",
@@ -108,6 +111,7 @@ const ManageProjectInfo = ({ project, handleSubmitForm, onClose }) => {
reset({
id: project?.id || "",
name: project?.name || "",
+ shortName: project?.shortName || "",
contactPerson: project?.contactPerson || "",
projectAddress: project?.projectAddress || "",
startDate: formatDate(project?.startDate) || currentDate,
@@ -157,6 +161,27 @@ const ManageProjectInfo = ({ project, handleSubmitForm, onClose }) => {
)}
+
+
+
+ {errors.shortName && (
+
+ {errors.shortName.message}
+
+ )}
+
-
-
- {projectInfo.name}
-
+
+ {projectInfo.shortName
+ ? projectInfo.shortName
+ : projectInfo.name}
- Client:
- {projectInfo.contactPerson}
+ {projectInfo.shortName ? projectInfo.name : ""}
@@ -141,9 +139,14 @@ const ProjectCard = ({ projectData }) => {
data-bs-toggle="dropdown"
aria-expanded="false"
>
- {modifyProjectLoading?
- Loading...
-
:
+ {modifyProjectLoading ? (
+
+ Loading...
+
+ ) : (
{
data-bs-placement="top"
data-bs-custom-class="tooltip-dark"
title="More Action"
- >}
+ >
+ )}
-
@@ -191,6 +195,12 @@ const ProjectCard = ({ projectData }) => {
+
+
+ Contact Person:{" "}
+
+ {projectInfo.contactPerson ? projectInfo.contactPerson : "NA"}
+
Start Date:
{projectInfo.startDate
diff --git a/src/pages/project/ProjectList.jsx b/src/pages/project/ProjectList.jsx
index 0f1dca9b..70b2e696 100644
--- a/src/pages/project/ProjectList.jsx
+++ b/src/pages/project/ProjectList.jsx
@@ -37,7 +37,7 @@ const ProjectList = () => {
const handleShow = () => setShowModal(true);
const handleClose = () => setShowModal(false);
- useEffect(() => {
+ const sortingProject = (projects) =>{
if (!loading && Array.isArray(projects)) {
const grouped = {};
projects.forEach((project) => {
@@ -56,6 +56,10 @@ const ProjectList = () => {
setProjectList(sortedGrouped);
}
+ }
+
+ useEffect(() => {
+ sortingProject(projects)
}, [projects, loginUser?.projects, loading]);
useEffect(() => {
@@ -75,6 +79,7 @@ const ProjectList = () => {
setProjectList( ( prev ) => [ ...prev, response.data ] );
setloading( false )
reset()
+ sortingProject(getCachedData("projectslist"))
showToast("Project Created successfully.", "success");
setShowModal(false);
})
@@ -118,7 +123,7 @@ const ProjectList = () => {
indexOfLastItem
);
const totalPages = Math.ceil(filteredProjects.length / itemsPerPage);
-
+
useEffect(() => {
const tooltipTriggerList = Array.from(
document.querySelectorAll('[data-bs-toggle="tooltip"]')
@@ -268,7 +273,7 @@ const ProjectList = () => {
Project Name
|
-
Project Manger |
+
Contact Person |
START DATE |
DEADLINE |
Task |
@@ -336,7 +341,7 @@ const ProjectList = () => {
) : (
currentItems.map((project) => (
-
+
))
)}
@@ -344,7 +349,7 @@ const ProjectList = () => {
) : (
currentItems.map((project) => (
-
+
))
)}
diff --git a/src/pages/project/ProjectListView.jsx b/src/pages/project/ProjectListView.jsx
index 98698760..0b2682e0 100644
--- a/src/pages/project/ProjectListView.jsx
+++ b/src/pages/project/ProjectListView.jsx
@@ -15,7 +15,7 @@ import ManageProjectInfo from "../../components/Project/ManageProjectInfo";
import showToast from "../../services/toastService";
import { getCachedData, cacheData } from "../../slices/apiDataManager";
-const ProjectListView = ({ projectData }) => {
+const ProjectListView = ({ projectData, recall }) => {
const [projectInfo, setProjectInfo] = useState(projectData);
const [projectDetails, setProjectDetails] = useState(null);
const [showModal, setShowModal] = useState(false);
@@ -76,6 +76,7 @@ const ProjectListView = ({ projectData }) => {
);
cacheData("projectslist", updatedProjectsList);
}
+ recall(getCachedData("projectslist"));
showToast("Project updated successfully.", "success");
setShowModal(false);
})
@@ -87,19 +88,21 @@ const ProjectListView = ({ projectData }) => {
return (
<>
{showModal && projectDetails && (
-
-
-
+
+
+
+ |
+
)}
@@ -108,7 +111,9 @@ const ProjectListView = ({ projectData }) => {
className="text-primary cursor-pointer"
onClick={() => navigate(`/projects/${projectInfo.id}`)}
>
- {projectInfo.name}
+ {projectInfo.shortName
+ ? `${projectInfo.name} (${projectInfo.shortName})`
+ : projectInfo.name}
{projectInfo.contactPerson} |