refactor: update EmployeeProfile component layout and add employee details table

This commit is contained in:
Vaibhav Surve 2025-04-16 15:55:06 +05:30 committed by Vikas Nale
parent 49e3e0735e
commit 37620c78a1

View File

@ -9,6 +9,7 @@ import { useEmployeeProfile, useEmployees, useEmployeesByProject } from "../../h
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";
import { useNavigate } from "react-router-dom";
import Avatar from "../../components/common/Avatar"; import Avatar from "../../components/common/Avatar";
const EmployeeProfile = () => { const EmployeeProfile = () => {
@ -50,7 +51,7 @@ const EmployeeProfile = () => {
} }
}, [employeeId]); }, [employeeId]);
const navigate = useNavigate();
const renderContent = () => { const renderContent = () => {
if (loading) return <div>Loading</div>; if (loading) return <div>Loading</div>;
switch (activePill) { switch (activePill) {
@ -113,47 +114,62 @@ const EmployeeProfile = () => {
<Avatar <Avatar
firstName={`${currentEmployee?.firstName}`} firstName={`${currentEmployee?.firstName}`}
lastName={`${currentEmployee?.lastName}`} lastName={`${currentEmployee?.lastName}`}
size={"lg"}
/> />
<div className="py-2"> <div className="py-2">
<p className="h6">{`${currentEmployee?.firstName} ${currentEmployee?.lastName}`}</p> <p className="h6">{`${currentEmployee?.firstName} ${currentEmployee?.lastName}`}</p>
</div> </div>
<hr className="my-2" />
</div> </div>
<div className="w-100 d-flex flex-column justify-content-start"> <div className="w-100 d-flex flex-column justify-content-start">
<div className="d-flex justify-content-between align-items-center mb-3"> <div className="mt-3 w-100">
<small className="card-text text-uppercase text-muted small mb-0">Contacts</small> <h6 className="mb-2 text-muted text-start">Employee Info</h6>
<a href="javascript:;" class="btn btn-icon item-edit"><i class="bx bx-edit bx-sm"></i></a> <table className="table table-borderless mb-3">
</div> <tbody>
<tr>
<td className="fw-medium text-start">Email:</td>
<td className="text-start">{currentEmployee?.email || <em>NA</em>}</td>
</tr>
<tr>
<td className="fw-medium text-start">Phone Number:</td>
<td className="text-start">{currentEmployee?.phoneNumber || <em>NA</em>}</td>
</tr>
<tr>
<td className="fw-medium text-start">Emergency Contact Person:</td>
<td className="text-start">{currentEmployee?.emergencyContactPerson || <em>NA</em>}</td>
</tr>
<tr>
<td className="fw-medium text-start">Emergency Contact Number:</td>
<td className="text-start">{currentEmployee?.emergencyPhoneNumber || <em>NA</em>}</td>
</tr>
<ul className="list-unstyled my-3 py-1"> <tr>
<li className="d-flex align-items-center mb-4"> <td className="fw-medium text-start">Gender:</td>
<i className="bx bx-phone"></i> <td className="text-start">{currentEmployee?.gender || <em>NA</em>}</td>
<span className="fw-medium mx-2">Contact Number:</span> </tr>
<span className={`${currentEmployee?.emergencyPhoneNumber ? "" : "text-muted"}`}> <tr>
{currentEmployee?.emergencyPhoneNumber || <em>NA</em>} <td className="fw-medium text-start">Birth Date:</td>
</span> <td className="text-start">{currentEmployee?.birthDate ? new Date(currentEmployee.birthDate).toLocaleDateString() : <em>NA</em>}</td>
</li> </tr>
<li className="d-flex align-items-center mb-4 text-start">
<i className="bx bx-envelope"></i>
<span className="fw-medium mx-2">Email:</span> <tr>
<span className={`text-break text-wrap ${currentEmployee?.email ? "" : "text-muted"}`}> <td className="fw-medium text-start">Joining Date:</td>
{currentEmployee?.email || <em className="muted">NA</em>} <td className="text-start">{currentEmployee?.joiningDate ? new Date(currentEmployee.joiningDate).toLocaleDateString() : <em>NA</em>}</td>
</span> </tr>
</li> <tr>
<li className="d-flex align-items-center mb-4"> <td className="fw-medium text-start">Job Role:</td>
<i className="bx bx-user"></i> <td className="text-start">{currentEmployee?.jobRole || <em>NA</em>}</td>
<span className="fw-medium mx-2">Contact Person:</span> </tr>
<span>{currentEmployee?.emergencyContactPerson}</span> <tr>
</li> <td className="fw-medium text-start">Address:</td>
<li className="d-flex align-items-center mb-4"> <td className="text-start">{currentEmployee?.currentAddress || <em>NA</em>}</td>
<i className="bx bx-flag"></i> </tr>
<span className="fw-medium mx-2">Address:</span> </tbody>
<span className={`${currentEmployee?.currentAddress ? "" : "text-muted"}`}> </table>
{currentEmployee?.currentAddress || <em>NA</em>} </div>
</span> <button className="btn btn-primary btn-block" onClick={() => navigate(`/employee/manage/${currentEmployee?.id}`)}>
</li> Edit Profile
</ul> </button>
</div> </div>
</div> </div>
</div> </div>