>
}
- {
+ {!dis &&
<>
>
}
- {!disableDelete && (
+ {!dis && !disableDelete && (
//
removeOption(index)}>
//
// {t(`CAMPAIGN_DELETE_ROW_TEXT`)}
diff --git a/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/configs/checklistCreateConfig.js b/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/configs/checklistCreateConfig.js
index 18e4dfd152a..1b37e8498f0 100644
--- a/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/configs/checklistCreateConfig.js
+++ b/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/configs/checklistCreateConfig.js
@@ -1,4 +1,4 @@
-export const checklistCreateConfig = (data, time) => [
+export const checklistCreateConfig = (data, time, typeOfCall) => [
{
head: "",
body: [
@@ -17,7 +17,8 @@ export const checklistCreateConfig = (data, time) => [
customProps: {
module: "Campaign",
data: data,
- time: time
+ time: time,
+ typeOfCall: typeOfCall
},
},
],
diff --git a/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/ViewChecklist.js b/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/ViewChecklist.js
new file mode 100644
index 00000000000..429ae2b221c
--- /dev/null
+++ b/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/ViewChecklist.js
@@ -0,0 +1,240 @@
+import React, { useEffect, useState, createContext, useContext } from "react";
+import { checklistCreateConfig } from "../../configs/checklistCreateConfig";
+import { useTranslation } from "react-i18next";
+import { ViewCardFieldPair, Toast, Card, TextBlock, Button, PopUp, CardText, TextInput, BreadCrumb, Loader, ActionBar } from "@egovernments/digit-ui-components";
+import { FormComposerV2 } from "@egovernments/digit-ui-react-components";
+import { useHistory, useLocation } from "react-router-dom";
+
+const ViewChecklist = () => {
+ const { t } = useTranslation();
+ const tenantId = Digit.ULBService.getCurrentTenantId();
+ const searchParams = new URLSearchParams(location.search);
+ const campaignName = searchParams.get("campaignName");
+ const role = searchParams.get("role");
+ const checklistType = searchParams.get("checklistType");
+ const [config, setConfig] = useState(null);
+ const [checklistTypeCode, setChecklistTypeCode] = useState(null);
+ const [roleCode, setRoleCode] = useState(null);
+ const [serviceCode, setServiceCode] = useState(null);
+ const [searching, setSearching] = useState(true);
+ const [viewData, setViewData] = useState(
+ // [
+ // {
+ // id: crypto.randomUUID(),
+ // parentId: null,
+ // level: 1,
+ // key: 1,
+ // title: null,
+ // type: { code: "SingleValueList" },
+ // value: null,
+ // isRequired: false
+ // }
+ // ]
+ null
+ );
+
+
+
+ const reqCriteriaResourceMDMS = {
+ url: `/mdms-v2/v2/_search`,
+ // url: `/${urlMd}/v2/_search`,
+ body: {
+ MdmsCriteria: {
+ tenantId: tenantId,
+ schemaCode: "HCMadminconsole.checklisttemplates"
+ // schemaCode: "HCM-ADMIN-CONSOLE.ChecklistTemplates"
+ }
+ },
+ config: {
+ enabled: true,
+ select: (data) => {
+ return data?.mdms?.[0]?.data?.data;
+ },
+ },
+ // changeQueryName:"checklsit template "
+ };
+ const { isLoading1, data: mdms, isFetching } = Digit.Hooks.useCustomAPIHook(reqCriteriaResourceMDMS);
+
+ const reqCriteria = {
+
+ url: `/localization/messages/v1/_search`,
+ body: {
+ tenantId: tenantId
+ },
+ params: {
+ locale: "en_MZ",
+ tenantId: tenantId,
+ module: "hcm-campaignmanager"
+ },
+ }
+ const { isLoading2, data: localization, isFetching2 } = Digit.Hooks.useCustomAPIHook(reqCriteria);
+
+ useEffect(() => {
+ if (localization?.messages?.length > 0) {
+ let matchedItem = localization.messages.find(item => item.message === checklistType);
+ console.log("matched item", matchedItem);
+ // If a match is found, assign the 'code' to 'checklistcode'
+ if (matchedItem) {
+ let code = matchedItem.code;
+ let res = code.replace("HCM_CHECKLIST_TYPE_", "");
+ setChecklistTypeCode(res);
+ setRoleCode(role.toUpperCase().replace(/ /g, "_"));
+ console.log("type", checklistTypeCode);
+ console.log("role", roleCode);
+ } else {
+ }
+ } else {
+ }
+
+ }, [localization])
+
+ useEffect(() => {
+ setServiceCode(`${campaignName}.${checklistTypeCode}.${roleCode}`);
+ }, [checklistTypeCode, roleCode]
+ )
+
+ useEffect(() => {
+ console.log("service code", serviceCode);
+
+ const callSearch = async () => {
+ const res = await Digit.CustomService.getResponse({
+ url: `/service-request/service/definition/v1/_search`,
+ body: {
+ ServiceDefinitionCriteria: {
+ "tenantId": tenantId,
+ "code": [serviceCode]
+ },
+ },
+ });
+ return res;
+ }
+ const fetchData = async () => {
+ try {
+ const res = await callSearch();
+ console.log("the res is", res);
+
+ if (res?.ServiceDefinitions?.[0]?.attributes) {
+ setSearching(false);
+ let temp_data = res?.ServiceDefinitions?.[0]?.attributes
+ let formatted_data = temp_data.map((item) => item.additionalDetails);
+ setViewData(formatted_data);
+ console.log("formatted data", formatted_data);
+
+ }
+ }
+ catch (error) {
+ }
+ }
+ fetchData();
+ }, [serviceCode])
+
+ useEffect(() => {
+ // setConfig(checklistCreateConfig(data=[{ id: crypto.randomUUID(), parentId: null, level: 1, key: 1, title: null, type: {"code": "SingleValueList"}, value: null, isRequired: false }], typeOfCall="view"));
+ // const initialData = [
+ // {
+ // id: crypto.randomUUID(),
+ // parentId: null,
+ // level: 1,
+ // key: 1,
+ // title: null,
+ // type: { code: "SingleValueList" },
+ // value: null,
+ // isRequired: false
+ // }
+ // ];
+ console.log("achieved data is", viewData);
+ const currentTime = new Date();
+ if (viewData !== null) {
+ setConfig(checklistCreateConfig(viewData, currentTime, "view"));
+ // setConfig(checklistCreateConfig({
+ // data: viewData,
+ // time: currentTime,
+ // typeOfCall: "view"
+ // }));
+ }
+
+ }, [viewData])
+
+
+
+
+
+ const fieldPairs = [
+ { label: "ROLE", value: role },
+ { label: "TYPE_OF_CHECKLIST", value: checklistType },
+ { label: "CAMPAIGN_NAME", value: campaignName },
+ { label: "CHECKLIST_NAME", value: `${checklistType} ${role}` }
+ ];
+ return (
+
+
+ {t("VIEW_CHECKLIST")}
+
+
+ {fieldPairs.map((pair, index) => (
+
+
+ {index !== fieldPairs.length - 1 &&
}
+
+ ))}
+
+ {!searching &&
}
+ {searching &&
}
+
,
+
+ )
+
+
+
+};
+
+export default ViewChecklist;
\ No newline at end of file
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 7375d961843..5b252805573 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
@@ -15,6 +15,7 @@ import Boundary from "./Boundary";
import GeoPode from "./GeoPode";
import ViewBoundary from "./ViewBoundary";
import ViewHierarchy from "./ViewHierarchy";
+import ViewChecklist from "./ViewChecklist";
/**
* The CampaignBreadCrumb function generates breadcrumb navigation for a campaign setup page in a React
* application.
@@ -127,7 +128,7 @@ const App = ({ path, BOUNDARY_HIERARCHY_TYPE, hierarchyData }) => {
} />
} />
} />
-
+ } />