added generic modal for edit profile

This commit is contained in:
Pramod Mahajan 2025-07-09 16:37:09 +05:30
parent bba4315a8e
commit 01591c429e

View File

@ -20,6 +20,7 @@ import Avatar from "../../components/common/Avatar";
import AttendancesEmployeeRecords from "./AttendancesEmployeeRecords"; import AttendancesEmployeeRecords from "./AttendancesEmployeeRecords";
import ManageEmployee from "../../components/Employee/ManageEmployee"; import ManageEmployee from "../../components/Employee/ManageEmployee";
import { useChangePassword } from "../../components/Context/ChangePasswordContext"; import { useChangePassword } from "../../components/Context/ChangePasswordContext";
import GlobalModel from "../../components/common/GlobalModel";
const EmployeeProfile = () => { const EmployeeProfile = () => {
const { profile } = useProfile(); const { profile } = useProfile();
@ -39,11 +40,7 @@ const EmployeeProfile = () => {
setActivePill(pillKey); setActivePill(pillKey);
}; };
const closeModal = () => {
setShowModal(false);
fetchEmployeeProfile(employeeId);
};
const handleShow = () => setShowModal(true);
const fetchEmployeeProfile = async (employeeID) => { const fetchEmployeeProfile = async (employeeID) => {
try { try {
@ -104,24 +101,10 @@ const EmployeeProfile = () => {
const { openChangePassword } = useChangePassword(); const { openChangePassword } = useChangePassword();
return ( return (
<> <>
{" "}
{showModal && ( {showModal && (
<div <GlobalModel size="lg" isOpen={showModal} closeModal={()=>setShowModal(false)}>
className={`modal fade ${showModal ? "show" : ""} `} <ManageEmployee employeeId={employeeId} onClosed={()=>setShowModal(false)} />
tabIndex="-1" </GlobalModel>
role="dialog"
style={{ display: showModal ? "block" : "none" }}
aria-hidden={!showModal}
>
<div className="modal-dialog modal-xl modal-dialog-centered ">
<div
className="modal-content overflow-y-auto overflow-x-hidden"
style={{ maxHeight: "90vh" }}
>
<ManageEmployee employeeId={employeeId} onClosed={closeModal} />
</div>
</div>
</div>
)} )}
<div className="container-fluid"> <div className="container-fluid">
<Breadcrumb <Breadcrumb
@ -251,7 +234,7 @@ const EmployeeProfile = () => {
</div> </div>
<button <button
className="btn btn-primary btn-block" className="btn btn-primary btn-block"
onClick={() => handleShow()} onClick={()=>setShowModal(true)}
> >
Edit Profile Edit Profile
</button> </button>