Skip to content

Commit

Permalink
adding utils and remove hardcoding module name (#1984)
Browse files Browse the repository at this point in the history
* adding utils and remove hardcoding module name

* Update UICustomizations.js

* Update index.js

---------

Co-authored-by: NabeelAyubee <nayubi7@gmail.com>
Co-authored-by: Jagankumar <53823168+jagankumar-egov@users.noreply.github.com>
  • Loading branch information
3 people authored Dec 6, 2024
1 parent acbfd80 commit d1a4c20
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { Button as ButtonNew, Dropdown } from "@egovernments/digit-ui-components
// these functions will act as middlewares
// var Digit = window.Digit || {};


const businessServiceMap = {
"muster roll": "MR",
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ const CampaignModule = ({ stateCode, userType, tenants }) => {
const tenantId = Digit.ULBService.getCurrentTenantId();
const { data: BOUNDARY_HIERARCHY_TYPE , isLoading: hierarchyLoading } = Digit.Hooks.useCustomMDMS(tenantId, CONSOLE_MDMS_MODULENAME, [{
name: "HierarchySchema",
"filter": "[?(@.type=='console')]"
"filter": `[?(@.type==${window.Digit.Utils.campaign.getModuleName()})]`
}], {
select: (data) => {
return data?.[CONSOLE_MDMS_MODULENAME]?.HierarchySchema?.[0]?.hierarchy;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,15 +107,15 @@ const DateWithBoundary = ({ onSelect, formData, ...props }) => {
const [selectedBoundaries, setSelectedBoundaries] = useState(null);
const { data: BOUNDARY_HIERARCHY_TYPE } = Digit.Hooks.useCustomMDMS(tenantId, CONSOLE_MDMS_MODULENAME, [{
name: "HierarchySchema",
"filter": "[?(@.type=='console')]"
"filter": `[?(@.type==${window.Digit.Utils.campaign.getModuleName()})]`
}], {
select: (data) => {
return data?.[CONSOLE_MDMS_MODULENAME]?.HierarchySchema?.[0]?.hierarchy;
},
},{ schemaCode: `${CONSOLE_MDMS_MODULENAME}.HierarchySchema` });
const { isLoading, data: HierarchySchema } = Digit.Hooks.useCustomMDMS(tenantId, CONSOLE_MDMS_MODULENAME, [{
name: "HierarchySchema",
"filter": "[?(@.type=='console')]"
"filter": `[?(@.type==${window.Digit.Utils.campaign.getModuleName()})]`
}],{select:(MdmsRes)=>MdmsRes},{ schemaCode: `${CONSOLE_MDMS_MODULENAME}.HierarchySchema` });
const lowestHierarchy = useMemo(() => {
return HierarchySchema?.[CONSOLE_MDMS_MODULENAME]?.HierarchySchema?.[0]?.lowestHierarchy;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function SelectingBoundaries({ onSelect, formData, ...props }) {
const [loaderEnabled, setLoaderEnabled] = useState(false);
const { isLoading, data: HierarchySchema } = Digit.Hooks.useCustomMDMS(tenantId, CONSOLE_MDMS_MODULENAME,[{
name: "HierarchySchema",
"filter": "[?(@.type=='console')]"
"filter": `[?(@.type==${window.Digit.Utils.campaign.getModuleName()})]`
}],{select:(MdmsRes)=>MdmsRes},{ schemaCode: `${CONSOLE_MDMS_MODULENAME}.HierarchySchema` });

const lowestHierarchy = useMemo(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const SelectingBoundariesDuplicate = ({ onSelect, formData, ...props }) => {
const hierarchyType = props?.props?.dataParams?.hierarchyType;
const { data: HierarchySchema } = Digit.Hooks.useCustomMDMS(tenantId, CONSOLE_MDMS_MODULENAME, [{
name: "HierarchySchema",
"filter": "[?(@.type=='console')]"
"filter": `[?(@.type==${window.Digit.Utils.campaign.getModuleName()})]`
}],{select:(MdmsRes)=>MdmsRes},{ schemaCode: `${CONSOLE_MDMS_MODULENAME}.HierarchySchema` });
const { data: mailConfig } = Digit.Hooks.useCustomMDMS(tenantId, CONSOLE_MDMS_MODULENAME, [{ name: "mailConfig" }],{select:(MdmsRes)=>MdmsRes},{ schemaCode: `${CONSOLE_MDMS_MODULENAME}.mailConfig` });
const lowestHierarchy = useMemo(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const UpdateBoundaryWrapper = ({ onSelect,...props }) => {
// const hierarchyType = props?.props?.hierarchyType;
const { data: HierarchySchema } = Digit.Hooks.useCustomMDMS(tenantId, CONSOLE_MDMS_MODULENAME, [{
name: "HierarchySchema",
"filter": "[?(@.type=='console')]"
"filter": `[?(@.type==${window.Digit.Utils.campaign.getModuleName()})]`
}],{select:(MdmsRes)=>MdmsRes},{ schemaCode: `${CONSOLE_MDMS_MODULENAME}.HierarchySchema` });
const [selectedData, setSelectedData] = useState(props?.props?.sessionData?.HCM_CAMPAIGN_SELECTING_BOUNDARY_DATA?.boundaryType?.selectedData || []);
const [boundaryOptions, setBoundaryOptions] = useState(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const businessServiceMap = {};

const inboxModuleNameMap = {};

const HCM_MODULE_NAME = "console";

const updateServiceDefinition = async (tenantId, newStatus, sdcode) => {
try {
Expand Down Expand Up @@ -59,6 +60,7 @@ const retryCampaign = async (row,searchResult) => {
}
};
export const UICustomizations = {
HCM_MODULE_NAME,
MyChecklistSearchConfig: {

preProcess: (data, additionalDetails) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const SetupCampaign = ({ hierarchyType, hierarchyData }) => {
const [active, setActive] = useState(0);
const { data: HierarchySchema } = Digit.Hooks.useCustomMDMS(tenantId, CONSOLE_MDMS_MODULENAME, [{
name: "HierarchySchema",
"filter": "[?(@.type=='console')]"
"filter": `[?(@.type==${window.Digit.Utils.campaign.getModuleName()})]`
}],{select:(MdmsRes)=>MdmsRes},
{ schemaCode: `${CONSOLE_MDMS_MODULENAME}.HierarchySchema` });
const lowestHierarchy = useMemo(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const UpdateCampaign = ({hierarchyData }) => {
const [active, setActive] = useState(0);
const { data: HierarchySchema } = Digit.Hooks.useCustomMDMS(tenantId, CONSOLE_MDMS_MODULENAME, [{
name: "HierarchySchema",
"filter": "[?(@.type=='console')]"
"filter": `[?(@.type==${window.Digit.Utils.campaign.getModuleName()})]`
}],{select:(MdmsRes)=>MdmsRes},{ schemaCode: `${CONSOLE_MDMS_MODULENAME}.HierarchySchema` });
const [hierarchyType, setHierarchyType] = useState();
const lowestHierarchy = useMemo(() => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import _ from "lodash";
import { downloadExcelWithCustomName } from "./downloadExcel";

export default { downloadExcelWithCustomName };
export default {
downloadExcelWithCustomName,
getModuleName: () => {
return window?.Digit?.Customizations?.commonUiConfig?.["HCM_MODULE_NAME"] || "console";
},
};
export { downloadExcelWithCustomName };
export const PRIMARY_COLOR = "#C84C0E";

0 comments on commit d1a4c20

Please sign in to comment.