diff --git a/health/micro-ui/web/micro-ui-internals/example/src/UICustomizations.js b/health/micro-ui/web/micro-ui-internals/example/src/UICustomizations.js
index 1b4bada361b..50a20e94fc9 100644
--- a/health/micro-ui/web/micro-ui-internals/example/src/UICustomizations.js
+++ b/health/micro-ui/web/micro-ui-internals/example/src/UICustomizations.js
@@ -767,12 +767,18 @@ export const UICustomizations = {
},
MicroplanSearchConfig: {
preProcess: (data, additionalDetails) => {
- const { name, status } = data?.state?.searchForm || {};
+ const MICROPLAN_STATUS_MAP = {
+ 0: null,
+ 1: ["DRAFT"],
+ 2: ["EXECUTION_TO_BE_DONE"],
+ 3: ["CENSUS_DATA_APPROVAL_IN_PROGRESS", "CENSUS_DATA_APPROVED", "RESOURCE_ESTIMATION_IN_PROGRESS"],
+ 4: ["RESOURCE_ESTIMATIONS_APPROVED"],
+ };
+ const { status } = data?.state?.searchForm || {};
data.body.PlanConfigurationSearchCriteria = {};
data.body.PlanConfigurationSearchCriteria.limit = data?.state?.tableForm?.limit;
// data.body.PlanConfigurationSearchCriteria.limit = 10
data.body.PlanConfigurationSearchCriteria.offset = data?.state?.tableForm?.offset;
- data.body.PlanConfigurationSearchCriteria.name = name;
data.body.PlanConfigurationSearchCriteria.tenantId = Digit.ULBService.getCurrentTenantId();
data.body.PlanConfigurationSearchCriteria.userUuid = Digit.UserService.getUser().info.uuid;
// delete data.body.PlanConfigurationSearchCriteria.pagination
@@ -780,17 +786,11 @@ export const UICustomizations = {
data.body.PlanConfigurationSearchCriteria.name = data?.state?.searchForm?.microplanName;
cleanObject(data.body.PlanConfigurationSearchCriteria);
- const dic = {
- 0: null,
- 1: ["DRAFT"],
- 2: ["EXECUTION_TO_BE_DONE"],
- 3: ["CENSUS_DATA_APPROVAL_IN_PROGRESS", "CENSUS_DATA_APPROVED", "RESOURCE_ESTIMATION_IN_PROGRESS"],
- 4: ["RESOURCE_ESTIMATIONS_APPROVED"],
- };
+
const url = Digit.Hooks.useQueryParams();
const tabId = url.tabId || "0"; // Default to '0' if tabId is undefined
- data.body.PlanConfigurationSearchCriteria.status = dic[String(tabId)];
+ data.body.PlanConfigurationSearchCriteria.status = MICROPLAN_STATUS_MAP[String(tabId)];
cleanObject(data.body.PlanConfigurationSearchCriteria);
return data;
},
diff --git a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/RoleTableComposer.js b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/RoleTableComposer.js
index b7b652fe18b..b44f3bf4559 100644
--- a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/RoleTableComposer.js
+++ b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/RoleTableComposer.js
@@ -78,8 +78,7 @@ function RoleTableComposer({ nationalRoles }) {
config: {
enabled: true,
select: (data) => {
- const resp = data?.Employees
- ?.map((item, index) => {
+ const resp = data?.Employees?.map((item, index) => {
return {
rowIndex: index + 1,
name: item?.user?.name,
diff --git a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/UserAccess.js b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/UserAccess.js
index 7d3f1f84ed8..9a816ba6455 100644
--- a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/UserAccess.js
+++ b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/UserAccess.js
@@ -301,6 +301,7 @@ function UserAccess({ category, setData, nationalRoles }) {
useEffect(()=>{
setShowToast(null);
+ // Reset search when category changes to prevent filtering with previous search terms
setSearchQuery("");
},[category])
diff --git a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/configs/UICustomizations.js b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/configs/UICustomizations.js
index f8fe90573c3..6e19a9fce51 100644
--- a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/configs/UICustomizations.js
+++ b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/configs/UICustomizations.js
@@ -48,176 +48,176 @@ export const UICustomizations = {
test: "yes",
},
MicroplanSearchConfig: {
- preProcess: (data, additionalDetails) => {
- const { name, status } = data?.state?.searchForm || {};
- data.body.PlanConfigurationSearchCriteria = {};
- data.body.PlanConfigurationSearchCriteria.limit = data?.state?.tableForm?.limit;
- // data.body.PlanConfigurationSearchCriteria.limit = 10
- data.body.PlanConfigurationSearchCriteria.offset = data?.state?.tableForm?.offset;
- data.body.PlanConfigurationSearchCriteria.name = name;
- data.body.PlanConfigurationSearchCriteria.tenantId = Digit.ULBService.getCurrentTenantId();
- data.body.PlanConfigurationSearchCriteria.userUuid = Digit.UserService.getUser().info.uuid;
- // delete data.body.PlanConfigurationSearchCriteria.pagination
- data.body.PlanConfigurationSearchCriteria.status = status?.status;
- data.body.PlanConfigurationSearchCriteria.name = data?.state?.searchForm?.microplanName;
- cleanObject(data.body.PlanConfigurationSearchCriteria);
-
- const dic = {
- 0: null,
- 1: ["DRAFT"],
- 2: ["EXECUTION_TO_BE_DONE"],
- 3: ["CENSUS_DATA_APPROVAL_IN_PROGRESS", "CENSUS_DATA_APPROVED", "RESOURCE_ESTIMATION_IN_PROGRESS"],
- 4: ["RESOURCE_ESTIMATIONS_APPROVED"],
- };
- const url = Digit.Hooks.useQueryParams();
-
- const tabId = url.tabId || "0"; // Default to '0' if tabId is undefined
- data.body.PlanConfigurationSearchCriteria.status = dic[String(tabId)];
- cleanObject(data.body.PlanConfigurationSearchCriteria);
- return data;
- },
- additionalCustomizations: (row, key, column, value, t, searchResult) => {
-
- switch (key) {
- case "ACTIONS":
- // TODO : Replace dummy file id with real file id when API is ready
- const dummyFile = "c22a7676-d5d7-49b6-bcdb-83e9519f58df"
- const microplanFileId = row?.campaignDetails?.additionalDetails?.microplanFileId || dummyFile;
- let options = [];
-
- if (row?.status == "DRAFT") {
- options = [{ code: "1", name: "MP_ACTIONS_EDIT_SETUP" }];
- } else {
- options = [{ code: "1", name: "MP_ACTIONS_VIEW_SUMMARY" }];
- }
-
- const handleDownload = () => {
- const files = row?.files;
- const file = files.find((item) => item.templateIdentifier === "Population");
- const fileId = file?.filestoreId;
- if (!fileId) {
- console.error("Population template file not found");
- return;
- }
- const campaignName = row?.name || "";
- Digit.Utils.campaign.downloadExcelWithCustomName({
- fileStoreId: fileId,
- customName: campaignName
- });
- };
-
- const onActionSelect = (e) => {
- if (e.name === "MP_ACTIONS_EDIT_SETUP") {
- const key = parseInt(row?.additionalDetails?.key);
- const resolvedKey = key === 8 ? 7 : key === 9 ? 10 : key || 2;
- const url = `/${window.contextPath}/employee/microplan/setup-microplan?key=${resolvedKey}µplanId=${row.id}&campaignId=${row.campaignDetails.id}`;
- window.location.href = url;
- }
- if (e.name == "MP_ACTIONS_VIEW_SUMMARY") {
- window.location.href = `/${window.contextPath}/employee/microplan/setup-microplan?key=${10}µplanId=${row.id}&campaignId=${
- row.campaignDetails.id
- }&setup-completed=true`;
- }
+ preProcess: (data, additionalDetails) => {
+ const MICROPLAN_STATUS_MAP = {
+ 0: null,
+ 1: ["DRAFT"],
+ 2: ["EXECUTION_TO_BE_DONE"],
+ 3: ["CENSUS_DATA_APPROVAL_IN_PROGRESS", "CENSUS_DATA_APPROVED", "RESOURCE_ESTIMATION_IN_PROGRESS"],
+ 4: ["RESOURCE_ESTIMATIONS_APPROVED"],
};
-
- return (
-
- {microplanFileId && row?.status == "RESOURCE_ESTIMATIONS_APPROVED" ? (
+ const { status } = data?.state?.searchForm || {};
+ data.body.PlanConfigurationSearchCriteria = {};
+ data.body.PlanConfigurationSearchCriteria.limit = data?.state?.tableForm?.limit;
+ // data.body.PlanConfigurationSearchCriteria.limit = 10
+ data.body.PlanConfigurationSearchCriteria.offset = data?.state?.tableForm?.offset;
+ data.body.PlanConfigurationSearchCriteria.tenantId = Digit.ULBService.getCurrentTenantId();
+ data.body.PlanConfigurationSearchCriteria.userUuid = Digit.UserService.getUser().info.uuid;
+ // delete data.body.PlanConfigurationSearchCriteria.pagination
+ data.body.PlanConfigurationSearchCriteria.status = status?.status;
+ data.body.PlanConfigurationSearchCriteria.name = data?.state?.searchForm?.microplanName;
+ cleanObject(data.body.PlanConfigurationSearchCriteria);
+
+
+ const url = Digit.Hooks.useQueryParams();
+
+ const tabId = url.tabId || "0"; // Default to '0' if tabId is undefined
+ data.body.PlanConfigurationSearchCriteria.status = MICROPLAN_STATUS_MAP[String(tabId)];
+ cleanObject(data.body.PlanConfigurationSearchCriteria);
+ return data;
+ },
+ additionalCustomizations: (row, key, column, value, t, searchResult) => {
+
+ switch (key) {
+ case "ACTIONS":
+ // TODO : Replace dummy file id with real file id when API is ready
+ const dummyFile = "c22a7676-d5d7-49b6-bcdb-83e9519f58df"
+ const microplanFileId = row?.campaignDetails?.additionalDetails?.microplanFileId || dummyFile;
+ let options = [];
+
+ if (row?.status == "DRAFT") {
+ options = [{ code: "1", name: "MP_ACTIONS_EDIT_SETUP" }];
+ } else {
+ options = [{ code: "1", name: "MP_ACTIONS_VIEW_SUMMARY" }];
+ }
+
+ const handleDownload = () => {
+ const files = row?.files;
+ const file = files.find((item) => item.templateIdentifier === "Population");
+ const fileId = file?.filestoreId;
+ if (!fileId) {
+ console.error("Population template file not found");
+ return;
+ }
+ const campaignName = row?.name || "";
+ Digit.Utils.campaign.downloadExcelWithCustomName({
+ fileStoreId: fileId,
+ customName: campaignName
+ });
+ };
+
+ const onActionSelect = (e) => {
+ if (e.name === "MP_ACTIONS_EDIT_SETUP") {
+ const key = parseInt(row?.additionalDetails?.key);
+ const resolvedKey = key === 8 ? 7 : key === 9 ? 10 : key || 2;
+ const url = `/${window.contextPath}/employee/microplan/setup-microplan?key=${resolvedKey}µplanId=${row.id}&campaignId=${row.campaignDetails.id}`;
+ window.location.href = url;
+ }
+ if (e.name == "MP_ACTIONS_VIEW_SUMMARY") {
+ window.location.href = `/${window.contextPath}/employee/microplan/setup-microplan?key=${10}µplanId=${row.id}&campaignId=${
+ row.campaignDetails.id
+ }&setup-completed=true`;
+ }
+ };
+
+ return (
-
+ {microplanFileId && row?.status == "RESOURCE_ESTIMATIONS_APPROVED" ? (
+
+
+
+ ) : (
+
+
+ onActionSelect(item)}
+ />
+
+
+ )}
- ) : (
-
-
-
onActionSelect(item)}
- />
+ );
+
+ case "NAME_OF_MICROPLAN":
+ if (value && value !== "NA") {
+ return (
+
-
- )}
-
- );
-
- case "NAME_OF_MICROPLAN":
- if (value && value !== "NA") {
- return (
-
- );
- } else {
- return (
-
- );
- }
-
- case "MICROPLAN_STATUS":
- if (value && value != "NA") {
- return
{t(Digit.Utils.locale.getTransformedLocale("MICROPLAN_STATUS_" + value))}
;
- } else {
- return (
-
- );
- }
-
- case "CAMPAIGN_DISEASE":
- if (value && value != "NA") {
- return
{t(Digit.Utils.locale.getTransformedLocale("MICROPLAN_DISEASE_" + value))}
;
- } else {
- return (
-
- );
- }
-
- case "CAMPAIGN_TYPE":
- if (value && value != "NA") {
- return
{t(Digit.Utils.locale.getTransformedLocale("MICROPLAN_TYPE_" + value))}
;
- } else {
- return (
-
- );
- }
-
- case "DISTIRBUTION_STRATEGY":
- if (value && value != "NA") {
- return
{t(Digit.Utils.locale.getTransformedLocale("MICROPLAN_DISTRIBUTION_" + value))}
;
- } else {
- return (
-
- );
+ );
+ } else {
+ return (
+
+ );
+ }
+
+ case "MICROPLAN_STATUS":
+ if (value && value != "NA") {
+ return
{t(Digit.Utils.locale.getTransformedLocale("MICROPLAN_STATUS_" + value))}
;
+ } else {
+ return (
+
+ );
+ }
+
+ case "CAMPAIGN_DISEASE":
+ if (value && value != "NA") {
+ return
{t(Digit.Utils.locale.getTransformedLocale("MICROPLAN_DISEASE_" + value))}
;
+ } else {
+ return (
+
+ );
+ }
+
+ case "CAMPAIGN_TYPE":
+ if (value && value != "NA") {
+ return
{t(Digit.Utils.locale.getTransformedLocale("MICROPLAN_TYPE_" + value))}
;
+ } else {
+ return (
+
+ );
+ }
+
+ case "DISTIRBUTION_STRATEGY":
+ if (value && value != "NA") {
+ return
{t(Digit.Utils.locale.getTransformedLocale("MICROPLAN_DISTRIBUTION_" + value))}
;
+ } else {
+ return (
+
+ );
+ }
+
+ default:
+ return null; // Handle any unexpected keys here if needed
}
-
- default:
- return null; // Handle any unexpected keys here if needed
- }
- },
- },
+ },
+ },
MyMicroplanSearchConfig: {
preProcess: (data, additionalDetails) => {
const { name, status } = data?.state?.searchForm || {};
diff --git a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/hooks/services/createUpdatePlanProject.js b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/hooks/services/createUpdatePlanProject.js
index f9a174c004d..cbe43312ce8 100644
--- a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/hooks/services/createUpdatePlanProject.js
+++ b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/hooks/services/createUpdatePlanProject.js
@@ -356,14 +356,16 @@ const createUpdatePlanProject = async (req) => {
const triggeredFrom = config.name;
switch (triggeredFrom) {
- case "CAMPAIGN_DETAILS":
+ case "CAMPAIGN_DETAILS":{
setCurrentKey((prev) => prev + 1);
setCurrentStep((prev) => prev + 1);
return {
triggeredFrom,
};
+ }
case "MICROPLAN_DETAILS":
+ {
//here just check if microplanId and campaignId is already there then if microplan name is same as old one no need to do anything
if (microplanId && campaignId && planObject?.name === totalFormData?.MICROPLAN_DETAILS?.microplanDetails?.microplanName) {
setCurrentKey((prev) => prev + 1);
@@ -412,8 +414,10 @@ const createUpdatePlanProject = async (req) => {
triggeredFrom,
};
}
+ }
case "BOUNDARY":
+ {
// call an update to plan
// also write logic to invalidate
@@ -526,8 +530,9 @@ const createUpdatePlanProject = async (req) => {
} else {
setShowToast({ key: "error", label: "ERR_BOUNDARY_UPDATE" });
}
+ }
- case "ASSUMPTIONS_FORM":
+ case "ASSUMPTIONS_FORM":{
// here we have to invalidate the existing assumptions in update call if there is a change in assumptionsForm
// check whether the currentAssumptionsForm is equal to prev assumptionsForm (if so then skip this update call)
@@ -598,8 +603,8 @@ const createUpdatePlanProject = async (req) => {
} else {
setShowToast({ key: "error", label: "ERR_ASSUMPTIONS_FORM_UPDATE" });
}
-
- case "HYPOTHESIS":
+ }
+ case "HYPOTHESIS":{
//fetch current plan
const fetchedPlanForHypothesis = await searchPlanConfig({
PlanConfigurationSearchCriteria: {
@@ -637,8 +642,8 @@ const createUpdatePlanProject = async (req) => {
} else {
setShowToast({ key: "error", label: "ERR_ASSUMPTIONS_FORM_UPDATE" });
}
-
- case "SUB_HYPOTHESIS":
+ }
+ case "SUB_HYPOTHESIS":{
//first fetch current plan object
const fetchedPlanForSubHypothesis = await searchPlanConfig({
PlanConfigurationSearchCriteria: {
@@ -668,8 +673,8 @@ const createUpdatePlanProject = async (req) => {
await updatePlan(upatedPlanObjSubHypothesis);
return;
-
- case "FORMULA_CONFIGURATION":
+ }
+ case "FORMULA_CONFIGURATION":{
if (
!totalFormData?.FORMULA_CONFIGURATION?.formulaConfiguration?.formulaConfigValues.every(
(row) => row.category && row.output && row.input && row.operatorName && row.assumptionValue
@@ -726,8 +731,8 @@ const createUpdatePlanProject = async (req) => {
} else {
setShowToast({ key: "error", label: "ERR_ASSUMPTIONS_FORM_UPDATE" });
}
-
- case "SUB_FORMULA":
+ }
+ case "SUB_FORMULA":{
//first fetch current plan object
const fetchedPlanForSubFormula = await searchPlanConfig({
PlanConfigurationSearchCriteria: {
@@ -767,8 +772,9 @@ const createUpdatePlanProject = async (req) => {
};
await updatePlan(upatedPlanObjSubFormula);
return;
+ }
- case "UPLOADBOUNDARYDATA":
+ case "UPLOADBOUNDARYDATA":{
const fetchedPlanForBoundary = await searchPlanConfig({
PlanConfigurationSearchCriteria: {
tenantId,
@@ -807,8 +813,9 @@ const createUpdatePlanProject = async (req) => {
} else {
setShowToast({ key: "error", label: "ERR_BOUNDARY_FORM_UPDATE" });
}
+ }
- case "UPLOADFACILITYDATA":
+ case "UPLOADFACILITYDATA":{
const fetchedPlanForFacility = await searchPlanConfig({
PlanConfigurationSearchCriteria: {
tenantId,
@@ -851,8 +858,9 @@ const createUpdatePlanProject = async (req) => {
} else {
setShowToast({ key: "error", label: "ERR_FACILITY_FORM_UPDATE" });
}
+ }
- case "SUMMARY_SCREEN":
+ case "SUMMARY_SCREEN":{
//here we need to take complete setup action
//update plan-config with workflow action
const fetchedPlanForSummary = await searchPlanConfig({
@@ -914,6 +922,7 @@ const createUpdatePlanProject = async (req) => {
} else {
setShowToast({ key: "error", label: "ERR_FAILED_TO_COMPLETE_SETUP" });
}
+ }
case "ROLE_ACCESS_CONFIGURATION": {
const fetchedPlan = await searchPlanConfig({
@@ -941,6 +950,7 @@ const createUpdatePlanProject = async (req) => {
setShowToast({ key: "error", label: "ERR_FAILED_TO_UPDATE_PLAN" });
}
}
+ break;
default:
setShowToast({ key: "error", label: "ERROR_UNHANDLED_NEXT_OPERATION" });
diff --git a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/PopInbox.js b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/PopInbox.js
index 19b8501dd34..9bc1e62786f 100644
--- a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/PopInbox.js
+++ b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/PopInbox.js
@@ -344,7 +344,7 @@ const PopInbox = () => {
CensusSearchCriteria: {
tenantId: tenantId,
source: microplanId,
- status: selectedFilter?.status !== null && selectedFilter?.status !== undefined ? selectedFilter?.status : "",
+ status: selectedFilter?.status || "",
...(activeLink.code == "ASSIGNED_TO_ALL" || selectedFilter?.status == "VALIDATED"
? {}
: { assignee: user.info.uuid }),