Skip to content

Commit

Permalink
Pr resolve
Browse files Browse the repository at this point in the history
  • Loading branch information
NabeelAyubee committed Sep 9, 2024
1 parent 8642f0a commit 60c4861
Show file tree
Hide file tree
Showing 6 changed files with 96 additions and 47 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -333,3 +333,10 @@
margin-bottom: 0;
}
}
.action-bar-wrap{
.menu-wrap{
p{
margin: 0 !important;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"prepublish": "yarn build"
},
"dependencies": {
"@egovernments/digit-ui-react-components": "1.8.2-beta.12",
"@egovernments/digit-ui-react-components": "1.8.2-beta.13",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-hook-form": "6.15.8",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,40 +6,52 @@ const HRMSCard = () => {
const ADMIN = Digit.Utils.hrmsAccess();
if (!ADMIN) {
return null;
}
const { t } = useTranslation();
const tenantId = Digit.ULBService.getCurrentTenantId();
const { isLoading, isError, error, data, ...rest } = Digit.Hooks.hrms.useHRMSCount(tenantId);
}
const { t } = useTranslation();
const tenantId = Digit.ULBService.getCurrentTenantId();
const { isLoading, isError, error, data, ...rest } = Digit.Hooks.hrms.useHRMSCount(tenantId);

const propsForModuleCard = {
Icon : <PersonIcon/>,
moduleName: t("ACTION_TEST_HRMS"),
kpis: [
{
count: isLoading ? "-" : data?.EmployeCount?.totalEmployee,
label: t("TOTAL_EMPLOYEES"),
link: `/${window?.contextPath}/employee/hrms/inbox`
},
{
count: isLoading ? "-" : data?.EmployeCount?.activeEmployee,
label: t("ACTIVE_EMPLOYEES"),
link: `/${window?.contextPath}/employee/hrms/inbox`
}
],
links: [
{
label: t("HR_HOME_SEARCH_RESULTS_HEADING"),
link: `/${window?.contextPath}/employee/hrms/inbox`
},
{
label: t("HR_COMMON_CREATE_EMPLOYEE_HEADER"),
link: `/${window?.contextPath}/employee/hrms/create`
}
]
}
let role = ["SUPERUSER"];

return <EmployeeModuleCard {...propsForModuleCard} />
let propsForSandbox = [
{
label: t("CONFIGURE_MASTER"),
link: `/${window?.contextPath}/employee/sandbox/application-management/setup-master?module=HRMS`,
isOutsideModule: true,
roles: role,
},
];
propsForSandbox = propsForSandbox.filter((link) => (link?.roles ? Digit.Utils.didEmployeeHasAtleastOneRole(link.roles) : true));

const propsForModuleCard = {
Icon: <PersonIcon />,
moduleName: t("ACTION_TEST_HRMS"),
kpis: [
{
count: isLoading ? "-" : data?.EmployeCount?.totalEmployee,
label: t("TOTAL_EMPLOYEES"),
link: `/${window?.contextPath}/employee/hrms/inbox`,
},
{
count: isLoading ? "-" : data?.EmployeCount?.activeEmployee,
label: t("ACTIVE_EMPLOYEES"),
link: `/${window?.contextPath}/employee/hrms/inbox`,
},
],
links: [
{
label: t("HR_HOME_SEARCH_RESULTS_HEADING"),
link: `/${window?.contextPath}/employee/hrms/inbox`,
},
{
label: t("HR_COMMON_CREATE_EMPLOYEE_HEADER"),
link: `/${window?.contextPath}/employee/hrms/create`,
},
...propsForSandbox,
],
};

return <EmployeeModuleCard {...propsForModuleCard} />;
};

export default HRMSCard;

Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,18 @@ let propsForCSR = [
}
];

propsForCSR = propsForCSR.filter(link => link?.roles ? Digit.Utils.didEmployeeHasAtleastOneRole(link.roles) : true );

let propsForSandbox = [
{
label: t("CONFIGURE_MASTER"),
link: `/${window?.contextPath}/employee/sandbox/application-management/setup-master?module=PGR`,
isOutsideModule : true,
roles: role
}
];

propsForCSR = propsForCSR.filter(link => link?.roles ? Digit.Utils.didEmployeeHasAtleastOneRole(link.roles) : true );
propsForSandbox = propsForSandbox.filter(link => link?.roles ? Digit.Utils.didEmployeeHasAtleastOneRole(link.roles) : true );
const propsForModuleCard = {
Icon: <Icon />,
moduleName: t("ES_PGR_HEADER_COMPLAINT"),
Expand All @@ -55,7 +65,8 @@ let propsForCSR = [
label: t("ES_PGR_INBOX"),
link: `/${window?.contextPath}/employee/pgr/inbox`
},
...propsForCSR
...propsForCSR,
...propsForSandbox
]
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ const SandboxCard = () => {
link: `/${window?.contextPath}/employee/sandbox/tenant-management/search`,
roles: ROLES.SUPERUSER,
},
{
label: t("SANDBOX_APPLICATION_MANAGEMENT_HOMECARD_LABEL"),
link: `/${window?.contextPath}/employee/sandbox/application-management/home`,
roles: ROLES.SUPERUSER,
},
// {
// label: t("SANDBOX_APPLICATION_MANAGEMENT_HOMECARD_LABEL"),
// link: `/${window?.contextPath}/employee/sandbox/application-management/home`,
// roles: ROLES.SUPERUSER,
// },
],
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,32 @@ const EmployeeModuleCard = ({ Icon, moduleName, kpis = [], links = [], isCitizen
<span>{count || "-"}</span>
</div>
<div>

{link ? <span className="link" onClick={()=> history.push(`${link}`,{count})}>{label}</span> : null}
{link ? (
<span className="link" onClick={() => history.push(`${link}`, { count })}>
{label}
</span>
) : null}
</div>
</div>
))}
</div>
)}
<div className="links-wrapper" style={{ width: "80%" }}>
{links.map(({ count, label, link }, index) => (
{links.map(({ count, label, link, isOutsideModule }, index) => (
<span className="link" key={index}>
{link ? (link?.includes(`${window?.contextPath}/`)?<Link to={{ pathname:link, state: {count} }}>{label}</Link>:<a href={link}>{label}</a>) : null}
{link ? (
link?.includes(`${window?.contextPath}/`) ? (
isOutsideModule ? (
<span className={"link"} onClick={() => history.push(`${link}`)}>
{label}
</span>
) : (
<Link to={{ pathname: link, state: { count } }}>{label}</Link>
)
) : (
<a href={link}>{label}</a>
)
) : null}
{count ? (
<>
<span className={"inbox-total"} onClick={()=>history.push(`${link}`)}>{count || "-"}</span>
Expand All @@ -50,15 +65,19 @@ const EmployeeModuleCard = ({ Icon, moduleName, kpis = [], links = [], isCitizen
);
};

const ModuleCardFullWidth = ({ moduleName, links = [], isCitizen = false, className, styles, headerStyle, subHeader, subHeaderLink }) => {
const ModuleCardFullWidth = ({ moduleName, links = [], isCitizen = false, className, styles, headerStyle, subHeader, subHeaderLink }) => {
return (
<div className={className ? className : "employeeCard card-home customEmployeeCard home-action-cards"} style={styles ? styles : {}}>
<div className="complaint-links-container" style={{ padding: "10px" }}>
<div className="header" style={isCitizen ? { padding: "0px" } : headerStyle}>
<span className="text removeHeight">{moduleName}</span>
<span className="link">
<a href={subHeaderLink}>
<span className={"inbox-total"} style={{ display: "flex", alignItems: "center", color: "#F47738", fontWeight: "bold" }} onClick={()=>history.push(`${link}`)}>
<span
className={"inbox-total"}
style={{ display: "flex", alignItems: "center", color: "#F47738", fontWeight: "bold" }}
onClick={() => history.push(`${link}`)}
>
{subHeader || "-"}
<span style={{ marginLeft: "10px" }}>
{" "}
Expand All @@ -72,7 +91,7 @@ const ModuleCardFullWidth = ({ moduleName, links = [], isCitizen = false, class
<div className="links-wrapper" style={{ width: "100%", display: "flex", flexWrap: "wrap" }}>
{links.map(({ count, label, link }, index) => (
<span className="link full-employee-card-link" key={index}>
{link ? (link?.includes(`${window?.contextPath}/`)?<Link to={link}>{label}</Link>:<a href={link}>{label}</a>) : null}
{link ? link?.includes(`${window?.contextPath}/`) ? <Link to={link}>{label}</Link> : <a href={link}>{label}</a> : null}
</span>
))}
</div>
Expand Down

0 comments on commit 60c4861

Please sign in to comment.