Skip to content

Commit

Permalink
Merge pull request #960 from egovernments/HLM-6172
Browse files Browse the repository at this point in the history
  • Loading branch information
nipunarora-eGov authored Jun 26, 2024
2 parents 5fd838a + 2a68842 commit 4bac6bc
Show file tree
Hide file tree
Showing 10 changed files with 48 additions and 32 deletions.
2 changes: 2 additions & 0 deletions micro-ui/web/micro-ui-internals/example/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
<title>DIGIT</title>
<link rel="stylesheet" href="https://unpkg.com/@egovernments/[email protected]/dist/index.css" />
<link rel="stylesheet" href="https://unpkg.com/@egovernments/[email protected]/dist/index.css" />

<link rel="stylesheet" href="https://unpkg.com/@egovernments/[email protected]/dist/index.css" />
<!-- <link rel="stylesheet" href="https://unpkg.com/@egovernments/[email protected]/dist/index.css" /> -->

<!-- <link rel="stylesheet" href="https://unpkg.com/@egovernments/[email protected]/dist/index.css" /> -->
Expand Down
2 changes: 1 addition & 1 deletion micro-ui/web/micro-ui-internals/packages/css/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@egovernments/digit-ui-css",
"version": "1.0.44-microplan",
"version": "1.0.45-microplan",
"license": "MIT",
"main": "dist/index.css",
"author": "Jagankumar <[email protected]>",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,18 +148,22 @@ employee-select-wrap--elipses:hover {
}

.employee .main {
padding-top: 5.5rem;
padding-top: 5.5rem !important;
}

.main.digit-home-main .employee-app-wrapper.digit-home-app-wrapper {
margin-left: 0rem;
margin-right: 0rem;
margin-left: 0rem !important;
margin-right: 0rem !important;
}

.digit-home-ground {
padding: 1rem !important;
}

.employee .main {
padding-top: 5.2rem;
padding-top: 5.2rem !important;
}

.main.digit-home-main {
margin-left: 4.5rem !important;
}
Original file line number Diff line number Diff line change
Expand Up @@ -705,12 +705,12 @@ const Upload = ({
}
setResourceMapping([]);

let boundaryDataAgainstBoundaryCode = (await boundaryDataGeneration(schemaData, campaignData, t)) || {};
const boundaryDataAgainstBoundaryCode = (await boundaryDataGeneration(schemaData, campaignData, t)) || {};
const mappedToList = resourceMappingData.map((item) => item.mappedTo);
if (hierarchy.every((item) => !mappedToList.includes(t(item)))) {
data.features.forEach((feature) => {
const boundaryCode = feature.properties.boundaryCode;
let additionalDetails = {};
const additionalDetails = {};
for (let i = 0; i < hierarchy.length; i++) {
if (boundaryDataAgainstBoundaryCode[boundaryCode]?.[i] || boundaryDataAgainstBoundaryCode[boundaryCode]?.[i] === "") {
additionalDetails[hierarchy[i]] = boundaryDataAgainstBoundaryCode[boundaryCode][i];
Expand Down Expand Up @@ -833,18 +833,9 @@ const Upload = ({
if (schemaData?.schema?.["Properties"]) schemaKeys = hierarchy.concat(Object.keys(schemaData.schema["Properties"]));
// Sorting the resourceMapping list inorder to maintain the column sequence
const sortedSecondList = Digit.Utils.microplan.sortSecondListBasedOnFirstListOrder(schemaKeys, resourceMapping);

// Creating a object with input data with MDMS keys
const newFeatures = [];
for (const item of fileData.data["features"]) {
if (
schemaData?.activeInactiveField &&
schemaData?.schema?.Properties &&
Object.keys(schemaData.schema.Properties).includes(schemaData.activeInactiveField) &&
item?.properties?.[t(schemaData.activeInactiveField)] !== t(UPLOADED_DATA_ACTIVE_STATUS)
) {
continue;
}
let newProperties = {};

sortedSecondList.forEach((e) => {
Expand All @@ -853,8 +844,20 @@ const Upload = ({
item["properties"] = newProperties;
newFeatures.push(item);
}
let filteredFeature = [];
for (const item of newFeatures) {
if (
schemaData?.activeInactiveField &&
schemaData?.schema?.Properties &&
Object.keys(schemaData.schema.Properties).includes(schemaData.activeInactiveField) &&
item?.properties?.[schemaData.activeInactiveField] !== t(UPLOADED_DATA_ACTIVE_STATUS)
) {
continue;
}
filteredFeature.push(item);
}
let data = fileData.data;
data["features"] = newFeatures;
data["features"] = filteredFeature;
return data;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ const SavedMicroplans = () => {
Digit.SessionStorage.set("microplanData", computedSession);

setShowLoader(false);
history.push(`/${window.contextPath}/employee/microplanning/create-microplan?id=${row?.original?.executionPlanId}`);
history.push(`/${window.contextPath}/employee/microplanning/edit-saved-microplan?id=${row?.original?.executionPlanId}`);
} catch (error) {
console.error(`Failed to process the request: ${error.message}`);
setShowLoader(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ const MicroplanningBreadCrumb = ({ location, defaultPath }) => {
const { t } = useTranslation();
const pathVar = location.pathname.replace(`${defaultPath}/`, "").split("?")?.[0];
const { masterName, moduleName, uniqueIdentifier } = Digit.Hooks.useQueryParams();

const crumbs = [
{
path: `/${window?.contextPath}/employee`,
Expand All @@ -34,15 +33,19 @@ const MicroplanningBreadCrumb = ({ location, defaultPath }) => {
// },
{
content: t(`CREATE_MICROPLAN`),
show: pathVar.includes("create-microplan"),
show: pathVar === "create-microplan",
},
{
content: t(`SAVED_MICROPLANS_TEXT`),
show: pathVar.includes("saved-microplan"),
show: pathVar === "saved-microplans",
},
{
content: t(`CREATE_MICROPLAN`),
show: pathVar.includes("select-campaign"),
show: pathVar === "select-campaign",
},
{
content: t(`EDIT_MICROPLANS_TEXT`),
show: pathVar === "edit-saved-microplan",
},
];
return <BreadCrumb className="workbench-bredcrumb" crumbs={crumbs} spanStyle={{ maxWidth: "min-content" }} />;
Expand Down Expand Up @@ -96,8 +99,8 @@ const App = ({ path }) => {
//destroying session
useEffect(() => {
const pathVar = location.pathname.replace(`${path}/`, "").split("?")?.[0];
Digit.Utils.microplan.destroySessionHelper(pathVar, ["create-microplan"], "microplanData");
Digit.Utils.microplan.destroySessionHelper(pathVar, ["create-microplan"], "microplanHelperData");
Digit.Utils.microplan.destroySessionHelper(pathVar, ["create-microplan", "edit-saved-microplan"], "microplanData");
Digit.Utils.microplan.destroySessionHelper(pathVar, ["create-microplan", "edit-saved-microplan"], "microplanHelperData");
Digit.Utils.microplan.destroySessionHelper(pathVar, ["select-campaign"], "SELECT_CAMPAIGN_SESSION");
Digit.Utils.microplan.destroySessionHelper(pathVar, ["saved-microplans"], "SAVED_MICROPLAN_SESSION");
}, [location]);
Expand All @@ -122,6 +125,7 @@ const App = ({ path }) => {
<PrivateRoute path={`${path}/create-microplan`} component={() => <CreateMicroplan parentRoute={path} />} />
<PrivateRoute path={`${path}/saved-microplans`} component={() => <SavedMicroplans parentRoute={path} />} />
<PrivateRoute path={`${path}/select-campaign`} component={() => <SelectCampaign parentRoute={path} />} />
<PrivateRoute path={`${path}/edit-saved-microplan`} component={() => <CreateMicroplan parentRoute={path} />} />
</AppContainer>
</Switch>
</React.Fragment>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,10 @@ export const extractGeoData = (
const keys = [...Object.keys(fileData?.data.features[0].properties), "feature"];
const values = fileData?.data.features.map((feature) => keys.map((key) => (key === "feature" ? feature : feature.properties[key] || null)));

const dataWithResources = [[...keys, ...resources], ...values];
let dataWithResources = [[...keys], ...values];
if (resources && formulaConfiguration && hypothesisAssumptionsList) {
dataWithResources = addResourcesToFilteredData(dataWithResources, resources, hypothesisAssumptionsList, formulaConfiguration, microplanData, t);
}
const processedDataWithResources = dataWithResources.map((item, index) => {
if (index === 0) return item;
const newProperties = keys.reduce((acc, key, i) => (key !== "feature" ? { ...acc, [key]: item[i] } : acc), {});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ export const updateSessionUtils = {
};

const fetchBoundaryDataWrapper = async (schemaData) => {
let boundaryDataAgainstBoundaryCode = {};
const boundaryDataAgainstBoundaryCode = {};
// if (!schemaData?.doHierarchyCheckInUploadedData) {
try {
const rootBoundary = additionalProps.campaignData?.boundaries?.filter((boundary) => boundary.isRoot); // Retrieve session storage data once and store it in a variable
Expand Down Expand Up @@ -329,10 +329,10 @@ export const updateSessionUtils = {
!mappedToList.includes(`${additionalProps.campaignData?.hierarchyType}_${Digit.Utils.microplan.transformIntoLocalisationCode(item)}`)
)
) {
let boundaryDataAgainstBoundaryCode = await fetchBoundaryDataWrapper(schema);
const boundaryDataAgainstBoundaryCode = await fetchBoundaryDataWrapper(schema);
upload.data.features.forEach((feature) => {
const boundaryCode = feature.properties.boundaryCode;
let additionalDetails = {};
const additionalDetails = {};
for (let i = 0; i < additionalProps.hierarchyData?.length; i++) {
if (boundaryDataAgainstBoundaryCode[boundaryCode]?.[i] || boundaryDataAgainstBoundaryCode[boundaryCode]?.[i] === "") {
additionalDetails[additionalProps.hierarchyData?.[i]] = boundaryDataAgainstBoundaryCode[boundaryCode][i];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ const processData = (data, schemaCols, errors, hierarchy, sectionIdList, readMeS

// Function to process errors for a sheet
const processSheetErrors = (dataset, sheetName, errors, t) => {
let headerCount = dataset[0].length;
const headerCount = dataset[0].length;
dataset[0].push(t("MICROPLAN_ERROR_STATUS_COLUMN"), t("MICROPLAN_ERROR_COLUMN"));

for (let i = 1; i < dataset.length; i++) {
Expand All @@ -573,7 +573,7 @@ const processSheetErrors = (dataset, sheetName, errors, t) => {

const errorInfo = errors?.[sheetName]?.[i - 1];
if (errorInfo) {
let rowDataAddOn = Object.entries(errorInfo)
const rowDataAddOn = Object.entries(errorInfo)
.map(([key, value]) => {
return `${t(key)}: ${value.map((item) => t(item)).join(", ")}`;
})
Expand Down Expand Up @@ -724,7 +724,7 @@ export const convertToWorkBook = async (jsonData, columnWithStyle, t) => {
return workbook;
};
export const boundaryDataGeneration = async (schemaData, campaignData, t) => {
let boundaryDataAgainstBoundaryCode = {};
const boundaryDataAgainstBoundaryCode = {};
if (schemaData && !schemaData.doHierarchyCheckInUploadedData) {
try {
const rootBoundary = campaignData?.boundaries?.filter((boundary) => boundary.isRoot); // Retrieve session storage data once and store it in a variable
Expand Down
2 changes: 1 addition & 1 deletion micro-ui/web/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
/>
<link
rel="stylesheet"
href="https://unpkg.com/@egovernments/[email protected].44-microplan/dist/index.css"
href="https://unpkg.com/@egovernments/[email protected].45-microplan/dist/index.css"
/>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#00bcd1" />
Expand Down

0 comments on commit 4bac6bc

Please sign in to comment.