From a2735bfee935817cebe07df75938c49d3264e4f3 Mon Sep 17 00:00:00 2001 From: Bhavya-egov <137176879+Bhavya-egov@users.noreply.github.com> Date: Mon, 21 Oct 2024 11:46:39 +0530 Subject: [PATCH 1/3] added breadCrumbs for update (#1591) * added breadCrumbs for update * changed name for the download template in update * changed name * changed label * removed boundary * Update index.js --------- Co-authored-by: Jagankumar <53823168+jagankumar-egov@users.noreply.github.com> --- .../src/components/UploadData.js | 16 +++++++++++++++- .../src/configs/UICustomizations.js | 4 ++-- .../src/pages/employee/MyCampaign.js | 2 +- .../campaign-manager/src/pages/employee/index.js | 7 ++++++- 4 files changed, 24 insertions(+), 5 deletions(-) diff --git a/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/UploadData.js b/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/UploadData.js index be8ee7ac0fc..b0f22a676fe 100644 --- a/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/UploadData.js +++ b/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/UploadData.js @@ -1040,6 +1040,20 @@ const UploadData = ({ formData, onSelect, ...props }) => { else setKey(12); }; + const getDownloadLabel = () => { + if (parentId) { + if (type === "boundary") { + return t("WBH_DOWNLOAD_CURRENT_TARGET"); + } else if (type === "facilityWithBoundary") { + return t("WBH_DOWNLOAD_CURRENT_FACILITY"); + } else { + return t("WBH_DOWNLOAD_CURRENT_USER"); + } + } else { + return t("WBH_DOWNLOAD_TEMPLATE"); + } + }; + return ( <>
@@ -1072,7 +1086,7 @@ const UploadData = ({ formData, onSelect, ...props }) => { {type === "boundary" ? t("WBH_UPLOAD_TARGET") : type === "facilityWithBoundary" ? t("WBH_UPLOAD_FACILITY") : t("WBH_UPLOAD_USER")}
+ + )} + + + + + + ); +}; + +export default PlanInbox; 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 e19e6510c0a..cb5d28c1fe6 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 @@ -6,10 +6,7 @@ import { Card, Tab, Button, SVG, Loader } from "@egovernments/digit-ui-component import { useTranslation } from "react-i18next"; import InboxFilterWrapper from "../../components/InboxFilterWrapper"; - - const PopInbox = () => { - const { t } = useTranslation(); const tenantId = Digit.ULBService.getCurrentTenantId(); @@ -19,7 +16,7 @@ const PopInbox = () => { const [showTab, setShowTab] = useState(true); const user = Digit.UserService.getUser(); const [jurisdiction, setjurisdiction] = useState([]); - const [hierarchyLevel, setHierarchyLevel] = useState(''); + const [hierarchyLevel, setHierarchyLevel] = useState(""); const [censusData, setCensusData] = useState([]); const [boundaries, setBoundaries] = useState([]); const [selectedFilter, setSelectedFilter] = useState(null); @@ -29,10 +26,7 @@ const PopInbox = () => { name: "ASSIGNED_TO_ME", }); - - const onSearch = (selectedBoundaries) => { - // Extract the list of codes from the selectedBoundaries array const boundaryCodes = selectedBoundaries.map((boundary) => boundary.code); @@ -40,9 +34,6 @@ const PopInbox = () => { setjurisdiction(boundaryCodes); }; - - - // need to add table and filter card const { @@ -54,7 +45,7 @@ const PopInbox = () => { { CampaignDetails: { tenantId, - ids: [url?.campaignId], + ids: ["3c4f50b4-07ed-4b64-a9aa-079ab433dac9"], }, }, { @@ -70,7 +61,7 @@ const PopInbox = () => { } }, [campaignObject]); - + console.log("user", user); const { isLoading: isPlanEmpSearchLoading, data: planEmployee, @@ -84,15 +75,13 @@ const PopInbox = () => { // planConfigurationId: url?.microplanId, // active: true, // employeeId: [user?.info?.uuid], - // "role": [ - // "POPULATION_DATA_APPROVER" - // ], + // role: ["POPULATION_DATA_APPROVER", "ROOT_POPULATION_DATA_APPROVER"], tenantId: "mz", active: true, - planConfigurationId: "6cb8bde7-138b-4c25-b13d-7a44c9b26407", + planConfigurationId: url?.microplanId, role: ["POPULATION_DATA_APPROVER"], - employeeId: ["13df46a3-6398-44b7-927e-62cf75c75bf4"], + employeeId: [user?.info?.uuid], }, }, config: { @@ -103,15 +92,14 @@ const PopInbox = () => { useEffect(() => { if (planEmployee?.planData) { setjurisdiction(planEmployee?.planData?.[0]?.jurisdiction); - setHierarchyLevel(planEmployee?.planData?.[0]?.hierarchyLevel) + setHierarchyLevel(planEmployee?.planData?.[0]?.hierarchyLevel); } }, [planEmployee]); const onClear = () => { - setjurisdiction(planEmployee?.planData?.[0]?.jurisdiction) + setjurisdiction(planEmployee?.planData?.[0]?.jurisdiction); }; - const { isLoading: isUserLoading, data: workflowData, revalidate } = Digit.Hooks.useCustomAPIHook({ url: "/egov-workflow-v2/egov-wf/businessservice/_search", params: { @@ -129,9 +117,6 @@ const PopInbox = () => { const actionsMain = workflowData?.actions; - - - // Custom hook to fetch census data based on microplanId and boundaryCode const reqCriteriaResource = { url: `/census-service/_search`, @@ -139,8 +124,8 @@ const PopInbox = () => { CensusSearchCriteria: { tenantId: tenantId, source: microplanId, - status: selectedFilter !== null && selectedFilter !== undefined ? selectedFilter : '', - assignee: activeLink.code === 'ASSIGNED_TO_ME' ? user?.info?.uuid : '', + status: selectedFilter !== null && selectedFilter !== undefined ? selectedFilter : "", + assignee: activeLink.code === "ASSIGNED_TO_ME" ? user?.info?.uuid : "", jurisdiction: jurisdiction, }, }, @@ -151,36 +136,30 @@ const PopInbox = () => { const { isLoading, data, isFetching, refetch } = Digit.Hooks.useCustomAPIHook(reqCriteriaResource); - useEffect(() => { if (data) { setCensusData(data?.Census); setActiveFilter(data?.StatusCount); - if ((selectedFilter === null || selectedFilter === undefined) && selectedFilter !== '') { - setSelectedFilter(Object.entries(data?.StatusCount)?.[0]?.[0]) + if ((selectedFilter === null || selectedFilter === undefined) && selectedFilter !== "") { + setSelectedFilter(Object.entries(data?.StatusCount)?.[0]?.[0]); } } }, [data, selectedFilter]); - - useEffect(() => { if (jurisdiction.length > 0) { refetch(); // Trigger the API call again after activeFilter changes } }, [selectedFilter, activeLink, jurisdiction]); - - useEffect(() => { - }, [selectedFilter]); + useEffect(() => {}, [selectedFilter]); const onFilter = (selectedStatus) => { setSelectedFilter(selectedStatus?.code); - }; const clearFilters = () => { - setSelectedFilter(''); + setSelectedFilter(""); }; const handleActionClick = (action) => { @@ -192,26 +171,30 @@ const PopInbox = () => { setVillagesSelected(event?.selectedCount); }; - if (isPlanEmpSearchLoading || isLoadingCampaignObject || isLoading) { return ; } - - return (
- +
@@ -240,26 +223,27 @@ const PopInbox = () => { /> )} - {villagesSlected !== 0 &&
- -
- -
{`${villagesSlected} ${t("MICROPLAN_VILLAGES_SELECTED")}`}
-
- -
- {actionsMain?.map((action, index) => ( -
-
} + )}
@@ -268,4 +252,4 @@ const PopInbox = () => { ); }; -export default PopInbox; \ No newline at end of file +export default PopInbox; diff --git a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/index.js b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/index.js index 4ba5321f37d..2db026acd2a 100644 --- a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/index.js +++ b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/index.js @@ -19,6 +19,7 @@ import ChooseActivity from "./ChooseActivity"; import Response from "../../components/Response"; import FacilityCatchmentMapping from "./FacilityCatchmentMapping"; +import PlanInbox from "./PlanInbox"; @@ -186,6 +187,7 @@ const App = ({ path, stateCode, userType, tenants, BOUNDARY_HIERARCHY_TYPE, hier } /> } /> } /> + } /> } /> } /> } /> From 45944530711707ecc828251edd8ec1b599779318 Mon Sep 17 00:00:00 2001 From: rachana-egov <137176770+rachana-egov@users.noreply.github.com> Date: Mon, 21 Oct 2024 16:31:52 +0530 Subject: [PATCH 3/3] Added updated api for census and workflow integration (#1598) * added updated api for census and workflow integration * updated approve popup to workflow popup * updated workflow action * resolved coderabbit comments --------- Co-authored-by: rachana-egov Co-authored-by: Nipun Arora --- .../example/public/index.html | 2 +- .../packages/css/package.json | 2 +- .../css/src/pages/employee/index.scss | 2 +- .../css/src/pages/employee/villageView.scss | 16 + .../microplan/src/components/WorkflowPopUp.js | 104 +++ .../components/editVillagePopulationPopUP.js | 56 +- .../microplan/src/components/securityPopUp.js | 8 +- .../src/components/timelinePopUpWrapper.js | 753 +----------------- .../src/pages/employee/viewVillage.js | 15 +- health/micro-ui/web/public/index.html | 2 +- 10 files changed, 203 insertions(+), 757 deletions(-) create mode 100644 health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/WorkflowPopUp.js 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 9ed9ac3fe67..53afaafba1c 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 @@ -16,7 +16,7 @@ /> --> - + 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 2e0739dde41..da0398fe077 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.1.3", + "version": "0.1.4", "license": "MIT", "main": "dist/index.css", "author": "Jagankumar ", diff --git a/health/micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/index.scss b/health/micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/index.scss index a1a54d026fe..54f1db47c7d 100644 --- a/health/micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/index.scss +++ b/health/micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/index.scss @@ -1146,5 +1146,5 @@ tbody { } .digit-action-bar-wrap div { - width: 100%; + width: unset; } \ No newline at end of file diff --git a/health/micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/villageView.scss b/health/micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/villageView.scss index b2be946938f..fb71b5622e1 100644 --- a/health/micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/villageView.scss +++ b/health/micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/villageView.scss @@ -56,4 +56,20 @@ .middle-child { margin-bottom: 1.5rem; +} + +.comment-label { + margin-bottom: .25rem; + @extend .typography.label; + color: theme(digitv2.lightTheme.text-primary); +} + +.comment-label .required { + color: theme(digitv2.alert.error); +} + +.security-question-label { + margin-bottom: 1rem; + @extend .typography.heading-m; + color: theme(digitv2.lightTheme.text-primary); } \ No newline at end of file diff --git a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/WorkflowPopUp.js b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/WorkflowPopUp.js new file mode 100644 index 00000000000..85c1ee88c8c --- /dev/null +++ b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/WorkflowPopUp.js @@ -0,0 +1,104 @@ +import React, { useState } from "react"; +import { useTranslation } from "react-i18next"; +import { PopUp, Button, TextArea, ErrorMessage } from "@egovernments/digit-ui-components"; +import { useMyContext } from "../utils/context"; // Ensure that the translation function `t` is handled here + + +{/* use this component for comment like this + setShowPopup(false)} + onSubmit={(comment) => console.log("Submitted comment:", comment)} + census={censusData} +/> */} + +const WorkflowPopUp = ({ onClose, onSubmit, heading }) => { + const { state } = useMyContext(); // Extract state from context + const { t } = useTranslation(); + + const [comment, setComment] = useState(""); // Track TextArea input + const [error, setError] = useState(false); // Track error state + + // Handle TextArea input change + const handleTextAreaChange = (e) => { + setComment(e.target.value); + if (e.target.value.trim()) { + setError(false); // Reset error when input is not empty + } + }; + + // Handle keypress "Enter" to submit the form + const handleKeyPress = (e) => { + if (e.key === "Enter") { + handleSave(); + } + }; + + // Handle Save + const handleSave = () => { + if (!comment.trim()) { + setError(true); // Show error if TextArea is empty + return; // Do not proceed further + } + + // Send the comment to the parent component or handle it here + if (onSubmit) { + onSubmit(comment); // Pass the comment via onSubmit prop + } + + // Close the popup after submitting the comment + onClose(); + }; + + return ( + +
+ {t(`HCM_MICROPLAN_ADD_COMMENT_LABEL`)}{" "} + * +
+