Add link to he project from Attendance details widget

This commit is contained in:
Vikas Nale 2025-12-15 11:08:27 +05:30
parent 34d5ce9ef9
commit 4f9fa1b7c2

View File

@ -7,8 +7,14 @@ import DatePicker from "../common/DatePicker";
import { useAppForm, useAppWatch } from "../../hooks/appHooks/useAppForm"; import { useAppForm, useAppWatch } from "../../hooks/appHooks/useAppForm";
import { zodResolver } from "@hookform/resolvers/zod"; import { zodResolver } from "@hookform/resolvers/zod";
import { z } from "zod"; import { z } from "zod";
import { setProjectId } from "../../slices/localVariablesSlice";
import { useDispatch } from "react-redux";
import { useNavigate } from "react-router-dom";
const ProjectWiseTeamCount = () => { const ProjectWiseTeamCount = () => {
const dispatch = useDispatch();
const navigate = useNavigate();
const { control } = useAppForm({ const { control } = useAppForm({
resolver: zodResolver( resolver: zodResolver(
z.object({ z.object({
@ -20,6 +26,11 @@ const ProjectWiseTeamCount = () => {
}, },
}); });
const goToProject = (projectId) => () => {
dispatch(setProjectId(projectId));
navigate(`/projects/details`);
};
const selectedDate = useAppWatch({ control, name: "date" }); const selectedDate = useAppWatch({ control, name: "date" });
const { data, isLoading, isFetching, isError, error } = const { data, isLoading, isFetching, isError, error } =
@ -72,11 +83,21 @@ const ProjectWiseTeamCount = () => {
className="d-flex align-items-center text-wrap my-2 text-start" className="d-flex align-items-center text-wrap my-2 text-start"
style={{ width: "180px" }} style={{ width: "180px" }}
> >
<span className="text-heading">{item.projectName}</span> <a
onClick={goToProject(item.projectId)}
className="text-heading text-truncate cursor-pointer"
>
{" "}
<span className="text-heading">{item.projectName}</span>
</a>
</div> </div>
</td> </td>
<td className="text-center" style={{ width: 80 }}>{item.teamCount}</td> <td className="text-center" style={{ width: 80 }}>
<td className="text-center" style={{ width: 80 }} >{item.attendanceCount}</td> {item.teamCount}
</td>
<td className="text-center" style={{ width: 80 }}>
{item.attendanceCount}
</td>
{/* <td>{percent(item.teamCount, item.attendanceCount)}%</td> */} {/* <td>{percent(item.teamCount, item.attendanceCount)}%</td> */}
</tr> </tr>
))} ))}