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

Po finding fixes2 #1845

Merged
merged 11 commits into from
Nov 18, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -1221,12 +1221,16 @@ export const UICustomizations = {
additionalCustomizations: (row, key, column, value, t, searchResult) => {
const [showPopup, setShowPopup] = useState(false);
const FacilityPopUp = Digit.ComponentRegistryService.getComponent("FacilityPopup");
const VillageHierarchyTooltipWrapper = Digit.ComponentRegistryService.getComponent("VillageHierarchyTooltipWrapper");

switch (key) {
case "MICROPLAN_FACILITY_SERVINGPOPULATION":
return row?.additionalDetails?.servingPopulation;
case "MICROPLAN_FACILITY_RESIDINGVILLAGE":
return t(row?.residingBoundary);
return <div style={{display:"flex", gap:".5rem"}}>
{t(row?.residingBoundary)}
<VillageHierarchyTooltipWrapper boundaryCode={row?.residingBoundary}/>
</div>
rachana-egov marked this conversation as resolved.
Show resolved Hide resolved
case "MICROPLAN_FACILITY_ASSIGNED_VILLAGES":
const assignedVillages = row?.serviceBoundaries;
return assignedVillages ? assignedVillages.length : null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,16 @@
}
}

.select-activity-info {
margin-bottom: .5rem;
padding: .5rem;
width: 100%;
display: flex;
rachana-egov marked this conversation as resolved.
Show resolved Hide resolved
align-items: center;
gap: 1rem;
justify-content: space-between;
}
rachana-egov marked this conversation as resolved.
Show resolved Hide resolved

.table-actions-wrapper {
display: flex;
gap: 0.5rem;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import CustomScaleControl from "./components/CustomScaleControl";
import MapFilterIndex from "./components/MapFilterIndex";
import FilterSection from "./components/FilterSection";
import ChoroplethSelection from "./components/ChoroplethSelection";
import VillageHierarchyTooltipWrapper from "./components/VillageHierarchyTooltipWrapper";

export const MicroplanModule = ({ stateCode, userType, tenants }) => {
const { path, url } = useRouteMatch();
Expand Down Expand Up @@ -94,6 +95,7 @@ const componentsToRegister = {
AssumptionsList,
FormulaConfigScreen,
FacilityPopup,
VillageHierarchyTooltipWrapper,
UserAccessMgmt,
UserAccessMgmtTableWrapper,
DataMgmtComponent,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React, { Fragment } from "react";
import { useTranslation } from "react-i18next";
import { useHistory } from "react-router-dom";
import { CardHeader, Header } from "@egovernments/digit-ui-react-components";
import { Card, Tag } from "@egovernments/digit-ui-components";
import { CardHeader, Header, InfoIconOutline } from "@egovernments/digit-ui-react-components";
import { Card, Tag, TooltipWrapper } from "@egovernments/digit-ui-components";

const ActivityHomeCard = ({onClickCard=()=>{},...props}) => {
const { t } = useTranslation();
Expand All @@ -26,9 +26,10 @@ const ActivityHomeCard = ({onClickCard=()=>{},...props}) => {
minWidth: "100px",
cursor: i.disable ? "not-allowed" : "pointer",
opacity: i.disable ? 0.8 : 1, // To visually indicate the disabled state
justifyContent: "center",
alignItems: "center",
// justifyContent: "center",
alignItems: "center",
height: "200px",
padding: "0px"
}} // Adding margin to each card
onClick={() => {
if (!i.disable) { // Check if disabled
Expand All @@ -38,14 +39,19 @@ const ActivityHomeCard = ({onClickCard=()=>{},...props}) => {
}}
children={
<>
{i.icon}
{i.doneLabel && <Tag
<div className="select-activity-info">
<TooltipWrapper content={t(`SELECT_ACTIVITY_TOOLTIP_CONTENT_${i.name}`)} placement={"right-start"}>
<InfoIconOutline width="1.75rem" height="1.75rem" fill="#363636" />
</TooltipWrapper>
rachana-egov marked this conversation as resolved.
Show resolved Hide resolved
{i.doneLabel && <Tag
icon=""
label={t(i.doneLabel)}
labelStyle={{}}
style={{}}
type="success"
/>}
</div>
{i.icon}
<p className={`activity-card-label ${i.disable ? "disable-label" : ""}`}>{t(i.name)}</p>
</>
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { Fragment, useState, useEffect } from "react";
import { useTranslation } from "react-i18next";
import { PopUp, Button, TextArea, ErrorMessage, Toast } from "@egovernments/digit-ui-components";

const ConfirmationPopUp = ({ onClose, alertMessage, submitLabel, url, requestPayload, onSuccess, onError, cancelLabel }) => {
const ConfirmationPopUp = ({ onClose, alertHeading, alertMessage, submitLabel, url, requestPayload, onSuccess, onError, cancelLabel }) => {

const { t } = useTranslation();
const [comment, setComment] = useState(null);
Expand Down Expand Up @@ -46,6 +46,7 @@ const ConfirmationPopUp = ({ onClose, alertMessage, submitLabel, url, requestPay
type="alert"
onClose={onClose}
alertMessage={alertMessage}
alertHeading={alertHeading}
onOverlayClick={onClose}
equalWidthButtons={true}
footerChildren={[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -529,11 +529,16 @@ export const UICustomizations = {
additionalCustomizations: (row, key, column, value, t, searchResult) => {
const [showPopup, setShowPopup] = useState(false);
const FacilityPopUp = Digit.ComponentRegistryService.getComponent("FacilityPopup");
const VillageHierarchyTooltipWrapper = Digit.ComponentRegistryService.getComponent("VillageHierarchyTooltipWrapper");

switch (key) {
case "MICROPLAN_FACILITY_SERVINGPOPULATION":
return row?.additionalDetails?.servingPopulation;
case "MICROPLAN_FACILITY_RESIDINGVILLAGE":
return t(row?.residingBoundary);
return <div style={{display:"flex", gap:".5rem"}}>
{t(row?.residingBoundary)}
<VillageHierarchyTooltipWrapper boundaryCode={row?.residingBoundary}/>
</div>
case "MICROPLAN_FACILITY_ASSIGNED_VILLAGES":
const assignedVillages = row?.serviceBoundaries;
return assignedVillages ? assignedVillages.length : null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,31 +67,31 @@ const ChooseActivity = () => {
if(planObject && workflowData && processData){
const updatedActivityCardData = [
{
name: t("VALIDATE_N_APPROVE_POPULATION_DATA"),
name: "VALIDATE_N_APPROVE_POPULATION_DATA",
link: `pop-inbox?campaignId=${campaignId}&microplanId=${microplanId}`,
doneLabel: isProcessDone(processData, "APPROVE_CENSUS_DATA") && "CENSUS_VALIDATED_LABEL",
icon: <SVG.Population height="36" width="36" fill={isCardDisabled(["POPULATION_DATA_APPROVER", "ROOT_POPULATION_DATA_APPROVER"], isProcessDone(processData, "APPROVE_CENSUS_DATA"), ["EXECUTION_TO_BE_DONE","CENSUS_DATA_APPROVAL_IN_PROGRESS"]) ? "#C5C5C5" : "#C84C0E"}/>,
disable: isCardDisabled(["POPULATION_DATA_APPROVER", "ROOT_POPULATION_DATA_APPROVER"], isProcessDone(processData, "APPROVE_CENSUS_DATA"), ["EXECUTION_TO_BE_DONE","CENSUS_DATA_APPROVAL_IN_PROGRESS"]),
optionKey: "VALIDATE_N_APPROVE_POPULATION_DATA"
},
rachana-egov marked this conversation as resolved.
Show resolved Hide resolved
{
name: t("ASSIGN_FACILITIES_TO_VILLAGE"),
name: "ASSIGN_FACILITIES_TO_VILLAGE",
link: `assign-facilities-to-villages?campaignId=${campaignId}&microplanId=${microplanId}`,
doneLabel: isProcessDone(processData, "FINALIZE_CATCHMENT_MAPPING") && "FACILITY_CATCHEMENT_DONE_LABEL",
icon: <SVG.AssignmentTurnedIn height="36" width="36" fill={isCardDisabled(["FACILITY_CATCHMENT_MAPPER", "ROOT_FACILITY_CATCHMENT_MAPPER"], isProcessDone(processData, "FINALIZE_CATCHMENT_MAPPING"), ["CENSUS_DATA_APPROVED"]) ? "#C5C5C5" : "#C84C0E"} />,
disable: isCardDisabled(["FACILITY_CATCHMENT_MAPPER", "ROOT_FACILITY_CATCHMENT_MAPPER"], isProcessDone(processData, "FINALIZE_CATCHMENT_MAPPING"), ["CENSUS_DATA_APPROVED"]),
optionKey: "ASSIGN_FACILITIES_TO_VILLAGE"
},
rachana-egov marked this conversation as resolved.
Show resolved Hide resolved
{
name: t("VALIDATE_N_APPROVE_MICROPLAN_ESTIMATIONS"),
name: "VALIDATE_N_APPROVE_MICROPLAN_ESTIMATIONS",
link: `plan-inbox?campaignId=${campaignId}&microplanId=${microplanId}`,
doneLabel: isProcessDone(processData, "APPROVE_ESTIMATIONS") && "ESTIMATIONS_APPROVED_LABEL",
icon: <SVG.FactCheck height="36" width="36" fill={isCardDisabled(["PLAN_ESTIMATION_APPROVER", "ROOT_PLAN_ESTIMATION_APPROVER"], isProcessDone(processData, "APPROVE_ESTIMATIONS"), ["RESOURCE_ESTIMATION_IN_PROGRESS"]) ? "#C5C5C5" : "#C84C0E"} />,
disable: isCardDisabled(["PLAN_ESTIMATION_APPROVER", "ROOT_PLAN_ESTIMATION_APPROVER"], isProcessDone(processData, "APPROVE_ESTIMATIONS"), ["RESOURCE_ESTIMATION_IN_PROGRESS"]),
optionKey: "VALIDATE_N_APPROVE_MICROPLAN_ESTIMATIONS"
},
rachana-egov marked this conversation as resolved.
Show resolved Hide resolved
{
name: t("GEOSPATIAL_MAP_VIEW"),
name: "GEOSPATIAL_MAP_VIEW",
link: `map-view?campaignId=${campaignId}&microplanId=${microplanId}`,
icon: <SVG.LocationOn height="36" width="36" fill={isCardDisabled(["POPULATION_DATA_APPROVER","ROOT_POPULATION_DATA_APPROVER","FACILITY_CATCHMENT_MAPPER","ROOT_FACILITY_CATCHMENT_MAPPER","MICROPLAN_VIEWER","PLAN_ESTIMATION_APPROVER", "ROOT_PLAN_ESTIMATION_APPROVER"], workflowData, ["RESOURCE_ESTIMATION_IN_PROGRESS","RESOURCE_ESTIMATIONS_APPROVED"]) ? "#C5C5C5" : "#C84C0E"}/>,
disable: isCardDisabled(["POPULATION_DATA_APPROVER","ROOT_POPULATION_DATA_APPROVER","FACILITY_CATCHMENT_MAPPER","ROOT_FACILITY_CATCHMENT_MAPPER","MICROPLAN_VIEWER","PLAN_ESTIMATION_APPROVER", "ROOT_PLAN_ESTIMATION_APPROVER"], workflowData, ["RESOURCE_ESTIMATION_IN_PROGRESS","RESOURCE_ESTIMATIONS_APPROVED"]),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ const FacilityCatchmentMapping = () => {
{actionBarPopUp && (
<ConfirmationPopUp
onClose={closeActionBarPopUp}
alertHeading={t(`HCM_MICROPLAN_FINALIZE_FACILITY_TO_VILLAGE_ASSIGNMENT_ALERT_HEADING`)}
alertMessage={t(`HCM_MICROPLAN_FINALIZE_FACILITY_TO_VILLAGE_ASSIGNMENT_ALERT_MESSAGE`)}
submitLabel={t(`HCM_MICROPLAN_FINALIZE_FACILITY_TO_VILLAGE_ASSIGNMENT_SUBMIT_ACTION`)}
cancelLabel={t(`HCM_MICROPLAN_FINALIZE_FACILITY_TO_VILLAGE_ASSIGNMENT_CANCEL_ACTION`)}
rachana-egov marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,7 @@ const PlanInbox = () => {
commentPath="workflow.comments"
onSuccess={(data) => {
closePopUp();
setShowToast({ key: "success", label: t("PLAN_INBOX_WORKFLOW_UPDATE_SUCCESS"), transitionTime: 5000 });
setShowToast({ key: "success", label: t(`PLAN_INBOX_WORKFLOW_FOR_${workFlowPopUp}_UPDATE_SUCCESS`), transitionTime: 5000 });
rachana-egov marked this conversation as resolved.
Show resolved Hide resolved
refetchPlanWithCensus();
}}
onError={(data) => {
Expand Down Expand Up @@ -693,6 +693,7 @@ const PlanInbox = () => {
{actionBarPopUp && (
<ConfirmationPopUp
onClose={closeActionBarPopUp}
alertHeading={t(`HCM_MICROPLAN_FINALIZE_MICROPLAN_ALERT_HEADING`)}
alertMessage={t(`HCM_MICROPLAN_FINALIZE_MICROPLAN_ALERT_MESSAGE`)}
submitLabel={t(`HCM_MICROPLAN_FINALIZE_MICROPLAN_SUBMIT_LABEL`)}
cancelLabel={t(`HCM_MICROPLAN_FINALIZE_MICROPLAN_CANCEL_ACTION`)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ const PopInbox = () => {
CensusSearchCriteria: {
tenantId: tenantId,
source: microplanId,
...(isRootApprover
? {}
: {jurisdiction: jurisdiction }),
rachana-egov marked this conversation as resolved.
Show resolved Hide resolved
},
}
},
Expand Down Expand Up @@ -485,6 +488,20 @@ const isStatusConditionMet = (statusCount) => {
"SEND_BACK_FOR_CORRECTION": { isSuffix: true, icon: "ArrowForward" },
}

const getButtonState = (action) => {

if (selectedFilter === "PENDING_FOR_VALIDATION" && action === "VALIDATE") {
return true;
}
if (selectedFilter === "PENDING_FOR_APPROVAL" && (action === "APPROVE" || action === "ROOT_APPROVE")) {
return true;
}
if (selectedFilter === "VALIDATED" && action === "SEND_BACK_FOR_CORRECTION") {
return true;
}
return false;
};


const onCommentLogClose = () => {
setShowComment(false);
Expand Down Expand Up @@ -523,7 +540,7 @@ const isStatusConditionMet = (statusCount) => {
onClear={onClear}
/>

<div className="pop-inbox-wrapper-filter-table-wrapper" style={{ marginBottom: isRootApprover && isStatusConditionMet(totalStatusCount) && planObject?.status === "CENSUS_DATA_APPROVAL_IN_PROGRESS" ? "2.5rem" : "0rem" }}>
<div className="pop-inbox-wrapper-filter-table-wrapper" style={{ marginBottom: (isRootApprover && isStatusConditionMet(totalStatusCount) && planObject?.status === "CENSUS_DATA_APPROVAL_IN_PROGRESS") || (!isRootApprover && isStatusConditionMet(totalStatusCount)) || disabledAction ? "2.5rem" : "0rem" }}>
rachana-egov marked this conversation as resolved.
Show resolved Hide resolved
<InboxFilterWrapper
options={activeFilter}
onApplyFilters={onFilter}
Expand Down Expand Up @@ -572,35 +589,44 @@ const isStatusConditionMet = (statusCount) => {
<ButtonsGroup
buttonsArray={actionsMain
?.filter((action) => !actionsToHide.includes(action.action))
?.map((action, index) => (
?.map((action, index) => {

const isPrimary = getButtonState(action.action);

return (
<Button
key={index}
variation="secondary"
variation={isPrimary ? "primary" : "secondary"}
label={t(action.action)}
type="button"
onClick={() => handleActionClick(action.action)}
size="large"
icon={actionIconMap[action.action]?.icon}
isSuffix={actionIconMap[action.action]?.isSuffix}
/>
))
);
})
}
/>
) : (
actionsMain
?.filter((action) => !actionsToHide.includes(action.action))
?.map((action, index) => (
?.map((action, index) => {
const isPrimary = getButtonState(action.action);

return(
<Button
key={index}
variation="secondary"
variation={isPrimary ? "primary" : "secondary"}
label={t(action.action)}
type="button"
onClick={() => handleActionClick(action.action)}
size="large"
icon={actionIconMap[action.action]?.icon}
isSuffix={actionIconMap[action.action]?.isSuffix}
/>
))
);
})
)}
</div>

Expand All @@ -614,7 +640,7 @@ const isStatusConditionMet = (statusCount) => {
commentPath="workflow.comments"
onSuccess={(data) => {
closePopUp();
setShowToast({ key: "success", label: t("POP_INBOX_WORKFLOW_UPDATE_SUCCESS"), transitionTime: 5000 });
setShowToast({ key: "success", label: t(`POP_INBOX_WORKFLOW_FOR_${workFlowPopUp}_UPDATE_SUCCESS`), transitionTime: 5000 });
refetch();
refetchPlan();
fetchStatusCount();
Expand All @@ -637,7 +663,7 @@ const isStatusConditionMet = (statusCount) => {
<WorkflowCommentPopUp
onClose={onCommentLogClose}
heading={t(`POP_INBOX_HCM_MICROPLAN_EDIT_POPULATION_COMMENT_LABEL`)}
submitLabel={t(`POP_INBOX_HCM_MICROPLAN_EDIT_POPULATION_COMMENT_SUBMIT_LABEL`)}
submitLabel={t(`${isRootApprover ? 'ROOT_' : ''}POP_INBOX_HCM_MICROPLAN_EDIT_POPULATION_COMMENT_SUBMIT_LABEL`)}
url="/census-service/_update"
requestPayload={{ Census: updatedCensus }}
commentPath="workflow.comments"
Expand Down Expand Up @@ -677,10 +703,25 @@ const isStatusConditionMet = (statusCount) => {
style={{}}
/>}

{((!isRootApprover && isStatusConditionMet(totalStatusCount)) || disabledAction) &&
<ActionBar
actionFields={[
<Button label={t(`HCM_MICROPLAN_POP_INBOX_BACK_BUTTON`)} onClick={()=> {
history.push(`/${window.contextPath}/employee/microplan/select-activity?microplanId=${url?.microplanId}&campaignId=${url?.campaignId}`);
}} type="button" variation="primary" />,
]}
className=""
maxActionFieldsAllowed={5}
setactionFieldsToRight
sortActionFields
style={{}}
/>}

rachana-egov marked this conversation as resolved.
Show resolved Hide resolved
{actionBarPopUp && (
<ConfirmationPopUp
onClose={closeActionBarPopUp}
alertMessage={t(`HCM_MICROPLAN_FINALIZE_POPULATION_ALERT_MESSAGE`)}
alertHeading={t(`HCM_MICROPLAN_FINALIZE_POPULATION_ALERT_HEADING_MESSAGE`)}
alertMessage={t(`HCM_MICROPLAN_FINALIZE_POPULATION_ALERT_DESCRIPTION_MESSAGE`)}
submitLabel={t(`HCM_MICROPLAN_FINALIZE_POPULATION_DATA_SUBMIT_ACTION`)}
cancelLabel={t(`HCM_MICROPLAN_FINALIZE_POPULATION_DATA_CANCEL_ACTION`)}
url="/plan-service/config/_update"
Expand Down