added userPermissions
This commit is contained in:
parent
38fbc6dc84
commit
c61cb3bb63
@ -11,7 +11,12 @@ import { hasUserPermission } from "../../utils/authUtils";
|
|||||||
import { MANAGE_EMPLOYEES } from "../../utils/constants";
|
import { MANAGE_EMPLOYEES } from "../../utils/constants";
|
||||||
import { useHasUserPermission } from "../../hooks/useHasUserPermission";
|
import { useHasUserPermission } from "../../hooks/useHasUserPermission";
|
||||||
import SuspendEmp from "../../components/Employee/SuspendEmp";
|
import SuspendEmp from "../../components/Employee/SuspendEmp";
|
||||||
import {exportToCSV,exportToExcel,printTable,exportToPDF} from "../../utils/tableExportUtils";
|
import {
|
||||||
|
exportToCSV,
|
||||||
|
exportToExcel,
|
||||||
|
printTable,
|
||||||
|
exportToPDF,
|
||||||
|
} from "../../utils/tableExportUtils";
|
||||||
|
|
||||||
const EmployeeList = () => {
|
const EmployeeList = () => {
|
||||||
const { profile: loginUser } = useProfile();
|
const { profile: loginUser } = useProfile();
|
||||||
@ -124,7 +129,6 @@ const EmployeeList = () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{isCreateModalOpen && (
|
{isCreateModalOpen && (
|
||||||
@ -179,7 +183,11 @@ const EmployeeList = () => {
|
|||||||
<option value="">All Employees</option>
|
<option value="">All Employees</option>
|
||||||
{Array.isArray(projects) &&
|
{Array.isArray(projects) &&
|
||||||
projects
|
projects
|
||||||
.filter((item) => loginUser?.projects?.includes(String(item.id)))
|
.filter((item) =>
|
||||||
|
loginUser?.projects?.includes(
|
||||||
|
String(item.id)
|
||||||
|
)
|
||||||
|
)
|
||||||
.map((item) => (
|
.map((item) => (
|
||||||
<option key={item.id} value={item.id}>
|
<option key={item.id} value={item.id}>
|
||||||
{item.name}
|
{item.name}
|
||||||
@ -223,22 +231,39 @@ const EmployeeList = () => {
|
|||||||
</button>
|
</button>
|
||||||
<ul className="dropdown-menu">
|
<ul className="dropdown-menu">
|
||||||
<li>
|
<li>
|
||||||
<a className="dropdown-item" href="#" onClick={() => handleExport("print")}>
|
<a
|
||||||
|
className="dropdown-item"
|
||||||
|
href="#"
|
||||||
|
onClick={() => handleExport("print")}
|
||||||
|
>
|
||||||
<i className="bx bx-printer me-1"></i> Print
|
<i className="bx bx-printer me-1"></i> Print
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a className="dropdown-item" href="#" onClick={() => handleExport("csv")}>
|
<a
|
||||||
|
className="dropdown-item"
|
||||||
|
href="#"
|
||||||
|
onClick={() => handleExport("csv")}
|
||||||
|
>
|
||||||
<i className="bx bx-file me-1"></i> CSV
|
<i className="bx bx-file me-1"></i> CSV
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a className="dropdown-item" href="#" onClick={() => handleExport("excel")}>
|
<a
|
||||||
<i className="bx bxs-file-export me-1"></i> Excel
|
className="dropdown-item"
|
||||||
|
href="#"
|
||||||
|
onClick={() => handleExport("excel")}
|
||||||
|
>
|
||||||
|
<i className="bx bxs-file-export me-1"></i>{" "}
|
||||||
|
Excel
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a className="dropdown-item" href="#" onClick={() => handleExport("pdf")}>
|
<a
|
||||||
|
className="dropdown-item"
|
||||||
|
href="#"
|
||||||
|
onClick={() => handleExport("pdf")}
|
||||||
|
>
|
||||||
<i className="bx bxs-file-pdf me-1"></i> PDF
|
<i className="bx bxs-file-pdf me-1"></i> PDF
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
@ -468,13 +493,13 @@ const EmployeeList = () => {
|
|||||||
to={`/employee/manage/${item.id}`}
|
to={`/employee/manage/${item.id}`}
|
||||||
className="dropdown-item py-1"
|
className="dropdown-item py-1"
|
||||||
>
|
>
|
||||||
<i class='bx bx-edit bx-sm'></i> Edit
|
<i class="bx bx-edit bx-sm"></i> Edit
|
||||||
</Link>
|
</Link>
|
||||||
<button
|
<button
|
||||||
className="dropdown-item py-1"
|
className="dropdown-item py-1"
|
||||||
onClick={handleShow}
|
onClick={handleShow}
|
||||||
>
|
>
|
||||||
<i class='bx bx-task-x bx-sm'></i> Suspend
|
<i class="bx bx-task-x bx-sm"></i> Suspend
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
className="dropdown-item py-1"
|
className="dropdown-item py-1"
|
||||||
@ -483,7 +508,7 @@ const EmployeeList = () => {
|
|||||||
data-bs-target="#managerole-modal"
|
data-bs-target="#managerole-modal"
|
||||||
onClick={() => handleConfigData(item.id)}
|
onClick={() => handleConfigData(item.id)}
|
||||||
>
|
>
|
||||||
<i class='bx bx-cog bx-sm'></i> Manage Role
|
<i class="bx bx-cog bx-sm"></i> Manage Role
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user