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 89f0115887..bb1241f61d 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 @@ -12,7 +12,7 @@ DIGIT - + 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 6e08896c2d..8adddce428 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.35", + "version": "0.2.36", "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 8f234de9e8..ab65a5a2c9 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 @@ -538,4 +538,13 @@ tbody tr:last-child td:last-child .digit-dropdown-employee-select-wrap .digit-dr flex-direction: column; gap: 1rem; -} \ No newline at end of file +} + +.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/microplan/src/components/InboxFilterWrapper.js b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/InboxFilterWrapper.js index bd33733d7c..dcbb418cb0 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,4 +1,4 @@ -import React, { useState, useEffect } from "react"; +import React, { useState, useEffect, Fragment } from "react"; import { useTranslation } from "react-i18next"; import { FilterCard, Dropdown, LabelFieldPair, RadioButtons, TextBlock, Loader } from "@egovernments/digit-ui-components"; import { useMyContext } from "../utils/context"; @@ -11,34 +11,39 @@ const InboxFilterWrapper = (props) => { 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 } + { status: null, onRoadCondition: null, terrain: null, securityQ1: null, securityQ2: null,facilityID:null } ); - // Default selected option let defaultSelectedOptions = props.defaultValue - ? Object.entries(props.defaultValue).reduce((acc, [key, value]) => { - if (value !== null) { + ? Object.entries(props.defaultValue).reduce((acc, [key, value]) => { + if (key === "facilityId") { + acc[key] = { code: value?.code, name: `${t(key)} (${value})` }; + } else if (value !== null) { acc[key] = { code: value, name: `${t(key)} (${value})` }; } else { acc[key] = null; } return acc; }, {}) - : null; + : null; + // Initialize state with the default selected option useEffect(() => { if (props.defaultValue && Object.keys(props.defaultValue).length > 0) { const newDefault = Object.entries(props.defaultValue).reduce((acc, [key, value]) => { acc[key] = value !== null - ? { code: value, name: `${t(key)} (${value})` } + ? key === 'facilityId' + ? { code: value?.code } + : { code: value, name: `${t(key)} (${value})` } : null; return acc; }, {}); setFilterValues(newDefault); } }, [props.defaultValue, t]); + @@ -65,15 +70,16 @@ const InboxFilterWrapper = (props) => { const handleApplyFilters = () => { if (props.onApplyFilters) { const filtersToApply = {}; - for (let key in filterValues) { - if (filterValues[key] && typeof filterValues[key] === 'object' && filterValues[key].hasOwnProperty('code')) { + 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 } }; @@ -125,7 +131,7 @@ const InboxFilterWrapper = (props) => { if(isPlanFacilityLoading){ return } - + return ( { /> )} - + {props.isPlanInbox && + - +
{t("MP_VILLAGE_ROAD_CONDITION")}
{
- - {t("MP_VILLAGE_TERRAIN")} + { - +
{t("MP_FILTER_FACILITY")}
handleDropdownChange("facility", value)} + selected={filterValues["facilityId"] || defaultSelectedOptions?.facilityId } + select={(value) => handleDropdownChange("facilityId", value)} t={t} disabled={false} /> @@ -202,24 +209,27 @@ const InboxFilterWrapper = (props) => { })); const isLastElement = index === state.securityQuestions.length - 1; + const questionNumber = parseInt(item.id, 10); return ( - +
{t(`MP_SECURITY_QUESTION ${index + 1}`)}
handleDropdownChange(`securityQ${index + 1}`, value)} - t={(key) => key} + optionKey={"code"} + selected={filterValues[`securityQ${questionNumber}`]} + select={(value) => handleDropdownChange(`securityQ${questionNumber}`, value)} + t={t} disabled={false} />
); })} +
+ } 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 bbc28edeef..b7b652fe18 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 @@ -79,7 +79,6 @@ function RoleTableComposer({ nationalRoles }) { enabled: true, select: (data) => { const resp = data?.Employees - ?.filter((emp)=> emp?.user?.userServiceUuid!== null) ?.map((item, index) => { return { rowIndex: index + 1, 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 3f5f626365..6894d59db9 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({status:"PENDING_FOR_VALIDATION",onRoadCondition:null,terrain:null,securityQ1:null,securityQ2:null}); + const [selectedFilter, setSelectedFilter] = useState({status:"PENDING_FOR_VALIDATION",onRoadCondition:null,terrain:null,securityQ1:null,securityQ2:null,facilityId:null}); const [activeFilter, setActiveFilter] = useState({}); const [actionBarPopUp, setactionBarPopUp] = useState(false); const [selectedRows, setSelectedRows] = useState([]); @@ -176,6 +176,7 @@ const PlanInbox = () => { ...(selectedFilter?.terrain != null && { terrain: selectedFilter.terrain }), ...(selectedFilter?.securityQ1 != null && { securityQ1: selectedFilter.securityQ1 }), ...(selectedFilter?.securityQ2 != null && { securityQ2: selectedFilter.securityQ2 }), + ...(selectedFilter?.facilityId?.id != null && { facilityId: selectedFilter.facilityId.id }), assignee: user.info.uuid, planConfigurationId: microplanId, limit: limitAndOffset?.limit, @@ -216,6 +217,8 @@ const PlanInbox = () => { ...(selectedFilter?.onRoadCondition != null && { onRoadCondition: selectedFilter.onRoadCondition }), ...(selectedFilter?.securityQ1 != null && { securityQ1: selectedFilter.securityQ1 }), ...(selectedFilter?.securityQ2 != null && { securityQ2: selectedFilter.securityQ2 }), + ...(selectedFilter?.facilityId?.id != null && { facilityId: selectedFilter.facilityId.id }), + planConfigurationId: microplanId, //list of plan ids limit: limitAndOffset?.limit, offset: limitAndOffset?.offset, @@ -882,6 +885,7 @@ const PlanInbox = () => { }} > { 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; @@ -619,7 +625,7 @@ const PopInbox = () => { - + {
@@ -763,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/public/index.html b/health/micro-ui/web/public/index.html index 54d966c576..f74d5d5e3c 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