diff --git a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/MicroplanCard.js b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/MicroplanCard.js
index 28aa95f0700..d960ee66df7 100644
--- a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/MicroplanCard.js
+++ b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/MicroplanCard.js
@@ -18,7 +18,7 @@ const MicroplanCard = () => {
};
};
- let links = [generateLink("SETUP_MICROLAN","setup-microplan")];
+ let links = [generateLink("SETUP_MICROCLAN","setup-microplan"),generateLink("SEARCH_MICROPLANS","microplan-search")];
links = links.filter((link) => (link?.roles && link?.roles?.length > 0 ? Digit.Utils.didEmployeeHasAtleastOneRole(link?.roles) : true));
diff --git a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/configs/MicroplanSearchConfig.js b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/configs/MicroplanSearchConfig.js
new file mode 100644
index 00000000000..1bbbdd330e0
--- /dev/null
+++ b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/configs/MicroplanSearchConfig.js
@@ -0,0 +1,126 @@
+
+
+// default values of search input component
+const defaultSearchValues = {
+ microplanName: "",
+
+ };
+
+
+ //config for tab search sceeen
+ export const TabSearchconfig = {
+ // moduleName: "commonCampaignUiConfig",
+ showTab: true, // setting true will enable tab screen
+ TabSearchconfig: [ // all tab config should be added in json array
+ {
+ label: "ALL",
+ type: "search",
+ apiDetails: {
+ serviceName: "/plan-service/config/_search", //! Note
+ requestParam: {},
+ requestBody: {},
+ masterName: "commonUiConfig",
+ moduleName: "MicroplanSearchConfig",
+ minParametersForSearchForm: 0,
+ tableFormJsonPath: "requestBody.PlanConfigurationSearchCriteria.pagination",
+ // filterFormJsonPath: "requestBody.MdmsCriteria.customs",
+ searchFormJsonPath: "requestBody.PlanConfigurationSearchCriteria",
+ },
+
+ sections: {
+ search: {
+ uiConfig: {
+ formClassName: "custom-both-clear-search",
+ primaryLabel: "ES_COMMON_SEARCH",
+ secondaryLabel: "ES_COMMON_CLEAR_SEARCH",
+ minReqFields: 0,
+ defaultValues: defaultSearchValues, // Set default values for search fields
+ fields: [
+ {
+ label: "Name of the microplan",
+ isMandatory: false,
+ key: "microplanName",
+ type: "text",
+ populators: {
+ name: "microplanName",
+ error: "Required",
+ validation: { pattern: /^[A-Za-z]+$/i },
+ },
+ },
+ // {
+ // label: "Phone number",
+ // isMandatory: false,
+ // key: "Phone number",
+ // type: "number",
+ // disable: false,
+ // populators: { name: "mobileNumber", error: "sample error message", validation: { min: 0, max: 999999999 } },
+ // },
+ // {
+ // label: "Individual Id ",
+ // isMandatory: false,
+ // type: "text",
+ // disable: false,
+ // populators: {
+ // name: "individualId",
+ // },
+ // },
+ ],
+ },
+
+ show: true,
+ },
+ searchResult: {
+ uiConfig: {
+ columns: [
+ {
+ label: "Name of the Microplan",
+ jsonPath: "name",
+ additionalCustomization:true
+ },
+
+ {
+ label: "Microplan Status",
+ jsonPath: "status",
+ },
+ {
+ label: "Campaign Disease",
+ jsonPath: "CampaignDetails.campaignName",
+ },
+ {
+ label:"Camapaign Type",
+ jsonPath:"CampaignDetails.startDate"
+ },
+ {
+ label:"Distribution Strategy",
+ jsonPath:" proposalDate"
+ },
+ {
+ label:"Actions",
+ jsonPath:"",
+ additionalCustomization:true
+ }
+ ],
+ resultsJsonPath: "PlanConfiguration",
+
+ enableColumnSort: true,
+ // resultsJsonPath: "mdms",
+ },
+ show: true,
+ },
+ // customHookName: "microplanv1.useSavedMicroplans", //! Note
+
+ },
+ customHookName:"microplanv1.useSavedMicroplans"
+ },
+
+
+ {label: "DRAFTED_SETUP"},
+ {label: "EXECUTION_TO_BE_DONE",},
+ {label:"EXECUTION_IN_PROGRESS"},
+ {label:"MICROPLAN_EXECUTED"}
+
+ ],
+ };
+
+
+
\ No newline at end of file
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 427e1c5bb18..a8ce71c57ab 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
@@ -1,5 +1,7 @@
import { Link, useHistory } from "react-router-dom";
import _ from "lodash";
+import React from "react";
+import { Dropdown } from "@egovernments/digit-ui-components";
//create functions here based on module name set in mdms(eg->SearchProjectConfig)
//how to call these -> Digit?.Customizations?.[masterName]?.[moduleName]
@@ -10,108 +12,90 @@ const businessServiceMap = {};
const inboxModuleNameMap = {};
+function cleanObject(obj) {
+ for (const key in obj) {
+ if (Object.hasOwn(obj, key)) {
+ if (Array.isArray(obj[key])) {
+ if (obj[key].length === 0) {
+ delete obj[key];
+ }
+ } else if (
+ obj[key] === undefined ||
+ obj[key] === null ||
+ obj[key] === false ||
+ obj[key] === "" || // Check for empty string
+ (typeof obj[key] === "object" && Object.keys(obj[key]).length === 0)
+ ) {
+ delete obj[key];
+ }
+ }
+ }
+ return obj;
+}
+
export const UICustomizations = {
- SearchPucarConfig: {
- customValidationCheck: (data) => {
- //checking both to and from date are present
- const { createdFrom, createdTo } = data;
- if ((createdFrom === "" && createdTo !== "") || (createdFrom !== "" && createdTo === ""))
- return { warning: true, label: "ES_COMMON_ENTER_DATE_RANGE" };
-
- return false;
- },
- preProcess: (data) => {
- // data.params = { ...data.params, tenantId: Digit.ULBService.getCurrentTenantId() };
-
- // let requestBody = { ...data.body.Individual };
- // const pathConfig = {
- // name: "name.givenName",
- // };
- // const dateConfig = {
- // createdFrom: "daystart",
- // createdTo: "dayend",
- // };
- // const selectConfig = {
- // wardCode: "wardCode[0].code",
- // socialCategory: "socialCategory.code",
- // };
- // const textConfig = ["name", "individualId"];
- // let Individual = Object.keys(requestBody)
- // .map((key) => {
- // if (selectConfig[key]) {
- // requestBody[key] = _.get(requestBody, selectConfig[key], null);
- // } else if (typeof requestBody[key] == "object") {
- // requestBody[key] = requestBody[key]?.code;
- // } else if (textConfig?.includes(key)) {
- // requestBody[key] = requestBody[key]?.trim();
- // }
- // return key;
- // })
- // .filter((key) => requestBody[key])
- // .reduce((acc, curr) => {
- // if (pathConfig[curr]) {
- // _.set(acc, pathConfig[curr], requestBody[curr]);
- // } else if (dateConfig[curr] && dateConfig[curr]?.includes("day")) {
- // _.set(acc, curr, Digit.Utils.date.convertDateToEpoch(requestBody[curr], dateConfig[curr]));
- // } else {
- // _.set(acc, curr, requestBody[curr]);
- // }
- // return acc;
- // }, {});
-
- // data.body.Individual = { ...Individual };
- console.log(data,"data");
- return data;
- },
- additionalCustomizations: (row, key, column, value, t, searchResult) => {
- //here we can add multiple conditions
- //like if a cell is link then we return link
- //first we can identify which column it belongs to then we can return relevant result
- switch (key) {
- case "MASTERS_WAGESEEKER_ID":
- return (
-
-
- {String(value ? (column.translate ? t(column.prefix ? `${column.prefix}${value}` : value) : value) : t("ES_COMMON_NA"))}
-
-
- );
-
- case "MASTERS_SOCIAL_CATEGORY":
- return value ? {String(t(`MASTERS_${value}`))} : t("ES_COMMON_NA");
-
- case "CORE_COMMON_PROFILE_CITY":
- return value ? {String(t(Digit.Utils.locale.getCityLocale(value)))} : t("ES_COMMON_NA");
-
- case "MASTERS_WARD":
- return value ? (
- {String(t(Digit.Utils.locale.getMohallaLocale(value, row?.tenantId)))}
- ) : (
- t("ES_COMMON_NA")
- );
+
+ 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;
+ cleanObject(data.body.PlanConfigurationSearchCriteria);
- case "MASTERS_LOCALITY":
- return value ? (
- {String(t(Digit.Utils.locale.getMohallaLocale(value, row?.tenantId)))}
- ) : (
- t("ES_COMMON_NA")
- );
- default:
- return t("ES_COMMON_NA");
- }
- },
- MobileDetailsOnClick: (row, tenantId) => {
- let link;
- Object.keys(row).map((key) => {
- if (key === "MASTERS_WAGESEEKER_ID")
- link = `/${window.contextPath}/employee/masters/view-wageseeker?tenantId=${tenantId}&wageseekerId=${row[key]}`;
- });
- return link;
- },
- additionalValidations: (type, data, keys) => {
- if (type === "date") {
- return data[keys.start] && data[keys.end] ? () => new Date(data[keys.start]).getTime() <= new Date(data[keys.end]).getTime() : true;
- }
- },
- },
+ return data;
+ },
+ additionalCustomizations: (row, key, column, value, t, searchResult) => {
+ if (key === "Actions") {
+ return (
+
$${value}
+ + ); + } + + if (key === "Name of the Microplan") { + if (value && value !== "NA") { + + return ( +{value}
+NA
+