diff --git a/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CampaignCard.js b/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CampaignCard.js index 41329a8d089..a17de5031ae 100644 --- a/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CampaignCard.js +++ b/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CampaignCard.js @@ -74,6 +74,12 @@ const CampaignCard = () => { roles: ROLES.CAMPAIGN_MANAGER, // count: isLoading?"-":data }, + { + label: t("MICROPLAN_CAMPAIGN"), + link: `/${window?.contextPath}/employee/campaign/my-microplan`, + roles: ROLES.CAMPAIGN_MANAGER, + // count: isLoading?"-":data + }, ]; 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/campaign-manager/src/components/CampaignType.js b/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CampaignType.js index 42adf726de5..a60630e7b2d 100644 --- a/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CampaignType.js +++ b/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CampaignType.js @@ -19,6 +19,7 @@ const CampaignSelection = ({ onSelect, formData, formState, ...props }) => { const searchParams = new URLSearchParams(location.search); const [currentStep , setCurrentStep] = useState(1); const currentKey = searchParams.get("key"); + const productType = searchParams.get("type"); const [key, setKey] = useState(() => { const keyParam = searchParams.get("key"); return keyParam ? parseInt(keyParam) : 1; @@ -118,7 +119,7 @@ const CampaignSelection = ({ onSelect, formData, formState, ...props }) => {
{ - if (props?.props?.sessionData?.HCM_CAMPAIGN_TYPE?.projectType && !canUpdate) { + if (props?.props?.sessionData?.HCM_CAMPAIGN_TYPE?.projectType && !canUpdate && productType!=="microplan") { setShowPopUp(true); return; } @@ -143,6 +144,8 @@ const CampaignSelection = ({ onSelect, formData, formState, ...props }) => { setStartValidation(true); handleChange(value); }} + disabled = {productType === "microplan"} + /> {error?.message && }
diff --git a/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/configs/UICustomizations.js b/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/configs/UICustomizations.js index 7c530ca3f3a..c566f3a38a3 100644 --- a/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/configs/UICustomizations.js +++ b/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/configs/UICustomizations.js @@ -299,11 +299,66 @@ export const UICustomizations = { }} /> - ) + ); } - }, + }, + MicroplanCampaignSearchConfig: { + 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; + data.body.PlanConfigurationSearchCriteria.campaignType = data?.state?.searchForm?.campaignType?.[0]?.code; + return data; + }, + additionalCustomizations: (row, key, column, value, t, searchResult) => { + switch (key) { + case "NAME_OF_MICROPLAN": + if (value && value !== "NA") { + return ( +
+

{t(value)}

+
+ ); + } else { + return ( +
+

{t("NA")}

+
+ ); + } + case "CAMPAIGN_TYPE": + if (value && value != "NA") { + return

{t(Digit.Utils.locale.getTransformedLocale("MICROPLAN_TYPE_" + value))}

; + } else { + return ( +
+

{t("NA")}

+
+ ); + } + case "LAST_MODIFIED_TIME": + return Digit.DateUtils.ConvertEpochToDate(value); + default: + return null; // Handle any unexpected keys here if needed + } + }, }, MyCampaignConfigOngoing: { preProcess: (data, additionalDetails) => { @@ -886,7 +941,7 @@ export const UICustomizations = { return value ? t("CM_UPDATE_REQUEST") : t("CM_CREATE_REQUEST"); case "CAMPAIGN_START_DATE": return Digit.DateUtils.ConvertEpochToDate(value); - case "CAMPAIGN_END_DATE": + case "LAST_MODIFIED_TIME": return Digit.DateUtils.ConvertEpochToDate(value); default: return "case_not_found"; @@ -993,7 +1048,8 @@ export const UICustomizations = { ); - + case "CM_DRAFT_TYPE": + return value ? t("CM_UPDATE_REQUEST") : t("CM_CREATE_REQUEST"); case "CAMPAIGN_START_DATE": return Digit.DateUtils.ConvertEpochToDate(value); case "CAMPAIGN_END_DATE": diff --git a/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/configs/myCampaignConfig.js b/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/configs/myCampaignConfig.js index 5c05471a267..0537d052036 100644 --- a/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/configs/myCampaignConfig.js +++ b/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/configs/myCampaignConfig.js @@ -524,11 +524,16 @@ export const myCampaignConfig = { additionalCustomization: true, // disableSortBy: true, }, + // { + // label: "CAMPAIGN_END_DATE", + // jsonPath: "endDate", + // additionalCustomization: true, + // // disableSortBy: true, + // }, { - label: "CAMPAIGN_END_DATE", - jsonPath: "endDate", - additionalCustomization: true, - // disableSortBy: true, + label:"LAST_MODIFIED_TIME", + jsonPath:"auditDetails.lastModifiedTime", + additionalCustomization:true }, ], enableGlobalSearch: false, @@ -637,6 +642,11 @@ export const myCampaignConfig = { jsonPath: "campaignName", // additionalCustomization: true, }, + { + label: "CM_DRAFT_TYPE", + jsonPath: "parentId", + additionalCustomization: true, + }, { label: "CAMPAIGN_TYPE", jsonPath: "projectType", diff --git a/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/configs/myMicroplanConfig.js b/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/configs/myMicroplanConfig.js new file mode 100644 index 00000000000..7163cb8e6a3 --- /dev/null +++ b/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/configs/myMicroplanConfig.js @@ -0,0 +1,104 @@ + + + const tenantId = Digit.ULBService.getCurrentTenantId(); + const mdms_context_path = window?.globalConfigs?.getConfig("MDMS_V2_CONTEXT_PATH") || "mdms-v2"; + export const MicroplanCampaignSearchConfig = [ + { + label: "MICROPLAN_SEARCH", + type: "search", + apiDetails: { + serviceName: "/plan-service/config/_search", + requestParam: { + }, + requestBody: { + "PlanConfigurationSearchCriteria": { + "limit": 10, + "offset": 0, + "tenantId": "mz", + "userUuid": "ff4ca65b-de7a-48de-ab9d-23c7728dc1aa" + }, + }, + masterName: "commonUiConfig", + moduleName: "MicroplanCampaignSearchConfig", + 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:{ + microplanName: "", + campaignType: "", + }, + fields: [ + { + label: "Name of the microplan", + isMandatory: false, + key: "microplanName", + type: "text", + populators: { + name: "microplanName" + }, + }, + { + label: "CAMPAIGN_SEARCH_TYPE", + type: "apidropdown", + isMandatory: false, + disable: false, + populators: { + optionsCustomStyle: { + top: "2.3rem", + }, + name: "campaignType", + optionsKey: "code", + allowMultiSelect: false, + masterName: "commonUiConfig", + moduleName: "MyCampaignConfigDrafts", + customfn: "populateCampaignTypeReqCriteria", + }, + }, + ], + }, + + show: true, + }, + searchResult: { + uiConfig: { + columns: [ + { + label: "NAME_OF_MICROPLAN", + jsonPath: "name", + additionalCustomization:true + }, + { + label:"CAMPAIGN_TYPE", + jsonPath:"campaignDetails.projectType", + additionalCustomization:true + }, + { + label:"LAST_MODIFIED_TIME", + jsonPath:"auditDetails.lastModifiedTime", + additionalCustomization:true + }, + ], + resultsJsonPath: "PlanConfiguration", + + enableColumnSort: true, + // resultsJsonPath: "mdms", + }, + show: true, + }, + // customHookName: "microplanv1.useSavedMicroplans", + + }, + customHookName:"microplanv1.useSavedMicroplans" + }, + ]; + + diff --git a/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/MyMicroplans.js b/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/MyMicroplans.js new file mode 100644 index 00000000000..926a321096f --- /dev/null +++ b/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/MyMicroplans.js @@ -0,0 +1,52 @@ +import { Header, InboxSearchComposer } from "@egovernments/digit-ui-react-components"; +import React, { useState, useEffect } from "react"; +import { useTranslation } from "react-i18next"; +import { useHistory } from "react-router-dom"; +import { MicroplanCampaignSearchConfig } from "../../configs/myMicroplanConfig"; + + + +const defaultSearchValues = { + +}; + +const MyMicroplans = () => { + const { t } = useTranslation(); + const [defaultValues, setDefaultValues] = useState(defaultSearchValues); // State to hold default values for search fields + const history = useHistory(); + useEffect(() => { + // Set default values when component mounts + setDefaultValues(defaultSearchValues); + }, []); + + const onTabChange = (n) => { + + setTabData((prev) => prev.map((i, c) => ({ ...i, active: c === n ? true : false }))); //setting tab enable which is being clicked + // setConfig(TabSearchconfig?.TabSearchconfig?.[n]);// as per tab number filtering the config + const url = new URL(window.location.href); + url.searchParams.set("tabId", `${n}`); + window.history.replaceState({}, "", url); + + }; + const onClickRow = ({ original: row }) => { + history.push(`/${window.contextPath}/employee/campaign/setup-campaign?id=${row.campaignId}&draft=true&fetchBoundary=true&draftBoundary=true&type=microplan`); + }; + return ( + + +
{t("MY_MICROPLANS_HEADING")}
+
+ {/* Pass defaultValues as props to InboxSearchComposer */} + +
+
+ ); +}; +export default MyMicroplans; \ No newline at end of file diff --git a/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/SetupCampaign.js b/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/SetupCampaign.js index 0478649267a..e7d3325d9d5 100644 --- a/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/SetupCampaign.js +++ b/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/SetupCampaign.js @@ -49,6 +49,7 @@ const SetupCampaign = ({ hierarchyType, hierarchyData }) => { const isDateRestricted = searchParams.get("date"); const isChangeDates = searchParams.get("changeDates"); const actionBar = searchParams.get("actionBar"); + const type = searchParams.get("type"); const [isDraftCreated, setIsDraftCreated] = useState(false); const [currentKey, setCurrentKey] = useState(() => { const keyParam = searchParams.get("key"); @@ -112,9 +113,12 @@ const SetupCampaign = ({ hierarchyType, hierarchyData }) => { setIsDraftCreated(true); if (isSkip === "false") { if (currentKey === 1) setCurrentKey(1); - } else if (isDateRestricted === "true") { - setCurrentKey(3); - } else { + } else if (type === "microplan") { + setCurrentKey(2); + }else if (isDateRestricted === "true") { + setCurrentKey(3); + } + else { if(draftData?.additionalDetails?.key === 7 || draftData?.additionalDetails?.key === 8){ setCurrentKey(6); } diff --git a/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/index.js b/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/index.js index 3659ba79432..b2aeeb02143 100644 --- a/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/index.js +++ b/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/index.js @@ -14,6 +14,7 @@ import ViewHierarchy from "./ViewHierarchy"; import ViewChecklist from "./ViewChecklist"; import UpdateChecklist from "./UpdateChecklist"; import BoundaryHome from "./BoundaryHome"; +import MyMicroplans from "./MyMicroplans"; /** * The CampaignBreadCrumb function generates breadcrumb navigation for a campaign setup page in a React * application. @@ -148,6 +149,7 @@ const App = ({ path, BOUNDARY_HIERARCHY_TYPE, hierarchyData }) => { } /> } /> } /> + } />