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 (
<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 */}

View File

@ -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,11 +98,17 @@ 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"
>
{isLoading && (
<div>
<Loader />
</div>
)}
{data && (
<div className="dataTables_wrapper no-footer mx-5 pb-2">
<table className="table dataTable text-nowrap">
<thead>
@ -121,7 +128,9 @@ const ListViewContact = ({ data, Pagination }) => {
data.map((row, i) => (
<tr
key={i}
style={{ background: `${!showActive ? "#f8f6f6" : ""}` }}
style={{
background: `${!showActive ? "#f8f6f6" : ""}`,
}}
>
{contactList.map((col) => (
<td key={col.key} className={col.align}>
@ -184,16 +193,17 @@ const ListViewContact = ({ data, Pagination }) => {
No contacts found
</td>
</tr>
)}
</tbody>
</table>
{Pagination && (
<div className="d-flex justify-content-start">
{Pagination}
</div>
<div className="d-flex justify-content-start">{Pagination}</div>
)}
</div>
)}
{data?.length === 0 && !isLoading && (
<div className="text-center"> No Expense Found</div>
)}
</div>
</div>
</>

View File

@ -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();

View File

@ -246,6 +246,7 @@ const Header = () => {
)}
<ul className="navbar-nav flex-row align-items-center ms-md-auto">
{HasManageProjectPermission && (
<li className="nav-item navbar-dropdown dropdown-user dropdown">
<button
className="btn btn-sm btn-primary"
@ -256,6 +257,7 @@ const Header = () => {
<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"

View File

@ -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();

View File

@ -15,10 +15,10 @@ export const useEmployee = (employeeId) => {
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,

View File

@ -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 {
// 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);
}
};

View File

@ -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}