diff --git a/build/build-config.yml b/build/build-config.yml index 3ec0f0f411..af446afed4 100644 --- a/build/build-config.yml +++ b/build/build-config.yml @@ -102,7 +102,7 @@ config: dockerfile: "build/maven/Dockerfile" image-name: "measurement-service" - work-dir: "backend/measurement-service/src/main/resources/db" - image-name: "measurement-service-db" + image-name: "measurement-service-db" - name: "builds/digit-works/backend/measurement-registry" build: diff --git a/frontend/micro-ui/web/micro-ui-internals/example/.env-unified b/frontend/micro-ui/web/micro-ui-internals/example/.env-unified new file mode 100644 index 0000000000..6d5a65ccb6 --- /dev/null +++ b/frontend/micro-ui/web/micro-ui-internals/example/.env-unified @@ -0,0 +1,8 @@ +SKIP_PREFLIGHT_CHECK=true +REACT_APP_USER_TYPE=EMPLOYEE +REACT_APP_EMPLOYEE_TOKEN=c835932f-2ad4-4d05-83d6-49e0b8c59f8a +REACT_APP_CITIZEN_TOKEN=7cd58aae-30b3-41ed-a1b3-3417107a993c +REACT_APP_PROXY_API=https://unified-dev.digit.org +REACT_APP_PROXY_ASSETS=https://unified-dev.digit.org +REACT_APP_GLOBAL=https://s3.ap-south-1.amazonaws.com/works-dev-asset/globalConfigsWorks.js +REACT_APP_CONTEXT=works \ No newline at end of file diff --git a/frontend/micro-ui/web/micro-ui-internals/example/package.json b/frontend/micro-ui/web/micro-ui-internals/example/package.json index b8bc3238e5..c733399295 100644 --- a/frontend/micro-ui/web/micro-ui-internals/example/package.json +++ b/frontend/micro-ui/web/micro-ui-internals/example/package.json @@ -14,13 +14,14 @@ "@egovernments/digit-ui-module-hrms": "1.5.26", "@egovernments/digit-ui-module-dss": "1.5.52", "@egovernments/digit-ui-react-components": "^1.5.0", - "@egovernments/digit-ui-module-attendencemgmt": "0.2.5", - "@egovernments/digit-ui-module-contracts": "0.2.10", - "@egovernments/digit-ui-module-estimate": "0.2.1", - "@egovernments/digit-ui-module-masters": "0.2.24", - "@egovernments/digit-ui-module-project": "0.2.9", - "@egovernments/digit-ui-module-expenditure": "0.2.25", - "@egovernments/digit-ui-customisation-mukta": "0.2.0", + "@egovernments/digit-ui-module-attendencemgmt": "0.3.1", + "@egovernments/digit-ui-module-contracts": "0.3.5", + "@egovernments/digit-ui-module-measurement":"0.1.0", + "@egovernments/digit-ui-module-estimate": "0.3.27", + "@egovernments/digit-ui-module-masters": "0.3.1", + "@egovernments/digit-ui-module-project": "0.3.4", + "@egovernments/digit-ui-module-expenditure": "0.3.2", + "@egovernments/digit-ui-customisation-mukta": "0.2.1", "http-proxy-middleware": "^1.0.5", "react": "17.0.2", "react-dom": "17.0.2", diff --git a/frontend/micro-ui/web/micro-ui-internals/example/src/UICustomizations.js b/frontend/micro-ui/web/micro-ui-internals/example/src/UICustomizations.js index e38c0164e5..7e3342cb75 100644 --- a/frontend/micro-ui/web/micro-ui-internals/example/src/UICustomizations.js +++ b/frontend/micro-ui/web/micro-ui-internals/example/src/UICustomizations.js @@ -1,5 +1,7 @@ +import React from "react"; import { Link } from "react-router-dom"; import _ from "lodash"; +import { Amount } 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] @@ -24,8 +26,9 @@ const businessServiceMap = { "works.wages":"EXPENSE.WAGES", "works.purchase":"EXPENSE.PURCHASE", "works.supervision":"EXPENSE.SUPERVISION", - revisedWO:"CONTRACT-REVISION" -}; + revisedWO:"CONTRACT-REVISION", + measurement : "MB" +}; const inboxModuleNameMap = { "mukta-estimate": "estimate-service", @@ -144,6 +147,31 @@ export const UICustomizations = { workflow, }; } + if (businessService === businessServiceMap?.measurement) { + const workflow = { + comment: data.comments, + documents: data?.documents?.map((document) => { + return { + documentType: action?.action + " DOC", + fileName: document?.[1]?.file?.name, + fileStoreId: document?.[1]?.fileStoreId?.fileStoreId, + documentUid: document?.[1]?.fileStoreId?.fileStoreId, + tenantId: document?.[1]?.fileStoreId?.tenantId, + }; + }), + assignees: data?.assignees?.uuid ? [data?.assignees?.uuid] : null, + action: action.action, + }; + //filtering out the data + Object.keys(workflow).forEach((key, index) => { + if (!workflow[key] || workflow[key]?.length === 0) delete workflow[key]; + }); + // ap[0] = {...ap[0]wor:{}} + applicationDetails[0] = {...applicationDetails[0],"workflow" : workflow} + return { + measurements: applicationDetails + }; + } }, enableModalSubmit:(businessService,action,setModalSubmit,data)=>{ if(businessService === businessServiceMap?.["muster roll"] && action.action==="APPROVE"){ @@ -189,6 +217,9 @@ export const UICustomizations = { else if (moduleCode?.includes("revisedWO")) { return businessServiceMap?.["revisedWO"]; } + else if (moduleCode?.includes("measurement")) { + return businessServiceMap?.measurement; + } else { return businessServiceMap; } @@ -611,15 +642,266 @@ export const UICustomizations = { } }, }, + + + + + SearchMeasurementConfig: { + preProcess: (data) => { + + // console.log(data); + const mbNumber=data?.body?.Individual?.MBNumber || null; + const refId= data?.body?.Individual?.MBReference || null; + + data.body.criteria = { + "tenantId": Digit.ULBService.getCurrentTenantId() , + "measurementNumber": mbNumber, + + }; + data.body.pagination = { + "limit": 10, + "offSet": 0, + "sortBy": "string", + "order": "DESC" + }; + data.body.params = {}; + + return data; + + }, + additionalCustomizations: (row, key, column, value, t, searchResult) => { + // console.log(key,value); + //here we can add multiple conditions + //like if a cell is link then we return link + //first we can identify which column it belongs to then we can return relevant result + switch (key) { + case "MB_REFERENCE_NUMBER": + return ( + + + {value ? value : t("ES_COMMON_NA")} + + + ); + + case "MASTERS_SOCIAL_CATEGORY": + return value ? {String(t(`MASTERS_${value}`))} : t("ES_COMMON_NA"); + + case "CORE_COMMON_PROFILE_CITY": + return value ? {String(t(Digit.Utils.locale.getCityLocale(value)))} : t("ES_COMMON_NA"); + + case "MASTERS_WARD": + return value ? ( + {String(t(Digit.Utils.locale.getMohallaLocale(value, row?.tenantId)))} + ) : ( + t("ES_COMMON_NA") + ); + + case "MASTERS_LOCALITY": + return value ? ( + {String(t(Digit.Utils.locale.getMohallaLocale(value, row?.tenantId)))} + ) : ( + t("ES_COMMON_NA") + ); + default: + return t("NA"); + } + }, + MobileDetailsOnClick: (row, tenantId) => { + let link; + Object.keys(row).map((key) => { + if (key === "MASTERS_WAGESEEKER_ID") + link = `/${window.contextPath}/employee/masters/view-wageseeker?tenantId=${tenantId}&wageseekerId=${row[key]}`; + }); + return link; + }, + additionalValidations: (type, data, keys) => { + if (type === "date") { + return data[keys.start] && data[keys.end] ? () => new Date(data[keys.start]).getTime() <= new Date(data[keys.end]).getTime() : true; + } + }, + }, + + InboxMeasurementConfig: { + preProcess: (data) => { + let moduleSearchCriteria = data.body.inbox.moduleSearchCriteria; + + const statusValues = Object.keys(moduleSearchCriteria?.status || {}).filter(key => moduleSearchCriteria.status[key]); + moduleSearchCriteria = { + ...(moduleSearchCriteria?.measurementNumber && { measurementNumber: moduleSearchCriteria?.measurementNumber?.trim() }), + ...(moduleSearchCriteria?.projectType?.code && { projectType: moduleSearchCriteria?.projectType?.code }), + ...(moduleSearchCriteria?.projectId && { projectId: moduleSearchCriteria?.projectId?.trim() }), + ...(moduleSearchCriteria?.assignee?.code === "ASSIGNED TO ME" && { assignee: Digit.UserService.getUser().info.uuid }), + ...(moduleSearchCriteria?.ward?.length > 0 && { ward: moduleSearchCriteria.ward?.map(e => e?.code) }), + ...(statusValues.length > 0 && { status: statusValues }) + } + data.body.inbox.moduleSearchCriteria = { ...moduleSearchCriteria }; + data.body.inbox.moduleSearchCriteria.tenantId = Digit.ULBService.getCurrentTenantId(); + return data; + }, + additionalCustomizations: (row, key, column, value, t, searchResult) => { + + const tenantId = searchResult[0]?.ProcessInstance?.tenantId; + + switch (key) { + case "MB_REFERENCE_NUMBER": + const state = row?.ProcessInstance?.state?.state; + const contractNumber = row?.businessObject?.referenceId + return ( + + {/* {Digit.Utils.statusBasedNavigation(state, contractNumber, value, tenantId, value)} */} + + ); + case "MB_ASSIGNEE": + return value ? {value?.[0]?.name} : {t("NA")}; + case "MB_WORKFLOW_STATE": + return {t(value)}; + case "MB_AMOUNT": + return + case "MB_SLA_DAYS_REMAINING": + return value > 0 ? {value} : {value}; + default: + return t("ES_COMMON_NA"); + } + }, + additionalValidations: (type, data, keys) => { + if (type === "date") { + return data[keys.start] && data[keys.end] ? () => new Date(data[keys.start]).getTime() <= new Date(data[keys.end]).getTime() : true; + } + }, + MobileDetailsOnClick: (row, tenantId) => { + let link; + Object.keys(row).map((key) => { + if (key === "ESTIMATE_ESTIMATE_NO") + link = `/${window.contextPath}/employee/estimate/estimate-details?tenantId=${tenantId}&estimateNumber=${row[key] + }`; + }); + return link; + }, + }, + + WMSSearchMeasurementConfig: { + + customValidationCheck: (data) => { + //checking both to and from date are present + const { createdFrom, createdTo } = data; + if ((createdFrom === "" && createdTo !== "") || ( createdFrom!== "" && createdTo === "")) + return { warning: true, label: "ES_COMMON_ENTER_DATE_RANGE" }; + + return false; + }, + + preProcess: (data) => { + const mbNumber=data?.body?.inbox?.measurementNumber || null; + const refId= data?.body?.Individual?.referenceId || null; + + + return data; + + }, + additionalCustomizations: (row, key, column, value, t, searchResult) => { + // console.log(key,value); + // console.log(row,"qwertyuiop"); + + //here we can add multiple conditions + //like if a cell is link then we return link + //first we can identify which column it belongs to then we can return relevant result + + const tenantId = searchResult[0]?.ProcessInstance?.tenantId; + + switch (key) { + case "MB_NUMBER": + const state = row?.ProcessInstance?.state?.state; + const contractNumber = row?.businessObject?.referenceId + return ( + + {Digit.Utils.statusBasedNavigation(state , contractNumber, value, tenantId, value)} + + ); + case "MB_AMOUNT": + return value ? {value} : t("ES_COMMON_NA"); + case "MB_STATUS": + return {t(value)}; + case "MASTERS_SOCIAL_CATEGORY": + return value ? {String(t(`MASTERS_${value}`))} : t("ES_COMMON_NA"); + + case "CORE_COMMON_PROFILE_CITY": + return value ? {String(t(Digit.Utils.locale.getCityLocale(value)))} : t("ES_COMMON_NA"); + + case "MASTERS_WARD": + return value ? ( + {String(t(Digit.Utils.locale.getMohallaLocale(value, row?.tenantId)))} + ) : ( + t("ES_COMMON_NA") + ); + + case "MASTERS_LOCALITY": + return value ? ( + {String(t(Digit.Utils.locale.getMohallaLocale(value, row?.tenantId)))} + ) : ( + t("ES_COMMON_NA") + ); + default: + return t("NA"); + } + }, + MobileDetailsOnClick: (row, tenantId) => { + let link; + Object.keys(row).map((key) => { + if (key === "MASTERS_WAGESEEKER_ID") + link = `/${window.contextPath}/employee/masters/view-wageseeker?tenantId=${tenantId}&wageseekerId=${row[key]}`; + }); + return link; + }, + additionalValidations: (type, data, keys) => { + if (type === "date") { + return data[keys.start] && data[keys.end] ? () => new Date(data[keys.start]).getTime() <= new Date(data[keys.end]).getTime() : true; + } + }, + populateReqCriteria: () => { + + const tenantId = Digit.ULBService.getCurrentTenantId(); + + + return { + url: "/egov-workflow-v2/egov-wf/businessservice/_search", + params: { tenantId, businessServices: Digit?.Customizations?.["commonUiConfig"]?.getBusinessService("measurement") }, + body: { + + }, + config: { + enabled: true, + select: (data) => { + const states = data?.BusinessServices?.[0]?.states?.filter(state=> state.state)?.map(state=> { + return { + // "i18nKey":`${Digit?.Customizations?.["commonUiConfig"]?.getBusinessService("MB")}${state?.state}`, + "i18nKey":state?.state, + + "wfStatus":state?.state + } + }) + return states + }, + }, + }; + }, + }, + + + + + SearchOrganisationConfig: { preProcess: (data) => { // const createdFrom = Digit.Utils.pt.convertDateToEpoch(data.body.Projects[0]?.createdFrom); // const createdTo = Digit.Utils.pt.convertDateToEpoch(data.body.Projects[0]?.createdTo); // data.params = { ...data.params, tenantId: Digit.ULBService.getCurrentTenantId() }; data.body.SearchCriteria = { ...data.body.SearchCriteria, tenantId: Digit.ULBService.getCurrentTenantId() }; + return data; }, additionalCustomizations: (row, key, column, value, t, searchResult) => { + //here we can add multiple conditions //like if a cell is link then we return link //first we can identify which column it belongs to then we can return relevant result @@ -640,6 +922,7 @@ export const UICustomizations = { ) : ( t("ES_COMMON_NA") ); + case "CORE_COMMON_STATUS": return value ? {String(t(`MASTERS_${value}`))} : t("ES_COMMON_NA"); diff --git a/frontend/micro-ui/web/micro-ui-internals/example/src/index.js b/frontend/micro-ui/web/micro-ui-internals/example/src/index.js index ff426a4dc6..1bee73eab7 100644 --- a/frontend/micro-ui/web/micro-ui-internals/example/src/index.js +++ b/frontend/micro-ui/web/micro-ui-internals/example/src/index.js @@ -10,20 +10,22 @@ import { initDSSComponents } from "@egovernments/digit-ui-module-dss"; // import { initWorksComponents } from "@egovernments/digit-ui-module-works"; import { initAttendenceMgmtComponents } from "@egovernments/digit-ui-module-attendencemgmt"; import { initExpenditureComponents } from "@egovernments/digit-ui-module-expenditure"; -import { initEstimateComponents } from "@egovernments/digit-ui-module-estimate"; import { initContractsComponents } from "@egovernments/digit-ui-module-contracts"; import { DigitUI } from "@egovernments/digit-ui-module-core"; import { initHRMSComponents } from "@egovernments/digit-ui-module-hrms"; import { initMastersComponents } from "@egovernments/digit-ui-module-masters"; -import { initProjectComponents } from "@egovernments/digit-ui-module-project"; +import { initProjectComponents } from "@egovernments/digit-ui-module-project"; +import { initEstimateComponents } from "@egovernments/digit-ui-module-estimate"; + import "@egovernments/digit-ui-works-css/example/index.css"; -import {initMuktaCustomisations} from "@egovernments/digit-ui-customisation-mukta"; +import { initMeasurementComponents } from "@egovernments/digit-ui-module-measurement"; +import { initMuktaCustomisations } from "@egovernments/digit-ui-customisation-mukta"; // import * as comps from "@egovernments/digit-ui-react-components"; // import { subFormRegistry } from "@egovernments/digit-ui-libraries"; -import { pgrCustomizations } from "./pgr"; +import { pgrCustomizations } from "./pgr"; import { UICustomizations } from "./UICustomizations"; var Digit = window.Digit || {}; @@ -37,7 +39,9 @@ const enabledModules = [ "Estimate", "Project", "Mukta", - "DSS" + "DSS", + "Sample", + "Measurement", // "Engagement" ]; @@ -82,6 +86,7 @@ const initDigitUI = () => { initAttendenceMgmtComponents(); initHRMSComponents(); initContractsComponents(); + initMeasurementComponents(); initExpenditureComponents(); initMastersComponents(); initProjectComponents(); @@ -95,14 +100,17 @@ const initDigitUI = () => { customiseRenewalCreateFormData: (formData, licenceObject) => licenceObject, customiseSendbackFormData: (formData, licenceObject) => licenceObject, }, - commonUiConfig: UICustomizations + commonUiConfig: UICustomizations, }; const registry = window?.Digit.ComponentRegistryService.getRegistry(); const stateCode = window?.globalConfigs?.getConfig("STATE_LEVEL_TENANT_ID") || "pb"; initTokens(stateCode); initMuktaCustomisations(); - ReactDOM.render(, document.getElementById("root")); + ReactDOM.render( + , + document.getElementById("root") + ); }; initLibraries().then(() => { diff --git a/frontend/micro-ui/web/micro-ui-internals/example/src/setupProxy.js b/frontend/micro-ui/web/micro-ui-internals/example/src/setupProxy.js index 640336516f..6ba5da4972 100644 --- a/frontend/micro-ui/web/micro-ui-internals/example/src/setupProxy.js +++ b/frontend/micro-ui/web/micro-ui-internals/example/src/setupProxy.js @@ -12,6 +12,7 @@ const assetsProxy = createProxyMiddleware({ changeOrigin: true, secure: false, }); + module.exports = function (app) { [ "/access/v1/actions/mdms", @@ -87,7 +88,10 @@ module.exports = function (app) { "/egov-pdf/bill/_search", "/expense-calculator/v1/_search", "/expense/payment/", - "/expense-calculator/" + "/expense-calculator/", + "/measurement-service/", + "/mukta-services/", + "/mdms-v2/" ].forEach((location) => app.use(location, createProxy)); ["/pb-egov-assets"].forEach((location) => app.use(location, assetsProxy)); }; diff --git a/frontend/micro-ui/web/micro-ui-internals/package.json b/frontend/micro-ui/web/micro-ui-internals/package.json index a5eaa8bcb3..ec013614b1 100644 --- a/frontend/micro-ui/web/micro-ui-internals/package.json +++ b/frontend/micro-ui/web/micro-ui-internals/package.json @@ -7,9 +7,10 @@ "example", "packages/css", "packages/react-components", + "packages/modules/Measurement", "packages/modules/Estimate", "packages/modules/Expenditure", - "packages/Mukta" + "packages/Mukta" ], "author": "JaganKumar ", "license": "MIT", @@ -26,14 +27,15 @@ "publish:css": "cd packages/css && yarn publish --access public", "dev:libraries": "cd packages/libraries && yarn start", "dev:components": "cd packages/react-components && yarn start", - "dev:contracts": "cd packages/modules/Contracts && yarn start", - "dev:attendencemgmt": "cd packages/modules/AttendenceMgmt && yarn start", - "dev:masters": "cd packages/modules/Masters && yarn start", - "dev:project": "cd packages/modules/Project && yarn start", + "devD:contracts": "cd packages/modules/Contracts && yarn start", + "devD:attendencemgmt": "cd packages/modules/AttendenceMgmt && yarn start", + "devD:masters": "cd packages/modules/Masters && yarn start", + "dev:measurement": "cd packages/modules/Measurement && yarn start", + "devD:project": "cd packages/modules/Project && yarn start", "dev:estimate": "cd packages/modules/Estimate && yarn start", "dev:mukta": "cd packages/Mukta && yarn start", "devD:works": "cd packages/modules/works && yarn start", - "dev:expenditure": "cd packages/modules/Expenditure && yarn start", + "devD:expenditure": "cd packages/modules/Expenditure && yarn start", "dev:example": "cd example && yarn start", "build": "run-p build:**", "buildD": "run-p buildD:**", @@ -43,6 +45,7 @@ "buildD:contracts": "cd packages/modules/Contracts && yarn build", "buildD:masters": "cd packages/modules/Masters && yarn build", "build:estimate": "cd packages/modules/Estimate && yarn build", + "build:measurement": "cd packages/modules/Measurement && yarn build", "build:mukta": "cd packages/Mukta && yarn build", "buildD:project": "cd packages/modules/Project && yarn build", "buildD:works": "cd packages/modules/works && yarn build", @@ -62,7 +65,7 @@ "*.{js,css,md}": "prettier --write" }, "dependencies": { - "lodash": "4.17.21", + "lodash": "^4.17.21", "microbundle-crl": "0.13.11", "react": "17.0.2", "react-dom": "17.0.2", diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/Mukta/package.json b/frontend/micro-ui/web/micro-ui-internals/packages/Mukta/package.json index d40ea5f176..673e145552 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/Mukta/package.json +++ b/frontend/micro-ui/web/micro-ui-internals/packages/Mukta/package.json @@ -1,6 +1,6 @@ { "name": "@egovernments/digit-ui-customisation-mukta", - "version": "0.2.0", + "version": "0.2.1", "description": "MUKTA Customisation of Works UI", "main": "dist/index.js", "module": "dist/index.modern.js", diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/Mukta/src/Module.js b/frontend/micro-ui/web/micro-ui-internals/packages/Mukta/src/Module.js index a587716242..2fd2d94d3d 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/Mukta/src/Module.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/Mukta/src/Module.js @@ -29,7 +29,8 @@ const componentsToRegister = { WorksCard, DSSCard:null, // TO HIDE THE DSS CARD IN HOME SCREEN as per MUKTA AttendenceMgmtCard:null , // TO HIDE THE Attendance Mgmt CARD IN HOME SCREEN as per MUKTA - HRMSCard // Overridden the HRMS card as per MUKTA + HRMSCard, // Overridden the HRMS card as per MUKTA + MeasurementCard:null }; const overrideHooks = () => { diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/Mukta/src/components/WorksCard.js b/frontend/micro-ui/web/micro-ui-internals/packages/Mukta/src/components/WorksCard.js index 5fd7b8e25e..a922565dfb 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/Mukta/src/components/WorksCard.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/Mukta/src/components/WorksCard.js @@ -10,6 +10,8 @@ const ROLES = { BILLS: ["BILL_CREATOR", "BILL_VERIFIER","BILL_APPROVER"], PAYMENT: ["BILL_ACCOUNTANT"], MUSTERROLLS: ["MUSTER_ROLL_VERIFIER", "MUSTER_ROLL_APPROVER"], + MEASUREMENT: ["MB_CREATOR", "MB_VERIFIER", "MB_APPROVER", "MB_VIEWER"], + DSS: ["STADMIN"], }; @@ -27,6 +29,7 @@ const WorksCard = () => { const bsPurchaseBill = Digit?.Customizations?.["commonUiConfig"]?.getBusinessService("works.purchase"); const bsWageBill = Digit?.Customizations?.["commonUiConfig"]?.getBusinessService("works.wages"); const bsSupervisionBill = Digit?.Customizations?.["commonUiConfig"]?.getBusinessService("works.supervision"); + const bsMeasurement = Digit?.Customizations?.["commonUiConfig"]?.getBusinessService("measurement"); const { t } = useTranslation(); @@ -78,6 +81,31 @@ const WorksCard = () => { const { isLoading: isLoadingEstimate, data: dataEstimate } = Digit.Hooks.useCustomAPIHook(requestCriteriaEstimate); + const requestCriteriaMeasurement = { + url: "/inbox/v2/_search", + body: { + inbox: { + tenantId, + processSearchCriteria: { + businessService: [bsMeasurement], + moduleName: "measurement-service", + }, + moduleSearchCriteria: { + tenantId, + }, + limit: 10, + offset: 0, + }, + }, + config: { + enabled: Digit.Utils.didEmployeeHasAtleastOneRole(ROLES.MEASUREMENT), + }, + changeQueryName: "MeasurementInbox", + }; + + const { isLoading: isLoadingMeasurement, data: dataMeasurement } = Digit.Hooks.useCustomAPIHook(requestCriteriaMeasurement); + + const requestCriteriaContract = { url: "/inbox/v2/_search", body: { @@ -144,6 +172,12 @@ const WorksCard = () => { roles: ROLES.CONTRACT, count: isLoadingContract ? "-" : dataContract?.totalCount, }, + { + label: t("ACTION_TEST_5MEASUREMENT"), + link: `/${window?.contextPath}/employee/measurement/inbox`, + roles: ROLES.MEASUREMENT, + count: isLoadingMeasurement? "-" : dataMeasurement?.totalCount, + }, { label: t("ACTION_TEST_4ATTENDENCEMGMT"), link: `/${window?.contextPath}/employee/attendencemgmt/inbox`, diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/Mukta/src/configs/UICustomizations.js b/frontend/micro-ui/web/micro-ui-internals/packages/Mukta/src/configs/UICustomizations.js index d24b17863b..62357d9767 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/Mukta/src/configs/UICustomizations.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/Mukta/src/configs/UICustomizations.js @@ -3,7 +3,6 @@ import _ from "lodash"; import React from "react"; import { Amount, LinkLabel } 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 @@ -12,119 +11,121 @@ var Digit = window.Digit || {}; const businessServiceMap = { estimate: "ESTIMATE", contract: "CONTRACT", + measurement: "MB", "muster roll": "MR", - "works.wages":"EXPENSE.WAGES", - "works.purchase":"EXPENSE.PURCHASE", - "works.supervision":"EXPENSE.SUPERVISION", - revisedWO:"CONTRACT-REVISION" + "works.wages": "EXPENSE.WAGES", + "works.purchase": "EXPENSE.PURCHASE", + "works.supervision": "EXPENSE.SUPERVISION", + revisedWO: "CONTRACT-REVISION", }; const getBillType = (businessService) => { - switch(businessService) { + switch (businessService) { case "EXPENSE.WAGES": - return 'wage' + return "wage"; case "EXPENSE.PURCHASE": - return 'purchase' + return "purchase"; case "EXPENSE.SUPERVISION": - return 'supervision' + return "supervision"; default: - return 'wage'; + return "wage"; } -} -const PAYMENT_UPDATE_STATUS="SUCCESSFUL"; - +}; +const PAYMENT_UPDATE_STATUS = "SUCCESSFUL"; const getCreatePaymentPayload = (data) => { - let payment = {} - payment.tenantId = Digit.ULBService.getCurrentTenantId() - payment.netPayableAmount = 0 - payment.netPaidAmount = 0 - payment.additionalDetails = {} + let payment = {}; + payment.tenantId = Digit.ULBService.getCurrentTenantId(); + payment.netPayableAmount = 0; + payment.netPaidAmount = 0; + payment.additionalDetails = {}; //payment.status = 'INITIATED' - payment.bills = [] - - data?.forEach(item => { - const bill = item - let billObj = {} - billObj.billId = bill?.id - billObj.tenantId = bill?.tenantId - billObj.totalAmount = bill?.totalAmount + payment.bills = []; + + data?.forEach((item) => { + const bill = item; + let billObj = {}; + billObj.billId = bill?.id; + billObj.tenantId = bill?.tenantId; + billObj.totalAmount = bill?.totalAmount; /* temp fix for now before jit integration*/ - billObj.totalPaidAmount = bill?.totalAmount + billObj.totalPaidAmount = bill?.totalAmount; //billObj.status = 'INITIATED' - payment.netPayableAmount=payment.netPayableAmount+bill?.totalAmount; - billObj.billDetails = [] - if(bill?.billDetails?.length > 0) { - bill?.billDetails?.forEach(detail => { - let billDetailObj = {} - billDetailObj.billDetailId = detail?.id //billId - billDetailObj.totalAmount = detail?.totalAmount - /* temp fix for now before jit integration*/ - - billDetailObj.totalPaidAmount = detail?.totalAmount + payment.netPayableAmount = payment.netPayableAmount + bill?.totalAmount; + billObj.billDetails = []; + if (bill?.billDetails?.length > 0) { + bill?.billDetails?.forEach((detail) => { + let billDetailObj = {}; + billDetailObj.billDetailId = detail?.id; //billId + billDetailObj.totalAmount = detail?.totalAmount; + /* temp fix for now before jit integration*/ + + billDetailObj.totalPaidAmount = detail?.totalAmount; //billDetailObj.status = 'INITIATED' - billDetailObj.payableLineItems = detail?.payableLineItems?.filter((row => row.status==="ACTIVE"))?.map(item => ( - { + billDetailObj.payableLineItems = detail?.payableLineItems + ?.filter((row) => row.status === "ACTIVE") + ?.map((item) => ({ lineItemId: item?.id, tenantId: item?.tenantId, paidAmount: item?.amount, //status: 'INITIATED' - } - )) - billDetailObj.additionalDetails = {} - billObj.billDetails.push(billDetailObj) - }) + })); + billDetailObj.additionalDetails = {}; + billObj.billDetails.push(billDetailObj); + }); } - payment.bills.push(billObj) - }) - payment.netPaidAmount=payment.netPayableAmount; - let payload = {payment} - - return payload -} -const getUpdatePaymentPayload = (payment={}) =>{ - if(payment?.status){ - payment.status=PAYMENT_UPDATE_STATUS; + payment.bills.push(billObj); + }); + payment.netPaidAmount = payment.netPayableAmount; + let payload = { payment }; + + return payload; +}; +const getUpdatePaymentPayload = (payment = {}) => { + if (payment?.status) { + payment.status = PAYMENT_UPDATE_STATUS; } - if(payment?.bills){ - payment.bills=payment?.bills?.map(bill=>{ - if(bill?.status){ - bill.status=PAYMENT_UPDATE_STATUS; - } - bill.billDetails= bill.billDetails?.map(billDetail=>{ - if(billDetail?.status){ - billDetail.status=PAYMENT_UPDATE_STATUS; + if (payment?.bills) { + payment.bills = payment?.bills?.map((bill) => { + if (bill?.status) { + bill.status = PAYMENT_UPDATE_STATUS; + } + bill.billDetails = bill.billDetails?.map((billDetail) => { + if (billDetail?.status) { + billDetail.status = PAYMENT_UPDATE_STATUS; } - return {...billDetail} - }) - return {...bill} - }) + return { ...billDetail }; + }); + return { ...bill }; + }); } - return {payment}; -} - -const RetryComponent = ({row,t})=> { - try { - const pdfRegenerateResponse = - row?.paymentId && - (await Digit.ExpenseService.regeneratePDF( - { - Criteria: { - paymentId: row?.paymentId, + return { payment }; +}; + +const RetryComponent = ({ row, t }) => ( + { + try { + const pdfRegenerateResponse = + row?.paymentId && + (await Digit.ExpenseService.regeneratePDF( + { + Criteria: { + paymentId: row?.paymentId, + }, }, - }, - row?.tenantId - )); - console.info(pdfRegenerateResponse); - } catch (error) { - console.error(error, "downloaderror"); - } - }} -> - {t("CS_COMMON_RETRY")} -; + row?.tenantId + )); + console.info(pdfRegenerateResponse); + } catch (error) { + console.error(error, "downloaderror"); + } + }} + > + {t("CS_COMMON_RETRY")} + +); export const UICustomizations = { EstimateInboxConfig: { @@ -133,11 +134,15 @@ export const UICustomizations = { data.body.inbox.tenantId = Digit.ULBService.getCurrentTenantId(); data.body.inbox.processSearchCriteria.tenantId = Digit.ULBService.getCurrentTenantId(); - const estimateNumber = data?.body?.inbox?.moduleSearchCriteria?.estimateNumber?.trim() - if(estimateNumber) data.body.inbox.moduleSearchCriteria.estimateNumber = estimateNumber + const estimateNumber = data?.body?.inbox?.moduleSearchCriteria?.estimateNumber?.trim(); + if (!(data?.body?.inbox?.moduleSearchCriteria?.estimateNumber?.includes("RE")) && estimateNumber) data.body.inbox.moduleSearchCriteria.estimateNumber = estimateNumber; + if (data?.body?.inbox?.moduleSearchCriteria?.estimateNumber?.includes("RE") && estimateNumber) { + data.body.inbox.moduleSearchCriteria.revisionNumber = estimateNumber; + delete data?.body?.inbox?.moduleSearchCriteria?.estimateNumber; + } - const projectId = data?.body?.inbox?.moduleSearchCriteria?.projectId?.trim() - if(projectId) data.body.inbox.moduleSearchCriteria.projectId = projectId + const projectId = data?.body?.inbox?.moduleSearchCriteria?.projectId?.trim(); + if (projectId) data.body.inbox.moduleSearchCriteria.projectId = projectId; // deleting them for now(assignee-> need clarity from pintu,ward-> static for now,not implemented BE side) const assignee = _.clone(data.body.inbox.moduleSearchCriteria.assignee); @@ -146,7 +151,6 @@ export const UICustomizations = { data.body.inbox.moduleSearchCriteria.assignee = Digit.UserService.getUser().info.uuid; } - let ward = _.clone(data.body.inbox.moduleSearchCriteria.ward ? data.body.inbox.moduleSearchCriteria.ward : []); delete data.body.inbox.moduleSearchCriteria.ward; ward = ward?.map((row) => row?.code); @@ -173,32 +177,34 @@ export const UICustomizations = { return data; }, additionalCustomizations: (row, key, column, value, t, searchResult) => { - switch(key){ - case "ESTIMATE_ESTIMATE_NO": + switch (key) { + case "ESTIMATE_ESTIMATE_NO": return ( - - - {String(value ? (column.translate ? t(column.prefix ? `${column.prefix}${value}` : value) : value) : t("ES_COMMON_NA"))} - - + + {/* + {String(value ? (column.translate ? t(column.prefix ? `${column.prefix}${value}` : value) : value) : t("ES_COMMON_NA"))} + */} + {/* here the end condition will be update as backend will add bussinessservice in inbox apo response in business object*/} + {Digit.Utils.statusBasedNavigation(row?.ProcessInstance?.action, row?.businessObject?.additionalDetails?.projectNumber, value, row.ProcessInstance.tenantId, value, value?.includes("RE") || row?.businessObject?.businessService === "REVISION-ESTIMATE" ? "REVISION-ESTIMATE" : "ESTIMATE", row?.businessObject?.estimateNumber)} + ); - case "COMMON_ASSIGNEE": - return value? {value?.[0]?.name} : {t("NA")}; + case "COMMON_ASSIGNEE": + return value ? {value?.[0]?.name} : {t("NA")}; - case "COMMON_WORKFLOW_STATES": + case "COMMON_WORKFLOW_STATES": return {t(`WF_EST_${value}`)}; - case "WORKS_ESTIMATED_AMOUNT": - return + case "WORKS_ESTIMATED_AMOUNT": + return ; - case "COMMON_SLA_DAYS": + case "COMMON_SLA_DAYS": return value > 0 ? {value} : {value}; - - default: + + default: return t("ES_COMMON_NA"); } - }, - additionalValidations: (type, data, keys) => { + }, + additionalValidations: (type, data, keys) => { if (type === "date") { return data[keys.start] && data[keys.end] ? () => new Date(data[keys.start]).getTime() <= new Date(data[keys.end]).getTime() : true; } @@ -207,25 +213,22 @@ export const UICustomizations = { let link; Object.keys(row).map((key) => { if (key === "ESTIMATE_ESTIMATE_NO") - link = `/${window.contextPath}/employee/estimate/estimate-details?tenantId=${tenantId}&estimateNumber=${ - row[key] - }`; + link = `/${window.contextPath}/employee/estimate/estimate-details?tenantId=${tenantId}&estimateNumber=${row[key]}`; }); return link; }, }, AttendanceInboxConfig: { preProcess: (data) => { - //set tenantId data.body.inbox.tenantId = Digit.ULBService.getCurrentTenantId(); data.body.inbox.processSearchCriteria.tenantId = Digit.ULBService.getCurrentTenantId(); const musterRollNumber = data?.body?.inbox?.moduleSearchCriteria?.musterRollNumber?.trim(); - if(musterRollNumber) data.body.inbox.moduleSearchCriteria.musterRollNumber = musterRollNumber + if (musterRollNumber) data.body.inbox.moduleSearchCriteria.musterRollNumber = musterRollNumber; const attendanceRegisterName = data?.body?.inbox?.moduleSearchCriteria?.attendanceRegisterName?.trim(); - if(attendanceRegisterName) data.body.inbox.moduleSearchCriteria.attendanceRegisterName = attendanceRegisterName + if (attendanceRegisterName) data.body.inbox.moduleSearchCriteria.attendanceRegisterName = attendanceRegisterName; // deleting them for now(assignee-> need clarity from pintu,ward-> static for now,not implemented BE side) const assignee = _.clone(data.body.inbox.moduleSearchCriteria.assignee); @@ -236,11 +239,11 @@ export const UICustomizations = { //cloning locality and workflow states to format them // let locality = _.clone(data.body.inbox.moduleSearchCriteria.locality ? data.body.inbox.moduleSearchCriteria.locality : []); - - let selectedOrg = _.clone(data.body.inbox.moduleSearchCriteria.orgId ? data.body.inbox.moduleSearchCriteria.orgId : null); + + let selectedOrg = _.clone(data.body.inbox.moduleSearchCriteria.orgId ? data.body.inbox.moduleSearchCriteria.orgId : null); delete data.body.inbox.moduleSearchCriteria.orgId; - if(selectedOrg) { - data.body.inbox.moduleSearchCriteria.orgId = selectedOrg?.[0]?.applicationNumber; + if (selectedOrg) { + data.body.inbox.moduleSearchCriteria.orgId = selectedOrg?.[0]?.applicationNumber; } // let selectedWard = _.clone(data.body.inbox.moduleSearchCriteria.ward ? data.body.inbox.moduleSearchCriteria.ward : null); @@ -258,11 +261,10 @@ export const UICustomizations = { // locality = locality?.map((row) => row?.code); states = Object.keys(states)?.filter((key) => states[key]); ward = ward?.map((row) => row?.code); - - + // //adding formatted data to these keys // if (locality.length > 0) data.body.inbox.moduleSearchCriteria.locality = locality; - if (states.length > 0) data.body.inbox.moduleSearchCriteria.status = states; + if (states.length > 0) data.body.inbox.moduleSearchCriteria.status = states; if (ward.length > 0) data.body.inbox.moduleSearchCriteria.ward = ward; const projectType = _.clone(data.body.inbox.moduleSearchCriteria.projectType ? data.body.inbox.moduleSearchCriteria.projectType : {}); if (projectType?.code) data.body.inbox.moduleSearchCriteria.projectType = projectType.code; @@ -270,10 +272,10 @@ export const UICustomizations = { //adding tenantId to moduleSearchCriteria data.body.inbox.moduleSearchCriteria.tenantId = Digit.ULBService.getCurrentTenantId(); - //setting limit and offset becoz somehow they are not getting set in muster inbox - data.body.inbox .limit = data.state.tableForm.limit - data.body.inbox.offset = data.state.tableForm.offset - delete data.state + //setting limit and offset becoz somehow they are not getting set in muster inbox + data.body.inbox.limit = data.state.tableForm.limit; + data.body.inbox.offset = data.state.tableForm.offset; + delete data.state; return data; }, postProcess: (responseArray, uiConfig) => { @@ -292,7 +294,9 @@ export const UICustomizations = { return ( {String(value ? (column.translate ? t(column.prefix ? `${column.prefix}${value}` : value) : value) : t("ES_COMMON_NA"))} @@ -310,7 +314,7 @@ export const UICustomizations = { return
{value?.length}
; } - if(key === "ATM_AMOUNT_IN_RS"){ + if (key === "ATM_AMOUNT_IN_RS") { return {value ? Digit.Utils.dss.formatterWithoutRound(value, "number") : t("ES_COMMON_NA")}; } if (key === "ATM_SLA") { @@ -321,11 +325,11 @@ export const UICustomizations = { ); } if (key === "COMMON_WORKFLOW_STATES") { - return {t(`WF_MUSTOR_${value}`)} + return {t(`WF_MUSTOR_${value}`)}; } //added this in case we change the key and not updated here , it'll throw that nothing was returned from cell error if that case is not handled here. To prevent that error putting this default - return {t(`CASE_NOT_HANDLED`)} + return {t(`CASE_NOT_HANDLED`)}; }, MobileDetailsOnClick: (row, tenantId) => { let link; @@ -336,7 +340,6 @@ export const UICustomizations = { return link; }, populateReqCriteria: () => { - const tenantId = Digit.ULBService.getCurrentTenantId(); return { @@ -345,9 +348,9 @@ export const UICustomizations = { body: { SearchCriteria: { tenantId: tenantId, - functions : { - type : "CBO" - } + functions: { + type: "CBO", + }, }, }, config: { @@ -368,47 +371,50 @@ export const UICustomizations = { return false; }, - preProcess: (data,defaultValues) => { + preProcess: (data, defaultValues) => { //get data to set in api - const fromProposalDate = Digit.Utils.pt.convertDateToEpoch(data?.body?.inbox?.moduleSearchCriteria?.fromProposalDate,"daystart"); - if(fromProposalDate) data.body.inbox.moduleSearchCriteria.fromProposalDate = fromProposalDate + const fromProposalDate = Digit.Utils.pt.convertDateToEpoch(data?.body?.inbox?.moduleSearchCriteria?.fromProposalDate, "daystart"); + if (fromProposalDate) data.body.inbox.moduleSearchCriteria.fromProposalDate = fromProposalDate; const toProposalDate = Digit.Utils.pt.convertDateToEpoch(data?.body?.inbox?.moduleSearchCriteria?.toProposalDate); - if(toProposalDate) data.body.inbox.moduleSearchCriteria.toProposalDate = toProposalDate - - const status = data?.body?.inbox?.moduleSearchCriteria?.status?.[0]?.wfStatus - delete data?.body?.inbox?.moduleSearchCriteria?.status - if(status){ - data.body.inbox.moduleSearchCriteria.status = status + if (toProposalDate) data.body.inbox.moduleSearchCriteria.toProposalDate = toProposalDate; + + const status = data?.body?.inbox?.moduleSearchCriteria?.status?.[0]?.wfStatus; + delete data?.body?.inbox?.moduleSearchCriteria?.status; + if (status) { + data.body.inbox.moduleSearchCriteria.status = status; } const projectType = data?.body?.inbox?.moduleSearchCriteria?.typeOfWork?.code; - delete data.body.inbox.moduleSearchCriteria.typeOfWork - if(projectType) data.body.inbox.moduleSearchCriteria.typeOfWork = projectType + delete data.body.inbox.moduleSearchCriteria.typeOfWork; + if (projectType) data.body.inbox.moduleSearchCriteria.typeOfWork = projectType; - const ward = data?.body?.inbox?.moduleSearchCriteria?.ward?.[0]?.code - delete data.body.inbox.moduleSearchCriteria.ward - if(ward) data.body.inbox.moduleSearchCriteria.ward = ward + const ward = data?.body?.inbox?.moduleSearchCriteria?.ward?.[0]?.code; + delete data.body.inbox.moduleSearchCriteria.ward; + if (ward) data.body.inbox.moduleSearchCriteria.ward = ward; + estimateId = data?.body?.inbox?.moduleSearchCriteria?.estimateId?.trim(); + if (!(data?.body?.inbox?.moduleSearchCriteria?.estimateId?.includes("RE")) && estimateId) data.body.inbox.moduleSearchCriteria.estimateId = estimateId; + if (data?.body?.inbox?.moduleSearchCriteria?.estimateId?.includes("RE") && estimateId) { + data.body.inbox.moduleSearchCriteria.revisionNumber = estimateId; + delete data?.body?.inbox?.moduleSearchCriteria?.estimateId; + } - const estimateId = data?.body?.inbox?.moduleSearchCriteria?.estimateId?.trim() - if(estimateId) data.body.inbox.moduleSearchCriteria.estimateId = estimateId - - const projectName = data?.body?.inbox?.moduleSearchCriteria?.projectName?.trim() - if(projectName) data.body.inbox.moduleSearchCriteria.projectName = projectName + const projectName = data?.body?.inbox?.moduleSearchCriteria?.projectName?.trim(); + if (projectName) data.body.inbox.moduleSearchCriteria.projectName = projectName; - //set tenantId + //set tenantId data.body.inbox.tenantId = Digit.ULBService.getCurrentTenantId(); data.body.inbox.moduleSearchCriteria.tenantId = Digit.ULBService.getCurrentTenantId(); //here iterate over defaultValues and set from presets in the api - - const presets = Digit.Hooks.useQueryParams(); - if(Object.keys(presets).length > 0 ) { - Object.keys(presets).forEach(preset => { + + const presets = Digit.Hooks.useQueryParams(); + if (Object.keys(presets).length > 0) { + Object.keys(presets).forEach((preset) => { //if present in defaultValues object then only set it - if(Object.keys(defaultValues).some(key => key===preset)){ - data.body.inbox.moduleSearchCriteria[preset] = presets[preset] + if (Object.keys(defaultValues).some((key) => key === preset)) { + data.body.inbox.moduleSearchCriteria[preset] = presets[preset]; } - }) + }); } return data; @@ -424,14 +430,11 @@ export const UICustomizations = { if (key === "ESTIMATE_ESTIMATE_NO") { return ( - - {String(value ? (column.translate ? t(column.prefix ? `${column.prefix}${value}` : value) : value) : t("ES_COMMON_NA"))} - - + {/* + {String(value ? (column.translate ? t(column.prefix ? `${column.prefix}${value}` : value) : value) : t("ES_COMMON_NA"))} + */} + {Digit.Utils.statusBasedNavigation(row?.ProcessInstance?.action, row?.businessObject?.additionalDetails?.projectNumber, row?.ProcessInstance?.businessId, row.ProcessInstance.tenantId, row?.ProcessInstance?.businessId, row?.businessObject?.businessService === "REVISION-ESTIMATE" ? "REVISION-ESTIMATE" : "ESTIMATE", row?.businessObject?.estimateNumber)} +
); } if (key === "ES_COMMON_PROJECT_NAME") { @@ -448,14 +451,14 @@ export const UICustomizations = { ); } if (key === "WORKS_ESTIMATED_AMOUNT") { - return + return ; } - if(key === "CORE_COMMON_STATUS"){ - return t(`WF_ESTIMATE_STATUS_${value}`) + if (key === "CORE_COMMON_STATUS") { + return t(`WF_ESTIMATE_STATUS_${value}`); } if (key === "ES_COMMON_LOCATION") { const location = value; - const headerLocale = Digit.Utils.locale.getTransformedLocale(Digit.ULBService.getCurrentTenantId()) + const headerLocale = Digit.Utils.locale.getTransformedLocale(Digit.ULBService.getCurrentTenantId()); if (location) { let locality = location?.locality ? t(`${headerLocale}_ADMIN_${location?.locality}`) : ""; let ward = location?.ward ? t(`${headerLocale}_ADMIN_${location?.ward}`) : ""; @@ -479,25 +482,24 @@ export const UICustomizations = { return link; }, populateReqCriteria: () => { - const tenantId = Digit.ULBService.getCurrentTenantId(); return { url: "/egov-workflow-v2/egov-wf/businessservice/_search", params: { tenantId, businessServices: Digit?.Customizations?.["commonUiConfig"]?.getBusinessService("estimate") }, - body: { - - }, + body: {}, config: { enabled: true, select: (data) => { - const states = data?.BusinessServices?.[0]?.states?.filter(state=> state.state)?.map(state=> { - return { - "i18nKey":`WF_${Digit?.Customizations?.["commonUiConfig"]?.getBusinessService("estimate")}_STATUS_${state?.state}`, - "wfStatus":state?.state - } - }) - return states + const states = data?.BusinessServices?.[0]?.states + ?.filter((state) => state.state) + ?.map((state) => { + return { + i18nKey: `WF_${Digit?.Customizations?.["commonUiConfig"]?.getBusinessService("estimate")}_STATUS_${state?.state}`, + wfStatus: state?.state, + }; + }); + return states; }, }, }; @@ -511,10 +513,17 @@ export const UICustomizations = { const ward = data.body.Projects[0]?.ward?.[0]?.code; data.params = { ...data.params, tenantId: Digit.ULBService.getCurrentTenantId(), includeAncestors: true, createdFrom, createdTo }; let name = data.body.Projects[0]?.name?.trim(); - let projectNumber = data.body.Projects[0]?.projectNumber?.trim() + let projectNumber = data.body.Projects[0]?.projectNumber?.trim(); delete data.body.Projects[0]?.createdFrom; delete data.body.Projects[0]?.createdTo; - data.body.Projects[0] = { ...data.body.Projects[0], tenantId: Digit.ULBService.getCurrentTenantId(),projectNumber, projectType, name, address : { boundary : ward} }; + data.body.Projects[0] = { + ...data.body.Projects[0], + tenantId: Digit.ULBService.getCurrentTenantId(), + projectNumber, + projectType, + name, + address: { boundary: ward }, + }; return data; }, @@ -554,10 +563,8 @@ export const UICustomizations = { customValidationCheck: (data) => { //checking both to and from date are present const { createdFrom, createdTo } = data; - if (createdTo !== "" && createdFrom === "") - return { warning: true, label: "ES_COMMON_ENTER_DATE_RANGE" }; - else if (createdTo === "" && createdFrom !== "") - return { warning: true, label: "ES_COMMON_ENTER_DATE_RANGE" }; + if (createdTo !== "" && createdFrom === "") return { warning: true, label: "ES_COMMON_ENTER_DATE_RANGE" }; + else if (createdTo === "" && createdFrom !== "") return { warning: true, label: "ES_COMMON_ENTER_DATE_RANGE" }; return false; }, @@ -565,60 +572,61 @@ export const UICustomizations = { //here we can add multiple conditions //like if a cell is link then we return link //first we can identify which column it belongs to then we can return relevant result - switch(key){ + switch (key) { case "WORKS_PROJECT_ID": - return ( - - - {String(value ? (column.translate ? t(column.prefix ? `${column.prefix}${value}` : value) : value) : t("ES_COMMON_NA"))} - - - ); - - case "WORKS_PARENT_PROJECT_ID": - return value ? ( - - - {String(value ? value : t("ES_COMMON_NA"))} - - - ) : ( - t("ES_COMMON_NA") - ); - - case "WORKS_PROJECT_NAME": - { let currentProject = searchResult?.filter((result) => result?.id === row?.id)[0]; - return ( -
- - {String(t(value))} + return ( + + + {String(value ? (column.translate ? t(column.prefix ? `${column.prefix}${value}` : value) : value) : t("ES_COMMON_NA"))} + - {/* check condtion - if length greater than 20 */} - - {currentProject?.description} + ); + + case "WORKS_PARENT_PROJECT_ID": + return value ? ( + + + {String(value ? value : t("ES_COMMON_NA"))} + -
- ); } - - case "PROJECT_ESTIMATED_COST_IN_RS": - return - - case "ES_COMMON_LOCATION": - { let currentProject = searchResult?.filter((result) => result?.id === row?.id)[0]; - const headerLocale = Digit.Utils.locale.getTransformedLocale(row?.tenantId) - if (currentProject) { - let locality = currentProject?.address?.boundary ? t(`${headerLocale}_ADMIN_${currentProject?.address?.boundary}`) : ""; - let ward = currentProject?.additionalDetails?.ward ? t(`${headerLocale}_ADMIN_${currentProject?.additionalDetails?.ward}`) : ""; - let city = currentProject?.address?.city - ? t(`TENANT_TENANTS_${Digit.Utils.locale.getTransformedLocale(currentProject?.address?.city)}`) - : ""; - return

{`${locality ? locality + ", " : ""}${ward ? ward + ", " : ""}${city}`}

; + ) : ( + t("ES_COMMON_NA") + ); + + case "WORKS_PROJECT_NAME": { + let currentProject = searchResult?.filter((result) => result?.id === row?.id)[0]; + return ( +
+ + {String(t(value))} + + {/* check condtion - if length greater than 20 */} + + {currentProject?.description} + +
+ ); } - return

{"NA"}

- } - default: - return t("ES_COMMON_NA"); + case "PROJECT_ESTIMATED_COST_IN_RS": + return ; + + case "ES_COMMON_LOCATION": { + let currentProject = searchResult?.filter((result) => result?.id === row?.id)[0]; + const headerLocale = Digit.Utils.locale.getTransformedLocale(row?.tenantId); + if (currentProject) { + let locality = currentProject?.address?.boundary ? t(`${headerLocale}_ADMIN_${currentProject?.address?.boundary}`) : ""; + let ward = currentProject?.additionalDetails?.ward ? t(`${headerLocale}_ADMIN_${currentProject?.additionalDetails?.ward}`) : ""; + let city = currentProject?.address?.city + ? t(`TENANT_TENANTS_${Digit.Utils.locale.getTransformedLocale(currentProject?.address?.city)}`) + : ""; + return

{`${locality ? locality + ", " : ""}${ward ? ward + ", " : ""}${city}`}

; + } + return

{"NA"}

; + } + + default: + return t("ES_COMMON_NA"); } }, additionalValidations: (type, data, keys) => { @@ -637,18 +645,27 @@ export const UICustomizations = { }, SearchWMSProjectConfig: { preProcess: (data) => { - const createdFrom = Digit.Utils.pt.convertDateToEpoch(data.body.inbox.moduleSearchCriteria?.createdFrom, "daystart"); + const createdFrom = Digit.Utils.pt.convertDateToEpoch(data.body.inbox.moduleSearchCriteria?.createdFrom, "daystart"); const createdTo = Digit.Utils.pt.convertDateToEpoch(data.body.inbox.moduleSearchCriteria?.createdTo); const projectType = data.body.inbox.moduleSearchCriteria?.projectType?.code; const boundary = data.body.inbox.moduleSearchCriteria?.boundary?.[0]?.code; data.params = { ...data.params, tenantId: Digit.ULBService.getCurrentTenantId(), includeAncestors: true }; let projectName = data.body.inbox.moduleSearchCriteria?.projectName?.trim(); - let projectNumber = data.body.inbox.moduleSearchCriteria?.projectNumber?.trim() + let projectNumber = data.body.inbox.moduleSearchCriteria?.projectNumber?.trim(); delete data.body.inbox.moduleSearchCriteria?.createdFrom; delete data.body.inbox.moduleSearchCriteria?.ward; delete data.body.inbox.moduleSearchCriteria?.createdTo; data.body.inbox.tenantId = Digit.ULBService.getCurrentTenantId(); - data.body.inbox.moduleSearchCriteria = { ...data.body.inbox.moduleSearchCriteria, tenantId: Digit.ULBService.getCurrentTenantId(),projectNumber, projectType, projectName, boundary, createdFrom, createdTo}; + data.body.inbox.moduleSearchCriteria = { + ...data.body.inbox.moduleSearchCriteria, + tenantId: Digit.ULBService.getCurrentTenantId(), + projectNumber, + projectType, + projectName, + boundary, + createdFrom, + createdTo, + }; return data; }, @@ -688,10 +705,8 @@ export const UICustomizations = { customValidationCheck: (data) => { //checking both to and from date are present const { createdFrom, createdTo } = data; - if (createdTo !== "" && createdFrom === "") - return { warning: true, label: "ES_COMMON_ENTER_DATE_RANGE" }; - else if (createdTo === "" && createdFrom !== "") - return { warning: true, label: "ES_COMMON_ENTER_DATE_RANGE" }; + if (createdTo !== "" && createdFrom === "") return { warning: true, label: "ES_COMMON_ENTER_DATE_RANGE" }; + else if (createdTo === "" && createdFrom !== "") return { warning: true, label: "ES_COMMON_ENTER_DATE_RANGE" }; return false; }, @@ -699,60 +714,61 @@ export const UICustomizations = { //here we can add multiple conditions //like if a cell is link then we return link //first we can identify which column it belongs to then we can return relevant result - switch(key){ + switch (key) { case "WORKS_PROJECT_ID": - return ( - - - {String(value ? (column.translate ? t(column.prefix ? `${column.prefix}${value}` : value) : value) : t("ES_COMMON_NA"))} - - - ); - - case "WORKS_PARENT_PROJECT_ID": - return value ? ( - - - {String(value ? value : t("ES_COMMON_NA"))} - - - ) : ( - t("ES_COMMON_NA") - ); - - case "WORKS_PROJECT_NAME": - { let currentProject = searchResult?.filter((result) => result?.businessObject?.id === row?.businessObject?.id)[0]; - return ( -
- - {String(t(value))} + return ( + + + {String(value ? (column.translate ? t(column.prefix ? `${column.prefix}${value}` : value) : value) : t("ES_COMMON_NA"))} + - {/* check condtion - if length greater than 20 */} - - {currentProject?.businessObject?.description} + ); + + case "WORKS_PARENT_PROJECT_ID": + return value ? ( + + + {String(value ? value : t("ES_COMMON_NA"))} + -
- ); } - - case "PROJECT_ESTIMATED_COST_IN_RS": - return - - case "ES_COMMON_LOCATION": - { let currentProject = searchResult?.filter((result) => result?.businessObject.id === row?.businessObject.id)[0].businessObject; - const headerLocale = Digit.Utils.locale.getTransformedLocale(row?.businessObject.tenantId) - if (currentProject) { - let locality = currentProject?.address?.boundary ? t(`${headerLocale}_ADMIN_${currentProject?.address?.boundary}`) : ""; - let ward = currentProject?.additionalDetails?.ward ? t(`${headerLocale}_ADMIN_${currentProject?.additionalDetails?.ward}`) : ""; - let city = currentProject?.address?.city - ? t(`TENANT_TENANTS_${Digit.Utils.locale.getTransformedLocale(currentProject?.address?.city)}`) - : ""; - return

{`${locality ? locality + ", " : ""}${ward ? ward + ", " : ""}${city}`}

; + ) : ( + t("ES_COMMON_NA") + ); + + case "WORKS_PROJECT_NAME": { + let currentProject = searchResult?.filter((result) => result?.businessObject?.id === row?.businessObject?.id)[0]; + return ( +
+ + {String(t(value))} + + {/* check condtion - if length greater than 20 */} + + {currentProject?.businessObject?.description} + +
+ ); } - return

{"NA"}

- } - default: - return t("ES_COMMON_NA"); + case "PROJECT_ESTIMATED_COST_IN_RS": + return ; + + case "ES_COMMON_LOCATION": { + let currentProject = searchResult?.filter((result) => result?.businessObject.id === row?.businessObject.id)[0].businessObject; + const headerLocale = Digit.Utils.locale.getTransformedLocale(row?.businessObject.tenantId); + if (currentProject) { + let locality = currentProject?.address?.boundary ? t(`${headerLocale}_ADMIN_${currentProject?.address?.boundary}`) : ""; + let ward = currentProject?.additionalDetails?.ward ? t(`${headerLocale}_ADMIN_${currentProject?.additionalDetails?.ward}`) : ""; + let city = currentProject?.address?.city + ? t(`TENANT_TENANTS_${Digit.Utils.locale.getTransformedLocale(currentProject?.address?.city)}`) + : ""; + return

{`${locality ? locality + ", " : ""}${ward ? ward + ", " : ""}${city}`}

; + } + return

{"NA"}

; + } + + default: + return t("ES_COMMON_NA"); } }, additionalValidations: (type, data, keys) => { @@ -771,33 +787,32 @@ export const UICustomizations = { }, SearchAttendanceConfig: { preProcess: (data) => { - //get data to set in api - const startDate = Digit.Utils.pt.convertDateToEpoch(data?.body?.inbox?.moduleSearchCriteria?.startDate,"daystart"); - if(startDate) data.body.inbox.moduleSearchCriteria.startDate = startDate + const startDate = Digit.Utils.pt.convertDateToEpoch(data?.body?.inbox?.moduleSearchCriteria?.startDate, "daystart"); + if (startDate) data.body.inbox.moduleSearchCriteria.startDate = startDate; const endDate = Digit.Utils.pt.convertDateToEpoch(data?.body?.inbox?.moduleSearchCriteria?.endDate); - if(endDate) data.body.inbox.moduleSearchCriteria.endDate = endDate - + if (endDate) data.body.inbox.moduleSearchCriteria.endDate = endDate; + const projectType = data?.body?.inbox?.moduleSearchCriteria?.projectType?.code; - delete data.body.inbox.moduleSearchCriteria.projectType - if(projectType) data.body.inbox.moduleSearchCriteria.projectType = projectType + delete data.body.inbox.moduleSearchCriteria.projectType; + if (projectType) data.body.inbox.moduleSearchCriteria.projectType = projectType; + + const ward = data?.body?.inbox?.moduleSearchCriteria?.ward?.[0]?.code; + delete data.body.inbox.moduleSearchCriteria.ward; + if (ward) data.body.inbox.moduleSearchCriteria.ward = ward; - const ward = data?.body?.inbox?.moduleSearchCriteria?.ward?.[0]?.code - delete data.body.inbox.moduleSearchCriteria.ward - if(ward) data.body.inbox.moduleSearchCriteria.ward = ward - - const status = data?.body?.inbox?.moduleSearchCriteria?.musterRollStatus?.[0]?.wfStatus - delete data?.body?.inbox?.moduleSearchCriteria?.musterRollStatus - if(status){ - data.body.inbox.moduleSearchCriteria.musterRollStatus = status + const status = data?.body?.inbox?.moduleSearchCriteria?.musterRollStatus?.[0]?.wfStatus; + delete data?.body?.inbox?.moduleSearchCriteria?.musterRollStatus; + if (status) { + data.body.inbox.moduleSearchCriteria.musterRollStatus = status; } const musterRollNumber = data?.body?.inbox?.moduleSearchCriteria?.musterRollNumber?.trim(); - if(musterRollNumber) data.body.inbox.moduleSearchCriteria.musterRollNumber = musterRollNumber + if (musterRollNumber) data.body.inbox.moduleSearchCriteria.musterRollNumber = musterRollNumber; const attendanceRegisterName = data?.body?.inbox?.moduleSearchCriteria?.attendanceRegisterName?.trim(); - if(attendanceRegisterName) data.body.inbox.moduleSearchCriteria.attendanceRegisterName = attendanceRegisterName - //set tenantId + if (attendanceRegisterName) data.body.inbox.moduleSearchCriteria.attendanceRegisterName = attendanceRegisterName; + //set tenantId data.body.inbox.tenantId = Digit.ULBService.getCurrentTenantId(); data.body.inbox.moduleSearchCriteria.tenantId = Digit.ULBService.getCurrentTenantId(); return data; @@ -805,8 +820,7 @@ export const UICustomizations = { customValidationCheck: (data) => { //checking both to and from date are present const { startDate, endDate } = data; - if ((startDate === "" && endDate !== "") || (startDate !== "" && endDate === "")) - return { warning: true, label: "ES_COMMON_ENTER_DATE_RANGE" }; + if ((startDate === "" && endDate !== "") || (startDate !== "" && endDate === "")) return { warning: true, label: "ES_COMMON_ENTER_DATE_RANGE" }; return false; }, @@ -824,10 +838,12 @@ export const UICustomizations = { ); } - if(key === "ES_COMMON_LOCATION"){ + if (key === "ES_COMMON_LOCATION") { return value ? ( -

{`${value?.locality ? value?.locality + ", " : ""}${value?.ward ? value?.ward + ", " : ""}${t(Digit.Utils.locale.getCityLocale(row?.businessObject?.tenantId))}`}

+

{`${value?.locality ? value?.locality + ", " : ""}${value?.ward ? value?.ward + ", " : ""}${t( + Digit.Utils.locale.getCityLocale(row?.businessObject?.tenantId) + )}`}

) : ( t("ES_COMMON_NA") @@ -848,15 +864,13 @@ export const UICustomizations = { ); } - if (key === "CORE_COMMON_STATUS") { - return {t(`WF_MUSTOR_${value}`)} + return {t(`WF_MUSTOR_${value}`)}; } - if(key === "MUSTER_WAGE_AMOUNT") { - return {value ? Digit.Utils.dss.formatterWithoutRound(value, "number") : t("ES_COMMON_NA")}; + if (key === "MUSTER_WAGE_AMOUNT") { + return {value ? Digit.Utils.dss.formatterWithoutRound(value, "number") : t("ES_COMMON_NA")}; } - }, MobileDetailsOnClick: (row, tenantId) => { let link; @@ -867,25 +881,24 @@ export const UICustomizations = { return link; }, populateReqCriteria: () => { - const tenantId = Digit.ULBService.getCurrentTenantId(); return { url: "/egov-workflow-v2/egov-wf/businessservice/_search", params: { tenantId, businessServices: Digit?.Customizations?.["commonUiConfig"]?.getBusinessService("muster roll") }, - body: { - - }, + body: {}, config: { enabled: true, select: (data) => { - const states = data?.BusinessServices?.[0]?.states?.filter(state=> state.state)?.map(state=> { - return { - "i18nKey":`WF_${Digit?.Customizations?.["commonUiConfig"]?.getBusinessService("muster roll")}_STATUS_${state?.state}`, - "wfStatus":state?.state - } - }) - return states + const states = data?.BusinessServices?.[0]?.states + ?.filter((state) => state.state) + ?.map((state) => { + return { + i18nKey: `WF_${Digit?.Customizations?.["commonUiConfig"]?.getBusinessService("muster roll")}_STATUS_${state?.state}`, + wfStatus: state?.state, + }; + }); + return states; }, }, }; @@ -894,7 +907,7 @@ export const UICustomizations = { if (type === "date") { return data[keys.start] && data[keys.end] ? () => new Date(data[keys.start]).getTime() <= new Date(data[keys.end]).getTime() : true; } - } + }, }, ContractsInboxConfig: { preProcess: (data) => { @@ -903,11 +916,11 @@ export const UICustomizations = { data.body.inbox.processSearchCriteria.tenantId = Digit.ULBService.getCurrentTenantId(); data.body.inbox.moduleSearchCriteria.tenantId = Digit.ULBService.getCurrentTenantId(); - const workOrderNumber = data?.body?.inbox?.moduleSearchCriteria?.workOrderNumber?.trim() - if(workOrderNumber) data.body.inbox.moduleSearchCriteria.workOrderNumber = workOrderNumber + const workOrderNumber = data?.body?.inbox?.moduleSearchCriteria?.workOrderNumber?.trim(); + if (workOrderNumber) data.body.inbox.moduleSearchCriteria.workOrderNumber = workOrderNumber; - const projectId = data?.body?.inbox?.moduleSearchCriteria?.projectId?.trim() - if(projectId) data.body.inbox.moduleSearchCriteria.projectId = projectId + const projectId = data?.body?.inbox?.moduleSearchCriteria?.projectId?.trim(); + if (projectId) data.body.inbox.moduleSearchCriteria.projectId = projectId; const assignee = _.clone(data.body.inbox.moduleSearchCriteria.assignee); delete data.body.inbox.moduleSearchCriteria.assignee; @@ -935,24 +948,30 @@ export const UICustomizations = { return data; }, additionalCustomizations: (row, key, column, value, t, searchResult) => { - switch(key){ - case "WORKS_ORDER_NO": + switch (key) { + case "WORKS_ORDER_NO": return ( - - - {String(value ? (column.translate ? t(column.prefix ? `${column.prefix}${value}` : value) : value) : t("ES_COMMON_NA"))} - - + + + {String(value ? (column.translate ? t(column.prefix ? `${column.prefix}${value}` : value) : value) : t("ES_COMMON_NA"))} + + ); case "COMMON_ASSIGNEE": - return value? {value?.[0]?.name} : {t("NA")}; + return value ? {value?.[0]?.name} : {t("NA")}; case "COMMON_WORKFLOW_STATES": return {t(`WF_WO_${value}`)}; case "ES_COMMON_AMOUNT": - return + return ; case "COMMON_SLA_DAYS": return value > 0 ? {value} : {value}; @@ -997,20 +1016,20 @@ export const UICustomizations = { projectName, startDate, endDate, - status + status, }, }; - const presets = Digit.Hooks.useQueryParams(); - if(Object.keys(presets).length > 0 ) { - Object.keys(presets).forEach(preset => { + const presets = Digit.Hooks.useQueryParams(); + if (Object.keys(presets).length > 0) { + Object.keys(presets).forEach((preset) => { //if present in defaultValues object then only set it - if(Object.keys(defaultValues).some(key => key===preset)){ - data.body.inbox.moduleSearchCriteria[preset] = presets[preset] + if (Object.keys(defaultValues).some((key) => key === preset)) { + data.body.inbox.moduleSearchCriteria[preset] = presets[preset]; } - }) + }); } - + return data; }, customValidationCheck: (data) => { @@ -1026,16 +1045,22 @@ export const UICustomizations = { //like if a cell is link then we return link //first we can identify which column it belongs to then we can return relevant result switch (key) { - case "WORKS_ORDER_ID": - return ( - - + case "WORKS_ORDER_ID": + return ( + + {String(value ? (column.translate ? t(column.prefix ? `${column.prefix}${value}` : value) : value) : t("ES_COMMON_NA"))} - - - ); - - case "WORKS_PROJECT_NAME": + + + ); + + case "WORKS_PROJECT_NAME": return (
@@ -1047,34 +1072,34 @@ export const UICustomizations = {
); - - case "ES_COMMON_AMOUNT": - return - case "COMMON_ROLE_OF_CBO": - return {t(`COMMON_MASTERS_${value}`)}; - case "ES_COMMON_LOCATION": - return value ? ( - - {String( - `${t(Digit.Utils.locale.getCityLocale(row?.businessObject?.tenantId))}, ${t( - Digit.Utils.locale.getMohallaLocale(value, row?.businessObject?.tenantId) - )}` - )} - - ) : ( - t("ES_COMMON_NA") - ); - case "ES_COMMON_STATUS": - return value ? ( - - {t(`WF_${Digit?.Customizations?.["commonUiConfig"]?.getBusinessService("contract")}_STATUS_${value}`)} - - ) : ( - t("ES_COMMON_NA") - ); - default: - return t("ES_COMMON_NA"); + case "ES_COMMON_AMOUNT": + return ; + case "COMMON_ROLE_OF_CBO": + return {t(`COMMON_MASTERS_${value}`)}; + + case "ES_COMMON_LOCATION": + return value ? ( + + {String( + `${t(Digit.Utils.locale.getCityLocale(row?.businessObject?.tenantId))}, ${t( + Digit.Utils.locale.getMohallaLocale(value, row?.businessObject?.tenantId) + )}` + )} + + ) : ( + t("ES_COMMON_NA") + ); + case "ES_COMMON_STATUS": + return value ? ( + + {t(`WF_${Digit?.Customizations?.["commonUiConfig"]?.getBusinessService("contract")}_STATUS_${value}`)} + + ) : ( + t("ES_COMMON_NA") + ); + default: + return t("ES_COMMON_NA"); } }, MobileDetailsOnClick: (row, tenantId) => { @@ -1091,25 +1116,24 @@ export const UICustomizations = { } }, populateReqCriteria: () => { - const tenantId = Digit.ULBService.getCurrentTenantId(); return { url: "/egov-workflow-v2/egov-wf/businessservice/_search", params: { tenantId, businessServices: Digit?.Customizations?.["commonUiConfig"]?.getBusinessService("contract") }, - body: { - - }, + body: {}, config: { enabled: true, select: (data) => { - const states = data?.BusinessServices?.[0]?.states?.filter(state=> state.state)?.map(state=> { - return { - "i18nKey":`WF_${Digit?.Customizations?.["commonUiConfig"]?.getBusinessService("contract")}_STATUS_${state?.state}`, - "wfStatus":state?.state - } - }) - return states + const states = data?.BusinessServices?.[0]?.states + ?.filter((state) => state.state) + ?.map((state) => { + return { + i18nKey: `WF_${Digit?.Customizations?.["commonUiConfig"]?.getBusinessService("contract")}_STATUS_${state?.state}`, + wfStatus: state?.state, + }; + }); + return states; }, }, }; @@ -1139,7 +1163,7 @@ export const UICustomizations = { wardCode: "wardCode[0].code", socialCategory: "socialCategory.code", }; - const textConfig = ["name", "individualId"] + const textConfig = ["name", "individualId"]; let Individual = Object.keys(requestBody) .map((key) => { if (selectConfig[key]) { @@ -1147,7 +1171,7 @@ export const UICustomizations = { } else if (typeof requestBody[key] == "object") { requestBody[key] = requestBody[key]?.code; } else if (textConfig?.includes(key)) { - requestBody[key] = requestBody[key]?.trim() + requestBody[key] = requestBody[key]?.trim(); } return key; }) @@ -1175,7 +1199,7 @@ export const UICustomizations = { return ( - {String(value ? (column.translate ? t(column.prefix ? `${column.prefix}${value}` : value) : value) : t("ES_COMMON_NA"))} + {String(value ? (column.translate ? t(column.prefix ? `${column.prefix}${value}` : value) : value) : t("ES_COMMON_NA"))} ); @@ -1215,7 +1239,7 @@ export const UICustomizations = { if (type === "date") { return data[keys.start] && data[keys.end] ? () => new Date(data[keys.start]).getTime() <= new Date(data[keys.end]).getTime() : true; } - } + }, }, SearchWMSWageSeekerConfig: { customValidationCheck: (data) => { @@ -1230,8 +1254,7 @@ export const UICustomizations = { data.params = { ...data.params, tenantId: Digit.ULBService.getCurrentTenantId() }; let requestBody = { ...data.body.inbox.moduleSearchCriteria }; - const pathConfig = { - }; + const pathConfig = {}; const dateConfig = { createdFrom: "daystart", createdTo: "dayend", @@ -1241,8 +1264,8 @@ export const UICustomizations = { name: "name.givenName", socialCategoryValue: "socialCategoryValue.code", }; - const textConfig = ["name", "individualId"] - + const textConfig = ["name", "individualId"]; + let Individual = Object.keys(requestBody) .map((key) => { if (selectConfig[key]) { @@ -1250,7 +1273,7 @@ export const UICustomizations = { } else if (typeof requestBody[key] == "object") { requestBody[key] = requestBody[key]?.code; } else if (textConfig?.includes(key)) { - requestBody[key] = requestBody[key]?.trim() + requestBody[key] = requestBody[key]?.trim(); } return key; }) @@ -1266,8 +1289,12 @@ export const UICustomizations = { return acc; }, {}); - data.body.inbox.moduleSearchCriteria = { ...data.body.inbox.moduleSearchCriteria ,...Individual, tenantId:Digit.ULBService.getCurrentTenantId()}; - data.body.inbox.tenantId = Digit.ULBService.getCurrentTenantId() + data.body.inbox.moduleSearchCriteria = { + ...data.body.inbox.moduleSearchCriteria, + ...Individual, + tenantId: Digit.ULBService.getCurrentTenantId(), + }; + data.body.inbox.tenantId = Digit.ULBService.getCurrentTenantId(); return data; }, additionalCustomizations: (row, key, column, value, t, searchResult) => { @@ -1279,7 +1306,7 @@ export const UICustomizations = { return ( - {String(value ? (column.translate ? t(column.prefix ? `${column.prefix}${value}` : value) : value) : t("ES_COMMON_NA"))} + {String(value ? (column.translate ? t(column.prefix ? `${column.prefix}${value}` : value) : value) : t("ES_COMMON_NA"))} ); @@ -1319,7 +1346,7 @@ export const UICustomizations = { if (type === "date") { return data[keys.start] && data[keys.end] ? () => new Date(data[keys.start]).getTime() <= new Date(data[keys.end]).getTime() : true; } - } + }, }, SearchOrganisationConfig: { customValidationCheck: (data) => { @@ -1330,58 +1357,58 @@ export const UICustomizations = { return false; }, - preProcess: (data) => { - let requestBody = { ...data.body.SearchCriteria }; - const pathConfig = { - type: "functions.type", - }; - const dateConfig = { - createdFrom: "daystart", - createdTo: "dayend", - }; - const selectConfig = { - boundaryCode: "boundaryCode[0].code", - type:"type.code", - applicationStatus: "applicationStatus.code", - }; - const textConfig = ["name", "orgNumber"] - - let SearchCriteria = Object.keys(requestBody) - .map((key) => { - if (selectConfig[key]) { - requestBody[key] = _.get(requestBody, selectConfig[key], null); - } else if (typeof requestBody[key] == "object") { - requestBody[key] = requestBody[key]?.code; - } else if (textConfig?.includes(key)) { - requestBody[key] = requestBody[key]?.trim() - } - return key; - }) - .filter((key) => requestBody[key]) - .reduce((acc, curr) => { - if (pathConfig[curr]) { - _.set(acc, pathConfig[curr], requestBody[curr]); - } else if (dateConfig[curr] && dateConfig[curr]?.includes("day")) { - _.set(acc, curr, Digit.Utils.date.convertDateToEpoch(requestBody[curr], dateConfig[curr])); - } else { - _.set(acc, curr, requestBody[curr]); - } - return acc; - }, {}); - data.body.SearchCriteria = { ...SearchCriteria,tenantId:Digit.ULBService.getCurrentTenantId() }; - return data; - }, - - additionalCustomizations: (row, key, column, value, t, searchResult) => { - //here we can add multiple conditions - //like if a cell is link then we return link - //first we can identify which column it belongs to then we can return relevant result - switch (key) { - case "MASTERS_ORGANISATION_ID": - return ( - - - {String(value ? (column.translate ? t(column.prefix ? `${column.prefix}${value}` : value) : value) : t("ES_COMMON_NA"))} + preProcess: (data) => { + let requestBody = { ...data.body.SearchCriteria }; + const pathConfig = { + type: "functions.type", + }; + const dateConfig = { + createdFrom: "daystart", + createdTo: "dayend", + }; + const selectConfig = { + boundaryCode: "boundaryCode[0].code", + type: "type.code", + applicationStatus: "applicationStatus.code", + }; + const textConfig = ["name", "orgNumber"]; + + let SearchCriteria = Object.keys(requestBody) + .map((key) => { + if (selectConfig[key]) { + requestBody[key] = _.get(requestBody, selectConfig[key], null); + } else if (typeof requestBody[key] == "object") { + requestBody[key] = requestBody[key]?.code; + } else if (textConfig?.includes(key)) { + requestBody[key] = requestBody[key]?.trim(); + } + return key; + }) + .filter((key) => requestBody[key]) + .reduce((acc, curr) => { + if (pathConfig[curr]) { + _.set(acc, pathConfig[curr], requestBody[curr]); + } else if (dateConfig[curr] && dateConfig[curr]?.includes("day")) { + _.set(acc, curr, Digit.Utils.date.convertDateToEpoch(requestBody[curr], dateConfig[curr])); + } else { + _.set(acc, curr, requestBody[curr]); + } + return acc; + }, {}); + data.body.SearchCriteria = { ...SearchCriteria, tenantId: Digit.ULBService.getCurrentTenantId() }; + return data; + }, + + additionalCustomizations: (row, key, column, value, t, searchResult) => { + //here we can add multiple conditions + //like if a cell is link then we return link + //first we can identify which column it belongs to then we can return relevant result + switch (key) { + case "MASTERS_ORGANISATION_ID": + return ( + + + {String(value ? (column.translate ? t(column.prefix ? `${column.prefix}${value}` : value) : value) : t("ES_COMMON_NA"))} ); @@ -1397,10 +1424,18 @@ export const UICustomizations = { return value ? {String(t(`MASTERS_ORG_STATUS_${value}`))} : t("ES_COMMON_NA"); case "MASTERS_ORGANISATION_TYPE": - return value ? {String(t(`COMMON_MASTERS_ORG_${value?.split?.('.')?.[0]}`))} : t("ES_COMMON_NA"); + return value ? ( + {String(t(`COMMON_MASTERS_ORG_${value?.split?.(".")?.[0]}`))} + ) : ( + t("ES_COMMON_NA") + ); case "MASTERS_ORGANISATION_SUB_TYPE": - return value ? {String(t(`COMMON_MASTERS_SUBORG_${row?.functions?.[0]?.type?.split?.('.')?.[1]}`))} : t("ES_COMMON_NA"); + return value ? ( + {String(t(`COMMON_MASTERS_SUBORG_${row?.functions?.[0]?.type?.split?.(".")?.[1]}`))} + ) : ( + t("ES_COMMON_NA") + ); default: return t("ES_COMMON_NA"); } @@ -1417,7 +1452,7 @@ export const UICustomizations = { if (type === "date") { return data[keys.start] && data[keys.end] ? () => new Date(data[keys.start]).getTime() <= new Date(data[keys.end]).getTime() : true; } - } + }, }, SearchBillWMSConfig: { customValidationCheck: (data) => { @@ -1428,9 +1463,7 @@ export const UICustomizations = { return false; }, - preProcess: (data,defaultValues) => { - - + preProcess: (data, defaultValues) => { let requestBody = { ...data.body.inbox.moduleSearchCriteria }; const dateConfig = { createdFrom: "daystart", @@ -1441,73 +1474,69 @@ export const UICustomizations = { ward: "ward[0].code", status: "status[0].code", }; - const textConfig = ["projectName", "billNumber"] + const textConfig = ["projectName", "billNumber"]; let SearchCriteria = Object.keys(requestBody) - .map((key) => { - if (selectConfig[key]) { - requestBody[key] = _.get(requestBody, selectConfig[key], null); - } else if (typeof requestBody[key] == "object") { - requestBody[key] = requestBody[key]?.code; - } else if (textConfig?.includes(key)) { - requestBody[key] = requestBody[key]?.trim() - } - return key; - }) - .filter((key) => requestBody[key]) - .reduce((acc, curr) => { - if (dateConfig[curr] && dateConfig[curr]?.includes("day")) { - _.set(acc, curr, Digit.Utils.date.convertDateToEpoch(requestBody[curr], dateConfig[curr])); - } else { - _.set(acc, curr, requestBody[curr]); - } - return acc; - }, {}); + .map((key) => { + if (selectConfig[key]) { + requestBody[key] = _.get(requestBody, selectConfig[key], null); + } else if (typeof requestBody[key] == "object") { + requestBody[key] = requestBody[key]?.code; + } else if (textConfig?.includes(key)) { + requestBody[key] = requestBody[key]?.trim(); + } + return key; + }) + .filter((key) => requestBody[key]) + .reduce((acc, curr) => { + if (dateConfig[curr] && dateConfig[curr]?.includes("day")) { + _.set(acc, curr, Digit.Utils.date.convertDateToEpoch(requestBody[curr], dateConfig[curr])); + } else { + _.set(acc, curr, requestBody[curr]); + } + return acc; + }, {}); data.body.inbox.tenantId = Digit.ULBService.getCurrentTenantId(); - data.body.inbox.moduleSearchCriteria = { ...SearchCriteria,tenantId:Digit.ULBService.getCurrentTenantId() }; + data.body.inbox.moduleSearchCriteria = { ...SearchCriteria, tenantId: Digit.ULBService.getCurrentTenantId() }; - const presets = Digit.Hooks.useQueryParams(); - if(Object.keys(presets).length > 0 ) { - Object.keys(presets).forEach(preset => { + const presets = Digit.Hooks.useQueryParams(); + if (Object.keys(presets).length > 0) { + Object.keys(presets).forEach((preset) => { //if present in defaultValues object then only set it - if(Object.keys(defaultValues).some(key => key===preset)){ - data.body.inbox.moduleSearchCriteria[preset] = presets[preset] + if (Object.keys(defaultValues).some((key) => key === preset)) { + data.body.inbox.moduleSearchCriteria[preset] = presets[preset]; } - }) + }); } return data; }, additionalCustomizations: (row, key, column, value, t, searchResult) => { - let tenantId = Digit.ULBService.getCurrentTenantId() + let tenantId = Digit.ULBService.getCurrentTenantId(); if (key === "WORKS_BILL_NUMBER") { - let billType = "" + let billType = ""; const bsPurchaseBill = Digit?.Customizations?.["commonUiConfig"]?.getBusinessService("works.purchase"); const bsSupervisionBill = Digit?.Customizations?.["commonUiConfig"]?.getBusinessService("works.supervision"); const bsWageBill = Digit?.Customizations?.["commonUiConfig"]?.getBusinessService("works.wages"); - if(row?.ProcessInstance?.businessService === bsPurchaseBill ){ - billType = "purchase" + if (row?.ProcessInstance?.businessService === bsPurchaseBill) { + billType = "purchase"; } - if(row?.ProcessInstance?.businessService === bsSupervisionBill ){ - billType = "supervision" + if (row?.ProcessInstance?.businessService === bsSupervisionBill) { + billType = "supervision"; } - if(row?.ProcessInstance?.businessService === bsWageBill ){ - billType = "wage" + if (row?.ProcessInstance?.businessService === bsWageBill) { + billType = "wage"; } return ( - + {String(value ? value : t("ES_COMMON_NA"))} ); } if (key === "EXP_BILL_AMOUNT") { - return + return ; } if (key === "WORKS_PROJECT_NAME") { @@ -1524,16 +1553,16 @@ export const UICustomizations = { ); } - if(key === "CORE_COMMON_STATUS") { - return value ? t(Digit.Utils.locale.getTransformedLocale(`BILL_STATUS_PAYMENT_${value}`)) : t("ES_COMMON_NA") + if (key === "CORE_COMMON_STATUS") { + return value ? t(Digit.Utils.locale.getTransformedLocale(`BILL_STATUS_PAYMENT_${value}`)) : t("ES_COMMON_NA"); } - if(key === "ES_COMMON_LOCATION") { + if (key === "ES_COMMON_LOCATION") { const location = { - "ward":value?.ward, - "locality":value?.locality, - "city":row?.businessObject?.tenantId + ward: value?.ward, + locality: value?.locality, + city: row?.businessObject?.tenantId, }; - const headerLocale = Digit.Utils.locale.getTransformedLocale(Digit.ULBService.getCurrentTenantId()) + const headerLocale = Digit.Utils.locale.getTransformedLocale(Digit.ULBService.getCurrentTenantId()); if (location) { let locality = location?.locality ? t(`${headerLocale}_ADMIN_${location?.locality}`) : ""; let ward = location?.ward ? t(`${headerLocale}_ADMIN_${location?.ward}`) : ""; @@ -1542,16 +1571,15 @@ export const UICustomizations = { } return

{"NA"}

; } - if(key === "WORKS_BILL_TYPE") { - const headerLocale = Digit.Utils.locale.getTransformedLocale(value) - return value ? t(`COMMON_MASTERS_BILL_TYPE_${headerLocale}`) : t("ES_COMMON_NA") + if (key === "WORKS_BILL_TYPE") { + const headerLocale = Digit.Utils.locale.getTransformedLocale(value); + return value ? t(`COMMON_MASTERS_BILL_TYPE_${headerLocale}`) : t("ES_COMMON_NA"); } }, MobileDetailsOnClick: (row, tenantId) => { let link; Object.keys(row).map((key) => { - if (key === "WORKS_BILL_NUMBER") - link = `/${window.contextPath}/employee/expenditure/view-bill?tenantId=${tenantId}&billNumber=${row[key]}`; + if (key === "WORKS_BILL_NUMBER") link = `/${window.contextPath}/employee/expenditure/view-bill?tenantId=${tenantId}&billNumber=${row[key]}`; }); return link; }, @@ -1565,57 +1593,60 @@ export const UICustomizations = { return { url: "/egov-workflow-v2/egov-wf/businessservice/_search", - params: { tenantId, businessServices:Digit?.Customizations?.["commonUiConfig"]?.getBusinessService("works.purchase") }, + params: { tenantId, businessServices: Digit?.Customizations?.["commonUiConfig"]?.getBusinessService("works.purchase") }, body: {}, config: { enabled: true, select: (data) => { - const states = data?.BusinessServices?.[0]?.states?.filter(state=> state.state)?.map(state=> { - return { - "code": state?.state, - "i18nKey":`WF_${Digit.Utils.locale.getTransformedLocale(Digit?.Customizations?.["commonUiConfig"]?.getBusinessService("works.purchase"))}_STATUS_${state?.state}`, - "wfStatus":state?.state - } - }) - return states + const states = data?.BusinessServices?.[0]?.states + ?.filter((state) => state.state) + ?.map((state) => { + return { + code: state?.state, + i18nKey: `WF_${Digit.Utils.locale.getTransformedLocale( + Digit?.Customizations?.["commonUiConfig"]?.getBusinessService("works.purchase") + )}_STATUS_${state?.state}`, + wfStatus: state?.state, + }; + }); + return states; }, }, }; }, - selectionHandler: async (selectedRows,t) => { - + selectionHandler: async (selectedRows, t) => { /// here do expense calc search and get the response and send the list of bills to getCreatePaymentPayload - const ids = selectedRows?.map(row=> row?.original?.businessObject?.id) - - const result = await Digit.WorksService.searchBill({ - "billCriteria": { - "tenantId": Digit.ULBService.getCurrentTenantId(), - ids, - // "businessService":[bsPurchaseBill,bsWageBill,bsSupervisionBill] - // "businessService":bsPurchaseBill - }, - "pagination": { - "limit": 50, - "offSet": 0, - "sortBy": "ASC", - "order": "ASC" - } - }) - - const payload = getCreatePaymentPayload(result.bills); - let responseToReturn = { isSuccess: true, label: "BILL_STATUS_PAYMENT_INITIATED_TOAST"} - try { - const response = await Digit.ExpenseService.createPayment(payload); - responseToReturn.label=`${t(responseToReturn?.label)} ${response?.payments?.[0]?.paymentNumber}` - return responseToReturn - } catch (error) { - responseToReturn.isSuccess = false - responseToReturn.label = t("BILL_STATUS_PAYMENT_FAILED") - return responseToReturn - } + const ids = selectedRows?.map((row) => row?.original?.businessObject?.id); + + const result = await Digit.WorksService.searchBill({ + billCriteria: { + tenantId: Digit.ULBService.getCurrentTenantId(), + ids, + // "businessService":[bsPurchaseBill,bsWageBill,bsSupervisionBill] + // "businessService":bsPurchaseBill + }, + pagination: { + limit: 50, + offSet: 0, + sortBy: "ASC", + order: "ASC", + }, + }); + + const payload = getCreatePaymentPayload(result.bills); + let responseToReturn = { isSuccess: true, label: "BILL_STATUS_PAYMENT_INITIATED_TOAST" }; + try { + const response = await Digit.ExpenseService.createPayment(payload); + responseToReturn.label = `${t(responseToReturn?.label)} ${response?.payments?.[0]?.paymentNumber}`; + return responseToReturn; + } catch (error) { + responseToReturn.isSuccess = false; + responseToReturn.label = t("BILL_STATUS_PAYMENT_FAILED"); + return responseToReturn; } + }, }, - CreatePAWMSConfig:{ + CreatePAWMSConfig: { customValidationCheck: (data) => { //checking both to and from date are present const { createdFrom, createdTo } = data; @@ -1624,7 +1655,7 @@ export const UICustomizations = { return false; }, - preProcess: (data,defaultValues) => { + preProcess: (data, defaultValues) => { let requestBody = { ...data.body.inbox.moduleSearchCriteria }; const dateConfig = { createdFrom: "daystart", @@ -1635,73 +1666,69 @@ export const UICustomizations = { ward: "ward[0].code", status: "status[0].code", }; - const textConfig = ["projectName", "billNumber"] + const textConfig = ["projectName", "billNumber"]; let SearchCriteria = Object.keys(requestBody) - .map((key) => { - if (selectConfig[key]) { - requestBody[key] = _.get(requestBody, selectConfig[key], null); - } else if (typeof requestBody[key] == "object") { - requestBody[key] = requestBody[key]?.code; - } else if (textConfig?.includes(key)) { - requestBody[key] = requestBody[key]?.trim() - } - return key; - }) - .filter((key) => requestBody[key]) - .reduce((acc, curr) => { - if (dateConfig[curr] && dateConfig[curr]?.includes("day")) { - _.set(acc, curr, Digit.Utils.date.convertDateToEpoch(requestBody[curr], dateConfig[curr])); - } else { - _.set(acc, curr, requestBody[curr]); - } - return acc; - }, {}); + .map((key) => { + if (selectConfig[key]) { + requestBody[key] = _.get(requestBody, selectConfig[key], null); + } else if (typeof requestBody[key] == "object") { + requestBody[key] = requestBody[key]?.code; + } else if (textConfig?.includes(key)) { + requestBody[key] = requestBody[key]?.trim(); + } + return key; + }) + .filter((key) => requestBody[key]) + .reduce((acc, curr) => { + if (dateConfig[curr] && dateConfig[curr]?.includes("day")) { + _.set(acc, curr, Digit.Utils.date.convertDateToEpoch(requestBody[curr], dateConfig[curr])); + } else { + _.set(acc, curr, requestBody[curr]); + } + return acc; + }, {}); data.body.inbox.tenantId = Digit.ULBService.getCurrentTenantId(); - data.body.inbox.moduleSearchCriteria = { ...SearchCriteria,tenantId:Digit.ULBService.getCurrentTenantId() }; + data.body.inbox.moduleSearchCriteria = { ...SearchCriteria, tenantId: Digit.ULBService.getCurrentTenantId() }; - const presets = Digit.Hooks.useQueryParams(); - if(Object.keys(presets).length > 0 ) { - Object.keys(presets).forEach(preset => { + const presets = Digit.Hooks.useQueryParams(); + if (Object.keys(presets).length > 0) { + Object.keys(presets).forEach((preset) => { //if present in defaultValues object then only set it - if(Object.keys(defaultValues).some(key => key===preset)){ - data.body.inbox.moduleSearchCriteria[preset] = presets[preset] + if (Object.keys(defaultValues).some((key) => key === preset)) { + data.body.inbox.moduleSearchCriteria[preset] = presets[preset]; } - }) + }); } return data; }, additionalCustomizations: (row, key, column, value, t, searchResult) => { - let tenantId = Digit.ULBService.getCurrentTenantId() + let tenantId = Digit.ULBService.getCurrentTenantId(); if (key === "WORKS_BILL_NUMBER") { - let billType = "" + let billType = ""; const bsPurchaseBill = Digit?.Customizations?.["commonUiConfig"]?.getBusinessService("works.purchase"); const bsSupervisionBill = Digit?.Customizations?.["commonUiConfig"]?.getBusinessService("works.supervision"); const bsWageBill = Digit?.Customizations?.["commonUiConfig"]?.getBusinessService("works.wages"); - if(row?.ProcessInstance?.businessService === bsPurchaseBill ){ - billType = "purchase" + if (row?.ProcessInstance?.businessService === bsPurchaseBill) { + billType = "purchase"; } - if(row?.ProcessInstance?.businessService === bsSupervisionBill ){ - billType = "supervision" + if (row?.ProcessInstance?.businessService === bsSupervisionBill) { + billType = "supervision"; } - if(row?.ProcessInstance?.businessService === bsWageBill ){ - billType = "wage" + if (row?.ProcessInstance?.businessService === bsWageBill) { + billType = "wage"; } return ( - + {String(value ? value : t("ES_COMMON_NA"))} ); } if (key === "EXP_BILL_AMOUNT") { - return + return ; } if (key === "WORKS_PROJECT_NAME") { @@ -1718,16 +1745,16 @@ export const UICustomizations = { ); } - if(key === "CORE_COMMON_STATUS") { - return value ? t(`BILL_STATUS_PAYMENT_INITIATED`) : t("ES_COMMON_NA") + if (key === "CORE_COMMON_STATUS") { + return value ? t(`BILL_STATUS_PAYMENT_INITIATED`) : t("ES_COMMON_NA"); } - if(key === "ES_COMMON_LOCATION") { + if (key === "ES_COMMON_LOCATION") { const location = { - "ward":value?.ward, - "locality":value?.locality, - "city":row?.businessObject?.tenantId + ward: value?.ward, + locality: value?.locality, + city: row?.businessObject?.tenantId, }; - const headerLocale = Digit.Utils.locale.getTransformedLocale(Digit.ULBService.getCurrentTenantId()) + const headerLocale = Digit.Utils.locale.getTransformedLocale(Digit.ULBService.getCurrentTenantId()); if (location) { let locality = location?.locality ? t(`${headerLocale}_ADMIN_${location?.locality}`) : ""; let ward = location?.ward ? t(`${headerLocale}_ADMIN_${location?.ward}`) : ""; @@ -1736,16 +1763,15 @@ export const UICustomizations = { } return

{"NA"}

; } - if(key === "WORKS_BILL_TYPE") { - const headerLocale = Digit.Utils.locale.getTransformedLocale(value) - return value ? t(`COMMON_MASTERS_BILL_TYPE_${headerLocale}`) : t("ES_COMMON_NA") + if (key === "WORKS_BILL_TYPE") { + const headerLocale = Digit.Utils.locale.getTransformedLocale(value); + return value ? t(`COMMON_MASTERS_BILL_TYPE_${headerLocale}`) : t("ES_COMMON_NA"); } }, MobileDetailsOnClick: (row, tenantId) => { let link; Object.keys(row).map((key) => { - if (key === "WORKS_BILL_NUMBER") - link = `/${window.contextPath}/employee/expenditure/view-bill?tenantId=${tenantId}&billNumber=${row[key]}`; + if (key === "WORKS_BILL_NUMBER") link = `/${window.contextPath}/employee/expenditure/view-bill?tenantId=${tenantId}&billNumber=${row[key]}`; }); return link; }, @@ -1759,88 +1785,89 @@ export const UICustomizations = { return { url: "/egov-workflow-v2/egov-wf/businessservice/_search", - params: { tenantId, businessServices:Digit?.Customizations?.["commonUiConfig"]?.getBusinessService("works.purchase") }, + params: { tenantId, businessServices: Digit?.Customizations?.["commonUiConfig"]?.getBusinessService("works.purchase") }, body: {}, config: { enabled: true, select: (data) => { - const states = data?.BusinessServices?.[0]?.states?.filter(state=> state.state)?.map(state=> { - return { - "code": state?.state, - "i18nKey":`WF_${Digit.Utils.locale.getTransformedLocale(Digit?.Customizations?.["commonUiConfig"]?.getBusinessService("works.purchase"))}_STATUS_${state?.state}`, - "wfStatus":state?.state - } - }) - return states + const states = data?.BusinessServices?.[0]?.states + ?.filter((state) => state.state) + ?.map((state) => { + return { + code: state?.state, + i18nKey: `WF_${Digit.Utils.locale.getTransformedLocale( + Digit?.Customizations?.["commonUiConfig"]?.getBusinessService("works.purchase") + )}_STATUS_${state?.state}`, + wfStatus: state?.state, + }; + }); + return states; }, }, }; }, - selectionHandler: async (selectedRows,t) => { - + selectionHandler: async (selectedRows, t) => { /// here do expense calc search and get the response and send the list of bills to getCreatePaymentPayload - const ids = selectedRows?.map(row=> row?.original?.businessObject?.id) - - const result = await Digit.WorksService.searchBill({ - "billCriteria": { - "tenantId": Digit.ULBService.getCurrentTenantId(), - ids, - // "businessService":[bsPurchaseBill,bsWageBill,bsSupervisionBill] - // "businessService":bsPurchaseBill - }, - "pagination": { - "limit": 50, - "offSet": 0, - "sortBy": "ASC", - "order": "ASC" - } - }) - - // const payload = getCreatePaymentPayload(result.bills); - //Updated this code to call create n number of times(one for every bill) - let responseToReturn = { isSuccess: true, label: "BILL_STATUS_PAYMENT_INITIATED_TOAST"} - let statuses = [] - for(let i=0;i row?.original?.businessObject?.id); + + const result = await Digit.WorksService.searchBill({ + billCriteria: { + tenantId: Digit.ULBService.getCurrentTenantId(), + ids, + // "businessService":[bsPurchaseBill,bsWageBill,bsSupervisionBill] + // "businessService":bsPurchaseBill + }, + pagination: { + limit: 50, + offSet: 0, + sortBy: "ASC", + order: "ASC", + }, + }); + + // const payload = getCreatePaymentPayload(result.bills); + //Updated this code to call create n number of times(one for every bill) + let responseToReturn = { isSuccess: true, label: "BILL_STATUS_PAYMENT_INITIATED_TOAST" }; + let statuses = []; + for (let i = 0; i < result.bills.length; i++) { + try { + const payload = getCreatePaymentPayload([result.bills?.[i]]); + const response = await Digit.ExpenseService.createPayment(payload); + // responseToReturn.label=`${t(responseToReturn?.label)} ${response?.payments?.[0]?.paymentNumber}` + statuses.push([result.bills?.[i]?.billNumber, "success", response?.payments?.[0]?.paymentNumber]); + // return responseToReturn + } catch (error) { + // responseToReturn.isSuccess = false + // responseToReturn.label = t("BILL_STATUS_PAYMENT_FAILED") + statuses.push([result.bills?.[i]?.billNumber, "failed"]); + // return responseToReturn } - - let atleastOnePaymentSuccess = statuses?.some(status => status?.[1]==="success") - responseToReturn.isSuccess = atleastOnePaymentSuccess ? true : false - let initiatedBills = "" - let failedBills = "" - statuses?.forEach(status => { - if(status[1]==="success") initiatedBills += `${status[0]}, ` - else failedBills += `${status[0]}, ` - }) - const returnLabel = `${t("BILL_STATUS_PAYMENT_INITIATED")}:${initiatedBills} ${t("BILL_STATUS_PAYMENT_FAILED")}:${failedBills}` - responseToReturn.label = returnLabel - return responseToReturn - }, - } - , - SearchPIWMS:{ + } + + let atleastOnePaymentSuccess = statuses?.some((status) => status?.[1] === "success"); + responseToReturn.isSuccess = atleastOnePaymentSuccess ? true : false; + let initiatedBills = ""; + let failedBills = ""; + statuses?.forEach((status) => { + if (status[1] === "success") initiatedBills += `${status[0]}, `; + else failedBills += `${status[0]}, `; + }); + const returnLabel = `${t("BILL_STATUS_PAYMENT_INITIATED")}:${initiatedBills} ${t("BILL_STATUS_PAYMENT_FAILED")}:${failedBills}`; + responseToReturn.label = returnLabel; + return responseToReturn; + }, + }, + SearchPIWMS: { customValidationCheck: (data) => { //checking both to and from date are present - + const { createdFrom, createdTo } = data; if ((createdFrom === "" && createdTo !== "") || (createdFrom !== "" && createdTo === "")) return { warning: true, label: "ES_COMMON_ENTER_DATE_RANGE" }; return false; }, - preProcess: (data,defaultValues,nav) => { - + preProcess: (data, defaultValues, nav) => { let requestBody = { ...data.body.inbox.moduleSearchCriteria }; const dateConfig = { createdFrom: "daystart", @@ -1850,61 +1877,60 @@ export const UICustomizations = { // billType: "billType.code", // ward: "ward[0].code", status: "status.code", - piType:"piType.code" + piType: "piType.code", }; - const textConfig = ["billNumber","jitBillNo"] + const textConfig = ["billNumber", "jitBillNo"]; let SearchCriteria = Object.keys(requestBody) - .map((key) => { - if (selectConfig[key]) { - requestBody[key] = _.get(requestBody, selectConfig[key], null); - } else if (typeof requestBody[key] == "object") { - requestBody[key] = requestBody[key]?.code; - } else if (textConfig?.includes(key)) { - requestBody[key] = requestBody[key]?.trim() - } - return key; - }) - .filter((key) => requestBody[key]) - .reduce((acc, curr) => { - if (dateConfig[curr] && dateConfig[curr]?.includes("day")) { - _.set(acc, curr, Digit.Utils.date.convertDateToEpoch(requestBody[curr], dateConfig[curr])); - } else { - _.set(acc, curr, requestBody[curr]); - } - return acc; - }, {}); + .map((key) => { + if (selectConfig[key]) { + requestBody[key] = _.get(requestBody, selectConfig[key], null); + } else if (typeof requestBody[key] == "object") { + requestBody[key] = requestBody[key]?.code; + } else if (textConfig?.includes(key)) { + requestBody[key] = requestBody[key]?.trim(); + } + return key; + }) + .filter((key) => requestBody[key]) + .reduce((acc, curr) => { + if (dateConfig[curr] && dateConfig[curr]?.includes("day")) { + _.set(acc, curr, Digit.Utils.date.convertDateToEpoch(requestBody[curr], dateConfig[curr])); + } else { + _.set(acc, curr, requestBody[curr]); + } + return acc; + }, {}); data.body.inbox.tenantId = Digit.ULBService.getCurrentTenantId(); - data.body.inbox.moduleSearchCriteria = { ...SearchCriteria,tenantId:Digit.ULBService.getCurrentTenantId() }; + data.body.inbox.moduleSearchCriteria = { ...SearchCriteria, tenantId: Digit.ULBService.getCurrentTenantId() }; - const presets = Digit.Hooks.useQueryParams(); - if(Object.keys(presets).length > 0 ) { - Object.keys(presets).forEach(preset => { + const presets = Digit.Hooks.useQueryParams(); + if (Object.keys(presets).length > 0) { + Object.keys(presets).forEach((preset) => { //if present in defaultValues object then only set it - if(Object.keys(defaultValues).some(key => key===preset)){ - data.body.inbox.moduleSearchCriteria[preset] = presets[preset] + if (Object.keys(defaultValues).some((key) => key === preset)) { + data.body.inbox.moduleSearchCriteria[preset] = presets[preset]; } - }) + }); } - - if(nav === "Pending for action"){ - data.body.inbox.moduleSearchCriteria.status = ["PARTIAL","FAILED"] + if (nav === "Pending for action") { + data.body.inbox.moduleSearchCriteria.status = ["PARTIAL", "FAILED"]; } return data; }, additionalCustomizations: (row, key, column, value, t, searchResult) => { - let tenantId = Digit.ULBService.getCurrentTenantId() - let numSuccess = 0 - let numFailed = 0 - row?.businessObject?.beneficiaryDetails?.forEach(bene => { - if(bene?.paymentStatus === "Payment Successful"){ - numSuccess +=1 - }else if(bene?.paymentStatus === "Payment Failed"){ - numFailed += 1 + let tenantId = Digit.ULBService.getCurrentTenantId(); + let numSuccess = 0; + let numFailed = 0; + row?.businessObject?.beneficiaryDetails?.forEach((bene) => { + if (bene?.paymentStatus === "Payment Successful") { + numSuccess += 1; + } else if (bene?.paymentStatus === "Payment Failed") { + numFailed += 1; } - }) + }); if (key === "EXP_PI_ID") { return ( @@ -1912,9 +1938,7 @@ export const UICustomizations = { // to={`/${ // window.contextPath // }/employee/expenditure/view-payment-instruction?tenantId=${tenantId}&piNumber=${value}`} - to={`/${ - window.contextPath - }/employee/expenditure/view-payment?tenantId=${tenantId}&paymentNumber=${row?.businessObject?.muktaReferenceId}`} + to={`/${window.contextPath}/employee/expenditure/view-payment?tenantId=${tenantId}&paymentNumber=${row?.businessObject?.muktaReferenceId}`} > {String(value ? value : t("ES_COMMON_NA"))} @@ -1922,7 +1946,7 @@ export const UICustomizations = { ); } if (key === "EXP_PI_DATE") { - return Digit.DateUtils.ConvertEpochToDate(value) + return Digit.DateUtils.ConvertEpochToDate(value); // return } @@ -1940,23 +1964,21 @@ export const UICustomizations = { // ); // } - if(key === "EXP_NO_SUCC_PAYMENTS") { - return numSuccess + if (key === "EXP_NO_SUCC_PAYMENTS") { + return numSuccess; } - if(key === "EXP_NO_FAIL_PAYMENTS") { - return numFailed + if (key === "EXP_NO_FAIL_PAYMENTS") { + return numFailed; } - if(key === "CORE_COMMON_STATUS") { - return t(Digit.Utils.locale.getTransformedLocale(`EXP_PI_STATUS_${value}`)) - } - - if(key === "ES_COMMON_TOTAL_AMOUNT") { - return + if (key === "CORE_COMMON_STATUS") { + return t(Digit.Utils.locale.getTransformedLocale(`EXP_PI_STATUS_${value}`)); } - else{ - return t("ES_COMMON_NA") + if (key === "ES_COMMON_TOTAL_AMOUNT") { + return ; + } else { + return t("ES_COMMON_NA"); } }, additionalValidations: (type, data, keys) => { @@ -1974,8 +1996,7 @@ export const UICustomizations = { return false; }, - preProcess: (data,defaultValues) => { - + preProcess: (data, defaultValues) => { let requestBody = { ...data.body.paymentCriteria }; const dateConfig = { createdFrom: "daystart", @@ -1986,76 +2007,72 @@ export const UICustomizations = { ward: "ward[0].code", status: "status[0].code", }; - const textConfig = ["projectName", "billNumber"] + const textConfig = ["projectName", "billNumber"]; let SearchCriteria = Object.keys(requestBody) - .map((key) => { - if (selectConfig[key]) { - requestBody[key] = _.get(requestBody, selectConfig[key], null); - } else if (typeof requestBody[key] == "object") { - requestBody[key] = requestBody[key]?.code; - } else if (textConfig?.includes(key)) { - requestBody[key] = requestBody[key]?.trim() - } - return key; - }) - .filter((key) => requestBody[key]) - .reduce((acc, curr) => { - if (dateConfig[curr] && dateConfig[curr]?.includes("day")) { - _.set(acc, curr, Digit.Utils.date.convertDateToEpoch(requestBody[curr], dateConfig[curr])); - } else { - _.set(acc, curr, requestBody[curr]); - } - return acc; - }, {}); + .map((key) => { + if (selectConfig[key]) { + requestBody[key] = _.get(requestBody, selectConfig[key], null); + } else if (typeof requestBody[key] == "object") { + requestBody[key] = requestBody[key]?.code; + } else if (textConfig?.includes(key)) { + requestBody[key] = requestBody[key]?.trim(); + } + return key; + }) + .filter((key) => requestBody[key]) + .reduce((acc, curr) => { + if (dateConfig[curr] && dateConfig[curr]?.includes("day")) { + _.set(acc, curr, Digit.Utils.date.convertDateToEpoch(requestBody[curr], dateConfig[curr])); + } else { + _.set(acc, curr, requestBody[curr]); + } + return acc; + }, {}); data.body.paymentCriteria.tenantId = Digit.ULBService.getCurrentTenantId(); - data.body.paymentCriteria = { ...SearchCriteria,tenantId:Digit.ULBService.getCurrentTenantId() }; - + data.body.paymentCriteria = { ...SearchCriteria, tenantId: Digit.ULBService.getCurrentTenantId() }; + //added for testing(to have some results) - data.body.paymentCriteria.status = "INITIATED" + data.body.paymentCriteria.status = "INITIATED"; - const presets = Digit.Hooks.useQueryParams(); - if(Object.keys(presets).length > 0 ) { - Object.keys(presets).forEach(preset => { + const presets = Digit.Hooks.useQueryParams(); + if (Object.keys(presets).length > 0) { + Object.keys(presets).forEach((preset) => { //if present in defaultValues object then only set it - if(Object.keys(defaultValues).some(key => key===preset)){ - data.body.paymentCriteria[preset] = presets[preset] + if (Object.keys(defaultValues).some((key) => key === preset)) { + data.body.paymentCriteria[preset] = presets[preset]; } - }) + }); } return data; }, additionalCustomizations: (row, key, column, value, t, searchResult) => { - let tenantId = Digit.ULBService.getCurrentTenantId() + let tenantId = Digit.ULBService.getCurrentTenantId(); if (key === "WORKS_BILL_NUMBER") { - let billType = "" + let billType = ""; const bsPurchaseBill = Digit?.Customizations?.["commonUiConfig"]?.getBusinessService("works.purchase"); const bsSupervisionBill = Digit?.Customizations?.["commonUiConfig"]?.getBusinessService("works.supervision"); const bsWageBill = Digit?.Customizations?.["commonUiConfig"]?.getBusinessService("works.wages"); - if(row?.ProcessInstance?.businessService === bsPurchaseBill ){ - billType = "purchase" + if (row?.ProcessInstance?.businessService === bsPurchaseBill) { + billType = "purchase"; } - if(row?.ProcessInstance?.businessService === bsSupervisionBill ){ - billType = "supervision" + if (row?.ProcessInstance?.businessService === bsSupervisionBill) { + billType = "supervision"; } - if(row?.ProcessInstance?.businessService === bsWageBill ){ - billType = "wage" + if (row?.ProcessInstance?.businessService === bsWageBill) { + billType = "wage"; } return ( - + {String(value ? value : t("ES_COMMON_NA"))} ); } if (key === "EXP_BILL_AMOUNT") { - return + return ; } if (key === "WORKS_PROJECT_NAME") { @@ -2072,16 +2089,16 @@ export const UICustomizations = { ); } - if(key === "CORE_COMMON_STATUS") { - return value ? t(`BILL_STATUS_PAYMENT_INITIATED`) : t("ES_COMMON_NA") + if (key === "CORE_COMMON_STATUS") { + return value ? t(`BILL_STATUS_PAYMENT_INITIATED`) : t("ES_COMMON_NA"); } - if(key === "ES_COMMON_LOCATION") { + if (key === "ES_COMMON_LOCATION") { const location = { - "ward":value?.ward, - "locality":value?.locality, - "city":row?.businessObject?.tenantId + ward: value?.ward, + locality: value?.locality, + city: row?.businessObject?.tenantId, }; - const headerLocale = Digit.Utils.locale.getTransformedLocale(Digit.ULBService.getCurrentTenantId()) + const headerLocale = Digit.Utils.locale.getTransformedLocale(Digit.ULBService.getCurrentTenantId()); if (location) { let locality = location?.locality ? t(`${headerLocale}_ADMIN_${location?.locality}`) : ""; let ward = location?.ward ? t(`${headerLocale}_ADMIN_${location?.ward}`) : ""; @@ -2090,9 +2107,9 @@ export const UICustomizations = { } return

{"NA"}

; } - if(key === "WORKS_BILL_TYPE") { - const headerLocale = Digit.Utils.locale.getTransformedLocale(value) - return value ? t(`COMMON_MASTERS_BILL_TYPE_${headerLocale}`) : t("ES_COMMON_NA") + if (key === "WORKS_BILL_TYPE") { + const headerLocale = Digit.Utils.locale.getTransformedLocale(value); + return value ? t(`COMMON_MASTERS_BILL_TYPE_${headerLocale}`) : t("ES_COMMON_NA"); } }, additionalValidations: (type, data, keys) => { @@ -2100,7 +2117,6 @@ export const UICustomizations = { return data[keys.start] && data[keys.end] ? () => new Date(data[keys.start]).getTime() <= new Date(data[keys.end]).getTime() : true; } }, - }, SearchBillConfig: { customValidationCheck: (data) => { @@ -2112,92 +2128,86 @@ export const UICustomizations = { return false; }, preProcess: (data) => { - - const createdFromDate = Digit.Utils.pt.convertDateToEpoch(data?.body?.searchCriteria?.createdFrom,"daystart"); - delete data?.body?.searchCriteria?.createdFrom + const createdFromDate = Digit.Utils.pt.convertDateToEpoch(data?.body?.searchCriteria?.createdFrom, "daystart"); + delete data?.body?.searchCriteria?.createdFrom; // if(createdFromDate) data.body.searchCriteria.createdFrom = createdFromDate const createdToDate = Digit.Utils.pt.convertDateToEpoch(data?.body?.searchCriteria?.createdTo); - delete data?.body?.searchCriteria?.createdTo + delete data?.body?.searchCriteria?.createdTo; // if(createdToDate) data.body.searchCriteria.createdTo = createdToDate - - const status = data?.body?.searchCriteria?.status?.[0]?.code - delete data?.body?.searchCriteria?.status + + const status = data?.body?.searchCriteria?.status?.[0]?.code; + delete data?.body?.searchCriteria?.status; // if(status){ // data.body.searchCriteria.status = status // } const billType = data?.body?.searchCriteria?.billType?.code; - delete data?.body?.searchCriteria?.billType - delete data?.body?.searchCriteria?.billTypes - if(billType) data.body.searchCriteria.billTypes = [billType] + delete data?.body?.searchCriteria?.billType; + delete data?.body?.searchCriteria?.billTypes; + if (billType) data.body.searchCriteria.billTypes = [billType]; // const ward = data?.body?.searchCriteria?.ward?.[0]?.code - delete data?.body?.searchCriteria?.ward + delete data?.body?.searchCriteria?.ward; // if(ward) data.body.searchCriteria.ward = ward - const billNumber = data?.body?.searchCriteria?.billNumber?.trim() - delete data?.body?.searchCriteria?.billNumber - delete data?.body?.searchCriteria?.billNumbers - if(billNumber) data.body.searchCriteria.billNumbers = [billNumber] - - const projectNumber = data?.body?.searchCriteria?.projectNumber?.trim() - delete data?.body?.searchCriteria?.projectNumber - if(projectNumber) data.body.searchCriteria.projectNumbers = [projectNumber] + const billNumber = data?.body?.searchCriteria?.billNumber?.trim(); + delete data?.body?.searchCriteria?.billNumber; + delete data?.body?.searchCriteria?.billNumbers; + if (billNumber) data.body.searchCriteria.billNumbers = [billNumber]; + + const projectNumber = data?.body?.searchCriteria?.projectNumber?.trim(); + delete data?.body?.searchCriteria?.projectNumber; + if (projectNumber) data.body.searchCriteria.projectNumbers = [projectNumber]; data.body.searchCriteria.tenantId = Digit.ULBService.getCurrentTenantId(); - delete data.body.searchCriteria.ward - + delete data.body.searchCriteria.ward; + return data; }, additionalCustomizations: (row, key, column, value, t, searchResult) => { - let tenantId = Digit.ULBService.getCurrentTenantId() + let tenantId = Digit.ULBService.getCurrentTenantId(); if (key === "WORKS_BILL_NUMBER") { - let billType = "" + let billType = ""; const bsPurchaseBill = Digit?.Customizations?.["commonUiConfig"]?.getBusinessService("works.purchase"); const bsSupervisionBill = Digit?.Customizations?.["commonUiConfig"]?.getBusinessService("works.supervision"); const bsWageBill = Digit?.Customizations?.["commonUiConfig"]?.getBusinessService("works.wages"); - if(row?.bill?.businessService === bsPurchaseBill ){ - billType = "purchase" + if (row?.bill?.businessService === bsPurchaseBill) { + billType = "purchase"; } - if(row?.bill?.businessService === bsSupervisionBill ){ - billType = "supervision" + if (row?.bill?.businessService === bsSupervisionBill) { + billType = "supervision"; } - if(row?.bill?.businessService === bsWageBill ){ - billType = "wage" + if (row?.bill?.businessService === bsWageBill) { + billType = "wage"; } return ( - + {String(value ? value : t("ES_COMMON_NA"))} ); } if (key === "WORKS_BILL_TYPE") { - return value ? t(`COMMON_MASTERS_BILL_TYPE_${Digit.Utils.locale.getTransformedLocale(value)}`) : t("ES_COMMON_NA") + return value ? t(`COMMON_MASTERS_BILL_TYPE_${Digit.Utils.locale.getTransformedLocale(value)}`) : t("ES_COMMON_NA"); } if (key === "EXP_BILL_AMOUNT") { - return + return ; } - if(key === "CORE_COMMON_STATUS") { - return value ? t(Digit.Utils.locale.getTransformedLocale(`WF_${row?.bill?.businessService}_STATUS_${value}`)) : t("ES_COMMON_NA") + if (key === "CORE_COMMON_STATUS") { + return value ? t(Digit.Utils.locale.getTransformedLocale(`WF_${row?.bill?.businessService}_STATUS_${value}`)) : t("ES_COMMON_NA"); } - if(key === "ES_COMMON_LOCATION") { + if (key === "ES_COMMON_LOCATION") { const location = value; - const headerLocale = Digit.Utils.locale.getTransformedLocale(tenantId) - return location ? t(`TENANT_TENANTS_${headerLocale}`) : t("ES_COMMON_NA") + const headerLocale = Digit.Utils.locale.getTransformedLocale(tenantId); + return location ? t(`TENANT_TENANTS_${headerLocale}`) : t("ES_COMMON_NA"); } }, MobileDetailsOnClick: (row, tenantId) => { let link; Object.keys(row).map((key) => { - if (key === "WORKS_BILL_NUMBER") - link = `/${window.contextPath}/employee/expenditure/view-bill?tenantId=${tenantId}&billNumber=${row[key]}`; + if (key === "WORKS_BILL_NUMBER") link = `/${window.contextPath}/employee/expenditure/view-bill?tenantId=${tenantId}&billNumber=${row[key]}`; }); return link; }, @@ -2211,36 +2221,40 @@ export const UICustomizations = { return { url: "/egov-workflow-v2/egov-wf/businessservice/_search", - params: { tenantId, businessServices:Digit?.Customizations?.["commonUiConfig"]?.getBusinessService("works.purchase") }, + params: { tenantId, businessServices: Digit?.Customizations?.["commonUiConfig"]?.getBusinessService("works.purchase") }, body: {}, config: { enabled: true, select: (data) => { - const states = data?.BusinessServices?.[0]?.states?.filter(state=> state.state)?.map(state=> { - return { - "code": state?.state, - "i18nKey":`WF_${Digit.Utils.locale.getTransformedLocale(Digit?.Customizations?.["commonUiConfig"]?.getBusinessService("works.purchase"))}_STATUS_${state?.state}`, - "wfStatus":state?.state - } - }) - return states + const states = data?.BusinessServices?.[0]?.states + ?.filter((state) => state.state) + ?.map((state) => { + return { + code: state?.state, + i18nKey: `WF_${Digit.Utils.locale.getTransformedLocale( + Digit?.Customizations?.["commonUiConfig"]?.getBusinessService("works.purchase") + )}_STATUS_${state?.state}`, + wfStatus: state?.state, + }; + }); + return states; }, }, }; }, - selectionHandler: async (selectedRows,t) => { - const payload = getCreatePaymentPayload(selectedRows,t); - let responseToReturn = { isSuccess: true, label: "BILL_STATUS_PAYMENT_SUCCESS"} + selectionHandler: async (selectedRows, t) => { + const payload = getCreatePaymentPayload(selectedRows, t); + let responseToReturn = { isSuccess: true, label: "BILL_STATUS_PAYMENT_SUCCESS" }; try { const response = await Digit.PaymentService.createPayment(payload); - responseToReturn.label=`${t(responseToReturn?.label)} : ${response?.payments?.[0]?.paymentNumber}` - return responseToReturn + responseToReturn.label = `${t(responseToReturn?.label)} : ${response?.payments?.[0]?.paymentNumber}`; + return responseToReturn; } catch (error) { - responseToReturn.isSuccess = false - responseToReturn.label = t("BILL_STATUS_PAYMENT_FAILED") - return responseToReturn + responseToReturn.isSuccess = false; + responseToReturn.label = t("BILL_STATUS_PAYMENT_FAILED"); + return responseToReturn; } - } + }, }, SearchExpenseBillConfig: { customValidationCheck: (data) => { @@ -2252,67 +2266,62 @@ export const UICustomizations = { return false; }, preProcess: (data) => { - const createdFromDate = Digit.Utils.pt.convertDateToEpoch(data?.body?.billCriteria?.createdFrom,"daystart"); - if(createdFromDate) data.body.billCriteria.createdFrom = createdFromDate + const createdFromDate = Digit.Utils.pt.convertDateToEpoch(data?.body?.billCriteria?.createdFrom, "daystart"); + if (createdFromDate) data.body.billCriteria.createdFrom = createdFromDate; const createdToDate = Digit.Utils.pt.convertDateToEpoch(data?.body?.billCriteria?.createdTo); - if(createdToDate) data.body.billCriteria.createdTo = createdToDate + if (createdToDate) data.body.billCriteria.createdTo = createdToDate; - const status = data?.body?.billCriteria?.status?.[0]?.code - delete data?.body?.billCriteria?.status - if(status){ - data.body.billCriteria.status = status + const status = data?.body?.billCriteria?.status?.[0]?.code; + delete data?.body?.billCriteria?.status; + if (status) { + data.body.billCriteria.status = status; } const billType = data?.body?.billCriteria?.billType?.code; - delete data?.body?.billCriteria?.billType - if(billType) data.body.billCriteria.businessService = billType - - const ward = data?.body?.billCriteria?.ward?.[0]?.code - delete data?.body?.billCriteria?.ward - if(ward) data.body.billCriteria.ward = ward - - const billNumber = data?.body?.billCriteria?.billNumber?.trim() - delete data?.body?.billCriteria?.billNumber - delete data?.body?.billCriteria?.billNumbers - if(billNumber) data.body.billCriteria.billNumbers = [billNumber] - + delete data?.body?.billCriteria?.billType; + if (billType) data.body.billCriteria.businessService = billType; + + const ward = data?.body?.billCriteria?.ward?.[0]?.code; + delete data?.body?.billCriteria?.ward; + if (ward) data.body.billCriteria.ward = ward; + + const billNumber = data?.body?.billCriteria?.billNumber?.trim(); + delete data?.body?.billCriteria?.billNumber; + delete data?.body?.billCriteria?.billNumbers; + if (billNumber) data.body.billCriteria.billNumbers = [billNumber]; + data.body.billCriteria.tenantId = Digit.ULBService.getCurrentTenantId(); return data; }, additionalCustomizations: (row, key, column, value, t, searchResult) => { if (key === "WORKS_BILL_NUMBER") { - const billType = getBillType(row?.businessService) + const billType = getBillType(row?.businessService); return ( - + {String(value ? value : t("ES_COMMON_NA"))} ); } if (key === "WORKS_BILL_TYPE") { - return value ? `COMMON_MASTERS_BILL_TYPE_${Digit.Utils.locale.getTransformedLocale(value)}` : t("ES_COMMON_NA") + return value ? `COMMON_MASTERS_BILL_TYPE_${Digit.Utils.locale.getTransformedLocale(value)}` : t("ES_COMMON_NA"); } if (key === "EXP_BILL_AMOUNT") { - return + return ; } - if(key === "CORE_COMMON_STATUS") { - return value ? t(`BILL_STATUS_${value}`) : t("ES_COMMON_NA") + if (key === "CORE_COMMON_STATUS") { + return value ? t(`BILL_STATUS_${value}`) : t("ES_COMMON_NA"); } - if(key === "ES_COMMON_LOCATION") { - const headerLocale = Digit.Utils.locale.getTransformedLocale(row?.tenantId) - return t(`TENANT_TENANTS_${headerLocale}`) + if (key === "ES_COMMON_LOCATION") { + const headerLocale = Digit.Utils.locale.getTransformedLocale(row?.tenantId); + return t(`TENANT_TENANTS_${headerLocale}`); } }, MobileDetailsOnClick: (row, tenantId) => { let link; Object.keys(row).map((key) => { - if (key === "WORKS_BILL_NUMBER") - link = `/${window.contextPath}/employee/expenditure/view-bill?tenantId=${tenantId}&billNumber=${row[key]}`; + if (key === "WORKS_BILL_NUMBER") link = `/${window.contextPath}/employee/expenditure/view-bill?tenantId=${tenantId}&billNumber=${row[key]}`; }); return link; }, @@ -2326,35 +2335,39 @@ export const UICustomizations = { return { url: "/egov-workflow-v2/egov-wf/businessservice/_search", - params: { tenantId, businessServices:Digit?.Customizations?.["commonUiConfig"]?.getBusinessService("works.purchase") }, + params: { tenantId, businessServices: Digit?.Customizations?.["commonUiConfig"]?.getBusinessService("works.purchase") }, body: {}, config: { enabled: true, select: (data) => { - const states = data?.BusinessServices?.[0]?.states?.filter(state=> state.state)?.map(state=> { - return { - "code": state?.state, - "i18nKey":`WF_${Digit.Utils.locale.getTransformedLocale(Digit?.Customizations?.["commonUiConfig"]?.getBusinessService("works.purchase"))}_STATUS_${state?.state}`, - "wfStatus":state?.state - } - }) - return states + const states = data?.BusinessServices?.[0]?.states + ?.filter((state) => state.state) + ?.map((state) => { + return { + code: state?.state, + i18nKey: `WF_${Digit.Utils.locale.getTransformedLocale( + Digit?.Customizations?.["commonUiConfig"]?.getBusinessService("works.purchase") + )}_STATUS_${state?.state}`, + wfStatus: state?.state, + }; + }); + return states; }, }, }; }, selectionHandler: async (selectedRows) => { const payload = getCreatePaymentPayload(selectedRows); - let responseToReturn = { isSuccess: true, label: "BILL_STATUS_PAYMENT_SUCCESS"} + let responseToReturn = { isSuccess: true, label: "BILL_STATUS_PAYMENT_SUCCESS" }; try { const response = await Digit.PaymentService.createPayment(payload); - return responseToReturn + return responseToReturn; } catch (error) { - responseToReturn.isSuccess = false - responseToReturn.label = t("BILL_STATUS_PAYMENT_FAILED") - return responseToReturn + responseToReturn.isSuccess = false; + responseToReturn.label = t("BILL_STATUS_PAYMENT_FAILED"); + return responseToReturn; } - } + }, }, DownloadBillConfig: { preProcess: (data) => { @@ -2362,19 +2375,19 @@ export const UICustomizations = { return data; }, additionalCustomizations: (row, key, column, value, t, searchResult) => { - if(key === "WORKS_SNO"){ - return {searchResult?.findIndex(e=>e?.id==row?.id)+1} + if (key === "WORKS_SNO") { + return {searchResult?.findIndex((e) => e?.id == row?.id) + 1}; } if (key === "ES_COMMON_TOTAL_AMOUNT") { - return + return ; } - if(key === "CORE_COMMON_STATUS") { - return t("BILL_STATUS_PAYMENT_INITIATED") + if (key === "CORE_COMMON_STATUS") { + return t("BILL_STATUS_PAYMENT_INITIATED"); } - if(key === "ES_COMMON_DATE") { - return value ? Digit.DateUtils.ConvertTimestampToDate(parseInt(value), "dd/MM/yyyy") : t("ES_COMMON_NA") + if (key === "ES_COMMON_DATE") { + return value ? Digit.DateUtils.ConvertTimestampToDate(parseInt(value), "dd/MM/yyyy") : t("ES_COMMON_NA"); } - if(key === "CS_COMMON_ACTION") { + if (key === "CS_COMMON_ACTION") { switch (row?.status) { case "COMPLETED": return value ? ( @@ -2403,34 +2416,186 @@ export const UICustomizations = { > {t("CS_COMMON_DOWNLOAD")} - ) : ; + ) : ( + + ); case "INPROGRESS": return t("CS_COMMON_NA"); case "FAILED": - return + return ; default: return t("CS_COMMON_NA"); } - - } - } + }, }, - BillInboxConfig:{ + + WMSSearchMeasurementConfig: { + + customValidationCheck: (data) => { + //checking both to and from date are present + const { createdFrom, createdTo } = data; + if ((createdFrom === "" && createdTo !== "") || ( createdFrom!== "" && createdTo === "")) + return { warning: true, label: "ES_COMMON_ENTER_DATE_RANGE" }; + + return false; + }, + + preProcess: (data) => { + + let moduleSearchCriteria = data?.body?.inbox?.moduleSearchCriteria; + + moduleSearchCriteria = { + ...(moduleSearchCriteria?.measurementNumber && { measurementNumber: moduleSearchCriteria?.measurementNumber?.trim() }), + ...(moduleSearchCriteria?.projectName && { projectName : moduleSearchCriteria?.projectName}), + ...(moduleSearchCriteria?.status && {status : moduleSearchCriteria?.status}), + ...(moduleSearchCriteria?.ward && {ward : moduleSearchCriteria?.ward}), + ...(moduleSearchCriteria?.referenceId && {referenceId : moduleSearchCriteria?.referenceId}), + ...(moduleSearchCriteria?.createdFrom && {createdFrom : Digit.Utils.pt.convertDateToEpoch(moduleSearchCriteria?.createdFrom)}), + ...(moduleSearchCriteria?.createdTo && {createdTo : Digit.Utils.pt.convertDateToEpoch(moduleSearchCriteria?.createdTo)}) + } + data.body.inbox.moduleSearchCriteria = { ...moduleSearchCriteria }; + data.body.inbox.moduleSearchCriteria.tenantId = Digit.ULBService.getCurrentTenantId(); + + return data; + }, + additionalCustomizations: (row, key, column, value, t, searchResult) => { + const tenantId = searchResult[0]?.ProcessInstance?.tenantId; + + switch (key) { + case "MB_NUMBER": + const state = row?.ProcessInstance?.state?.state; + const contractNumber = row?.businessObject?.referenceId; + return {Digit.Utils.statusBasedNavigation(state, contractNumber, value, tenantId, value)}; + case "MB_AMOUNT": + return value ? {value} : t("ES_COMMON_NA"); + case "MB_STATUS": + return {t(value)}; + case "MASTERS_SOCIAL_CATEGORY": + return value ? {String(t(`MASTERS_${value}`))} : t("ES_COMMON_NA"); + + case "CORE_COMMON_PROFILE_CITY": + return value ? {String(t(Digit.Utils.locale.getCityLocale(value)))} : t("ES_COMMON_NA"); + + case "MASTERS_WARD": + return value ? ( + {String(t(Digit.Utils.locale.getMohallaLocale(value, row?.tenantId)))} + ) : ( + t("ES_COMMON_NA") + ); + + case "MASTERS_LOCALITY": + return value ? ( + {String(t(Digit.Utils.locale.getMohallaLocale(value, row?.tenantId)))} + ) : ( + t("ES_COMMON_NA") + ); + default: + return t("NA"); + } + }, + MobileDetailsOnClick: (row, tenantId) => { + let link; + Object.keys(row).map((key) => { + if (key === "MASTERS_WAGESEEKER_ID") + link = `/${window.contextPath}/employee/masters/view-wageseeker?tenantId=${tenantId}&wageseekerId=${row[key]}`; + }); + return link; + }, + additionalValidations: (type, data, keys) => { + if (type === "date") { + return data[keys.start] && data[keys.end] ? () => new Date(data[keys.start]).getTime() <= new Date(data[keys.end]).getTime() : true; + } + }, + populateReqCriteria: () => { + const tenantId = Digit.ULBService.getCurrentTenantId(); + + return { + url: "/egov-workflow-v2/egov-wf/businessservice/_search", + params: { tenantId, businessServices: Digit?.Customizations?.["commonUiConfig"]?.getBusinessService("measurement") }, + body: {}, + config: { + enabled: true, + select: (data) => { + const states = data?.BusinessServices?.[0]?.states + ?.filter((state) => state?.state) + ?.map((state) => { + return { + i18nKey: state?.state, + wfStatus: state?.state, + }; + }); + return states; + }, + }, + }; + }, + }, + InboxMeasurementConfig: { + preProcess: (data) => { + let moduleSearchCriteria = data.body.inbox.moduleSearchCriteria; + + const statusValues = Object.keys(moduleSearchCriteria?.status || {}).filter((key) => moduleSearchCriteria.status[key]); + moduleSearchCriteria = { + ...(moduleSearchCriteria?.measurementNumber && { measurementNumber: moduleSearchCriteria?.measurementNumber?.trim() }), + ...(moduleSearchCriteria?.projectType?.code && { projectType: moduleSearchCriteria?.projectType?.code }), + ...(moduleSearchCriteria?.ProjectId && { projectId: moduleSearchCriteria?.ProjectId?.trim() }), + ...(moduleSearchCriteria?.assignee?.code === "ASSIGNED TO ME" && { assignee: Digit.UserService.getUser().info.uuid }), + ...(moduleSearchCriteria?.ward?.length > 0 && { ward: moduleSearchCriteria.ward?.map((e) => e?.code) }), + ...(statusValues.length > 0 && { status: statusValues }), + }; + data.body.inbox.moduleSearchCriteria = { ...moduleSearchCriteria }; + data.body.inbox.moduleSearchCriteria.tenantId = Digit.ULBService.getCurrentTenantId(); + return data; + }, + additionalCustomizations: (row, key, column, value, t, searchResult) => { + const tenantId = searchResult[0]?.ProcessInstance?.tenantId; + + switch (key) { + case "MB_REFERENCE_NUMBER": + const state = row?.ProcessInstance?.state?.state; + const contractNumber = row?.businessObject?.referenceId; + return {Digit.Utils.statusBasedNavigation(state, contractNumber, value, tenantId, value)}; + case "MB_ASSIGNEE": + return value ? {value?.[0]?.name} : {t("NA")}; + case "MB_WORKFLOW_STATE": + return {t(value)}; + case "MB_AMOUNT": + return ; + case "MB_SLA_DAYS_REMAINING": + return value > 0 ? {value} : {value}; + default: + return t("ES_COMMON_NA"); + } + }, + additionalValidations: (type, data, keys) => { + if (type === "date") { + return data[keys.start] && data[keys.end] ? () => new Date(data[keys.start]).getTime() <= new Date(data[keys.end]).getTime() : true; + } + }, + MobileDetailsOnClick: (row, tenantId) => { + let link; + Object.keys(row).map((key) => { + if (key === "ESTIMATE_ESTIMATE_NO") + link = `/${window.contextPath}/employee/estimate/estimate-details?tenantId=${tenantId}&estimateNumber=${row[key]}`; + }); + return link; + }, + }, + BillInboxConfig: { preProcess: (data) => { - //set tenantId data.body.inbox.tenantId = Digit.ULBService.getCurrentTenantId(); data.body.inbox.processSearchCriteria.tenantId = Digit.ULBService.getCurrentTenantId(); - const billNumber = data?.body?.inbox?.moduleSearchCriteria?.billNumber?.trim() - if(billNumber) data.body.inbox.moduleSearchCriteria.billNumber = billNumber + const billNumber = data?.body?.inbox?.moduleSearchCriteria?.billNumber?.trim(); + if (billNumber) data.body.inbox.moduleSearchCriteria.billNumber = billNumber; - const projectId = data?.body?.inbox?.moduleSearchCriteria?.projectId?.trim() - if(projectId) data.body.inbox.moduleSearchCriteria.projectId = projectId + const projectId = data?.body?.inbox?.moduleSearchCriteria?.projectId?.trim(); + if (projectId) data.body.inbox.moduleSearchCriteria.projectId = projectId; - const referenceId = data?.body?.inbox?.moduleSearchCriteria?.referenceId?.trim() - if(referenceId) data.body.inbox.moduleSearchCriteria.referenceId = referenceId; + const referenceId = data?.body?.inbox?.moduleSearchCriteria?.referenceId?.trim(); + if (referenceId) data.body.inbox.moduleSearchCriteria.referenceId = referenceId; // deleting them for now(assignee-> need clarity from pintu,ward-> static for now,not implemented BE side) const assignee = _.clone(data.body.inbox.moduleSearchCriteria.assignee); @@ -2439,20 +2604,19 @@ export const UICustomizations = { data.body.inbox.moduleSearchCriteria.assignee = Digit.UserService.getUser().info.uuid; } - let ward = _.clone(data.body.inbox.moduleSearchCriteria.ward ? data.body.inbox.moduleSearchCriteria.ward : []); delete data.body.inbox.moduleSearchCriteria.ward; - ward = ward?.map((row) => row?.code)?.filter(row=>row); + ward = ward?.map((row) => row?.code)?.filter((row) => row); if (ward.length > 0) data.body.inbox.moduleSearchCriteria.ward = ward; //cloning locality and workflow states to format them let locality = _.clone(data.body.inbox.moduleSearchCriteria.locality ? data.body.inbox.moduleSearchCriteria.locality : []); - + let states = _.clone(data.body.inbox.moduleSearchCriteria.state ? data.body.inbox.moduleSearchCriteria.state : []); delete data.body.inbox.moduleSearchCriteria.locality; delete data.body.inbox.moduleSearchCriteria.state; delete data.body.inbox.moduleSearchCriteria.status; - locality = locality?.map((row) => row?.code)?.filter(row=>row); + locality = locality?.map((row) => row?.code)?.filter((row) => row); states = Object.keys(states)?.filter((key) => states[key]); //adding formatted data to these keys @@ -2460,75 +2624,66 @@ export const UICustomizations = { if (states.length > 0) data.body.inbox.moduleSearchCriteria.status = states; const billType = _.clone(data.body.inbox.moduleSearchCriteria.billType ? data.body.inbox.moduleSearchCriteria.billType : {}); - delete data.body.inbox.moduleSearchCriteria.billType + delete data.body.inbox.moduleSearchCriteria.billType; const bsPurchaseBill = Digit?.Customizations?.["commonUiConfig"]?.getBusinessService("works.purchase"); const bsWageBill = Digit?.Customizations?.["commonUiConfig"]?.getBusinessService("works.wages"); const bsSupervisionBill = Digit?.Customizations?.["commonUiConfig"]?.getBusinessService("works.supervision"); - + if (billType?.code) data.body.inbox.processSearchCriteria.businessService = [billType.code]; - else data.body.inbox.processSearchCriteria.businessService = [ - bsPurchaseBill, - bsSupervisionBill, - bsWageBill - ] + else data.body.inbox.processSearchCriteria.businessService = [bsPurchaseBill, bsSupervisionBill, bsWageBill]; //adding tenantId to moduleSearchCriteria data.body.inbox.moduleSearchCriteria.tenantId = Digit.ULBService.getCurrentTenantId(); return data; }, additionalCustomizations: (row, key, column, value, t, searchResult) => { - - switch(key){ - case "WORKS_BILL_NUMBER": - let billType = "" + switch (key) { + case "WORKS_BILL_NUMBER": + let billType = ""; const bsPurchaseBill = Digit?.Customizations?.["commonUiConfig"]?.getBusinessService("works.purchase"); const bsSupervisionBill = Digit?.Customizations?.["commonUiConfig"]?.getBusinessService("works.supervision"); const bsWageBill = Digit?.Customizations?.["commonUiConfig"]?.getBusinessService("works.wages"); - if(row.ProcessInstance.businessService === bsPurchaseBill ){ - billType = "purchase" + if (row.ProcessInstance.businessService === bsPurchaseBill) { + billType = "purchase"; } - if(row.ProcessInstance.businessService === bsSupervisionBill ){ - billType = "supervision" + if (row.ProcessInstance.businessService === bsSupervisionBill) { + billType = "supervision"; } - if(row.ProcessInstance.businessService === bsWageBill ){ - billType = "wage" + if (row.ProcessInstance.businessService === bsWageBill) { + billType = "wage"; } return ( {String(value ? value : t("ES_COMMON_NA"))} ); - - case "COMMON_WORKFLOW_STATES": + + case "COMMON_WORKFLOW_STATES": return {t(Digit.Utils.locale.getTransformedLocale(`WF_${row.ProcessInstance.businessService}_STATE_${value}`))}; - case "ES_COMMON_AMOUNT": - return + case "ES_COMMON_AMOUNT": + return ; - case "COMMON_SLA_DAYS": + case "COMMON_SLA_DAYS": return value > 0 ? {value} : {value}; - - default: + + default: return t("ES_COMMON_NA"); } - }, + }, MobileDetailsOnClick: (row, tenantId) => { let link; Object.keys(row).map((key) => { if (key === "ESTIMATE_ESTIMATE_NO") - link = `/${window.contextPath}/employee/estimate/estimate-details?tenantId=${tenantId}&estimateNumber=${ - row[key] - }`; + link = `/${window.contextPath}/employee/estimate/estimate-details?tenantId=${tenantId}&estimateNumber=${row[key]}`; }); return link; }, - } + }, }; const downloadPdf = (link, openIn = "_blank") => { @@ -2536,4 +2691,4 @@ const downloadPdf = (link, openIn = "_blank") => { if (win) { win.focus(); } -}; \ No newline at end of file +}; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/css/gulpfile.js b/frontend/micro-ui/web/micro-ui-internals/packages/css/gulpfile.js index f76cae7234..74bc884bf1 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/css/gulpfile.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/css/gulpfile.js @@ -1,4 +1,18 @@ +const fs = require("fs"); +const { name, version, author, cssConfig } = JSON.parse(fs.readFileSync("package.json")); + +const headerString = ` +@charset "UTF-8"; +/*! + * ${name} - ${version} + * + * Copyright (c) ${new Date().getFullYear()} ${author} + * + */ + `; const { series, src, dest, watch, task } = require("gulp"); +const header = require("postcss-header"); + const clean = require("gulp-clean"); const postcss = require("gulp-postcss"); const sass = require("gulp-sass"); @@ -23,6 +37,7 @@ function styles() { postcssPresetEnv({ stage: 2, autoprefixer: { cascade: false }, features: { "custom-properties": true } }), require("autoprefixer"), require("cssnano"), + header({ header: headerString }), ]; return src("src/index.scss").pipe(postcss(plugins)).pipe(sass()).pipe(dest(output)); } diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/css/package.json b/frontend/micro-ui/web/micro-ui-internals/packages/css/package.json index 92256b10de..bd06c26b25 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/css/package.json +++ b/frontend/micro-ui/web/micro-ui-internals/packages/css/package.json @@ -1,6 +1,6 @@ { "name": "@egovernments/digit-ui-works-css", - "version": "0.2.28", + "version": "0.2.36", "license": "MIT", "author": "Jagankumar ", "main": "dist/index.css", diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/css/src/components/estimate.scss b/frontend/micro-ui/web/micro-ui-internals/packages/css/src/components/estimate.scss new file mode 100644 index 0000000000..fdf0f7d057 --- /dev/null +++ b/frontend/micro-ui/web/micro-ui-internals/packages/css/src/components/estimate.scss @@ -0,0 +1,76 @@ +.sor-dropdowns { + margin-top: 10px; + width: 70%; + display: flex; + justify-content: space-between; + flex-wrap: wrap; +} + +.sor-label { + display: inline-block; + width: 110px; + flex-basis: 100px; +} + +.dropdown-width { + width: 40rem; + height: 2.5rem; + padding: 5px 10px; +} + +.search-sor-container { + display: flex; + width: 69.25%; /* make it 69.25*/ + justify-content: space-between; + flex-wrap: wrap; +} + +.search-sor-button { + display: flex; + flex-direction: row; + justify-content: space-around; +} +.search-sor-label { + margin-top: 26px; +} + +.add-sor-button { + padding: 10px 50px 10px 50px; + margin-top: 20px; + width: 8.625rem; /*width: 8.625rem;*/ + height: 2.5rem; + margin-left : 158px /*158*/ +} + +.search-sor-input { + width: 27.375rem; + height: 2.5rem; +} + +.popup-view-alaysis { + margin-left: 35% !important; + margin-top: 10% !important; + margin-bottom: 8% !important; + width: 32rem; +} + +.view-Analysis-button { + border: 3px solid; + width: 15%; + padding: 10px 15px; + border-color: rgb(244, 119, 56); + color: rgb(244, 119, 56) !important; + font-size: 16px; +} + +.analysis-estimate-label { + font-size: 16px; + font-style: bold; + font-weight: 700 !important; + width : 60% !important; +} + +.estimate-analysis-cardheader { + margin-top: 14px; + margin-bottom: 1rem; +} \ No newline at end of file diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/css/src/components/measurement.scss b/frontend/micro-ui/web/micro-ui-internals/packages/css/src/components/measurement.scss new file mode 100644 index 0000000000..9fbced9e38 --- /dev/null +++ b/frontend/micro-ui/web/micro-ui-internals/packages/css/src/components/measurement.scss @@ -0,0 +1,140 @@ +.measurement-table-input { + display: flex; + flex-direction: row; + justify-content: center; + align-items: center; +} + +.plus-button { + border-radius: 50%; + width: 25px; + height: 25px; + background-color: #ff9100; + color: #ffffff; + font-size: 20px; + text-align: center; + line-height: 5px; + text-decoration: none; + display: inline-block; + cursor: pointer; + box-shadow: none; +} +.override-card { + margin-left: 0px !important; +} + +.custom-collapsible-table { + overflow: hidden; /* Hide the overflow when collapsed */ + transition: max-height 0.3s ease-out; /* Add a smooth transition */ + + &.collapsed { + max-height: 0; /* Collapse the content by setting max-height to 0 */ + } + padding: 10px; + margin-bottom: 10px; + + button { + background-color: #dbd3d3; + color: #cc7b2f; + margin-top: 10px; + } +} + +.collapse-button { + background-color: #ffffff; + color: #f37f12; + margin-top: 10px; + font-weight: bold; + border: none; + outline: none; + box-shadow: none; +} + +.outline-btn { + background-color: #ffffff; + color: #f37f12; + font-weight: bold; + outline: #f37f12; + margin: 10px; + box-shadow: none; + padding: 8px 35px 8px 35px; + border-radius: 8px; +} + +.view-utilization-card { + display: flex; + flex-direction: row; + justify-content: space-between; + border: #cc7b2f; +} + +$fill-color: #f47738; + +.addIcon { + fill: $fill-color; + margin: auto; + display: inline; + margin-top: -2px; + width: 20px; + height: 20px; +} + +.view-only-card-container { + text-align: right; + margin: 20px; + display: flex; + justify-content: flex-end; +} + +.view-only-card { + border: 1px solid black; + padding: 20px; + background-color: white; + width: fit-content; + font-weight: bold; + display: flex; +} + +.contract-card { + background-color: #ffffff; + margin: 15px; + padding: 20px 20px 15px 20px; + border: 1px solid #ccc; + display: flex; + flex-direction: column; +} + +.key-value-container { + display: grid; + grid-template-columns: 15% 85%; + margin-bottom: 10px; +} + +.contract-card-label { + font-weight: bold; + margin-right: 10px; +} + +.employeeCard .card-section-header { + margin-bottom: 0px; +} + +.measurement-table-custom { + padding: 16px 18px !important; +} + +.table { + thead { + th { + padding: 17px 18px; + } + } +} + +.modified-bread-crumb { + margin-left: 10px; +} + +.modify-header{ + margin-left : 20px +} \ No newline at end of file diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/css/src/components/searchSor.scss b/frontend/micro-ui/web/micro-ui-internals/packages/css/src/components/searchSor.scss new file mode 100644 index 0000000000..30116ae2ce --- /dev/null +++ b/frontend/micro-ui/web/micro-ui-internals/packages/css/src/components/searchSor.scss @@ -0,0 +1,32 @@ +/* SearchBar.css */ + +.search-bar-sor { + position: relative; + width: 300px; + /* Set your desired width */ + margin: 20px; + margin-bottom: 0px; +} + +ul.suggestions-sor { + list-style: none; + padding: 0; + margin: 0; + position: absolute; + width: 205%; + background-color: #fff; + border: 1px solid #ccc; + border-top: none; + border-radius: 0 0 4px 4px; + box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.1); +} + +ul.suggestions-sor li { + padding: 10px; + cursor: pointer; + transition: background-color 0.2s; +} + +ul.suggestions-sor li:hover { + background-color: #f0f0f0; +} \ No newline at end of file diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/css/src/components/table.scss b/frontend/micro-ui/web/micro-ui-internals/packages/css/src/components/table.scss index 0b6d9591c9..dd8c8df994 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/css/src/components/table.scss +++ b/frontend/micro-ui/web/micro-ui-internals/packages/css/src/components/table.scss @@ -419,4 +419,9 @@ padding: 20px 18px; } } +} + +.measure-table-header { + float: right; + margin-top: -2rem; } \ No newline at end of file diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/css/src/components/uploadcomponents.scss b/frontend/micro-ui/web/micro-ui-internals/packages/css/src/components/uploadcomponents.scss index 254414417a..fd01e63baa 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/css/src/components/uploadcomponents.scss +++ b/frontend/micro-ui/web/micro-ui-internals/packages/css/src/components/uploadcomponents.scss @@ -1,103 +1,106 @@ .upload-wrap { - @apply flex w-full h-40 bg-grey-light relative mb-lg px-sm border-border border-dashed; - max-width: 540px; - + @apply flex w-full h-40 bg-grey-light relative mb-lg px-sm border-border border-dashed; + max-width: 540px; + + img { + display: block; + margin-top: 58px; + margin-left: calc(50% - 23px); + height: 42px; + width: 46px; + } + + svg { + display: block; + margin-top: 58px; + margin-left: calc(50% - 23px); + height: 42px; + width: 46px; + } + + input { + @apply absolute w-full h-full opacity-0 top-0; + } +} + +.multi-upload-wrap { + @apply flex mb-lg; + + div { + display: block; + position: relative; + background-color: #fafafa; + width: calc((100% - 16px) / 3); + margin-right: 8px; + + .delete { + position: absolute; + height: 24px; + width: 24px; + border-radius: 100%; + top: 2px; + right: 2px; + } + } + + .upload-img-container { + border: 1px dashed #d6d5d4; + margin: 0 !important; + img { - display: block; - margin-top: 58px; - margin-left: calc(50% - 23px); - height: 42px; - width: 46px; + margin-left: auto; + margin-right: auto; + padding-top: calc(33% - 21px); + } + + svg { + @apply flex; + margin: auto; } - + svg { - display: block; - margin-top: 58px; - margin-left: calc(50% - 23px); - height: 42px; - width: 46px; + margin-left: auto; + margin-right: auto; + top: calc(50% - 21px); + position: relative; } - + input { @apply absolute w-full h-full opacity-0 top-0; } } - - .multi-upload-wrap { - @apply flex mb-lg; - - div { - display: block; - position: relative; - background-color: #fafafa; - width: calc((100% - 16px) / 3); - margin-right: 8px; - - .delete { - position: absolute; - height: 24px; - width: 24px; - border-radius: 100%; - top: 2px; - right: 2px; - } - } - - .upload-img-container { - border: 1px dashed #d6d5d4; - margin: 0 !important; - - img { - margin-left: auto; - margin-right: auto; - padding-top: calc(33% - 21px); - } - - svg { - @apply flex; - margin: auto; - } - - svg { - margin-left: auto; - margin-right: auto; - top: calc(50% - 21px); - position: relative; - } - - input { - @apply absolute w-full h-full opacity-0 top-0; - } +} + +.upload-file-max-width { + max-width: 540px; +} + +.upload-file { + min-height: 56px; + + &.upload-margin-bottom { + @apply mb-md; + } + + @apply relative border-input-border w-full; + + div { + @apply flex flex-row h-full items-center pl-md mt-sm flex-wrap; + + .file-upload-status { + @apply text-body-s-dt ml-sm; } } - - .upload-file-max-width { - max-width: 540px; + + input { + width: 160px; + @apply absolute top-0 left-0 opacity-0 h-full; } - - .upload-file { - min-height: 56px; - &.upload-margin-bottom { - @apply mb-md; - } - @apply relative border-input-border w-full; - - div { - @apply flex flex-row h-full items-center pl-md mt-sm flex-wrap; - - .file-upload-status { - @apply text-body-s-dt ml-sm; - } - } - input { - width: 160px; - @apply absolute top-0 left-0 opacity-0 h-full; - } +} + +@screen dt { + .multi-upload-wrap img { + width: 100%; + height: 158px; } - - @screen dt { - .multi-upload-wrap img { - width: 100%; - height: 158px; - } - } \ No newline at end of file +} \ No newline at end of file diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/css/src/index.scss b/frontend/micro-ui/web/micro-ui-internals/packages/css/src/index.scss index 7f5660f55b..6d0e120f0b 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/css/src/index.scss +++ b/frontend/micro-ui/web/micro-ui-internals/packages/css/src/index.scss @@ -1,5 +1,3 @@ - - @import "tailwindcss/base"; @import "tailwindcss/components"; @@ -16,6 +14,7 @@ @import "./components/button.scss"; @import "./components/attendencetable.scss"; @import "./components/dssTest.scss"; +@import "./components/searchSor.scss"; @import "./pages/employee/index.scss"; @import "./components/uploadcomponents.scss"; @@ -24,6 +23,9 @@ @import "./pages/works/inboxSearch.scss"; @import "./pages/works/horizontalNav.scss"; @import "./pages//works/searchComponentTable.scss"; +@import "./components/measurement.scss"; +@import "./components/estimate.scss"; + @@ -42,6 +44,7 @@ .display-flex-gap-2 { @apply flex gap-3; } + .rm-mb { margin-bottom: unset !important; } @@ -150,6 +153,7 @@ position: unset; } } + .application-table-container { @apply mt-lg ml-lg flex-1; } @@ -170,7 +174,7 @@ } .resend-otp { - cursor: pointer; + cursor: pointer; } .primaryColor { @@ -208,14 +212,17 @@ .react-time-picker { width: 194px; height: 2.5rem; + &__wrapper { border: 2px solid #0b0c0c; padding-left: 16px; } + &__inputGroup__input { @apply px-sm; line-height: 2.5rem; min-width: 16px; + &:focus { outline: 2px solid black; } @@ -232,6 +239,7 @@ input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; } + input[type="number"] { -moz-appearance: textfield; } @@ -244,8 +252,10 @@ input[type="number"] { flex: 1; max-height: 75vh; overflow: scroll; - -ms-overflow-style: none; /* IE and Edge */ - scrollbar-width: none; /* Firefox */ + -ms-overflow-style: none; + /* IE and Edge */ + scrollbar-width: none; + /* Firefox */ &::-webkit-scrollbar { display: none; @@ -348,6 +358,7 @@ input[type="number"] { text-indent: 5px; padding: 6px 0px; } + button { @apply outline-none; border: 0px; @@ -358,6 +369,7 @@ input[type="number"] { .text-input { @apply relative w-full; + input { &:hover { @apply border-2 border-solid border-primary-main; @@ -445,16 +457,19 @@ input[type="number"] { justify-content: center; align-items: center; flex-direction: column; + .error-container { display: flex; width: 400px; justify-content: center; align-items: center; flex-direction: column; + h1 { font-size: 32px; font-weight: bold; } + button { height: 40px; width: 153px; @@ -480,10 +495,12 @@ input[type="number"] { .full-width-card { width: 92vw !important; } + .full-employee-card-link { width: 100% !important; margin: 7px 0px; } + .full-employee-card-height { height: unset !important; } @@ -492,15 +509,18 @@ input[type="number"] { .full-employee-card-height { height: 196px !important; } + .full-employee-card-link { width: 30% !important; } + .full-width-card { @apply w-full !important; } } -.applications-list-container { -} + +.applications-list-container {} + .complaint-summary { @media (min-width: 780px) { flex: 1 0 auto; @@ -519,6 +539,7 @@ input[type="number"] { padding-right: 16px; } } + @media (min-width: 780px) { .citizen-card-container { padding-left: 15px; @@ -528,6 +549,7 @@ input[type="number"] { } @media (min-width: 780px) { + .citizen-obps-wrapper, .selection-card-wrapper, .fsm-citizen-wrapper, @@ -547,12 +569,15 @@ input[type="number"] { margin-top: 1rem; } } + @media only screen and (max-width: 768px) { + /* For mobile phones: */ .error-boundary { height: 75vh; } } + .employee-app-wrapper { min-height: calc(100vh - 8em); } @@ -563,9 +588,11 @@ input[type="number"] { flex-direction: row-reverse !important; width: 100% !important; align-items: center; + button { width: 240px !important; } + p { width: unset; margin-right: 1rem; @@ -590,6 +617,7 @@ input[type="number"] { padding-bottom: 8px; margin-bottom: 8px; } + .row { color: #b1b4b6; font-weight: 700; @@ -608,11 +636,13 @@ input[type="number"] { .connection-details-old-value-wrapper, .plumber-details-old-value-wrapper { flex: 1 1 auto; + .old-value-null-wrapper { visibility: hidden; padding-bottom: 8px; margin-bottom: 8px; } + .row { color: #b1b4b6; font-weight: 700; @@ -624,6 +654,7 @@ input[type="number"] { padding: 1rem; font-weight: 400; } + .modal-body-ws { padding: 1rem; font-weight: 700; @@ -631,9 +662,11 @@ input[type="number"] { font-size: 24px; margin-bottom: 1rem; } + .privacy-icon { cursor: pointer; } + .privacy-icon:hover { path { fill: rgba(244, 119, 56, 1); @@ -643,6 +676,7 @@ input[type="number"] { .attendance-view-table { thead { background-color: #dbd3d3; + th { font-size: 12px; padding: 8px 8px; @@ -667,18 +701,23 @@ input[type="number"] { grid-template-columns: 1fr 1fr; padding-top: 8px; margin-top: 8px; + .attendence-date-picker { width: 80%; } + h2 { font-weight: bolder; } + .disabled { border-color: #9E9E9E; pointer-events: none !important; + input { color: #9E9E9E !important; } + svg { fill: #9E9E9E; } @@ -688,6 +727,7 @@ input[type="number"] { @screen sm { .date-range-pair { display: flex; + .attendence-date-picker { width: 100%; } @@ -713,7 +753,7 @@ input[type="number"] { display: grid; grid-template-columns: 1fr 1fr; align-items: center; - padding: 12px ; + padding: 12px; position: relative; font-weight: bolder; border: 1px solid #828282; @@ -724,16 +764,16 @@ input[type="number"] { position: absolute; right: 10px; top: 50%; - transform: translate(0%,-50%); + transform: translate(0%, -50%); cursor: pointer; } -.expand-collapse-header .label{ +.expand-collapse-header .label { display: block; text-align: left; } -.expand-collapse-header .value{ +.expand-collapse-header .value { display: block; text-align: right; margin-right: 2rem; @@ -757,8 +797,9 @@ input[type="number"] { &:empty { padding: 0px !important; } - .card-label.bolder{ - @apply font-medium !important; + + .card-label.bolder { + @apply font-medium !important; } } @@ -772,6 +813,7 @@ input[type="number"] { .card-section-header { @apply mb-md; } + &:empty { padding: 0px !important; } @@ -796,10 +838,12 @@ input[type="number"] { color: #F47738; display: flex; align-items: center; + svg { margin: 0 15px; } } + .bills-menu-options { cursor: pointer; margin: 1rem; @@ -808,11 +852,12 @@ input[type="number"] { .no-data-found { height: 100%; - width : 100%; + width: 100%; display: flex; flex-direction: column; justify-content: center; align-items: center; + .error-msg { margin-top: 2rem; } @@ -825,27 +870,32 @@ input[type="number"] { .info-banner-wrap { margin: 0; + &.project-banner { background: #FFE2B5; - p{ + + p { font-size: 16px; color: #CC7B2F; - } - h2{ + } + + h2 { font-size: 18px; color: #CC7B2F; } } &.doc-banner { - max-width: 1286px; + max-width: 1350px; margin-bottom: 24px; - p{ + + p { font-size: 16px; font-weight: 400; color: #505A5F; - } - h2{ + } + + h2 { font-size: 18px; color: #0B0C0C; } @@ -855,18 +905,23 @@ input[type="number"] { .sub-project-table-wrapper { overflow-x: scroll; padding-bottom: 9rem; + &.no-padding { padding: 0; } + .project-details-table { position: relative; + .sub-projects-details-field-mt { margin-top: 1.5rem; - } + } + .projects-subProject-details-error { - width : 100%; - position : absolute; + width: 100%; + position: absolute; margin-top: 3px; + &.dropdown-field { margin-top: -21px; } @@ -897,7 +952,7 @@ input[type="number"] { .text-input-customIcon { position: absolute; top: 10px; - right : 8px; + right: 8px; } .emp-error-wrap { @@ -917,9 +972,9 @@ input[type="number"] { display: flex; justify-content: space-between; - .skill-details { - width: 50%; - } + .skill-details { + width: 50%; + } } @screen sm { @@ -942,11 +997,11 @@ input[type="number"] { } .fc-paragraph { - text-align: justify; - padding-left: 9px; - margin-bottom: 4%; - display: block; - padding-top: 5px; + text-align: justify; + padding-left: 9px; + margin-bottom: 4%; + display: block; + padding-top: 5px; } .disabled-text-field { @@ -978,32 +1033,33 @@ input[type="number"] { display: block; max-height: 7.2em; line-height: 1.8em; - width: max-content; + width: max-content; max-width: 64ch; } -.table{ + +.table { tr:nth-child(1) { - td:nth-child(2){ + td:nth-child(2) { .tooltip { - .tooltiptext { - top: 100% !important; - bottom: 0% !important; - height: max-content; - } + .tooltiptext { + top: 100% !important; + bottom: 0% !important; + height: max-content; + } } } } - + } -.employee-data-table { -.row { - .value { - white-space: break-spaces !important; - word-break: break-all; +.employee-data-table { + .row { + .value { + white-space: break-spaces !important; + word-break: break-all; + } } } -} .text-wrap-overflow { word-wrap: break-word; @@ -1013,32 +1069,39 @@ input[type="number"] { .submenu-container:first-child { .sidebar-link { - padding: 18px!important; - padding-top: 20px!important; + padding: 18px !important; + padding-top: 20px !important; + svg { - width: 21px!important; - height: 21px!important; + width: 21px !important; + height: 21px !important; } -} + } - .employee-search-input{ - margin-left:16px !important; + .employee-search-input { + margin-left: 16px !important; } } -.h1 {&.works-header-search{ -font-size: 36px; -} -&.works-header-create{ - font-size: 36px; -} -&.works-header-view{ - font-size: 36px; -} + +.h1 { + &.works-header-search { + font-size: 36px; + } + + &.works-header-create { + font-size: 36px; + } + + &.works-header-view { + font-size: 36px; + } } -.submit-bar header{ + +.submit-bar header { font-family: Roboto; } + input[type=“date”]::-webkit-calendar-picker-indicator { width: 24px; height: 24px; @@ -1054,6 +1117,7 @@ input[type=“date”]::-webkit-calendar-picker-indicator { .cursor-pointer { cursor: pointer; } + .table-instruction-wrapper { display: flex; column-gap: 10px; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/index.scss b/frontend/micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/index.scss index 6359269564..1bfb4c7b82 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/index.scss +++ b/frontend/micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/index.scss @@ -584,4 +584,9 @@ .topbar .left .employee-select-wrap .options-card { right: -3rem !important +} + +.reponse-link { + display: inline-flex; + gap: 7px; } \ No newline at end of file diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/libraries/package.json b/frontend/micro-ui/web/micro-ui-internals/packages/libraries/package.json index 55667b7a0c..ef0201a86a 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/libraries/package.json +++ b/frontend/micro-ui/web/micro-ui-internals/packages/libraries/package.json @@ -25,6 +25,7 @@ "dependencies": { "axios": "1.4.0", "babel-preset-react": "6.24.1", + "lodash": "^4.17.21", "date-fns": "2.28.0", "html2canvas": "1.4.1", "dom-to-image": "2.6.0", diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/hooks/expenditure/useMBDataForPB.js b/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/hooks/expenditure/useMBDataForPB.js new file mode 100644 index 0000000000..466ef69d24 --- /dev/null +++ b/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/hooks/expenditure/useMBDataForPB.js @@ -0,0 +1,86 @@ +import { transformEstimateData } from "../../../../modules/Measurement/src/utils/transformEstimateData"; + +const useMBDataForPB=({workOrderNumber, tenantId})=>{ + + const requestCriteriaForMeasurement = { + url : "/mukta-services/measurement/_search", + + body: { + "contractNumber" : workOrderNumber, + "tenantId" : tenantId + } + + } + const {isLoading: isMeasurementLoading, data} = Digit.Hooks.useCustomAPIHook(requestCriteriaForMeasurement); + + // const { contract, estimate, allMeasurements, measurement, musterRollNumber, period } = data; + + + const requestCriteria = { + url: "/mdms-v2/v1/_search", + body: { + MdmsCriteria: { + tenantId: tenantId, + moduleDetails: [ + { + moduleName: "WORKS-SOR", + masterDetails: [ + { + name: "Rates", + //filter: `[?(@.sorId=='${sorid}')]`, + }, + ], + }, + ], + }, + }, + }; + + const { isLoading : isRatesLoading, data : RatesData} = Digit.Hooks.useCustomAPIHook(requestCriteria); + + const requestCriteriaBill = { + url : "/expense-calculator/v1/_search", + + body: { + "searchCriteria": { + "tenantId": tenantId, + "contractNumbers": [workOrderNumber], + "billTypes": [ + "EXPENSE.PURCHASE" + ] + }, + "pagination": { + "limit": 100, + "offSet": 0, + "sortBy": "", + "order": "ASC" + }, + } + }; + + const { isLoading : billloading, data : BillData} = Digit.Hooks.useCustomAPIHook(requestCriteriaBill); + + let ValidMeasurement = data?.allMeasurements?.length > 0 ? data?.allMeasurements?.filter((ob) => ob?.wfStatus !== "DRAFTED" && ob?.wfStatus !== "REJECTED") : []; + + const SOR = data && transformEstimateData(data?.estimate?.estimateDetails, data?.contract, "SOR", data?.measurement, ValidMeasurement); + + let totalMaterialAmount = data ? SOR?.reduce((tot,ob) => { + let amountDetails = RatesData?.MdmsRes?.["WORKS-SOR"]?.Rates?.filter((rate) => (rate?.sorId === ob?.sorId || rate?.sorId === ob?.sorCode))?.[0]?.amountDetails; + let amount = amountDetails?.reduce((total,item) => item?.heads?.includes("MA") ? (item?.amount + total) : total,0); + return (tot + amount * ob?.currentMBEntry) + },0) : null; + + let allMeasurementsIds = ValidMeasurement?.map((ob) => ob?.measurementNumber); + + const totalPaidAmountForSuccessfulBills = BillData?.bills?.reduce((total, bill) => (bill.bill?.additionalDetails?.paymentStatus === 'SUCCESSFUL' ? total + (bill.bill?.totalPaidAmount || 0) : total), 0); + + let finalObject = { + allMeasurementsIds, + totalMaterialAmount, + totalPaidAmountForSuccessfulBills + } + + return finalObject; +} + +export default useMBDataForPB; \ No newline at end of file diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/hooks/index.js b/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/hooks/index.js index 668c58be5e..91dd0cdb3a 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/hooks/index.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/hooks/index.js @@ -163,6 +163,10 @@ import useSearchBill from "./bills/useSearchBill"; import useViewPaymentInstruction from "./payments/useViewPaymentInstruction"; import useViewPayment from "./payments/useViewPayment"; import useUpdatePI from "./expenditure/useUpdatePI"; +import useMBDataForPB from "./expenditure/useMBDataForPB"; + +import useViewMeasurement from "./measurement/useViewMeasurement"; + const works = { useViewEstimateDetails, useViewProjectDetails, @@ -313,9 +317,14 @@ const bankAccount = { const paymentInstruction = { useViewPaymentInstruction, useUpdatePI, + useMBDataForPB, useViewPayment } +const measurement = { + useViewMeasurement +} + const Hooks = { useSessionStorage, useQueryParams, @@ -382,7 +391,8 @@ const Hooks = { wageSeeker, organisation, bankAccount, - paymentInstruction + paymentInstruction, + measurement }; export default Hooks; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/hooks/measurement/useViewMeasurement.js b/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/hooks/measurement/useViewMeasurement.js new file mode 100644 index 0000000000..102757a2a8 --- /dev/null +++ b/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/hooks/measurement/useViewMeasurement.js @@ -0,0 +1,15 @@ +import { useQuery } from 'react-query'; +import { useTranslation } from "react-i18next"; +import { View } from '../../../../libraries/src/services/molecules/Measurement/View'; + + +const useViewMeasurement = (tenantId, data, searchParams, config = {},revisedWONumber) => { + const { t } = useTranslation(); + return useQuery( + ["VIEW_MEASUREMENT_DETAILS", tenantId, searchParams?.contractNumber, data?.measurementNumber], + () => View.fetchMeasurementDetails(t, tenantId, data, searchParams,revisedWONumber), + config + ); +} + +export default useViewMeasurement; \ No newline at end of file diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/index.js b/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/index.js index 0a772ff2a4..947effc4d4 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/index.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/index.js @@ -44,6 +44,7 @@ import { CustomService } from "./services/elements/CustomService"; import { WageSeekerService } from "./services/elements/WageSeeker"; import { OrganisationService } from "./services/elements/Organisation"; import { BankAccountService } from "./services/elements/BankAccount"; +import { MeasurementService } from "./services/elements/Measurement"; const setupLibraries = (Library, props) => { window.Digit = window.Digit || {}; @@ -94,7 +95,9 @@ const initLibraries = () => { setupLibraries("CustomService", CustomService); setupLibraries("WageSeekerService", WageSeekerService); setupLibraries("OrganisationService", OrganisationService); - setupLibraries("BankAccountService", BankAccountService) + setupLibraries("BankAccountService", BankAccountService); + + setupLibraries("MeasurementService", MeasurementService); return new Promise((resolve) => { initI18n(resolve); diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/services/atoms/urls.js b/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/services/atoms/urls.js index d5fbb8e5b0..052b9125d9 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/services/atoms/urls.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/services/atoms/urls.js @@ -275,6 +275,11 @@ expense:{ calculator: { expenseBill: "/expense-calculator/v1/_estimate", }, + + measurement : { + search : "/measurement-service/v1/_search", + update : "/measurement-service/v1/_update" + } }; export default Urls; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/services/elements/Contracts.js b/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/services/elements/Contracts.js index ac43fd350c..243d55b78d 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/services/elements/Contracts.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/services/elements/Contracts.js @@ -10,6 +10,7 @@ export const ContractService = { auth: true, userService: true, data: data, + authHeader:true, params: {tenantId, ...searchParams}, }) }; \ No newline at end of file diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/services/elements/Measurement.js b/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/services/elements/Measurement.js new file mode 100644 index 0000000000..4f20547ead --- /dev/null +++ b/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/services/elements/Measurement.js @@ -0,0 +1,22 @@ +import { Request } from "../atoms/Utils/Request"; +import Urls from "../atoms/urls"; + +export const MeasurementService = { + search: async (criteria, tenantId) => { + try { + const response = await Request({ + url: Urls.measurement.search, + data: criteria, + useCache: false, + setTimeParam: false, + method: "POST", + auth: true, + userService: true, + params: { tenantId } + }); + return response; + } catch (error) { + throw new Error(error.response?.Errors[0].message); + } + } +}; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/services/molecules/Contracts/View.js b/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/services/molecules/Contracts/View.js index 24eed4137b..42881bdb16 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/services/molecules/Contracts/View.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/services/molecules/Contracts/View.js @@ -24,16 +24,21 @@ const transformViewDataToApplicationDetails = async (t, data, workflowDetails, r if(data.contracts.length === 1) contract = data.contracts[0] else { //this condition is added because to show work order when there are multiple object in response array - if(revisedWONumber) - {contract = data.contracts.filter(element => element.supplementNumber && (element.status==="ACTIVE" || element.status==="INWORKFLOW"))?.[0] - contract = {...contract, wfStatus:"ACCEPTED"}} - else - contract = data.contracts.filter(element => (element.status==="ACTIVE" || element.status==="INWORKFLOW"))?.[0] + // if(revisedWONumber) + contract = data.contracts.filter(element => element.supplementNumber && (element.status==="ACTIVE" || element.status==="INWORKFLOW"))?.[0] + contract = contract ? {...contract, wfStatus:"ACCEPTED"} : {} + // else + // contract = data.contracts.filter(element => (element.status==="ACTIVE" || element.status==="INWORKFLOW"))?.[0] } if(revisedWONumber){ contract = data?.contracts?.filter(row => row?.supplementNumber===revisedWONumber)?.[0] } + //Added this condition if from the response array not able to find contract then takes the original contract (usecase : of rejected TE) + if(Object.keys(contract)?.length <= 0) + { + contract = data?.contracts?.filter((row) => row?.supplementNumber == null && row?.status === "ACTIVE")?.[0]; + } const contractDetails = { title: " ", diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/services/molecules/Measurement/View.js b/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/services/molecules/Measurement/View.js new file mode 100644 index 0000000000..b9b23a850c --- /dev/null +++ b/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/services/molecules/Measurement/View.js @@ -0,0 +1,179 @@ +import { getThumbnails } from "../../../utils/thumbnail"; +import { CustomService } from "../../elements/CustomService"; + +const combine = (docs, estimateDocs) => { + let allDocuments = []; + for (let i = 0; i < docs?.length; i++) { + if (docs[i]?.fileStoreId !== undefined || docs[i]?.fileStore !== undefined) { + allDocuments.push(docs[i]); + } + } + for (let i = 0; i < estimateDocs?.length; i++) { + if (estimateDocs?.[i]?.fileStoreId !== undefined || estimateDocs?.[i]?.fileStore !== undefined) { + allDocuments.push(estimateDocs[i]); + } + } + return allDocuments; +}; + +const transformViewDataToApplicationDetails = async (t, data, workflowDetails, revisedWONumber) => { + //if revisedWONumber is defined then it's a time extension screen(use TE object here) + const tenantId = Digit.ULBService.getCurrentTenantId(); + const isTimeExtAlreadyInWorkflow = data.contracts.some( + (element) => + element.businessService === Digit?.Customizations?.["commonUiConfig"]?.businessServiceMap?.revisedWO && element.status === "INWORKFLOW" + ); + + let contract; + + // let contract = data.contracts.filter(element => element.supplementNumber=== null)?.[0] + if (data.contracts.length === 1) contract = data.contracts[0]; + else { + contract = data.contracts.filter((element) => element.supplementNumber && (element.status === "ACTIVE" || element.status === "INWORKFLOW"))?.[0]; + + contract = { ...contract, wfStatus: "ACCEPTED" }; + } + + if (revisedWONumber) { + contract = data?.contracts?.filter((row) => row?.supplementNumber === revisedWONumber)?.[0]; + } + + let measurements = data?.measurements; + const fileStoreIds = measurements[0]?.documents.map((item) => item.fileStore); + + let thumbnails = ""; + try { + thumbnails = await getThumbnails( + // ["8f158603-26a7-4c3a-8433-64b9ed20db60", "10ca8e0f-6d2e-4918-b628-b8bda860f061", "611d55d1-9a43-4037-ab9a-fae24466a4a6"], + fileStoreIds, + tenantId + ); + } catch (error) { + console.log(error); + } + + let estimateDetails = data?.estimate; + + const contractDetails = { + title: " ", + asSectionHeader: false, + values: [ + { title: t("MB_NUMBER"), value: measurements[0]?.measurementNumber || t("NA") }, + { title: t("MB_WORK_ORDER_NUMBER"), value: contract?.contractNumber || t("NA") }, + { title: t("MB_PROJECT_ID"), value: contract?.additionalDetails?.projectId || t("NA") }, + { title: t("MB_MUSTER_ROLL_ID"), value: t("NA") }, + { title: t("MB_PROJECT_DATE"), value: t("NA") }, + { title: t("MB_PROJECT_NAME"), value: contract?.additionalDetails?.projectName || t("NA") }, + { title: t("MB_PROJECT_DESC"), value: contract?.additionalDetails?.projectDesc || t("NA") }, + { title: t("MB_LOCATION"), value: t("NA") }, + { title: t("MB_MEASUREMENT_PERIOD"), value: t("NA") }, + ], + }; + if (contract.startDate) { + contractDetails.values.push({ title: "WORKS_START_DATE", value: Digit.DateUtils.ConvertEpochToDate(contract.startDate) || t("NA") }); + } + if (contract.endDate) { + contractDetails.values.push({ title: "WORKS_END_DATE", value: Digit.DateUtils.ConvertEpochToDate(contract.endDate) || t("NA") }); + } + if (contract.additionalDetails.timeExt && revisedWONumber) { + contractDetails.values.push({ title: "EXTENSION_REQ", value: contract?.additionalDetails?.timeExt || t("NA") }); + } + if (contract.additionalDetails.timeExtReason && revisedWONumber) { + contractDetails.values.push({ title: "EXTENSION_REASON", value: contract?.additionalDetails?.timeExtReason || t("NA") }); + } + + const allDocuments = combine(contract?.documents, contract?.additionalDetails?.estimateDocs); + let documentDetails = { + title: "", + asSectionHeader: true, + additionalDetails: { + documents: [ + { + title: "WORKS_RELEVANT_DOCUMENTS", + BS: "Works", + values: allDocuments?.map((document) => { + if (!document.fileStoreId && !document.fileStore) return null; + if (document?.status !== "INACTIVE") { + if (document?.fileStoreId) { + //ESTIMATE FILES + return { + title: document?.fileType === "Others" ? document?.fileName : document?.fileType, + documentType: document?.fileName, + documentUid: document?.documentUid, + fileStoreId: document?.fileStoreId, + }; + } + //WO FILES + return { + title: document?.documentType === "OTHERS" ? document?.additionalDetails?.otherCategoryName : t(`CONTRACT_${document?.documentType}`), + documentType: document?.documentType, + documentUid: document?.fileStore, + fileStoreId: document?.fileStore, + }; + } + return {}; + }), + }, + ], + }, + }; + + const imageDetails = { + title: "MB_WORKSITE_PHOTOS", + asSectionHeader: true, + additionalDetails: { + photo: { + thumbnailsToShow: thumbnails, + }, + }, + }; + + //filter any empty object + documentDetails.additionalDetails.documents[0].values = documentDetails?.additionalDetails?.documents?.[0]?.values?.filter((value) => { + if (value?.title) { + return value; + } + }); + + const applicationDetails = revisedWONumber + ? { applicationDetails: [contractDetails] } + : { applicationDetails: [contractDetails, documentDetails, imageDetails] }; + + return { + applicationDetails, + + applicationData: data , + + processInstancesDetails: workflowDetails?.ProcessInstances, + workflowDetails, + isNoDataFound: data?.contracts?.length === 0 ? true : false, + additionalDetails: { + isTimeExtAlreadyInWorkflow, + }, + }; +}; + +export const View = { + fetchMeasurementDetails: async (t, tenantId, data, searchParams, revisedWONumber) => { + try { + + const url = "/mukta-services/measurement/_search" + + const allData = await CustomService.getResponse({ + url, + params : {tenantId}, + body : {...data} + }); + + const response = { + measurements: [allData.measurement], + contracts: [allData.contract], + estimate: [allData.estimate], + }; + + return transformViewDataToApplicationDetails(t, response, undefined, revisedWONumber); + } catch (error) { + throw new Error(error?.response?.data?.Errors[0].message); + } + }, +}; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/utils/debouncing.js b/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/utils/debouncing.js new file mode 100644 index 0000000000..ae79b84879 --- /dev/null +++ b/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/utils/debouncing.js @@ -0,0 +1,5 @@ +import debounce from 'lodash/debounce'; + +export const debouncing = (func, delay) => { + return debounce(func,delay); +} diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/utils/index.js b/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/utils/index.js index aebe7a6338..9e1e0bd333 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/utils/index.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/utils/index.js @@ -5,6 +5,7 @@ import * as locale from "./locale"; import * as obps from "./obps"; import * as pt from "./pt"; import * as privacy from "./privacy"; +import { debouncing } from "./debouncing"; import PDFUtil, { downloadReceipt, downloadPDFFromLink, downloadBill, getFileUrl, downloadEgovPDF, getDocumentName } from "./pdf"; import getFileTypeFromFileStoreURL from "./fileType"; import preProcessMDMSConfig from "./preProcessMDMSConfig"; @@ -12,6 +13,8 @@ import { configUpdater } from "./configUpdater"; import preProcessMDMSConfigInboxSearch from "./preProcessMDMSConfigInboxSearch"; import Urls from "../services/atoms/urls"; import { getLoggedInUserDetails } from "./user"; +import { statusBasedNavigation } from "./statusBasedNavigation"; +import { getThumbnails } from "./thumbnail"; const GetParamFromUrl = (key, fallback, search) => { if (typeof window !== "undefined") { @@ -362,5 +365,8 @@ export default { getConfigModuleName, createFunction, configUpdater, - trimStringsInObject + trimStringsInObject, + statusBasedNavigation, + getThumbnails, + debouncing }; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/utils/statusBasedNavigation.js b/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/utils/statusBasedNavigation.js new file mode 100644 index 0000000000..22a4e71cba --- /dev/null +++ b/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/utils/statusBasedNavigation.js @@ -0,0 +1,40 @@ +import React from "react"; +import { Link } from "react-router-dom"; +import { useTranslation } from "react-i18next"; + +export const statusBasedNavigation = ( status, contractOrProjectNumber, measurementOrEstimateNumber, tenantId, value, mode = "MEASUREMENT", businessId ) => { + const { t } = useTranslation(); + + let linkTo = `/${window?.contextPath}/employee/measurement/update?tenantId=${tenantId}&workOrderNumber=${contractOrProjectNumber}&mbNumber=${measurementOrEstimateNumber}`; + + if (status !== "DRAFTED") { + linkTo = `/${window?.contextPath}/employee/measurement/view?tenantId=${tenantId}&workOrderNumber=${contractOrProjectNumber}&mbNumber=${measurementOrEstimateNumber}`; + } + + if(mode === "REVISION-ESTIMATE") + { + linkTo = `/${window?.contextPath}/employee/estimate/update-revision-detailed-estimate?tenantId=${tenantId}&revisionNumber=${measurementOrEstimateNumber}&projectNumber=${contractOrProjectNumber}&isEditRevisionEstimate=${true}`; + + if (status !== "DRAFT") { + linkTo = `/${window?.contextPath}/employee/estimate/estimate-details?tenantId=${tenantId}&revisionNumber=${measurementOrEstimateNumber}&estimateNumber=${businessId}&projectNumber=${contractOrProjectNumber}`; + } + } + + if(mode === "ESTIMATE") + { + linkTo = `/${window?.contextPath}/employee/estimate/update-detailed-estimate?tenantId=${tenantId}&estimateNumber=${measurementOrEstimateNumber}&projectNumber=${contractOrProjectNumber}&isEdit=${true}`; + + if (status !== "DRAFT") { + linkTo = `/${window?.contextPath}/employee/estimate/estimate-details?tenantId=${tenantId}&estimateNumber=${measurementOrEstimateNumber}&projectNumber=${contractOrProjectNumber}`; + } + } + + + + + return ( + + {value ? value : t("ES_COMMON_NA")} + + ); +}; \ No newline at end of file diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/AttendenceMgmt/package.json b/frontend/micro-ui/web/micro-ui-internals/packages/modules/AttendenceMgmt/package.json index 3464f86cbc..a9de4938bc 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/AttendenceMgmt/package.json +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/AttendenceMgmt/package.json @@ -1,6 +1,6 @@ { "name": "@egovernments/digit-ui-module-attendencemgmt", - "version": "0.2.5", + "version": "0.3.1", "description": "Attendence Management Module UI", "main": "dist/index.js", "module": "dist/index.modern.js", diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/Contracts/package.json b/frontend/micro-ui/web/micro-ui-internals/packages/modules/Contracts/package.json index 7ab668f64c..1e3b7bef19 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/Contracts/package.json +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/Contracts/package.json @@ -1,6 +1,6 @@ { "name": "@egovernments/digit-ui-module-contracts", - "version": "0.2.10", + "version": "0.3.5", "description": "Contracts Module UI", "main": "dist/index.js", "module": "dist/index.modern.js", @@ -19,6 +19,7 @@ }, "dependencies": { "@egovernments/digit-ui-react-components": "^1.5.0", + "lodash": "^4.17.21", "react": "17.0.2", "react-date-range": "^1.4.0", "react-dom": "17.0.2", diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/Contracts/src/components/WOTermsAndConditions.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/Contracts/src/components/WOTermsAndConditions.js index 77ad327215..20f45ba50a 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/Contracts/src/components/WOTermsAndConditions.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/Contracts/src/components/WOTermsAndConditions.js @@ -1,157 +1,167 @@ -import { AddIcon, CardLabelError, DeleteIcon, TextInput,TextArea } from "@egovernments/digit-ui-react-components"; +import { AddIcon, CardLabelError, DeleteIcon, TextInput, TextArea } from "@egovernments/digit-ui-react-components"; import React, { Fragment, useEffect, useState } from "react"; const WOTermsAndConditions = (props) => { - const ContractSession = Digit.Hooks.useSessionStorage("CONTRACT_CREATE",{}); - const [sessionFormData] = ContractSession; + const ContractSession = Digit.Hooks.useSessionStorage("CONTRACT_CREATE", {}); + const [sessionFormData] = ContractSession; - const formFieldName = "WOTermsAndConditions" // this will be the key under which the data for this table will be present on onFormSubmit - const { t, register, unregister, errors , setValue, getValues, formData} = props + const formFieldName = "WOTermsAndConditions"; // this will be the key under which the data for this table will be present on onFormSubmit + const { t, register, unregister, errors, setValue, getValues, formData } = props; - //update sub project table with session data - const renderWOTermsAndConditionsFromSession = () => { - if(!sessionFormData?.WOTermsAndConditions) { - return [{ - key: 1, - isShow: true, - }]; - } - let tableState = []; - for(let i = 0; i { + if (!sessionFormData?.WOTermsAndConditions) { + return [ + { + key: 1, + isShow: true, + }, + ]; } - const [rows, setRows] = useState(renderWOTermsAndConditionsFromSession()); - - const getStyles = (index) => { - let obj = {} - switch (index) { - case 1: - obj = { "width": "1rem" } - break; - case 2: - obj = { "width": "30rem" } - break; - default: - obj = { "width": "1rem" } - break; - } - return obj + let tableState = []; + for (let i = 0; i < sessionFormData?.WOTermsAndConditions?.length; i++) { + if (sessionFormData?.WOTermsAndConditions[i]) { + tableState.push({ + key: i, + isShow: true, + }); } - - const columns = [t('WORKS_SNO'), t('COMMON_DESC'),'']; - const renderHeader = () => { - return columns?.map((key, index) => { - return {key} - }) } + return tableState; + }; + const [rows, setRows] = useState(renderWOTermsAndConditionsFromSession()); - const showDelete = () => { - let countIsShow = 0 - rows?.map(row => row.isShow && countIsShow++) - // if (countIsShow === 1) { - // return false - // } - return true + const getStyles = (index) => { + let obj = {}; + switch (index) { + case 1: + obj = { width: "1rem" }; + break; + case 2: + obj = { width: "30rem" }; + break; + default: + obj = { width: "1rem" }; + break; } + return obj; + }; - const errorCardStyle = {width:"100%"} + const columns = [t("WORKS_SNO"), t("COMMON_DESC"), ""]; + const renderHeader = () => { + return columns?.map((key, index) => { + return ( + + {" "} + {key}{" "} + + ); + }); + }; - const removeRow = (row) => { - - //check if only one row is present - let totalRows = 0; - for(let keys of Object.keys(formData?.[formFieldName])) { - totalRows += 1; - } - if(totalRows === 1) { - setValue(`${formFieldName}.${row.key}.description`, ''); - }else { + const showDelete = () => { + let countIsShow = 0; + rows?.map((row) => row.isShow && countIsShow++); + // if (countIsShow === 1) { + // return false + // } + return true; + }; + + const errorCardStyle = { width: "100%" }; - //make a new state here which doesn't have this key - const updatedState = rows?.map(e => { + const removeRow = (row) => { + //check if only one row is present + let totalRows = 0; + for (let keys of Object.keys(formData?.[formFieldName])) { + totalRows += 1; + } + if (totalRows === 1) { + setValue(`${formFieldName}.${row.key}.description`, ""); + } else { + //make a new state here which doesn't have this key + const updatedState = rows?.map((e) => { if (e.key === row.key) { - return { + return { key: e.key, - isShow: false - } + isShow: false, + }; } - return e - }) - - unregister(`${formFieldName}.${row.key}.description`) - setRows(prev => updatedState) - } - } + return e; + }); - const addRow = () => { - const obj = { - key: null, - isShow: true - } - obj.key = rows[rows.length - 1].key + 1 - setRows(prev => [...prev, obj]) + unregister(`${formFieldName}.${row.key}.description`); + setRows((prev) => updatedState); } + }; + + const addRow = () => { + const obj = { + key: null, + isShow: true, + }; + obj.key = rows[rows.length - 1].key + 1; + setRows((prev) => [...prev, obj]); + }; - const renderBody = () => { - let i = 0 - return rows?.map((row, index) => { - if (row.isShow) i++ - return ( - row.isShow && ( - - {i} + const renderBody = () => { + let i = 0; + return rows?.map((row, index) => { + if (row.isShow) i++; + return ( + row.isShow && ( + + {i} - -
- {/* +
+ {/* */} -