show change password button to self only
This commit is contained in:
parent
a480c3b111
commit
9b40317eb2
@ -10,6 +10,8 @@ import {
|
|||||||
useEmployees,
|
useEmployees,
|
||||||
useEmployeesByProject,
|
useEmployeesByProject,
|
||||||
} from "../../hooks/useEmployees";
|
} from "../../hooks/useEmployees";
|
||||||
|
import { useProfile } from "../../hooks/useProfile";
|
||||||
|
|
||||||
import { useSelector } from "react-redux";
|
import { useSelector } from "react-redux";
|
||||||
import EmployeeRepository from "../../repositories/EmployeeRepository";
|
import EmployeeRepository from "../../repositories/EmployeeRepository";
|
||||||
import { ComingSoonPage } from "../Misc/ComingSoonPage";
|
import { ComingSoonPage } from "../Misc/ComingSoonPage";
|
||||||
@ -20,6 +22,8 @@ import ManageEmployee from "../../components/Employee/ManageEmployee";
|
|||||||
import { useChangePassword } from "../../components/Context/ChangePasswordContext";
|
import { useChangePassword } from "../../components/Context/ChangePasswordContext";
|
||||||
|
|
||||||
const EmployeeProfile = () => {
|
const EmployeeProfile = () => {
|
||||||
|
const { profile } = useProfile();
|
||||||
|
|
||||||
const projectID = useSelector((store) => store.localVariables.projectId);
|
const projectID = useSelector((store) => store.localVariables.projectId);
|
||||||
const { employeeId } = useParams();
|
const { employeeId } = useParams();
|
||||||
// const {employee,loading} = useEmployeeProfile(employeeId)
|
// const {employee,loading} = useEmployeeProfile(employeeId)
|
||||||
@ -97,28 +101,28 @@ const EmployeeProfile = () => {
|
|||||||
if (loading) {
|
if (loading) {
|
||||||
return <div>Loading...</div>;
|
return <div>Loading...</div>;
|
||||||
}
|
}
|
||||||
const { openChangePassword } = useChangePassword();
|
const { openChangePassword } = useChangePassword();
|
||||||
return (
|
return (
|
||||||
<> {showModal && (<div
|
<>
|
||||||
className={`modal fade ${showModal ? "show" : ""} `}
|
{" "}
|
||||||
tabIndex="-1"
|
{showModal && (
|
||||||
role="dialog"
|
|
||||||
style={{ display: showModal ? "block" : "none" }}
|
|
||||||
aria-hidden={!showModal}
|
|
||||||
>
|
|
||||||
<div className="modal-dialog modal-xl modal-dialog-centered ">
|
|
||||||
<div
|
<div
|
||||||
className="modal-content overflow-y-auto overflow-x-hidden"
|
className={`modal fade ${showModal ? "show" : ""} `}
|
||||||
style={{ maxHeight: "90vh" }}
|
tabIndex="-1"
|
||||||
|
role="dialog"
|
||||||
|
style={{ display: showModal ? "block" : "none" }}
|
||||||
|
aria-hidden={!showModal}
|
||||||
>
|
>
|
||||||
<ManageEmployee
|
<div className="modal-dialog modal-xl modal-dialog-centered ">
|
||||||
employeeId={employeeId}
|
<div
|
||||||
onClosed={closeModal}
|
className="modal-content overflow-y-auto overflow-x-hidden"
|
||||||
/>
|
style={{ maxHeight: "90vh" }}
|
||||||
|
>
|
||||||
|
<ManageEmployee employeeId={employeeId} onClosed={closeModal} />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
)}
|
||||||
</div>)}
|
|
||||||
|
|
||||||
<div className="container-xxl flex-grow-1 container-p-y">
|
<div className="container-xxl flex-grow-1 container-p-y">
|
||||||
<Breadcrumb
|
<Breadcrumb
|
||||||
data={[
|
data={[
|
||||||
@ -188,7 +192,9 @@ const { openChangePassword } = useChangePassword();
|
|||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td className="fw-medium text-start">Gender:</td>
|
<td className="fw-medium text-start">
|
||||||
|
Gender:
|
||||||
|
</td>
|
||||||
<td className="text-start">
|
<td className="text-start">
|
||||||
{currentEmployee?.gender || <em>NA</em>}
|
{currentEmployee?.gender || <em>NA</em>}
|
||||||
</td>
|
</td>
|
||||||
@ -231,9 +237,13 @@ const { openChangePassword } = useChangePassword();
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td className="fw-medium text-start">Address:</td>
|
<td className="fw-medium text-start">
|
||||||
|
Address:
|
||||||
|
</td>
|
||||||
<td className="text-start">
|
<td className="text-start">
|
||||||
{currentEmployee?.currentAddress || <em>NA</em>}
|
{currentEmployee?.currentAddress || (
|
||||||
|
<em>NA</em>
|
||||||
|
)}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
@ -245,15 +255,14 @@ const { openChangePassword } = useChangePassword();
|
|||||||
>
|
>
|
||||||
Edit Profile
|
Edit Profile
|
||||||
</button>
|
</button>
|
||||||
|
{currentEmployee?.id == profile?.employeeInfo?.id && (
|
||||||
<button
|
<button
|
||||||
className="btn btn-outline-primary btn-block mt-2"
|
className="btn btn-outline-primary btn-block mt-2"
|
||||||
onClick={() => openChangePassword()}
|
onClick={() => openChangePassword()}
|
||||||
>
|
>
|
||||||
Change Password
|
Change Password
|
||||||
</button>
|
</button>
|
||||||
|
)}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -276,7 +285,6 @@ const { openChangePassword } = useChangePassword();
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user