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