Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Latest KPI values and Heading change #1883

Merged
merged 15 commits into from
Nov 23, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -417,3 +417,6 @@ tbody tr:last-child td:last-child .digit-dropdown-employee-select-wrap .digit-dr
position: relative;
}

.mp-heading-bold{
font-weight: 700;
}
abishekTa-egov marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React, { useState, Fragment, useEffect } from "react";
import { useTranslation } from "react-i18next";
import { PopUp, Button, Tab, CheckBox, Card, Toast, SVG,TooltipWrapper } from "@egovernments/digit-ui-components";
import { PopUp, Button, Tab, CheckBox, Card, Toast, SVG, TooltipWrapper } from "@egovernments/digit-ui-components";
import SearchJurisdiction from "./SearchJurisdiction";
import { LoaderWithGap, Loader,InfoBannerIcon } from "@egovernments/digit-ui-react-components";
import { LoaderWithGap, Loader, InfoBannerIcon } from "@egovernments/digit-ui-react-components";
import DataTable from "react-data-table-component";
import AccessibilityPopUp from "./accessbilityPopUP";
import SecurityPopUp from "./securityPopUp";
Expand Down Expand Up @@ -159,6 +159,26 @@ const FacilityPopUp = ({ details, onClose, updateDetails }) => {
};

const mutationForCensusSearch = Digit.Hooks.useCustomAPIMutationHook(censusSearchMutaionConfig);
const reqCriteria = {
url: `/plan-service/plan/facility/_search`,
params: {},
body: {
PlanFacilitySearchCriteria: {
"tenantId": Digit.ULBService.getCurrentTenantId(),
"planConfigurationId": details.planConfigurationId,
"facilityId": details.facilityId,

},
},
config: {
select: (data) => data,
},
};
nipunarora-eGov marked this conversation as resolved.
Show resolved Hide resolved


const { isLoading:iskpiDataLoading, data: latestKpiData, refetch, revalidate } = Digit.Hooks.useCustomAPIHook(reqCriteria);
nipunarora-eGov marked this conversation as resolved.
Show resolved Hide resolved




const censusSearch = async (data) => {
Expand Down Expand Up @@ -208,12 +228,12 @@ const FacilityPopUp = ({ details, onClose, updateDetails }) => {
}

useEffect(() => {
if (isLoadingPlanEmployee || isLoadingCampaign || isProcessLoading) {
if (isLoadingPlanEmployee || isLoadingCampaign || isProcessLoading || iskpiDataLoading) {
setLoader(true);
} else {
setLoader(false);
}
}, [isLoadingPlanEmployee, isLoadingCampaign, isProcessLoading]);
}, [isLoadingPlanEmployee, isLoadingCampaign, isProcessLoading,iskpiDataLoading]);
abishekTa-egov marked this conversation as resolved.
Show resolved Hide resolved

const handleRowSelect = (event) => {
// Extract the IDs of all selected rows
Expand Down Expand Up @@ -340,7 +360,8 @@ const FacilityPopUp = ({ details, onClose, updateDetails }) => {
await mutationForPlanFacilitySearch.mutate(
{},
{
onSuccess: async (result) => {
onSuccess: async (result) => {
refetch();
updateDetails(result?.PlanFacility?.[0]);
},
onError: async (result) => {
Expand Down Expand Up @@ -417,24 +438,16 @@ const FacilityPopUp = ({ details, onClose, updateDetails }) => {
setKpiParams([
{ key: "facilityName", value: details?.additionalDetails?.facilityName || t("NA") },
{ key: "facilityType", value: details?.additionalDetails?.facilityType || t("NA") },
{ key: "facilityStatus", value: details?.additionalDetails?.facilityStatus || t("NA")},
{ key: "facilityStatus", value: details?.additionalDetails?.facilityStatus || t("NA") },
{ key: "capacity", value: details?.additionalDetails?.capacity || t("NA") },
{ key: "servingPopulation", value: details?.additionalDetails?.servingPopulation || t("NA") },
{ key: "servingPopulation", value: latestKpiData?.PlanFacility[0]?.additionalDetails?.servingPopulation || t("NA")},
{ key: "fixedPost", value: details?.additionalDetails?.fixedPost || t("NA") },
{ key: "residingVillage", value: t(details?.residingBoundary) || t("NA")}
{ key: "residingVillage", value: t(details?.residingBoundary) || t("NA") }
]);
}
}, [details]);

const customRenderers = {
}, [details, latestKpiData]);
nipunarora-eGov marked this conversation as resolved.
Show resolved Hide resolved

residingVillage: (value) => (
<p className="mp-fac-value">
<span style={{ color: "#0B4B66" }}>{t(value)}</span>{" "}
<VillageHierarchyTooltipWrapper boundaryCode={details?.residingBoundary} placement={"bottom"} />
</p>

)};


return (
Expand All @@ -447,16 +460,16 @@ const FacilityPopUp = ({ details, onClose, updateDetails }) => {
heading={`${t(`MICROPLAN_ASSIGNMENT_FACILITY`)} ${details?.additionalDetails?.facilityName}`}
children={[
<div className="facilitypopup-serach-results-wrapper">
<Card className="fac-middle-child">
{iskpiDataLoading? <Loader/>:<Card className="fac-middle-child">
<div className="fac-kpi-container">
{kpiParams.map(({ key, value }) => (
<div key={key} className="fac-kpi-card">
abishekTa-egov marked this conversation as resolved.
Show resolved Hide resolved
{customRenderers[key] ? customRenderers[key](value) : <p className="mp-fac-value">{value}</p>}
<p className="mp-fac-value">{value}</p>
<p className="mp-fac-key">{t(`MICROPLAN_${key.toUpperCase()}`)}</p>
</div>
))}
</div>
</Card>
</Card>}
abishekTa-egov marked this conversation as resolved.
Show resolved Hide resolved
<div className="facilitypopup-tab-serach-wrapper">
<Tab
activeLink={activeLink.code}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -579,14 +579,10 @@ function RoleTableComposer({ nationalRoles }) {
{unassignPopup && (
<PopUp
className={"popUpClass"}
type={"default"}
heading={t("USERTAG_CONFIRM_TO_UNASSIGN")}
type={"alert"}
alertHeading={t("USERTAG_CONFIRM_TO_UNASSIGN")}
alertMessage={t("USERTAG_CONFIRM_TO_UNASSIGN_DESC")}
equalWidthButtons={true}
children={[
<div>
<CardText style={{ margin: 0 }}>{t("USERTAG_CONFIRM_TO_UNASSIGN_DESC")}</CardText>
</div>,
]}
onOverlayClick={() => {
setUnassignPopup(false);
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -368,14 +368,10 @@ function UserAccess({ category, setData, nationalRoles }) {
{unassignPopup && (
<PopUp
className={"popUpClass"}
type={"default"}
heading={t("USERTAG_CONFIRM_TO_UNASSIGN")}
type={"alert"}
alertHeading={t("USERTAG_CONFIRM_TO_UNASSIGN")}
alertMessage={t("USERTAG_CONFIRM_TO_UNASSIGN_DESC")}
abishekTa-egov marked this conversation as resolved.
Show resolved Hide resolved
equalWidthButtons={true}
children={[
<div>
<CardText style={{ margin: 0 }}>{t("USERTAG_CONFIRM_TO_UNASSIGN_DESC")}</CardText>
</div>,
]}
onOverlayClick={() => {
setUnassignPopup(false);
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ const FacilityCatchmentMapping = () => {
<div style={{ marginBottom: isRootApprover && data?.TotalCount === 0 && planObject?.status === "CENSUS_DATA_APPROVED" ?"2.5rem" :"0rem"}}>
<Header styles={{ marginBottom: "1rem" }}>{t("MICROPLAN_ASSIGN_CATCHMENT_VILLAGES")}</Header>
<div className="role-summary-sub-heading" style={{marginBottom:"1.5rem"}}>
<div>
<div className="mp-heading-bold">
{`${t("HCM_MICROPLAN_MICROPLAN_NAME_LABEL")}: ${planObject?.name || t("NO_NAME_AVAILABLE")}`}
</div>
<div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,7 @@ const PlanInbox = () => {
<div>
<Header styles={{marginBottom:"1rem"}} className="pop-inbox-header">{t(`HCM_MICROPLAN_VALIDATE_AND_APPROVE_MICROPLAN_ESTIMATIONS`)}</Header>
<div className="role-summary-sub-heading">
<div>
<div className="mp-heading-bold">
{`${t("HCM_MICROPLAN_MICROPLAN_NAME_LABEL")}: ${campaignObject?.campaignName || t("NO_NAME_AVAILABLE")}`}
</div>
<div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ const PopInbox = () => {
<div>
<Header styles={{ marginBottom: "1rem" }} className="pop-inbox-header">{t(`VALIDATE_APPROVE_POPULATIONDATA`)}</Header>
<div className="role-summary-sub-heading">
<div>
<div className="mp-heading-bold">
{`${t("HCM_MICROPLAN_MICROPLAN_NAME_LABEL")}: ${planObject?.name || t("NO_NAME_AVAILABLE")}`}
</div>
<div>
Expand Down