Skip to content

Commit

Permalink
added dropdown related changes
Browse files Browse the repository at this point in the history
  • Loading branch information
nitish-egov committed Jan 27, 2025
1 parent f492334 commit b23714a
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions health-services/project-factory/src/server/utils/genericUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ async function createFacilitySheet(request: any, allFacilities: any[], localizat
logger.info("facilities generation done ");
logger.debug(`facility response ${JSON.stringify(facilities)}`)
const facilitySheetData: any = await createExcelSheet(facilities, localizedHeaders);
return facilitySheetData;
return { schema, facilitySheetData };
}


Expand Down Expand Up @@ -880,29 +880,31 @@ async function generateFacilityAndBoundarySheet(tenantId: string, request: any,
const allFacilities = await getAllFacilities(tenantId, request.body);
request.body.generatedResourceCount = allFacilities?.length;
logger.info(`Facilities generation completed and found ${allFacilities?.length} facilities`);
let facilitySheetData: any;
let facilitySheetDataFinal: any;
const localizedFacilityTab = getLocalizedName(config?.facility?.facilityTab, localizationMap);
let schema: any;
let schemaFinal: any;
if (fileUrl) {
/* fetch facility from processed file
and generate facility sheet data */
schema = await callMdmsTypeSchema(request, tenantId, true, typeWithoutWith, "all");
schemaFinal = await callMdmsTypeSchema(request, tenantId, true, typeWithoutWith, "all");
const processedFacilitySheetData = await getSheetData(fileUrl, localizedFacilityTab, false, undefined, localizationMap);
const modifiedProcessedFacilitySheetData = modifyProcessedSheetData(typeWithoutWith, processedFacilitySheetData, schema, localizationMap);
facilitySheetData = modifiedProcessedFacilitySheetData;
const modifiedProcessedFacilitySheetData = modifyProcessedSheetData(typeWithoutWith, processedFacilitySheetData, schemaFinal, localizationMap);
facilitySheetDataFinal = modifiedProcessedFacilitySheetData;
// setDropdownFromSchema(request, schema, localizationMap);
}
else {
facilitySheetData = await createFacilitySheet(request, allFacilities, localizationMap);
const { schema, facilitySheetData }: any = await createFacilitySheet(request, allFacilities, localizationMap);
facilitySheetDataFinal = facilitySheetData;
schemaFinal = schema;
}
// request.body.Filters = { tenantId: tenantId, hierarchyType: request?.query?.hierarchyType, includeChildren: true }
if (filteredBoundary && filteredBoundary.length > 0) {
logger.info("proceed with the filtered boundary data")
await createFacilityAndBoundaryFile(facilitySheetData, filteredBoundary, request, localizationMap, fileUrl, schema);
await createFacilityAndBoundaryFile(facilitySheetDataFinal, filteredBoundary, request, localizationMap, fileUrl, schemaFinal);
}
else {
const boundarySheetData: any = await getBoundarySheetData(request, localizationMap);
await createFacilityAndBoundaryFile(facilitySheetData, boundarySheetData, request, localizationMap, fileUrl, schema);
await createFacilityAndBoundaryFile(facilitySheetDataFinal, boundarySheetData, request, localizationMap, fileUrl, schemaFinal);
}
}

Expand Down

0 comments on commit b23714a

Please sign in to comment.