Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Application Management Updated #1359

Merged
merged 24 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions micro-ui/web/micro-ui-internals/example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
"@egovernments/digit-ui-module-dss": "1.8.1",
"@egovernments/digit-ui-module-core": "1.8.2-beta.18",
"@egovernments/digit-ui-module-common": "1.8.0",
"@egovernments/digit-ui-module-hrms": "1.8.0",
"@egovernments/digit-ui-module-hrms": "1.8.1-beta.1",
"@egovernments/digit-ui-module-utilities": "1.0.1-beta.39",
"@egovernments/digit-ui-module-open-payment":"0.0.1",
"@egovernments/digit-ui-module-engagement": "1.5.20",
"@egovernments/digit-ui-components": "0.0.2-beta.31",
"@egovernments/digit-ui-react-components": "1.8.2-beta.12",
"@egovernments/digit-ui-react-components": "1.8.2-beta.13",
"@egovernments/digit-ui-module-sandbox": "0.0.1",
"http-proxy-middleware": "^1.0.5",
"react": "17.0.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@
<div id="root"></div>
</body>

</html>
</html>
4 changes: 3 additions & 1 deletion micro-ui/web/micro-ui-internals/example/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ const initDigitUI = () => {
const pathname = window.location.pathname;
const context = window?.globalConfigs?.getConfig("CONTEXT_PATH");
const start = pathname.indexOf(context) + context.length + 1;
const end = pathname.indexOf("employee");
const employeeIndex = pathname.indexOf("employee");
const citizenIndex = pathname.indexOf("citizen");
const end = (employeeIndex !== -1) ? employeeIndex : (citizenIndex !== -1) ? citizenIndex : -1;
nabeelmd-eGov marked this conversation as resolved.
Show resolved Hide resolved
const tenant = end > start ? pathname.substring(start, end).replace(/\/$/, "") : "";
window.contextPath = window?.globalConfigs?.getConfig("CONTEXT_PATH") + `${tenant ? `/${tenant}` : ""}` || "digit-ui";
window.globalPath = window?.globalConfigs?.getConfig("CONTEXT_PATH") || "digit-ui";
Expand Down
3 changes: 2 additions & 1 deletion micro-ui/web/micro-ui-internals/example/src/setupProxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ module.exports = function (app) {
"/project-factory",
"/project-factory/v1/data/_autoGenerateBoundaryCode",
"/billing-service/bill/v2/_fetchbill",
"/tenant-management"
"/tenant-management",
"/default-data-handler"
].forEach((location) => app.use(location, createProxy));
["/pb-egov-assets"].forEach((location) => app.use(location, assetsProxy));
["/mdms-v2/v2/_create"].forEach((location) => app.use(location, mdmsProxy));
Expand Down
4 changes: 2 additions & 2 deletions micro-ui/web/micro-ui-internals/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"dev:example": "cd example && yarn start",
"dev:core": "cd packages/modules/core && yarn start",
"devD:dss": "cd packages/modules/dss && yarn start",
"devD:hrms": "cd packages/modules/hrms && yarn start",
"dev:hrms": "cd packages/modules/hrms && yarn start",
"devD:common": "cd packages/modules/common && yarn start",
"devD:utilities": "cd packages/modules/utilities && yarn start",
"dev:workbench": "cd packages/modules/workbench && yarn start",
Expand Down Expand Up @@ -73,7 +73,7 @@
"lodash": "4.17.21",
"microbundle-crl": "0.13.11",
"@egovernments/digit-ui-components": "0.0.2-beta.31",
"@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
@@ -1,6 +1,6 @@
{
"name": "@egovernments/digit-ui-css",
"version": "1.8.2-beta.20",
"version": "1.8.2-beta.21",
"license": "MIT",
"main": "dist/index.css",
"author": "Jagankumar <[email protected]>",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,7 @@ input[type="number"] {
.citizen-form-wrapper {
width: calc(100% - 219px);
display: flex;
justify-content: center;
justify-content: flex-start;
margin-top: 1rem;
padding-left: 16px;
padding-right: 16px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
align-self: flex-start;
margin-bottom: 3rem;
font-size: 14px;
margin-top: -2.5rem;
margin-top: -0.5rem;
color: #505a5f;
font-family: "Roboto";
}
Expand Down Expand Up @@ -240,7 +240,7 @@
margin-top: 0.5rem;
}
.sandbox-url-footer {
margin-top: -1.5rem;
margin-top: 0.5rem;
}
.digit-button-primary {
width: 100%;
Expand All @@ -254,3 +254,82 @@
color: #00703c !important;
}
}
.sandbox-url-wrapper {
display: flex;
width: 100%;
.digit-text-input-field.urlInputText {
}
.digit-button-secondary.large.copyButton {
width: 30%;
padding: 0;
}
}

.setupMasterSetupActionBar {
margin-top: 2.5rem;
margin-bottom: -1rem;
margin-left: -1rem;
margin-right: -1rem;
z-index: 1000;
box-shadow: 0 -0.063rem 0.125rem 0 rgba(0, 0, 0, 0.14902);
padding: 1.5rem;
display: flex;
flex-direction: row-reverse;
}
.digit-employee-card.sandboxSetupMasterInfo {
.h1.headerFlex {
display: flex;
gap: 1rem;
align-items: center;
}
.digit-card-header.subHeader {
font-size: 1.5rem;
font-weight: 700;
color: unset !important;
}
}
.digit-card-header.setupMaster-subheading {
font-size: 1.5rem;
color: unset !important;
margin-left: 1.5rem;
}
.digit-popup-wrapper.masterHandlerPopup {
.digit-popup-header {
.header-close-container {
.digit-popup-close {
display: none !important;
}
}
}
}
nabeelmd-eGov marked this conversation as resolved.
Show resolved Hide resolved
.digit-topbar-ulb {
.state {
width: 80px;
height: 19px;
}
}
.digit-popup-footer.masterHandlerPopUpFooter {
.digit-popup-footer-buttons {
margin-left: unset;
width: 100%;
justify-content: center;
}
}
.main.center-container.citizen-home-container {
z-index: 100;
justify-content: flex-start;
}
.SideBarStatic {
z-index: 10;
height: 100vh;
}
.citizen-home-footer {
position: absolute;
bottom: 0;
}
.citizen-form-wrapper {
justify-content: flex-start;
.citizen-card-input.citizen-card-input--front {
margin-bottom: 0;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ import useGetFAQsJSON from "./useGetFAQsJSON";
import useGetHowItWorksJSON from "./useHowItWorksJSON";
import { usePrivacyContext } from "./usePrivacyContext";
import useStaticData from "./useStaticData";
import { useTenantManagementSearch } from "./useTenantManagementSearch";



Expand Down Expand Up @@ -210,7 +211,8 @@ const Hooks = {
useStaticData,
useDynamicData,
useBulkPdfDetails,
useLocation
useLocation,
useTenantManagementSearch
};

export default Hooks;
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { useQuery } from "react-query";

const tenantManagementSearchService = async ({ stateId, includeSubTenants = true, filter, pagination }) => {
const response = await Digit.CustomService.getResponse({
url: "/tenant-management/tenant/_search",
body: {
apiOperation: "SEARCH",
},
params: {
code: stateId,
includeSubTenants: includeSubTenants,
},
});
return response?.Tenants;
};

export const useTenantManagementSearch = ({ stateId, includeSubTenants = true, filter, pagination, config = {} }) => {
return useQuery(
["SEARCH_TENANT_MANAGEMENT", stateId, filter, includeSubTenants, pagination],
() => tenantManagementSearchService({ stateId, includeSubTenants, filter, pagination }),
config
);
};
nabeelmd-eGov marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const mdmsV1Path = window?.globalConfigs?.getConfig("MDMS_V1_CONTEXT_PATH") || "
const mdmsV2Path = window?.globalConfigs?.getConfig("MDMS_V2_CONTEXT_PATH") || "mdms-v2";
const Urls = {
MDMS: `/${mdmsV1Path}/v1/_search`,
TenantConfigSearch: `/tenant-management/tenant/config/_search`,
WorkFlow: `/egov-workflow-v2/egov-wf/businessservice/_search`,
WorkFlowProcessSearch: `/egov-workflow-v2/egov-wf/process/_search`,
localization: `/localization/messages/v1/_search`,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { ServiceRequest } from "../atoms/Utils/Request";
import Urls from "../atoms/urls";

export const TenantConfigSearch = {
tenant: (stateCode) =>
ServiceRequest({
serviceName: "tenantConfigSearch",
url: Urls.TenantConfigSearch,
data: {},
useCache: true,
params: { code: stateCode },
}),
};
nabeelmd-eGov marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { LocalizationService } from "../../elements/Localization/service";
import { MdmsService } from "../../elements/MDMS";
import { Storage } from "../../atoms/Utils/Storage";
import { ApiCacheService } from "../../atoms/ApiCacheService";
import { TenantConfigSearch } from "../../elements/TenantConfigService";

const getImgUrl = (url, fallbackUrl) => {
if (!url && fallbackUrl) {
Expand Down Expand Up @@ -30,7 +31,7 @@ const addLogo = (id, url, fallbackUrl = "") => {

const renderTenantLogos = (stateInfo, tenants) => {
addLogo(stateInfo.code, stateInfo.logoUrl);
tenants.forEach((tenant) => {
tenants?.forEach((tenant) => {
addLogo(tenant.code, tenant.logoId, stateInfo.logoUrl);
});
};
Expand All @@ -54,17 +55,38 @@ export const StoreService = {
});
return await Promise.all(allBoundries);
},
digitInitData: async (stateCode, enabledModules , modulePrefix) => {
digitInitData: async (stateCode, enabledModules, modulePrefix) => {
const { MdmsRes } = await MdmsService.init(stateCode);
const stateInfo = MdmsRes["common-masters"]?.StateInfo?.[0]||{};
const uiHomePage = MdmsRes["common-masters"]?.uiHomePage?.[0]||{};
const stateInfo = MdmsRes["common-masters"]?.StateInfo?.[0] || {};
const uiHomePage = MdmsRes["common-masters"]?.uiHomePage?.[0] || {};
const tenantConfigFetch = Digit.Utils.getMultiRootTenant();
const localities = {};
const revenue_localities = {};
const initData = {
const fetchTenantConfig = async () => {
const tenantConfigs = await TenantConfigSearch.tenant(stateCode);
const tenantConfigSearch = tenantConfigs?.tenantConfigs ? tenantConfigs?.tenantConfigs : null;
return {
languages: stateInfo.hasLocalisation ? stateInfo.languages : [{ label: "ENGLISH", value: Digit.Utils.getDefaultLanguage() }],
stateInfo: {
code: tenantConfigFetch ? tenantConfigSearch?.[0]?.code : stateInfo.code,
name: tenantConfigFetch ? tenantConfigSearch?.[0]?.name : stateInfo.name,
logoUrl: tenantConfigFetch ? tenantConfigSearch?.[0]?.documents?.find((item) => item.type === "logoUrl")?.url : stateInfo.logoUrl,
statelogo: tenantConfigFetch ? tenantConfigSearch?.[0]?.documents?.find((item) => item.type === "statelogo")?.url : stateInfo.statelogo,
logoUrlWhite: tenantConfigFetch
? tenantConfigSearch?.[0]?.documents?.find((item) => item.type === "logoUrlWhite")?.url
: stateInfo.logoUrlWhite,
bannerUrl: tenantConfigFetch ? tenantConfigSearch?.[0]?.documents?.find((item) => item.type === "bannerUrl")?.url : stateInfo.bannerUrl,
},
localizationModules: stateInfo.localizationModules,
modules: MdmsRes?.tenant?.citymodule?.filter((module) => module?.active)?.filter((module) => enabledModules?.includes(module?.code))?.sort((x,y)=>x?.order-y?.order)|| [],
uiHomePage: uiHomePage
};
};
const initData = tenantConfigFetch ? await fetchTenantConfig() : {
languages: stateInfo.hasLocalisation ? stateInfo.languages : [{ label: "ENGLISH", value: Digit.Utils.getDefaultLanguage() }],
stateInfo: {
code: stateInfo.code,
name: stateInfo.name,
name: stateInfo.name,
logoUrl: stateInfo.logoUrl,
statelogo: stateInfo.statelogo,
logoUrlWhite: stateInfo.logoUrlWhite,
Expand All @@ -74,8 +96,6 @@ export const StoreService = {
modules: MdmsRes?.tenant?.citymodule?.filter((module) => module?.active)?.filter((module) => enabledModules?.includes(module?.code))?.sort((x,y)=>x?.order-y?.order)|| [],
uiHomePage: uiHomePage
};


initData.selectedLanguage = Digit.SessionStorage.get("locale") || initData.languages[0].value;

ApiCacheService.saveSetting(MdmsRes["DIGIT-UI"]?.ApiCachingSettings);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,17 @@ export const ULBService = {
*/
getCurrentTenantId: () => {
// TODO: change when setter is done.

const user = UserService.getUser();
if (user?.extraRoleInfo) {
const isDsoRoute = Digit.Utils.detectDsoRoute(window.location.pathname);
if (isDsoRoute) {
return user.extraRoleInfo?.tenantId;
}
}

//TODO: fix tenant id from userinfo
const tenantId =
user?.info?.type === "EMPLOYEE" && user?.info?.tenantId ? user?.info?.tenantId : window?.globalConfigs.getConfig("STATE_LEVEL_TENANT_ID");
const tenantId = user?.info?.type === "EMPLOYEE" && user?.info?.tenantId ? user?.info?.tenantId : window?.globalConfigs.getConfig("STATE_LEVEL_TENANT_ID");
return tenantId;
},
/**
Expand All @@ -56,7 +57,9 @@ export const ULBService = {
const pathname = window.location.pathname;
const context = window?.globalConfigs?.getConfig("CONTEXT_PATH");
const start = pathname.indexOf(context) + context.length + 1;
const end = pathname.indexOf("employee");
const employeeIndex = pathname.indexOf("employee");
const citizenIndex = pathname.indexOf("citizen");
const end = (employeeIndex !== -1) ? employeeIndex : (citizenIndex !== -1) ? citizenIndex : -1;
const tenant = end > start ? pathname.substring(start, end).replace(/\/$/, "") : "";

return isMultiRootTenant && tenant ? tenant : window?.globalConfigs?.getConfig("STATE_LEVEL_TENANT_ID");
Expand All @@ -74,7 +77,7 @@ export const ULBService = {
getCurrentUlb: () => {
const initData = StoreService.getInitData();
const tenantId = ULBService.getCurrentTenantId();
return initData?.tenants?.find((tenant) => tenant?.code === tenantId)||ULBService.getStateId();
return initData?.tenants?.find((tenant) => tenant?.code === tenantId) || ULBService.getStateId();
nabeelmd-eGov marked this conversation as resolved.
Show resolved Hide resolved
}
/**
* Custom method to get citizen's current selected city
Expand All @@ -88,12 +91,12 @@ export const ULBService = {
*
* @returns {String}
*/,
getCitizenCurrentTenant: (selectedCity=false) => {
const homeCity=Digit.SessionStorage.get("CITIZEN.COMMON.HOME.CITY")?.code;
if(selectedCity){
getCitizenCurrentTenant: (selectedCity = false) => {
const homeCity = Digit.SessionStorage.get("CITIZEN.COMMON.HOME.CITY")?.code;
if (selectedCity) {
return homeCity;
}
return homeCity|| Digit.UserService.getUser()?.info?.permanentCity || ULBService.getStateId();
return homeCity || Digit.UserService.getUser()?.info?.permanentCity || ULBService.getStateId();
nabeelmd-eGov marked this conversation as resolved.
Show resolved Hide resolved
},
/**
* Custom method to get all ulb's which the loggedin employee has access to
Expand Down
Loading