remove dashboard
This commit is contained in:
parent
2aff3b9e80
commit
c1e5ff4043
@ -27,35 +27,7 @@ const Dashboard = () => {
|
||||
return (
|
||||
<div className="container-fluid mt-5">
|
||||
<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 && (
|
||||
<div className="col-xxl-6 col-lg-6">
|
||||
<AttendanceOverview /> {/* ✅ Removed unnecessary projectId prop */}
|
||||
|
@ -4,8 +4,9 @@ import Pagination from "../common/Pagination";
|
||||
import { useDirectoryContext } from "../../pages/Directory/DirectoryPage";
|
||||
import { useActiveInActiveContact } from "../../hooks/useDirectory";
|
||||
import ConfirmModal from "../common/ConfirmModal";
|
||||
import Loader from "../common/Loader";
|
||||
|
||||
const ListViewContact = ({ data, Pagination }) => {
|
||||
const ListViewContact = ({ data, Pagination, isLoading }) => {
|
||||
const { showActive, setManageContact, setContactOpen } =
|
||||
useDirectoryContext();
|
||||
const [deleteContact, setDeleteContact] = useState({
|
||||
@ -97,103 +98,112 @@ const ListViewContact = ({ data, Pagination }) => {
|
||||
paramData={deleteContact.contactId}
|
||||
isOpen={deleteContact.Open}
|
||||
/>
|
||||
<div className="card ">
|
||||
<div className="card page-min-h">
|
||||
<div
|
||||
className="card-datatable table-responsive"
|
||||
id="horizontal-example"
|
||||
>
|
||||
<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}
|
||||
{isLoading && (
|
||||
<div>
|
||||
<Loader />
|
||||
</div>
|
||||
)}
|
||||
{data && (
|
||||
<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 className="sticky-action-column bg-white text-center">
|
||||
Action
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody >
|
||||
{Array.isArray(data) && data.length > 0 ? (
|
||||
data.map((row, i) => (
|
||||
<tr
|
||||
key={i}
|
||||
style={{ background: `${!showActive ? "#f8f6f6" : ""}` }}
|
||||
>
|
||||
{contactList.map((col) => (
|
||||
<td key={col.key} className={col.align}>
|
||||
{col.getValue(row)}
|
||||
</td>
|
||||
))}
|
||||
<td className="text-center">
|
||||
{showActive ? (
|
||||
<div className="d-flex justify-content-center gap-2">
|
||||
<i
|
||||
className="bx bx-show text-primary cursor-pointer"
|
||||
onClick={() =>
|
||||
setContactOpen({ contact: row, Open: true })
|
||||
}
|
||||
></i>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{Array.isArray(data) && data.length > 0 ? (
|
||||
data.map((row, i) => (
|
||||
<tr
|
||||
key={i}
|
||||
style={{
|
||||
background: `${!showActive ? "#f8f6f6" : ""}`,
|
||||
}}
|
||||
>
|
||||
{contactList.map((col) => (
|
||||
<td key={col.key} className={col.align}>
|
||||
{col.getValue(row)}
|
||||
</td>
|
||||
))}
|
||||
<td className="text-center">
|
||||
{showActive ? (
|
||||
<div className="d-flex justify-content-center gap-2">
|
||||
<i
|
||||
className="bx bx-show text-primary cursor-pointer"
|
||||
onClick={() =>
|
||||
setContactOpen({ contact: row, Open: true })
|
||||
}
|
||||
></i>
|
||||
|
||||
<i
|
||||
className="bx bx-edit text-secondary cursor-pointer"
|
||||
onClick={() =>
|
||||
setManageContact({
|
||||
isOpen: true,
|
||||
contactId: row.id,
|
||||
})
|
||||
}
|
||||
></i>
|
||||
<i
|
||||
className="bx bx-edit text-secondary cursor-pointer"
|
||||
onClick={() =>
|
||||
setManageContact({
|
||||
isOpen: true,
|
||||
contactId: row.id,
|
||||
})
|
||||
}
|
||||
></i>
|
||||
|
||||
<i
|
||||
className="bx bx-trash text-danger cursor-pointer"
|
||||
onClick={() =>
|
||||
setDeleteContact({
|
||||
contactId: row.id,
|
||||
Open: true,
|
||||
})
|
||||
}
|
||||
></i>
|
||||
</div>
|
||||
) : (
|
||||
<i
|
||||
className="bx bx-trash text-danger cursor-pointer"
|
||||
onClick={() =>
|
||||
setDeleteContact({
|
||||
contactId: row.id,
|
||||
Open: true,
|
||||
})
|
||||
}
|
||||
></i>
|
||||
</div>
|
||||
) : (
|
||||
<i
|
||||
className={`bx ${
|
||||
isPending && activeContact === row.id
|
||||
? "bx-loader-alt bx-spin"
|
||||
: "bx-recycle"
|
||||
className={`bx ${
|
||||
isPending && activeContact === row.id
|
||||
? "bx-loader-alt bx-spin"
|
||||
: "bx-recycle"
|
||||
} me-1 text-primary cursor-pointer`}
|
||||
title="Restore"
|
||||
onClick={() => {
|
||||
setActiveContact(row.id);
|
||||
handleActiveInactive(row.id);
|
||||
}}
|
||||
></i>
|
||||
)}
|
||||
title="Restore"
|
||||
onClick={() => {
|
||||
setActiveContact(row.id);
|
||||
handleActiveInactive(row.id);
|
||||
}}
|
||||
></i>
|
||||
)}
|
||||
</td>
|
||||
</tr>
|
||||
))
|
||||
) : (
|
||||
<tr style={{ height: "200px" }}>
|
||||
<td
|
||||
colSpan={contactList.length + 1}
|
||||
className="text-center align-middle"
|
||||
>
|
||||
No contacts found
|
||||
</td>
|
||||
</tr>
|
||||
))
|
||||
) : (
|
||||
<tr style={{ height: "200px" }}>
|
||||
<td
|
||||
colSpan={contactList.length + 1}
|
||||
className="text-center align-middle"
|
||||
>
|
||||
No contacts found
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
)}
|
||||
</tbody>
|
||||
</table>
|
||||
{Pagination && (
|
||||
<div className="d-flex justify-content-start">
|
||||
{Pagination}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</tbody>
|
||||
</table>
|
||||
{Pagination && (
|
||||
<div className="d-flex justify-content-start">{Pagination}</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
{data?.length === 0 && !isLoading && (
|
||||
<div className="text-center"> No Expense Found</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
|
@ -23,7 +23,7 @@ import Label from "../common/Label";
|
||||
const ManageContact = ({ contactId, closeModal }) => {
|
||||
// fetch master data
|
||||
const { buckets, loading: bucketsLoaging } = useBuckets();
|
||||
const { projects, loading: projectLoading } = useProjects();
|
||||
const { data:projects, loading: projectLoading } = useProjects();
|
||||
const { contactCategory, loading: contactCategoryLoading } =
|
||||
useContactCategory();
|
||||
const { organizationList } = useOrganization();
|
||||
|
@ -246,16 +246,18 @@ const Header = () => {
|
||||
)}
|
||||
|
||||
<ul className="navbar-nav flex-row align-items-center ms-md-auto">
|
||||
<li className="nav-item navbar-dropdown dropdown-user dropdown">
|
||||
<button
|
||||
className="btn btn-sm btn-primary"
|
||||
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>
|
||||
</button>
|
||||
</li>
|
||||
{HasManageProjectPermission && (
|
||||
<li className="nav-item navbar-dropdown dropdown-user dropdown">
|
||||
<button
|
||||
className="btn btn-sm btn-primary"
|
||||
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>
|
||||
</button>
|
||||
</li>
|
||||
)}
|
||||
<li className="nav-item navbar-dropdown dropdown-user dropdown">
|
||||
<a
|
||||
aria-label="dropdown profile avatar"
|
||||
|
@ -483,6 +483,7 @@ export const useUpdateContact = (onSuccessCallBack) => {
|
||||
mutationFn: async ({ contactId, contactPayload }) =>
|
||||
await DirectoryRepository.UpdateContact(contactId, contactPayload),
|
||||
onSuccess: (_, variables) => {
|
||||
queryClient.invalidateQueries({ queryKey: ["Contact"] });
|
||||
queryClient.invalidateQueries({ queryKey: ["contacts"] });
|
||||
showToast("Contact updated Successfully", "success");
|
||||
if (onSuccessCallBack) onSuccessCallBack();
|
||||
|
@ -12,13 +12,13 @@ import { queryClient } from "../layouts/AuthLayout";
|
||||
// Query ---------------------------------------------------------------------------
|
||||
|
||||
export const useEmployee = (employeeId) => {
|
||||
return useQuery({
|
||||
return useQuery({
|
||||
queryKey: ["employeeProfile", employeeId],
|
||||
queryFn: async () => {
|
||||
const res = await EmployeeRepository.getEmployeeProfile(employeeId)
|
||||
const res = await EmployeeRepository.getEmployeeProfile(employeeId);
|
||||
return res.data;
|
||||
},
|
||||
enabled:!!employeeId
|
||||
enabled: !!employeeId,
|
||||
});
|
||||
};
|
||||
|
||||
@ -208,9 +208,6 @@ export const useEmployeesNameByProject = (projectId) => {
|
||||
|
||||
// Mutation------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
|
||||
export const useUpdateEmployee = () => {
|
||||
const selectedProject = useSelector(
|
||||
(store) => store.localVariables.projectId
|
||||
@ -218,14 +215,15 @@ export const useUpdateEmployee = () => {
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
return useMutation({
|
||||
mutationFn: (employeeData) =>
|
||||
EmployeeRepository.manageEmployee(employeeData),
|
||||
mutationFn: async (employeeData) =>
|
||||
await EmployeeRepository.manageEmployee(employeeData),
|
||||
onSuccess: (_, variables) => {
|
||||
debugger;
|
||||
const id = variables?.id || variables?.employeeId;
|
||||
const isAllEmployee = variables.IsAllEmployee;
|
||||
|
||||
// Cache invalidation
|
||||
queryClient.invalidateQueries({ queryKey: ["employeeProfile",id] });
|
||||
queryClient.invalidateQueries({ queryKey: ["employeeProfile"] });
|
||||
queryClient.invalidateQueries({ queryKey: ["allEmployees"] });
|
||||
// queryClient.invalidateQueries(['employeeProfile', id]);
|
||||
queryClient.invalidateQueries({ queryKey: ["projectEmployees"] });
|
||||
@ -247,7 +245,6 @@ export const useUpdateEmployee = () => {
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
export const useSuspendEmployee = ({
|
||||
setIsDeleteModalOpen,
|
||||
setemployeeLodaing,
|
||||
@ -300,7 +297,6 @@ export const useSuspendEmployee = ({
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
export const useUpdateEmployeeRoles = ({
|
||||
onClose,
|
||||
resetForm,
|
||||
|
@ -8,19 +8,20 @@ export const useHasUserPermission = (permission) => {
|
||||
data: projectPermissions = [],
|
||||
isLoading,
|
||||
isError,
|
||||
} = useAllProjectLevelPermissions(selectedProject);
|
||||
|
||||
} = useAllProjectLevelPermissions();
|
||||
// set selectedProject to call api- selectedProject
|
||||
if (isLoading || !permission) return false;
|
||||
|
||||
const globalPerms = profile?.featurePermissions ?? [];
|
||||
const projectPerms = projectPermissions ?? [];
|
||||
if (selectedProject) {
|
||||
if (projectPerms.length === 0) {
|
||||
return projectPerms.includes(permission);
|
||||
} else {
|
||||
return projectPerms.includes(permission);
|
||||
}
|
||||
} else {
|
||||
return globalPerms.includes(permission);
|
||||
}
|
||||
// const projectPerms = projectPermissions ?? [];
|
||||
// if (selectedProject) {
|
||||
// if (projectPerms.length === 0) {
|
||||
// return projectPerms.includes(permission);
|
||||
// } else {
|
||||
// return projectPerms.includes(permission);
|
||||
// }
|
||||
// } else {
|
||||
// return globalPerms.includes(permission);
|
||||
// }
|
||||
return globalPerms.includes(permission);
|
||||
};
|
||||
|
@ -9,18 +9,24 @@ import { defaultContactFilter } from "../../components/Directory/DirectorySchema
|
||||
import { useDebounce } from "../../utils/appUtils";
|
||||
import Pagination from "../../components/common/Pagination";
|
||||
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
|
||||
const formatExportData = (contacts) => {
|
||||
return contacts.map(contact => ({
|
||||
Email: contact.contactEmails?.map(e => e.emailAddress).join(", ") || "",
|
||||
Phone: contact.contactPhones?.map(p => p.phoneNumber).join(", ") || "",
|
||||
Created: contact.createdAt ? new Date(contact.createdAt).toLocaleString() : "",
|
||||
return contacts.map((contact) => ({
|
||||
Email: contact.contactEmails?.map((e) => e.emailAddress).join(", ") || "",
|
||||
Phone: contact.contactPhones?.map((p) => p.phoneNumber).join(", ") || "",
|
||||
Created: contact.createdAt
|
||||
? new Date(contact.createdAt).toLocaleString()
|
||||
: "",
|
||||
Location: contact.address || "",
|
||||
Organization: contact.organization || "",
|
||||
Category: contact.contactCategory?.name || "",
|
||||
Tags: contact.tags?.map(t => t.name).join(", ") || "",
|
||||
Tags: contact.tags?.map((t) => t.name).join(", ") || "",
|
||||
Buckets: contact.bucketIds?.join(", ") || "",
|
||||
}));
|
||||
};
|
||||
@ -75,8 +81,16 @@ const ContactsPage = ({ projectId, searchText, onExport }) => {
|
||||
<div className="row mt-5">
|
||||
{gridView ? (
|
||||
<>
|
||||
{isLoading && (
|
||||
<div>
|
||||
<Loader />
|
||||
</div>
|
||||
)}
|
||||
{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} />
|
||||
</div>
|
||||
))}
|
||||
@ -95,6 +109,7 @@ const ContactsPage = ({ projectId, searchText, onExport }) => {
|
||||
<div className="col-12">
|
||||
<ListViewContact
|
||||
data={data?.data}
|
||||
isLoading={isLoading}
|
||||
Pagination={
|
||||
<Pagination
|
||||
currentPage={currentPage}
|
||||
|
@ -133,7 +133,7 @@ export default function DirectoryPage({ IsPage = true, projectId = null }) {
|
||||
]}
|
||||
></Breadcrumb>
|
||||
)}
|
||||
<div className="card">
|
||||
<div className="card ">
|
||||
<div className="d-flex-row px-2">
|
||||
<div className="d-flex justify-content-between align-items-center mb-1">
|
||||
<ul className="nav nav-tabs">
|
||||
|
Loading…
x
Reference in New Issue
Block a user