remove dashboard

This commit is contained in:
pramod.mahajan 2025-09-30 23:39:41 +05:30
parent 2aff3b9e80
commit c1e5ff4043
9 changed files with 157 additions and 160 deletions

View File

@ -27,35 +27,7 @@ const Dashboard = () => {
return ( return (
<div className="container-fluid mt-5"> <div className="container-fluid mt-5">
<div className="row gy-4"> <div className="row gy-4">
{isAllProjectsSelected && (
<div className="col-sm-6 col-lg-4">
<Projects projectsCardData={projectsCardData} />
</div>
)}
<div className={`${!isAllProjectsSelected ? "col-sm-6 col-lg-6" : "col-sm-6 col-lg-4"}`}>
<Teams teamsCardData={teamsCardData} />
</div>
<div className={`${!isAllProjectsSelected ? "col-sm-6 col-lg-6" : "col-sm-6 col-lg-4"}`}>
<TasksCard tasksCardData={tasksCardData} />
</div>
{isAllProjectsSelected && (
<div className="col-xxl-6 col-lg-6">
<ProjectCompletionChart />
</div>
)}
{!isAllProjectsSelected && (
<div className="col-xxl-6 col-lg-6">
<ProjectOverview />
</div>
)}
<div className="col-xxl-6 col-lg-6">
<ProjectProgressChart />
</div>
{!isAllProjectsSelected && ( {!isAllProjectsSelected && (
<div className="col-xxl-6 col-lg-6"> <div className="col-xxl-6 col-lg-6">
<AttendanceOverview /> {/* ✅ Removed unnecessary projectId prop */} <AttendanceOverview /> {/* ✅ Removed unnecessary projectId prop */}

View File

@ -4,8 +4,9 @@ import Pagination from "../common/Pagination";
import { useDirectoryContext } from "../../pages/Directory/DirectoryPage"; import { useDirectoryContext } from "../../pages/Directory/DirectoryPage";
import { useActiveInActiveContact } from "../../hooks/useDirectory"; import { useActiveInActiveContact } from "../../hooks/useDirectory";
import ConfirmModal from "../common/ConfirmModal"; import ConfirmModal from "../common/ConfirmModal";
import Loader from "../common/Loader";
const ListViewContact = ({ data, Pagination }) => { const ListViewContact = ({ data, Pagination, isLoading }) => {
const { showActive, setManageContact, setContactOpen } = const { showActive, setManageContact, setContactOpen } =
useDirectoryContext(); useDirectoryContext();
const [deleteContact, setDeleteContact] = useState({ const [deleteContact, setDeleteContact] = useState({
@ -97,103 +98,112 @@ const ListViewContact = ({ data, Pagination }) => {
paramData={deleteContact.contactId} paramData={deleteContact.contactId}
isOpen={deleteContact.Open} isOpen={deleteContact.Open}
/> />
<div className="card "> <div className="card page-min-h">
<div <div
className="card-datatable table-responsive" className="card-datatable table-responsive"
id="horizontal-example" id="horizontal-example"
> >
<div className="dataTables_wrapper no-footer mx-5 pb-2"> {isLoading && (
<table className="table dataTable text-nowrap"> <div>
<thead> <Loader />
<tr className="table_header_border"> </div>
{contactList?.map((col) => ( )}
<th key={col.key} className={col.align}> {data && (
{col.label} <div className="dataTables_wrapper no-footer mx-5 pb-2">
<table className="table dataTable text-nowrap">
<thead>
<tr className="table_header_border">
{contactList?.map((col) => (
<th key={col.key} className={col.align}>
{col.label}
</th>
))}
<th className="sticky-action-column bg-white text-center">
Action
</th> </th>
))} </tr>
<th className="sticky-action-column bg-white text-center"> </thead>
Action <tbody>
</th> {Array.isArray(data) && data.length > 0 ? (
</tr> data.map((row, i) => (
</thead> <tr
<tbody > key={i}
{Array.isArray(data) && data.length > 0 ? ( style={{
data.map((row, i) => ( background: `${!showActive ? "#f8f6f6" : ""}`,
<tr }}
key={i} >
style={{ background: `${!showActive ? "#f8f6f6" : ""}` }} {contactList.map((col) => (
> <td key={col.key} className={col.align}>
{contactList.map((col) => ( {col.getValue(row)}
<td key={col.key} className={col.align}> </td>
{col.getValue(row)} ))}
</td> <td className="text-center">
))} {showActive ? (
<td className="text-center"> <div className="d-flex justify-content-center gap-2">
{showActive ? ( <i
<div className="d-flex justify-content-center gap-2"> className="bx bx-show text-primary cursor-pointer"
<i onClick={() =>
className="bx bx-show text-primary cursor-pointer" setContactOpen({ contact: row, Open: true })
onClick={() => }
setContactOpen({ contact: row, Open: true }) ></i>
}
></i>
<i <i
className="bx bx-edit text-secondary cursor-pointer" className="bx bx-edit text-secondary cursor-pointer"
onClick={() => onClick={() =>
setManageContact({ setManageContact({
isOpen: true, isOpen: true,
contactId: row.id, contactId: row.id,
}) })
} }
></i> ></i>
<i
className="bx bx-trash text-danger cursor-pointer"
onClick={() =>
setDeleteContact({
contactId: row.id,
Open: true,
})
}
></i>
</div>
) : (
<i <i
className="bx bx-trash text-danger cursor-pointer" className={`bx ${
onClick={() => isPending && activeContact === row.id
setDeleteContact({ ? "bx-loader-alt bx-spin"
contactId: row.id, : "bx-recycle"
Open: true,
})
}
></i>
</div>
) : (
<i
className={`bx ${
isPending && activeContact === row.id
? "bx-loader-alt bx-spin"
: "bx-recycle"
} me-1 text-primary cursor-pointer`} } me-1 text-primary cursor-pointer`}
title="Restore" title="Restore"
onClick={() => { onClick={() => {
setActiveContact(row.id); setActiveContact(row.id);
handleActiveInactive(row.id); handleActiveInactive(row.id);
}} }}
></i> ></i>
)} )}
</td>
</tr>
))
) : (
<tr style={{ height: "200px" }}>
<td
colSpan={contactList.length + 1}
className="text-center align-middle"
>
No contacts found
</td> </td>
</tr> </tr>
)) )}
) : ( </tbody>
<tr style={{ height: "200px" }}> </table>
<td {Pagination && (
colSpan={contactList.length + 1} <div className="d-flex justify-content-start">{Pagination}</div>
className="text-center align-middle" )}
> </div>
No contacts found )}
</td> {data?.length === 0 && !isLoading && (
</tr> <div className="text-center"> No Expense Found</div>
)}
)}
</tbody>
</table>
{Pagination && (
<div className="d-flex justify-content-start">
{Pagination}
</div>
)}
</div>
</div> </div>
</div> </div>
</> </>

View File

@ -23,7 +23,7 @@ import Label from "../common/Label";
const ManageContact = ({ contactId, closeModal }) => { const ManageContact = ({ contactId, closeModal }) => {
// fetch master data // fetch master data
const { buckets, loading: bucketsLoaging } = useBuckets(); const { buckets, loading: bucketsLoaging } = useBuckets();
const { projects, loading: projectLoading } = useProjects(); const { data:projects, loading: projectLoading } = useProjects();
const { contactCategory, loading: contactCategoryLoading } = const { contactCategory, loading: contactCategoryLoading } =
useContactCategory(); useContactCategory();
const { organizationList } = useOrganization(); const { organizationList } = useOrganization();

View File

@ -246,16 +246,18 @@ const Header = () => {
)} )}
<ul className="navbar-nav flex-row align-items-center ms-md-auto"> <ul className="navbar-nav flex-row align-items-center ms-md-auto">
<li className="nav-item navbar-dropdown dropdown-user dropdown"> {HasManageProjectPermission && (
<button <li className="nav-item navbar-dropdown dropdown-user dropdown">
className="btn btn-sm btn-primary" <button
type="button" className="btn btn-sm btn-primary"
onClick={()=>openModal(null)} type="button"
> onClick={() => openModal(null)}
<i className="bx bx-plus-circle me-2"></i> >
<span className="d-none d-md-inline-block">Create Project</span> <i className="bx bx-plus-circle me-2"></i>
</button> <span className="d-none d-md-inline-block">Create Project</span>
</li> </button>
</li>
)}
<li className="nav-item navbar-dropdown dropdown-user dropdown"> <li className="nav-item navbar-dropdown dropdown-user dropdown">
<a <a
aria-label="dropdown profile avatar" aria-label="dropdown profile avatar"

View File

@ -483,6 +483,7 @@ export const useUpdateContact = (onSuccessCallBack) => {
mutationFn: async ({ contactId, contactPayload }) => mutationFn: async ({ contactId, contactPayload }) =>
await DirectoryRepository.UpdateContact(contactId, contactPayload), await DirectoryRepository.UpdateContact(contactId, contactPayload),
onSuccess: (_, variables) => { onSuccess: (_, variables) => {
queryClient.invalidateQueries({ queryKey: ["Contact"] });
queryClient.invalidateQueries({ queryKey: ["contacts"] }); queryClient.invalidateQueries({ queryKey: ["contacts"] });
showToast("Contact updated Successfully", "success"); showToast("Contact updated Successfully", "success");
if (onSuccessCallBack) onSuccessCallBack(); if (onSuccessCallBack) onSuccessCallBack();

View File

@ -12,14 +12,14 @@ import { queryClient } from "../layouts/AuthLayout";
// Query --------------------------------------------------------------------------- // Query ---------------------------------------------------------------------------
export const useEmployee = (employeeId) => { export const useEmployee = (employeeId) => {
return useQuery({ return useQuery({
queryKey: ["employeeProfile", employeeId], queryKey: ["employeeProfile", employeeId],
queryFn: async () => { queryFn: async () => {
const res = await EmployeeRepository.getEmployeeProfile(employeeId) const res = await EmployeeRepository.getEmployeeProfile(employeeId);
return res.data; return res.data;
}, },
enabled:!!employeeId enabled: !!employeeId,
}); });
}; };
export const useAllEmployees = (showInactive) => { export const useAllEmployees = (showInactive) => {
@ -208,9 +208,6 @@ export const useEmployeesNameByProject = (projectId) => {
// Mutation------------------------------------------------------------------ // Mutation------------------------------------------------------------------
export const useUpdateEmployee = () => { export const useUpdateEmployee = () => {
const selectedProject = useSelector( const selectedProject = useSelector(
(store) => store.localVariables.projectId (store) => store.localVariables.projectId
@ -218,14 +215,15 @@ export const useUpdateEmployee = () => {
const queryClient = useQueryClient(); const queryClient = useQueryClient();
return useMutation({ return useMutation({
mutationFn: (employeeData) => mutationFn: async (employeeData) =>
EmployeeRepository.manageEmployee(employeeData), await EmployeeRepository.manageEmployee(employeeData),
onSuccess: (_, variables) => { onSuccess: (_, variables) => {
debugger;
const id = variables?.id || variables?.employeeId; const id = variables?.id || variables?.employeeId;
const isAllEmployee = variables.IsAllEmployee; const isAllEmployee = variables.IsAllEmployee;
// Cache invalidation // Cache invalidation
queryClient.invalidateQueries({ queryKey: ["employeeProfile",id] }); queryClient.invalidateQueries({ queryKey: ["employeeProfile"] });
queryClient.invalidateQueries({ queryKey: ["allEmployees"] }); queryClient.invalidateQueries({ queryKey: ["allEmployees"] });
// queryClient.invalidateQueries(['employeeProfile', id]); // queryClient.invalidateQueries(['employeeProfile', id]);
queryClient.invalidateQueries({ queryKey: ["projectEmployees"] }); queryClient.invalidateQueries({ queryKey: ["projectEmployees"] });
@ -247,7 +245,6 @@ export const useUpdateEmployee = () => {
}); });
}; };
export const useSuspendEmployee = ({ export const useSuspendEmployee = ({
setIsDeleteModalOpen, setIsDeleteModalOpen,
setemployeeLodaing, setemployeeLodaing,
@ -300,7 +297,6 @@ export const useSuspendEmployee = ({
}); });
}; };
export const useUpdateEmployeeRoles = ({ export const useUpdateEmployeeRoles = ({
onClose, onClose,
resetForm, resetForm,
@ -334,4 +330,4 @@ export const useUpdateEmployeeRoles = ({
isError: mutation.isError, isError: mutation.isError,
error: mutation.error, error: mutation.error,
}; };
}; };

View File

@ -8,19 +8,20 @@ export const useHasUserPermission = (permission) => {
data: projectPermissions = [], data: projectPermissions = [],
isLoading, isLoading,
isError, isError,
} = useAllProjectLevelPermissions(selectedProject); } = useAllProjectLevelPermissions();
// set selectedProject to call api- selectedProject
if (isLoading || !permission) return false; if (isLoading || !permission) return false;
const globalPerms = profile?.featurePermissions ?? []; const globalPerms = profile?.featurePermissions ?? [];
const projectPerms = projectPermissions ?? []; // const projectPerms = projectPermissions ?? [];
if (selectedProject) { // if (selectedProject) {
if (projectPerms.length === 0) { // if (projectPerms.length === 0) {
return projectPerms.includes(permission); // return projectPerms.includes(permission);
} else { // } else {
return projectPerms.includes(permission); // return projectPerms.includes(permission);
} // }
} else { // } else {
return globalPerms.includes(permission); // return globalPerms.includes(permission);
} // }
return globalPerms.includes(permission);
}; };

View File

@ -9,18 +9,24 @@ import { defaultContactFilter } from "../../components/Directory/DirectorySchema
import { useDebounce } from "../../utils/appUtils"; import { useDebounce } from "../../utils/appUtils";
import Pagination from "../../components/common/Pagination"; import Pagination from "../../components/common/Pagination";
import ListViewContact from "../../components/Directory/ListViewContact"; import ListViewContact from "../../components/Directory/ListViewContact";
import { CardViewContactSkeleton, ListViewContactSkeleton } from "../../components/Directory/DirectoryPageSkeleton"; import {
CardViewContactSkeleton,
ListViewContactSkeleton,
} from "../../components/Directory/DirectoryPageSkeleton";
import Loader from "../../components/common/Loader";
// Utility function to format contacts for CSV export // Utility function to format contacts for CSV export
const formatExportData = (contacts) => { const formatExportData = (contacts) => {
return contacts.map(contact => ({ return contacts.map((contact) => ({
Email: contact.contactEmails?.map(e => e.emailAddress).join(", ") || "", Email: contact.contactEmails?.map((e) => e.emailAddress).join(", ") || "",
Phone: contact.contactPhones?.map(p => p.phoneNumber).join(", ") || "", Phone: contact.contactPhones?.map((p) => p.phoneNumber).join(", ") || "",
Created: contact.createdAt ? new Date(contact.createdAt).toLocaleString() : "", Created: contact.createdAt
? new Date(contact.createdAt).toLocaleString()
: "",
Location: contact.address || "", Location: contact.address || "",
Organization: contact.organization || "", Organization: contact.organization || "",
Category: contact.contactCategory?.name || "", Category: contact.contactCategory?.name || "",
Tags: contact.tags?.map(t => t.name).join(", ") || "", Tags: contact.tags?.map((t) => t.name).join(", ") || "",
Buckets: contact.bucketIds?.join(", ") || "", Buckets: contact.bucketIds?.join(", ") || "",
})); }));
}; };
@ -75,8 +81,16 @@ const ContactsPage = ({ projectId, searchText, onExport }) => {
<div className="row mt-5"> <div className="row mt-5">
{gridView ? ( {gridView ? (
<> <>
{isLoading && (
<div>
<Loader />
</div>
)}
{data?.data?.map((contact) => ( {data?.data?.map((contact) => (
<div key={contact.id} className="col-12 col-sm-6 col-md-4 col-lg-4 mb-4"> <div
key={contact.id}
className="col-12 col-sm-6 col-md-4 col-lg-4 mb-4"
>
<CardViewContact IsActive={showActive} contact={contact} /> <CardViewContact IsActive={showActive} contact={contact} />
</div> </div>
))} ))}
@ -95,6 +109,7 @@ const ContactsPage = ({ projectId, searchText, onExport }) => {
<div className="col-12"> <div className="col-12">
<ListViewContact <ListViewContact
data={data?.data} data={data?.data}
isLoading={isLoading}
Pagination={ Pagination={
<Pagination <Pagination
currentPage={currentPage} currentPage={currentPage}

View File

@ -133,7 +133,7 @@ export default function DirectoryPage({ IsPage = true, projectId = null }) {
]} ]}
></Breadcrumb> ></Breadcrumb>
)} )}
<div className="card"> <div className="card ">
<div className="d-flex-row px-2"> <div className="d-flex-row px-2">
<div className="d-flex justify-content-between align-items-center mb-1"> <div className="d-flex justify-content-between align-items-center mb-1">
<ul className="nav nav-tabs"> <ul className="nav nav-tabs">