Skip to content

Commit

Permalink
Merge branch 'console' into abi1-28-11
Browse files Browse the repository at this point in the history
  • Loading branch information
abishekTa-egov committed Nov 28, 2024
2 parents f90e506 + 5ab0b40 commit 6dcd51d
Show file tree
Hide file tree
Showing 19 changed files with 522 additions and 59 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<title>DIGIT</title>
<link rel="stylesheet" href="https://unpkg.com/@egovernments/[email protected]/dist/index.css" />
<link rel="stylesheet" href="https://unpkg.com/@egovernments/[email protected]/dist/index.css" />
<link rel="stylesheet" href="https://unpkg.com/@egovernments/[email protected].46/dist/index.css" />
<link rel="stylesheet" href="https://unpkg.com/@egovernments/[email protected].49/dist/index.css" />

<!-- added below css for hcm-workbench module inclusion-->
<!-- <link rel="stylesheet" href="https://unpkg.com/@egovernments/[email protected]/dist/index.css" /> -->
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@egovernments/digit-ui-health-css",
"version": "0.1.46",
"version": "0.1.49",
"license": "MIT",
"main": "dist/index.css",
"author": "Jagankumar <[email protected]>",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -421,3 +421,9 @@ tbody tr:last-child td:last-child .digit-dropdown-employee-select-wrap .digit-dr
.mp-heading-bold{
font-weight: 700;
}

.accessibility-pop-up{
.digit-popup-children-wrap{
overflow: visible !important;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2595,7 +2595,7 @@ $border-color: rgba(214, 213, 212, 1);
.kpi-container {
display: flex;
flex-direction: row;
justify-content: space-between;
justify-content: space-around;
gap: 1rem;
overflow-x: auto;
padding: 8px;
Expand All @@ -2606,7 +2606,14 @@ $border-color: rgba(214, 213, 212, 1);
text-align: center;
display: grid;
justify-content: center;
flex-shrink: 0;
flex-shrink: 0;

.kpi-text {
font-size: 1rem;
line-height: 1.2;
text-align: center;
}

}

.kpi-card h2 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
@import "./pages/employee/campaign.scss";
@import "./pages/employee/formulaConfig.scss";
@import "./pages/employee/microplanInbox.scss";

@import "./pages/employee/fetchFromMicroplan.scss";
@import "./pages/employee/checklist.scss";
@import "./pages/employee/mapview.scss";
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
/* login screen issue*/

.primary-label-btn {
color: theme(digitv2.lightTheme.primary);
color: theme(digitv2.lightTheme.primary) !important;
}

/* landing screen issue*/
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
.fetch-from-microplan{
.h1{
font-size: 32px;
}
.sandbox-loader-screen{
height: 100%;
.sandbox-installation-steps{
margin: 1rem;
}
}

.digit-infobanner-wrap.info{
margin: 1rem 0rem;
max-width: 100%;
}
.bg-loader-with-gap-container{
background: none!important;

.bg-loader{
border: .5rem solid theme(digitv2.lightTheme.primary) !important;
border-top-color: white !important;
}
.bg-loader-text{
color: theme(digitv2.lightTheme.primary) !important;
}

}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect, useState, Fragment } from "react";
import React, { useEffect, useState } from "react";
import { CheckCircle } from "@egovernments/digit-ui-svg-components";
import { useHistory, useLocation } from "react-router-dom";
import { useTranslation } from "react-i18next";
Expand All @@ -7,9 +7,10 @@ import { InfoCard, Toast } from "@egovernments/digit-ui-components";
import { callTemplateDownloadByUntilCompleted } from "../utils/pollUtils";
import { fetchFromMicroplan, searchCampaign, waitForSomeTime } from "../hooks/useFetchFromMicroplan";

const TEMPLATE_GENERATION_STEP = 4;
const TEMPLATE_GENERATION_STEP = 5;
const FACILITY_DATA_STEP = 6;
const MICROPLAN_FETCH_STEP = 7;
const MICROPLAN_STOP_STEP = 9;
const MICROPLAN_FETCH_TIMEOUT = 8000;

const FetchFromMicroplanScreen = () => {
Expand All @@ -23,6 +24,7 @@ const FetchFromMicroplanScreen = () => {
const tenantId = Digit.ULBService.getCurrentTenantId();
const [templates, setTemplates] = useState(null);
const [microplan, setMicroplan] = useState(null);
const [aleastOneTemplateFilled, setAleastOneTemplateFilled] = useState(false);

const [completed, setCompleted] = useState(null);
const [showToast, setShowToast] = useState(null);
Expand All @@ -31,16 +33,20 @@ const FetchFromMicroplanScreen = () => {
const steps = [
"FETCHING_CAMPAIGN_DATA_FROM_MICROPLAN",
"FETCHING_CAMPAIGN_TYPE_FROM_MICROPLAN",
"FETCHING_CAMPAIGN_TARGET_FROM_MICROPLAN",
"FETCHING_CAMPAIGN_BOUNDARIRES_FROM_MICROPLAN",
"CREATING_CAMPAIGN_BASED_ON_MICROPLAN",
"GENERATING_ALL_THE_TEMPLATES",
"DOWNLOAD_THE_TARGET_TEMPLATE",
"FILLING_CAMPAIGN_TARGET_DATA_FROM_MICROPLAN",
"FETCHING_CAMPAIGN_TARGET_FROM_MICROPLAN",
"FETCHING_CAMPAIGN_FACILITY_FROM_MICROPLAN",
"FETCHING_CAMPAIGN_USER_FROM_MICROPLAN",
"FETCHED_ALLMAPPING_DATA_FROM_MICROPLAN",
"DOWNLOAD_THE_FACILITY_TEMPLATE",
"FILLING_CAMPAIGN_FACILITY_DATA_FROM_MICROPLAN",
"DOWNLOAD_THE_TARGET_TEMPLATE",
"FILLING_CAMPAIGN_TARGET_DATA_FROM_MICROPLAN",
"DOWNLOAD_THE_USER_TEMPLATE",
"FETCHING_CAMPAIGN_USER_FROM_MICROPLAN",
"FILLING_CAMPAIGN_USER_DATA_FROM_MICROPLAN",
"VALIDATING_THE_USER_TEMPLATE",
"UPDATED_CAMPAIGN_WITH_UPLODAED_DATA",
"CMN_ALL_DATA_FETCH_DONE",
];
Expand Down Expand Up @@ -103,16 +109,15 @@ const FetchFromMicroplanScreen = () => {
});

// Show loading state
setShowToast({ key: "info", label: t("FETCHING_MICROPLAN_DATA") });

setTimeout(() => {
// Ensure progressive updates
setCurrentStep((prev) => MICROPLAN_FETCH_STEP);
setShowToast({ key: "info", label: t("FETCHING_MICROPLAN_DATA") });
}, MICROPLAN_FETCH_TIMEOUT);
} catch (error) {
console.error("Error fetching microplan data:", error);
setShowToast({ key: "error", label: t("ERROR_FETCHING_MICROPLAN") });

}
};
if (templates?.completed) {
Expand Down Expand Up @@ -155,7 +160,7 @@ const FetchFromMicroplanScreen = () => {
currentStep < steps.length &&
currentStep !== TEMPLATE_GENERATION_STEP &&
currentStep !== FACILITY_DATA_STEP &&
currentStep !== steps.length - 2
currentStep !== MICROPLAN_STOP_STEP
) {
setCurrentStep((prev) => prev + 1);
}
Expand All @@ -167,19 +172,19 @@ const FetchFromMicroplanScreen = () => {

useEffect(() => {
const fetchCampaign = async () => {
if (currentStep === steps.length - 2 && completed == null) {
if (currentStep === MICROPLAN_STOP_STEP && completed == null) {
try {
const response = await searchCampaign(
data?.updatedCampaignData?.id,
data?.updatedCampaignData?.tenantId
);
if (response?.resources && response?.resources?.length ==3) {
const response = await searchCampaign(data?.updatedCampaignData?.id, data?.updatedCampaignData?.tenantId);
if (response?.resources && response?.resources?.length == 3) {
setCompleted({ ...response });
setCurrentStep((curr) => curr + 1);
} else {
setShowToast({ key: "warning", label: t("SOME_ERROR_OCCURED_IN_FETCH_RETRYING") });
setCurrentStep(TEMPLATE_GENERATION_STEP);
}
if (response?.resources && response?.resources?.length > 0) {
setAleastOneTemplateFilled(true);
}
} catch (error) {
console.error("Error fetching campaign:", error);
setShowToast({ key: "error", label: t("ERROR_FETCHING_CAMPAIGN") });
Expand Down Expand Up @@ -207,24 +212,23 @@ const FetchFromMicroplanScreen = () => {
setShowToast(null);
};
return (
<>
<Header styles={{ fontSize: "32px" }}>{t("MY_FETCH_FROM_MICROPLAN_HEADING")}</Header>
<span className="fetch-from-microplan">
<Header>{t("MY_FETCH_FROM_MICROPLAN_HEADING")}</Header>
<InfoCard
populators={{
name: "infocard",
}}
variant="info"
text={t("HCM_FETCH_FROM_PLAN_INFO")}
style={{ marginTop: "1rem", maxWidth: "100%", marginBottom: "1rem" }}
/>

<div className="sandbox-loader-screen" style={{ height: "100%" }}>
<div className="sandbox-loader-screen ">
{showToast?.key != "error" && <LoaderWithGap text={t("DATA_FECTHING_FROM_SERVER")} />}
<ul className="sandbox-installation-steps" style={{ margin: "1rem" }}>
<ul className="sandbox-installation-steps">
{steps.map((step, index) => (
<li key={index} className={`sandbox-step ${index < currentStep ? "sandbox-visible" : ""}`}>
<span className="sandbox-step-text">{t(step)}</span>
{index < currentStep && <CheckCircle fill="#00703C" />}
{index + 1 < currentStep && (aleastOneTemplateFilled || index < TEMPLATE_GENERATION_STEP) && <CheckCircle fill="#00703C" />}
</li>
))}
<li key={currentStep + 1} className={`sandbox-step ${0 < currentStep ? "sandbox-visible" : ""}`}>
Expand All @@ -235,7 +239,7 @@ const FetchFromMicroplanScreen = () => {
</ul>
</div>
{showToast && <Toast type={showToast?.key} label={t(showToast?.label)} onClose={closeToast} />}
</>
</span>
);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -531,17 +531,17 @@ const FormulaConfiguration = ({ onSelect, category, customProps, formulas: initi
return;
}

if (selectedDeletedFormula?.code === "NEW_FORMULA" && !(selectedDeletedFormula?.name && /^(?=.*[a-zA-Z])[a-zA-Z0-9]+(?: [a-zA-Z0-9]+)*$/.test(selectedDeletedFormula?.name))) {
setShowToast({
key: "error",
label: t("MP_FORMULA_NAME_INVALID") ,
transitionTime: 3000,
style: {
zIndex: 1000000
}
});
return
}
// if (selectedDeletedFormula?.code === "NEW_FORMULA" && !(selectedDeletedFormula?.name && /^(?=.*[a-zA-Z])[a-zA-Z0-9]+(?: [a-zA-Z0-9]+)*$/.test(selectedDeletedFormula?.name))) {
// setShowToast({
// key: "error",
// label: t("MP_FORMULA_NAME_INVALID") ,
// transitionTime: 3000,
// style: {
// zIndex: 1000000
// }
// });
// return
// }


if (selectedDeletedFormula?.code === "NEW_FORMULA" && selectedDeletedFormula?.name?.length > 100) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import React from 'react';
import { Card } from '@egovernments/digit-ui-components';
import { Loader } from '@egovernments/digit-ui-react-components';
import { useTranslation } from 'react-i18next';
import useKpiDssSearch from '../hooks/useKpiDssSearch';

const GenericKpiFromDSS = (props) => {
const { module, planId, campaignType, planEmployee={}, boundariesForKpi=[] } = props;

// Create a copy of the boundariesForKpi array
const localBoundariesForKpi = [...boundariesForKpi];


if (localBoundariesForKpi.length === 0) {
const hierarchyLevel = planEmployee?.planData?.[0]?.hierarchyLevel;
const jurisdictionCodes = planEmployee?.planData?.[0]?.jurisdiction;
if(jurisdictionCodes?.length > 0 && hierarchyLevel){
for (const code of jurisdictionCodes) {
localBoundariesForKpi.push({
type: hierarchyLevel,
code: code
});
}
}
}

const { t } = useTranslation();

const { data, loader } = useKpiDssSearch({
module,
planId,
campaignType,
boundariesForKpi: localBoundariesForKpi
});

if (loader) {
return <Loader />
}

return (
data ? (
<Card>
<div className="kpi-container">
{Object.keys(data || {}).map((key) => (
<div key={key} className="kpi-card">
<h2>{String(data[key] || 0).padStart(2, '0')}</h2>
<p className="kpi-text">{t(key)}</p>
</div>
))}
</div>
</Card>
) : null
);

};

export default GenericKpiFromDSS;
Original file line number Diff line number Diff line change
Expand Up @@ -401,17 +401,17 @@ const Hypothesis = ({ category, assumptions: initialAssumptions, setShowToast, a


//alphanumeric name of assumption
if (selectedDeletedAssumption?.code === "NEW_ASSUMPTION" && !(selectedDeletedAssumption?.name && /^(?=.*[a-zA-Z])[a-zA-Z0-9]+(?: [a-zA-Z0-9]+)*$/.test(selectedDeletedAssumption?.name))) {
setShowToast({
key: "error",
label: t("MP_ASSUMPTION_NAME_INVALID") ,
transitionTime: 3000,
style: {
zIndex: 1000000
}
});
return
}
// if (selectedDeletedAssumption?.code === "NEW_ASSUMPTION" && !(selectedDeletedAssumption?.name && /^(?=.*[a-zA-Z])[a-zA-Z0-9]+(?: [a-zA-Z0-9]+)*$/.test(selectedDeletedAssumption?.name))) {
// setShowToast({
// key: "error",
// label: t("MP_ASSUMPTION_NAME_INVALID") ,
// transitionTime: 3000,
// style: {
// zIndex: 1000000
// }
// });
// return
// }

//If no issues then go ahead and add assumption
addNewAssumption();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ const AccessibilityPopUp = ({ onClose, census, onSuccess, disableEditing=false }
return (
<>
<PopUp
className='accessibility-pop-up'
onClose={onClose}
heading={t(`HCM_MICROPLAN_VILLAGE_ACCESSIBILITY_LABEL`)}
children={[
Expand Down
Loading

0 comments on commit 6dcd51d

Please sign in to comment.