added filter, only display logged user associated projects
This commit is contained in:
parent
a096f3d743
commit
1caeeb890d
@ -163,30 +163,32 @@ const EmployeeList = () => {
|
|||||||
className="dataTables_length text-start"
|
className="dataTables_length text-start"
|
||||||
id="DataTables_Table_0_length"
|
id="DataTables_Table_0_length"
|
||||||
>
|
>
|
||||||
<label>
|
<label>
|
||||||
<select
|
<select
|
||||||
id="project-select"
|
id="project-select"
|
||||||
onChange={(e) => setSelectedProject(e.target.value)}
|
onChange={(e) => setSelectedProject(e.target.value)}
|
||||||
name="DataTables_Table_0_length"
|
name="DataTables_Table_0_length"
|
||||||
aria-controls="DataTables_Table_0"
|
aria-controls="DataTables_Table_0"
|
||||||
className="form-select form-select-sm"
|
className="form-select form-select-sm"
|
||||||
value={selectedProject || ""}
|
value={selectedProject || ""}
|
||||||
>
|
>
|
||||||
{projectLoading ? (
|
{projectLoading ? (
|
||||||
<option value="Loading">Loading...</option>
|
<option value="Loading">Loading...</option>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
<option value="">All Employees</option>
|
<option value="">All Employees</option>
|
||||||
{Array.isArray(projects) &&
|
{Array.isArray(projects) &&
|
||||||
projects.map((item) => (
|
projects
|
||||||
<option key={item.id} value={item.id}>
|
.filter((item) => loginUser?.projects?.includes(String(item.id)))
|
||||||
{item.name}
|
.map((item) => (
|
||||||
</option>
|
<option key={item.id} value={item.id}>
|
||||||
))}
|
{item.name}
|
||||||
</>
|
</option>
|
||||||
)}
|
))}
|
||||||
</select>
|
</>
|
||||||
</label>
|
)}
|
||||||
|
</select>
|
||||||
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -176,10 +176,13 @@ const ProjectList = () =>
|
|||||||
{loading && <p className="text-center">Loading...</p>}
|
{loading && <p className="text-center">Loading...</p>}
|
||||||
|
|
||||||
|
|
||||||
{currentItems &&
|
{Array.isArray(currentItems) && loginUser?.projects && (
|
||||||
currentItems.map((item) => (
|
currentItems
|
||||||
<ProjectCard projectData={item} key={item.id}></ProjectCard>
|
.filter((item) => loginUser.projects.includes(String(item.id)))
|
||||||
))}
|
.map((item) => (
|
||||||
|
<ProjectCard projectData={item} key={item.id} />
|
||||||
|
))
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
{/* Pagination */}
|
{/* Pagination */}
|
||||||
{!loading && (
|
{!loading && (
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user