set Directory page for project

This commit is contained in:
pramod mahajan 2025-09-10 20:35:48 +05:30
parent d6de8cbfc1
commit 4741025dcb
3 changed files with 15 additions and 12 deletions

View File

@ -12,14 +12,14 @@ import ListViewContact from "../../components/Directory/ListViewContact";
import { CardViewContactSkeleton, ListViewContactSkeleton } from "../../components/Directory/DirectoryPageSkeleton";
const ContactsPage = ({ searchText }) => {
const ContactsPage = ({projectId ,searchText }) => {
const [currentPage, setCurrentPage] = useState(1);
const [filters, setFilter] = useState(defaultContactFilter);
const debouncedSearch = useDebounce(searchText, 500);
const { showActive, gridView } = useDirectoryContext();
const { data, isError, isLoading, error } = useContactList(
showActive,
null,
projectId,
ITEMS_PER_PAGE,
currentPage,
filters,

View File

@ -32,7 +32,7 @@ export const useDirectoryContext = () => {
}
return context;
};
export default function DirectoryPage({ IsPage = true, projectId }) {
export default function DirectoryPage({ IsPage = true, projectId=null }) {
const [searchContact, setsearchContact] = useState("");
const [searchNote, setSearchNote] = useState("");
const [activeTab, setActiveTab] = useState("notes");
@ -94,13 +94,13 @@ export default function DirectoryPage({ IsPage = true, projectId }) {
return (
<>
<DirectoryContext.Provider value={contextValues}>
<div className="container-fluid">
<Breadcrumb
<div className={`${IsPage ? "container-fluid":""}`}>
{IsPage && ( <Breadcrumb
data={[
{ label: "Home", link: "/dashboard" },
{ label: "Directory", link: null },
]}
></Breadcrumb>
></Breadcrumb>)}
<div className="card">
<div className="d-flex justify-content-between align-items-center mb-1 px-2">
<ul className="nav nav-tabs">
@ -188,7 +188,7 @@ export default function DirectoryPage({ IsPage = true, projectId }) {
<i className="bx bx-grid-alt"></i>
</button>
</div>
<div className="form-check form-switch text-start m-0 ms-5">
<div className="form-check form-switch d-flex align-items-center ms-4">
<input
type="checkbox"
className="form-check-input"
@ -197,8 +197,11 @@ export default function DirectoryPage({ IsPage = true, projectId }) {
checked={showActive}
onChange={(e) => setShowActive(e.target.checked)}
/>
<label className="form-check-label ms-0">
{showActive ? "In-ACtive":"Active" }
<label
className="form-check-label ms-2"
htmlFor="inactiveEmployeesCheckbox"
>
{showActive ? "Inactive" : "Active"}
</label>
</div>
</div>
@ -211,10 +214,10 @@ export default function DirectoryPage({ IsPage = true, projectId }) {
<div>
<Suspense fallback={<MainDirectoryPageSkeleton />}>
{activeTab === "notes" && (
<NotesPage projectId={null} searchText={searchNote} />
<NotesPage projectId={projectId} searchText={searchNote} />
)}
{activeTab === "contacts" && (
<ContactsPage searchText={searchContact} />
<ContactsPage projectId={projectId} searchText={searchContact} />
)}
</Suspense>
</div>

View File

@ -56,7 +56,7 @@ export const DirectoryRepository = {
const payloadJsonString = JSON.stringify(filter);
return api.get(
`/api/directory/notes?` +
(projectId ? `projectId=${projectId}` : "&") +
(projectId ? `projectId=${projectId}&` : "&") +
`pageSize=${pageSize}&pageNumber=${pageNumber}&filter=${encodeURIComponent(
payloadJsonString
)}&searchString=${encodeURIComponent(searchString)}`