From 2ccbccb261c19e2b351d737f92e35732c5b78fa1 Mon Sep 17 00:00:00 2001 From: Nipun Arora Date: Thu, 17 Oct 2024 20:30:22 +0530 Subject: [PATCH] updates --- .../example/public/index.html | 2 +- .../example/src/UICustomizations.js | 180 +++++++++--- .../packages/css/src/index.scss | 2 +- .../src/pages/employee/microplanInbox.scss | 5 + .../packages/modules/microplan/package.json | 2 +- .../microplan/src/components/PopInboxTable.js | 260 ++++++++++++++++++ .../microplan/src/configs/UICustomizations.js | 9 +- .../microplan/src/pages/employee/PopInbox.js | 71 ++++- 8 files changed, 472 insertions(+), 59 deletions(-) create mode 100644 health/micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/microplanInbox.scss create mode 100644 health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/PopInboxTable.js diff --git a/health/micro-ui/web/micro-ui-internals/example/public/index.html b/health/micro-ui/web/micro-ui-internals/example/public/index.html index 4682ab968dd..6fa3dfe4d19 100644 --- a/health/micro-ui/web/micro-ui-internals/example/public/index.html +++ b/health/micro-ui/web/micro-ui-internals/example/public/index.html @@ -17,7 +17,7 @@ - + diff --git a/health/micro-ui/web/micro-ui-internals/example/src/UICustomizations.js b/health/micro-ui/web/micro-ui-internals/example/src/UICustomizations.js index 4af07067209..98fc947c1d4 100644 --- a/health/micro-ui/web/micro-ui-internals/example/src/UICustomizations.js +++ b/health/micro-ui/web/micro-ui-internals/example/src/UICustomizations.js @@ -2,6 +2,7 @@ import _ from "lodash"; import { useLocation, useHistory,Link,useParams } from "react-router-dom"; import React from "react"; import { Dropdown } from "@egovernments/digit-ui-components"; +import { DeleteIconv2, DownloadIcon, FileIcon, Button, Card, CardSubHeader,EditIcon,ArrowForward } from "@egovernments/digit-ui-react-components"; //create functions here based on module name set in mdms(eg->SearchProjectConfig) //how to call these -> Digit?.Customizations?.[masterName]?.[moduleName] // these functions will act as middlewares @@ -778,21 +779,37 @@ export const UICustomizations = { data.body.PlanConfigurationSearchCriteria.status = status?.status; cleanObject(data.body.PlanConfigurationSearchCriteria); + const dic = { '0': null, '1': ["DRAFT"], '2': ["EXECUTION_TO_BE_DONE"], '3': ["CENSUS_DATA_APPROVAL_IN_PROGRESS", "CENSUS_DATA_APPROVED", "RESOURCE_ESTIMATION_IN_PROGRESS"], "4": ["RESOURCE_ESTIMATIONS_APPROVED"] } + const url = Digit.Hooks.useQueryParams(); + + const tabId = url.tabId || '0'; // Default to '0' if tabId is undefined + data.body.PlanConfigurationSearchCriteria.status = dic[String(tabId)]; + cleanObject(data.body.PlanConfigurationSearchCriteria) return data; }, additionalCustomizations: (row, key, column, value, t, searchResult) => { if (key === "Actions") { + // `/${window.contextPath}/employee/microplan/setup-microplan?key=${9}&preview=${true}&action=${false}` return ( { console.log(e, "event") }} + select={(e) => { + console.log(e, "event"); // e contains the selected option + if (e.code === "1") { + // Use window.location.href to navigate + window.location.href = `/${window.contextPath}/employee/microplan/setup-microplan?key=${1}&preview=${true}&action=${false}µplanId=${row.id}&campaignId=${row.CampaignDetails.id}`; + } + if (e.code === "2") { + // Use window.location.href to navigate + window.location.href = `/${window.contextPath}/employee/microplan/setup-microplan?key=${9}&preview=${true}&action=${false}µplanId=${row.id}&campaignId=${row.CampaignDetails.id}`; + } + }} optionKey={"name"} selected={{ code: "1", name: "Actions" }} - > + /> //

$${value}

); @@ -825,31 +842,124 @@ export const UICustomizations = { }, }, + MyMicroplanSearchConfig: { + preProcess: (data, additionalDetails) => { + const { name, status } = data?.state?.searchForm || {}; + + data.body.PlanConfigurationSearchCriteria = {}; + data.body.PlanConfigurationSearchCriteria.limit = data?.state?.tableForm?.limit; + // data.body.PlanConfigurationSearchCriteria.limit = 10 + data.body.PlanConfigurationSearchCriteria.offset = data?.state?.tableForm?.offset; + data.body.PlanConfigurationSearchCriteria.name = name; + data.body.PlanConfigurationSearchCriteria.tenantId = Digit.ULBService.getCurrentTenantId(); + data.body.PlanConfigurationSearchCriteria.userUuid = Digit.UserService.getUser().info.uuid; + // delete data.body.PlanConfigurationSearchCriteria.pagination + data.body.PlanConfigurationSearchCriteria.status = status?.status; + cleanObject(data.body.PlanConfigurationSearchCriteria); + + const dic = { '0': null, '1': ["DRAFT"], '2': ["EXECUTION_TO_BE_DONE"], '3': ["CENSUS_DATA_APPROVAL_IN_PROGRESS", "CENSUS_DATA_APPROVED", "RESOURCE_ESTIMATION_IN_PROGRESS"], "4": ["RESOURCE_ESTIMATIONS_APPROVED"] } + const url = Digit.Hooks.useQueryParams(); + + const tabId = url.tabId || '0'; // Default to '0' if tabId is undefined + data.body.PlanConfigurationSearchCriteria.status = dic[String(tabId)]; + cleanObject(data.body.PlanConfigurationSearchCriteria) + return data; + }, + additionalCustomizations: (row, key, column, value, t, searchResult) => { + if (key === "Actions") { + // `/${window.contextPath}/employee/microplan/setup-microplan?key=${9}&preview=${true}&action=${false}` + return ( + + row.status === "DRAFT" ? (