Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/console' into vertical-stepper-i…
Browse files Browse the repository at this point in the history
…mplemenetation
  • Loading branch information
ashish-egov committed Oct 7, 2024
2 parents c12d9eb + 66ace5c commit 8e22724
Show file tree
Hide file tree
Showing 19 changed files with 1,057 additions and 234 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<link rel="stylesheet" href="https://unpkg.com/@egovernments/digit-ui-css@1.8.0-alpha.6/dist/index.css" />

<link rel="stylesheet" href="https://unpkg.com/@egovernments/digit-ui-components-css@0.0.2-beta.34/dist/index.css" />
<link rel="stylesheet" href="https://unpkg.com/@egovernments/digit-ui-css@1.0.72-campaign/dist/index.css" />
<link rel="stylesheet" href="https://unpkg.com/@egovernments/digit-ui-css@1.0.74-campaign/dist/index.css" />

<link rel="stylesheet" href="https://unpkg.com/@egovernments/digit-ui-css@1.0.50-microplan/dist/index.css" />

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@egovernments/digit-ui-css",
"version": "1.0.72-campaign",
"version": "1.0.73-campaign",
"license": "MIT",
"main": "dist/index.css",
"author": "Jagankumar <jagan.kumar@egov.org.in>",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,17 @@
background-color: #fbe9e6;
border-color: #dc5a32;
}

.subBoundarycomp-container{
display:inline-flex;
flex-wrap:wrap;
gap:0.125rem;
}

.view-more{
text-decoration: underline;
cursor:pointer;
color:orange;
margin-top: 0.2rem;
}

Original file line number Diff line number Diff line change
Expand Up @@ -2575,3 +2575,46 @@ $border-color: rgba(214, 213, 212, 1);
font-weight: bold;
font-size: 1.2em;
}

.mp-description{
margin-top: 2rem;
margin-bottom: 1rem;
}

.assumptions-label-field > div > span {
width: 20rem;
font-size: 1.2rem;
margin-right: 2rem;
font-weight: bold;
}

.delete-button {
display: flex;
cursor: pointer;
margin-left: 1rem;
font-size: 1.2rem;
}

.fieldv1-container{
display: flex;
justify-content: center;
width:30rem;
align-items: center;
}

.assumptionsForm-label-field{
display: flex;
flex-direction: column;
gap: 1.5rem;
align-items: start !important;
}
.assumptionsForm-label-field > div > span{
font-size: 1.5rem;
font-weight: bold;
}

.assumptionsForm-card{
background-color:#FAFAFA;
border: 1px solid #D6D5D4;
}

Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import MicroplanDetails from "./components/MicroplanDetails";
import CampaignDetails from "./components/CampaignDetails";
import { ProviderContext } from "./utils/context";
import BoundarySelection from "./components/BoundarySelection";
import AssumptionsForm from "./components/AssumptionsForm";
import HypothesisWrapper from "./components/HypothesisWrapper";
import UploadDataCustom from "./components/UploadDataCustom";
import DataMgmtTable from "./components/DataMgmtTable";
Expand All @@ -16,6 +17,8 @@ import HeaderComp from "./components/HeaderComp";
import FormulaSection from "./components/FormulaSectionCard";
import FormulaView from "./components/FormulaView";
import SummaryScreen from "./pages/employee/SummaryScreen";
import CampaignBoundary from "./components/CampaignBoundary";


export const MicroplanModule = ({ stateCode, userType, tenants }) => {
const { path, url } = useRouteMatch();
Expand Down Expand Up @@ -55,14 +58,16 @@ const componentsToRegister = {
CampaignDetails,
MicroplanDetails,
BoundarySelection,
AssumptionsForm,
HypothesisWrapper,
UploadDataCustom,
DataMgmtTable,
FileComponent,
HeaderComp,
FormulaView,
FormulaSection,
SummaryScreen
SummaryScreen,
CampaignBoundary


};
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
import React, { useState, useEffect, Fragment } from "react";
import { useTranslation } from "react-i18next";
import { Card, Header, LabelFieldPair } from "@egovernments/digit-ui-react-components";
import { Dropdown, RadioButtons } from "@egovernments/digit-ui-components";
import { useMyContext } from "../utils/context";

const AssumptionsForm = ({ onSelect, ...props }) => {
const { state } = useMyContext();
const { t } = useTranslation();
const optionsForProcesses = state.ResourceDistributionStrategy;
const optionsForRegistrationDistributionMode = state.RegistrationAndDistributionHappeningTogetherOrSeparately;
const [selectedRegistrationProcess, setSelectedRegistrationProcess] = useState(props?.props?.sessionData?.ASSUMPTIONS_FORM?.assumptionsForm?.selectedRegistrationProcess || false);
const [selectedDistributionProcess, setSelectedDistributionProcess] = useState(props?.props?.sessionData?.ASSUMPTIONS_FORM?.assumptionsForm?.selectedDistributionProcess || false);
const [selectedRegistrationDistributionMode, setSelectedRegistrationDistributionMode] = useState(props?.props?.sessionData?.ASSUMPTIONS_FORM?.assumptionsForm?.selectedRegistrationDistributionMode || false);
const [executionCount, setExecutionCount] = useState(0);
const resourceDistributionStrategyCode = props?.props?.sessionData?.CAMPAIGN_DETAILS?.campaignDetails?.distributionStrat?.resourceDistributionStrategyCode;

useEffect(() => {
if (executionCount < 5) {
onSelect(props.props.name, {selectedRegistrationProcess,selectedDistributionProcess,selectedRegistrationDistributionMode})
setExecutionCount((prevCount) => prevCount + 1);
}
});


useEffect(()=>{

if(resourceDistributionStrategyCode === "MIXED"){
onSelect(props.props.name, {selectedRegistrationProcess,selectedDistributionProcess,selectedRegistrationDistributionMode})
return;
}

onSelect(props.props.name,{selectedRegistrationDistributionMode} )

},[selectedDistributionProcess, selectedRegistrationDistributionMode, selectedRegistrationProcess, resourceDistributionStrategyCode])




const filteredOptions = resourceDistributionStrategyCode === "MIXED"
? optionsForProcesses.filter(option => option.resourceDistributionStrategyName !== "Fixed post & House-to-House")
: optionsForProcesses;


return (
<Card>
<Header>{t("PROVIDE_DETAILS")}</Header>
<p className="mp-description">{t("ANSWER_TO_PROVIDE_ESTIMATE")}</p>

{/* Show dropdowns only if the code is MIXED */}
{resourceDistributionStrategyCode === "MIXED" && (
<>
{/* Dropdown for Registration Process */}
<Card className="assumptionsForm-card">
<LabelFieldPair className="assumptionsForm-label-field">
<div style={{ width: "100%" }}>
<span>{t("REGISTRATION_PROCESS")} </span>
<span className="mandatory-span" style={{ marginLeft: "0rem" }}>*</span>
</div>
<Dropdown
variant="select-dropdown"
t={t}
isMandatory={true}
option={filteredOptions.map(item => ({
code: item.resourceDistributionStrategyCode,
value: item.resourceDistributionStrategyName,
}))}
select={(value) => {
setSelectedRegistrationProcess(value);
}}
selected={selectedRegistrationProcess}
optionKey="code"
showToolTip={true}
style={{ width: "25rem" }}
/>
</LabelFieldPair>
</Card>

{/* Dropdown for Distribution Process */}
<Card className="assumptionsForm-card">
<LabelFieldPair className="assumptionsForm-label-field">
<div style={{ width: "100%" }}>
<span>{t("DISTRIBUTION_PROCESS")} </span>
<span className="mandatory-span" style={{ marginLeft: "0rem" }}>*</span>
</div>
<Dropdown
variant="select-dropdown"
t={t}
isMandatory={true}
option={filteredOptions.map(item => ({
code: item.resourceDistributionStrategyCode,
value: item.resourceDistributionStrategyName,
}))}
select={(value) => {
setSelectedDistributionProcess(value);
}}
selected={selectedDistributionProcess}
optionKey="code"
showToolTip={true}
style={{ width: "25rem" }}
/>
</LabelFieldPair>
</Card>
</>
)}

{/* Show radio buttons only if the code is HOUSE_TO_HOUSE or FIXED_POST */}
{["HOUSE_TO_HOUSE", "FIXED_POST", "MIXED"].includes(resourceDistributionStrategyCode) && (
<Card className="assumptionsForm-card">
<LabelFieldPair className="assumptionsForm-label-field">
<div style={{ width: "100%" }}>
<span>{t("REGISTRATION_AND_DISTRIBUTION")} </span>
<span className="mandatory-span" style={{ marginLeft: "0rem" }}>*</span>
</div>
<RadioButtons
isMandatory={true}
additionalWrapperClass="custom-box"
innerStyles={{ borderBottom: "0.063rem solid rgba(214, 213, 212, 1)" }}
options={optionsForRegistrationDistributionMode?.map(item => ({
code: item.registrationAndDistributionHappeningTogetherOrSeparatelyCode,
value: item.registrationAndDistributionHappeningTogetherOrSeparatelyName,
}))}
optionsKey="code"
style={{ display: "flex", gap: "15rem" }}
onSelect={(value) => {
setSelectedRegistrationDistributionMode(value);
}}
selectedOption={selectedRegistrationDistributionMode}
/>
</LabelFieldPair>
</Card>
)}
</Card>
);
};

export default AssumptionsForm;




Loading

0 comments on commit 8e22724

Please sign in to comment.