- Remove consoe log
- Handle projects dropdown hidden on profile page
This commit is contained in:
parent
e76284598e
commit
dd81d873f1
@ -22,36 +22,36 @@ const EmpBanner = ({ profile, loggedInUser }) => {
|
||||
/>
|
||||
</GlobalModel>
|
||||
)}
|
||||
<div class="user-profile-header d-flex flex-column flex-lg-row text-sm-start text-center mb-8">
|
||||
<div class="flex-shrink-0 mt-1 mx-sm-0 mx-auto">
|
||||
<div className="user-profile-header d-flex flex-column flex-lg-row text-sm-start text-center mb-8">
|
||||
<div className="flex-shrink-0 mt-1 mx-sm-0 mx-auto">
|
||||
<img
|
||||
width={125}
|
||||
src="../../assets/img/avatars/00.jpg"
|
||||
alt="user image"
|
||||
class="d-block h-auto ms-0 ms-sm-6 rounded-3 user-profile-img"
|
||||
className="d-block h-auto ms-0 ms-sm-6 rounded-3 user-profile-img"
|
||||
/>
|
||||
</div>
|
||||
<div class="flex-grow-1 mt-1 mt-lg-1">
|
||||
<div class="d-flex align-items-md-end align-items-sm-start align-items-center justify-content-md-between justify-content-start mx-5 flex-md-row flex-column gap-4">
|
||||
<div class="user-profile-info">
|
||||
<h4 class="mb-2">{`${profile?.firstName} ${profile?.middleName} ${profile?.lastName}`}</h4>
|
||||
<ul class="list-inline mb-0 d-flex align-items-center flex-wrap justify-content-sm-start justify-content-center gap-4 mt-4">
|
||||
<li class="list-inline-item">
|
||||
<i class="icon-base bx bx-palette me-2 align-top"></i>
|
||||
<span class="fw-medium">
|
||||
<div className="flex-grow-1 mt-1 mt-lg-1">
|
||||
<div className="d-flex align-items-md-end align-items-sm-start align-items-center justify-content-md-between justify-content-start mx-5 flex-md-row flex-column gap-4">
|
||||
<div className="user-profile-info">
|
||||
<h4 className="mb-2">{`${profile?.firstName} ${profile?.middleName} ${profile?.lastName}`}</h4>
|
||||
<ul className="list-inline mb-0 d-flex align-items-center flex-wrap justify-content-sm-start justify-content-center gap-4 mt-4">
|
||||
<li className="list-inline-item">
|
||||
<i className="icon-base bx bx-crown me-2 align-top"></i>
|
||||
<span className="fw-medium">
|
||||
{profile?.jobRole || <em>NA</em>}
|
||||
</span>
|
||||
</li>
|
||||
<li class="list-inline-item">
|
||||
<i class="icon-base bx bx-phone me-2 align-top"></i>
|
||||
<span class="fw-medium">
|
||||
<li className="list-inline-item">
|
||||
<i className="icon-base bx bx-phone me-2 align-top"></i>
|
||||
<span className="fw-medium">
|
||||
{" "}
|
||||
{profile?.phoneNumber || <em>NA</em>}
|
||||
</span>
|
||||
</li>
|
||||
<li class="list-inline-item">
|
||||
<i class="icon-base bx bx-calendar me-2 align-top"></i>
|
||||
<span class="fw-medium">
|
||||
<li className="list-inline-item">
|
||||
<i className="icon-base bx bx-calendar me-2 align-top"></i>
|
||||
<span className="fw-medium">
|
||||
{" "}
|
||||
Joined on{" "}
|
||||
{profile?.joiningDate ? (
|
||||
@ -62,8 +62,8 @@ const EmpBanner = ({ profile, loggedInUser }) => {
|
||||
</span>
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="list-inline mb-0 d-flex align-items-center flex-wrap justify-content-sm-start justify-content-center mt-4">
|
||||
<li class="list-inline-item">
|
||||
<ul className="list-inline mb-0 d-flex align-items-center flex-wrap justify-content-sm-start justify-content-center mt-4">
|
||||
<li className="list-inline-item">
|
||||
<button
|
||||
className="btn btn-sm btn-primary btn-block"
|
||||
onClick={() => setShowModal(true)}
|
||||
@ -71,7 +71,7 @@ const EmpBanner = ({ profile, loggedInUser }) => {
|
||||
Edit Profile
|
||||
</button>
|
||||
</li>
|
||||
<li class="list-inline-item">
|
||||
<li className="list-inline-item">
|
||||
{profile?.id == loggedInUser?.employeeInfo?.id && (
|
||||
<button
|
||||
className="btn btn-sm btn-outline-primary btn-block"
|
||||
|
@ -13,8 +13,8 @@ const EmpDashboard = ({ profile }) => {
|
||||
<div className="col col-4 pt-5">
|
||||
<div className="card">
|
||||
{" "}
|
||||
<div class="card-body">
|
||||
<small class="card-text text-uppercase text-body-secondary small">
|
||||
<div className="card-body">
|
||||
<small className="card-text text-uppercase text-body-secondary small">
|
||||
My Projects
|
||||
</small>{" "}
|
||||
</div>
|
||||
@ -22,8 +22,8 @@ const EmpDashboard = ({ profile }) => {
|
||||
</div>
|
||||
<div className="col col-4 pt-5">
|
||||
<div className="card">
|
||||
<div class="card-body">
|
||||
<small class="card-text text-uppercase text-body-secondary small">
|
||||
<div className="card-body">
|
||||
<small className="card-text text-uppercase text-body-secondary small">
|
||||
My Expences
|
||||
</small>{" "}
|
||||
</div>{" "}
|
||||
|
@ -4,8 +4,7 @@ import { useProfile } from "../../hooks/useProfile";
|
||||
|
||||
const EmpOverview = ({ profile }) => {
|
||||
const { loggedInUserProfile } = useProfile();
|
||||
console.log(loggedInUserProfile);
|
||||
console.log(profile);
|
||||
|
||||
return (
|
||||
<>
|
||||
{" "}
|
||||
@ -72,7 +71,7 @@ const EmpOverview = ({ profile }) => {
|
||||
<li className="d-flex align-items-center mb-4">
|
||||
<i className="icon-base bx bx-envelope"></i>
|
||||
<span className="fw-medium mx-2">Email:</span>{" "}
|
||||
<a href={`${profile?.email}`}>
|
||||
<a href={`mailto:${profile?.email}`}>
|
||||
{" "}
|
||||
{profile?.email || <em>NA</em>}
|
||||
</a>
|
||||
|
@ -27,12 +27,25 @@ const Header = () => {
|
||||
const { data, loading } = useMaster();
|
||||
const navigate = useNavigate();
|
||||
const HasManageProjectPermission = useHasUserPermission(MANAGE_PROJECT);
|
||||
{
|
||||
console.log(location.pathname);
|
||||
}
|
||||
|
||||
const isDirectoryPath = /^\/directory$/.test(location.pathname);
|
||||
const isProjectPath = /^\/projects$/.test(location.pathname);
|
||||
const isDashboard =
|
||||
const isDashboardPath =
|
||||
/^\/dashboard$/.test(location.pathname) || /^\/$/.test(location.pathname);
|
||||
const isProjectPath = /^\/projects$/.test(location.pathname);
|
||||
|
||||
const showProjectDropdown = (pathname) => {
|
||||
const isDirectoryPath = /^\/directory$/.test(pathname);
|
||||
|
||||
// const isProfilePage = /^\/employee$/.test(location.pathname);
|
||||
const isProfilePage =
|
||||
/^\/employee\/[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/.test(
|
||||
pathname
|
||||
);
|
||||
|
||||
return !(isDirectoryPath || isProfilePage);
|
||||
};
|
||||
const allowedProjectStatusIds = [
|
||||
"603e994b-a27f-4e5d-a251-f3d69b0498ba",
|
||||
"cdad86aa-8a56-4ff4-b633-9c629057dfef",
|
||||
@ -89,7 +102,7 @@ const Header = () => {
|
||||
|
||||
const selectedProject = useSelectedproject();
|
||||
|
||||
const projectsForDropdown = isDashboard
|
||||
const projectsForDropdown = isDashboardPath
|
||||
? projectNames
|
||||
: projectNames?.filter((project) =>
|
||||
allowedProjectStatusIds.includes(project.projectStatusId)
|
||||
@ -127,7 +140,7 @@ const Header = () => {
|
||||
if (projectNames.length === 1) {
|
||||
dispatch(setProjectId(projectNames[0]?.id || null));
|
||||
} else {
|
||||
if (isDashboard) {
|
||||
if (isDashboardPath) {
|
||||
dispatch(setProjectId(null));
|
||||
} else {
|
||||
const firstAllowedProject = projectNames.find((project) =>
|
||||
@ -137,7 +150,7 @@ const Header = () => {
|
||||
}
|
||||
}
|
||||
}
|
||||
}, [projectNames, selectedProject, dispatch, isDashboard]);
|
||||
}, [projectNames, selectedProject, dispatch, isDashboardPath]);
|
||||
|
||||
const handler = useCallback(
|
||||
async (data) => {
|
||||
@ -207,7 +220,7 @@ const Header = () => {
|
||||
className="navbar-nav-right d-flex align-items-center justify-content-between"
|
||||
id="navbar-collapse"
|
||||
>
|
||||
{projectNames && !isDirectoryPath && (
|
||||
{showProjectDropdown(location.pathname) && (
|
||||
<div className="align-items-center">
|
||||
<i className="rounded-circle bx bx-building-house bx-sm-lg bx-md me-2"></i>
|
||||
<div className="btn-group">
|
||||
@ -233,7 +246,7 @@ const Header = () => {
|
||||
className="dropdown-menu"
|
||||
style={{ overflow: "auto", maxHeight: "300px" }}
|
||||
>
|
||||
{isDashboard && (
|
||||
{isDashboardPath && (
|
||||
<li>
|
||||
<button
|
||||
className="dropdown-item"
|
||||
|
Loading…
x
Reference in New Issue
Block a user