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 1eacfa59e9f..1a662a87e2c 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
@@ -22,6 +22,8 @@ const CampaignCard = () => {
}
const { t } = useTranslation();
+ const userId = Digit.UserService.getUser().info.uuid;
+ const microplanStatus = "RESOURCE_ESTIMATIONS_APPROVED"
let links = [
@@ -36,9 +38,9 @@ const CampaignCard = () => {
roles: ROLES.CAMPAIGN_MANAGER,
// count: isLoading?"-":data
},
- { //@Bhavya put the new url and remove the comment
+ {
label: t("ACTION_TEST_SETUP_CAMPAIGN_FROM_MICROPLAN"),
- link: `/${window?.contextPath}/employee/campaign/setup-campaign`,
+ link: `/${window?.contextPath}/employee/campaign/setup-from-microplan&userId=${userId}&status=${microplanStatus}`,
roles: ROLES.CAMPAIGN_MANAGER
},
{
@@ -58,7 +60,7 @@ const CampaignCard = () => {
link: `/${window?.contextPath}/employee/campaign/boundary/home`,
roles: ROLES.BOUNDARY_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/CampaignName.js b/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CampaignName.js
index 04b4f7c02aa..bae52d9f60b 100644
--- a/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CampaignName.js
+++ b/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CampaignName.js
@@ -6,14 +6,24 @@ import { ErrorMessage, FieldV1 , Stepper , TextBlock ,Card } from "@egovernments
const CampaignName = ({ onSelect, formData, control, formState, ...props }) => {
const { t } = useTranslation();
- const [name, setName] = useState(props?.props?.sessionData?.HCM_CAMPAIGN_NAME?.campaignName || "");
+
const [executionCount, setExecutionCount] = useState(0);
const [startValidation, setStartValidation] = useState(null);
const [error, setError] = useState(null);
+ const searchParams = new URLSearchParams(location.search);
+ const microplanName = searchParams.get("microName");
+ const source = searchParams.get("source");
+ const [name, setName] = useState(props?.props?.sessionData?.HCM_CAMPAIGN_NAME?.campaignName || "");
useEffect(() => {
- setName(props?.props?.sessionData?.HCM_CAMPAIGN_NAME?.campaignName);
+ if(source === "microplan"){
+ const sessionName = props?.props?.sessionData?.HCM_CAMPAIGN_NAME?.campaignName.replace(/&/g, "and");
+ if(sessionName === microplanName){
+ setName("");
+ }
+ }
+ else setName(props?.props?.sessionData?.HCM_CAMPAIGN_NAME?.campaignName);
}, [props?.props?.sessionData?.HCM_CAMPAIGN_NAME]);
- const searchParams = new URLSearchParams(location.search);
+
const [currentStep , setCurrentStep] = useState(1);
const currentKey = searchParams.get("key");
const [key, setKey] = useState(() => {
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..ca8c7bf4184 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 source = searchParams.get("source");
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 && source!=="microplan") {
setShowPopUp(true);
return;
}
@@ -143,6 +144,8 @@ const CampaignSelection = ({ onSelect, formData, formState, ...props }) => {
setStartValidation(true);
handleChange(value);
}}
+ disabled = {source === "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..8e2118d7808 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
@@ -149,8 +149,8 @@ export const UICustomizations = {
history.push(`/${window.contextPath}/employee/campaign/checklist/create?campaignName=${campaignName}&role=${role_code}&checklistType=${cl_code}&projectType=${projectType}&campaignId=${campaignId}`)
}}
/>
- )
- }
+ );
+ }
default:
return value;
}
@@ -299,11 +299,63 @@ export const UICustomizations = {
}}
/>
>
- )
+ );
}
-
},
+ },
+ MicroplanCampaignSearchConfig: {
+ preProcess: (data, additionalDetails) => {
+ const url = window.location.pathname;
+ const queryString = url.includes("?") ? url.split("?")[1] : url.split("&").slice(1).join("&");
+ const searchParams = new URLSearchParams(queryString);
+ const userId = searchParams.get("userId");
+ const status = searchParams.get("status");
+ data.body.PlanConfigurationSearchCriteria.userUuid = userId;
+ data.body.PlanConfigurationSearchCriteria.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 (
+
+ );
+ } else {
+ return (
+
+ );
+ }
+ case "CAMPAIGN_TYPE":
+ if (value && value != "NA") {
+ return {t(Digit.Utils.locale.getTransformedLocale("CAMPAIGN_TYPE_" + value))}
;
+ } else {
+ return (
+
+ );
+ }
+ case "LAST_MODIFIED_TIME":
+ return Digit.DateUtils.ConvertEpochToDate(value);
+ default:
+ return null; // Handle any unexpected keys here if needed
+ }
+ },
},
MyCampaignConfigOngoing: {
preProcess: (data, additionalDetails) => {
@@ -397,7 +449,6 @@ export const UICustomizations = {
setTimeline(true);
break;
case "ACTION_LABEL_CONFIGURE_APP":
-
window.history.pushState(
{
name: row?.campaignName,
@@ -715,7 +766,6 @@ export const UICustomizations = {
setTimeline(true);
break;
-
case "ACTION_LABEL_UPDATE_BOUNDARY_DETAILS":
window.history.pushState(
{
@@ -735,7 +785,7 @@ export const UICustomizations = {
name: row?.campaignName,
data: row,
projectId: row?.projectId,
- campaignType: row?.projectType
+ campaignType: row?.projectType,
},
"",
`/${window.contextPath}/employee/campaign/checklist/search?name=${row?.campaignName}&campaignId=${row?.id}&projectType=${row?.projectType}`
@@ -886,7 +936,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";
@@ -977,8 +1027,8 @@ export const UICustomizations = {
setTimeline(true);
break;
case "ACTION_LABEL_RETRY":
- retryCampaign(row,searchResult);
- break;
+ retryCampaign(row, searchResult);
+ break;
default:
console.log(value);
break;
@@ -993,7 +1043,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":
@@ -1006,7 +1057,10 @@ export const UICustomizations = {
type="actionButton"
variation="secondary"
label={"Action"}
- options={[{ key: 1, code: "ACTION_LABEL_VIEW_TIMELINE", i18nKey: t("ACTION_LABEL_VIEW_TIMELINE") },{ key: 2, code: "ACTION_LABEL_RETRY", i18nKey: t("ACTION_LABEL_RETRY") }].filter(obj=>Digit.Utils.didEmployeeHasAtleastOneRole(["SYSTEM_ADMINISTRATOR"]||obj?.key!=2))} //added retry for system adminstrator for failed campaign
+ options={[
+ { key: 1, code: "ACTION_LABEL_VIEW_TIMELINE", i18nKey: t("ACTION_LABEL_VIEW_TIMELINE") },
+ { key: 2, code: "ACTION_LABEL_RETRY", i18nKey: t("ACTION_LABEL_RETRY") },
+ ].filter((obj) => Digit.Utils.didEmployeeHasAtleastOneRole(["SYSTEM_ADMINISTRATOR"] || obj?.key != 2))} //added retry for system adminstrator for failed campaign
optionsKey="i18nKey"
showBottom={true}
isSearchable={false}
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..19da3a0d45d
--- /dev/null
+++ b/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/configs/myMicroplanConfig.js
@@ -0,0 +1,100 @@
+
+
+ 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": tenantId,
+ },
+ },
+ 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_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:"additionalDetails.campaignType",
+ additionalCustomization:true
+ },
+ {
+ label:"LAST_MODIFIED_TIME",
+ jsonPath:"auditDetails.lastModifiedTime",
+ additionalCustomization:true
+ },
+ ],
+ resultsJsonPath: "PlanConfiguration",
+
+ enableColumnSort: true,
+ },
+ show: true,
+ },
+
+ },
+ },
+ ];
+
+
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..40740c1d2ce
--- /dev/null
+++ b/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/MyMicroplans.js
@@ -0,0 +1,45 @@
+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";
+
+// export const updateUrlParams=(params) =>{
+// const url = new URL(window.location.href);
+// Object.entries(params).forEach(([key, value]) => {
+// url.searchParams.set(key, value);
+// });
+// window.history.replaceState({}, "", url);
+// }
+
+const MyMicroplans = () => {
+ const { t } = useTranslation();
+ const history = useHistory();
+ // const userId = Digit.UserService.getUser().info.uuid;
+ // const microplanStatus = "RESOURCE_ESTIMATIONS_APPROVED"
+
+ // useEffect(() =>{
+ // updateUrlParams({ userId: userId, status: microplanStatus });
+ // },[])
+ const onClickRow = ({ original: row }) => {
+ const updatedName = row.name.replace(/&/g, "and");
+ history.push(`/${window.contextPath}/employee/campaign/setup-campaign?id=${row.campaignId}&draft=true&fetchBoundary=true&draftBoundary=true&source=microplanµName=${updatedName}`);
+ };
+ return (
+
+
+ {t("MY_MICROPLANS_HEADING")}
+
+
+
+
+ );
+};
+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..abbb969d45b 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,8 @@ const SetupCampaign = ({ hierarchyType, hierarchyData }) => {
const isDateRestricted = searchParams.get("date");
const isChangeDates = searchParams.get("changeDates");
const actionBar = searchParams.get("actionBar");
+ const source = searchParams.get("source");
+ const microplanName = searchParams.get("microName");
const [isDraftCreated, setIsDraftCreated] = useState(false);
const [currentKey, setCurrentKey] = useState(() => {
const keyParam = searchParams.get("key");
@@ -112,9 +114,14 @@ const SetupCampaign = ({ hierarchyType, hierarchyData }) => {
setIsDraftCreated(true);
if (isSkip === "false") {
if (currentKey === 1) setCurrentKey(1);
- } else if (isDateRestricted === "true") {
- setCurrentKey(3);
- } else {
+ //if user comes from set up microplan
+ } else if (source === "microplan") {
+ setCurrentKey(2);
+ //if the campaign is in draft and the start date is passed
+ }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..a3051b82ed0 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.
@@ -92,6 +93,8 @@ const CampaignBreadCrumb = ({ location, defaultPath }) => {
*/
const App = ({ path, BOUNDARY_HIERARCHY_TYPE, hierarchyData }) => {
const location = useLocation();
+ const userId = Digit.UserService.getUser().info.uuid;
+ const microplanStatus = "RESOURCE_ESTIMATIONS_APPROVED"
const UploadBoundaryData = Digit?.ComponentRegistryService?.getComponent("UploadBoundaryData");
const CycleConfiguration = Digit?.ComponentRegistryService?.getComponent("CycleConfiguration");
const DeliveryRule = Digit?.ComponentRegistryService?.getComponent("DeliveryRule");
@@ -148,6 +151,7 @@ const App = ({ path, BOUNDARY_HIERARCHY_TYPE, hierarchyData }) => {
} />
} />
} />
+ } />
diff --git a/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/setupCampaignValidators.js b/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/setupCampaignValidators.js
index a641082c84b..b1e60a3e1ef 100644
--- a/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/setupCampaignValidators.js
+++ b/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/setupCampaignValidators.js
@@ -191,8 +191,8 @@ export const handleValidate = ({formData,t,setShowToast,hierarchyDefinition,low
if (typeof formData?.campaignName !== "string" || !formData?.campaignName.trim()) {
setShowToast({ key: "error", label: "CAMPAIGN_NAME_MISSING_TYPE_ERROR" });
return false;
- } else if (formData.campaignName.length > 250) {
- setShowToast({ key: "error", label: "CAMPAIGN_NAME_TOO_LONG_ERROR" });
+ } else if (formData.campaignName.length > 30) {
+ setShowToast({ key: "error", label: "CAMPAIGN_NAME_LONG_ERROR" });
return false;
} else {
setShowToast(null);