From bcb3a799cf860ba614e82431320dd9a0e797359b Mon Sep 17 00:00:00 2001 From: Nipun Arora Date: Mon, 3 Feb 2025 11:16:03 +0530 Subject: [PATCH] RELEASE/HCMPRE-1923 : Microplanning 0.2 release (#2134) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * BUGFIX/HCMPRE-1634: fix for versions (#2024) * Revert "Bugfix/hcmpre 1583 (#2021)" This reverts commit 201a0ce612b46671ba4cc5bb74d886245d918615. * BUGFIX/HCMPRE-1634 Revert ing"updated core version (#2020)" * BUGFIX/HCMPRE-1583 fixes --------- Co-authored-by: Swathi-eGov * FEATURE/HCMPRE-1634:Fixed all the version updates (#2026) FEATURE/HCMPRE-1634: Fixed all the version updates * BUGFIX/HCMPRE-1505 : Updated Core Version To Fix Validation Issue on … (#2047) BUGFIX/HCMPRE-1505 : Updated Core Version To Fix Validation Issue on Profile Update * BUGFIX/HCMPRE-15830 : Fixed checkbox click area (#2064) Css changes * FEATURE/HCMPRE-1789 : Draft Flow (#2093) * changes to createUpdatePlan * Changes to UI, createUpdatePlan * Putting the Hierarchy near the name * Loc change * Resolved comments * Null check for Hierarchy level * Changes * Indirectly Mutating planObject * changes * changes --------- Co-authored-by: Abishek * FEATURE/HCMPRE-1787 : Untagging all the current users if boundary is (#2092) * FEATURE/HCMPRE-1787 : Untagging all the current users if boundary is changed during setup * FEATUTE/HCMPRE-1787 : Added different error cases * FEATURE/HCMPRE-1710: Accessibility dropdown for planInbox with plan integration and apply filter (#2091) * Adding filters * Working Filter Search * InboxFilter Changes * removing console.log * Css package update * changes * changes * changes * changes * changes * A lot of changes * changes * changes * changes * uniform payload structure * FEATURE/HCMPRE-1712: Facility Dropdown for plan Inbox (#2096) * Adding filters * Working Filter Search * InboxFilter Changes * removing console.log * Css package update * changes * changes * changes * changes * changes * A lot of changes * changes * changes * changes * uniform payload structure * Adding Facility Dropdown * code replacing name attribute * Loader changes * comments resolved * Loader change * Id to id * BUGFIX/HCMPRE-1810: Fix issue for next page in user tagging (#2104) * for clickng on save and next * remove console * FEATURE/HCMPRE-1706: Plan Inbox updates and draft flow changes (#2109) * updated plan inbox * Update createUpdatePlanProject.js * formatted createupdateplanproject * FEATURE/HCMPRE-1681: Handled the case where capacity is 0 and tested full flow (#2111) handled the case where capacity is 0 and tested full flow * FEATURE/HCMPRE-1713: PopInbox and filtering integration (#2108) * PopInbox and facilityId search in planInbox * Localization * Chages to CSS and removing filter * Changes to facility filter and security Question * css package update * facilityId removed * Resolved comments, made payload to facilityId * component package update * FEATURE/HCMPRE-1704 : Removing current validation from assumptions an… (#2122) * FEATURE/HCMPRE-1704 : Removing current validation from assumptions and making sure the flow works as expected( for mixed strat, regis and dist can be same) * FEATURE/HCMPRE-1704 : Review updates * BUGFIX/HCMPRE-1584: Disable planSearch for popInbox and CSS for dropdown (#2123) * BUGFIX/HCMPRE-1866 : Updated versions (#2128) * FEATURE/HCMPRE-0000 : Fix for serach query in user tagging screen (#2132) * BUGFIX/HCMPRE-1944: TotalCount UI issue in planIbox (#2138) * useEffect updated * CountAssignToAll issue in planInbox * BUGFIX/HCMPRE-2212 : Updated Facility Filter as a Multiselect dropdown * Fixed facility filter issue * FEATURE/HCMPRE-0000 : Fixed Css Issue (#2178) --------- Co-authored-by: Jagankumar <53823168+jagankumar-egov@users.noreply.github.com> Co-authored-by: Swathi-eGov Co-authored-by: Swathi-eGov <137176788+Swathi-eGov@users.noreply.github.com> Co-authored-by: abishekTa-egov --- .../example/public/index.html | 5 +- .../example/src/UICustomizations.js | 334 +++++++++--------- .../packages/css/package.json | 2 +- .../css/src/components/microplan.scss | 23 +- .../modules/campaign-manager/package.json | 2 + .../src/components/AssumptionsForm.js | 15 +- .../src/components/BoundarySelection.js | 16 +- .../src/components/InboxFilterWrapper.js | 211 +++++++++-- .../src/components/RoleTableComposer.js | 3 +- .../microplan/src/components/UserAccess.js | 1 + .../src/components/UserAccessWrapper.js | 1 + .../microplan/src/components/UserUpload.js | 2 +- .../src/configs/FacilityMappingConfig.js | 3 + .../microplan/src/configs/UICustomizations.js | 14 +- .../hooks/services/createUpdatePlanProject.js | 229 +++++++++--- .../employee/FacilityCatchmentMapping.js | 5 +- .../microplan/src/pages/employee/PlanInbox.js | 111 +++--- .../microplan/src/pages/employee/PopInbox.js | 63 ++-- .../modules/microplan/src/utils/utilities.js | 2 +- health/micro-ui/web/public/index.html | 4 +- 20 files changed, 715 insertions(+), 331 deletions(-) diff --git a/health/micro-ui/web/micro-ui-internals/example/public/index.html b/health/micro-ui/web/micro-ui-internals/example/public/index.html index 246f1b2c8be..df805462ead 100644 --- a/health/micro-ui/web/micro-ui-internals/example/public/index.html +++ b/health/micro-ui/web/micro-ui-internals/example/public/index.html @@ -11,9 +11,8 @@ DIGIT - - - + + 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 0b4fefe01ac..1b4bada361b 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 @@ -765,176 +765,177 @@ export const UICustomizations = { } }, }, - 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; - const campaignName = row?.name || ""; - if (!fileId) { - console.error("Population template file not found"); - return; - } - Digit.Utils.campaign.downloadExcelWithCustomName({ - fileStoreId: fileId, - customName: campaignName - }); - }; - - const onActionSelect = (e) => { - if (e.name == "MP_ACTIONS_EDIT_SETUP") { - window.location.href = `/${window.contextPath}/employee/microplan/setup-microplan?key=${1}µplanId=${row.id}&campaignId=${ - row.campaignDetails.id - }`; - } - 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`; + 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" }]; } - }; - - return ( -
- {microplanFileId && row?.status == "RESOURCE_ESTIMATIONS_APPROVED" ? ( -
- -
- ) : ( -
-
- onActionSelect(item)} - /> -
-
- )} -
- ); - - case "NAME_OF_MICROPLAN": - if (value && value !== "NA") { - return ( -
-

{t(value)}

-
- ); - } else { + + 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 (
-

{t("NA")}

-
- ); - } - - case "MICROPLAN_STATUS": - if (value && value != "NA") { - return

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

; - } else { - return ( -
-

{t("NA")}

-
- ); - } - - case "CAMPAIGN_DISEASE": - if (value && value != "NA") { - return

{t(Digit.Utils.locale.getTransformedLocale("MICROPLAN_DISEASE_" + 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 "DISTIRBUTION_STRATEGY": - if (value && value != "NA") { - return

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

; - } else { - return ( -
-

{t("NA")}

+ {microplanFileId && row?.status == "RESOURCE_ESTIMATIONS_APPROVED" ? ( +
+ +
+ ) : ( +
+
+ onActionSelect(item)} + /> +
+
+ )}
); - } - - default: - return null; // Handle any unexpected keys here if needed - } + + case "NAME_OF_MICROPLAN": + if (value && value !== "NA") { + return ( +
+

{t(value)}

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

{t("NA")}

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

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

; + } else { + return ( +
+

{t("NA")}

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

{t(Digit.Utils.locale.getTransformedLocale("MICROPLAN_DISEASE_" + 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 "DISTIRBUTION_STRATEGY": + if (value && value != "NA") { + return

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

; + } else { + return ( +
+

{t("NA")}

+
+ ); + } + + default: + return null; // Handle any unexpected keys here if needed + } + }, }, - }, MyMicroplanSearchConfig: { preProcess: (data, additionalDetails) => { const { name, status } = data?.state?.searchForm || {}; @@ -1299,6 +1300,11 @@ export const UICustomizations = { const VillageHierarchyTooltipWrapper = Digit.ComponentRegistryService.getComponent("VillageHierarchyTooltipWrapper"); switch (key) { + case `MICROPLAN_FACILITY_${column?.projectType}_CAPACITY`: + if (row?.additionalDetails?.capacity || row?.additionalDetails?.capacity === 0) { + return row?.additionalDetails?.capacity; + } + return t("NA"); case "MICROPLAN_FACILITY_SERVINGPOPULATION": return row?.additionalDetails?.servingPopulation; case "MICROPLAN_FACILITY_RESIDINGVILLAGE": diff --git a/health/micro-ui/web/micro-ui-internals/packages/css/package.json b/health/micro-ui/web/micro-ui-internals/packages/css/package.json index 5a7a3c5ef69..f79ffd9248d 100644 --- a/health/micro-ui/web/micro-ui-internals/packages/css/package.json +++ b/health/micro-ui/web/micro-ui-internals/packages/css/package.json @@ -1,6 +1,6 @@ { "name": "@egovernments/digit-ui-health-css", - "version": "0.2.6", + "version": "0.2.44", "license": "MIT", "main": "dist/index.css", "author": "Jagankumar ", diff --git a/health/micro-ui/web/micro-ui-internals/packages/css/src/components/microplan.scss b/health/micro-ui/web/micro-ui-internals/packages/css/src/components/microplan.scss index b330f694f65..ab65a5a2c98 100644 --- a/health/micro-ui/web/micro-ui-internals/packages/css/src/components/microplan.scss +++ b/health/micro-ui/web/micro-ui-internals/packages/css/src/components/microplan.scss @@ -260,6 +260,11 @@ gap: 1.5rem; } +.inbox-search-wrapper .inbox-search-component-wrapper .sections-parent.search .checkbox-wrap input, .checkbox-wrap .input-emp { + top:13px; + left:-3px; +} + .horizontal-nav { overflow: auto; display: -webkit-box; @@ -526,4 +531,20 @@ tbody tr:last-child td:last-child .digit-dropdown-employee-select-wrap .digit-dr } } } -} \ No newline at end of file +} + +.gap-between-dropdowns{ + display:flex; + flex-direction: column; + gap: 1rem; + +} + +.custom-filter-names { + font-family: Roboto; + font-style: normal; + font-weight: 400; + line-height: 1.37rem; + color: #363636; + font-size: 1.1rem; +} diff --git a/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/package.json b/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/package.json index 5c71e60363e..df94cdb7a5d 100644 --- a/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/package.json +++ b/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/package.json @@ -21,6 +21,8 @@ "@cyntler/react-doc-viewer": "1.10.3", "@egovernments/digit-ui-components": "0.0.2-beta.58", "@egovernments/digit-ui-react-components": "1.8.14", + "react-data-table-component": "7.6.2", + "styled-components": "5.0.0", "@rjsf/core": "5.10.0", "@rjsf/utils": "5.10.0", "@rjsf/validator-ajv8": "5.10.0", diff --git a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/AssumptionsForm.js b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/AssumptionsForm.js index bd0f15a95a9..237b5063ecd 100644 --- a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/AssumptionsForm.js +++ b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/AssumptionsForm.js @@ -67,13 +67,14 @@ const AssumptionsForm = ({ onSelect, ...props }) => { }, [selectedDistributionProcess, selectedRegistrationDistributionMode, selectedRegistrationProcess, resourceDistributionStrategyCode]) + + useEffect(()=>{ + setSelectedRegistrationDistributionMode(props?.props?.sessionData?.ASSUMPTIONS_FORM?.assumptionsForm?.selectedRegistrationDistributionMode); + setSelectedDistributionProcess(props?.props?.sessionData?.ASSUMPTIONS_FORM?.assumptionsForm?.selectedDistributionProcess); + setSelectedRegistrationProcess(props?.props?.sessionData?.ASSUMPTIONS_FORM?.assumptionsForm?.selectedRegistrationProcess); + },[props?.props?.sessionData?.ASSUMPTIONS_FORM?.assumptionsForm]) - - const filteredOptions = resourceDistributionStrategyCode === "MIXED" - ? optionsForProcesses.filter(option => option.resourceDistributionStrategyName !== "Fixed post & House-to-House") - : optionsForProcesses; - if (isLoadingPlanObject) { return } @@ -98,7 +99,7 @@ const AssumptionsForm = ({ onSelect, ...props }) => { variant="select-dropdown" t={t} isMandatory={true} - option={filteredOptions.map(item => ({ + option={optionsForProcesses.map(item => ({ code: item.resourceDistributionStrategyCode, value: item.resourceDistributionStrategyName, }))} @@ -124,7 +125,7 @@ const AssumptionsForm = ({ onSelect, ...props }) => { variant="select-dropdown" t={t} isMandatory={true} - option={filteredOptions.map(item => ({ + option={optionsForProcesses.map(item => ({ code: item.resourceDistributionStrategyCode, value: item.resourceDistributionStrategyName, }))} diff --git a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/BoundarySelection.js b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/BoundarySelection.js index 254b3335219..0131f18c15c 100644 --- a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/BoundarySelection.js +++ b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/BoundarySelection.js @@ -18,6 +18,7 @@ const BoundarySelection = ({ onSelect, props: customProps, ...props }) => { const [statusMap, setStatusMap] = useState({}); const [executionCount, setExecutionCount] = useState(0); const [updateBoundary, setUpdateBoundary] = useState(true); + const [isStatusMapLoading, setIsStatusMapLoading] = useState(false); const handleBoundaryChange = (value) => { setBoundaryOptions(value?.boundaryOptions); setSelectedData(value?.selectedData); @@ -58,10 +59,19 @@ const BoundarySelection = ({ onSelect, props: customProps, ...props }) => { useEffect(() => { + // Show loader before updating statusMap + setIsStatusMapLoading(true); if (selectedData && selectedData.length >= 0) { - setStatusMap(() => Digit.Utils.microplanv1.createStatusMap(selectedData, boundaryHierarchy)) + const newStatusMap = Digit.Utils.microplanv1.createStatusMap(selectedData, boundaryHierarchy); + setStatusMap(newStatusMap); + // Hide loader after updating statusMap + setIsStatusMapLoading(false); } - }, [selectedData, boundaryHierarchy]) + return () => { + // Cleanup function to prevent state updates if component unmounts during loading + setIsStatusMapLoading(false); + }; + }, [selectedData, boundaryHierarchy]); useEffect(() => { @@ -94,7 +104,7 @@ const BoundarySelection = ({ onSelect, props: customProps, ...props }) => { return ( <> - + {isStatusMapLoading ? : }
{t(`MICROPLAN_SELECT_BOUNDARY`)}

{t(`MICROPLAN_SELECT_BOUNDARIES_DESCRIPTION`)}

diff --git a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/InboxFilterWrapper.js b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/InboxFilterWrapper.js index 3a9135ec23b..8e9537cbcf6 100644 --- a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/InboxFilterWrapper.js +++ b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/InboxFilterWrapper.js @@ -1,28 +1,51 @@ -import React, { useState, useEffect } from "react"; +import React, { useState, useEffect, Fragment } from "react"; import { useTranslation } from "react-i18next"; -import { FilterCard, LabelFieldPair, RadioButtons } from "@egovernments/digit-ui-components"; +import { FilterCard, Dropdown, LabelFieldPair, RadioButtons, TextBlock, Loader,MultiSelectDropdown } from "@egovernments/digit-ui-components"; +import { useMyContext } from "../utils/context"; + + const InboxFilterWrapper = (props) => { + const { state } = useMyContext(); const { t } = useTranslation(); + const {microplanId,...rest} = Digit.Hooks.useQueryParams() + const tenantId = Digit.ULBService.getCurrentTenantId(); + const [filterValues, setFilterValues] = useState( + { status: null, onRoadCondition: null, terrain: null, securityQ1: null, securityQ2: null, facilityId:null } + ); // Default selected option - const defaultSelectedOption = props.defaultValue - ? { code: Object.keys(props.defaultValue)[0], name: `${t(Object.keys(props.defaultValue)[0])} (${Object.values(props.defaultValue)[0]})` } - : null; + let defaultSelectedOptions = props.defaultValue + ? Object.entries(props.defaultValue).reduce((acc, [key, value]) => { + if (key === "facilityId") { + acc[key] = value.map(item => ({ code: item?.code, id: item?.id, name: item?.name })); + } else if (value !== null) { + acc[key] = { code: value, name: `${t(key)} (${value})` }; + } else { + acc[key] = null; + } + return acc; + }, {}) + : null; - // Initialize state with the default selected option - const [selectedValue, setSelectedValue] = useState(defaultSelectedOption); - // Only update selectedValue when defaultValue from props changes, but not when it's null or undefined + // Initialize state with the default selected option useEffect(() => { if (props.defaultValue && Object.keys(props.defaultValue).length > 0) { - const newDefault = { - code: Object.keys(props.defaultValue)[0], - name: `${t(Object.keys(props.defaultValue)[0])} (${Object.values(props.defaultValue)[0]})`, - }; - setSelectedValue(newDefault); + const newDefault = Object.entries(props.defaultValue)?.reduce((acc, [key, value]) => { + acc[key] = value !== null + ? key === 'facilityId' + ? value.map(item => ({ code: item?.code, id: item?.id, name: item?.name })) + : { code: value, name: `${t(key)} (${value})` } + : null; + return acc; + }, {}); + setFilterValues(newDefault); } }, [props.defaultValue, t]); + + + const createArrayFromObject = (obj, t) => { if (!obj || typeof obj !== "object" || Object.keys(obj).length === 0 || typeof t !== "function") { @@ -33,6 +56,7 @@ const InboxFilterWrapper = (props) => { name: `${t(key)} (${value})`, })); }; + // Generate options from props.options const resultArray = createArrayFromObject(props?.options, t); @@ -45,21 +69,91 @@ const InboxFilterWrapper = (props) => { // Apply filters when the user presses the primary action button const handleApplyFilters = () => { if (props.onApplyFilters) { - props.onApplyFilters(selectedValue); // Call the parent function with selected value + const filtersToApply = {}; + for (let key in filterValues) { + if(filterValues[key] && typeof filterValues[key] === 'object' && String(key)==='facilityId' && filterValues[key].hasOwnProperty('code') ){ + filtersToApply[key] = filterValues[key] + } + else if (filterValues[key] && typeof filterValues[key] === 'object' && filterValues[key].hasOwnProperty('code')) { + filtersToApply[key] = filterValues[key].code; // Extract 'name' if it exists + } else { + filtersToApply[key] = filterValues[key]; // Keep the value as is (including null) + } + } + props.onApplyFilters(filtersToApply); // Pass the new array to onApplyFilters } }; // Clear filters when the user presses the secondary action button const clearFilters = () => { - setSelectedValue(selectedValue); // Clear the selection + // setSelectedValue(selectedValue); // Clear the selection + setFilterValues({ status: null, onRoadCondition: null, terrain: null, securityQ1: null, securityQ2: null }); + defaultSelectedOptions = {}; if (props.clearFilters) { props.clearFilters(); } }; + const handleDropdownChange = (key, value) => { + setFilterValues((prev) => ({ + ...prev, + [key]: value + })); + }; + + const handleMultiSelectDropdownChange = (key, value) => { + const transformedValue = Array.isArray(value) + ? value.map((item) => ({ + code: item?.[1]?.code, + id: item?.[1]?.id, + name: item?.[1]?.name + })) + : []; + setFilterValues((prev) => ({ + ...prev, + [key]: transformedValue, + })); + }; + + + const planFacilitySearchConfig = { + url: "/plan-service/plan/facility/_search", + body: { + PlanFacilitySearchCriteria: { + tenantId: tenantId, + planConfigurationId: microplanId, + } + }, + config: { + enabled: props?.isPlanInbox ? props?.isPlanInbox: false, + select: (data) => { + if (!data?.PlanFacility || !Array.isArray(data.PlanFacility)) return []; + + // Extract facilityName and facilityId for each object + const facilityOptions = data.PlanFacility.map((facility) => ({ + name: facility.facilityName, + code: facility.facilityId, + id: facility.facilityId + })); + + return facilityOptions; + }, + cacheTime:Infinity + } + }; + + const { isLoading: isPlanFacilityLoading, error: planFacilityError, data: planFacility } = Digit.Hooks.useCustomAPIHook(planFacilitySearchConfig); + + + + if(isPlanFacilityLoading){ + return + } + return ( + { secondaryActionLabel={resultArray.length > 0 && t(props?.secondaryActionLabel)} title={t(props?.title)} > -
+
{/* Only render LabelFieldPair if resultArray has items */} {resultArray.length > 0 && ( - + handleDropdownChange("status", value)} // Function to handle selection /> )} + {props.isPlanInbox && + + +
{t("MP_VILLAGE_ROAD_CONDITION")}
+ handleDropdownChange("onRoadCondition", value)} + t={t} + disabled={false} + showToolTip={true} + /> +
+ + +
{t("MP_VILLAGE_TERRAIN")}
+ handleDropdownChange("terrain", value)} + t={t} + disabled={false} + showToolTip={true} + /> +
+ + +
{t("MP_FILTER_FACILITY")}
+
+ handleMultiSelectDropdownChange("facilityId", value)} + t={t} + /> +
+
+ + + {state.securityQuestions.map((item, index) => { + // Transform item.values into an array of objects + const options = item.values.map((value) => ({ + code: value, + name: value, + active: true, + })); + + const isLastElement = index === state.securityQuestions.length - 1; + const questionNumber = parseInt(item.id, 10); + + return ( + +
{t(`MP_SECURITY_QUESTION ${index + 1}`)}
+ handleDropdownChange(`securityQ${questionNumber}`, value)} + t={t} + disabled={false} + showToolTip={true} + /> +
+ ); + })} +
+ } + +
); @@ -97,4 +266,4 @@ InboxFilterWrapper.defaultProps = { optionsKey: "name", }; -export default InboxFilterWrapper; +export default InboxFilterWrapper; \ No newline at end of file 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 b44f3bf4559..b7b652fe18b 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,7 +78,8 @@ 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 3b47f709450..7d3f1f84ed8 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); + setSearchQuery(""); },[category]) return ( diff --git a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/UserAccessWrapper.js b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/UserAccessWrapper.js index ce3863d2c2a..c708c0e62f5 100644 --- a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/UserAccessWrapper.js +++ b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/UserAccessWrapper.js @@ -142,6 +142,7 @@ const UserAccessWrapper = ({ onSelect, props: customProps, setupCompleted }) => updateUrlParams({ internalKey }); }, [internalKey]); + return ( diff --git a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/UserUpload.js b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/UserUpload.js index f203ad1ec44..fe37365460a 100644 --- a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/UserUpload.js +++ b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/UserUpload.js @@ -410,7 +410,7 @@ const UserUpload = React.memo(() => { history.push(`/${window.contextPath}/employee/microplan/upload-user-success`, { fileName: fileName, message: "USER_DATA_UPLOAD_SUCCESSFUL", - description: "The user data uploaded will be available in your microplan user assignment", + description: "MP_USER_DATA_UPLOADED_WILL_BE_AVAILABLE", back: "GO_BACK_TO_USER_MANAGEMENT", backlink: `/${window.contextPath}/employee/microplan/user-management`, }); diff --git a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/configs/FacilityMappingConfig.js b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/configs/FacilityMappingConfig.js index faba63dbdcd..362cc78b9eb 100644 --- a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/configs/FacilityMappingConfig.js +++ b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/configs/FacilityMappingConfig.js @@ -1,5 +1,6 @@ import { useMyContext } from "../utils/context"; +//ProjectType will be ["LLIN-mz","MR-DN"] for microplan const facilityMappingConfig = (projectType, disabledAction) => { const { state, dispatch } = useMyContext(); @@ -124,6 +125,8 @@ const facilityMappingConfig = (projectType, disabledAction) => { { label: `MICROPLAN_FACILITY_${projectType}_CAPACITY`, jsonPath: "additionalDetails.capacity", + additionalCustomization: true, + projectType: projectType, }, { label: "MICROPLAN_FACILITY_ASSIGNED_VILLAGES", 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 45b1f7d43c8..f8fe90573c3 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 @@ -107,10 +107,11 @@ export const UICustomizations = { }; const onActionSelect = (e) => { - if (e.name == "MP_ACTIONS_EDIT_SETUP") { - window.location.href = `/${window.contextPath}/employee/microplan/setup-microplan?key=${1}µplanId=${row.id}&campaignId=${ - row.campaignDetails.id - }`; + 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=${ @@ -581,6 +582,11 @@ export const UICustomizations = { const VillageHierarchyTooltipWrapper = Digit.ComponentRegistryService.getComponent("VillageHierarchyTooltipWrapper"); switch (key) { + case `MICROPLAN_FACILITY_${column?.projectType}_CAPACITY`: + if (row?.additionalDetails?.capacity || row?.additionalDetails?.capacity === 0) { + return row?.additionalDetails?.capacity; + } + return t("NA"); case "MICROPLAN_FACILITY_SERVINGPOPULATION": return row?.additionalDetails?.servingPopulation; case "MICROPLAN_FACILITY_RESIDINGVILLAGE": 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 a1cd80eee63..f9a174c004d 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 @@ -51,13 +51,9 @@ const isValidResourceName = async (name) => { function updateFormulasSource(formulasToUpdate, assumptions) { // Extract keys of assumptions with source "CUSTOM" - let customKeys = assumptions - .filter((assumption) => assumption.source === "CUSTOM") - .map((assumption) => assumption.key); + let customKeys = assumptions.filter((assumption) => assumption.source === "CUSTOM").map((assumption) => assumption.key); - const customKeysFromFormula = formulasToUpdate - ?.filter((formula) => formula.source === "CUSTOM") - ?.map((formula) => formula.output); + const customKeysFromFormula = formulasToUpdate?.filter((formula) => formula.source === "CUSTOM")?.map((formula) => formula.output); customKeys = [...customKeys, ...customKeysFromFormula]; // Update the source of formulas based on the conditions @@ -66,8 +62,8 @@ function updateFormulasSource(formulasToUpdate, assumptions) { formula.source === "MDMS" && // Check if the formula's source is "MDMS" (customKeys.includes(formula.input) || customKeys.includes(formula.assumptionValue)) // Check if input or assumptionValue belongs to "CUSTOM" ) { - // Dynamically add this formula's output to customKeys - customKeys.push(formula.output) + // Dynamically add this formula's output to customKeys + customKeys.push(formula.output); return { ...formula, source: "CUSTOM" }; // Update the source to "CUSTOM" } return formula; // Return unchanged formula otherwise @@ -181,7 +177,6 @@ const UpdateResource = async (req, currentPlanObject, currentCampaignObject) => //creating a microplan and campaign instance here const { totalFormData, state, setShowToast, setCurrentKey, setCurrentStep, config, campaignObject, planObject } = req; try { - // Update the campaign object by keeping existing properties and only changing the name const updatedCampaignObject = { ...currentCampaignObject, @@ -199,6 +194,7 @@ const UpdateResource = async (req, currentPlanObject, currentCampaignObject) => const updatedPlanObject = { ...currentPlanObject, name: totalFormData?.MICROPLAN_DETAILS?.microplanDetails?.microplanName, + additionalDetails: { ...currentPlanObject.additionalDetails, key: req?.config?.key || "2" }, }; const planRes = await Digit.CustomService.getResponse({ @@ -207,7 +203,7 @@ const UpdateResource = async (req, currentPlanObject, currentCampaignObject) => method: "POST", userService: true, body: { - PlanConfiguration: updatedPlanObject + PlanConfiguration: updatedPlanObject, }, }); @@ -236,6 +232,17 @@ const searchPlanConfig = async (body) => { return response?.PlanConfiguration?.[0]; }; +const searchPlanEmployeeConfig = async (body) => { + const response = await Digit.CustomService.getResponse({ + url: "/plan-service/employee/_search", + useCache: false, + method: "POST", + userService: false, + body, + }); + return response; +}; + const searchCampaignConfig = async (body) => { const response = await Digit.CustomService.getResponse({ url: "/project-factory/v1/project-type/search", @@ -269,12 +276,63 @@ const updatePlan = async (req) => { return planRes; }; +const updatePlanEmployee = async (req) => { + const planEmployeeRes = await Digit.CustomService.getResponse({ + url: "/plan-service/employee/_update", + body: req, + }); + return planEmployeeRes; +}; + +/** + * Documentation for the createUpdatePlanProject function + * + * This function handles creation and updates of plan and project based on different triggers(Triggers are screens' next button). + * + * Flow: + * 1. Function takes a request object containing: + * - totalFormData: Form data from different screens + * - state: Application state + * - setShowToast: Toast notification setter + * - setCurrentKey: Current key setter + * - setCurrentStep: Current step setter + * - config: Configuration object + * - invalidateConfig: Config for data invalidation + * + * 2. Gets microplanId, campaignId and key from URL query params + * + * 3. Gets current tenant ID + * + * 4. If microplanId exists: + * - Fetches existing plan configuration using searchPlanConfig + * + * 5. If campaignId exists: + * - Fetches campaign details using searchCampaignConfig + * + * 6. Based on triggeredFrom config name: + * - CAMPAIGN_DETAILS: Increments key and step + * - MICROPLAN_DETAILS: Checks if update needed based on name change + * - HYPOTHESIS: Handles assumptions updates + * - SUB_HYPOTHESIS: Updates sub-hypothesis assumptions + * - FORMULA_CONFIGURATION: Validates and updates formula configurations + * + * 7. Returns appropriate response based on the trigger + * + * Key APIs Used: + * - searchPlanConfig: Fetches plan configuration + * - searchCampaignConfig: Fetches campaign details + * - updatePlan: Updates plan configuration + * - updateProject: Updates project details + * - updatePlanEmployee: Updates plan employee details + */ + const createUpdatePlanProject = async (req) => { try { //later this object must have an invalidation config which can be used to invalidate data such as files uploaded,assumptions,formulas etc... const { totalFormData, state, setShowToast, setCurrentKey, setCurrentStep, config, invalidateConfig } = req; - const { microplanId, campaignId } = Digit.Hooks.useQueryParams(); + const { microplanId, campaignId, key } = Digit.Hooks.useQueryParams(); + // const key=config?.key; const tenantId = Digit.ULBService.getCurrentTenantId(); //now basically we need to decide from which screen this hook was triggered and take action accordingly let planObject = {}; @@ -306,7 +364,6 @@ const createUpdatePlanProject = async (req) => { }; 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); @@ -316,7 +373,6 @@ const createUpdatePlanProject = async (req) => { /// now check if microplan and campaign id is there but name need to be updated if (microplanId && campaignId && planObject?.name !== totalFormData?.MICROPLAN_DETAILS?.microplanDetails?.microplanName) { - // check if the name is valid const isResourceNameValid = await isValidResourceName(totalFormData?.MICROPLAN_DETAILS?.microplanDetails?.microplanName); if (!isResourceNameValid) { @@ -335,10 +391,9 @@ const createUpdatePlanProject = async (req) => { return { triggeredFrom, }; - - }else{ - //if we reach here then we need to create a plan and project instance - // validate campaign and microplan name feasible or not -> search campaign + search plan + } else { + //if we reach here then we need to create a plan and project instance + // validate campaign and microplan name feasible or not -> search campaign + search plan const isResourceNameValid = await isValidResourceName(totalFormData?.MICROPLAN_DETAILS?.microplanDetails?.microplanName); if (!isResourceNameValid) { setShowToast({ key: "error", label: "ERROR_MICROPLAN_NAME_ALREADY_EXISTS" }); @@ -357,7 +412,6 @@ const createUpdatePlanProject = async (req) => { triggeredFrom, }; } - case "BOUNDARY": // call an update to plan @@ -399,6 +453,7 @@ const createUpdatePlanProject = async (req) => { //invalidate files const updatedPlanObjectForBoundaryInvalidate = { ...fetchedPlanForBoundaryInvalidate, + additionalDetails: { ...fetchedPlanForBoundaryInvalidate.additionalDetails, key: key }, files: fetchedPlanForBoundaryInvalidate?.files?.length > 0 ? fetchedPlanForBoundaryInvalidate?.files?.map((file) => { @@ -409,17 +464,65 @@ const createUpdatePlanProject = async (req) => { }) : [], }; - + + const fetchedPlanEmployeeForBoundaryInvalidate = await searchPlanEmployeeConfig({ + PlanEmployeeAssignmentSearchCriteria: { + tenantId: tenantId, + planConfigurationId: microplanId, + active: true, + }, + }); + + const updatedPlanEmployeeObjectForBoundaryInvalidate = { + ...fetchedPlanEmployeeForBoundaryInvalidate, + PlanEmployeeAssignment: + fetchedPlanEmployeeForBoundaryInvalidate?.PlanEmployeeAssignment?.length > 0 + ? fetchedPlanEmployeeForBoundaryInvalidate.PlanEmployeeAssignment.map((employee) => ({ + ...employee, + active: false, + })) + : [], + }; + // update plan object const planUpdateForBoundaryInvalidation = await updatePlan(updatedPlanObjectForBoundaryInvalidate); - if (planUpdateForBoundaryInvalidation) { + // Call updatePlanEmployee for each item + const planEmployeeAssignments = updatedPlanEmployeeObjectForBoundaryInvalidate.PlanEmployeeAssignment; + let allEmployeesUpdated = true; // Flag to track employee update status + + if (planEmployeeAssignments.length > 0) { + try { + // Use Promise.all to update all employees concurrently + await Promise.all( + planEmployeeAssignments.map(async (employee) => { + const employeeUpdateObject = { + ...fetchedPlanEmployeeForBoundaryInvalidate, + PlanEmployeeAssignment: employee, // Only update this specific employee + }; + try { + const planEmployeeUpdateResponse = await updatePlanEmployee(employeeUpdateObject); + } catch (error) { + allEmployeesUpdated = false; // Mark as false if any employee update fails + } + }) + ); + } catch (error) { + allEmployeesUpdated = false; + } + } + + if (planUpdateForBoundaryInvalidation && allEmployeesUpdated) { // doing this after invalidating the session // setCurrentKey((prev) => prev + 1); - // setCurrentStep((prev) => prev + 1); + // setCurrentStep((prev) => prev + 1); return { triggeredFrom, - invalidateSession:true + invalidateSession: true, }; + } else if (!planUpdateForBoundaryInvalidation) { + setShowToast({ key: "error", label: "ERR_PLAN_UPDATE_FAILED" }); + } else if (!allEmployeesUpdated) { + setShowToast({ key: "error", label: "ERR_EMPLOYEE_UPDATE_FAILED" }); } else { setShowToast({ key: "error", label: "ERR_BOUNDARY_UPDATE" }); } @@ -427,8 +530,11 @@ const createUpdatePlanProject = async (req) => { 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) - - if (_.isEqual(planObject?.additionalDetails?.assumptionsForm, totalFormData?.ASSUMPTIONS_FORM?.assumptionsForm) && Object.keys(planObject?.additionalDetails?.assumptionsForm).length>0) { + + if ( + _.isEqual(planObject?.additionalDetails?.assumptionsForm, totalFormData?.ASSUMPTIONS_FORM?.assumptionsForm) && + Object.keys(planObject?.additionalDetails?.assumptionsForm).length > 0 + ) { setCurrentKey((prev) => prev + 1); setCurrentStep((prev) => prev + 1); return { @@ -478,6 +584,7 @@ const createUpdatePlanProject = async (req) => { totalFormData.CAMPAIGN_DETAILS.campaignDetails.distributionStrat.resourceDistributionStrategyCode === "MIXED" ? "SEPARATELY" : totalFormData.ASSUMPTIONS_FORM.assumptionsForm.selectedRegistrationDistributionMode?.code, + key: key, }, }; const planResAssumptionsForm = await updatePlan(updatedPlanObjAssumptionsForm); @@ -486,7 +593,7 @@ const createUpdatePlanProject = async (req) => { // setCurrentStep((prev) => prev + 1); return { triggeredFrom, - invalidateSession:true + invalidateSession: true, }; } else { setShowToast({ key: "error", label: "ERR_ASSUMPTIONS_FORM_UPDATE" }); @@ -514,6 +621,7 @@ const createUpdatePlanProject = async (req) => { const upatedPlanObjHypothesis = { ...fetchedPlanForHypothesis, assumptions: [...prevAssumptions, ...assumptionsToUpdate], + additionalDetails: { ...fetchedPlanForHypothesis.additionalDetails, key: key }, }; const planResHypothesis = await updatePlan(upatedPlanObjHypothesis); @@ -555,6 +663,7 @@ const createUpdatePlanProject = async (req) => { const upatedPlanObjSubHypothesis = { ...fetchedPlanForSubHypothesis, assumptions: [...prevAssumptionsForSubHypothesis, ...assumptionsToUpdateFromUI], + additionalDetails: { ...fetchedPlanForSubHypothesis.additionalDetails, key: key }, }; await updatePlan(upatedPlanObjSubHypothesis); @@ -596,10 +705,11 @@ const createUpdatePlanProject = async (req) => { updatedRow.operator = state?.RuleConfigureOperators?.find((operation) => operation.operatorName === operatorName)?.operatorCode; return updatedRow; }); - const formulasToUpdateWithUpdatedSource = updateFormulasSource(formulasToUpdate,fetchedPlanForFormula?.assumptions) - //here we need to update the source of operations + const formulasToUpdateWithUpdatedSource = updateFormulasSource(formulasToUpdate, fetchedPlanForFormula?.assumptions); + //here we need to update the source of operations const updatedPlanObjFormula = { ...fetchedPlanForFormula, + additionalDetails: { ...fetchedPlanForFormula.additionalDetails, key: key }, operations: [...prevFormulas, ...formulasToUpdateWithUpdatedSource], }; @@ -617,7 +727,7 @@ const createUpdatePlanProject = async (req) => { setShowToast({ key: "error", label: "ERR_ASSUMPTIONS_FORM_UPDATE" }); } - case "SUB_FORMULA": + case "SUB_FORMULA": //first fetch current plan object const fetchedPlanForSubFormula = await searchPlanConfig({ PlanConfigurationSearchCriteria: { @@ -625,7 +735,7 @@ const createUpdatePlanProject = async (req) => { id: microplanId, }, }); - // const currentCategory = + // const currentCategory = const prevFormulaValues = fetchedPlanForSubFormula?.operations.length > 0 ? fetchedPlanForSubFormula?.operations?.map((row) => { @@ -638,26 +748,26 @@ const createUpdatePlanProject = async (req) => { : []; //get the list of assumptions from UI - const formulasToUpdateFromUIForSubFormula = req?.formulasToUpdate?.filter((row) => { - return row.category && row.output && row.input && row.operatorName && row.assumptionValue; - }) - ?.map((row) => { - const updatedRow = { ...row }; - const operatorName = row?.operatorName; - delete updatedRow?.operatorName; - updatedRow.operator = state?.RuleConfigureOperators?.find((operation) => operation.operatorName === operatorName)?.operatorCode; - return updatedRow; - }); + const formulasToUpdateFromUIForSubFormula = req?.formulasToUpdate + ?.filter((row) => { + return row.category && row.output && row.input && row.operatorName && row.assumptionValue; + }) + ?.map((row) => { + const updatedRow = { ...row }; + const operatorName = row?.operatorName; + delete updatedRow?.operatorName; + updatedRow.operator = state?.RuleConfigureOperators?.find((operation) => operation.operatorName === operatorName)?.operatorCode; + return updatedRow; + }); //mix the current + api res const upatedPlanObjSubFormula = { ...fetchedPlanForSubFormula, operations: [...prevFormulaValues, ...formulasToUpdateFromUIForSubFormula], + additionalDetails: { ...fetchedPlanForSubFormula.additionalDetails, key: key }, }; - await updatePlan(upatedPlanObjSubFormula); return; - case "UPLOADBOUNDARYDATA": const fetchedPlanForBoundary = await searchPlanConfig({ PlanConfigurationSearchCriteria: { @@ -684,6 +794,7 @@ const createUpdatePlanProject = async (req) => { const updatedPlanObjForBoundary = { ...fetchedPlanForBoundary, files, + additionalDetails: { ...fetchedPlanForBoundary.additionalDetails, key: key }, }; const planResBoundary = await updatePlan(updatedPlanObjForBoundary); @@ -726,6 +837,7 @@ const createUpdatePlanProject = async (req) => { const updatedPlanObjForFacility = { ...fetchedPlanForFacility, files: filesForFacility, + additionalDetails: { ...fetchedPlanForFacility.additionalDetails, key: key }, }; const planResFacility = await updatePlan(updatedPlanObjForFacility); @@ -803,16 +915,33 @@ const createUpdatePlanProject = async (req) => { setShowToast({ key: "error", label: "ERR_FAILED_TO_COMPLETE_SETUP" }); } - case "ROLE_ACCESS_CONFIGURATION": - //run any api validations if any/ - setCurrentKey((prev) => prev + 1); - setCurrentStep((prev) => prev + 1); - window.dispatchEvent(new Event("isLastStep")); - Digit.Utils.microplanv1.updateUrlParams({ isLastVerticalStep: null }); - Digit.Utils.microplanv1.updateUrlParams({ internalKey: null }); - return { - triggeredFrom, + case "ROLE_ACCESS_CONFIGURATION": { + const fetchedPlan = await searchPlanConfig({ + PlanConfigurationSearchCriteria: { + tenantId, + id: microplanId, + }, + }); + const updatedPlanObject = { + ...fetchedPlan, + additionalDetails: { ...fetchedPlan.additionalDetails, key: key }, }; + const response = await updatePlan(updatedPlanObject); + // Return as expected + if (response) { + setCurrentKey((prev) => prev + 1); + setCurrentStep((prev) => prev + 1); + window.dispatchEvent(new Event("isLastStep")); + Digit.Utils.microplanv1.updateUrlParams({ isLastVerticalStep: null }); + Digit.Utils.microplanv1.updateUrlParams({ internalKey: null }); + return { + triggeredFrom, + }; + } else { + setShowToast({ key: "error", label: "ERR_FAILED_TO_UPDATE_PLAN" }); + } + } + default: setShowToast({ key: "error", label: "ERROR_UNHANDLED_NEXT_OPERATION" }); return { diff --git a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/FacilityCatchmentMapping.js b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/FacilityCatchmentMapping.js index 62e3a7e9f74..15da661044f 100644 --- a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/FacilityCatchmentMapping.js +++ b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/FacilityCatchmentMapping.js @@ -45,7 +45,6 @@ const FacilityCatchmentMapping = () => { }, }); - const { isLoading: isLoadingCampaignObject, data: campaignObject, @@ -192,8 +191,8 @@ const FacilityCatchmentMapping = () => { {`${t("HCM_MICROPLAN_MICROPLAN_NAME_LABEL")}: ${planObject?.name || t("NO_NAME_AVAILABLE")}`}
- {`${t("LOGGED_IN_AS")} ${userName} - ${t(userRole)}`} - + {`${t("LOGGED_IN_AS")} ${userName} - ${t(userRole)}${planEmployee?.planData?.[0]?.hierarchyLevel ? + ` (${t(planEmployee.planData[0].hierarchyLevel.toUpperCase())})` : ""}`}
diff --git a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/PlanInbox.js b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/PlanInbox.js index 8b657392351..045b17679f8 100644 --- a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/PlanInbox.js +++ b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/PlanInbox.js @@ -33,7 +33,7 @@ const PlanInbox = () => { const [hierarchyLevel, setHierarchyLevel] = useState(""); const [censusData, setCensusData] = useState([]); const [boundaries, setBoundaries] = useState([]); - const [selectedFilter, setSelectedFilter] = useState(null); + const [selectedFilter, setSelectedFilter] = useState({status:"PENDING_FOR_VALIDATION",onRoadCondition:null,terrain:null,securityQ1:null,securityQ2:null,facilityId:[]}); const [activeFilter, setActiveFilter] = useState({}); const [actionBarPopUp, setactionBarPopUp] = useState(false); const [selectedRows, setSelectedRows] = useState([]); @@ -120,7 +120,7 @@ const PlanInbox = () => { }; useEffect(() => { - if (selectedFilter === "VALIDATED") { + if (selectedFilter?.status === "VALIDATED") { setActiveLink({ code: "", name: "" }); setShowTab(false); } else { @@ -132,7 +132,7 @@ const PlanInbox = () => { setShowTab(true); } } - }, [selectedFilter]); + }, [selectedFilter?.status]); const selectProps = { hideLabel: true, @@ -171,7 +171,14 @@ const PlanInbox = () => { tenantId: tenantId, active: true, jurisdiction: censusJurisdiction, - status: selectedFilter !== null && selectedFilter !== undefined ? selectedFilter : "", + status: selectedFilter?.status !== null && selectedFilter?.status !== undefined ? selectedFilter?.status : null, + ...(selectedFilter?.onRoadCondition != null && { onRoadCondition: selectedFilter.onRoadCondition }), + ...(selectedFilter?.terrain != null && { terrain: selectedFilter.terrain }), + ...(selectedFilter?.securityQ1 != null && { securityQ1: selectedFilter.securityQ1 }), + ...(selectedFilter?.securityQ2 != null && { securityQ2: selectedFilter.securityQ2 }), + ...(selectedFilter?.facilityId && { + facilityIds: selectedFilter?.facilityId?.map((item) => item.id), + }), assignee: user.info.uuid, planConfigurationId: microplanId, limit: limitAndOffset?.limit, @@ -183,15 +190,10 @@ const PlanInbox = () => { }, changeQueryName:"count" }); - - useEffect(() => { - if (planWithCensusCount) { - setAssignedToMeCount(planWithCensusCount?.TotalCount); - } - }, [planWithCensusCount]); - - - + + + + const { isLoading: isPlanWithCensusLoading, data: planWithCensus, @@ -206,8 +208,15 @@ const PlanInbox = () => { tenantId: tenantId, active: true, jurisdiction: censusJurisdiction, - status: selectedFilter !== null && selectedFilter !== undefined ? selectedFilter : "", - ...(activeLink.code == "ASSIGNED_TO_ALL" || selectedFilter == "VALIDATED" ? {} : { assignee: user.info.uuid }), + status: selectedFilter?.status !== null && selectedFilter?.status !== undefined ? selectedFilter?.status : "", + ...(activeLink.code == "ASSIGNED_TO_ALL" || selectedFilter?.status == "VALIDATED" ? {} : { assignee: user.info.uuid }), + ...(selectedFilter?.terrain != null && { terrain: selectedFilter.terrain }), + ...(selectedFilter?.onRoadCondition != null && { onRoadCondition: selectedFilter.onRoadCondition }), + ...(selectedFilter?.securityQ1 != null && { securityQ1: selectedFilter.securityQ1 }), + ...(selectedFilter?.securityQ2 != null && { securityQ2: selectedFilter.securityQ2 }), + ...(selectedFilter?.facilityId && { + facilityIds: selectedFilter?.facilityId?.map((item) => item.id), + }), planConfigurationId: microplanId, //list of plan ids limit: limitAndOffset?.limit, offset: limitAndOffset?.offset, @@ -237,7 +246,7 @@ const PlanInbox = () => { acc[field.key] = field.value; // Set `key` as property name and `value` as property value return acc; }, {}); - + return { original: item, censusOriginal: filteredCensus, @@ -284,7 +293,7 @@ const PlanInbox = () => { setDefaultBoundaries(selectedBoundaries); // Extract the list of codes from the selectedBoundaries array const boundaryCodes = selectedBoundaries.map((boundary) => boundary.code); - + // Set census jurisdiction with the list of boundary codes setCensusJurisdiction(boundaryCodes); } @@ -366,7 +375,7 @@ const PlanInbox = () => { businessServices: "PLAN_ESTIMATION", }, config: { - enabled: selectedFilter ? true : false, + enabled: selectedFilter?.status ? true : false, select: (data) => { return data.BusinessServices?.[0]; }, @@ -375,16 +384,16 @@ const PlanInbox = () => { useEffect(() => { if (workflowData) { - // Assume selectedFilter maps to applicationStatus or state - const selectedState = workflowData?.states?.find((state) => state.state === selectedFilter); - + // Assume selectedFilter.filterValue maps to applicationStatus or state + const selectedState = workflowData?.states?.find((state) => state.state === selectedFilter?.status); + // Filter actions based on the selected state const availableActions = selectedState?.actions?.filter((action) => action.roles.some((role) => userRoles.includes(role))); // Update the available actions state setAvailableActionsForUser(availableActions || []); } - }, [workflowData, selectedFilter]); + }, [workflowData, selectedFilter?.status]); // if availableActionsForUser is defined and is an array const actionsMain = availableActionsForUser?.length > 0 ? availableActionsForUser : []; @@ -409,15 +418,18 @@ const PlanInbox = () => { ); setActiveFilter(reorderedStatusCount); const activeFilterKeys = Object.keys(reorderedStatusCount || {}); - if (selectedFilter === null || selectedFilter === undefined || selectedFilter === "" || !activeFilterKeys.includes(selectedFilter)) { - setSelectedFilter(activeFilterKeys[0]); + if (selectedFilter?.filterValue === null || selectedFilter?.status=== undefined || selectedFilter?.status === "") { + setSelectedFilter((prev) => ({ + ...prev, // Spread the previous state to retain other attributes + })); + } setVillagesSelected(0); setSelectedRows([]); if (activeLink.code === "ASSIGNED_TO_ME") { setAssignedToMeCount(planWithCensus?.TotalCount); - setAssignedToAllCount(planWithCensus?.StatusCount[selectedFilter] || 0); + setAssignedToAllCount(planWithCensus?.StatusCount[selectedFilter?.status] || 0); } else { setAssignedToAllCount(planWithCensus?.TotalCount); } @@ -432,7 +444,7 @@ const PlanInbox = () => { refetchPlanWithCensus(); // Trigger the API call again after activeFilter changes } }, [selectedFilter, activeLink, censusJurisdiction, limitAndOffset]); - + const reqCri = { url: `/${hrms_context_path}/employees/_search`, params: { @@ -443,6 +455,13 @@ const PlanInbox = () => { enabled: assigneeUuids?.length > 0 ? true : false, }, }; + + useEffect(() => { + if (planWithCensusCount) { + setAssignedToMeCount(planWithCensusCount?.TotalCount); + setAssignedToAllCount(planWithCensusCount?.TotalCount); + } + }, [planWithCensusCount]); const { isLoading: isEmployeeLoading, data: employeeData, refetch: refetchHrms } = Digit.Hooks.useCustomAPIHook(reqCri); @@ -484,7 +503,7 @@ const PlanInbox = () => { }, [processData]); useEffect(() => { - if (selectedFilter === "VALIDATED") { + if (selectedFilter?.status === "VALIDATED") { setActiveLink({ code: "", name: "" }); setShowTab(false); } else { @@ -496,10 +515,15 @@ const PlanInbox = () => { setShowTab(true); } } - }, [selectedFilter]); + }, [selectedFilter?.status]); - const onFilter = (selectedStatus) => { - setSelectedFilter(selectedStatus?.code); + const onFilter = (filterValue) => { + setSelectedFilter((prev)=>( + { + ...prev, + ...filterValue + } + )); setCurrentPage(1); setLimitAndOffset((prev)=>{ return { @@ -513,10 +537,10 @@ const PlanInbox = () => { }); }; - const clearFilters = () => { - if (selectedFilter !== Object.entries(activeFilter)?.[0]?.[0]) { - setSelectedFilter(Object.entries(activeFilter)?.[0]?.[0]); - } + const clearFilters = () => { + setSelectedFilter((prev)=>({ + status:Object.entries(activeFilter)?.[0]?.[0] + })); setCurrentPage(1); setLimitAndOffset((prev)=>{ return { @@ -537,7 +561,7 @@ const PlanInbox = () => { const resourceArr = (resources || []).map((resource) => ({ name: t(resource.resourceType), // Dynamic column name for each resourceType cell: (row) => { - return row?.[resource?.resourceType]; // Return estimatedNumber if exists + return row?.[resource?.resourceType] === null ? t("NA") : row?.[resource?.resourceType]; // Return NA only if null, not for 0 or falsy values }, sortable: true, width: "180px", @@ -787,13 +811,13 @@ const PlanInbox = () => { }; const getButtonState = (action) => { - if (selectedFilter === "PENDING_FOR_VALIDATION" && action === "VALIDATE") { + if (selectedFilter?.status === "PENDING_FOR_VALIDATION" && action === "VALIDATE") { return true; } - if (selectedFilter === "PENDING_FOR_APPROVAL" && (action === "APPROVE" || action === "ROOT_APPROVE")) { + if (selectedFilter?.status === "PENDING_FOR_APPROVAL" && (action === "APPROVE" || action === "ROOT_APPROVE")) { return true; } - if (selectedFilter === "VALIDATED" && action === "SEND_BACK_FOR_CORRECTION") { + if (selectedFilter?.status === "VALIDATED" && action === "SEND_BACK_FOR_CORRECTION") { return true; } return false; @@ -836,10 +860,12 @@ const PlanInbox = () => {
{`${t("HCM_MICROPLAN_MICROPLAN_NAME_LABEL")}: ${campaignObject?.campaignName || t("NO_NAME_AVAILABLE")}`}
-
{`${t("LOGGED_IN_AS")} ${userName} - ${t(userRole)}`}
+
{`${t("LOGGED_IN_AS")} ${userName} - ${t(userRole)}${planEmployee?.planData?.[0]?.hierarchyLevel ? + ` (${t(planEmployee.planData[0].hierarchyLevel.toUpperCase())})` : ""}`} +
- + { }} >
@@ -993,7 +1020,7 @@ const PlanInbox = () => { ) : planWithCensus?.tableData?.length === 0 ? ( ) : ( 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 793350d96bf..19b8501dd34 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 @@ -26,7 +26,7 @@ const PopInbox = () => { const [boundaries, setBoundaries] = useState([]); const [selectedRows, setSelectedRows] = useState([]); const [workFlowPopUp, setworkFlowPopUp] = useState(''); - const [selectedFilter, setSelectedFilter] = useState(null); + const [selectedFilter, setSelectedFilter] = useState({status:"PENDING_FOR_VALIDATION"}); const [actionBarPopUp, setactionBarPopUp] = useState(false); const [activeFilter, setActiveFilter] = useState({}); const [currentPage, setCurrentPage] = useState(1); @@ -269,7 +269,7 @@ const PopInbox = () => { businessServices: "CENSUS", }, config: { - enabled: selectedFilter ? true : false, + enabled: selectedFilter?.status ? true : false, select: (data) => { return data.BusinessServices?.[0]; }, @@ -281,7 +281,7 @@ const PopInbox = () => { // Assume selectedFilter maps to applicationStatus or state const selectedState = workflowData?.states?.find( - (state) => state.state === selectedFilter + (state) => state.state === selectedFilter?.status ); // Filter actions based on the selected state @@ -293,7 +293,7 @@ const PopInbox = () => { setAvailableActionsForUser(availableActions || []); } - }, [workflowData, selectedFilter]); + }, [workflowData, selectedFilter?.status]); // if availableActionsForUser is defined and is an array @@ -313,7 +313,7 @@ const PopInbox = () => { CensusSearchCriteria: { tenantId: tenantId, source: microplanId, - status: selectedFilter !== null && selectedFilter !== undefined ? selectedFilter : "", + status: selectedFilter?.status !== null && selectedFilter?.status !== undefined ? selectedFilter?.status : "", assignee: user.info.uuid, jurisdiction: censusJurisdiction, limit: limitAndOffset?.limit, @@ -344,8 +344,8 @@ const PopInbox = () => { CensusSearchCriteria: { tenantId: tenantId, source: microplanId, - status: selectedFilter !== null && selectedFilter !== undefined ? selectedFilter : "", - ...(activeLink.code == "ASSIGNED_TO_ALL" || selectedFilter == "VALIDATED" + status: selectedFilter?.status !== null && selectedFilter?.status !== undefined ? selectedFilter?.status : "", + ...(activeLink.code == "ASSIGNED_TO_ALL" || selectedFilter?.status == "VALIDATED" ? {} : { assignee: user.info.uuid }), jurisdiction: censusJurisdiction, @@ -422,17 +422,18 @@ const PopInbox = () => { const activeFilterKeys = Object.keys(reorderedStatusCount || {}); if ( - (selectedFilter === null || selectedFilter === undefined || selectedFilter === "") || - !activeFilterKeys.includes(selectedFilter) + (selectedFilter?.status === null || selectedFilter?.status === undefined || selectedFilter?.status === "") ) { - setSelectedFilter(activeFilterKeys[0]); + setSelectedFilter((prev) => ({ + ...prev, // Spread the previous state to retain other attributes + })); } setVillagesSelected(0); setSelectedRows([]); if (activeLink.code === "ASSIGNED_TO_ME") { setAssignedToMeCount(data?.TotalCount); - setAssignedToAllCount(data?.StatusCount[selectedFilter] || 0) + setAssignedToAllCount(data?.StatusCount[selectedFilter?.status] || 0) } else { setAssignedToAllCount(data?.TotalCount); } @@ -443,10 +444,10 @@ const PopInbox = () => { if (censusJurisdiction?.length > 0) { refetchCensus(); // Trigger the API call again after activeFilter changes } - }, [selectedFilter, censusJurisdiction, limitAndOffset, activeLink]); + }, [selectedFilter?.status, censusJurisdiction, limitAndOffset, activeLink]); useEffect(() => { - if (selectedFilter === "VALIDATED") { + if (selectedFilter?.status === "VALIDATED") { setActiveLink({ code: "", name: "" }); setShowTab(false); } else { @@ -458,9 +459,9 @@ const PopInbox = () => { setShowTab(true); } } - }, [selectedFilter]); + }, [selectedFilter?.status]); - const onFilter = (selectedStatus) => { + const onFilter = (filterValue) => { setLimitAndOffset((prev)=>{ return { limit: prev.limit, @@ -468,7 +469,12 @@ const PopInbox = () => { } }); setCurrentPage(1); - setSelectedFilter(selectedStatus?.code); + setSelectedFilter((prev)=>( + { + ...prev, + ...filterValue + } + )); setActiveLink({ code: "ASSIGNED_TO_ME", name: "ASSIGNED_TO_ME" @@ -487,9 +493,9 @@ const PopInbox = () => { } const clearFilters = () => { - if (selectedFilter !== Object.entries(activeFilter)?.[0]?.[0]) { - setSelectedFilter(Object.entries(activeFilter)?.[0]?.[0]); - } + setSelectedFilter((prev)=>({ + status:Object.entries(activeFilter)?.[0]?.[0] + })); setLimitAndOffset((prev)=>{ return { limit: prev.limit, @@ -558,13 +564,13 @@ const PopInbox = () => { const getButtonState = (action) => { - if (selectedFilter === "PENDING_FOR_VALIDATION" && action === "VALIDATE") { + if (selectedFilter?.status === "PENDING_FOR_VALIDATION" && action === "VALIDATE") { return true; } - if (selectedFilter === "PENDING_FOR_APPROVAL" && (action === "APPROVE" || action === "ROOT_APPROVE")) { + if (selectedFilter?.status === "PENDING_FOR_APPROVAL" && (action === "APPROVE" || action === "ROOT_APPROVE")) { return true; } - if (selectedFilter === "VALIDATED" && action === "SEND_BACK_FOR_CORRECTION") { + if (selectedFilter?.status === "VALIDATED" && action === "SEND_BACK_FOR_CORRECTION") { return true; } return false; @@ -611,12 +617,15 @@ const PopInbox = () => { {`${t("HCM_MICROPLAN_MICROPLAN_NAME_LABEL")}: ${planObject?.name || t("NO_NAME_AVAILABLE")}`}
- {`${t("LOGGED_IN_AS")} ${userName} - ${t(userRole)}`} + {`${t("LOGGED_IN_AS")} ${userName} - ${t(userRole)}${planEmployee?.planData + ? ` (${t(planEmployee.planData[0].hierarchyLevel.toUpperCase())})` : ""}` + } +
- + {
@@ -760,7 +769,7 @@ const PopInbox = () => { )}
)} - {isLoading || isFetching ? : censusData.length === 0 ? : 0} employeeNameData={employeeNameMap} + {isLoading || isFetching ? : censusData.length === 0 ? : 0} employeeNameData={employeeNameMap} onSuccessEdit={(data) => { setUpdatedCensus(data); setShowComment(true); diff --git a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/utils/utilities.js b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/utils/utilities.js index 83890c13024..07e634794f9 100644 --- a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/utils/utilities.js +++ b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/utils/utilities.js @@ -163,7 +163,7 @@ const formValidator = (formData, key, state, t) => { } const processesAreValid = formData?.selectedRegistrationProcess?.code && formData?.selectedDistributionProcess?.code; - if (processesAreValid && (formData?.selectedRegistrationProcess.code === formData?.selectedDistributionProcess.code)) { + if (processesAreValid && (formData?.selectedRegistrationProcess.code === formData?.selectedDistributionProcess.code) && (formData?.selectedRegistrationProcess.code !== "MIXED")) { return { key: "error", label: "ERROR_REGISTRATION_AND_DISTRIBUTION_ARE_SAME" }; // Customize as needed } diff --git a/health/micro-ui/web/public/index.html b/health/micro-ui/web/public/index.html index 99a2ccb976a..af79e1162a3 100644 --- a/health/micro-ui/web/public/index.html +++ b/health/micro-ui/web/public/index.html @@ -8,9 +8,9 @@ href="https://fonts.googleapis.com/css2?family=Roboto+Condensed:wght@400;500;700&family=Roboto:wght@400;500;700&display=swap" rel="stylesheet" type="text/css" /> - + - + DIGIT HCM