Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
 into console
  • Loading branch information
Bhavya-egov committed Nov 14, 2024
2 parents 3f88737 + af070ec commit 34c2409
Show file tree
Hide file tree
Showing 33 changed files with 344 additions and 116 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].33/dist/index.css" />
<link rel="stylesheet" href="https://unpkg.com/@egovernments/[email protected].34/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
Expand Up @@ -982,6 +982,7 @@ export const UICustomizations = {
label={t("START")}
variation="secondary"
icon={"ArrowForward"}
style={{minWidth:"240px"}}
type="button"
isDisabled={!hasRequiredRole}
// className="dm-workbench-download-template-btn dm-hover"
Expand All @@ -992,6 +993,7 @@ export const UICustomizations = {
label={t("WBH_DOWNLOAD")}
variation="secondary"
icon={"FileDownload"}
style={{minWidth:"240px"}}
type="button"
// className="dm-workbench-download-template-btn dm-hover"
onClick={(e) => onActionSelect("DOWNLOAD", row)}
Expand All @@ -1001,6 +1003,7 @@ export const UICustomizations = {
label={t("WBH_EDIT")}
variation="secondary"
icon={"Edit"}
style={{minWidth:"240px"}}
type="button"
// className="dm-workbench-download-template-btn dm-hover"
onClick={(e) => onActionSelect("EDIT", row)}
Expand Down Expand Up @@ -1257,6 +1260,30 @@ export const UICustomizations = {
return null;
}
},
getFacilitySearchRequest: ( prop) => {
const tenantId = Digit.ULBService.getCurrentTenantId();
const {campaignId} = Digit.Hooks.useQueryParams();
return {
url: `/project-factory/v1/project-type/search`,
params: { },
body: {
CampaignDetails: {
"tenantId": tenantId,
"ids": [
campaignId
]
}
},
changeQueryName: `boundarySearchForPlanFacility`,
config: {
enabled: true,
select: (data) => {
const result = data?.CampaignDetails?.[0]?.boundaries?.filter((item) => item.type == prop.lowestHierarchy) || [];
return result
},
},
};
}
},
MyMicroplanSearchConfigExample: {
test: "yes",
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.33",
"version": "0.1.34",
"license": "MIT",
"main": "dist/index.css",
"author": "Jagankumar <[email protected]>",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2661,7 +2661,7 @@ $border-color: rgba(214, 213, 212, 1);

.digit-dropdown-employee-select-wrap.roleTableCell {
.digit-dropdown-options-card {
position: fixed;
position: absolute;
max-width: 14rem;
}
}
Expand All @@ -2673,7 +2673,7 @@ $border-color: rgba(214, 213, 212, 1);

.digit-multiselectdropdown-server {
top: unset !important;
position: fixed !important;
position: absolute !important;
max-width: unset !important;
max-height: 15rem !important;
width: 14rem !important;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,4 +211,8 @@
.search-component-table::-webkit-scrollbar-thumb {
background-color: #d6d5d4;
border-radius: 0.563rem;
}

.digit-topbar .digit-logo-ulb-wrapper .digit-topbar-logo{
width: fit-content !important;
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState, useEffect, Fragment, useContext } from "react";
import React, { useState, useEffect, Fragment, useContext, useMemo } from "react";
import { useTranslation } from "react-i18next";
import { DustbinIcon } from "./icons/DustbinIcon";
import { PRIMARY_COLOR } from "../utils";
Expand All @@ -9,6 +9,7 @@ import Dropdowns from "./Dropdowns";
import { QuestionContext } from "./CreateQuestionContext";



// field selector for multiselect and signle select component.
const FieldSelector = ({ type, name, value, onChange, placeholder = "", t, field, dispatchQuestionData,
subQclassName,
Expand Down Expand Up @@ -246,13 +247,34 @@ const CreateQuestion = ({ onSelect, className, level = 1, initialQuestionData, p
const role = searchParams.get("role");
let locale = Digit?.SessionStorage.get("initData")?.selectedLanguage || "en_IN";
const { questionData, dispatchQuestionData } = useContext(QuestionContext);
const dataType = [
// { code: "String" },
{ code: "SingleValueList" },
{ code: "MultiValueList" },
// { code: "Short Answer" },
// { code: "Dropdown" }
];

const mdms_context_path = window?.globalConfigs?.getConfig("MDMS_V2_CONTEXT_PATH") || "mdms-v2";

const reqCriteria = useMemo(() => ({
url: `/${mdms_context_path}/v2/_search`,
body: {
MdmsCriteria: {
tenantId: tenantId,
schemaCode: "HCM-ADMIN-CONSOLE.appFieldTypes",
isActive: true
}
}
}), [tenantId]); // Only recreate if tenantId changes

// Use the custom hook with memoized criteria
const { isLoading1, data: mdmsData, isFetching1 } = Digit.Hooks.useCustomAPIHook(reqCriteria);

// Memoize the dataType array based on the API response
const dataType = useMemo(() => {
if (!mdmsData) return [
{ code: "SingleValueList" },
{ code: "MultiValueList" }
];
return mdmsData.mdms?.map(role => ({
code: role?.data?.code
})) || [];
}, [mdmsData]); // Only recompute when mdmsData changes

const regexOption = [
{
code: "TEXT_ONLY",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
MdmsCriteria: {
tenantId: tenantId,
schemaCode: `HCM-ADMIN-CONSOLE.ChecklistTemplates`,
isActive: true,
filters : {},
limit: 10,
offset: 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ const useBoundaryHome = ({ screenType = "campaign", defaultHierarchyType = "", h
MdmsCriteria: {
tenantId: tenantId,
schemaCode: `${CONSOLE_MDMS_MODULENAME}.HierarchySchema`,
isActive: true
},
},
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ const CreateChecklist = () => {
filters: {
role: role,
checklistType: checklistType
}
},
isActive: true
}
},
});
Expand Down Expand Up @@ -329,6 +330,9 @@ const CreateChecklist = () => {
return upperCaseString.replace(/ /g, '_');
});
}
if(String(item?.type?.code) === "SingleValueList"){
labelsArray.push("NOT_SELECTED");
}

const questionObject = {
id: item.id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ const SearchChecklist = () => {
MdmsCriteria: {
tenantId: tenantId,
schemaCode: `${CONSOLE_MDMS_MODULENAME}.rolesForChecklist`,
isActive: true
}
}
};
Expand All @@ -71,7 +72,8 @@ const SearchChecklist = () => {
MdmsCriteria: {
tenantId: tenantId,
schemaCode: "HCM.CHECKLIST_TYPES",
filters: {"type": "DEFAULT"}
filters: {"type": "DEFAULT"},
isActive: true
}
},
changeQueryName: "HCM"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ const UpdateChecklist = () => {
let nvd = formatted_data.filter((value, index, self) =>
index === self.findIndex((t) => t.id === value.id)
);
console.log("nvd", nvd);
return nvd;
}
}
Expand Down Expand Up @@ -277,6 +276,9 @@ const UpdateChecklist = () => {
return upperCaseString.replace(/ /g, '_');
});
}
if(String(item?.type?.code) === "SingleValueList"){
labelsArray.push("NOT_SELECTED");
}

const questionObject = {
id: item.id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,22 @@ const FormulaConfigWrapper = ({ onSelect, props: customProps }) => {
setCustomFormula(temp);
}, [formulaInternalKey, formulaConfigValues]);


useEffect(() => {
const handleKeyDown = (event) => {
if (event.key === "Enter") {
event.preventDefault(); // Prevent default Enter key behavior globally
}
};

document.addEventListener("keydown", handleKeyDown);

// Cleanup the event listener on component unmount
return () => {
document.removeEventListener("keydown", handleKeyDown);
};
}, []);

const navigateBack = () => {
if (formulaInternalKey > 1) {
setFormulaInternalKey((prevKey) => prevKey - 1);
Expand Down Expand Up @@ -473,7 +489,7 @@ const FormulaConfigWrapper = ({ onSelect, props: customProps }) => {
</Card>
<Card className="vertical-stepper-card">
<Stepper
customSteps={ruleConfigurationCategories.map((category) => category.category)}
customSteps={ruleConfigurationCategories.map((category) => `FORMULA_${category.category}`)}
currentStep={formulaInternalKey}
onStepClick={() => null}
direction={"vertical"}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const Hypothesis = ({ category, assumptions: initialAssumptions, setShowToast, a
setAssumptions(initialAssumptions);
}, [initialAssumptions]);

const handleDeleteClick = (index) => {
const handleDeleteClick = (index, item) => {
if (assumptions?.length === 1 && category !== "CAMPAIGN_VEHICLES") {
//atleast one assumption in each category has to be mandatory to support draft functionality
setShowToast({
Expand All @@ -48,7 +48,7 @@ const Hypothesis = ({ category, assumptions: initialAssumptions, setShowToast, a
return;
}
setAssumptionToDelete(index);
setShowPopUp(true);
setShowPopUp(assumptionValues?.find((i) => i.key === item)?.source || true);
};

const handleCancelDelete = () => {
Expand Down Expand Up @@ -153,7 +153,7 @@ const Hypothesis = ({ category, assumptions: initialAssumptions, setShowToast, a
{assumptions.map((item, index) => {
const sourceCheck = assumptionValues?.find((i) => i?.key === item)?.source;
return (
<LabelFieldPair className="mp-hypothesis-label-field" style={{ alignItems: "center"}} key={index}>
<LabelFieldPair className="mp-hypothesis-label-field" style={{ alignItems: "center" }} key={index}>
<div className="assumption-label">
<span>
{`${t(item)}`}
Expand All @@ -179,10 +179,15 @@ const Hypothesis = ({ category, assumptions: initialAssumptions, setShowToast, a
onChange={(event) => {
handleAssumptionChange(category, event, item);
}}
onKeyDown={(event) => {
if (event.key === "Enter") {
event.preventDefault(); // Prevent form submission on Enter
}
}}
/>
<div className="hypothesis-delete-button">
<DeleteIconv2 />
<span style={{ color: "#B91900", textDecoration: "Underline" }} onClick={() => handleDeleteClick(index)}>
<span style={{ color: "#B91900", textDecoration: "Underline" }} onClick={() => handleDeleteClick(index, item)}>
{t("DELETE")}
</span>
</div>
Expand All @@ -209,7 +214,7 @@ const Hypothesis = ({ category, assumptions: initialAssumptions, setShowToast, a
equalWidthButtons={true}
children={[
<div>
<CardText style={{ margin: 0 }}>{t("HYP_PERMANENT_DELETE")}</CardText>
<CardText style={{ margin: 0 }}>{showPopUP === "CUSTOM" ? t(`HYP_PERMANENT_DELETE_CUSTOM`) : t("HYP_PERMANENT_DELETE")}</CardText>
</div>,
]}
onOverlayClick={() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,22 @@ const HypothesisWrapper = ({ onSelect, props: customProps }) => {
}
);


useEffect(() => {
const handleKeyDown = (event) => {
if (event.key === "Enter") {
event.preventDefault(); // Prevent default Enter key behavior globally
}
};

document.addEventListener("keydown", handleKeyDown);

// Cleanup the event listener on component unmount
return () => {
document.removeEventListener("keydown", handleKeyDown);
};
}, []);

useEffect(() => {
const tc = assumptionCategories[internalKey - 1]?.category;
const temp = assumptionValues?.filter((i) => i.category === tc && i.source === "CUSTOM")?.map((i) => i.key) || [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const MicroplanDetails = ({ onSelect, props: customProps, ...props }) => {
);
const [executionCount, setExecutionCount] = useState(0);
const { campaignId, microplanId, key, ...queryParams } = Digit.Hooks.useQueryParams();
const [isFreezed, setIsFreezed] = useState(campaignId && microplanId ? true : false);
//const [isFreezed, setIsFreezed] = useState(campaignId && microplanId ? true : false);
const campaignData = customProps?.sessionData?.CAMPAIGN_DETAILS?.campaignDetails;
const campaignCard = [
{
Expand Down Expand Up @@ -119,7 +119,7 @@ const MicroplanDetails = ({ onSelect, props: customProps, ...props }) => {
placeholder={t("MICROPLAN_NAME_INPUT_PLACEHOLDER")}
value={microplan}
onChange={onChangeMicroplanName}
disabled={isFreezed}
// disabled={isFreezed}
/>
</div>
</LabelFieldPair>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ const PopInboxTable = ({ ...props }) => {
},
width: "180px",
},
{
name: t("INBOX_ASSIGNEE"),
selector: (row, index) => props?.employeeNameData?.[row?.assignee] || t("ES_COMMON_NA"),
sortable: true,
width: "180px",
},
...(
(props?.censusData?.[0]?.additionalFields || [])
.filter((field) => field.showOnUi)
Expand Down Expand Up @@ -101,12 +107,6 @@ const PopInboxTable = ({ ...props }) => {
sortable: false,
width: "180px",
},
{
name: t("INBOX_ASSIGNEE"),
selector: (row, index) => props?.employeeNameData?.[row?.assignee] || t("ES_COMMON_NA"),
sortable: true,
width: "180px",
},
];
}, [props.showEditColumn, props.employeeNameData, props.censusData]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ function RoleTableComposer({ nationalRoles }) {
</Card>

{/* {isLoading || isHrmsLoading ? <LoaderOverlay /> : null} */}
<Card style={{ boxShadow: "none", padding: "0px" }}>
<Card style={{ overflow: "visible", boxShadow: "none", padding: "0px" }}>
<DataTable
columns={columns}
data={HrmsData?.data}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ const SearchJurisdiction = ({ boundaries, jurisdiction, onSubmit = () => { }, on
} = useMyContext();

//hierarchy dropdowns for this jurisdiction
const [hierarchy, setHierarchy] = useState(
Digit.Utils.microplanv1.getFilteredHierarchy(boundaryHierarchy, jurisdiction.boundaryType, hierarchyType)
);
const hierarchy = Digit.Utils.microplanv1.getFilteredHierarchy(boundaryHierarchy, jurisdiction.boundaryType, hierarchyType);
const [boundaryOptions, setBoundaryOptions] = useState([]);

const [selectedBoundaries, setSelectedBoundaries] = useState([]);
Expand Down
Loading

0 comments on commit 34c2409

Please sign in to comment.