Skip to content

Commit

Permalink
consoles removed
Browse files Browse the repository at this point in the history
  • Loading branch information
suryansh-egov committed Jan 31, 2025
1 parent 113eefd commit a27768b
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 91 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ function SelectingBoundaries({ onSelect, formData, ...props }) {
const isDraft = searchParams.get("draft");
const draftBoundary = searchParams.get("draftBoundary");

console.log("propjjjjjjs", props);

function updateUrlParams(params) {
const url = new URL(window.location.href);
Object.entries(params).forEach(([key, value]) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,84 +1,4 @@
// import React from "react";

// // Fetch hierarchies from MDMS
// const fetchHierarchies = async () => {
// // Return early if data already exists
// if (window.hierarchyData) {
// return window.hierarchyData;
// }

// const tenantId = Digit.ULBService.getStateId();

// try {
// const response = await Digit.CustomService.getResponse({
// url: '/mdms-v2/v1/_search',
// params: {},
// body: {
// MdmsCriteria: {
// tenantId,
// moduleDetails: [{
// moduleName: "HCM-ADMIN-CONSOLE",
// masterDetails: [{
// name: "HierarchySchema"
// }]
// }]
// }
// }
// });
// window.hierarchyData = response?.MdmsRes?.["HCM-ADMIN-CONSOLE"]?.HierarchySchema || [];
// return window.hierarchyData;
// } catch (error) {
// console.error("Error fetching hierarchies:", error);
// window.hierarchyData = [];
// return [];
// }
// };

// const fetchEmployeeDetails = async () => {
// // Return early if data already exists
// if (window.employeeDetails) {
// return window.employeeDetails;
// }

// const HRMS_CONTEXT_PATH = window?.globalConfigs?.getConfig("HRMS_CONTEXT_PATH") || "egov-hrms";
// const tenantId = Digit.ULBService.getStateId();
// try {
// const userName = Digit.UserService.getUser()?.info?.userName;
// const res = await Digit.CustomService.getResponse({
// url: `/${HRMS_CONTEXT_PATH}/employees/_search`,
// params: {
// tenantId: tenantId,
// codes: userName,
// sortOrder: "ASC",
// },
// body: {},
// });
// window.employeeDetails = res?.Employees?.[0];
// return res?.Employees?.[0];
// } catch (error) {
// console.error("Error fetching employee details:", error);
// return null;
// }
// };

// // Initialize data once
// const initializeData = () => {
// if (!window.dataInitialized) {
// Promise.all([
// fetchEmployeeDetails(),
// fetchHierarchies()
// ]).then(() => {
// window.dataInitialized = true;
// });
// }
// };

export const CampaignConfig = (totalFormData, dataParams, isSubmitting, summaryErrors, hierarchyData, allHierarchy, employeeDetails) => {

// initializeData();
console.log("hierachy dta from setup", allHierarchy);
console.log("employee det frmo setup", employeeDetails);


return [
{
Expand All @@ -103,8 +23,6 @@ export const CampaignConfig = (totalFormData, dataParams, isSubmitting, summaryE
isSubmitting: isSubmitting,
employeeDetails: employeeDetails,
allHierarchy: allHierarchy
// getEmployeeDetails: () => window.employeeDetails, // Function to get employee details
// getHierarchies: () => window.hierarchyData // Function to get hierarchies
},
populators: {
name: "projectType",
Expand Down Expand Up @@ -212,7 +130,6 @@ export const CampaignConfig = (totalFormData, dataParams, isSubmitting, summaryE
hierarchyData: hierarchyData,
employeeDetails: employeeDetails,
allHierarchy: allHierarchy
// getEmployeeDetails: () => window.employeeDetails // Function to get employee details
},
populators: {
name: "boundaryType",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ const fetchBoundaryHierarchy = async (hierarchyType, tenantId) => {
};

const fetchEmployeeDetails = async (userName, tenantId) => {
console.log("inside");
try {
// Second API Call: Fetch Service Definitions
const res = await Digit.CustomService.getResponse({
Expand All @@ -56,7 +55,6 @@ const fetchEmployeeDetails = async (userName, tenantId) => {
},
body: {},
});
console.log("Res is", res);
return res?.Employees?.[0];
} catch (error) {
console.error("Error fetching service definition:", error);
Expand Down Expand Up @@ -114,7 +112,6 @@ const useBoundaryHome = ({ screenType = "campaign", defaultHierarchyType = "", h
hierarchyName,
defaultHierarchyName
};
console.log("merged data", mergedData);
resolve(mergedData);
});
} catch (error) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,7 @@ const BoundaryHome = () => {
const type=searchParams.get("type")|| config?.type;

const {isLoading,data,error}=Digit.Hooks.campaign.useBoundaryHome({ screenType: type,defaultHierarchyType:searchParams?.get("defaultHierarchyType"),hierarchyType:searchParams?.get("hierarchyType"),userName:Digit.UserService.getUser()?.info?.userName,tenantId });
useEffect(()=>{
console.log("hehehihihi", data);
}, [data])

if (isLoading) return <Loader />;

return (
Expand Down

0 comments on commit a27768b

Please sign in to comment.