Skip to content

Commit

Permalink
Added role based action card (#1396)
Browse files Browse the repository at this point in the history
* setup master enhancement

* localisation code updated

* updated components css version

* Added role based action card

* Sandbox fixes and enhacement

---------

Co-authored-by: NabeelAyubee <[email protected]>
  • Loading branch information
nabeelmd-eGov and NabeelAyubee authored Sep 18, 2024
1 parent 49481a4 commit 202ca6e
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,9 @@ export const StoreService = {
},
defaultData: async (stateCode, moduleCode, language, modulePrefix) => {
let moduleCodes = [];
if(typeof moduleCode !== "string") moduleCode.forEach(code => { moduleCodes.push(`${modulePrefix}-${code.toLowerCase()}`) });
if(typeof moduleCode !== "string") moduleCode.forEach(code => { moduleCodes.push(modulePrefix ? `${modulePrefix}-${code.toLowerCase()}` : `${code.toLowerCase()}`) });
const LocalePromise = LocalizationService.getLocale({
modules: typeof moduleCode == "string" ? [`${modulePrefix}-${moduleCode.toLowerCase()}`] : moduleCodes,
modules: typeof moduleCode == "string" ? modulePrefix ? [`${modulePrefix}-${moduleCode.toLowerCase()}`] : [`${moduleCode.toLowerCase()}`] : moduleCodes,
locale: language,
tenantId: stateCode,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,13 @@ export const RoleBasedEmployeeHome = ({ modules, additionalComponent }) => {
links: [],
};
}
const linkUrl = transformURL(item.navigationURL);
const queryParamIndex = linkUrl.indexOf("?");
acc[module].links.push({
link: transformURL(item.navigationURL),
label: Digit.Utils.locale.getTransformedLocale(`${module}_LINK_${item.displayName}`),
// link: linkUrl,
link: queryParamIndex === -1 ? linkUrl : linkUrl.substring(0, queryParamIndex),
queryParams: queryParamIndex === -1 ? null : linkUrl.substring(queryParamIndex),
label: t(Digit.Utils.locale.getTransformedLocale(`${module}_LINK_${item.displayName}`)),
});
return acc;
}, {});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,20 @@ import ModuleCard from "./components/ModuleCard";
export const SandboxModule = ({ stateCode, userType, tenants }) => {
const { path, url } = useRouteMatch();
const tenantId = Digit.ULBService.getCurrentTenantId();
const moduleCode = ["sandbox"];
const MDMSmoduleCode = [`rainmaker-mdms`, `rainmaker-workbench`, `rainmaker-schema`];
const moduleCode = ["digit-sandbox", `rainmaker-mdms`, `rainmaker-workbench`, `rainmaker-schema`];
const language = Digit.StoreData.getCurrentLanguage();
const { isLoading, data: store } = Digit.Services.useStore({
stateCode,
moduleCode,
language,
modulePrefix: "digit",
modulePrefix: null,
});

const { isLoading: isMDMSLoading, data: MDMSstore } = Digit.Services.useStore({
stateCode,
MDMSmoduleCode,
language,
});

if (!Digit.Utils.sandboxAccess()) {
return null;
}
if (isLoading && isMDMSLoading) {
if (isLoading) {
return <Loader />;
}
return <EmployeeApp path={path} stateCode={stateCode} userType={userType} tenants={tenants} />;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const EmployeeModuleCard = ({ Icon, moduleName, kpis = [], links = [], isCitizen
</div>
)}
<div className="links-wrapper" style={{ width: "80%" }}>
{links.map(({ count, label, link, isOutsideModule }, index) => (
{links.map(({ count, label, link, isOutsideModule, queryParams }, index) => (
<span className="link" key={index}>
{link ? (
link?.includes(`${window?.contextPath}/`) ? (
Expand All @@ -42,7 +42,7 @@ const EmployeeModuleCard = ({ Icon, moduleName, kpis = [], links = [], isCitizen
{label}
</span>
) : (
<Link to={{ pathname: link, state: { count } }}>{label}</Link>
<Link to={{ pathname: link, state: { count }, search: queryParams }}>{label}</Link>
)
) : (
<a href={link}>{label}</a>
Expand Down

0 comments on commit 202ca6e

Please sign in to comment.