Skip to content

Commit 2cabde2

Browse files
authored
Merge branch 'console' into FEATURE/HCMPRE-1634
2 parents 25bab9a + c35c899 commit 2cabde2

File tree

16 files changed

+1805
-290
lines changed

16 files changed

+1805
-290
lines changed

health/micro-ui/web/micro-ui-internals/example/public/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<title>DIGIT</title>
1313
<link rel="stylesheet" href="https://unpkg.com/@egovernments/[email protected]/dist/index.css" />
1414
<link rel="stylesheet" href="https://unpkg.com/@egovernments/[email protected]/dist/index.css" />
15-
<link rel="stylesheet" href="https://unpkg.com/@egovernments/[email protected].2/dist/index.css" />
15+
<link rel="stylesheet" href="https://unpkg.com/@egovernments/[email protected].3/dist/index.css" />
1616

1717

1818
<!-- added below css for hcm-workbench module inclusion-->

health/micro-ui/web/micro-ui-internals/packages/css/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@egovernments/digit-ui-health-css",
3-
"version": "0.2.2",
3+
"version": "0.2.3",
44
"license": "MIT",
55
"main": "dist/index.css",
66
"author": "Jagankumar <[email protected]>",

health/micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/campaign.scss

+20
Original file line numberDiff line numberDiff line change
@@ -217,3 +217,23 @@
217217
font-weight: 700;
218218
}
219219
}
220+
.digit-popup-wrapper.dataMapping {
221+
.digit-popup-children-wrap {
222+
overflow: visible;
223+
}
224+
}
225+
.dataMappingCard {
226+
overflow-y: scroll;
227+
}
228+
.dataMappingDropdown {
229+
min-width: 13rem !important;
230+
}
231+
.data-mapping-filter-switch {
232+
float: right;
233+
margin-bottom: 1.5rem;
234+
}
235+
.digit-label-field-pair.multiselect-label-field {
236+
> div:nth-of-type(1) {
237+
width: 69%;
238+
}
239+
}

health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/package.json

+3
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
"@cyntler/react-doc-viewer": "1.10.3",
2222
"@egovernments/digit-ui-components": "0.0.2-beta.58",
2323
"@egovernments/digit-ui-react-components": "1.8.10",
24+
"react-data-table-component": "7.6.2",
25+
"styled-components": "5.0.0",
2426
"@rjsf/core": "5.10.0",
2527
"@rjsf/utils": "5.10.0",
2628
"@rjsf/validator-ajv8": "5.10.0",
@@ -36,6 +38,7 @@
3638
"react-router-dom": "5.3.0",
3739
"react-select": "5.7.4",
3840
"react-table": "7.7.0",
41+
"exceljs": "^4.4.0",
3942
"xlsx": "0.17.5"
4043
},
4144
"author": "JaganKumar <[email protected]>",

health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/Module.js

+32-19
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,13 @@ import ViewHierarchy from "./pages/employee/ViewHierarchy";
5555
import MultiSelectDropdown from "./components/MultiSelectDropdown";
5656
import MapView from "./components/MapView";
5757
import NoResultsFound from "./components/NoResultsFound";
58+
import UploadDataMappingWrapper from "./components/UploadDataMappingWrapper";
59+
import DataUploadWrapper from "./components/DataUploadWrapper";
5860

5961
/**
6062
* MDMS Module name
6163
*/
62-
export const CONSOLE_MDMS_MODULENAME="HCM-ADMIN-CONSOLE";
64+
export const CONSOLE_MDMS_MODULENAME = "HCM-ADMIN-CONSOLE";
6365

6466
/**
6567
* The CampaignModule function fetches store data based on state code, module code, and language, and
@@ -69,24 +71,27 @@ export const CONSOLE_MDMS_MODULENAME="HCM-ADMIN-CONSOLE";
6971
*/
7072
const CampaignModule = ({ stateCode, userType, tenants }) => {
7173
const tenantId = Digit.ULBService.getCurrentTenantId();
72-
const { data: BOUNDARY_HIERARCHY_TYPE , isLoading: hierarchyLoading } = Digit.Hooks.useCustomMDMS(tenantId, CONSOLE_MDMS_MODULENAME, [{
73-
name: "HierarchySchema",
74-
"filter": `[?(@.type=='${window.Digit.Utils.campaign.getModuleName()}')]`
75-
}], {
76-
select: (data) => {
77-
return data?.[CONSOLE_MDMS_MODULENAME]?.HierarchySchema?.[0]?.hierarchy;
74+
const { data: BOUNDARY_HIERARCHY_TYPE, isLoading: hierarchyLoading } = Digit.Hooks.useCustomMDMS(
75+
tenantId,
76+
CONSOLE_MDMS_MODULENAME,
77+
[
78+
{
79+
name: "HierarchySchema",
80+
filter: `[?(@.type=='${window.Digit.Utils.campaign.getModuleName()}')]`,
81+
},
82+
],
83+
{
84+
select: (data) => {
85+
return data?.[CONSOLE_MDMS_MODULENAME]?.HierarchySchema?.[0]?.hierarchy;
86+
},
7887
},
79-
},
80-
{ schemaCode: `${CONSOLE_MDMS_MODULENAME}.HierarchySchema` }
81-
);
82-
88+
{ schemaCode: `${CONSOLE_MDMS_MODULENAME}.HierarchySchema` }
89+
);
8390

84-
const hierarchyData = Digit.Hooks.campaign.useBoundaryRelationshipSearch({BOUNDARY_HIERARCHY_TYPE,tenantId});
91+
const hierarchyData = Digit.Hooks.campaign.useBoundaryRelationshipSearch({ BOUNDARY_HIERARCHY_TYPE, tenantId });
8592
const modulePrefix = "hcm";
8693

87-
const moduleCode = BOUNDARY_HIERARCHY_TYPE
88-
? [`boundary-${BOUNDARY_HIERARCHY_TYPE}`]
89-
: [ "campaignmanager", "schema", "admin-schemas","checklist"];
94+
const moduleCode = BOUNDARY_HIERARCHY_TYPE ? [`boundary-${BOUNDARY_HIERARCHY_TYPE}`] : ["campaignmanager", "schema", "admin-schemas", "checklist"];
9095

9196
const { path, url } = useRouteMatch();
9297
const language = Digit.StoreData.getCurrentLanguage();
@@ -104,13 +109,19 @@ const CampaignModule = ({ stateCode, userType, tenants }) => {
104109
return (
105110
<ErrorBoundary moduleName="CAMPAIGN">
106111
<TourProvider>
107-
<EmployeeApp BOUNDARY_HIERARCHY_TYPE={BOUNDARY_HIERARCHY_TYPE} path={path} stateCode={stateCode} url={url} userType={userType} hierarchyData={hierarchyData} />
112+
<EmployeeApp
113+
BOUNDARY_HIERARCHY_TYPE={BOUNDARY_HIERARCHY_TYPE}
114+
path={path}
115+
stateCode={stateCode}
116+
url={url}
117+
userType={userType}
118+
hierarchyData={hierarchyData}
119+
/>
108120
</TourProvider>
109121
</ErrorBoundary>
110122
);
111123
};
112124

113-
114125
const componentsToRegister = {
115126
CampaignModule: CampaignModule,
116127
CampaignCard: CampaignCard,
@@ -155,13 +166,15 @@ const componentsToRegister = {
155166
BulkUpload,
156167
CampaignUpdateSummary,
157168
XlsPreview,
158-
MultiSelectDropdownBoundary:MultiSelectDropdown,
169+
MultiSelectDropdownBoundary: MultiSelectDropdown,
159170
GeoPode,
160171
ViewBoundary,
161172
ViewHierarchy,
162173
BoundarySummary,
163174
MapView,
164-
NoResultsFound
175+
NoResultsFound,
176+
UploadDataMappingWrapper,
177+
DataUploadWrapper,
165178
};
166179

167180
const overrideHooks = () => {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
import { Card, Stepper, TextBlock } from "@egovernments/digit-ui-components";
2+
import React, { Fragment, useEffect, useState } from "react";
3+
import UploadData from "./UploadData";
4+
import { useTranslation } from "react-i18next";
5+
import UploadDataMappingWrapper from "./UploadDataMappingWrapper";
6+
7+
function DataUploadWrapper({ formData, props, onSelect }) {
8+
const { t } = useTranslation();
9+
const { parentId, key: currentKey, ...queryParams } = Digit.Hooks.useQueryParams();
10+
const categories = [
11+
"HCM_UPLOAD_FACILITY",
12+
"HCM_UPLOAD_FACILITY_MAPPING",
13+
"HCM_UPLOAD_USER",
14+
"HCM_UPLOAD_USER_MAPPING",
15+
"HCM_UPLOAD_TARGET",
16+
"HCM_SUMMARY",
17+
];
18+
const mappingCategories = ["HCM_UPLOAD_FACILITY_MAPPING", "HCM_UPLOAD_USER_MAPPING"];
19+
const [currentStep, setCurrentStep] = useState(1);
20+
const currentCategories = categories?.[currentStep - 1];
21+
const [key, setKey] = useState(() => {
22+
return currentKey ? parseInt(currentKey) : 1;
23+
});
24+
const baseKey = 10;
25+
function updateUrlParams(params) {
26+
const url = new URL(window.location.href);
27+
Object.entries(params).forEach(([key, value]) => {
28+
url.searchParams.set(key, value);
29+
});
30+
window.history.replaceState({}, "", url);
31+
}
32+
33+
useEffect(() => {
34+
setKey(currentKey);
35+
setCurrentStep(currentKey - baseKey + 1);
36+
}, [currentKey]);
37+
38+
useEffect(() => {
39+
updateUrlParams({ key: key });
40+
window.dispatchEvent(new Event("checking"));
41+
}, [key]);
42+
43+
const onStepClick = (currentStep) => {
44+
setCurrentStep(currentStep + 1);
45+
if (currentStep === 0) {
46+
setKey(10);
47+
} else if (currentStep === 1) {
48+
setKey(11);
49+
} else if (currentStep === 3) {
50+
setKey(13);
51+
} else if (currentStep === 4) {
52+
setKey(14);
53+
} else setKey(12);
54+
};
55+
56+
return (
57+
<>
58+
<div className="container-full">
59+
{!parentId && (
60+
<div className="card-container">
61+
<Card className="card-header-timeline">
62+
<TextBlock subHeader={t("HCM_UPLOAD_DATA")} subHeaderClassName={"stepper-subheader"} wrapperClassName={"stepper-wrapper"} />
63+
</Card>
64+
<Card className="stepper-card">
65+
<Stepper customSteps={categories} currentStep={currentStep} onStepClick={onStepClick} direction={"vertical"} />
66+
</Card>
67+
</div>
68+
)}
69+
{mappingCategories?.includes(currentCategories) ? (
70+
<UploadDataMappingWrapper currentCategories={currentCategories} formData={formData} props={props} onSelect={onSelect} />
71+
) : (
72+
<UploadData formData={formData} props={props} onSelect={onSelect} />
73+
)}
74+
</div>
75+
</>
76+
);
77+
}
78+
79+
export default DataUploadWrapper;

0 commit comments

Comments
 (0)