From 11e1d012ec8ce5331cdff90b760cfe1c31da5c13 Mon Sep 17 00:00:00 2001 From: snehal-eGov <94351369+snehal-eGov@users.noreply.github.com> Date: Fri, 11 Aug 2023 18:56:44 +0530 Subject: [PATCH 01/10] Update app.py --- utilities/rollout-dashboard-cronjob/app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utilities/rollout-dashboard-cronjob/app.py b/utilities/rollout-dashboard-cronjob/app.py index e48800284..7909f33aa 100644 --- a/utilities/rollout-dashboard-cronjob/app.py +++ b/utilities/rollout-dashboard-cronjob/app.py @@ -54,7 +54,7 @@ def getGPWSCHeirarchy(): if tenant.get('city') is not None and tenant.get('city').get('code') is not None: teanant_data_Map.update({tenant.get('city').get('code'): tenant.get('code')}) - url = os.getenv('IFIX_DEP_ENTITY_URL') + url = 'https://mgramseva-dwss.punjab.gov.in/' print(url) requestData = { "requestHeader": { From 2b1b288f807efbbbf8d3937c06cb40e36ebfa72c Mon Sep 17 00:00:00 2001 From: pradeep-egov Date: Fri, 18 Aug 2023 15:02:13 +0530 Subject: [PATCH 02/10] Corrected demand generation date condition --- utilities/rollout-dashboard-cronjob/app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utilities/rollout-dashboard-cronjob/app.py b/utilities/rollout-dashboard-cronjob/app.py index 01ec94742..5a047bb2e 100644 --- a/utilities/rollout-dashboard-cronjob/app.py +++ b/utilities/rollout-dashboard-cronjob/app.py @@ -631,7 +631,7 @@ def getLastDemandDate(tenantId): cursor = connection.cursor() - LAST_DEMAND_DATE = "select max(to_timestamp(taxperiodto/1000)::date) from eg_ws_connection conn left outer join egbs_demand_v1 dmd on dmd.consumercode=conn.connectionno and dmd.status='ACTIVE' left outer join egbs_demanddetail_v1 dtl on dtl.demandid=dmd.id and taxheadcode='10101' where conn.status='Active'and businessservice='WS' and (EXTRACT(epoch FROM (to_timestamp(taxperiodto/1000))-to_timestamp(taxperiodfrom/1000)))::int/86400<=31 and dmd.tenantid = '"+tenantId+"'" + LAST_DEMAND_DATE = "select max(to_timestamp(taxperiodto/1000)::date) from eg_ws_connection conn left outer join egbs_demand_v1 dmd on dmd.consumercode=conn.connectionno and dmd.status='ACTIVE' left outer join egbs_demanddetail_v1 dtl on dtl.demandid=dmd.id and taxheadcode='10101' where dtl.id is not null and conn.status='Active'and businessservice='WS' and (EXTRACT(epoch FROM (to_timestamp(taxperiodto/1000))-to_timestamp(taxperiodfrom/1000)))::int/86400<=31 and dmd.tenantid = '"+tenantId+"'" cursor.execute(LAST_DEMAND_DATE) result = cursor.fetchone() From 81bb7be5b4377df27543706596dbd68ea211c2d2 Mon Sep 17 00:00:00 2001 From: Rahul Dev Garg <34365102+rahuldevgarg@users.noreply.github.com> Date: Fri, 25 Aug 2023 19:21:22 +0530 Subject: [PATCH 03/10] Update README.md --- frontend/mgramseva/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/mgramseva/README.md b/frontend/mgramseva/README.md index 69a6171c7..02c1210a3 100644 --- a/frontend/mgramseva/README.md +++ b/frontend/mgramseva/README.md @@ -19,7 +19,7 @@ Command: - Clone the repository [https://github.com/egovernments/punjab-mgramseva](https://github.com/egovernments/punjab-mgramseva) - $ cd /punjab-mgramseva/frontend/mgramseva - $ flutter pub get -- Change the url in the lib/Env/app_config.dart to the desired instance url +- Change the url in the lib/env/app_config.dart to the desired instance url ## About Flutter For help getting started with Flutter, view our From 38582c16cb1e7939aa158c70f115fd459b1935c4 Mon Sep 17 00:00:00 2001 From: Rahul Dev Garg <118716448+rahuldevgarg-egov@users.noreply.github.com> Date: Fri, 1 Sep 2023 20:36:26 +0530 Subject: [PATCH 04/10] changed path of mgramseva-digit-ui --- frontend/micro-ui/web/docker/nginx.conf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/micro-ui/web/docker/nginx.conf b/frontend/micro-ui/web/docker/nginx.conf index 4f532e4a6..31c68f71f 100644 --- a/frontend/micro-ui/web/docker/nginx.conf +++ b/frontend/micro-ui/web/docker/nginx.conf @@ -3,10 +3,10 @@ server listen 80; underscores_in_headers on; - location /digit-ui + location /mgramseva-digit-ui { root /var/web; index index.html index.htm; - try_files $uri $uri/ /digit-ui/index.html; + try_files $uri $uri/ /mgramseva-digit-ui/index.html; } } \ No newline at end of file From 0e7323662dcefe23273f92db79d2e3bb633b4a09 Mon Sep 17 00:00:00 2001 From: rakesh-wt-egov Date: Mon, 4 Sep 2023 10:06:56 +0530 Subject: [PATCH 05/10] changed digit-ui/employee to mgramseva-digit-ui --- .../src/services/atoms/Utils/Request.js | 12 +- .../src/services/elements/User/index.js | 7 +- .../src/services/molecules/NOC/Search.js | 23 +- .../src/services/molecules/TL/Search.js | 26 +- .../src/services/molecules/WS/Search.js | 2600 ++++++++++------- .../modules/bills/src/billHomeCard.js | 10 +- .../bills/src/components/BillCancelModal.js | 2 +- .../components/CancelBill/MobileCancelBill.js | 346 +-- .../bills/src/components/CancelBill/index.js | 437 +-- .../bills/src/components/GroupBill/index.js | 521 ++-- .../Search/MobileSearchApplication.js | 365 ++- .../bills/src/components/Search/index.js | 6 +- .../citizen/ApplicationCitizenCard.js | 8 +- .../src/components/inbox/ApplicationCard.js | 8 +- .../src/components/inbox/BillsDesktopInbox.js | 14 +- .../src/components/inbox/BillsMobileInbox.js | 2 +- .../bills/src/pages/employee/BillDetailsv1.js | 481 +-- .../src/pages/employee/ResponseCancelBill.js | 67 +- .../modules/bills/src/pages/employee/index.js | 30 +- .../common/src/payments/employee/index.js | 6 +- .../src/payments/employee/response/index.js | 18 +- .../commonPt/src/components/CommonPTCard.js | 6 +- .../search/CPTPropertySearchForm.js | 130 +- .../search/CPTPropertySearchResults.js | 15 +- .../commonPt/src/pages/employee/index.js | 19 +- .../pageComponents/PropertySearchNSummary.js | 247 +- .../src/pages/pageComponents/ViewProperty.js | 23 +- .../packages/modules/core/src/App.js | 10 +- .../modules/core/src/components/AppModules.js | 12 +- .../modules/core/src/components/ChangeCity.js | 27 +- .../core/src/components/ErrorBoundaries.js | 4 +- .../TopBarSideBar/SideBar/CitizenSideBar.js | 39 +- .../TopBarSideBar/SideBar/EmployeeSideBar.js | 57 +- .../src/components/TopBarSideBar/index.js | 12 +- .../core/src/config/employee-sidebar-menu.js | 34 +- .../modules/core/src/config/sidebar-menu.js | 78 +- .../src/pages/citizen/Home/UserProfile.js | 121 +- .../employee/ChangePassword/changePassword.js | 8 +- .../employee/ForgotPassword/forgotPassword.js | 6 +- .../pages/employee/LanguageSelection/index.js | 2 +- .../core/src/pages/employee/Login/login.js | 14 +- .../modules/core/src/pages/employee/index.js | 2 +- .../packages/modules/dss/src/Module.js | 45 +- .../dss/src/components/CustomBarChart.js | 2 +- .../components/CustomHorizontalBarChart.js | 10 +- .../modules/dss/src/components/DSSCard.js | 24 +- .../packages/modules/dss/src/pages/Home.js | 16 +- .../packages/modules/engagement/src/Module.js | 78 +- .../components/Documents/ApplicationCard.js | 55 +- .../src/components/Documents/DesktopInbox.js | 123 +- .../components/Documents/DocumentDetails.js | 214 +- .../src/components/EngagementCard.js | 24 +- .../src/components/Events/ApplicationCard.js | 44 +- .../src/components/Events/DocumentDetails.js | 163 +- .../components/Messages/ApplicationCard.js | 49 +- .../components/Messages/DocumentDetails.js | 106 +- .../Surveys/ResultsView/SurveyDetailsView.js | 88 +- .../employee/CitizenSurveys/Inbox/index.js | 206 +- .../employee/CitizenSurveys/NewSurvey.js | 107 +- .../employee/CitizenSurveys/SurveyDetails.js | 72 +- .../CitizenSurveys/responses/create.js | 58 +- .../CitizenSurveys/responses/delete.js | 16 +- .../CitizenSurveys/responses/update.js | 19 +- .../pages/employee/Documents/Inbox/index.js | 231 +- .../employee/Documents/delete-response.js | 13 +- .../employee/Documents/documents-create.js | 24 +- .../employee/Documents/documents-update.js | 44 +- .../src/pages/employee/Documents/response.js | 26 +- .../employee/Documents/update-response.js | 11 +- .../pages/employee/Events/EditEvent/index.js | 57 +- .../src/pages/employee/Events/EventDetails.js | 51 +- .../src/pages/employee/Events/Inbox/index.js | 80 +- .../employee/Events/NewEvent/Response.js | 64 +- .../pages/employee/Events/NewEvent/index.js | 27 +- .../pages/employee/Messages/EditMessage.js | 59 +- .../src/pages/employee/Messages/Inbox.js | 79 +- .../src/pages/employee/Messages/Inbox_DEMO.js | 322 +- .../pages/employee/Messages/MessageDetails.js | 114 +- .../employee/Messages/NewMessage/Response.js | 43 +- .../employee/Messages/NewMessage/index.js | 27 +- .../fsm/src/components/DesktopInbox.js | 13 +- .../modules/fsm/src/components/FsmCard.js | 123 +- .../fsm/src/components/RegistryInbox.js | 16 +- .../fsm/src/components/RegistrySearch.js | 6 +- .../src/components/inbox/ApplicationCard.js | 24 +- .../src/components/inbox/ApplicationLinks.js | 2 +- .../fsm/src/components/inbox/FSMLink.js | 2 +- .../modules/fsm/src/pages/Response.js | 8 +- .../src/pages/employee/ApplicationAudit.js | 2 +- .../ApplicationDetails/Modal/index.js | 143 +- .../employee/ApplicationDetails/index.js | 8 +- .../employee/EditApplication/EditForm.js | 9 +- .../employee/FSMRegistry/Driver/AddDriver.js | 2 +- .../FSMRegistry/Driver/DriverDetails.js | 4 +- .../employee/FSMRegistry/Driver/EditDriver.js | 2 +- .../FSMRegistry/Vehicle/AddVehicle.js | 2 +- .../FSMRegistry/Vehicle/EditVehicle.js | 2 +- .../FSMRegistry/Vehicle/VehicleDetails.js | 4 +- .../employee/FSMRegistry/Vendor/AddVendor.js | 2 +- .../employee/FSMRegistry/Vendor/EditVendor.js | 2 +- .../FSMRegistry/Vendor/VendorDetails.js | 8 +- .../src/pages/employee/FSMRegistry/index.js | 2 +- .../fsm/src/pages/employee/FstpAddVehicle.js | 2 +- .../fsm/src/pages/employee/FstpInbox.js | 2 +- .../fsm/src/pages/employee/FstpOperations.js | 60 +- .../src/pages/employee/FstpOperatorDetails.js | 2 +- .../src/pages/employee/FstpServiceRequest.js | 10 +- .../pages/employee/NewApplication/index.js | 2 +- .../modules/fsm/src/pages/employee/index.js | 26 +- .../hrms/src/components/EmployeeAction.js | 24 +- .../modules/hrms/src/components/hrmscard.js | 61 +- .../src/components/inbox/ApplicationCard.js | 4 +- .../hrms/src/components/inbox/DesktopInbox.js | 12 +- .../hrms/src/pages/EditEmployee/EditForm.js | 55 +- .../modules/hrms/src/pages/EmployeeDetails.js | 149 +- .../packages/modules/hrms/src/pages/Inbox.js | 2 +- .../modules/hrms/src/pages/Response.js | 16 +- .../modules/hrms/src/pages/createEmployee.js | 73 +- .../packages/modules/hrms/src/pages/index.js | 4 +- .../modules/mCollect/src/EmployeeChallan.js | 55 +- .../mCollect/src/components/DesktopInbox.js | 5 +- .../mCollect/src/components/MCollectCard.js | 17 +- .../mCollect/src/components/MobileInbox.js | 26 +- .../Modal/MCollectWFAcknowledgement.js | 4 +- .../src/components/inbox/ApplicationCard.js | 25 +- .../src/components/inbox/InboxLink.js | 4 +- .../src/pages/employee/CreateChallan.js | 127 +- .../EmployeeChallanAcknowledgement.js | 7 +- .../src/pages/employee/NewChallan/index.js | 145 +- .../mCollect/src/pages/employee/index.js | 20 +- .../noc/src/pages/employee/EmployeeCard.js | 118 +- .../noc/src/pages/employee/Inbox/index.js | 325 ++- .../noc/src/pages/employee/Response.js | 19 +- .../SearchApplication/SearchAtom/mobile.js | 196 +- .../SearchApplication/useTableConfig.js | 121 +- .../modules/noc/src/pages/employee/index.js | 22 +- .../src/components/SearchApplication/index.js | 184 +- .../SearchApplication/useTableConfig.js | 149 +- .../src/pages/citizen/ArchitectInbox/index.js | 117 +- .../obps/src/pages/employee/EmployeeCard.js | 214 +- .../obps/src/pages/employee/Inbox/index.js | 24 +- .../employee/Inbox/useInboxMobileCardsData.js | 91 +- .../obps/src/pages/employee/OBPSResponse.js | 151 +- .../modules/obps/src/pages/employee/Search.js | 63 +- .../src/pages/employee/StakeholderResponse.js | 24 +- .../modules/obps/src/pages/employee/index.js | 39 +- .../pages/employee/stakeholderInbox/index.js | 236 +- .../pgr/src/components/DesktopInbox.js | 4 +- .../modules/pgr/src/components/PGRCard.js | 57 +- .../pgr/src/components/inbox/ComplaintCard.js | 2 +- .../src/components/inbox/ComplaintLinks.js | 2 +- .../modules/pgr/src/constants/Routes.js | 2 +- .../pgr/src/pages/employee/Response.js | 2 +- .../src/components/MobileSearchApplication.js | 80 +- .../modules/pt/src/components/PTCard.js | 25 +- .../pt/src/components/SearchApplication.js | 544 ++-- .../modules/pt/src/components/empty-result.js | 2 +- .../src/components/inbox/ApplicationCard.js | 8 +- .../src/components/inbox/ApplicationLinks.js | 4 +- .../pt/src/components/inbox/InboxLink.js | 10 +- .../search/PropertySearchResults.js | 77 +- .../pt/src/config/inbox-table-config.js | 4 +- .../packages/modules/pt/src/pages/Response.js | 8 +- .../src/pages/employee/ApplicationDetails.js | 77 +- .../src/pages/employee/AssessmentDetails.js | 720 ++--- .../employee/EditApplication/EditForm.js | 27 +- .../employee/MutationApplicatinDetails.js | 475 ++- .../pages/employee/NewApplication/index.js | 9 +- .../pt/src/pages/employee/PropertyDetails.js | 67 +- .../employee/PropertyMutation/docsRequired.js | 7 +- .../employee/PropertyMutation/mutationForm.js | 2 +- .../modules/pt/src/pages/employee/index.js | 98 +- .../src/components/ReceiptCancelModal.js | 22 +- .../src/components/inbox/ApplicationCard.js | 6 +- .../components/inbox/ReceiptsDesktopInbox.js | 27 +- .../src/pages/ReceiptAcknowledgement.js | 27 +- .../receipts/src/pages/ReceiptInbox.js | 27 +- .../modules/receipts/src/pages/index.js | 4 +- .../modules/receipts/src/receiptHomeCard.js | 4 +- .../reports/src/components/ReportsCard.js | 94 +- .../modules/reports/src/pages/index.js | 38 +- .../Modal/FSMActionModal.js | 4 +- .../templates/ApplicationDetails/index.js | 56 +- .../MobileSearchApplication.js | 70 +- .../src/components/SearchApplication/index.js | 302 +- .../SearchLicense/MobileSearchApplication.js | 66 +- .../tl/src/components/SearchLicense/index.js | 247 +- .../modules/tl/src/components/TLCard.js | 124 +- .../src/components/inbox/ApplicationCard.js | 6 +- .../tl/src/components/inbox/DesktopInbox.js | 77 +- .../tl/src/components/inbox/MobileInbox.js | 90 +- .../packages/modules/tl/src/pages/Response.js | 65 +- .../src/pages/employee/ApplicationDetails.js | 268 +- .../pages/employee/NewApplication/index.js | 77 +- .../pages/employee/ReNewApplication/index.js | 198 +- .../modules/tl/src/pages/employee/index.js | 134 +- .../ws/src/components/BillAmendmentCard.js | 83 +- .../components/BillIAmendMentInbox/index.js | 48 +- .../useInboxMobileCardsData.js | 2 +- .../useInboxTableConfig.js | 18 +- .../modules/ws/src/components/SWCard.js | 14 +- .../MobileSearchApplication.js | 52 +- .../src/components/SearchApplication/index.js | 75 +- .../MobileSearchWater.js | 12 +- .../components/SearchWaterConnection/index.js | 40 +- .../modules/ws/src/components/WSCard.js | 14 +- .../ws/src/components/WSInbox/index.js | 32 +- .../WSInbox/useInboxMobileCardsData.js | 10 +- .../components/WSInbox/useInboxTableConfig.js | 23 +- .../src/pageComponents/WSDisconnectionForm.js | 621 ++-- .../src/pageComponents/WSPropertyDetails.js | 6 +- .../employee/ActivateConnection/index.js | 453 +-- .../employee/ApplicationBillAmendment.js | 780 ++--- .../src/pages/employee/ApplicationDetails.js | 225 +- .../ApplicationDetailsBillAmendment.js | 44 +- .../WSDisconnectionResponse.js | 26 +- .../pages/employee/DisconnectionDetails.js | 47 +- .../WSEditApplicationByConfig.js | 261 +- .../pages/employee/EditApplication/index.js | 107 +- .../employee/EditModifyApplication/index.js | 89 +- .../pages/employee/ModifyApplication/index.js | 216 +- .../employee/ModifyApplicationDetails.js | 76 +- .../pages/employee/NewApplication/index.js | 343 ++- .../modules/ws/src/pages/employee/Response.js | 119 +- .../src/pages/employee/ResponseBillAmend.js | 50 +- .../ws/src/pages/employee/WSResponse.js | 135 +- .../connectionDetails/connectionDetails.js | 43 +- .../modules/ws/src/pages/employee/index.js | 145 +- .../src/atoms/PrivateRoute.js | 11 +- .../react-components/src/atoms/TopBar.js | 13 +- 230 files changed, 11350 insertions(+), 9293 deletions(-) diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/services/atoms/Utils/Request.js b/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/services/atoms/Utils/Request.js index ad705d1dd..48627bcf4 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/services/atoms/Utils/Request.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/services/atoms/Utils/Request.js @@ -17,18 +17,18 @@ Axios.interceptors.response.use( localStorage.clear(); sessionStorage.clear(); window.location.href = - (isEmployee ? "/digit-ui/employee/user/login" : "/digit-ui/citizen/login") + + (isEmployee ? "/mgramseva-digit-ui/employee/user/login" : "/digit-ui/citizen/login") + `?from=${encodeURIComponent(window.location.pathname + window.location.search)}`; } else if ( error?.message?.toLowerCase()?.includes("internal server error") || error?.message?.toLowerCase()?.includes("some error occured") ) { window.location.href = - (isEmployee ? "/digit-ui/employee/user/error" : "/digit-ui/citizen/error") + + (isEmployee ? "/mgramseva-digit-ui/employee/user/error" : "/digit-ui/citizen/error") + `?type=maintenance&from=${encodeURIComponent(window.location.pathname + window.location.search)}`; } else if (error.message.includes("ZuulRuntimeException")) { window.location.href = - (isEmployee ? "/digit-ui/employee/user/error" : "/digit-ui/citizen/error") + + (isEmployee ? "/mgramseva-digit-ui/employee/user/error" : "/digit-ui/citizen/error") + `?type=notfound&from=${encodeURIComponent(window.location.pathname + window.location.search)}`; } } @@ -67,7 +67,7 @@ export const Request = async ({ multipartFormData = false, multipartData = {}, reqTimestamp = false, - plainAccessRequest = null + plainAccessRequest = null, }) => { if (method.toUpperCase() === "POST") { const ts = new Date().getTime(); @@ -100,10 +100,9 @@ export const Request = async ({ data.RequestInfo = { ...data.RequestInfo, plainAccessRequest: { ...privacy } }; } - if(plainAccessRequest){ + if (plainAccessRequest) { data.RequestInfo = { ...data.RequestInfo, plainAccessRequest }; } - } const headers1 = { @@ -198,6 +197,7 @@ export const ServiceRequest = async ({ let reqParams = params; let reqData = data; + console.log(reqData, "reqData"); if (window[preHookName] && typeof window[preHookName] === "function") { let preHookRes = await window[preHookName]({ params, data }); reqParams = preHookRes.params; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/services/elements/User/index.js b/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/services/elements/User/index.js index 10260e972..81092be2e 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/services/elements/User/index.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/services/elements/User/index.js @@ -13,7 +13,7 @@ export const UserService = { url: Urls.Authenticate, data, headers: { - authorization: `Basic ${window?.globalConfigs?.getConfig("JWT_TOKEN")||"ZWdvdi11c2VyLWNsaWVudDo="}`, + authorization: `Basic ${window?.globalConfigs?.getConfig("JWT_TOKEN") || "ZWdvdi11c2VyLWNsaWVudDo="}`, "Content-Type": "application/x-www-form-urlencoded", }, }); @@ -45,14 +45,13 @@ export const UserService = { try { await UserService.logoutUser(); } catch (e) { - } - finally{ + } finally { window.localStorage.clear(); window.sessionStorage.clear(); if (userType === "citizen") { window.location.replace("/digit-ui/citizen"); } else { - window.location.replace("/digit-ui/employee/user/language-selection"); + window.location.replace("/mgramseva-digit-ui/employee/user/language-selection"); } } }, diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/services/molecules/NOC/Search.js b/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/services/molecules/NOC/Search.js index dbbe07630..73ba4ed6f 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/services/molecules/NOC/Search.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/services/molecules/NOC/Search.js @@ -34,13 +34,13 @@ export const NOCSearch = { let bpaResponse = []; if (response?.sourceRefId) { - const bpaFilter = { applicationNo: response?.sourceRefId } + const bpaFilter = { applicationNo: response?.sourceRefId }; bpaResponse = await NOCSearch.BPADetails(tenantId, bpaFilter); } let edcrResponse = {}; if (bpaResponse?.[0]?.edcrNumber) { - const bpaFilter = { edcrNumber: bpaResponse?.[0]?.edcrNumber } + const bpaFilter = { edcrNumber: bpaResponse?.[0]?.edcrNumber }; edcrResponse = await NOCSearch.scrutinyDetails(tenantId, bpaFilter); } @@ -49,12 +49,23 @@ export const NOCSearch = { title: "NOC_BULDING_DETAILS_LABEL", asSectionHeader: true, values: [ - { title: "NOC_APP_NO_LABEL", value:
{bpaResponse?.[0]?.applicationNo}
}, + { + title: "NOC_APP_NO_LABEL", + value: ( +
+ + + {bpaResponse?.[0]?.applicationNo} + + +
+ ), + }, // { title: "NOC_APP_NO_LABEL", value: bpaResponse?.[0]?.applicationNo || "NA" }, { title: "NOC_MODULE_SOURCE_LABEL", value: t(response?.source) || "NA" }, { title: "NOC_APPLICATION_TYPE_LABEL", value: edcrResponse?.appliactionType ? t(`WF_BPA_${edcrResponse?.appliactionType}`) : "NA" }, - { title: "NOC_SERVICE_TYPE_LABEL", value: t(edcrResponse?.applicationSubType) || "NA" } - ] + { title: "NOC_SERVICE_TYPE_LABEL", value: t(edcrResponse?.applicationSubType) || "NA" }, + ], }; response && employeeResponse.push(buildingDetails); @@ -63,7 +74,7 @@ export const NOCSearch = { tenantId: response.tenantId, applicationDetails: employeeResponse, additionalDetails: response?.additionalDetails, - applicationData: response + applicationData: response, }; }, }; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/services/molecules/TL/Search.js b/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/services/molecules/TL/Search.js index 3a3fa5d24..d919fc9da 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/services/molecules/TL/Search.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/services/molecules/TL/Search.js @@ -69,13 +69,18 @@ export const TLSearch = { asSectionHeader: false, values: [ { title: "TL_LOCALIZATION_APPLICATION_NO", value: response?.applicationNumber ? `${response?.applicationNumber}` : "NA" }, - { title: "TL_APPLICATION_CHALLAN_LABEL", value: response?.tradeLicenseDetail?.channel ? `TL_CHANNEL_${response?.tradeLicenseDetail?.channel}` : "NA" }, - ] - } + { + title: "TL_APPLICATION_CHALLAN_LABEL", + value: response?.tradeLicenseDetail?.channel ? `TL_CHANNEL_${response?.tradeLicenseDetail?.channel}` : "NA", + }, + ], + }; - if(response?.licenseNumber && applicationNoAndChannel?.values.filter((ob) => ob?.title === "TL_LOCALIZATION_LICENSE_NO")?.length <= 0) - { - applicationNoAndChannel?.values.push({ title: "TL_LOCALIZATION_LICENSE_NO", value: response?.licenseNumber ? `${response?.licenseNumber}` : "NA" }) + if (response?.licenseNumber && applicationNoAndChannel?.values.filter((ob) => ob?.title === "TL_LOCALIZATION_LICENSE_NO")?.length <= 0) { + applicationNoAndChannel?.values.push({ + title: "TL_LOCALIZATION_LICENSE_NO", + value: response?.licenseNumber ? `${response?.licenseNumber}` : "NA", + }); } const tradedetails = { @@ -94,14 +99,17 @@ export const TLSearch = { { title: "TL_NEW_TRADE_DETAILS_STRUCT_SUB_TYPE_LABEL", value: response?.tradeLicenseDetail?.structureType - ? `COMMON_MASTERS_STRUCTURETYPE_${stringReplaceAll(response?.tradeLicenseDetail?.structureType,".","_")}` + ? `COMMON_MASTERS_STRUCTURETYPE_${stringReplaceAll(response?.tradeLicenseDetail?.structureType, ".", "_")}` : "NA", }, { title: "TL_NEW_TRADE_DETAILS_TRADE_COMM_DATE_LABEL", value: response?.commencementDate ? convertEpochToDate(response?.commencementDate) : "NA", }, - { title: "TL_NEW_GST_NUMBER_LABEL", value: response?.tradeLicenseDetail?.additionalDetail?.gstNo || response?.tradeLicenseDetail?.additionalDetail?.tradeGstNo || "NA" }, + { + title: "TL_NEW_GST_NUMBER_LABEL", + value: response?.tradeLicenseDetail?.additionalDetail?.gstNo || response?.tradeLicenseDetail?.additionalDetail?.tradeGstNo || "NA", + }, { title: "TL_NEW_OPERATIONAL_SQ_FT_AREA_LABEL", value: response?.tradeLicenseDetail?.operationalArea || "NA" }, { title: "TL_NEW_NUMBER_OF_EMPLOYEES_LABEL", value: response?.tradeLicenseDetail?.noOfEmployees || "NA" }, ], @@ -161,7 +169,7 @@ export const TLSearch = { { title: "PROPERTY_ADDRESS", value: propertyAddress || "NA" }, { title: "TL_VIEW_PROPERTY_DETAIL", - to: `/digit-ui/employee/commonpt/view-property?propertyId=${propertyDetails?.Properties?.[0]?.propertyId}&tenantId=${propertyDetails?.Properties?.[0]?.tenantId}&from=TL_APPLICATION_DETAILS_LABEL`, + to: `/mgramseva-digit-ui/employee/commonpt/view-property?propertyId=${propertyDetails?.Properties?.[0]?.propertyId}&tenantId=${propertyDetails?.Properties?.[0]?.tenantId}&from=TL_APPLICATION_DETAILS_LABEL`, value: "", isLink: true, }, diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/services/molecules/WS/Search.js b/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/services/molecules/WS/Search.js index 6fd31e836..9358610c3 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/services/molecules/WS/Search.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/services/molecules/WS/Search.js @@ -30,41 +30,41 @@ const convertEpochToDate = (dateEpoch) => { }; const getAddress = (address, t) => { - const result = `${address?.doorNo ? `${address?.doorNo}, ` : ""} ${address?.street ? `${address?.street}, ` : ""}${ + const result = `${address?.doorNo ? `${address?.doorNo}, ` : ""} ${address?.street ? `${address?.street}, ` : ""}${ address?.landmark ? `${address?.landmark}, ` : "" }${t(Digit.Utils.pt.getMohallaLocale(address?.locality.code, address?.tenantId))}, ${t(Digit.Utils.pt.getCityLocale(address?.tenantId))}${ address?.pincode && t(address?.pincode) ? `, ${address.pincode}` : " " }`; - return result + return result; }; const getOwnerNames = (propertyData) => { - const getActiveOwners = propertyData?.owners?.filter(owner => owner?.active); - const getOwnersList = getActiveOwners?.map(activeOwner => activeOwner?.name)?.join(","); + const getActiveOwners = propertyData?.owners?.filter((owner) => owner?.active); + const getOwnersList = getActiveOwners?.map((activeOwner) => activeOwner?.name)?.join(","); return getOwnersList ? getOwnersList : t("NA"); -} +}; const checkUserExist = async (userInfo) => { const checkList = ["SW_FIELD_INSPECTOR", "WS_APPROVER", "WS_FIELD_INSPECTOR", "SW_APPROVER"]; const filterList = []; - checkList?.map(list => { - let filterData = userInfo?.info?.roles?.filter(role => role?.code == list); - if(filterData?.length > 0) { + checkList?.map((list) => { + let filterData = userInfo?.info?.roles?.filter((role) => role?.code == list); + if (filterData?.length > 0) { filterList.push(filterData?.[0]?.code); } - }) + }); return filterList; -} +}; const checkExistStatus = async (processInstances) => { - const checkStatus = processInstances?.filter(state => state?.state?.applicationStatus == "PENDING_FOR_PAYMENT"); + const checkStatus = processInstances?.filter((state) => state?.state?.applicationStatus == "PENDING_FOR_PAYMENT"); return checkStatus?.length > 0 ? checkStatus : []; -} +}; const checkFeeEstimateVisible = async (wsDatas) => { const dataDetails = wsDatas?.[0]?.applicationType?.includes("NEW"); return dataDetails; -} +}; export const WSSearch = { application: async (tenantId, filters = {}, serviceType) => { @@ -82,7 +82,7 @@ export const WSSearch = { return response; }, - searchAmendment: async (tenantId, consumercodes, businessService="WS") => { + searchAmendment: async (tenantId, consumercodes, businessService = "WS") => { const response = await Digit.PaymentService.searchAmendment(tenantId, { amendmentId: consumercodes, businessService }); return response; }, @@ -98,14 +98,14 @@ export const WSSearch = { return response; }, - colletionData: async ({tenantId, serviceTypeOfData, collectionNumber}) => { + colletionData: async ({ tenantId, serviceTypeOfData, collectionNumber }) => { const businessService = serviceTypeOfData; const consumerCodes = collectionNumber; - const response = await Digit.PaymentService.recieptSearch(tenantId, businessService, {consumerCodes: consumerCodes }); + const response = await Digit.PaymentService.recieptSearch(tenantId, businessService, { consumerCodes: consumerCodes }); return response; }, - fetchBillData: async ({tenantId, serviceTypeOfData, collectionNumber}) => { + fetchBillData: async ({ tenantId, serviceTypeOfData, collectionNumber }) => { const businessService = serviceTypeOfData; const consumerCode = collectionNumber; const response = await Digit.PaymentService.fetchBill(tenantId, { @@ -115,10 +115,7 @@ export const WSSearch = { return response; }, - - applicationDetails: async (t, tenantId, applicationNumber, serviceType = "WATER", userInfo, config = {}) => { - const filters = { applicationNumber }; let propertyids = "", @@ -130,18 +127,18 @@ export const WSSearch = { const appSessionDetails = sessionStorage.getItem("WS_SESSION_APPLICATION_DETAILS"); const wsApplicationDetails = appSessionDetails ? JSON.parse(appSessionDetails) : ""; if ( - response?.WaterConnection?.[0] && + response?.WaterConnection?.[0] && wsApplicationDetails?.applicationType && wsApplicationDetails?.applicationNo == response?.WaterConnection?.[0]?.applicationNo - ) { + ) { response.WaterConnection[0] = wsApplicationDetails; } if ( - response?.SewerageConnections?.[0] && - wsApplicationDetails?.applicationType && + response?.SewerageConnections?.[0] && + wsApplicationDetails?.applicationType && wsApplicationDetails?.applicationNo == response?.SewerageConnections?.[0]?.applicationNo - ) { + ) { response.SewerageConnections[0] = wsApplicationDetails; } @@ -201,9 +198,11 @@ export const WSSearch = { const serviceTypeOfData = serviceType == "WATER" ? "WS.ONE_TIME_FEE" : "SW.ONE_TIME_FEE"; const collectionNumber = filters?.applicationNumber; - - let fetchBillData = {}, colletionData = {}, estimationResponse = {}, mdmsRes = {}, isPaid = false; - + let fetchBillData = {}, + colletionData = {}, + estimationResponse = {}, + mdmsRes = {}, + isPaid = false; fetchBillData = await WSSearch.fetchBillData({ tenantId, serviceTypeOfData, collectionNumber }); @@ -211,17 +210,32 @@ export const WSSearch = { const stateCode = Digit.ULBService.getStateId(); mdmsRes = await MdmsService.getMultipleTypes(stateCode, "BillingService", ["TaxHeadMaster"]); let taxHeadMasterResponce = mdmsRes.BillingService.TaxHeadMaster; - fetchBillData.Bill[0].billDetails[0].billAccountDetails.forEach(data => { - taxHeadMasterResponce.forEach(taxHeadCode => { if (data.taxHeadCode == taxHeadCode.code) { data.category = taxHeadCode.category } }); + fetchBillData.Bill[0].billDetails[0].billAccountDetails.forEach((data) => { + taxHeadMasterResponce.forEach((taxHeadCode) => { + if (data.taxHeadCode == taxHeadCode.code) { + data.category = taxHeadCode.category; + } + }); }); - let fee = 0, charge = 0, taxAmount = 0; - fetchBillData.Bill[0].billSlabData = _.groupBy(fetchBillData.Bill[0].billDetails[0].billAccountDetails, 'category') - if (fetchBillData?.Bill?.[0]?.billSlabData?.FEE?.length > 0) fetchBillData.Bill[0].billSlabData.FEE?.map(amount => { fee += parseFloat(amount.amount); }); - if (fetchBillData?.Bill?.[0]?.billSlabData?.CHARGES?.length > 0) fetchBillData.Bill[0].billSlabData.CHARGES?.map(amount => { charge += parseFloat(amount.amount); }); - if (fetchBillData?.Bill?.[0]?.billSlabData?.TAX?.length > 0) fetchBillData.Bill[0].billSlabData.TAX?.map(amount => { taxAmount += parseFloat(amount.amount); }); + let fee = 0, + charge = 0, + taxAmount = 0; + fetchBillData.Bill[0].billSlabData = _.groupBy(fetchBillData.Bill[0].billDetails[0].billAccountDetails, "category"); + if (fetchBillData?.Bill?.[0]?.billSlabData?.FEE?.length > 0) + fetchBillData.Bill[0].billSlabData.FEE?.map((amount) => { + fee += parseFloat(amount.amount); + }); + if (fetchBillData?.Bill?.[0]?.billSlabData?.CHARGES?.length > 0) + fetchBillData.Bill[0].billSlabData.CHARGES?.map((amount) => { + charge += parseFloat(amount.amount); + }); + if (fetchBillData?.Bill?.[0]?.billSlabData?.TAX?.length > 0) + fetchBillData.Bill[0].billSlabData.TAX?.map((amount) => { + taxAmount += parseFloat(amount.amount); + }); fetchBillData.Bill[0].fee = fee; - fetchBillData.Bill[0].charge = charge + fetchBillData.Bill[0].charge = charge; fetchBillData.Bill[0].taxAmount = taxAmount; fetchBillData.Bill[0].totalAmount = fee + charge + taxAmount; } @@ -234,20 +248,38 @@ export const WSSearch = { const stateCode = Digit.ULBService.getStateId(); mdmsRes = await MdmsService.getMultipleTypes(stateCode, "BillingService", ["TaxHeadMaster"]); let taxHeadMasterResponce = mdmsRes.BillingService.TaxHeadMaster; - colletionDataDetails?.Payments?.[0]?.paymentDetails?.[0]?.bill?.billDetails?.[0]?.billAccountDetails.forEach(data => { - taxHeadMasterResponce.forEach(taxHeadCode => { if (data.taxHeadCode == taxHeadCode.code) { data.category = taxHeadCode.category } }); + colletionDataDetails?.Payments?.[0]?.paymentDetails?.[0]?.bill?.billDetails?.[0]?.billAccountDetails.forEach((data) => { + taxHeadMasterResponce.forEach((taxHeadCode) => { + if (data.taxHeadCode == taxHeadCode.code) { + data.category = taxHeadCode.category; + } + }); }); - - let fee = 0, charge = 0, taxAmount = 0; + + let fee = 0, + charge = 0, + taxAmount = 0; fetchBillData = {}; fetchBillData.Bill = []; fetchBillData.Bill[0] = {}; - fetchBillData.Bill[0].billSlabData = _.groupBy(colletionDataDetails?.Payments?.[0]?.paymentDetails?.[0]?.bill?.billDetails?.[0]?.billAccountDetails, 'category') - if (fetchBillData?.Bill?.[0]?.billSlabData?.FEE?.length > 0) fetchBillData.Bill[0].billSlabData.FEE?.map(amount => { fee += parseFloat(amount.amount); }); - if (fetchBillData?.Bill?.[0]?.billSlabData?.CHARGES?.length > 0) fetchBillData.Bill[0].billSlabData.CHARGES?.map(amount => { charge += parseFloat(amount.amount); }); - if (fetchBillData?.Bill?.[0]?.billSlabData?.TAX?.length > 0) fetchBillData.Bill[0].billSlabData.TAX?.map(amount => { taxAmount += parseFloat(amount.amount); }); + fetchBillData.Bill[0].billSlabData = _.groupBy( + colletionDataDetails?.Payments?.[0]?.paymentDetails?.[0]?.bill?.billDetails?.[0]?.billAccountDetails, + "category" + ); + if (fetchBillData?.Bill?.[0]?.billSlabData?.FEE?.length > 0) + fetchBillData.Bill[0].billSlabData.FEE?.map((amount) => { + fee += parseFloat(amount.amount); + }); + if (fetchBillData?.Bill?.[0]?.billSlabData?.CHARGES?.length > 0) + fetchBillData.Bill[0].billSlabData.CHARGES?.map((amount) => { + charge += parseFloat(amount.amount); + }); + if (fetchBillData?.Bill?.[0]?.billSlabData?.TAX?.length > 0) + fetchBillData.Bill[0].billSlabData.TAX?.map((amount) => { + taxAmount += parseFloat(amount.amount); + }); fetchBillData.Bill[0].fee = fee; - fetchBillData.Bill[0].charge = charge + fetchBillData.Bill[0].charge = charge; fetchBillData.Bill[0].taxAmount = taxAmount; fetchBillData.Bill[0].totalAmount = fee + charge + taxAmount; } @@ -264,12 +296,12 @@ export const WSSearch = { } if (estimationResponse?.Calculation?.[0]?.taxHeadEstimates?.length > 0) { - estimationResponse.Calculation[0].taxHeadEstimates?.forEach(data => data.amount = data.estimateAmount); - estimationResponse.Calculation[0].billSlabData = _.groupBy(estimationResponse.Calculation[0].taxHeadEstimates, 'category'); + estimationResponse.Calculation[0].taxHeadEstimates?.forEach((data) => (data.amount = data.estimateAmount)); + estimationResponse.Calculation[0].billSlabData = _.groupBy(estimationResponse.Calculation[0].taxHeadEstimates, "category"); } fetchBillData = {}; fetchBillData.Bill = []; - fetchBillData.Bill[0] = estimationResponse?.Calculation?.[0] + fetchBillData.Bill[0] = estimationResponse?.Calculation?.[0]; } } @@ -279,7 +311,6 @@ export const WSSearch = { const workFlowDataDetails = cloneDeep(workflowDetails); const serviceDataType = cloneDeep(serviceType); - const applicationHeaderDetails = { title: " ", asSectionHeader: true, @@ -287,13 +318,19 @@ export const WSSearch = { serviceType == "WATER" ? [ { title: "PDF_STATIC_LABEL_APPLICATION_NUMBER_LABEL", value: wsDataDetails?.applicationNo || t("NA") }, - { title: "WS_SERVICE_NAME_LABEL", value: t(`WS_APPLICATION_TYPE_${wsDataDetails?.applicationType ? wsDataDetails?.applicationType : wsDataDetails?.serviceType}`) }, + { + title: "WS_SERVICE_NAME_LABEL", + value: t(`WS_APPLICATION_TYPE_${wsDataDetails?.applicationType ? wsDataDetails?.applicationType : wsDataDetails?.serviceType}`), + }, { title: "WS_NO_OF_CONNECTIONS_PROPOSED_LABEL", value: wsDataDetails?.proposedTaps || t("NA") }, { title: "WS_PROPOSED_PIPE_SIZE", value: wsDataDetails?.proposedPipeSize || t("NA") }, ] : [ { title: "PDF_STATIC_LABEL_APPLICATION_NUMBER_LABEL", value: wsDataDetails?.applicationNo || t("NA") }, - { title: "WS_SERVICE_NAME_LABEL", value: t(`WS_APPLICATION_TYPE_${wsDataDetails?.applicationType ? wsDataDetails?.applicationType : wsDataDetails?.serviceType}`) }, + { + title: "WS_SERVICE_NAME_LABEL", + value: t(`WS_APPLICATION_TYPE_${wsDataDetails?.applicationType ? wsDataDetails?.applicationType : wsDataDetails?.serviceType}`), + }, { title: "WS_NO_WATER_CLOSETS_LABEL", value: wsDataDetails?.proposedWaterClosets || t("NA") }, { title: "WS_PROPOSED_WATER_TOILETS_LABEL", value: wsDataDetails?.proposedToilets || t("NA") }, ], @@ -302,22 +339,27 @@ export const WSSearch = { let isAdhocRebate = false; const checkUserList = await checkUserExist(cloneDeep(userInfo)); const checkStatus = await checkExistStatus(cloneDeep(workFlowDataDetails?.ProcessInstances)); - if (checkUserList?.length > 0 && checkStatus?.length == 0 && window.location.href.includes("/employee") && workFlowDataDetails?.ProcessInstances?.[0]?.nextActions?.length > 0) { + if ( + checkUserList?.length > 0 && + checkStatus?.length == 0 && + window.location.href.includes("/employee") && + workFlowDataDetails?.ProcessInstances?.[0]?.nextActions?.length > 0 + ) { isAdhocRebate = true; } let wtrSewDetails = cloneDeep(wsDataDetails); if (wtrSewDetails?.additionalDetails?.adhocRebateReason) { - wtrSewDetails.additionalDetails.adhocRebateReason_data = { - title : wtrSewDetails?.additionalDetails?.adhocRebateReason, - value: t(`${wtrSewDetails?.additionalDetails?.adhocRebateReason}`) - } + wtrSewDetails.additionalDetails.adhocRebateReason_data = { + title: wtrSewDetails?.additionalDetails?.adhocRebateReason, + value: t(`${wtrSewDetails?.additionalDetails?.adhocRebateReason}`), + }; } if (wtrSewDetails?.additionalDetails?.adhocPenaltyReason) { - wtrSewDetails.additionalDetails.adhocPenaltyReason_data = { - title : wtrSewDetails?.additionalDetails?.adhocPenaltyReason, - value: t(`${wtrSewDetails?.additionalDetails?.adhocPenaltyReason}`) - } + wtrSewDetails.additionalDetails.adhocPenaltyReason_data = { + title: wtrSewDetails?.additionalDetails?.adhocPenaltyReason, + value: t(`${wtrSewDetails?.additionalDetails?.adhocPenaltyReason}`), + }; } const feeEstimation = { @@ -326,15 +368,15 @@ export const WSSearch = { additionalDetails: { estimationDetails: true, data: fetchBillData?.Bill?.[0], - appDetails: {...wtrSewDetails, property: propertyDataDetails, service: serviceDataType}, + appDetails: { ...wtrSewDetails, property: propertyDataDetails, service: serviceDataType }, isAdhocRebate: isAdhocRebate, isVisible: isVisible, isPaid: colletionData?.Payments?.length > 0 ? true : false, isViewBreakup: isVisible, values: [ - { title: "WS_APPLICATION_FEE_HEADER", value: ₹{fetchBillData?.Bill?.[0]?.fee || 0}}, - { title: "WS_SERVICE_FEE_HEADER", value: ₹{fetchBillData?.Bill?.[0]?.charge || 0}}, - { title: "WS_TAX_HEADER", value: ₹{fetchBillData?.Bill?.[0]?.taxAmount || 0}}, + { title: "WS_APPLICATION_FEE_HEADER", value: ₹{fetchBillData?.Bill?.[0]?.fee || 0} }, + { title: "WS_SERVICE_FEE_HEADER", value: ₹{fetchBillData?.Bill?.[0]?.charge || 0} }, + { title: "WS_TAX_HEADER", value: ₹{fetchBillData?.Bill?.[0]?.taxAmount || 0} }, ], }, }; @@ -345,102 +387,180 @@ export const WSSearch = { values: [ { title: "WS_PROPERTY_ID_LABEL", value: propertyDataDetails?.propertyId }, { title: "WS_COMMON_OWNER_NAME_LABEL", value: getOwnerNames(propertyDataDetails) }, - { title: "WS_PROPERTY_ADDRESS_LABEL", value: getAddress(propertyDataDetails?.address, t), isNotTranslated: true, privacy: { uuid: propertyDataDetails?.owners?.[0]?.uuid, fieldName: ["doorNo", "street", "landmark"], model: "Property",showValue: true, - loadData: { - serviceName: "/property-services/property/_search", - requestBody: {}, - requestParam: { tenantId, propertyIds : propertyids }, - jsonPath: "Properties[0].address.street", - isArray: false, - d: (res) => { - let resultString = (_.get(res,"Properties[0].address.doorNo") ? `${_.get(res,"Properties[0].address.doorNo")}, ` : "") + (_.get(res,"Properties[0].address.street")? `${_.get(res,"Properties[0].address.street")}, ` : "") + (_.get(res,"Properties[0].address.landmark") ? `${_.get(res,"Properties[0].address.landmark")}`:"") - return resultString; - } - },}, }, + { + title: "WS_PROPERTY_ADDRESS_LABEL", + value: getAddress(propertyDataDetails?.address, t), + isNotTranslated: true, + privacy: { + uuid: propertyDataDetails?.owners?.[0]?.uuid, + fieldName: ["doorNo", "street", "landmark"], + model: "Property", + showValue: true, + loadData: { + serviceName: "/property-services/property/_search", + requestBody: {}, + requestParam: { tenantId, propertyIds: propertyids }, + jsonPath: "Properties[0].address.street", + isArray: false, + d: (res) => { + let resultString = + (_.get(res, "Properties[0].address.doorNo") ? `${_.get(res, "Properties[0].address.doorNo")}, ` : "") + + (_.get(res, "Properties[0].address.street") ? `${_.get(res, "Properties[0].address.street")}, ` : "") + + (_.get(res, "Properties[0].address.landmark") ? `${_.get(res, "Properties[0].address.landmark")}` : ""); + return resultString; + }, + }, + }, + }, ], additionalDetails: { redirectUrl: { title: t("WS_VIEW_PROPERTY_DETAILS"), - url: `/digit-ui/employee/pt/property-details/${propertyDataDetails?.propertyId}?from=WS_APPLICATION_DETAILS_HEADER`, + url: `/mgramseva-digit-ui/employee/pt/property-details/${propertyDataDetails?.propertyId}?from=WS_APPLICATION_DETAILS_HEADER`, }, }, }; - const uuid = wsDataDetails?.connectionHolders?.[0]?.uuid - const applicationNoForPrivacy = wsDataDetails?.applicationNo + const uuid = wsDataDetails?.connectionHolders?.[0]?.uuid; + const applicationNoForPrivacy = wsDataDetails?.applicationNo; const connectionHolderDetails = { title: "WS_COMMON_CONNECTION_HOLDER_DETAILS_HEADER", asSectionHeader: true, values: wsDataDetails?.connectionHolders?.length > 0 ? [ - { title: "WS_OWN_DETAIL_NAME", value: wsDataDetails?.connectionHolders?.[0]?.name || t("NA") }, - { title: "WS_CONN_HOLDER_OWN_DETAIL_GENDER_LABEL", value: wsDataDetails?.connectionHolders?.[0]?.gender, privacy: { uuid: uuid, fieldName: ["gender"], model: "WnSConnectionOwner",showValue: false, - loadData: { - serviceName: serviceType === "WATER" ? "/ws-services/wc/_search" : "/sw-services/swc/_search", - requestBody: {}, - requestParam: { tenantId, applicationNumber }, - jsonPath: serviceType === "WATER" ? "WaterConnection[0].connectionHolders[0].gender" : "SewerageConnections[0].connectionHolders[0].gender", - isArray: false, - }, }, }, - { title: "CORE_COMMON_MOBILE_NUMBER", value: wsDataDetails?.connectionHolders?.[0]?.mobileNumber, privacy: { uuid: uuid, fieldName: ["connectionHoldersMobileNumber"], model: "WnSConnectionOwner",showValue: false, - loadData: { - serviceName: serviceType === "WATER" ? "/ws-services/wc/_search" : "/sw-services/swc/_search", - requestBody: {}, - requestParam: { tenantId, applicationNumber }, - jsonPath: serviceType === "WATER" ? "WaterConnection[0].connectionHolders[0].mobileNumber" : "SewerageConnections[0].connectionHolders[0].mobileNumber", - isArray: false, - }, }, }, - { title: "WS_CONN_HOLDER_COMMON_FATHER_OR_HUSBAND_NAME", value: wsDataDetails?.connectionHolders?.[0]?.fatherOrHusbandName, privacy: { uuid: uuid, fieldName: ["fatherOrHusbandName"], model: "WnSConnectionOwner",showValue: false, - loadData: { - serviceName: serviceType === "WATER" ? "/ws-services/wc/_search" : "/sw-services/swc/_search", - requestBody: {}, - requestParam: { tenantId, applicationNumber }, - jsonPath: serviceType === "WATER" ? "WaterConnection[0].connectionHolders[0].fatherOrHusbandName" : "SewerageConnections[0].connectionHolders[0].fatherOrHusbandName", - isArray: false, - }, } }, - { title: "WS_CONN_HOLDER_OWN_DETAIL_RELATION_LABEL", value: wsDataDetails?.connectionHolders?.[0]?.relationship, - privacy: { uuid: uuid, fieldName: ["relationship"], model: "WnSConnection",showValue: false, - loadData: { - serviceName: serviceType === "WATER" ? "/ws-services/wc/_search" : "/sw-services/swc/_search", - requestBody: {}, - requestParam: { tenantId, applicationNumber }, - jsonPath: serviceType === "WATER" ? "WaterConnection[0].connectionHolders[0].relationship" : "SewerageConnections[0].connectionHolders[0].relationship", - isArray: false, - }, }, - }, - { - title: "WS_CORRESPONDANCE_ADDRESS_LABEL", value: wsDataDetails?.connectionHolders?.[0]?.correspondenceAddress, - privacy: { - uuid: uuid, - fieldName: wsDataDetails?.connectionHolders[0]?.permanentAddress ? ["permanentAddress"] : ["correspondenceAddress"], - model: "WnSConnectionOwner", - hide: !(wsDataDetails?.connectionHolders[0]?.permanentAddress || wsDataDetails?.connectionHolders[0]?.correspondenceAddress), - showValue: false, - loadData: { - serviceName: serviceType === "WATER" ? "/ws-services/wc/_search" : "/sw-services/swc/_search", - requestBody: {}, - requestParam: { tenantId, applicationNumber }, - jsonPath: serviceType === "WATER" ? "WaterConnection[0].connectionHolders[0].correspondenceAddress" : "SewerageConnections[0].connectionHolders[0].correspondenceAddress", - isArray: false, - }, - } - }, - { - title: "WS_OWNER_SPECIAL_CATEGORY", value: wsDataDetails?.connectionHolders?.[0]?.ownerType ? (wsDataDetails?.connectionHolders?.[0]?.ownerType?.includes("*") ? wsDataDetails?.connectionHolders?.[0]?.ownerType : (`PROPERTYTAX_OWNERTYPE_${wsDataDetails?.connectionHolders?.[0]?.ownerType?.toUpperCase()}`) ): "NA", - privacy: { uuid: uuid, fieldName: ["ownerType"], model: "WnSConnection",showValue: false, - loadData: { - serviceName: serviceType === "WATER" ? "/ws-services/wc/_search" : "/sw-services/swc/_search", - requestBody: {}, - requestParam: { tenantId, applicationNumber }, - jsonPath: serviceType === "WATER" ? "WaterConnection[0].connectionHolders[0].ownerType" : "SewerageConnections[0].connectionHolders[0].ownerType", - isArray: false, - d: (res) => { - let resultString = (res?.WaterConnection?.[0] ? t(`PROPERTYTAX_OWNERTYPE_${res?.WaterConnection?.[0]?.connectionHolders?.[0]?.ownerType?.toUpperCase()}`) : t(`PROPERTYTAX_OWNERTYPE_${res?.SewerageConnections?.[0]?.connectionHolders?.[0]?.ownerType?.toUpperCase()}`)); - return resultString; - } - }, }, - }, + { title: "WS_OWN_DETAIL_NAME", value: wsDataDetails?.connectionHolders?.[0]?.name || t("NA") }, + { + title: "WS_CONN_HOLDER_OWN_DETAIL_GENDER_LABEL", + value: wsDataDetails?.connectionHolders?.[0]?.gender, + privacy: { + uuid: uuid, + fieldName: ["gender"], + model: "WnSConnectionOwner", + showValue: false, + loadData: { + serviceName: serviceType === "WATER" ? "/ws-services/wc/_search" : "/sw-services/swc/_search", + requestBody: {}, + requestParam: { tenantId, applicationNumber }, + jsonPath: + serviceType === "WATER" + ? "WaterConnection[0].connectionHolders[0].gender" + : "SewerageConnections[0].connectionHolders[0].gender", + isArray: false, + }, + }, + }, + { + title: "CORE_COMMON_MOBILE_NUMBER", + value: wsDataDetails?.connectionHolders?.[0]?.mobileNumber, + privacy: { + uuid: uuid, + fieldName: ["connectionHoldersMobileNumber"], + model: "WnSConnectionOwner", + showValue: false, + loadData: { + serviceName: serviceType === "WATER" ? "/ws-services/wc/_search" : "/sw-services/swc/_search", + requestBody: {}, + requestParam: { tenantId, applicationNumber }, + jsonPath: + serviceType === "WATER" + ? "WaterConnection[0].connectionHolders[0].mobileNumber" + : "SewerageConnections[0].connectionHolders[0].mobileNumber", + isArray: false, + }, + }, + }, + { + title: "WS_CONN_HOLDER_COMMON_FATHER_OR_HUSBAND_NAME", + value: wsDataDetails?.connectionHolders?.[0]?.fatherOrHusbandName, + privacy: { + uuid: uuid, + fieldName: ["fatherOrHusbandName"], + model: "WnSConnectionOwner", + showValue: false, + loadData: { + serviceName: serviceType === "WATER" ? "/ws-services/wc/_search" : "/sw-services/swc/_search", + requestBody: {}, + requestParam: { tenantId, applicationNumber }, + jsonPath: + serviceType === "WATER" + ? "WaterConnection[0].connectionHolders[0].fatherOrHusbandName" + : "SewerageConnections[0].connectionHolders[0].fatherOrHusbandName", + isArray: false, + }, + }, + }, + { + title: "WS_CONN_HOLDER_OWN_DETAIL_RELATION_LABEL", + value: wsDataDetails?.connectionHolders?.[0]?.relationship, + privacy: { + uuid: uuid, + fieldName: ["relationship"], + model: "WnSConnection", + showValue: false, + loadData: { + serviceName: serviceType === "WATER" ? "/ws-services/wc/_search" : "/sw-services/swc/_search", + requestBody: {}, + requestParam: { tenantId, applicationNumber }, + jsonPath: + serviceType === "WATER" + ? "WaterConnection[0].connectionHolders[0].relationship" + : "SewerageConnections[0].connectionHolders[0].relationship", + isArray: false, + }, + }, + }, + { + title: "WS_CORRESPONDANCE_ADDRESS_LABEL", + value: wsDataDetails?.connectionHolders?.[0]?.correspondenceAddress, + privacy: { + uuid: uuid, + fieldName: wsDataDetails?.connectionHolders[0]?.permanentAddress ? ["permanentAddress"] : ["correspondenceAddress"], + model: "WnSConnectionOwner", + hide: !(wsDataDetails?.connectionHolders[0]?.permanentAddress || wsDataDetails?.connectionHolders[0]?.correspondenceAddress), + showValue: false, + loadData: { + serviceName: serviceType === "WATER" ? "/ws-services/wc/_search" : "/sw-services/swc/_search", + requestBody: {}, + requestParam: { tenantId, applicationNumber }, + jsonPath: + serviceType === "WATER" + ? "WaterConnection[0].connectionHolders[0].correspondenceAddress" + : "SewerageConnections[0].connectionHolders[0].correspondenceAddress", + isArray: false, + }, + }, + }, + { + title: "WS_OWNER_SPECIAL_CATEGORY", + value: wsDataDetails?.connectionHolders?.[0]?.ownerType + ? wsDataDetails?.connectionHolders?.[0]?.ownerType?.includes("*") + ? wsDataDetails?.connectionHolders?.[0]?.ownerType + : `PROPERTYTAX_OWNERTYPE_${wsDataDetails?.connectionHolders?.[0]?.ownerType?.toUpperCase()}` + : "NA", + privacy: { + uuid: uuid, + fieldName: ["ownerType"], + model: "WnSConnection", + showValue: false, + loadData: { + serviceName: serviceType === "WATER" ? "/ws-services/wc/_search" : "/sw-services/swc/_search", + requestBody: {}, + requestParam: { tenantId, applicationNumber }, + jsonPath: + serviceType === "WATER" + ? "WaterConnection[0].connectionHolders[0].ownerType" + : "SewerageConnections[0].connectionHolders[0].ownerType", + isArray: false, + d: (res) => { + let resultString = res?.WaterConnection?.[0] + ? t(`PROPERTYTAX_OWNERTYPE_${res?.WaterConnection?.[0]?.connectionHolders?.[0]?.ownerType?.toUpperCase()}`) + : t(`PROPERTYTAX_OWNERTYPE_${res?.SewerageConnections?.[0]?.connectionHolders?.[0]?.ownerType?.toUpperCase()}`); + return resultString; + }, + }, + }, + }, ] : [{ title: "WS_CONN_HOLDER_SAME_AS_OWNER_DETAILS", value: t("SCORE_YES") }], }; @@ -513,17 +633,27 @@ export const WSSearch = { }, { title: "WS_ADDN_DETAILS_PLUMBER_LICENCE_NO_LABEL", value: wsDataDetails?.plumberInfo?.[0]?.licenseNo || t("NA") }, { title: "WS_ADDN_DETAILS_PLUMBER_NAME_LABEL", value: wsDataDetails?.plumberInfo?.[0]?.name || t("NA") }, - { - title: "WS_PLUMBER_MOBILE_NO_LABEL", value: wsDataDetails?.plumberInfo?.[0]?.mobileNumber || t("NA"), privacy: { uuid: wsDataDetails?.applicationNo, fieldName: ["plumberInfoMobileNumber"], model: "WnSConnectionPlumber",showValue: false, - loadData: { - serviceName: serviceType === "WATER" ? "/ws-services/wc/_search" : "/sw-services/swc/_search", - requestBody: {}, - requestParam: { tenantId, applicationNumber }, - jsonPath: serviceType === "WATER" ? "WaterConnection[0].plumberInfo[0].mobileNumber" : "SewerageConnections[0].plumberInfo[0].mobileNumber", - isArray: false, - }, }, - //privacy:{} - }, + { + title: "WS_PLUMBER_MOBILE_NO_LABEL", + value: wsDataDetails?.plumberInfo?.[0]?.mobileNumber || t("NA"), + privacy: { + uuid: wsDataDetails?.applicationNo, + fieldName: ["plumberInfoMobileNumber"], + model: "WnSConnectionPlumber", + showValue: false, + loadData: { + serviceName: serviceType === "WATER" ? "/ws-services/wc/_search" : "/sw-services/swc/_search", + requestBody: {}, + requestParam: { tenantId, applicationNumber }, + jsonPath: + serviceType === "WATER" + ? "WaterConnection[0].plumberInfo[0].mobileNumber" + : "SewerageConnections[0].plumberInfo[0].mobileNumber", + isArray: false, + }, + }, + //privacy:{} + }, ] : [ { @@ -534,15 +664,17 @@ export const WSSearch = { }, ], roadCuttingDetails: wsDataDetails?.roadCuttingInfo - ? wsDataDetails?.roadCuttingInfo?.filter((e) => e?.status !== "INACTIVE")?.map((info, index) => { - return { - title: "WS_ROAD_CUTTING_DETAIL", - values: [ - { title: "WS_ADDN_DETAIL_ROAD_TYPE", value: t(`WS_ROADTYPE_${info?.roadType}`) }, - { title: "WS_ROAD_CUTTING_AREA_LABEL", value: info?.roadCuttingArea }, - ], - }; - }) + ? wsDataDetails?.roadCuttingInfo + ?.filter((e) => e?.status !== "INACTIVE") + ?.map((info, index) => { + return { + title: "WS_ROAD_CUTTING_DETAIL", + values: [ + { title: "WS_ADDN_DETAIL_ROAD_TYPE", value: t(`WS_ROADTYPE_${info?.roadType}`) }, + { title: "WS_ROAD_CUTTING_AREA_LABEL", value: info?.roadCuttingArea }, + ], + }; + }) : [ { title: "WS_ROAD_CUTTING_DETAIL", @@ -564,13 +696,13 @@ export const WSSearch = { { title: "WS_SERV_DETAIL_CONN_EXECUTION_DATE", value: wsDataDetails?.connectionExecutionDate ? convertEpochToDate(wsDataDetails?.connectionExecutionDate) : t("NA"), - } + }, ] : [ { title: "WS_SERV_DETAIL_CONN_EXECUTION_DATE", value: wsDataDetails?.connectionExecutionDate ? convertEpochToDate(wsDataDetails?.connectionExecutionDate) : t("NA"), - } + }, ], }, }; @@ -582,12 +714,21 @@ export const WSSearch = { isLabelShow: true, additionalDetails: { isLabelShow: true }, }; - details = [...details,isLabelShow, applicationHeaderDetails, feeEstimation, propertyDetails, connectionHolderDetails, AdditionalDetailsByWS, documentDetails]; + details = [ + ...details, + isLabelShow, + applicationHeaderDetails, + feeEstimation, + propertyDetails, + connectionHolderDetails, + AdditionalDetailsByWS, + documentDetails, + ]; wsDataDetails.serviceType = serviceDataType; if (!isVisible) { - const allDetails = cloneDeep(details) - details = allDetails?.filter(data => data?.title != "WS_TASK_DETAILS_FEE_ESTIMATE"); + const allDetails = cloneDeep(details); + details = allDetails?.filter((data) => data?.title != "WS_TASK_DETAILS_FEE_ESTIMATE"); } //for edit in DV and FI : reloading after unmasking sessionStorage.removeItem("IsDetailsExists"); @@ -605,7 +746,6 @@ export const WSSearch = { }, modifyApplicationDetails: async (t, tenantId, applicationNumber, serviceType = "WATER", userInfo, config = {}) => { - const filters = { applicationNumber }; let propertyids = "", @@ -622,7 +762,6 @@ export const WSSearch = { const wsOldDetails = cloneDeep(serviceType == "WATER" ? oldResponse?.WaterConnection?.[1] : oldResponse?.SewerageConnections?.[1]); - wsData?.forEach((item) => { propertyids = propertyids + item?.propertyId + ","; consumercodes = consumercodes + item?.applicationNo + ","; @@ -658,17 +797,23 @@ export const WSSearch = { values: serviceType == "WATER" ? [ - { title: "PDF_STATIC_LABEL_APPLICATION_NUMBER_LABEL", value: wsDataDetails?.applicationNo || t("NA") }, - { title: "WS_SERVICE_NAME_LABEL", value: t(`WS_APPLICATION_TYPE_${wsDataDetails?.applicationType? wsDataDetails?.applicationType : wsDataDetails?.serviceType}`) }, - { title: "WS_NO_OF_CONNECTIONS_PROPOSED_LABEL", value: wsDataDetails?.proposedTaps || t("NA") }, - { title: "WS_PROPOSED_PIPE_SIZE", value: wsDataDetails?.proposedPipeSize || t("NA") }, - ] + { title: "PDF_STATIC_LABEL_APPLICATION_NUMBER_LABEL", value: wsDataDetails?.applicationNo || t("NA") }, + { + title: "WS_SERVICE_NAME_LABEL", + value: t(`WS_APPLICATION_TYPE_${wsDataDetails?.applicationType ? wsDataDetails?.applicationType : wsDataDetails?.serviceType}`), + }, + { title: "WS_NO_OF_CONNECTIONS_PROPOSED_LABEL", value: wsDataDetails?.proposedTaps || t("NA") }, + { title: "WS_PROPOSED_PIPE_SIZE", value: wsDataDetails?.proposedPipeSize || t("NA") }, + ] : [ - { title: "PDF_STATIC_LABEL_APPLICATION_NUMBER_LABEL", value: wsDataDetails?.applicationNo || t("NA") }, - { title: "WS_SERVICE_NAME_LABEL", value: t(`WS_APPLICATION_TYPE_${wsDataDetails?.applicationType? wsDataDetails?.applicationType : wsDataDetails?.serviceType}`) }, - { title: "WS_NO_WATER_CLOSETS_LABEL", value: wsDataDetails?.proposedWaterClosets || t("NA") }, - { title: "WS_PROPOSED_WATER_TOILETS_LABEL", value: wsDataDetails?.proposedToilets || t("NA") }, - ], + { title: "PDF_STATIC_LABEL_APPLICATION_NUMBER_LABEL", value: wsDataDetails?.applicationNo || t("NA") }, + { + title: "WS_SERVICE_NAME_LABEL", + value: t(`WS_APPLICATION_TYPE_${wsDataDetails?.applicationType ? wsDataDetails?.applicationType : wsDataDetails?.serviceType}`), + }, + { title: "WS_NO_WATER_CLOSETS_LABEL", value: wsDataDetails?.proposedWaterClosets || t("NA") }, + { title: "WS_PROPOSED_WATER_TOILETS_LABEL", value: wsDataDetails?.proposedToilets || t("NA") }, + ], }; const propertyDetails = { @@ -678,71 +823,97 @@ export const WSSearch = { { title: "WS_PROPERTY_ID_LABEL", value: propertyDataDetails?.propertyId, - oldValue: propertyDataDetails?.propertyId != oldPropertyDetails?.propertyId ? - [ - { value: propertyDataDetails?.propertyId, className: "newValue", style: { display: "inline" } }, - { - value: `${t("WS_OLD_LABEL_NAME")} ${oldPropertyDetails?.propertyId}`, - style: { color: 'gray', paddingLeft: "10px", display: "inline", fontSize: "13px" }, className: "oldValue" - } - ] : null + oldValue: + propertyDataDetails?.propertyId != oldPropertyDetails?.propertyId + ? [ + { value: propertyDataDetails?.propertyId, className: "newValue", style: { display: "inline" } }, + { + value: `${t("WS_OLD_LABEL_NAME")} ${oldPropertyDetails?.propertyId}`, + style: { color: "gray", paddingLeft: "10px", display: "inline", fontSize: "13px" }, + className: "oldValue", + }, + ] + : null, }, { title: "WS_COMMON_OWNER_NAME_LABEL", value: getOwnerNames(propertyDataDetails), - oldValue: getOwnerNames(propertyDataDetails) != getOwnerNames(oldPropertyDetails) ? - [ - { value: getOwnerNames(propertyDataDetails), className: "newValue", style: { display: "inline" } }, - { - value: `${t("WS_OLD_LABEL_NAME")} ${getOwnerNames(oldPropertyDetails)}`, - style: { color: 'gray', paddingLeft: "10px", display: "inline", fontSize: "13px" }, className: "oldValue" - } - ] : null + oldValue: + getOwnerNames(propertyDataDetails) != getOwnerNames(oldPropertyDetails) + ? [ + { value: getOwnerNames(propertyDataDetails), className: "newValue", style: { display: "inline" } }, + { + value: `${t("WS_OLD_LABEL_NAME")} ${getOwnerNames(oldPropertyDetails)}`, + style: { color: "gray", paddingLeft: "10px", display: "inline", fontSize: "13px" }, + className: "oldValue", + }, + ] + : null, }, { title: "WS_PROPERTY_ADDRESS_LABEL", value: getAddress(propertyDataDetails?.address, t), isNotTranslated: true, - privacy: [{ uuid: propertyDataDetails?.owners?.[0]?.uuid, fieldName: ["doorNo", "street", "landmark"], model: "Property",showValue: true, - loadData: { - serviceName: "/property-services/property/_search", - requestBody: {}, - requestParam: { tenantId, propertyIds : propertyids }, - jsonPath: "Properties[0].address.street", - isArray: false, - d: (res) => { - let resultString = (_.get(res,"Properties[0].address.doorNo") ? `${_.get(res,"Properties[0].address.doorNo")}, ` : "") + (_.get(res,"Properties[0].address.street")? `${_.get(res,"Properties[0].address.street")}, ` : "") + (_.get(res,"Properties[0].address.landmark") ? `${_.get(res,"Properties[0].address.landmark")}`:"") - return resultString; - } - }}, - { uuid: oldPropertyDetails?.owners?.[0]?.uuid, fieldName: ["doorNo", "street", "landmark"], model: "Property",showValue: true, - loadData: { - serviceName: "/property-services/property/_search", - requestBody: {}, - requestParam: { tenantId, propertyIds : wsOldDetails?.propertyId }, - jsonPath: "Properties[0].address.street", - isArray: false, - oldValue: true, - d: (res) => { - let resultString = (_.get(res,"Properties[0].address.doorNo") ? `${_.get(res,"Properties[0].address.doorNo")}, ` : "") + (_.get(res,"Properties[0].address.street")? `${_.get(res,"Properties[0].address.street")}, ` : "") + (_.get(res,"Properties[0].address.landmark") ? `${_.get(res,"Properties[0].address.landmark")}`:"") - return resultString; - } - } - }], - oldValue: getAddress(propertyDataDetails?.address, t) != getAddress(oldPropertyDetails?.address, t) ? - [ - { value: getAddress(propertyDataDetails?.address, t), className: "newValue", style: { display: "inline" } }, - { - value: `${t("WS_OLD_LABEL_NAME")} ${getAddress(oldPropertyDetails?.address, t)}`, - style: { color: 'gray', paddingLeft: "10px", display: "inline", fontSize: "13px" }, className: "oldValue" - } - ] : null + privacy: [ + { + uuid: propertyDataDetails?.owners?.[0]?.uuid, + fieldName: ["doorNo", "street", "landmark"], + model: "Property", + showValue: true, + loadData: { + serviceName: "/property-services/property/_search", + requestBody: {}, + requestParam: { tenantId, propertyIds: propertyids }, + jsonPath: "Properties[0].address.street", + isArray: false, + d: (res) => { + let resultString = + (_.get(res, "Properties[0].address.doorNo") ? `${_.get(res, "Properties[0].address.doorNo")}, ` : "") + + (_.get(res, "Properties[0].address.street") ? `${_.get(res, "Properties[0].address.street")}, ` : "") + + (_.get(res, "Properties[0].address.landmark") ? `${_.get(res, "Properties[0].address.landmark")}` : ""); + return resultString; + }, + }, + }, + { + uuid: oldPropertyDetails?.owners?.[0]?.uuid, + fieldName: ["doorNo", "street", "landmark"], + model: "Property", + showValue: true, + loadData: { + serviceName: "/property-services/property/_search", + requestBody: {}, + requestParam: { tenantId, propertyIds: wsOldDetails?.propertyId }, + jsonPath: "Properties[0].address.street", + isArray: false, + oldValue: true, + d: (res) => { + let resultString = + (_.get(res, "Properties[0].address.doorNo") ? `${_.get(res, "Properties[0].address.doorNo")}, ` : "") + + (_.get(res, "Properties[0].address.street") ? `${_.get(res, "Properties[0].address.street")}, ` : "") + + (_.get(res, "Properties[0].address.landmark") ? `${_.get(res, "Properties[0].address.landmark")}` : ""); + return resultString; + }, + }, + }, + ], + oldValue: + getAddress(propertyDataDetails?.address, t) != getAddress(oldPropertyDetails?.address, t) + ? [ + { value: getAddress(propertyDataDetails?.address, t), className: "newValue", style: { display: "inline" } }, + { + value: `${t("WS_OLD_LABEL_NAME")} ${getAddress(oldPropertyDetails?.address, t)}`, + style: { color: "gray", paddingLeft: "10px", display: "inline", fontSize: "13px" }, + className: "oldValue", + }, + ] + : null, }, ], additionalDetails: { redirectUrl: { title: t("WS_VIEW_PROPERTY_DETAILS"), - url: `/digit-ui/employee/pt/property-details/${propertyDataDetails?.propertyId}?from=WS_APPLICATION_DETAILS_HEADER`, + url: `/mgramseva-digit-ui/employee/pt/property-details/${propertyDataDetails?.propertyId}?from=WS_APPLICATION_DETAILS_HEADER`, }, }, }; @@ -758,245 +929,432 @@ export const WSSearch = { values: wsDataDetails?.connectionHolders?.length > 0 ? [ - { - title: "WS_OWN_DETAIL_NAME", - value: wsDataDetails?.connectionHolders?.[0]?.name || t("NA"), - oldValue: wsDataDetails?.connectionHolders?.[0]?.name != wsOldData?.connectionHolders?.[0]?.name ? [ - { value: wsDataDetails?.connectionHolders?.[0]?.name || t("NA"), className: "newValue", style: { display: "inline" } }, - { - value: `${t("WS_OLD_LABEL_NAME")} ${wsOldData?.connectionHolders?.[0]?.name || t("NA")}`, - style: { color: 'gray', paddingLeft: "10px", display: "inline", fontSize: "13px" }, className: "oldValue" - } - ] : null - }, - { - title: "WS_CONN_HOLDER_OWN_DETAIL_GENDER_LABEL", - value: wsDataDetails?.connectionHolders?.[0]?.gender, - privacy: [{ uuid: uuid, fieldName: ["gender"], model: "WnSConnectionOwner",showValue: false, - loadData: { - serviceName: serviceType === "WATER" ? "/ws-services/wc/_search" : "/sw-services/swc/_search", - requestBody: {}, - requestParam: { tenantId, applicationNumber }, - jsonPath: serviceType === "WATER" ? "WaterConnection[0].connectionHolders[0].gender" : "SewerageConnections[0].connectionHolders[0].gender", - isArray: false, - }, },{ uuid: olduuid, fieldName: ["gender"], model: "WnSConnectionOwner",showValue: false, - loadData: { - serviceName: serviceType === "WATER" ? "/ws-services/wc/_search" : "/sw-services/swc/_search", - requestBody: {}, - requestParam: { tenantId, applicationNumber:OldapplicationNo}, - jsonPath: serviceType === "WATER" ? "WaterConnection[0].connectionHolders[0].gender" : "SewerageConnections[0].connectionHolders[0].gender", - isArray: false, - oldValue: true, - d: (res) => { - let resultString = (res?.WaterConnection?.[0] ? `${t("WS_OLD_LABEL_NAME")} ${t(res?.WaterConnection?.[0]?.connectionHolders?.[0]?.gender)}` : `${t("WS_OLD_LABEL_NAME")} ${t(res?.SewerageConnections?.[0]?.connectionHolders?.[0]?.gender)}`); - return resultString; - } - }, }], - oldValue: wsDataDetails?.connectionHolders?.[0]?.gender != wsOldData?.connectionHolders?.[0]?.gender ? [ - { value: wsDataDetails?.connectionHolders?.[0]?.gender ? t(`${wsDataDetails?.connectionHolders?.[0]?.gender}`) : t("NA"), className: "newValue", style: { display: "inline" } }, - { - value: `${t("WS_OLD_LABEL_NAME")} ${wsOldData?.connectionHolders?.[0]?.gender ? t(`${wsOldData?.connectionHolders?.[0]?.gender}`) : t("NA")}`, - style: { color: 'gray', paddingLeft: "10px", display: "inline", fontSize: "13px" }, className: "oldValue" - } - ] : null - }, - { - title: "CORE_COMMON_MOBILE_NUMBER", - value: wsDataDetails?.connectionHolders?.[0]?.mobileNumber, - privacy: [{ - uuid: uuid, fieldName: ["connectionHoldersMobileNumber"], - model: "WnSConnectionOwner",showValue: false, - loadData: { - serviceName: serviceType === "WATER" ? "/ws-services/wc/_search" : "/sw-services/swc/_search", - requestBody: {}, - requestParam: { tenantId, applicationNumber }, - jsonPath: serviceType === "WATER" ? "WaterConnection[0].connectionHolders[0].mobileNumber" : "SewerageConnections[0].connectionHolders[0].mobileNumber", - isArray: false, - }, + { + title: "WS_OWN_DETAIL_NAME", + value: wsDataDetails?.connectionHolders?.[0]?.name || t("NA"), + oldValue: + wsDataDetails?.connectionHolders?.[0]?.name != wsOldData?.connectionHolders?.[0]?.name + ? [ + { value: wsDataDetails?.connectionHolders?.[0]?.name || t("NA"), className: "newValue", style: { display: "inline" } }, + { + value: `${t("WS_OLD_LABEL_NAME")} ${wsOldData?.connectionHolders?.[0]?.name || t("NA")}`, + style: { color: "gray", paddingLeft: "10px", display: "inline", fontSize: "13px" }, + className: "oldValue", + }, + ] + : null, }, { - uuid: olduuid, fieldName: ["connectionHoldersMobileNumber"], - model: "WnSConnectionOwner",showValue: false, - loadData: { - serviceName: serviceType === "WATER" ? "/ws-services/wc/_search" : "/sw-services/swc/_search", - requestBody: {}, - requestParam: { tenantId, applicationNumber:OldapplicationNo }, - jsonPath: serviceType === "WATER" ? "WaterConnection[0].connectionHolders[0].mobileNumber" : "SewerageConnections[0].connectionHolders[0].mobileNumber", - isArray: false, - oldValue: true, - d: (res) => { - let resultString = (res?.WaterConnection?.[0] ? `${t("WS_OLD_LABEL_NAME")} ${res?.WaterConnection?.[0]?.connectionHolders?.[0]?.mobileNumber}` : `${t("WS_OLD_LABEL_NAME")} ${res?.SewerageConnections?.[0]?.connectionHolders?.[0]?.mobileNumber}`); - return resultString; - } - }, - }], - oldValue: wsDataDetails?.connectionHolders?.[0]?.mobileNumber != wsOldData?.connectionHolders?.[0]?.mobileNumber ? [ - { value: wsDataDetails?.connectionHolders?.[0]?.mobileNumber ? t(`${wsDataDetails?.connectionHolders?.[0]?.mobileNumber}`) : t("NA"), className: "newValue", style: { display: "inline" } }, - { - value: `${t("WS_OLD_LABEL_NAME")} ${wsOldData?.connectionHolders?.[0]?.mobileNumber ? t(`${wsOldData?.connectionHolders?.[0]?.mobileNumber}`) : t("NA")}`, - style: { color: 'gray', paddingLeft: "10px", display: "inline", fontSize: "13px" }, className: "oldValue" - } - ] : null - }, - { - title: "WS_CONN_HOLDER_COMMON_FATHER_OR_HUSBAND_NAME", - value: wsDataDetails?.connectionHolders?.[0]?.fatherOrHusbandName, - privacy: [{ - uuid: uuid, fieldName: ["fatherOrHusbandName"], - model: "WnSConnectionOwner",showValue: false, - loadData: { - serviceName: serviceType === "WATER" ? "/ws-services/wc/_search" : "/sw-services/swc/_search", - requestBody: {}, - requestParam: { tenantId, applicationNumber }, - jsonPath: serviceType === "WATER" ? "WaterConnection[0].connectionHolders[0].fatherOrHusbandName" : "SewerageConnections[0].connectionHolders[0].fatherOrHusbandName", - isArray: false, - }, - },{ - uuid: olduuid, fieldName: ["fatherOrHusbandName"], - model: "WnSConnectionOwner",showValue: false, - loadData: { - serviceName: serviceType === "WATER" ? "/ws-services/wc/_search" : "/sw-services/swc/_search", - requestBody: {}, - requestParam: { tenantId, applicationNumber:OldapplicationNo}, - jsonPath: serviceType === "WATER" ? "WaterConnection[0].connectionHolders[0].fatherOrHusbandName" : "SewerageConnections[0].connectionHolders[0].fatherOrHusbandName", - isArray: false, - oldValue: true, - d: (res) => { - let resultString = (res?.WaterConnection?.[0] ? `${t("WS_OLD_LABEL_NAME")} ${res?.WaterConnection?.[0]?.connectionHolders?.[0]?.fatherOrHusbandName}` : `${t("WS_OLD_LABEL_NAME")} ${res?.SewerageConnections?.[0]?.connectionHolders?.[0]?.fatherOrHusbandName}`); - return resultString; - } - }, - }], - oldValue: wsDataDetails?.connectionHolders?.[0]?.fatherOrHusbandName != wsOldData?.connectionHolders?.[0]?.fatherOrHusbandName ? [ - { value: `${wsDataDetails?.connectionHolders?.[0]?.fatherOrHusbandName ? t(`${wsDataDetails?.connectionHolders?.[0]?.fatherOrHusbandName}`) : t("NA")}`, className: "newValue", style: { display: "inline" } }, - { - value: `${`${t("WS_OLD_LABEL_NAME")} ${wsOldData?.connectionHolders?.[0]?.fatherOrHusbandName ? t(`${wsOldData?.connectionHolders?.[0]?.fatherOrHusbandName}`) : t("NA")}`}`, - style: { color: 'gray', paddingLeft: "10px", display: "inline", fontSize: "13px" }, className: "oldValue" - } - ] : null - }, - { - title: "WS_CONN_HOLDER_OWN_DETAIL_RELATION_LABEL", - value: wsDataDetails?.connectionHolders?.[0]?.relationship, - privacy: [{ uuid: uuid, fieldName: ["relationship"], model: "WnSConnectionOwner",showValue: false, - loadData: { - serviceName: serviceType === "WATER" ? "/ws-services/wc/_search" : "/sw-services/swc/_search", - requestBody: {}, - requestParam: { tenantId, applicationNumber }, - jsonPath: serviceType === "WATER" ? "WaterConnection[0].connectionHolders[0].relationship" : "SewerageConnections[0].connectionHolders[0].relationship", - isArray: false, + title: "WS_CONN_HOLDER_OWN_DETAIL_GENDER_LABEL", + value: wsDataDetails?.connectionHolders?.[0]?.gender, + privacy: [ + { + uuid: uuid, + fieldName: ["gender"], + model: "WnSConnectionOwner", + showValue: false, + loadData: { + serviceName: serviceType === "WATER" ? "/ws-services/wc/_search" : "/sw-services/swc/_search", + requestBody: {}, + requestParam: { tenantId, applicationNumber }, + jsonPath: + serviceType === "WATER" + ? "WaterConnection[0].connectionHolders[0].gender" + : "SewerageConnections[0].connectionHolders[0].gender", + isArray: false, + }, + }, + { + uuid: olduuid, + fieldName: ["gender"], + model: "WnSConnectionOwner", + showValue: false, + loadData: { + serviceName: serviceType === "WATER" ? "/ws-services/wc/_search" : "/sw-services/swc/_search", + requestBody: {}, + requestParam: { tenantId, applicationNumber: OldapplicationNo }, + jsonPath: + serviceType === "WATER" + ? "WaterConnection[0].connectionHolders[0].gender" + : "SewerageConnections[0].connectionHolders[0].gender", + isArray: false, + oldValue: true, + d: (res) => { + let resultString = res?.WaterConnection?.[0] + ? `${t("WS_OLD_LABEL_NAME")} ${t(res?.WaterConnection?.[0]?.connectionHolders?.[0]?.gender)}` + : `${t("WS_OLD_LABEL_NAME")} ${t(res?.SewerageConnections?.[0]?.connectionHolders?.[0]?.gender)}`; + return resultString; + }, + }, + }, + ], + oldValue: + wsDataDetails?.connectionHolders?.[0]?.gender != wsOldData?.connectionHolders?.[0]?.gender + ? [ + { + value: wsDataDetails?.connectionHolders?.[0]?.gender ? t(`${wsDataDetails?.connectionHolders?.[0]?.gender}`) : t("NA"), + className: "newValue", + style: { display: "inline" }, + }, + { + value: `${t("WS_OLD_LABEL_NAME")} ${ + wsOldData?.connectionHolders?.[0]?.gender ? t(`${wsOldData?.connectionHolders?.[0]?.gender}`) : t("NA") + }`, + style: { color: "gray", paddingLeft: "10px", display: "inline", fontSize: "13px" }, + className: "oldValue", + }, + ] + : null, }, - },{ uuid: olduuid, fieldName: ["relationship"], model: "WnSConnectionOwner",showValue: false, - loadData: { - serviceName: serviceType === "WATER" ? "/ws-services/wc/_search" : "/sw-services/swc/_search", - requestBody: {}, - requestParam: { tenantId, applicationNumber:OldapplicationNo }, - jsonPath: serviceType === "WATER" ? "WaterConnection[0].connectionHolders[0].relationship" : "SewerageConnections[0].connectionHolders[0].relationship", - isArray: false, - oldValue: true, - d: (res) => { - let resultString = (res?.WaterConnection?.[0] ? `${t("WS_OLD_LABEL_NAME")} ${t(res?.WaterConnection?.[0]?.connectionHolders?.[0]?.relationship)}` : `${t("WS_OLD_LABEL_NAME")} ${t(res?.SewerageConnections?.[0]?.connectionHolders?.[0]?.relationship)}`); - return resultString; - } - }, }], - oldValue: wsDataDetails?.connectionHolders?.[0]?.relationship != wsOldData?.connectionHolders?.[0]?.relationship ? [ - { value: `${wsDataDetails?.connectionHolders?.[0]?.relationship ? t(`${wsDataDetails?.connectionHolders?.[0]?.relationship}`) : t("NA")}`, className: "newValue", style: { display: "inline" } }, - { - value: `${`${t("WS_OLD_LABEL_NAME")} ${wsOldData?.connectionHolders?.[0]?.relationship ? t(`${wsOldData?.connectionHolders?.[0]?.relationship}`) : t("NA")}`}`, - style: { color: 'gray', paddingLeft: "10px", display: "inline", fontSize: "13px" }, className: "oldValue" - } - ] : null - }, - { - title: "WS_CORRESPONDANCE_ADDRESS_LABEL", - value: wsDataDetails?.connectionHolders?.[0]?.correspondenceAddress, - privacy: [{ - uuid: uuid, - fieldName: wsDataDetails?.connectionHolders[0]?.permanentAddress ? ["permanentAddress"] : ["correspondenceAddress"], - model: "WnSConnectionOwner", - hide: !(wsDataDetails?.connectionHolders[0]?.permanentAddress || wsDataDetails?.connectionHolders[0]?.correspondenceAddress), - showValue: false, - loadData: { - serviceName: serviceType === "WATER" ? "/ws-services/wc/_search" : "/sw-services/swc/_search", - requestBody: {}, - requestParam: { tenantId, applicationNumber }, - jsonPath: serviceType === "WATER" ? "WaterConnection[0].connectionHolders[0].correspondenceAddress" : "SewerageConnections[0].connectionHolders[0].correspondenceAddress", - isArray: false, - }, + { + title: "CORE_COMMON_MOBILE_NUMBER", + value: wsDataDetails?.connectionHolders?.[0]?.mobileNumber, + privacy: [ + { + uuid: uuid, + fieldName: ["connectionHoldersMobileNumber"], + model: "WnSConnectionOwner", + showValue: false, + loadData: { + serviceName: serviceType === "WATER" ? "/ws-services/wc/_search" : "/sw-services/swc/_search", + requestBody: {}, + requestParam: { tenantId, applicationNumber }, + jsonPath: + serviceType === "WATER" + ? "WaterConnection[0].connectionHolders[0].mobileNumber" + : "SewerageConnections[0].connectionHolders[0].mobileNumber", + isArray: false, + }, + }, + { + uuid: olduuid, + fieldName: ["connectionHoldersMobileNumber"], + model: "WnSConnectionOwner", + showValue: false, + loadData: { + serviceName: serviceType === "WATER" ? "/ws-services/wc/_search" : "/sw-services/swc/_search", + requestBody: {}, + requestParam: { tenantId, applicationNumber: OldapplicationNo }, + jsonPath: + serviceType === "WATER" + ? "WaterConnection[0].connectionHolders[0].mobileNumber" + : "SewerageConnections[0].connectionHolders[0].mobileNumber", + isArray: false, + oldValue: true, + d: (res) => { + let resultString = res?.WaterConnection?.[0] + ? `${t("WS_OLD_LABEL_NAME")} ${res?.WaterConnection?.[0]?.connectionHolders?.[0]?.mobileNumber}` + : `${t("WS_OLD_LABEL_NAME")} ${res?.SewerageConnections?.[0]?.connectionHolders?.[0]?.mobileNumber}`; + return resultString; + }, + }, + }, + ], + oldValue: + wsDataDetails?.connectionHolders?.[0]?.mobileNumber != wsOldData?.connectionHolders?.[0]?.mobileNumber + ? [ + { + value: wsDataDetails?.connectionHolders?.[0]?.mobileNumber + ? t(`${wsDataDetails?.connectionHolders?.[0]?.mobileNumber}`) + : t("NA"), + className: "newValue", + style: { display: "inline" }, + }, + { + value: `${t("WS_OLD_LABEL_NAME")} ${ + wsOldData?.connectionHolders?.[0]?.mobileNumber ? t(`${wsOldData?.connectionHolders?.[0]?.mobileNumber}`) : t("NA") + }`, + style: { color: "gray", paddingLeft: "10px", display: "inline", fontSize: "13px" }, + className: "oldValue", + }, + ] + : null, }, { - uuid: olduuid, - fieldName: wsDataDetails?.connectionHolders[0]?.permanentAddress ? ["permanentAddress"] : ["correspondenceAddress"], - model: "WnSConnectionOwner", - hide: !(wsDataDetails?.connectionHolders[0]?.permanentAddress || wsDataDetails?.connectionHolders[0]?.correspondenceAddress), - showValue: false, - loadData: { - serviceName: serviceType === "WATER" ? "/ws-services/wc/_search" : "/sw-services/swc/_search", - requestBody: {}, - requestParam: { tenantId, applicationNumber:OldapplicationNo}, - jsonPath: serviceType === "WATER" ? "WaterConnection[0].connectionHolders[0].correspondenceAddress" : "SewerageConnections[0].connectionHolders[0].correspondenceAddress", - isArray: false, - oldValue: true, - d: (res) => { - let resultString = (res?.WaterConnection?.[0] ? `${t("WS_OLD_LABEL_NAME")} ${res?.WaterConnection?.[0]?.connectionHolders?.[0]?.correspondenceAddress}` : `${t("WS_OLD_LABEL_NAME")} ${res?.SewerageConnections?.[0]?.connectionHolders?.[0]?.correspondenceAddress}`); - return resultString; - } - }, - }], - oldValue: wsDataDetails?.connectionHolders?.[0]?.correspondenceAddress != wsOldData?.connectionHolders?.[0]?.correspondenceAddress ? [ - { value: wsDataDetails?.connectionHolders?.[0]?.correspondenceAddress || t("NA"), className: "newValue", style: { display: "inline" } }, - { - value: `${t("WS_OLD_LABEL_NAME")} ${wsOldData?.connectionHolders?.[0]?.correspondenceAddress || t("NA")}`, - style: { color: 'gray', paddingLeft: "10px", display: "inline", fontSize: "13px" }, className: "oldValue" - } - ] : null - }, - { - title: "WS_OWNER_SPECIAL_CATEGORY", - value: wsDataDetails?.connectionHolders?.[0]?.ownerType ? (wsDataDetails?.connectionHolders?.[0]?.ownerType?.includes("*") ? wsDataDetails?.connectionHolders?.[0]?.ownerType : (t(`PROPERTYTAX_OWNERTYPE_${wsDataDetails?.connectionHolders?.[0]?.ownerType?.toUpperCase()}`))) : "NA", - privacy: [{ uuid: uuid, fieldName: ["ownerType"], model: "WnSConnection",showValue: false, - loadData: { - serviceName: serviceType === "WATER" ? "/ws-services/wc/_search" : "/sw-services/swc/_search", - requestBody: {}, - requestParam: { tenantId, applicationNumber }, - jsonPath: serviceType === "WATER" ? "WaterConnection[0].connectionHolders[0].ownerType" : "SewerageConnections[0].connectionHolders[0].ownerType", - isArray: false, - d: (res) => { - let resultString = (res?.WaterConnection?.[0]? t(`PROPERTYTAX_OWNERTYPE_${res?.WaterConnection?.[0]?.connectionHolders?.[0]?.ownerType?.toUpperCase()}`) : t(`PROPERTYTAX_OWNERTYPE_${res?.SewerageConnections?.[0]?.connectionHolders?.[0]?.ownerType?.toUpperCase()}`)); - return resultString; - } - }, }, - { uuid: olduuid, fieldName: ["ownerType"], model: "WnSConnection",showValue: false, - loadData: { - serviceName: serviceType === "WATER" ? "/ws-services/wc/_search" : "/sw-services/swc/_search", - requestBody: {}, - requestParam: { tenantId, applicationNumber:OldapplicationNo }, - jsonPath: serviceType === "WATER" ? "WaterConnection[0].connectionHolders[0].ownerType" : "SewerageConnections[0].connectionHolders[0].ownerType", - isArray: false, - oldValue: true, - d: (res) => { - let resultString = (res?.WaterConnection?.[0] ? `${t("WS_OLD_LABEL_NAME")} ${t(`PROPERTYTAX_OWNERTYPE_${res?.WaterConnection?.[0]?.connectionHolders?.[0]?.ownerType?.toUpperCase()}`)}` : `${t("WS_OLD_LABEL_NAME")} ${t(`PROPERTYTAX_OWNERTYPE_${res?.SewerageConnections?.[0]?.connectionHolders?.[0]?.ownerType?.toUpperCase()}`)}`); - return resultString; - } - }, }], - oldValue: wsDataDetails?.connectionHolders?.[0]?.ownerType != wsOldData?.connectionHolders?.[0]?.ownerType ? [ - { value: `${wsDataDetails?.connectionHolders?.[0]?.ownerType ? t(`${wsDataDetails?.connectionHolders?.[0]?.ownerType}`) : t("NA")}`, className: "newValue", style: { display: "inline" } }, - { - value: `${`${t("WS_OLD_LABEL_NAME")} ${wsOldData?.connectionHolders?.[0]?.ownerType ? t(`${wsOldData?.connectionHolders?.[0]?.ownerType}`) : t("NA")}`}`, - style: { color: 'gray', paddingLeft: "10px", display: "inline", fontSize: "13px" }, className: "oldValue" - } - ] : null - }, - ] - : [ - { - title: "WS_CONN_HOLDER_SAME_AS_OWNER_DETAILS", - value: t("SCORE_YES") - }], - }; - - const documentDetails = { - title: "", + title: "WS_CONN_HOLDER_COMMON_FATHER_OR_HUSBAND_NAME", + value: wsDataDetails?.connectionHolders?.[0]?.fatherOrHusbandName, + privacy: [ + { + uuid: uuid, + fieldName: ["fatherOrHusbandName"], + model: "WnSConnectionOwner", + showValue: false, + loadData: { + serviceName: serviceType === "WATER" ? "/ws-services/wc/_search" : "/sw-services/swc/_search", + requestBody: {}, + requestParam: { tenantId, applicationNumber }, + jsonPath: + serviceType === "WATER" + ? "WaterConnection[0].connectionHolders[0].fatherOrHusbandName" + : "SewerageConnections[0].connectionHolders[0].fatherOrHusbandName", + isArray: false, + }, + }, + { + uuid: olduuid, + fieldName: ["fatherOrHusbandName"], + model: "WnSConnectionOwner", + showValue: false, + loadData: { + serviceName: serviceType === "WATER" ? "/ws-services/wc/_search" : "/sw-services/swc/_search", + requestBody: {}, + requestParam: { tenantId, applicationNumber: OldapplicationNo }, + jsonPath: + serviceType === "WATER" + ? "WaterConnection[0].connectionHolders[0].fatherOrHusbandName" + : "SewerageConnections[0].connectionHolders[0].fatherOrHusbandName", + isArray: false, + oldValue: true, + d: (res) => { + let resultString = res?.WaterConnection?.[0] + ? `${t("WS_OLD_LABEL_NAME")} ${res?.WaterConnection?.[0]?.connectionHolders?.[0]?.fatherOrHusbandName}` + : `${t("WS_OLD_LABEL_NAME")} ${res?.SewerageConnections?.[0]?.connectionHolders?.[0]?.fatherOrHusbandName}`; + return resultString; + }, + }, + }, + ], + oldValue: + wsDataDetails?.connectionHolders?.[0]?.fatherOrHusbandName != wsOldData?.connectionHolders?.[0]?.fatherOrHusbandName + ? [ + { + value: `${ + wsDataDetails?.connectionHolders?.[0]?.fatherOrHusbandName + ? t(`${wsDataDetails?.connectionHolders?.[0]?.fatherOrHusbandName}`) + : t("NA") + }`, + className: "newValue", + style: { display: "inline" }, + }, + { + value: `${`${t("WS_OLD_LABEL_NAME")} ${ + wsOldData?.connectionHolders?.[0]?.fatherOrHusbandName + ? t(`${wsOldData?.connectionHolders?.[0]?.fatherOrHusbandName}`) + : t("NA") + }`}`, + style: { color: "gray", paddingLeft: "10px", display: "inline", fontSize: "13px" }, + className: "oldValue", + }, + ] + : null, + }, + { + title: "WS_CONN_HOLDER_OWN_DETAIL_RELATION_LABEL", + value: wsDataDetails?.connectionHolders?.[0]?.relationship, + privacy: [ + { + uuid: uuid, + fieldName: ["relationship"], + model: "WnSConnectionOwner", + showValue: false, + loadData: { + serviceName: serviceType === "WATER" ? "/ws-services/wc/_search" : "/sw-services/swc/_search", + requestBody: {}, + requestParam: { tenantId, applicationNumber }, + jsonPath: + serviceType === "WATER" + ? "WaterConnection[0].connectionHolders[0].relationship" + : "SewerageConnections[0].connectionHolders[0].relationship", + isArray: false, + }, + }, + { + uuid: olduuid, + fieldName: ["relationship"], + model: "WnSConnectionOwner", + showValue: false, + loadData: { + serviceName: serviceType === "WATER" ? "/ws-services/wc/_search" : "/sw-services/swc/_search", + requestBody: {}, + requestParam: { tenantId, applicationNumber: OldapplicationNo }, + jsonPath: + serviceType === "WATER" + ? "WaterConnection[0].connectionHolders[0].relationship" + : "SewerageConnections[0].connectionHolders[0].relationship", + isArray: false, + oldValue: true, + d: (res) => { + let resultString = res?.WaterConnection?.[0] + ? `${t("WS_OLD_LABEL_NAME")} ${t(res?.WaterConnection?.[0]?.connectionHolders?.[0]?.relationship)}` + : `${t("WS_OLD_LABEL_NAME")} ${t(res?.SewerageConnections?.[0]?.connectionHolders?.[0]?.relationship)}`; + return resultString; + }, + }, + }, + ], + oldValue: + wsDataDetails?.connectionHolders?.[0]?.relationship != wsOldData?.connectionHolders?.[0]?.relationship + ? [ + { + value: `${ + wsDataDetails?.connectionHolders?.[0]?.relationship + ? t(`${wsDataDetails?.connectionHolders?.[0]?.relationship}`) + : t("NA") + }`, + className: "newValue", + style: { display: "inline" }, + }, + { + value: `${`${t("WS_OLD_LABEL_NAME")} ${ + wsOldData?.connectionHolders?.[0]?.relationship ? t(`${wsOldData?.connectionHolders?.[0]?.relationship}`) : t("NA") + }`}`, + style: { color: "gray", paddingLeft: "10px", display: "inline", fontSize: "13px" }, + className: "oldValue", + }, + ] + : null, + }, + { + title: "WS_CORRESPONDANCE_ADDRESS_LABEL", + value: wsDataDetails?.connectionHolders?.[0]?.correspondenceAddress, + privacy: [ + { + uuid: uuid, + fieldName: wsDataDetails?.connectionHolders[0]?.permanentAddress ? ["permanentAddress"] : ["correspondenceAddress"], + model: "WnSConnectionOwner", + hide: !(wsDataDetails?.connectionHolders[0]?.permanentAddress || wsDataDetails?.connectionHolders[0]?.correspondenceAddress), + showValue: false, + loadData: { + serviceName: serviceType === "WATER" ? "/ws-services/wc/_search" : "/sw-services/swc/_search", + requestBody: {}, + requestParam: { tenantId, applicationNumber }, + jsonPath: + serviceType === "WATER" + ? "WaterConnection[0].connectionHolders[0].correspondenceAddress" + : "SewerageConnections[0].connectionHolders[0].correspondenceAddress", + isArray: false, + }, + }, + { + uuid: olduuid, + fieldName: wsDataDetails?.connectionHolders[0]?.permanentAddress ? ["permanentAddress"] : ["correspondenceAddress"], + model: "WnSConnectionOwner", + hide: !(wsDataDetails?.connectionHolders[0]?.permanentAddress || wsDataDetails?.connectionHolders[0]?.correspondenceAddress), + showValue: false, + loadData: { + serviceName: serviceType === "WATER" ? "/ws-services/wc/_search" : "/sw-services/swc/_search", + requestBody: {}, + requestParam: { tenantId, applicationNumber: OldapplicationNo }, + jsonPath: + serviceType === "WATER" + ? "WaterConnection[0].connectionHolders[0].correspondenceAddress" + : "SewerageConnections[0].connectionHolders[0].correspondenceAddress", + isArray: false, + oldValue: true, + d: (res) => { + let resultString = res?.WaterConnection?.[0] + ? `${t("WS_OLD_LABEL_NAME")} ${res?.WaterConnection?.[0]?.connectionHolders?.[0]?.correspondenceAddress}` + : `${t("WS_OLD_LABEL_NAME")} ${res?.SewerageConnections?.[0]?.connectionHolders?.[0]?.correspondenceAddress}`; + return resultString; + }, + }, + }, + ], + oldValue: + wsDataDetails?.connectionHolders?.[0]?.correspondenceAddress != wsOldData?.connectionHolders?.[0]?.correspondenceAddress + ? [ + { + value: wsDataDetails?.connectionHolders?.[0]?.correspondenceAddress || t("NA"), + className: "newValue", + style: { display: "inline" }, + }, + { + value: `${t("WS_OLD_LABEL_NAME")} ${wsOldData?.connectionHolders?.[0]?.correspondenceAddress || t("NA")}`, + style: { color: "gray", paddingLeft: "10px", display: "inline", fontSize: "13px" }, + className: "oldValue", + }, + ] + : null, + }, + { + title: "WS_OWNER_SPECIAL_CATEGORY", + value: wsDataDetails?.connectionHolders?.[0]?.ownerType + ? wsDataDetails?.connectionHolders?.[0]?.ownerType?.includes("*") + ? wsDataDetails?.connectionHolders?.[0]?.ownerType + : t(`PROPERTYTAX_OWNERTYPE_${wsDataDetails?.connectionHolders?.[0]?.ownerType?.toUpperCase()}`) + : "NA", + privacy: [ + { + uuid: uuid, + fieldName: ["ownerType"], + model: "WnSConnection", + showValue: false, + loadData: { + serviceName: serviceType === "WATER" ? "/ws-services/wc/_search" : "/sw-services/swc/_search", + requestBody: {}, + requestParam: { tenantId, applicationNumber }, + jsonPath: + serviceType === "WATER" + ? "WaterConnection[0].connectionHolders[0].ownerType" + : "SewerageConnections[0].connectionHolders[0].ownerType", + isArray: false, + d: (res) => { + let resultString = res?.WaterConnection?.[0] + ? t(`PROPERTYTAX_OWNERTYPE_${res?.WaterConnection?.[0]?.connectionHolders?.[0]?.ownerType?.toUpperCase()}`) + : t(`PROPERTYTAX_OWNERTYPE_${res?.SewerageConnections?.[0]?.connectionHolders?.[0]?.ownerType?.toUpperCase()}`); + return resultString; + }, + }, + }, + { + uuid: olduuid, + fieldName: ["ownerType"], + model: "WnSConnection", + showValue: false, + loadData: { + serviceName: serviceType === "WATER" ? "/ws-services/wc/_search" : "/sw-services/swc/_search", + requestBody: {}, + requestParam: { tenantId, applicationNumber: OldapplicationNo }, + jsonPath: + serviceType === "WATER" + ? "WaterConnection[0].connectionHolders[0].ownerType" + : "SewerageConnections[0].connectionHolders[0].ownerType", + isArray: false, + oldValue: true, + d: (res) => { + let resultString = res?.WaterConnection?.[0] + ? `${t("WS_OLD_LABEL_NAME")} ${t( + `PROPERTYTAX_OWNERTYPE_${res?.WaterConnection?.[0]?.connectionHolders?.[0]?.ownerType?.toUpperCase()}` + )}` + : `${t("WS_OLD_LABEL_NAME")} ${t( + `PROPERTYTAX_OWNERTYPE_${res?.SewerageConnections?.[0]?.connectionHolders?.[0]?.ownerType?.toUpperCase()}` + )}`; + return resultString; + }, + }, + }, + ], + oldValue: + wsDataDetails?.connectionHolders?.[0]?.ownerType != wsOldData?.connectionHolders?.[0]?.ownerType + ? [ + { + value: `${ + wsDataDetails?.connectionHolders?.[0]?.ownerType ? t(`${wsDataDetails?.connectionHolders?.[0]?.ownerType}`) : t("NA") + }`, + className: "newValue", + style: { display: "inline" }, + }, + { + value: `${`${t("WS_OLD_LABEL_NAME")} ${ + wsOldData?.connectionHolders?.[0]?.ownerType ? t(`${wsOldData?.connectionHolders?.[0]?.ownerType}`) : t("NA") + }`}`, + style: { color: "gray", paddingLeft: "10px", display: "inline", fontSize: "13px" }, + className: "oldValue", + }, + ] + : null, + }, + ] + : [ + { + title: "WS_CONN_HOLDER_SAME_AS_OWNER_DETAILS", + value: t("SCORE_YES"), + }, + ], + }; + + const documentDetails = { + title: "", asSectionHeader: true, additionalDetails: { documents: [ @@ -1018,228 +1376,344 @@ export const WSSearch = { const connectionDetails = { title: "WS_COMMON_CONNECTION_DETAIL", asSectionHeader: true, - values: serviceType == "WATER" - ? [ - { - title: "WS_SERV_DETAIL_CONN_TYPE", - value: wsDataDetails?.connectionType - ? t(`WS_SERVICES_MASTERS_WATERSOURCE_${stringReplaceAll(wsDataDetails?.connectionType?.toUpperCase(), " ", "_")}`) - : t("NA"), - oldValue: wsDataDetails?.connectionType != wsOldData?.connectionType ? [ + values: + serviceType == "WATER" + ? [ { + title: "WS_SERV_DETAIL_CONN_TYPE", value: wsDataDetails?.connectionType ? t(`WS_SERVICES_MASTERS_WATERSOURCE_${stringReplaceAll(wsDataDetails?.connectionType?.toUpperCase(), " ", "_")}`) - : t("NA"), className: "newValue", style: { display: "inline" } + : t("NA"), + oldValue: + wsDataDetails?.connectionType != wsOldData?.connectionType + ? [ + { + value: wsDataDetails?.connectionType + ? t(`WS_SERVICES_MASTERS_WATERSOURCE_${stringReplaceAll(wsDataDetails?.connectionType?.toUpperCase(), " ", "_")}`) + : t("NA"), + className: "newValue", + style: { display: "inline" }, + }, + { + value: `${t("WS_OLD_LABEL_NAME")} ${ + wsOldData?.connectionType + ? t(`WS_SERVICES_MASTERS_WATERSOURCE_${stringReplaceAll(wsOldData?.connectionType?.toUpperCase(), " ", "_")}`) + : t("NA") + }`, + style: { color: "gray", paddingLeft: "10px", display: "inline", fontSize: "13px" }, + className: "oldValue", + }, + ] + : null, }, { - value: `${t("WS_OLD_LABEL_NAME")} ${wsOldData?.connectionType - ? t(`WS_SERVICES_MASTERS_WATERSOURCE_${stringReplaceAll(wsOldData?.connectionType?.toUpperCase(), " ", "_")}`) - : t("NA")}`, - style: { color: 'gray', paddingLeft: "10px", display: "inline", fontSize: "13px" }, className: "oldValue" - } - ] : null - }, - { - title: "WS_SERV_DETAIL_NO_OF_TAPS", - value: wsDataDetails?.noOfTaps || t("NA"), - oldValue: wsDataDetails?.noOfTaps != wsOldData?.noOfTaps ? [ - { value: wsDataDetails?.noOfTaps || t("NA"), className: "newValue", style: { display: "inline" } }, - { - value: `${t("WS_OLD_LABEL_NAME")} ${wsOldData?.noOfTaps || t("NA")}`, - style: { color: 'gray', paddingLeft: "10px", display: "inline", fontSize: "13px" }, className: "oldValue" - } - ] : null - }, - { - title: "WS_SERV_DETAIL_WATER_SOURCE", - value: wsDataDetails?.waterSource - ? t(`WS_SERVICES_MASTERS_WATERSOURCE_${wsDataDetails?.waterSource?.toUpperCase()?.split(".")[0]}`) - : t("NA"), - oldValue: wsDataDetails?.waterSource != wsOldData?.waterSource ? [ + title: "WS_SERV_DETAIL_NO_OF_TAPS", + value: wsDataDetails?.noOfTaps || t("NA"), + oldValue: + wsDataDetails?.noOfTaps != wsOldData?.noOfTaps + ? [ + { value: wsDataDetails?.noOfTaps || t("NA"), className: "newValue", style: { display: "inline" } }, + { + value: `${t("WS_OLD_LABEL_NAME")} ${wsOldData?.noOfTaps || t("NA")}`, + style: { color: "gray", paddingLeft: "10px", display: "inline", fontSize: "13px" }, + className: "oldValue", + }, + ] + : null, + }, { + title: "WS_SERV_DETAIL_WATER_SOURCE", value: wsDataDetails?.waterSource ? t(`WS_SERVICES_MASTERS_WATERSOURCE_${wsDataDetails?.waterSource?.toUpperCase()?.split(".")[0]}`) - : t("NA"), className: "newValue", style: { display: "inline" } + : t("NA"), + oldValue: + wsDataDetails?.waterSource != wsOldData?.waterSource + ? [ + { + value: wsDataDetails?.waterSource + ? t(`WS_SERVICES_MASTERS_WATERSOURCE_${wsDataDetails?.waterSource?.toUpperCase()?.split(".")[0]}`) + : t("NA"), + className: "newValue", + style: { display: "inline" }, + }, + { + value: `${t("WS_OLD_LABEL_NAME")} ${ + wsOldData?.waterSource + ? t(`WS_SERVICES_MASTERS_WATERSOURCE_${wsOldData?.waterSource?.toUpperCase()?.split(".")[0]}`) + : t("NA") + }`, + style: { color: "gray", paddingLeft: "10px", display: "inline", fontSize: "13px" }, + className: "oldValue", + }, + ] + : null, }, { - value: `${t("WS_OLD_LABEL_NAME")} ${wsOldData?.waterSource - ? t(`WS_SERVICES_MASTERS_WATERSOURCE_${wsOldData?.waterSource?.toUpperCase()?.split(".")[0]}`) - : t("NA")}`, - style: { color: 'gray', paddingLeft: "10px", display: "inline", fontSize: "13px" }, className: "oldValue" - } - ] : null - }, - { - title: "WS_PIPE_SIZE_IN_INCHES_LABEL", - value: wsDataDetails?.pipeSize || t("NA"), - oldValue: wsDataDetails?.pipeSize != wsOldData?.pipeSize ? [ - { value: wsDataDetails?.pipeSize || t("NA"), className: "newValue", style: { display: "inline" } }, - { - value: `${t("WS_OLD_LABEL_NAME")} ${wsOldData?.pipeSize || t("NA")}`, - style: { color: 'gray', paddingLeft: "10px", display: "inline", fontSize: "13px" }, className: "oldValue" - } - ] : null - }, - { - title: "WS_SERV_DETAIL_WATER_SUB_SOURCE", - value: wsDataDetails?.waterSource ? t(`${wsDataDetails?.waterSource?.toUpperCase()?.split(".")[1]}`) : t("NA"), - oldValue: wsDataDetails?.waterSource != wsOldData?.waterSource ? [ - { value: wsDataDetails?.waterSource ? t(`${wsDataDetails?.waterSource?.toUpperCase()?.split(".")[1]}`) : t("NA"), className: "newValue", style: { display: "inline" } }, + title: "WS_PIPE_SIZE_IN_INCHES_LABEL", + value: wsDataDetails?.pipeSize || t("NA"), + oldValue: + wsDataDetails?.pipeSize != wsOldData?.pipeSize + ? [ + { value: wsDataDetails?.pipeSize || t("NA"), className: "newValue", style: { display: "inline" } }, + { + value: `${t("WS_OLD_LABEL_NAME")} ${wsOldData?.pipeSize || t("NA")}`, + style: { color: "gray", paddingLeft: "10px", display: "inline", fontSize: "13px" }, + className: "oldValue", + }, + ] + : null, + }, { - value: `${t("WS_OLD_LABEL_NAME")} ${wsOldData?.waterSource ? t(`${wsOldData?.waterSource?.toUpperCase()?.split(".")[1]}`) : t("NA")}`, - style: { color: 'gray', paddingLeft: "10px", display: "inline", fontSize: "13px" }, className: "oldValue" - } - ] : null - }, - ] - : [ - { - title: "WS_SERV_DETAIL_CONN_TYPE", - value: wsDataDetails?.connectionType - ? t(`WS_SERVICES_MASTERS_WATERSOURCE_${stringReplaceAll(wsDataDetails?.connectionType?.toUpperCase(), " ", "_")}`) - : t("NA"), - oldValue: wsDataDetails?.connectionType != wsOldData?.connectionType ? [ + title: "WS_SERV_DETAIL_WATER_SUB_SOURCE", + value: wsDataDetails?.waterSource ? t(`${wsDataDetails?.waterSource?.toUpperCase()?.split(".")[1]}`) : t("NA"), + oldValue: + wsDataDetails?.waterSource != wsOldData?.waterSource + ? [ + { + value: wsDataDetails?.waterSource ? t(`${wsDataDetails?.waterSource?.toUpperCase()?.split(".")[1]}`) : t("NA"), + className: "newValue", + style: { display: "inline" }, + }, + { + value: `${t("WS_OLD_LABEL_NAME")} ${ + wsOldData?.waterSource ? t(`${wsOldData?.waterSource?.toUpperCase()?.split(".")[1]}`) : t("NA") + }`, + style: { color: "gray", paddingLeft: "10px", display: "inline", fontSize: "13px" }, + className: "oldValue", + }, + ] + : null, + }, + ] + : [ { + title: "WS_SERV_DETAIL_CONN_TYPE", value: wsDataDetails?.connectionType ? t(`WS_SERVICES_MASTERS_WATERSOURCE_${stringReplaceAll(wsDataDetails?.connectionType?.toUpperCase(), " ", "_")}`) - : t("NA"), className: "newValue", style: { display: "inline" } + : t("NA"), + oldValue: + wsDataDetails?.connectionType != wsOldData?.connectionType + ? [ + { + value: wsDataDetails?.connectionType + ? t(`WS_SERVICES_MASTERS_WATERSOURCE_${stringReplaceAll(wsDataDetails?.connectionType?.toUpperCase(), " ", "_")}`) + : t("NA"), + className: "newValue", + style: { display: "inline" }, + }, + { + value: `${t("WS_OLD_LABEL_NAME")} ${ + wsOldData?.connectionType + ? t(`WS_SERVICES_MASTERS_WATERSOURCE_${stringReplaceAll(wsOldData?.connectionType?.toUpperCase(), " ", "_")}`) + : t("NA") + }`, + style: { color: "gray", paddingLeft: "10px", display: "inline", fontSize: "13px" }, + className: "oldValue", + }, + ] + : null, }, { - value: `${t("WS_OLD_LABEL_NAME")} ${wsOldData?.connectionType - ? t(`WS_SERVICES_MASTERS_WATERSOURCE_${stringReplaceAll(wsOldData?.connectionType?.toUpperCase(), " ", "_")}`) - : t("NA")}`, - style: { color: 'gray', paddingLeft: "10px", display: "inline", fontSize: "13px" }, className: "oldValue" - } - ] : null - }, - { - title: "WS_NUMBER_WATER_CLOSETS_LABEL", - value: wsDataDetails?.noOfWaterClosets || t("NA"), - oldValue: wsDataDetails?.noOfWaterClosets != wsOldData?.noOfWaterClosets ? [ - { - value: wsDataDetails?.noOfWaterClosets || t("NA"), className: "newValue", style: { display: "inline" } + title: "WS_NUMBER_WATER_CLOSETS_LABEL", + value: wsDataDetails?.noOfWaterClosets || t("NA"), + oldValue: + wsDataDetails?.noOfWaterClosets != wsOldData?.noOfWaterClosets + ? [ + { + value: wsDataDetails?.noOfWaterClosets || t("NA"), + className: "newValue", + style: { display: "inline" }, + }, + { + value: `${t("WS_OLD_LABEL_NAME")} ${wsOldData?.noOfWaterClosets || t("NA")}`, + style: { color: "gray", paddingLeft: "10px", display: "inline", fontSize: "13px" }, + className: "oldValue", + }, + ] + : null, }, { - value: `${t("WS_OLD_LABEL_NAME")} ${wsOldData?.noOfWaterClosets || t("NA")}`, - style: { color: 'gray', paddingLeft: "10px", display: "inline", fontSize: "13px" }, className: "oldValue" - } - ] : null - }, - { - title: "WS_SERV_DETAIL_NO_OF_TOILETS", - value: wsDataDetails?.noOfToilets || t("NA"), - oldValue: wsDataDetails?.noOfToilets != wsOldData?.noOfToilets ? [ - { - value: wsDataDetails?.noOfToilets || t("NA"), className: "newValue", style: { display: "inline" } + title: "WS_SERV_DETAIL_NO_OF_TOILETS", + value: wsDataDetails?.noOfToilets || t("NA"), + oldValue: + wsDataDetails?.noOfToilets != wsOldData?.noOfToilets + ? [ + { + value: wsDataDetails?.noOfToilets || t("NA"), + className: "newValue", + style: { display: "inline" }, + }, + { + value: `${t("WS_OLD_LABEL_NAME")} ${wsOldData?.noOfToilets || t("NA")}`, + style: { color: "gray", paddingLeft: "10px", display: "inline", fontSize: "13px" }, + className: "oldValue", + }, + ] + : null, }, - { - value: `${t("WS_OLD_LABEL_NAME")} ${wsOldData?.noOfToilets || t("NA")}`, - style: { color: 'gray', paddingLeft: "10px", display: "inline", fontSize: "13px" }, className: "oldValue" - } - ] : null - }, - ], + ], }; const activationDetails = { title: "WS_ACTIVATION_DETAILS", asSectionHeader: true, - values: wsDataDetails?.connectionType == "Metered" - ? [ - { - title: "WS_SERV_DETAIL_METER_ID", - value: wsDataDetails?.meterId || t("NA"), - oldValue: wsDataDetails?.meterId != wsOldData?.meterId ? [ - { - value: wsDataDetails?.meterId || t("NA"), className: "newValue", style: { display: "inline" } - }, - { - value: `${t("WS_OLD_LABEL_NAME")} ${wsOldData?.meterId || t("NA")}`, - style: { color: 'gray', paddingLeft: "10px", display: "inline", fontSize: "13px" }, className: "oldValue" - } - ] : null - }, - { - title: "WS_INITIAL_METER_READING_LABEL", - value: wsDataDetails?.additionalDetails?.initialMeterReading || t("NA"), - oldValue: wsDataDetails?.additionalDetails?.initialMeterReading != wsOldData?.additionalDetails?.initialMeterReading ? [ - { - value: wsDataDetails?.additionalDetails?.initialMeterReading || t("NA"), className: "newValue", style: { display: "inline" } - }, - { - value: `${t("WS_OLD_LABEL_NAME")} ${wsOldData?.additionalDetails?.initialMeterReading || t("NA")}`, - style: { color: 'gray', paddingLeft: "10px", display: "inline", fontSize: "13px" }, className: "oldValue" - } - ] : null - }, - { - title: "WS_INSTALLATION_DATE_LABEL", - value: wsDataDetails?.meterInstallationDate ? convertEpochToDate(wsDataDetails?.meterInstallationDate) : t("NA"), - oldValue: wsDataDetails?.meterInstallationDate != wsOldData?.meterInstallationDate ? [ + values: + wsDataDetails?.connectionType == "Metered" + ? [ { - value: wsDataDetails?.meterInstallationDate ? convertEpochToDate(wsDataDetails?.meterInstallationDate) : t("NA"), className: "newValue", style: { display: "inline" } + title: "WS_SERV_DETAIL_METER_ID", + value: wsDataDetails?.meterId || t("NA"), + oldValue: + wsDataDetails?.meterId != wsOldData?.meterId + ? [ + { + value: wsDataDetails?.meterId || t("NA"), + className: "newValue", + style: { display: "inline" }, + }, + { + value: `${t("WS_OLD_LABEL_NAME")} ${wsOldData?.meterId || t("NA")}`, + style: { color: "gray", paddingLeft: "10px", display: "inline", fontSize: "13px" }, + className: "oldValue", + }, + ] + : null, }, { - value: `${t("WS_OLD_LABEL_NAME")} ${wsOldData?.meterInstallationDate ? convertEpochToDate(wsOldData?.meterInstallationDate) : t("NA")}`, - style: { color: 'gray', paddingLeft: "10px", display: "inline", fontSize: "13px" }, className: "oldValue" - } - ] : null - }, - { - title: "WS_SERV_DETAIL_CONN_EXECUTION_DATE", - value: wsDataDetails?.connectionExecutionDate ? convertEpochToDate(wsDataDetails?.connectionExecutionDate) : t("NA"), - oldValue: wsDataDetails?.connectionExecutionDate != wsOldData?.connectionExecutionDate ? [ - { - value: wsDataDetails?.connectionExecutionDate ? convertEpochToDate(wsDataDetails?.connectionExecutionDate) : t("NA"), className: "newValue", style: { display: "inline" } + title: "WS_INITIAL_METER_READING_LABEL", + value: wsDataDetails?.additionalDetails?.initialMeterReading || t("NA"), + oldValue: + wsDataDetails?.additionalDetails?.initialMeterReading != wsOldData?.additionalDetails?.initialMeterReading + ? [ + { + value: wsDataDetails?.additionalDetails?.initialMeterReading || t("NA"), + className: "newValue", + style: { display: "inline" }, + }, + { + value: `${t("WS_OLD_LABEL_NAME")} ${wsOldData?.additionalDetails?.initialMeterReading || t("NA")}`, + style: { color: "gray", paddingLeft: "10px", display: "inline", fontSize: "13px" }, + className: "oldValue", + }, + ] + : null, }, { - value: `${t("WS_OLD_LABEL_NAME")} ${wsOldData?.connectionExecutionDate ? convertEpochToDate(wsOldData?.connectionExecutionDate) : t("NA")}`, - style: { color: 'gray', paddingLeft: "10px", display: "inline", fontSize: "13px" }, className: "oldValue" - } - ] : null - }, - ...(wsDataDetails?.dateEffectiveFrom ? [{ - title: "WS_MODIFICATIONS_EFFECTIVE_FROM", - value: wsDataDetails?.dateEffectiveFrom ? convertEpochToDate(wsDataDetails?.dateEffectiveFrom) : t("NA"), - oldValue: wsDataDetails?.dateEffectiveFrom != wsOldData?.dateEffectiveFrom ? [ - { - value: wsDataDetails?.dateEffectiveFrom ? convertEpochToDate(wsDataDetails?.dateEffectiveFrom) : t("NA"), className: "newValue", style: { display: "inline" } + title: "WS_INSTALLATION_DATE_LABEL", + value: wsDataDetails?.meterInstallationDate ? convertEpochToDate(wsDataDetails?.meterInstallationDate) : t("NA"), + oldValue: + wsDataDetails?.meterInstallationDate != wsOldData?.meterInstallationDate + ? [ + { + value: wsDataDetails?.meterInstallationDate ? convertEpochToDate(wsDataDetails?.meterInstallationDate) : t("NA"), + className: "newValue", + style: { display: "inline" }, + }, + { + value: `${t("WS_OLD_LABEL_NAME")} ${ + wsOldData?.meterInstallationDate ? convertEpochToDate(wsOldData?.meterInstallationDate) : t("NA") + }`, + style: { color: "gray", paddingLeft: "10px", display: "inline", fontSize: "13px" }, + className: "oldValue", + }, + ] + : null, }, { - value: `${t("WS_OLD_LABEL_NAME")} ${wsOldData?.dateEffectiveFrom ? convertEpochToDate(wsOldData?.dateEffectiveFrom) : t("NA")}`, - style: { color: 'gray', paddingLeft: "10px", display: "inline", fontSize: "13px" }, className: "oldValue" - } - ] : null - }] : []), - ] - : [ - { - title: "WS_SERV_DETAIL_CONN_EXECUTION_DATE", - value: wsDataDetails?.connectionExecutionDate ? convertEpochToDate(wsDataDetails?.connectionExecutionDate) : t("NA"), - oldValue: wsDataDetails?.connectionExecutionDate != wsOldData?.connectionExecutionDate ? [ - { - value: wsDataDetails?.connectionExecutionDate ? convertEpochToDate(wsDataDetails?.connectionExecutionDate) : t("NA"), className: "newValue", style: { display: "inline" } + title: "WS_SERV_DETAIL_CONN_EXECUTION_DATE", + value: wsDataDetails?.connectionExecutionDate ? convertEpochToDate(wsDataDetails?.connectionExecutionDate) : t("NA"), + oldValue: + wsDataDetails?.connectionExecutionDate != wsOldData?.connectionExecutionDate + ? [ + { + value: wsDataDetails?.connectionExecutionDate ? convertEpochToDate(wsDataDetails?.connectionExecutionDate) : t("NA"), + className: "newValue", + style: { display: "inline" }, + }, + { + value: `${t("WS_OLD_LABEL_NAME")} ${ + wsOldData?.connectionExecutionDate ? convertEpochToDate(wsOldData?.connectionExecutionDate) : t("NA") + }`, + style: { color: "gray", paddingLeft: "10px", display: "inline", fontSize: "13px" }, + className: "oldValue", + }, + ] + : null, }, + ...(wsDataDetails?.dateEffectiveFrom + ? [ + { + title: "WS_MODIFICATIONS_EFFECTIVE_FROM", + value: wsDataDetails?.dateEffectiveFrom ? convertEpochToDate(wsDataDetails?.dateEffectiveFrom) : t("NA"), + oldValue: + wsDataDetails?.dateEffectiveFrom != wsOldData?.dateEffectiveFrom + ? [ + { + value: wsDataDetails?.dateEffectiveFrom ? convertEpochToDate(wsDataDetails?.dateEffectiveFrom) : t("NA"), + className: "newValue", + style: { display: "inline" }, + }, + { + value: `${t("WS_OLD_LABEL_NAME")} ${ + wsOldData?.dateEffectiveFrom ? convertEpochToDate(wsOldData?.dateEffectiveFrom) : t("NA") + }`, + style: { color: "gray", paddingLeft: "10px", display: "inline", fontSize: "13px" }, + className: "oldValue", + }, + ] + : null, + }, + ] + : []), + ] + : [ { - value: `${t("WS_OLD_LABEL_NAME")} ${wsOldData?.connectionExecutionDate ? convertEpochToDate(wsOldData?.connectionExecutionDate) : t("NA")}`, - style: { color: 'gray', paddingLeft: "10px", display: "inline", fontSize: "13px" }, className: "oldValue" - } - ] : null - }, - ...(wsDataDetails?.dateEffectiveFrom ? [{ - title: "WS_MODIFICATIONS_EFFECTIVE_FROM", - value: wsDataDetails?.dateEffectiveFrom ? convertEpochToDate(wsDataDetails?.dateEffectiveFrom) : t("NA"), - oldValue: wsDataDetails?.dateEffectiveFrom != wsOldData?.dateEffectiveFrom ? [ - { - value: wsDataDetails?.dateEffectiveFrom ? convertEpochToDate(wsDataDetails?.dateEffectiveFrom) : t("NA"), className: "newValue", style: { display: "inline" } + title: "WS_SERV_DETAIL_CONN_EXECUTION_DATE", + value: wsDataDetails?.connectionExecutionDate ? convertEpochToDate(wsDataDetails?.connectionExecutionDate) : t("NA"), + oldValue: + wsDataDetails?.connectionExecutionDate != wsOldData?.connectionExecutionDate + ? [ + { + value: wsDataDetails?.connectionExecutionDate ? convertEpochToDate(wsDataDetails?.connectionExecutionDate) : t("NA"), + className: "newValue", + style: { display: "inline" }, + }, + { + value: `${t("WS_OLD_LABEL_NAME")} ${ + wsOldData?.connectionExecutionDate ? convertEpochToDate(wsOldData?.connectionExecutionDate) : t("NA") + }`, + style: { color: "gray", paddingLeft: "10px", display: "inline", fontSize: "13px" }, + className: "oldValue", + }, + ] + : null, }, - { - value: `${t("WS_OLD_LABEL_NAME")} ${wsOldData?.dateEffectiveFrom ? convertEpochToDate(wsOldData?.dateEffectiveFrom) : t("NA")}`, - style: { color: 'gray', paddingLeft: "10px", display: "inline", fontSize: "13px" }, className: "oldValue" - } - ] : null - }] : []) - ] + ...(wsDataDetails?.dateEffectiveFrom + ? [ + { + title: "WS_MODIFICATIONS_EFFECTIVE_FROM", + value: wsDataDetails?.dateEffectiveFrom ? convertEpochToDate(wsDataDetails?.dateEffectiveFrom) : t("NA"), + oldValue: + wsDataDetails?.dateEffectiveFrom != wsOldData?.dateEffectiveFrom + ? [ + { + value: wsDataDetails?.dateEffectiveFrom ? convertEpochToDate(wsDataDetails?.dateEffectiveFrom) : t("NA"), + className: "newValue", + style: { display: "inline" }, + }, + { + value: `${t("WS_OLD_LABEL_NAME")} ${ + wsOldData?.dateEffectiveFrom ? convertEpochToDate(wsOldData?.dateEffectiveFrom) : t("NA") + }`, + style: { color: "gray", paddingLeft: "10px", display: "inline", fontSize: "13px" }, + className: "oldValue", + }, + ] + : null, + }, + ] + : []), + ], }; let details = []; @@ -1249,7 +1723,16 @@ export const WSSearch = { isLabelShow: true, additionalDetails: { isLabelShow: true }, }; - details = [...details, isLabelShow, applicationHeaderDetails, propertyDetails, connectionHolderDetails, connectionDetails, activationDetails, documentDetails]; + details = [ + ...details, + isLabelShow, + applicationHeaderDetails, + propertyDetails, + connectionHolderDetails, + connectionDetails, + activationDetails, + documentDetails, + ]; wsDataDetails.serviceType = serviceDataType; return { @@ -1260,58 +1743,62 @@ export const WSSearch = { applicationStatus: wsDataDetails?.applicationStatus, propertyDetails: propertyDataDetails, processInstancesDetails: workFlowDataDetails?.ProcessInstances, - oldApplication: wsOldData + oldApplication: wsOldData, }; }, - applicationDetailsBillAmendment: async (t, tenantId, applicationNumber, serviceType = "WATER", config = {}, businessService="WS.AMENDMENT") => { + applicationDetailsBillAmendment: async (t, tenantId, applicationNumber, serviceType = "WATER", config = {}, businessService = "WS.AMENDMENT") => { businessService = serviceType === "WATER" ? "WS.AMENDMENT" : "SW.AMENDMENT"; - const businessServiceWf = await WorkflowService.init(tenantId,businessService) - - let billAmendSearchService="WS"; - if(serviceType!="WATER"){ - billAmendSearchService="SW" + const businessServiceWf = await WorkflowService.init(tenantId, businessService); + + let billAmendSearchService = "WS"; + if (serviceType != "WATER") { + billAmendSearchService = "SW"; } - const billAmendmentSearch = await WSSearch.searchAmendment(tenantId, applicationNumber,billAmendSearchService) + const billAmendmentSearch = await WSSearch.searchAmendment(tenantId, applicationNumber, billAmendSearchService); const filtersForWSSearch = { connectionNumber: billAmendmentSearch.Amendments[0].consumerCode, searchType: "CONNECTION", billAmendSearchService, - isPropertyDetailsRequired: true - } + isPropertyDetailsRequired: true, + }; - let propertyids = "", consumercodes = "", businessIds = ""; + let propertyids = "", + consumercodes = "", + businessIds = ""; const response = await WSSearch.application(tenantId, filtersForWSSearch, serviceType); - - const wsData = cloneDeep(response?.WaterConnection || response?.SewerageConnections) + + const wsData = cloneDeep(response?.WaterConnection || response?.SewerageConnections); const filters = { applicationNumber: wsData?.[0]?.applicationNo }; - wsData?.forEach(item => { - propertyids = propertyids + item?.propertyId + (","); + wsData?.forEach((item) => { + propertyids = propertyids + item?.propertyId + ","; consumercodes = consumercodes + item?.applicationNo + ","; }); - let propertyfilter = { propertyIds: propertyids.substring(0, propertyids.length - 1), } + let propertyfilter = { propertyIds: propertyids.substring(0, propertyids.length - 1) }; if (propertyids !== "" && filters?.locality) propertyfilter.locality = filters?.locality; - config = { enabled: propertyids !== "" ? true : false } + config = { enabled: propertyids !== "" ? true : false }; const properties = await WSSearch.property(tenantId, propertyfilter); - const {Demands: BillDemandDetails} = await PaymentService.demandSearch(tenantId, filtersForWSSearch?.connectionNumber, billAmendSearchService) - const billServiceTaxHeadMaster = await MdmsService.getWSTaxHeadMaster(tenantId, "WS") - const billServiceTaxHeadMasterForBillAmendment = billServiceTaxHeadMaster?.BillingService?.TaxHeadMaster?.filter(w=>w.IsBillamend) - const actualFieldsAndAmountOfBillDetails = BillDemandDetails?.[0]?.demandDetails.filter( e => billServiceTaxHeadMasterForBillAmendment.find(taxHeadMaster => taxHeadMaster.code === e.taxHeadMasterCode)) + const { Demands: BillDemandDetails } = await PaymentService.demandSearch(tenantId, filtersForWSSearch?.connectionNumber, billAmendSearchService); + const billServiceTaxHeadMaster = await MdmsService.getWSTaxHeadMaster(tenantId, "WS"); + const billServiceTaxHeadMasterForBillAmendment = billServiceTaxHeadMaster?.BillingService?.TaxHeadMaster?.filter((w) => w.IsBillamend); + const actualFieldsAndAmountOfBillDetails = BillDemandDetails?.[0]?.demandDetails.filter((e) => + billServiceTaxHeadMasterForBillAmendment.find((taxHeadMaster) => taxHeadMaster.code === e.taxHeadMasterCode) + ); const billData = await WSSearch.searchBills(tenantId, consumercodes); if (filters?.applicationNumber) businessIds = filters?.applicationNumber; - + const workflowDetails = await WSSearch.workflowDataDetails(tenantId, applicationNumber); - + const wsDataDetails = cloneDeep(response?.WaterConnection?.[0] || response?.SewerageConnections?.[0]); const propertyDataDetails = cloneDeep(properties?.Properties?.[0]); const billDetails = cloneDeep(billData); @@ -1321,60 +1808,59 @@ export const WSSearch = { const applicationHeaderDetails = { title: " ", asSectionHeader: true, - values: [ - { title: "PDF_STATIC_LABEL_CONSUMER_NUMBER_LABEL", value: wsDataDetails?.connectionNo || t("NA") }, - ] + values: [{ title: "PDF_STATIC_LABEL_CONSUMER_NUMBER_LABEL", value: wsDataDetails?.connectionNo || t("NA") }], }; const propertyDetails = { title: "WS_AMOUNT_DETAILS", asSectionHeader: true, - values: [...actualFieldsAndAmountOfBillDetails.map( e => ({ - title: e?.taxHeadMasterCode, value: `₹ ${e?.taxAmount}` - })), { title: "WS_REVISED_DEMAND", value: `₹ ${Math.round(actualFieldsAndAmountOfBillDetails.reduce((acc, curr) => curr.taxAmount + acc, 0))}` }] + values: [ + ...actualFieldsAndAmountOfBillDetails.map((e) => ({ + title: e?.taxHeadMasterCode, + value: `₹ ${e?.taxAmount}`, + })), + { title: "WS_REVISED_DEMAND", value: `₹ ${Math.round(actualFieldsAndAmountOfBillDetails.reduce((acc, curr) => curr.taxAmount + acc, 0))}` }, + ], }; - + const tableData = billAmendmentSearch?.Amendments?.[0]?.additionalDetails?.searchBillDetails; const action = tableData?.action; - const tableHeader = ["WS_TAX_HEAD","WS_CURRENT_DEMAND",`WS_${action}_HEAD`,"WS_REVISED_DEMAND"] - const tableRows = [] - const taxHeads = Object.keys(tableData?.actionPerformed) - const actionPerformed = tableData?.actionPerformed - const originalDemand = tableData?.originalDemand - const getTaxHeadAmount = (obj,taxHead) => { - return parseInt(obj[taxHead] ? obj[taxHead] : 0) - } - - let sumCurrent=0; - let sumApplied=0; - let sumRevised=0; - taxHeads.map(taxHead => { - const currentDemand = getTaxHeadAmount(originalDemand, taxHead) - const appliedDemand = getTaxHeadAmount(actionPerformed, taxHead) - const revisedDemand = action==="REBATE"?currentDemand-appliedDemand:currentDemand+appliedDemand - sumCurrent += currentDemand - sumApplied += appliedDemand - sumRevised += revisedDemand - tableRows.push([taxHead,`₹${currentDemand}`,`₹${appliedDemand}`,`₹${revisedDemand}`]) - }) - tableRows.push(["WS_TOTAL_DUE",`₹${sumCurrent}`,`₹${sumApplied}`,`₹${sumRevised}`]) - + const tableHeader = ["WS_TAX_HEAD", "WS_CURRENT_DEMAND", `WS_${action}_HEAD`, "WS_REVISED_DEMAND"]; + const tableRows = []; + const taxHeads = Object.keys(tableData?.actionPerformed); + const actionPerformed = tableData?.actionPerformed; + const originalDemand = tableData?.originalDemand; + const getTaxHeadAmount = (obj, taxHead) => { + return parseInt(obj[taxHead] ? obj[taxHead] : 0); + }; + + let sumCurrent = 0; + let sumApplied = 0; + let sumRevised = 0; + taxHeads.map((taxHead) => { + const currentDemand = getTaxHeadAmount(originalDemand, taxHead); + const appliedDemand = getTaxHeadAmount(actionPerformed, taxHead); + const revisedDemand = action === "REBATE" ? currentDemand - appliedDemand : currentDemand + appliedDemand; + sumCurrent += currentDemand; + sumApplied += appliedDemand; + sumRevised += revisedDemand; + tableRows.push([taxHead, `₹${currentDemand}`, `₹${appliedDemand}`, `₹${revisedDemand}`]); + }); + tableRows.push(["WS_TOTAL_DUE", `₹${sumCurrent}`, `₹${sumApplied}`, `₹${sumRevised}`]); + const tableDetails = { title: "WS_AMOUNT_DETAILS", asSectionHeader: true, - isTable:true, - headers:tableHeader, + isTable: true, + headers: tableHeader, action, - tableRows - } + tableRows, + }; - function getReasonDocNoHeader(amendmentReason){ - if(amendmentReason === "COURT_CASE_SETTLEMENT") - return "WS_COURT_ORDER_NO"; - else if(amendmentReason === "ARREAR_WRITE_OFF" || amendmentReason === "ONE_TIME_SETTLEMENT") - return "WS_GOVERNMENT_NOTIFICATION_NUMBER"; - else - return "WS_DOCUMENT_NO"; + function getReasonDocNoHeader(amendmentReason) { + if (amendmentReason === "COURT_CASE_SETTLEMENT") return "WS_COURT_ORDER_NO"; + else if (amendmentReason === "ARREAR_WRITE_OFF" || amendmentReason === "ONE_TIME_SETTLEMENT") return "WS_GOVERNMENT_NOTIFICATION_NUMBER"; + else return "WS_DOCUMENT_NO"; } let connectionHolderDetails = { @@ -1382,41 +1868,48 @@ export const WSSearch = { asSectionHeader: true, values: [ { title: "WS_DEMAND_REVISION_BASIS", value: billAmendmentSearch?.Amendments?.[0]?.amendmentReason }, - { title: getReasonDocNoHeader(billAmendmentSearch?.Amendments?.[0]?.amendmentReason), value: billAmendmentSearch?.Amendments?.[0]?.reasonDocumentNumber }, + { + title: getReasonDocNoHeader(billAmendmentSearch?.Amendments?.[0]?.amendmentReason), + value: billAmendmentSearch?.Amendments?.[0]?.reasonDocumentNumber, + }, { title: "WS_COMMON_FROM_DATE_LABEL", value: Digit.DateUtils.ConvertTimestampToDate(billAmendmentSearch?.Amendments?.[0]?.effectiveFrom) }, - {...billAmendmentSearch?.Amendments?.[0]?.amendmentReason !== "COURT_CASE_SETTLEMENT" && { title: "WS_COMMON_TO_DATE_LABEL", value: Digit.DateUtils.ConvertTimestampToDate(billAmendmentSearch?.Amendments?.[0]?.effectiveTill) }}, - ]?.filter((ob) => JSON.stringify(ob) !== "{}") + { + ...(billAmendmentSearch?.Amendments?.[0]?.amendmentReason !== "COURT_CASE_SETTLEMENT" && { + title: "WS_COMMON_TO_DATE_LABEL", + value: Digit.DateUtils.ConvertTimestampToDate(billAmendmentSearch?.Amendments?.[0]?.effectiveTill), + }), + }, + ]?.filter((ob) => JSON.stringify(ob) !== "{}"), }; const documentDetails = { title: "", asSectionHeader: true, additionalDetails: { - documents: [{ - title: "BILL_AMEND_DOCS_UPLOADED", - BS:'BillAmend', - values: billAmendmentSearch.Amendments[0]?.documents?.map((document) => { - return { - title: `WS_${document?.documentType}`, - documentType: document?.documentType, - documentUid: document?.documentUid, - fileStoreId: document?.fileStoreId, - }; - }), - }, - ] - } + documents: [ + { + title: "BILL_AMEND_DOCS_UPLOADED", + BS: "BillAmend", + values: billAmendmentSearch.Amendments[0]?.documents?.map((document) => { + return { + title: `WS_${document?.documentType}`, + documentType: document?.documentType, + documentUid: document?.documentUid, + fileStoreId: document?.fileStoreId, + }; + }), + }, + ], + }, }; - const details = [applicationHeaderDetails, tableDetails , connectionHolderDetails, documentDetails] + const details = [applicationHeaderDetails, tableDetails, connectionHolderDetails, documentDetails]; wsDataDetails.serviceType = serviceDataType; - if (billAmendmentSearch?.Amendments?.[0]) { - wsDataDetails.billAmendmentDetails = billAmendmentSearch.Amendments[0] - wsDataDetails.isBillAmend = true + wsDataDetails.billAmendmentDetails = billAmendmentSearch.Amendments[0]; + wsDataDetails.isBillAmend = true; } - return { applicationData: wsDataDetails, applicationDetails: details, @@ -1426,14 +1919,11 @@ export const WSSearch = { propertyDetails: propertyDataDetails, billDetails: billDetails?.Bill, processInstancesDetails: workFlowDataDetails?.ProcessInstances, - amendment: billAmendmentSearch.Amendments[0], - businessServiceWf + amendment: billAmendmentSearch.Amendments[0], + businessServiceWf, }; }, - applicationDetailsBillAmendmentv2: async() => { - - } - , + applicationDetailsBillAmendmentv2: async () => {}, connectionDetails: async (t, tenantId, connectionNumber, serviceType = "WATER", config = {}) => { const filters = { connectionNumber, searchType: "CONNECTION" }; @@ -1460,32 +1950,35 @@ export const WSSearch = { const wsResponseForWorkflow = await WSSearch.application(tenantId, { connectionNumber }, serviceType); - const wsResponseForWorkflowData = cloneDeep(serviceType == "WATER" ? wsResponseForWorkflow?.WaterConnection : wsResponseForWorkflow?.SewerageConnections); - + const wsResponseForWorkflowData = cloneDeep( + serviceType == "WATER" ? wsResponseForWorkflow?.WaterConnection : wsResponseForWorkflow?.SewerageConnections + ); + const noOfConnections = cloneDeep(wsResponseForWorkflowData); let isDisconnectionDone = false; if (noOfConnections?.length > 0) { - const data = noOfConnections?.filter(data => data?.applicationStatus == "DISCONNECTION_EXECUTED" && data?.applicationType.includes("DISCONNECT")); + const data = noOfConnections?.filter( + (data) => data?.applicationStatus == "DISCONNECTION_EXECUTED" && data?.applicationType.includes("DISCONNECT") + ); if (data?.length) isDisconnectionDone = true; } - + wsResponseForWorkflowData?.forEach((item) => { - item?.applicationNo && businessIds.push(item?.applicationNo); + item?.applicationNo && businessIds.push(item?.applicationNo); }); const workflowDetails = await WSSearch.workflowDataDetails(tenantId, businessIds.join(",")); const wsDataDetails = cloneDeep(serviceType == "WATER" ? response?.WaterConnection?.[0] : response?.SewerageConnections?.[0]); - + const propertyDataDetails = cloneDeep(properties?.Properties?.[0]); const workFlowDataDetails = cloneDeep(workflowDetails); const serviceDataType = cloneDeep(serviceType); const serviceTypeOfData = serviceType == "WATER" ? "WS" : "SW"; const collectionNumber = wsDataDetails?.connectionNo; - const colletionOFData = await WSSearch.colletionData({tenantId, serviceTypeOfData, collectionNumber}, {}); - const fetchBills = await WSSearch.fetchBillData({ tenantId, serviceTypeOfData, collectionNumber}); - + const colletionOFData = await WSSearch.colletionData({ tenantId, serviceTypeOfData, collectionNumber }, {}); + const fetchBills = await WSSearch.fetchBillData({ tenantId, serviceTypeOfData, collectionNumber }); const applicationHeaderDetails = { title: "WS_COMMON_SERV_DETAIL", @@ -1494,7 +1987,10 @@ export const WSSearch = { serviceType == "WATER" ? [ { title: "PDF_STATIC_LABEL_CONSUMER_NUMBER_LABEL", value: wsDataDetails?.connectionNo || t("NA") }, - { title: "WS_SERVICE_NAME_LABEL", value: t(`WS_APPLICATION_TYPE_${wsDataDetails?.applicationType? wsDataDetails?.applicationType : wsDataDetails?.serviceType}`) }, + { + title: "WS_SERVICE_NAME_LABEL", + value: t(`WS_APPLICATION_TYPE_${wsDataDetails?.applicationType ? wsDataDetails?.applicationType : wsDataDetails?.serviceType}`), + }, { title: "WS_SERV_DETAIL_CONN_TYPE", value: wsDataDetails?.connectionType @@ -1525,14 +2021,21 @@ export const WSSearch = { { title: "WS_INITIAL_METER_READING_LABEL", value: wsDataDetails?.additionalDetails?.initialMeterReading || t("NA") }, { title: "WS_VIEW_CONSUMPTION_DETAIL", - to: `/digit-ui/employee/ws/consumption-details?applicationNo=${wsDataDetails?.connectionNo}&tenantId=${wsDataDetails?.tenantId}&service=${serviceType}&from=${window.location.href.includes("bill-details") ? "ABG_BILL_DETAILS_HEADER" : "WS_COMMON_CONNECTION_DETAIL"}`, + to: `/mgramseva-digit-ui/employee/ws/consumption-details?applicationNo=${wsDataDetails?.connectionNo}&tenantId=${ + wsDataDetails?.tenantId + }&service=${serviceType}&from=${ + window.location.href.includes("bill-details") ? "ABG_BILL_DETAILS_HEADER" : "WS_COMMON_CONNECTION_DETAIL" + }`, value: "", - isLink: wsDataDetails?.connectionType ==="Metered" ? true:false, + isLink: wsDataDetails?.connectionType === "Metered" ? true : false, }, ] : [ { title: "PDF_STATIC_LABEL_CONSUMER_NUMBER_LABEL", value: wsDataDetails?.connectionNo || t("NA") }, - { title: "WS_SERVICE_NAME_LABEL", value: t(`WS_APPLICATION_TYPE_${wsDataDetails?.applicationType? wsDataDetails?.applicationType : wsDataDetails?.serviceType}`) }, + { + title: "WS_SERVICE_NAME_LABEL", + value: t(`WS_APPLICATION_TYPE_${wsDataDetails?.applicationType ? wsDataDetails?.applicationType : wsDataDetails?.serviceType}`), + }, { title: "WS_NUMBER_WATER_CLOSETS_LABEL", value: wsDataDetails?.noOfWaterClosets || t("NA") }, { title: "WS_SERV_DETAIL_NO_OF_TOILETS", value: wsDataDetails?.noOfToilets || t("NA") }, { @@ -1547,36 +2050,44 @@ export const WSSearch = { asSectionHeader: true, values: [ { title: "WS_PROPERTY_ID_LABEL", value: propertyDataDetails?.propertyId }, - { title: "WS_COMMON_OWNER_NAME_LABEL", + { + title: "WS_COMMON_OWNER_NAME_LABEL", value: getOwnerNames(propertyDataDetails), privacy: { - uuid: propertyDataDetails?.owners?.[0]?.uuid, - fieldName: "name", - model: "User" - } + uuid: propertyDataDetails?.owners?.[0]?.uuid, + fieldName: "name", + model: "User", + }, }, - { title: "WS_PROPERTY_ADDRESS_LABEL", + { + title: "WS_PROPERTY_ADDRESS_LABEL", value: getAddress(propertyDataDetails?.address, t), privacy: { - uuid: propertyDataDetails?.owners?.[0]?.uuid, - fieldName: ["doorNo" , "street" , "landmark"], - model: "Property",showValue: true, + uuid: propertyDataDetails?.owners?.[0]?.uuid, + fieldName: ["doorNo", "street", "landmark"], + model: "Property", + showValue: true, loadData: { serviceName: "/property-services/property/_search", requestBody: {}, - requestParam: { tenantId, propertyIds : propertyids }, + requestParam: { tenantId, propertyIds: propertyids }, jsonPath: "Properties[0].address.street", isArray: false, d: (res) => { - let resultString = (_.get(res,"Properties[0].address.doorNo") ? `${_.get(res,"Properties[0].address.doorNo")}, ` : "") + (_.get(res,"Properties[0].address.street")? `${_.get(res,"Properties[0].address.street")}, ` : "") + (_.get(res,"Properties[0].address.landmark") ? `${_.get(res,"Properties[0].address.landmark")}`:"") + let resultString = + (_.get(res, "Properties[0].address.doorNo") ? `${_.get(res, "Properties[0].address.doorNo")}, ` : "") + + (_.get(res, "Properties[0].address.street") ? `${_.get(res, "Properties[0].address.street")}, ` : "") + + (_.get(res, "Properties[0].address.landmark") ? `${_.get(res, "Properties[0].address.landmark")}` : ""); return resultString; - } - } - } + }, + }, + }, }, { title: "WS_VIEW_PROPERTY_DETAIL", - to: `/digit-ui/employee/pt/property-details/${propertyDataDetails?.propertyId}?from=${window.location.href.includes("bill-details") ? "ABG_BILL_DETAILS_HEADER" : "WS_COMMON_CONNECTION_DETAIL"}`, + to: `/mgramseva-digit-ui/employee/pt/property-details/${propertyDataDetails?.propertyId}?from=${ + window.location.href.includes("bill-details") ? "ABG_BILL_DETAILS_HEADER" : "WS_COMMON_CONNECTION_DETAIL" + }`, value: "", isLink: true, }, @@ -1589,115 +2100,150 @@ export const WSSearch = { values: wsDataDetails?.connectionHolders != null && wsDataDetails?.connectionHolders.length > 0 ? [ - { - title: "WS_OWN_DETAIL_NAME", + { + title: "WS_OWN_DETAIL_NAME", value: wsDataDetails?.connectionHolders?.[0]?.name || t("NA"), privacy: { - uuid: wsDataDetails?.connectionHolders?.[0]?.uuid, - fieldName: "name", - model: "WnSConnectionOwner" - } + uuid: wsDataDetails?.connectionHolders?.[0]?.uuid, + fieldName: "name", + model: "WnSConnectionOwner", + }, }, - { - title: "WS_CONN_HOLDER_OWN_DETAIL_GENDER_LABEL", + { + title: "WS_CONN_HOLDER_OWN_DETAIL_GENDER_LABEL", value: wsDataDetails?.connectionHolders?.[0]?.gender, - privacy: { - uuid: wsDataDetails?.connectionHolders?.[0]?.uuid, - fieldName: "gender", - model: "WnSConnectionOwner",showValue: false, + privacy: { + uuid: wsDataDetails?.connectionHolders?.[0]?.uuid, + fieldName: "gender", + model: "WnSConnectionOwner", + showValue: false, loadData: { serviceName: serviceType === "WATER" ? "/ws-services/wc/_search" : "/sw-services/swc/_search", requestBody: {}, requestParam: { tenantId, connectionNumber, searchType: "CONNECTION" }, - jsonPath: serviceType === "WATER" ? "WaterConnection[0].connectionHolders[0].gender" : "SewerageConnections[0].connectionHolders[0].gender", + jsonPath: + serviceType === "WATER" + ? "WaterConnection[0].connectionHolders[0].gender" + : "SewerageConnections[0].connectionHolders[0].gender", isArray: false, }, - } + }, }, - { - title: "CORE_COMMON_MOBILE_NUMBER", + { + title: "CORE_COMMON_MOBILE_NUMBER", value: wsDataDetails?.connectionHolders?.[0]?.mobileNumber, - privacy: { - uuid: wsDataDetails?.connectionHolders?.[0]?.uuid, - fieldName: "connectionHoldersMobileNumber", - model: "WnSConnectionOwner",showValue: false, + privacy: { + uuid: wsDataDetails?.connectionHolders?.[0]?.uuid, + fieldName: "connectionHoldersMobileNumber", + model: "WnSConnectionOwner", + showValue: false, loadData: { serviceName: serviceType === "WATER" ? "/ws-services/wc/_search" : "/sw-services/swc/_search", requestBody: {}, requestParam: { tenantId, connectionNumber, searchType: "CONNECTION" }, - jsonPath: serviceType === "WATER" ? "WaterConnection[0].connectionHolders[0].mobileNumber" : "SewerageConnections[0].connectionHolders[0].mobileNumber", + jsonPath: + serviceType === "WATER" + ? "WaterConnection[0].connectionHolders[0].mobileNumber" + : "SewerageConnections[0].connectionHolders[0].mobileNumber", isArray: false, }, - } + }, }, - { - title: "WS_CONN_HOLDER_COMMON_FATHER_OR_HUSBAND_NAME", + { + title: "WS_CONN_HOLDER_COMMON_FATHER_OR_HUSBAND_NAME", value: wsDataDetails?.connectionHolders?.[0]?.fatherOrHusbandName, - privacy: { - uuid: wsDataDetails?.connectionHolders?.[0]?.uuid, - fieldName: "fatherOrHusbandName", - model: "WnSConnectionOwner",showValue: false, + privacy: { + uuid: wsDataDetails?.connectionHolders?.[0]?.uuid, + fieldName: "fatherOrHusbandName", + model: "WnSConnectionOwner", + showValue: false, loadData: { serviceName: serviceType === "WATER" ? "/ws-services/wc/_search" : "/sw-services/swc/_search", requestBody: {}, requestParam: { tenantId, connectionNumber, searchType: "CONNECTION" }, - jsonPath: serviceType === "WATER" ? "WaterConnection[0].connectionHolders[0].fatherOrHusbandName" : "SewerageConnections[0].connectionHolders[0].fatherOrHusbandName", + jsonPath: + serviceType === "WATER" + ? "WaterConnection[0].connectionHolders[0].fatherOrHusbandName" + : "SewerageConnections[0].connectionHolders[0].fatherOrHusbandName", isArray: false, }, - } + }, }, - { title: "WS_CONN_HOLDER_OWN_DETAIL_RELATION_LABEL", value: wsDataDetails?.connectionHolders?.[0]?.relationship, - privacy: { - uuid: wsDataDetails?.connectionHolders?.[0]?.uuid, - fieldName: ["relationship"], - model: "WnSConnection",showValue: false, + { + title: "WS_CONN_HOLDER_OWN_DETAIL_RELATION_LABEL", + value: wsDataDetails?.connectionHolders?.[0]?.relationship, + privacy: { + uuid: wsDataDetails?.connectionHolders?.[0]?.uuid, + fieldName: ["relationship"], + model: "WnSConnection", + showValue: false, loadData: { serviceName: serviceType === "WATER" ? "/ws-services/wc/_search" : "/sw-services/swc/_search", requestBody: {}, requestParam: { tenantId, connectionNumber, searchType: "CONNECTION" }, - jsonPath: serviceType === "WATER" ? "WaterConnection[0].connectionHolders[0].relationship" : "SewerageConnections[0].connectionHolders[0].relationship", + jsonPath: + serviceType === "WATER" + ? "WaterConnection[0].connectionHolders[0].relationship" + : "SewerageConnections[0].connectionHolders[0].relationship", isArray: false, }, - } + }, }, - { - title: "WS_CORRESPONDANCE_ADDRESS_LABEL", + { + title: "WS_CORRESPONDANCE_ADDRESS_LABEL", value: wsDataDetails?.connectionHolders?.[0]?.correspondenceAddress, - privacy: { - uuid: wsDataDetails?.connectionHolders?.[0]?.uuid, - fieldName: "correspondenceAddress", - model: "WnSConnectionOwner",showValue: false, + privacy: { + uuid: wsDataDetails?.connectionHolders?.[0]?.uuid, + fieldName: "correspondenceAddress", + model: "WnSConnectionOwner", + showValue: false, loadData: { serviceName: serviceType === "WATER" ? "/ws-services/wc/_search" : "/sw-services/swc/_search", requestBody: {}, requestParam: { tenantId, connectionNumber, searchType: "CONNECTION" }, - jsonPath: serviceType === "WATER" ? "WaterConnection[0].connectionHolders[0].correspondenceAddress" : "SewerageConnections[0].connectionHolders[0].correspondenceAddress", + jsonPath: + serviceType === "WATER" + ? "WaterConnection[0].connectionHolders[0].correspondenceAddress" + : "SewerageConnections[0].connectionHolders[0].correspondenceAddress", isArray: false, }, - } - }, - { title: "WS_OWNER_SPECIAL_CATEGORY", value: wsDataDetails?.connectionHolders?.[0]?.ownerType ? !(wsDataDetails?.connectionHolders?.[0]?.ownerType?.includes("*")) ? `PROPERTYTAX_OWNERTYPE_${wsDataDetails?.connectionHolders?.[0]?.ownerType?.toUpperCase()}` : wsDataDetails?.connectionHolders?.[0]?.ownerType : "NA", - privacy: { - uuid: wsDataDetails?.connectionHolders?.[0]?.uuid, - fieldName: ["ownerType"], - model: "WnSConnection",showValue: false, - loadData: { - serviceName: serviceType === "WATER" ? "/ws-services/wc/_search" : "/sw-services/swc/_search", - requestBody: {}, - requestParam: { tenantId, connectionNumber, searchType: "CONNECTION" }, - jsonPath: serviceType === "WATER" ? "WaterConnection[0].connectionHolders[0].ownerType" : "SewerageConnections[0].connectionHolders[0].ownerType", - isArray: false, - d: (res) => { - let resultString = (res?.WaterConnection?.[0] ? t(`PROPERTYTAX_OWNERTYPE_${res?.WaterConnection?.[0]?.connectionHolders?.[0]?.ownerType?.toUpperCase()}`) : t(`PROPERTYTAX_OWNERTYPE_${res?.SewerageConnections?.[0]?.connectionHolders?.[0]?.ownerType?.toUpperCase()}`)); - return resultString; - } - }, - } } + }, + }, + { + title: "WS_OWNER_SPECIAL_CATEGORY", + value: wsDataDetails?.connectionHolders?.[0]?.ownerType + ? !wsDataDetails?.connectionHolders?.[0]?.ownerType?.includes("*") + ? `PROPERTYTAX_OWNERTYPE_${wsDataDetails?.connectionHolders?.[0]?.ownerType?.toUpperCase()}` + : wsDataDetails?.connectionHolders?.[0]?.ownerType + : "NA", + privacy: { + uuid: wsDataDetails?.connectionHolders?.[0]?.uuid, + fieldName: ["ownerType"], + model: "WnSConnection", + showValue: false, + loadData: { + serviceName: serviceType === "WATER" ? "/ws-services/wc/_search" : "/sw-services/swc/_search", + requestBody: {}, + requestParam: { tenantId, connectionNumber, searchType: "CONNECTION" }, + jsonPath: + serviceType === "WATER" + ? "WaterConnection[0].connectionHolders[0].ownerType" + : "SewerageConnections[0].connectionHolders[0].ownerType", + isArray: false, + d: (res) => { + let resultString = res?.WaterConnection?.[0] + ? t(`PROPERTYTAX_OWNERTYPE_${res?.WaterConnection?.[0]?.connectionHolders?.[0]?.ownerType?.toUpperCase()}`) + : t(`PROPERTYTAX_OWNERTYPE_${res?.SewerageConnections?.[0]?.connectionHolders?.[0]?.ownerType?.toUpperCase()}`); + return resultString; + }, + }, + }, + }, ] : [{ title: "WS_CONN_HOLDER_SAME_AS_OWNER_DETAILS", value: t("SCORE_YES") }], }; - const isApplicationApproved = workFlowDataDetails?.ProcessInstances?.[0]?.state.isTerminateState + const isApplicationApproved = workFlowDataDetails?.ProcessInstances?.[0]?.state.isTerminateState; const isLabelShow = { title: "", asSectionHeader: true, @@ -1720,37 +2266,42 @@ export const WSSearch = { colletionOfData: colletionOFData?.Payments, fetchBillsData: fetchBills?.Bill, isApplicationApproved: isApplicationApproved, - isDisconnectionDone: isDisconnectionDone + isDisconnectionDone: isDisconnectionDone, }; }, disConnectionDetails: async (t, tenantId, applicationNumber, serviceType = "WATER", config = {}) => { const filters = { applicationNumber }; - let propertyids = "", consumercodes = "", businessIds = ""; + let propertyids = "", + consumercodes = "", + businessIds = ""; const response = await WSSearch.application(tenantId, filters, serviceType); const appSessionDetails = sessionStorage.getItem("WS_SESSION_APPLICATION_DETAILS"); const wsApplicationDetails = appSessionDetails ? JSON.parse(appSessionDetails) : ""; if ( - response?.WaterConnection?.[0] && + response?.WaterConnection?.[0] && wsApplicationDetails?.applicationType && wsApplicationDetails?.applicationNo == response?.WaterConnection?.[0]?.applicationNo - ) { + ) { response.WaterConnection[0] = wsApplicationDetails; } if ( - response?.SewerageConnections?.[0] && - wsApplicationDetails?.applicationType && + response?.SewerageConnections?.[0] && + wsApplicationDetails?.applicationType && wsApplicationDetails?.applicationNo == response?.SewerageConnections?.[0]?.applicationNo - ) { + ) { response.SewerageConnections[0] = wsApplicationDetails; } const wsData = cloneDeep(serviceType == "WATER" ? response?.WaterConnection : response?.SewerageConnections); - wsData?.forEach((item) => { propertyids = propertyids + item?.propertyId + ","; consumercodes = consumercodes + item?.applicationNo + ","; }); + wsData?.forEach((item) => { + propertyids = propertyids + item?.propertyId + ","; + consumercodes = consumercodes + item?.applicationNo + ","; + }); let propertyfilter = { propertyIds: propertyids.substring(0, propertyids.length - 1) }; @@ -1779,21 +2330,31 @@ export const WSSearch = { if (wsApplicationType.includes("DISCONNECT") && wsDataDetails?.isDisconnectionTemporary) applicationType = "WS_DISCONNECTIONTYPE_TEMPORARY"; else applicationType = "WS_DISCONNECTIONTYPE_PERMANENT"; - const applicationHeaderDetails = { title: " ", asSectionHeader: true, - values: - [ - { title: "PDF_STATIC_LABEL_APPLICATION_NUMBER_LABEL", value: wsDataDetails?.applicationNo || t("NA") }, - { title: "PDF_STATIC_LABEL_CONSUMER_NUMBER_LABEL", value: wsDataDetails?.connectionNo || t("NA") }, - { title: "WS_SERVICE_NAME_LABEL", value: t(`WS_APPLICATION_TYPE_${wsDataDetails?.applicationType? wsDataDetails?.applicationType : wsDataDetails?.serviceType}`) }, - { title: "PDF_STATIC_LABEL_WS_CONSOLIDATED_ACKNOWELDGMENT_DISCONNECTION_TYPE", value: t(`${applicationType}`) }, - { title: "WNS_COMMON_TABLE_COL_AMT_DUE_LABEL", value: fetchBillData.Bill[0]?.totalAmount ? "₹ " + fetchBillData.Bill[0]?.totalAmount : "₹ 0" }, - { title: "WS_DISCONNECTION_PROPOSED_DATE", value: wsDataDetails?.dateEffectiveFrom ? convertEpochToDate(wsDataDetails?.dateEffectiveFrom) : t("NA") }, - { title: "WS_DISCONNECTION_EXECUTED_DATE", value: wsDataDetails?.disconnectionExecutionDate ? convertEpochToDate(wsDataDetails?.disconnectionExecutionDate) : t("NA") }, - { title: "WS_DISCONNECTION_REASON", value: wsDataDetails?.disconnectionReason || t("NA") }, - ] + values: [ + { title: "PDF_STATIC_LABEL_APPLICATION_NUMBER_LABEL", value: wsDataDetails?.applicationNo || t("NA") }, + { title: "PDF_STATIC_LABEL_CONSUMER_NUMBER_LABEL", value: wsDataDetails?.connectionNo || t("NA") }, + { + title: "WS_SERVICE_NAME_LABEL", + value: t(`WS_APPLICATION_TYPE_${wsDataDetails?.applicationType ? wsDataDetails?.applicationType : wsDataDetails?.serviceType}`), + }, + { title: "PDF_STATIC_LABEL_WS_CONSOLIDATED_ACKNOWELDGMENT_DISCONNECTION_TYPE", value: t(`${applicationType}`) }, + { + title: "WNS_COMMON_TABLE_COL_AMT_DUE_LABEL", + value: fetchBillData.Bill[0]?.totalAmount ? "₹ " + fetchBillData.Bill[0]?.totalAmount : "₹ 0", + }, + { + title: "WS_DISCONNECTION_PROPOSED_DATE", + value: wsDataDetails?.dateEffectiveFrom ? convertEpochToDate(wsDataDetails?.dateEffectiveFrom) : t("NA"), + }, + { + title: "WS_DISCONNECTION_EXECUTED_DATE", + value: wsDataDetails?.disconnectionExecutionDate ? convertEpochToDate(wsDataDetails?.disconnectionExecutionDate) : t("NA"), + }, + { title: "WS_DISCONNECTION_REASON", value: wsDataDetails?.disconnectionReason || t("NA") }, + ], }; const propertyDetails = { @@ -1802,28 +2363,35 @@ export const WSSearch = { values: [ { title: "WS_PROPERTY_ID_LABEL", value: propertyDataDetails?.propertyId }, { title: "WS_COMMON_OWNER_NAME_LABEL", value: getOwnerNames(propertyDataDetails) }, - { title: "WS_PROPERTY_ADDRESS_LABEL", value: getAddress(propertyDataDetails?.address, t), - privacy: { - uuid: propertyDataDetails?.owners?.[0]?.uuid, - fieldName: ["doorNo" , "street" , "landmark"], - model: "Property",showValue: true, - loadData: { - serviceName: "/property-services/property/_search", - requestBody: {}, - requestParam: { tenantId, propertyIds : propertyids }, - jsonPath: "Properties[0].address.street", - isArray: false, - d: (res) => { - let resultString = (_.get(res,"Properties[0].address.doorNo") ? `${_.get(res,"Properties[0].address.doorNo")}, ` : "") + (_.get(res,"Properties[0].address.street")? `${_.get(res,"Properties[0].address.street")}, ` : "") + (_.get(res,"Properties[0].address.landmark") ? `${_.get(res,"Properties[0].address.landmark")}`:"") - return resultString; - } - } - } }, + { + title: "WS_PROPERTY_ADDRESS_LABEL", + value: getAddress(propertyDataDetails?.address, t), + privacy: { + uuid: propertyDataDetails?.owners?.[0]?.uuid, + fieldName: ["doorNo", "street", "landmark"], + model: "Property", + showValue: true, + loadData: { + serviceName: "/property-services/property/_search", + requestBody: {}, + requestParam: { tenantId, propertyIds: propertyids }, + jsonPath: "Properties[0].address.street", + isArray: false, + d: (res) => { + let resultString = + (_.get(res, "Properties[0].address.doorNo") ? `${_.get(res, "Properties[0].address.doorNo")}, ` : "") + + (_.get(res, "Properties[0].address.street") ? `${_.get(res, "Properties[0].address.street")}, ` : "") + + (_.get(res, "Properties[0].address.landmark") ? `${_.get(res, "Properties[0].address.landmark")}` : ""); + return resultString; + }, + }, + }, + }, ], additionalDetails: { redirectUrl: { title: t("WS_VIEW_PROPERTY_DETAILS"), - url: `/digit-ui/employee/pt/property-details/${propertyDataDetails?.propertyId}?from=WS_APPLICATION_DETAILS_HEADER`, + url: `/mgramseva-digit-ui/employee/pt/property-details/${propertyDataDetails?.propertyId}?from=WS_APPLICATION_DETAILS_HEADER`, }, }, }; @@ -1834,80 +2402,147 @@ export const WSSearch = { values: wsDataDetails?.connectionHolders?.length > 0 ? [ - { title: "WS_OWN_DETAIL_NAME", value: wsDataDetails?.connectionHolders?.[0]?.name || t("NA"), - privacy: { - uuid: wsDataDetails?.connectionHolders?.[0]?.uuid, - fieldName: ["name"], - model: "WnSConnectionOwner", - } }, - { title: "WS_CONN_HOLDER_OWN_DETAIL_GENDER_LABEL", value: wsDataDetails?.connectionHolders?.[0]?.gender , - privacy: { - uuid: wsDataDetails?.connectionHolders?.[0]?.uuid, - fieldName: ["gender"], - model: "WnSConnectionOwner",showValue: false, - loadData: { - serviceName: serviceType === "WATER" ? "/ws-services/wc/_search" : "/sw-services/swc/_search", - requestBody: {}, - requestParam: { tenantId, applicationNumber }, - jsonPath: serviceType === "WATER" ? "WaterConnection[0].connectionHolders[0].gender" : "SewerageConnections[0].connectionHolders[0].gender", - isArray: false, + { + title: "WS_OWN_DETAIL_NAME", + value: wsDataDetails?.connectionHolders?.[0]?.name || t("NA"), + privacy: { + uuid: wsDataDetails?.connectionHolders?.[0]?.uuid, + fieldName: ["name"], + model: "WnSConnectionOwner", + }, }, - } }, - { title: "CORE_COMMON_MOBILE_NUMBER", value: wsDataDetails?.connectionHolders?.[0]?.mobileNumber, - privacy: { uuid: wsDataDetails?.connectionHolders?.[0]?.uuid, fieldName: ["connectionHoldersMobileNumber"], model: "WnSConnectionOwner",showValue: false, - loadData: { - serviceName: serviceType === "WATER" ? "/ws-services/wc/_search" : "/sw-services/swc/_search", - requestBody: {}, - requestParam: { tenantId, applicationNumber }, - jsonPath: serviceType === "WATER" ? "WaterConnection[0].connectionHolders[0].mobileNumber" : "SewerageConnections[0].connectionHolders[0].mobileNumber", - isArray: false, - }, } }, - { title: "WS_CONN_HOLDER_COMMON_FATHER_OR_HUSBAND_NAME", value: wsDataDetails?.connectionHolders?.[0]?.fatherOrHusbandName, - privacy: { uuid: wsDataDetails?.connectionHolders?.[0]?.uuid, fieldName: ["fatherOrHusbandName"], model: "WnSConnectionOwner",showValue: false, - loadData: { - serviceName: serviceType === "WATER" ? "/ws-services/wc/_search" : "/sw-services/swc/_search", - requestBody: {}, - requestParam: { tenantId, applicationNumber }, - jsonPath: serviceType === "WATER" ? "WaterConnection[0].connectionHolders[0].fatherOrHusbandName" : "SewerageConnections[0].connectionHolders[0].fatherOrHusbandName", - isArray: false, - }, } }, - { title: "WS_CONN_HOLDER_OWN_DETAIL_RELATION_LABEL", value: wsDataDetails?.connectionHolders?.[0]?.relationship, - privacy: { uuid: wsDataDetails?.connectionHolders?.[0]?.uuid, fieldName: ["relationship"], model: "WnSConnection",showValue: false, - loadData: { - serviceName: serviceType === "WATER" ? "/ws-services/wc/_search" : "/sw-services/swc/_search", - requestBody: {}, - requestParam: { tenantId, applicationNumber }, - jsonPath: serviceType === "WATER" ? "WaterConnection[0].connectionHolders[0].relationship" : "SewerageConnections[0].connectionHolders[0].relationship", - isArray: false, - }, }, }, - { title: "WS_CORRESPONDANCE_ADDRESS_LABEL", value: wsDataDetails?.connectionHolders?.[0]?.correspondenceAddress, - privacy: { - uuid: wsDataDetails?.connectionHolders?.[0]?.uuid, - fieldName: wsDataDetails?.connectionHolders[0]?.permanentAddress ? ["permanentAddress"] : ["correspondenceAddress"], - model: "WnSConnectionOwner", - hide: !(wsDataDetails?.connectionHolders[0]?.permanentAddress || wsDataDetails?.connectionHolders[0]?.correspondenceAddress),showValue: false, - loadData: { - serviceName: serviceType === "WATER" ? "/ws-services/wc/_search" : "/sw-services/swc/_search", - requestBody: {}, - requestParam: { tenantId, applicationNumber }, - jsonPath: serviceType === "WATER" ? "WaterConnection[0].connectionHolders[0].correspondenceAddress" : "SewerageConnections[0].connectionHolders[0].correspondenceAddress", - isArray: false, + { + title: "WS_CONN_HOLDER_OWN_DETAIL_GENDER_LABEL", + value: wsDataDetails?.connectionHolders?.[0]?.gender, + privacy: { + uuid: wsDataDetails?.connectionHolders?.[0]?.uuid, + fieldName: ["gender"], + model: "WnSConnectionOwner", + showValue: false, + loadData: { + serviceName: serviceType === "WATER" ? "/ws-services/wc/_search" : "/sw-services/swc/_search", + requestBody: {}, + requestParam: { tenantId, applicationNumber }, + jsonPath: + serviceType === "WATER" + ? "WaterConnection[0].connectionHolders[0].gender" + : "SewerageConnections[0].connectionHolders[0].gender", + isArray: false, + }, + }, }, - } }, - { title: "WS_OWNER_SPECIAL_CATEGORY", value: wsDataDetails?.connectionHolders?.[0]?.ownerType ? !(wsDataDetails?.connectionHolders?.[0]?.ownerType?.includes("*")) ? `PROPERTYTAX_OWNERTYPE_${wsDataDetails?.connectionHolders?.[0]?.ownerType?.toUpperCase()}` : wsDataDetails?.connectionHolders?.[0]?.ownerType : "NA" , - privacy: { uuid: wsDataDetails?.connectionHolders?.[0]?.uuid, fieldName: ["ownerType"], model: "WnSConnection",showValue: false, - loadData: { - serviceName: serviceType === "WATER" ? "/ws-services/wc/_search" : "/sw-services/swc/_search", - requestBody: {}, - requestParam: { tenantId, applicationNumber }, - jsonPath: serviceType === "WATER" ? "WaterConnection[0].connectionHolders[0].ownerType" : "SewerageConnections[0].connectionHolders[0].ownerType", - isArray: false, - d: (res) => { - let resultString = (res?.WaterConnection?.[0] ? t(`PROPERTYTAX_OWNERTYPE_${res?.WaterConnection?.[0]?.connectionHolders?.[0]?.ownerType?.toUpperCase()}`) : t(`PROPERTYTAX_OWNERTYPE_${res?.SewerageConnections?.[0]?.connectionHolders?.[0]?.ownerType?.toUpperCase()}`)); - return resultString; - } - }, }}, - ] + { + title: "CORE_COMMON_MOBILE_NUMBER", + value: wsDataDetails?.connectionHolders?.[0]?.mobileNumber, + privacy: { + uuid: wsDataDetails?.connectionHolders?.[0]?.uuid, + fieldName: ["connectionHoldersMobileNumber"], + model: "WnSConnectionOwner", + showValue: false, + loadData: { + serviceName: serviceType === "WATER" ? "/ws-services/wc/_search" : "/sw-services/swc/_search", + requestBody: {}, + requestParam: { tenantId, applicationNumber }, + jsonPath: + serviceType === "WATER" + ? "WaterConnection[0].connectionHolders[0].mobileNumber" + : "SewerageConnections[0].connectionHolders[0].mobileNumber", + isArray: false, + }, + }, + }, + { + title: "WS_CONN_HOLDER_COMMON_FATHER_OR_HUSBAND_NAME", + value: wsDataDetails?.connectionHolders?.[0]?.fatherOrHusbandName, + privacy: { + uuid: wsDataDetails?.connectionHolders?.[0]?.uuid, + fieldName: ["fatherOrHusbandName"], + model: "WnSConnectionOwner", + showValue: false, + loadData: { + serviceName: serviceType === "WATER" ? "/ws-services/wc/_search" : "/sw-services/swc/_search", + requestBody: {}, + requestParam: { tenantId, applicationNumber }, + jsonPath: + serviceType === "WATER" + ? "WaterConnection[0].connectionHolders[0].fatherOrHusbandName" + : "SewerageConnections[0].connectionHolders[0].fatherOrHusbandName", + isArray: false, + }, + }, + }, + { + title: "WS_CONN_HOLDER_OWN_DETAIL_RELATION_LABEL", + value: wsDataDetails?.connectionHolders?.[0]?.relationship, + privacy: { + uuid: wsDataDetails?.connectionHolders?.[0]?.uuid, + fieldName: ["relationship"], + model: "WnSConnection", + showValue: false, + loadData: { + serviceName: serviceType === "WATER" ? "/ws-services/wc/_search" : "/sw-services/swc/_search", + requestBody: {}, + requestParam: { tenantId, applicationNumber }, + jsonPath: + serviceType === "WATER" + ? "WaterConnection[0].connectionHolders[0].relationship" + : "SewerageConnections[0].connectionHolders[0].relationship", + isArray: false, + }, + }, + }, + { + title: "WS_CORRESPONDANCE_ADDRESS_LABEL", + value: wsDataDetails?.connectionHolders?.[0]?.correspondenceAddress, + privacy: { + uuid: wsDataDetails?.connectionHolders?.[0]?.uuid, + fieldName: wsDataDetails?.connectionHolders[0]?.permanentAddress ? ["permanentAddress"] : ["correspondenceAddress"], + model: "WnSConnectionOwner", + hide: !(wsDataDetails?.connectionHolders[0]?.permanentAddress || wsDataDetails?.connectionHolders[0]?.correspondenceAddress), + showValue: false, + loadData: { + serviceName: serviceType === "WATER" ? "/ws-services/wc/_search" : "/sw-services/swc/_search", + requestBody: {}, + requestParam: { tenantId, applicationNumber }, + jsonPath: + serviceType === "WATER" + ? "WaterConnection[0].connectionHolders[0].correspondenceAddress" + : "SewerageConnections[0].connectionHolders[0].correspondenceAddress", + isArray: false, + }, + }, + }, + { + title: "WS_OWNER_SPECIAL_CATEGORY", + value: wsDataDetails?.connectionHolders?.[0]?.ownerType + ? !wsDataDetails?.connectionHolders?.[0]?.ownerType?.includes("*") + ? `PROPERTYTAX_OWNERTYPE_${wsDataDetails?.connectionHolders?.[0]?.ownerType?.toUpperCase()}` + : wsDataDetails?.connectionHolders?.[0]?.ownerType + : "NA", + privacy: { + uuid: wsDataDetails?.connectionHolders?.[0]?.uuid, + fieldName: ["ownerType"], + model: "WnSConnection", + showValue: false, + loadData: { + serviceName: serviceType === "WATER" ? "/ws-services/wc/_search" : "/sw-services/swc/_search", + requestBody: {}, + requestParam: { tenantId, applicationNumber }, + jsonPath: + serviceType === "WATER" + ? "WaterConnection[0].connectionHolders[0].ownerType" + : "SewerageConnections[0].connectionHolders[0].ownerType", + isArray: false, + d: (res) => { + let resultString = res?.WaterConnection?.[0] + ? t(`PROPERTYTAX_OWNERTYPE_${res?.WaterConnection?.[0]?.connectionHolders?.[0]?.ownerType?.toUpperCase()}`) + : t(`PROPERTYTAX_OWNERTYPE_${res?.SewerageConnections?.[0]?.connectionHolders?.[0]?.ownerType?.toUpperCase()}`); + return resultString; + }, + }, + }, + }, + ] : [{ title: "WS_CONN_HOLDER_SAME_AS_OWNER_DETAILS", value: t("SCORE_YES") }], }; @@ -1917,31 +2552,43 @@ export const WSSearch = { values: wsDataDetails?.additionalDetails?.detailsProvidedBy === "ULB" ? [ - { - title: "WS_ADDN_DETAILS_PLUMBER_PROVIDED_BY", - value: wsDataDetails?.additionalDetails?.detailsProvidedBy - ? t(`WS_PLUMBER_${wsDataDetails?.additionalDetails?.detailsProvidedBy?.toUpperCase()}`) - : t("NA"), - }, - { title: "WS_ADDN_DETAILS_PLUMBER_LICENCE_NO_LABEL", value: wsDataDetails?.plumberInfo?.[0]?.licenseNo || t("NA") }, - { title: "WS_ADDN_DETAILS_PLUMBER_NAME_LABEL", value: wsDataDetails?.plumberInfo?.[0]?.name || t("NA") }, - { title: "WS_PLUMBER_MOBILE_NO_LABEL", value: wsDataDetails?.plumberInfo?.[0]?.mobileNumber || t("NA"),privacy: { uuid: wsDataDetails?.applicationNo, fieldName: ["plumberInfoMobileNumber"], model: "WnSConnectionPlumber",showValue: false, - loadData: { - serviceName: serviceType === "WATER" ? "/ws-services/wc/_search" : "/sw-services/swc/_search", - requestBody: {}, - requestParam: { tenantId, applicationNumber }, - jsonPath: serviceType === "WATER" ? "WaterConnection[0].plumberInfo[0].mobileNumber" : "SewerageConnections[0].plumberInfo[0].mobileNumber", - isArray: false, - }, } }, - ] + { + title: "WS_ADDN_DETAILS_PLUMBER_PROVIDED_BY", + value: wsDataDetails?.additionalDetails?.detailsProvidedBy + ? t(`WS_PLUMBER_${wsDataDetails?.additionalDetails?.detailsProvidedBy?.toUpperCase()}`) + : t("NA"), + }, + { title: "WS_ADDN_DETAILS_PLUMBER_LICENCE_NO_LABEL", value: wsDataDetails?.plumberInfo?.[0]?.licenseNo || t("NA") }, + { title: "WS_ADDN_DETAILS_PLUMBER_NAME_LABEL", value: wsDataDetails?.plumberInfo?.[0]?.name || t("NA") }, + { + title: "WS_PLUMBER_MOBILE_NO_LABEL", + value: wsDataDetails?.plumberInfo?.[0]?.mobileNumber || t("NA"), + privacy: { + uuid: wsDataDetails?.applicationNo, + fieldName: ["plumberInfoMobileNumber"], + model: "WnSConnectionPlumber", + showValue: false, + loadData: { + serviceName: serviceType === "WATER" ? "/ws-services/wc/_search" : "/sw-services/swc/_search", + requestBody: {}, + requestParam: { tenantId, applicationNumber }, + jsonPath: + serviceType === "WATER" + ? "WaterConnection[0].plumberInfo[0].mobileNumber" + : "SewerageConnections[0].plumberInfo[0].mobileNumber", + isArray: false, + }, + }, + }, + ] : [ - { - title: "WS_ADDN_DETAILS_PLUMBER_PROVIDED_BY", - value: wsDataDetails?.additionalDetails?.detailsProvidedBy - ? t(`WS_PLUMBER_${wsDataDetails?.additionalDetails?.detailsProvidedBy?.toUpperCase()}`) - : t("NA"), - }, - ] + { + title: "WS_ADDN_DETAILS_PLUMBER_PROVIDED_BY", + value: wsDataDetails?.additionalDetails?.detailsProvidedBy + ? t(`WS_PLUMBER_${wsDataDetails?.additionalDetails?.detailsProvidedBy?.toUpperCase()}`) + : t("NA"), + }, + ], }; const documentDetails = { @@ -1979,6 +2626,5 @@ export const WSSearch = { propertyDetails: propertyDataDetails, processInstancesDetails: workFlowDataDetails?.ProcessInstances, }; - - } + }, }; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/bills/src/billHomeCard.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/bills/src/billHomeCard.js index 36eb3b802..ff2d92cc9 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/bills/src/billHomeCard.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/bills/src/billHomeCard.js @@ -13,20 +13,20 @@ const BillsCard = () => { links: [ { label: t("ABG_SEARCH_BILL_COMMON_HEADER"), - link: `/digit-ui/employee/bills/inbox`, + link: `/mgramseva-digit-ui/employee/bills/inbox`, }, { label: t("ACTION_TEST_GROUP_BILLS"), - link: `/digit-ui/employee/bills/group-bill`, + link: `/mgramseva-digit-ui/employee/bills/group-bill`, }, { label: t("ACTION_TEST_CANCEL_BILL"), - link: `/digit-ui/employee/bills/cancel-bill`, + link: `/mgramseva-digit-ui/employee/bills/cancel-bill`, }, { label: t("ACTION_TEST_DOWNLOAD_BILL_PDF"), - link: `/digit-ui/employee/bills/download-bill-pdf`, - } + link: `/mgramseva-digit-ui/employee/bills/download-bill-pdf`, + }, ], }; return ; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/bills/src/components/BillCancelModal.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/bills/src/components/BillCancelModal.js index 327396b08..dc17af8ba 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/bills/src/components/BillCancelModal.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/bills/src/components/BillCancelModal.js @@ -49,7 +49,7 @@ const BillCancelModal = ({ t, action, tenantId, closeModal, submitAction, applic }, [data]); function submit(data) { - history.replace("/digit-ui/employee/receipts/response", { + history.replace("/mgramseva-digit-ui/employee/receipts/response", { paymentWorkflow: { action: "CANCEL", additionalDetails: { ...data.otherDetails, selectedReasonMessage: t(`CR_REASON_${selectedReason.code}`) }, diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/bills/src/components/CancelBill/MobileCancelBill.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/bills/src/components/CancelBill/MobileCancelBill.js index b714ff6ee..8e4c0ede0 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/bills/src/components/CancelBill/MobileCancelBill.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/bills/src/components/CancelBill/MobileCancelBill.js @@ -1,191 +1,203 @@ -import React, { Fragment, useCallback, useMemo, useReducer,useState } from "react"; +import React, { Fragment, useCallback, useMemo, useReducer, useState } from "react"; import { Link } from "react-router-dom"; import { CloseSvg, SearchForm, Table, Card, SearchAction, PopUp, DetailsCard, Loader, Toast } from "@egovernments/digit-ui-react-components"; import { useHistory } from "react-router-dom"; import SearchFormFields from "./SearchFields"; import CancelBillModal from "./CancelBillModal"; -const MobileCancelBill = ({ Controller, register, control, t, reset, handleSubmit, tenantId, data, onSubmit,isLoading,resultOk }) => { - const history = useHistory() - function activateModal(state, action) { - switch (action.type) { - case "set": - return action.payload; - case "remove": - return false; - default: - break; - } +const MobileCancelBill = ({ Controller, register, control, t, reset, handleSubmit, tenantId, data, onSubmit, isLoading, resultOk }) => { + const history = useHistory(); + function activateModal(state, action) { + switch (action.type) { + case "set": + return action.payload; + case "remove": + return false; + default: + break; } + } - const [currentlyActiveMobileModal, setActiveMobileModal] = useReducer(activateModal, false); + const [currentlyActiveMobileModal, setActiveMobileModal] = useReducer(activateModal, false); - const closeMobilePopupModal = () => { - setActiveMobileModal({ type: "remove" }); - }; - - const MobilePopUpCloseButton = () => ( -
- -
- ); + const closeMobilePopupModal = () => { + setActiveMobileModal({ type: "remove" }); + }; - const searchFormFieldsComponentProps = { Controller, register, control, t, reset }; + const MobilePopUpCloseButton = () => ( +
+ +
+ ); - const MobileComponentDirectory = ({ currentlyActiveMobileModal, searchFormFieldsComponentProps, tenantId, ...props }) => { - const { closeMobilePopupModal } = props; - switch (currentlyActiveMobileModal) { - case "SearchFormComponent": - return ( - - -
-

{t("ABG_CANCEL_BILL")}:

-
- -
- ); - default: - return ; - } - }; + const searchFormFieldsComponentProps = { Controller, register, control, t, reset }; - const convertEpochToDate = (dateEpoch) => { - if (dateEpoch == null || dateEpoch == undefined || dateEpoch == "") { - return "NA"; - } - const dateFromApi = new Date(dateEpoch); - let month = dateFromApi.getMonth() + 1; - let day = dateFromApi.getDate(); - let year = dateFromApi.getFullYear(); - month = (month > 9 ? "" : "0") + month; - day = (day > 9 ? "" : "0") + day; - return `${day}/${month}/${year}`; - }; - - const CurrentMobileModalComponent = useCallback( - ({ currentlyActiveMobileModal, searchFormFieldsComponentProps, tenantId, ...props }) => - MobileComponentDirectory({ currentlyActiveMobileModal, searchFormFieldsComponentProps, tenantId, ...props }), - [currentlyActiveMobileModal] - ); - - const [showModal, setShowModal] = useState(false) - const handleCancelBillAction = (_data) => { - setShowModal(false) - const filters = { - tenantId, - consumerCodes: [currentBill?.consumerCode], - businessService: currentBill?.businessService, - statusToBeUpdated: "CANCELLED", - additionalDetails: { - reason: _data?.reason?.code, - description: _data?.details || "", - reasonMessage: t(_data?.reason?.message) - } - } - //here do history.push to the response page and send filters there - history.push("/digit-ui/employee/bills/response-cancelBill", { filters, currentBill }); - //call the cancel bill api from response page and show appropriate response + const MobileComponentDirectory = ({ currentlyActiveMobileModal, searchFormFieldsComponentProps, tenantId, ...props }) => { + const { closeMobilePopupModal } = props; + switch (currentlyActiveMobileModal) { + case "SearchFormComponent": + return ( + + +
+

{t("ABG_CANCEL_BILL")}:

+
+ +
+ ); + default: + return ; } + }; - const [currentBill, setCurrentBill] = useState("") - const handleCancelActionClick = (row) => { - setShowModal(true) - setCurrentBill(row) + const convertEpochToDate = (dateEpoch) => { + if (dateEpoch == null || dateEpoch == undefined || dateEpoch == "") { + return "NA"; } + const dateFromApi = new Date(dateEpoch); + let month = dateFromApi.getMonth() + 1; + let day = dateFromApi.getDate(); + let year = dateFromApi.getFullYear(); + month = (month > 9 ? "" : "0") + month; + day = (day > 9 ? "" : "0") + day; + return `${day}/${month}/${year}`; + }; - const getActionItem = (row) => { - return ( -
- - - -
- ) + const CurrentMobileModalComponent = useCallback( + ({ currentlyActiveMobileModal, searchFormFieldsComponentProps, tenantId, ...props }) => + MobileComponentDirectory({ currentlyActiveMobileModal, searchFormFieldsComponentProps, tenantId, ...props }), + [currentlyActiveMobileModal] + ); + + const [showModal, setShowModal] = useState(false); + const handleCancelBillAction = (_data) => { + setShowModal(false); + const filters = { + tenantId, + consumerCodes: [currentBill?.consumerCode], + businessService: currentBill?.businessService, + statusToBeUpdated: "CANCELLED", + additionalDetails: { + reason: _data?.reason?.code, + description: _data?.details || "", + reasonMessage: t(_data?.reason?.message), + }, }; + //here do history.push to the response page and send filters there + history.push("/mgramseva-digit-ui/employee/bills/response-cancelBill", { filters, currentBill }); + //call the cancel bill api from response page and show appropriate response + }; - const handleBillLinkClick = (row) => { - history.push(`/digit-ui/employee/bills/bill-details?connectionNumber=${row?.consumerCode}&tenantId=${tenantId}&service=${row?.businessService}`, row) - } - - const GetCell = (value) => {value}; - const getBillLink = (row) => { - return ( -
- - - -
- ) - } - const propsMobileInboxCards = useMemo(() => { - // if (data?.display) { - // return []; - // } - if(isLoading){ - return []; - } - return data?.map((row) => ({ - [t("ABG_BILL_NUMBER_LABEL")]: getBillLink(row) , - [t("ABG_COMMON_TABLE_COL_CONSUMER_NAME")]: row?.user?.name? t(`${row?.user?.name}`) : "NA", - [t("ABG_COMMON_TABLE_COL_BILL_DATE")]: GetCell(convertEpochToDate(row?.billDate)), - [t("ABG_COMMON_TABLE_COL_BILL_AMOUNT")]: GetCell(row?.totalAmount||"NA"), - [t("ABG_COMMON_TABLE_COL_STATUS")]: GetCell(row?.status || "NA"), - [t("ABG_COMMON_TABLE_COL_ACTION")]: GetCell(getActionItem(row)), - })); - }, [data]); + const [currentBill, setCurrentBill] = useState(""); + const handleCancelActionClick = (row) => { + setShowModal(true); + setCurrentBill(row); + }; + const getActionItem = (row) => { return ( - -
- setActiveMobileModal({ type: "set", payload: "SearchFormComponent" })} - {...{ tenantId, t }} - /> -
- {currentlyActiveMobileModal ? ( - - { - setActiveMobileModal({ type: "remove" }); - onSubmit(data); - }} - handleSubmit={handleSubmit} - id="search-form" - className="rm-mb form-field-flex-one inboxPopupMobileWrapper" - {...{ searchFormFieldsComponentProps, currentlyActiveMobileModal, closeMobilePopupModal, tenantId }} - /> - - ) : null} - {isLoading && } - {!isLoading && resultOk && ( - {}, - handleDetailCardClick: (e)=> {}, - data: propsMobileInboxCards, - serviceRequestIdKey: t("ABG_BILL_NUMBER_LABEL"), - }} - /> - )} - {showModal && setShowModal(false)} - actionCancelLabel={"ABG_BACK"} - actionCancelOnSubmit={() => setShowModal(false)} - actionSaveLabel={"ABG_CANCEL_BILL"} - actionSaveOnSubmit={handleCancelBillAction} - onSubmit={handleCancelBillAction} - > - } -
+
+ + + +
+ ); + }; + + const handleBillLinkClick = (row) => { + history.push( + `/mgramseva-digit-ui/employee/bills/bill-details?connectionNumber=${row?.consumerCode}&tenantId=${tenantId}&service=${row?.businessService}`, + row + ); + }; + + const GetCell = (value) => {value}; + const getBillLink = (row) => { + return ( +
+ + + +
); + }; + const propsMobileInboxCards = useMemo(() => { + // if (data?.display) { + // return []; + // } + if (isLoading) { + return []; + } + return data?.map((row) => ({ + [t("ABG_BILL_NUMBER_LABEL")]: getBillLink(row), + [t("ABG_COMMON_TABLE_COL_CONSUMER_NAME")]: row?.user?.name ? t(`${row?.user?.name}`) : "NA", + [t("ABG_COMMON_TABLE_COL_BILL_DATE")]: GetCell(convertEpochToDate(row?.billDate)), + [t("ABG_COMMON_TABLE_COL_BILL_AMOUNT")]: GetCell(row?.totalAmount || "NA"), + [t("ABG_COMMON_TABLE_COL_STATUS")]: GetCell(row?.status || "NA"), + [t("ABG_COMMON_TABLE_COL_ACTION")]: GetCell(getActionItem(row)), + })); + }, [data]); + + return ( + +
+ setActiveMobileModal({ type: "set", payload: "SearchFormComponent" })} + {...{ tenantId, t }} + /> +
+ {currentlyActiveMobileModal ? ( + + { + setActiveMobileModal({ type: "remove" }); + onSubmit(data); + }} + handleSubmit={handleSubmit} + id="search-form" + className="rm-mb form-field-flex-one inboxPopupMobileWrapper" + {...{ searchFormFieldsComponentProps, currentlyActiveMobileModal, closeMobilePopupModal, tenantId }} + /> + + ) : null} + {isLoading && } + {!isLoading && resultOk && ( + {}, + handleDetailCardClick: (e) => {}, + data: propsMobileInboxCards, + serviceRequestIdKey: t("ABG_BILL_NUMBER_LABEL"), + }} + /> + )} + {showModal && ( + setShowModal(false)} + actionCancelLabel={"ABG_BACK"} + actionCancelOnSubmit={() => setShowModal(false)} + actionSaveLabel={"ABG_CANCEL_BILL"} + actionSaveOnSubmit={handleCancelBillAction} + onSubmit={handleCancelBillAction} + > + )} +
+ ); }; export default MobileCancelBill; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/bills/src/components/CancelBill/index.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/bills/src/components/CancelBill/index.js index c14bc055a..053ab7a62 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/bills/src/components/CancelBill/index.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/bills/src/components/CancelBill/index.js @@ -1,4 +1,4 @@ -import React, { Fragment, useEffect, useCallback, useMemo,useState } from "react"; +import React, { Fragment, useEffect, useCallback, useMemo, useState } from "react"; import { SearchForm, Table, Card, Loader, Header, DownloadBtnCommon, DownloadIcon } from "@egovernments/digit-ui-react-components"; import { useForm, Controller } from "react-hook-form"; import SearchFields from "./SearchFields"; @@ -9,230 +9,239 @@ import { useHistory } from "react-router-dom"; import { join } from "lodash"; import MobileCancelBill from "./MobileCancelBill"; -const CancelBills = ({ tenantId, onSubmit, data, count,isLoading,resultOk }) => { - const history = useHistory() - const convertEpochToDate = (dateEpoch) => { - if (dateEpoch == null || dateEpoch == undefined || dateEpoch == "") { - return "NA"; - } - const dateFromApi = new Date(dateEpoch); - let month = dateFromApi.getMonth() + 1; - let day = dateFromApi.getDate(); - let year = dateFromApi.getFullYear(); - month = (month > 9 ? "" : "0") + month; - day = (day > 9 ? "" : "0") + day; - return `${day}/${month}/${year}`; - }; - - const { t } = useTranslation(); - const { register, control, handleSubmit, setValue, getValues, reset,formState } = useForm({ - defaultValues: { - offset: 0, - limit: 10, - sortBy: "commencementDate", - sortOrder: "DESC", - searchType: "CONNECTION", - }, - }); - - - const handleBillLinkClick = (row) => { - history.push(`/digit-ui/employee/bills/bill-details?connectionNumber=${row?.consumerCode}&tenantId=${tenantId}&service=${row?.businessService}&from=ABG_CANCEL_BILL`,row) - } - - const getBillLink = (row) => { - return ( -
- - - -
- ) +const CancelBills = ({ tenantId, onSubmit, data, count, isLoading, resultOk }) => { + const history = useHistory(); + const convertEpochToDate = (dateEpoch) => { + if (dateEpoch == null || dateEpoch == undefined || dateEpoch == "") { + return "NA"; } + const dateFromApi = new Date(dateEpoch); + let month = dateFromApi.getMonth() + 1; + let day = dateFromApi.getDate(); + let year = dateFromApi.getFullYear(); + month = (month > 9 ? "" : "0") + month; + day = (day > 9 ? "" : "0") + day; + return `${day}/${month}/${year}`; + }; - const isMobile = window.Digit.Utils.browser.isMobile(); + const { t } = useTranslation(); + const { register, control, handleSubmit, setValue, getValues, reset, formState } = useForm({ + defaultValues: { + offset: 0, + limit: 10, + sortBy: "commencementDate", + sortOrder: "DESC", + searchType: "CONNECTION", + }, + }); - if (isMobile) { - return ; - } - const DownloadBtn = (props) => { - return ( -
- -
- ); - }; + const handleBillLinkClick = (row) => { + history.push( + `/mgramseva-digit-ui/employee/bills/bill-details?connectionNumber=${row?.consumerCode}&tenantId=${tenantId}&service=${row?.businessService}&from=ABG_CANCEL_BILL`, + row + ); + }; - const handleExcelDownload = (tabData) => { - if (tabData?.[0] !== undefined) { - return Digit.Download.Excel(tabData?.[0], "Bills"); - } - }; - const [tabledata, settabledata] = useState([]); - useEffect(() => { - if (data !== "") { - settabledata([ + const getBillLink = (row) => { + return ( +
+ + + +
+ ); + }; - data?.map((obj) => { - let returnObject = {}; - returnObject[t("ABG_COMMON_TABLE_COL_BILL_NO")] = obj?.billNumber; - returnObject[t("ABG_COMMON_TABLE_COL_CONSUMER_NAME")] = obj?.payerName; - returnObject[t("ABG_COMMON_TABLE_COL_BILL_DATE")] = convertEpochToDate(obj?.billDate); - returnObject[t("ABG_COMMON_TABLE_COL_BILL_AMOUNT")] = obj?.totalAmount; - returnObject[t("ABG_COMMON_TABLE_COL_STATUS")] = obj?.status; - return { - ...returnObject, - } - }) - ]) - } - }, [data]); - const GetCell = (value) => {value}; - const columns = useMemo( - () => [ - { - Header: t("ABG_BILL_NUMBER_LABEL"), - disableSortBy: true, - accessor: "billNumber", - Cell: ({ row }) => { - return getBillLink(row) - }, - }, - { - Header: t("ABG_COMMON_TABLE_COL_CONSUMER_NAME"), - disableSortBy: true, - Cell: ({ row }) => { - return GetCell(row.original?.user?.name || "NA"); - }, - }, + const isMobile = window.Digit.Utils.browser.isMobile(); - { - Header: t("ABG_COMMON_TABLE_COL_BILL_DATE"), - disableSortBy: true, - Cell: ({ row }) => { - return GetCell(convertEpochToDate(row?.original?.billDate)); - }, - }, - { - Header: t("ABG_COMMON_TABLE_COL_BILL_AMOUNT"), - disableSortBy: true, - Cell: ({ row }) => { - return GetCell(row?.original?.totalAmount || "NA"); - }, - }, - { - Header: t("ABG_COMMON_TABLE_COL_STATUS"), - disableSortBy: true, - Cell: ({ row }) => { - return GetCell(row?.original?.status || "NA"); - }, - }, - { - Header: t("ABG_COMMON_TABLE_COL_ACTION"), - disableSortBy: true, - Cell: ({ row }) => { - return GetCell(getActionItem(row)); - }, - }, - ], - [] + if (isMobile) { + return ; + } + const DownloadBtn = (props) => { + return ( +
+ +
); - - const [showModal,setShowModal] = useState(false) - const handleCancelBillAction = (_data) => { - setShowModal(false) - const filters = { - tenantId, - consumerCodes: [currentBill?.consumerCode], - businessService: currentBill?.businessService, - statusToBeUpdated: "CANCELLED", - additionalDetails: { - reason: _data?.reason?.code, - description: _data?.details || "", - reasonMessage: t(_data?.reason?.message) - } - } - //here do history.push to the response page and send filters there - history.push("/digit-ui/employee/bills/response-cancelBill", {filters,currentBill}); - //call the cancel bill api from response page and show appropriate response - } + }; - const [currentBill,setCurrentBill] = useState("") - const handleCancelActionClick = (row) => { - setShowModal(true) - setCurrentBill(row) + const handleExcelDownload = (tabData) => { + if (tabData?.[0] !== undefined) { + return Digit.Download.Excel(tabData?.[0], "Bills"); } - const getActionItem = (row) => { - return ( -
- - - -
- ) + }; + const [tabledata, settabledata] = useState([]); + useEffect(() => { + if (data !== "") { + settabledata([ + data?.map((obj) => { + let returnObject = {}; + returnObject[t("ABG_COMMON_TABLE_COL_BILL_NO")] = obj?.billNumber; + returnObject[t("ABG_COMMON_TABLE_COL_CONSUMER_NAME")] = obj?.payerName; + returnObject[t("ABG_COMMON_TABLE_COL_BILL_DATE")] = convertEpochToDate(obj?.billDate); + returnObject[t("ABG_COMMON_TABLE_COL_BILL_AMOUNT")] = obj?.totalAmount; + returnObject[t("ABG_COMMON_TABLE_COL_STATUS")] = obj?.status; + return { + ...returnObject, + }; + }), + ]); + } + }, [data]); + const GetCell = (value) => {value}; + const columns = useMemo( + () => [ + { + Header: t("ABG_BILL_NUMBER_LABEL"), + disableSortBy: true, + accessor: "billNumber", + Cell: ({ row }) => { + return getBillLink(row); + }, + }, + { + Header: t("ABG_COMMON_TABLE_COL_CONSUMER_NAME"), + disableSortBy: true, + Cell: ({ row }) => { + return GetCell(row.original?.user?.name || "NA"); + }, + }, + + { + Header: t("ABG_COMMON_TABLE_COL_BILL_DATE"), + disableSortBy: true, + Cell: ({ row }) => { + return GetCell(convertEpochToDate(row?.original?.billDate)); + }, + }, + { + Header: t("ABG_COMMON_TABLE_COL_BILL_AMOUNT"), + disableSortBy: true, + Cell: ({ row }) => { + return GetCell(row?.original?.totalAmount || "NA"); + }, + }, + { + Header: t("ABG_COMMON_TABLE_COL_STATUS"), + disableSortBy: true, + Cell: ({ row }) => { + return GetCell(row?.original?.status || "NA"); + }, + }, + { + Header: t("ABG_COMMON_TABLE_COL_ACTION"), + disableSortBy: true, + Cell: ({ row }) => { + return GetCell(getActionItem(row)); + }, + }, + ], + [] + ); + + const [showModal, setShowModal] = useState(false); + const handleCancelBillAction = (_data) => { + setShowModal(false); + const filters = { + tenantId, + consumerCodes: [currentBill?.consumerCode], + businessService: currentBill?.businessService, + statusToBeUpdated: "CANCELLED", + additionalDetails: { + reason: _data?.reason?.code, + description: _data?.details || "", + reasonMessage: t(_data?.reason?.message), + }, }; + //here do history.push to the response page and send filters there + history.push("/mgramseva-digit-ui/employee/bills/response-cancelBill", { filters, currentBill }); + //call the cancel bill api from response page and show appropriate response + }; + const [currentBill, setCurrentBill] = useState(""); + const handleCancelActionClick = (row) => { + setShowModal(true); + setCurrentBill(row); + }; + const getActionItem = (row) => { return ( - <> -
- {t("ABG_CANCEL_BILL")} -
- < Card className={"card-search-heading"}> - {t("WS_INFO_VALIDATION")} - - - - - {isLoading && } - {data && data?.length == 0 ? ( - - {t("ES_COMMON_NO_DATA")} - ): - (isLoading===false && resultOk && -
-
- {t("ABG_SEARCH_RESULTS_HEADER")} -
-
- - handleExcelDownload(tabledata)} /> - -
- { - return { - style: { - minWidth: cellInfo.column.Header === t("ABG_BILL_NUMBER_LABEL") ? "240px" : "", - padding: "20px 18px", - fontSize: "16px", - }, - }; - }} - manualPagination={false} - /> - )} - {showModal && setShowModal(false)} - actionCancelLabel={"ABG_BACK"} - actionCancelOnSubmit={() => setShowModal(false)} - actionSaveLabel={"ABG_CANCEL_BILL"} - actionSaveOnSubmit={handleCancelBillAction} - onSubmit={handleCancelBillAction} - > - } - - ) +
+ + + +
+ ); + }; -} + return ( + <> +
{t("ABG_CANCEL_BILL")}
+ + {t("WS_INFO_VALIDATION")} + + + + + {isLoading && } + {data && data?.length == 0 ? ( + {t("ES_COMMON_NO_DATA")} + ) : ( + isLoading === false && + resultOk && ( +
+
+ {t("ABG_SEARCH_RESULTS_HEADER")} +
+
+ + handleExcelDownload(tabledata)} /> + +
+
{ + return { + style: { + minWidth: cellInfo.column.Header === t("ABG_BILL_NUMBER_LABEL") ? "240px" : "", + padding: "20px 18px", + fontSize: "16px", + }, + }; + }} + manualPagination={false} + /> + + ) + )} + {showModal && ( + setShowModal(false)} + actionCancelLabel={"ABG_BACK"} + actionCancelOnSubmit={() => setShowModal(false)} + actionSaveLabel={"ABG_CANCEL_BILL"} + actionSaveOnSubmit={handleCancelBillAction} + onSubmit={handleCancelBillAction} + > + )} + + ); +}; -export default CancelBills \ No newline at end of file +export default CancelBills; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/bills/src/components/GroupBill/index.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/bills/src/components/GroupBill/index.js index 6c4a176c2..968231938 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/bills/src/components/GroupBill/index.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/bills/src/components/GroupBill/index.js @@ -1,5 +1,5 @@ import React, { Fragment, useEffect, useCallback, useMemo, useState } from "react"; -import { SearchForm, Table, Card, Loader, Header, DownloadBtnCommon, DownloadIcon,MultiLink,Toast } from "@egovernments/digit-ui-react-components"; +import { SearchForm, Table, Card, Loader, Header, DownloadBtnCommon, DownloadIcon, MultiLink, Toast } from "@egovernments/digit-ui-react-components"; import { useForm, Controller } from "react-hook-form"; import SearchFields from "./SearchFields"; import { useTranslation } from "react-i18next"; @@ -9,280 +9,319 @@ import { join } from "lodash"; //import MobileCancelBill from "../CancelBill/MobileCancelBill"; import MobileGroupBill from "../GroupBill/MobileGroupBill"; import { getBillNumber } from "../../utils"; -const GroupBills = ({ tenantId, onSubmit, data, count, isLoading, resultOk,serviceType,locality }) => { - - const history = useHistory() - const convertEpochToDate = (dateEpoch) => { - if (dateEpoch == null || dateEpoch == undefined || dateEpoch == "") { - return "NA"; - } - const dateFromApi = new Date(dateEpoch); - let month = dateFromApi.getMonth() + 1; - let day = dateFromApi.getDate(); - let year = dateFromApi.getFullYear(); - month = (month > 9 ? "" : "0") + month; - day = (day > 9 ? "" : "0") + day; - return `${day}/${month}/${year}`; - }; +const GroupBills = ({ tenantId, onSubmit, data, count, isLoading, resultOk, serviceType, locality }) => { + const history = useHistory(); + const convertEpochToDate = (dateEpoch) => { + if (dateEpoch == null || dateEpoch == undefined || dateEpoch == "") { + return "NA"; + } + const dateFromApi = new Date(dateEpoch); + let month = dateFromApi.getMonth() + 1; + let day = dateFromApi.getDate(); + let year = dateFromApi.getFullYear(); + month = (month > 9 ? "" : "0") + month; + day = (day > 9 ? "" : "0") + day; + return `${day}/${month}/${year}`; + }; - const { t } = useTranslation(); - const { data: tenantlocalties, isLoadingLocalities } = Digit.Hooks.useBoundaryLocalities(tenantId, 'revenue',{}, t); - const { register, control, handleSubmit, setValue, getValues, reset, formState } = useForm({ - defaultValues: { - offset: 0, - limit: 10, - sortBy: "commencementDate", - sortOrder: "DESC", - searchType: "CONNECTION", - }, - }); + const { t } = useTranslation(); + const { data: tenantlocalties, isLoadingLocalities } = Digit.Hooks.useBoundaryLocalities(tenantId, "revenue", {}, t); + const { register, control, handleSubmit, setValue, getValues, reset, formState } = useForm({ + defaultValues: { + offset: 0, + limit: 10, + sortBy: "commencementDate", + sortOrder: "DESC", + searchType: "CONNECTION", + }, + }); + const handleBillLinkClick = (row) => { + history.push( + `/mgramseva-digit-ui/employee/bills/bill-details?connectionNumber=${row?.consumerCode}&tenantId=${tenantId}&service=${row?.businessService}&from=ABG_CANCEL_BILL`, + row + ); + }; - const handleBillLinkClick = (row) => { - history.push(`/digit-ui/employee/bills/bill-details?connectionNumber=${row?.consumerCode}&tenantId=${tenantId}&service=${row?.businessService}&from=ABG_CANCEL_BILL`, row) - } + const getBillLink = (row) => { + return ( +
+ + + +
+ ); + }; + + const isMobile = window.Digit.Utils.browser.isMobile(); + + if (isMobile) { + return ( + + ); + } + const DownloadBtn = (props) => { + return ( +
+ +
+ ); + }; - const getBillLink = (row) => { - return ( + const printBill = async (businessService, consumerCode) => { + await Digit.Utils.downloadBill(consumerCode, businessService, "consolidatedreceipt"); + }; + + const GetCell = (value) => {value}; + const columns = useMemo( + () => [ + { + Header: t("ABG_BILL_NUMBER_LABEL"), + disableSortBy: true, + accessor: "billNumber", + Cell: ({ row }) => { + //here just download this particular bill + return (
- - - + + {GetCell(getBillNumber(row.original?.businessService, row.original?.consumerCode, row.original?.billNumber))} +
- ) - } + ); + }, + }, + { + Header: serviceType === "WS" || serviceType === "SW" ? t("PDF_STATIC_LABEL_CONSOLIDATED_BILL_CONSUMER_ID") : t("PROPERTY_ID"), + disableSortBy: true, + Cell: ({ row }) => { + return GetCell(row.original?.consumerCode || "NA"); + }, + }, + { + Header: serviceType === "WS" || serviceType === "SW" ? t("ABG_COMMON_TABLE_COL_CONSUMER_NAME") : t("OWNER_NAME"), + disableSortBy: true, + Cell: ({ row }) => { + return GetCell(row.original?.user?.name || "NA"); + }, + }, - const isMobile = window.Digit.Utils.browser.isMobile(); + { + Header: t("ABG_COMMON_TABLE_COL_BILL_DATE"), + disableSortBy: true, + Cell: ({ row }) => { + return GetCell(convertEpochToDate(row?.original?.billDate)); + }, + }, + { + Header: t("ABG_COMMON_TABLE_COL_STATUS"), + disableSortBy: true, + Cell: ({ row }) => { + return GetCell(row?.original?.status || "NA"); + }, + }, + ], + [serviceType] + ); - if (isMobile) { - return ; - } - const DownloadBtn = (props) => { - return ( -
- -
- ); + const [showModal, setShowModal] = useState(false); + const handleCancelBillAction = (_data) => { + setShowModal(false); + const filters = { + tenantId, + consumerCodes: [currentBill?.consumerCode], + businessService: currentBill?.businessService, + statusToBeUpdated: "CANCELLED", + additionalDetails: { + reason: _data?.reason?.code, + description: _data?.details || "", + reasonMessage: t(_data?.reason?.message), + }, }; + //here do history.push to the response page and send filters there + history.push("/mgramseva-digit-ui/employee/bills/response-cancelBill", { filters, currentBill }); + //call the cancel bill api from response page and show appropriate response + }; - const printBill = async (businessService, consumerCode) => { - await Digit.Utils.downloadBill(consumerCode, businessService, "consolidatedreceipt"); - }; + const [currentBill, setCurrentBill] = useState(""); - const GetCell = (value) => {value}; - const columns = useMemo( - () => [ - { - Header: t("ABG_BILL_NUMBER_LABEL"), - disableSortBy: true, - accessor: "billNumber", - Cell: ({ row }) => { - //here just download this particular bill - return (
- - {GetCell(getBillNumber(row.original?.businessService, row.original?.consumerCode, row.original?.billNumber))} - -
) - } - }, - { - Header: serviceType === "WS" || serviceType === "SW" ? t("PDF_STATIC_LABEL_CONSOLIDATED_BILL_CONSUMER_ID") : t("PROPERTY_ID"), - disableSortBy: true, - Cell: ({ row }) => { - return GetCell(row.original?.consumerCode || "NA"); - }, - }, - { - Header: serviceType === "WS" || serviceType === "SW" ? t("ABG_COMMON_TABLE_COL_CONSUMER_NAME") : t("OWNER_NAME"), - disableSortBy: true, - Cell: ({ row }) => { - return GetCell(row.original?.user?.name || "NA"); - }, - }, + const downloadAll = (data) => { + data.map((fs) => { + window.open(fs.url); + }); + }; - { - Header: t("ABG_COMMON_TABLE_COL_BILL_DATE"), - disableSortBy: true, - Cell: ({ row }) => { - return GetCell(convertEpochToDate(row?.original?.billDate)); - }, - }, - { - Header: t("ABG_COMMON_TABLE_COL_STATUS"), - disableSortBy: true, - Cell: ({ row }) => { - return GetCell(row?.original?.status || "NA"); - }, - }, - ], - [serviceType] + const handleCancelActionClick = (row) => { + setShowModal(true); + setCurrentBill(row); + }; + const getActionItem = (row) => { + return ( +
+ + + +
); + }; + const { isLoadinggen, data: generateServiceType } = Digit.Hooks.useCommonMDMS(tenantId, "BillingService", "BillsGenieKey"); + const keys = generateServiceType?.["common-masters"]?.uiCommonPay; + const downloadBills = async () => { + const keyv1 = keys.filter((key) => key.code === serviceType); + const bills = await Digit.PaymentService.generatePdf(tenantId, { Bill: data }, keyv1[0].billKey); + const res = await Digit.UploadServices.Filefetch(bills?.filestoreIds, tenantId); + // removed for UM-5036 + // window.open(res.data[bills.filestoreIds[0]]); - const [showModal, setShowModal] = useState(false) - const handleCancelBillAction = (_data) => { - setShowModal(false) - const filters = { - tenantId, - consumerCodes: [currentBill?.consumerCode], - businessService: currentBill?.businessService, - statusToBeUpdated: "CANCELLED", - additionalDetails: { - reason: _data?.reason?.code, - description: _data?.details || "", - reasonMessage: t(_data?.reason?.message) - } - } - //here do history.push to the response page and send filters there - history.push("/digit-ui/employee/bills/response-cancelBill", { filters, currentBill }); - //call the cancel bill api from response page and show appropriate response - } - - const [currentBill, setCurrentBill] = useState(""); - - const downloadAll = (data) => { - data.map((fs) => { - window.open(fs.url); - }); - }; - - const handleCancelActionClick = (row) => { - setShowModal(true) - setCurrentBill(row) + //logic for downloading all bills anyway(if api is giving multiple filestoreids) + const fsObj = res.data.fileStoreIds; + downloadAll(fsObj); + }; + const handleMergeAndDownload = (e) => { + if (serviceType == "PT") { + startWSBillDownloadJob(true, "pt-bill"); + } else { + downloadBills(); } - const getActionItem = (row) => { - return ( -
- - - -
- ) - }; - const { isLoadinggen, data: generateServiceType } = Digit.Hooks.useCommonMDMS(tenantId, "BillingService", "BillsGenieKey"); - const keys = generateServiceType?.["common-masters"]?.uiCommonPay - const downloadBills = async () => { - const keyv1 = keys.filter((key) => key.code === serviceType); - const bills = await Digit.PaymentService.generatePdf(tenantId, { Bill: data }, keyv1[0].billKey); - const res = await Digit.UploadServices.Filefetch(bills?.filestoreIds, tenantId); - // removed for UM-5036 - // window.open(res.data[bills.filestoreIds[0]]); - - //logic for downloading all bills anyway(if api is giving multiple filestoreids) - const fsObj = res.data.fileStoreIds; - downloadAll(fsObj) - }; - const handleMergeAndDownload = (e) => { - if (serviceType == "PT") { - startWSBillDownloadJob(true, "pt-bill") - } else { - downloadBills(); - } - - }; - const [showToast, setShowToast] = useState(null) - const startWSBillDownloadJob = async (isConsolidated, key = "ws-bill") => { - const result = await Digit.WSService.wnsGroupBill({ key: key ? key : "ws-bill", tenantId, locality: locality?.code, isConsolidated, bussinessService: serviceType }); - setShowToast({ - label: `${t("GRP_JOB_INITIATED_STATUS")} ${result?.jobId}` - }) - }; - const [showOptions, setShowOptions] = useState(false) - const dowloadOptions = serviceType === "WS" ? [ - { + }; + const [showToast, setShowToast] = useState(null); + const startWSBillDownloadJob = async (isConsolidated, key = "ws-bill") => { + const result = await Digit.WSService.wnsGroupBill({ + key: key ? key : "ws-bill", + tenantId, + locality: locality?.code, + isConsolidated, + bussinessService: serviceType, + }); + setShowToast({ + label: `${t("GRP_JOB_INITIATED_STATUS")} ${result?.jobId}`, + }); + }; + const [showOptions, setShowOptions] = useState(false); + const dowloadOptions = + serviceType === "WS" + ? [ + { order: 1, label: t("ABG_WATER_BILLS"), onClick: () => startWSBillDownloadJob(false), - }, - { + }, + { order: 2, label: t("ABG_WATER_SEWERAGE_BILLS"), onClick: () => startWSBillDownloadJob(true), - } - - ] : serviceType === "SW" ? [ - { + }, + ] + : serviceType === "SW" + ? [ + { order: 1, label: t("ABG_SEWERAGE_BILLS"), onClick: () => startWSBillDownloadJob(false), - }, - { + }, + { order: 2, label: t("ABG_WATER_SEWERAGE_BILLS"), onClick: () => startWSBillDownloadJob(true), - } - ] : [ - { + }, + ] + : [ + { order: 1, label: t("BILLS_MERGE_AND_DOWNLOAD"), - onClick: ()=> {handleMergeAndDownload()} - } - ]; - + onClick: () => { + handleMergeAndDownload(); + }, + }, + ]; - return ( - <> -
-
- {t("ABG_COMMON_HEADER")} -
- {data && data?.length >= 0 && ( - setShowOptions(!showOptions)} - displayOptions={showOptions} - options={dowloadOptions} - downloadBtnClassName={"employee-download-btn-className"} - optionsClassName={"employee-options-btn-className"} - label={t("BILLS_MERGE_AND_DOWNLOAD")} - /> - )} -
- {/* < Card className={"card-search-heading"}> + return ( + <> +
+
{t("ABG_COMMON_HEADER")}
+ {data && data?.length >= 0 && ( + setShowOptions(!showOptions)} + displayOptions={showOptions} + options={dowloadOptions} + downloadBtnClassName={"employee-download-btn-className"} + optionsClassName={"employee-options-btn-className"} + label={t("BILLS_MERGE_AND_DOWNLOAD")} + /> + )} +
+ {/* < Card className={"card-search-heading"}> {t("WS_INFO_VALIDATION")} */} - - - - {isLoading && } - {data && data?.length == 0 ? ( - - {t("ES_COMMON_NO_DATA")} - ):( - isLoading===false && data && -
-
- {t("ABG_SEARCH_RESULTS_HEADER")} -
- {/*
+ + + + {isLoading && } + {data && data?.length == 0 ? ( + {t("ES_COMMON_NO_DATA")} + ) : ( + isLoading === false && + data && ( +
+
+ {t("ABG_SEARCH_RESULTS_HEADER")} +
+ {/*
handleExcelDownload(tabledata)} />
*/} -
{ - return { - style: { - minWidth: cellInfo.column.Header === t("ABG_BILL_NUMBER_LABEL") ? "240px" : "", - padding: "20px 18px", - fontSize: "16px", - }, - }; - }} - manualPagination={false} - /> - )} - {showToast && setShowToast(null)} />} - - ) - -} +
{ + return { + style: { + minWidth: cellInfo.column.Header === t("ABG_BILL_NUMBER_LABEL") ? "240px" : "", + padding: "20px 18px", + fontSize: "16px", + }, + }; + }} + manualPagination={false} + /> + + ) + )} + {showToast && setShowToast(null)} />} + + ); +}; -export default GroupBills \ No newline at end of file +export default GroupBills; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/bills/src/components/Search/MobileSearchApplication.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/bills/src/components/Search/MobileSearchApplication.js index fdf4ba6dc..b53f6b8b0 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/bills/src/components/Search/MobileSearchApplication.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/bills/src/components/Search/MobileSearchApplication.js @@ -10,7 +10,7 @@ import { Loader, Toast, Header, - DownloadBtnCommon + DownloadBtnCommon, } from "@egovernments/digit-ui-react-components"; import { Link } from "react-router-dom"; import { getBillNumber } from "../../utils"; @@ -18,63 +18,63 @@ import SearchFormFields from "./SearchFields"; import { printRecieptMobile } from "../../utils"; // import { convertEpochToDateDMY } from "../../utils"; -const MobileSearchApplication = ({ Controller, register, control, t, reset, previousPage, handleSubmit, tenantId, data, onSubmit,isLoading}) => { - +const MobileSearchApplication = ({ Controller, register, control, t, reset, previousPage, handleSubmit, tenantId, data, onSubmit, isLoading }) => { function activateModal(state, action) { switch (action.type) { case "set": return action.payload; case "remove": return false; - default: - break; } + default: + break; } - const [currentlyActiveMobileModal, setActiveMobileModal] = useReducer(activateModal, false); + } + const [currentlyActiveMobileModal, setActiveMobileModal] = useReducer(activateModal, false); - const closeMobilePopupModal = () => { - setActiveMobileModal({ type: "remove" }); - }; - const convertEpochToDate = (dateEpoch) => { - if (dateEpoch == null || dateEpoch == undefined || dateEpoch == "") { - return "NA"; - } - const dateFromApi = new Date(dateEpoch); - let month = dateFromApi.getMonth() + 1; - let day = dateFromApi.getDate(); - let year = dateFromApi.getFullYear(); - month = (month > 9 ? "" : "0") + month; - day = (day > 9 ? "" : "0") + day; - return `${day}/${month}/${year}`; - }; - const MobilePopUpCloseButton = () => ( -
- -
- ); - const searchFormFieldsComponentProps = { Controller, register, control, t, reset, previousPage }; + const closeMobilePopupModal = () => { + setActiveMobileModal({ type: "remove" }); + }; + const convertEpochToDate = (dateEpoch) => { + if (dateEpoch == null || dateEpoch == undefined || dateEpoch == "") { + return "NA"; + } + const dateFromApi = new Date(dateEpoch); + let month = dateFromApi.getMonth() + 1; + let day = dateFromApi.getDate(); + let year = dateFromApi.getFullYear(); + month = (month > 9 ? "" : "0") + month; + day = (day > 9 ? "" : "0") + day; + return `${day}/${month}/${year}`; + }; + const MobilePopUpCloseButton = () => ( +
+ +
+ ); + const searchFormFieldsComponentProps = { Controller, register, control, t, reset, previousPage }; - const MobileComponentDirectory = ({ currentlyActiveMobileModal, searchFormFieldsComponentProps, tenantId, ...props }) => { - const { closeMobilePopupModal } = props; - switch (currentlyActiveMobileModal) { - case "SearchFormComponent": - return ( - - -
-

{t("ABG_SEARCH_BILL_COMMON_HEADER")}:

-
- - {/* + const MobileComponentDirectory = ({ currentlyActiveMobileModal, searchFormFieldsComponentProps, tenantId, ...props }) => { + const { closeMobilePopupModal } = props; + switch (currentlyActiveMobileModal) { + case "SearchFormComponent": + return ( + + +
+

{t("ABG_SEARCH_BILL_COMMON_HEADER")}:

+
+ + {/*

{t(`ES_COMMON_CLEAR_ALL`)}

*/} -
- ); - default: - return ; - } - }; - const [tabledata,settabledata ]=useState([]); +
+ ); + default: + return ; + } + }; + const [tabledata, settabledata] = useState([]); const DownloadBtn = (props) => { return (
@@ -82,151 +82,146 @@ const MobileSearchApplication = ({ Controller, register, control, t, reset, prev
); }; - const handleExcelDownload = (tabData) => { - if(tabData?.[0] !== undefined){ - return Digit.Download.Excel(tabData?.[0] , "Bills"); - } - }; + const handleExcelDownload = (tabData) => { + if (tabData?.[0] !== undefined) { + return Digit.Download.Excel(tabData?.[0], "Bills"); + } + }; useEffect(() => { - if ( data?.length >0){ + if (data?.length > 0) { settabledata([ - - data?.map((obj)=> { - let returnObject={}; - returnObject[ t("ABG_COMMON_TABLE_COL_BILL_NO")]=obj?.billNumber; - returnObject[t("ABG_COMMON_TABLE_COL_CONSUMER_NAME")]=obj?.payerName; - returnObject[t("ABG_COMMON_TABLE_COL_BILL_DATE")]=convertEpochToDate(obj?.billDate); - returnObject[t("ABG_COMMON_TABLE_COL_BILL_AMOUNT")]=obj?.totalAmount; - returnObject[t("ABG_COMMON_TABLE_COL_STATUS")]=obj?.status; + data?.map((obj) => { + let returnObject = {}; + returnObject[t("ABG_COMMON_TABLE_COL_BILL_NO")] = obj?.billNumber; + returnObject[t("ABG_COMMON_TABLE_COL_CONSUMER_NAME")] = obj?.payerName; + returnObject[t("ABG_COMMON_TABLE_COL_BILL_DATE")] = convertEpochToDate(obj?.billDate); + returnObject[t("ABG_COMMON_TABLE_COL_BILL_AMOUNT")] = obj?.totalAmount; + returnObject[t("ABG_COMMON_TABLE_COL_STATUS")] = obj?.status; return { ...returnObject, - } - }) - ]) + }; + }), + ]); } }, [data]); - const CurrentMobileModalComponent = useCallback( - ({ currentlyActiveMobileModal, searchFormFieldsComponentProps, tenantId, ...props }) => - MobileComponentDirectory({ currentlyActiveMobileModal, searchFormFieldsComponentProps, tenantId, ...props }), - [currentlyActiveMobileModal] - ); - const GetCell = (value) => {value}; - const getBillLink = (row) => { - return ( -
- - {/* */} - {GetCell(getBillNumber(row?.businessService, row?.consumerCode, row?.billNumber))} - -
- ) + {GetCell(getBillNumber(row?.businessService, row?.consumerCode, row?.billNumber))} + + + ); + }; + const getActionItem = (original) => { + if (original?.totalAmount > 0) { + if (original?.status === "ACTIVE") { + return ( +
+ + + {t(`${"ABG_COLLECT"}`)} + + +
+ ); + } else if (original?.status === "CANCELLED" || original?.status === "EXPIRED") { + return ( +
+ + + {t(`${"ABG_GENERATE_NEW_BILL"}`)} + + +
+ ); + } else if (original?.status === "PAID") { + return ( + + ); + } + } else { + return GetCell(t(`${"CS_NA"}`)); } - const getActionItem = (original) => { - if (original?.totalAmount > 0) { - if (original?.status === "ACTIVE") { - return ( -
- - - {t(`${"ABG_COLLECT"}`)} - - -
- ); - } else if (original?.status === "CANCELLED" || original?.status === "EXPIRED") { - return ( -
- - - {t(`${"ABG_GENERATE_NEW_BILL"}`)} - - -
- ); - } else if (original?.status === "PAID") { - return ( - - ); - } - } else { - return GetCell(t(`${"CS_NA"}`)); - } - }; - const propsMobileInboxCards = useMemo( - () => { - if (data?.display){ - return [] - } - if(data === "") - { - return []; - } - return data?.map((row) => ({ - [t("ABG_COMMON_TABLE_COL_BILL_NO")]: getBillLink(row) , - [t("ABG_COMMON_TABLE_COL_CONSUMER_NAME")]: row?.user?.name? t(`${row?.user?.name}`) : "NA", - [t("ABG_COMMON_TABLE_COL_BILL_DATE")]: GetCell(convertEpochToDate(row?.billDate)), - [t("ABG_COMMON_TABLE_COL_BILL_AMOUNT")]: GetCell(row?.totalAmount||"NA"), - [t("ABG_COMMON_TABLE_COL_STATUS")]: GetCell(row?.status || "NA"), - [t("ABG_COMMON_TABLE_COL_ACTION")]: GetCell(getActionItem(row)), - })) - }, - [data] - ); + }; + const propsMobileInboxCards = useMemo(() => { + if (data?.display) { + return []; + } + if (data === "") { + return []; + } + return data?.map((row) => ({ + [t("ABG_COMMON_TABLE_COL_BILL_NO")]: getBillLink(row), + [t("ABG_COMMON_TABLE_COL_CONSUMER_NAME")]: row?.user?.name ? t(`${row?.user?.name}`) : "NA", + [t("ABG_COMMON_TABLE_COL_BILL_DATE")]: GetCell(convertEpochToDate(row?.billDate)), + [t("ABG_COMMON_TABLE_COL_BILL_AMOUNT")]: GetCell(row?.totalAmount || "NA"), + [t("ABG_COMMON_TABLE_COL_STATUS")]: GetCell(row?.status || "NA"), + [t("ABG_COMMON_TABLE_COL_ACTION")]: GetCell(getActionItem(row)), + })); + }, [data]); return ( -
- handleExcelDownload(tabledata)}/> +
+ handleExcelDownload(tabledata)} />
-
{t("ABG_SEARCH_BILL_COMMON_HEADER")}:
+
{t("ABG_SEARCH_BILL_COMMON_HEADER")}:
setActiveMobileModal({ type: "set", payload: "SearchFormComponent" })} - {...{tenantId, t}} + {...{ tenantId, t }} /> -
+
{currentlyActiveMobileModal ? ( ) : null} - {isLoading && } - -
- ) - } - - export default MobileSearchApplication + {isLoading && } + + + ); +}; + +export default MobileSearchApplication; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/bills/src/components/Search/index.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/bills/src/components/Search/index.js index 027601d15..a9c20e07b 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/bills/src/components/Search/index.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/bills/src/components/Search/index.js @@ -155,7 +155,7 @@ const SearchApplication = ({ showTable, showLoader, isLoading, tenantId, t, onSu [] ); const getActionItem = (status, row) => { - if (window.location.href.includes("/digit-ui/employee/bills/group-bill")) { + if (window.location.href.includes("/mgramseva-digit-ui/employee/bills/group-bill")) { return null; } switch (status) { @@ -165,7 +165,7 @@ const SearchApplication = ({ showTable, showLoader, isLoading, tenantId, t, onSu ); } else if (data && data?.length > 0) { - result = ; + result = ( + + ); } return ( diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/bills/src/components/inbox/ApplicationCard.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/bills/src/components/inbox/ApplicationCard.js index 53cdb8f75..d09f6372e 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/bills/src/components/inbox/ApplicationCard.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/bills/src/components/inbox/ApplicationCard.js @@ -56,7 +56,13 @@ export const ApplicationCard = ({ ); } else if (data && data?.length > 0) { - result = ; + result = ( + + ); } return ( diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/bills/src/components/inbox/BillsDesktopInbox.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/bills/src/components/inbox/BillsDesktopInbox.js index e9d17ebd0..5d9383987 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/bills/src/components/inbox/BillsDesktopInbox.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/bills/src/components/inbox/BillsDesktopInbox.js @@ -28,7 +28,7 @@ const BillsDesktopInbox = ({ tableConfig, filterComponent, ...props }) => { }; const columns = React.useMemo(() => { - if (window.location.href.includes("/digit-ui/employee/bills/group-bill")) { + if (window.location.href.includes("/mgramseva-digit-ui/employee/bills/group-bill")) { return [ { Header: t("ABG_COMMON_TABLE_COL_BILL_NO"), @@ -134,7 +134,7 @@ const BillsDesktopInbox = ({ tableConfig, filterComponent, ...props }) => { }, []); const getActionItem = (status, row) => { - if (window.location.href.includes("/digit-ui/employee/bills/group-bill")) { + if (window.location.href.includes("/mgramseva-digit-ui/employee/bills/group-bill")) { return null; } switch (status) { @@ -144,7 +144,7 @@ const BillsDesktopInbox = ({ tableConfig, filterComponent, ...props }) => { {t(`${"ABG_COLLECT"}`)}{" "} @@ -159,7 +159,7 @@ const BillsDesktopInbox = ({ tableConfig, filterComponent, ...props }) => { {t(`${"ABG_GENERATE_NEW_BILL"}`)} @@ -222,14 +222,14 @@ const BillsDesktopInbox = ({ tableConfig, filterComponent, ...props }) => { } const dynamicRoutes = () => { - if (window.location.href.includes("/digit-ui/employee/bills/group-bill")) { + if (window.location.href.includes("/mgramseva-digit-ui/employee/bills/group-bill")) { return ( { allLinks={[ { text: "ABG_COMMON_HEADER", - link: "/digit-ui/employee/bills/group-bill", + link: "/mgramseva-digit-ui/employee/bills/group-bill", }, ]} headerText={t("ACTION_TEST_BILLGENIE")} diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/bills/src/components/inbox/BillsMobileInbox.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/bills/src/components/inbox/BillsMobileInbox.js index 342cd29e5..7483dbebc 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/bills/src/components/inbox/BillsMobileInbox.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/bills/src/components/inbox/BillsMobileInbox.js @@ -61,7 +61,7 @@ const BillsMobileInbox = ({ {t(`${"ABG_GENERATE_NEW_BILL"}`)} diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/bills/src/pages/employee/BillDetailsv1.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/bills/src/pages/employee/BillDetailsv1.js index 3cad45d78..4d4820f17 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/bills/src/pages/employee/BillDetailsv1.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/bills/src/pages/employee/BillDetailsv1.js @@ -1,240 +1,261 @@ -import React, { Fragment,useState } from 'react' -import { Card, CardSectionHeader, Header, Loader, RadioButtons, Row, StatusTable, TextInput,ActionBar,SubmitBar } from "@egovernments/digit-ui-react-components"; -import { Link, useLocation } from "react-router-dom" +import React, { Fragment, useState } from "react"; +import { + Card, + CardSectionHeader, + Header, + Loader, + RadioButtons, + Row, + StatusTable, + TextInput, + ActionBar, + SubmitBar, +} from "@egovernments/digit-ui-react-components"; +import { Link, useLocation } from "react-router-dom"; import { useTranslation } from "react-i18next"; -import { BillDetailsConfig } from './BillDetailsConfig'; -import CancelBillModal from '../../components/CancelBill/CancelBillModal'; +import { BillDetailsConfig } from "./BillDetailsConfig"; +import CancelBillModal from "../../components/CancelBill/CancelBillModal"; import { useHistory } from "react-router-dom"; const BillDetailsv1 = (props) => { - const history = useHistory() - //serviceTYpe -> WS,SW - const { connectionNumber,service:serviceType,tenantId} = Digit.Hooks.useQueryParams(); - - const result = Digit.Hooks.useFetchBillsForBuissnessService( - { businessService: serviceType, ...{ consumerCode: connectionNumber }, tenantId } - ); - const fetchedBill = result?.data?.Bill?.[0] - - - const { state } = useLocation() - const { t } = useTranslation() - const bill = state - const config = BillDetailsConfig[bill?.businessService] - const getTotal = () => (bill?.totalAmount ? bill?.totalAmount : 0); - const arrears = - fetchedBill?.billDetails - ?.sort((a, b) => b.fromPeriod - a.fromPeriod) - ?.reduce((total, current, index) => (index === 0 ? total : total + current.amount), 0) || 0; - const yearWiseBills = fetchedBill?.billDetails?.sort((a, b) => b.fromPeriod - a.fromPeriod); - const billDetails = yearWiseBills?.[0] || []; - // let result = Digit.Hooks.ws.useSearchWS({ tenantId, filters: { connectionNumber, searchType:"CONNECTION"}, config, bussinessService: serviceType, t }); - // const fetchedBill = result?.billData?.[0] - - const { isLoading, isError, data: applicationDetails, error } = Digit.Hooks.ws.useConnectionDetail(t, tenantId, connectionNumber, serviceType==="WS"?"WATER":"SEWERAGE"); - - const [showModal, setShowModal] = useState(false) - const handleCancelBillAction = (_data) => { - setShowModal(false) - - const filters = { - tenantId, - consumerCodes: [bill?.consumerCode], - businessService: bill?.businessService, - statusToBeUpdated: "CANCELLED", - additionalDetails: { - reason: _data?.reason?.code, - description: _data?.details || "", - reasonMessage: t(_data?.reason?.message) - } - } - history.push("/digit-ui/employee/bills/response-cancelBill", { filters, bill }); - } + const history = useHistory(); + //serviceTYpe -> WS,SW + const { connectionNumber, service: serviceType, tenantId } = Digit.Hooks.useQueryParams(); - const getTranslatedValues = (dataValue, isNotTranslated) => { - if (dataValue) { - return !isNotTranslated ? t(dataValue) : dataValue; - } else { - return t("NA"); - } - }; + const result = Digit.Hooks.useFetchBillsForBuissnessService({ businessService: serviceType, ...{ consumerCode: connectionNumber }, tenantId }); + const fetchedBill = result?.data?.Bill?.[0]; + + const { state } = useLocation(); + const { t } = useTranslation(); + const bill = state; + const config = BillDetailsConfig[bill?.businessService]; + const getTotal = () => (bill?.totalAmount ? bill?.totalAmount : 0); + const arrears = + fetchedBill?.billDetails + ?.sort((a, b) => b.fromPeriod - a.fromPeriod) + ?.reduce((total, current, index) => (index === 0 ? total : total + current.amount), 0) || 0; + const yearWiseBills = fetchedBill?.billDetails?.sort((a, b) => b.fromPeriod - a.fromPeriod); + const billDetails = yearWiseBills?.[0] || []; + // let result = Digit.Hooks.ws.useSearchWS({ tenantId, filters: { connectionNumber, searchType:"CONNECTION"}, config, bussinessService: serviceType, t }); + // const fetchedBill = result?.billData?.[0] + + const { isLoading, isError, data: applicationDetails, error } = Digit.Hooks.ws.useConnectionDetail( + t, + tenantId, + connectionNumber, + serviceType === "WS" ? "WATER" : "SEWERAGE" + ); + + const [showModal, setShowModal] = useState(false); + const handleCancelBillAction = (_data) => { + setShowModal(false); - const getTextValue = (value) => { - if (value?.skip) return value.value; - else if (value?.isUnit) return value?.value ? `${getTranslatedValues(value?.value, value?.isNotTranslated)} ${t(value?.isUnit)}` : t("N/A"); - else return value?.value ? getTranslatedValues(value?.value, value?.isNotTranslated) : t("N/A"); + const filters = { + tenantId, + consumerCodes: [bill?.consumerCode], + businessService: bill?.businessService, + statusToBeUpdated: "CANCELLED", + additionalDetails: { + reason: _data?.reason?.code, + description: _data?.details || "", + reasonMessage: t(_data?.reason?.message), + }, }; + history.push("/mgramseva-digit-ui/employee/bills/response-cancelBill", { filters, bill }); + }; + + const getTranslatedValues = (dataValue, isNotTranslated) => { + if (dataValue) { + return !isNotTranslated ? t(dataValue) : dataValue; + } else { + return t("NA"); + } + }; + + const getTextValue = (value) => { + if (value?.skip) return value.value; + else if (value?.isUnit) return value?.value ? `${getTranslatedValues(value?.value, value?.isNotTranslated)} ${t(value?.isUnit)}` : t("N/A"); + else return value?.value ? getTranslatedValues(value?.value, value?.isNotTranslated) : t("N/A"); + }; + + const checkLocation = + window.location.href.includes("employee/tl") || window.location.href.includes("employee/obps") || window.location.href.includes("employee/noc"); + const isNocLocation = window.location.href.includes("employee/noc"); + const isBPALocation = window.location.href.includes("employee/obps"); + const isWS = window.location.href.includes("employee/ws"); - const checkLocation = - window.location.href.includes("employee/tl") || window.location.href.includes("employee/obps") || window.location.href.includes("employee/noc"); - const isNocLocation = window.location.href.includes("employee/noc"); - const isBPALocation = window.location.href.includes("employee/obps"); - const isWS = window.location.href.includes("employee/ws"); - - return ( - <> -
-
{t("ABG_BILL_DETAILS_HEADER")}
-
- {fetchedBill && !isLoading ? - <> - - {fetchedBill && - config?.details.map((obj, index) => { - const value = obj.keyPath.reduce((acc, key) => { - if (typeof key === "function") acc = key(acc); - else acc = acc[key]; - return acc; - }, fetchedBill); - return ; - })} - - - - {t("ABG_BILL_DETAILS_HEADER")} - -
- {billDetails?.billAccountDetails - ?.sort((a, b) => a.order - b.order) - .map((amountDetails, index) => ( - - ))} - - {arrears?.toFixed?.(2) ? ( - - ) : null} - -
+ return ( + <> +
+
{t("ABG_BILL_DETAILS_HEADER")}
+
+ {fetchedBill && !isLoading ? ( + + <> + + {fetchedBill && + config?.details.map((obj, index) => { + const value = obj.keyPath.reduce((acc, key) => { + if (typeof key === "function") acc = key(acc); + else acc = acc[key]; + return acc; + }, fetchedBill); + return ; + })} + + + + {t("ABG_BILL_DETAILS_HEADER")} + +
+ {billDetails?.billAccountDetails + ?.sort((a, b) => a.order - b.order) + .map((amountDetails, index) => ( + + ))} + + {arrears?.toFixed?.(2) ? ( + + ) : null} + +
+ +
+ + + {applicationDetails?.applicationDetails?.map((detail, index) => ( + +
+ {index === 0 && !detail.asSectionHeader ? ( + {t(detail.title)} + ) : ( + + + {isNocLocation ? `${t(detail.title)}` : t(detail.title)} + {detail?.Component ? : null} + + + )} + {/* TODO, Later will move to classes */} + {/* Here Render the table for adjustment amount details detail.isTable is true for that table*/} + {detail?.isTable && ( +
+ + {detail?.headers.map((header) => ( + + ))} + + {detail?.tableRows.map((row) => ( + + {row.map((element) => ( + + ))} + + ))} +
{t(header)}
{t(element)}
+ )} + + {detail?.title && + !detail?.title.includes("NOC") && + detail?.values?.map((value, index) => { + if (value.map === true && value.value !== "N/A") { + return } />; + } + if (value?.isLink == true) { + return ( + + + + {t(value?.title)} + + +
+ ) : isNocLocation || isBPALocation ? ( + `${t(value.title)}` + ) : ( + t(value.title) + ) + } + text={ +
+ + + {value?.value} + + +
+ } + last={index === detail?.values?.length - 1} + caption={value.caption} + className="border-none" + //rowContainerStyle={} + /> + ); + } + return ( - - - - {applicationDetails?.applicationDetails?.map((detail, index) => ( - -
- {index === 0 && !detail.asSectionHeader ? ( - {t(detail.title)} - ) : ( - - - {isNocLocation ? `${t(detail.title)}` : t(detail.title)} - {detail?.Component ? : null} - - - )} - {/* TODO, Later will move to classes */} - {/* Here Render the table for adjustment amount details detail.isTable is true for that table*/} - {detail?.isTable && ( - - - {detail?.headers.map(header => )} - - {detail?.tableRows.map(row => - {row.map(element => )} - )} -
{t(header)}
{t(element)}
- )} - - {detail?.title && - !detail?.title.includes("NOC") && - detail?.values?.map((value, index) => { - if (value.map === true && value.value !== "N/A") { - return } />; - } - if (value?.isLink == true) { - return ( - - - - {t(value?.title)} - - -
- ) : isNocLocation || isBPALocation ? ( - `${t(value.title)}` - ) : ( - t(value.title) - ) - } - text={ -
- - - {value?.value} - - -
- } - last={index === detail?.values?.length - 1} - caption={value.caption} - className="border-none" - //rowContainerStyle={} - /> - ); - } - return ( - - ); - })} - - -
- ))} - :} - - - setShowModal(true)}/> - - - - - - {showModal && setShowModal(false)} - actionCancelLabel={"ABG_BACK"} - actionCancelOnSubmit={() => setShowModal(false)} - actionSaveLabel={"ABG_CANCEL_BILL"} - actionSaveOnSubmit={handleCancelBillAction} - onSubmit={handleCancelBillAction} - > - } - - ) -} - -export default BillDetailsv1 \ No newline at end of file + ); + })} + + + + ))} + + ) : ( + + )} + + + setShowModal(true)} /> + + + {showModal && ( + setShowModal(false)} + actionCancelLabel={"ABG_BACK"} + actionCancelOnSubmit={() => setShowModal(false)} + actionSaveLabel={"ABG_CANCEL_BILL"} + actionSaveOnSubmit={handleCancelBillAction} + onSubmit={handleCancelBillAction} + > + )} + + ); +}; + +export default BillDetailsv1; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/bills/src/pages/employee/ResponseCancelBill.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/bills/src/pages/employee/ResponseCancelBill.js index e6c9855ab..86b521a5e 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/bills/src/pages/employee/ResponseCancelBill.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/bills/src/pages/employee/ResponseCancelBill.js @@ -1,36 +1,41 @@ -import { ActionBar, Banner, Card, CardText, Loader, SubmitBar } from "@egovernments/digit-ui-react-components" -import React, { useEffect } from "react" -import { useTranslation } from "react-i18next" -import { Link, useLocation } from "react-router-dom" +import { ActionBar, Banner, Card, CardText, Loader, SubmitBar } from "@egovernments/digit-ui-react-components"; +import React, { useEffect } from "react"; +import { useTranslation } from "react-i18next"; +import { Link, useLocation } from "react-router-dom"; const ResponseCancelBill = () => { - - const tenantId = Digit.ULBService.getCurrentTenantId(); - const { state } = useLocation() - const { t } = useTranslation() - - const {filters,currentBill, bill} = state + const tenantId = Digit.ULBService.getCurrentTenantId(); + const { state } = useLocation(); + const { t } = useTranslation(); - const { isLoading: hookLoading, data, ...rest } = Digit.Hooks.useCancelBill({ - filters: { ...filters }, - }); - - return
- {hookLoading ? : - - {!hookLoading && data?.Message ? {t("COMMON_RESPONSE_SUCCESS_MESSAGE_CANCEL_BILL")} : null} - - - - - - } + const { filters, currentBill, bill } = state; + + const { isLoading: hookLoading, data, ...rest } = Digit.Hooks.useCancelBill({ + filters: { ...filters }, + }); + + return ( +
+ {hookLoading ? ( + + ) : ( + + + {!hookLoading && data?.Message ? {t("COMMON_RESPONSE_SUCCESS_MESSAGE_CANCEL_BILL")} : null} + + + + + + + )}
-} + ); +}; -export default ResponseCancelBill \ No newline at end of file +export default ResponseCancelBill; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/bills/src/pages/employee/index.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/bills/src/pages/employee/index.js index 9eaeb5de0..85548cc28 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/bills/src/pages/employee/index.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/bills/src/pages/employee/index.js @@ -1,4 +1,4 @@ -import { PrivateRoute,BreadCrumb } from "@egovernments/digit-ui-react-components"; +import { PrivateRoute, BreadCrumb } from "@egovernments/digit-ui-react-components"; import React from "react"; import { useTranslation } from "react-i18next"; import { Link, Switch, useLocation } from "react-router-dom"; @@ -16,48 +16,46 @@ const BILLSBreadCrumbs = ({ location }) => { const { t } = useTranslation(); const search = useLocation().search; - + const fromScreen = new URLSearchParams(search).get("from") || null; const crumbs = [ { - path: "/digit-ui/employee", + path: "/mgramseva-digit-ui/employee", content: t("ES_COMMON_HOME"), show: true, }, { - path: "/digit-ui/employee/bills/cancel-bill", + path: "/mgramseva-digit-ui/employee/bills/cancel-bill", content: t("ABG_CANCEL_BILL"), show: location.pathname.includes("/cancel-bill") ? true : false, }, { - path: "/digit-ui/employee/bills/bill-details", + path: "/mgramseva-digit-ui/employee/bills/bill-details", content: fromScreen ? `${t(fromScreen)} / ${t("ABG_BILL_DETAILS_HEADER")}` : t("ABG_BILL_DETAILS_HEADER"), show: location.pathname.includes("/bill-details") ? true : false, isBack: fromScreen && true, }, { - path: "/digit-ui/employee/bills/group-bill", + path: "/mgramseva-digit-ui/employee/bills/group-bill", content: t("ABG_COMMON_HEADER"), show: location.pathname.includes("/group-bill") ? true : false, }, { - path: "/digit-ui/employee/bills/inbox", + path: "/mgramseva-digit-ui/employee/bills/inbox", content: t("ABG_SEARCH_BILL_COMMON_HEADER"), show: location.pathname.includes("/inbox") ? true : false, }, { - path: "/digit-ui/employee/bills/download-bill-pdf", + path: "/mgramseva-digit-ui/employee/bills/download-bill-pdf", content: t("ABG_VIEW_DOWNLOADS_HEADER"), show: location.pathname.includes("/download-bill-pdf") ? true : false, - } - + }, ]; return ; }; - const EmployeeApp = ({ path, url, userType }) => { const { t } = useTranslation(); const location = useLocation(); @@ -122,14 +120,8 @@ const EmployeeApp = ({ path, url, userType }) => { path={`${path}/cancel-bill`} component={() => } /> - } - /> - } - /> + } /> + } />
diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/common/src/payments/employee/index.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/common/src/payments/employee/index.js index fb36975de..dd9d7f0a2 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/common/src/payments/employee/index.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/common/src/payments/employee/index.js @@ -27,9 +27,9 @@ const EmployeePayment = ({ stateCode, cityCode, moduleCode }) => { return (

- {t("ES_COMMON_HOME")} - {isFsm ? / {t("ES_TITLE_FSM")} : null} - {isFsm ? / {t("ES_TITLE_INBOX")} : null}/ {link} + {t("ES_COMMON_HOME")} + {isFsm ? / {t("ES_TITLE_FSM")} : null} + {isFsm ? / {t("ES_TITLE_INBOX")} : null}/ {link}

diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/common/src/payments/employee/response/index.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/common/src/payments/employee/response/index.js index e1bfc545b..152a754c3 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/common/src/payments/employee/response/index.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/common/src/payments/employee/response/index.js @@ -41,9 +41,9 @@ export const SuccessfulPayment = (props) => { useEffect(() => { switch (selectedAction) { case "GO_TO_HOME": - return history.push("/digit-ui/employee"); + return history.push("/mgramseva-digit-ui/employee"); case "ASSIGN_TO_DSO": - return history.push(`/digit-ui/employee/fsm/application-details/${consumerCode}`); + return history.push(`/mgramseva-digit-ui/employee/fsm/application-details/${consumerCode}`); default: return null; } @@ -173,9 +173,9 @@ export const SuccessfulPayment = (props) => { const printDisconnectionRecipet = async () => { let tenantid = tenantId ? tenantId : Digit.ULBService.getCurrentTenantId(); - let consumercode = window.location.href.substring(window.location.href.lastIndexOf(consumerCode),window.location.href.lastIndexOf("?")); + let consumercode = window.location.href.substring(window.location.href.lastIndexOf(consumerCode), window.location.href.lastIndexOf("?")); await Digit.Utils.downloadReceipt(consumercode, businessService, "consolidatedreceipt", tenantid); - } + }; if (businessService?.includes("BPA") && isBpaSearchLoading) return ; @@ -186,7 +186,11 @@ export const SuccessfulPayment = (props) => { {getCardText()} {generatePdfKey ? (
-
+
@@ -245,7 +249,7 @@ export const SuccessfulPayment = (props) => { ) : ( - + @@ -268,7 +272,7 @@ export const FailedPayment = (props) => { {t("ES_PAYMENT_FAILED_DETAILS")} - + diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/commonPt/src/components/CommonPTCard.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/commonPt/src/components/CommonPTCard.js index 6d3eb2301..6e76e3081 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/commonPt/src/components/CommonPTCard.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/commonPt/src/components/CommonPTCard.js @@ -15,8 +15,8 @@ const CommonPTCard = () => { links: [ { label: t("PT_SEARCH_AND_PAY"), - link: `/digit-ui/employee/commonpt/search`, - } + link: `/mgramseva-digit-ui/employee/commonpt/search`, + }, ], }; @@ -24,7 +24,7 @@ const CommonPTCard = () => { if (PT_CEMP && !propsForModuleCard.links?.[1]) { propsForModuleCard.links.push({ label: t("PT_CREATE_PROPERTY"), - link: `/digit-ui/employee/commonpt/new-application`, + link: `/mgramseva-digit-ui/employee/commonpt/new-application`, }); } diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/commonPt/src/components/search/CPTPropertySearchForm.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/commonPt/src/components/search/CPTPropertySearchForm.js index e99930824..6e9b54ec1 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/commonPt/src/components/search/CPTPropertySearchForm.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/commonPt/src/components/search/CPTPropertySearchForm.js @@ -1,38 +1,42 @@ -import { CardLabelError, SearchField, SearchForm, SubmitBar, TextInput,Localities } from "@egovernments/digit-ui-react-components"; +import { CardLabelError, SearchField, SearchForm, SubmitBar, TextInput, Localities } from "@egovernments/digit-ui-react-components"; import React, { useState, useEffect } from "react"; import { Controller, useForm } from "react-hook-form"; - const SwitchComponent = (props) => { return (
{props.keys.map((key) => ( - {key === "searchDetail" && !(sessionStorage.getItem("searchDetailValue"))?sessionStorage.setItem("searchDetailValue",1):""; key==="searchId" && sessionStorage.getItem("searchDetailValue") == 1?sessionStorage.setItem("searchDetailValue",2):""; props.onSwitch(key);props.onReset();}}> + { + key === "searchDetail" && !sessionStorage.getItem("searchDetailValue") ? sessionStorage.setItem("searchDetailValue", 1) : ""; + key === "searchId" && sessionStorage.getItem("searchDetailValue") == 1 ? sessionStorage.setItem("searchDetailValue", 2) : ""; + props.onSwitch(key); + props.onReset(); + }} + > {props.t(`PT_SEARCH_BY_${key?.toUpperCase()}`)} ))}
); }; -const SearchPTID = ({ tenantId, t, onSubmit, onReset, searchBy, PTSearchFields, setSearchBy ,payload}) => { - const { register, control, handleSubmit, setValue, watch,getValues, reset, formState } = useForm({ +const SearchPTID = ({ tenantId, t, onSubmit, onReset, searchBy, PTSearchFields, setSearchBy, payload }) => { + const { register, control, handleSubmit, setValue, watch, getValues, reset, formState } = useForm({ defaultValues: { ...payload, - } + }, }); const formValue = watch(); const fields = PTSearchFields?.[searchBy] || {}; useEffect(() => { - if(sessionStorage.getItem("isCreateEnabledEmployee") === "true") - { + if (sessionStorage.getItem("isCreateEnabledEmployee") === "true") { sessionStorage.removeItem("isCreateEnabledEmployee"); - history.replace("/digit-ui/employee"); - } - else - sessionStorage.removeItem("isCreateEnabledEmployee"); - - }) + history.replace("/mgramseva-digit-ui/employee"); + } else sessionStorage.removeItem("isCreateEnabledEmployee"); + }); return (
@@ -44,60 +48,64 @@ const SearchPTID = ({ tenantId, t, onSubmit, onReset, searchBy, PTSearchFields, let validation = field?.validation || {}; return ( - - {field?.type==="custom"? - ( - { - props.onChange(d); - }} - tenantId={tenantId} - selected={formValue?.[key]} - {...field.customCompProps} + + {field?.type === "custom" ? ( + ( + { + props.onChange(d); + }} + tenantId={tenantId} + selected={formValue?.[key]} + {...field.customCompProps} + /> + )} /> + ) : ( +
+ {field?.componentInFront ? ( + + {field?.componentInFront} + + ) : null} + +
)} - /> - : -
- {field?.componentInFront ? ( - - {field?.componentInFront} - - ) : null} - -
} {t(formState?.errors?.[key]?.message)}
); })} -
- -

{ - onReset({}); - }} - > - {t(`ES_COMMON_CLEAR_ALL`)} -

-
- - - -
+
+ +

{ + onReset({}); + }} + > + {t(`ES_COMMON_CLEAR_ALL`)} +

+
+ + + +
); diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/commonPt/src/components/search/CPTPropertySearchResults.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/commonPt/src/components/search/CPTPropertySearchResults.js index 373679ccf..254980cc5 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/commonPt/src/components/search/CPTPropertySearchResults.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/commonPt/src/components/search/CPTPropertySearchResults.js @@ -10,8 +10,10 @@ const SearchPTID = ({ tenantId, t, payload, showToast, setShowToast, ptSearchCon const { state } = useLocation(); const search = useLocation().search; const urlPropertyId = new URLSearchParams(search).get("propertyId"); - let urlParams = window.location.href.includes("&")? window.location.href.substring(window.location.href.indexOf("&")+1,window.location.href.length) : ""; - + let urlParams = window.location.href.includes("&") + ? window.location.href.substring(window.location.href.indexOf("&") + 1, window.location.href.length) + : ""; + const [searchQuery, setSearchQuery] = useState({ /* ...defaultValues, to enable pagination */ ...payload, @@ -36,7 +38,7 @@ const SearchPTID = ({ tenantId, t, payload, showToast, setShowToast, ptSearchCon onClick={() => { //sessionStorage.setItem("propertyDetailsBC",JSON.stringify({...state})) history.push( - `/digit-ui/employee/commonpt/view-property?propertyId=${row.original["propertyId"]}&tenantId=${tenantId}&redirectToUrl=${redirectToUrl}`, + `/mgramseva-digit-ui/employee/commonpt/view-property?propertyId=${row.original["propertyId"]}&tenantId=${tenantId}&redirectToUrl=${redirectToUrl}`, { ...state } ); }} @@ -81,7 +83,12 @@ const SearchPTID = ({ tenantId, t, payload, showToast, setShowToast, ptSearchCon { //sessionStorage.setItem("propertyDetailsBC",JSON.stringify({...state})) - history.push(urlParams ? `${redirectToUrl}?${urlParams?.replace(urlPropertyId,row.original["propertyId"])}` : `${redirectToUrl}?propertyId=${row.original["propertyId"]}&tenantId=${tenantId}`, { ...state }); + history.push( + urlParams + ? `${redirectToUrl}?${urlParams?.replace(urlPropertyId, row.original["propertyId"])}` + : `${redirectToUrl}?propertyId=${row.original["propertyId"]}&tenantId=${tenantId}`, + { ...state } + ); const scrollConst = redirectToUrl?.includes("employee/tl") ? 1600 : 300; setTimeout(() => window.scrollTo(0, scrollConst), 400); }} diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/commonPt/src/pages/employee/index.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/commonPt/src/pages/employee/index.js index 92aeef7a9..09cc8704e 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/commonPt/src/pages/employee/index.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/commonPt/src/pages/employee/index.js @@ -15,10 +15,10 @@ const EmployeeApp = ({ path, url, userType }) => { const mobileView = innerWidth <= 640; const breadcrumbObj = { - ["/digit-ui/employee/pt/inbox"]: "ES_TITLE_INBOX", - ["/digit-ui/employee/pt/new-application"]: "ES_TITLE_NEW_PROPERTY_APPLICATION", - ["/digit-ui/employee/pt/search"]: "ES_COMMON_SEARCH", - ["/digit-ui/employee/pt/application-search"]: "ES_COMMON_APPLICATION_SEARCH", + ["/mgramseva-digit-ui/employee/pt/inbox"]: "ES_TITLE_INBOX", + ["/mgramseva-digit-ui/employee/pt/new-application"]: "ES_TITLE_NEW_PROPERTY_APPLICATION", + ["/mgramseva-digit-ui/employee/pt/search"]: "ES_COMMON_SEARCH", + ["/mgramseva-digit-ui/employee/pt/application-search"]: "ES_COMMON_APPLICATION_SEARCH", }; const getBreadCrumb = () => { @@ -49,19 +49,22 @@ const EmployeeApp = ({ path, url, userType }) => { const crumbs = [ { - path: "/digit-ui/employee", + path: "/mgramseva-digit-ui/employee", content: t("ES_COMMON_HOME"), show: true, }, { - path: { pathname: urlpropertyId ? `${redirectUrl}?propertyId=${urlpropertyId}&tenantId=${urltenantId}` : redirectUrl, state: { ...location.state } }, + path: { + pathname: urlpropertyId ? `${redirectUrl}?propertyId=${urlpropertyId}&tenantId=${urltenantId}` : redirectUrl, + state: { ...location.state }, + }, content: redirectUrl ? getRedirectBreadCrumb(redirectUrl) : (fromScreen && t(fromScreen)) || "NONE", show: (redirectUrl || fromScreen) && true, isBack: fromScreen && true, isredirected: true, }, { - path: "/digit-ui/employee/dss/drilldown", + path: "/mgramseva-digit-ui/employee/dss/drilldown", content: getBreadCrumb(), show: true, }, @@ -74,7 +77,7 @@ const EmployeeApp = ({ path, url, userType }) => {
{/*

- + {t("ES_COMMON_HOME")} {" "} / {getBreadCrumb()} diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/commonPt/src/pages/pageComponents/PropertySearchNSummary.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/commonPt/src/pages/pageComponents/PropertySearchNSummary.js index 2741050fb..f70f5125c 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/commonPt/src/pages/pageComponents/PropertySearchNSummary.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/commonPt/src/pages/pageComponents/PropertySearchNSummary.js @@ -33,22 +33,31 @@ const PropertySearchNSummary = ({ config, onSelect, userType, formData, setError const isEditScreen = pathname.includes("/modify-application/"); const tenantId = Digit.ULBService.getCurrentTenantId(); const isEmpNewApplication = window.location.href.includes("/employee/tl/new-application"); - const isEmpRenewLicense = window.location.href.includes("/employee/tl/renew-application-details") || window.location.href.includes("/employee/tl/edit-application-details"); + const isEmpRenewLicense = + window.location.href.includes("/employee/tl/renew-application-details") || window.location.href.includes("/employee/tl/edit-application-details"); const search = useLocation().search; const urlPropertyId = new URLSearchParams(search).get("propertyId"); - const [propertyId, setPropertyId] = useState(formData?.cptId?.id || (urlPropertyId !== "null" ?urlPropertyId:"") || ""); - const [searchPropertyId, setSearchPropertyId] = useState(urlPropertyId !== "null" ?urlPropertyId:""); + const [propertyId, setPropertyId] = useState(formData?.cptId?.id || (urlPropertyId !== "null" ? urlPropertyId : "") || ""); + const [searchPropertyId, setSearchPropertyId] = useState(urlPropertyId !== "null" ? urlPropertyId : ""); const [showToast, setShowToast] = useState(null); const isMobile = window.Digit.Utils.browser.isMobile(); - const serachParams = window.location.href.includes("?")? window.location.href.substring(window.location.href.indexOf("?")+1,window.location.href.length) : ""; + const serachParams = window.location.href.includes("?") + ? window.location.href.substring(window.location.href.indexOf("?") + 1, window.location.href.length) + : ""; const { isLoading, isError, error, data: propertyDetails } = Digit.Hooks.pt.usePropertySearch( { filters: { propertyIds: searchPropertyId }, tenantId: tenantId }, - { filters: { propertyIds: searchPropertyId }, tenantId: tenantId, enabled: searchPropertyId ? true : false, privacy : Digit.Utils.getPrivacyObject() } + { + filters: { propertyIds: searchPropertyId }, + tenantId: tenantId, + enabled: searchPropertyId ? true : false, + privacy: Digit.Utils.getPrivacyObject(), + } ); useEffect(() => { - if (propertyId && (window.location.href.includes("/renew-application-details/") || window.location.href.includes("/edit-application-details/"))) setSearchPropertyId(propertyId); + if (propertyId && (window.location.href.includes("/renew-application-details/") || window.location.href.includes("/edit-application-details/"))) + setSearchPropertyId(propertyId); }, [propertyId]); useEffect(() => { @@ -65,14 +74,12 @@ const PropertySearchNSummary = ({ config, onSelect, userType, formData, setError setShowToast({ error: true, label: "PT_ENTER_PROPERTY_ID_AND_SEARCH" }); } setSearchPropertyId(propertyId); - if(window.location.pathname.includes("/tl/new-application")){ - history.push(`/digit-ui/employee/tl/new-application?propertyId=${propertyId}`) - const scrollConst = 1600 + if (window.location.pathname.includes("/tl/new-application")) { + history.push(`/mgramseva-digit-ui/employee/tl/new-application?propertyId=${propertyId}`); + const scrollConst = 1600; setTimeout(() => window.scrollTo(0, scrollConst), 0); - } - - else if (window.location.pathname.includes("/ws/new-application")) - history.push(`/digit-ui/employee/ws/new-application?propertyId=${propertyId}`) + } else if (window.location.pathname.includes("/ws/new-application")) + history.push(`/mgramseva-digit-ui/employee/ws/new-application?propertyId=${propertyId}`); }; if (isEditScreen) { @@ -88,114 +95,136 @@ const PropertySearchNSummary = ({ config, onSelect, userType, formData, setError } const getInputStyles = () => { if (window.location.href.includes("/ws/")) { - return { fontWeight: "700" } + return { fontWeight: "700" }; } else return {}; - } + }; const getOwnerNames = (propertyData) => { - const getActiveOwners = propertyData?.owners?.filter(owner => owner?.active); - const getOwnersList = getActiveOwners?.map(activeOwner => activeOwner?.name)?.join(","); + const getActiveOwners = propertyData?.owners?.filter((owner) => owner?.active); + const getOwnersList = getActiveOwners?.map((activeOwner) => activeOwner?.name)?.join(","); return getOwnersList ? getOwnersList : t("NA"); - } + }; let clns = ""; - if (window.location.href.includes("/ws/")) clns = ":" + if (window.location.href.includes("/ws/")) clns = ":"; return ( - {(window.location.href.includes("/tl/") ? (!(formData?.tradedetils?.[0]?.structureType?.code === "MOVABLE") && (isEmpNewApplication || isEmpRenewLicense) ) : true) &&

- - {`${t(`PROPERTY_ID`)}`} -
- { - setPropertyId(e.target.value); - onSelect(config.key, { id: e.target.value }); - }} - style={{ width: "80%", float: "left", marginRight: "20px" }} - /> - -
-
- history.push(`/digit-ui/employee/commonpt/search?redirectToUrl=${redirectBackUrl}&${serachParams}`, { ...state })}> - - -   |   - history.push(`/digit-ui/employee/commonpt/new-application?redirectToUrl=${redirectBackUrl}&${serachParams}`, { ...state })}> - - - {propertyDetails && propertyDetails?.Properties.length ? ( - -
- {t("PT_DETAILS")} -
- -
- - - {/* */} - { - let resultString = (_.get(res,"Properties[0].address.doorNo") ? `${_.get(res,"Properties[0].address.doorNo")}, ` : "") + (_.get(res,"Properties[0].address.street")? `${_.get(res,"Properties[0].address.street")}, ` : "") + (_.get(res,"Properties[0].address.landmark") ? `${_.get(res,"Properties[0].address.landmark")}`:"") - return resultString; - }, - isArray: false, - }, - - }} + {(window.location.href.includes("/tl/") + ? !(formData?.tradedetils?.[0]?.structureType?.code === "MOVABLE") && (isEmpNewApplication || isEmpRenewLicense) + : true) && ( +
+ + {`${t(`PROPERTY_ID`)}`} +
+ { + setPropertyId(e.target.value); + onSelect(config.key, { id: e.target.value }); + }} + style={{ width: "80%", float: "left", marginRight: "20px" }} /> +
- - - - - - ) : null} - {showToast && ( - { - setShowToast(null); - }} - /> +
+ + history.push(`/mgramseva-digit-ui/employee/commonpt/search?redirectToUrl=${redirectBackUrl}&${serachParams}`, { ...state }) + } + > + + +   |   + + history.push(`/mgramseva-digit-ui/employee/commonpt/new-application?redirectToUrl=${redirectBackUrl}&${serachParams}`, { ...state }) + } + > + + + {propertyDetails && propertyDetails?.Properties.length ? ( + +
+ {t("PT_DETAILS")} +
+ +
+ + + {/* */} + { + let resultString = + (_.get(res, "Properties[0].address.doorNo") ? `${_.get(res, "Properties[0].address.doorNo")}, ` : "") + + (_.get(res, "Properties[0].address.street") ? `${_.get(res, "Properties[0].address.street")}, ` : "") + + (_.get(res, "Properties[0].address.landmark") ? `${_.get(res, "Properties[0].address.landmark")}` : ""); + return resultString; + }, + isArray: false, + }, + }} + /> +
+
+ + + +
+ ) : null} + {showToast && ( + { + setShowToast(null); + }} + /> + )} +
)} -
}
); }; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/commonPt/src/pages/pageComponents/ViewProperty.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/commonPt/src/pages/pageComponents/ViewProperty.js index c32fb9707..6ec815928 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/commonPt/src/pages/pageComponents/ViewProperty.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/commonPt/src/pages/pageComponents/ViewProperty.js @@ -1,5 +1,5 @@ import { Header, ActionBar, SubmitBar } from "@egovernments/digit-ui-react-components"; -import React, {useEffect} from "react"; +import React, { useEffect } from "react"; import { useTranslation } from "react-i18next"; import { useHistory } from "react-router-dom"; import { useLocation, Link } from "react-router-dom"; @@ -31,19 +31,22 @@ const ViewProperty = () => { const onSubmit = () => { const scrollConst = redirectToUrl?.includes("employee/tl") ? 1600 : 300; setTimeout(() => window.scrollTo(0, scrollConst), 400); - return history.push(`${redirectToUrl}?propertyId=${propertyId}&tenantId=${applicationDetails?.tenantId || tenantId}${state?.data?.applicationDetails?.applicationStatus === "PENDING_FOR_FIELD_INSPECTION" ? `&applicationNumber=${state?.data?.applicationDetails?.applicationNo}&service=${state?.data?.applicationDetails?.applicationData?.serviceType}`:``}`, { ...state }); + return history.push( + `${redirectToUrl}?propertyId=${propertyId}&tenantId=${applicationDetails?.tenantId || tenantId}${ + state?.data?.applicationDetails?.applicationStatus === "PENDING_FOR_FIELD_INSPECTION" + ? `&applicationNumber=${state?.data?.applicationDetails?.applicationNo}&service=${state?.data?.applicationDetails?.applicationData?.serviceType}` + : `` + }`, + { ...state } + ); }; useEffect(() => { - if(sessionStorage.getItem("isCreateEnabledEmployee") === "true") - { + if (sessionStorage.getItem("isCreateEnabledEmployee") === "true") { sessionStorage.removeItem("isCreateEnabledEmployee"); - history.replace("/digit-ui/employee"); - } - else - sessionStorage.removeItem("isCreateEnabledEmployee"); - - }) + history.replace("/mgramseva-digit-ui/employee"); + } else sessionStorage.removeItem("isCreateEnabledEmployee"); + }); return (
diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/App.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/App.js index ef794c9e6..cf4e80ff0 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/App.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/App.js @@ -28,11 +28,11 @@ export const DigitApp = ({ stateCode, modules, appTenants, logoUrl, initData }) if (!pathname?.includes("dss")) { Digit.SessionStorage.del("DSS_FILTERS"); } - if (pathname?.toString() === "/digit-ui/employee") { + if (pathname?.toString() === "/mgramseva-digit-ui/employee") { Digit.SessionStorage.del("SEARCH_APPLICATION_DETAIL"); Digit.SessionStorage.del("WS_EDIT_APPLICATION_DETAILS"); } - if (pathname?.toString() === "/digit-ui/citizen" || pathname?.toString() === "/digit-ui/employee") { + if (pathname?.toString() === "/digit-ui/citizen" || pathname?.toString() === "/mgramseva-digit-ui/employee") { Digit.SessionStorage.del("WS_DISCONNECTION"); } }, [pathname]); @@ -65,14 +65,14 @@ export const DigitApp = ({ stateCode, modules, appTenants, logoUrl, initData }) }; return ( - + - + - + ); diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/AppModules.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/AppModules.js index f12a70eab..aa9ef57a2 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/AppModules.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/AppModules.js @@ -21,7 +21,7 @@ export const AppModules = ({ stateCode, userType, modules, appTenants }) => { const user = Digit.UserService.getUser(); if (!user || !user?.access_token || !user?.info) { - return ; + return ; } const appRoutes = modules.map(({ code, tenants }, index) => { @@ -30,9 +30,11 @@ export const AppModules = ({ stateCode, userType, modules, appTenants }) => { - ) : - - ; + ) : ( + + + + ); }); return ( @@ -40,7 +42,7 @@ export const AppModules = ({ stateCode, userType, modules, appTenants }) => { {appRoutes} - + diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/ChangeCity.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/ChangeCity.js index 28827051f..aa09e1f0f 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/ChangeCity.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/ChangeCity.js @@ -21,7 +21,7 @@ const ChangeCity = (prop) => { const handleChangeCity = (city) => { const loggedInData = Digit.SessionStorage.get("citizen.userRequestObject"); - const filteredRoles = Digit.SessionStorage.get("citizen.userRequestObject")?.info?.roles?.filter(role => role.tenantId === city.value); + const filteredRoles = Digit.SessionStorage.get("citizen.userRequestObject")?.info?.roles?.filter((role) => role.tenantId === city.value); if (filteredRoles?.length > 0) { loggedInData.info.roles = filteredRoles; loggedInData.info.tenantId = city?.value; @@ -29,8 +29,8 @@ const ChangeCity = (prop) => { Digit.SessionStorage.set("Employee.tenantId", city?.value); Digit.UserService.setUser(loggedInData); setDropDownData(city); - if (window.location.href.includes("/digit-ui/employee/")) { - const redirectPath = location.state?.from || "/digit-ui/employee"; + if (window.location.href.includes("/mgramseva-digit-ui/employee/")) { + const redirectPath = location.state?.from || "/mgramseva-digit-ui/employee"; history.replace(redirectPath); } window.location.reload(); @@ -38,29 +38,34 @@ const ChangeCity = (prop) => { useEffect(() => { const userloggedValues = Digit.SessionStorage.get("citizen.userRequestObject"); - let teantsArray = [], filteredArray = []; - userloggedValues?.info?.roles?.forEach(role => teantsArray.push(role.tenantId)); + let teantsArray = [], + filteredArray = []; + userloggedValues?.info?.roles?.forEach((role) => teantsArray.push(role.tenantId)); let unique = teantsArray.filter((item, i, ar) => ar.indexOf(item) === i); - unique?.forEach(uniCode => { + unique?.forEach((uniCode) => { filteredArray.push({ label: prop?.t(`TENANT_TENANTS_${stringReplaceAll(uniCode, ".", "_")?.toUpperCase()}`), - value: uniCode - }) + value: uniCode, + }); }); - selectedCities = filteredArray?.filter(select => select.value == Digit.SessionStorage.get("Employee.tenantId")); + selectedCities = filteredArray?.filter((select) => select.value == Digit.SessionStorage.get("Employee.tenantId")); setSelectCityData(filteredArray); }, [dropDownData]); // if (isDropdown) { return ( -
+
cityValue.value === dropDownData?.value)} optionKey={"label"} select={handleChangeCity} freeze={true} - customSelector={} + customSelector={ + + } />
); diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/ErrorBoundaries.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/ErrorBoundaries.js index 0140781bc..74a403811 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/ErrorBoundaries.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/ErrorBoundaries.js @@ -2,14 +2,14 @@ import React from "react"; import ErrorComponent from "./ErrorComponent"; const Redircter = () => { - const path = Digit.UserService.getType() === "employee" ? "/digit-ui/employee/user/error" : "/digit-ui/citizen/error"; + const path = Digit.UserService.getType() === "employee" ? "/mgramseva-digit-ui/employee/user/error" : "/digit-ui/citizen/error"; if ( window.location.href.includes("employee/user/error") || window.location.href.includes("citizen/error") || process.env.NODE_ENV === "development" ) { //do nothing - }else{ + } else { window.location.href = path; } return ; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/TopBarSideBar/SideBar/CitizenSideBar.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/TopBarSideBar/SideBar/CitizenSideBar.js index 5f957dd04..12fbe3ad8 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/TopBarSideBar/SideBar/CitizenSideBar.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/TopBarSideBar/SideBar/CitizenSideBar.js @@ -1,6 +1,4 @@ -import { - Loader, NavBar -} from "@egovernments/digit-ui-react-components"; +import { Loader, NavBar } from "@egovernments/digit-ui-react-components"; import React, { useState } from "react"; import { useTranslation } from "react-i18next"; import { useHistory } from "react-router-dom"; @@ -88,7 +86,16 @@ const PoweredBy = () => ( /* Feature :: Citizen Webview sidebar */ -export const CitizenSideBar = ({ isOpen, isMobile = false, toggleSidebar, onLogout, isEmployee = false, linkData, islinkDataLoading, isSideBarScroll }) => { +export const CitizenSideBar = ({ + isOpen, + isMobile = false, + toggleSidebar, + onLogout, + isEmployee = false, + linkData, + islinkDataLoading, + isSideBarScroll, +}) => { const { data: storeData, isFetched } = Digit.Hooks.useStore.getInitData(); const { stateInfo } = storeData || {}; const user = Digit.UserService.getUser(); @@ -104,7 +111,7 @@ export const CitizenSideBar = ({ isOpen, isMobile = false, toggleSidebar, onLogo const { isLoading, data } = Digit.Hooks.useAccessControl(); const tenantId = Digit.ULBService.getCitizenCurrentTenant(); const showProfilePage = () => { - const redirectUrl = isEmployee ? "/digit-ui/employee/user/profile" : "/digit-ui/citizen/user/profile"; + const redirectUrl = isEmployee ? "/mgramseva-digit-ui/employee/user/profile" : "/digit-ui/citizen/user/profile"; history.push(redirectUrl); closeSidebar(); }; @@ -218,22 +225,24 @@ export const CitizenSideBar = ({ isOpen, isMobile = false, toggleSidebar, onLogo menuItems.splice(1, 0, { type: "dynamic", moduleName: t(`ACTION_TEST_${getParentDisplayName}`), - links: configEmployeeSideBar[keys[i]]?.map((ob) => {return {...ob, displayName: t(`ACTION_TEST_${ob?.displayName?.toUpperCase()?.replace(/[ -]/g, "_")}`)}}), + links: configEmployeeSideBar[keys[i]]?.map((ob) => { + return { ...ob, displayName: t(`ACTION_TEST_${ob?.displayName?.toUpperCase()?.replace(/[ -]/g, "_")}`) }; + }), icon: configEmployeeSideBar[keys[i]][1]?.leftIcon, }); } } - const indx = menuItems.findIndex(a => a.element === "HOME"); - const home = menuItems.splice(indx,1); - const comp = menuItems.findIndex(a => a.element === "LANGUAGE"); - const part = menuItems.splice(comp,menuItems?.length-comp); - menuItems.sort((a,b) => { + const indx = menuItems.findIndex((a) => a.element === "HOME"); + const home = menuItems.splice(indx, 1); + const comp = menuItems.findIndex((a) => a.element === "LANGUAGE"); + const part = menuItems.splice(comp, menuItems?.length - comp); + menuItems.sort((a, b) => { let c1 = a?.type === "dynamic" ? a?.moduleName : a?.text; let c2 = b?.type === "dynamic" ? b?.moduleName : b?.text; - return c1.localeCompare(c2) - } ); - home?.[0] && menuItems.splice(0,0,home[0]); - menuItems = part?.length > 0 ? menuItems.concat(part) : menuItems; + return c1.localeCompare(c2); + }); + home?.[0] && menuItems.splice(0, 0, home[0]); + menuItems = part?.length > 0 ? menuItems.concat(part) : menuItems; } /* URL with openlink wont have sidebar and actions */ diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/TopBarSideBar/SideBar/EmployeeSideBar.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/TopBarSideBar/SideBar/EmployeeSideBar.js index 82698e20e..23be73d3c 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/TopBarSideBar/SideBar/EmployeeSideBar.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/TopBarSideBar/SideBar/EmployeeSideBar.js @@ -42,24 +42,31 @@ const EmployeeSideBar = () => { //creating the object structure from mdms value for easy iteration let configEmployeeSideBar1 = {}; - data?.actions?.filter((e) => e.url === "url")?.forEach((item) => { - _.set(configEmployeeSideBar1,item.path,{...item}) - }) + data?.actions + ?.filter((e) => e.url === "url") + ?.forEach((item) => { + _.set(configEmployeeSideBar1, item.path, { ...item }); + }); data?.actions .filter((e) => e.url === "url") .forEach((item) => { let index = item.path.split(".")[0]; if (search == "" && item.path !== "") { - index = item.path.split(".")[0]; + index = item.path.split(".")[0]; if (index === "TradeLicense") index = "Trade License"; if (!configEmployeeSideBar[index]) { configEmployeeSideBar[index] = [item]; } else { configEmployeeSideBar[index].push(item); } - } else if (item.path !== "" && t(`ACTION_TEST_${index?.toUpperCase()?.replace(/[ -]/g, "_")}`)?.toLowerCase().includes(search.toLowerCase())) { - index = item.path.split(".")[0]; + } else if ( + item.path !== "" && + t(`ACTION_TEST_${index?.toUpperCase()?.replace(/[ -]/g, "_")}`) + ?.toLowerCase() + .includes(search.toLowerCase()) + ) { + index = item.path.split(".")[0]; if (index === "TradeLicense") index = "Trade License"; if (!configEmployeeSideBar[index]) { configEmployeeSideBar[index] = [item]; @@ -71,20 +78,19 @@ const EmployeeSideBar = () => { let res = []; //method is used for restructing of configEmployeeSideBar1 nested object into nested array object - function restructuringOfConfig (tempconfig){ + function restructuringOfConfig(tempconfig) { const result = []; - for(const key in tempconfig){ - const value= tempconfig[key]; - if(typeof value === "object" && !(value?.id)){ - const children = restructuringOfConfig(value); - result.push({label : key,children, icon:children?.[0]?.icon, to:""}); - } - else{ - result.push({label: key, value, icon:value?.leftIcon, to: key === "Home" ? "/digit-ui/employee" : value?.navigationURL}); + for (const key in tempconfig) { + const value = tempconfig[key]; + if (typeof value === "object" && !value?.id) { + const children = restructuringOfConfig(value); + result.push({ label: key, children, icon: children?.[0]?.icon, to: "" }); + } else { + result.push({ label: key, value, icon: value?.leftIcon, to: key === "Home" ? "/mgramseva-digit-ui/employee" : value?.navigationURL }); } } - return result + return result; } const splitKeyValue = () => { const keys = Object.keys(configEmployeeSideBar); @@ -92,7 +98,7 @@ const EmployeeSideBar = () => { for (let i = 0; i < keys.length; i++) { if (configEmployeeSideBar[keys[i]][0].path.indexOf(".") === -1) { if (configEmployeeSideBar[keys[i]][0].displayName === "Home") { - const homeURL = "/digit-ui/employee"; + const homeURL = "/mgramseva-digit-ui/employee"; res.unshift({ moduleName: keys[i].toUpperCase(), icon: configEmployeeSideBar[keys[i]][0], @@ -116,18 +122,15 @@ const EmployeeSideBar = () => { }); } } - if(res.find(a => a.moduleName === "HOME")) - { + if (res.find((a) => a.moduleName === "HOME")) { //res.splice(0,1); - const indx = res.findIndex(a => a.moduleName === "HOME"); - const home = res?.filter((ob) => ob?.moduleName === "HOME") - let res1 = res?.filter((ob) => ob?.moduleName !== "HOME") - res = res1.sort((a,b) => a.moduleName.localeCompare(b.moduleName)); + const indx = res.findIndex((a) => a.moduleName === "HOME"); + const home = res?.filter((ob) => ob?.moduleName === "HOME"); + let res1 = res?.filter((ob) => ob?.moduleName !== "HOME"); + res = res1.sort((a, b) => a.moduleName.localeCompare(b.moduleName)); home?.[0] && res.unshift(home[0]); - } - else - { - res.sort((a,b) => a.moduleName.localeCompare(b.moduleName)); + } else { + res.sort((a, b) => a.moduleName.localeCompare(b.moduleName)); } //reverting the newsidebar change for now, in order to solve ndss login issue //let newconfig = restructuringOfConfig(configEmployeeSideBar1); diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/TopBarSideBar/index.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/TopBarSideBar/index.js index 032522774..66a4414ec 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/TopBarSideBar/index.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/TopBarSideBar/index.js @@ -29,12 +29,12 @@ const TopBarSideBar = ({ const handleOnSubmit = () => { Digit.UserService.logout(); setShowDialog(false); - } + }; const handleOnCancel = () => { setShowDialog(false); - } + }; const userProfile = () => { - history.push("/digit-ui/employee/user/profile"); + history.push("/mgramseva-digit-ui/employee/user/profile"); }; const userOptions = [ { name: t("EDIT_PROFILE"), icon: , func: userProfile }, @@ -59,9 +59,7 @@ const TopBarSideBar = ({ logoUrl={logoUrl} showLanguageChange={showLanguageChange} /> - {showDialog && ( - - )} + {showDialog && } {showSidebar && ( ); }; -export default TopBarSideBar; \ No newline at end of file +export default TopBarSideBar; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/config/employee-sidebar-menu.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/config/employee-sidebar-menu.js index 719bd0d65..760499262 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/config/employee-sidebar-menu.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/config/employee-sidebar-menu.js @@ -20,11 +20,11 @@ const EmployeeSideBarMenu = (t, HRMS, FSM, PT, mCollect, DSS, RECEIPTS, TL, NOC, links: [ { label: t("HR_HOME_SEARCH_RESULTS_HEADING"), - link: `/digit-ui/employee/hrms/inbox`, + link: `/mgramseva-digit-ui/employee/hrms/inbox`, }, { label: t("HR_COMMON_CREATE_EMPLOYEE_HEADER"), - link: `/digit-ui/employee/hrms/create`, + link: `/mgramseva-digit-ui/employee/hrms/create`, }, ], }, @@ -34,7 +34,7 @@ const EmployeeSideBarMenu = (t, HRMS, FSM, PT, mCollect, DSS, RECEIPTS, TL, NOC, links: [ { label: t("ES_COMMON_INBOX"), - link: `/digit-ui/employee/fsm/inbox`, + link: `/mgramseva-digit-ui/employee/fsm/inbox`, }, ], }, @@ -46,11 +46,11 @@ const EmployeeSideBarMenu = (t, HRMS, FSM, PT, mCollect, DSS, RECEIPTS, TL, NOC, links: [ { label: t("UC_SEARCH_CHALLAN_LABEL"), - link: `/digit-ui/employee/mcollect/inbox`, + link: `/mgramseva-digit-ui/employee/mcollect/inbox`, }, { label: t("UC_GENERATE_NEW_CHALLAN"), - link: `/digit-ui/employee/mcollect/new-application`, + link: `/mgramseva-digit-ui/employee/mcollect/new-application`, }, ], }, @@ -65,11 +65,11 @@ const EmployeeSideBarMenu = (t, HRMS, FSM, PT, mCollect, DSS, RECEIPTS, TL, NOC, links: [ { label: t("ES_TITLE_INBOX"), - link: `/digit-ui/employee/engagement/messages/inbox`, + link: `/mgramseva-digit-ui/employee/engagement/messages/inbox`, }, { label: t("NEW_PUBLIC_MESSAGE_BUTTON_LABEL"), - link: `/digit-ui/employee/engagement/messages/create`, + link: `/mgramseva-digit-ui/employee/engagement/messages/create`, }, ], }, @@ -79,11 +79,11 @@ const EmployeeSideBarMenu = (t, HRMS, FSM, PT, mCollect, DSS, RECEIPTS, TL, NOC, links: [ { label: t("ES_TITLE_INBOX"), - link: `/digit-ui/employee/engagement/surveys/inbox`, + link: `/mgramseva-digit-ui/employee/engagement/surveys/inbox`, }, { label: t("CS_COMMON_NEW_SURVEY"), - link: `/digit-ui/employee/engagement/surveys/create`, + link: `/mgramseva-digit-ui/employee/engagement/surveys/create`, }, ], }, @@ -93,11 +93,11 @@ const EmployeeSideBarMenu = (t, HRMS, FSM, PT, mCollect, DSS, RECEIPTS, TL, NOC, links: [ { label: t("ES_TITLE_INBOX"), - link: `/digit-ui/employee/engagement/event/inbox`, + link: `/mgramseva-digit-ui/employee/engagement/event/inbox`, }, { label: t("ES_TITLE_NEW_EVENTS"), - link: `/digit-ui/employee/engagement/event/new-event`, + link: `/mgramseva-digit-ui/employee/engagement/event/new-event`, }, ], }, @@ -107,11 +107,11 @@ const EmployeeSideBarMenu = (t, HRMS, FSM, PT, mCollect, DSS, RECEIPTS, TL, NOC, links: [ { label: t("ES_TITLE_INBOX"), - link: `/digit-ui/employee/engagement/documents/inbox`, + link: `/mgramseva-digit-ui/employee/engagement/documents/inbox`, }, { label: t("NEW_DOCUMENT_TEXT"), - link: `/digit-ui/employee/engagement/documents/new-doc`, + link: `/mgramseva-digit-ui/employee/engagement/documents/new-doc`, }, ], }, @@ -122,7 +122,7 @@ const EmployeeSideBarMenu = (t, HRMS, FSM, PT, mCollect, DSS, RECEIPTS, TL, NOC, links: [ { label: t("CR_SEARCH_COMMON_HEADER"), - link: `/digit-ui/employee/receipts/inbox`, + link: `/mgramseva-digit-ui/employee/receipts/inbox`, }, ], }, @@ -138,11 +138,11 @@ const EmployeeSideBarMenu = (t, HRMS, FSM, PT, mCollect, DSS, RECEIPTS, TL, NOC, links: [ { label: t("ES_COMMON_INBOX"), - link: `/digit-ui/employee/noc/inbox`, + link: `/mgramseva-digit-ui/employee/noc/inbox`, }, { label: t("ES_COMMON_SEARCH"), - link: `/digit-ui/employee/noc/search`, + link: `/mgramseva-digit-ui/employee/noc/search`, }, ], }, @@ -153,7 +153,7 @@ const EmployeeSideBarMenu = (t, HRMS, FSM, PT, mCollect, DSS, RECEIPTS, TL, NOC, links: [ { label: t("ES_COMMON_INBOX"), - link: "/digit-ui/employee/fsm/fstp-inbox", + link: "/mgramseva-digit-ui/employee/fsm/fstp-inbox", }, ], }, diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/config/sidebar-menu.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/config/sidebar-menu.js index 79ddee07f..cdef2ea2c 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/config/sidebar-menu.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/config/sidebar-menu.js @@ -4,48 +4,48 @@ import ChangeLanguage from "../components/ChangeLanguage"; const SideBarMenu = (t, closeSidebar, redirectToLoginPage, isEmployee, storeData, tenantId) => { let filteredTenantData = storeData?.tenants.filter((e) => e.code === tenantId)[0]?.contactNumber || storeData?.tenants[0]?.contactNumber; -return [ - { - type: "link", - element: "HOME", - text: t("COMMON_BOTTOM_NAVIGATION_HOME"), - link: isEmployee ? "/digit-ui/employee" : "/digit-ui/citizen", - icon: "HomeIcon", - populators: { - onClick: closeSidebar, + return [ + { + type: "link", + element: "HOME", + text: t("COMMON_BOTTOM_NAVIGATION_HOME"), + link: isEmployee ? "/mgramseva-digit-ui/employee" : "/digit-ui/citizen", + icon: "HomeIcon", + populators: { + onClick: closeSidebar, + }, }, - }, - { - type: "component", - element: "LANGUAGE", - action: , - icon: "LanguageIcon", - }, - { - id: "login-btn", - element: "LOGIN", - text: t("CORE_COMMON_LOGIN"), - icon: "LoginIcon", - populators: { - onClick: redirectToLoginPage, + { + type: "component", + element: "LANGUAGE", + action: , + icon: "LanguageIcon", }, - }, - { - id: "help-line", - text: ( - - {t("CS_COMMON_HELPLINE")} -
-
- {filteredTenantData} + { + id: "login-btn", + element: "LOGIN", + text: t("CORE_COMMON_LOGIN"), + icon: "LoginIcon", + populators: { + onClick: redirectToLoginPage, + }, + }, + { + id: "help-line", + text: ( + + {t("CS_COMMON_HELPLINE")} + -
- - ), - element: "Helpline", - icon: "Phone", - }, -] + + ), + element: "Helpline", + icon: "Phone", + }, + ]; }; export default SideBarMenu; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/citizen/Home/UserProfile.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/citizen/Home/UserProfile.js index 730599c30..7d45c6ddb 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/citizen/Home/UserProfile.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/citizen/Home/UserProfile.js @@ -107,61 +107,61 @@ const UserProfile = ({ stateCode, userType, cityDetails }) => { const setUserName = (value) => { setName(value); - if(!new RegExp(/^[a-zA-Z ]+$/i).test(value) || value.length === 0 || value.length > 50){ - setErrors({...errors, userName : {type: "pattern", message: t("CORE_COMMON_PROFILE_NAME_INVALID")}}); - }else{ - setErrors({...errors, userName : null}) + if (!new RegExp(/^[a-zA-Z ]+$/i).test(value) || value.length === 0 || value.length > 50) { + setErrors({ ...errors, userName: { type: "pattern", message: t("CORE_COMMON_PROFILE_NAME_INVALID") } }); + } else { + setErrors({ ...errors, userName: null }); } - } + }; const setUserEmailAddress = (value) => { setEmail(value); - if(value.length && /*!(value.includes("@") && value.includes("."))*/ !(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(value))){ - setErrors({...errors, emailAddress: {type: "pattern", message: t("CORE_COMMON_PROFILE_EMAIL_INVALID")}}) - }else{ - setErrors({...errors, emailAddress : null}) + if (value.length && /*!(value.includes("@") && value.includes("."))*/ !/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(value)) { + setErrors({ ...errors, emailAddress: { type: "pattern", message: t("CORE_COMMON_PROFILE_EMAIL_INVALID") } }); + } else { + setErrors({ ...errors, emailAddress: null }); } - } + }; const setUserMobileNumber = (value) => { setMobileNo(value); if (userType === "employee" && !new RegExp(/^[6-9]{1}[0-9]{9}$/).test(value)) { - setErrors({...errors, mobileNumber: {type: 'pattern', message: t("CORE_COMMON_PROFILE_MOBILE_NUMBER_INVALID")}}) - }else{ - setErrors({...errors, mobileNumber: null}); + setErrors({ ...errors, mobileNumber: { type: "pattern", message: t("CORE_COMMON_PROFILE_MOBILE_NUMBER_INVALID") } }); + } else { + setErrors({ ...errors, mobileNumber: null }); } - } + }; const setUserCurrentPassword = (value) => { setCurrentPassword(value); if (!new RegExp(/^([a-zA-Z0-9@#$%]{8,15})$/i).test(value)) { - setErrors({...errors, currentPassword: {type: "pattern", message: t("CORE_COMMON_PROFILE_PASSWORD_INVALID")}}) - }else{ - setErrors({...errors, currentPassword: null}); + setErrors({ ...errors, currentPassword: { type: "pattern", message: t("CORE_COMMON_PROFILE_PASSWORD_INVALID") } }); + } else { + setErrors({ ...errors, currentPassword: null }); } - } + }; const setUserNewPassword = (value) => { setNewPassword(value); if (!new RegExp(/^([a-zA-Z0-9@#$%]{8,15})$/i).test(value)) { - setErrors({...errors, newPassword: {type: "pattern", message: t("CORE_COMMON_PROFILE_PASSWORD_INVALID")}}) - }else{ - setErrors({...errors, newPassword: null}); + setErrors({ ...errors, newPassword: { type: "pattern", message: t("CORE_COMMON_PROFILE_PASSWORD_INVALID") } }); + } else { + setErrors({ ...errors, newPassword: null }); } - } + }; const setUserConfirmPassword = (value) => { setConfirmPassword(value); if (!new RegExp(/^([a-zA-Z0-9@#$%]{8,15})$/i).test(value)) { - setErrors({...errors, confirmPassword: {type: "pattern", message: t("CORE_COMMON_PROFILE_PASSWORD_INVALID")}}) - }else{ - setErrors({...errors, confirmPassword: null}); + setErrors({ ...errors, confirmPassword: { type: "pattern", message: t("CORE_COMMON_PROFILE_PASSWORD_INVALID") } }); + } else { + setErrors({ ...errors, confirmPassword: null }); } - } + }; const removeProfilePic = () => { setProfilePic(null); @@ -194,7 +194,7 @@ const UserProfile = ({ stateCode, userType, cityDetails }) => { throw JSON.stringify({ type: "error", message: t("CORE_COMMON_PROFILE_MOBILE_NUMBER_INVALID") }); } - if (email.length && !(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email))) { + if (email.length && !/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email)) { throw JSON.stringify({ type: "error", message: t("CORE_COMMON_PROFILE_EMAIL_INVALID") }); } @@ -211,7 +211,7 @@ const UserProfile = ({ stateCode, userType, cityDetails }) => { throw JSON.stringify({ type: "error", message: t("CORE_COMMON_PROFILE_PASSWORD_INVALID") }); } } - requestData["locale"]=Digit.StoreData.getCurrentLanguage(); + requestData["locale"] = Digit.StoreData.getCurrentLanguage(); const { responseInfo, user } = await Digit.UserService.updateUser(requestData, stateCode); if (responseInfo && responseInfo.status === "200") { @@ -311,12 +311,12 @@ const UserProfile = ({ stateCode, userType, cityDetails }) => { { boxShadow: userType === "citizen" ? "" : "1px 1px 4px 0px rgba(0,0,0,0.2)", background: "white", padding: userType === "citizen" ? "8px" : "24px", - paddingBottom : "20px", + paddingBottom: "20px", }} > {userType === "citizen" ? ( {`${t("CORE_COMMON_PROFILE_NAME")}`}* -
+
{ isMandatory={false} name="name" value={name} - onChange={(e)=>setUserName(e.target.value)} + onChange={(e) => setUserName(e.target.value)} {...(validation = { isRequired: true, pattern: "^[a-zA-Z-.`' ]*$", @@ -442,13 +442,13 @@ const UserProfile = ({ stateCode, userType, cityDetails }) => { optionKey="i18nKey" name="email" value={email} - onChange={(e)=>setUserEmailAddress(e.target.value)} + onChange={(e) => setUserEmailAddress(e.target.value)} disable={editScreen} /> {errors?.emailAddress && {errors?.emailAddress?.message} }
- + */} - history.push(`/digit-ui/employee/engagement/surveys/inbox/details/${surveyId}`)}> - {t("VIEW_SURVEY_QUESTIONS")} + history.push(`/mgramseva-digit-ui/employee/engagement/surveys/inbox/details/${surveyId}`)}> + {t("VIEW_SURVEY_QUESTIONS")} - - - - - - - - - - - + + + + + + + + + +
- ) -} + ); +}; -export default SurveyDetailsView \ No newline at end of file +export default SurveyDetailsView; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/pages/employee/CitizenSurveys/Inbox/index.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/pages/employee/CitizenSurveys/Inbox/index.js index 007447839..de6902f4b 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/pages/employee/CitizenSurveys/Inbox/index.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/pages/employee/CitizenSurveys/Inbox/index.js @@ -1,4 +1,4 @@ -import React, { Fragment, useCallback, useMemo, useReducer } from "react" +import React, { Fragment, useCallback, useMemo, useReducer } from "react"; import { InboxComposer, DocumentIcon } from "@egovernments/digit-ui-react-components"; import { useTranslation } from "react-i18next"; import FilterFormFieldsComponent from "./FilterFieldsComponent"; @@ -7,131 +7,175 @@ import useInboxTableConfig from "./useInboxTableConfig"; import useInboxMobileCardsData from "./useInboxMobileDataCard"; // import { useHistory } from "react-router-dom"; const Inbox = ({ parentRoute }) => { - - const { t } = useTranslation() + const { t } = useTranslation(); // const history = useHistory() const tenantId = Digit.ULBService.getCurrentTenantId(); const ulbs = Digit.SessionStorage.get("ENGAGEMENT_TENANTS"); const userInfo = Digit.UserService.getUser().info; - const userUlbs = ulbs - .filter((ulb) => userInfo?.roles?.some((role) => role?.tenantId === ulb?.code)) - + const userUlbs = ulbs.filter((ulb) => userInfo?.roles?.some((role) => role?.tenantId === ulb?.code)); + const statuses = [ { code: "ALL", name: `${t("ES_COMMON_ALL")}` }, { code: "ACTIVE", name: `${t("ES_COMMON_ACTIVE")}` }, - { code: "INACTIVE", name: `${t("ES_COMMON_INACTIVE")}` } - ] + { code: "INACTIVE", name: `${t("ES_COMMON_INACTIVE")}` }, + ]; const searchFormDefaultValues = { // tenantIds: tenantId, - tenantIds:userUlbs[0], + tenantIds: userUlbs[0], postedBy: "", - title: "" - } + title: "", + }; const filterFormDefaultValues = { - status: statuses[0] - } + status: statuses[0], + }; const tableOrderFormDefaultValues = { sortBy: "", limit: 10, offset: 0, - sortOrder: "DESC" - } + sortOrder: "DESC", + }; function formReducer(state, payload) { switch (payload.action) { case "mutateSearchForm": - Digit.SessionStorage.set("CITIZENSURVEY.INBOX", { ...state, searchForm: payload.data }) + Digit.SessionStorage.set("CITIZENSURVEY.INBOX", { ...state, searchForm: payload.data }); return { ...state, searchForm: payload.data }; case "mutateFilterForm": - Digit.SessionStorage.set("CITIZENSURVEY.INBOX", { ...state, filterForm: payload.data }) + Digit.SessionStorage.set("CITIZENSURVEY.INBOX", { ...state, filterForm: payload.data }); return { ...state, filterForm: payload.data }; case "mutateTableForm": - Digit.SessionStorage.set("CITIZENSURVEY.INBOX", { ...state, tableForm: payload.data }) + Digit.SessionStorage.set("CITIZENSURVEY.INBOX", { ...state, tableForm: payload.data }); return { ...state, tableForm: payload.data }; default: break; } } - const InboxObjectInSessionStorage = Digit.SessionStorage.get("CITIZENSURVEY.INBOX") - + const InboxObjectInSessionStorage = Digit.SessionStorage.get("CITIZENSURVEY.INBOX"); + const onSearchFormReset = (setSearchFormValue) => { - setSearchFormValue("postedBy", "") - setSearchFormValue("title", "") - setSearchFormValue("tenantIds", tenantId) - dispatch({ action: "mutateSearchForm", data: searchFormDefaultValues }) - } + setSearchFormValue("postedBy", ""); + setSearchFormValue("title", ""); + setSearchFormValue("tenantIds", tenantId); + dispatch({ action: "mutateSearchForm", data: searchFormDefaultValues }); + }; const onFilterFormReset = (setFilterFormValue) => { - setFilterFormValue("status", statuses[0]) - dispatch({ action: "mutateFilterForm", data: filterFormDefaultValues }) - } + setFilterFormValue("status", statuses[0]); + dispatch({ action: "mutateFilterForm", data: filterFormDefaultValues }); + }; const formInitValue = useMemo(() => { - return InboxObjectInSessionStorage || { - filterForm: filterFormDefaultValues, - searchForm: searchFormDefaultValues, - tableForm: tableOrderFormDefaultValues - } - } - , [Object.values(InboxObjectInSessionStorage?.filterForm || {}), Object.values(InboxObjectInSessionStorage?.searchForm || {}), Object.values(InboxObjectInSessionStorage?.tableForm || {})]) - - const [formState, dispatch] = useReducer(formReducer, formInitValue) + return ( + InboxObjectInSessionStorage || { + filterForm: filterFormDefaultValues, + searchForm: searchFormDefaultValues, + tableForm: tableOrderFormDefaultValues, + } + ); + }, [ + Object.values(InboxObjectInSessionStorage?.filterForm || {}), + Object.values(InboxObjectInSessionStorage?.searchForm || {}), + Object.values(InboxObjectInSessionStorage?.tableForm || {}), + ]); + + const [formState, dispatch] = useReducer(formReducer, formInitValue); const onPageSizeChange = (e) => { - dispatch({ action: "mutateTableForm", data: { ...formState.tableForm, limit: e.target.value } }) - } + dispatch({ action: "mutateTableForm", data: { ...formState.tableForm, limit: e.target.value } }); + }; - - const { data: { Surveys, TotalCount } = {}, isLoading: isInboxLoading, } = Digit.Hooks.survey.useSurveyInbox(formState) + const { data: { Surveys, TotalCount } = {}, isLoading: isInboxLoading } = Digit.Hooks.survey.useSurveyInbox(formState); const PropsForInboxLinks = { logoIcon: , headerText: "CS_COMMON_SURVEYS", - links: [{ - text: t("CS_COMMON_NEW_SURVEY"), - link: "/digit-ui/employee/engagement/surveys/inbox/create", - }] - } - - const SearchFormFields = useCallback(({ registerRef, searchFormState, controlSearchForm }) => , []) + links: [ + { + text: t("CS_COMMON_NEW_SURVEY"), + link: "/mgramseva-digit-ui/employee/engagement/surveys/inbox/create", + }, + ], + }; + + const SearchFormFields = useCallback( + ({ registerRef, searchFormState, controlSearchForm }) => , + [] + ); const FilterFormFields = useCallback( - ({ registerRef, controlFilterForm, setFilterFormValue, getFilterFormValue }) => - , [statuses]) - - + ({ registerRef, controlFilterForm, setFilterFormValue, getFilterFormValue }) => ( + + ), + [statuses] + ); + const onSearchFormSubmit = (data) => { //setting the offset to 0(In case searched from page other than 1) - dispatch({ action: "mutateTableForm", data: { ...formState.tableForm, offset:0 } }) + dispatch({ action: "mutateTableForm", data: { ...formState.tableForm, offset: 0 } }); - data.hasOwnProperty("") ? delete data?.[""] : null - dispatch({ action: "mutateSearchForm", data }) - } + data.hasOwnProperty("") ? delete data?.[""] : null; + dispatch({ action: "mutateSearchForm", data }); + }; const onFilterFormSubmit = (data) => { - data.hasOwnProperty("") ? delete data?.[""] : null - dispatch({ action: "mutateFilterForm", data }) - } - - const propsForSearchForm = { SearchFormFields, onSearchFormSubmit, searchFormDefaultValues: formState?.searchForm, resetSearchFormDefaultValues: searchFormDefaultValues, onSearchFormReset } - - const propsForFilterForm = { FilterFormFields, onFilterFormSubmit, filterFormDefaultValues: formState?.filterForm, resetFilterFormDefaultValues: filterFormDefaultValues, onFilterFormReset } - - const propsForInboxTable = useInboxTableConfig({ ...{ parentRoute, onPageSizeChange, formState, totalCount: TotalCount, table: Surveys, noResultsMessage: "CS_SURVEYS_NOT_FOUND", dispatch, inboxStyles:{overflowX:"scroll", overflowY:"hidden"} } }) - - const propsForInboxMobileCards = useInboxMobileCardsData({parentRoute, table:Surveys}) - - return - -} - -export default Inbox \ No newline at end of file + data.hasOwnProperty("") ? delete data?.[""] : null; + dispatch({ action: "mutateFilterForm", data }); + }; + + const propsForSearchForm = { + SearchFormFields, + onSearchFormSubmit, + searchFormDefaultValues: formState?.searchForm, + resetSearchFormDefaultValues: searchFormDefaultValues, + onSearchFormReset, + }; + + const propsForFilterForm = { + FilterFormFields, + onFilterFormSubmit, + filterFormDefaultValues: formState?.filterForm, + resetFilterFormDefaultValues: filterFormDefaultValues, + onFilterFormReset, + }; + + const propsForInboxTable = useInboxTableConfig({ + ...{ + parentRoute, + onPageSizeChange, + formState, + totalCount: TotalCount, + table: Surveys, + noResultsMessage: "CS_SURVEYS_NOT_FOUND", + dispatch, + inboxStyles: { overflowX: "scroll", overflowY: "hidden" }, + }, + }); + + const propsForInboxMobileCards = useInboxMobileCardsData({ parentRoute, table: Surveys }); + + return ( + + ); +}; + +export default Inbox; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/pages/employee/CitizenSurveys/NewSurvey.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/pages/employee/CitizenSurveys/NewSurvey.js index dbd9663e1..02eccb98a 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/pages/employee/CitizenSurveys/NewSurvey.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/pages/employee/CitizenSurveys/NewSurvey.js @@ -14,38 +14,54 @@ export const answerTypeEnum = { Time: "TIME_ANSWER_TYPE", }; - /**TODO NRJ-egov handle this by setting correct state inside the surveyFormMaker */ -export const mapQuestions = (questions =[],initialData) =>{ - //Added this condition to avoid a bug in which the question type is set as undefined when question type dropdown is not touched and create survey form is submitted. - questions = questions.map(ques=>{ - if(!ques?.formConfig?.type){ +export const mapQuestions = (questions = [], initialData) => { + //Added this condition to avoid a bug in which the question type is set as undefined when question type dropdown is not touched and create survey form is submitted. + questions = questions.map((ques) => { + if (!ques?.formConfig?.type) { return { ...ques, - formConfig: { ...ques?.formConfig, type:"Short Answer"} - } + formConfig: { ...ques?.formConfig, type: "Short Answer" }, + }; } - return ques - }) - if(!questions.length) return; + return ques; + }); + if (!questions.length) return; let newmappedQues = []; - newmappedQues = questions.map(({formConfig},index)=>{ - const {options:choices, questionStatement,required, type:stringType, uuid, qorder} = formConfig; - const finalQuestion = {questionStatement,uuid : uuid ? uuid : null, qorder, status : "ACTIVE", required, type: typeof stringType === "object" && stringType !== null ? stringType.value : (stringType.title ? answerTypeEnum[stringType.title] : answerTypeEnum[stringType])}; - if((stringType?.title === "Multiple Choice" || stringType?.value === "MULTIPLE_ANSWER_TYPE") || (stringType?.title ==="Check Boxes" || stringType?.value === "CHECKBOX_ANSWER_TYPE")) { - finalQuestion["options"] = choices; - } - return finalQuestion; - }) - - initialData && initialData?.questions?.map((ques) => { - let found = newmappedQues.length > 0 ? newmappedQues.some(el => el.uuid === ques?.uuid) : false; - if(!found) newmappedQues.push({...ques,status:"INACTIVE"}); - }) + newmappedQues = questions.map(({ formConfig }, index) => { + const { options: choices, questionStatement, required, type: stringType, uuid, qorder } = formConfig; + const finalQuestion = { + questionStatement, + uuid: uuid ? uuid : null, + qorder, + status: "ACTIVE", + required, + type: + typeof stringType === "object" && stringType !== null + ? stringType.value + : stringType.title + ? answerTypeEnum[stringType.title] + : answerTypeEnum[stringType], + }; + if ( + stringType?.title === "Multiple Choice" || + stringType?.value === "MULTIPLE_ANSWER_TYPE" || + stringType?.title === "Check Boxes" || + stringType?.value === "CHECKBOX_ANSWER_TYPE" + ) { + finalQuestion["options"] = choices; + } + return finalQuestion; + }); + + initialData && + initialData?.questions?.map((ques) => { + let found = newmappedQues.length > 0 ? newmappedQues.some((el) => el.uuid === ques?.uuid) : false; + if (!found) newmappedQues.push({ ...ques, status: "INACTIVE" }); + }); return newmappedQues; - -} +}; const NewSurveys = () => { const { t } = useTranslation(); @@ -58,45 +74,38 @@ const NewSurveys = () => { setTimeout(() => { closeToast(); }, 10000); - + const onSubmit = (data) => { const { collectCitizenInfo, title, description, tenantIds, fromDate, toDate, fromTime, toTime, questions } = data; const mappedQuestions = mapQuestions(questions); const details = { SurveyEntity: { - tenantIds: tenantIds.map(({code})=>(code)), + tenantIds: tenantIds.map(({ code }) => code), title, description, startDate: new Date(`${fromDate} ${fromTime}`).getTime(), endDate: new Date(`${toDate} ${toTime}`).getTime(), - questions:mappedQuestions + questions: mappedQuestions, }, }; - - try{ - let filters = {tenantIds : tenantIds?.[0]?.code, title : title} + + try { + let filters = { tenantIds: tenantIds?.[0]?.code, title: title }; Digit.Surveys.search(filters).then((ob) => { - if(ob?.Surveys?.length>0) - { + if (ob?.Surveys?.length > 0) { setShowToast({ key: true, label: "SURVEY_SAME_NAME_SURVEY_ALREADY_PRESENT" }); + } else { + history.push("/mgramseva-digit-ui/employee/engagement/surveys/create-response", details); } - else - { - history.push("/digit-ui/employee/engagement/surveys/create-response", details) - } - }) - } - catch(error) - {} + }); + } catch (error) {} }; const tenantId = Digit.ULBService.getCurrentTenantId(); const ulbs = Digit.SessionStorage.get("ENGAGEMENT_TENANTS"); const userInfo = Digit.UserService.getUser().info; - const userUlbs = ulbs - .filter((ulb) => userInfo?.roles?.some((role) => role?.tenantId === ulb?.code)) - - + const userUlbs = ulbs.filter((ulb) => userInfo?.roles?.some((role) => role?.tenantId === ulb?.code)); + const defaultValues = { fromDate: "", fromTime: "", @@ -104,13 +113,13 @@ const NewSurveys = () => { toTime: "", questions: {}, // tenantIds:[] - tenantIds:userUlbs, + tenantIds: userUlbs, }; const stylesForForm = { - marginLeft:'-20px', - } - + marginLeft: "-20px", + }; + return ( {/*
{t("CS_COMMON_SURVEYS")}
*/} diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/pages/employee/CitizenSurveys/SurveyDetails.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/pages/employee/CitizenSurveys/SurveyDetails.js index 308bf79ed..8eaa69588 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/pages/employee/CitizenSurveys/SurveyDetails.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/pages/employee/CitizenSurveys/SurveyDetails.js @@ -18,7 +18,13 @@ const filterQuestion = (question) => { // if (question.type !== "Multiple Choice" || question.type !== "Check Boxes") { // delete question.options; // } - return { ...question, type: question.type.includes("_") ? question.type : answerTypeEnum[question.type],options:question?.options, status:question.status ? question.status : "ACTIVE", qorder:question.qorder }; + return { + ...question, + type: question.type.includes("_") ? question.type : answerTypeEnum[question.type], + options: question?.options, + status: question.status ? question.status : "ACTIVE", + qorder: question.qorder, + }; }; /**TODO : Think of better to do this possibly in service layer */ @@ -42,7 +48,7 @@ const SurveyDetails = ({ location, match }) => { const [displayMenu, setDisplayMenu] = useState(false); const [userAction, setUserAction] = useState(undefined); const tenantId = Digit.ULBService.getCurrentTenantId(); - const tenantIdForInboxSearch = window?.Digit.SessionStorage?.get("CITIZENSURVEY.INBOX")?.searchForm?.tenantIds?.code || tenantId + const tenantIdForInboxSearch = window?.Digit.SessionStorage?.get("CITIZENSURVEY.INBOX")?.searchForm?.tenantIds?.code || tenantId; const [showToast, setShowToast] = useState(null); const closeToast = () => { @@ -53,17 +59,17 @@ const SurveyDetails = ({ location, match }) => { }, 10000); function convertTime12To24(time) { - var hours = Number(time.match(/^(\d+)/)[1]); + var hours = Number(time.match(/^(\d+)/)[1]); var minutes = Number(time.match(/:(\d+)/)[1]); - var AMPM = time.match(/\s(.*)$/)[1]; - if (AMPM === "PM" || AMPM === "pm" && hours < 12) hours = hours + 12; - if (AMPM === "AM" || AMPM === "am" && hours === 12) hours = hours - 12; - var sHours = hours.toString(); + var AMPM = time.match(/\s(.*)$/)[1]; + if (AMPM === "PM" || (AMPM === "pm" && hours < 12)) hours = hours + 12; + if (AMPM === "AM" || (AMPM === "am" && hours === 12)) hours = hours - 12; + var sHours = hours.toString(); var sMinutes = minutes.toString(); if (hours < 10) sHours = "0" + sHours; if (minutes < 10) sMinutes = "0" + sMinutes; - return (sHours + ":" + sMinutes); -} + return sHours + ":" + sMinutes; + } const { isLoading, data: surveyData } = Digit.Hooks.survey.useSearch( { tenantIds: tenantIdForInboxSearch, uuid: id }, @@ -77,17 +83,17 @@ const SurveyDetails = ({ location, match }) => { description: surveyObj.description, fromDate: format(new Date(surveyObj.startDate), "yyyy-MM-dd"), toDate: format(new Date(surveyObj.endDate), "yyyy-MM-dd"), - fromTime: convertTime12To24(new Date(surveyObj.startDate).toLocaleString("en-IN",{hour: "numeric", minute:"numeric",hour12:true})), - toTime: convertTime12To24(new Date(surveyObj.endDate).toLocaleString("en-IN",{hour: "numeric", minute:"numeric",hour12:true})), + fromTime: convertTime12To24(new Date(surveyObj.startDate).toLocaleString("en-IN", { hour: "numeric", minute: "numeric", hour12: true })), + toTime: convertTime12To24(new Date(surveyObj.endDate).toLocaleString("en-IN", { hour: "numeric", minute: "numeric", hour12: true })), questions: surveyObj.questions.map(({ questionStatement, type, required, options, uuid, surveyId, qorder, status }) => ({ questionStatement, - type: /*TypeAnswerEnum[type]*/type, + type: /*TypeAnswerEnum[type]*/ type, required, options, uuid, surveyId, qorder, - status + status, })), status: surveyObj.status, tenantId: { code: surveyObj.tenantId }, @@ -132,7 +138,7 @@ const SurveyDetails = ({ location, match }) => { const onEdit = (data) => { const { collectCitizenInfo, title, description, tenantIds, fromDate, toDate, fromTime, toTime, questions } = data; - const mappedQuestions = mapQuestions(questions,surveyData); + const mappedQuestions = mapQuestions(questions, surveyData); const details = { SurveyEntity: { uuid: surveyData.uuid, @@ -143,7 +149,7 @@ const SurveyDetails = ({ location, match }) => { startDate: new Date(`${fromDate} ${fromTime}`).getTime(), endDate: new Date(`${toDate} ${toTime}`).getTime(), questions: mappedQuestions, - status:isSurveyActive?"ACTIVE":"INACTIVE", + status: isSurveyActive ? "ACTIVE" : "INACTIVE", // active:true, // answersCount:0, // postedBy:"BPAREG Approver", @@ -153,28 +159,23 @@ const SurveyDetails = ({ location, match }) => { }, }; - try{ - let filters = {tenantIds : tenantIds[0]?.code ? tenantIds[0]?.code : surveyData.tenantId.code, title : title} + try { + let filters = { tenantIds: tenantIds[0]?.code ? tenantIds[0]?.code : surveyData.tenantId.code, title: title }; Digit.Surveys.search(filters).then((ob) => { - if(ob?.Surveys?.length>0 && data?.title !== surveyData?.title) - { + if (ob?.Surveys?.length > 0 && data?.title !== surveyData?.title) { setShowToast({ key: true, label: "SURVEY_SAME_NAME_SURVEY_ALREADY_PRESENT" }); + } else { + history.push("/mgramseva-digit-ui/employee/engagement/surveys/update-response", details); } - else - { - history.push("/digit-ui/employee/engagement/surveys/update-response", details); - } - }) - } - catch(error) - {} + }); + } catch (error) {} }; const handleDelete = () => { const details = { SurveyEntity: { ...surveyData, tenantId: tenantId?.code ? tenantId?.code : tenantId }, }; - history.push("/digit-ui/employee/engagement/surveys/delete-response", details); + history.push("/mgramseva-digit-ui/employee/engagement/surveys/delete-response", details); }; //if we don't send tenantId it violates the not null constraint in the backend... @@ -190,18 +191,14 @@ const SurveyDetails = ({ location, match }) => { tenantId, }, }; - history.push("/digit-ui/employee/engagement/surveys/update-response", details); + history.push("/mgramseva-digit-ui/employee/engagement/surveys/update-response", details); }; const handleMarkInactive = () => { const details = { - SurveyEntity: { ...surveyData, - tenantId, - questions: surveyData.questions.map(filterQuestion), - status: "INACTIVE", - }, + SurveyEntity: { ...surveyData, tenantId, questions: surveyData.questions.map(filterQuestion), status: "INACTIVE" }, }; - history.push("/digit-ui/employee/engagement/surveys/update-response", details); + history.push("/mgramseva-digit-ui/employee/engagement/surveys/update-response", details); }; const actionMenuOptions = useMemo(() => { @@ -216,7 +213,6 @@ const SurveyDetails = ({ location, match }) => { if (isLoading) return ; - return (
{t("CS_COMMON_SURVEYS")}
@@ -230,7 +226,7 @@ const SurveyDetails = ({ location, match }) => { setDisplayMenu={setDisplayMenu} onActionSelect={onActionSelect} initialSurveysConfig={surveyData} - isSurveyActive = {isSurveyActive} + isSurveyActive={isSurveyActive} formDisabled={isFormDisabled} /> @@ -278,4 +274,4 @@ const SurveyDetails = ({ location, match }) => { ); }; -export default SurveyDetails; \ No newline at end of file +export default SurveyDetails; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/pages/employee/CitizenSurveys/responses/create.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/pages/employee/CitizenSurveys/responses/create.js index 32d6e8be5..b92afe4fc 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/pages/employee/CitizenSurveys/responses/create.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/pages/employee/CitizenSurveys/responses/create.js @@ -1,8 +1,8 @@ -import { Banner, Card, Loader, CardText, ActionBar, SubmitBar,Menu } from "@egovernments/digit-ui-react-components"; +import { Banner, Card, Loader, CardText, ActionBar, SubmitBar, Menu } from "@egovernments/digit-ui-react-components"; import { useQueryClient } from "react-query"; -import React, { useEffect,useState } from "react"; +import React, { useEffect, useState } from "react"; import { useTranslation } from "react-i18next"; -import { Link,useHistory } from "react-router-dom"; +import { Link, useHistory } from "react-router-dom"; const getMessage = (mutation) => { if (mutation.isSuccess) return mutation.data?.Surveys?.[0]?.uuid; return ""; @@ -27,48 +27,44 @@ const Acknowledgement = (props) => { const mutation = Digit.Hooks.survey.useCreate(); const { state } = props.location; const history = useHistory(); - const [isActionClicked,setIsActionClicked] = useState(false) + const [isActionClicked, setIsActionClicked] = useState(false); useEffect(() => { const onSuccess = () => { queryClient.clear(); - window.history.replaceState(null, 'CREATE_SURVEY_STATE') + window.history.replaceState(null, "CREATE_SURVEY_STATE"); }; - if(!!state){ + if (!!state) { mutation.mutate(state, { onSuccess, - }) - }; + }); + } }, []); if (mutation.isLoading && !mutation.isIdle) { return ; } - const survey = mutation.data?.Surveys?.[0]; - + const handleActionClick = () => { - setIsActionClicked((prevState => { - return !prevState - })) - } + setIsActionClicked((prevState) => { + return !prevState; + }); + }; // const actionClickHandler = (option) => { - // if(option === "Go Back to home") history.push("/digit-ui/employee") - // else if(option === "Create another survey") history.push("/digit-ui/employee/engagement/surveys/create") + // if(option === "Go Back to home") history.push("/mgramseva-digit-ui/employee") + // else if(option === "Create another survey") history.push("/mgramseva-digit-ui/employee/engagement/surveys/create") // } - const actionClickHandler = (option) => { - if(option === t("GO_BACK_TO_HOME")) history.push("/digit-ui/employee") - else if(option === t("CREATE_ANOTHER_SURVEY")) history.push("/digit-ui/employee/engagement/surveys/create") - } + const actionClickHandler = (option) => { + if (option === t("GO_BACK_TO_HOME")) history.push("/mgramseva-digit-ui/employee"); + else if (option === t("CREATE_ANOTHER_SURVEY")) history.push("/mgramseva-digit-ui/employee/engagement/surveys/create"); + }; return ( - + - {mutation.isSuccess + {mutation.isSuccess ? t(`SURVEY_FORM_CREATION_MESSAGE`, { surveyName: survey?.title, fromDate: Digit.DateUtils.ConvertTimestampToDate(survey?.startDate), @@ -76,9 +72,9 @@ const Acknowledgement = (props) => { }) : null} - - {/* - + + {/* + */} @@ -87,13 +83,11 @@ const Acknowledgement = (props) => { - - ); }; -export default Acknowledgement; \ No newline at end of file +export default Acknowledgement; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/pages/employee/CitizenSurveys/responses/delete.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/pages/employee/CitizenSurveys/responses/delete.js index 15cba08d0..1a8895d15 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/pages/employee/CitizenSurveys/responses/delete.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/pages/employee/CitizenSurveys/responses/delete.js @@ -17,7 +17,6 @@ import { Link } from "react-router-dom"; // return ""; // }; - const BannerPicker = (props) => { const { t } = useTranslation(); return ( @@ -40,9 +39,9 @@ const Response = (props) => { useEffect(() => { const onSuccess = () => { queryClient.clear(); - window.history.replaceState(null, 'DELETE_SURVEY_STATE') + window.history.replaceState(null, "DELETE_SURVEY_STATE"); }; - if(!!state){ + if (!!state) { mutation.mutate(state, { onSuccess, }); @@ -56,10 +55,17 @@ const Response = (props) => { return (
- + - + diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/pages/employee/CitizenSurveys/responses/update.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/pages/employee/CitizenSurveys/responses/update.js index 00f5e1f22..15eb0719d 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/pages/employee/CitizenSurveys/responses/update.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/pages/employee/CitizenSurveys/responses/update.js @@ -5,8 +5,8 @@ import { useTranslation } from "react-i18next"; import { Link } from "react-router-dom"; const getMessage = (mutation) => { - if (mutation.isSuccess && mutation?.data?.Surveys?.[0]?.uuid){ - return mutation?.data?.Surveys?.[0]?.uuid + if (mutation.isSuccess && mutation?.data?.Surveys?.[0]?.uuid) { + return mutation?.data?.Surveys?.[0]?.uuid; } if (mutation.isSuccess) return mutation.data?.Documents?.[0]?.uuid; return ""; @@ -34,9 +34,9 @@ const Response = (props) => { useEffect(() => { const onSuccess = () => { queryClient.clear(); - window.history.replaceState(null, 'UPDATE_SURVEY_STATE') + window.history.replaceState(null, "UPDATE_SURVEY_STATE"); }; - if(!!state){ + if (!!state) { mutation.mutate(state, { onSuccess, }); @@ -49,12 +49,17 @@ const Response = (props) => { return (
- - + - + diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/pages/employee/Documents/Inbox/index.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/pages/employee/Documents/Inbox/index.js index b7a302e01..7ac4de62f 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/pages/employee/Documents/Inbox/index.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/pages/employee/Documents/Inbox/index.js @@ -4,124 +4,119 @@ import { Header } from "@egovernments/digit-ui-react-components"; import DesktopInbox from "../../../../components/Documents/DesktopInbox"; import MobileInbox from "../../../../components/Documents/MobileInbox"; - - const Inbox = ({ tenants }) => { - const { t } = useTranslation() - Digit.SessionStorage.set("ENGAGEMENT_TENANTS", tenants); - const tenantId = Digit.ULBService.getCurrentTenantId(); - const [searchParams, setSearchParams] = useState({ - tenantIds: tenantId, - offset: 0, - limit: 10 - }); - - let isMobile = window.Digit.Utils.browser.isMobile(); - const { data: response, isLoading } = Digit.Hooks.engagement.useDocSearch(searchParams, { - select: ({ Documents, totalCount }) => ({ documentsList: Documents, totalCount }) - - }); - - const onSearch = (params) => { - const tenantIds = params?.ulbs?.code?.length ? params?.ulbs?.code : tenantId - const { name, postedBy } = params; - setSearchParams((prevSearchParams) => ({ ...prevSearchParams, name, postedBy, tenantIds })); - } - - const handleFilterChange = (data) => { - setSearchParams((prevSearchParams) => ({ ...prevSearchParams, ...data })); - } - - const fetchNextPage = useCallback(() => { - setSearchParams((prevSearchParams) => ({...prevSearchParams, offset: (parseInt(prevSearchParams?.offset) + parseInt(prevSearchParams?.limit))})); - - }, []) - - const fetchPrevPage = () => { - setSearchParams((prevSearchParams) => ({...prevSearchParams, offset: (parseInt(prevSearchParams?.offset) - parseInt(prevSearchParams?.limit))})); - }; - - const handlePageSizeChange = (e) => { - setSearchParams((prevSearchParams) => ({...prevSearchParams, limit:e.target.value})); - }; - - useEffect(() => { - setSearchParams((prevSearchParams) => ({ ...prevSearchParams, tenantIds: tenantId })) - }, [tenantId]) - - const getSearchFields = () => { - return [ - { - label: t('LABEL_FOR_ULB'), - name: "ulbs", - type: "ulb", - }, - { - label: t('DOCUMENTS_DOCUMENT_HEADER'), - name: "name" - }, - { - label: t('CE_TABLE_DOCUMENT_POSTED_BY'), - name: "postedBy" - } - ] - } - - const links = [ - { - text: t('NEW_DOCUMENT_TEXT'), - link: "/digit-ui/employee/engagement/documents/inbox/new-doc", - } - ] - if (isMobile) { - return ( - - ) - } - + const { t } = useTranslation(); + Digit.SessionStorage.set("ENGAGEMENT_TENANTS", tenants); + const tenantId = Digit.ULBService.getCurrentTenantId(); + const [searchParams, setSearchParams] = useState({ + tenantIds: tenantId, + offset: 0, + limit: 10, + }); + + let isMobile = window.Digit.Utils.browser.isMobile(); + const { data: response, isLoading } = Digit.Hooks.engagement.useDocSearch(searchParams, { + select: ({ Documents, totalCount }) => ({ documentsList: Documents, totalCount }), + }); + + const onSearch = (params) => { + const tenantIds = params?.ulbs?.code?.length ? params?.ulbs?.code : tenantId; + const { name, postedBy } = params; + setSearchParams((prevSearchParams) => ({ ...prevSearchParams, name, postedBy, tenantIds })); + }; + + const handleFilterChange = (data) => { + setSearchParams((prevSearchParams) => ({ ...prevSearchParams, ...data })); + }; + + const fetchNextPage = useCallback(() => { + setSearchParams((prevSearchParams) => ({ ...prevSearchParams, offset: parseInt(prevSearchParams?.offset) + parseInt(prevSearchParams?.limit) })); + }, []); + + const fetchPrevPage = () => { + setSearchParams((prevSearchParams) => ({ ...prevSearchParams, offset: parseInt(prevSearchParams?.offset) - parseInt(prevSearchParams?.limit) })); + }; + + const handlePageSizeChange = (e) => { + setSearchParams((prevSearchParams) => ({ ...prevSearchParams, limit: e.target.value })); + }; + + useEffect(() => { + setSearchParams((prevSearchParams) => ({ ...prevSearchParams, tenantIds: tenantId })); + }, [tenantId]); + + const getSearchFields = () => { + return [ + { + label: t("LABEL_FOR_ULB"), + name: "ulbs", + type: "ulb", + }, + { + label: t("DOCUMENTS_DOCUMENT_HEADER"), + name: "name", + }, + { + label: t("CE_TABLE_DOCUMENT_POSTED_BY"), + name: "postedBy", + }, + ]; + }; + + const links = [ + { + text: t("NEW_DOCUMENT_TEXT"), + link: "/mgramseva-digit-ui/employee/engagement/documents/inbox/new-doc", + }, + ]; + if (isMobile) { return ( -
-
- {t("DOCUMENTS_DOCUMENT_HEADER")} - {Number(response?.totalCount) ?

{Number(response?.totalCount)}

: null} -
- - - -
+ ); -} - -export default Inbox; \ No newline at end of file + } + + return ( +
+
+ {t("DOCUMENTS_DOCUMENT_HEADER")} + {Number(response?.totalCount) ?

{Number(response?.totalCount)}

: null} +
+ + +
+ ); +}; + +export default Inbox; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/pages/employee/Documents/delete-response.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/pages/employee/Documents/delete-response.js index d48fb2266..bd3219cb6 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/pages/employee/Documents/delete-response.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/pages/employee/Documents/delete-response.js @@ -14,7 +14,7 @@ const BannerPicker = (props) => { return ( @@ -45,10 +45,17 @@ const Response = (props) => { return (
- + - + diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/pages/employee/Documents/documents-create.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/pages/employee/Documents/documents-create.js index 1cc0e1f1e..15c73910d 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/pages/employee/Documents/documents-create.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/pages/employee/Documents/documents-create.js @@ -22,7 +22,7 @@ const Documents = () => { } }; - const onSubmit = (data) => { + const onSubmit = (data) => { const DocumentEntity = { name: data.documentName, description: data?.description.length ? data.description : "", @@ -34,21 +34,21 @@ const Documents = () => { tenantIds: data.ULB.map((e) => e.code), }; - history.push("/digit-ui/employee/engagement/documents/response", { DocumentEntity }); + history.push("/mgramseva-digit-ui/employee/engagement/documents/response", { DocumentEntity }); }; return (
-
{t("ES_ENGAGEMENT_DOCUMENTS")}
- +
{t("ES_ENGAGEMENT_DOCUMENTS")}
+
); }; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/pages/employee/Documents/documents-update.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/pages/employee/Documents/documents-update.js index e271a9836..1102c51dc 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/pages/employee/Documents/documents-update.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/pages/employee/Documents/documents-update.js @@ -1,30 +1,37 @@ import React, { useState, useCallback } from "react"; -import { Card, Header, LabelFieldPair, CardLabel, TextInput, Dropdown, FormComposer, SubmitBar, ActionBar } from "@egovernments/digit-ui-react-components"; +import { + Card, + Header, + LabelFieldPair, + CardLabel, + TextInput, + Dropdown, + FormComposer, + SubmitBar, + ActionBar, +} from "@egovernments/digit-ui-react-components"; import { useTranslation } from "react-i18next"; import { documentsFormConfig } from "../../../config/doc-update"; import { useHistory } from "react-router-dom"; - const Documents = (props) => { const { t } = useTranslation(); const history = useHistory(); const [canSubmit, setSubmitValve] = useState(false); - const onFormValueChange = useCallback( - (setValue, updatedFormData, formState) => { - if ( - updatedFormData?.documentName && - updatedFormData?.docCategory && - (updatedFormData?.document.filestoreId || updatedFormData?.document.documentLink) && - updatedFormData?.ULB && Object.keys(updatedFormData?.ULB).length - ) { - setSubmitValve(true); - } else { - setSubmitValve(false); - } - }, - [], - ) + const onFormValueChange = useCallback((setValue, updatedFormData, formState) => { + if ( + updatedFormData?.documentName && + updatedFormData?.docCategory && + (updatedFormData?.document.filestoreId || updatedFormData?.document.documentLink) && + updatedFormData?.ULB && + Object.keys(updatedFormData?.ULB).length + ) { + setSubmitValve(true); + } else { + setSubmitValve(false); + } + }, []); const update = (data) => { const fileSize = data.document?.filestoreId?.fileSize ? data.document?.filestoreId?.fileSize : props.location.state?.DocumentEntity?.fileSize; @@ -44,7 +51,7 @@ const Documents = (props) => { delete DocumentEntity.ULB; delete DocumentEntity.docCategory; delete DocumentEntity.documentName; - history.push("/digit-ui/employee/engagement/documents/update-response", { DocumentEntity }); + history.push("/mgramseva-digit-ui/employee/engagement/documents/update-response", { DocumentEntity }); }; return ( @@ -60,7 +67,6 @@ const Documents = (props) => { defaultValues={props.location.state?.DocumentEntity} isDisabled={!canSubmit} /> - ); }; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/pages/employee/Documents/response.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/pages/employee/Documents/response.js index dbfdd3e6b..1dd326857 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/pages/employee/Documents/response.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/pages/employee/Documents/response.js @@ -42,16 +42,22 @@ const Response = (props) => { } return ( -
- - - - - - - - -
+
+ + + + + + + + +
); }; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/pages/employee/Documents/update-response.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/pages/employee/Documents/update-response.js index 91b446059..1943330e3 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/pages/employee/Documents/update-response.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/pages/employee/Documents/update-response.js @@ -44,12 +44,17 @@ const Response = (props) => { return (
- - + - + diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/pages/employee/Events/EditEvent/index.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/pages/employee/Events/EditEvent/index.js index 646d1a487..d2bf084c4 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/pages/employee/Events/EditEvent/index.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/pages/employee/Events/EditEvent/index.js @@ -1,5 +1,5 @@ import { FormComposer, Header, Loader } from "@egovernments/digit-ui-react-components"; -import { format } from 'date-fns'; +import { format } from "date-fns"; import React, { Fragment, useEffect } from "react"; import { useTranslation } from "react-i18next"; import { useHistory, useParams } from "react-router-dom"; @@ -10,14 +10,17 @@ const EditEvents = () => { const history = useHistory(); const { id: EventId } = useParams(); const tenantId = Digit.ULBService.getCurrentTenantId(); - const { isLoading, data } = Digit.Hooks.events.useInbox(tenantId, {}, + const { isLoading, data } = Digit.Hooks.events.useInbox( + tenantId, + {}, { eventTypes: "EVENTSONGROUND", - ids: EventId + ids: EventId, }, { - select: (data) => data?.events?.[0] - }); + select: (data) => data?.events?.[0], + } + ); const [mutationHappened, setMutationHappened, clear] = Digit.Hooks.useSessionStorage("EMPLOYEE_EVENT_MUTATION_HAPPENED", false); const [errorInfo, setErrorInfo, clearError] = Digit.Hooks.useSessionStorage("EMPLOYEE_EVENT_ERROR_DATA", false); const [successData, setsuccessData, clearSuccessData] = Digit.Hooks.useSessionStorage("EMPLOYEE_EVENT_MUTATION_SUCCESS_DATA", false); @@ -50,50 +53,42 @@ const EditEvents = () => { organizer, fees, latitude: geoLocation?.latitude, - longitude: geoLocation?.longitude - } - } - ] - } - history.push("/digit-ui/employee/engagement/event/response?update=true", details) - } + longitude: geoLocation?.longitude, + }, + }, + ], + }; + history.push("/mgramseva-digit-ui/employee/engagement/event/response?update=true", details); + }; if (isLoading) { - return ( - - ); + return ; } const defaultValues = { defaultTenantId: data?.tenantId, name: data?.name, - fromDate: format(new Date(data?.eventDetails?.fromDate), 'yyyy-MM-dd'), - toDate: format(new Date(data?.eventDetails?.toDate), 'yyyy-MM-dd'), + fromDate: format(new Date(data?.eventDetails?.fromDate), "yyyy-MM-dd"), + toDate: format(new Date(data?.eventDetails?.toDate), "yyyy-MM-dd"), organizer: data?.eventDetails?.organizer, fees: data?.eventDetails?.fees, description: data?.description, address: data?.eventDetails?.address, category: data?.eventCategory, - fromTime: format(new Date(data?.eventDetails?.fromDate), 'HH:mm'), - toTime: format(new Date(data?.eventDetails?.toDate), 'HH:mm'), + fromTime: format(new Date(data?.eventDetails?.fromDate), "HH:mm"), + toTime: format(new Date(data?.eventDetails?.toDate), "HH:mm"), geoLocation: { latitude: data?.eventDetails?.latitude, longitude: data?.eventDetails?.longitude, - } - } + }, + }; return (
{t("ES_TITLE_EDIT_EVENTS")}
- - +
- ) -} + ); +}; -export default EditEvents; \ No newline at end of file +export default EditEvents; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/pages/employee/Events/EventDetails.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/pages/employee/Events/EventDetails.js index 0aaed115d..c61e54c19 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/pages/employee/Events/EventDetails.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/pages/employee/Events/EventDetails.js @@ -1,7 +1,19 @@ -import React, { Fragment, useState ,useEffect} from "react"; +import React, { Fragment, useState, useEffect } from "react"; import { useParams, useHistory } from "react-router-dom"; import { useTranslation } from "react-i18next"; -import { Header, Card, CardSectionHeader, PDFSvg, Loader, StatusTable, Menu, ActionBar, SubmitBar, Modal, CardText } from "@egovernments/digit-ui-react-components"; +import { + Header, + Card, + CardSectionHeader, + PDFSvg, + Loader, + StatusTable, + Menu, + ActionBar, + SubmitBar, + Modal, + CardText, +} from "@egovernments/digit-ui-react-components"; import ApplicationDetailsTemplate from "../../../../../templates/ApplicationDetails"; const Heading = (props) => { @@ -45,7 +57,7 @@ const EventDetails = () => { function onActionSelect(action) { // setSelectedAction(action); if (action === "EDIT") { - history.push(`/digit-ui/employee/engagement/event/edit-event/${id}`) + history.push(`/mgramseva-digit-ui/employee/engagement/event/edit-event/${id}`); } if (action === "DELETE") { setShowModal(true); @@ -62,7 +74,7 @@ const EventDetails = () => { }, ], }; - history.push("/digit-ui/employee/engagement/event/response?delete=true", details); + history.push("/mgramseva-digit-ui/employee/engagement/event/response?delete=true", details); }; return ( @@ -73,40 +85,33 @@ const EventDetails = () => { applicationDetails={data} isLoading={isLoading} isDataLoading={isLoading} - // workflowDetails={workflowDetails} - // businessService={ - // workflowDetails?.data?.applicationBusinessService - // ? workflowDetails?.data?.applicationBusinessService - // : data?.applicationData?.businessService - // } + // workflowDetails={workflowDetails} + // businessService={ + // workflowDetails?.data?.applicationBusinessService + // ? workflowDetails?.data?.applicationBusinessService + // : data?.applicationData?.businessService + // } /> - {displayMenu ? ( - - ) : null} + {displayMenu ? : null} setDisplayMenu(!displayMenu)} /> - {showModal && + {showModal && ( } + headerBarMain={} headerBarEnd={ setShowModal(false)} />} actionCancelLabel={t("CS_COMMON_CANCEL")} actionCancelOnSubmit={() => setShowModal(false)} - actionSaveLabel={t('ES_EVENT_DELETE')} + actionSaveLabel={t("ES_EVENT_DELETE")} actionSaveOnSubmit={handleDelete} > {t(`ES_EVENT_DELETE_TEXT`)} - } + )} ); }; -export default EventDetails; \ No newline at end of file +export default EventDetails; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/pages/employee/Events/Inbox/index.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/pages/employee/Events/Inbox/index.js index fc5781d1b..0135a30db 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/pages/employee/Events/Inbox/index.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/pages/employee/Events/Inbox/index.js @@ -5,10 +5,8 @@ import { Header } from "@egovernments/digit-ui-react-components"; import DesktopInbox from "../../../../components/Events/DesktopInbox"; import MobileInbox from "../../../../components/Events/MobileInbox"; - - const Inbox = ({ tenants, parentRoute }) => { - const { t } = useTranslation() + const { t } = useTranslation(); Digit.SessionStorage.set("ENGAGEMENT_TENANTS", tenants); const tenantId = Digit.ULBService.getCurrentTenantId(); const [pageSize, setPageSize] = useState(10); @@ -18,9 +16,9 @@ const Inbox = ({ tenants, parentRoute }) => { range: { startDate: null, endDate: new Date(""), - title: "" + title: "", }, - ulb: tenants?.find(tenant => tenant?.code === tenantId) + ulb: tenants?.find((tenant) => tenant?.code === tenantId), }); let isMobile = window.Digit.Utils.browser.isMobile(); @@ -33,64 +31,70 @@ const Inbox = ({ tenants, parentRoute }) => { }, { label: t("EVENTS_NAME_LABEL"), - name: "eventName" - } - ] - } + name: "eventName", + }, + ]; + }; const links = [ { text: t("ES_TITLE_NEW_EVENTS"), - link: "/digit-ui/employee/engagement/event/inbox/new-event", - } - ] + link: "/mgramseva-digit-ui/employee/engagement/event/inbox/new-event", + }, + ]; - const { data, isLoading } = Digit.Hooks.events.useInbox(searchParams?.ulb?.code, {}, + const { data, isLoading } = Digit.Hooks.events.useInbox( + searchParams?.ulb?.code, + {}, { - eventTypes: "EVENTSONGROUND", limit: pageSize, + eventTypes: "EVENTSONGROUND", + limit: pageSize, offset: pageOffset, }, { - select: (data) => ({ events: data?.events, totalCount: data?.totalCount }) - }); + select: (data) => ({ events: data?.events, totalCount: data?.totalCount }), + } + ); const onSearch = (params) => { let updatedParams = { ...params }; if (!params?.ulb) { - updatedParams = { ...params, ulb: { code: tenantId } } + updatedParams = { ...params, ulb: { code: tenantId } }; } setSearchParams({ ...searchParams, ...updatedParams }); - } + }; const handleFilterChange = (data) => { - setSearchParams({ ...searchParams, ...data }) - } + setSearchParams({ ...searchParams, ...data }); + }; const globalSearch = (rows, columnIds) => { // return rows; - return rows?.filter(row => - (searchParams?.eventStatus?.length > 0 ? searchParams?.eventStatus?.includes(row.original?.status) : true) && - (searchParams?.eventName ? row.original?.name?.toUpperCase().startsWith(searchParams?.eventName.toUpperCase()) : true) && - (searchParams?.ulb?.code ? row.original.tenantId === searchParams?.ulb?.code : true) && - (searchParams?.eventCategory ? row.original.eventCategory === searchParams?.eventCategory?.code : true) && - (isValid(searchParams?.range?.startDate) ? row.original.eventDetails?.fromDate >= new Date(searchParams?.range?.startDate).getTime() : true) && - (isValid(searchParams?.range?.endDate) ? row.original.eventDetails?.toDate <= new Date(searchParams?.range?.endDate).getTime() : true)) - } + return rows?.filter( + (row) => + (searchParams?.eventStatus?.length > 0 ? searchParams?.eventStatus?.includes(row.original?.status) : true) && + (searchParams?.eventName ? row.original?.name?.toUpperCase().startsWith(searchParams?.eventName.toUpperCase()) : true) && + (searchParams?.ulb?.code ? row.original.tenantId === searchParams?.ulb?.code : true) && + (searchParams?.eventCategory ? row.original.eventCategory === searchParams?.eventCategory?.code : true) && + (isValid(searchParams?.range?.startDate) + ? row.original.eventDetails?.fromDate >= new Date(searchParams?.range?.startDate).getTime() + : true) && + (isValid(searchParams?.range?.endDate) ? row.original.eventDetails?.toDate <= new Date(searchParams?.range?.endDate).getTime() : true) + ); + }; const fetchNextPage = useCallback(() => { - setPageOffset((prevPageOffSet) => ((parseInt(prevPageOffSet) + parseInt(pageSize)))); - }, [pageSize]) + setPageOffset((prevPageOffSet) => parseInt(prevPageOffSet) + parseInt(pageSize)); + }, [pageSize]); const fetchPrevPage = useCallback(() => { - setPageOffset((prevPageOffSet) => ((parseInt(prevPageOffSet) - parseInt(pageSize)))); - }, [pageSize]) + setPageOffset((prevPageOffSet) => parseInt(prevPageOffSet) - parseInt(pageSize)); + }, [pageSize]); const handlePageSizeChange = (e) => { - setPageSize((prevPageSize) => (e.target.value)); + setPageSize((prevPageSize) => e.target.value); }; - - if (isMobile) { return ( { iconName={"calender"} links={links} /> - ) + ); } return ( @@ -136,6 +140,6 @@ const Inbox = ({ tenants, parentRoute }) => { />
); -} +}; -export default Inbox; \ No newline at end of file +export default Inbox; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/pages/employee/Events/NewEvent/Response.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/pages/employee/Events/NewEvent/Response.js index de400d223..273d275a8 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/pages/employee/Events/NewEvent/Response.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/pages/employee/Events/NewEvent/Response.js @@ -14,8 +14,8 @@ const BannerPicker = (props) => { info={t(`ENGAGEMENT_EVENT_NAME`)} successful={props.isSuccess} /> - ) -} + ); +}; const Response = (props) => { const queryClient = useQueryClient(); @@ -24,16 +24,15 @@ const Response = (props) => { const tenantId = Digit.ULBService.getCurrentTenantId(); const mutation = Digit.Hooks.events.useCreateEvent(); const updateEventMutation = Digit.Hooks.events.useUpdateEvent(); - const [isSuccess, setIsSuccess] = useState(false) + const [isSuccess, setIsSuccess] = useState(false); const { state } = props.location; const [mutationHappened, setMutationHappened, clear] = Digit.Hooks.useSessionStorage("EMPLOYEE_EVENT_MUTATION_HAPPENED", false); const [successData, setsuccessData, clearSuccessData] = Digit.Hooks.useSessionStorage("EMPLOYEE_EVENT_MUTATION_SUCCESS_DATA", false); const [errorInfo, setErrorInfo, clearError] = Digit.Hooks.useSessionStorage("EMPLOYEE_EVENT_ERROR_DATA", false); - const onError = (error, variables) => { - setErrorInfo(error?.response?.data?.Errors[0]?.code || 'ERROR'); + setErrorInfo(error?.response?.data?.Errors[0]?.code || "ERROR"); setMutationHappened(true); }; @@ -48,7 +47,7 @@ const Response = (props) => { const onSuccess = () => { setMutationHappened(true); queryClient.clear(); - } + }; if (!mutationHappened) { if (Boolean(searchParams?.delete) || Boolean(searchParams?.update)) { updateEventMutation.mutate(state, { @@ -60,7 +59,7 @@ const Response = (props) => { mutation.mutate(state, { onError, onSuccess, - }) + }); return; } return () => { @@ -70,35 +69,48 @@ const Response = (props) => { if (searchParams?.delete || searchParams?.update) { if (updateEventMutation.isLoading || (updateEventMutation.isIdle && !mutationHappened)) { - return + return ; } return ( - {searchParams?.update ? (updateEventMutation.isSuccess || successData) ? t('ENGAGEMENT_EVENT_UPDATED') : t(`ENGAGEMENT_EVENT_UPDATED_FAILED`) : (updateEventMutation.isSuccess || successData) ? t('ENGAGEMENT_EVENT_DELETED') : t('ENGAGEMENT_EVENT_DELETED_FAILED')} + {searchParams?.update + ? updateEventMutation.isSuccess || successData + ? t("ENGAGEMENT_EVENT_UPDATED") + : t(`ENGAGEMENT_EVENT_UPDATED_FAILED`) + : updateEventMutation.isSuccess || successData + ? t("ENGAGEMENT_EVENT_DELETED") + : t("ENGAGEMENT_EVENT_DELETED_FAILED")} - + - ) + ); } if (mutation.isLoading || (mutation.isIdle && !mutationHappened)) { - return + return ; } - const event = mutation?.data?.events?.[0] || successData?.events?.[0] || {}; return ( @@ -110,21 +122,23 @@ const Response = (props) => { isLoading={(mutation.isIdle && !mutationHappened) || mutation.isLoading} /> - {mutation.isSuccess || successData ? t(`ENGAGEMENT_EVENT_CREATED_MESSAGES`, { - eventName: event?.name, - fromDate: Digit.DateUtils.ConvertTimestampToDate(event?.eventDetails?.fromDate), - toDate: Digit.DateUtils.ConvertTimestampToDate(event?.eventDetails?.toDate), - fromTime: mutation.isSuccess ? format(new Date(event?.eventDetails?.fromDate), 'HH:mm') : null, - toTime: mutation.isSuccess ? format(new Date(event?.eventDetails?.toDate), 'HH:mm') : null, - }) : null} + {mutation.isSuccess || successData + ? t(`ENGAGEMENT_EVENT_CREATED_MESSAGES`, { + eventName: event?.name, + fromDate: Digit.DateUtils.ConvertTimestampToDate(event?.eventDetails?.fromDate), + toDate: Digit.DateUtils.ConvertTimestampToDate(event?.eventDetails?.toDate), + fromTime: mutation.isSuccess ? format(new Date(event?.eventDetails?.fromDate), "HH:mm") : null, + toTime: mutation.isSuccess ? format(new Date(event?.eventDetails?.toDate), "HH:mm") : null, + }) + : null} - + - ) -} + ); +}; -export default Response; \ No newline at end of file +export default Response; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/pages/employee/Events/NewEvent/index.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/pages/employee/Events/NewEvent/index.js index 6082d2aa2..42d0ca14e 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/pages/employee/Events/NewEvent/index.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/pages/employee/Events/NewEvent/index.js @@ -27,13 +27,13 @@ const NewEvents = () => { address, organizer, fees, - ...geoLocation - } - } - ] - } - history.push("/digit-ui/employee/engagement/event/response", details) - } + ...geoLocation, + }, + }, + ], + }; + history.push("/mgramseva-digit-ui/employee/engagement/event/response", details); + }; const [mutationHappened, setMutationHappened, clear] = Digit.Hooks.useSessionStorage("EMPLOYEE_EVENT_MUTATION_HAPPENED", false); const [errorInfo, setErrorInfo, clearError] = Digit.Hooks.useSessionStorage("EMPLOYEE_EVENT_ERROR_DATA", false); @@ -48,14 +48,9 @@ const NewEvents = () => { return (
{t("ES_TITLE_NEW_EVENTS")}
- - +
- ) -} + ); +}; -export default NewEvents; \ No newline at end of file +export default NewEvents; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/pages/employee/Messages/EditMessage.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/pages/employee/Messages/EditMessage.js index 87d4d0b68..45d2dfcd5 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/pages/employee/Messages/EditMessage.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/pages/employee/Messages/EditMessage.js @@ -1,5 +1,5 @@ import { FormComposer, Header, Loader } from "@egovernments/digit-ui-react-components"; -import { format } from 'date-fns'; +import { format } from "date-fns"; import React, { Fragment, useEffect, useMemo } from "react"; import { useTranslation } from "react-i18next"; import { useHistory, useParams } from "react-router-dom"; @@ -11,14 +11,17 @@ const EditMessage = () => { const history = useHistory(); const { id: MessageId } = useParams(); const tenantId = Digit.ULBService.getCurrentTenantId(); - const { isLoading, data } = Digit.Hooks.events.useInbox(tenantId, {}, + const { isLoading, data } = Digit.Hooks.events.useInbox( + tenantId, + {}, { eventTypes: "BROADCAST", - ids: MessageId + ids: MessageId, }, { - select: (data) => data?.events?.[0] - }); + select: (data) => data?.events?.[0], + } + ); const [mutationHappened, setMutationHappened, clear] = Digit.Hooks.useSessionStorage("EMPLOYEE_MSG_MUTATION_HAPPENED", false); const [errorInfo, setErrorInfo, clearError] = Digit.Hooks.useSessionStorage("EMPLOYEE_MSG_ERROR_DATA", false); const [successData, setsuccessData, clearSuccessData] = Digit.Hooks.useSessionStorage("EMPLOYEE_MSG_MUTATION_SUCCESS_DATA", false); @@ -32,7 +35,6 @@ const EditMessage = () => { const onSubmit = (formData) => { const { fromDate, toDate, description, name, documents } = formData; - const finalDocuments = isNestedArray(documents) ? reduceDocsArray(documents) : documents; const details = { @@ -49,42 +51,37 @@ const EditMessage = () => { documents: finalDocuments, fromDate: handleTodaysDate(`${fromDate}`), toDate: handleTodaysDate(`${toDate}`), - } - } - ] - } - history.push("/digit-ui/employee/engagement/messages/response?update=true", details) - } + }, + }, + ], + }; + history.push("/mgramseva-digit-ui/employee/engagement/messages/response?update=true", details); + }; const defaultValues = useMemo(() => { - const documents = data?.eventDetails?.documents + const documents = data?.eventDetails?.documents; return { name: data?.name, description: data?.description, - documents: documents?.map(e => [e.fileName, { file: { name: e.fileName, type: e.documentType }, fileStoreId: { fileStoreId: e.fileStoreId, tenantId } }]), - fromDate: data ? format(new Date(data?.eventDetails?.fromDate), 'yyyy-MM-dd') : null, - toDate: data ? format(new Date(data?.eventDetails?.toDate), 'yyyy-MM-dd') : null, - } - }, [data]) + documents: documents?.map((e) => [ + e.fileName, + { file: { name: e.fileName, type: e.documentType }, fileStoreId: { fileStoreId: e.fileStoreId, tenantId } }, + ]), + fromDate: data ? format(new Date(data?.eventDetails?.fromDate), "yyyy-MM-dd") : null, + toDate: data ? format(new Date(data?.eventDetails?.toDate), "yyyy-MM-dd") : null, + }; + }, [data]); if (isLoading) { - return ( - - ); + return ; } return (
{t("EDIT_NEW_PUBLIC_MESSAGE")}
- - +
- ) -} + ); +}; -export default EditMessage; \ No newline at end of file +export default EditMessage; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/pages/employee/Messages/Inbox.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/pages/employee/Messages/Inbox.js index bd63fff60..ba2e3a3ff 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/pages/employee/Messages/Inbox.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/pages/employee/Messages/Inbox.js @@ -6,53 +6,62 @@ import DesktopInbox from "../../../components/Messages/DesktopInbox"; import MobileInbox from "../../../components/Messages/MobileInbox"; const Inbox = ({ tenants, parentRoute }) => { - const { t } = useTranslation() + const { t } = useTranslation(); Digit.SessionStorage.set("ENGAGEMENT_TENANTS", tenants); const tenantId = Digit.ULBService.getCurrentTenantId(); const [pageSize, setPageSize] = useState(10); const [pageOffset, setPageOffset] = useState(0); const [searchParams, setSearchParams] = useState({ eventStatus: [], - name: '', + name: "", range: { startDate: null, endDate: new Date(""), - title: "" + title: "", }, - ulb: tenants?.find(tenant => tenant?.code === tenantId) + ulb: tenants?.find((tenant) => tenant?.code === tenantId), }); let isMobile = window.Digit.Utils.browser.isMobile(); - const { data, isLoading } = Digit.Hooks.events.useInbox(searchParams?.ulb?.code, {}, + const { data, isLoading } = Digit.Hooks.events.useInbox( + searchParams?.ulb?.code, + {}, { - status: "ACTIVE,INACTIVE", eventTypes: "BROADCAST", limit: pageSize, + status: "ACTIVE,INACTIVE", + eventTypes: "BROADCAST", + limit: pageSize, offset: pageOffset, }, { - select: (data) => ({ events: data?.events, totalCount: data?.totalCount }) - }); + select: (data) => ({ events: data?.events, totalCount: data?.totalCount }), + } + ); const onSearch = (params) => { let updatedParams = { ...params }; if (!params?.ulb) { - updatedParams = { ...params, ulb: { code: tenantId } } + updatedParams = { ...params, ulb: { code: tenantId } }; } setSearchParams((prevParams) => ({ ...prevParams, ...updatedParams })); - } + }; const handleFilterChange = (data) => { - setSearchParams((prevParams) => ({ ...prevParams, ...data })) - } + setSearchParams((prevParams) => ({ ...prevParams, ...data })); + }; const globalSearch = (rows, columnIds) => { // return rows; - return rows?.filter(row => - (searchParams?.eventStatus?.length > 0 ? searchParams?.eventStatus?.includes(row.original?.status) : true) && - (searchParams?.name ? row.original?.name?.toUpperCase().startsWith(searchParams?.name.toUpperCase()) : true) && - (searchParams?.ulb?.code ? row.original.tenantId === searchParams?.ulb?.code : true) && - (searchParams?.eventCategory ? row.original.eventCategory === searchParams?.eventCategory?.code : true) && - (isValid(searchParams?.range?.startDate) ? row.original.eventDetails?.fromDate >= new Date(searchParams?.range?.startDate).getTime() : true) && - (isValid(searchParams?.range?.endDate) ? row.original.eventDetails?.toDate <= new Date(searchParams?.range?.endDate).getTime() : true)) - } + return rows?.filter( + (row) => + (searchParams?.eventStatus?.length > 0 ? searchParams?.eventStatus?.includes(row.original?.status) : true) && + (searchParams?.name ? row.original?.name?.toUpperCase().startsWith(searchParams?.name.toUpperCase()) : true) && + (searchParams?.ulb?.code ? row.original.tenantId === searchParams?.ulb?.code : true) && + (searchParams?.eventCategory ? row.original.eventCategory === searchParams?.eventCategory?.code : true) && + (isValid(searchParams?.range?.startDate) + ? row.original.eventDetails?.fromDate >= new Date(searchParams?.range?.startDate).getTime() + : true) && + (isValid(searchParams?.range?.endDate) ? row.original.eventDetails?.toDate <= new Date(searchParams?.range?.endDate).getTime() : true) + ); + }; const getSearchFields = () => { return [ @@ -67,28 +76,28 @@ const Inbox = ({ tenants, parentRoute }) => { }, */ { label: t("EVENTS_MESSAGE_LABEL"), - name: "name" - } - ] - } + name: "name", + }, + ]; + }; const links = [ { text: t("NEW_PUBLIC_MESSAGE_BUTTON_LABEL"), - link: "/digit-ui/employee/engagement/messages/inbox/create", - } - ] + link: "/mgramseva-digit-ui/employee/engagement/messages/inbox/create", + }, + ]; const fetchNextPage = useCallback(() => { - setPageOffset((prevPageOffSet) => ((parseInt(prevPageOffSet) + parseInt(pageSize)))); - }, [pageSize]) + setPageOffset((prevPageOffSet) => parseInt(prevPageOffSet) + parseInt(pageSize)); + }, [pageSize]); const fetchPrevPage = useCallback(() => { - setPageOffset((prevPageOffSet) => ((parseInt(prevPageOffSet) - parseInt(pageSize)))); - }, [pageSize]) + setPageOffset((prevPageOffSet) => parseInt(prevPageOffSet) - parseInt(pageSize)); + }, [pageSize]); const handlePageSizeChange = (e) => { - setPageSize((prevPageSize) => (e.target.value)); + setPageSize((prevPageSize) => e.target.value); }; if (isMobile) { @@ -105,7 +114,7 @@ const Inbox = ({ tenants, parentRoute }) => { iconName={"calender"} links={links} /> - ) + ); } return ( @@ -136,6 +145,6 @@ const Inbox = ({ tenants, parentRoute }) => { />
); -} +}; -export default Inbox; \ No newline at end of file +export default Inbox; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/pages/employee/Messages/Inbox_DEMO.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/pages/employee/Messages/Inbox_DEMO.js index d41347761..7b7e35294 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/pages/employee/Messages/Inbox_DEMO.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/pages/employee/Messages/Inbox_DEMO.js @@ -1,177 +1,191 @@ -import React, {Fragment, useCallback, useMemo, useReducer} from "react" +import React, { Fragment, useCallback, useMemo, useReducer } from "react"; import { InboxComposer, CaseIcon, SearchField, TextInput, FilterFormField, Loader } from "@egovernments/digit-ui-react-components"; import { useTranslation } from "react-i18next"; import { Link } from "react-router-dom"; import { format } from "date-fns"; const Inbox = () => { - - const { t } = useTranslation() - - const tenantId = Digit.ULBService.getCurrentTenantId(); - - const searchFormDefaultValues = {} - const filterFormDefaultValues = {} - - function formReducer(state, payload) { - switch(payload.action){ - case "mutateSearchForm": - Digit.SessionStorage.set("ENGAGEMENT.MESSAGES.INBOX", {...state, searchForm: payload.data}) - return {...state, searchForm: payload.data}; - case "mutateFilterForm": - Digit.SessionStorage.set("ENGAGEMENT.MESSAGES.INBOX", {...state, filterForm: payload.data}) - return {...state, filterForm: payload.data}; - default: - break; - } + const { t } = useTranslation(); + + const tenantId = Digit.ULBService.getCurrentTenantId(); + + const searchFormDefaultValues = {}; + const filterFormDefaultValues = {}; + + function formReducer(state, payload) { + switch (payload.action) { + case "mutateSearchForm": + Digit.SessionStorage.set("ENGAGEMENT.MESSAGES.INBOX", { ...state, searchForm: payload.data }); + return { ...state, searchForm: payload.data }; + case "mutateFilterForm": + Digit.SessionStorage.set("ENGAGEMENT.MESSAGES.INBOX", { ...state, filterForm: payload.data }); + return { ...state, filterForm: payload.data }; + default: + break; } - const formInitValue = Digit.SessionStorage.get("ENGAGEMENT.MESSAGES.INBOX") || { - filterForm: filterFormDefaultValues, - searchForm: searchFormDefaultValues + } + const formInitValue = Digit.SessionStorage.get("ENGAGEMENT.MESSAGES.INBOX") || { + filterForm: filterFormDefaultValues, + searchForm: searchFormDefaultValues, + }; + const [formState, dispatch] = useReducer(formReducer, formInitValue); + const { data: inboxData, isLoading: inboxLoading } = Digit.Hooks.events.useInbox( + tenantId, + { + // limit: pageSize, + // offset: pageOffset, + }, + { status: "ACTIVE,INACTIVE", eventTypes: "BROADCAST" }, + { + select: (data) => data?.events, } - const [ formState, dispatch ] = useReducer(formReducer, formInitValue ) - const { data: inboxData, isLoading: inboxLoading } = Digit.Hooks.events.useInbox(tenantId, { - // limit: pageSize, - // offset: pageOffset, - }, - { status: "ACTIVE,INACTIVE",eventTypes: "BROADCAST" }, + ); + + const PropsForInboxLinks = { + logoIcon: , + headerText: "CS_COMMON_TEXT", + links: [ { - select: (data) => data?.events - }); - - const PropsForInboxLinks = { - logoIcon: , - headerText: "CS_COMMON_TEXT", - links: [{ - text: "TL_NEW_APPLICATION", - link: "/digit-ui/employee/engagement/messages/create", - businessService: "TL", - roles: ["TL_CEMP"], - }] - } + text: "TL_NEW_APPLICATION", + link: "/mgramseva-digit-ui/employee/engagement/messages/create", + businessService: "TL", + roles: ["TL_CEMP"], + }, + ], + }; + + const SearchFormFields = useCallback(({ registerRef }) => { + return ( + <> + + + + + + + + + + + + + + ); + }); - const SearchFormFields = useCallback(({registerRef}) => { - return <> - - - - - - - - - - - - - - }) - - const FilterFormFields = useCallback(({registerRef}) => { - return <> - -

{t("ES_COMMON_SEARCH")}

-
- {/* { + return ( + <> + +

{t("ES_COMMON_SEARCH")}

+
+ {/* onServiceSelect(event, e.statusid)} /> */} - - }) + + ); + }); + const onSearchFormSubmit = (data) => { + dispatch({ action: "mutateSearchForm", data }); + }; - const onSearchFormSubmit = (data) => { - dispatch({action: "mutateSearchForm", data}) - } - - const onFilterFormSubmit = (data) => { - dispatch({action: "mutateFilterForm", data}) - } + const onFilterFormSubmit = (data) => { + dispatch({ action: "mutateFilterForm", data }); + }; + + const propsForSearchForm = { SearchFormFields, onSearchFormSubmit, searchFormDefaultValues }; + + const propsForFilterForm = { FilterFormFields, onFilterFormSubmit, filterFormDefaultValues }; + + const GetCell = (value) => {value}; + const GetStatusCell = (value) => + value === "Active" ? {value} : {value}; + + const tableColumnConfig = useMemo(() => { + return [ + { + Header: t("EVENTS_MESSAGE_LABEL"), + accessor: "message", + Cell: ({ row }) => { + return ( +
+ {row.original["description"]} +
+ ); + }, + }, + { + Header: t("EVENTS_POSTING_DATE_LABEL"), + accessor: (row) => (row?.auditDetails?.createdTime ? GetCell(format(new Date(row?.auditDetails?.createdTime), "dd/MM/yyyy")) : ""), + }, + { + Header: t("EVENTS_START_DATE_LABEL"), + accessor: (row) => (row?.eventDetails?.fromDate ? GetCell(format(new Date(row?.eventDetails?.fromDate), "dd/MM/yyyy")) : ""), + }, + { + Header: t("EVENTS_END_DATE_LABEL"), + accessor: (row) => (row?.eventDetails?.toDate ? GetCell(format(new Date(row?.eventDetails?.toDate), "dd/MM/yyyy")) : ""), + }, + { + Header: t("EVENTS_POSTEDBY_LABEL"), + accessor: (row) => GetCell(row?.user?.name || ""), + }, + { + Header: t("EVENTS_STATUS_LABEL"), + accessor: (row) => GetStatusCell(t(row?.status)), + }, + ]; + }); + + const searchForItemsInTable = (rows, columnIds) => { + return rows; + }; + + const propsForInboxTable = useMemo(() => { + return { + getCellProps: (cellInfo) => { + return { + style: { + padding: "20px 18px", + fontSize: "16px", + }, + }; + }, + disableSort: false, + autoSort: true, + // manualPagination:false, + // initSortId="S N " + // onPageSizeChange:onPageSizeChange, + // currentPage: getValues("offset")/getValues("limit"), + // onNextPage: nextPage, + // onPrevPage: previousPage, + // pageSizeLimit: 10, + // onSort: onSort, + // sortParams: [{id: getValues("sortBy"), desc: getValues("sortOrder") === "DESC" ? true : false}], + totalRecords: 100, + onSearch: formState?.searchForm?.message, + // globalSearch: {searchForItemsInTable}, + // searchQueryForTable, + data: inboxData, + columns: tableColumnConfig, + }; + }, [inboxData, tableColumnConfig, formState?.searchForm?.message]); - const propsForSearchForm = { SearchFormFields, onSearchFormSubmit, searchFormDefaultValues } - - const propsForFilterForm = { FilterFormFields, onFilterFormSubmit, filterFormDefaultValues } - - const GetCell = (value) => {value}; - const GetStatusCell = (value) => value === "Active" ? {value} : {value} - - const tableColumnConfig = useMemo(() => { - return [ - { - Header: t("EVENTS_MESSAGE_LABEL"), - accessor: "message", - Cell: ({ row }) => { - return ( -
- {row.original["description"]} -
- ); - }, - }, - { - Header: t("EVENTS_POSTING_DATE_LABEL"), - accessor: (row) => row?.auditDetails?.createdTime ? GetCell(format(new Date(row?.auditDetails?.createdTime), 'dd/MM/yyyy')) : "" - }, - { - Header: t("EVENTS_START_DATE_LABEL"), - accessor: (row) => row?.eventDetails?.fromDate ? GetCell(format(new Date(row?.eventDetails?.fromDate), 'dd/MM/yyyy')) : "", - }, - { - Header: t("EVENTS_END_DATE_LABEL"), - accessor: (row) => row?.eventDetails?.toDate ? GetCell(format(new Date(row?.eventDetails?.toDate), "dd/MM/yyyy")) : "", - }, - { - Header: t("EVENTS_POSTEDBY_LABEL"), - accessor: row => GetCell(row?.user?.name || "") - }, - { - Header: t("EVENTS_STATUS_LABEL"), - accessor: row => GetStatusCell(t(row?.status)), - } - ] - }) - - const searchForItemsInTable = (rows, columnIds)=>{ - return rows - } - - const propsForInboxTable = useMemo(()=>{ - return { - getCellProps: (cellInfo) => { - return { - style: { - padding: "20px 18px", - fontSize: "16px" - }}}, - disableSort: false, - autoSort:true, - // manualPagination:false, - // initSortId="S N " - // onPageSizeChange:onPageSizeChange, - // currentPage: getValues("offset")/getValues("limit"), - // onNextPage: nextPage, - // onPrevPage: previousPage, - // pageSizeLimit: 10, - // onSort: onSort, - // sortParams: [{id: getValues("sortBy"), desc: getValues("sortOrder") === "DESC" ? true : false}], - totalRecords: 100, - onSearch: formState?.searchForm?.message, - // globalSearch: {searchForItemsInTable}, - // searchQueryForTable, - data: inboxData, - columns: tableColumnConfig - } - },[inboxData, tableColumnConfig, formState?.searchForm?.message]) - - return inboxLoading ? : - {/* */} - {/* + return inboxLoading ? ( + + ) : ( + + {/* */} + {/* */} -} + ); +}; -export default Inbox \ No newline at end of file +export default Inbox; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/pages/employee/Messages/MessageDetails.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/pages/employee/Messages/MessageDetails.js index a624a3de5..66356e471 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/pages/employee/Messages/MessageDetails.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/pages/employee/Messages/MessageDetails.js @@ -1,7 +1,19 @@ import React, { Fragment, useState } from "react"; import { useParams, useHistory } from "react-router-dom"; import { useTranslation } from "react-i18next"; -import { Header, Card, CardSectionHeader, PDFSvg, Loader, StatusTable, Menu, ActionBar, SubmitBar, Modal, CardText } from "@egovernments/digit-ui-react-components"; +import { + Header, + Card, + CardSectionHeader, + PDFSvg, + Loader, + StatusTable, + Menu, + ActionBar, + SubmitBar, + Modal, + CardText, +} from "@egovernments/digit-ui-react-components"; import ApplicationDetailsTemplate from "../../../../../templates/ApplicationDetails"; import { format } from "date-fns"; @@ -29,12 +41,21 @@ const DocumentDetails = ({ t, data, documents, paymentDetails }) => { {data?.map((document, index) => ( -
-
{t(`BPA_${document?.documentType}`)}
+
+
{t(`BPA_${document?.documentType}`)}
- {decodeURIComponent( documents[document.fileStoreId].split(",")[0].split("?")[0].split("/").pop().slice(13))} + {decodeURIComponent(documents[document.fileStoreId].split(",")[0].split("?")[0].split("/").pop().slice(13))}
))} @@ -47,7 +68,7 @@ const DocumentDetails = ({ t, data, documents, paymentDetails }) => {
*/}
); -} +}; const MessageDetails = () => { const { id } = useParams(); @@ -57,33 +78,41 @@ const MessageDetails = () => { const [displayMenu, setDisplayMenu] = useState(false); const tenantId = Digit.ULBService.getCurrentTenantId(); - - const { isLoading, data } = Digit.Hooks.events.useEventDetails(tenantId, { ids: id }, { - select: (data) => { - const details = [{ - title: "", - asSectionHeader: true, - values: [ - { title: "EVENTS_ULB_LABEL", value: data?.tenantId }, - { title: "EVENTS_NAME_LABEL", value: data?.name }, - { title: "PUBLIC_BRDCST_TITLE_LABEL", value: data?.description }, - { title: "EVENTS_FROM_DATE_LABEL", value: format(new Date(data?.eventDetails?.fromDate), 'dd/MM/yyyy') }, - { title: "EVENTS_TO_DATE_LABEL", value: format(new Date(data?.eventDetails?.toDate), 'dd/MM/yyyy') }, - { title: "CS_COMMON_DOCUMENTS", belowComponent: () => } - ] - }] - return { - applicationData: data, - applicationDetails: details, - tenantId: tenantId - } + const { isLoading, data } = Digit.Hooks.events.useEventDetails( + tenantId, + { ids: id }, + { + select: (data) => { + const details = [ + { + title: "", + asSectionHeader: true, + values: [ + { title: "EVENTS_ULB_LABEL", value: data?.tenantId }, + { title: "EVENTS_NAME_LABEL", value: data?.name }, + { title: "PUBLIC_BRDCST_TITLE_LABEL", value: data?.description }, + { title: "EVENTS_FROM_DATE_LABEL", value: format(new Date(data?.eventDetails?.fromDate), "dd/MM/yyyy") }, + { title: "EVENTS_TO_DATE_LABEL", value: format(new Date(data?.eventDetails?.toDate), "dd/MM/yyyy") }, + { + title: "CS_COMMON_DOCUMENTS", + belowComponent: () => , + }, + ], + }, + ]; + return { + applicationData: data, + applicationDetails: details, + tenantId: tenantId, + }; + }, } - }); + ); function onActionSelect(action) { // setSelectedAction(action); if (action === "EDIT") { - history.push(`/digit-ui/employee/engagement/messages/inbox/edit/${id}`) + history.push(`/mgramseva-digit-ui/employee/engagement/messages/inbox/edit/${id}`); } if (action === "DELETE") { setShowModal(true); @@ -92,7 +121,7 @@ const MessageDetails = () => { } const handleDelete = () => { - const finalData = (({ uploadedFilesData, ...ogData }) => ogData)(data?.applicationData) + const finalData = (({ uploadedFilesData, ...ogData }) => ogData)(data?.applicationData); const details = { events: [ { @@ -101,7 +130,7 @@ const MessageDetails = () => { }, ], }; - history.push("/digit-ui/employee/engagement/messages/response?delete=true", details); + history.push("/mgramseva-digit-ui/employee/engagement/messages/response?delete=true", details); }; return ( @@ -121,32 +150,25 @@ const MessageDetails = () => { // } /> - {displayMenu ? ( - - ) : null} + {displayMenu ? : null} setDisplayMenu(!displayMenu)} /> - {showModal && + {showModal && ( } - headerBarEnd={ setShowModal(false)} />} - actionCancelLabel={t("CS_COMMON_CANCEL")} - actionCancelOnSubmit={() => setShowModal(false)} - actionSaveLabel={t('PUBLIC_BRDCST_DELETE')} - actionSaveOnSubmit={handleDelete} + headerBarMain={} + headerBarEnd={ setShowModal(false)} />} + actionCancelLabel={t("CS_COMMON_CANCEL")} + actionCancelOnSubmit={() => setShowModal(false)} + actionSaveLabel={t("PUBLIC_BRDCST_DELETE")} + actionSaveOnSubmit={handleDelete} > {t(`PUBLIC_BRDCST_DELETE_TEXT`)} - } + )} ); }; -export default MessageDetails; \ No newline at end of file +export default MessageDetails; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/pages/employee/Messages/NewMessage/Response.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/pages/employee/Messages/NewMessage/Response.js index 9a38fce67..7e7865cf8 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/pages/employee/Messages/NewMessage/Response.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/pages/employee/Messages/NewMessage/Response.js @@ -13,8 +13,8 @@ const BannerPicker = (props) => { //info={t(`MESSAGE_ADD_SUCCESS_MESSAGE_MAIN`)} successful={props.isSuccess} /> - ) -} + ); +}; const Response = (props) => { const queryClient = useQueryClient(); @@ -28,19 +28,16 @@ const Response = (props) => { const [successData, setsuccessData, clearSuccessData] = Digit.Hooks.useSessionStorage("EMPLOYEE_MSG_MUTATION_SUCCESS_DATA", false); const [errorInfo, setErrorInfo, clearError] = Digit.Hooks.useSessionStorage("EMPLOYEE_MSG_ERROR_DATA", false); - - useEffect(() => { if (updateEventMutation.data) setsuccessData(updateEventMutation.data); }, [updateEventMutation.data]); - useEffect(() => { if (mutation.data) setsuccessData(mutation.data); }, [mutation.data]); const onError = (error, variables) => { - setErrorInfo(error?.response?.data?.Errors[0]?.code || 'ERROR'); + setErrorInfo(error?.response?.data?.Errors[0]?.code || "ERROR"); setMutationHappened(true); }; @@ -48,7 +45,7 @@ const Response = (props) => { const onSuccess = () => { setMutationHappened(true); queryClient.clear(); - } + }; if (!mutationHappened) { if (Boolean(searchParams?.delete) || Boolean(searchParams?.update)) { updateEventMutation.mutate(state, { @@ -60,37 +57,43 @@ const Response = (props) => { mutation.mutate(state, { onError, onSuccess, - }) + }); } }, []); if (searchParams?.delete || searchParams?.update) { if (updateEventMutation.isLoading || (updateEventMutation.isIdle && !mutationHappened)) { - return + return ; } return ( - - {searchParams?.update ? t(`ENGAGEMENT_PUBLIC_BRDCST_MESSAGES`) : t(`ENGAGEMENT_PUBLIC_BRDCST_MESSAGES`)} - + {searchParams?.update ? t(`ENGAGEMENT_PUBLIC_BRDCST_MESSAGES`) : t(`ENGAGEMENT_PUBLIC_BRDCST_MESSAGES`)} - + - ) + ); } if (mutation.isLoading || (mutation.isIdle && !mutationHappened)) { - return + return ; } return ( @@ -102,12 +105,12 @@ const Response = (props) => { isLoading={(mutation.isIdle && !mutationHappened) || mutation.isLoading} /> - + - ) -} + ); +}; -export default Response; \ No newline at end of file +export default Response; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/pages/employee/Messages/NewMessage/index.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/pages/employee/Messages/NewMessage/index.js index b82c9a5a5..79aa34b76 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/pages/employee/Messages/NewMessage/index.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/pages/employee/Messages/NewMessage/index.js @@ -5,8 +5,6 @@ import { useHistory } from "react-router-dom"; import { convertDateToMaximumPossibleValue } from "../../../../utils"; import { config } from "../../../../config/NewMessageConfig"; - - const NewEvents = () => { const { t } = useTranslation(); const history = useHistory(); @@ -34,24 +32,19 @@ const NewEvents = () => { documents, fromDate: convertDateToMaximumPossibleValue(new Date(`${fromDate}`))?.getTime(), toDate: convertDateToMaximumPossibleValue(new Date(`${toDate}`))?.getTime(), - } - } - ] - } - history.push("/digit-ui/employee/engagement/messages/response", details) - } + }, + }, + ], + }; + history.push("/mgramseva-digit-ui/employee/engagement/messages/response", details); + }; return (
{t("ADD_NEW_PUBLIC_MESSAGE")}
- - +
- ) -} + ); +}; -export default NewEvents; \ No newline at end of file +export default NewEvents; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/components/DesktopInbox.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/components/DesktopInbox.js index 6f9c33db5..eccf3fe53 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/components/DesktopInbox.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/components/DesktopInbox.js @@ -20,7 +20,7 @@ const DesktopInbox = (props) => { }; function goTo(id) { - // history.push("/digit-ui/employee/fsm/complaint/details/" + id); + // history.push("/mgramseva-digit-ui/employee/fsm/complaint/details/" + id); } const columns = React.useMemo(() => { @@ -96,7 +96,10 @@ const DesktopInbox = (props) => { return (
- {citizen_info?.applicationNo} + + {" "} + {citizen_info?.applicationNo} +
); @@ -151,7 +154,7 @@ const DesktopInbox = (props) => { return (
- + {row.original["tripDetails"].map((i) => (
{i.referenceNo} @@ -172,7 +175,9 @@ const DesktopInbox = (props) => { return (
- {row.original["applicationNo"]} + + {row.original["applicationNo"]} +
); diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/components/FsmCard.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/components/FsmCard.js index dc84f1b60..d4c45e731 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/components/FsmCard.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/components/FsmCard.js @@ -63,9 +63,13 @@ const FSMCard = () => { else return { uuid: { code: "ASSIGNED_TO_ME", name: t("ES_INBOX_ASSIGNED_TO_ME") } }; }; - const { data: inbox, isFetching: pendingApprovalRefetching } = Digit.Hooks.fsm.useInbox(tenantId, { ...filters, limit: 10, offset: 0, ...getUUIDFilter() }, { - enabled: !isFSTPOperator ? true : false, - }); + const { data: inbox, isFetching: pendingApprovalRefetching } = Digit.Hooks.fsm.useInbox( + tenantId, + { ...filters, limit: 10, offset: 0, ...getUUIDFilter() }, + { + enabled: !isFSTPOperator ? true : false, + } + ); useEffect(() => { if (inbox) { @@ -80,69 +84,70 @@ const FSMCard = () => { // kpis: isSuccess ? Object.keys(info).map((key, index) => ({ // label: t(key), // count: t(info[key]), - // link: "/digit-ui/employee/fsm/fstp-inbox" + // link: "/mgramseva-digit-ui/employee/fsm/fstp-inbox" // })): [], links: [ { label: t("ES_COMMON_HOME"), - link: "/digit-ui/employee/fsm/fstp-operations" - } - ] - - } + link: "/mgramseva-digit-ui/employee/fsm/fstp-operations", + }, + ], + }; if (isFSTPOperator && isSuccess) { - return + return ; } - const linksForSomeFSMEmployees = !DSO && !COLLECTOR && !FSM_EDITOR ? [ - { - label: t("ES_TITLE_NEW_DESULDGING_APPLICATION"), - link: `/digit-ui/employee/fsm/new-application` - } - ] : [] - - const propsForModuleCard = isFSTPOperator ? - { - Icon: , - moduleName: t("ES_TITLE_VEHICLE_LOG"), - // kpis: isSuccess ? Object.keys(info).map((key, index) => ({ - // label: t(key), - // count: t(info[key]), - // link: "/digit-ui/employee/fsm/fstp-inbox" - // })): [], - links: [ - { - label: t("ES_COMMON_HOME"), - link: "/digit-ui/employee/fsm/fstp-operations" - } - ] - - } : - { - Icon: , - moduleName: t("ES_TITLE_FAECAL_SLUDGE_MGMT"), - kpis: [ - { - count: total, - label: t("TOTAL_FSM"), - link: `/digit-ui/employee/fsm/inbox` - }, - { - label: t("TOTAL_NEARING_SLA"), - link: `/digit-ui/employee/fsm/inbox` - } - ], - links: [ - { - count: total, - label: t("ES_COMMON_INBOX"), - link: `/digit-ui/employee/fsm/inbox` - }, - ...linksForSomeFSMEmployees - ] - } - - return + const linksForSomeFSMEmployees = + !DSO && !COLLECTOR && !FSM_EDITOR + ? [ + { + label: t("ES_TITLE_NEW_DESULDGING_APPLICATION"), + link: `/mgramseva-digit-ui/employee/fsm/new-application`, + }, + ] + : []; + + const propsForModuleCard = isFSTPOperator + ? { + Icon: , + moduleName: t("ES_TITLE_VEHICLE_LOG"), + // kpis: isSuccess ? Object.keys(info).map((key, index) => ({ + // label: t(key), + // count: t(info[key]), + // link: "/mgramseva-digit-ui/employee/fsm/fstp-inbox" + // })): [], + links: [ + { + label: t("ES_COMMON_HOME"), + link: "/mgramseva-digit-ui/employee/fsm/fstp-operations", + }, + ], + } + : { + Icon: , + moduleName: t("ES_TITLE_FAECAL_SLUDGE_MGMT"), + kpis: [ + { + count: total, + label: t("TOTAL_FSM"), + link: `/mgramseva-digit-ui/employee/fsm/inbox`, + }, + { + label: t("TOTAL_NEARING_SLA"), + link: `/mgramseva-digit-ui/employee/fsm/inbox`, + }, + ], + links: [ + { + count: total, + label: t("ES_COMMON_INBOX"), + link: `/mgramseva-digit-ui/employee/fsm/inbox`, + }, + ...linksForSomeFSMEmployees, + ], + }; + + return ; }; export default FSMCard; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/components/RegistryInbox.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/components/RegistryInbox.js index 9f5c8188b..8aa82c2d0 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/components/RegistryInbox.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/components/RegistryInbox.js @@ -264,21 +264,21 @@ const RegisryInbox = (props) => { const onActionSelect = (action, type, data) => { if (type === "VEHICLE") { - history.push("/digit-ui/employee/fsm/registry/vehicle-details/" + action); + history.push("/mgramseva-digit-ui/employee/fsm/registry/vehicle-details/" + action); } else { let driver = data.find((ele) => ele.name === action); - history.push("/digit-ui/employee/fsm/registry/driver-details/" + driver?.id); + history.push("/mgramseva-digit-ui/employee/fsm/registry/driver-details/" + driver?.id); } }; const onSelectAdd = () => { switch (props.selectedTab) { case "VENDOR": - return history.push("/digit-ui/employee/fsm/registry/new-vendor"); + return history.push("/mgramseva-digit-ui/employee/fsm/registry/new-vendor"); case "VEHICLE": - return history.push("/digit-ui/employee/fsm/registry/new-vehicle"); + return history.push("/mgramseva-digit-ui/employee/fsm/registry/new-vehicle"); case "DRIVER": - return history.push("/digit-ui/employee/fsm/registry/new-driver"); + return history.push("/mgramseva-digit-ui/employee/fsm/registry/new-driver"); default: break; } @@ -295,7 +295,7 @@ const RegisryInbox = (props) => { return (
- +
{row.original.name}
@@ -435,7 +435,7 @@ const RegisryInbox = (props) => { return (
- +
{row.original.registrationNumber}
@@ -493,7 +493,7 @@ const RegisryInbox = (props) => { return (
- +
{row.original.name}
diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/components/RegistrySearch.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/components/RegistrySearch.js index 9169a6ba8..d6c0aa833 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/components/RegistrySearch.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/components/RegistrySearch.js @@ -73,11 +73,11 @@ const SearchApplication = ({ onSearch, type, onClose, onTabChange, isFstpOperato function onActionSelect(action) { switch (action) { case "VENDOR": - return history.push("/digit-ui/employee/fsm/registry/new-vendor"); + return history.push("/mgramseva-digit-ui/employee/fsm/registry/new-vendor"); case "VEHICLE": - return history.push("/digit-ui/employee/fsm/registry/new-vehicle"); + return history.push("/mgramseva-digit-ui/employee/fsm/registry/new-vehicle"); case "DRIVER": - return history.push("/digit-ui/employee/fsm/registry/new-driver"); + return history.push("/mgramseva-digit-ui/employee/fsm/registry/new-driver"); default: break; } diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/components/inbox/ApplicationCard.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/components/inbox/ApplicationCard.js index 53112177d..d2ae82f59 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/components/inbox/ApplicationCard.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/components/inbox/ApplicationCard.js @@ -102,7 +102,7 @@ export const ApplicationCard = ({ ); } @@ -119,7 +119,7 @@ export const ApplicationCard = ({ }} /> )} - {!isSearch && onFilterChange && ((!DSO && !isFstpOperator && searchParams) || (mergedRoleDetails?.statuses?.length > 0)) && ( + {!isSearch && onFilterChange && ((!DSO && !isFstpOperator && searchParams) || mergedRoleDetails?.statuses?.length > 0) && ( { @@ -128,13 +128,15 @@ export const ApplicationCard = ({ }} /> )} - {!isSearch && { - setType("SORT"); - setPopup(true); - }} - />} + {!isSearch && ( + { + setType("SORT"); + setPopup(true); + }} + /> + )}
{result} {popup && ( @@ -155,9 +157,7 @@ export const ApplicationCard = ({
)} {type === "SORT" && ( -
- {} -
+
{}
)} {type === "SEARCH" && (
diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/components/inbox/ApplicationLinks.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/components/inbox/ApplicationLinks.js index 55e92dde1..799b54004 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/components/inbox/ApplicationLinks.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/components/inbox/ApplicationLinks.js @@ -9,7 +9,7 @@ const ApplicationLinks = ({ linkPrefix }) => { const allLinks = [ { text: t("ES_TITLE_NEW_DESULDGING_APPLICATION"), - link: "/digit-ui/employee/fsm/new-application", + link: "/mgramseva-digit-ui/employee/fsm/new-application", accessTo: ["FSM_CREATOR_EMP"], }, // { text: t("ES_TITLE_REPORTS"), link: "/employee" }, diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/components/inbox/FSMLink.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/components/inbox/FSMLink.js index fcd4fe0b1..68498a9ab 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/components/inbox/FSMLink.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/components/inbox/FSMLink.js @@ -10,7 +10,7 @@ const FSMLink = ({ parentRoute, isMobile, data }) => { const allLinks = [ { text: t("ES_TITLE_NEW_DESULDGING_APPLICATION"), - link: "/digit-ui/employee/fsm/new-application", + link: "/mgramseva-digit-ui/employee/fsm/new-application", roles: ["FSM_CREATOR_EMP"], }, // { text: t("ES_TITLE_REPORTS"), link: "/employee" }, diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/Response.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/Response.js index 604ed76db..69096bd58 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/Response.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/Response.js @@ -119,7 +119,9 @@ const Response = (props) => { closeToast(); }, 5000); } else { - history.push(`/digit-ui/employee/payment/collect/FSM.TRIP_CHARGES/${state?.applicationData?.applicationNo || Data?.fsm?.[0].applicationNo}`); + history.push( + `/mgramseva-digit-ui/employee/payment/collect/FSM.TRIP_CHARGES/${state?.applicationData?.applicationNo || Data?.fsm?.[0].applicationNo}` + ); } }; @@ -179,9 +181,9 @@ const Response = (props) => { useEffect(() => { switch (selectedAction) { case "GO_TO_HOME": - return isCitizen ? history.push("/digit-ui/citizen") : history.push("/digit-ui/employee"); + return isCitizen ? history.push("/digit-ui/citizen") : history.push("/mgramseva-digit-ui/employee"); case "ASSIGN_TO_DSO": - return history.push(`/digit-ui/employee/fsm/application-details/${getApplicationNo}`); + return history.push(`/mgramseva-digit-ui/employee/fsm/application-details/${getApplicationNo}`); case "PAY": return handleResponse(); } diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/ApplicationAudit.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/ApplicationAudit.js index 66060a786..40fe0e8a9 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/ApplicationAudit.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/ApplicationAudit.js @@ -63,7 +63,7 @@ const ApplicationAudit = ({ parentRoute }) => { index === 0 ? (

New Request{" "} - +

diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/ApplicationDetails/Modal/index.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/ApplicationDetails/Modal/index.js index f784b4904..5a0d5d3a8 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/ApplicationDetails/Modal/index.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/ApplicationDetails/Modal/index.js @@ -3,7 +3,16 @@ import React, { useState, useEffect } from "react"; import { useQueryClient } from "react-query"; import { UploadPitPhoto } from "@egovernments/digit-ui-react-components"; -import { configAssignDso, configCompleteApplication, configReassignDSO, configAcceptDso, configRejectApplication, configScheduleDso, configUpdateTrips, configRejectFstpo } from "../config"; +import { + configAssignDso, + configCompleteApplication, + configReassignDSO, + configAcceptDso, + configRejectApplication, + configScheduleDso, + configUpdateTrips, + configRejectFstpo, +} from "../config"; const Heading = (props) => { return

{props.label}

; @@ -25,23 +34,26 @@ const CloseBtn = (props) => { }; const popupActionBarStyles = { - boxShadow: '0 -2px 8px rgb(0 0 0 / 16%)', - maxWidth: '480px', - zIndex: '100', - left: '0', - bottom: '0', - width: '100%', - backgroundColor: 'rgba(255, 255, 255)', - padding: '8px', - position: 'fixed', - textAlign: 'right', - display: 'flex', - justifyContent: 'space-around' -} + boxShadow: "0 -2px 8px rgb(0 0 0 / 16%)", + maxWidth: "480px", + zIndex: "100", + left: "0", + bottom: "0", + width: "100%", + backgroundColor: "rgba(255, 255, 255)", + padding: "8px", + position: "fixed", + textAlign: "right", + display: "flex", + justifyContent: "space-around", +}; const ActionModal = ({ t, action, tenantId, state, id, closeModal, submitAction, actionData, module }) => { const mobileView = Digit.Utils.browser.isMobile() ? true : false; - const { data: dsoData, isLoading: isDsoLoading, isSuccess: isDsoSuccess, error: dsoError } = Digit.Hooks.fsm.useDsoSearch(tenantId, { limit: '-1', status: 'ACTIVE' }); + const { data: dsoData, isLoading: isDsoLoading, isSuccess: isDsoSuccess, error: dsoError } = Digit.Hooks.fsm.useDsoSearch(tenantId, { + limit: "-1", + status: "ACTIVE", + }); const { isLoading, isSuccess, isError, data: applicationData, error } = Digit.Hooks.fsm.useSearch( tenantId, { applicationNos: id }, @@ -84,18 +96,15 @@ const ActionModal = ({ t, action, tenantId, state, id, closeModal, submitAction, { staleTime: Infinity } ); - const { data: pitList, isLoading: isPitData, isSuccess: isPitDataLoaded } = Digit.Hooks.fsm.useMDMS( - stateCode, - "FSM", - "PitType", - { staleTime: Infinity } - ); + const { data: pitList, isLoading: isPitData, isSuccess: isPitDataLoaded } = Digit.Hooks.fsm.useMDMS(stateCode, "FSM", "PitType", { + staleTime: Infinity, + }); const { data: Reason, isLoading: isReasonLoading } = Digit.Hooks.fsm.useMDMS(stateCode, "FSM", "Reason", { staleTime: Infinity }, [ "ReassignReason", "RejectionReason", "DeclineReason", - "CancelReason" + "CancelReason", ]); const { data: FSTPORejectionReasons, isLoading: isFSTPORejectionReasonData } = Digit.Hooks.fsm.useMDMS( @@ -133,7 +142,7 @@ const ActionModal = ({ t, action, tenantId, state, id, closeModal, submitAction, const [defaultValues, setDefautValue] = useState({ capacity: vehicle?.capacity, wasteCollected: vehicle?.capacity, - propertyType: applicationData?.propertyUsage.split('.')[0], + propertyType: applicationData?.propertyUsage.split(".")[0], subtype: applicationData?.propertyUsage, pitType: applicationData?.sanitationtype, pitDetail: applicationData?.pitDetail, @@ -142,9 +151,9 @@ const ActionModal = ({ t, action, tenantId, state, id, closeModal, submitAction, useEffect(() => { if (isSuccess && isVehicleDataLoaded && applicationData) { const [vehicle] = vehicleList.filter((item) => item.code === applicationData.vehicleType); - let arrayList = defaultValues + let arrayList = defaultValues; arrayList.capacity = applicationData?.vehicleCapacity; - arrayList.wasteCollected = applicationData?.vehicleCapacity + arrayList.wasteCollected = applicationData?.vehicleCapacity; setVehicleMenu([vehicle]); setVehicle(vehicle); setDefautValue(arrayList); @@ -153,7 +162,7 @@ const ActionModal = ({ t, action, tenantId, state, id, closeModal, submitAction, useEffect(() => { if (isSuccess && isPropertyDataLoaded && applicationData) { - const [property] = propertyList.filter((item) => item.code === applicationData.propertyUsage.split('.')[0]); + const [property] = propertyList.filter((item) => item.code === applicationData.propertyUsage.split(".")[0]); let arrayList = defaultValues; arrayList.propertyType = property; setPropertyMenu([property]); @@ -180,9 +189,8 @@ const ActionModal = ({ t, action, tenantId, state, id, closeModal, submitAction, arrayList.pitType = pitType; arrayList.pitDetail = pitDetail; setPitType(pitType); - setPitDetail(applicationData.pitDetail) - setDefautValue(arrayList) - + setPitDetail(applicationData.pitDetail); + setDefautValue(arrayList); } }, [isPitDataLoaded, isSuccess]); @@ -197,7 +205,7 @@ const ActionModal = ({ t, action, tenantId, state, id, closeModal, submitAction, if (isSuccess && isDsoSuccess && applicationData && applicationData.dsoId) { const [dso] = dsoData.filter((dso) => dso.id === applicationData.dsoId); const tempList = dso?.vehicles?.filter((vehicle) => vehicle.capacity == applicationData?.vehicleCapacity); - const vehicleNoList = tempList.sort((a,b) => (a.registrationNumber > b.registrationNumber ? 1 : -1 )); + const vehicleNoList = tempList.sort((a, b) => (a.registrationNumber > b.registrationNumber ? 1 : -1)); setVehicleNoList(vehicleNoList); } }, [isSuccess, isDsoSuccess]); @@ -273,13 +281,16 @@ const ActionModal = ({ t, action, tenantId, state, id, closeModal, submitAction, if (data.pitDetail) applicationData.pitDetail.diameter = Number(data.pitDetail.diameter); if (data.pitDetail) applicationData.pitDetail.length = Number(data.pitDetail.length); if (data.pitType) applicationData.sanitationtype = data.pitType.code; - if (data.subtype && typeof (data.subtype) === "object") applicationData.propertyUsage = data.subtype.code; - if (data.subtype && typeof (data.subtype) === "string") applicationData.propertyUsage = data.subtype; + if (data.subtype && typeof data.subtype === "object") applicationData.propertyUsage = data.subtype.code; + if (data.subtype && typeof data.subtype === "string") applicationData.propertyUsage = data.subtype; if (data.noOfTrips) applicationData.noOfTrips = data.noOfTrips; if (fileStoreId) { if (applicationData.pitDetail.additionalDetails && applicationData.pitDetail.additionalDetails.fileStoreId) { - applicationData.pitDetail.additionalDetails.fileStoreId = { ...applicationData.pitDetail.additionalDetails.fileStoreId, FSM_DSO: fileStoreId }; + applicationData.pitDetail.additionalDetails.fileStoreId = { + ...applicationData.pitDetail.additionalDetails.fileStoreId, + FSM_DSO: fileStoreId, + }; } else { applicationData.pitDetail.additionalDetails = { fileStoreId: { FSM_DSO: fileStoreId } }; } @@ -348,8 +359,7 @@ const ActionModal = ({ t, action, tenantId, state, id, closeModal, submitAction, case "REASSIGN": case "REASSING": case "FSM_REASSING": - dso && - (reassignReason || (actionData && actionData[0] && actionData[0].comment?.length > 0 && actionData[0]?.status === "DSO_REJECTED")) + dso && (reassignReason || (actionData && actionData[0] && actionData[0].comment?.length > 0 && actionData[0]?.status === "DSO_REJECTED")) ? setFormValve(true) : setFormValve(false); return setConfig( @@ -373,10 +383,20 @@ const ActionModal = ({ t, action, tenantId, state, id, closeModal, submitAction, case "COMPLETE": case "COMPLETED": setFormValve(true); - return setConfig(configCompleteApplication({ t, vehicle, vehicleCapacity: applicationData?.vehicleCapacity, noOfTrips: applicationData?.noOfTrips, applicationCreatedTime: applicationData?.auditDetails?.createdTime, action, module })); + return setConfig( + configCompleteApplication({ + t, + vehicle, + vehicleCapacity: applicationData?.vehicleCapacity, + noOfTrips: applicationData?.noOfTrips, + applicationCreatedTime: applicationData?.auditDetails?.createdTime, + action, + module, + }) + ); case "SUBMIT": case "FSM_SUBMIT": - return history.push("/digit-ui/employee/fsm/modify-application/" + applicationNumber); + return history.push("/mgramseva-digit-ui/employee/fsm/modify-application/" + applicationNumber); case "DECLINE": case "DSO_REJECT": //declinereason @@ -418,25 +438,25 @@ const ActionModal = ({ t, action, tenantId, state, id, closeModal, submitAction, ); // case "SCHEDULE": // case "ES_FSM_SCHEDULE": - // setFormValve(true); - // return setConfig( - // configScheduleDso({ - // t, - // rejectMenu: Reason?.DeclineReason, - // setReason: setDeclineReason, - // reason: declineReason, - // applicationCreatedTime: applicationData?.auditDetails?.createdTime, - // vehicle, - // vehicleCapacity: applicationData?.vehicleCapacity, - // action, - // noOfTrips: applicationData?.noOfTrips - // }) - // ); + // setFormValve(true); + // return setConfig( + // configScheduleDso({ + // t, + // rejectMenu: Reason?.DeclineReason, + // setReason: setDeclineReason, + // reason: declineReason, + // applicationCreatedTime: applicationData?.auditDetails?.createdTime, + // vehicle, + // vehicleCapacity: applicationData?.vehicleCapacity, + // action, + // noOfTrips: applicationData?.noOfTrips + // }) + // ); case "PAY": case "ADDITIONAL_PAY_REQUEST": case "FSM_PAY": - return history.push(`/digit-ui/employee/payment/collect/FSM.TRIP_CHARGES/${applicationNumber}`); + return history.push(`/mgramseva-digit-ui/employee/payment/collect/FSM.TRIP_CHARGES/${applicationNumber}`); case "DECLINEVEHICLE": setFormValve(fstpoRejectionReason ? true : false); return setConfig( @@ -457,16 +477,16 @@ const ActionModal = ({ t, action, tenantId, state, id, closeModal, submitAction, return action && config.form && !isDsoLoading && !isReasonLoading && isVehicleDataLoaded ? ( } headerBarEnd={} actionCancelLabel={t(config.label.cancel)} actionCancelOnSubmit={closeModal} actionSaveLabel={t(config.label.submit)} - actionSaveOnSubmit={() => { }} + actionSaveOnSubmit={() => {}} formId="modal-action" isDisabled={!formValve} - popupModuleMianStyles={mobileView ? { paddingBottom: '60px' } : {}} + popupModuleMianStyles={mobileView ? { paddingBottom: "60px" } : {}} popupModuleActionBarStyles={mobileView ? popupActionBarStyles : {}} > - - {action === "COMPLETED" ? : null - } + > + {action === "COMPLETED" ? ( + + ) : null} {/* {toastError && } */} diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/ApplicationDetails/index.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/ApplicationDetails/index.js index 566e9c2f8..af64095af 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/ApplicationDetails/index.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/ApplicationDetails/index.js @@ -118,12 +118,12 @@ const ApplicationDetails = (props) => { return setShowModal(true); case "SUBMIT": case "FSM_SUBMIT": - // case !DSO && "SCHEDULE": - return history.push("/digit-ui/employee/fsm/modify-application/" + applicationNumber); + // case !DSO && "SCHEDULE": + return history.push("/mgramseva-digit-ui/employee/fsm/modify-application/" + applicationNumber); case "PAY": case "FSM_PAY": case "ADDITIONAL_PAY_REQUEST": - return history.push(`/digit-ui/employee/payment/collect/FSM.TRIP_CHARGES/${applicationNumber}?workflow=FSM`); + return history.push(`/mgramseva-digit-ui/employee/payment/collect/FSM.TRIP_CHARGES/${applicationNumber}?workflow=FSM`); default: break; } @@ -199,7 +199,7 @@ const ApplicationDetails = (props) => { return (
- + {t("CS_FSM_RATE_VIEW")}
diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/EditApplication/EditForm.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/EditApplication/EditForm.js index a7fa93fbc..a0086b4ea 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/EditApplication/EditForm.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/EditApplication/EditForm.js @@ -75,7 +75,10 @@ const EditForm = ({ tenantId, applicationData, channelMenu, vehicleMenu, sanitat setSubmitValve(true); } else setSubmitValve(false); } - if (formData?.tripData?.amountPerTrip !== 0 && (formData?.advancepaymentPreference?.advanceAmount > formData?.tripData?.amount || formData?.advancepaymentPreference?.advanceAmount < min)) { + if ( + formData?.tripData?.amountPerTrip !== 0 && + (formData?.advancepaymentPreference?.advanceAmount > formData?.tripData?.amount || formData?.advancepaymentPreference?.advanceAmount < min) + ) { setSubmitValve(false); } if (applicationData?.advanceAmount > 0 && formData?.advancepaymentPreference?.advanceAmount <= 0) { @@ -163,7 +166,7 @@ const EditForm = ({ tenantId, applicationData, channelMenu, vehicleMenu, sanitat Digit.SessionStorage.set("city_property", null); Digit.SessionStorage.set("selected_localities", null); Digit.SessionStorage.set("locality_property", null); - history.replace("/digit-ui/employee/fsm/response", { + history.replace("/mgramseva-digit-ui/employee/fsm/response", { applicationData: formData, key: "update", action: applicationData?.applicationStatus === "CREATED" ? "SUBMIT" : "SCHEDULE", @@ -204,4 +207,4 @@ const EditForm = ({ tenantId, applicationData, channelMenu, vehicleMenu, sanitat ); }; -export default EditForm; \ No newline at end of file +export default EditForm; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FSMRegistry/Driver/AddDriver.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FSMRegistry/Driver/AddDriver.js index 47d1a528f..1aa84fb98 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FSMRegistry/Driver/AddDriver.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FSMRegistry/Driver/AddDriver.js @@ -92,7 +92,7 @@ const AddDriver = ({ parentUrl, heading }) => { queryClient.invalidateQueries("FSM_DRIVER_SEARCH"); setTimeout(() => { closeToast(); - history.push(`/digit-ui/employee/fsm/registry?selectedTabs=DRIVER`); + history.push(`/mgramseva-digit-ui/employee/fsm/registry?selectedTabs=DRIVER`); }, 5000); }, }); diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FSMRegistry/Driver/DriverDetails.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FSMRegistry/Driver/DriverDetails.js index 14a3399e0..a99d69607 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FSMRegistry/Driver/DriverDetails.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FSMRegistry/Driver/DriverDetails.js @@ -110,7 +110,7 @@ const DriverDetails = (props) => { case "DELETE_VENDOR": return setShowModal(true); case "EDIT": - return history.push("/digit-ui/employee/fsm/registry/modify-driver/" + dsoId); + return history.push("/mgramseva-digit-ui/employee/fsm/registry/modify-driver/" + dsoId); default: break; } @@ -154,7 +154,7 @@ const DriverDetails = (props) => { queryClient.invalidateQueries("DSO_SEARCH"); setTimeout(() => { - closeToast, history.push(`/digit-ui/employee/fsm/registry`); + closeToast, history.push(`/mgramseva-digit-ui/employee/fsm/registry`); }, 5000); }, }); diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FSMRegistry/Driver/EditDriver.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FSMRegistry/Driver/EditDriver.js index 4e11b0a10..4e07866ea 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FSMRegistry/Driver/EditDriver.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FSMRegistry/Driver/EditDriver.js @@ -102,7 +102,7 @@ const EditDriver = ({ parentUrl, heading }) => { queryClient.invalidateQueries("FSM_DRIVER_SEARCH"); setTimeout(() => { closeToast(); - history.push(`/digit-ui/employee/fsm/registry/driver-details/${dsoId}`); + history.push(`/mgramseva-digit-ui/employee/fsm/registry/driver-details/${dsoId}`); }, 5000); }, }); diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FSMRegistry/Vehicle/AddVehicle.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FSMRegistry/Vehicle/AddVehicle.js index 52725caf2..96a4dfd49 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FSMRegistry/Vehicle/AddVehicle.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FSMRegistry/Vehicle/AddVehicle.js @@ -133,7 +133,7 @@ const AddVehicle = ({ parentUrl, heading }) => { queryClient.invalidateQueries("FSM_VEICLES_SEARCH"); setTimeout(() => { closeToast(); - history.push(`/digit-ui/employee/fsm/registry?selectedTabs=VEHICLE`); + history.push(`/mgramseva-digit-ui/employee/fsm/registry?selectedTabs=VEHICLE`); }, 5000); }, }); diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FSMRegistry/Vehicle/EditVehicle.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FSMRegistry/Vehicle/EditVehicle.js index cc5289d76..14277b70d 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FSMRegistry/Vehicle/EditVehicle.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FSMRegistry/Vehicle/EditVehicle.js @@ -149,7 +149,7 @@ const EditVehicle = ({ parentUrl, heading }) => { queryClient.invalidateQueries("DSO_SEARCH"); setTimeout(() => { closeToast(); - history.push(`/digit-ui/employee/fsm/registry/vehicle-details/${dsoId}`); + history.push(`/mgramseva-digit-ui/employee/fsm/registry/vehicle-details/${dsoId}`); }, 5000); }, }); diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FSMRegistry/Vehicle/VehicleDetails.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FSMRegistry/Vehicle/VehicleDetails.js index 635ac4af1..c86251dab 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FSMRegistry/Vehicle/VehicleDetails.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FSMRegistry/Vehicle/VehicleDetails.js @@ -117,7 +117,7 @@ const VehicleDetails = (props) => { case "DELETE_VENDOR": return setShowModal(true); case "EDIT": - return history.push("/digit-ui/employee/fsm/registry/modify-vehicle/" + vehicleNumber); + return history.push("/mgramseva-digit-ui/employee/fsm/registry/modify-vehicle/" + vehicleNumber); default: break; } @@ -257,7 +257,7 @@ const VehicleDetails = (props) => { queryClient.invalidateQueries("FSM_VEICLES_SEARCH"); setTimeout(() => { closeToast; - history.push(`/digit-ui/employee/fsm/registry`); + history.push(`/mgramseva-digit-ui/employee/fsm/registry`); }, 5000); }, }); diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FSMRegistry/Vendor/AddVendor.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FSMRegistry/Vendor/AddVendor.js index 6ebf56991..022b112a8 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FSMRegistry/Vendor/AddVendor.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FSMRegistry/Vendor/AddVendor.js @@ -132,7 +132,7 @@ const AddVendor = ({ parentUrl, heading }) => { queryClient.invalidateQueries("DSO_SEARCH"); setTimeout(() => { closeToast(); - history.push(`/digit-ui/employee/fsm/registry?selectedTabs=VENDOR`); + history.push(`/mgramseva-digit-ui/employee/fsm/registry?selectedTabs=VENDOR`); }, 5000); }, }); diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FSMRegistry/Vendor/EditVendor.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FSMRegistry/Vendor/EditVendor.js index 10d14d4bb..25150a920 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FSMRegistry/Vendor/EditVendor.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FSMRegistry/Vendor/EditVendor.js @@ -162,7 +162,7 @@ const EditVendor = ({ parentUrl, heading }) => { queryClient.invalidateQueries("DSO_SEARCH"); setTimeout(() => { closeToast(); - history.push(`/digit-ui/employee/fsm/registry/vendor-details/${dsoId}`); + history.push(`/mgramseva-digit-ui/employee/fsm/registry/vendor-details/${dsoId}`); }, 5000); }, }); diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FSMRegistry/Vendor/VendorDetails.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FSMRegistry/Vendor/VendorDetails.js index a3bf8fb89..59dd07e4c 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FSMRegistry/Vendor/VendorDetails.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FSMRegistry/Vendor/VendorDetails.js @@ -116,7 +116,7 @@ const VendorDetails = (props) => { case "ADD_DRIVER": return setShowModal(true); case "EDIT": - return history.push("/digit-ui/employee/fsm/registry/modify-vendor/" + dsoId); + return history.push("/mgramseva-digit-ui/employee/fsm/registry/modify-vendor/" + dsoId); default: break; } @@ -185,7 +185,7 @@ const VendorDetails = (props) => { refetchDriver(); setTimeout(() => { closeToast(); - if (selectedAction === "DELETE") history.push(`/digit-ui/employee/fsm/registry`); + if (selectedAction === "DELETE") history.push(`/mgramseva-digit-ui/employee/fsm/registry`); }, 5000); }, }); @@ -195,10 +195,10 @@ const VendorDetails = (props) => { const onEdit = (details, type, id) => { if (type === "ES_FSM_REGISTRY_DETAILS_TYPE_DRIVER") { - history.push("/digit-ui/employee/fsm/registry/modify-driver/" + id); + history.push("/mgramseva-digit-ui/employee/fsm/registry/modify-driver/" + id); } else { let registrationNumber = details?.values?.find((ele) => ele.title === "ES_FSM_REGISTRY_VEHICLE_NUMBER")?.value; - history.push("/digit-ui/employee/fsm/registry/modify-vehicle/" + registrationNumber); + history.push("/mgramseva-digit-ui/employee/fsm/registry/modify-vehicle/" + registrationNumber); } }; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FSMRegistry/index.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FSMRegistry/index.js index 96556eebb..338441f6d 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FSMRegistry/index.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FSMRegistry/index.js @@ -210,7 +210,7 @@ const FSMRegistry = () => { const onTabChange = (tab) => { setTab(tab); if (selectedTabs !== tab) { - history.push(`/digit-ui/employee/fsm/registry?selectedTabs=${tab}`); + history.push(`/mgramseva-digit-ui/employee/fsm/registry?selectedTabs=${tab}`); } }; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FstpAddVehicle.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FstpAddVehicle.js index af0fd02be..f1379ebed 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FstpAddVehicle.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FstpAddVehicle.js @@ -40,7 +40,7 @@ const FstpAddVehicle = ({ onSelect }) => { }; const onSubmit = (data) => { - history.push(`/digit-ui/employee/fsm/fstp-fsm-request/${data.vehicleNumber.trim()}`); + history.push(`/mgramseva-digit-ui/employee/fsm/fstp-fsm-request/${data.vehicleNumber.trim()}`); }; function onChange(e) { diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FstpInbox.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FstpInbox.js index 14a754c5d..e88f5ed6c 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FstpInbox.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FstpInbox.js @@ -131,7 +131,7 @@ const FstpInbox = () => { vehicleLog={vehicleLog} isLoading={isLoading} userRole={"FSM_EMP_FSTPO"} - linkPrefix={"/digit-ui/employee/fsm/fstp-operator-details/"} + linkPrefix={"/mgramseva-digit-ui/employee/fsm/fstp-operator-details/"} onSearch={onSearch} searchFields={searchFields} onSort={handleSort} diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FstpOperations.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FstpOperations.js index 0c43bfb6d..62e264942 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FstpOperations.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FstpOperations.js @@ -4,36 +4,38 @@ import { useTranslation } from "react-i18next"; import { useHistory } from "react-router-dom"; const FstpOperations = () => { - const { t } = useTranslation(); - const state = Digit.ULBService.getStateId(); - const tenantId = Digit.ULBService.getCurrentTenantId(); - const stateId = Digit.ULBService.getStateId(); - const history = useHistory(); - const title = "ES_COMMON_FSTP_OPERATION" - const module = [ - { - name: "ES_FSM_ADD_NEW_BUTTON", - link: "/digit-ui/employee/fsm/fstp-add-vehicle", - icon: - }, - { - name: "ES_FSM_VIEW_REPORTS_BUTTON", - link: "/employee/report/fsm/FSMFSTPPlantWithVehicleLogReport", - hyperlink: true, - icon: - }, - { - name: "ES_COMMON_INBOX", - link: "/digit-ui/employee/fsm/fstp-inbox", - icon: - } - ] + const { t } = useTranslation(); + const state = Digit.ULBService.getStateId(); + const tenantId = Digit.ULBService.getCurrentTenantId(); + const stateId = Digit.ULBService.getStateId(); + const history = useHistory(); + const title = "ES_COMMON_FSTP_OPERATION"; + const module = [ + { + name: "ES_FSM_ADD_NEW_BUTTON", + link: "/mgramseva-digit-ui/employee/fsm/fstp-add-vehicle", + icon: , + }, + { + name: "ES_FSM_VIEW_REPORTS_BUTTON", + link: "/employee/report/fsm/FSMFSTPPlantWithVehicleLogReport", + hyperlink: true, + icon: , + }, + { + name: "ES_COMMON_INBOX", + link: "/mgramseva-digit-ui/employee/fsm/fstp-inbox", + icon: , + }, + ]; - return ( - - - - ); + return ( + + + {" "} + + + ); }; export default FstpOperations; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FstpOperatorDetails.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FstpOperatorDetails.js index 09452e42a..e726bce60 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FstpOperatorDetails.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FstpOperatorDetails.js @@ -322,7 +322,7 @@ const FstpOperatorDetails = () => { setShowToast({ key: "success", action: `ES_FSM_DISPOSE_UPDATE_SUCCESS` }); setTimeout(() => { closeToast(); - history.push(`/digit-ui/employee`); + history.push(`/mgramseva-digit-ui/employee`); }, 5000); }; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FstpServiceRequest.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FstpServiceRequest.js index 5d81ca6cb..b0df3466d 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FstpServiceRequest.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/FstpServiceRequest.js @@ -129,7 +129,7 @@ const FstpServiceRequest = () => { }, []); // if (isSuccess && totalCount === 0 && !isLoading) { - // history.push('/digit-ui/employee/fsm/fstp/new-vehicle-entry/') + // history.push('/mgramseva-digit-ui/employee/fsm/fstp/new-vehicle-entry/') // } if (isLoading && !isSuccess && isSearchLoading && isVehiclesLoading && !isIdle && !isVehicleSearchCompleted) { @@ -137,7 +137,7 @@ const FstpServiceRequest = () => { } if (vehicleLog?.length === 0 && tripDetails?.length === 0 && isSuccess && !isSearchLoading && tripDetail?.length === 0 && !isVehiclesLoading) { - history.push(`/digit-ui/employee/fsm/fstp/new-vehicle-entry/${vehicleNumber}`); + history.push(`/mgramseva-digit-ui/employee/fsm/fstp/new-vehicle-entry/${vehicleNumber}`); } let citizenInfo = []; @@ -156,7 +156,7 @@ const FstpServiceRequest = () => { isFSMRequest={true} isLoading={isLoading} userRole={"FSM_EMP_FSTPO"} - linkPrefix={"/digit-ui/employee/fsm/fstp-operator-details/"} + linkPrefix={"/mgramseva-digit-ui/employee/fsm/fstp-operator-details/"} onSearch={onSearch} searchFields={searchFields} onSort={handleSort} @@ -165,7 +165,7 @@ const FstpServiceRequest = () => { {t("ES_FSM_FSTP_NEW_ENTRY")} @@ -201,7 +201,7 @@ const FstpServiceRequest = () => { {t("ES_FSM_FSTP_NEW_ENTRY")} diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/NewApplication/index.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/NewApplication/index.js index 4ad6d8162..03606c5e6 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/NewApplication/index.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/NewApplication/index.js @@ -153,7 +153,7 @@ export const NewApplication = ({ parentUrl, heading }) => { Digit.SessionStorage.set("city_property", null); Digit.SessionStorage.set("selected_localities", null); Digit.SessionStorage.set("locality_property", null); - history.push("/digit-ui/employee/fsm/response", formData); + history.push("/mgramseva-digit-ui/employee/fsm/response", formData); }; if (isLoading || isTripConfigLoading || isApplicantConfigLoading) { diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/index.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/index.js index 0b143b446..3bdcb81c2 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/index.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/fsm/src/pages/employee/index.js @@ -56,17 +56,21 @@ export const FsmBreadCrumb = ({ location }) => { const crumbs = [ { - path: DSO ? "/digit-ui/citizen/fsm/dso-dashboard" : "/digit-ui/employee", + path: DSO ? "/digit-ui/citizen/fsm/dso-dashboard" : "/mgramseva-digit-ui/employee", content: t("ES_COMMON_HOME"), show: isFsm, }, { - path: isRegistry ? `/digit-ui/employee/fsm/registry?selectedTabs=VENDOR` : FSTPO ? "/digit-ui/employee/fsm/fstp-inbox" : "/digit-ui/employee", + path: isRegistry + ? `/mgramseva-digit-ui/employee/fsm/registry?selectedTabs=VENDOR` + : FSTPO + ? "/mgramseva-digit-ui/employee/fsm/fstp-inbox" + : "/mgramseva-digit-ui/employee", content: isVehicleLog ? t("ES_TITLE_INBOX") : "FSM", show: isFsm, }, { - path: isNewApplication ? "/digit-ui/employee/fsm/new-application" : "", + path: isNewApplication ? "/mgramseva-digit-ui/employee/fsm/new-application" : "", content: t("FSM_NEW_DESLUDGING_APPLICATION"), show: isFsm && isNewApplication, }, @@ -76,29 +80,29 @@ export const FsmBreadCrumb = ({ location }) => { show: location.pathname.includes("/employee/fsm/response") ? true : false, }, { - path: isInbox || isSearch || isApplicationDetails ? "/digit-ui/employee/fsm/inbox" : "", + path: isInbox || isSearch || isApplicationDetails ? "/mgramseva-digit-ui/employee/fsm/inbox" : "", content: t("ES_TITLE_INBOX"), show: (isFsm && isInbox) || isSearch || isApplicationDetails, }, { - path: "/digit-ui/employee/fsm/search", + path: "/mgramseva-digit-ui/employee/fsm/search", content: t("ES_TITILE_SEARCH_APPLICATION"), show: search, }, { content: t("ES_TITLE_APPLICATION_DETAILS"), show: isApplicationDetails }, { content: t("ES_TITLE_VEHICLE_LOG"), show: isVehicleLog }, { - path: "/digit-ui/employee/fsm/registry/vendor-details/" + id, + path: "/mgramseva-digit-ui/employee/fsm/registry/vendor-details/" + id, content: t("ES_TITLE_VENDOR_DETAILS"), show: isRegistry && (isVendorDetails || isVendorEdit), }, { - path: "/digit-ui/employee/fsm/registry/vehicle-details/" + id, + path: "/mgramseva-digit-ui/employee/fsm/registry/vehicle-details/" + id, content: t("ES_TITLE_VEHICLE_DETAILS"), show: isRegistry && (isVehicleDetails || isVehicleEdit), }, { - path: "/digit-ui/employee/fsm/registry/driver-details/" + id, + path: "/mgramseva-digit-ui/employee/fsm/registry/driver-details/" + id, content: t("ES_TITLE_DRIVER_DETAILS"), show: isRegistry && (isDriverDetails || isDriverEdit), }, @@ -136,7 +140,7 @@ const EmployeeApp = ({ path, url, userType }) => { !DSO && !COLLECTOR && !FSM_EDITOR ? [ { - link: "/digit-ui/employee/fsm/new-application", + link: "/mgramseva-digit-ui/employee/fsm/new-application", name: "FSM_NEW_DESLUDGING_APPLICATION", icon: , }, @@ -146,7 +150,7 @@ const EmployeeApp = ({ path, url, userType }) => { const moduleForSomeFSMAdmin = FSM_ADMIN ? [ { - link: "/digit-ui/employee/fsm/registry?selectedTabs=VENDOR", + link: "/mgramseva-digit-ui/employee/fsm/registry?selectedTabs=VENDOR", name: "ES_TITLE_FSM_REGISTRY", icon: , }, @@ -156,7 +160,7 @@ const EmployeeApp = ({ path, url, userType }) => { const module = [ ...moduleForSomeFSMEmployees, { - link: "/digit-ui/employee/fsm/inbox", + link: "/mgramseva-digit-ui/employee/fsm/inbox", name: "ES_COMMON_INBOX", icon: , }, diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/EmployeeAction.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/EmployeeAction.js index cc2fe61f1..c08d014da 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/EmployeeAction.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/EmployeeAction.js @@ -41,7 +41,7 @@ const EmployeeAction = ({ t, action, tenantId, closeModal, submitAction, applica selectedReason, Reasons, selectReason, - employees: applicationData?.Employees[0] || {} + employees: applicationData?.Employees[0] || {}, }) ); default: @@ -121,13 +121,13 @@ const EmployeeAction = ({ t, action, tenantId, closeModal, submitAction, applica applicationData.Employees[0]["documents"].push(documents); } - set(Employees[0], 'deactivationDetails[0].effectiveFrom', new Date()?.getTime()); - set(Employees[0], 'deactivationDetails[0].orderNo', data?.orderNo); - set(Employees[0], 'deactivationDetails[0].reasonForDeactivation', data?.reasonForDeactivation); - set(Employees[0], 'deactivationDetails[0].remarks', data?.remarks); + set(Employees[0], "deactivationDetails[0].effectiveFrom", new Date()?.getTime()); + set(Employees[0], "deactivationDetails[0].orderNo", data?.orderNo); + set(Employees[0], "deactivationDetails[0].reasonForDeactivation", data?.reasonForDeactivation); + set(Employees[0], "deactivationDetails[0].remarks", data?.remarks); Employees[0].isActive = false; - history.replace("/digit-ui/employee/hrms/response", { Employees, key: "UPDATE", action: "DEACTIVATION" }); + history.replace("/mgramseva-digit-ui/employee/hrms/response", { Employees, key: "UPDATE", action: "DEACTIVATION" }); } else { if (file) { let documents = { @@ -138,13 +138,13 @@ const EmployeeAction = ({ t, action, tenantId, closeModal, submitAction, applica applicationData.Employees[0]["documents"].push(documents); } - set(Employees[0], 'reactivationDetails[0].effectiveFrom', new Date()?.getTime()); - set(Employees[0], 'reactivationDetails[0].orderNo', data?.orderNo); - set(Employees[0], 'reactivationDetails[0].reasonForDeactivation', data?.reasonForDeactivation); - set(Employees[0], 'reactivationDetails[0].remarks', data?.remarks); + set(Employees[0], "reactivationDetails[0].effectiveFrom", new Date()?.getTime()); + set(Employees[0], "reactivationDetails[0].orderNo", data?.orderNo); + set(Employees[0], "reactivationDetails[0].reasonForDeactivation", data?.reasonForDeactivation); + set(Employees[0], "reactivationDetails[0].remarks", data?.remarks); Employees[0].isActive = true; - history.replace("/digit-ui/employee/hrms/response", { Employees, key: "UPDATE", action: "ACTIVATION" }); + history.replace("/mgramseva-digit-ui/employee/hrms/response", { Employees, key: "UPDATE", action: "ACTIVATION" }); } } @@ -154,7 +154,7 @@ const EmployeeAction = ({ t, action, tenantId, closeModal, submitAction, applica headerBarEnd={} actionCancelOnSubmit={closeModal} actionSaveLabel={t(config?.label?.submit)} - actionSaveOnSubmit={() => { }} + actionSaveOnSubmit={() => {}} formId="modal-action" isDisabled={!selectedReason} > diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/hrmscard.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/hrmscard.js index 086e3c1d8..34f47f348 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/hrmscard.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/hrmscard.js @@ -7,39 +7,38 @@ const HRMSCard = () => { if (!ADMIN) { return null; } - const { t } = useTranslation(); - const tenantId = Digit.ULBService.getCurrentTenantId(); - const { isLoading, isError, error, data, ...rest } = Digit.Hooks.hrms.useHRMSCount(tenantId); + const { t } = useTranslation(); + const tenantId = Digit.ULBService.getCurrentTenantId(); + const { isLoading, isError, error, data, ...rest } = Digit.Hooks.hrms.useHRMSCount(tenantId); - const propsForModuleCard = { - Icon : , - moduleName: t("ACTION_TEST_HRMS"), - kpis: [ - { - count: isLoading ? "-" : data?.EmployeCount?.totalEmployee, - label: t("TOTAL_EMPLOYEES"), - link: `/digit-ui/employee/hrms/inbox` - }, - { - count: isLoading ? "-" : data?.EmployeCount?.activeEmployee, - label: t("ACTIVE_EMPLOYEES"), - link: `/digit-ui/employee/hrms/inbox` - } - ], - links: [ - { - label: t("HR_HOME_SEARCH_RESULTS_HEADING"), - link: `/digit-ui/employee/hrms/inbox` - }, - { - label: t("HR_COMMON_CREATE_EMPLOYEE_HEADER"), - link: `/digit-ui/employee/hrms/create` - } - ] - } + const propsForModuleCard = { + Icon: , + moduleName: t("ACTION_TEST_HRMS"), + kpis: [ + { + count: isLoading ? "-" : data?.EmployeCount?.totalEmployee, + label: t("TOTAL_EMPLOYEES"), + link: `/mgramseva-digit-ui/employee/hrms/inbox`, + }, + { + count: isLoading ? "-" : data?.EmployeCount?.activeEmployee, + label: t("ACTIVE_EMPLOYEES"), + link: `/mgramseva-digit-ui/employee/hrms/inbox`, + }, + ], + links: [ + { + label: t("HR_HOME_SEARCH_RESULTS_HEADING"), + link: `/mgramseva-digit-ui/employee/hrms/inbox`, + }, + { + label: t("HR_COMMON_CREATE_EMPLOYEE_HEADER"), + link: `/mgramseva-digit-ui/employee/hrms/create`, + }, + ], + }; - return + return ; }; export default HRMSCard; - diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/inbox/ApplicationCard.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/inbox/ApplicationCard.js index f4ebecf8a..57ac94d02 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/inbox/ApplicationCard.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/inbox/ApplicationCard.js @@ -38,7 +38,7 @@ export const ApplicationCard = ({ onFilterChange({ ...params, ...param }); setType(""); setPopup(false); - onSearch() + onSearch(); }; useEffect(() => { @@ -83,7 +83,7 @@ export const ApplicationCard = ({ ); } diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/inbox/DesktopInbox.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/inbox/DesktopInbox.js index b3d438657..76ad5ae8d 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/inbox/DesktopInbox.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/inbox/DesktopInbox.js @@ -11,7 +11,11 @@ const DesktopInbox = ({ tableConfig, filterComponent, ...props }) => { const tenantIds = Digit.SessionStorage.get("HRMS_TENANTS"); const GetCell = (value) => {t(value)}; const GetSlaCell = (value) => { - return value == "INACTIVE" ? { t(value )|| ""} : { t(value) || ""}; + return value == "INACTIVE" ? ( + {t(value) || ""} + ) : ( + {t(value) || ""} + ); }; const data = props?.data?.Employees; @@ -25,7 +29,7 @@ const DesktopInbox = ({ tableConfig, filterComponent, ...props }) => { Cell: ({ row }) => { return ( - {row.original.code} + {row.original.code} ); }, @@ -44,7 +48,7 @@ const DesktopInbox = ({ tableConfig, filterComponent, ...props }) => {
{" "} {GetCell(`${row.original?.user?.roles.length}`)} - + {row.original?.user?.roles.map((ele, index) => ( {`${index + 1}. ` + t(`ACCESSCONTROL_ROLES_ROLES_${ele.code}`)}
{" "} @@ -147,7 +151,7 @@ const DesktopInbox = ({ tableConfig, filterComponent, ...props }) => { allLinks={[ { text: "HR_COMMON_CREATE_EMPLOYEE_HEADER", - link: "/digit-ui/employee/hrms/create", + link: "/mgramseva-digit-ui/employee/hrms/create", businessService: "hrms", roles: ["HRMS_ADMIN"], }, diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/pages/EditEmployee/EditForm.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/pages/EditEmployee/EditForm.js index b8f5e0b4b..e11c6f4ba 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/pages/EditEmployee/EditForm.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/pages/EditEmployee/EditForm.js @@ -1,4 +1,4 @@ -import { FormComposer, Toast,Loader } from "@egovernments/digit-ui-react-components"; +import { FormComposer, Toast, Loader } from "@egovernments/digit-ui-react-components"; import React, { useEffect, useState } from "react"; import { useTranslation } from "react-i18next"; import { useHistory } from "react-router-dom"; @@ -13,10 +13,10 @@ const EditForm = ({ tenantId, data }) => { const [mobileNumber, setMobileNumber] = useState(null); const [phonecheck, setPhonecheck] = useState(false); const [checkfield, setcheck] = useState(false); - const { data: mdmsData,isLoading } = Digit.Hooks.useCommonMDMS(Digit.ULBService.getStateId(), "egov-hrms", ["CommonFieldsConfig"], { + const { data: mdmsData, isLoading } = Digit.Hooks.useCommonMDMS(Digit.ULBService.getStateId(), "egov-hrms", ["CommonFieldsConfig"], { select: (data) => { - return { - config: data?.MdmsRes?.['egov-hrms']?.CommonFieldsConfig + return { + config: data?.MdmsRes?.["egov-hrms"]?.CommonFieldsConfig, }; }, retry: false, @@ -33,7 +33,7 @@ const EditForm = ({ tenantId, data }) => { }, []); useEffect(() => { - if (mobileNumber && mobileNumber.length == 10 && mobileNumber.match(Digit.Utils.getPattern('MobileNo'))) { + if (mobileNumber && mobileNumber.length == 10 && mobileNumber.match(Digit.Utils.getPattern("MobileNo"))) { setShowToast(null); if (data.user.mobileNumber == mobileNumber) { setPhonecheck(true); @@ -78,7 +78,7 @@ const EditForm = ({ tenantId, data }) => { code: ele.hierarchy, name: ele.hierarchy, }, - boundaryType: { label: ele.boundaryType, i18text:`EGOV_LOCATION_BOUNDARYTYPE_${ele.boundaryType.toUpperCase()}` }, + boundaryType: { label: ele.boundaryType, i18text: `EGOV_LOCATION_BOUNDARYTYPE_${ele.boundaryType.toUpperCase()}` }, boundary: { code: ele.boundary }, roles: data?.user?.roles.filter((item) => item.tenantId == ele.boundary), }); @@ -102,13 +102,12 @@ const EditForm = ({ tenantId, data }) => { }; const checkMailNameNum = (formData) => { - - const email = formData?.SelectEmployeeEmailId?.emailId || ''; - const name = formData?.SelectEmployeeName?.employeeName || ''; - const address = formData?.SelectEmployeeCorrespondenceAddress?.correspondenceAddress || ''; - const validEmail = email.length == 0 ? true : email.match(Digit.Utils.getPattern('Email')); - return validEmail && name.match(Digit.Utils.getPattern('Name')) && address.match(Digit.Utils.getPattern('Address')); - } + const email = formData?.SelectEmployeeEmailId?.emailId || ""; + const name = formData?.SelectEmployeeName?.employeeName || ""; + const address = formData?.SelectEmployeeCorrespondenceAddress?.correspondenceAddress || ""; + const validEmail = email.length == 0 ? true : email.match(Digit.Utils.getPattern("Email")); + return validEmail && name.match(Digit.Utils.getPattern("Name")) && address.match(Digit.Utils.getPattern("Address")); + }; const onFormValueChange = (setValue = true, formData) => { if (formData?.SelectEmployeePhoneNumber?.mobileNumber) { @@ -160,16 +159,20 @@ const EditForm = ({ tenantId, data }) => { }; const onSubmit = (input) => { - if (input.Jurisdictions.filter(juris => juris.tenantId == tenantId && juris.isActive !== false).length == 0) { + if (input.Jurisdictions.filter((juris) => juris.tenantId == tenantId && juris.isActive !== false).length == 0) { setShowToast({ key: true, label: "ERR_BASE_TENANT_MANDATORY" }); return; } - if (!Object.values(input.Jurisdictions.reduce((acc, sum) => { - if (sum && sum?.tenantId) { - acc[sum.tenantId] = acc[sum.tenantId] ? acc[sum.tenantId] + 1 : 1; - } - return acc; - }, {})).every(s => s == 1)) { + if ( + !Object.values( + input.Jurisdictions.reduce((acc, sum) => { + if (sum && sum?.tenantId) { + acc[sum.tenantId] = acc[sum.tenantId] ? acc[sum.tenantId] + 1 : 1; + } + return acc; + }, {}) + ).every((s) => s == 1) + ) { setShowToast({ key: true, label: "ERR_INVALID_JURISDICTION" }); return; } @@ -191,20 +194,19 @@ const EditForm = ({ tenantId, data }) => { requestdata.user.mobileNumber = input?.SelectEmployeePhoneNumber?.mobileNumber; requestdata["user"]["name"] = input?.SelectEmployeeName?.employeeName; requestdata.user.correspondenceAddress = input?.SelectEmployeeCorrespondenceAddress?.correspondenceAddress; - requestdata.user.roles = roles.filter(role=>role&&role.name); + requestdata.user.roles = roles.filter((role) => role && role.name); let Employees = [requestdata]; /* use customiseUpdateFormData hook to make some chnages to the Employee object */ - Employees=Digit?.Customizations?.HRMS?.customiseUpdateFormData?Digit.Customizations.HRMS.customiseUpdateFormData(data,Employees):Employees; - + Employees = Digit?.Customizations?.HRMS?.customiseUpdateFormData ? Digit.Customizations.HRMS.customiseUpdateFormData(data, Employees) : Employees; - history.replace("/digit-ui/employee/hrms/response", { Employees, key: "UPDATE", action: "UPDATE" }); + history.replace("/mgramseva-digit-ui/employee/hrms/response", { Employees, key: "UPDATE", action: "UPDATE" }); }; if (isLoading) { return ; } - const config =mdmsData?.config?mdmsData.config: newConfig; + const config = mdmsData?.config ? mdmsData.config : newConfig; return (
{ onSubmit={onSubmit} defaultValues={defaultValues} onFormValueChange={onFormValueChange} - /> {showToast && ( + />{" "} + {showToast && ( { const [showModal, setShowModal] = useState(false); const { t } = useTranslation(); const { id: employeeId } = useParams(); - const { tenantId: tenantId } = useParams() + const { tenantId: tenantId } = useParams(); const history = useHistory(); const [displayMenu, setDisplayMenu] = useState(false); const isupdate = Digit.SessionStorage.get("isupdate"); @@ -43,7 +54,7 @@ const Details = () => { window.open(documentLink, "_blank"); }; - const submitAction = (data) => { }; + const submitAction = (data) => {}; useEffect(() => { switch (selectedAction) { @@ -52,7 +63,7 @@ const Details = () => { case "ACTIVATE_EMPLOYEE_HEAD": return setShowModal(true); case "COMMON_EDIT_EMPLOYEE_HEADER": - return history.push(`/digit-ui/employee/hrms/edit/${tenantId}/${employeeId}`); + return history.push(`/mgramseva-digit-ui/employee/hrms/edit/${tenantId}/${employeeId}`); default: break; } @@ -64,7 +75,13 @@ const Details = () => { return ( -
+
{t("HR_NEW_EMPLOYEE_FORM_HEADER")}
{!isLoading && data?.Employees.length > 0 ? ( @@ -74,7 +91,11 @@ const Details = () => { {t("HR_EMP_STATUS_LABEL")} } text={ - data?.Employees?.[0]?.isActive ?
{t("ACTIVE")}
:
{t("INACTIVE")}
+ data?.Employees?.[0]?.isActive ? ( +
{t("ACTIVE")}
+ ) : ( +
{t("INACTIVE")}
+ ) } textStyle={{ fontWeight: "bold", maxWidth: "6.5rem" }} /> @@ -89,7 +110,11 @@ const Details = () => { {t("HR_NEW_EMPLOYEE_FORM_HEADER")} - + { new Date(a.effectiveFrom) - new Date(b.effectiveFrom))[0] - .reasonForDeactivation) || "NA" + t( + "EGOV_HRMS_DEACTIVATIONREASON_" + + data?.Employees?.[0]?.deactivationDetails?.sort((a, b) => new Date(a.effectiveFrom) - new Date(b.effectiveFrom))[0] + .reasonForDeactivation + ) || "NA" } /> - new Date(a.effectiveFrom) - new Date(b.effectiveFrom))[0].remarks || "NA" + data?.Employees?.[0]?.deactivationDetails?.sort((a, b) => new Date(a.effectiveFrom) - new Date(b.effectiveFrom))[0].remarks || + "NA" } /> - + new Date(a.effectiveFrom) - new Date(b.effectiveFrom))[0]?.orderNo || "NA"} + text={ + data?.Employees?.[0]?.deactivationDetails?.sort((a, b) => new Date(a.effectiveFrom) - new Date(b.effectiveFrom))[0]?.orderNo || + "NA" + } /> ) : null} - {data?.Employees?.[0]?.documents ? - -
- {data?.Employees?.[0]?.documents?.map((document, index) => { - return ( - handleDownload(document)} style={{ minWidth: "160px", marginRight: "20px" }} key={index}> - -

{document.documentName}

-
- ); - })} -
-
- : null} + {data?.Employees?.[0]?.documents ? ( + + +
+ {data?.Employees?.[0]?.documents?.map((document, index) => { + return ( + handleDownload(document)} style={{ minWidth: "160px", marginRight: "20px" }} key={index}> + +

{document.documentName}

+
+ ); + })} +
+
+ ) : null} {data?.Employees?.[0]?.jurisdictions.length > 0 ? ( {t("HR_JURIS_DET_HEADER")} ) : null} {data?.Employees?.[0]?.jurisdictions?.length > 0 ? data?.Employees?.[0]?.jurisdictions.map((element, index) => { - return ( - -
- {" "} - {t("HR_JURISDICTION")} {index + 1} -
- - - - ele.tenantId == element?.boundary).map((ele) => t(`ACCESSCONTROL_ROLES_ROLES_` + ele?.code))} - /> -
- ); - }) + return ( + +
+ {" "} + {t("HR_JURISDICTION")} {index + 1} +
+ + + + ele.tenantId == element?.boundary) + .map((ele) => t(`ACCESSCONTROL_ROLES_ROLES_` + ele?.code))} + /> +
+ ); + }) : null} {data?.Employees?.[0]?.assignments.length > 0 ? ( {t("HR_ASSIGN_DET_HEADER")} diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/pages/Inbox.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/pages/Inbox.js index 6963bd122..6d018cb05 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/pages/Inbox.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/pages/Inbox.js @@ -114,7 +114,7 @@ const Inbox = ({ parentRoute, businessService = "HRMS", initialStates = {}, filt searchParams={searchParams} sortParams={sortParams} totalRecords={totalRecords} - linkPrefix={'/digit-ui/employee/hrms/details/'} + linkPrefix={"/mgramseva-digit-ui/employee/hrms/details/"} filterComponent={filterComponent} /> //
diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/pages/Response.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/pages/Response.js index 670716e92..a9759402d 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/pages/Response.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/pages/Response.js @@ -22,7 +22,7 @@ const BannerPicker = (props) => { return ( @@ -40,7 +40,7 @@ const Response = (props) => { const mutation = state.key === "UPDATE" ? Digit.Hooks.hrms.useHRMSUpdate(tenantId) : Digit.Hooks.hrms.useHRMSCreate(tenantId); const onError = (error, variables) => { - setErrorInfo(error?.response?.data?.Errors[0]?.code || 'ERROR'); + setErrorInfo(error?.response?.data?.Errors[0]?.code || "ERROR"); setMutationHappened(true); }; @@ -52,7 +52,7 @@ const Response = (props) => { const onSuccess = () => { setMutationHappened(true); }; - if (!mutationHappened ) { + if (!mutationHappened) { if (state.key === "UPDATE") { mutation.mutate( { @@ -73,20 +73,20 @@ const Response = (props) => { const DisplayText = (action, isSuccess, isEmployee, t) => { if (!isSuccess) { - return mutation?.error?.response?.data?.Errors[0].code||errorInfo; + return mutation?.error?.response?.data?.Errors[0].code || errorInfo; } else { Digit.SessionStorage.set("isupdate", Math.floor(100000 + Math.random() * 900000)); - return state.key === "CREATE"?"HRMS_CREATE_EMPLOYEE_INFO" :""; + return state.key === "CREATE" ? "HRMS_CREATE_EMPLOYEE_INFO" : ""; } }; - if (mutation.isLoading || (mutation.isIdle && !mutationHappened)) { + if (mutation.isLoading || (mutation.isIdle && !mutationHappened)) { return ; } return ( { {t(DisplayText(state.action, mutation.isSuccess || !!successData, props.parentRoute.includes("employee"), t), t)} - + diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/pages/createEmployee.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/pages/createEmployee.js index 4394cd80b..1d493bc4e 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/pages/createEmployee.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/pages/createEmployee.js @@ -1,4 +1,4 @@ -import { FormComposer, Toast ,Loader, Header} from "@egovernments/digit-ui-react-components"; +import { FormComposer, Toast, Loader, Header } from "@egovernments/digit-ui-react-components"; import React, { useEffect, useState } from "react"; import { useTranslation } from "react-i18next"; import { useHistory } from "react-router-dom"; @@ -10,15 +10,15 @@ const CreateEmployee = () => { const [mobileNumber, setMobileNumber] = useState(null); const [showToast, setShowToast] = useState(null); const [phonecheck, setPhonecheck] = useState(false); - const [checkfield, setcheck] = useState(false) + const [checkfield, setcheck] = useState(false); const { t } = useTranslation(); const history = useHistory(); const isMobile = window.Digit.Utils.browser.isMobile(); - const { data: mdmsData,isLoading } = Digit.Hooks.useCommonMDMS(Digit.ULBService.getStateId(), "egov-hrms", ["CommonFieldsConfig"], { + const { data: mdmsData, isLoading } = Digit.Hooks.useCommonMDMS(Digit.ULBService.getStateId(), "egov-hrms", ["CommonFieldsConfig"], { select: (data) => { return { - config: data?.MdmsRes?.['egov-hrms']?.CommonFieldsConfig + config: data?.MdmsRes?.["egov-hrms"]?.CommonFieldsConfig, }; }, retry: false, @@ -35,15 +35,14 @@ const CreateEmployee = () => { }, []); const checkMailNameNum = (formData) => { - - const email = formData?.SelectEmployeeEmailId?.emailId || ''; - const name = formData?.SelectEmployeeName?.employeeName || ''; - const address = formData?.SelectEmployeeCorrespondenceAddress?.correspondenceAddress || ''; - const validEmail = email.length == 0 ? true : email.match(Digit.Utils.getPattern('Email')); - return validEmail && name.match(Digit.Utils.getPattern('Name')) && address.match(Digit.Utils.getPattern('Address')); - } + const email = formData?.SelectEmployeeEmailId?.emailId || ""; + const name = formData?.SelectEmployeeName?.employeeName || ""; + const address = formData?.SelectEmployeeCorrespondenceAddress?.correspondenceAddress || ""; + const validEmail = email.length == 0 ? true : email.match(Digit.Utils.getPattern("Email")); + return validEmail && name.match(Digit.Utils.getPattern("Name")) && address.match(Digit.Utils.getPattern("Address")); + }; useEffect(() => { - if (mobileNumber && mobileNumber.length == 10 && mobileNumber.match(Digit.Utils.getPattern('MobileNo'))) { + if (mobileNumber && mobileNumber.length == 10 && mobileNumber.match(Digit.Utils.getPattern("MobileNo"))) { setShowToast(null); Digit.HRMSService.search(tenantId, null, { phone: mobileNumber }).then((result, err) => { if (result.Employees.length > 0) { @@ -59,20 +58,19 @@ const CreateEmployee = () => { }, [mobileNumber]); const defaultValues = { - - Jurisdictions: - [{ + Jurisdictions: [ + { id: undefined, key: 1, hierarchy: null, boundaryType: null, boundary: { - code: tenantId + code: tenantId, }, roles: [], - }] - } - + }, + ], + }; const onFormValueChange = (setValue = true, formData) => { if (formData?.SelectEmployeePhoneNumber?.mobileNumber) { @@ -124,21 +122,24 @@ const CreateEmployee = () => { }; const navigateToAcknowledgement = (Employees) => { - history.replace("/digit-ui/employee/hrms/response", { Employees, key: "CREATE", action: "CREATE" }); - } - + history.replace("/mgramseva-digit-ui/employee/hrms/response", { Employees, key: "CREATE", action: "CREATE" }); + }; const onSubmit = (data) => { - if (data.Jurisdictions.filter(juris => juris.tenantId == tenantId).length == 0) { + if (data.Jurisdictions.filter((juris) => juris.tenantId == tenantId).length == 0) { setShowToast({ key: true, label: "ERR_BASE_TENANT_MANDATORY" }); return; } - if (!Object.values(data.Jurisdictions.reduce((acc, sum) => { - if (sum && sum?.tenantId) { - acc[sum.tenantId] = acc[sum.tenantId] ? acc[sum.tenantId] + 1 : 1; - } - return acc; - }, {})).every(s => s == 1)) { + if ( + !Object.values( + data.Jurisdictions.reduce((acc, sum) => { + if (sum && sum?.tenantId) { + acc[sum.tenantId] = acc[sum.tenantId] ? acc[sum.tenantId] + 1 : 1; + } + return acc; + }, {}) + ).every((s) => s == 1) + ) { setShowToast({ key: true, label: "ERR_INVALID_JURISDICTION" }); return; } @@ -174,8 +175,8 @@ const CreateEmployee = () => { tests: [], }, ]; - /* use customiseCreateFormData hook to make some chnages to the Employee object */ - Employees=Digit?.Customizations?.HRMS?.customiseCreateFormData?Digit.Customizations.HRMS.customiseCreateFormData(data,Employees):Employees; + /* use customiseCreateFormData hook to make some chnages to the Employee object */ + Employees = Digit?.Customizations?.HRMS?.customiseCreateFormData ? Digit.Customizations.HRMS.customiseCreateFormData(data, Employees) : Employees; if (data?.SelectEmployeeId?.code && data?.SelectEmployeeId?.code?.trim().length > 0) { Digit.HRMSService.search(tenantId, null, { codes: data?.SelectEmployeeId?.code }).then((result, err) => { @@ -193,10 +194,16 @@ const CreateEmployee = () => { if (isLoading) { return ; } - const config =mdmsData?.config?mdmsData.config: newConfig; + const config = mdmsData?.config ? mdmsData.config : newConfig; return (
-
+
{t("HR_COMMON_CREATE_EMPLOYEE_HEADER")}
{

- + {t("HR_COMMON_BUTTON_HOME")} {" "} - / {location.pathname === "/digit-ui/employee/hrms/inbox" ? t("HR_COMMON_HEADER") : t("HR_COMMON_HEADER")} + / {location.pathname === "/mgramseva-digit-ui/employee/hrms/inbox" ? t("HR_COMMON_HEADER") : t("HR_COMMON_HEADER")}

{ case "CANCEL_CHALLAN": return setShowModal(true); case "UPDATE_CHALLAN": - return history.push(`/digit-ui/employee/mcollect/modify-challan/${challanno}`); + return history.push(`/mgramseva-digit-ui/employee/mcollect/modify-challan/${challanno}`); case "BUTTON_PAY": return history.push( - `/digit-ui/employee/payment/collect/${challanDetails?.businessService}/${challanno}/tenantId=${tenantId}?workflow=mcollect` + `/mgramseva-digit-ui/employee/payment/collect/${challanDetails?.businessService}/${challanno}/tenantId=${tenantId}?workflow=mcollect` ); default: break; @@ -52,7 +64,7 @@ const EmployeeChallan = (props) => { const challan = result.challans[0]; let LastModifiedTime = Digit.SessionStorage.set("isMcollectAppChanged", challan.challanNo); history.push( - `/digit-ui/employee/mcollect/acknowledgement?purpose=challan&status=success&tenantId=${challan?.tenantId}&serviceCategory=${challan.businessService}&challanNumber=${challan.challanNo}&applicationStatus=${challan.applicationStatus}`, + `/mgramseva-digit-ui/employee/mcollect/acknowledgement?purpose=challan&status=success&tenantId=${challan?.tenantId}&serviceCategory=${challan.businessService}&challanNumber=${challan.challanNo}&applicationStatus=${challan.applicationStatus}`, { from: url } ); } @@ -83,12 +95,11 @@ const EmployeeChallan = (props) => { billDetails.push(bill); }); setTotalDueAmount(res?.Bill[0]?.totalAmount); - billDetails && billDetails.map((ob) => { - if(ob.taxHeadCode.includes("CGST")) - ob.order = 3; - else if(ob.taxHeadCode.includes("SGST")) - ob.order = 4; - }); + billDetails && + billDetails.map((ob) => { + if (ob.taxHeadCode.includes("CGST")) ob.order = 3; + else if (ob.taxHeadCode.includes("SGST")) ob.order = 4; + }); billDetails.sort((a, b) => a.order - b.order); setChallanBillDetails(billDetails); } @@ -109,8 +120,8 @@ const EmployeeChallan = (props) => { onClick: () => downloadAndPrintReciept(challanDetails?.businessService, challanno), }; - let dowloadOptions = [] - dowloadOptions = challanDetails?.applicationStatus === "PAID" ? [challanDownload , receiptDownload] : [challanDownload]; + let dowloadOptions = []; + dowloadOptions = challanDetails?.applicationStatus === "PAID" ? [challanDownload, receiptDownload] : [challanDownload]; const workflowActions = ["CANCEL_CHALLAN", "UPDATE_CHALLAN", "BUTTON_PAY"]; @@ -122,14 +133,14 @@ const EmployeeChallan = (props) => {
{`${t("CHALLAN_DETAILS")}`}
- setIsDisplayDownloadMenu(!isDisplayDownloadMenu)} - displayOptions={isDisplayDownloadMenu} - options={challanDetails?.applicationStatus === "PAID" ? [challanDownload , receiptDownload] : [challanDownload]} - downloadBtnClassName={"employee-download-btn-className"} - optionsClassName={"employee-options-btn-className"} - /> + setIsDisplayDownloadMenu(!isDisplayDownloadMenu)} + displayOptions={isDisplayDownloadMenu} + options={challanDetails?.applicationStatus === "PAID" ? [challanDownload, receiptDownload] : [challanDownload]} + downloadBtnClassName={"employee-download-btn-className"} + optionsClassName={"employee-options-btn-className"} + />
@@ -153,7 +164,9 @@ const EmployeeChallan = (props) => { diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/mCollect/src/components/DesktopInbox.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/mCollect/src/components/DesktopInbox.js index 1dd438902..f59a21153 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/mCollect/src/components/DesktopInbox.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/mCollect/src/components/DesktopInbox.js @@ -7,7 +7,6 @@ import ApplicationTable from "./inbox/ApplicationTable"; import InboxLinks from "./inbox/InboxLink"; import SearchApplication from "./inbox/search"; - const DesktopInbox = ({ tableConfig, filterComponent, columns, ...props }) => { const { data } = props; const { t } = useTranslation(); @@ -116,7 +115,7 @@ const DesktopInbox = ({ tableConfig, filterComponent, columns, ...props }) => { {t(`UC_${action}`)} @@ -188,7 +187,7 @@ const DesktopInbox = ({ tableConfig, filterComponent, columns, ...props }) => { } return ( -
+
{!props.isSearch && (
diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/mCollect/src/components/MCollectCard.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/mCollect/src/components/MCollectCard.js index 63f94ce77..99fbc9702 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/mCollect/src/components/MCollectCard.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/mCollect/src/components/MCollectCard.js @@ -16,26 +16,25 @@ const MCollectCard = () => { kpis: [ { count: isLoading ? "-" : data?.ChallanCount?.totalChallan, - label: t("TOTAL_CHALLANS") + label: t("TOTAL_CHALLANS"), }, // { // label: t(""), - // link: `/digit-ui/employee/receipts/inbox` - // } + // link: `/mgramseva-digit-ui/employee/receipts/inbox` + // } ], links: [ { label: t("UC_SEARCH_CHALLAN_LABEL"), - link: `/digit-ui/employee/mcollect/inbox` + link: `/mgramseva-digit-ui/employee/mcollect/inbox`, }, { label: t("UC_GENERATE_NEW_CHALLAN"), - link: `/digit-ui/employee/mcollect/new-application` + link: `/mgramseva-digit-ui/employee/mcollect/new-application`, }, - ] - } - return + ], + }; + return ; }; export default MCollectCard; - diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/mCollect/src/components/MobileInbox.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/mCollect/src/components/MobileInbox.js index 2022d3d7a..90b20ffb4 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/mCollect/src/components/MobileInbox.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/mCollect/src/components/MobileInbox.js @@ -7,7 +7,7 @@ import { Link } from "react-router-dom"; const MobileInbox = ({ data, - defaultSearchParams={}, + defaultSearchParams = {}, isLoading, isSearch, searchFields, @@ -87,7 +87,7 @@ const MobileInbox = ({ {t(`UC_${action}`)} @@ -141,14 +141,20 @@ const MobileInbox = ({
- {!isSearch && } + {!isSearch && ( + + )} { const location = useLocation(); const [params, setParams] = useState({}); useEffect(() => { - setParams(func.getQueryStringParams(location.search)); // result: '?query=abc' + setParams(func.getQueryStringParams(location.search)); // result: '?query=abc' }, [location]); const { t } = useTranslation(); function proceedToPayment() {} @@ -26,7 +26,7 @@ const MCollectWFAcknowledgement = () => { alignItems: "baseline", }} > - + diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/mCollect/src/components/inbox/ApplicationCard.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/mCollect/src/components/inbox/ApplicationCard.js index dfef453d9..ce342a2d3 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/mCollect/src/components/inbox/ApplicationCard.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/mCollect/src/components/inbox/ApplicationCard.js @@ -8,7 +8,7 @@ import SortBy from "./SortBy"; export const ApplicationCard = ({ t, data, - defaultSearchParams={}, + defaultSearchParams = {}, onFilterChange, onSearch, onSort, @@ -62,7 +62,13 @@ export const ApplicationCard = ({ ); } else if (data && data?.length > 0) { - result = ; + result = ( + + ); } return ( @@ -75,7 +81,7 @@ export const ApplicationCard = ({ setType("SEARCH"); setSearchFilterParams({ businessService: [], - status: [] + status: [], }); setPopup(true); }} @@ -88,7 +94,7 @@ export const ApplicationCard = ({ setType("FILTER"); setSearchFilterParams({ businessService: [], - status: [] + status: [], }); setPopup(true); }} @@ -107,7 +113,16 @@ export const ApplicationCard = ({ {type === "FILTER" && (
- {} + { + + }
)} {/* {type === "SORT" && ( diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/mCollect/src/components/inbox/InboxLink.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/mCollect/src/components/inbox/InboxLink.js index fdaa26f40..cdd1d3101 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/mCollect/src/components/inbox/InboxLink.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/mCollect/src/components/inbox/InboxLink.js @@ -9,7 +9,7 @@ const InboxLinks = ({ parentRoute, businessService }) => { const allLinks = [ { text: t("UC_GENERATE_NEW_CHALLAN"), - link: "/digit-ui/employee/mcollect/new-application", + link: "/mgramseva-digit-ui/employee/mcollect/new-application", roles: [], }, ]; @@ -46,4 +46,4 @@ const InboxLinks = ({ parentRoute, businessService }) => { ); }; -export default InboxLinks; \ No newline at end of file +export default InboxLinks; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/mCollect/src/pages/employee/CreateChallan.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/mCollect/src/pages/employee/CreateChallan.js index 985ba5829..4b819f4a2 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/mCollect/src/pages/employee/CreateChallan.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/mCollect/src/pages/employee/CreateChallan.js @@ -32,7 +32,12 @@ const CreateChallen = ({ ChallanData }) => { const cities = Digit.Hooks.mcollect.usemcollectTenants(); const stateCode = window?.globalConfigs?.getConfig("STATE_LEVEL_TENANT_ID"); const data = Digit.Hooks.mcollect.useCommonMDMS(stateCode, "common-masters", ["HierarchyType"]); - const type = data && data.data && data.data[`common-masters`] && data.data[`common-masters`]["HierarchyType"] && data.data[`common-masters`]["HierarchyType"][0]; + const type = + data && + data.data && + data.data[`common-masters`] && + data.data[`common-masters`]["HierarchyType"] && + data.data[`common-masters`]["HierarchyType"][0]; const getCities = () => cities?.filter((e) => e.code === Digit.ULBService.getCurrentTenantId()) || []; const { t } = useTranslation(); const { data: fetchedLocalities } = Digit.Hooks.useBoundaryLocalities( @@ -44,7 +49,6 @@ const CreateChallen = ({ ChallanData }) => { t ); - const getPattern = (type) => { switch (type) { case "name": @@ -52,17 +56,16 @@ const CreateChallen = ({ ChallanData }) => { case "mobileNumber": return /^[6789][0-9]{9}$/i; case "doorNo": - return /^[^\$\"'<>?~`!@$%^={}\[\]*:;“”‘’]{1,50}$/i; + return /^[^\$\"'<>?~`!@$%^={}\[\]*:;“”‘’]{1,50}$/i; case "buildingName": case "street": - return /^[^\$\"'<>?\\\\~`!@$%^()+={}\[\]*.:;“”‘’]{1,64}$/i; + return /^[^\$\"'<>?\\\\~`!@$%^()+={}\[\]*.:;“”‘’]{1,64}$/i; case "pincode": - return /^[1-9][0-9]{5}$/i; + return /^[1-9][0-9]{5}$/i; default: - return /^(0|[1-9][0-9]*)$/i; + return /^(0|[1-9][0-9]*)$/i; } - } - + }; const handlePincode = (event) => { const { value } = event.target; @@ -136,8 +139,13 @@ const CreateChallen = ({ ChallanData }) => { const [canSubmits, setSubmitsValve] = useState(true); const [totalFormData, setTotalFormData] = useState({}); - const { register, handleSubmit, setError, formState: { errors }, clearErrors } = useForm(); - + const { + register, + handleSubmit, + setError, + formState: { errors }, + clearErrors, + } = useForm(); if (isEdit == true && fetchBillData && ChallanData[0] && JSON.parse(sessionStorage.getItem("isHookRecall"))) { defaultval = { @@ -151,9 +159,7 @@ const CreateChallen = ({ ChallanData }) => { comments: ChallanData[0].description, }; if (fetchBillData.Bill[0].billDetails[0].billAccountDetails.length > 0) { - fetchBillData.Bill[0].billDetails[0].billAccountDetails.map( - (ele) => (defaultval[`${ele.taxHeadCode.replaceAll(".", "_")}`] = `${ele.amount}`) - ); + fetchBillData.Bill[0].billDetails[0].billAccountDetails.map((ele) => (defaultval[`${ele.taxHeadCode.replaceAll(".", "_")}`] = `${ele.amount}`)); } } @@ -220,7 +226,7 @@ const CreateChallen = ({ ChallanData }) => { }, [selectedCategory]); useEffect(() => { - let selectedCatBusinesService = selectedCategoryType?stringReplaceAll(selectedCategoryType?.businessService.split(".")[1]," ","_"):""; + let selectedCatBusinesService = selectedCategoryType ? stringReplaceAll(selectedCategoryType?.businessService.split(".")[1], " ", "_") : ""; setTaxHeadMasterFields( TaxHeadMaster.filter((ele) => { let temp = selectedCategory.code.replace("BILLINGSERVICE_BUSINESSSERVICE_", ""); @@ -228,7 +234,7 @@ const CreateChallen = ({ ChallanData }) => { selectedCategoryType && selectedCategoryType.code.split(temp + "_")[1] && (ele.service == temp + "." + humanize(selectedCategoryType.code.split(temp + "_")[1].toLowerCase()) || - ele.service == temp + "." + selectedCatBusinesService) + ele.service == temp + "." + selectedCatBusinesService) ); }) ); @@ -242,7 +248,7 @@ const CreateChallen = ({ ChallanData }) => { Digit.MDMSService.getPaymentRules(tenantId, "[?(@.type=='Adhoc')]").then((value) => { setAPIcategories( func.setServiceCategory(value.MdmsRes.BillingService.BusinessService).map((ele) => { - ele.code = "BILLINGSERVICE_BUSINESSSERVICE_" +stringReplaceAll(ele.code.toUpperCase()," ","_"); + ele.code = "BILLINGSERVICE_BUSINESSSERVICE_" + stringReplaceAll(ele.code.toUpperCase(), " ", "_"); return ele; }) ); @@ -252,28 +258,41 @@ const CreateChallen = ({ ChallanData }) => { useEffect(() => { // if((ChallanData?.length > 0 && isEdit) || isEdit) { - const configDetails = setconfig(); - const isMandatoryArray = []; - let flag = true; - configDetails?.map(data => { - data?.body?.map(details => { - if(details.isMandatory && details.type == "text") isMandatoryArray.push(details.name); - }) + const configDetails = setconfig(); + const isMandatoryArray = []; + let flag = true; + configDetails?.map((data) => { + data?.body?.map((details) => { + if (details.isMandatory && details.type == "text") isMandatoryArray.push(details.name); }); - if(isEdit && !Object.keys(errors).length) { - setSubmitsValve(false) - } else if (!isEdit) { - isMandatoryArray?.map(data => { - if(flag && totalFormData[data] && totalFormData[data] != "" && selectedCategory && selectedCategoryType && fromDate != "" && toDate != "" && selectedLocality != null && !Object.keys(errors).length) { setSubmitsValve(false); } - else { setSubmitsValve(true); flag = false;} - }) - } else { - setSubmitsValve(true) - } + }); + if (isEdit && !Object.keys(errors).length) { + setSubmitsValve(false); + } else if (!isEdit) { + isMandatoryArray?.map((data) => { + if ( + flag && + totalFormData[data] && + totalFormData[data] != "" && + selectedCategory && + selectedCategoryType && + fromDate != "" && + toDate != "" && + selectedLocality != null && + !Object.keys(errors).length + ) { + setSubmitsValve(false); + } else { + setSubmitsValve(true); + flag = false; + } + }); + } else { + setSubmitsValve(true); + } // } }, [totalFormData, selectedCategory, selectedCategoryType, selectedLocality, fromDate, toDate]); - useEffect(() => { if (selectedCategory && selectedCategoryType && fromDate != "" && toDate != "" && selectedLocality != null) { setSubmitValve(true); @@ -302,21 +321,21 @@ const CreateChallen = ({ ChallanData }) => { const handleData = (event) => { sessionStorage.setItem("isHookRecall", false); // if((ChallanData?.length > 0 && isEdit) || isEdit) { - const { value, name } = event.target; - setTotalFormData({ ...totalFormData, [event.target.name]: event.target.value }); - if (!value || getPattern(name).test(value)) { - clearErrors(name, { - type: "manual", - message: "Dont Forget Your Username Should Be Cool!", - }); - } else { - setError(name, { - type: "manual12", - message: "Dont Forget Your Username Should Be Cool!", - }); - } + const { value, name } = event.target; + setTotalFormData({ ...totalFormData, [event.target.name]: event.target.value }); + if (!value || getPattern(name).test(value)) { + clearErrors(name, { + type: "manual", + message: "Dont Forget Your Username Should Be Cool!", + }); + } else { + setError(name, { + type: "manual12", + message: "Dont Forget Your Username Should Be Cool!", + }); + } // } - } + }; const onSubmit = (data) => { TaxHeadMasterFields.map((ele) => { @@ -331,7 +350,7 @@ const CreateChallen = ({ ChallanData }) => { mobileNumber: data.mobileNumber, }, //businessService: selectedCategoryType ? temp + "." + humanized(selectedCategoryType.code, temp) : "", - businessService:selectedCategoryType?(temp + "." + stringReplaceAll(selectedCategoryType?.businessService.split(".")[1]," ","_")) : "", + businessService: selectedCategoryType ? temp + "." + stringReplaceAll(selectedCategoryType?.businessService.split(".")[1], " ", "_") : "", consumerType: temp, description: data.comments, taxPeriodFrom: Date.parse(fromDate), @@ -383,7 +402,7 @@ const CreateChallen = ({ ChallanData }) => { Digit.MCollectService.generateBill(challan.challanNo, tenantId, challan.businessService, "challan").then((response) => { if (response.Bill && response.Bill.length > 0) { history.push( - `/digit-ui/employee/mcollect/acknowledgement?purpose=challan&status=success&tenantId=${tenantId}&billNumber=${ + `/mgramseva-digit-ui/employee/mcollect/acknowledgement?purpose=challan&status=success&tenantId=${tenantId}&billNumber=${ response.Bill[0].billNumber }&serviceCategory=${response.Bill[0].businessService}&challanNumber=${response.Bill[0].consumerCode}&isEdit=${true}`, { from: url } @@ -401,7 +420,7 @@ const CreateChallen = ({ ChallanData }) => { Digit.MCollectService.generateBill(challan.challanNo, tenantId, challan.businessService, "challan").then((response) => { if (response.Bill && response.Bill.length > 0) { history.push( - `/digit-ui/employee/mcollect/acknowledgement?purpose=challan&status=success&tenantId=${tenantId}&billNumber=${response.Bill[0].billNumber}&serviceCategory=${response.Bill[0].businessService}&challanNumber=${response.Bill[0].consumerCode}`, + `/mgramseva-digit-ui/employee/mcollect/acknowledgement?purpose=challan&status=success&tenantId=${tenantId}&billNumber=${response.Bill[0].billNumber}&serviceCategory=${response.Bill[0].businessService}&challanNumber=${response.Bill[0].consumerCode}`, { from: url } ); } @@ -457,7 +476,7 @@ const CreateChallen = ({ ChallanData }) => { name: "doorNo", disable: isEdit, error: t("UC_COMMON_FIELD_ERROR"), - onChange: handleData + onChange: handleData, }, }, { @@ -469,7 +488,7 @@ const CreateChallen = ({ ChallanData }) => { disable: isEdit, }, error: t("UC_COMMON_FIELD_ERROR"), - onChange: handleData + onChange: handleData, }, { label: t("UC_SRT_NAME_LABEL"), @@ -480,7 +499,7 @@ const CreateChallen = ({ ChallanData }) => { disable: isEdit, }, error: t("UC_COMMON_FIELD_ERROR"), - onChange: handleData + onChange: handleData, }, { label: t("UC_PINCODE_LABEL"), diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/mCollect/src/pages/employee/EmployeeChallanAcknowledgement.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/mCollect/src/pages/employee/EmployeeChallanAcknowledgement.js index 3004ab2e1..5d9ac9e9f 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/mCollect/src/pages/employee/EmployeeChallanAcknowledgement.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/mCollect/src/pages/employee/EmployeeChallanAcknowledgement.js @@ -11,7 +11,6 @@ const MCollectAcknowledgement = () => { const { isEdit } = Digit.Hooks.useQueryParams(); useEffect(() => { setParams(func.getQueryStringParams(location.search)); // result: '?query=abc' - }, [location]); const { t } = useTranslation(); @@ -41,7 +40,7 @@ const MCollectAcknowledgement = () => {
) : null} - + @@ -65,13 +64,13 @@ const MCollectAcknowledgement = () => {
) : null} - + diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/mCollect/src/pages/employee/NewChallan/index.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/mCollect/src/pages/employee/NewChallan/index.js index 00255bc23..8481d4b2d 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/mCollect/src/pages/employee/NewChallan/index.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/mCollect/src/pages/employee/NewChallan/index.js @@ -6,7 +6,7 @@ import { useHistory, useRouteMatch } from "react-router-dom"; import { stringReplaceAll } from "../../../utils"; //import { convertDateToEpoch } from "../../../utils"; -const getformDataforEdit = (ChallanData,fetchBillData) => { +const getformDataforEdit = (ChallanData, fetchBillData) => { let defaultval = { ConsumerName: ChallanData[0].citizen.name, mobileNumber: ChallanData[0].citizen.mobileNumber, @@ -14,37 +14,44 @@ const getformDataforEdit = (ChallanData,fetchBillData) => { building: ChallanData[0].address.buildingName, streetName: ChallanData[0].address.street, pincode: ChallanData[0].address.pincode || "143001", - mohalla: {...ChallanData[0].address.locality, i18nkey:`${stringReplaceAll(ChallanData[0].tenantId,".","_").toUpperCase()}_ADMIN_${ChallanData[0]?.address?.locality?.code}`}, - category: {code:ChallanData[0].businessService, i18nkey:`BILLINGSERVICE_BUSINESSSERVICE_${ChallanData[0]?.businessService.split(".")[0].toUpperCase()}`}, - categoryType: {code:ChallanData[0].businessService, i18nkey:`BILLINGSERVICE_BUSINESSSERVICE_${stringReplaceAll(ChallanData[0].businessService,".","_").toUpperCase()}`}, - fromDate : ChallanData[0] - ? new Date(ChallanData[0].taxPeriodFrom).getFullYear().toString() + - "-" + - `${(new Date(ChallanData[0].taxPeriodFrom).getMonth() + 1) < 10?"0":""}${(new Date(ChallanData[0].taxPeriodFrom).getMonth() + 1)}` + - "-" + - `${(new Date(ChallanData[0].taxPeriodFrom).getDate() < 10?"0":"")}${new Date(ChallanData[0].taxPeriodFrom).getDate()}` - : null, - toDate : ChallanData[0] - ? new Date(ChallanData[0].taxPeriodTo).getFullYear().toString() + - "-" + - `${(new Date(ChallanData[0].taxPeriodTo).getMonth() + 1) < 10?"0":""}${(new Date(ChallanData[0].taxPeriodTo).getMonth() + 1)}` + - "-" + - `${(new Date(ChallanData[0].taxPeriodTo).getDate() < 10?"0":"")}${new Date(ChallanData[0].taxPeriodTo).getDate()}` - : null + mohalla: { + ...ChallanData[0].address.locality, + i18nkey: `${stringReplaceAll(ChallanData[0].tenantId, ".", "_").toUpperCase()}_ADMIN_${ChallanData[0]?.address?.locality?.code}`, + }, + category: { + code: ChallanData[0].businessService, + i18nkey: `BILLINGSERVICE_BUSINESSSERVICE_${ChallanData[0]?.businessService.split(".")[0].toUpperCase()}`, + }, + categoryType: { + code: ChallanData[0].businessService, + i18nkey: `BILLINGSERVICE_BUSINESSSERVICE_${stringReplaceAll(ChallanData[0].businessService, ".", "_").toUpperCase()}`, + }, + fromDate: ChallanData[0] + ? new Date(ChallanData[0].taxPeriodFrom).getFullYear().toString() + + "-" + + `${new Date(ChallanData[0].taxPeriodFrom).getMonth() + 1 < 10 ? "0" : ""}${new Date(ChallanData[0].taxPeriodFrom).getMonth() + 1}` + + "-" + + `${new Date(ChallanData[0].taxPeriodFrom).getDate() < 10 ? "0" : ""}${new Date(ChallanData[0].taxPeriodFrom).getDate()}` + : null, + toDate: ChallanData[0] + ? new Date(ChallanData[0].taxPeriodTo).getFullYear().toString() + + "-" + + `${new Date(ChallanData[0].taxPeriodTo).getMonth() + 1 < 10 ? "0" : ""}${new Date(ChallanData[0].taxPeriodTo).getMonth() + 1}` + + "-" + + `${new Date(ChallanData[0].taxPeriodTo).getDate() < 10 ? "0" : ""}${new Date(ChallanData[0].taxPeriodTo).getDate()}` + : null, }; defaultval[`${ChallanData[0]?.businessService.split(".")[0]}`] = {}; if (fetchBillData.Bill[0].billDetails[0].billAccountDetails.length > 0) { fetchBillData.Bill[0].billDetails[0].billAccountDetails.map( - (ele) => ((defaultval[`${ChallanData[0]?.businessService.split(".")[0]}`])[`${ele.taxHeadCode.split(".")[1]}`] = `${ele.amount}`) + (ele) => (defaultval[`${ChallanData[0]?.businessService.split(".")[0]}`][`${ele.taxHeadCode.split(".")[1]}`] = `${ele.amount}`) ); } - sessionStorage.setItem("InitialTaxFeilds",JSON.stringify(defaultval[`${ChallanData[0]?.businessService.split(".")[0]}`])); + sessionStorage.setItem("InitialTaxFeilds", JSON.stringify(defaultval[`${ChallanData[0]?.businessService.split(".")[0]}`])); return defaultval; +}; -} - - -const NewChallan = ({ChallanData}) => { +const NewChallan = ({ ChallanData }) => { const tenantId = Digit.ULBService.getCurrentTenantId(); const { t } = useTranslation(); const { url } = useRouteMatch(); @@ -59,11 +66,9 @@ const NewChallan = ({ChallanData}) => { const [_formData, setFormData, _clear] = Digit.Hooks.useSessionStorage("store-data", null); const [mutationHappened, setMutationHappened, clear] = Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_HAPPENED", false); const [successData, setsuccessData, clearSuccessData] = Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_SUCCESS_DATA", {}); - const [defaultUpdatedValue, setdefaultUpdatedValue] = useState(false) + const [defaultUpdatedValue, setdefaultUpdatedValue] = useState(false); const isMobile = window.Digit.Utils.browser.isMobile(); - - const [showToast, setShowToast] = useState(null); const [error, setError] = useState(null); @@ -81,13 +86,12 @@ const NewChallan = ({ChallanData}) => { : {}; useEffect(() => { - if(isEdit && fetchBillData) - { + if (isEdit && fetchBillData) { let formdata = getformDataforEdit(ChallanData, fetchBillData); - setdefaultUpdatedValue(true) - sessionStorage.setItem("mcollectEditObject", JSON.stringify({consomerDetails1:[{...formdata}]})) + setdefaultUpdatedValue(true); + sessionStorage.setItem("mcollectEditObject", JSON.stringify({ consomerDetails1: [{ ...formdata }] })); } - },[isEdit,fetchBillData]) + }, [isEdit, fetchBillData]); const closeToast = () => { setShowToast(null); @@ -101,18 +105,18 @@ const NewChallan = ({ChallanData}) => { window.onunload = function () { sessionStorage.removeItem("mcollectFormData"); - } + }; const onFormValueChange = (setValue, formData, formState) => { setSubmitValve(!Object.keys(formState.errors).length); }; const onSubmit = (data) => { let mcollectFormValue = JSON.parse(sessionStorage.getItem("mcollectFormData")); - data = mcollectFormValue? mcollectFormValue : data?.consomerDetails1?.[0]; - let TaxHeadMasterKeys= data[`${data?.category?.code?.split(".")[0]}`] ? Object.keys(data[`${data?.category?.code?.split(".")[0]}`]) : []; + data = mcollectFormValue ? mcollectFormValue : data?.consomerDetails1?.[0]; + let TaxHeadMasterKeys = data[`${data?.category?.code?.split(".")[0]}`] ? Object.keys(data[`${data?.category?.code?.split(".")[0]}`]) : []; let TaxHeadMasterValues = data[`${data?.category?.code?.split(".")[0]}`] ? Object.values(data[`${data?.category?.code?.split(".")[0]}`]) : []; let Challan = {}; - if(!isEdit){ + if (!isEdit) { let temp = data?.category?.code; Challan = { citizen: { @@ -120,7 +124,7 @@ const NewChallan = ({ChallanData}) => { mobileNumber: data.mobileNumber, }, //businessService: selectedCategoryType ? temp + "." + humanized(selectedCategoryType.code, temp) : "", - businessService:data?.categoryType?.code, + businessService: data?.categoryType?.code, consumerType: data?.category?.code?.split(".")[0], description: data?.comments, taxPeriodFrom: Date.parse(data?.fromDate), @@ -133,7 +137,7 @@ const NewChallan = ({ChallanData}) => { locality: { code: data?.mohalla?.code }, pincode: data.pincode, }, - amount: TaxHeadMasterKeys.map((ele,index) => { + amount: TaxHeadMasterKeys.map((ele, index) => { return { taxHeadCode: `${data?.category?.code?.split(".")[0]}.${ele}`, amount: TaxHeadMasterValues[index] ? parseInt(TaxHeadMasterValues[index]) : 0, @@ -155,7 +159,7 @@ const NewChallan = ({ChallanData}) => { taxPeriodTo: Date.parse(data.toDate), tenantId: tenantId, address: ChallanData[0].address, - amount: TaxHeadMasterKeys.map((ele,index) => { + amount: TaxHeadMasterKeys.map((ele, index) => { return { taxHeadCode: `${data?.category?.code?.split(".")[0]}.${ele}`, amount: TaxHeadMasterValues[index] ? parseInt(TaxHeadMasterValues[index]) : 0, @@ -169,12 +173,12 @@ const NewChallan = ({ChallanData}) => { .then((result, err) => { if (result.challans && result.challans.length > 0) { const challan = result.challans[0]; - sessionStorage.removeItem('mcollectEditObject'); + sessionStorage.removeItem("mcollectEditObject"); let LastModifiedTime = Digit.SessionStorage.set("isMcollectAppChanged", challan.auditDetails.lastModifiedTime); Digit.MCollectService.generateBill(challan.challanNo, tenantId, challan.businessService, "challan").then((response) => { if (response.Bill && response.Bill.length > 0) { history.push( - `/digit-ui/employee/mcollect/acknowledgement?purpose=challan&status=success&tenantId=${tenantId}&billNumber=${ + `/mgramseva-digit-ui/employee/mcollect/acknowledgement?purpose=challan&status=success&tenantId=${tenantId}&billNumber=${ response.Bill[0].billNumber }&serviceCategory=${response.Bill[0].businessService}&challanNumber=${response.Bill[0].consumerCode}&isEdit=${true}`, { from: url } @@ -193,26 +197,28 @@ const NewChallan = ({ChallanData}) => { Digit.MCollectService.generateBill(challan.challanNo, tenantId, challan.businessService, "challan").then((response) => { if (response.Bill && response.Bill.length > 0) { history.push( - `/digit-ui/employee/mcollect/acknowledgement?purpose=challan&status=success&tenantId=${tenantId}&billNumber=${response.Bill[0].billNumber}&serviceCategory=${response.Bill[0].businessService}&challanNumber=${response.Bill[0].consumerCode}`, + `/mgramseva-digit-ui/employee/mcollect/acknowledgement?purpose=challan&status=success&tenantId=${tenantId}&billNumber=${response.Bill[0].billNumber}&serviceCategory=${response.Bill[0].businessService}&challanNumber=${response.Bill[0].consumerCode}`, { from: url } ); } }); } }) - .catch((e) => {setShowToast({ key: "error", label: e?.response?.data?.Errors[0].message })}); + .catch((e) => { + setShowToast({ key: "error", label: e?.response?.data?.Errors[0].message }); + }); } }; let configs = newConfig || []; //let configs = []; //let newConfig; - newConfig=newConfig?newConfig:newConfigMcollect; + newConfig = newConfig ? newConfig : newConfigMcollect; newConfig?.map((conf) => { if (conf.head !== "ES_NEW_APPLICATION_PROPERTY_ASSESSMENT" && conf.head) { configs.push(conf); } }); - configs=newConfig; + configs = newConfig; function checkHead(head) { if (head === "ES_NEW_APPLICATION_LOCATION_DETAILS") { return "TL_CHECK_ADDRESS"; @@ -225,32 +231,35 @@ const NewChallan = ({ChallanData}) => { return (
-
-
{isEdit ? t("UC_UPDATE_CHALLAN"):t("UC_COMMON_HEADER")}
+
+
{isEdit ? t("UC_UPDATE_CHALLAN") : t("UC_COMMON_HEADER")}
- {isEdit && !(JSON.parse(sessionStorage.getItem("mcollectEditObject"))) && !defaultUpdatedValue ? - : { - return { - ...config, - body: config.body.filter((a) => { - return !a.hideInEmployee; - }), - head: checkHead(config.head), - }; - })} - fieldStyle={{ marginRight: 0 }} - onSubmit={onSubmit} - defaultValues={defaultValues} - onFormValueChange={onFormValueChange} - breaklineStyle={{ border: "0px" }} - />} + {isEdit && !JSON.parse(sessionStorage.getItem("mcollectEditObject")) && !defaultUpdatedValue ? ( + + ) : ( + { + return { + ...config, + body: config.body.filter((a) => { + return !a.hideInEmployee; + }), + head: checkHead(config.head), + }; + })} + fieldStyle={{ marginRight: 0 }} + onSubmit={onSubmit} + defaultValues={defaultValues} + onFormValueChange={onFormValueChange} + breaklineStyle={{ border: "0px" }} + /> + )} {showToast && }
); }; -export default NewChallan; \ No newline at end of file +export default NewChallan; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/mCollect/src/pages/employee/index.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/mCollect/src/pages/employee/index.js index cfc389e6e..d28ac8905 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/mCollect/src/pages/employee/index.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/mCollect/src/pages/employee/index.js @@ -47,20 +47,21 @@ const EmployeeApp = ({ path, url, userType }) => { const searchMW = [{ combineTaxDueInSearchData }]; - const EmployeeChallan = Digit?.ComponentRegistryService?.getComponent('MCollectEmployeeChallan'); - const MCollectAcknowledgement = Digit?.ComponentRegistryService?.getComponent('MCollectAcknowledgement'); - const EditChallan = Digit?.ComponentRegistryService?.getComponent('MCollectEditChallan'); - const NewChallan = Digit?.ComponentRegistryService?.getComponent('MCollectNewChallan'); + const EmployeeChallan = Digit?.ComponentRegistryService?.getComponent("MCollectEmployeeChallan"); + const MCollectAcknowledgement = Digit?.ComponentRegistryService?.getComponent("MCollectAcknowledgement"); + const EditChallan = Digit?.ComponentRegistryService?.getComponent("MCollectEditChallan"); + const NewChallan = Digit?.ComponentRegistryService?.getComponent("MCollectNewChallan"); return (
-

- +

+ {t("ES_COMMON_HOME")} {" "} - / {location.pathname === "/digit-ui/employee/mcollect/inbox" ? t("UC_SEARCH_HEADER") : t("UC_COMMON_HEADER_SEARCH")} + /{" "} + {location.pathname === "/mgramseva-digit-ui/employee/mcollect/inbox" ? t("UC_SEARCH_HEADER") : t("UC_COMMON_HEADER_SEARCH")}

} /> { /> )} /> -{/* } /> - */} } /> + {/* } /> + */}{" "} + } /> ( diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/noc/src/pages/employee/EmployeeCard.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/noc/src/pages/employee/EmployeeCard.js index adc10aee1..e893ec5e7 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/noc/src/pages/employee/EmployeeCard.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/noc/src/pages/employee/EmployeeCard.js @@ -5,80 +5,82 @@ import { useLocation } from "react-router-dom"; import { businessServiceList } from "../../utils"; const NOCEmployeeHomeCard = () => { - const { t } = useTranslation(); - const location = useLocation() - const tenantId = Digit.ULBService.getCurrentTenantId(); + const { t } = useTranslation(); + const location = useLocation(); + const tenantId = Digit.ULBService.getCurrentTenantId(); - if (!Digit.Utils.NOCAccess()) return null; - - const searchFormDefaultValues = {} - - const filterFormDefaultValues = { - moduleName: "noc-services", - applicationStatus: "", - locality: [], - assignee: "ASSIGNED_TO_ALL", - businessServiceArray: businessServiceList(true) || [] - } + if (!Digit.Utils.NOCAccess()) return null; - const tableOrderFormDefaultValues = { - // sortBy: "", - limit: 10, - offset: 0, - // sortOrder: "DESC" - } - - const formInitValue = { - filterForm: filterFormDefaultValues, - searchForm: searchFormDefaultValues, - tableForm: tableOrderFormDefaultValues - } + const searchFormDefaultValues = {}; + + const filterFormDefaultValues = { + moduleName: "noc-services", + applicationStatus: "", + locality: [], + assignee: "ASSIGNED_TO_ALL", + businessServiceArray: businessServiceList(true) || [], + }; + + const tableOrderFormDefaultValues = { + // sortBy: "", + limit: 10, + offset: 0, + // sortOrder: "DESC" + }; - const { isLoading: isInboxLoading, data: {table , statuses, totalCount,nearingSlaCount} = {} } = Digit.Hooks.noc.useInbox({ - tenantId, - filters: { ...formInitValue }, - config : { enabled : formInitValue?.filterForm?.businessServiceArray?.length > 0} - }); + const formInitValue = { + filterForm: filterFormDefaultValues, + searchForm: searchFormDefaultValues, + tableForm: tableOrderFormDefaultValues, + }; - const ComplaintIcon = () => - - + const { isLoading: isInboxLoading, data: { table, statuses, totalCount, nearingSlaCount } = {} } = Digit.Hooks.noc.useInbox({ + tenantId, + filters: { ...formInitValue }, + config: { enabled: formInitValue?.filterForm?.businessServiceArray?.length > 0 }, + }); + + const ComplaintIcon = () => ( + + + + ); - useEffect(()=>{ - if (location.pathname === "/digit-ui/employee"){ - Digit.SessionStorage.del("NOC.INBOX") - } - },[location.pathname]) + useEffect(() => { + if (location.pathname === "/mgramseva-digit-ui/employee") { + Digit.SessionStorage.del("NOC.INBOX"); + } + }, [location.pathname]); - const propsForModuleCard = useMemo(()=>({ + const propsForModuleCard = useMemo( + () => ({ Icon: , moduleName: t("ACTION_TEST_NOC"), - kpis:[ + kpis: [ { - count: !isInboxLoading ? totalCount : "", - label: t("TOTAL_FSM"), - link: `/digit-ui/employee/obps/inbox` + count: !isInboxLoading ? totalCount : "", + label: t("TOTAL_FSM"), + link: `/mgramseva-digit-ui/employee/obps/inbox`, }, - { count:!isInboxLoading ?nearingSlaCount:"-", - label: t("TOTAL_NEARING_SLA"), - link: `/digit-ui/employee/obps/inbox` - } + { count: !isInboxLoading ? nearingSlaCount : "-", label: t("TOTAL_NEARING_SLA"), link: `/mgramseva-digit-ui/employee/obps/inbox` }, ], links: [ { - count: totalCount , + count: totalCount, label: t("ES_COMMON_INBOX"), - link: `/digit-ui/employee/noc/inbox` + link: `/mgramseva-digit-ui/employee/noc/inbox`, }, { label: t("ES_COMMON_APPLICATION_SEARCH"), - link: `/digit-ui/employee/noc/search` - } - ] - }),[isInboxLoading, totalCount]); - - return Digit.Utils.NOCAccess() ? : null - } + link: `/mgramseva-digit-ui/employee/noc/search`, + }, + ], + }), + [isInboxLoading, totalCount] + ); + + return Digit.Utils.NOCAccess() ? : null; +}; - export default NOCEmployeeHomeCard \ No newline at end of file +export default NOCEmployeeHomeCard; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/noc/src/pages/employee/Inbox/index.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/noc/src/pages/employee/Inbox/index.js index 478c08626..e6c68e7ef 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/noc/src/pages/employee/Inbox/index.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/noc/src/pages/employee/Inbox/index.js @@ -1,4 +1,4 @@ -import React, {Fragment, useCallback, useMemo, useReducer} from "react" +import React, { Fragment, useCallback, useMemo, useReducer } from "react"; import { InboxComposer, ComplaintIcon, Header } from "@egovernments/digit-ui-react-components"; import { useTranslation } from "react-i18next"; import SearchFormFieldsComponents from "./SearchFormFieldsComponent"; @@ -7,149 +7,204 @@ import useInboxTableConfig from "./useInboxTableConfig"; import useInboxMobileCardsData from "./useInboxMobileCardsData"; import { businessServiceList } from "../../../utils"; -const Inbox = ({parentRoute}) => { - - const { t } = useTranslation() - - const tenantId = Digit.ULBService.getCurrentTenantId(); - - const searchFormDefaultValues = { - // mobileNumber: "", - // applicationNumber - } - - const filterFormDefaultValues = { - moduleName: "noc-services", - applicationStatus: [], - businessService: null, - locality: [], - assignee: "ASSIGNED_TO_ALL", - businessServiceArray: businessServiceList(true) || [] - } - const tableOrderFormDefaultValues = { - sortBy: "", - limit: window.Digit.Utils.browser.isMobile()?50:10, - offset: 0, - sortOrder: "DESC" - } - - function formReducer(state, payload) { - switch(payload.action){ - case "mutateSearchForm": - Digit.SessionStorage.set("NOC.INBOX", {...state, searchForm: payload.data}) - return {...state, searchForm: payload.data}; - case "mutateFilterForm": - Digit.SessionStorage.set("NOC.INBOX", {...state, filterForm: payload.data}) - return {...state, filterForm: payload.data}; - case "mutateTableForm": - Digit.SessionStorage.set("NOC.INBOX", {...state, tableForm: payload.data}) - return {...state, tableForm: payload.data}; - default: - break; - } - } - const InboxObjectInSessionStorage = Digit.SessionStorage.get("NOC.INBOX") - - const onSearchFormReset = (setSearchFormValue) =>{ - setSearchFormValue("sourceRefId", null); - setSearchFormValue("applicationNo", null); - dispatch({action: "mutateSearchForm", data: searchFormDefaultValues}); +const Inbox = ({ parentRoute }) => { + const { t } = useTranslation(); + + const tenantId = Digit.ULBService.getCurrentTenantId(); + + const searchFormDefaultValues = { + // mobileNumber: "", + // applicationNumber + }; + + const filterFormDefaultValues = { + moduleName: "noc-services", + applicationStatus: [], + businessService: null, + locality: [], + assignee: "ASSIGNED_TO_ALL", + businessServiceArray: businessServiceList(true) || [], + }; + const tableOrderFormDefaultValues = { + sortBy: "", + limit: window.Digit.Utils.browser.isMobile() ? 50 : 10, + offset: 0, + sortOrder: "DESC", + }; + + function formReducer(state, payload) { + switch (payload.action) { + case "mutateSearchForm": + Digit.SessionStorage.set("NOC.INBOX", { ...state, searchForm: payload.data }); + return { ...state, searchForm: payload.data }; + case "mutateFilterForm": + Digit.SessionStorage.set("NOC.INBOX", { ...state, filterForm: payload.data }); + return { ...state, filterForm: payload.data }; + case "mutateTableForm": + Digit.SessionStorage.set("NOC.INBOX", { ...state, tableForm: payload.data }); + return { ...state, tableForm: payload.data }; + default: + break; } - - const onFilterFormReset = (setFilterFormValue) =>{ - setFilterFormValue("moduleName", "bpa-services"); - setFilterFormValue("applicationStatus", ""); - setFilterFormValue("locality", []); - setFilterFormValue("assignee", "ASSIGNED_TO_ALL"); - setFilterFormValue("applicationType", []); - dispatch({action: "mutateFilterForm", data: filterFormDefaultValues}); - } - - const onSortFormReset = (setSortFormValue) => { - setSortFormValue("sortOrder", "DESC") - dispatch({action: "mutateTableForm", data: tableOrderFormDefaultValues}) - } - - const formInitValue = useMemo(() => { - return InboxObjectInSessionStorage || { + } + const InboxObjectInSessionStorage = Digit.SessionStorage.get("NOC.INBOX"); + + const onSearchFormReset = (setSearchFormValue) => { + setSearchFormValue("sourceRefId", null); + setSearchFormValue("applicationNo", null); + dispatch({ action: "mutateSearchForm", data: searchFormDefaultValues }); + }; + + const onFilterFormReset = (setFilterFormValue) => { + setFilterFormValue("moduleName", "bpa-services"); + setFilterFormValue("applicationStatus", ""); + setFilterFormValue("locality", []); + setFilterFormValue("assignee", "ASSIGNED_TO_ALL"); + setFilterFormValue("applicationType", []); + dispatch({ action: "mutateFilterForm", data: filterFormDefaultValues }); + }; + + const onSortFormReset = (setSortFormValue) => { + setSortFormValue("sortOrder", "DESC"); + dispatch({ action: "mutateTableForm", data: tableOrderFormDefaultValues }); + }; + + const formInitValue = useMemo(() => { + return ( + InboxObjectInSessionStorage || { filterForm: filterFormDefaultValues, searchForm: searchFormDefaultValues, - tableForm: tableOrderFormDefaultValues + tableForm: tableOrderFormDefaultValues, } - } - , [Object.values(InboxObjectInSessionStorage?.filterForm || {}), Object.values(InboxObjectInSessionStorage?.searchForm || {}), Object.values(InboxObjectInSessionStorage?.tableForm || {})] ) - - const [ formState, dispatch ] = useReducer(formReducer, formInitValue ) - const onPageSizeChange = (e) => { - dispatch({action: "mutateTableForm", data: {...formState.tableForm , limit: e.target.value}}) - } - const onSortingByData = (e) => { - if(e.length > 0){ - const [{id, desc}] = e - const sortOrder = desc ? "DESC" : "ASC" - const sortBy = id - if(!(formState.tableForm.sortBy === sortBy && formState.tableForm.sortOrder === sortOrder)){ - dispatch({action: "mutateTableForm", data:{ ...formState.tableForm, sortBy: id, sortOrder: desc ? "DESC" : "ASC" }}) - } + ); + }, [ + Object.values(InboxObjectInSessionStorage?.filterForm || {}), + Object.values(InboxObjectInSessionStorage?.searchForm || {}), + Object.values(InboxObjectInSessionStorage?.tableForm || {}), + ]); + + const [formState, dispatch] = useReducer(formReducer, formInitValue); + const onPageSizeChange = (e) => { + dispatch({ action: "mutateTableForm", data: { ...formState.tableForm, limit: e.target.value } }); + }; + const onSortingByData = (e) => { + if (e.length > 0) { + const [{ id, desc }] = e; + const sortOrder = desc ? "DESC" : "ASC"; + const sortBy = id; + if (!(formState.tableForm.sortBy === sortBy && formState.tableForm.sortOrder === sortOrder)) { + dispatch({ action: "mutateTableForm", data: { ...formState.tableForm, sortBy: id, sortOrder: desc ? "DESC" : "ASC" } }); } } - - const onMobileSortOrderData = (data) => { - const {sortOrder} = data - dispatch({action: "mutateTableForm", data:{ ...formState.tableForm, sortOrder }}) - } - - const { data: localitiesForEmployeesCurrentTenant, isLoading: loadingLocalitiesForEmployeesCurrentTenant } = Digit.Hooks.useBoundaryLocalities(tenantId, "revenue", {}, t); - - const { isLoading: isInboxLoading, data: {table , statuses, totalCount} = {} } = Digit.Hooks.noc.useInbox({ - tenantId, - filters: { ...formState } - }); - const PropsForInboxLinks = { - logoIcon: , - headerText: "ACTION_TEST_NOC", - links: [{ - text: t("ES_COMMON_APPLICATION_SEARCH"), - link: "/digit-ui/employee/noc/search", - }] - } - - const SearchFormFields = useCallback(({registerRef, searchFormState, searchFieldComponents}) => ,[]) - - const FilterFormFields = useCallback( - ({registerRef, controlFilterForm, setFilterFormValue, getFilterFormValue}) => - ,[statuses, isInboxLoading, localitiesForEmployeesCurrentTenant, loadingLocalitiesForEmployeesCurrentTenant]) - - - const onSearchFormSubmit = (data) => { - data.hasOwnProperty("") && delete data?.[""] ; - dispatch({ action: "mutateTableForm", data: { ...tableOrderFormDefaultValues } }); - dispatch({action: "mutateSearchForm", data}) - } - - const onFilterFormSubmit = (data) => { - data.hasOwnProperty("") && delete data?.[""] ; - dispatch({ action: "mutateTableForm", data: { ...tableOrderFormDefaultValues } }); - dispatch({action: "mutateFilterForm", data}) - } - - const propsForSearchForm = { SearchFormFields, onSearchFormSubmit, searchFormDefaultValues: formState?.searchForm, resetSearchFormDefaultValues: searchFormDefaultValues, onSearchFormReset } - - const propsForFilterForm = { FilterFormFields, onFilterFormSubmit, filterFormDefaultValues: formState?.filterForm, resetFilterFormDefaultValues: filterFormDefaultValues, onFilterFormReset } - - const propsForInboxTable = useInboxTableConfig({...{ parentRoute, onPageSizeChange, formState, totalCount, table, dispatch, onSortingByData}}) - - const propsForInboxMobileCards = useInboxMobileCardsData({parentRoute, table}) - - const propsForMobileSortForm = { onMobileSortOrderData, sortFormDefaultValues: formState?.tableForm, onSortFormReset } - - return <> + }; + + const onMobileSortOrderData = (data) => { + const { sortOrder } = data; + dispatch({ action: "mutateTableForm", data: { ...formState.tableForm, sortOrder } }); + }; + + const { data: localitiesForEmployeesCurrentTenant, isLoading: loadingLocalitiesForEmployeesCurrentTenant } = Digit.Hooks.useBoundaryLocalities( + tenantId, + "revenue", + {}, + t + ); + + const { isLoading: isInboxLoading, data: { table, statuses, totalCount } = {} } = Digit.Hooks.noc.useInbox({ + tenantId, + filters: { ...formState }, + }); + const PropsForInboxLinks = { + logoIcon: , + headerText: "ACTION_TEST_NOC", + links: [ + { + text: t("ES_COMMON_APPLICATION_SEARCH"), + link: "/mgramseva-digit-ui/employee/noc/search", + }, + ], + }; + + const SearchFormFields = useCallback( + ({ registerRef, searchFormState, searchFieldComponents }) => ( + + ), + [] + ); + + const FilterFormFields = useCallback( + ({ registerRef, controlFilterForm, setFilterFormValue, getFilterFormValue }) => ( + + ), + [statuses, isInboxLoading, localitiesForEmployeesCurrentTenant, loadingLocalitiesForEmployeesCurrentTenant] + ); + + const onSearchFormSubmit = (data) => { + data.hasOwnProperty("") && delete data?.[""]; + dispatch({ action: "mutateTableForm", data: { ...tableOrderFormDefaultValues } }); + dispatch({ action: "mutateSearchForm", data }); + }; + + const onFilterFormSubmit = (data) => { + data.hasOwnProperty("") && delete data?.[""]; + dispatch({ action: "mutateTableForm", data: { ...tableOrderFormDefaultValues } }); + dispatch({ action: "mutateFilterForm", data }); + }; + + const propsForSearchForm = { + SearchFormFields, + onSearchFormSubmit, + searchFormDefaultValues: formState?.searchForm, + resetSearchFormDefaultValues: searchFormDefaultValues, + onSearchFormReset, + }; + + const propsForFilterForm = { + FilterFormFields, + onFilterFormSubmit, + filterFormDefaultValues: formState?.filterForm, + resetFilterFormDefaultValues: filterFormDefaultValues, + onFilterFormReset, + }; + + const propsForInboxTable = useInboxTableConfig({ ...{ parentRoute, onPageSizeChange, formState, totalCount, table, dispatch, onSortingByData } }); + + const propsForInboxMobileCards = useInboxMobileCardsData({ parentRoute, table }); + + const propsForMobileSortForm = { onMobileSortOrderData, sortFormDefaultValues: formState?.tableForm, onSortFormReset }; + + return ( + <>
{t("ES_COMMON_INBOX")} {totalCount ?

{totalCount}

: null} - + -} + ); +}; -export default Inbox \ No newline at end of file +export default Inbox; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/noc/src/pages/employee/Response.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/noc/src/pages/employee/Response.js index 0ddf36f97..859a01491 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/noc/src/pages/employee/Response.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/noc/src/pages/employee/Response.js @@ -11,8 +11,8 @@ const Response = (props) => { const nocData = state?.data?.Noc?.[0]; const onSubmit = () => { - history.push(`/digit-ui/employee`); - } + history.push(`/mgramseva-digit-ui/employee`); + }; return (
@@ -23,17 +23,18 @@ const Response = (props) => { info={nocData?.applicationStatus == "REJECTED" ? "" : t(`NOC_${stringReplaceAll(nocData?.nocType, ".", "_")}_APPROVAL_NUMBER`)} successful={nocData?.applicationStatus == "REJECTED" ? false : true} style={{ padding: "10px" }} - headerStyles={{fontSize: "32px", wordBreak: "break-word"}} + headerStyles={{ fontSize: "32px", wordBreak: "break-word" }} /> - { nocData?.applicationStatus !== "REJECTED" ? {t(`NOC_${stringReplaceAll(nocData?.nocType, ".", "_")}_${stringReplaceAll(nocData?.applicationStatus, ".", "_")}_SUB_HEADER`)} : null} + {nocData?.applicationStatus !== "REJECTED" ? ( + + {t(`NOC_${stringReplaceAll(nocData?.nocType, ".", "_")}_${stringReplaceAll(nocData?.applicationStatus, ".", "_")}_SUB_HEADER`)} + + ) : null} - +
); }; -export default Response; \ No newline at end of file +export default Response; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/noc/src/pages/employee/SearchApplication/SearchAtom/mobile.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/noc/src/pages/employee/SearchApplication/SearchAtom/mobile.js index f50202bc2..ee837f51c 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/noc/src/pages/employee/SearchApplication/SearchAtom/mobile.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/noc/src/pages/employee/SearchApplication/SearchAtom/mobile.js @@ -1,124 +1,110 @@ import React, { Fragment, useCallback, useMemo, useEffect, useState, useReducer } from "react"; import { useFormContext } from "react-hook-form"; -import { - CloseSvg, - SearchForm, - Table, - Card, - SearchAction, - PopUp, - DetailsCard, - Loader, - Toast, -} from "@egovernments/digit-ui-react-components"; +import { CloseSvg, SearchForm, Table, Card, SearchAction, PopUp, DetailsCard, Loader, Toast } from "@egovernments/digit-ui-react-components"; import { useTranslation } from "react-i18next"; const SearchApplicationMobileView = ({ SearchFormFieldsComponent, propsMobileInboxCards, isLoading, data, getRedirectionLink, onSubmit }) => { - const { t } = useTranslation(); - const { handleSubmit, setValue, getValues } = useFormContext(); + const { t } = useTranslation(); + const { handleSubmit, setValue, getValues } = useFormContext(); - // const {} = useFormContext() + // const {} = useFormContext() - function activateModal(state, action) { - switch (action.type) { - case "set": - return action.payload; - case "remove": - return false; - default: - break; - } + function activateModal(state, action) { + switch (action.type) { + case "set": + return action.payload; + case "remove": + return false; + default: + break; } + } - const [currentlyActiveMobileModal, setActiveMobileModal] = useReducer(activateModal, false); + const [currentlyActiveMobileModal, setActiveMobileModal] = useReducer(activateModal, false); - const closeMobilePopupModal = () => { - setActiveMobileModal({ type: "remove" }); - }; + const closeMobilePopupModal = () => { + setActiveMobileModal({ type: "remove" }); + }; - const MobilePopUpCloseButton = () => ( -
- -
- ); + const MobilePopUpCloseButton = () => ( +
+ +
+ ); - const MobileComponentDirectory = ({ currentlyActiveMobileModal, ...props }) => { - const { closeMobilePopupModal } = props; - switch (currentlyActiveMobileModal) { - case "SearchFormComponent": - return ( - - -
-

{t("ACTION_TEST_SEARCH_NOC_APPLICATION")}:

-
- - {/* + const MobileComponentDirectory = ({ currentlyActiveMobileModal, ...props }) => { + const { closeMobilePopupModal } = props; + switch (currentlyActiveMobileModal) { + case "SearchFormComponent": + return ( + + +
+

{t("ACTION_TEST_SEARCH_NOC_APPLICATION")}:

+
+ + {/*

{t(`ES_COMMON_CLEAR_ALL`)}

*/} -
- ); - default: - return ; - } - }; +
+ ); + default: + return ; + } + }; - const CurrentMobileModalComponent = useCallback( - ({ currentlyActiveMobileModal, ...props }) => - MobileComponentDirectory({ currentlyActiveMobileModal, ...props }), - [currentlyActiveMobileModal] - ); + const CurrentMobileModalComponent = useCallback( + ({ currentlyActiveMobileModal, ...props }) => MobileComponentDirectory({ currentlyActiveMobileModal, ...props }), + [currentlyActiveMobileModal] + ); - if (isLoading) { - return ; - } - return ( - -
- setActiveMobileModal({ type: "set", payload: "SearchFormComponent" })} - /> - {/* {isInboxLoading ? : setActiveMobileModal({type:"set", payload:"FilterFormComponent"})}/>} */} - {/* setActiveMobileModal({type:"set", payload:"SortComponent"})}/> */} -
- {currentlyActiveMobileModal ? ( - - { - setActiveMobileModal({ type: "remove" }); - onSubmit(data); - }} - handleSubmit={handleSubmit} - id="search-form" - className="rm-mb form-field-flex-one inboxPopupMobileWrapper" - {...{ currentlyActiveMobileModal, closeMobilePopupModal }} - /> - - ) : null} - {data?.[0]?.display ? ( - - {t(data?.[0]?.display) - .split("\\n") - .map((text, index) => ( -

- {text} -

- ))} -
- ) : ( - ; + } + return ( + +
+ setActiveMobileModal({ type: "set", payload: "SearchFormComponent" })} /> + {/* {isInboxLoading ? : setActiveMobileModal({type:"set", payload:"FilterFormComponent"})}/>} */} + {/* setActiveMobileModal({type:"set", payload:"SortComponent"})}/> */} +
+ {currentlyActiveMobileModal ? ( + + { + setActiveMobileModal({ type: "remove" }); + onSubmit(data); }} - /> - )} -
- ); -} + handleSubmit={handleSubmit} + id="search-form" + className="rm-mb form-field-flex-one inboxPopupMobileWrapper" + {...{ currentlyActiveMobileModal, closeMobilePopupModal }} + /> + + ) : null} + {data?.[0]?.display ? ( + + {t(data?.[0]?.display) + .split("\\n") + .map((text, index) => ( +

+ {text} +

+ ))} +
+ ) : ( + + )} +
+ ); +}; -export default SearchApplicationMobileView \ No newline at end of file +export default SearchApplicationMobileView; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/noc/src/pages/employee/SearchApplication/useTableConfig.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/noc/src/pages/employee/SearchApplication/useTableConfig.js index 2a300c55c..9c07e1a8b 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/noc/src/pages/employee/SearchApplication/useTableConfig.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/noc/src/pages/employee/SearchApplication/useTableConfig.js @@ -3,63 +3,70 @@ import { useTranslation } from "react-i18next"; import { Link } from "react-router-dom"; const useSearchApplicationTableConfig = () => { - const {t} = useTranslation() - const getRedirectionLink = (bService) => { - let redirectBS = bService === "BPAREG"?"search/application/stakeholder":"search/application/bpa"; - return redirectBS; - } - const GetCell = (value) => {value}; - - return useMemo( () => ([ - { - Header: t("NOC_APP_NO_LABEL"), - accessor: "applicationNo", - disableSortBy: true, - Cell: ({ row }) => { - return ( -
- - - {row.original["applicationNo"] || row.original["applicationNumber"]} - - -
- ); - }, - }, - { - Header: t("NOC_COMMON_TABLE_COL_APP_DATE_LABEL"), - disableSortBy: true, - accessor: (row) => GetCell(row?.auditDetails?.createdTime ? Digit.DateUtils.ConvertEpochToDate(row?.auditDetails?.createdTime) : "-"), - }, - { - Header: t("NOC_APPLICANTS_NAME_LABEL"), - disableSortBy: true, - accessor: (row) => { - return GetCell(row?.additionalDetails?.applicantName ? row?.additionalDetails?.applicantName : "-") - }, - }, - { - Header: t("NOC_SOURCE_MODULE_LABEL"), - disableSortBy: true, - accessor: (row) => GetCell(t(`MODULE_${row?.source}` || "-")), - }, - { - Header: t("NOC_SOURCE_MODULE_NUMBER"), - disableSortBy: true, - accessor: (row) => GetCell(row?.sourceRefId || "-"), + const { t } = useTranslation(); + const getRedirectionLink = (bService) => { + let redirectBS = bService === "BPAREG" ? "search/application/stakeholder" : "search/application/bpa"; + return redirectBS; + }; + const GetCell = (value) => {value}; + + return useMemo( + () => [ + { + Header: t("NOC_APP_NO_LABEL"), + accessor: "applicationNo", + disableSortBy: true, + Cell: ({ row }) => { + return ( +
+ + + {row.original["applicationNo"] || row.original["applicationNumber"]} + + +
+ ); }, - { - Header: t("NOC_STATUS_LABEL"), - accessor: (row) =>GetCell(t(row?.applicationStatus && `${row.applicationStatus}`|| "-") ), - disableSortBy: true, + }, + { + Header: t("NOC_COMMON_TABLE_COL_APP_DATE_LABEL"), + disableSortBy: true, + accessor: (row) => GetCell(row?.auditDetails?.createdTime ? Digit.DateUtils.ConvertEpochToDate(row?.auditDetails?.createdTime) : "-"), + }, + { + Header: t("NOC_APPLICANTS_NAME_LABEL"), + disableSortBy: true, + accessor: (row) => { + return GetCell(row?.additionalDetails?.applicantName ? row?.additionalDetails?.applicantName : "-"); }, - { - Header: t("WF_INBOX_HEADER_CURRENT_OWNER"), - accessor: (row) =>GetCell(t(row?.additionalDetails?.currentOwner && `${row?.additionalDetails?.currentOwner}`|| "-") ), - disableSortBy: true, - } - ]), [] ) -} + }, + { + Header: t("NOC_SOURCE_MODULE_LABEL"), + disableSortBy: true, + accessor: (row) => GetCell(t(`MODULE_${row?.source}` || "-")), + }, + { + Header: t("NOC_SOURCE_MODULE_NUMBER"), + disableSortBy: true, + accessor: (row) => GetCell(row?.sourceRefId || "-"), + }, + { + Header: t("NOC_STATUS_LABEL"), + accessor: (row) => GetCell(t((row?.applicationStatus && `${row.applicationStatus}`) || "-")), + disableSortBy: true, + }, + { + Header: t("WF_INBOX_HEADER_CURRENT_OWNER"), + accessor: (row) => GetCell(t((row?.additionalDetails?.currentOwner && `${row?.additionalDetails?.currentOwner}`) || "-")), + disableSortBy: true, + }, + ], + [] + ); +}; -export default useSearchApplicationTableConfig \ No newline at end of file +export default useSearchApplicationTableConfig; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/noc/src/pages/employee/index.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/noc/src/pages/employee/index.js index 796e62b3c..72fc39b3c 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/noc/src/pages/employee/index.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/noc/src/pages/employee/index.js @@ -9,29 +9,29 @@ const NOCBreadCrumbs = ({ location }) => { const { t } = useTranslation(); const crumbs = [ { - path: "/digit-ui/employee", + path: "/mgramseva-digit-ui/employee", content: t("ES_COMMON_HOME"), show: true, }, { - path: "/digit-ui/employee/noc/inbox", + path: "/mgramseva-digit-ui/employee/noc/inbox", content: t("ES_COMMON_INBOX"), show: location.pathname.includes("noc/inbox") ? true : false, }, { - path: "/digit-ui/employee/noc/inbox/application-overview/:id", + path: "/mgramseva-digit-ui/employee/noc/inbox/application-overview/:id", content: t("NOC_APP_OVER_VIEW_HEADER"), show: location.pathname.includes("noc/inbox/application-overview") ? true : false, }, { - path: "/digit-ui/employee/noc/search", + path: "/mgramseva-digit-ui/employee/noc/search", content: t("ES_COMMON_APPLICATION_SEARCH"), - show: location.pathname.includes("/digit-ui/employee/noc/search") ? true : false, + show: location.pathname.includes("/mgramseva-digit-ui/employee/noc/search") ? true : false, }, { - path: "/digit-ui/employee/noc/search/application-overview/:id", + path: "/mgramseva-digit-ui/employee/noc/search/application-overview/:id", content: t("NOC_APP_OVER_VIEW_HEADER"), - show: location.pathname.includes("/digit-ui/employee/noc/search/application-overview") ? true : false, + show: location.pathname.includes("/mgramseva-digit-ui/employee/noc/search/application-overview") ? true : false, }, ]; return ; @@ -48,9 +48,11 @@ const EmployeeApp = ({ path }) => { return ( - {!isResponse ?
- -
: null} + {!isResponse ? ( +
+ +
+ ) : null} diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/obps/src/components/SearchApplication/index.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/obps/src/components/SearchApplication/index.js index 158693d17..fdfce11d8 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/obps/src/components/SearchApplication/index.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/obps/src/components/SearchApplication/index.js @@ -1,17 +1,6 @@ import React, { Fragment, useCallback, useMemo, useEffect, useState, useReducer } from "react"; import { useForm, Controller } from "react-hook-form"; -import { - CloseSvg, - SearchForm, - Table, - Card, - SearchAction, - PopUp, - DetailsCard, - Loader, - Toast, - Header -} from "@egovernments/digit-ui-react-components"; +import { CloseSvg, SearchForm, Table, Card, SearchAction, PopUp, DetailsCard, Loader, Toast, Header } from "@egovernments/digit-ui-react-components"; import { convertEpochToDateDMY } from "../../utils"; import SearchFormFieldsComponent from "./SearchFormFieldsComponent"; import useSearchApplicationTableConfig from "./useTableConfig"; @@ -38,30 +27,44 @@ const OBPSSearchApplication = ({ tenantId, t, onSubmit, data, error, searchData, limit: 10, sortBy: "commencementDate", sortOrder: "DESC", - applicationType: userInformation?.roles?.filter((ob) => ob.code.includes("BPAREG_"))?.length <= 0 && userInformation?.roles?.filter((ob) =>(ob.code.includes("BPA_") || ob.code.includes("CITIZEN"))).length > 0 ? { - code: "BUILDING_PLAN_SCRUTINY", - i18nKey: "WF_BPA_BUILDING_PLAN_SCRUTINY", - } : userInformation?.roles?.filter((ob) => ob.code.includes("BPAREG_"))?.length > 0 && userInformation?.roles?.filter((ob) =>(ob.code.includes("BPA_") || ob.code.includes("CITIZEN"))).length <= 0 ? { - code: "BPA_STAKEHOLDER_REGISTRATION", - i18nKey: "WF_BPA_BPA_STAKEHOLDER_REGISTRATION", - } : { - code: "BUILDING_PLAN_SCRUTINY", - i18nKey: "WF_BPA_BUILDING_PLAN_SCRUTINY", - }, - serviceType: userInformation?.roles?.filter((ob) => ob.code.includes("BPAREG_"))?.length <= 0 && userInformation?.roles?.filter((ob) =>(ob.code.includes("BPA_") || ob.code.includes("CITIZEN"))).length > 0 ? { - applicationType: ["BUILDING_PLAN_SCRUTINY", "BUILDING_OC_PLAN_SCRUTINY"], - code: "NEW_CONSTRUCTION", - i18nKey: "BPA_SERVICETYPE_NEW_CONSTRUCTION", - } : userInformation?.roles?.filter((ob) => ob.code.includes("BPAREG_"))?.length > 0 && userInformation?.roles?.filter((ob) =>(ob.code.includes("BPA_") || ob.code.includes("CITIZEN"))).length <= 0 ? /* { + applicationType: + userInformation?.roles?.filter((ob) => ob.code.includes("BPAREG_"))?.length <= 0 && + userInformation?.roles?.filter((ob) => ob.code.includes("BPA_") || ob.code.includes("CITIZEN")).length > 0 + ? { + code: "BUILDING_PLAN_SCRUTINY", + i18nKey: "WF_BPA_BUILDING_PLAN_SCRUTINY", + } + : userInformation?.roles?.filter((ob) => ob.code.includes("BPAREG_"))?.length > 0 && + userInformation?.roles?.filter((ob) => ob.code.includes("BPA_") || ob.code.includes("CITIZEN")).length <= 0 + ? { + code: "BPA_STAKEHOLDER_REGISTRATION", + i18nKey: "WF_BPA_BPA_STAKEHOLDER_REGISTRATION", + } + : { + code: "BUILDING_PLAN_SCRUTINY", + i18nKey: "WF_BPA_BUILDING_PLAN_SCRUTINY", + }, + serviceType: + userInformation?.roles?.filter((ob) => ob.code.includes("BPAREG_"))?.length <= 0 && + userInformation?.roles?.filter((ob) => ob.code.includes("BPA_") || ob.code.includes("CITIZEN")).length > 0 + ? { + applicationType: ["BUILDING_PLAN_SCRUTINY", "BUILDING_OC_PLAN_SCRUTINY"], + code: "NEW_CONSTRUCTION", + i18nKey: "BPA_SERVICETYPE_NEW_CONSTRUCTION", + } + : userInformation?.roles?.filter((ob) => ob.code.includes("BPAREG_"))?.length > 0 && + userInformation?.roles?.filter((ob) => ob.code.includes("BPA_") || ob.code.includes("CITIZEN")).length <= 0 + ? /* { code: "BPA_STAKEHOLDER_REGISTRATION", applicationType:["BPA_STAKEHOLDER_REGISTRATION"], roles: ["BPAREG_APPROVER","BPAREG_DOC_VERIFIER"], i18nKey: "BPA_SERVICETYPE_BPA_STAKEHOLDER_REGISTRATION" - } */ "": { - applicationType: ["BUILDING_PLAN_SCRUTINY", "BUILDING_OC_PLAN_SCRUTINY"], - code: "NEW_CONSTRUCTION", - i18nKey: "BPA_SERVICETYPE_NEW_CONSTRUCTION", - }, + } */ "" + : { + applicationType: ["BUILDING_PLAN_SCRUTINY", "BUILDING_OC_PLAN_SCRUTINY"], + code: "NEW_CONSTRUCTION", + i18nKey: "BPA_SERVICETYPE_NEW_CONSTRUCTION", + }, ...searchData, }, }); @@ -79,7 +82,7 @@ const OBPSSearchApplication = ({ tenantId, t, onSubmit, data, error, searchData, reset({ applicationNo: "", // mobileNumber: "", - mobileNumber: window.location.href.includes("/search/obps-application") ? Digit.UserService.getUser()?.info?.mobileNumber : "", + mobileNumber: window.location.href.includes("/search/obps-application") ? Digit.UserService.getUser()?.info?.mobileNumber : "", fromDate: "", toDate: "", status: "", @@ -87,33 +90,47 @@ const OBPSSearchApplication = ({ tenantId, t, onSubmit, data, error, searchData, limit: 10, sortBy: "commencementDate", sortOrder: "DESC", - applicationType: userInformation?.roles?.filter((ob) => ob.code.includes("BPAREG_"))?.length <= 0 && userInformation?.roles?.filter((ob) =>(ob.code.includes("BPA_") || ob.code.includes("citizen"))).length > 0 ? { - code: "BUILDING_PLAN_SCRUTINY", - i18nKey: "WF_BPA_BUILDING_PLAN_SCRUTINY", - } : userInformation?.roles?.filter((ob) => ob.code.includes("BPAREG_"))?.length > 0 && userInformation?.roles?.filter((ob) =>(ob.code.includes("BPA_") || ob.code.includes("citizen"))).length <= 0 ? { - code: "BPA_STAKEHOLDER_REGISTRATION", - i18nKey: "WF_BPA_BPA_STAKEHOLDER_REGISTRATION", - } : { - code: "BUILDING_PLAN_SCRUTINY", - i18nKey: "WF_BPA_BUILDING_PLAN_SCRUTINY", - }, - serviceType: userInformation?.roles?.filter((ob) => ob.code.includes("BPAREG_"))?.length <= 0 && userInformation?.roles?.filter((ob) =>(ob.code.includes("BPA_") || ob.code.includes("citizen"))).length > 0 ? { - applicationType: ["BUILDING_PLAN_SCRUTINY", "BUILDING_OC_PLAN_SCRUTINY"], - code: "NEW_CONSTRUCTION", - i18nKey: "BPA_SERVICETYPE_NEW_CONSTRUCTION", - } : userInformation?.roles?.filter((ob) => ob.code.includes("BPAREG_"))?.length > 0 && userInformation?.roles?.filter((ob) =>(ob.code.includes("BPA_") || ob.code.includes("citizen"))).length <= 0 ? /* { + applicationType: + userInformation?.roles?.filter((ob) => ob.code.includes("BPAREG_"))?.length <= 0 && + userInformation?.roles?.filter((ob) => ob.code.includes("BPA_") || ob.code.includes("citizen")).length > 0 + ? { + code: "BUILDING_PLAN_SCRUTINY", + i18nKey: "WF_BPA_BUILDING_PLAN_SCRUTINY", + } + : userInformation?.roles?.filter((ob) => ob.code.includes("BPAREG_"))?.length > 0 && + userInformation?.roles?.filter((ob) => ob.code.includes("BPA_") || ob.code.includes("citizen")).length <= 0 + ? { + code: "BPA_STAKEHOLDER_REGISTRATION", + i18nKey: "WF_BPA_BPA_STAKEHOLDER_REGISTRATION", + } + : { + code: "BUILDING_PLAN_SCRUTINY", + i18nKey: "WF_BPA_BUILDING_PLAN_SCRUTINY", + }, + serviceType: + userInformation?.roles?.filter((ob) => ob.code.includes("BPAREG_"))?.length <= 0 && + userInformation?.roles?.filter((ob) => ob.code.includes("BPA_") || ob.code.includes("citizen")).length > 0 + ? { + applicationType: ["BUILDING_PLAN_SCRUTINY", "BUILDING_OC_PLAN_SCRUTINY"], + code: "NEW_CONSTRUCTION", + i18nKey: "BPA_SERVICETYPE_NEW_CONSTRUCTION", + } + : userInformation?.roles?.filter((ob) => ob.code.includes("BPAREG_"))?.length > 0 && + userInformation?.roles?.filter((ob) => ob.code.includes("BPA_") || ob.code.includes("citizen")).length <= 0 + ? /* { code: "BPA_STAKEHOLDER_REGISTRATION", applicationType:["BPA_STAKEHOLDER_REGISTRATION"], roles: ["BPAREG_APPROVER","BPAREG_DOC_VERIFIER"], i18nKey: "BPA_SERVICETYPE_BPA_STAKEHOLDER_REGISTRATION" - } */ "" : { - applicationType: ["BUILDING_PLAN_SCRUTINY", "BUILDING_OC_PLAN_SCRUTINY"], - code: "NEW_CONSTRUCTION", - i18nKey: "BPA_SERVICETYPE_NEW_CONSTRUCTION", - }, + } */ "" + : { + applicationType: ["BUILDING_PLAN_SCRUTINY", "BUILDING_OC_PLAN_SCRUTINY"], + code: "NEW_CONSTRUCTION", + i18nKey: "BPA_SERVICETYPE_NEW_CONSTRUCTION", + }, ...searchData, isSubmitSuccessful: false, - }) + }); } }, [formState]); const columns = useSearchApplicationTableConfig({ t }); @@ -122,7 +139,7 @@ const OBPSSearchApplication = ({ tenantId, t, onSubmit, data, error, searchData, useEffect(() => { if (error !== "") { - setparamerror("") + setparamerror(""); setShowToast({ key: true, label: error }); } }, [error]); @@ -158,8 +175,7 @@ const OBPSSearchApplication = ({ tenantId, t, onSubmit, data, error, searchData, } useEffect(() => { - if(!(getValues("offset") == undefined || getValues("limit") == undefined)) - setCurrPage(getValues("offset") / getValues("limit")); + if (!(getValues("offset") == undefined || getValues("limit") == undefined)) setCurrPage(getValues("offset") / getValues("limit")); }, [getValues("offset"), getValues("limit")]); const isMobile = window.Digit.Utils.browser.isMobile(); @@ -167,10 +183,10 @@ const OBPSSearchApplication = ({ tenantId, t, onSubmit, data, error, searchData, const searchFormFieldsComponentProps = { formState, Controller, register, control, t, reset, previousPage }; const getRedirectionLink = (bService) => { - const businessService = data?.[0]?.businessService == "BPAREG" ? "BPAREG" : bService; + const businessService = data?.[0]?.businessService == "BPAREG" ? "BPAREG" : bService; let redirectBS = businessService === "BPAREG" ? "search/application/stakeholder" : "search/application/bpa"; if (window.location.href.includes("/citizen")) { - redirectBS = businessService === "BPAREG"?"stakeholder":"bpa"; + redirectBS = businessService === "BPAREG" ? "stakeholder" : "bpa"; } return redirectBS; }; @@ -180,11 +196,19 @@ const OBPSSearchApplication = ({ tenantId, t, onSubmit, data, error, searchData, return { [t("BPA_APPLICATION_NUMBER_LABEL")]: data.applicationNo || data.applicationNumber, [t("BPA_COMMON_TABLE_COL_APP_DATE_LABEL")]: convertEpochToDateDMY(data.auditDetails?.createdTime) || "", - [t("BPA_SEARCH_APPLICATION_TYPE_LABEL")]: data?.additionalDetails?.applicationType ? t(`WF_BPA_${data?.additionalDetails?.applicationType}`) : data?.businessService ? t(`BPA_APPLICATIONTYPE_${data?.businessService}`) : t("CS_NA"), - [t("BPA_BASIC_DETAILS_SERVICE_TYPE_LABEL")]: t(data.additionalDetails?.serviceType || t(`TRADELICENSE_TRADETYPE_${data?.tradeLicenseDetail?.tradeUnits?.[0]?.tradeType?.split(".")[0]}`) || t("CS_NA")), - [t("BPA_CURRENT_OWNER_HEAD")]: data?.assignee || t("CS_NA"),//data.landInfo?.owners.map((o) => o.name).join(",") || "-", - [t("BPA_STATUS_LABEL")]: t(data?.state&&`WF_BPA_${data.state}` || data?.state&&`WF_BPA_${data.status}`|| t("CS_NA")) - } + [t("BPA_SEARCH_APPLICATION_TYPE_LABEL")]: data?.additionalDetails?.applicationType + ? t(`WF_BPA_${data?.additionalDetails?.applicationType}`) + : data?.businessService + ? t(`BPA_APPLICATIONTYPE_${data?.businessService}`) + : t("CS_NA"), + [t("BPA_BASIC_DETAILS_SERVICE_TYPE_LABEL")]: t( + data.additionalDetails?.serviceType || + t(`TRADELICENSE_TRADETYPE_${data?.tradeLicenseDetail?.tradeUnits?.[0]?.tradeType?.split(".")[0]}`) || + t("CS_NA") + ), + [t("BPA_CURRENT_OWNER_HEAD")]: data?.assignee || t("CS_NA"), //data.landInfo?.owners.map((o) => o.name).join(",") || "-", + [t("BPA_STATUS_LABEL")]: t((data?.state && `WF_BPA_${data.state}`) || (data?.state && `WF_BPA_${data.status}`) || t("CS_NA")), + }; }), [data] ); @@ -198,7 +222,7 @@ const OBPSSearchApplication = ({ tenantId, t, onSubmit, data, error, searchData, return false; default: break; - } + } } const [currentlyActiveMobileModal, setActiveMobileModal] = useReducer(activateModal, false); @@ -219,23 +243,22 @@ const OBPSSearchApplication = ({ tenantId, t, onSubmit, data, error, searchData, case "SearchFormComponent": return ( <> - - -
-

{t("ES_COMMON_SEARCH_APPLICATION")}:

-
- { - window.location.href.includes("citizen/obps/search/application") && + + +
+

{t("ES_COMMON_SEARCH_APPLICATION")}:

+
+ {window.location.href.includes("citizen/obps/search/application") && (
- } - - {/* + )} + + {/*

{t(`ES_COMMON_CLEAR_ALL`)}

*/} -
+
); default: @@ -291,7 +314,7 @@ const OBPSSearchApplication = ({ tenantId, t, onSubmit, data, error, searchData, {...{ data: propsMobileInboxCards, isTwoDynamicPrefix: true, - linkPrefix: window.location.href.includes("/citizen") ? `/digit-ui/citizen/obps/` : `/digit-ui/employee/obps/`, + linkPrefix: window.location.href.includes("/citizen") ? `/digit-ui/citizen/obps/` : `/mgramseva-digit-ui/employee/obps/`, getRedirectionLink: getRedirectionLink, serviceRequestIdKey: "applicationNo", }} @@ -304,12 +327,11 @@ const OBPSSearchApplication = ({ tenantId, t, onSubmit, data, error, searchData, return (
{t("ES_COMMON_SEARCH_APPLICATION")}
- { - window.location.href.includes("citizen/obps/search/application") && -
+ {window.location.href.includes("citizen/obps/search/application") && ( +
- } + )} diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/obps/src/components/SearchApplication/useTableConfig.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/obps/src/components/SearchApplication/useTableConfig.js index 43332e5d7..b15a7f4a6 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/obps/src/components/SearchApplication/useTableConfig.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/obps/src/components/SearchApplication/useTableConfig.js @@ -2,70 +2,93 @@ import React, { useMemo } from "react"; import { Link } from "react-router-dom"; import { convertEpochToDateDMY } from "../../utils"; -const useSearchApplicationTableConfig = ({t}) => { - - const getRedirectionLink = (bService) => { - let redirectBS = bService === "BPAREG"?"search/application/stakeholder":"search/application/bpa"; - if (window.location.href.includes("/citizen")) { - redirectBS = bService === "BPAREG"?"stakeholder":"bpa"; - } - return redirectBS; +const useSearchApplicationTableConfig = ({ t }) => { + const getRedirectionLink = (bService) => { + let redirectBS = bService === "BPAREG" ? "search/application/stakeholder" : "search/application/bpa"; + if (window.location.href.includes("/citizen")) { + redirectBS = bService === "BPAREG" ? "stakeholder" : "bpa"; } - const GetCell = (value) => {value}; - - return useMemo( () => ([ - { - Header: t("BPA_APPLICATION_NUMBER_LABEL"), - accessor: "applicationNo", - disableSortBy: true, - Cell: ({ row }) => { - return ( -
- - - {row.original["applicationNo"] || row.original["applicationNumber"]} - - -
- ); - }, - }, - { - Header: t("BPA_COMMON_TABLE_COL_APP_DATE_LABEL"), - disableSortBy: true, - accessor: (row) => GetCell(row?.auditDetails?.createdTime ? convertEpochToDateDMY(row?.auditDetails?.createdTime) : ""), - }, - { - Header: t("BPA_SEARCH_APPLICATION_TYPE_LABEL"), - disableSortBy: true, - accessor: "applicationType", - Cell: ({ row }) => { - return ( -
- - {row.original?.additionalDetails?.applicationType ? t(`WF_BPA_${row.original?.additionalDetails?.applicationType}`) : row.original?.businessService ? t(`BPA_APPLICATIONTYPE_${row?.original?.businessService}`) : "-"} - -
- ); - }, - }, - { - Header: t("BPA_BASIC_DETAILS_SERVICE_TYPE_LABEL"), - disableSortBy: true, - accessor: (row) => GetCell(t(row.additionalDetails?.serviceType || t(`TRADELICENSE_TRADETYPE_${row?.tradeLicenseDetail?.tradeUnits?.[0]?.tradeType?.split(".")[0]}`) || "-")), + return redirectBS; + }; + const GetCell = (value) => {value}; + + return useMemo( + () => [ + { + Header: t("BPA_APPLICATION_NUMBER_LABEL"), + accessor: "applicationNo", + disableSortBy: true, + Cell: ({ row }) => { + return ( +
+ + + {row.original["applicationNo"] || row.original["applicationNumber"]} + + +
+ ); }, - { - Header: t("BPA_CURRENT_OWNER_HEAD"), - accessor: (row) => GetCell(row?.assignee || "-"), - // accessor: (row) => GetCell(row.businessService === "BPAREG"?row?.tradeLicenseDetail?.owners.map( o => o.name ). join(",") || "-" : row?.landInfo?.owners.map( o => o.name ). join(",") || "-"), - disableSortBy: true, + }, + { + Header: t("BPA_COMMON_TABLE_COL_APP_DATE_LABEL"), + disableSortBy: true, + accessor: (row) => GetCell(row?.auditDetails?.createdTime ? convertEpochToDateDMY(row?.auditDetails?.createdTime) : ""), + }, + { + Header: t("BPA_SEARCH_APPLICATION_TYPE_LABEL"), + disableSortBy: true, + accessor: "applicationType", + Cell: ({ row }) => { + return ( +
+ + {row.original?.additionalDetails?.applicationType + ? t(`WF_BPA_${row.original?.additionalDetails?.applicationType}`) + : row.original?.businessService + ? t(`BPA_APPLICATIONTYPE_${row?.original?.businessService}`) + : "-"} + +
+ ); }, - { - Header: t("BPA_STATUS_LABEL"), - accessor: (row) =>GetCell(t(row?.state&&`WF_BPA_${row.state}` || row?.state&&`WF_BPA_${row.status}`|| "NA") ), - disableSortBy: true, - } - ]), [] ) -} + }, + { + Header: t("BPA_BASIC_DETAILS_SERVICE_TYPE_LABEL"), + disableSortBy: true, + accessor: (row) => + GetCell( + t( + row.additionalDetails?.serviceType || + t(`TRADELICENSE_TRADETYPE_${row?.tradeLicenseDetail?.tradeUnits?.[0]?.tradeType?.split(".")[0]}`) || + "-" + ) + ), + }, + { + Header: t("BPA_CURRENT_OWNER_HEAD"), + accessor: (row) => GetCell(row?.assignee || "-"), + // accessor: (row) => GetCell(row.businessService === "BPAREG"?row?.tradeLicenseDetail?.owners.map( o => o.name ). join(",") || "-" : row?.landInfo?.owners.map( o => o.name ). join(",") || "-"), + disableSortBy: true, + }, + { + Header: t("BPA_STATUS_LABEL"), + accessor: (row) => GetCell(t((row?.state && `WF_BPA_${row.state}`) || (row?.state && `WF_BPA_${row.status}`) || "NA")), + disableSortBy: true, + }, + ], + [] + ); +}; -export default useSearchApplicationTableConfig \ No newline at end of file +export default useSearchApplicationTableConfig; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/obps/src/pages/citizen/ArchitectInbox/index.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/obps/src/pages/citizen/ArchitectInbox/index.js index 70ea44da3..83105bbec 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/obps/src/pages/citizen/ArchitectInbox/index.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/obps/src/pages/citizen/ArchitectInbox/index.js @@ -8,26 +8,27 @@ const headerStyle = { fontSize: "30px", fontWeight: "700", marginTop: "-10px", - marginLeft: "15px" -} + marginLeft: "15px", +}; const Inbox = ({ tenants, parentRoute }) => { - const { t } = useTranslation() + const { t } = useTranslation(); const tenantId = Digit.ULBService.getCurrentTenantId(); const stateCode = Digit.ULBService.getStateId(); const [searchParams, setSearchParams] = useState({ applicationStatus: [], applicationType: [], - businessService: [] + businessService: [], }); let isMobile = window.Digit.Utils.browser.isMobile(); const userInfo = Digit.UserService.getUser(); const [pageOffset, setPageOffset] = useState(0); - const [pageSize, setPageSize] = useState(window.Digit.Utils.browser.isMobile()?50:10); + const [pageSize, setPageSize] = useState(window.Digit.Utils.browser.isMobile() ? 50 : 10); const [sortParams, setSortParams] = useState([{ id: "createdTime", sortOrder: "DESC" }]); - const paginationParams = isMobile ? { limit: 10, offset: 0, sortBy: sortParams?.[0]?.id, sortOrder: sortParams?.[0]?.sortOrder } : - { limit: pageSize, offset: pageOffset, sortBy: sortParams?.[0]?.id, sortOrder: sortParams?.[0]?.sortOrder } - const inboxSearchParams = { limit: 10, offset: 0, mobileNumber: userInfo?.info?.mobileNumber } + const paginationParams = isMobile + ? { limit: 10, offset: 0, sortBy: sortParams?.[0]?.id, sortOrder: sortParams?.[0]?.sortOrder } + : { limit: pageSize, offset: pageOffset, sortBy: sortParams?.[0]?.id, sortOrder: sortParams?.[0]?.sortOrder }; + const inboxSearchParams = { limit: 10, offset: 0, mobileNumber: userInfo?.info?.mobileNumber }; const { isLoading: bpaLoading, data: bpaInboxData } = Digit.Hooks.obps.useArchitectInbox({ tenantId: stateCode, @@ -35,13 +36,13 @@ const Inbox = ({ tenants, parentRoute }) => { businessService: ["BPA_LOW", "BPA", "BPA_OC"], filters: { searchForm: { - ...searchParams + ...searchParams, }, tableForm: { sortBy: sortParams?.[0]?.id, limit: pageSize, offset: pageOffset, - sortOrder: sortParams?.[0]?.sortOrder + sortOrder: sortParams?.[0]?.sortOrder, }, filterForm: { moduleName: "bpa-services", @@ -49,19 +50,19 @@ const Inbox = ({ tenants, parentRoute }) => { applicationStatus: searchParams?.applicationStatus, applicationType: searchParams?.applicationType ? searchParams?.applicationType : [], locality: [], - assignee: "ASSIGNED_TO_ALL" - } + assignee: "ASSIGNED_TO_ALL", + }, }, config: {}, - withEDCRData:false + withEDCRData: false, }); - const fetchLastPage = () => { - setPageOffset(bpaInboxData?.totalCount && (Math.ceil(bpaInboxData?.totalCount / 10) * 10 - pageSize)); + const fetchLastPage = () => { + setPageOffset(bpaInboxData?.totalCount && Math.ceil(bpaInboxData?.totalCount / 10) * 10 - pageSize); }; const fetchFirstPage = () => { - setPageOffset(0); + setPageOffset(0); }; const handleSort = (args) => { @@ -75,23 +76,23 @@ const Inbox = ({ tenants, parentRoute }) => { name: "applicationNo", type: "ulb", }, - ] - } + ]; + }; const links = [ { text: t("NEW_PUBLIC_MESSAGE_BUTTON_LABEL"), - link: "/digit-ui/employee/engagement/messages/create", - } - ] + link: "/mgramseva-digit-ui/employee/engagement/messages/create", + }, + ]; const onSearch = (params) => { setSearchParams({ ...searchParams, ...params }); - } + }; const handleFilterChange = (data) => { - setSearchParams({ ...searchParams, ...data }) - } + setSearchParams({ ...searchParams, ...data }); + }; const fetchNextPage = () => { setPageOffset((prevState) => prevState + pageSize); @@ -108,7 +109,7 @@ const Inbox = ({ tenants, parentRoute }) => { if (isMobile) { return ( -

{`${t("ES_COMMON_OBPS_INBOX_LABEL")} ( ${bpaInboxData?.totalCount || 0} )`}

+

{`${t("ES_COMMON_OBPS_INBOX_LABEL")} ( ${bpaInboxData?.totalCount || 0} )`}

{ links={links} />
- ) + ); } return (
-
- {t("ES_COMMON_INBOX")} - {Number(bpaInboxData?.totalCount) ?

{Number(bpaInboxData?.totalCount)}

: null} -
- +
+ {t("ES_COMMON_INBOX")} + {Number(bpaInboxData?.totalCount) ?

{Number(bpaInboxData?.totalCount)}

: null} +
+
); -} +}; -export default Inbox; +export default Inbox; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/obps/src/pages/employee/EmployeeCard.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/obps/src/pages/employee/EmployeeCard.js index 3073e31e4..7e7a648d5 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/obps/src/pages/employee/EmployeeCard.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/obps/src/pages/employee/EmployeeCard.js @@ -5,140 +5,146 @@ import { showHidingLinksForStakeholder, showHidingLinksForBPA } from "../../util import { useLocation } from "react-router-dom"; const OBPSEmployeeHomeCard = () => { + const [totalCount, setTotalCount] = useState(0); + const [totalCountEs, setTotalCountEs] = useState(0); - const [totalCount, setTotalCount] = useState(0); - const [totalCountEs, setTotalCountEs] = useState(0); - - const { t } = useTranslation(); - const location = useLocation() - - const tenantId = Digit.ULBService.getCurrentTenantId(); - const stateCode = Digit.ULBService.getStateId(); - - const stakeholderEmployeeRoles = [ { code: "BPAREG_DOC_VERIFIER", tenantId: stateCode }, { code: "BPAREG_APPROVER", tenantId: stateCode }]; - const bpaEmployeeRoles = [ "BPA_FIELD_INSPECTOR", "BPA_NOC_VERIFIER", "BPA_APPROVER", "BPA_VERIFIER", "CEMP"]; - - const checkingForStakeholderRoles = showHidingLinksForStakeholder(stakeholderEmployeeRoles); - const checkingForBPARoles = showHidingLinksForBPA(bpaEmployeeRoles); - - const searchFormDefaultValues = {} - - const filterFormDefaultValues = { - moduleName: "bpa-services", - applicationStatus: "", - locality: [], - assignee: "ASSIGNED_TO_ALL", - applicationType: [] - } - const tableOrderFormDefaultValues = { - sortBy: "", - limit: 10, - offset: 0, - sortOrder: "DESC" - } - - const formInitValue = { - filterForm: filterFormDefaultValues, - searchForm: searchFormDefaultValues, - tableForm: tableOrderFormDefaultValues - } + const { t } = useTranslation(); + const location = useLocation(); - const searchFormDefaultValuesOfStakeholder = {} + const tenantId = Digit.ULBService.getCurrentTenantId(); + const stateCode = Digit.ULBService.getStateId(); - const filterFormDefaultValuesOfStakeholder = { - moduleName: "BPAREG", - // businessService: {code: "BPAREG", name:t("BPAREG")}, - applicationStatus: "", - locality: [], - assignee: "ASSIGNED_TO_ALL" - } - const tableOrderFormDefaultValuesOfStakeholder = { - sortBy: "", - limit: 10, - offset: 0, - sortOrder: "DESC" - } - - const formInitValueOfStakeholder = { - filterForm: filterFormDefaultValuesOfStakeholder, - searchForm: searchFormDefaultValuesOfStakeholder, - tableForm: tableOrderFormDefaultValuesOfStakeholder - } - - const { isLoading: isInboxLoadingOfStakeholder, data: dataOfStakeholder } = Digit.Hooks.obps.useBPAInbox({ - tenantId, - filters: { ...formInitValueOfStakeholder }, - config:{ enabled: !!checkingForStakeholderRoles } - }); + const stakeholderEmployeeRoles = [ + { code: "BPAREG_DOC_VERIFIER", tenantId: stateCode }, + { code: "BPAREG_APPROVER", tenantId: stateCode }, + ]; + const bpaEmployeeRoles = ["BPA_FIELD_INSPECTOR", "BPA_NOC_VERIFIER", "BPA_APPROVER", "BPA_VERIFIER", "CEMP"]; - const { isLoading: isInboxLoading, data : dataOfBPA } = Digit.Hooks.obps.useBPAInbox({ - tenantId, - filters: { ...formInitValue }, - config:{ enabled: !!checkingForBPARoles } - }); + const checkingForStakeholderRoles = showHidingLinksForStakeholder(stakeholderEmployeeRoles); + const checkingForBPARoles = showHidingLinksForBPA(bpaEmployeeRoles); + + const searchFormDefaultValues = {}; + + const filterFormDefaultValues = { + moduleName: "bpa-services", + applicationStatus: "", + locality: [], + assignee: "ASSIGNED_TO_ALL", + applicationType: [], + }; + const tableOrderFormDefaultValues = { + sortBy: "", + limit: 10, + offset: 0, + sortOrder: "DESC", + }; + + const formInitValue = { + filterForm: filterFormDefaultValues, + searchForm: searchFormDefaultValues, + tableForm: tableOrderFormDefaultValues, + }; + + const searchFormDefaultValuesOfStakeholder = {}; + + const filterFormDefaultValuesOfStakeholder = { + moduleName: "BPAREG", + // businessService: {code: "BPAREG", name:t("BPAREG")}, + applicationStatus: "", + locality: [], + assignee: "ASSIGNED_TO_ALL", + }; + const tableOrderFormDefaultValuesOfStakeholder = { + sortBy: "", + limit: 10, + offset: 0, + sortOrder: "DESC", + }; + + const formInitValueOfStakeholder = { + filterForm: filterFormDefaultValuesOfStakeholder, + searchForm: searchFormDefaultValuesOfStakeholder, + tableForm: tableOrderFormDefaultValuesOfStakeholder, + }; + + const { isLoading: isInboxLoadingOfStakeholder, data: dataOfStakeholder } = Digit.Hooks.obps.useBPAInbox({ + tenantId, + filters: { ...formInitValueOfStakeholder }, + config: { enabled: !!checkingForStakeholderRoles }, + }); + + const { isLoading: isInboxLoading, data: dataOfBPA } = Digit.Hooks.obps.useBPAInbox({ + tenantId, + filters: { ...formInitValue }, + config: { enabled: !!checkingForBPARoles }, + }); useEffect(() => { if (!isInboxLoading && !isInboxLoadingOfStakeholder) { const bpaCount = dataOfBPA?.totalCount ? dataOfBPA?.totalCount : 0; const stakeHolderCount = dataOfStakeholder?.totalCount ? dataOfStakeholder?.totalCount : 0; setTotalCount(bpaCount + stakeHolderCount); - setTotalCountEs(dataOfBPA?.nearingSlaCount||0 + dataOfStakeholder?.nearingSlaCount||0 ) + setTotalCountEs(dataOfBPA?.nearingSlaCount || 0 + dataOfStakeholder?.nearingSlaCount || 0); } }, [dataOfBPA, dataOfStakeholder]); - useEffect(()=>{ - if (location.pathname === "/digit-ui/employee"){ - Digit.SessionStorage.del("OBPS.INBOX") - Digit.SessionStorage.del("STAKEHOLDER.INBOX") + useEffect(() => { + if (location.pathname === "/mgramseva-digit-ui/employee") { + Digit.SessionStorage.del("OBPS.INBOX"); + Digit.SessionStorage.del("STAKEHOLDER.INBOX"); } - },[location.pathname]) - const propsForModuleCard = useMemo(()=>({ + }, [location.pathname]); + const propsForModuleCard = useMemo( + () => ({ Icon: , moduleName: t("MODULE_OBPS"), - kpis:[ + kpis: [ { - count: !isInboxLoading && !isInboxLoadingOfStakeholder ? totalCount : "", - label: t("TOTAL_FSM"), - link: `/digit-ui/employee/obps/inbox` + count: !isInboxLoading && !isInboxLoadingOfStakeholder ? totalCount : "", + label: t("TOTAL_FSM"), + link: `/mgramseva-digit-ui/employee/obps/inbox`, + }, + { + count: !isInboxLoading && !isInboxLoadingOfStakeholder ? totalCountEs : "", + label: t("TOTAL_NEARING_SLA"), + link: `/mgramseva-digit-ui/employee/obps/inbox`, }, - { count:!isInboxLoading && !isInboxLoadingOfStakeholder ? totalCountEs : "", - label: t("TOTAL_NEARING_SLA"), - link: `/digit-ui/employee/obps/inbox` - } ], links: [ { - count: isInboxLoadingOfStakeholder ? "" : dataOfStakeholder?.totalCount , + count: isInboxLoadingOfStakeholder ? "" : dataOfStakeholder?.totalCount, label: t("ES_COMMON_STAKEHOLDER_INBOX_LABEL"), - link: `/digit-ui/employee/obps/stakeholder-inbox`, - field: "STAKEHOLDER" + link: `/mgramseva-digit-ui/employee/obps/stakeholder-inbox`, + field: "STAKEHOLDER", }, { - count: isInboxLoading ? "" : dataOfBPA?.totalCount , + count: isInboxLoading ? "" : dataOfBPA?.totalCount, label: t("ES_COMMON_OBPS_INBOX_LABEL"), - link: `/digit-ui/employee/obps/inbox`, - field: "BPA" + link: `/mgramseva-digit-ui/employee/obps/inbox`, + field: "BPA", }, { label: t("ES_COMMON_SEARCH_APPLICATION"), - link: `/digit-ui/employee/obps/search/application` + link: `/mgramseva-digit-ui/employee/obps/search/application`, }, - ] - }),[isInboxLoading, isInboxLoadingOfStakeholder, dataOfStakeholder, dataOfBPA, totalCount, totalCountEs]); + ], + }), + [isInboxLoading, isInboxLoadingOfStakeholder, dataOfStakeholder, dataOfBPA, totalCount, totalCountEs] + ); - if (!checkingForStakeholderRoles) { - propsForModuleCard.links = propsForModuleCard.links.filter(obj => { - return obj.field !== 'STAKEHOLDER'; - }); - } + if (!checkingForStakeholderRoles) { + propsForModuleCard.links = propsForModuleCard.links.filter((obj) => { + return obj.field !== "STAKEHOLDER"; + }); + } - if (!checkingForBPARoles) { - propsForModuleCard.links = propsForModuleCard.links.filter(obj => { - return obj.field !== 'BPA'; - }); - } - - return checkingForBPARoles || checkingForStakeholderRoles ? : null + if (!checkingForBPARoles) { + propsForModuleCard.links = propsForModuleCard.links.filter((obj) => { + return obj.field !== "BPA"; + }); } - export default OBPSEmployeeHomeCard \ No newline at end of file + return checkingForBPARoles || checkingForStakeholderRoles ? : null; +}; + +export default OBPSEmployeeHomeCard; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/obps/src/pages/employee/Inbox/index.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/obps/src/pages/employee/Inbox/index.js index 79e57fcc0..a8cc5aa6e 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/obps/src/pages/employee/Inbox/index.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/obps/src/pages/employee/Inbox/index.js @@ -105,7 +105,7 @@ const Inbox = ({ parentRoute }) => { if (bService === "BPAREG") { redirectBS = "search/application/stakeholder"; } else { - redirectBS = window.location.href.includes("/citizen") ? "bpa" : "search/application/bpa" + redirectBS = window.location.href.includes("/citizen") ? "bpa" : "search/application/bpa"; } return redirectBS; }; @@ -127,7 +127,9 @@ const Inbox = ({ parentRoute }) => { links: [ { text: t("BPA_SEARCH_PAGE_TITLE"), - link: window.location.href.includes("/citizen") ? "/digit-ui/citizen/obps/search/application" : "/digit-ui/employee/obps/search/application", + link: window.location.href.includes("/citizen") + ? "/digit-ui/citizen/obps/search/application" + : "/mgramseva-digit-ui/employee/obps/search/application", businessService: "BPA", roles: ["BPAREG_EMPLOYEE", "BPAREG_APPROVER", "BPAREG_DOC_VERIFIER", "BPAREG_DOC_VERIFIER"], }, @@ -161,13 +163,13 @@ const Inbox = ({ parentRoute }) => { ); const onSearchFormSubmit = (data) => { - data.hasOwnProperty("") && delete data?.[""] ; + data.hasOwnProperty("") && delete data?.[""]; dispatch({ action: "mutateTableForm", data: { ...tableOrderFormDefaultValues } }); dispatch({ action: "mutateSearchForm", data }); }; const onFilterFormSubmit = (data) => { - data.hasOwnProperty("") && delete data?.[""] ; + data.hasOwnProperty("") && delete data?.[""]; dispatch({ action: "mutateTableForm", data: { ...tableOrderFormDefaultValues } }); dispatch({ action: "mutateFilterForm", data }); }; @@ -200,13 +202,19 @@ const Inbox = ({ parentRoute }) => { {t("ES_COMMON_INBOX")} {totalCount ?

{totalCount}

: null} - {Digit.Utils.browser.isMobile() && -
- + {Digit.Utils.browser.isMobile() && ( +
+ {t("BPA_SEARCH_PAGE_TITLE")}
- } + )} { - const { t } = useTranslation() +const useInboxMobileCardsData = ({ parentRoute, table, getRedirectionLink }) => { + const { t } = useTranslation(); - const dataForMobileInboxCards = table?.map(({ applicationId, date, applicationType,businessService, locality, status, owner, sla, state}) => ({ - [t("BPA_APPLICATION_NUMBER_LABEL")]: applicationId, - [t("CS_APPLICATION_DETAILS_APPLICATION_DATE")]: format(new Date(date), 'dd/MM/yyyy'), - [t("BPA_SEARCH_APPLICATION_TYPE_LABEL")]: t(applicationType), - [t("ES_INBOX_LOCALITY")]: t(locality), - [t("EVENTS_STATUS_LABEL")]: state ? t(`WF_${businessService}_${state}`): t(`WF_${businessService}_${status}`), - [t("WF_INBOX_HEADER_CURRENT_OWNER")]: owner, - [t("ES_INBOX_SLA_DAYS_REMAINING")]: sla - })) + const dataForMobileInboxCards = table?.map(({ applicationId, date, applicationType, businessService, locality, status, owner, sla, state }) => ({ + [t("BPA_APPLICATION_NUMBER_LABEL")]: applicationId, + [t("CS_APPLICATION_DETAILS_APPLICATION_DATE")]: format(new Date(date), "dd/MM/yyyy"), + [t("BPA_SEARCH_APPLICATION_TYPE_LABEL")]: t(applicationType), + [t("ES_INBOX_LOCALITY")]: t(locality), + [t("EVENTS_STATUS_LABEL")]: state ? t(`WF_${businessService}_${state}`) : t(`WF_${businessService}_${status}`), + [t("WF_INBOX_HEADER_CURRENT_OWNER")]: owner, + [t("ES_INBOX_SLA_DAYS_REMAINING")]: sla, + })); - const MobileSortFormValues = () => { - const sortOrderOptions = [{ - code: "DESC", - i18nKey: "ES_COMMON_SORT_BY_DESC" - },{ - code: "ASC", - i18nKey: "ES_COMMON_SORT_BY_ASC" - }] - const { control: controlSortForm } = useFormContext() - return - { - onChange(e.code) - }} - selectedOption={sortOrderOptions.filter((option) => option.code === value)[0]} - optionsKey="i18nKey" - name="sortOrder" - options={sortOrderOptions} - />} + const MobileSortFormValues = () => { + const sortOrderOptions = [ + { + code: "DESC", + i18nKey: "ES_COMMON_SORT_BY_DESC", + }, + { + code: "ASC", + i18nKey: "ES_COMMON_SORT_BY_ASC", + }, + ]; + const { control: controlSortForm } = useFormContext(); + return ( + + ( + { + onChange(e.code); + }} + selectedOption={sortOrderOptions.filter((option) => option.code === value)[0]} + optionsKey="i18nKey" + name="sortOrder" + options={sortOrderOptions} /> - - } + )} + /> + + ); + }; - return ({ data:dataForMobileInboxCards,isTwoDynamicPrefix:true, linkPrefix: window.location.href.includes("/citizen") ? `/digit-ui/citizen/obps/` : `/digit-ui/employee/obps/`,getRedirectionLink:getRedirectionLink, serviceRequestIdKey: "applicationNo", MobileSortFormValues}) + return { + data: dataForMobileInboxCards, + isTwoDynamicPrefix: true, + linkPrefix: window.location.href.includes("/citizen") ? `/digit-ui/citizen/obps/` : `/mgramseva-digit-ui/employee/obps/`, + getRedirectionLink: getRedirectionLink, + serviceRequestIdKey: "applicationNo", + MobileSortFormValues, + }; +}; -} - -export default useInboxMobileCardsData \ No newline at end of file +export default useInboxMobileCardsData; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/obps/src/pages/employee/OBPSResponse.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/obps/src/pages/employee/OBPSResponse.js index e37a619a3..28e3d62b0 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/obps/src/pages/employee/OBPSResponse.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/obps/src/pages/employee/OBPSResponse.js @@ -4,7 +4,6 @@ import { useTranslation } from "react-i18next"; import { stringReplaceAll, getBusinessServices } from "../../utils"; import { Link, useHistory } from "react-router-dom"; - const OBPSResponse = (props) => { const { state } = props.location; const { t } = useTranslation(); @@ -18,7 +17,7 @@ const OBPSResponse = (props) => { let bpaBusinessService = applicationData?.businessService; let bpaStatus = applicationData?.status; - if (bpaBusinessService == "BPA_LOW") bpaBusinessService = "BPA" + if (bpaBusinessService == "BPA_LOW") bpaBusinessService = "BPA"; let workflowDetails = Digit.Hooks.useWorkflowDetails({ tenantId: bpaData?.tenantId, id: bpaData?.applicationNo, moduleCode: "BPA" }); @@ -30,20 +29,31 @@ const OBPSResponse = (props) => { // else if (bpaResponse?.BPA?.[0]?.businessService === "BPA_OC") businessService = "BPA.NC_OC_SAN_FEE"; let businessService = await getBusinessServices(bpaResponse?.BPA?.[0]?.businessService, bpaResponse?.BPA?.[0]?.status); - const fetchBill = await Digit.PaymentService.fetchBill(tenantId, { consumerCode: bpaResponse?.BPA?.[0]?.applicationNo, businessService: businessService }); + const fetchBill = await Digit.PaymentService.fetchBill(tenantId, { + consumerCode: bpaResponse?.BPA?.[0]?.applicationNo, + businessService: businessService, + }); if (bpaResponse?.BPA?.[0]?.status == "APPROVED" && fetchBill?.Bill[0] && fetchBill?.Bill[0]?.totalAmount != 0) setSanctionFee("_SAN_FEE"); setIsLoader(false); setApplicationData(bpaResponse?.BPA?.[0]); - setBillData(fetchBill?.Bill) - }, []) + setBillData(fetchBill?.Bill); + }, []); const getHeaderMessage = () => { - return t(`BPA_HEADER_${bpaBusinessService}_${bpaData?.workflow?.action}_${stringReplaceAll(bpaStatus, " ", "_").toUpperCase()}${isSanctionFee ? isSanctionFee : ""}`) - } + return t( + `BPA_HEADER_${bpaBusinessService}_${bpaData?.workflow?.action}_${stringReplaceAll(bpaStatus, " ", "_").toUpperCase()}${ + isSanctionFee ? isSanctionFee : "" + }` + ); + }; const getSubHeaderMessage = () => { - return t(`BPA_SUB_HEADER_${bpaBusinessService}_${bpaData?.workflow?.action}_${bpaData?.additionalDetails?.typeOfArchitect ? bpaData?.additionalDetails?.typeOfArchitect : "ARCHITECT"}_${stringReplaceAll(bpaStatus, " ", "_").toUpperCase()}${isSanctionFee ? isSanctionFee : ""}`) - } + return t( + `BPA_SUB_HEADER_${bpaBusinessService}_${bpaData?.workflow?.action}_${ + bpaData?.additionalDetails?.typeOfArchitect ? bpaData?.additionalDetails?.typeOfArchitect : "ARCHITECT" + }_${stringReplaceAll(bpaStatus, " ", "_").toUpperCase()}${isSanctionFee ? isSanctionFee : ""}` + ); + }; const printReciept = async () => { let response = await Digit.PaymentService.generatePdf(tenantId, { Bpa: [applicationData] }, "bpa-revocation"); @@ -52,32 +62,42 @@ const OBPSResponse = (props) => { }; const onSubmit = () => { - history.push(`/digit-ui/employee`); - } + history.push(`/mgramseva-digit-ui/employee`); + }; const getApplicationNoLabel = () => { - return bpaBusinessService == "BPA" ? t("BPA_PERMIT_APPLICATION_NUMBER_LABEL") : t("BPA_OCCUPANCY_CERTIFICATE_APPLICATION_NUMBER_LABEL") - } + return bpaBusinessService == "BPA" ? t("BPA_PERMIT_APPLICATION_NUMBER_LABEL") : t("BPA_OCCUPANCY_CERTIFICATE_APPLICATION_NUMBER_LABEL"); + }; const getPaymentURL = (isCitizen) => { - if (isCitizen == true) return `/digit-ui/citizen/payment/collect/${getBusinessServices(applicationData?.businessService, applicationData?.status)}/${applicationData?.applicationNo}/${applicationData?.tenantId}?tenantId=${applicationData?.tenantId}`; - } + if (isCitizen == true) + return `/digit-ui/citizen/payment/collect/${getBusinessServices(applicationData?.businessService, applicationData?.status)}/${ + applicationData?.applicationNo + }/${applicationData?.tenantId}?tenantId=${applicationData?.tenantId}`; + }; const getPaymentURLEmployee = () => { - history.push(`/digit-ui/employee/payment/collect/${getBusinessServices(applicationData?.businessService, applicationData?.status)}/${applicationData?.applicationNo}/${applicationData?.tenantId}?tenantId=${applicationData?.tenantId}`); - } + history.push( + `/mgramseva-digit-ui/employee/payment/collect/${getBusinessServices(applicationData?.businessService, applicationData?.status)}/${ + applicationData?.applicationNo + }/${applicationData?.tenantId}?tenantId=${applicationData?.tenantId}` + ); + }; - let isWorkflowLoading = true, isPayButtonEnable = false; + let isWorkflowLoading = true, + isPayButtonEnable = false; if (workflowDetails && workflowDetails?.data && !workflowDetails?.isLoading) { isWorkflowLoading = false; - workflowDetails?.data?.nextActions?.forEach(data => { + workflowDetails?.data?.nextActions?.forEach((data) => { if (data.action == "PAY" && !isPayButtonEnable) isPayButtonEnable = true; - }) + }); } return (
- {isLoader || workflowDetails?.isLoading ? : + {isLoader || workflowDetails?.isLoading ? ( + + ) : ( { headerStyles={{ fontSize: "32px", wordBreak: "break-word" }} /> {getSubHeaderMessage()} - {applicationData?.status == "PERMIT REVOCATION" ? -
+ {applicationData?.status == "PERMIT REVOCATION" ? ( +
{t("BPA_REVOCATION_PDF_LABEL")} -
: null - } - { - window.location.href.includes("/citizen") ? +
+ ) : null} + {window.location.href.includes("/citizen") ? ( +
+ {(applicationData?.status == "PENDING_APPL_FEE" || + applicationData?.status == "PENDING_FEE" || + applicationData?.status == "PENDING_SANC_FEE_PAYMENT") && + billData?.length > 0 && + isPayButtonEnable ? ( +
+ + + + + + +
+ ) : ( + + + + )} +
+ ) : ( +
- {(applicationData?.status == "PENDING_APPL_FEE" || applicationData?.status == "PENDING_FEE" || applicationData?.status == "PENDING_SANC_FEE_PAYMENT") && billData?.length > 0 && isPayButtonEnable ? + {(applicationData?.status == "PENDING_APPL_FEE" || + applicationData?.status == "PENDING_FEE" || + applicationData?.status == "PENDING_SANC_FEE_PAYMENT") && + billData?.length > 0 && + isPayButtonEnable ? (
- - - - - + + + {/* */} + {t("CORE_COMMON_GO_TO_HOME")} -
: - - - } +
+ ) : ( + + )}
- : - -
- {(applicationData?.status == "PENDING_APPL_FEE" || applicationData?.status == "PENDING_FEE" || applicationData?.status == "PENDING_SANC_FEE_PAYMENT") && billData?.length > 0 && isPayButtonEnable ? -
- - - {/* */} - {t("CORE_COMMON_GO_TO_HOME")} - -
: } -
-
- } - } + + )} + + )}
); }; -export default OBPSResponse; \ No newline at end of file +export default OBPSResponse; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/obps/src/pages/employee/Search.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/obps/src/pages/employee/Search.js index aaeaaa309..51c999f85 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/obps/src/pages/employee/Search.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/obps/src/pages/employee/Search.js @@ -11,37 +11,55 @@ const Search = ({ path }) => { const tenantId = Digit.ULBService.getCurrentTenantId(); const location = useLocation(); const details = () => { - if (userInformation?.roles?.filter((ob) => ob.code.includes("BPAREG_"))?.length <= 0 && userInformation?.roles?.filter((ob) =>(ob.code.includes("BPA_") || ob.code.includes("CITIZEN"))).length > 0) return "BUILDING_PLAN_SCRUTINY"; - if (userInformation?.roles?.filter((ob) => ob.code.includes("BPAREG_"))?.length > 0 && userInformation?.roles?.filter((ob) =>(ob.code.includes("BPA_") || ob.code.includes("CITIZEN"))).length <= 0) return "BPA_STAKEHOLDER_REGISTRATION"; - else return "BUILDING_PLAN_SCRUTINY" - } + if ( + userInformation?.roles?.filter((ob) => ob.code.includes("BPAREG_"))?.length <= 0 && + userInformation?.roles?.filter((ob) => ob.code.includes("BPA_") || ob.code.includes("CITIZEN")).length > 0 + ) + return "BUILDING_PLAN_SCRUTINY"; + if ( + userInformation?.roles?.filter((ob) => ob.code.includes("BPAREG_"))?.length > 0 && + userInformation?.roles?.filter((ob) => ob.code.includes("BPA_") || ob.code.includes("CITIZEN")).length <= 0 + ) + return "BPA_STAKEHOLDER_REGISTRATION"; + else return "BUILDING_PLAN_SCRUTINY"; + }; const [selectedType, setSelectedType] = useState(details()); const [payload, setPayload] = useState({}); const [searchData, setSearchData] = useState({}); - useEffect(()=>{ - if (location.pathname === "/digit-ui/citizen/obps/search/application" || location.pathname === "/digit-ui/employee/obps/search/application") { - Digit.SessionStorage.del("OBPS.INBOX") - Digit.SessionStorage.del("STAKEHOLDER.INBOX") + useEffect(() => { + if ( + location.pathname === "/digit-ui/citizen/obps/search/application" || + location.pathname === "/mgramseva-digit-ui/employee/obps/search/application" + ) { + Digit.SessionStorage.del("OBPS.INBOX"); + Digit.SessionStorage.del("STAKEHOLDER.INBOX"); } - },[location.pathname]) + }, [location.pathname]); const Search = Digit.ComponentRegistryService.getComponent("OBPSSearchApplication"); const checkData = (data) => { - if (data?.applicationNo === "" && data?.fromDate === "" && data?.mobileNumber === "" && data?.serviceType === "" && data?.status === "" && data?.toDate === "") return false - - return true + if ( + data?.applicationNo === "" && + data?.fromDate === "" && + data?.mobileNumber === "" && + data?.serviceType === "" && + data?.status === "" && + data?.toDate === "" + ) + return false; - } + return true; + }; - const [paramerror,setparamerror] = useState("") + const [paramerror, setparamerror] = useState(""); function onSubmit(_data) { - if (_data?.applicationType?.code === "BPA_STAKEHOLDER_REGISTRATION"){ - const isSearchAllowed = checkData(_data) - if(!isSearchAllowed){ - setparamerror("BPA_ADD_MORE_PARAM_STAKEHOLDER") + if (_data?.applicationType?.code === "BPA_STAKEHOLDER_REGISTRATION") { + const isSearchAllowed = checkData(_data); + if (!isSearchAllowed) { + setparamerror("BPA_ADD_MORE_PARAM_STAKEHOLDER"); } } setSearchData(_data); @@ -65,9 +83,7 @@ const Search = ({ path }) => { let params = {}; let filters = {}; - - if ( (selectedType && selectedType.includes("STAKEHOLDER")) || (Object.keys(payload).length > 0 && payload?.applicationType && payload?.applicationType.includes("STAKEHOLDER")) @@ -80,9 +96,8 @@ const Search = ({ path }) => { payload.applicationNo = ""; } if (payload && payload["applicationType"]) delete payload["applicationType"]; - if(payload && payload["serviceType"]) - { - payload["tradeType"] = payload["serviceType"] + if (payload && payload["serviceType"]) { + payload["tradeType"] = payload["serviceType"]; delete payload["serviceType"]; } params = { ...payload, tenantId: Digit.ULBService.getStateId() }; @@ -107,7 +122,7 @@ const Search = ({ path }) => { tenantId, filters, params, - {enabled:paramerror===""} + { enabled: paramerror === "" } ); return ( { const { state } = props.location; const { t } = useTranslation(); const history = useHistory(); const bparegData = state?.data?.Licenses?.[0]; - const typeofStakeholder = bparegData?.tradeLicenseDetail?.tradeUnits?.[0]?.tradeType?.split('.')[0] + const typeofStakeholder = bparegData?.tradeLicenseDetail?.tradeUnits?.[0]?.tradeType?.split(".")[0]; const getHeaderMessage = () => { - return t(`BPA_ARCHITECT_${bparegData?.status}_MAIN_HEAD`) - } + return t(`BPA_ARCHITECT_${bparegData?.status}_MAIN_HEAD`); + }; const getSubHeaderMessage = () => { - return t(`BPA_ARCHITECT_${bparegData?.status}_SUB_MAIN_HEAD`) - } + return t(`BPA_ARCHITECT_${bparegData?.status}_SUB_MAIN_HEAD`); + }; const onSubmit = () => { - history.push(`/digit-ui/employee`); - } + history.push(`/mgramseva-digit-ui/employee`); + }; return (
@@ -32,17 +31,14 @@ const StakeholderResponse = (props) => { info={t("BPA_NEW_STAKEHOLDER_REGISTRATION_APP_LABEL")} successful={bparegData?.status == "REJECTED" ? false : true} style={{ padding: "10px" }} - headerStyles={{fontSize: "32px", wordBreak: "break-word"}} + headerStyles={{ fontSize: "32px", wordBreak: "break-word" }} /> {getSubHeaderMessage()} - +
); }; -export default StakeholderResponse; \ No newline at end of file +export default StakeholderResponse; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/obps/src/pages/employee/index.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/obps/src/pages/employee/index.js index 1e410166f..f0a0ea2b7 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/obps/src/pages/employee/index.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/obps/src/pages/employee/index.js @@ -12,64 +12,71 @@ const OBPSBreadCrumbs = ({ location }) => { const { t } = useTranslation(); const crumbs = [ { - path: "/digit-ui/employee", + path: "/mgramseva-digit-ui/employee", content: t("ES_COMMON_HOME"), show: true, }, { - path: "/digit-ui/employee/obps/inbox", + path: "/mgramseva-digit-ui/employee/obps/inbox", content: t("ES_COMMON_OBPS_INBOX_LABEL"), show: location.pathname.includes("obps/inbox") ? true : false, }, { - path: "/digit-ui/employee/obps/stakeholder-inbox", + path: "/mgramseva-digit-ui/employee/obps/stakeholder-inbox", content: t("ES_COMMON_STAKEHOLDER_INBOX_LABEL"), show: location.pathname.includes("obps/stakeholder-inbox") ? true : false, }, { - path: "/digit-ui/employee/obps/inbox/bpa/:id", + path: "/mgramseva-digit-ui/employee/obps/inbox/bpa/:id", content: t("ES_OBPS_SEARCH_BPA"), show: location.pathname.includes("obps/inbox/bpa") ? true : false, }, { - path: "/digit-ui/employee/obps/inbox/stakeholder/:id", + path: "/mgramseva-digit-ui/employee/obps/inbox/stakeholder/:id", content: t("ES_OBPS_SEARCH_BPA"), show: location.pathname.includes("obps/stakeholder-inbox/stakeholder") ? true : false, }, { - path: "/digit-ui/employee/obps/search/application", + path: "/mgramseva-digit-ui/employee/obps/search/application", content: t("ES_OBPS_SEARCH"), show: location.pathname.includes("/obps/search/application") ? true : false, }, { - path: "/digit-ui/employee/obps/search/application/bpa/:id", + path: "/mgramseva-digit-ui/employee/obps/search/application/bpa/:id", content: t("ES_OBPS_SEARCH_BPA"), show: location.pathname.includes("/obps/search/application/bpa") ? true : false, }, { - path: "/digit-ui/employee/obps/search/application/stakeholder/:id", + path: "/mgramseva-digit-ui/employee/obps/search/application/stakeholder/:id", content: t("ES_OBPS_SEARCH_BPA"), show: location.pathname.includes("/obps/search/application/stakeholder/") ? true : false, }, ]; return ; -} +}; const EmployeeApp = ({ path }) => { - const location = useLocation() + const location = useLocation(); const { t } = useTranslation(); const Inbox = Digit.ComponentRegistryService.getComponent("BPAInbox"); const StakeholderInbox = Digit.ComponentRegistryService.getComponent("StakeholderInbox"); const ApplicationDetail = Digit.ComponentRegistryService.getComponent("ObpsEmpApplicationDetail"); const BpaApplicationDetail = Digit.ComponentRegistryService.getComponent("ObpsEmployeeBpaApplicationDetail"); - const isLocation = window.location.href.includes("bpa") || window.location.href.includes("stakeholder-inbox/stakeholder") || window.location.href.includes("application"); + const isLocation = + window.location.href.includes("bpa") || + window.location.href.includes("stakeholder-inbox/stakeholder") || + window.location.href.includes("application"); const isFromNoc = window.location.href.includes("digit-ui/employee/obps/bpa/"); const isRes = window.location.href.includes("obps/response") || window.location.href.includes("obps/stakeholder-response"); return ( - {!isFromNoc && !isRes ?
: null} - {isFromNoc ? {t("CS_COMMON_BACK")}: null} + {!isFromNoc && !isRes ? ( +
+ +
+ ) : null} + {isFromNoc ? {t("CS_COMMON_BACK")} : null} @@ -83,7 +90,7 @@ const EmployeeApp = ({ path }) => {
- ) -} + ); +}; -export default EmployeeApp; \ No newline at end of file +export default EmployeeApp; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/obps/src/pages/employee/stakeholderInbox/index.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/obps/src/pages/employee/stakeholderInbox/index.js index 5e4b87f74..f31ad15eb 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/obps/src/pages/employee/stakeholderInbox/index.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/obps/src/pages/employee/stakeholderInbox/index.js @@ -1,4 +1,4 @@ -import React, { Fragment, useCallback, useMemo, useReducer } from "react" +import React, { Fragment, useCallback, useMemo, useReducer } from "react"; import { InboxComposer, CaseIcon, Header } from "@egovernments/digit-ui-react-components"; import { useTranslation } from "react-i18next"; import FilterFormFieldsComponent from "./FilterFormFieldsComponent"; @@ -8,49 +8,48 @@ import useInboxMobileCardsData from "./useInboxMobileCardsData"; import { Link } from "react-router-dom"; const Inbox = ({ parentRoute }) => { - - const { t } = useTranslation() + const { t } = useTranslation(); const tenantId = Digit.ULBService.getStateId(); - const searchFormDefaultValues = {} + const searchFormDefaultValues = {}; const filterFormDefaultValues = { moduleName: "BPAREG", applicationStatus: [], businessService: null, locality: [], - assignee: "ASSIGNED_TO_ALL" - } + assignee: "ASSIGNED_TO_ALL", + }; const tableOrderFormDefaultValues = { sortBy: "", - limit: window.Digit.Utils.browser.isMobile()?50:10, + limit: window.Digit.Utils.browser.isMobile() ? 50 : 10, offset: 0, - sortOrder: "DESC" - } + sortOrder: "DESC", + }; function formReducer(state, payload) { switch (payload.action) { case "mutateSearchForm": - Digit.SessionStorage.set("STAKEHOLDER.INBOX", { ...state, searchForm: payload.data }) + Digit.SessionStorage.set("STAKEHOLDER.INBOX", { ...state, searchForm: payload.data }); return { ...state, searchForm: payload.data }; case "mutateFilterForm": - Digit.SessionStorage.set("STAKEHOLDER.INBOX", { ...state, filterForm: payload.data }) + Digit.SessionStorage.set("STAKEHOLDER.INBOX", { ...state, filterForm: payload.data }); return { ...state, filterForm: payload.data }; case "mutateTableForm": - Digit.SessionStorage.set("STAKEHOLDER.INBOX", { ...state, tableForm: payload.data }) + Digit.SessionStorage.set("STAKEHOLDER.INBOX", { ...state, tableForm: payload.data }); return { ...state, tableForm: payload.data }; default: break; } } - const InboxObjectInSessionStorage = Digit.SessionStorage.get("STAKEHOLDER.INBOX") + const InboxObjectInSessionStorage = Digit.SessionStorage.get("STAKEHOLDER.INBOX"); const onSearchFormReset = (setSearchFormValue) => { setSearchFormValue("mobileNumber", null); setSearchFormValue("applicationNo", null); - dispatch({action: "mutateSearchForm", data: searchFormDefaultValues}); - } + dispatch({ action: "mutateSearchForm", data: searchFormDefaultValues }); + }; const onFilterFormReset = (setFilterFormValue) => { setFilterFormValue("moduleName", "BPAREG"); @@ -59,103 +58,166 @@ const Inbox = ({ parentRoute }) => { setFilterFormValue("locality", []); setFilterFormValue("assignee", "ASSIGNED_TO_ALL"); dispatch({ action: "mutateFilterForm", data: filterFormDefaultValues }); - } - + }; + const onSortFormReset = (setSortFormValue) => { - setSortFormValue("sortOrder", "DESC") - dispatch({action: "mutateTableForm", data: tableOrderFormDefaultValues}) - } + setSortFormValue("sortOrder", "DESC"); + dispatch({ action: "mutateTableForm", data: tableOrderFormDefaultValues }); + }; const formInitValue = useMemo(() => { - return InboxObjectInSessionStorage || { - filterForm: filterFormDefaultValues, - searchForm: searchFormDefaultValues, - tableForm: tableOrderFormDefaultValues - } - } - , [Object.values(InboxObjectInSessionStorage?.filterForm || {}), Object.values(InboxObjectInSessionStorage?.searchForm || {}), Object.values(InboxObjectInSessionStorage?.tableForm || {})]) - - const [formState, dispatch] = useReducer(formReducer, formInitValue) + return ( + InboxObjectInSessionStorage || { + filterForm: filterFormDefaultValues, + searchForm: searchFormDefaultValues, + tableForm: tableOrderFormDefaultValues, + } + ); + }, [ + Object.values(InboxObjectInSessionStorage?.filterForm || {}), + Object.values(InboxObjectInSessionStorage?.searchForm || {}), + Object.values(InboxObjectInSessionStorage?.tableForm || {}), + ]); + + const [formState, dispatch] = useReducer(formReducer, formInitValue); const onPageSizeChange = (e) => { - dispatch({ action: "mutateTableForm", data: { ...formState.tableForm, limit: e.target.value } }) - } + dispatch({ action: "mutateTableForm", data: { ...formState.tableForm, limit: e.target.value } }); + }; const onSortingByData = (e) => { - if(e.length > 0){ - const [{id, desc}] = e - const sortOrder = desc ? "DESC" : "ASC" - const sortBy = id - if(!(formState.tableForm.sortBy === sortBy && formState.tableForm.sortOrder === sortOrder)){ - dispatch({action: "mutateTableForm", data:{ ...formState.tableForm, sortBy: id, sortOrder: desc ? "DESC" : "ASC" }}) + if (e.length > 0) { + const [{ id, desc }] = e; + const sortOrder = desc ? "DESC" : "ASC"; + const sortBy = id; + if (!(formState.tableForm.sortBy === sortBy && formState.tableForm.sortOrder === sortOrder)) { + dispatch({ action: "mutateTableForm", data: { ...formState.tableForm, sortBy: id, sortOrder: desc ? "DESC" : "ASC" } }); } } - } + }; const onMobileSortOrderData = (data) => { - const {sortOrder} = data - dispatch({action: "mutateTableForm", data:{ ...formState.tableForm, sortOrder }}) - } + const { sortOrder } = data; + dispatch({ action: "mutateTableForm", data: { ...formState.tableForm, sortOrder } }); + }; - const { data: localitiesForEmployeesCurrentTenant, isLoading: loadingLocalitiesForEmployeesCurrentTenant } = Digit.Hooks.useBoundaryLocalities(tenantId, "revenue", {}, t); + const { data: localitiesForEmployeesCurrentTenant, isLoading: loadingLocalitiesForEmployeesCurrentTenant } = Digit.Hooks.useBoundaryLocalities( + tenantId, + "revenue", + {}, + t + ); const { isLoading: isInboxLoading, data: { table, statuses, totalCount } = {} } = Digit.Hooks.obps.useBPAInbox({ tenantId, - filters: { ...formState } + filters: { ...formState }, }); const PropsForInboxLinks = { logoIcon: , headerText: "CS_COMMON_OBPS", - links: [{ - text: t("BPA_SEARCH_PAGE_TITLE"), - link: "/digit-ui/employee/obps/search/application", - businessService: "BPA", - roles: ["BPAREG_EMPLOYEE", "BPAREG_APPROVER", "BPAREG_DOC_VERIFIER", "BPAREG_DOC_VERIFIER"], - }] - } - - const SearchFormFields = useCallback(({ registerRef, searchFormState, searchFieldComponents }) => , []) + links: [ + { + text: t("BPA_SEARCH_PAGE_TITLE"), + link: "/mgramseva-digit-ui/employee/obps/search/application", + businessService: "BPA", + roles: ["BPAREG_EMPLOYEE", "BPAREG_APPROVER", "BPAREG_DOC_VERIFIER", "BPAREG_DOC_VERIFIER"], + }, + ], + }; + + const SearchFormFields = useCallback( + ({ registerRef, searchFormState, searchFieldComponents }) => ( + + ), + [] + ); const FilterFormFields = useCallback( - ({ registerRef, controlFilterForm, setFilterFormValue, getFilterFormValue }) => - , [statuses, isInboxLoading, localitiesForEmployeesCurrentTenant, loadingLocalitiesForEmployeesCurrentTenant]) + ({ registerRef, controlFilterForm, setFilterFormValue, getFilterFormValue }) => ( + + ), + [statuses, isInboxLoading, localitiesForEmployeesCurrentTenant, loadingLocalitiesForEmployeesCurrentTenant] + ); const onSearchFormSubmit = (data) => { data.hasOwnProperty("") && delete data?.[""]; dispatch({ action: "mutateTableForm", data: { ...tableOrderFormDefaultValues } }); - dispatch({ action: "mutateSearchForm", data }) - } + dispatch({ action: "mutateSearchForm", data }); + }; const onFilterFormSubmit = (data) => { - data.hasOwnProperty("") && delete data?.[""] ; + data.hasOwnProperty("") && delete data?.[""]; dispatch({ action: "mutateTableForm", data: { ...tableOrderFormDefaultValues } }); - dispatch({ action: "mutateFilterForm", data }) - } - - const propsForSearchForm = { SearchFormFields, onSearchFormSubmit, searchFormDefaultValues: formState?.searchForm, resetSearchFormDefaultValues: searchFormDefaultValues, onSearchFormReset } - - const propsForFilterForm = { FilterFormFields, onFilterFormSubmit, filterFormDefaultValues: formState?.filterForm, resetFilterFormDefaultValues: filterFormDefaultValues, onFilterFormReset } - - const propsForInboxTable = useInboxTableConfig({ ...{ parentRoute, onPageSizeChange, formState, totalCount, table, dispatch, onSortingByData } }) - - const propsForInboxMobileCards = useInboxMobileCardsData({ parentRoute, table }) - - const propsForMobileSortForm = { onMobileSortOrderData, sortFormDefaultValues: formState?.tableForm, onSortFormReset } - - return <> -
- {t("ES_COMMON_INBOX")} - {totalCount ?

{totalCount}

: null} -
- {Digit.Utils.browser.isMobile() && -
- - {t("BPA_SEARCH_PAGE_TITLE")} - -
- } - - -} - -export default Inbox \ No newline at end of file + dispatch({ action: "mutateFilterForm", data }); + }; + + const propsForSearchForm = { + SearchFormFields, + onSearchFormSubmit, + searchFormDefaultValues: formState?.searchForm, + resetSearchFormDefaultValues: searchFormDefaultValues, + onSearchFormReset, + }; + + const propsForFilterForm = { + FilterFormFields, + onFilterFormSubmit, + filterFormDefaultValues: formState?.filterForm, + resetFilterFormDefaultValues: filterFormDefaultValues, + onFilterFormReset, + }; + + const propsForInboxTable = useInboxTableConfig({ ...{ parentRoute, onPageSizeChange, formState, totalCount, table, dispatch, onSortingByData } }); + + const propsForInboxMobileCards = useInboxMobileCardsData({ parentRoute, table }); + + const propsForMobileSortForm = { onMobileSortOrderData, sortFormDefaultValues: formState?.tableForm, onSortFormReset }; + + return ( + <> +
+ {t("ES_COMMON_INBOX")} + {totalCount ?

{totalCount}

: null} +
+ {Digit.Utils.browser.isMobile() && ( +
+ + {t("BPA_SEARCH_PAGE_TITLE")} + +
+ )} + + + ); +}; + +export default Inbox; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/components/DesktopInbox.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/components/DesktopInbox.js index a81aba6a4..c94259839 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/components/DesktopInbox.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/components/DesktopInbox.js @@ -35,7 +35,9 @@ const DesktopInbox = ({ return (
- {row.original["serviceRequestId"]} + + {row.original["serviceRequestId"]} + {/* goTo(row.row.original["serviceRequestId"])}>{row.row.original["serviceRequestId"]} */}
diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/components/PGRCard.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/components/PGRCard.js index 11e56ae82..7fd685f4b 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/components/PGRCard.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/components/PGRCard.js @@ -3,56 +3,57 @@ import { Link } from "react-router-dom"; import { useTranslation } from "react-i18next"; import { EmployeeModuleCard } from "@egovernments/digit-ui-react-components"; - const PGRCard = () => { const { t } = useTranslation(); const allLinks = [ - { text: t("ES_PGR_INBOX"), link: "/digit-ui/employee/pgr/inbox" }, - { text: t("ES_PGR_NEW_COMPLAINT"), link: "/digit-ui/employee/pgr/complaint/create", accessTo: ["CSR"] }, + { text: t("ES_PGR_INBOX"), link: "/mgramseva-digit-ui/employee/pgr/inbox" }, + { text: t("ES_PGR_NEW_COMPLAINT"), link: "/mgramseva-digit-ui/employee/pgr/complaint/create", accessTo: ["CSR"] }, ]; if (!Digit.Utils.pgrAccess()) { return null; } - const Icon = () => - - - + const Icon = () => ( + + + + + ); - let propsForCSR =[ + let propsForCSR = [ { label: t("ES_PGR_NEW_COMPLAINT"), - link: `/digit-ui/employee/pgr/complaint/create`, - role: "CSR" - } - ] + link: `/mgramseva-digit-ui/employee/pgr/complaint/create`, + role: "CSR", + }, + ]; - propsForCSR = propsForCSR.filter(link => link.role && Digit.Utils.didEmployeeHasRole(link.role) ); + propsForCSR = propsForCSR.filter((link) => link.role && Digit.Utils.didEmployeeHasRole(link.role)); const propsForModuleCard = { Icon: , moduleName: t("ES_PGR_HEADER_COMPLAINT"), kpis: [ - { - label: t("TOTAL_PGR"), - link: `/digit-ui/employee/pgr/inbox` - }, - { - label: t("TOTAL_NEARING_SLA"), - link: `/digit-ui/employee/pgr/inbox` - } + { + label: t("TOTAL_PGR"), + link: `/mgramseva-digit-ui/employee/pgr/inbox`, + }, + { + label: t("TOTAL_NEARING_SLA"), + link: `/mgramseva-digit-ui/employee/pgr/inbox`, + }, ], links: [ - { + { label: t("ES_PGR_INBOX"), - link: `/digit-ui/employee/pgr/inbox` - }, - ...propsForCSR - ] -} + link: `/mgramseva-digit-ui/employee/pgr/inbox`, + }, + ...propsForCSR, + ], + }; - return + return ; }; export default PGRCard; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/components/inbox/ComplaintCard.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/components/inbox/ComplaintCard.js index 13a625a7c..235cf1a8b 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/components/inbox/ComplaintCard.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/components/inbox/ComplaintCard.js @@ -42,7 +42,7 @@ export const ComplaintCard = ({ data, onFilterChange, onSearch, serviceRequestId ); } else if (data && data?.length > 0) { - result = ; + result = ; } else { result = ( diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/components/inbox/ComplaintLinks.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/components/inbox/ComplaintLinks.js index 59a47b833..71890c25d 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/components/inbox/ComplaintLinks.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/components/inbox/ComplaintLinks.js @@ -7,7 +7,7 @@ const ComplaintsLink = ({ isMobile, data }) => { const { t } = useTranslation(); const allLinks = [ - { text: "ES_PGR_NEW_COMPLAINT", link: "/digit-ui/employee/pgr/complaint/create", accessTo: ["CSR"] }, + { text: "ES_PGR_NEW_COMPLAINT", link: "/mgramseva-digit-ui/employee/pgr/complaint/create", accessTo: ["CSR"] }, // { text: "Reports", link: "/employee" }, // { text: "Dashboard", link: "/employee" }, ]; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/constants/Routes.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/constants/Routes.js index c1170e2f6..bb4d4db0c 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/constants/Routes.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/constants/Routes.js @@ -31,7 +31,7 @@ export const Employee = { ComplaintDetails: PGR_EMPLOYEE_COMPLAINT_DETAILS, CreateComplaint: PGR_EMPLOYEE_CREATE_COMPLAINT, Response: "/response", - Home: "/digit-ui/employee", + Home: "/mgramseva-digit-ui/employee", }; export const getRoute = (match, route) => `${match.path}${route}`; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/pages/employee/Response.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/pages/employee/Response.js index 3ce178175..a292b63a6 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/pages/employee/Response.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/pages/employee/Response.js @@ -38,7 +38,7 @@ const Response = (props) => { {appState.complaints.response && } {t("ES_COMMON_TRACK_COMPLAINT_TEXT")} - + diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/pt/src/components/MobileSearchApplication.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/pt/src/components/MobileSearchApplication.js index 741b5bd6a..e023fd6e1 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/pt/src/components/MobileSearchApplication.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/pt/src/components/MobileSearchApplication.js @@ -1,19 +1,21 @@ import React, { Fragment, useCallback, useMemo, useReducer } from "react"; -import { - CloseSvg, - SearchForm, - Table, - Card, - SearchAction, - PopUp, - DetailsCard, - Loader, - Toast, -} from "@egovernments/digit-ui-react-components"; +import { CloseSvg, SearchForm, Table, Card, SearchAction, PopUp, DetailsCard, Loader, Toast } from "@egovernments/digit-ui-react-components"; import SearchFormFields from "./SearchFields"; -const MobileSearchApplication = ({ Controller, register, control, t, reset, previousPage, handleSubmit, tenantId, data, onSubmit, formState, setShowToast}) => { - +const MobileSearchApplication = ({ + Controller, + register, + control, + t, + reset, + previousPage, + handleSubmit, + tenantId, + data, + onSubmit, + formState, + setShowToast, +}) => { function activateModal(state, action) { switch (action.type) { case "set": @@ -21,7 +23,8 @@ const MobileSearchApplication = ({ Controller, register, control, t, reset, prev case "remove": return false; default: - break; } + break; + } } const [currentlyActiveMobileModal, setActiveMobileModal] = useReducer(activateModal, false); @@ -66,28 +69,25 @@ const MobileSearchApplication = ({ Controller, register, control, t, reset, prev [currentlyActiveMobileModal] ); - const propsMobileInboxCards = useMemo( - () => { - if (data?.display){ - return [] - } - if(data === "") - { + const propsMobileInboxCards = useMemo(() => { + if (data?.display) { return []; - } - return data?.map((data) => ({ - [t("PT_SEARCHPROPERTY_TABEL_PID")]: data?.propertyId, - [t("PT_APPLICATION_NO_LABEL")]: data?.acknowldgementNumber || "-", - [t("PT_SEARCHPROPERTY_TABEL_APPLICATIONTYPE")]: data?.creationReason || "", - [t("PT_COMMON_TABLE_COL_OWNER_NAME")]: data?.owners?.map( o => o.name ). join(",") || "" , - [t("ES_SEARCH_PROPERTY_STATUS")]: t( data?.status &&`WF_PT_${data?.status}`|| "NA") || "", - [t("PT_ADDRESS_LABEL")]: `${data?.address?.doorNo ? `${data?.address?.doorNo}, ` : ""} ${data?.address?.street ? `${data?.address?.street}, ` : ""}${ - data?.address?.landmark ? `${data?.address?.landmark}, ` : "" - }${t(data?.address?.locality.code)}, ${t(data?.address?.city.code)} ${t(data?.address?.pincode) ? `${data?.address.pincode}` : " "}` || "NA", - })) - }, - [data] - ); + } + if (data === "") { + return []; + } + return data?.map((data) => ({ + [t("PT_SEARCHPROPERTY_TABEL_PID")]: data?.propertyId, + [t("PT_APPLICATION_NO_LABEL")]: data?.acknowldgementNumber || "-", + [t("PT_SEARCHPROPERTY_TABEL_APPLICATIONTYPE")]: data?.creationReason || "", + [t("PT_COMMON_TABLE_COL_OWNER_NAME")]: data?.owners?.map((o) => o.name).join(",") || "", + [t("ES_SEARCH_PROPERTY_STATUS")]: t((data?.status && `WF_PT_${data?.status}`) || "NA") || "", + [t("PT_ADDRESS_LABEL")]: + `${data?.address?.doorNo ? `${data?.address?.doorNo}, ` : ""} ${data?.address?.street ? `${data?.address?.street}, ` : ""}${ + data?.address?.landmark ? `${data?.address?.landmark}, ` : "" + }${t(data?.address?.locality.code)}, ${t(data?.address?.city.code)} ${t(data?.address?.pincode) ? `${data?.address.pincode}` : " "}` || "NA", + })); + }, [data]); return ( @@ -95,7 +95,7 @@ const MobileSearchApplication = ({ Controller, register, control, t, reset, prev setActiveMobileModal({ type: "set", payload: "SearchFormComponent" })} - {...{tenantId, t}} + {...{ tenantId, t }} /> {/* {isInboxLoading ? : setActiveMobileModal({type:"set", payload:"FilterFormComponent"})}/>} */} {/* setActiveMobileModal({type:"set", payload:"SortComponent"})}/> */} @@ -128,13 +128,13 @@ const MobileSearchApplication = ({ Controller, register, control, t, reset, prev )} - ) -} + ); +}; -export default MobileSearchApplication \ No newline at end of file +export default MobileSearchApplication; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/pt/src/components/PTCard.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/pt/src/components/PTCard.js index 24f1c78cc..37d1f3f52 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/pt/src/components/PTCard.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/pt/src/components/PTCard.js @@ -13,7 +13,7 @@ const PTCard = () => { filters: { limit: 10, offset: 0, services: ["PT.CREATE", "PT.MUTATION", "PT.UPDATE"] }, config: { select: (data) => { - return {totalCount:data?.totalCount,nearingSlaCount:data?.nearingSlaCount} || "-"; + return { totalCount: data?.totalCount, nearingSlaCount: data?.nearingSlaCount } || "-"; }, enabled: Digit.Utils.ptAccess(), }, @@ -26,26 +26,26 @@ const PTCard = () => { if (!Digit.Utils.ptAccess()) { return null; } - const links=[ + const links = [ { count: isLoading ? "-" : total?.totalCount, label: t("ES_COMMON_INBOX"), - link: `/digit-ui/employee/pt/inbox`, + link: `/mgramseva-digit-ui/employee/pt/inbox`, }, { label: t("ES_TITLE_NEW_REGISTRATION"), - link: `/digit-ui/employee/pt/new-application`, - role: "PT_CEMP" + link: `/mgramseva-digit-ui/employee/pt/new-application`, + role: "PT_CEMP", }, { label: t("SEARCH_PROPERTY"), - link: `/digit-ui/employee/pt/search`, + link: `/mgramseva-digit-ui/employee/pt/search`, }, { label: t("ES_COMMON_APPLICATION_SEARCH"), - link: `/digit-ui/employee/pt/application-search`, + link: `/mgramseva-digit-ui/employee/pt/application-search`, }, - ] + ]; const PT_CEMP = Digit.UserService.hasAccess(["PT_CEMP"]) || false; const propsForModuleCard = { Icon: , @@ -54,16 +54,15 @@ const PTCard = () => { { count: total?.totalCount, label: t("ES_TITLE_INBOX"), - link: `/digit-ui/employee/pt/inbox`, + link: `/mgramseva-digit-ui/employee/pt/inbox`, }, { - count: total?.nearingSlaCount, label: t("TOTAL_NEARING_SLA"), - link: `/digit-ui/employee/pt/inbox`, - } + link: `/mgramseva-digit-ui/employee/pt/inbox`, + }, ], - links:links.filter(link=>!link?.role||PT_CEMP), + links: links.filter((link) => !link?.role || PT_CEMP), }; return ; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/pt/src/components/SearchApplication.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/pt/src/components/SearchApplication.js index b99f7409e..7751053bb 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/pt/src/components/SearchApplication.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/pt/src/components/SearchApplication.js @@ -1,280 +1,312 @@ -import React, { useCallback, useMemo, useEffect } from "react" +import React, { useCallback, useMemo, useEffect } from "react"; import { useForm, Controller } from "react-hook-form"; -import { TextInput, SubmitBar, LinkLabel, ActionBar, CloseSvg, DatePicker, CardLabelError, SearchForm, SearchField, Dropdown, Table, Card, MobileNumber, Loader, CardText, Header } from "@egovernments/digit-ui-react-components"; +import { + TextInput, + SubmitBar, + LinkLabel, + ActionBar, + CloseSvg, + DatePicker, + CardLabelError, + SearchForm, + SearchField, + Dropdown, + Table, + Card, + MobileNumber, + Loader, + CardText, + Header, +} from "@egovernments/digit-ui-react-components"; import { Link } from "react-router-dom"; import MobileSearchApplication from "./MobileSearchApplication"; -const PTSearchApplication = ({tenantId, isLoading, t, onSubmit, data, count, setShowToast }) => { - const isMobile = window.Digit.Utils.browser.isMobile(); - const { register, control, handleSubmit, setValue, getValues, reset, formState } = useForm({ - defaultValues: { - offset: 0, - limit: !isMobile && 10, - sortBy: "commencementDate", - sortOrder: "DESC" - } - }) - useEffect(() => { - register("offset", 0) - register("limit", 10) - register("sortBy", "commencementDate") - register("sortOrder", "DESC") - },[register]) - //need to get from workflow - const applicationTypes = [ - { - code: "CREATE", - i18nKey: "CREATE" - }, - { - code: "UPDATE", - i18nKey: "UPDATE" - }, - { - code: "MUTATION", - i18nKey: "MUTATION" - }, - ] - const applicationStatuses = [ - { - code: "ACTIVE", - i18nKey: "WF_PT_ACTIVE" - }, - { - code: "INACTIVE", - i18nKey: "WF_PT_INACTIVE" - }, - { - code: "INWORKFLOW", - i18nKey: "WF_PT_INWORKFLOW" - }, - ] +const PTSearchApplication = ({ tenantId, isLoading, t, onSubmit, data, count, setShowToast }) => { + const isMobile = window.Digit.Utils.browser.isMobile(); + const { register, control, handleSubmit, setValue, getValues, reset, formState } = useForm({ + defaultValues: { + offset: 0, + limit: !isMobile && 10, + sortBy: "commencementDate", + sortOrder: "DESC", + }, + }); + useEffect(() => { + register("offset", 0); + register("limit", 10); + register("sortBy", "commencementDate"); + register("sortOrder", "DESC"); + }, [register]); + //need to get from workflow + const applicationTypes = [ + { + code: "CREATE", + i18nKey: "CREATE", + }, + { + code: "UPDATE", + i18nKey: "UPDATE", + }, + { + code: "MUTATION", + i18nKey: "MUTATION", + }, + ]; + const applicationStatuses = [ + { + code: "ACTIVE", + i18nKey: "WF_PT_ACTIVE", + }, + { + code: "INACTIVE", + i18nKey: "WF_PT_INACTIVE", + }, + { + code: "INWORKFLOW", + i18nKey: "WF_PT_INWORKFLOW", + }, + ]; - const getaddress = (address) => { - let newaddr = `${address?.doorNo ? `${address?.doorNo}, ` : ""} ${address?.street ? `${address?.street}, ` : ""}${ - address?.landmark ? `${address?.landmark}, ` : "" - }${t(address?.locality.code)}, ${t(address?.city)},${t(address?.pincode) ? `${address.pincode}` : " "}` - return newaddr; - } - const GetCell = (value) => {value}; - const columns = useMemo( () => ([ - { - Header: t("PT_SEARCHPROPERTY_TABEL_PID"), - disableSortBy: true, - accessor: (row) => GetCell(row.propertyId || ""), + const getaddress = (address) => { + let newaddr = `${address?.doorNo ? `${address?.doorNo}, ` : ""} ${address?.street ? `${address?.street}, ` : ""}${ + address?.landmark ? `${address?.landmark}, ` : "" + }${t(address?.locality.code)}, ${t(address?.city)},${t(address?.pincode) ? `${address.pincode}` : " "}`; + return newaddr; + }; + const GetCell = (value) => {value}; + const columns = useMemo( + () => [ + { + Header: t("PT_SEARCHPROPERTY_TABEL_PID"), + disableSortBy: true, + accessor: (row) => GetCell(row.propertyId || ""), + }, + { + Header: t("PT_APPLICATION_NO_LABEL"), + accessor: "acknowldgementNumber", + disableSortBy: true, + Cell: ({ row }) => { + return ( +
+ + + {row.original["acknowldgementNumber"]} + + +
+ ); }, - { - Header: t("PT_APPLICATION_NO_LABEL"), - accessor: "acknowldgementNumber", - disableSortBy: true, - Cell: ({ row }) => { - return ( -
- - - {row.original["acknowldgementNumber"]} - - -
- ); - }, - }, - { - Header: t("PT_SEARCHPROPERTY_TABEL_APPLICATIONTYPE"), - disableSortBy: true, - accessor: (row) => GetCell(row.creationReason || ""), - }, - { - Header: t("PT_COMMON_TABLE_COL_OWNER_NAME"), - accessor: (row) => GetCell(row.owners.map( o => o.name ). join(",") || ""), - disableSortBy: true, - }, - { - Header: t("ES_SEARCH_PROPERTY_STATUS"), - accessor: (row) =>GetCell(t( row?.status &&`WF_PT_${row.status}`|| "NA") ), - disableSortBy: true, - }, - { - Header: t("PT_ADDRESS_LABEL"), - disableSortBy: true, - accessor: (row) => GetCell(getaddress(row.address) || ""), - }, - ]), [] ) + }, + { + Header: t("PT_SEARCHPROPERTY_TABEL_APPLICATIONTYPE"), + disableSortBy: true, + accessor: (row) => GetCell(row.creationReason || ""), + }, + { + Header: t("PT_COMMON_TABLE_COL_OWNER_NAME"), + accessor: (row) => GetCell(row.owners.map((o) => o.name).join(",") || ""), + disableSortBy: true, + }, + { + Header: t("ES_SEARCH_PROPERTY_STATUS"), + accessor: (row) => GetCell(t((row?.status && `WF_PT_${row.status}`) || "NA")), + disableSortBy: true, + }, + { + Header: t("PT_ADDRESS_LABEL"), + disableSortBy: true, + accessor: (row) => GetCell(getaddress(row.address) || ""), + }, + ], + [] + ); - const onSort = useCallback((args) => { - if (args.length === 0) return - setValue("sortBy", args.id) - setValue("sortOrder", args.desc ? "DESC" : "ASC") - }, []) + const onSort = useCallback((args) => { + if (args.length === 0) return; + setValue("sortBy", args.id); + setValue("sortOrder", args.desc ? "DESC" : "ASC"); + }, []); - function onPageSizeChange(e){ - setValue("limit",Number(e.target.value)) - handleSubmit(onSubmit)() - } + function onPageSizeChange(e) { + setValue("limit", Number(e.target.value)); + handleSubmit(onSubmit)(); + } - function nextPage () { - setValue("offset", getValues("offset") + getValues("limit")) - handleSubmit(onSubmit)() - } - function previousPage () { - setValue("offset", getValues("offset") - getValues("limit") ) - handleSubmit(onSubmit)() - } - let validation={} + function nextPage() { + setValue("offset", getValues("offset") + getValues("limit")); + handleSubmit(onSubmit)(); + } + function previousPage() { + setValue("offset", getValues("offset") - getValues("limit")); + handleSubmit(onSubmit)(); + } + let validation = {}; - return - {isMobile ? - - : -
-
{t("PT_SEARCH_PROP_APP")}
- < Card className={"card-search-heading"}> - {t("Provide at least one parameter to search for an application")} - - - - - - - - - - - - - + {isMobile ? ( + + ) : ( +
+
{t("PT_SEARCH_PROP_APP")}
+ + {t("Provide at least one parameter to search for an application")} + + + + + + + + + + + + + +91
} //maxlength={10} - /> - {formState?.errors?.["mobileNumber"]?.message} -
- - - ( - - )} - /> - - - - ( - - )} - /> - - - - } - name="fromDate" - control={control} - /> - - - - } - name="toDate" - control={control} - /> - - - -

{ - reset({ - acknowledgementIds: "", - fromDate: "", - toDate: "", - propertyIds: "", - mobileNumber:"", - status: "", - creationReason: "", - offset: 0, - limit: 10, - sortBy: "commencementDate", - sortOrder: "DESC" - }); - setShowToast(null); - previousPage(); - }}>{t(`ES_COMMON_CLEAR_ALL`)}

-
-
- {!isLoading && data?.display ? - { - t(data.display) - .split("\\n") - .map((text, index) => ( -

- {text} -

- )) - } + /> + {formState?.errors?.["mobileNumber"]?.message} + + + + ( + + )} + /> + + + + ( + + )} + /> + + + + } + name="fromDate" + control={control} + /> + + + + } + name="toDate" + control={control} + /> + + + +

{ + reset({ + acknowledgementIds: "", + fromDate: "", + toDate: "", + propertyIds: "", + mobileNumber: "", + status: "", + creationReason: "", + offset: 0, + limit: 10, + sortBy: "commencementDate", + sortOrder: "DESC", + }); + setShowToast(null); + previousPage(); + }} + > + {t(`ES_COMMON_CLEAR_ALL`)} +

+
+ + {!isLoading && data?.display ? ( + + {t(data.display) + .split("\\n") + .map((text, index) => ( +

+ {text} +

+ ))}
- :(!isLoading && data !== ""? { + ) : !isLoading && data !== "" ? ( +
{ return { - style: { + style: { minWidth: cellInfo.column.Header === t("ES_INBOX_APPLICATION_NO") ? "240px" : "", padding: "20px 18px", - fontSize: "16px" + fontSize: "16px", }, }; - }} - onPageSizeChange={onPageSizeChange} - currentPage={getValues("offset")/getValues("limit")} - onNextPage={nextPage} - onPrevPage={previousPage} - pageSizeLimit={getValues("limit")} - onSort={onSort} - disableSort={false} - sortParams={[{id: getValues("sortBy"), desc: getValues("sortOrder") === "DESC" ? true : false}]} - />: data !== "" || isLoading && )} - } - -} + }} + onPageSizeChange={onPageSizeChange} + currentPage={getValues("offset") / getValues("limit")} + onNextPage={nextPage} + onPrevPage={previousPage} + pageSizeLimit={getValues("limit")} + onSort={onSort} + disableSort={false} + sortParams={[{ id: getValues("sortBy"), desc: getValues("sortOrder") === "DESC" ? true : false }]} + /> + ) : ( + data !== "" || (isLoading && ) + )} + + )} + + ); +}; -export default PTSearchApplication \ No newline at end of file +export default PTSearchApplication; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/pt/src/components/empty-result.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/pt/src/components/empty-result.js index 0aef1ccd6..00514acb5 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/pt/src/components/empty-result.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/pt/src/components/empty-result.js @@ -8,7 +8,7 @@ const EmptyResultInbox = (props) => { const history = useHistory(); const addNewProprty = () => { - history.push("/digit-ui/employee/pt/new-application"); + history.push("/mgramseva-digit-ui/employee/pt/new-application"); }; return ( diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/pt/src/components/inbox/ApplicationCard.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/pt/src/components/inbox/ApplicationCard.js index 427df9bc1..500ca4ba5 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/pt/src/components/inbox/ApplicationCard.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/pt/src/components/inbox/ApplicationCard.js @@ -60,7 +60,9 @@ export const ApplicationCard = ({ ); } else if (data && data?.length > 0) { - result = ; + result = ( + + ); } return ( @@ -101,9 +103,7 @@ export const ApplicationCard = ({ )} {type === "SORT" && ( -
- {} -
+
{}
)} {type === "SEARCH" && (
diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/pt/src/components/inbox/ApplicationLinks.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/pt/src/components/inbox/ApplicationLinks.js index 3b2ed95a6..e9dc5fe31 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/pt/src/components/inbox/ApplicationLinks.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/pt/src/components/inbox/ApplicationLinks.js @@ -3,13 +3,13 @@ import React, { useEffect, useState } from "react"; import { useTranslation } from "react-i18next"; import { Link } from "react-router-dom"; -const ApplicationLinks = ({ linkPrefix, classNameForMobileView="" }) => { +const ApplicationLinks = ({ linkPrefix, classNameForMobileView = "" }) => { const { t } = useTranslation(); const allLinks = [ { text: t("ES_TITLE_NEW_REGISTRATION"), - link: "/digit-ui/employee/pt/new-application", + link: "/mgramseva-digit-ui/employee/pt/new-application", }, { text: t("ES_TITILE_SEARCH_APPLICATION"), diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/pt/src/components/inbox/InboxLink.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/pt/src/components/inbox/InboxLink.js index 5b7d2c477..c00073015 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/pt/src/components/inbox/InboxLink.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/pt/src/components/inbox/InboxLink.js @@ -9,24 +9,24 @@ const InboxLinks = ({ parentRoute, businessService }) => { const allLinks = [ { text: "ES_TITLE_NEW_REGISTRATION", - link: "/digit-ui/employee/pt/new-application", + link: "/mgramseva-digit-ui/employee/pt/new-application", businessService: "PT", roles: ["PT_CEMP"], }, { text: "PT_SEARCH_PROPERTY", - link: `/digit-ui/employee/pt/search`, + link: `/mgramseva-digit-ui/employee/pt/search`, businessService: "PT", roles: [], }, { text: "ES_COMMON_APPLICATION_SEARCH", - link: `/digit-ui/employee/pt/application-search`, + link: `/mgramseva-digit-ui/employee/pt/application-search`, businessService: "PT", roles: [], }, - // { text: "PT_REPORTS", hyperLink: true, link: "/digit-ui/employee/integration/dss/propertytax", roles: [], businessService: "PT" }, - // { text: "PT_DASHBOARD", link: "/digit-ui/employee/", roles: [], businessService: "PT" }, + // { text: "PT_REPORTS", hyperLink: true, link: "/mgramseva-digit-ui/employee/integration/dss/propertytax", roles: [], businessService: "PT" }, + // { text: "PT_DASHBOARD", link: "/mgramseva-digit-ui/employee/", roles: [], businessService: "PT" }, ]; const [links, setLinks] = useState([]); diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/pt/src/components/search/PropertySearchResults.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/pt/src/components/search/PropertySearchResults.js index d221b18b1..1a104a76d 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/pt/src/components/search/PropertySearchResults.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/pt/src/components/search/PropertySearchResults.js @@ -5,9 +5,9 @@ import PropertyInvalidMobileNumber from "../../pages/citizen/MyProperties/Proper const GetCell = (value) => {value}; -const SearchPTID = ({ tenantId, t, payload, showToast, setShowToast,ptSearchConfig }) => { +const SearchPTID = ({ tenantId, t, payload, showToast, setShowToast, ptSearchConfig }) => { const history = useHistory(); - + const [searchQuery, setSearchQuery] = useState({ /* ...defaultValues, to enable pagination */ ...payload, @@ -17,7 +17,7 @@ const SearchPTID = ({ tenantId, t, payload, showToast, setShowToast,ptSearchConf const [selectedProperty, setSelectedProperty] = useState(null); const [ownerInvalidMobileNumberIndex, setOwnerInvalidMobileNumberIndex] = useState(0); - const { data, isLoading, error, isSuccess, billData ,revalidate} = Digit.Hooks.pt.usePropertySearchWithDue({ + const { data, isLoading, error, isSuccess, billData, revalidate } = Digit.Hooks.pt.usePropertySearchWithDue({ tenantId, filters: searchQuery, configs: { enabled: Object.keys(payload).length > 0 ? true : false, retry: false, retryOnMount: false, staleTime: Infinity }, @@ -35,35 +35,32 @@ const SearchPTID = ({ tenantId, t, payload, showToast, setShowToast,ptSearchConf }); const handleCollectTaxClick = (val) => { - let isAtleastOneMobileNumberInvalid = false + let isAtleastOneMobileNumberInvalid = false; let { owners } = val; - owners = owners && owners.filter(owner => owner.status == "ACTIVE"); - owners && owners.map((owner, index) => { - let number = owner.mobileNumber; - - if ( - ( - (number == updateNumberConfig?.invalidNumber) - || !number.match(updateNumberConfig?.invalidPattern) - && number == JSON.parse(getUserInfo()).mobileNumber - ) + owners = owners && owners.filter((owner) => owner.status == "ACTIVE"); + owners && + owners.map((owner, index) => { + let number = owner.mobileNumber; + + if ( + number == updateNumberConfig?.invalidNumber || + (!number.match(updateNumberConfig?.invalidPattern) && number == JSON.parse(getUserInfo()).mobileNumber) ) { - isAtleastOneMobileNumberInvalid = true; - setOwnerInvalidMobileNumberIndex(index); - } - }) + isAtleastOneMobileNumberInvalid = true; + setOwnerInvalidMobileNumberIndex(index); + } + }); - if(isAtleastOneMobileNumberInvalid) { + if (isAtleastOneMobileNumberInvalid) { setShowModal(true); setSelectedProperty(val); } else { revalidate(); - history.push(`/digit-ui/employee/payment/collect/PT/${val?.["propertyId"]}`) + history.push(`/mgramseva-digit-ui/employee/payment/collect/PT/${val?.["propertyId"]}`); } - - } + }; const Close = () => ( @@ -81,8 +78,8 @@ const SearchPTID = ({ tenantId, t, payload, showToast, setShowToast,ptSearchConf }; const skipNContinue = () => { - history.push(`/digit-ui/employee/payment/collect/PT/${selectedProperty?.['propertyId']}`) - } + history.push(`/mgramseva-digit-ui/employee/payment/collect/PT/${selectedProperty?.["propertyId"]}`); + }; const updateMobileNumber = () => { const ind = ownerInvalidMobileNumberIndex; @@ -93,7 +90,7 @@ const SearchPTID = ({ tenantId, t, payload, showToast, setShowToast,ptSearchConf mobileNumber: selectedProperty?.owners[ind]?.mobileNumber, index: ind, }); - } + }; const columns = useMemo( () => [ @@ -104,7 +101,9 @@ const SearchPTID = ({ tenantId, t, payload, showToast, setShowToast,ptSearchConf return (
- {row.original["propertyId"]} + + {row.original["propertyId"]} +
); @@ -127,7 +126,7 @@ const SearchPTID = ({ tenantId, t, payload, showToast, setShowToast,ptSearchConf }, { Header: t("PT_AMOUNT_DUE"), - Cell: ({ row }) => GetCell(row?.original?.due?`₹ ${row?.original?.due}`:t("PT_NA")), + Cell: ({ row }) => GetCell(row?.original?.due ? `₹ ${row?.original?.due}` : t("PT_NA")), disableSortBy: true, }, { @@ -137,8 +136,10 @@ const SearchPTID = ({ tenantId, t, payload, showToast, setShowToast,ptSearchConf return (
{row.original?.due > 0 && Digit.Utils.didEmployeeHasRole("PT_CEMP") ? ( - - handleCollectTaxClick(row.original)}>{t("ES_PT_COLLECT_TAX")} + + handleCollectTaxClick(row.original)}> + {t("ES_PT_COLLECT_TAX")} + ) : null}
@@ -163,15 +164,15 @@ const SearchPTID = ({ tenantId, t, payload, showToast, setShowToast,ptSearchConf return tableData?.map((dataObj) => { const obj = {}; columns.forEach((el) => { - if (el.Cell) obj[el.Header] = el.Cell({row:{original:dataObj}}); + if (el.Cell) obj[el.Header] = el.Cell({ row: { original: dataObj } }); }); return obj; }); }; const tableData = Object.values(data?.FormattedData || {}) || []; - if(ptSearchConfig?.ptSearchCount&&payload.locality&&tableData&&tableData.length>ptSearchConfig.ptSearchCount){ - !showToast &&setShowToast({ error: true, label: "PT_MODIFY_SEARCH_CRITERIA" }); + if (ptSearchConfig?.ptSearchCount && payload.locality && tableData && tableData.length > ptSearchConfig.ptSearchCount) { + !showToast && setShowToast({ error: true, label: "PT_MODIFY_SEARCH_CRITERIA" }); return null; } return ( @@ -223,7 +224,7 @@ const SearchPTID = ({ tenantId, t, payload, showToast, setShowToast,ptSearchConf t={t} onValidation={(data, showToast) => { let newProp = { ...selectedProperty }; - newProp.owners[showUpdateNo?.index].mobileNumber = data.mobileNumber; + newProp.owners[showUpdateNo?.index].mobileNumber = data.mobileNumber; newProp.creationReason = "UPDATE"; newProp.workflow = null; let newDocObj = { ...data }; @@ -253,10 +254,16 @@ const SearchPTID = ({ tenantId, t, payload, showToast, setShowToast,ptSearchConf }} /> )} - {!showUpdateNo && } + {!showUpdateNo && ( + + )} ) : null} - ); }; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/pt/src/config/inbox-table-config.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/pt/src/config/inbox-table-config.js index 9042cebdf..c9eb1fbdc 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/pt/src/config/inbox-table-config.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/pt/src/config/inbox-table-config.js @@ -76,7 +76,9 @@ export const TableConfig = (t) => ({
{row.original?.searchData?.due_tax > 0 && Digit.Utils.didEmployeeHasRole("PT_CEMP") ? ( - {t("ES_PT_COLLECT_TAX")} + + {t("ES_PT_COLLECT_TAX")} + ) : null}
diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/pt/src/pages/Response.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/pt/src/pages/Response.js index 5d4ea392d..667233944 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/pt/src/pages/Response.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/pt/src/pages/Response.js @@ -97,13 +97,13 @@ const Response = (props) => { const { Properties = [] } = mutation.data || successData; const Property = (Properties && Properties[0]) || {}; const tenantInfo = tenants.find((tenant) => tenant.code === Property.tenantId); - + let tenantId = Property.tenantId || tenantId; const propertyDetails = await Digit.PTService.search({ tenantId, filters: { propertyIds: Property?.propertyId, status: "INACTIVE" } }); Property.transferorDetails = propertyDetails?.Properties?.[0] || []; Property.isTransferor = true; - Property.transferorOwnershipCategory = propertyDetails?.Properties?.[0]?.ownershipCategory - + Property.transferorOwnershipCategory = propertyDetails?.Properties?.[0]?.ownershipCategory; + const data = await getPTAcknowledgementData({ ...Property, auditData }, tenantInfo, t); Digit.Utils.pdf.generate(data); }; @@ -132,7 +132,7 @@ const Response = (props) => { {showToast && } - + diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/pt/src/pages/employee/ApplicationDetails.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/pt/src/pages/employee/ApplicationDetails.js index 44d7d7aac..c91d0bf72 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/pt/src/pages/employee/ApplicationDetails.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/pt/src/pages/employee/ApplicationDetails.js @@ -9,7 +9,6 @@ import TransfererDetails from "../../pageComponents/Mutate/TransfererDetails"; import MutationApplicationDetails from "./MutationApplicatinDetails"; import getPTAcknowledgementData from "../../getPTAcknowledgementData"; - const ApplicationDetails = () => { const { t } = useTranslation(); const { data: storeData } = Digit.Hooks.useStore.getInitData(); @@ -21,7 +20,7 @@ const ApplicationDetails = () => { const [showOptions, setShowOptions] = useState(false); const [enableAudit, setEnableAudit] = useState(false); const [businessService, setBusinessService] = useState("PT.CREATE"); - sessionStorage.setItem("applicationNoinAppDetails",propertyId); + sessionStorage.setItem("applicationNoinAppDetails", propertyId); const { isLoading, isError, data: applicationDetails, error } = Digit.Hooks.pt.useApplicationDetail(t, tenantId, propertyId); @@ -64,7 +63,7 @@ const ApplicationDetails = () => { }); setAppDetailsToShow({ ...appDetailsToShow, applicationDetails }); } - },[setAppDetailsToShow,appDetailsToShow,auditData,applicationDetails,auditData,newConfigMutate]); + }, [setAppDetailsToShow, appDetailsToShow, auditData, applicationDetails, auditData, newConfigMutate]); const closeToast = () => { setShowToast(null); @@ -81,13 +80,16 @@ const ApplicationDetails = () => { useEffect(() => { showTransfererDetails(); - if (appDetailsToShow?.applicationData?.status === "ACTIVE" && PT_CEMP&&businessService=="PT.CREATE") { - setBusinessService("PT.UPDATE"); - } + if (appDetailsToShow?.applicationData?.status === "ACTIVE" && PT_CEMP && businessService == "PT.CREATE") { + setBusinessService("PT.UPDATE"); + } }, [auditData, applicationDetails, appDetailsToShow]); useEffect(() => { - if (workflowDetails?.data?.applicationBusinessService && !(workflowDetails?.data?.applicationBusinessService === "PT.CREATE" && businessService === "PT.UPDATE")) { + if ( + workflowDetails?.data?.applicationBusinessService && + !(workflowDetails?.data?.applicationBusinessService === "PT.CREATE" && businessService === "PT.UPDATE") + ) { setBusinessService(workflowDetails?.data?.applicationBusinessService); } }, [workflowDetails.data]); @@ -104,7 +106,7 @@ const ApplicationDetails = () => { { action: "VIEW_DETAILS", redirectionUrl: { - pathname: `/digit-ui/employee/pt/property-details/${propertyId}`, + pathname: `/mgramseva-digit-ui/employee/pt/property-details/${propertyId}`, }, tenantId: Digit.ULBService.getStateId(), }, @@ -123,7 +125,7 @@ const ApplicationDetails = () => { workflowDetails?.data?.actionState?.nextActions.push({ action: "UPDATE", redirectionUrl: { - pathname: `/digit-ui/employee/pt/modify-application/${propertyId}`, + pathname: `/mgramseva-digit-ui/employee/pt/modify-application/${propertyId}`, state: { workflow: { action: "REOPEN", moduleName: "PT", businessService } }, }, tenantId: Digit.ULBService.getStateId(), @@ -150,7 +152,9 @@ const ApplicationDetails = () => { return { action: "PAY", forcedName: "WF_EMPLOYEE_PT.MUTATION_PAY", - redirectionUrl: { pathname: `/digit-ui/employee/payment/collect/PT.MUTATION/${appDetailsToShow?.applicationData?.acknowldgementNumber}` }, + redirectionUrl: { + pathname: `/mgramseva-digit-ui/employee/payment/collect/PT.MUTATION/${appDetailsToShow?.applicationData?.acknowldgementNumber}`, + }, }; } return act; @@ -173,8 +177,8 @@ const ApplicationDetails = () => { ]; } const handleDownloadPdf = async () => { - const Property = appDetailsToShow?.applicationData ; - const tenantInfo = tenants.find((tenant) => tenant.code === Property.tenantId); + const Property = appDetailsToShow?.applicationData; + const tenantInfo = tenants.find((tenant) => tenant.code === Property.tenantId); const data = await getPTAcknowledgementData(Property, tenantInfo, t); Digit.Utils.pdf.generate(data); @@ -187,33 +191,33 @@ const ApplicationDetails = () => { }; let dowloadOptions = [propertyDetailsPDF]; - if (applicationDetails?.applicationData?.creationReason === "MUTATION"){ - return( - - ) - } + if (applicationDetails?.applicationData?.creationReason === "MUTATION") { + return ( + + ); + } return (
-
-
{t("PT_APPLICATION_TITLE")}
- {dowloadOptions && dowloadOptions.length > 0 && ( - setShowOptions(!showOptions)} - displayOptions={showOptions} - options={dowloadOptions} - downloadBtnClassName={"employee-download-btn-className"} - optionsClassName={"employee-options-btn-className"} - // ref={menuRef} - /> - )} -
+
+
{t("PT_APPLICATION_TITLE")}
+ {dowloadOptions && dowloadOptions.length > 0 && ( + setShowOptions(!showOptions)} + displayOptions={showOptions} + options={dowloadOptions} + downloadBtnClassName={"employee-download-btn-className"} + optionsClassName={"employee-options-btn-className"} + // ref={menuRef} + /> + )} +
{ statusAttribute={"state"} MenuStyle={{ color: "#FFFFFF", fontSize: "18px" }} /> -
); }; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/pt/src/pages/employee/AssessmentDetails.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/pt/src/pages/employee/AssessmentDetails.js index 4409e1d61..11d3a818e 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/pt/src/pages/employee/AssessmentDetails.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/pt/src/pages/employee/AssessmentDetails.js @@ -1,14 +1,25 @@ -import React, { useEffect, useState,useRef } from "react"; +import React, { useEffect, useState, useRef } from "react"; import { useTranslation } from "react-i18next"; import ApplicationDetailsTemplate from "../../../../templates/ApplicationDetails"; import { useParams, useLocation, useHistory } from "react-router-dom"; -import { ActionBar, Header, Loader, SubmitBar,Card,CardSubHeader,CardSectionHeader,LinkLabel, CardLabel, CardHeader, CardText} from "@egovernments/digit-ui-react-components"; +import { + ActionBar, + Header, + Loader, + SubmitBar, + Card, + CardSubHeader, + CardSectionHeader, + LinkLabel, + CardLabel, + CardHeader, + CardText, +} from "@egovernments/digit-ui-react-components"; import { useQueryClient } from "react-query"; import _, { first, update } from "lodash"; -import { Modal,Dropdown, Row, StatusTable } from "@egovernments/digit-ui-react-components"; -import {convertEpochToDate} from "../../utils/index"; - +import { Modal, Dropdown, Row, StatusTable } from "@egovernments/digit-ui-react-components"; +import { convertEpochToDate } from "../../utils/index"; const AssessmentDetails = () => { const { t } = useTranslation(); @@ -22,22 +33,21 @@ const AssessmentDetails = () => { const history = useHistory(); const [appDetailsToShow, setAppDetailsToShow] = useState({}); const isMobile = window.Digit.Utils.browser.isMobile(); - - const [popup,showPopUp]=useState(false); - const [selectedPenalityReason,setSelectedPenalityReason]=useState(null); - const [selectedRebateReason,setSelectedRebateReason]=useState(null); + const [popup, showPopUp] = useState(false); + const [selectedPenalityReason, setSelectedPenalityReason] = useState(null); + const [selectedRebateReason, setSelectedRebateReason] = useState(null); + + const first_temp = useRef(); + const second_temp = useRef(); + const third_temp = useRef(); + const fourth_temp = useRef(); - const first_temp=useRef(); - const second_temp=useRef(); - const third_temp=useRef(); - const fourth_temp=useRef(); - const getPropertyTypeLocale = (value) => { return `PROPERTYTAX_BILLING_SLAB_${value?.split(".")[0]}`; }; - - const getPropertySubtypeLocale = (value) => `PROPERTYTAX_BILLING_SLAB_${value}`; + + const getPropertySubtypeLocale = (value) => `PROPERTYTAX_BILLING_SLAB_${value}`; let { isLoading, isError, data: applicationDetails, error } = Digit.Hooks.pt.useApplicationDetail(t, tenantId, propertyId); const { isLoading: assessmentLoading, mutate: assessmentMutate } = Digit.Hooks.pt.usePropertyAssessment(tenantId); @@ -47,11 +57,10 @@ const AssessmentDetails = () => { mutate: ptCalculationEstimateMutate, } = Digit.Hooks.pt.usePtCalculationEstimate(tenantId); const { data: ChargeSlabsMenu, isLoading: isChargeSlabsLoading } = Digit.Hooks.pt.usePropertyMDMS(stateId, "PropertyTax", "ChargeSlabs"); - const fetchBillParams = { consumerCode : propertyId }; + const fetchBillParams = { consumerCode: propertyId }; - let ptCalculationEstimateDataCopy; - if(!ptCalculationEstimateDataCopy ) - ptCalculationEstimateDataCopy = ptCalculationEstimateData?.Calculation[0]; + let ptCalculationEstimateDataCopy; + if (!ptCalculationEstimateDataCopy) ptCalculationEstimateDataCopy = ptCalculationEstimateData?.Calculation[0]; const paymentDetails = Digit.Hooks.useFetchBillsForBuissnessService( { businessService: "PT", ...fetchBillParams, tenantId: tenantId }, @@ -63,7 +72,7 @@ const AssessmentDetails = () => { useEffect(() => { // estimate calculation ptCalculationEstimateMutate({ Assessment: AssessmentData }); - }, []); + }, []); useEffect(() => { if (applicationDetails) setAppDetailsToShow(_.cloneDeep(applicationDetails)); }, [applicationDetails]); @@ -75,15 +84,15 @@ const AssessmentDetails = () => { role: "PT_CEMP", // serviceData: applicationDetails, }); - const date=new Date(); + const date = new Date(); appDetailsToShow?.applicationDetails?.shift(); appDetailsToShow?.applicationDetails?.unshift({ title: "PT_ESTIMATE_DETAILS_HEADER", - values: [ + values: [ { title: "PT_PROPERTY_PTUID", - value: propertyId, + value: propertyId, }, { title: "ES_PT_TITLE_BILLING_PERIOD", @@ -93,9 +102,8 @@ const AssessmentDetails = () => { additionalDetails: { taxHeadEstimatesCalculation: ptCalculationEstimateData?.Calculation[0], }, - } - ); - + }); + const closeToast = () => { setShowToast(null); }; @@ -103,10 +111,14 @@ const AssessmentDetails = () => { const handleAssessment = () => { if (!queryClient.getQueryData(["PT_ASSESSMENT", propertyId, location?.state?.Assessment?.financialYear])) { assessmentMutate( - { Assessment:AssessmentData}, + { Assessment: AssessmentData }, { onError: (error, variables) => { - setShowToast({ key: "error", action: error?.response?.data?.Errors[0]?.message || error.message, error : { message:error?.response?.data?.Errors[0]?.code || error.message } }); + setShowToast({ + key: "error", + action: error?.response?.data?.Errors[0]?.message || error.message, + error: { message: error?.response?.data?.Errors[0]?.code || error.message }, + }); setTimeout(closeToast, 5000); }, onSuccess: (data, variables) => { @@ -115,7 +127,7 @@ const AssessmentDetails = () => { setTimeout(closeToast, 5000); // queryClient.clear(); // queryClient.setQueryData(["PT_ASSESSMENT", propertyId, location?.state?.Assessment?.financialYear], true); - history.push(`/digit-ui/employee/payment/collect/PT/${propertyId}`); + history.push(`/mgramseva-digit-ui/employee/payment/collect/PT/${propertyId}`); }, } ); @@ -123,171 +135,162 @@ const AssessmentDetails = () => { }; const proceeedToPay = () => { - history.push(`/digit-ui/employee/payment/collect/PT/${propertyId}`); + history.push(`/mgramseva-digit-ui/employee/payment/collect/PT/${propertyId}`); }; - if (ptCalculationEstimateLoading || assessmentLoading||!applicationDetails?.applicationDetails) { + if (ptCalculationEstimateLoading || assessmentLoading || !applicationDetails?.applicationDetails) { return ; } + let address_to_display = applicationDetails?.applicationData?.address; + if (address_to_display?.doorNo) { + address_to_display = address_to_display?.doorNo + "," + address_to_display?.locality?.area + "," + address_to_display?.city; + } else { + address_to_display = address_to_display?.locality?.area + "," + address_to_display?.city; + } -let address_to_display=applicationDetails?.applicationData?.address; -if(address_to_display?.doorNo){ - address_to_display=address_to_display?.doorNo+','+address_to_display?.locality?.area+','+address_to_display?.city; -} -else{ - address_to_display=address_to_display?.locality?.area+','+address_to_display?.city; -} - - -const Heading = (props) => { - return

{props.label}

; -}; - -const Close = () => ( - - - - -); + const Heading = (props) => { + return

{props.label}

; + }; -const CloseBtn = (props) => { - return ( -
- -
+ const Close = () => ( + + + + ); -}; -function change(){ - var total_amount=ptCalculationEstimateData?.Calculation[0]?.totalAmount - const [first,second]=[parseInt(first_temp.current.value),parseInt(second_temp.current.value)]; - if((selectedPenalityReason && first>0)/* &&(!selectedRebateReason) */){ - if(selectPenalityReason.value!=='Others'){ - if(first0){ - if(second { + return ( +
+ +
+ ); + }; + function change() { + var total_amount = ptCalculationEstimateData?.Calculation[0]?.totalAmount; + const [first, second] = [parseInt(first_temp.current.value), parseInt(second_temp.current.value)]; + if (selectedPenalityReason && first > 0 /* &&(!selectedRebateReason) */) { + if (selectPenalityReason.value !== "Others") { + if (first < total_amount) { + var additionalPenality = first; + ptCalculationEstimateData.Calculation[0].taxHeadEstimates[6] = { + taxHeadCode: "PT_TIME_PENALTY", + estimateAmount: ptCalculationEstimateData.Calculation[0].taxHeadEstimates[6]?.estimateAmount + first, + category: "TAX", + }; + AssessmentData.additionalDetails = { + adhocPenalty: additionalPenality, + adhocPenaltyReason: selectedPenalityReason.value, + }; + ptCalculationEstimateData.Calculation[0].totalAmount = ptCalculationEstimateData?.Calculation[0]?.totalAmount + first; + } else { + alert("Penality cannot exceed total amount"); } - AssessmentData.additionalDetails={ - "adhocExemption":second, - "adhocExemptionReason":selectedRebateReason.value, + } else { + if (first < total_amount) { + var additionalPenality = first; + ptCalculationEstimateData.Calculation[0].taxHeadEstimates[6] = { + taxHeadCode: "PT_TIME_PENALTY", + estimateAmount: ptCalculationEstimateData.Calculation[0].taxHeadEstimates[6]?.estimateAmount + first, + category: "TAX", + }; + AssessmentData.additionalDetails = { + adhocPenalty: additionalPenality, + adhocPenaltyReason: fourth_temp.current.value, + }; + ptCalculationEstimateData.Calculation[0].totalAmount = ptCalculationEstimateData?.Calculation[0]?.totalAmount + first; + } else { + alert("Penality cannot exceed total amount"); } - ptCalculationEstimateData.Calculation[0].totalAmount=ptCalculationEstimateData?.Calculation[0]?.totalAmount-second; - } - else{ - alert( "Adhoc Exemption cannot be greater than the estimated tax for the given property"); - } } } - else{ - if(second>0){ - if(second 0) { + if (second < total_amount) { + ptCalculationEstimateData.Calculation[0].taxHeadEstimates[5] = { + taxHeadCode: "PT_TIME_REBATE", + estimateAmount: ptCalculationEstimateData.Calculation[0].taxHeadEstimates[5]?.estimateAmount + second, + category: "TAX", + }; + AssessmentData.additionalDetails = { + adhocExemption: second, + adhocExemptionReason: selectedRebateReason.value, + }; + ptCalculationEstimateData.Calculation[0].totalAmount = ptCalculationEstimateData?.Calculation[0]?.totalAmount - second; + } else { + alert("Adhoc Exemption cannot be greater than the estimated tax for the given property"); + } } - AssessmentData.additionalDetails={ - "adhocExemption":second, - "adhocExemptionReason":third_temp.current.value, + } else { + if (second > 0) { + if (second < total_amount) { + ptCalculationEstimateData.Calculation[0].taxHeadEstimates[5] = { + taxHeadCode: "PT_TIME_REBATE", + estimateAmount: ptCalculationEstimateData.Calculation[0].taxHeadEstimates[5]?.estimateAmount - second, + category: "TAX", + }; + AssessmentData.additionalDetails = { + adhocExemption: second, + adhocExemptionReason: third_temp.current.value, + }; + ptCalculationEstimateData.Calculation[0].totalAmount = ptCalculationEstimateData?.Calculation[0]?.totalAmount - second; + } else { + alert("Adhoc Exemption cannot be greater than the estimated tax for the given property"); + } } - ptCalculationEstimateData.Calculation[0].totalAmount=ptCalculationEstimateData?.Calculation[0]?.totalAmount-second; - } - else{ - alert( "Adhoc Exemption cannot be greater than the estimated tax for the given property"); - } } } + setSelectedPenalityReason(null); + setSelectedRebateReason(null); + showPopUp(false); } - setSelectedPenalityReason(null); - setSelectedRebateReason(null); - showPopUp(false); -} -const Penality_menu=[ - { - title:"PT_PENDING_DUES_FROM_EARLIER", - value:"Pending dues from earlier", - }, - { - title:"PT_MISCALCULATION_OF_EARLIER_ASSESSMENT", - value:"Miscalculation of earlier Assessment", - }, - { - title:"PT_ONE_TIME_PENALITY", - value:"One time penality", - }, - { - title:"PT_OTHERS", - value:"Others", - }, - ] - const Rebate_menu=[ + const Penality_menu = [ + { + title: "PT_PENDING_DUES_FROM_EARLIER", + value: "Pending dues from earlier", + }, + { + title: "PT_MISCALCULATION_OF_EARLIER_ASSESSMENT", + value: "Miscalculation of earlier Assessment", + }, + { + title: "PT_ONE_TIME_PENALITY", + value: "One time penality", + }, + { + title: "PT_OTHERS", + value: "Others", + }, + ]; + const Rebate_menu = [ { - title:"PT_ADVANCED_PAID_BY_CITIZEN_EARLIER", - value:"Advanced Paid By Citizen Earlier", + title: "PT_ADVANCED_PAID_BY_CITIZEN_EARLIER", + value: "Advanced Paid By Citizen Earlier", }, { - title:"PT_REBATE_PROVIDED_BY_COMMISSIONER_EO", - value:"Rebate provided by commissioner/EO", + title: "PT_REBATE_PROVIDED_BY_COMMISSIONER_EO", + value: "Rebate provided by commissioner/EO", }, { - title:"PT_ADDITIONAL_AMOUNT_CHARGED_FROM_THE_CITIZEN", - value:"Additional amount charged from the citizen", + title: "PT_ADDITIONAL_AMOUNT_CHARGED_FROM_THE_CITIZEN", + value: "Additional amount charged from the citizen", }, { - title:"PT_OTHERS", - value:"Others", + title: "PT_OTHERS", + value: "Others", }, - ] - const selectPenalityReason=(reason)=>{ + ]; + const selectPenalityReason = (reason) => { setSelectedPenalityReason(reason); - } - const selectRebateReason=(reason)=>{ + }; + const selectRebateReason = (reason) => { setSelectedRebateReason(reason); - } -/* const RebatePenalityPoPup=() =>{ + }; + /* const RebatePenalityPoPup=() =>{ return ( } @@ -380,15 +383,14 @@ const Penality_menu=[
{t("PT_TX_ASSESSMENT")}
{showPopUp(true)}} style={isMobile ? {color:"#F47738",marginLeft:"0px"} : {color:"#F47738"}}>{t("PT_ADD_REBATE_PENALITY")} - }, - { - title: "PT_ASSESMENT_INFO_SUB_HEADER", - values: [ - { title: "PT_ASSESMENT_INFO_TYPE_OF_BUILDING", value: getPropertyTypeLocale(applicationDetails?.applicationData?.propertyType) }, - { title: "PT_ASSESMENT_INFO_USAGE_TYPE", value: getPropertySubtypeLocale(applicationDetails?.applicationData?.usageCategory) }, - { title: "PT_ASSESMENT_INFO_PLOT_SIZE", value: applicationDetails?.applicationData?.landArea }, - { title: "PT_ASSESMENT_INFO_NO_OF_FLOOR", value: applicationDetails?.applicationData?.noOfFloors }, - ], - additionalDetails: { - floors: applicationDetails?.applicationData?.units - ?.filter((e) => e.active) - ?.sort?.((a, b) => a.floorNo - b.floorNo) - ?.map((unit, index) => { - let floorName = `PROPERTYTAX_FLOOR_${unit.floorNo}`; - const values = [ - { - title: `${t("ES_APPLICATION_DETAILS_UNIT")} ${index + 1}`, - value: "", - }, - { - title: "Floor No", - value: unit?.floorNo, - }, - { - title: "PT_ASSESSMENT_UNIT_USAGE_TYPE", - value: `PROPERTYTAX_BILLING_SLAB_${ - unit?.usageCategory != "RESIDENTIAL" ? unit?.usageCategory?.split(".")[1] : unit?.usageCategory - }`, - }, - { - title: "PT_ASSESMENT_INFO_OCCUPLANCY", - value: unit?.occupancyType, - }, + }, + { + belowComponent: () => ( + { + showPopUp(true); + }} + style={isMobile ? { color: "#F47738", marginLeft: "0px" } : { color: "#F47738" }} + > + {t("PT_ADD_REBATE_PENALITY")} + + ), + }, + { + title: "PT_ASSESMENT_INFO_SUB_HEADER", + values: [ + { title: "PT_ASSESMENT_INFO_TYPE_OF_BUILDING", value: getPropertyTypeLocale(applicationDetails?.applicationData?.propertyType) }, + { title: "PT_ASSESMENT_INFO_USAGE_TYPE", value: getPropertySubtypeLocale(applicationDetails?.applicationData?.usageCategory) }, + { title: "PT_ASSESMENT_INFO_PLOT_SIZE", value: applicationDetails?.applicationData?.landArea }, + { title: "PT_ASSESMENT_INFO_NO_OF_FLOOR", value: applicationDetails?.applicationData?.noOfFloors }, + ], + additionalDetails: { + floors: applicationDetails?.applicationData?.units + ?.filter((e) => e.active) + ?.sort?.((a, b) => a.floorNo - b.floorNo) + ?.map((unit, index) => { + let floorName = `PROPERTYTAX_FLOOR_${unit.floorNo}`; + const values = [ + { + title: `${t("ES_APPLICATION_DETAILS_UNIT")} ${index + 1}`, + value: "", + }, + { + title: "Floor No", + value: unit?.floorNo, + }, + { + title: "PT_ASSESSMENT_UNIT_USAGE_TYPE", + value: `PROPERTYTAX_BILLING_SLAB_${ + unit?.usageCategory != "RESIDENTIAL" ? unit?.usageCategory?.split(".")[1] : unit?.usageCategory + }`, + }, + { + title: "PT_ASSESMENT_INFO_OCCUPLANCY", + value: unit?.occupancyType, + }, + { + title: "PT_FORM2_BUILT_AREA", + value: unit?.constructionDetail?.builtUpArea, + }, + ]; + + if (unit.occupancyType === "RENTED") values.push({ title: "PT_FORM2_TOTAL_ANNUAL_RENT", value: unit.arv }); + + return { + //title: floorName, + title: "", + values: [ { - title: "PT_FORM2_BUILT_AREA", - value: unit?.constructionDetail?.builtUpArea, + title: "", + values, }, - ]; - - if (unit.occupancyType === "RENTED") values.push({ title: "PT_FORM2_TOTAL_ANNUAL_RENT", value: unit.arv }); - - return { - //title: floorName, - title:"", - values: [ - { - title: "", - values, - }, - ], - }; - }), - }, + ], + }; + }), }, + }, { - belowComponent:()=>{ + belowComponent: () => { return ( -
- - {t("PT_CALC_DETAILS")}
-
- {t("PT_CALC_LOGIC_HEADER")} - {t("PT_CALC_LOGIC")} +
+ + {t("PT_CALC_DETAILS")} +
+
+ + {t("PT_CALC_LOGIC_HEADER")} + + {t("PT_CALC_LOGIC")} {/*
*/}
-

{t("PT_APPLICABLE_CHARGE_SLABS")}

- {/*

{t("PT_GRND_FLOOR_UNIT-1")}

+
+

{t("PT_APPLICABLE_CHARGE_SLABS")}

+
+ {/*

{t("PT_GRND_FLOOR_UNIT-1")}

{t("PT_RATE")}
*/} - - {applicationDetails?.applicationData?.units - ?.filter((e) => e.active) - ?.sort?.((a, b) => a.floorNo - b.floorNo) - ?.map((unit, index) => ( - ob.floorNo == unit.floorNo)?.[0]?.name} /> - ))} - -
+ + {applicationDetails?.applicationData?.units + ?.filter((e) => e.active) + ?.sort?.((a, b) => a.floorNo - b.floorNo) + ?.map((unit, index) => ( + ob.floorNo == unit.floorNo)?.[0]?.name + } + /> + ))} + +
- - ) - } - } - ]} - } + ); + }, + }, + ], + }} showTimeLine={false} isLoading={isLoading} isDataLoading={isLoading} @@ -520,52 +541,66 @@ const Penality_menu=[ forcedActionPrefix={"WF_EMPLOYEE_PT.CREATE"} /> {/* {popup && ()} */} - { popup && } - headerBarEnd={ {showPopUp(false), ptCalculationEstimateData.Calculation[0] = ptCalculationEstimateDataCopy; setSelectedPenalityReason(null); setSelectedRebateReason(null);}}/>} + {popup && ( + } + headerBarEnd={ + { + showPopUp(false), (ptCalculationEstimateData.Calculation[0] = ptCalculationEstimateDataCopy); + setSelectedPenalityReason(null); + setSelectedRebateReason(null); + }} + /> + } actionCancelLabel={t("PT_CANCEL")} - actionCancelOnSubmit={()=>{ptCalculationEstimateData.Calculation[0] = ptCalculationEstimateDataCopy; setSelectedPenalityReason(null);setSelectedRebateReason(null); showPopUp(false)}} + actionCancelOnSubmit={() => { + ptCalculationEstimateData.Calculation[0] = ptCalculationEstimateDataCopy; + setSelectedPenalityReason(null); + setSelectedRebateReason(null); + showPopUp(false); + }} actionSaveLabel={t("PT_ADD")} - actionSaveOnSubmit={()=>(change())} + actionSaveOnSubmit={() => change()} hideSubmit={false} - > - { -
- - {t("PT_AD_PENALTY")} - - {t("PT_TX_HEADS")} - -
-
-
- -
-
-
- {selectedPenalityReason && selectedPenalityReason.value==="Others" &&
- {t("PT_REASON")} -
-
- -
-
-
} - {t("PT_HEAD_AMT")} -
-
-
- + > + { +
+ + {t("PT_AD_PENALTY")} + {t("PT_TX_HEADS")} +
+
+
+ +
+
- {/* + {t("PT_REASON")} +
+
+ +
+
+
+ )} + {t("PT_HEAD_AMT")} +
+
+
+ +
+ {/* */} -
-
- - - {t("PT_AD_REBATE")} - {t("PT_TX_HEADS")} -
-
-
- +
-
-
- {selectedRebateReason && selectedRebateReason.value==="Others" &&
- {t("PT_REASON")} -
-
- + + + {t("PT_AD_REBATE")} + {t("PT_TX_HEADS")} +
+
+
+ +
+
-
-
} - {t("PT_HEAD_AMT")} -
-
-
- + {selectedRebateReason && selectedRebateReason.value === "Others" && ( +
+ {t("PT_REASON")} +
+
+ +
+
+
+ )} + {t("PT_HEAD_AMT")} +
+
+
+ +
+
-
-
- -
- } - } + +
+ } + + )} {!queryClient.getQueryData(["PT_ASSESSMENT", propertyId, location?.state?.Assessment?.financialYear]) ? ( ) : ( - 0 ? false : true} label={t("PT_PROCEED_PAYMENT")} onSubmit={proceeedToPay} /> + 0 ? false : true} + label={t("PT_PROCEED_PAYMENT")} + onSubmit={proceeedToPay} + /> )}
); }; -export default AssessmentDetails; \ No newline at end of file +export default AssessmentDetails; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/pt/src/pages/employee/EditApplication/EditForm.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/pt/src/pages/employee/EditApplication/EditForm.js index 096c53db3..ae631a104 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/pt/src/pages/employee/EditApplication/EditForm.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/pt/src/pages/employee/EditApplication/EditForm.js @@ -32,13 +32,11 @@ const EditForm = ({ applicationData }) => { }, })), }; - sessionStorage.setItem("PropertyInitials",JSON.stringify(defaultValues?.originalData)); + sessionStorage.setItem("PropertyInitials", JSON.stringify(defaultValues?.originalData)); const onFormValueChange = (setValue, formData, formState) => { - if(Object.keys(formState.errors).length==1 && formState.errors.documents) - setSubmitValve(true); - else - setSubmitValve(!Object.keys(formState.errors).length); + if (Object.keys(formState.errors).length == 1 && formState.errors.documents) setSubmitValve(true); + else setSubmitValve(!Object.keys(formState.errors).length); }; const onSubmit = (data) => { @@ -50,7 +48,8 @@ const EditForm = ({ applicationData }) => { city: data?.address?.city?.name, }, propertyType: data?.PropertyType?.code, - creationReason: state?.workflow?.businessService === "PT.UPDATE" || (applicationData?.documents == null ) ? "UPDATE" : applicationData?.creationReason, + creationReason: + state?.workflow?.businessService === "PT.UPDATE" || applicationData?.documents == null ? "UPDATE" : applicationData?.creationReason, usageCategory: data?.usageCategoryMinor?.subuagecode ? data?.usageCategoryMinor?.subuagecode : data?.usageCategoryMajor?.code, usageCategoryMajor: data?.usageCategoryMajor?.code.split(".")[0], usageCategoryMinor: data?.usageCategoryMajor?.code.split(".")[1] || null, @@ -59,11 +58,15 @@ const EditForm = ({ applicationData }) => { superBuiltUpArea: Number(data?.landarea), source: "MUNICIPAL_RECORDS", // required channel: "CFC_COUNTER", // required - documents: applicationData?.documents ? applicationData?.documents.map((old) => { - let dt = old.documentType.split("."); - let newDoc = data?.documents?.documents?.find((e) => e.documentType.includes(dt[0] + "." + dt[1])); - return { ...old, ...newDoc }; - }):data?.documents?.documents.length > 0 ? data?.documents?.documents : null, + documents: applicationData?.documents + ? applicationData?.documents.map((old) => { + let dt = old.documentType.split("."); + let newDoc = data?.documents?.documents?.find((e) => e.documentType.includes(dt[0] + "." + dt[1])); + return { ...old, ...newDoc }; + }) + : data?.documents?.documents.length > 0 + ? data?.documents?.documents + : null, units: [ ...(applicationData?.units?.map((old) => ({ ...old, active: false })) || []), ...(data?.units?.map((unit) => { @@ -76,7 +79,7 @@ const EditForm = ({ applicationData }) => { if (state?.workflow?.action === "OPEN") { formData.units = formData.units.filter((unit) => unit.active); } - history.push("/digit-ui/employee/pt/response", { Property: formData, key: "UPDATE", action: "SUBMIT" }); + history.push("/mgramseva-digit-ui/employee/pt/response", { Property: formData, key: "UPDATE", action: "SUBMIT" }); }; if (isLoading) { diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/pt/src/pages/employee/MutationApplicatinDetails.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/pt/src/pages/employee/MutationApplicatinDetails.js index 0468c99af..776e98507 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/pt/src/pages/employee/MutationApplicatinDetails.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/pt/src/pages/employee/MutationApplicatinDetails.js @@ -5,7 +5,7 @@ import { useHistory } from "react-router-dom"; import getPTAcknowledgementData from "../../getPTAcknowledgementData"; import PropertyDocument from "../../pageComponents/PropertyDocument"; import PTWFApplicationTimeline from "../../pageComponents/PTWFApplicationTimeline"; -import { getCityLocale, getPropertyTypeLocale, propertyCardBodyStyle,getMohallaLocale } from "../../utils"; +import { getCityLocale, getPropertyTypeLocale, propertyCardBodyStyle, getMohallaLocale } from "../../utils"; import ApplicationDetailsActionBar from "../../../../templates/ApplicationDetails/components/ApplicationDetailsActionBar"; import ActionModal from "../../../../templates/ApplicationDetails/Modal"; import { newConfigMutate } from "../../config/Mutate/config"; @@ -13,7 +13,7 @@ import _ from "lodash"; import get from "lodash/get"; import { pdfDownloadLink } from "../../utils"; -const MutationApplicationDetails = ({ propertyId, acknowledgementIds, workflowDetails, mutate}) => { +const MutationApplicationDetails = ({ propertyId, acknowledgementIds, workflowDetails, mutate }) => { const { t } = useTranslation(); const [displayMenu, setDisplayMenu] = useState(false); const [showOptions, setShowOptions] = useState(false); @@ -25,8 +25,8 @@ const MutationApplicationDetails = ({ propertyId, acknowledgementIds, workflowDe const history = useHistory(); const [isEnableLoader, setIsEnableLoader] = useState(false); const { isLoading, isError, error, data } = Digit.Hooks.pt.usePropertySearch( - { filters: { acknowledgementIds },tenantId }, - { filters: { acknowledgementIds },tenantId } + { filters: { acknowledgementIds }, tenantId }, + { filters: { acknowledgementIds }, tenantId } ); const [billAmount, setBillAmount] = useState(null); const [billStatus, setBillStatus] = useState(null); @@ -44,7 +44,7 @@ const MutationApplicationDetails = ({ propertyId, acknowledgementIds, workflowDe }, { enabled: true, - // select: (d) => + // select: (d) => // d.Properties.filter((e) => e.status === "ACTIVE")?.sort((a, b) => b.auditDetails.lastModifiedTime - a.auditDetails.lastModifiedTime), // select: (data) => data.Properties?.filter((e) => e.status === "ACTIVE") } @@ -56,27 +56,32 @@ const MutationApplicationDetails = ({ propertyId, acknowledgementIds, workflowDe consumerCodes: acknowledgementIds, isEmployee: true, }, - {enabled: acknowledgementIds?true:false} + { enabled: acknowledgementIds ? true : false } ); const [appDetailsToShow, setAppDetailsToShow] = useState({}); const [showModal, setShowModal] = useState(false); const [selectedAction, setSelectedAction] = useState(null); - const { isLoading: isLoadingApplicationDetails, isError: isErrorApplicationDetails, data: applicationDetails, error: errorApplicationDetails } = Digit.Hooks.pt.useApplicationDetail(t, tenantId, propertyId); - - useEffect(async ()=>{ - if(acknowledgementIds){ - const res = await Digit.PaymentService.searchBill(tenantId, {Service: businessService, consumerCode: acknowledgementIds}); - if(! res.Bill.length) { - const res1 = await Digit.PTService.ptCalculateMutation({Property: applicationDetails?.applicationData}, tenantId); - setBillAmount(res1?.[acknowledgementIds]?.totalAmount || t("CS_NA")) - setBillStatus(t(`PT_MUT_BILL_ACTIVE`)) + const { + isLoading: isLoadingApplicationDetails, + isError: isErrorApplicationDetails, + data: applicationDetails, + error: errorApplicationDetails, + } = Digit.Hooks.pt.useApplicationDetail(t, tenantId, propertyId); + + useEffect(async () => { + if (acknowledgementIds) { + const res = await Digit.PaymentService.searchBill(tenantId, { Service: businessService, consumerCode: acknowledgementIds }); + if (!res.Bill.length) { + const res1 = await Digit.PTService.ptCalculateMutation({ Property: applicationDetails?.applicationData }, tenantId); + setBillAmount(res1?.[acknowledgementIds]?.totalAmount || t("CS_NA")); + setBillStatus(t(`PT_MUT_BILL_ACTIVE`)); } else { - setBillAmount(res?.Bill[0]?.totalAmount || t("CS_NA")) - setBillStatus(t(`PT_MUT_BILL_${res?.Bill[0]?.status?.toUpperCase()}`)) + setBillAmount(res?.Bill[0]?.totalAmount || t("CS_NA")); + setBillStatus(t(`PT_MUT_BILL_${res?.Bill[0]?.status?.toUpperCase()}`)); } } - },[tenantId, acknowledgementIds, businessService]) + }, [tenantId, acknowledgementIds, businessService]); useEffect(() => { showTransfererDetails(); @@ -112,21 +117,23 @@ const MutationApplicationDetails = ({ propertyId, acknowledgementIds, workflowDe data?.customFunctionToExecute({ ...data }); } if (nocData !== false && nocMutation) { - const nocPrmomises = nocData?.map(noc => { - return nocMutation?.mutateAsync(noc) - }) + const nocPrmomises = nocData?.map((noc) => { + return nocMutation?.mutateAsync(noc); + }); try { setIsEnableLoader(true); const values = await Promise.all(nocPrmomises); - values && values.map((ob) => { - Digit.SessionStorage.del(ob?.Noc?.[0]?.nocType); - }) - } - catch (err) { + values && + values.map((ob) => { + Digit.SessionStorage.del(ob?.Noc?.[0]?.nocType); + }); + } catch (err) { setIsEnableLoader(false); - let errorValue = err?.response?.data?.Errors?.[0]?.code ? t(err?.response?.data?.Errors?.[0]?.code) : err?.response?.data?.Errors?.[0]?.message || err; + let errorValue = err?.response?.data?.Errors?.[0]?.code + ? t(err?.response?.data?.Errors?.[0]?.code) + : err?.response?.data?.Errors?.[0]?.message || err; closeModal(); - setShowToast({ key: "error", error: {message: errorValue}}); + setShowToast({ key: "error", error: { message: errorValue } }); setTimeout(closeToast, 5000); return; } @@ -143,14 +150,14 @@ const MutationApplicationDetails = ({ propertyId, acknowledgementIds, workflowDe setIsEnableLoader(false); if (isOBPS?.bpa) { data.selectedAction = selectedAction; - history.replace(`/digit-ui/employee/obps/response`, { data: data }); + history.replace(`/mgramseva-digit-ui/employee/obps/response`, { data: data }); } if (isOBPS?.isStakeholder) { data.selectedAction = selectedAction; - history.push(`/digit-ui/employee/obps/stakeholder-response`, { data: data }); + history.push(`/mgramseva-digit-ui/employee/obps/stakeholder-response`, { data: data }); } if (isOBPS?.isNoc) { - history.push(`/digit-ui/employee/noc/response`, { data: data }); + history.push(`/mgramseva-digit-ui/employee/noc/response`, { data: data }); } setShowToast({ key: "success", action: selectedAction }); setTimeout(closeToast, 5000); @@ -163,9 +170,9 @@ const MutationApplicationDetails = ({ propertyId, acknowledgementIds, workflowDe closeModal(); }; - async function getRecieptSearch({tenantId,payments,...params}) { + async function getRecieptSearch({ tenantId, payments, ...params }) { let response = { filestoreIds: [payments?.fileStoreId] }; - response = await Digit.PaymentService.generatePdf(tenantId, { Payments: [{...payments}] }, "consolidatedreceipt"); + response = await Digit.PaymentService.generatePdf(tenantId, { Payments: [{ ...payments }] }, "consolidatedreceipt"); const fileStore = await Digit.PaymentService.printReciept(tenantId, { fileStoreIds: response.filestoreIds[0] }); window.open(fileStore[response?.filestoreIds[0]], "_blank"); } @@ -184,7 +191,7 @@ const MutationApplicationDetails = ({ propertyId, acknowledgementIds, workflowDe function onActionSelect(action) { if (action) { if (action?.redirectionUrll) { - window.location.assign(`${window.location.origin}/digit-ui/employee/payment/collect/${action?.redirectionUrll?.pathname}`); + window.location.assign(`${window.location.origin}/mgramseva-digit-ui/employee/payment/collect/${action?.redirectionUrll?.pathname}`); } else if (!action?.redirectionUrl) { setShowModal(true); } else { @@ -193,7 +200,7 @@ const MutationApplicationDetails = ({ propertyId, acknowledgementIds, workflowDe state: { ...action.redirectionUrl?.state }, }); } - } + } setSelectedAction(action); setDisplayMenu(false); @@ -210,16 +217,15 @@ const MutationApplicationDetails = ({ propertyId, acknowledgementIds, workflowDe state: null, comment: null, documents: null, - assignes: null + assignes: null, }; property.workflow = workflow; - } if (property && property.owners && property.owners.length > 0) { let ownersTemp = []; let owners = []; - property.owners.map(owner => { + property.owners.map((owner) => { owner.documentUid = owner.documents ? owner.documents[0].documentUid : "NA"; owner.documentType = owner.documents ? owner.documents[0].documentType : "NA"; if (owner.status == "ACTIVE") { @@ -233,51 +239,35 @@ const MutationApplicationDetails = ({ propertyId, acknowledgementIds, workflowDe property.ownersTemp = ownersTemp; } property.ownershipCategoryTemp = property.ownershipCategory; - property.ownershipCategoryInit = 'NA'; + property.ownershipCategoryInit = "NA"; // Set Institution/Applicant info card visibility - if ( - get( - application, - "Properties[0].ownershipCategory", - "" - ).startsWith("INSTITUTION") - ) { + if (get(application, "Properties[0].ownershipCategory", "").startsWith("INSTITUTION")) { property.institutionTemp = property.institution; } if (auditResponse && Array.isArray(get(auditResponse, "Properties", [])) && get(auditResponse, "Properties", []).length > 0) { const propertiesAudit = get(auditResponse, "Properties", []); - const propertyIndex=property.status == 'ACTIVE' ? 1:0; - const previousActiveProperty = propertiesAudit.filter(property => property.status == 'ACTIVE').sort((x, y) => y.auditDetails.lastModifiedTime - x.auditDetails.lastModifiedTime)[propertyIndex]; + const propertyIndex = property.status == "ACTIVE" ? 1 : 0; + const previousActiveProperty = propertiesAudit + .filter((property) => property.status == "ACTIVE") + .sort((x, y) => y.auditDetails.lastModifiedTime - x.auditDetails.lastModifiedTime)[propertyIndex]; // Removed filter(property => property.status == 'ACTIVE') condition to match result in qa env // const previousActiveProperty = propertiesAudit.sort((x, y) => y.auditDetails.lastModifiedTime - x.auditDetails.lastModifiedTime)[propertyIndex]; property.ownershipCategoryInit = previousActiveProperty.ownershipCategory; - property.ownersInit = previousActiveProperty.owners.filter(owner => owner.status == "ACTIVE"); + property.ownersInit = previousActiveProperty.owners.filter((owner) => owner.status == "ACTIVE"); if (property.ownershipCategoryInit.startsWith("INSTITUTION")) { property.institutionInit = previousActiveProperty.institution; } } - let transfereeOwners = get( - property, - "ownersTemp", [] - ); - let transferorOwners = get( - property, - "ownersInit", [] - ); + let transfereeOwners = get(property, "ownersTemp", []); + let transferorOwners = get(property, "ownersInit", []); + + let transfereeInstitution = get(property, "institutionTemp", []); + + let transferorInstitution = get(property, "institutionInit", []); - let transfereeInstitution = get( - property, - "institutionTemp", [] - ); - - let transferorInstitution = get( - property, - "institutionInit", [] - ); - let units = []; units = application?.units; units && @@ -309,7 +299,7 @@ const MutationApplicationDetails = ({ propertyId, acknowledgementIds, workflowDe i = 0; flrno = units && units[0]?.floorNo; - // const isPropertyTransfer = property?.creationReason && property.creationReason === "MUTATION" ? true : false; + // const isPropertyTransfer = property?.creationReason && property.creationReason === "MUTATION" ? true : false; const handleDownloadPdf = async () => { const applications = application || {}; @@ -319,7 +309,7 @@ const MutationApplicationDetails = ({ propertyId, acknowledgementIds, workflowDe }; let documentDate = t("CS_NA"); - if(property?.additionalDetails?.documentDate) { + if (property?.additionalDetails?.documentDate) { const date = new Date(property?.additionalDetails?.documentDate); const month = Digit.Utils.date.monthNames[date.getMonth()]; documentDate = `${date.getDate()} ${month} ${date.getFullYear()}`; @@ -335,197 +325,198 @@ const MutationApplicationDetails = ({ propertyId, acknowledgementIds, workflowDe dowloadOptions.push({ label: t("MT_APPLICATION"), - onClick: () => handleDownloadPdf() - }); - if(reciept_data && reciept_data?.Payments.length>0 && recieptDataLoading == false) - dowloadOptions.push({ - label: t("MT_FEE_RECIEPT"), - onClick: () => getRecieptSearch({tenantId: reciept_data?.Payments[0]?.tenantId,payments: reciept_data?.Payments[0]}) - }); - if(data?.Properties?.[0]?.creationReason === "MUTATION" && data?.Properties?.[0]?.status === "ACTIVE") - dowloadOptions.push({ - label: t("MT_CERTIFICATE"), - onClick: () => printCertificate() + onClick: () => handleDownloadPdf(), }); + if (reciept_data && reciept_data?.Payments.length > 0 && recieptDataLoading == false) + dowloadOptions.push({ + label: t("MT_FEE_RECIEPT"), + onClick: () => getRecieptSearch({ tenantId: reciept_data?.Payments[0]?.tenantId, payments: reciept_data?.Payments[0] }), + }); + if (data?.Properties?.[0]?.creationReason === "MUTATION" && data?.Properties?.[0]?.status === "ACTIVE") + dowloadOptions.push({ + label: t("MT_CERTIFICATE"), + onClick: () => printCertificate(), + }); const getCardSubHeadrStyles = () => { - return { fontSize: "24px", fontWeight: "700", lineHeight: "28px", margin: "20px 0px" } - } + return { fontSize: "24px", fontWeight: "700", lineHeight: "28px", margin: "20px 0px" }; + }; return (
-
{t("PT_MUTATION_APPLICATION_DETAILS")}
-
+
{t("PT_MUTATION_APPLICATION_DETAILS")}
+
- {dowloadOptions && dowloadOptions.length > 0 && setShowOptions(!showOptions)} - displayOptions={showOptions} - options={dowloadOptions} - className="multilinkWrapper" - style={{top:"90px"}} - />} + {dowloadOptions && dowloadOptions.length > 0 && ( + setShowOptions(!showOptions)} + displayOptions={showOptions} + options={dowloadOptions} + className="multilinkWrapper" + style={{ top: "90px" }} + /> + )}
- - - - - - - - - - {t("PT_PROPERTY_ADDRESS_SUB_HEADER")} - - - - - - - - - - {t("PT_MUTATION_TRANSFEROR_DETAILS")} -
- {Array.isArray(transferorOwners) && - transferorOwners.map((owner, index) => ( -
- - {transferorOwners.length != 1 && ( - - {t("PT_OWNER_SUB_HEADER")} - {index + 1}{" "} - - )} - - - - - - - - - -
- ))} + + + + + + + + + {t("PT_PROPERTY_ADDRESS_SUB_HEADER")} + + + + + + + + + {t("PT_MUTATION_TRANSFEROR_DETAILS")} +
+ {Array.isArray(transferorOwners) && + transferorOwners.map((owner, index) => ( +
+ + {transferorOwners.length != 1 && ( + + {t("PT_OWNER_SUB_HEADER")} - {index + 1}{" "} + + )} + + + + + + + + +
+ ))} +
- {t("PT_MUTATION_TRANSFEREE_DETAILS")} - { - transferorInstitution.length ? ( -
- {Array.isArray(transfereeOwners) && - transfereeOwners.map((owner, index) => ( -
- - {transfereeOwners.length != 1 && ( - - {t("PT_OWNER_SUB_HEADER")} - {index + 1}{" "} - - )} - - - - - - - - - - - -
- ))} -
- ) : ( -
- {Array.isArray(transfereeOwners) && - transfereeOwners.map((owner, index) => ( -
- - {transfereeOwners.length != 1 && ( - - {t("PT_OWNER_SUB_HEADER")} - {index + 1}{" "} - - )} - - - - - - - - - - - - -
- ))} -
- ) - } - {t("PT_MUTATION_DETAILS")} - - - - - - - - {t("PT_REGISTRATION_DETAILS")} - - - - - - - - - - {t("PT_COMMON_DOCS")} + {t("PT_MUTATION_TRANSFEREE_DETAILS")} + {transferorInstitution.length ? (
- {Array.isArray(docs) ? ( - docs.length > 0 && - ) : ( - - - - )} + {Array.isArray(transfereeOwners) && + transfereeOwners.map((owner, index) => ( +
+ + {transfereeOwners.length != 1 && ( + + {t("PT_OWNER_SUB_HEADER")} - {index + 1}{" "} + + )} + + + + + + + + + + + +
+ ))}
- - {showModal ? ( - - ) : null} - + {Array.isArray(transfereeOwners) && + transfereeOwners.map((owner, index) => ( +
+ + {transfereeOwners.length != 1 && ( + + {t("PT_OWNER_SUB_HEADER")} - {index + 1}{" "} + + )} + + + + + + + + + + + + +
+ ))} +
+ )} + {t("PT_MUTATION_DETAILS")} + + + + + + + + {t("PT_REGISTRATION_DETAILS")} + + + + + + + + + + {t("PT_COMMON_DOCS")} +
+ {Array.isArray(docs) ? ( + docs.length > 0 && + ) : ( + + + + )} +
+ + {showModal ? ( + -
+ ) : null} + + ); }; -export default MutationApplicationDetails; \ No newline at end of file +export default MutationApplicationDetails; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/pt/src/pages/employee/NewApplication/index.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/pt/src/pages/employee/NewApplication/index.js index acfcaa11d..98fa1e065 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/pt/src/pages/employee/NewApplication/index.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/pt/src/pages/employee/NewApplication/index.js @@ -9,12 +9,12 @@ const NewApplication = () => { const tenants = Digit.Hooks.pt.useTenants(); const { t } = useTranslation(); const [canSubmit, setSubmitValve] = useState(false); - const defaultValues = { }; + const defaultValues = {}; const history = useHistory(); // delete // const [_formData, setFormData,_clear] = Digit.Hooks.useSessionStorage("store-data",null); const [mutationHappened, setMutationHappened, clear] = Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_HAPPENED", false); - const [successData, setsuccessData, clearSuccessData] = Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_SUCCESS_DATA", { }); + const [successData, setsuccessData, clearSuccessData] = Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_SUCCESS_DATA", {}); const { data: commonFields, isLoading } = Digit.Hooks.pt.useMDMS(Digit.ULBService.getStateId(), "PropertyTax", "CommonFieldsConfig"); useEffect(() => { setMutationHappened(false); @@ -120,8 +120,7 @@ const NewApplication = () => { }; } - history.replace("/digit-ui/employee/pt/response", { Property: formData }); //current wala - + history.replace("/mgramseva-digit-ui/employee/pt/response", { Property: formData }); //current wala }; if (isLoading) { return ; @@ -129,7 +128,7 @@ const NewApplication = () => { /* use newConfig instead of commonFields for local development in case needed */ - const configs = commonFields?commonFields:newConfig; + const configs = commonFields ? commonFields : newConfig; return ( { } else if (window.innerWidth > 780 && isMobile) { setIsMobile(false); } - } + }; window.addEventListener("resize", () => { onResize(); @@ -79,12 +79,11 @@ const PropertyDetails = () => { return () => { window.removeEventListener("resize", () => { - onResize() + onResize(); }); }; }); - useEffect(() => { if (applicationDetails && !enableAudit) { setAppDetailsToShow(_.cloneDeep(applicationDetails)); @@ -129,7 +128,7 @@ const PropertyDetails = () => { e.additionalDetails.owners.map((owner, ind) => { owner.values.map((value) => { if (value.title == "PT_OWNERSHIP_INFO_MOBILE_NO") { - value.textStyle = { display: "flex", wordBreak:"revert" }; + value.textStyle = { display: "flex", wordBreak: "revert" }; value.caption = ( { @@ -173,7 +172,7 @@ const PropertyDetails = () => { asSectionHeader: true, belowComponent: () => ( history.push({ pathname: `/digit-ui/employee/pt/payment-details/${applicationNumber}`})} + onClick={() => history.push({ pathname: `/mgramseva-digit-ui/employee/pt/payment-details/${applicationNumber}` })} style={isMobile ? { marginTop: "15px", marginLeft: "0px" } : { marginTop: "15px" }} > {t("PT_VIEW_PAYMENT")} @@ -192,7 +191,10 @@ const PropertyDetails = () => { }); } return () => { - if (appDetailsToShow?.applicationDetails?.[0]?.values?.[1].title == "PT_TOTAL_DUES" && !(sessionStorage.getItem("revalidateddone") === "done")) { + if ( + appDetailsToShow?.applicationDetails?.[0]?.values?.[1].title == "PT_TOTAL_DUES" && + !(sessionStorage.getItem("revalidateddone") === "done") + ) { appDetailsToShow?.applicationDetails.shift(); sessionStorage.setItem("revalidateddone", "done"); revalidate(); @@ -208,31 +210,34 @@ const PropertyDetails = () => { actionState: { nextActions: PT_CEMP ? [ - { - action: "ASSESS_PROPERTY", - forcedName: "PT_ASSESS", - showFinancialYearsModal: true, - customFunctionToExecute: (data) => { - delete data.customFunctionToExecute; - history.replace({ pathname: `/digit-ui/employee/pt/ptsearch/assessment-details/${applicationNumber}`, state: { ...data } }); + { + action: "ASSESS_PROPERTY", + forcedName: "PT_ASSESS", + showFinancialYearsModal: true, + customFunctionToExecute: (data) => { + delete data.customFunctionToExecute; + history.replace({ + pathname: `/mgramseva-digit-ui/employee/pt/ptsearch/assessment-details/${applicationNumber}`, + state: { ...data }, + }); + }, + tenantId: Digit.ULBService.getStateId(), }, - tenantId: Digit.ULBService.getStateId(), - }, - { - action: !fetchBillData?.Bill[0]?.totalAmount ? "MUTATE_PROPERTY" : "PT_TOTALDUES_PAY", - forcedName: "PT_OWNERSHIP_TRANSFER", - AmountDueForPay: fetchBillData?.Bill[0]?.totalAmount, - isWarningPopUp: !fetchBillData?.Bill[0]?.totalAmount ? false : true, - redirectionUrl: { - pathname: !fetchBillData?.Bill[0]?.totalAmount - ? `/digit-ui/employee/pt/property-mutate-docs-required/${applicationNumber}` - : `/digit-ui/employee/payment/collect/PT/${applicationNumber}`, - // state: { workflow: { action: "OPEN", moduleName: "PT", businessService } }, - state: null, + { + action: !fetchBillData?.Bill[0]?.totalAmount ? "MUTATE_PROPERTY" : "PT_TOTALDUES_PAY", + forcedName: "PT_OWNERSHIP_TRANSFER", + AmountDueForPay: fetchBillData?.Bill[0]?.totalAmount, + isWarningPopUp: !fetchBillData?.Bill[0]?.totalAmount ? false : true, + redirectionUrl: { + pathname: !fetchBillData?.Bill[0]?.totalAmount + ? `/mgramseva-digit-ui/employee/pt/property-mutate-docs-required/${applicationNumber}` + : `/mgramseva-digit-ui/employee/payment/collect/PT/${applicationNumber}`, + // state: { workflow: { action: "OPEN", moduleName: "PT", businessService } }, + state: null, + }, + tenantId: Digit.ULBService.getStateId(), }, - tenantId: Digit.ULBService.getStateId(), - }, - ] + ] : [], }, }, @@ -245,7 +250,7 @@ const PropertyDetails = () => { workflowDetails?.data?.actionState?.nextActions?.push({ action: "UPDATE", redirectionUrl: { - pathname: `/digit-ui/employee/pt/modify-application/${applicationNumber}`, + pathname: `/mgramseva-digit-ui/employee/pt/modify-application/${applicationNumber}`, state: { workflow: { action: "OPEN", moduleName: "PT", businessService: "PT.UPDATE" } }, }, tenantId: Digit.ULBService.getStateId(), @@ -288,7 +293,7 @@ const PropertyDetails = () => { } hideSubmit={true} isDisabled={false} - popupStyles={showUpdateNo ? { width: isMobile ? "473px" : "50%"} : { width: "75%"}} + popupStyles={showUpdateNo ? { width: isMobile ? "473px" : "50%" } : { width: "75%" }} > {showUpdateNo && ( { const [docs, setDocs] = useState([]); const { isLoading, data: Documentsob } = Digit.Hooks.pt.usePropertyMDMS(stateId, "PropertyTax", ["MutationDocuments"]); const OnSubmit = () => { - history.push(`/digit-ui/employee/pt/property-mutate/${id}`); + history.push(`/mgramseva-digit-ui/employee/pt/property-mutate/${id}`); }; useEffect(() => { diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/pt/src/pages/employee/PropertyMutation/mutationForm.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/pt/src/pages/employee/PropertyMutation/mutationForm.js index 5aa411eb1..c45fd7686 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/pt/src/pages/employee/PropertyMutation/mutationForm.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/pt/src/pages/employee/PropertyMutation/mutationForm.js @@ -122,7 +122,7 @@ const MutationForm = ({ applicationData, tenantId }) => { }; } - history.replace("/digit-ui/employee/pt/response", { Property: submitData.Property, key: "UPDATE", action: "SUBMIT" }); + history.replace("/mgramseva-digit-ui/employee/pt/response", { Property: submitData.Property, key: "UPDATE", action: "SUBMIT" }); }; const configs = newConfigMutate; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/pt/src/pages/employee/index.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/pt/src/pages/employee/index.js index da1b95f77..44b76f601 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/pt/src/pages/employee/index.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/pt/src/pages/employee/index.js @@ -1,4 +1,4 @@ -import { PrivateRoute,BreadCrumb } from "@egovernments/digit-ui-react-components"; +import { PrivateRoute, BreadCrumb } from "@egovernments/digit-ui-react-components"; import React from "react"; import { useTranslation } from "react-i18next"; import { Link, Switch, useLocation } from "react-router-dom"; @@ -8,7 +8,6 @@ import PaymentDetails from "./PaymentDetails"; import Search from "./Search"; import SearchApp from "./SearchApp"; - const EmployeeApp = ({ path, url, userType }) => { const { t } = useTranslation(); const location = useLocation(); @@ -49,41 +48,41 @@ const EmployeeApp = ({ path, url, userType }) => { const searchMW = [{ combineTaxDueInSearchData }]; const breadcrumbObj = { - ["/digit-ui/employee/pt/inbox"]: "ES_TITLE_INBOX", - ["/digit-ui/employee/pt/new-application"]: "ES_TITLE_NEW_PROPERTY_APPLICATION", - ["/digit-ui/employee/pt/search"]: "PT_COMMON_SEARCH_PROPERTY_SUB_HEADER", - ["/digit-ui/employee/pt/application-search"]: "ES_COMMON_APPLICATION_SEARCH", + ["/mgramseva-digit-ui/employee/pt/inbox"]: "ES_TITLE_INBOX", + ["/mgramseva-digit-ui/employee/pt/new-application"]: "ES_TITLE_NEW_PROPERTY_APPLICATION", + ["/mgramseva-digit-ui/employee/pt/search"]: "PT_COMMON_SEARCH_PROPERTY_SUB_HEADER", + ["/mgramseva-digit-ui/employee/pt/application-search"]: "ES_COMMON_APPLICATION_SEARCH", }; const getBreadCrumb = () => { if (breadcrumbObj[location.pathname]) return t(breadcrumbObj[location.pathname]); - else if (location.pathname.includes("/digit-ui/employee/pt/application-details/")) return t("PT_APPLICATION_TITLE"); - else if (location.pathname.includes("/digit-ui/employee/pt/property-details/")) return t("PT_PROPERTY_INFORMATION"); - else if (location.pathname.includes("/digit-ui/employee/pt/payment-details/")) return t("PT_PAYMENT_HISTORY"); - else if (location.pathname.includes("/digit-ui/employee/pt/assessment-details/")) return t("PT_ASSESS_PROPERTY"); + else if (location.pathname.includes("/mgramseva-digit-ui/employee/pt/application-details/")) return t("PT_APPLICATION_TITLE"); + else if (location.pathname.includes("/mgramseva-digit-ui/employee/pt/property-details/")) return t("PT_PROPERTY_INFORMATION"); + else if (location.pathname.includes("/mgramseva-digit-ui/employee/pt/payment-details/")) return t("PT_PAYMENT_HISTORY"); + else if (location.pathname.includes("/mgramseva-digit-ui/employee/pt/assessment-details/")) return t("PT_ASSESS_PROPERTY"); else if (location.pathname.includes("digit-ui/employee/pt/property-mutate-docs-required")) return t("PT_REQIURED_DOC_TRANSFER_OWNERSHIP"); - else if (location.pathname.includes("/digit-ui/employee/pt/property-mutate/")) return t("ES_TITLE_MUTATE_PROPERTY"); - else if (location.pathname.includes("/digit-ui/employee/pt/modify-application/")) return t("PT_UPDATE_PROPERTY"); + else if (location.pathname.includes("/mgramseva-digit-ui/employee/pt/property-mutate/")) return t("ES_TITLE_MUTATE_PROPERTY"); + else if (location.pathname.includes("/mgramseva-digit-ui/employee/pt/modify-application/")) return t("PT_UPDATE_PROPERTY"); }; const PTBreadCrumbs = ({ location }) => { const { t } = useTranslation(); const search = useLocation().search; const fromScreen = new URLSearchParams(search).get("from") || null; - const { from : fromScreen2 } = Digit.Hooks.useQueryParams(); + const { from: fromScreen2 } = Digit.Hooks.useQueryParams(); const crumbs = [ { - path: "/digit-ui/employee", + path: "/mgramseva-digit-ui/employee", content: t("ES_COMMON_HOME"), show: true, }, { - path: "/digit-ui/employee/pt/inbox", + path: "/mgramseva-digit-ui/employee/pt/inbox", content: t("ES_TITLE_INBOX"), show: location.pathname.includes("pt/inbox") ? true : false, }, { - path: "/digit-ui/employee/pt/search", + path: "/mgramseva-digit-ui/employee/pt/search", content: t("PT_COMMON_SEARCH_PROPERTY_SUB_HEADER"), show: location.pathname.includes("/pt/search") || location.pathname.includes("/pt/ptsearch") ? true : false, }, @@ -93,53 +92,65 @@ const EmployeeApp = ({ path, url, userType }) => { show: location.pathname.includes("pt/property-mutate-docs-required") ? true : false, }, { - path: "/digit-ui/employee/pt/property-mutate/", + path: "/mgramseva-digit-ui/employee/pt/property-mutate/", content: t("ES_TITLE_MUTATE_PROPERTY"), show: location.pathname.includes("pt/property-mutate/") ? true : false, }, { - path: "/digit-ui/employee/pt/modify-application/", + path: "/mgramseva-digit-ui/employee/pt/modify-application/", content: t("PT_UPDATE_PROPERTY"), show: location.pathname.includes("pt/modify-application") ? true : false, }, { - path: "/digit-ui/employee/pt/application-search", + path: "/mgramseva-digit-ui/employee/pt/application-search", content: t("ES_COMMON_APPLICATION_SEARCH"), - show: location.pathname.includes("/pt/application-search") || location.pathname.includes("/pt/applicationsearch/application-details/") ? true : false, + show: + location.pathname.includes("/pt/application-search") || location.pathname.includes("/pt/applicationsearch/application-details/") + ? true + : false, }, { - path: `/digit-ui/employee/pt/ptsearch/property-details/${sessionStorage.getItem("propertyIdinPropertyDetail")}`, - content: fromScreen || fromScreen2 ? `${t(fromScreen || fromScreen2)} / ${t("PT_PROPERTY_INFORMATION")}`:t("PT_PROPERTY_INFORMATION"), - show: location.pathname.includes("/pt/ptsearch/property-details/") || location.pathname.includes("/pt/ptsearch/payment-details/") || location.pathname.includes("/pt/ptsearch/assessment-details/") ? true : false, - isBack:fromScreen && true, + path: `/mgramseva-digit-ui/employee/pt/ptsearch/property-details/${sessionStorage.getItem("propertyIdinPropertyDetail")}`, + content: fromScreen || fromScreen2 ? `${t(fromScreen || fromScreen2)} / ${t("PT_PROPERTY_INFORMATION")}` : t("PT_PROPERTY_INFORMATION"), + show: + location.pathname.includes("/pt/ptsearch/property-details/") || + location.pathname.includes("/pt/ptsearch/payment-details/") || + location.pathname.includes("/pt/ptsearch/assessment-details/") + ? true + : false, + isBack: fromScreen && true, }, { - path: `/digit-ui/employee/pt/property-details/${sessionStorage.getItem("propertyIdinPropertyDetail")}?${fromScreen2?`from=${fromScreen2}` : ''}`, - content: fromScreen || fromScreen2 ? `${t(fromScreen || fromScreen2)} / ${t("PT_PROPERTY_INFORMATION")}`:t("PT_PROPERTY_INFORMATION"), + path: `/mgramseva-digit-ui/employee/pt/property-details/${sessionStorage.getItem("propertyIdinPropertyDetail")}?${ + fromScreen2 ? `from=${fromScreen2}` : "" + }`, + content: fromScreen || fromScreen2 ? `${t(fromScreen || fromScreen2)} / ${t("PT_PROPERTY_INFORMATION")}` : t("PT_PROPERTY_INFORMATION"), show: location.pathname.includes("/pt/property-details/") || location.pathname.includes("/pt/payment-details/") ? true : false, - isBack:true, + isBack: true, }, { - path: `/digit-ui/employee/pt/applicationsearch/application-details/${sessionStorage.getItem("applicationNoinAppDetails")}`, + path: `/mgramseva-digit-ui/employee/pt/applicationsearch/application-details/${sessionStorage.getItem("applicationNoinAppDetails")}`, content: t("PT_APPLICATION_TITLE"), - show: location.pathname.includes("/pt/application-details/") || location.pathname.includes("/pt/applicationsearch/application-details/") ? true : false, + show: + location.pathname.includes("/pt/application-details/") || location.pathname.includes("/pt/applicationsearch/application-details/") + ? true + : false, }, { - path: "/digit-ui/employee/pt/payment-details/", - content: fromScreen ? `${t(fromScreen)} / ${t("PT_PAYMENT_HISTORY") -} `: t("PT_PAYMENT_HISTORY"), + path: "/mgramseva-digit-ui/employee/pt/payment-details/", + content: fromScreen ? `${t(fromScreen)} / ${t("PT_PAYMENT_HISTORY")} ` : t("PT_PAYMENT_HISTORY"), show: location.pathname.includes("/pt/ptsearch/payment-details") || location.pathname.includes("/pt/payment-details") ? true : false, - isBack:fromScreen && true, + isBack: fromScreen && true, }, { - path: "/digit-ui/employee/pt/assessment-details/", + path: "/mgramseva-digit-ui/employee/pt/assessment-details/", content: t("PT_ASSESS_PROPERTY"), show: location.pathname.includes("pt/ptsearch/assessment-details") ? true : false, }, ]; - - return ; - } + + return ; + }; const NewApplication = Digit?.ComponentRegistryService?.getComponent("PTNewApplication"); const ApplicationDetails = Digit?.ComponentRegistryService?.getComponent("ApplicationDetails"); @@ -151,18 +162,25 @@ const EmployeeApp = ({ path, url, userType }) => { const DocsRequired = Digit?.ComponentRegistryService?.getComponent("PTDocsRequired"); const isRes = window.location.href.includes("pt/response"); const isLocation = window.location.href.includes("pt") || window.location.href.includes("application"); - const isNewRegistration = window.location.href.includes("new-application") || window.location.href.includes("modify-application") || window.location.href.includes("pt/application-details"); + const isNewRegistration = + window.location.href.includes("new-application") || + window.location.href.includes("modify-application") || + window.location.href.includes("pt/application-details"); return (
{/*

- + {t("ES_COMMON_HOME")} {" "} / {getBreadCrumb()}

} */} - {!isRes ?
: null} + {!isRes ? ( +
+ +
+ ) : null} } /> { return setConfig( @@ -52,21 +49,22 @@ const ReceiptCancelModal = ({ t, action, tenantId, closeModal, submitAction, app setReasons(data?.dropdownData); }, [data]); - function submit(data) { - history.replace("/digit-ui/employee/receipts/response", { + history.replace("/mgramseva-digit-ui/employee/receipts/response", { paymentWorkflow: { action: "CANCEL", - additionalDetails: {...data.otherDetails,selectedReasonMessage:t(`CR_REASON_${selectedReason.code}`)}, + additionalDetails: { ...data.otherDetails, selectedReasonMessage: t(`CR_REASON_${selectedReason.code}`) }, paymentId: applicationData?.Payments[0]?.id, reason: selectedReason.code, tenantId: applicationData?.Payments[0]?.tenantId, - }, key: "UPDATE", action: "CANCELLATION", businessService: applicationData?.Payments[0]?.paymentDetails[0]?.businessService + }, + key: "UPDATE", + action: "CANCELLATION", + businessService: applicationData?.Payments[0]?.paymentDetails[0]?.businessService, }); - } if (isLoading) { - return + return ; } return config?.form ? ( } actionCancelOnSubmit={closeModal} actionSaveLabel={t(config?.label?.submit)} - actionSaveOnSubmit={() => { }} + actionSaveOnSubmit={() => {}} formId="modal-action" isDisabled={!selectedReason} > diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/receipts/src/components/inbox/ApplicationCard.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/receipts/src/components/inbox/ApplicationCard.js index 376399ca1..f131ab678 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/receipts/src/components/inbox/ApplicationCard.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/receipts/src/components/inbox/ApplicationCard.js @@ -17,9 +17,8 @@ export const ApplicationCard = ({ sortParams, linkPrefix, removeParam, - defaultSearchParams + defaultSearchParams, }) => { - const [type, setType] = useState(isSearch ? "SEARCH" : ""); const [popup, setPopup] = useState(isSearch ? true : false); const [params, setParams] = useState(searchParams); @@ -56,7 +55,6 @@ export const ApplicationCard = ({ return ; } - let result; if (!data || data?.length === 0) { result = ( @@ -75,7 +73,7 @@ export const ApplicationCard = ({ ); } diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/receipts/src/components/inbox/ReceiptsDesktopInbox.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/receipts/src/components/inbox/ReceiptsDesktopInbox.js index 9ec603044..5f9b71587 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/receipts/src/components/inbox/ReceiptsDesktopInbox.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/receipts/src/components/inbox/ReceiptsDesktopInbox.js @@ -12,10 +12,14 @@ const ReceiptsDesktopInbox = ({ tableConfig, filterComponent, ...props }) => { const GetCell = (value) => {t(value)}; const GetDateCell = (value) => { const date = new Date(value); - return {date?.toLocaleDateString()} + return {date?.toLocaleDateString()}; }; - const GetSlaCell = (value, t, prefix = '') => { - return value == "CANCELLED" ? {t(`${prefix}${value}`) || ""} : {t(`${prefix}${value}`) || ""}; + const GetSlaCell = (value, t, prefix = "") => { + return value == "CANCELLED" ? ( + {t(`${prefix}${value}`) || ""} + ) : ( + {t(`${prefix}${value}`) || ""} + ); }; const data = props?.data?.Payments; const [FilterComponent, setComp] = useState(() => Digit.ComponentRegistryService?.getComponent(filterComponent)); @@ -27,7 +31,13 @@ const ReceiptsDesktopInbox = ({ tableConfig, filterComponent, ...props }) => { Cell: ({ row }) => { return ( - {row.original?.paymentDetails[0]?.receiptNumber} + + {row.original?.paymentDetails[0]?.receiptNumber} + ); }, @@ -64,10 +74,9 @@ const ReceiptsDesktopInbox = ({ tableConfig, filterComponent, ...props }) => { Header: t("CR_COMMON_TABLE_COL_STATUS"), disableSortBy: true, Cell: ({ row }) => { - return GetSlaCell(`${row.original?.paymentStatus}`, t, 'RC_'); + return GetSlaCell(`${row.original?.paymentStatus}`, t, "RC_"); }, }, - ]; }, []); @@ -126,16 +135,16 @@ const ReceiptsDesktopInbox = ({ tableConfig, filterComponent, ...props }) => { allLinks={[ { text: "CR_COMMON_DASHBOARD_HEADER", - link: "/digit-ui/employee/receipts/inprogress", + link: "/mgramseva-digit-ui/employee/receipts/inprogress", businessService: "receipts", roles: ["CR_PT"], }, { text: "CR_COMMON_REPORTS_HEADER", - link: "/digit-ui/employee/receipts/inprogress", + link: "/mgramseva-digit-ui/employee/receipts/inprogress", businessService: "receipts", roles: ["CR_PT"], - } + }, ]} headerText={t("ACTION_TEST_RECEIPTS")} businessService={props.businessService} diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/receipts/src/pages/ReceiptAcknowledgement.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/receipts/src/pages/ReceiptAcknowledgement.js index 81f0c2d09..5d598c5f9 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/receipts/src/pages/ReceiptAcknowledgement.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/receipts/src/pages/ReceiptAcknowledgement.js @@ -1,11 +1,10 @@ - import { ActionBar, Banner, Card, CardText, LinkButton, Loader, SubmitBar } from "@egovernments/digit-ui-react-components"; import React, { useEffect } from "react"; import { useTranslation } from "react-i18next"; import { Link } from "react-router-dom"; export const printReciept = async (businessService, consumerCode) => { - await Digit.Utils.downloadReceipt(consumerCode, businessService, 'consolidatedreceipt'); + await Digit.Utils.downloadReceipt(consumerCode, businessService, "consolidatedreceipt"); }; const GetMessage = (type, action, isSuccess, isEmployee, t) => { @@ -25,7 +24,7 @@ const GetLabel = (action, isSuccess, isEmployee, t) => { const BannerPicker = (props) => { return ( { }, [mutation.data]); const onError = (error, variables) => { - setErrorInfo(error?.response?.data?.Errors[0]?.code || 'ERROR'); + setErrorInfo(error?.response?.data?.Errors[0]?.code || "ERROR"); setMutationHappened(true); }; @@ -58,7 +57,7 @@ const ReceiptAcknowledgement = (props) => { if (state.key === "UPDATE" && !mutationHappened && !errorInfo) { mutation.mutate( { - paymentWorkflows: [state.paymentWorkflow] + paymentWorkflows: [state.paymentWorkflow], }, { onError, @@ -70,10 +69,10 @@ const ReceiptAcknowledgement = (props) => { const DisplayText = (action, isSuccess, isEmployee, t) => { if (!isSuccess) { - return mutation?.error?.response?.data?.Errors[0].code || errorInfo + return mutation?.error?.response?.data?.Errors[0].code || errorInfo; } else { Digit.SessionStorage.set("isupdate", Math.floor(100000 + Math.random() * 900000)); - return t('CR_APPLY_FORWARD_SUCCESS'); + return t("CR_APPLY_FORWARD_SUCCESS"); } }; @@ -100,18 +99,24 @@ const ReceiptAcknowledgement = (props) => {
- + {t("COMMON_TABLE_PRINT")}
} style={{ width: "100px" }} - onClick={() => { printReciept(Payment?.paymentDetails[0]?.businessService, Payment?.paymentDetails[0]?.bill?.consumerCode) }} + onClick={() => { + printReciept(Payment?.paymentDetails[0]?.businessService, Payment?.paymentDetails[0]?.bill?.consumerCode); + }} /> - )} + + )} - + diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/receipts/src/pages/ReceiptInbox.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/receipts/src/pages/ReceiptInbox.js index d645d5f51..bf6d50cf2 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/receipts/src/pages/ReceiptInbox.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/receipts/src/pages/ReceiptInbox.js @@ -15,22 +15,34 @@ const ReceiptInbox = ({ parentRoute, businessService = "receipts", initialStates const [searchParams, setSearchParams] = useState(() => { return initialStates.searchParams || {}; }); - const { isLoading: countLoading, data: countData, ...rest1 } = Digit.Hooks.receipts.useReceiptsSearch({ ...searchParams, isCountRequest: true }, tenantId, [], isupdate); + const { isLoading: countLoading, data: countData, ...rest1 } = Digit.Hooks.receipts.useReceiptsSearch( + { ...searchParams, isCountRequest: true }, + tenantId, + [], + isupdate + ); let isMobile = window.Digit.Utils.browser.isMobile(); let paginationParams = isMobile ? { limit: 100, offset: pageOffset, sortOrder: sortParams?.[0]?.desc ? "DESC" : "ASC" } : { limit: pageSize, offset: pageOffset, sortOrder: sortParams?.[0]?.desc ? "DESC" : "ASC" }; - const { isLoading: hookLoading, isError, error, data, ...rest } = Digit.Hooks.receipts.useReceiptsSearch(searchParams, tenantId, paginationParams, isupdate); + const { isLoading: hookLoading, isError, error, data, ...rest } = Digit.Hooks.receipts.useReceiptsSearch( + searchParams, + tenantId, + paginationParams, + isupdate + ); let isLoading = false; useEffect(() => { return () => { rest?.revalidate(); - } - }, []) - useEffect(() => { setTotalRecords(countData?.Count) }, [countData]) + }; + }, []); + useEffect(() => { + setTotalRecords(countData?.Count); + }, [countData]); useEffect(() => { setPageOffset(0); }, [searchParams]); @@ -43,7 +55,7 @@ const ReceiptInbox = ({ parentRoute, businessService = "receipts", initialStates setPageOffset((prevState) => prevState - pageSize); }; const fetchLastPage = () => { - setPageOffset((prevState) => countData?.Count && (Math.ceil(countData?.Count / 10) * 10 - pageSize)); + setPageOffset((prevState) => countData?.Count && Math.ceil(countData?.Count / 10) * 10 - pageSize); }; const fetchFirstPage = () => { @@ -60,7 +72,6 @@ const ReceiptInbox = ({ parentRoute, businessService = "receipts", initialStates } else { setSearchParams({ ...initialStates.searchParams }); } - }; const handleSort = useCallback((args) => { @@ -125,7 +136,7 @@ const ReceiptInbox = ({ parentRoute, businessService = "receipts", initialStates searchParams={searchParams} sortParams={sortParams} totalRecords={totalRecords} - linkPrefix={'/digit-ui/employee/receipts/details/'} + linkPrefix={"/mgramseva-digit-ui/employee/receipts/details/"} filterComponent={filterComponent} /> ); diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/receipts/src/pages/index.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/receipts/src/pages/index.js index 03a4d13a4..1197ed997 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/receipts/src/pages/index.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/receipts/src/pages/index.js @@ -26,10 +26,10 @@ const EmployeeApp = ({ path, url, userType }) => {

- + {t("ES_COMMON_HOME")} {" "} - / {location.pathname === "/digit-ui/employee/receipts/inbox" ? t("CR_COMMON_HEADER") : t("CR_COMMON_HEADER")} + / {location.pathname === "/mgramseva-digit-ui/employee/receipts/inbox" ? t("CR_COMMON_HEADER") : t("CR_COMMON_HEADER")}

{ { count: isLoading ? "-" : data?.Count, label: t("CR_TOTAL_RECEIPTS"), - link: `/digit-ui/employee/receipts/inbox`, + link: `/mgramseva-digit-ui/employee/receipts/inbox`, }, ], links: [ { count: isLoading ? "-" : data?.Count, label: t("CR_SEARCH_COMMON_HEADER"), - link: `/digit-ui/employee/receipts/inbox`, + link: `/mgramseva-digit-ui/employee/receipts/inbox`, }, ], }; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/reports/src/components/ReportsCard.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/reports/src/components/ReportsCard.js index 08f3a217d..d7ded195e 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/reports/src/components/ReportsCard.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/reports/src/components/ReportsCard.js @@ -4,56 +4,54 @@ import { useTranslation } from "react-i18next"; import { checkForEmployee } from "../../../ws/src/utils"; const ReportsCard = () => { - // if (!Digit.Utils.receiptsAccess()) { - // return null; - // } - const tenantId = Digit.ULBService.getCurrentTenantId(); - const { t } = useTranslation(); + // if (!Digit.Utils.receiptsAccess()) { + // return null; + // } + const tenantId = Digit.ULBService.getCurrentTenantId(); + const { t } = useTranslation(); - let links = [ - { - label: t("ACTION_TEST_RECEIPTREGISTER"), - link: `/digit-ui/employee/reports/search/pt-reports/PTReceiptRegister`, - roles: ["UC_EMP", "PT_CEMP"] - }, - { - label: t("ACTION_TEST_COLLECTION_REGISTER"), - link: `/digit-ui/employee/reports/search/pt-reports/PTCollectionReport`, - roles: ["PT_CEMP"] - }, - { - label: t("ACTION_TEST_DEFAULTER_REPORT"), - link: `/digit-ui/employee/reports/search/pt-reports/DefaulterReport`, - roles: ["PT_COLLECTION_EMP",] - }, - { - label: t("ACTION_TEST_RECEIPTREGISTER"), - link: `/digit-ui/employee/reports/search/rainmaker-wns/WnsReceiptRegisterReport`, - roles: ["WS_CEMP", "WS_APPROVER", "SW_CEMP", "SW_APPROVER"] - }, - { - label: t("ACTION_TEST_DEFAULTER_REPORT"), - link: `/digit-ui/employee/reports/search/rainmaker-wns/WnsDefaulterReport`, - roles: ["WS_CEMP"] - }, - { - label: t("ACTION_TEST_COLLECTION_REGISTER"), - link: `/digit-ui/employee/reports/search/rainmaker-wns/WnsCollectionRegisterReport`, - roles: ["WS_CEMP", "WS_APPROVER", "SW_CEMP", "SW_APPROVER"] - }, - ] - links = links.filter(link => link.roles ? checkForEmployee(link?.roles):true) - if(links.length === 0) return null + let links = [ + { + label: t("ACTION_TEST_RECEIPTREGISTER"), + link: `/mgramseva-digit-ui/employee/reports/search/pt-reports/PTReceiptRegister`, + roles: ["UC_EMP", "PT_CEMP"], + }, + { + label: t("ACTION_TEST_COLLECTION_REGISTER"), + link: `/mgramseva-digit-ui/employee/reports/search/pt-reports/PTCollectionReport`, + roles: ["PT_CEMP"], + }, + { + label: t("ACTION_TEST_DEFAULTER_REPORT"), + link: `/mgramseva-digit-ui/employee/reports/search/pt-reports/DefaulterReport`, + roles: ["PT_COLLECTION_EMP"], + }, + { + label: t("ACTION_TEST_RECEIPTREGISTER"), + link: `/mgramseva-digit-ui/employee/reports/search/rainmaker-wns/WnsReceiptRegisterReport`, + roles: ["WS_CEMP", "WS_APPROVER", "SW_CEMP", "SW_APPROVER"], + }, + { + label: t("ACTION_TEST_DEFAULTER_REPORT"), + link: `/mgramseva-digit-ui/employee/reports/search/rainmaker-wns/WnsDefaulterReport`, + roles: ["WS_CEMP"], + }, + { + label: t("ACTION_TEST_COLLECTION_REGISTER"), + link: `/mgramseva-digit-ui/employee/reports/search/rainmaker-wns/WnsCollectionRegisterReport`, + roles: ["WS_CEMP", "WS_APPROVER", "SW_CEMP", "SW_APPROVER"], + }, + ]; + links = links.filter((link) => (link.roles ? checkForEmployee(link?.roles) : true)); + if (links.length === 0) return null; - const propsForModuleCard = { - Icon: , - moduleName: t("ACTION_TEST_REPORTS"), - kpis: [ - - ], - links - }; - return ; + const propsForModuleCard = { + Icon: , + moduleName: t("ACTION_TEST_REPORTS"), + kpis: [], + links, + }; + return ; }; export default ReportsCard; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/reports/src/pages/index.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/reports/src/pages/index.js index 9363a31f8..8d94fec4e 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/reports/src/pages/index.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/reports/src/pages/index.js @@ -4,25 +4,25 @@ import { useTranslation } from "react-i18next"; import { Link, Switch, useLocation } from "react-router-dom"; import Report from "./Report"; const EmployeeApp = ({ path, url, userType }) => { - const { t } = useTranslation(); - const location = useLocation(); - const mobileView = innerWidth <= 640; - const tenantId = Digit.ULBService.getCurrentTenantId(); - return ( - - -
-

- - {t("ES_COMMON_HOME")} - {" "} - / { t("reports")} -

- } /> -
-
-
- ); + const { t } = useTranslation(); + const location = useLocation(); + const mobileView = innerWidth <= 640; + const tenantId = Digit.ULBService.getCurrentTenantId(); + return ( + + +
+

+ + {t("ES_COMMON_HOME")} + {" "} + / {t("reports")} +

+ } /> +
+
+
+ ); }; export default EmployeeApp; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/Modal/FSMActionModal.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/Modal/FSMActionModal.js index c3ba88567..47dd8ecda 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/Modal/FSMActionModal.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/Modal/FSMActionModal.js @@ -219,7 +219,7 @@ const ActionModal = ({ t, action, tenantId, state, id, closeModal, submitAction, return setConfig(configCompleteApplication({ t, vehicle, applicationCreatedTime: applicationData?.auditDetails?.createdTime, action })); case "SUBMIT": case "FSM_SUBMIT": - return history.push("/digit-ui/employee/fsm/modify-application/" + applicationNumber); + return history.push("/mgramseva-digit-ui/employee/fsm/modify-application/" + applicationNumber); case "DECLINE": case "DSO_REJECT": //declinereason @@ -262,7 +262,7 @@ const ActionModal = ({ t, action, tenantId, state, id, closeModal, submitAction, case "PAY": case "ADDITIONAL_PAY_REQUEST": case "FSM_PAY": - return history.push(`/digit-ui/employee/payment/collect/FSM.TRIP_CHARGES/${applicationNumber}`); + return history.push(`/mgramseva-digit-ui/employee/payment/collect/FSM.TRIP_CHARGES/${applicationNumber}`); default: break; } diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/index.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/index.js index f9ed82084..913e51e05 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/index.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/index.js @@ -46,9 +46,9 @@ const ApplicationDetails = (props) => { showTimeLine = true, oldValue, isInfoLabel = false, - clearDataDetails + clearDataDetails, } = props; - + useEffect(() => { if (showToast) { workflowDetails.revalidate(); @@ -57,23 +57,23 @@ const ApplicationDetails = (props) => { function onActionSelect(action) { if (action) { - if(action?.isToast){ + if (action?.isToast) { setShowToast({ key: "error", error: { message: action?.toastMessage } }); setTimeout(closeToast, 5000); - } - else if (action?.isWarningPopUp) { + } else if (action?.isWarningPopUp) { setWarningPopUp(true); } else if (action?.redirectionUrll) { if (action?.redirectionUrll?.action === "ACTIVATE_CONNECTION") { // window.location.assign(`${window.location.origin}digit-ui/employee/ws/${action?.redirectionUrll?.pathname}`, { data: action?.redirectionUrll?.state }); - history.push(`${action?.redirectionUrll?.pathname}`, JSON.stringify({ data: action?.redirectionUrll?.state, url: `${location?.pathname}${location.search}` })); - } - else if (action?.redirectionUrll?.action === "RE-SUBMIT-APPLICATION"){ + history.push( + `${action?.redirectionUrll?.pathname}`, + JSON.stringify({ data: action?.redirectionUrll?.state, url: `${location?.pathname}${location.search}` }) + ); + } else if (action?.redirectionUrll?.action === "RE-SUBMIT-APPLICATION") { history.push(`${action?.redirectionUrll?.pathname}`, { data: action?.redirectionUrll?.state }); - } - else { - window.location.assign(`${window.location.origin}/digit-ui/employee/payment/collect/${action?.redirectionUrll?.pathname}`); + } else { + window.location.assign(`${window.location.origin}/mgramseva-digit-ui/employee/payment/collect/${action?.redirectionUrll?.pathname}`); } } else if (!action?.redirectionUrl) { setShowModal(true); @@ -139,31 +139,30 @@ const ApplicationDetails = (props) => { setIsEnableLoader(false); if (isOBPS?.bpa) { data.selectedAction = selectedAction; - history.replace(`/digit-ui/employee/obps/response`, { data: data }); + history.replace(`/mgramseva-digit-ui/employee/obps/response`, { data: data }); } if (isOBPS?.isStakeholder) { data.selectedAction = selectedAction; - history.push(`/digit-ui/employee/obps/stakeholder-response`, { data: data }); + history.push(`/mgramseva-digit-ui/employee/obps/stakeholder-response`, { data: data }); } if (isOBPS?.isNoc) { - history.push(`/digit-ui/employee/noc/response`, { data: data }); + history.push(`/mgramseva-digit-ui/employee/noc/response`, { data: data }); } - if (data?.Amendments?.length > 0 ){ + if (data?.Amendments?.length > 0) { //RAIN-6981 instead just show a toast here with appropriate message - //show toast here and return - //history.push("/digit-ui/employee/ws/response-bill-amend", { status: true, state: data?.Amendments?.[0] }) - - if(variables?.AmendmentUpdate?.workflow?.action.includes("SEND_BACK")){ - setShowToast({ key: "success", label: t("ES_MODIFYSWCONNECTION_SEND_BACK_UPDATE_SUCCESS")}) - } else if (variables?.AmendmentUpdate?.workflow?.action.includes("RE-SUBMIT")){ - setShowToast({ key: "success", label: t("ES_MODIFYSWCONNECTION_RE_SUBMIT_UPDATE_SUCCESS") }) - } else if (variables?.AmendmentUpdate?.workflow?.action.includes("APPROVE")){ - setShowToast({ key: "success", label: t("ES_MODIFYSWCONNECTION_APPROVE_UPDATE_SUCCESS") }) + //show toast here and return + //history.push("/mgramseva-digit-ui/employee/ws/response-bill-amend", { status: true, state: data?.Amendments?.[0] }) + + if (variables?.AmendmentUpdate?.workflow?.action.includes("SEND_BACK")) { + setShowToast({ key: "success", label: t("ES_MODIFYSWCONNECTION_SEND_BACK_UPDATE_SUCCESS") }); + } else if (variables?.AmendmentUpdate?.workflow?.action.includes("RE-SUBMIT")) { + setShowToast({ key: "success", label: t("ES_MODIFYSWCONNECTION_RE_SUBMIT_UPDATE_SUCCESS") }); + } else if (variables?.AmendmentUpdate?.workflow?.action.includes("APPROVE")) { + setShowToast({ key: "success", label: t("ES_MODIFYSWCONNECTION_APPROVE_UPDATE_SUCCESS") }); + } else if (variables?.AmendmentUpdate?.workflow?.action.includes("REJECT")) { + setShowToast({ key: "success", label: t("ES_MODIFYWSCONNECTION_REJECT_UPDATE_SUCCESS") }); } - else if (variables?.AmendmentUpdate?.workflow?.action.includes("REJECT")){ - setShowToast({ key: "success", label: t("ES_MODIFYWSCONNECTION_REJECT_UPDATE_SUCCESS") }) - } - return + return; } setShowToast({ key: "success", action: selectedAction }); clearDataDetails && setTimeout(clearDataDetails, 3000); @@ -171,7 +170,6 @@ const ApplicationDetails = (props) => { queryClient.clear(); queryClient.refetchQueries("APPLICATION_SEARCH"); //push false status when reject - }, }); } diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/tl/src/components/SearchApplication/MobileSearchApplication.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/tl/src/components/SearchApplication/MobileSearchApplication.js index 32b1f58b6..9b527f185 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/tl/src/components/SearchApplication/MobileSearchApplication.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/tl/src/components/SearchApplication/MobileSearchApplication.js @@ -1,20 +1,9 @@ import React, { Fragment, useCallback, useMemo, useReducer } from "react"; -import { - CloseSvg, - SearchForm, - Table, - Card, - SearchAction, - PopUp, - DetailsCard, - Loader, - Toast, -} from "@egovernments/digit-ui-react-components"; +import { CloseSvg, SearchForm, Table, Card, SearchAction, PopUp, DetailsCard, Loader, Toast } from "@egovernments/digit-ui-react-components"; import SearchFormFields from "./SearchFields"; import { convertEpochToDateDMY } from "../../utils"; -const MobileSearchApplication = ({ Controller, register, control, t, reset, previousPage, handleSubmit, tenantId, data, onSubmit}) => { - +const MobileSearchApplication = ({ Controller, register, control, t, reset, previousPage, handleSubmit, tenantId, data, onSubmit }) => { function activateModal(state, action) { switch (action.type) { case "set": @@ -22,7 +11,8 @@ const MobileSearchApplication = ({ Controller, register, control, t, reset, prev case "remove": return false; default: - break; } + break; + } } const [currentlyActiveMobileModal, setActiveMobileModal] = useReducer(activateModal, false); @@ -67,31 +57,25 @@ const MobileSearchApplication = ({ Controller, register, control, t, reset, prev [currentlyActiveMobileModal] ); - const propsMobileInboxCards = useMemo( - () => { - if (data?.display){ - return [] - } - if(data === "") - { + const propsMobileInboxCards = useMemo(() => { + if (data?.display) { return []; - } - return data?.map((data) => ({ - [t("TL_COMMON_TABLE_COL_APP_NO")]: data.applicationNumber, - [t("TL_COMMON_TABLE_COL_APP_DATE")]: convertEpochToDateDMY(data.auditDetails?.createdTime) || "", - [t("TL_APPLICATION_TYPE_LABEL")]: data.applicationType - ? t(`TL_LOCALIZATION_APPLICATIONTYPE_${data.applicationType}`) - : "-", - [t("TL_LICENSE_NUMBERL_LABEL")]: data?.licenseNumber || "-", - [t("TL_LICENSE_YEAR_LABEL")]: data.financialYear || "", - [t("TL_COMMON_TABLE_COL_TRD_NAME")]: data.tradeName || "", - [t("TL_LOCALIZATION_TRADE_OWNER_NAME")]: data?.tradeLicenseDetail?.owners?.map( o => o.name ). join(",") || "" , - [t("WF_INBOX_HEADER_CURRENT_OWNER")]: data?.CurrentOwners[0].currentOwner || "", - [t("TL_COMMON_TABLE_COL_STATUS")]: data.workflowCode && data.state ? t(`WF_${data.workflowCode}_${data.state}`) : "NA", - })) - }, - [data] - ); + } + if (data === "") { + return []; + } + return data?.map((data) => ({ + [t("TL_COMMON_TABLE_COL_APP_NO")]: data.applicationNumber, + [t("TL_COMMON_TABLE_COL_APP_DATE")]: convertEpochToDateDMY(data.auditDetails?.createdTime) || "", + [t("TL_APPLICATION_TYPE_LABEL")]: data.applicationType ? t(`TL_LOCALIZATION_APPLICATIONTYPE_${data.applicationType}`) : "-", + [t("TL_LICENSE_NUMBERL_LABEL")]: data?.licenseNumber || "-", + [t("TL_LICENSE_YEAR_LABEL")]: data.financialYear || "", + [t("TL_COMMON_TABLE_COL_TRD_NAME")]: data.tradeName || "", + [t("TL_LOCALIZATION_TRADE_OWNER_NAME")]: data?.tradeLicenseDetail?.owners?.map((o) => o.name).join(",") || "", + [t("WF_INBOX_HEADER_CURRENT_OWNER")]: data?.CurrentOwners[0].currentOwner || "", + [t("TL_COMMON_TABLE_COL_STATUS")]: data.workflowCode && data.state ? t(`WF_${data.workflowCode}_${data.state}`) : "NA", + })); + }, [data]); return ( @@ -99,7 +83,7 @@ const MobileSearchApplication = ({ Controller, register, control, t, reset, prev setActiveMobileModal({ type: "set", payload: "SearchFormComponent" })} - {...{tenantId, t}} + {...{ tenantId, t }} /> {/* {isInboxLoading ? : setActiveMobileModal({type:"set", payload:"FilterFormComponent"})}/>} */} {/* setActiveMobileModal({type:"set", payload:"SortComponent"})}/> */} @@ -132,13 +116,13 @@ const MobileSearchApplication = ({ Controller, register, control, t, reset, prev )} - ) -} + ); +}; -export default MobileSearchApplication \ No newline at end of file +export default MobileSearchApplication; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/tl/src/components/SearchApplication/index.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/tl/src/components/SearchApplication/index.js index 3fda75bc5..04ea44dcd 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/tl/src/components/SearchApplication/index.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/tl/src/components/SearchApplication/index.js @@ -1,162 +1,172 @@ -import React, { useCallback, useMemo, useEffect } from "react" +import React, { useCallback, useMemo, useEffect } from "react"; import { useForm, Controller } from "react-hook-form"; import { SearchForm, Table, Card, Header } from "@egovernments/digit-ui-react-components"; import { Link } from "react-router-dom"; -import { convertEpochToDateDMY } from "../../utils"; +import { convertEpochToDateDMY } from "../../utils"; import SearchFields from "./SearchFields"; import MobileSearchApplication from "./MobileSearchApplication"; -const SearchApplication = ({tenantId, t, onSubmit, data, count }) => { - const initialValues = Digit.SessionStorage.get("SEARCH_APPLICATION_DETAIL")? { - ...Digit.SessionStorage.get("SEARCH_APPLICATION_DETAIL"), - offset: 0, - limit: 10, - sortBy: "commencementDate", - sortOrder: "DESC" -} : { - offset: 0, - limit: 10, - sortBy: "commencementDate", - sortOrder: "DESC" -}; - const { register, control, handleSubmit, setValue, getValues, reset } = useForm({ - defaultValues: initialValues - }) +const SearchApplication = ({ tenantId, t, onSubmit, data, count }) => { + const initialValues = Digit.SessionStorage.get("SEARCH_APPLICATION_DETAIL") + ? { + ...Digit.SessionStorage.get("SEARCH_APPLICATION_DETAIL"), + offset: 0, + limit: 10, + sortBy: "commencementDate", + sortOrder: "DESC", + } + : { + offset: 0, + limit: 10, + sortBy: "commencementDate", + sortOrder: "DESC", + }; + const { register, control, handleSubmit, setValue, getValues, reset } = useForm({ + defaultValues: initialValues, + }); - useEffect(() => { - register("offset", 0) - register("limit", 10) - register("sortBy", "commencementDate") - register("sortOrder", "DESC") - },[register]) + useEffect(() => { + register("offset", 0); + register("limit", 10); + register("sortBy", "commencementDate"); + register("sortOrder", "DESC"); + }, [register]); - const onSort = useCallback((args) => { - if (args.length === 0) return - setValue("sortBy", args.id) - setValue("sortOrder", args.desc ? "DESC" : "ASC") - }, []) + const onSort = useCallback((args) => { + if (args.length === 0) return; + setValue("sortBy", args.id); + setValue("sortOrder", args.desc ? "DESC" : "ASC"); + }, []); - function onPageSizeChange(e){ - setValue("limit",Number(e.target.value)) - handleSubmit(onSubmit)() - } + function onPageSizeChange(e) { + setValue("limit", Number(e.target.value)); + handleSubmit(onSubmit)(); + } - function nextPage () { - setValue("offset", getValues("offset") + getValues("limit")) - handleSubmit(onSubmit)() - } - function previousPage () { - setValue("offset", getValues("offset") - getValues("limit") ) - handleSubmit(onSubmit)() - } + function nextPage() { + setValue("offset", getValues("offset") + getValues("limit")); + handleSubmit(onSubmit)(); + } + function previousPage() { + setValue("offset", getValues("offset") - getValues("limit")); + handleSubmit(onSubmit)(); + } - const isMobile = window.Digit.Utils.browser.isMobile(); + const isMobile = window.Digit.Utils.browser.isMobile(); - if (isMobile) { - return - } + if (isMobile) { + return ; + } - //need to get from workflow - const GetCell = (value) => {value}; - const columns = useMemo( () => ([ - { - Header: t("TL_COMMON_TABLE_COL_APP_NO"), - accessor: "applicationNo", - disableSortBy: true, - Cell: ({ row }) => { - return ( -
- - - {row.original["applicationNumber"]} - - -
- ); - }, - }, - { - Header: t("TL_COMMON_TABLE_COL_APP_DATE"), - disableSortBy: true, - accessor: (row) => GetCell(row.auditDetails.createdTime ? convertEpochToDateDMY(row.auditDetails.createdTime) : ""), - }, - { - Header: t("TL_APPLICATION_TYPE_LABEL"), - disableSortBy: true, - accessor: (row) => GetCell(t(`TL_LOCALIZATION_APPLICATIONTYPE_${row?.workflowCode}`)), - }, - { - Header: t("TL_LICENSE_NUMBERL_LABEL"), - disableSortBy: true, - accessor: (row) => GetCell(row.licenseNumber || "-"), - }, - { - Header: t("TL_LICENSE_YEAR_LABEL"), - disableSortBy: true, - accessor: (row) => GetCell(row.financialYear), + //need to get from workflow + const GetCell = (value) => {value}; + const columns = useMemo( + () => [ + { + Header: t("TL_COMMON_TABLE_COL_APP_NO"), + accessor: "applicationNo", + disableSortBy: true, + Cell: ({ row }) => { + return ( +
+ + + {row.original["applicationNumber"]} + + +
+ ); }, - { - Header: t("TL_COMMON_TABLE_COL_TRD_NAME"), - disableSortBy: true, - accessor: (row) => GetCell(row.tradeName || ""), - }, - { - Header: t("TL_LOCALIZATION_TRADE_OWNER_NAME"), - accessor: (row) => GetCell(row.tradeLicenseDetail.owners.map( o => o.name ). join(",") || ""), - disableSortBy: true, - }, - { - Header: t("WF_INBOX_HEADER_CURRENT_OWNER"), - accessor: (row) => GetCell(row.CurrentOwners[0]?.currentOwner || ""), - disableSortBy: true, - }, - { - Header: t("TL_COMMON_TABLE_COL_STATUS"), - accessor: (row) =>GetCell(t( row?.workflowCode&&row?.status&&`WF_${row?.workflowCode?.toUpperCase()}_${row.status}`|| "NA") ), - disableSortBy: true, - } - ]), [] ) + }, + { + Header: t("TL_COMMON_TABLE_COL_APP_DATE"), + disableSortBy: true, + accessor: (row) => GetCell(row.auditDetails.createdTime ? convertEpochToDateDMY(row.auditDetails.createdTime) : ""), + }, + { + Header: t("TL_APPLICATION_TYPE_LABEL"), + disableSortBy: true, + accessor: (row) => GetCell(t(`TL_LOCALIZATION_APPLICATIONTYPE_${row?.workflowCode}`)), + }, + { + Header: t("TL_LICENSE_NUMBERL_LABEL"), + disableSortBy: true, + accessor: (row) => GetCell(row.licenseNumber || "-"), + }, + { + Header: t("TL_LICENSE_YEAR_LABEL"), + disableSortBy: true, + accessor: (row) => GetCell(row.financialYear), + }, + { + Header: t("TL_COMMON_TABLE_COL_TRD_NAME"), + disableSortBy: true, + accessor: (row) => GetCell(row.tradeName || ""), + }, + { + Header: t("TL_LOCALIZATION_TRADE_OWNER_NAME"), + accessor: (row) => GetCell(row.tradeLicenseDetail.owners.map((o) => o.name).join(",") || ""), + disableSortBy: true, + }, + { + Header: t("WF_INBOX_HEADER_CURRENT_OWNER"), + accessor: (row) => GetCell(row.CurrentOwners[0]?.currentOwner || ""), + disableSortBy: true, + }, + { + Header: t("TL_COMMON_TABLE_COL_STATUS"), + accessor: (row) => GetCell(t((row?.workflowCode && row?.status && `WF_${row?.workflowCode?.toUpperCase()}_${row.status}`) || "NA")), + disableSortBy: true, + }, + ], + [] + ); - return -
{t("TL_SEARCH_APPLICATIONS")}
- - - - {data?.display ? - { - t(data.display) - .split("\\n") - .map((text, index) => ( -

- {text} -

- )) - } -
- : data !== "" &&
{ - return { - style: { - minWidth: cellInfo.column.Header === t("ES_INBOX_APPLICATION_NO") ? "240px" : "", - padding: "20px 18px", - fontSize: "16px" - }, - }; - }} - onPageSizeChange={onPageSizeChange} - currentPage={getValues("offset")/getValues("limit")} - onNextPage={nextPage} - onPrevPage={previousPage} - pageSizeLimit={getValues("limit")} - onSort={onSort} - disableSort={false} - sortParams={[{id: getValues("sortBy"), desc: getValues("sortOrder") === "DESC" ? true : false}]} - />} - -} + return ( + +
{t("TL_SEARCH_APPLICATIONS")}
+ + + + {data?.display ? ( + + {t(data.display) + .split("\\n") + .map((text, index) => ( +

+ {text} +

+ ))} +
+ ) : ( + data !== "" && ( +
{ + return { + style: { + minWidth: cellInfo.column.Header === t("ES_INBOX_APPLICATION_NO") ? "240px" : "", + padding: "20px 18px", + fontSize: "16px", + }, + }; + }} + onPageSizeChange={onPageSizeChange} + currentPage={getValues("offset") / getValues("limit")} + onNextPage={nextPage} + onPrevPage={previousPage} + pageSizeLimit={getValues("limit")} + onSort={onSort} + disableSort={false} + sortParams={[{ id: getValues("sortBy"), desc: getValues("sortOrder") === "DESC" ? true : false }]} + /> + ) + )} + + ); +}; -export default SearchApplication \ No newline at end of file +export default SearchApplication; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/tl/src/components/SearchLicense/MobileSearchApplication.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/tl/src/components/SearchLicense/MobileSearchApplication.js index fa94ad335..db3478f11 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/tl/src/components/SearchLicense/MobileSearchApplication.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/tl/src/components/SearchLicense/MobileSearchApplication.js @@ -1,20 +1,9 @@ import React, { Fragment, useCallback, useMemo, useReducer } from "react"; -import { - CloseSvg, - SearchForm, - Table, - Card, - SearchAction, - PopUp, - DetailsCard, - Loader, - Toast, -} from "@egovernments/digit-ui-react-components"; +import { CloseSvg, SearchForm, Table, Card, SearchAction, PopUp, DetailsCard, Loader, Toast } from "@egovernments/digit-ui-react-components"; import SearchFormFields from "./SearchFields"; import { convertEpochToDateDMY, stringReplaceAll } from "../../utils"; -const MobileSearchApplication = ({ Controller, register, control, t, reset, previousPage, handleSubmit, tenantId, data, onSubmit}) => { - +const MobileSearchApplication = ({ Controller, register, control, t, reset, previousPage, handleSubmit, tenantId, data, onSubmit }) => { function activateModal(state, action) { switch (action.type) { case "set": @@ -23,7 +12,7 @@ const MobileSearchApplication = ({ Controller, register, control, t, reset, prev return false; default: break; - } + } } const [currentlyActiveMobileModal, setActiveMobileModal] = useReducer(activateModal, false); @@ -68,27 +57,24 @@ const MobileSearchApplication = ({ Controller, register, control, t, reset, prev [currentlyActiveMobileModal] ); - const propsMobileInboxCards = useMemo( - () => { - if (data?.display){ - return [] - } - if(data === "") - { + const propsMobileInboxCards = useMemo(() => { + if (data?.display) { return []; - } - return data?.map((data) => ({ - [t("TL_TRADE_LICENSE_LABEL")]: data.licenseNumber, - [t("TL_COMMON_TABLE_COL_APP_NO")]: data.applicationNumber, - [t("TL_LOCALIZATION_TRADE_NAME")]: data.tradeName || "", - [t("ES_APPLICATION_SEARCH_ISSUED_DATE")]: data.issuedDate ? convertEpochToDateDMY(data.issuedDate) : "", - [t("ES_APPLICATION_SEARCH_VALID_TO")]: data?.validTo ? convertEpochToDateDMY(data?.validTo) : "-", - [t("TL_HOME_SEARCH_RESULTS__LOCALITY")]: t(`${stringReplaceAll(data.tenantId?.toUpperCase(), ".", "_")}_REVENUE_${data.tradeLicenseDetail.address.locality.code}`) || "", - [t("TL_COMMON_TABLE_COL_STATUS")]: t( data?.workflowCode&&data?.status&&`WF_${data?.workflowCode?.toUpperCase()}_${data.status}`|| "NA") - })) - }, - [data] - ); + } + if (data === "") { + return []; + } + return data?.map((data) => ({ + [t("TL_TRADE_LICENSE_LABEL")]: data.licenseNumber, + [t("TL_COMMON_TABLE_COL_APP_NO")]: data.applicationNumber, + [t("TL_LOCALIZATION_TRADE_NAME")]: data.tradeName || "", + [t("ES_APPLICATION_SEARCH_ISSUED_DATE")]: data.issuedDate ? convertEpochToDateDMY(data.issuedDate) : "", + [t("ES_APPLICATION_SEARCH_VALID_TO")]: data?.validTo ? convertEpochToDateDMY(data?.validTo) : "-", + [t("TL_HOME_SEARCH_RESULTS__LOCALITY")]: + t(`${stringReplaceAll(data.tenantId?.toUpperCase(), ".", "_")}_REVENUE_${data.tradeLicenseDetail.address.locality.code}`) || "", + [t("TL_COMMON_TABLE_COL_STATUS")]: t((data?.workflowCode && data?.status && `WF_${data?.workflowCode?.toUpperCase()}_${data.status}`) || "NA"), + })); + }, [data]); return ( @@ -96,7 +82,7 @@ const MobileSearchApplication = ({ Controller, register, control, t, reset, prev setActiveMobileModal({ type: "set", payload: "SearchFormComponent" })} - {...{tenantId, t}} + {...{ tenantId, t }} /> {/* {isInboxLoading ? : setActiveMobileModal({type:"set", payload:"FilterFormComponent"})}/>} */} {/* setActiveMobileModal({type:"set", payload:"SortComponent"})}/> */} @@ -129,13 +115,13 @@ const MobileSearchApplication = ({ Controller, register, control, t, reset, prev )} - ) -} + ); +}; -export default MobileSearchApplication \ No newline at end of file +export default MobileSearchApplication; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/tl/src/components/SearchLicense/index.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/tl/src/components/SearchLicense/index.js index 641f24f24..c4f09271f 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/tl/src/components/SearchLicense/index.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/tl/src/components/SearchLicense/index.js @@ -1,144 +1,165 @@ -import React, { useCallback, useMemo, useEffect } from "react" +import React, { useCallback, useMemo, useEffect } from "react"; import { useForm, Controller } from "react-hook-form"; -import { TextInput, SubmitBar, LinkLabel, ActionBar, CloseSvg, DatePicker, CardLabelError, SearchForm, Header, SearchField, Dropdown, Table, Card } from "@egovernments/digit-ui-react-components"; +import { + TextInput, + SubmitBar, + LinkLabel, + ActionBar, + CloseSvg, + DatePicker, + CardLabelError, + SearchForm, + Header, + SearchField, + Dropdown, + Table, + Card, +} from "@egovernments/digit-ui-react-components"; import { Link } from "react-router-dom"; import { convertEpochToDateDMY, stringReplaceAll } from "../../utils"; import SearchFields from "./SearchFields"; import MobileSearchApplication from "./MobileSearchApplication"; -const SearchLicense = ({tenantId, t, onSubmit, data, count }) => { - - const initialValues = Digit.SessionStorage.get("SEARCH_APPLICATION_DETAIL")|| { +const SearchLicense = ({ tenantId, t, onSubmit, data, count }) => { + const initialValues = Digit.SessionStorage.get("SEARCH_APPLICATION_DETAIL") || { offset: 0, limit: 10, sortBy: "commencementDate", - sortOrder: "DESC" -}; - const { register, control, handleSubmit, setValue, getValues, reset } = useForm({ - defaultValues: initialValues - }) - useEffect(() => { - register("offset", 0) - register("limit", 10) - register("sortBy", "commencementDate") - register("sortOrder", "DESC") - register("status", "") - //register("RenewalPending", true) - },[register]) + sortOrder: "DESC", + }; + const { register, control, handleSubmit, setValue, getValues, reset } = useForm({ + defaultValues: initialValues, + }); + useEffect(() => { + register("offset", 0); + register("limit", 10); + register("sortBy", "commencementDate"); + register("sortOrder", "DESC"); + register("status", ""); + //register("RenewalPending", true) + }, [register]); - const onSort = useCallback((args) => { - if (args.length === 0) return - setValue("sortBy", args.id) - setValue("sortOrder", args.desc ? "DESC" : "ASC") - }, []) + const onSort = useCallback((args) => { + if (args.length === 0) return; + setValue("sortBy", args.id); + setValue("sortOrder", args.desc ? "DESC" : "ASC"); + }, []); + function onPageSizeChange(e) { + setValue("limit", Number(e.target.value)); + handleSubmit(onSubmit)(); + } - function onPageSizeChange(e){ - setValue("limit",Number(e.target.value)) - handleSubmit(onSubmit)() - } + function nextPage() { + setValue("offset", getValues("offset") + getValues("limit")); + handleSubmit(onSubmit)(); + } + function previousPage() { + setValue("offset", getValues("offset") - getValues("limit")); + handleSubmit(onSubmit)(); + } - function nextPage () { - setValue("offset", getValues("offset") + getValues("limit")) - handleSubmit(onSubmit)() - } - function previousPage () { - setValue("offset", getValues("offset") - getValues("limit") ) - handleSubmit(onSubmit)() - } + const isMobile = window.Digit.Utils.browser.isMobile(); - const isMobile = window.Digit.Utils.browser.isMobile(); + if (isMobile) { + return ; + } - if (isMobile) { - return - } - - const GetCell = (value) => {value}; - const columns = useMemo( () => ([ - { - Header: t("TL_TRADE_LICENSE_LABEL"), - accessor: "licenseNumber", - disableSortBy: true, - Cell: ({ row }) => { - return ( - - ); - }, - }, - { - Header: t("TL_LOCALIZATION_TRADE_NAME"), - disableSortBy: true, - accessor: (row) => GetCell(row.tradeName || ""), + const GetCell = (value) => {value}; + const columns = useMemo( + () => [ + { + Header: t("TL_TRADE_LICENSE_LABEL"), + accessor: "licenseNumber", + disableSortBy: true, + Cell: ({ row }) => { + return ( + + ); }, - { - Header: t("ES_APPLICATION_SEARCH_ISSUED_DATE"), - disableSortBy: true, - accessor: (row) => GetCell(row.issuedDate? convertEpochToDateDMY(row.issuedDate) : ""), - }, - { - Header: t("ES_APPLICATION_SEARCH_VALID_TO"), - disableSortBy: true, - accessor: (row) => GetCell(row.validTo? convertEpochToDateDMY(row.validTo) : ""), - }, - { - Header: t("TL_HOME_SEARCH_RESULTS__LOCALITY"), - disableSortBy: true, - // accessor: (row) => GetCell(row.tradeLicenseDetail.address.locality.name || ""), - accessor: (row) => GetCell( t(`${stringReplaceAll(row.tenantId?.toUpperCase(), ".", "_")}_REVENUE_${row.tradeLicenseDetail.address.locality.code}`) || ""), - }, - { - Header: t("TL_COMMON_TABLE_COL_STATUS"), - accessor: (row) =>GetCell(t( row?.workflowCode&&row?.status&&`WF_${row?.workflowCode?.toUpperCase()}_${row.status}`|| "NA") ), - disableSortBy: true, - } - ]), [] ) + }, + { + Header: t("TL_LOCALIZATION_TRADE_NAME"), + disableSortBy: true, + accessor: (row) => GetCell(row.tradeName || ""), + }, + { + Header: t("ES_APPLICATION_SEARCH_ISSUED_DATE"), + disableSortBy: true, + accessor: (row) => GetCell(row.issuedDate ? convertEpochToDateDMY(row.issuedDate) : ""), + }, + { + Header: t("ES_APPLICATION_SEARCH_VALID_TO"), + disableSortBy: true, + accessor: (row) => GetCell(row.validTo ? convertEpochToDateDMY(row.validTo) : ""), + }, + { + Header: t("TL_HOME_SEARCH_RESULTS__LOCALITY"), + disableSortBy: true, + // accessor: (row) => GetCell(row.tradeLicenseDetail.address.locality.name || ""), + accessor: (row) => + GetCell(t(`${stringReplaceAll(row.tenantId?.toUpperCase(), ".", "_")}_REVENUE_${row.tradeLicenseDetail.address.locality.code}`) || ""), + }, + { + Header: t("TL_COMMON_TABLE_COL_STATUS"), + accessor: (row) => GetCell(t((row?.workflowCode && row?.status && `WF_${row?.workflowCode?.toUpperCase()}_${row.status}`) || "NA")), + disableSortBy: true, + }, + ], + [] + ); - return -
{t("TL_SEARCH_LICENSE")}
- - - - {data?.display ? - { - t(data.display) - .split("\\n") - .map((text, index) => ( -

- {text} -

- )) - } + return ( + +
{t("TL_SEARCH_LICENSE")}
+ + + + {data?.display ? ( + + {t(data.display) + .split("\\n") + .map((text, index) => ( +

+ {text} +

+ ))}
- : data !== "" &&
{ - return { + return { style: { - minWidth: cellInfo.column.Header === t("ES_INBOX_APPLICATION_NO") ? "240px" : "", - padding: "20px 18px", - fontSize: "16px" - }, - }; + minWidth: cellInfo.column.Header === t("ES_INBOX_APPLICATION_NO") ? "240px" : "", + padding: "20px 18px", + fontSize: "16px", + }, + }; }} onPageSizeChange={onPageSizeChange} - currentPage={getValues("offset")/getValues("limit")} + currentPage={getValues("offset") / getValues("limit")} onNextPage={nextPage} onPrevPage={previousPage} pageSizeLimit={getValues("limit")} onSort={onSort} disableSort={false} - sortParams={[{id: getValues("sortBy"), desc: getValues("sortOrder") === "DESC" ? true : false}]} - />} - -} + sortParams={[{ id: getValues("sortBy"), desc: getValues("sortOrder") === "DESC" ? true : false }]} + /> + ) + )} + + ); +}; -export default SearchLicense \ No newline at end of file +export default SearchLicense; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/tl/src/components/TLCard.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/tl/src/components/TLCard.js index c1c9e68ed..a18ff6275 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/tl/src/components/TLCard.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/tl/src/components/TLCard.js @@ -4,72 +4,74 @@ import { useTranslation } from "react-i18next"; import { checkForEmployee } from "../utils"; const TLCard = () => { - sessionStorage.setItem("breadCrumbUrl", "home"); - if (!Digit.Utils.tlAccess()) { - return null; - } - const { t } = useTranslation(); - const tenantId = Digit.ULBService.getCurrentTenantId(); - const inboxSearchParams = { limit: 10, offset: 0 } - const { isLoading, data: inboxData } = Digit.Hooks.tl.useInbox({ - tenantId, - filters: { ...inboxSearchParams }, - config: {} - }); - - const [isStateLocalisation, setIsStateLocalisation] = useState(true); + sessionStorage.setItem("breadCrumbUrl", "home"); + if (!Digit.Utils.tlAccess()) { + return null; + } + const { t } = useTranslation(); + const tenantId = Digit.ULBService.getCurrentTenantId(); + const inboxSearchParams = { limit: 10, offset: 0 }; + const { isLoading, data: inboxData } = Digit.Hooks.tl.useInbox({ + tenantId, + filters: { ...inboxSearchParams }, + config: {}, + }); - useEffect(() => { - if (tenantId && isStateLocalisation) { - setIsStateLocalisation(false); - Digit.LocalizationService.getLocale({ modules: [`rainmaker-${tenantId}`], locale: Digit.StoreData.getCurrentLanguage(), tenantId: `${tenantId}` }); - } - }, [tenantId]); + const [isStateLocalisation, setIsStateLocalisation] = useState(true); + useEffect(() => { + if (tenantId && isStateLocalisation) { + setIsStateLocalisation(false); + Digit.LocalizationService.getLocale({ + modules: [`rainmaker-${tenantId}`], + locale: Digit.StoreData.getCurrentLanguage(), + tenantId: `${tenantId}`, + }); + } + }, [tenantId]); - let links = [ - { - count: isLoading ? "-" : inboxData?.totalCount, - label: t("ES_COMMON_INBOX"), - link: `/digit-ui/employee/tl/inbox`, - }, - { - label: t("TL_NEW_APPLICATION"), - link: "/digit-ui/employee/tl/new-application", - role: "TL_CEMP" - }, - { - label: t("TL_SEARCH_APPLICATIONS"), - link: `/digit-ui/employee/tl/search/application` - }, - { - label: t("TL_SEARCH_LICENSE"), - link: `/digit-ui/employee/tl/search/license`, - role: "TL_CEMP" - } - ] + let links = [ + { + count: isLoading ? "-" : inboxData?.totalCount, + label: t("ES_COMMON_INBOX"), + link: `/mgramseva-digit-ui/employee/tl/inbox`, + }, + { + label: t("TL_NEW_APPLICATION"), + link: "/mgramseva-digit-ui/employee/tl/new-application", + role: "TL_CEMP", + }, + { + label: t("TL_SEARCH_APPLICATIONS"), + link: `/mgramseva-digit-ui/employee/tl/search/application`, + }, + { + label: t("TL_SEARCH_LICENSE"), + link: `/mgramseva-digit-ui/employee/tl/search/license`, + role: "TL_CEMP", + }, + ]; - links = links.filter(link => link.role ? checkForEmployee(link.role) : true); + links = links.filter((link) => (link.role ? checkForEmployee(link.role) : true)); - const propsForModuleCard = { - Icon: , - moduleName: t("TL_COMMON_TL"), - kpis: [ - { - count: isLoading ? "-" : inboxData?.totalCount, - label: t("TOTAL_TL"), - link: `/digit-ui/employee/tl/inbox` - }, - { - count : isLoading ? "-" : inboxData?.nearingSlaCount, - label: t("TOTAL_NEARING_SLA"), - link: `/digit-ui/employee/tl/inbox` - } - ], - links: links - } - return + const propsForModuleCard = { + Icon: , + moduleName: t("TL_COMMON_TL"), + kpis: [ + { + count: isLoading ? "-" : inboxData?.totalCount, + label: t("TOTAL_TL"), + link: `/mgramseva-digit-ui/employee/tl/inbox`, + }, + { + count: isLoading ? "-" : inboxData?.nearingSlaCount, + label: t("TOTAL_NEARING_SLA"), + link: `/mgramseva-digit-ui/employee/tl/inbox`, + }, + ], + links: links, + }; + return ; }; export default TLCard; - diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/tl/src/components/inbox/ApplicationCard.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/tl/src/components/inbox/ApplicationCard.js index f7b08a2b2..3f0fc11b1 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/tl/src/components/inbox/ApplicationCard.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/tl/src/components/inbox/ApplicationCard.js @@ -81,7 +81,7 @@ export const ApplicationCard = ({ ); } @@ -133,9 +133,7 @@ export const ApplicationCard = ({ )} {type === "SORT" && ( -
- {} -
+
{}
)} {type === "SEARCH" && (
diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/tl/src/components/inbox/DesktopInbox.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/tl/src/components/inbox/DesktopInbox.js index d2a56f1eb..3b9bf6766 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/tl/src/components/inbox/DesktopInbox.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/tl/src/components/inbox/DesktopInbox.js @@ -8,14 +8,22 @@ import { Link } from "react-router-dom"; import { convertEpochToDateDMY } from "../../utils"; // import { getActionButton } from "../../utils"; -const DesktopInbox = ({ tableConfig, filterComponent,columns, isLoading, setSearchFieldsBackToOriginalState, setSetSearchFieldsBackToOriginalState, ...props }) => { +const DesktopInbox = ({ + tableConfig, + filterComponent, + columns, + isLoading, + setSearchFieldsBackToOriginalState, + setSetSearchFieldsBackToOriginalState, + ...props +}) => { const { data } = props; const { t } = useTranslation(); const [FilterComponent, setComp] = useState(() => Digit.ComponentRegistryService?.getComponent(filterComponent)); const GetCell = (value) => {value}; const GetSlaCell = (value) => { - if(value === "CS_NA") return t(value) + if (value === "CS_NA") return t(value); if (isNaN(value)) return 0; return value < 0 ? {value} : {value}; }; @@ -36,24 +44,27 @@ const DesktopInbox = ({ tableConfig, filterComponent,columns, isLoading, setSear return (
- {row.original["applicationId"]} + {row.original["applicationId"]}
); - } - },{ + }, + }, + { Header: t("TL_COMMON_TABLE_COL_APP_DATE"), accessor: "applicationDate", Cell: ({ row }) => { const date = convertEpochToDateDMY(row.original.date); - return GetCell(date) - } - },{ + return GetCell(date); + }, + }, + { Header: t("TL_COMMON_TABLE_COL_APP_TYPE"), Cell: ({ row }) => { - return GetCell(t(row.original["businessService"]?`CS_COMMON_INBOX_${row.original["businessService"]?.toUpperCase()}`:"NA")); + return GetCell(t(row.original["businessService"] ? `CS_COMMON_INBOX_${row.original["businessService"]?.toUpperCase()}` : "NA")); }, - },{ + }, + { Header: t("WF_INBOX_HEADER_LOCALITY"), Cell: ({ row }) => { return GetCell(t(Digit.Utils.locale.getRevenueLocalityCode(row.original["locality"], row.original["tenantId"]))); @@ -62,20 +73,23 @@ const DesktopInbox = ({ tableConfig, filterComponent,columns, isLoading, setSear { Header: t("WF_INBOX_HEADER_STATUS"), Cell: ({ row }) => { - return GetCell(t(row.original["businessService"]?`WF_${row.original["businessService"]?.toUpperCase()}_${row.original?.["status"]}`:`NA`)); + return GetCell( + t(row.original["businessService"] ? `WF_${row.original["businessService"]?.toUpperCase()}_${row.original?.["status"]}` : `NA`) + ); }, }, { Header: t("WF_INBOX_HEADER_CURRENT_OWNER"), Cell: ({ row }) => { return GetCell(t(`${row.original?.owner}`)); - } - },{ - Header: t("WF_INBOX_HEADER_SLA_DAYS_REMAINING"), - Cell: ({ row }) => { - return GetSlaCell(row.original["sla"]) + }, + }, + { + Header: t("WF_INBOX_HEADER_SLA_DAYS_REMAINING"), + Cell: ({ row }) => { + return GetSlaCell(row.original["sla"]); + }, }, - } ]; let result; @@ -125,42 +139,47 @@ const DesktopInbox = ({ tableConfig, filterComponent,columns, isLoading, setSear
{!props.isSearch && (
- + headerText={t("ACTION_TEST_TRADELICENSE")} + businessService={props.businessService} + />
- {isLoading ? : + {isLoading ? ( + + ) : ( - } + )}
)} @@ -180,7 +199,7 @@ const DesktopInbox = ({ tableConfig, filterComponent,columns, isLoading, setSear searchFields={props.searchFields} isInboxPage={!props?.isSearch} searchParams={props.searchParams} - {...{setSearchFieldsBackToOriginalState, setSetSearchFieldsBackToOriginalState}} + {...{ setSearchFieldsBackToOriginalState, setSetSearchFieldsBackToOriginalState }} />
{result} diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/tl/src/components/inbox/MobileInbox.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/tl/src/components/inbox/MobileInbox.js index c0ff5eb81..b75053557 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/tl/src/components/inbox/MobileInbox.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/tl/src/components/inbox/MobileInbox.js @@ -27,53 +27,59 @@ const MobileInbox = ({ sortParams, }) => { const { t } = useTranslation(); - const getData = () => data?.table.map(e => ({ - [t("WF_INBOX_HEADER_APPLICATION_NO")]:e?.["applicationId"], - [t("TL_COMMON_TABLE_COL_APP_DATE")]:convertEpochToDateDMY(e?.["date"]), - [t("TL_COMMON_TABLE_COL_APP_TYPE")]:e?.["businessService"]?t(`CS_COMMON_INBOX_${e?.["businessService"]?.toUpperCase()}`):t("NA"), - [t("WF_INBOX_HEADER_LOCALITY")]:t(Digit.Utils.locale.getRevenueLocalityCode(e?.["locality"], e?.["tenantId"])), - [t("WF_INBOX_HEADER_STATUS")]:t(e?.["businessService"]?`WF_${e["businessService"]?.toUpperCase()}_${e?.["status"]}`:`NA`), - [t("WF_INBOX_HEADER_CURRENT_OWNER")]:t(e?.owner), - [t("WF_INBOX_HEADER_SLA_DAYS_REMAINING")]:t(e?.["sla"])})) + const getData = () => + data?.table.map((e) => ({ + [t("WF_INBOX_HEADER_APPLICATION_NO")]: e?.["applicationId"], + [t("TL_COMMON_TABLE_COL_APP_DATE")]: convertEpochToDateDMY(e?.["date"]), + [t("TL_COMMON_TABLE_COL_APP_TYPE")]: e?.["businessService"] ? t(`CS_COMMON_INBOX_${e?.["businessService"]?.toUpperCase()}`) : t("NA"), + [t("WF_INBOX_HEADER_LOCALITY")]: t(Digit.Utils.locale.getRevenueLocalityCode(e?.["locality"], e?.["tenantId"])), + [t("WF_INBOX_HEADER_STATUS")]: t(e?.["businessService"] ? `WF_${e["businessService"]?.toUpperCase()}_${e?.["status"]}` : `NA`), + [t("WF_INBOX_HEADER_CURRENT_OWNER")]: t(e?.owner), + [t("WF_INBOX_HEADER_SLA_DAYS_REMAINING")]: t(e?.["sla"]), + })); return (
- + { const location = useLocation(); const { state } = props.location; @@ -14,7 +13,6 @@ const Response = (props) => { const { data: storeData } = Digit.Hooks.useStore.getInitData(); const { tenants } = storeData || {}; - useEffect(() => { setParams(func.getQueryStringParams(location.search)); }, [location]); @@ -29,41 +27,46 @@ const Response = (props) => { }; const routeToPaymentScreen = async () => { - window.location.assign(`${window.location.origin}/digit-ui/employee/payment/collect/TL/${state?.data?.[0]?.applicationNumber}/${state?.data?.[0]?.tenantId}`); - } + window.location.assign( + `${window.location.origin}/mgramseva-digit-ui/employee/payment/collect/TL/${state?.data?.[0]?.applicationNumber}/${state?.data?.[0]?.tenantId}` + ); + }; return (
- - - - {t("TL_NEW_SUCESS_RESPONSE_NOTIFICATION_LABEL")} -
- - - - - {t("TL_PRINT_APPLICATION_LABEL")} -
- - {state?.data?.[0]?.status !== "PENDINGPAYMENT" ? - - sessionStorage.removeItem("isCreateEnabled")} /> - : - // -
+ + + + {t("TL_NEW_SUCESS_RESPONSE_NOTIFICATION_LABEL")} +
+ + + + + {t("TL_PRINT_APPLICATION_LABEL")} +
+ + { + state?.data?.[0]?.status !== "PENDINGPAYMENT" ? ( + + sessionStorage.removeItem("isCreateEnabled")} /> + + ) : ( + // +
-
- +
+ ) + // } -
-
+ +
); }; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/tl/src/pages/employee/ApplicationDetails.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/tl/src/pages/employee/ApplicationDetails.js index e7db559c2..5f1cbde68 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/tl/src/pages/employee/ApplicationDetails.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/tl/src/pages/employee/ApplicationDetails.js @@ -3,10 +3,10 @@ import { useTranslation } from "react-i18next"; import ApplicationDetailsTemplate from "../../../../templates/ApplicationDetails"; import cloneDeep from "lodash/cloneDeep"; import { useParams } from "react-router-dom"; -import { Header,MultiLink } from "@egovernments/digit-ui-react-components"; +import { Header, MultiLink } from "@egovernments/digit-ui-react-components"; import get from "lodash/get"; import orderBy from "lodash/orderBy"; -import getPDFData from "../../utils/getTLAcknowledgementData" +import getPDFData from "../../utils/getTLAcknowledgementData"; const ApplicationDetails = () => { const { data: storeData } = Digit.Hooks.useStore.getInitData(); @@ -21,11 +21,11 @@ const ApplicationDetails = () => { const [allowedToNextYear, setAllowedToNextYear] = useState(false); const [oldRenewalAppNo, setoldRenewalAppNo] = useState(""); const [latestRenewalYearofAPP, setlatestRenewalYearofAPP] = useState(""); - sessionStorage.setItem("applicationNumber", applicationNumber) + sessionStorage.setItem("applicationNumber", applicationNumber); const { renewalPending: renewalPending } = Digit.Hooks.useQueryParams(); const { isLoading, isError, data: applicationDetails, error } = Digit.Hooks.tl.useApplicationDetail(t, tenantId, applicationNumber); - + const stateId = Digit.ULBService.getStateId(); const { data: TradeRenewalDate = {} } = Digit.Hooks.tl.useTradeLicenseMDMS(stateId, "TradeLicense", ["TradeRenewal"]); @@ -44,7 +44,7 @@ const ApplicationDetails = () => { id: applicationDetails?.applicationData?.applicationNumber, moduleCode: businessService, role: "TL_CEMP", - config:{EditRenewalApplastModifiedTime:EditRenewalApplastModifiedTime}, + config: { EditRenewalApplastModifiedTime: EditRenewalApplastModifiedTime }, }); const closeToast = () => { @@ -54,15 +54,25 @@ const ApplicationDetails = () => { useEffect(() => { if (applicationDetails?.numOfApplications?.length > 0) { let financialYear = cloneDeep(applicationDetails?.applicationData?.financialYear); - const financialYearDate = financialYear?.split('-')[1]; - const finalFinancialYear = `20${Number(financialYearDate)}-${Number(financialYearDate)+1}` - const latestFinancialYear = Math.max.apply(Math, applicationDetails?.numOfApplications?.filter(ob => ob.licenseNumber === applicationDetails?.applicationData?.licenseNumber)?.map(function(o){return parseInt(o.financialYear.split("-")[0])})) - const isAllowedToNextYear = applicationDetails?.numOfApplications?.filter(data => (data.financialYear == finalFinancialYear && data?.status !== "REJECTED")); - if (isAllowedToNextYear?.length > 0){ - setAllowedToNextYear(false); - setoldRenewalAppNo(isAllowedToNextYear?.[0]?.applicationNumber); + const financialYearDate = financialYear?.split("-")[1]; + const finalFinancialYear = `20${Number(financialYearDate)}-${Number(financialYearDate) + 1}`; + const latestFinancialYear = Math.max.apply( + Math, + applicationDetails?.numOfApplications + ?.filter((ob) => ob.licenseNumber === applicationDetails?.applicationData?.licenseNumber) + ?.map(function (o) { + return parseInt(o.financialYear.split("-")[0]); + }) + ); + const isAllowedToNextYear = applicationDetails?.numOfApplications?.filter( + (data) => data.financialYear == finalFinancialYear && data?.status !== "REJECTED" + ); + if (isAllowedToNextYear?.length > 0) { + setAllowedToNextYear(false); + setoldRenewalAppNo(isAllowedToNextYear?.[0]?.applicationNumber); } - if(!(applicationDetails?.applicationData?.financialYear.includes(`${latestFinancialYear}`))) setlatestRenewalYearofAPP(applicationDetails?.applicationData?.financialYear); + if (!applicationDetails?.applicationData?.financialYear.includes(`${latestFinancialYear}`)) + setlatestRenewalYearofAPP(applicationDetails?.applicationData?.financialYear); if (!isAllowedToNextYear || isAllowedToNextYear?.length == 0) setAllowedToNextYear(true); setNumberOfApplications(applicationDetails?.numOfApplications); } @@ -76,27 +86,25 @@ const ApplicationDetails = () => { if (workflowDetails?.data?.processInstances?.length > 0) { let filteredActions = []; - filteredActions = get(workflowDetails?.data?.processInstances[0], "nextActions", [])?.filter( - item => item.action != "ADHOC" - ); + filteredActions = get(workflowDetails?.data?.processInstances[0], "nextActions", [])?.filter((item) => item.action != "ADHOC"); let actions = orderBy(filteredActions, ["action"], ["desc"]); if ((!actions || actions?.length == 0) && workflowDetails?.data?.actionState) workflowDetails.data.actionState.nextActions = []; - workflowDetails?.data?.actionState?.nextActions?.forEach(data => { - if(data.action == "RESUBMIT") { - data.redirectionUrl = { - pathname: `/digit-ui/employee/tl/edit-application-details/${applicationNumber}`, - state: applicationDetails - }, - data.tenantId = stateId + workflowDetails?.data?.actionState?.nextActions?.forEach((data) => { + if (data.action == "RESUBMIT") { + (data.redirectionUrl = { + pathname: `/mgramseva-digit-ui/employee/tl/edit-application-details/${applicationNumber}`, + state: applicationDetails, + }), + (data.tenantId = stateId); } - }) + }); } - const userInfo = Digit.UserService.getUser(); - const rolearray = userInfo?.info?.roles.filter(item => { - if ((item.code == "TL_CEMP" && item.tenantId === tenantId) || item.code == "CITIZEN" ) return true; }); + const rolearray = userInfo?.info?.roles.filter((item) => { + if ((item.code == "TL_CEMP" && item.tenantId === tenantId) || item.code == "CITIZEN") return true; + }); const rolecheck = rolearray.length > 0 ? true : false; const validTo = applicationDetails?.applicationData?.validTo; @@ -105,38 +113,44 @@ const ApplicationDetails = () => { const renewalPeriod = TradeRenewalDate?.TradeLicense?.TradeRenewal?.[0]?.renewalPeriod; const getToastMessages = () => { - if(allowedToNextYear == false && oldRenewalAppNo && applicationDetails?.applicationData?.status !== "MANUALEXPIRED") - { + if (allowedToNextYear == false && oldRenewalAppNo && applicationDetails?.applicationData?.status !== "MANUALEXPIRED") { return `${t("TL_ERROR_TOAST_RENEWAL_1")} ${oldRenewalAppNo} ${t("TL_ERROR_TOAST_RENEWAL_2")}`; - } - else if(applicationDetails?.applicationData?.status === "CANCELLED") - { - return `${t("TL_ERROR_TOAST_RENEWAL_CANCEL")}` - } - else if((/* latestRenewalYearofAPP && */ applicationDetails?.applicationData?.status === "MANUALEXPIRED")) - { + } else if (applicationDetails?.applicationData?.status === "CANCELLED") { + return `${t("TL_ERROR_TOAST_RENEWAL_CANCEL")}`; + } else if (/* latestRenewalYearofAPP && */ applicationDetails?.applicationData?.status === "MANUALEXPIRED") { return `${t("TL_ERROR_TOAST_MUTUALLY_EXPIRED")}`; } - } + }; - if (rolecheck && (applicationDetails?.applicationData?.status === "APPROVED" || applicationDetails?.applicationData?.status === "EXPIRED" || applicationDetails?.applicationData?.status === "CANCELLED" || (applicationDetails?.applicationData?.status === "MANUALEXPIRED" /* && renewalPending==="true" */)) /* && duration <= renewalPeriod */) { - if(workflowDetails?.data /* && allowedToNextYear */) { - if(!workflowDetails?.data?.actionState) { + if ( + rolecheck && + (applicationDetails?.applicationData?.status === "APPROVED" || + applicationDetails?.applicationData?.status === "EXPIRED" || + applicationDetails?.applicationData?.status === "CANCELLED" || + applicationDetails?.applicationData?.status === "MANUALEXPIRED" /* && renewalPending==="true" */) /* && duration <= renewalPeriod */ + ) { + if (workflowDetails?.data /* && allowedToNextYear */) { + if (!workflowDetails?.data?.actionState) { workflowDetails.data.actionState = {}; workflowDetails.data.actionState.nextActions = []; } - const flagData = workflowDetails?.data?.actionState?.nextActions?.filter(data => data.action == "RENEWAL_SUBMIT_BUTTON"); - if(flagData && flagData.length === 0) { + const flagData = workflowDetails?.data?.actionState?.nextActions?.filter((data) => data.action == "RENEWAL_SUBMIT_BUTTON"); + if (flagData && flagData.length === 0) { workflowDetails?.data?.actionState?.nextActions?.push({ action: "RENEWAL_SUBMIT_BUTTON", - isToast : allowedToNextYear == false || applicationDetails?.applicationData?.status === "CANCELLED" || (applicationDetails?.applicationData?.status === "MANUALEXPIRED" /* && latestRenewalYearofAPP */) ? true : false, - toastMessage : getToastMessages(), + isToast: + allowedToNextYear == false || + applicationDetails?.applicationData?.status === "CANCELLED" || + applicationDetails?.applicationData?.status === "MANUALEXPIRED" /* && latestRenewalYearofAPP */ + ? true + : false, + toastMessage: getToastMessages(), redirectionUrl: { - pathname: `/digit-ui/employee/tl/renew-application-details/${applicationNumber}`, - state: applicationDetails + pathname: `/mgramseva-digit-ui/employee/tl/renew-application-details/${applicationNumber}`, + state: applicationDetails, }, tenantId: stateId, - role: [] + role: [], }); } // workflowDetails = { @@ -148,7 +162,7 @@ const ApplicationDetails = () => { // { // action: "RENEWAL_SUBMIT_BUTTON", // redirectionUrl: { - // pathname: `/digit-ui/employee/tl/renew-application-details/${applicationNumber}`, + // pathname: `/mgramseva-digit-ui/employee/tl/renew-application-details/${applicationNumber}`, // state: applicationDetails // }, // tenantId: stateId, @@ -161,100 +175,110 @@ const ApplicationDetails = () => { } if (rolearray && applicationDetails?.applicationData?.status === "PENDINGPAYMENT") { - workflowDetails?.data?.nextActions?.map(data => { - if (data.action === "PAY") { - workflowDetails = { - ...workflowDetails, - data: { - ...workflowDetails?.data, - actionState: { - nextActions: [ - { - action: data.action, - redirectionUrll: { - pathname: `TL/${applicationDetails?.applicationData?.applicationNumber}/${tenantId}`, - state: tenantId - }, - tenantId: tenantId, - } - ], - }, + workflowDetails?.data?.nextActions?.map((data) => { + if (data.action === "PAY") { + workflowDetails = { + ...workflowDetails, + data: { + ...workflowDetails?.data, + actionState: { + nextActions: [ + { + action: data.action, + redirectionUrll: { + pathname: `TL/${applicationDetails?.applicationData?.applicationNumber}/${tenantId}`, + state: tenantId, + }, + tenantId: tenantId, + }, + ], }, - }; - } - }) - }; + }, + }; + } + }); + } const wfDocs = workflowDetails.data?.timeline?.reduce((acc, { wfDocuments }) => { return wfDocuments ? [...acc, ...wfDocuments] : acc; }, []); - const ownerdetails = applicationDetails?.applicationDetails.find(e => e.title === "ES_NEW_APPLICATION_OWNERSHIP_DETAILS"); + const ownerdetails = applicationDetails?.applicationDetails.find((e) => e.title === "ES_NEW_APPLICATION_OWNERSHIP_DETAILS"); let appdetailsDocuments = ownerdetails?.additionalDetails?.documents; - if(appdetailsDocuments && wfDocs?.length && !(appdetailsDocuments.find(e => e.title === "TL_WORKFLOW_DOCS"))){ - ownerdetails.additionalDetails.documents = [...ownerdetails.additionalDetails.documents,{ - title: "TL_WORKFLOW_DOCS", - values: wfDocs?.map?.((e) => ({ ...e, title: e.documentType})), - }]; + if (appdetailsDocuments && wfDocs?.length && !appdetailsDocuments.find((e) => e.title === "TL_WORKFLOW_DOCS")) { + ownerdetails.additionalDetails.documents = [ + ...ownerdetails.additionalDetails.documents, + { + title: "TL_WORKFLOW_DOCS", + values: wfDocs?.map?.((e) => ({ ...e, title: e.documentType })), + }, + ]; } - const handleDownloadPdf = async () => { - const tenantInfo = tenants.find((tenant) => tenant.code === applicationDetails.tenantId); - const data = await getPDFData(applicationDetails?.applicationData, tenantInfo, t); - //data.then((ress) => Digit.Utils.pdf.generate(ress)); - Digit.Utils.pdf.generate(data); - setIsDisplayDownloadMenu(false) - }; + const handleDownloadPdf = async () => { + const tenantInfo = tenants.find((tenant) => tenant.code === applicationDetails.tenantId); + const data = await getPDFData(applicationDetails?.applicationData, tenantInfo, t); + //data.then((ress) => Digit.Utils.pdf.generate(ress)); + Digit.Utils.pdf.generate(data); + setIsDisplayDownloadMenu(false); + }; - const printReciept = async (businessService="TL", consumerCode=applicationDetails?.applicationData?.applicationNumber) => { - await Digit.Utils.downloadReceipt(consumerCode, businessService, 'tradelicense-receipt'); - setIsDisplayDownloadMenu(false) + const printReciept = async (businessService = "TL", consumerCode = applicationDetails?.applicationData?.applicationNumber) => { + await Digit.Utils.downloadReceipt(consumerCode, businessService, "tradelicense-receipt"); + setIsDisplayDownloadMenu(false); }; const printCertificate = async () => { - let res = await Digit.TLService.TLsearch({ tenantId: applicationDetails?.tenantId, filters: { applicationNumber:applicationDetails?.applicationData?.applicationNumber } }); - const TLcertificatefile = await Digit.PaymentService.generatePdf(tenantId, { Licenses: res?.Licenses }, "tlcertificate"); - const receiptFile = await Digit.PaymentService.printReciept(tenantId, { fileStoreIds: TLcertificatefile.filestoreIds[0] }); - window.open(receiptFile[TLcertificatefile.filestoreIds[0]], "_blank"); - setIsDisplayDownloadMenu(false) - } + let res = await Digit.TLService.TLsearch({ + tenantId: applicationDetails?.tenantId, + filters: { applicationNumber: applicationDetails?.applicationData?.applicationNumber }, + }); + const TLcertificatefile = await Digit.PaymentService.generatePdf(tenantId, { Licenses: res?.Licenses }, "tlcertificate"); + const receiptFile = await Digit.PaymentService.printReciept(tenantId, { fileStoreIds: TLcertificatefile.filestoreIds[0] }); + window.open(receiptFile[TLcertificatefile.filestoreIds[0]], "_blank"); + setIsDisplayDownloadMenu(false); + }; const [isDisplayDownloadMenu, setIsDisplayDownloadMenu] = useState(false); - const applicationStatus = applicationDetails?.applicationData?.status - + const applicationStatus = applicationDetails?.applicationData?.status; + const dowloadOptions = - applicationStatus==="APPROVED" + applicationStatus === "APPROVED" ? [ - { - label: t("TL_CERTIFICATE"), - onClick: printCertificate, - }, - { - label: t("TL_RECEIPT"), - onClick: printReciept, - }, - { - label: t("TL_APPLICATION"), - onClick: handleDownloadPdf, - } - ] + { + label: t("TL_CERTIFICATE"), + onClick: printCertificate, + }, + { + label: t("TL_RECEIPT"), + onClick: printReciept, + }, + { + label: t("TL_APPLICATION"), + onClick: handleDownloadPdf, + }, + ] : [ - { - label: t("TL_APPLICATION"), - onClick: handleDownloadPdf, - }, - ]; + { + label: t("TL_APPLICATION"), + onClick: handleDownloadPdf, + }, + ]; return ( -
+
-
{(applicationDetails?.applicationData?.workflowCode == "NewTL" && applicationDetails?.applicationData?.status !== "APPROVED") ? t("TL_TRADE_APPLICATION_DETAILS_LABEL") : t("TL_TRADE_LICENSE_DETAILS_LABEL")}
+
+ {applicationDetails?.applicationData?.workflowCode == "NewTL" && applicationDetails?.applicationData?.status !== "APPROVED" + ? t("TL_TRADE_APPLICATION_DETAILS_LABEL") + : t("TL_TRADE_LICENSE_DETAILS_LABEL")} +
setIsDisplayDownloadMenu(!isDisplayDownloadMenu)} - displayOptions={isDisplayDownloadMenu} - options={dowloadOptions} - downloadBtnClassName={"employee-download-btn-className"} - optionsClassName={"employee-options-btn-className"} - optionStyle={{padding: "10px"}} + className="multilinkWrapper employee-mulitlink-main-div" + onHeadClick={() => setIsDisplayDownloadMenu(!isDisplayDownloadMenu)} + displayOptions={isDisplayDownloadMenu} + options={dowloadOptions} + downloadBtnClassName={"employee-download-btn-className"} + optionsClassName={"employee-options-btn-className"} + optionStyle={{ padding: "10px" }} />
{ // delete const [propertyId, setPropertyId] = useState(new URLSearchParams(useLocation().search).get("propertyId")); const isEmpNewApplication = window.location.href.includes("/employee/tl/new-application"); - const isEmpRenewLicense = window.location.href.includes("/employee/tl/renew-application-details") || window.location.href.includes("/employee/tl/edit-application-details"); + const isEmpRenewLicense = + window.location.href.includes("/employee/tl/renew-application-details") || window.location.href.includes("/employee/tl/edit-application-details"); const [sessionFormData, setSessionFormData, clearSessionFormData] = Digit.Hooks.useSessionStorage("PT_CREATE_EMP_TRADE_NEW_FORM", {}); const [mutationHappened, setMutationHappened, clear] = Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_HAPPENED", false); @@ -38,29 +39,24 @@ const NewApplication = () => { }; useEffect(() => { - if(sessionStorage.getItem("isCreateEnabledEmployee") === "true") - { + if (sessionStorage.getItem("isCreateEnabledEmployee") === "true") { sessionStorage.removeItem("isCreateEnabledEmployee"); history.replace("/employee"); - } - else - sessionStorage.removeItem("isCreateEnabledEmployee"); - - }) + } else sessionStorage.removeItem("isCreateEnabledEmployee"); + }); useEffect(() => { setMutationHappened(false); clearSuccessData(); }, []); - function checkforownerPresent(formData){ - if(formData?.owners){ + function checkforownerPresent(formData) { + if (formData?.owners) { formData?.owners?.map((ob) => { - if(!ob?.name || !ob.mobileNumber || !ob?.fatherOrHusbandName || !ob?.relationship?.code || ob?.gender?.code) - { + if (!ob?.name || !ob.mobileNumber || !ob?.fatherOrHusbandName || !ob?.relationship?.code || ob?.gender?.code) { return true; } - }) + }); return false; } } @@ -69,11 +65,9 @@ const NewApplication = () => { if (!_.isEqual(sessionFormData, formData)) { setSessionFormData({ ...sessionFormData, ...formData }); } - if(checkforownerPresent(formData)) - { + if (checkforownerPresent(formData)) { setSubmitValve(false); - } - else if ( + } else if ( Object.keys(formState.errors).length > 0 && Object.keys(formState.errors).length == 1 && formState.errors["owners"] && @@ -85,17 +79,16 @@ const NewApplication = () => { } }; const onSubmit = (data) => { - let isSameAsPropertyOwner = sessionStorage.getItem("isSameAsPropertyOwner"); - if(data?.cpt?.id){ + let isSameAsPropertyOwner = sessionStorage.getItem("isSameAsPropertyOwner"); + if (data?.cpt?.id) { if (!data?.cpt?.details || !propertyDetails) { - setShowToast({ key: "error" }); - setError(t("ERR_INVALID_PROPERTY_ID")); - return; - } + setShowToast({ key: "error" }); + setError(t("ERR_INVALID_PROPERTY_ID")); + return; + } } const foundValue = tenants?.find((obj) => obj.pincode?.find((item) => item.toString() === data?.address?.pincode)); - if(!foundValue && data?.address?.pincode) - { + if (!foundValue && data?.address?.pincode) { setShowToast({ key: "error" }); setError(t("TL_COMMON_PINCODE_NOT_SERVICABLE")); return; @@ -140,8 +133,10 @@ const NewApplication = () => { if (data?.cpt?.details?.address) { address.city = data?.cpt?.details?.address?.city || null; address.locality = { code: data?.cpt?.details?.address?.locality?.code || null }; - if (data?.cpt?.details?.address?.doorNo || data?.address?.doorNo) address.doorNo = data?.cpt?.details?.address?.doorNo || data?.address?.doorNo || null; - if (data?.cpt?.details?.address?.street || data?.address?.street) address.street = data?.cpt?.details?.address?.street || data?.address?.street || null; + if (data?.cpt?.details?.address?.doorNo || data?.address?.doorNo) + address.doorNo = data?.cpt?.details?.address?.doorNo || data?.address?.doorNo || null; + if (data?.cpt?.details?.address?.street || data?.address?.street) + address.street = data?.cpt?.details?.address?.street || data?.address?.street || null; if (data?.cpt?.details?.address?.pincode) address.pincode = data?.cpt?.details?.address?.pincode; } else if (data?.address) { address.city = data?.address?.city?.code || null; @@ -218,11 +213,10 @@ const NewApplication = () => { formData.tradeLicenseDetail.institution["name"] = data?.owners?.[0]?.name; if (data?.owners?.length && subOwnerShipCategory.includes("INSTITUTIONAL")) formData.tradeLicenseDetail.institution["contactNo"] = data?.owners?.[0]?.altContactNumber; - if (data?.cpt) - { - formData.tradeLicenseDetail.additionalDetail.propertyId = data?.cpt?.details?.propertyId, - formData.tradeLicenseDetail.additionalDetail.isSameAsPropertyOwner = isSameAsPropertyOwner - }; + if (data?.cpt) { + (formData.tradeLicenseDetail.additionalDetail.propertyId = data?.cpt?.details?.propertyId), + (formData.tradeLicenseDetail.additionalDetail.isSameAsPropertyOwner = isSameAsPropertyOwner); + } // setFormData(formData) /* use customiseCreateFormData hook to make some chnages to the licence object */ @@ -238,8 +232,8 @@ const NewApplication = () => { .then((response) => { if (response?.Licenses?.length > 0) { // setTimeout(() => window.location.reload()); - sessionStorage.setItem("isCreateEnabledEmployee","true"); - history.replace(`/digit-ui/employee/tl/response`, { data: response?.Licenses }); + sessionStorage.setItem("isCreateEnabledEmployee", "true"); + history.replace(`/mgramseva-digit-ui/employee/tl/response`, { data: response?.Licenses }); clearSessionFormData(); } }) @@ -254,9 +248,9 @@ const NewApplication = () => { setError(e?.response?.data?.Errors[0]?.message || null); }); - // history.replace("/digit-ui/employee/tl/response", { Licenses: [formData], documents: applicationDocuments }); - // history.push("/digit-ui/employee/pt/response", { Property: formData }); - // history.push("/digit-ui/employee/pt/response", { Property: _formData }); + // history.replace("/mgramseva-digit-ui/employee/tl/response", { Licenses: [formData], documents: applicationDocuments }); + // history.push("/mgramseva-digit-ui/employee/pt/response", { Property: formData }); + // history.push("/mgramseva-digit-ui/employee/pt/response", { Property: _formData }); }; // let configs = newConfig; let configs = []; @@ -272,10 +266,13 @@ const NewApplication = () => { return "TL_CHECK_ADDRESS"; } else if (head === "ES_NEW_APPLICATION_OWNERSHIP_DETAILS") { return "TL_OWNERSHIP_DETAILS_HEADER"; - } else if (head === "TL_NEW_APPLICATION_PROPERTY" && (sessionFormData?.tradedetils?.[0]?.structureType?.code === "MOVABLE" && (isEmpNewApplication || isEmpRenewLicense))) { + } else if ( + head === "TL_NEW_APPLICATION_PROPERTY" && + sessionFormData?.tradedetils?.[0]?.structureType?.code === "MOVABLE" && + (isEmpNewApplication || isEmpRenewLicense) + ) { return ""; - } - else { + } else { return head; } } diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/tl/src/pages/employee/ReNewApplication/index.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/tl/src/pages/employee/ReNewApplication/index.js index 802e6a40f..a48b3cd9d 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/tl/src/pages/employee/ReNewApplication/index.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/tl/src/pages/employee/ReNewApplication/index.js @@ -8,17 +8,19 @@ import { newConfig as newConfigTL } from "../../../config/config"; const ReNewApplication = (props) => { const applicationData = cloneDeep(props?.location?.state?.applicationData) || {}; - const loc=useLocation(); - const propertyId =new URLSearchParams(loc.search).get("propertyId")|| loc?.state?.applicationDetails - .find((details)=>details?.title === "PT_DETAILS")?.values - .find((value)=> value?.title === "TL_PROPERTY_ID")?.value; + const loc = useLocation(); + const propertyId = + new URLSearchParams(loc.search).get("propertyId") || + loc?.state?.applicationDetails.find((details) => details?.title === "PT_DETAILS")?.values.find((value) => value?.title === "TL_PROPERTY_ID") + ?.value; const tenantId = Digit.ULBService.getCurrentTenantId(); const { t } = useTranslation(); const [canSubmit, setSubmitValve] = useState(false); let { data: newConfig, isLoading } = Digit.Hooks.tl.useMDMS.getFormConfig(tenantId?.split?.(".")?.[0], {}); - const { - data: propertyDetails - } = Digit.Hooks.pt.usePropertySearch({ filters: { propertyIds: propertyId }, tenantId: tenantId }, { filters: { propertyIds: propertyId }, tenantId: tenantId }); + const { data: propertyDetails } = Digit.Hooks.pt.usePropertySearch( + { filters: { propertyIds: propertyId }, tenantId: tenantId }, + { filters: { propertyIds: propertyId }, tenantId: tenantId } + ); const history = useHistory(); // delete @@ -26,7 +28,8 @@ const ReNewApplication = (props) => { const [mutationHappened, setMutationHappened, clear] = Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_HAPPENED", false); const [successData, setsuccessData, clearSuccessData] = Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_SUCCESS_DATA", {}); const isEmpNewApplication = window.location.href.includes("/employee/tl/new-application"); - const isEmpRenewLicense = window.location.href.includes("/employee/tl/renew-application-details") || window.location.href.includes("/employee/tl/edit-application-details"); + const isEmpRenewLicense = + window.location.href.includes("/employee/tl/renew-application-details") || window.location.href.includes("/employee/tl/edit-application-details"); const [showToast, setShowToast] = useState(null); const [error, setError] = useState(null); @@ -56,7 +59,7 @@ const ReNewApplication = (props) => { code: applicationData?.tradeLicenseDetail?.structureType, }, commencementDate: convertEpochToDate(applicationData?.commencementDate), - gstNo: applicationData?.tradeLicenseDetail?.additionalDetail?.gstNo || applicationData?.tradeLicenseDetail?.additionalDetail?.tradeGstNo || "", + gstNo: applicationData?.tradeLicenseDetail?.additionalDetail?.gstNo || applicationData?.tradeLicenseDetail?.additionalDetail?.tradeGstNo || "", operationalArea: applicationData?.tradeLicenseDetail?.operationalArea || "", noOfEmployees: applicationData?.tradeLicenseDetail?.noOfEmployees || "", key: Date.now(), @@ -99,17 +102,26 @@ const ReNewApplication = (props) => { data.key = Date.now() + (index + 1) * 20; }); } - if(applicationData?.tradeLicenseDetail){ - applicationData.tradeLicenseDetail["address"]=applicationData?.tradeLicenseDetail?.address||{}; - applicationData.tradeLicenseDetail.address.locality = { - ...applicationData?.tradeLicenseDetail?.address?.locality, - ...{ i18nkey: applicationData?.tradeLicenseDetail?.address?.locality?.name }, - }; + if (applicationData?.tradeLicenseDetail) { + applicationData.tradeLicenseDetail["address"] = applicationData?.tradeLicenseDetail?.address || {}; + applicationData.tradeLicenseDetail.address.locality = { + ...applicationData?.tradeLicenseDetail?.address?.locality, + ...{ i18nkey: applicationData?.tradeLicenseDetail?.address?.locality?.name }, + }; } const ownershipCategory = { code: applicationData?.tradeLicenseDetail?.subOwnerShipCategory, - i18nKey: `COMMON_MASTERS_OWNERSHIPCATEGORY_INDIVIDUAL_${applicationData?.tradeLicenseDetail?.subOwnerShipCategory?.includes("INSTITUTIONAL") ? (applicationData?.tradeLicenseDetail?.subOwnerShipCategory?.includes("GOVERNMENT") ?"OTHERGOVERNMENTINSTITUITION":"OTHERSPRIVATEINSTITUITION"):applicationData?.tradeLicenseDetail?.subOwnerShipCategory?.split(".")[1]}`, - isSameAsPropertyOwner: applicationData?.tradeLicenseDetail?.additionalDetail?.isSameAsPropertyOwner === "null" ? null : applicationData?.tradeLicenseDetail?.additionalDetail?.isSameAsPropertyOwner, + i18nKey: `COMMON_MASTERS_OWNERSHIPCATEGORY_INDIVIDUAL_${ + applicationData?.tradeLicenseDetail?.subOwnerShipCategory?.includes("INSTITUTIONAL") + ? applicationData?.tradeLicenseDetail?.subOwnerShipCategory?.includes("GOVERNMENT") + ? "OTHERGOVERNMENTINSTITUITION" + : "OTHERSPRIVATEINSTITUITION" + : applicationData?.tradeLicenseDetail?.subOwnerShipCategory?.split(".")[1] + }`, + isSameAsPropertyOwner: + applicationData?.tradeLicenseDetail?.additionalDetail?.isSameAsPropertyOwner === "null" + ? null + : applicationData?.tradeLicenseDetail?.additionalDetail?.isSameAsPropertyOwner, }; if (applicationData?.tradeLicenseDetail?.owners?.length > 0) { @@ -124,27 +136,27 @@ const ReNewApplication = (props) => { }); } - let clonedData = cloneDeep(props?.location?.state?.applicationData)||{}; + let clonedData = cloneDeep(props?.location?.state?.applicationData) || {}; clonedData.checkForRenewal = false; const getOwners = (application) => { - if(application?.tradeLicenseDetail?.subOwnerShipCategory?.includes("INSTITUTIONAL")) - { + if (application?.tradeLicenseDetail?.subOwnerShipCategory?.includes("INSTITUTIONAL")) { let owner = []; - owner.push({...application?.tradeLicenseDetail?.owners[0], - instituionName:application?.tradeLicenseDetail?.institution?.instituionName, - name:application?.tradeLicenseDetail?.institution?.name, - altContactNumber:application?.tradeLicenseDetail?.institution?.contactNo, - designation:application?.tradeLicenseDetail?.institution?.designation, - subOwnerShipCategory:{ + owner.push({ + ...application?.tradeLicenseDetail?.owners[0], + instituionName: application?.tradeLicenseDetail?.institution?.instituionName, + name: application?.tradeLicenseDetail?.institution?.name, + altContactNumber: application?.tradeLicenseDetail?.institution?.contactNo, + designation: application?.tradeLicenseDetail?.institution?.designation, + subOwnerShipCategory: { code: applicationData?.tradeLicenseDetail?.subOwnerShipCategory, i18nKey: `COMMON_MASTERS_OWNERSHIPCATEGORY_${stringReplaceAll(applicationData?.tradeLicenseDetail?.subOwnerShipCategory, ".", "_")}`, }, - }) + }); return owner; } return applicationData?.tradeLicenseDetail?.owners; - } + }; const defaultValues = { tradedetils1: clonedData, @@ -153,10 +165,10 @@ const ReNewApplication = (props) => { accessories: applicationData?.tradeLicenseDetail?.accessories, address: applicationData?.tradeLicenseDetail?.address || {}, ownershipCategory: ownershipCategory, - owners: getOwners(applicationData)|| [], + owners: getOwners(applicationData) || [], documents: { documents: applicationData?.tradeLicenseDetail?.applicationDocuments || [] }, - cptId: {id: propertyId}, - cpt: {details:propertyDetails?.Properties?.[0]} + cptId: { id: propertyId }, + cpt: { details: propertyDetails?.Properties?.[0] }, // applicationData: cloneDeep(props?.location?.state?.applicationData) }; @@ -171,12 +183,15 @@ const ReNewApplication = (props) => { }, []); const onFormValueChange = (setValue, formData, formState) => { - if(sessionStorage.getItem("isBillingSlabError") === "true") - setSubmitValve(false); - else if(Object.keys(formState.errors).length > 0 && Object.keys(formState.errors).length == 1 && formState.errors["owners"] && Object.values(formState.errors["owners"].type).filter((ob) => ob.type === "required").length ==0) - setSubmitValve(true); - else - setSubmitValve(!(Object.keys(formState.errors).length)); + if (sessionStorage.getItem("isBillingSlabError") === "true") setSubmitValve(false); + else if ( + Object.keys(formState.errors).length > 0 && + Object.keys(formState.errors).length == 1 && + formState.errors["owners"] && + Object.values(formState.errors["owners"].type).filter((ob) => ob.type === "required").length == 0 + ) + setSubmitValve(true); + else setSubmitValve(!Object.keys(formState.errors).length); }; const onSubmit = (data) => { @@ -187,12 +202,12 @@ const ReNewApplication = (props) => { // return; // } // }; - if(data?.cpt?.id){ + if (data?.cpt?.id) { if (!data?.cpt?.details || !propertyDetails) { - setShowToast({ key: "error" }); - setError(t("ERR_INVALID_PROPERTY_ID")); - return; - } + setShowToast({ key: "error" }); + setError(t("ERR_INVALID_PROPERTY_ID")); + return; + } } let EDITRENEWAL = data?.tradedetils1?.checkForRenewal; @@ -223,7 +238,7 @@ const ReNewApplication = (props) => { if (data?.tradeUnits?.length > 0) { data?.tradeUnits.forEach((data) => { - (data.tradeType = data?.tradeSubType?.code || null), + (data.tradeType = data?.tradeSubType?.code || null), (data.uom = data?.tradeSubType?.uom || null), (data.uomValue = Number(data?.uomValue) || null); }); @@ -268,7 +283,7 @@ const ReNewApplication = (props) => { } if (!data?.address) { data.address = {}; - data.address = data?.tradedetils1?.tradeLicenseDetail?.address || {} + data.address = data?.tradedetils1?.tradeLicenseDetail?.address || {}; } else { data.address.city = data?.address?.city?.code || null; } @@ -279,9 +294,12 @@ const ReNewApplication = (props) => { if (data?.tradedetils1?.tradeLicenseDetail.address.street !== data?.address?.street) { EDITRENEWAL = true; } - if( new URLSearchParams(loc.search).get("propertyId") && new URLSearchParams(loc.search).get("propertyId")!== loc?.state?.applicationDetails - .find((details)=>details?.title === "PT_DETAILS")?.values - .find((value)=> value?.title === "TL_PROPERTY_ID")?.value){ + if ( + new URLSearchParams(loc.search).get("propertyId") && + new URLSearchParams(loc.search).get("propertyId") !== + loc?.state?.applicationDetails.find((details) => details?.title === "PT_DETAILS")?.values.find((value) => value?.title === "TL_PROPERTY_ID") + ?.value + ) { EDITRENEWAL = true; } let applicationDocuments = data?.documents?.documents || []; @@ -314,23 +332,31 @@ const ReNewApplication = (props) => { if (data?.tradeUnits?.length > 0) formData.tradeLicenseDetail.tradeUnits = data?.tradeUnits; if (data?.owners?.length > 0) formData.tradeLicenseDetail.owners = data?.owners; if (structureType) formData.tradeLicenseDetail.structureType = structureType; - if (subOwnerShipCategory|| data?.owners?.[0]?.subOwnerShipCategory?.code) formData.tradeLicenseDetail.subOwnerShipCategory = formData?.tradeLicenseDetail?.owners?.[0]?.subOwnerShipCategory?.code?.includes("INSTITUTIONAL") ? data?.owners?.[0]?.subOwnerShipCategory.code : subOwnerShipCategory; - if (formData?.tradeLicenseDetail?.owners?.[0]?.subOwnerShipCategory?.code?.includes("INSTITUTIONAL")) formData.tradeLicenseDetail.institution = { - ...formData?.tradeLicenseDetail?.institution, - contactNo: data?.owners?.[0]?.altContactNumber, - designation: data?.owners?.[0]?.designation, - instituionName: data?.owners?.[0]?.instituionName, - name: data?.owners?.[0]?.name, - mobileNumber: data?.owners?.[0]?.mobileNumber, - emailId : data?.owners?.[0]?.emailId, - } + if (subOwnerShipCategory || data?.owners?.[0]?.subOwnerShipCategory?.code) + formData.tradeLicenseDetail.subOwnerShipCategory = formData?.tradeLicenseDetail?.owners?.[0]?.subOwnerShipCategory?.code?.includes( + "INSTITUTIONAL" + ) + ? data?.owners?.[0]?.subOwnerShipCategory.code + : subOwnerShipCategory; + if (formData?.tradeLicenseDetail?.owners?.[0]?.subOwnerShipCategory?.code?.includes("INSTITUTIONAL")) + formData.tradeLicenseDetail.institution = { + ...formData?.tradeLicenseDetail?.institution, + contactNo: data?.owners?.[0]?.altContactNumber, + designation: data?.owners?.[0]?.designation, + instituionName: data?.owners?.[0]?.instituionName, + name: data?.owners?.[0]?.name, + mobileNumber: data?.owners?.[0]?.mobileNumber, + emailId: data?.owners?.[0]?.emailId, + }; /* use customiseCreateFormData hook to make some chnages to the licence object */ - formData = Digit?.Customizations?.TL?.customiseSendbackFormData ? Digit?.Customizations?.TL?.customiseSendbackFormData(data, formData) : formData; + formData = Digit?.Customizations?.TL?.customiseSendbackFormData + ? Digit?.Customizations?.TL?.customiseSendbackFormData(data, formData) + : formData; Digit.TLService.update({ Licenses: [formData] }, tenantId) .then((result, err) => { if (result?.Licenses?.length > 0) { if (result?.Licenses?.length > 0) { - history.replace(`/digit-ui/employee/tl/response`, { data: result?.Licenses }); + history.replace(`/mgramseva-digit-ui/employee/tl/response`, { data: result?.Licenses }); } } }) @@ -357,9 +383,9 @@ const ReNewApplication = (props) => { if (data?.tradeUnits?.length > 0) formData.tradeLicenseDetail.tradeUnits = data?.tradeUnits?.filter((ob) => ob?.active !== false); if (data?.owners?.length > 0) formData.tradeLicenseDetail.owners = data?.owners?.filter((ob) => ob?.active !== false); if (data?.address) formData.tradeLicenseDetail.address = data?.address; - if (data?.cpt?.details?.address||propertyDetails) { + if (data?.cpt?.details?.address || propertyDetails) { let address = {}; - let ptdet=data?.cpt?.details||propertyDetails; + let ptdet = data?.cpt?.details || propertyDetails; address.city = ptdet?.address?.city || null; address.locality = { code: ptdet?.address?.locality?.code || null }; if (ptdet?.address?.doorNo || data?.address?.doorNo) address.doorNo = ptdet?.address?.doorNo || data?.address?.doorNo || null; @@ -368,26 +394,34 @@ const ReNewApplication = (props) => { formData.tradeLicenseDetail.address = address; } if (structureType) formData.tradeLicenseDetail.structureType = structureType; - if (subOwnerShipCategory || data?.owners?.[0]?.subOwnerShipCategory?.code) formData.tradeLicenseDetail["subOwnerShipCategory"] = formData?.tradeLicenseDetail?.owners?.[0]?.subOwnerShipCategory?.code?.includes("INSTITUTIONAL") ? data?.owners?.[0]?.subOwnerShipCategory?.code : subOwnerShipCategory; + if (subOwnerShipCategory || data?.owners?.[0]?.subOwnerShipCategory?.code) + formData.tradeLicenseDetail["subOwnerShipCategory"] = formData?.tradeLicenseDetail?.owners?.[0]?.subOwnerShipCategory?.code?.includes( + "INSTITUTIONAL" + ) + ? data?.owners?.[0]?.subOwnerShipCategory?.code + : subOwnerShipCategory; if (applicationDocuments) formData.tradeLicenseDetail.applicationDocuments = applicationDocuments; - if (data?.cpt || propertyDetails){ - if(!formData?.tradeLicenseDetail?.additionalDetail?.propertyId){ - formData.tradeLicenseDetail.additionalDetail={propertyId:null} + if (data?.cpt || propertyDetails) { + if (!formData?.tradeLicenseDetail?.additionalDetail?.propertyId) { + formData.tradeLicenseDetail.additionalDetail = { propertyId: null }; } - formData.tradeLicenseDetail.additionalDetail.propertyId = data?.cpt?.details?.propertyId||propertyDetails?.propertyId; - } - if (formData?.tradeLicenseDetail?.owners?.[0]?.subOwnerShipCategory?.code?.includes("INSTITUTIONAL")) formData.tradeLicenseDetail.institution = { - ...formData?.tradeLicenseDetail?.institution, - contactNo: data?.owners?.[0]?.altContactNumber, - designation: data?.owners?.[0]?.designation, - instituionName: data?.owners?.[0]?.instituionName, - name: data?.owners?.[0]?.name, - mobileNumber: data?.owners?.[0]?.mobileNumber, - emailId : data?.owners?.[0]?.emailId, + formData.tradeLicenseDetail.additionalDetail.propertyId = data?.cpt?.details?.propertyId || propertyDetails?.propertyId; } + if (formData?.tradeLicenseDetail?.owners?.[0]?.subOwnerShipCategory?.code?.includes("INSTITUTIONAL")) + formData.tradeLicenseDetail.institution = { + ...formData?.tradeLicenseDetail?.institution, + contactNo: data?.owners?.[0]?.altContactNumber, + designation: data?.owners?.[0]?.designation, + instituionName: data?.owners?.[0]?.instituionName, + name: data?.owners?.[0]?.name, + mobileNumber: data?.owners?.[0]?.mobileNumber, + emailId: data?.owners?.[0]?.emailId, + }; /* use customiseCreateFormData hook to make some chnages to the licence object */ - formData = Digit?.Customizations?.TL?.customiseRenewalCreateFormData ? Digit?.Customizations?.TL?.customiseRenewalCreateFormData(data, formData) : formData; + formData = Digit?.Customizations?.TL?.customiseRenewalCreateFormData + ? Digit?.Customizations?.TL?.customiseRenewalCreateFormData(data, formData) + : formData; Digit.TLService.update({ Licenses: [formData] }, tenantId) .then((result, err) => { if (result?.Licenses?.length > 0) { @@ -397,7 +431,7 @@ const ReNewApplication = (props) => { .then((response) => { Digit.SessionStorage.set("EditRenewalApplastModifiedTime", response?.Licenses[0]?.auditDetails?.lastModifiedTime); if (response?.Licenses?.length > 0) { - history.replace(`/digit-ui/employee/tl/response`, { data: response?.Licenses }); + history.replace(`/mgramseva-digit-ui/employee/tl/response`, { data: response?.Licenses }); } }) .catch((e) => { @@ -414,7 +448,7 @@ const ReNewApplication = (props) => { }; let configs = []; - newConfig=newConfig?newConfig:newConfigTL; + newConfig = newConfig ? newConfig : newConfigTL; newConfig?.map((conf) => { if (conf.head !== "ES_NEW_APPLICATION_PROPERTY_ASSESSMENT") { configs.push(conf); @@ -426,9 +460,13 @@ const ReNewApplication = (props) => { return "TL_CHECK_ADDRESS"; } else if (head === "ES_NEW_APPLICATION_OWNERSHIP_DETAILS") { return "TL_OWNERSHIP_DETAILS_HEADER"; - } else if (head === "TL_NEW_APPLICATION_PROPERTY" && (defaultValues?.tradedetils?.[0]?.structureType?.code === "MOVABLE" && (isEmpNewApplication || isEmpRenewLicense))) { + } else if ( + head === "TL_NEW_APPLICATION_PROPERTY" && + defaultValues?.tradedetils?.[0]?.structureType?.code === "MOVABLE" && + (isEmpNewApplication || isEmpRenewLicense) + ) { return ""; - }else { + } else { return head; } } diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/tl/src/pages/employee/index.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/tl/src/pages/employee/index.js index 31ab64a68..f3c3e7c88 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/tl/src/pages/employee/index.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/tl/src/pages/employee/index.js @@ -34,11 +34,11 @@ const TLBreadCrumb = ({ location }) => { } else if (locationsForTLEmployee.includes("search/license")) { if (breadCrumbUrl == "home") sessionStorage.setItem("breadCrumbUrl", "home/license"); else if (breadCrumbUrl == "inbox") sessionStorage.setItem("breadCrumbUrl", "inbox/license"); - else sessionStorage.setItem("breadCrumbUrl", breadCrumbUrl.includes("home/license") ? "home/license" : "inbox/license") + else sessionStorage.setItem("breadCrumbUrl", breadCrumbUrl.includes("home/license") ? "home/license" : "inbox/license"); } else if (locationsForTLEmployee.includes("search/application")) { if (breadCrumbUrl == "home") sessionStorage.setItem("breadCrumbUrl", "home/search"); else if (breadCrumbUrl == "inbox") sessionStorage.setItem("breadCrumbUrl", "inbox/search"); - else sessionStorage.setItem("breadCrumbUrl", breadCrumbUrl.includes("home/search") ? "home/search" : "inbox/search") + else sessionStorage.setItem("breadCrumbUrl", breadCrumbUrl.includes("home/search") ? "home/search" : "inbox/search"); } else if (locationsForTLEmployee.includes("new-application")) { if (breadCrumbUrl == "home") sessionStorage.setItem("breadCrumbUrl", "home/newApp"); else if (breadCrumbUrl == "inbox") sessionStorage.setItem("breadCrumbUrl", "inbox/newApp"); @@ -61,7 +61,7 @@ const TLBreadCrumb = ({ location }) => { else if (breadCrumbUrl == "home/search/appDetails") sessionStorage.setItem("breadCrumbUrl", "home/search/appDetails/edit"); else if (breadCrumbUrl == "inbox/search/appDetails") sessionStorage.setItem("breadCrumbUrl", "inbox/search/appDetails/edit"); } else if (locationsForTLEmployee.includes("response")) { - sessionStorage.setItem("breadCrumbUrl", "") + sessionStorage.setItem("breadCrumbUrl", ""); } useEffect(() => { @@ -76,125 +76,127 @@ const TLBreadCrumb = ({ location }) => { const crumbs = [ { - path: "/digit-ui/employee", + path: "/mgramseva-digit-ui/employee", content: t("ES_COMMON_HOME"), - show: true + show: true, }, { - path: "/digit-ui/employee/tl/inbox", + path: "/mgramseva-digit-ui/employee/tl/inbox", content: t("ES_TITLE_INBOX"), - show: breadCrumbUrls.includes("inbox") || isInbox + show: breadCrumbUrls.includes("inbox") || isInbox, }, { - path: "/digit-ui/employee/tl/search/application", + path: "/mgramseva-digit-ui/employee/tl/search/application", content: t("ES_COMMON_SEARCH_APPLICATION"), - show: isApplicationSearch || - breadCrumbUrls.includes("home/search") || - breadCrumbUrls.includes("inbox/search") + show: isApplicationSearch || breadCrumbUrls.includes("home/search") || breadCrumbUrls.includes("inbox/search"), }, { - path: "/digit-ui/employee/tl/search/license", + path: "/mgramseva-digit-ui/employee/tl/search/license", content: t("TL_SEARCH_TRADE_HEADER"), - show: isLicenceSearch || - breadCrumbUrls.includes("home/license") || - breadCrumbUrls.includes("inbox/license") + show: isLicenceSearch || breadCrumbUrls.includes("home/license") || breadCrumbUrls.includes("inbox/license"), }, { - path: sessionStorage.getItem("applicationNumber") ? `/digit-ui/employee/tl/application-details/${sessionStorage.getItem("applicationNumber")}` : "", + path: sessionStorage.getItem("applicationNumber") + ? `/mgramseva-digit-ui/employee/tl/application-details/${sessionStorage.getItem("applicationNumber")}` + : "", content: t("TL_DETAILS_HEADER_LABEL"), - show: isApplicationDetails || - breadCrumbUrls.includes("inbox/appDetails") || - breadCrumbUrls.includes("home/license/appDetails") || - breadCrumbUrls.includes("inbox/license/appDetails") || - breadCrumbUrls.includes("home/search/appDetails") || - breadCrumbUrls.includes("inbox/search/appDetails") + show: + isApplicationDetails || + breadCrumbUrls.includes("inbox/appDetails") || + breadCrumbUrls.includes("home/license/appDetails") || + breadCrumbUrls.includes("inbox/license/appDetails") || + breadCrumbUrls.includes("home/search/appDetails") || + breadCrumbUrls.includes("inbox/search/appDetails"), }, { - path: "/digit-ui/employee/tl/new-application", + path: "/mgramseva-digit-ui/employee/tl/new-application", content: t("TL_HOME_SEARCH_RESULTS_NEW_APP_BUTTON"), - show: isNewApplication || - breadCrumbUrls.includes("home/newApp") || - breadCrumbUrls.includes("inbox/newApp") + show: isNewApplication || breadCrumbUrls.includes("home/newApp") || breadCrumbUrls.includes("inbox/newApp"), }, { content: t("ES_TITLE_RENEW_TRADE_LICESE_APPLICATION"), - show: isRenewalApplication || - breadCrumbUrls.includes("inbox/appDetails/renew") || - breadCrumbUrls.includes("home/license/appDetails/renew") || - breadCrumbUrls.includes("inbox/license/appDetails/renew") || - breadCrumbUrls.includes("home/search/appDetails/renew") || - breadCrumbUrls.includes("inbox/search/appDetails/renew") + show: + isRenewalApplication || + breadCrumbUrls.includes("inbox/appDetails/renew") || + breadCrumbUrls.includes("home/license/appDetails/renew") || + breadCrumbUrls.includes("inbox/license/appDetails/renew") || + breadCrumbUrls.includes("home/search/appDetails/renew") || + breadCrumbUrls.includes("inbox/search/appDetails/renew"), }, { content: t("ES_TITLE_RE_NEW_TRADE_LICESE_APPLICATION"), - show: isEditApplication || - breadCrumbUrls.includes("inbox/appDetails/edit") || - breadCrumbUrls.includes("home/license/appDetails/edit") || - breadCrumbUrls.includes("inbox/license/appDetails/edit") || - breadCrumbUrls.includes("home/search/appDetails/edit") || - breadCrumbUrls.includes("inbox/search/appDetails/edit") + show: + isEditApplication || + breadCrumbUrls.includes("inbox/appDetails/edit") || + breadCrumbUrls.includes("home/license/appDetails/edit") || + breadCrumbUrls.includes("inbox/license/appDetails/edit") || + breadCrumbUrls.includes("home/search/appDetails/edit") || + breadCrumbUrls.includes("inbox/search/appDetails/edit"), }, { - path: "/digit-ui/employee/tl/inbox", + path: "/mgramseva-digit-ui/employee/tl/inbox", content: t("ACTION_TEST_RESPONSE"), - show: isResponse - } + show: isResponse, + }, ]; - return ; + return ; }; - const EmployeeApp = ({ path, url, userType }) => { const { t } = useTranslation(); const location = useLocation(); const mobileView = innerWidth <= 640; - const locationCheck = window.location.href.includes("employee/tl/new-application") || window.location.href.includes("employee/tl/response") || window.location.href.includes("employee/tl/edit-application-details") || window.location.href.includes("employee/tl/renew-application-details"); + const locationCheck = + window.location.href.includes("employee/tl/new-application") || + window.location.href.includes("employee/tl/response") || + window.location.href.includes("employee/tl/edit-application-details") || + window.location.href.includes("employee/tl/renew-application-details"); - const NewApplication = Digit?.ComponentRegistryService?.getComponent('TLNewApplication'); - const ReNewApplication = Digit?.ComponentRegistryService?.getComponent('TLReNewApplication'); - const Response = Digit?.ComponentRegistryService?.getComponent('TLResponse'); - const Search = Digit?.ComponentRegistryService?.getComponent('TLSearch'); + const NewApplication = Digit?.ComponentRegistryService?.getComponent("TLNewApplication"); + const ReNewApplication = Digit?.ComponentRegistryService?.getComponent("TLReNewApplication"); + const Response = Digit?.ComponentRegistryService?.getComponent("TLResponse"); + const Search = Digit?.ComponentRegistryService?.getComponent("TLSearch"); return ( -
-
+
+
{/*

- + {t("ES_COMMON_HOME")} {" "} / - {location.pathname === "/digit-ui/employee/tl/inbox" ? - {location.pathname === "/digit-ui/employee/tl/inbox" ? t("ES_COMMON_INBOX") : ""} + {location.pathname === "/mgramseva-digit-ui/employee/tl/inbox" ? + {location.pathname === "/mgramseva-digit-ui/employee/tl/inbox" ? t("ES_COMMON_INBOX") : ""} : - - {location.pathname.includes("/digit-ui/employee/tl/") ? t("ES_COMMON_INBOX") : ""} + + {location.pathname.includes("/mgramseva-digit-ui/employee/tl/") ? t("ES_COMMON_INBOX") : ""} } - {location.pathname.includes("/digit-ui/employee/tl/search/application") ? `/ ${t("ES_COMMON_SEARCH_APPLICATION") }` : null} - {location.pathname.includes("/digit-ui/employee/tl/search/license") ? `/ ${t("TL_SEARCH_TRADE_HEADER") }` : null} - {location.pathname.includes("/digit-ui/employee/tl/application-details") ? `/ ${t("TL_DETAILS_HEADER_LABEL") }` : null} - {location.pathname.includes("/digit-ui/employee/tl/new-application") ? `/ ${t("TL_HOME_SEARCH_RESULTS_NEW_APP_BUTTON") }` : null} - {location.pathname.includes("/digit-ui/employee/tl/renew-application-details") ? `/ ${t("ES_TITLE_RENEW_TRADE_LICESE_APPLICATION") }` : null} - {location.pathname.includes("/digit-ui/employee/tl/edit-application-details") ? `/ ${t("ES_TITLE_RE_NEW_TRADE_LICESE_APPLICATION") }` : null} + {location.pathname.includes("/mgramseva-digit-ui/employee/tl/search/application") ? `/ ${t("ES_COMMON_SEARCH_APPLICATION") }` : null} + {location.pathname.includes("/mgramseva-digit-ui/employee/tl/search/license") ? `/ ${t("TL_SEARCH_TRADE_HEADER") }` : null} + {location.pathname.includes("/mgramseva-digit-ui/employee/tl/application-details") ? `/ ${t("TL_DETAILS_HEADER_LABEL") }` : null} + {location.pathname.includes("/mgramseva-digit-ui/employee/tl/new-application") ? `/ ${t("TL_HOME_SEARCH_RESULTS_NEW_APP_BUTTON") }` : null} + {location.pathname.includes("/mgramseva-digit-ui/employee/tl/renew-application-details") ? `/ ${t("ES_TITLE_RENEW_TRADE_LICESE_APPLICATION") }` : null} + {location.pathname.includes("/mgramseva-digit-ui/employee/tl/edit-application-details") ? `/ ${t("ES_TITLE_RE_NEW_TRADE_LICESE_APPLICATION") }` : null}

*/} ( - - )} + component={() => } /> } /> } /> } /> - } /> + } + /> } /> } /> -
diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/ws/src/components/BillAmendmentCard.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/ws/src/components/BillAmendmentCard.js index 3fd2b94a5..81dcba7ae 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/ws/src/components/BillAmendmentCard.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/ws/src/components/BillAmendmentCard.js @@ -35,60 +35,67 @@ const BillAmendmentCard = () => { }; const formInitBilAmendmentValueSW = { - filterForm: {...filterFormDefaultBillAmendmentValues,businessService:["SW.AMENDMENT"], moduleName: "bsSw-service"}, + filterForm: { ...filterFormDefaultBillAmendmentValues, businessService: ["SW.AMENDMENT"], moduleName: "bsSw-service" }, searchForm: searchFormDefaultValues, tableForm: tableOrderFormDefaultValues, }; - - const { isLoading: isBillAMDInboxLoading, data : billData } = Digit.Hooks.useBillAmendmentInbox({ + const { isLoading: isBillAMDInboxLoading, data: billData } = Digit.Hooks.useBillAmendmentInbox({ tenantId, filters: { ...formInitBilAmendmentValue }, }); - const { isLoading: isSWBillAMDInboxLoading, data : swbillData } = Digit.Hooks.useBillAmendmentInbox({ + const { isLoading: isSWBillAMDInboxLoading, data: swbillData } = Digit.Hooks.useBillAmendmentInbox({ tenantId, filters: { ...formInitBilAmendmentValueSW }, }); - useEffect(() => { if (!isBillAMDInboxLoading || !isSWBillAMDInboxLoading) { - const billCount = billData?.totalCount && swbillData?.totalCount ? billData?.totalCount + swbillData?.totalCount : (billData?.totalCount?billData?.totalCount:(swbillData?.totalCount?swbillData?.totalCount:0)); + const billCount = + billData?.totalCount && swbillData?.totalCount + ? billData?.totalCount + swbillData?.totalCount + : billData?.totalCount + ? billData?.totalCount + : swbillData?.totalCount + ? swbillData?.totalCount + : 0; setTotalCount(billCount); } - }, [billData,swbillData]); - + }, [billData, swbillData]); - const propsForModuleCard = useMemo(() => ({ - Icon: , - moduleName: t("WS_BILL_AMENDMENT_BUTTON"), - kpis: [ - { - count: isBillAMDInboxLoading ? "-" : totalCount, - label: t("TOTAL_WS"), - link: `/digit-ui/employee/ws/water/bill-amendment/inbox`, - }, - { - count: isBillAMDInboxLoading ? "-" : billData?.slaCount, - label: t("TOTAL_NEARING_SLA"), - link: `/digit-ui/employee/ws/water/bill-amendment/inbox`, - } - ], - links: [ - { - count: isBillAMDInboxLoading ? "-" : billData?.totalCount, - label: t("WS_WATER_INBOX"), - link: `/digit-ui/employee/ws/water/bill-amendment/inbox`, - roles: ["WS_CEMP", "WS_APPROVER", "WS_FIELD_INSPECTOR", "WS_DOC_VERIFIER", "WS_CLERK"], - }, - { - count: isBillAMDInboxLoading ? "-" : swbillData?.totalCount, - label: t("SW_WATER_INBOX"), - link: `/digit-ui/employee/ws/sewerage/bill-amendment/inbox`, - roles: ["WS_CEMP", "WS_APPROVER", "WS_FIELD_INSPECTOR", "WS_DOC_VERIFIER", "WS_CLERK"], - } - ], - }), [isBillAMDInboxLoading, billData, totalCount]); + const propsForModuleCard = useMemo( + () => ({ + Icon: , + moduleName: t("WS_BILL_AMENDMENT_BUTTON"), + kpis: [ + { + count: isBillAMDInboxLoading ? "-" : totalCount, + label: t("TOTAL_WS"), + link: `/mgramseva-digit-ui/employee/ws/water/bill-amendment/inbox`, + }, + { + count: isBillAMDInboxLoading ? "-" : billData?.slaCount, + label: t("TOTAL_NEARING_SLA"), + link: `/mgramseva-digit-ui/employee/ws/water/bill-amendment/inbox`, + }, + ], + links: [ + { + count: isBillAMDInboxLoading ? "-" : billData?.totalCount, + label: t("WS_WATER_INBOX"), + link: `/mgramseva-digit-ui/employee/ws/water/bill-amendment/inbox`, + roles: ["WS_CEMP", "WS_APPROVER", "WS_FIELD_INSPECTOR", "WS_DOC_VERIFIER", "WS_CLERK"], + }, + { + count: isBillAMDInboxLoading ? "-" : swbillData?.totalCount, + label: t("SW_WATER_INBOX"), + link: `/mgramseva-digit-ui/employee/ws/sewerage/bill-amendment/inbox`, + roles: ["WS_CEMP", "WS_APPROVER", "WS_FIELD_INSPECTOR", "WS_DOC_VERIFIER", "WS_CLERK"], + }, + ], + }), + [isBillAMDInboxLoading, billData, totalCount] + ); return ; }; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/ws/src/components/BillIAmendMentInbox/index.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/ws/src/components/BillIAmendMentInbox/index.js index c6f83de75..88e17ae0f 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/ws/src/components/BillIAmendMentInbox/index.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/ws/src/components/BillIAmendMentInbox/index.js @@ -114,24 +114,26 @@ const Inbox = ({ parentRoute }) => { const { isLoading: isInboxLoading, data: { table, statuses, totalCount } = {} } = Digit.Hooks.useBillAmendmentInbox({ tenantId, filters: { ...formState }, - config : { cacheTime : 0} + config: { cacheTime: 0 }, }); - const { data: statusData, isLoading } = Digit.Hooks.useApplicationStatusGeneral({ businessServices: ["WS.AMENDMENT","SW.AMENDMENT"], tenantId }, { enabled: statuses?.length>0}); - - statuses?.map(status => { - statusData?.otherRoleStates?.map(state=>{ - if(state?.uuid===status?.statusid){ - status["applicationstatus"] = t(state?.state) + const { data: statusData, isLoading } = Digit.Hooks.useApplicationStatusGeneral( + { businessServices: ["WS.AMENDMENT", "SW.AMENDMENT"], tenantId }, + { enabled: statuses?.length > 0 } + ); + + statuses?.map((status) => { + statusData?.otherRoleStates?.map((state) => { + if (state?.uuid === status?.statusid) { + status["applicationstatus"] = t(state?.state); } - }) - statusData?.userRoleStates?.map(state => { + }); + statusData?.userRoleStates?.map((state) => { if (state?.uuid === status?.statusid) { - status["applicationstatus"] = t(state?.state) + status["applicationstatus"] = t(state?.state); } - }) - } ) - + }); + }); const PropsForInboxLinks = { logoIcon: , @@ -140,11 +142,11 @@ const Inbox = ({ parentRoute }) => { //UM-5603 As requested by PO // { // text: t("ACTION_TEST_REPORTS"), - // link: "/digit-ui/employee/ws/reports", + // link: "/mgramseva-digit-ui/employee/ws/reports", // }, // { // text: t("ACTION_TEST_DASHBOARD"), - // link: "/digit-ui/employee/ws/dashboards", + // link: "/mgramseva-digit-ui/employee/ws/dashboards", // }, ], }; @@ -170,7 +172,7 @@ const Inbox = ({ parentRoute }) => { }} /> ), - [statuses, isInboxLoading, localitiesForEmployeesCurrentTenant, loadingLocalitiesForEmployeesCurrentTenant,statusData] + [statuses, isInboxLoading, localitiesForEmployeesCurrentTenant, loadingLocalitiesForEmployeesCurrentTenant, statusData] ); const onSearchFormSubmit = (data) => { @@ -202,7 +204,19 @@ const Inbox = ({ parentRoute }) => { onFilterFormReset, }; - const propsForInboxTable = useInboxTableConfig({ ...{ parentRoute, onPageSizeChange, formState, totalCount, table, dispatch, onSortingByData, inboxStyles:{overflowX:"scroll", overflowY:"hidden"}, tableStyle:{width:"70%"} } }); + const propsForInboxTable = useInboxTableConfig({ + ...{ + parentRoute, + onPageSizeChange, + formState, + totalCount, + table, + dispatch, + onSortingByData, + inboxStyles: { overflowX: "scroll", overflowY: "hidden" }, + tableStyle: { width: "70%" }, + }, + }); const propsForInboxMobileCards = useInboxMobileCardsData({ parentRoute, table }); diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/ws/src/components/BillIAmendMentInbox/useInboxMobileCardsData.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/ws/src/components/BillIAmendMentInbox/useInboxMobileCardsData.js index cb16bdf78..0af40308d 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/ws/src/components/BillIAmendMentInbox/useInboxMobileCardsData.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/ws/src/components/BillIAmendMentInbox/useInboxMobileCardsData.js @@ -11,7 +11,7 @@ const useInboxMobileCardsData = ({ parentRoute, table }) => { const getApplicationNumberCell = (value, amendmentReason) => { return (
- + {value} {GetCell(t(`BILLAMENDMENT_${amendmentReason}_HEADING`))} diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/ws/src/components/BillIAmendMentInbox/useInboxTableConfig.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/ws/src/components/BillIAmendMentInbox/useInboxTableConfig.js index 3c8bc9d31..d284708e1 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/ws/src/components/BillIAmendMentInbox/useInboxTableConfig.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/ws/src/components/BillIAmendMentInbox/useInboxTableConfig.js @@ -3,7 +3,17 @@ import { Link } from "react-router-dom"; import { format } from "date-fns"; import { useTranslation } from "react-i18next"; -const useInboxTableConfig = ({ parentRoute, onPageSizeChange, formState, totalCount, table, dispatch, onSortingByData, inboxStyles={}, tableStyle={} }) => { +const useInboxTableConfig = ({ + parentRoute, + onPageSizeChange, + formState, + totalCount, + table, + dispatch, + onSortingByData, + inboxStyles = {}, + tableStyle = {}, +}) => { const { t } = useTranslation(); const tenantId = Digit.ULBService.getCurrentTenantId(); @@ -35,7 +45,7 @@ const useInboxTableConfig = ({ parentRoute, onPageSizeChange, formState, totalCo Cell: ({ row }) => { return (
- + {row.original["applicationNo"]} {GetCell(t(`BILLAMENDMENT_${row?.original?.amendmentReason}_HEADING`))} @@ -107,8 +117,8 @@ const useInboxTableConfig = ({ parentRoute, onPageSizeChange, formState, totalCo // searchQueryForTable, data: table, columns: tableColumnConfig, - inboxStyles:{...inboxStyles}, - tableStyle:{...tableStyle}, + inboxStyles: { ...inboxStyles }, + tableStyle: { ...tableStyle }, }; }; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/ws/src/components/SWCard.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/ws/src/components/SWCard.js index cfb2ab33f..2e0659683 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/ws/src/components/SWCard.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/ws/src/components/SWCard.js @@ -36,7 +36,7 @@ const SWCard = () => { searchForm: searchFormDefaultValues, tableForm: tableOrderFormDefaultValues, }; - + const { isLoading: isSWInboxLoading, data: swData } = Digit.Hooks.ws.useInbox({ tenantId, filters: { ...formInitValue }, @@ -51,7 +51,7 @@ const SWCard = () => { let links = [ { label: t("WS_APPLY_NEW_CONNECTION_HOME_CARD_LABEL"), - link: `/digit-ui/employee/ws/create-application`, + link: `/mgramseva-digit-ui/employee/ws/create-application`, roles: ["WS_CEMP", "SW_CEMP"], }, ]; @@ -65,30 +65,30 @@ const SWCard = () => { { count: isSWInboxLoading ? "-" : totalCount, label: t("TOTAL_SW"), - link: `/digit-ui/employee/ws/sewerage/inbox`, + link: `/mgramseva-digit-ui/employee/ws/sewerage/inbox`, }, { count: isSWInboxLoading ? "-" : swData?.slaCount, label: t("TOTAL_NEARING_SLA"), - link: `/digit-ui/employee/ws/sewerage/inbox`, + link: `/mgramseva-digit-ui/employee/ws/sewerage/inbox`, }, ], links: [ { count: isSWInboxLoading ? "-" : swData?.totalCount, label: t("WS_SEWERAGE_INBOX"), - link: `/digit-ui/employee/ws/sewerage/inbox`, + link: `/mgramseva-digit-ui/employee/ws/sewerage/inbox`, roles: ["SW_CEMP", "SW_APPROVER", "SW_FIELD_INSPECTOR", "SW_DOC_VERIFIER", "SW_CLERK"], }, ...links, { label: t("WS_SEWERAGE_CONNECTION_SEARCH_LABEL"), - link: `/digit-ui/employee/ws/sewerage/search-connection`, + link: `/mgramseva-digit-ui/employee/ws/sewerage/search-connection`, roles: ["SW_CEMP", "SW_APPROVER", "SW_FIELD_INSPECTOR", "SW_DOC_VERIFIER", "SW_CLERK"], }, { label: t("WS_SEWERAGE_APPLICATION_SEARCH"), - link: `/digit-ui/employee/ws/sewerage/search-application`, + link: `/mgramseva-digit-ui/employee/ws/sewerage/search-application`, roles: ["SW_CEMP", "SW_APPROVER", "SW_FIELD_INSPECTOR", "SW_DOC_VERIFIER", "SW_CLERK"], }, ], diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/ws/src/components/SearchApplication/MobileSearchApplication.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/ws/src/components/SearchApplication/MobileSearchApplication.js index 3f58689bb..76d403de6 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/ws/src/components/SearchApplication/MobileSearchApplication.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/ws/src/components/SearchApplication/MobileSearchApplication.js @@ -3,7 +3,19 @@ import { Link } from "react-router-dom"; import { CloseSvg, SearchForm, Table, Card, SearchAction, PopUp, DetailsCard, Loader, Toast } from "@egovernments/digit-ui-react-components"; import SearchFormFields from "./SearchFields"; -const MobileSearchApplication = ({ Controller, register, control, t, reset, previousPage, handleSubmit, tenantId, data, onSubmit, businessService }) => { +const MobileSearchApplication = ({ + Controller, + register, + control, + t, + reset, + previousPage, + handleSubmit, + tenantId, + data, + onSubmit, + businessService, +}) => { function activateModal(state, action) { switch (action.type) { case "set": @@ -38,7 +50,7 @@ const MobileSearchApplication = ({ Controller, register, control, t, reset, prev

{t("ES_COMMON_SEARCH")}:

- + {/*

{t(`ES_COMMON_CLEAR_ALL`)}

@@ -67,52 +79,54 @@ const MobileSearchApplication = ({ Controller, register, control, t, reset, prev const getWaterSewerageData = (data) => { if ( - data?.applicationType == "NEW_WATER_CONNECTION" || + data?.applicationType == "NEW_WATER_CONNECTION" || data?.applicationType == "MODIFY_WATER_CONNECTION" || data?.applicationType == "DISCONNECT_WATER_CONNECTION" ) { - return "WATER" + return "WATER"; } else if ( data?.applicationType == "NEW_SEWERAGE_CONNECTION" || - data?.applicationType == "MODIFY_SEWERAGE_CONNECTION" || + data?.applicationType == "MODIFY_SEWERAGE_CONNECTION" || data?.applicationType == "DISCONNECT_SEWERAGE_CONNECTION" ) { - return "SEWERAGE" + return "SEWERAGE"; } - } + }; const getFlowUrls = (applicationType) => { let application = "application"; if (applicationType?.toUpperCase()?.includes("DISCONNECT")) { - application = "disconnection" + application = "disconnection"; } else if (applicationType?.toUpperCase()?.includes("MODIFY")) { - application = "modify" + application = "modify"; } return application; - } + }; return data?.map((data) => ({ - [t("WS_MYCONNECTIONS_CONSUMER_NO")]: /*data?.connectionNo || "NA",*/data?.connectionNo ? ( + [t("WS_MYCONNECTIONS_CONSUMER_NO")]: /*data?.connectionNo || "NA",*/ data?.connectionNo ? (
{data?.connectionNo}
- ) : t("CS_NA"), + ) : ( + t("CS_NA") + ), //[t("WS_ACK_COMMON_APP_NO_LABEL")]: data?.applicationNo || "-", [t("WS_ACK_COMMON_APP_NO_LABEL")]: (
{data?.applicationNo} @@ -166,7 +180,7 @@ const MobileSearchApplication = ({ Controller, register, control, t, reset, prev diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/ws/src/components/SearchApplication/index.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/ws/src/components/SearchApplication/index.js index e5264290c..4a721b097 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/ws/src/components/SearchApplication/index.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/ws/src/components/SearchApplication/index.js @@ -6,10 +6,9 @@ import { useTranslation } from "react-i18next"; import { Link } from "react-router-dom"; import MobileSearchApplication from "./MobileSearchApplication"; const SearchApplication = ({ tenantId, onSubmit, data, count, resultOk, businessService, isLoading }) => { - const [sessionFormData, setSessionFormData, clearSessionFormData] = Digit.Hooks.useSessionStorage("ADHOC_ADD_REBATE_DATA", {}); const [sessionBillFormData, setSessionBillFormData, clearBillSessionFormData] = Digit.Hooks.useSessionStorage("ADHOC_BILL_ADD_REBATE_DATA", {}); - + const replaceUnderscore = (str) => { str = str.replace(/_/g, " "); return str; @@ -39,7 +38,7 @@ const SearchApplication = ({ tenantId, onSubmit, data, count, resultOk, business clearSessionFormData(); setSessionFormData({}); setSessionBillFormData({}); - clearBillSessionFormData() + clearBillSessionFormData(); }, []); const onSort = useCallback((args) => { @@ -65,7 +64,11 @@ const SearchApplication = ({ tenantId, onSubmit, data, count, resultOk, business const isMobile = window.Digit.Utils.browser.isMobile(); if (isMobile) { - return ; + return ( + + ); } //need to get from workflow @@ -78,28 +81,28 @@ const SearchApplication = ({ tenantId, onSubmit, data, count, resultOk, business accessor: "connectionNo", Cell: ({ row }) => { let service = "WATER"; - if ( - row?.original?.["applicationType"] == "NEW_WATER_CONNECTION" || - row?.original?.["applicationType"] == "MODIFY_WATER_CONNECTION" || - row?.original?.["applicationType"] == "DISCONNECT_WATER_CONNECTION" - ) { - service = "WATER" - } else if ( - row?.original?.["applicationType"] == "NEW_SEWERAGE_CONNECTION" || - row?.original?.["applicationType"] == "MODIFY_SEWERAGE_CONNECTION" || - row?.original?.["applicationType"] == "DISCONNECT_SEWERAGE_CONNECTION" - ) { - service = "SEWERAGE" - } - + if ( + row?.original?.["applicationType"] == "NEW_WATER_CONNECTION" || + row?.original?.["applicationType"] == "MODIFY_WATER_CONNECTION" || + row?.original?.["applicationType"] == "DISCONNECT_WATER_CONNECTION" + ) { + service = "WATER"; + } else if ( + row?.original?.["applicationType"] == "NEW_SEWERAGE_CONNECTION" || + row?.original?.["applicationType"] == "MODIFY_SEWERAGE_CONNECTION" || + row?.original?.["applicationType"] == "DISCONNECT_SEWERAGE_CONNECTION" + ) { + service = "SEWERAGE"; + } + return (
{row.original["connectionNo"] ? ( {row.original["connectionNo"] || "NA"} @@ -118,19 +121,19 @@ const SearchApplication = ({ tenantId, onSubmit, data, count, resultOk, business Cell: ({ row }) => { let service = "WATER"; if ( - row?.original?.["applicationType"] == "NEW_WATER_CONNECTION" || + row?.original?.["applicationType"] == "NEW_WATER_CONNECTION" || row?.original?.["applicationType"] == "MODIFY_WATER_CONNECTION" || row?.original?.["applicationType"] == "DISCONNECT_WATER_CONNECTION" ) { - service = "WATER" + service = "WATER"; } else if ( row?.original?.["applicationType"] == "NEW_SEWERAGE_CONNECTION" || - row?.original?.["applicationType"] == "MODIFY_SEWERAGE_CONNECTION" || + row?.original?.["applicationType"] == "MODIFY_SEWERAGE_CONNECTION" || row?.original?.["applicationType"] == "DISCONNECT_SEWERAGE_CONNECTION" ) { - service = "SEWERAGE" + service = "SEWERAGE"; } - + if (row.original["applicationType"] === "MODIFY_SEWERAGE_CONNECTION" || row.original["applicationType"] === "MODIFY_WATER_CONNECTION") { let application = "application"; if (row?.original?.["applicationType"]?.toUpperCase()?.includes("DISCONNECT")) { @@ -142,9 +145,9 @@ const SearchApplication = ({ tenantId, onSubmit, data, count, resultOk, business
{row.original["applicationNo"]} @@ -162,7 +165,7 @@ const SearchApplication = ({ tenantId, onSubmit, data, count, resultOk, business
{row.original["applicationNo"]} @@ -176,7 +179,7 @@ const SearchApplication = ({ tenantId, onSubmit, data, count, resultOk, business Header: t("WS_APPLICATION_TYPE_LABEL"), disableSortBy: true, accessor: (row) => { - return GetCell(t(`WS_${row.applicationType}`)) + return GetCell(t(`WS_${row.applicationType}`)); }, }, { @@ -199,17 +202,19 @@ const SearchApplication = ({ tenantId, onSubmit, data, count, resultOk, business ], [] ); - + return ( <> -
{businessService === "WS" ? t("WS_WATER_SEARCH_APPLICATION_SUB_HEADER") : t("WS_SEWERAGE_SEARCH_APPLICATION_SUB_HEADER")}
- < Card className={"card-search-heading"}> +
+ {businessService === "WS" ? t("WS_WATER_SEARCH_APPLICATION_SUB_HEADER") : t("WS_SEWERAGE_SEARCH_APPLICATION_SUB_HEADER")} +
+ {t("WS_INFO_VALIDATION")} - - + + - { isLoading ? : null } + {isLoading ? : null} {data?.display && !resultOk ? ( {t(data?.display) diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/ws/src/components/SearchWaterConnection/MobileSearchWater.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/ws/src/components/SearchWaterConnection/MobileSearchWater.js index ab55ad768..033ca3a21 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/ws/src/components/SearchWaterConnection/MobileSearchWater.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/ws/src/components/SearchWaterConnection/MobileSearchWater.js @@ -75,7 +75,7 @@ const MobileSearchWater = ({ Controller, register, control, t, reset, previousPa { - //let service = "WATER"; return (
{value?.connectionNo || "NA"} @@ -116,7 +115,8 @@ const MobileSearchWater = ({ Controller, register, control, t, reset, previousPa [t("WS_COMMON_TABLE_COL_STATUS_LABEL")]: t(`WS_${data?.status?.toUpperCase()}`), [t("WS_COMMON_TABLE_COL_AMT_DUE_LABEL")]: data?.due || t(`${"WS_NA"}`), [t("WS_COMMON_TABLE_COL_ADDRESS")]: data?.address || t(`${"WS_NA"}`), - [t("WS_COMMON_TABLE_COL_DUE_DATE_LABEL")]: data?.status?.toUpperCase() === "INACTIVE" ? t(`${"WS_NA"}`) : data?.dueDate ? convertEpochToDate(data?.dueDate) : t(`${"WS_NA"}`), + [t("WS_COMMON_TABLE_COL_DUE_DATE_LABEL")]: + data?.status?.toUpperCase() === "INACTIVE" ? t(`${"WS_NA"}`) : data?.dueDate ? convertEpochToDate(data?.dueDate) : t(`${"WS_NA"}`), [t("WS_COMMON_TABLE_COL_ACTION_LABEL")]: data?.due ? getActionItems(data?.status, data) : t(`${"WS_NA"}`), })); }, [data]); diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/ws/src/components/SearchWaterConnection/index.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/ws/src/components/SearchWaterConnection/index.js index c718eaa3d..7f9783188 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/ws/src/components/SearchWaterConnection/index.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/ws/src/components/SearchWaterConnection/index.js @@ -83,9 +83,11 @@ const SearchWaterConnection = ({ tenantId, onSubmit, data, count, resultOk, busi {row.original["connectionNo"] ? ( {row.original["connectionNo"] || "NA"} @@ -109,7 +111,11 @@ const SearchWaterConnection = ({ tenantId, onSubmit, data, count, resultOk, busi Header: t("WS_COMMON_TABLE_COL_OWN_NAME_LABEL"), disableSortBy: true, Cell: ({ row }) => { - return GetCell(row?.original?.connectionHolders?.map((owner) => owner?.name).join(",") ? row?.original?.connectionHolders?.map((owner) => owner?.name).join(",") : `${row.original?.["owner"] || "NA"}`); + return GetCell( + row?.original?.connectionHolders?.map((owner) => owner?.name).join(",") + ? row?.original?.connectionHolders?.map((owner) => owner?.name).join(",") + : `${row.original?.["owner"] || "NA"}` + ); }, }, { @@ -163,8 +169,8 @@ const SearchWaterConnection = ({ tenantId, onSubmit, data, count, resultOk, busi const getActionItem = (status, row) => { const userInfo = Digit.UserService.getUser(); const userRoles = userInfo.info.roles.map((roleData) => roleData.code); - const isUserAllowedToAddMeterReading = userRoles.filter(role => (role === "WS_CEMP" || role === "SW_CEMP")).length > 0 - if(!isUserAllowedToAddMeterReading) return null + const isUserAllowedToAddMeterReading = userRoles.filter((role) => role === "WS_CEMP" || role === "SW_CEMP").length > 0; + if (!isUserAllowedToAddMeterReading) return null; switch (status) { case "Active": return ( @@ -173,9 +179,11 @@ const SearchWaterConnection = ({ tenantId, onSubmit, data, count, resultOk, busi {row.original?.service === "WATER" ? ( {t(`${"WS_COMMON_COLLECT_LABEL"}`)}{" "} @@ -183,9 +191,11 @@ const SearchWaterConnection = ({ tenantId, onSubmit, data, count, resultOk, busi ) : ( {t(`${"WS_COMMON_COLLECT_LABEL"}`)}{" "} @@ -205,7 +215,7 @@ const SearchWaterConnection = ({ tenantId, onSubmit, data, count, resultOk, busi - { isLoading ? : null } + {isLoading ? : null} {data?.display && !resultOk ? ( {t(data?.display) @@ -216,8 +226,8 @@ const SearchWaterConnection = ({ tenantId, onSubmit, data, count, resultOk, busi

))}
- // <> - ) : resultOk ? ( + ) : // <> + resultOk ? (
{ let links = [ { label: t("WS_APPLY_NEW_CONNECTION_HOME_CARD_LABEL"), - link: `/digit-ui/employee/ws/create-application`, + link: `/mgramseva-digit-ui/employee/ws/create-application`, roles: ["WS_CEMP", "SW_CEMP"], }, ]; @@ -65,30 +65,30 @@ const WSCard = () => { { count: isWSInboxLoading ? "-" : totalCount, label: t("TOTAL_WS"), - link: `/digit-ui/employee/ws/water/inbox`, + link: `/mgramseva-digit-ui/employee/ws/water/inbox`, }, { count: isWSInboxLoading ? "-" : wsData?.slaCount, label: t("TOTAL_NEARING_SLA"), - link: `/digit-ui/employee/ws/water/inbox`, - } + link: `/mgramseva-digit-ui/employee/ws/water/inbox`, + }, ], links: [ { count: isWSInboxLoading ? "-" : wsData?.totalCount, label: t("WS_INBOX_HEADER"), - link: `/digit-ui/employee/ws/water/inbox`, + link: `/mgramseva-digit-ui/employee/ws/water/inbox`, roles: ["WS_CEMP", "WS_APPROVER", "WS_FIELD_INSPECTOR", "WS_DOC_VERIFIER", "WS_CLERK"], }, ...links, { label: t("WS_WATER_CONNECTION_SEARCH_LABEL"), - link: `/digit-ui/employee/ws/water/search-connection`, + link: `/mgramseva-digit-ui/employee/ws/water/search-connection`, roles: ["WS_CEMP", "WS_APPROVER", "WS_FIELD_INSPECTOR", "WS_DOC_VERIFIER", "WS_CLERK"], }, { label: t("WS_WATER_APPLICATION_SEARCH"), - link: `/digit-ui/employee/ws/water/search-application`, + link: `/mgramseva-digit-ui/employee/ws/water/search-application`, roles: ["WS_CEMP", "WS_APPROVER", "WS_FIELD_INSPECTOR", "WS_DOC_VERIFIER", "WS_CLERK"], }, ], diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/ws/src/components/WSInbox/index.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/ws/src/components/WSInbox/index.js index 9da0e3c05..3489b5d05 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/ws/src/components/WSInbox/index.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/ws/src/components/WSInbox/index.js @@ -20,7 +20,9 @@ const WSInbox = ({ parentRoute }) => { consumerNo: "", }; const filterFormDefaultValues = { - businessService: checkPathName ? ["NewWS1", "ModifyWSConnection", "DisconnectWSConnection"] : ["NewSW1", "ModifySWConnection", "DisconnectSWConnection"], + businessService: checkPathName + ? ["NewWS1", "ModifyWSConnection", "DisconnectWSConnection"] + : ["NewSW1", "ModifySWConnection", "DisconnectSWConnection"], moduleName: checkPathName ? "ws-services" : "sw-services", locality: [], assignee: "ASSIGNED_TO_ALL", @@ -141,7 +143,7 @@ const WSInbox = ({ parentRoute }) => { let links = [ { text: t("WS_APPLY_NEW_CONNECTION_HOME_CARD_LABEL"), - link: `/digit-ui/employee/ws/create-application`, + link: `/mgramseva-digit-ui/employee/ws/create-application`, roles: ["WS_CEMP", "SW_CEMP"], }, ]; @@ -155,8 +157,8 @@ const WSInbox = ({ parentRoute }) => { { text: t("WS_SEWERAGE_CONNECTION_SEARCH_LABEL"), link: checkPathName - ? `/digit-ui/employee/ws/water/search-connection?from=WS_SEWERAGE_INBOX` - : `/digit-ui/employee/ws/sewerage/search-connection?from=WS_SEWERAGE_INBOX`, + ? `/mgramseva-digit-ui/employee/ws/water/search-connection?from=WS_SEWERAGE_INBOX` + : `/mgramseva-digit-ui/employee/ws/sewerage/search-connection?from=WS_SEWERAGE_INBOX`, roles: checkPathName ? ["WS_CEMP", "WS_APPROVER", "WS_FIELD_INSPECTOR", "WS_DOC_VERIFIER", "WS_CLERK"] : ["SW_CEMP", "SW_APPROVER", "SW_FIELD_INSPECTOR", "SW_DOC_VERIFIER", "SW_CLERK"], @@ -164,8 +166,8 @@ const WSInbox = ({ parentRoute }) => { { text: t("WS_SEWERAGE_APPLICATION_SEARCH"), link: checkPathName - ? `/digit-ui/employee/ws/water/search-application?from=WS_SEWERAGE_INBOX` - : `/digit-ui/employee/ws/sewerage/search-application?from=WS_SEWERAGE_INBOX`, + ? `/mgramseva-digit-ui/employee/ws/water/search-application?from=WS_SEWERAGE_INBOX` + : `/mgramseva-digit-ui/employee/ws/sewerage/search-application?from=WS_SEWERAGE_INBOX`, roles: checkPathName ? ["WS_CEMP", "WS_APPROVER", "WS_FIELD_INSPECTOR", "WS_DOC_VERIFIER", "WS_CLERK"] : ["SW_CEMP", "SW_APPROVER", "SW_FIELD_INSPECTOR", "SW_DOC_VERIFIER", "SW_CLERK"], @@ -205,7 +207,7 @@ const WSInbox = ({ parentRoute }) => { }; const onFilterFormSubmit = (data) => { - data.hasOwnProperty("") && delete data?.[""] ; + data.hasOwnProperty("") && delete data?.[""]; dispatch({ action: "mutateTableForm", data: { ...tableOrderFormDefaultValues } }); dispatch({ action: "mutateFilterForm", data }); }; @@ -227,8 +229,20 @@ const WSInbox = ({ parentRoute }) => { onFilterFormReset, }; - const propsForInboxTable = useInboxTableConfig({ ...{ parentRoute, onPageSizeChange, formState, totalCount, table, dispatch, onSortingByData,tenantId, inboxStyles:{overflowX:"scroll", overflowY:"hidden"}, tableStyle:{width:"70%"} } }); - + const propsForInboxTable = useInboxTableConfig({ + ...{ + parentRoute, + onPageSizeChange, + formState, + totalCount, + table, + dispatch, + onSortingByData, + tenantId, + inboxStyles: { overflowX: "scroll", overflowY: "hidden" }, + tableStyle: { width: "70%" }, + }, + }); const propsForInboxMobileCards = useInboxMobileCardsData({ parentRoute, table }); diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/ws/src/components/WSInbox/useInboxMobileCardsData.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/ws/src/components/WSInbox/useInboxMobileCardsData.js index 26980e1f6..2c9d7f9f2 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/ws/src/components/WSInbox/useInboxMobileCardsData.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/ws/src/components/WSInbox/useInboxMobileCardsData.js @@ -10,16 +10,16 @@ const useInboxMobileCardsData = ({ parentRoute, table }) => { value === "Active" || value > 0 ? {value} : {value}; const GetStatusLinkCell = (value, tenantId, applicationType) => { - let service = value?.includes("WS")?"WATER":"SEWERAGE"; + let service = value?.includes("WS") ? "WATER" : "SEWERAGE"; let application = "application"; if (applicationType?.toUpperCase()?.includes("DISCONNECT")) { - application = "disconnection" + application = "disconnection"; } else if (applicationType?.toUpperCase()?.includes("MODIFY")) { - application = "modify" + application = "modify"; } return (
- + {" "} {value} @@ -31,7 +31,7 @@ const useInboxMobileCardsData = ({ parentRoute, table }) => { [t("WS_COMMON_TABLE_COL_CONSUMER_NO_LABEL")]: connectionNo, [t("WS_COMMON_TABLE_COL_OWN_NAME_LABEL")]: owner, [t("WS_COMMON_TABLE_COL_APP_TYPE_LABEL")]: t(`WS_${applicationType?.toUpperCase()}`), - [t("WS_COMMON_TABLE_COL_SERVICE_LABEL")]: businessService?t(`WS_COMMON_INBOX_${businessService?.toUpperCase()}`):"NA", + [t("WS_COMMON_TABLE_COL_SERVICE_LABEL")]: businessService ? t(`WS_COMMON_INBOX_${businessService?.toUpperCase()}`) : "NA", [t("WS_COMMON_TABLE_COL_APPLICATION_STATUS")]: t(`CS_${status}`), [t("ES_INBOX_SLA_DAYS_REMAINING")]: GetStatusCell(sla), })); diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/ws/src/components/WSInbox/useInboxTableConfig.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/ws/src/components/WSInbox/useInboxTableConfig.js index b7e937cc8..09df62950 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/ws/src/components/WSInbox/useInboxTableConfig.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/ws/src/components/WSInbox/useInboxTableConfig.js @@ -2,7 +2,18 @@ import React, { useMemo } from "react"; import { Link } from "react-router-dom"; import { useTranslation } from "react-i18next"; -const useInboxTableConfig = ({ parentRoute, onPageSizeChange, formState, totalCount, table, dispatch, onSortingByData, tenantId, inboxStyles={}, tableStyle={} }) => { +const useInboxTableConfig = ({ + parentRoute, + onPageSizeChange, + formState, + totalCount, + table, + dispatch, + onSortingByData, + tenantId, + inboxStyles = {}, + tableStyle = {}, +}) => { const { t } = useTranslation(); const GetCell = (value) => {value}; @@ -20,14 +31,14 @@ const useInboxTableConfig = ({ parentRoute, onPageSizeChange, formState, totalCo if (row.original["applicationNo"].includes("SW")) service = "SEWERAGE"; let application = "application"; if (row?.original?.["applicationType"]?.toUpperCase()?.includes("DISCONNECT")) { - application = "disconnection" + application = "disconnection"; } else if (row?.original?.["applicationType"]?.toUpperCase()?.includes("MODIFY")) { - application = "modify" + application = "modify"; } return (
{" "} {row.original["applicationNo"]} @@ -103,8 +114,8 @@ const useInboxTableConfig = ({ parentRoute, onPageSizeChange, formState, totalCo // searchQueryForTable, data: table, columns: tableColumnConfig, - inboxStyles:{...inboxStyles}, - tableStyle:{...tableStyle}, + inboxStyles: { ...inboxStyles }, + tableStyle: { ...tableStyle }, }; }; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/ws/src/pageComponents/WSDisconnectionForm.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/ws/src/pageComponents/WSDisconnectionForm.js index edfb8e8b2..fbd630e17 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/ws/src/pageComponents/WSDisconnectionForm.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/ws/src/pageComponents/WSDisconnectionForm.js @@ -1,25 +1,25 @@ -import { - CardLabel, - FormStep, - Loader, - RadioButtons, - TextInput, +import { + CardLabel, + FormStep, + Loader, + RadioButtons, + TextInput, UploadFile, LabelFieldPair, TextArea, - SubmitBar, + SubmitBar, CitizenInfoLabel, - CardHeader , + CardHeader, Toast, DatePicker, Header, CardSectionHeader, - StatusTable, + StatusTable, Row, InfoBannerIcon, ActionBar, Dropdown, - InfoIcon + InfoIcon, } from "@egovernments/digit-ui-react-components"; import React, { useEffect, useState } from "react"; import { useHistory, useRouteMatch } from "react-router-dom"; @@ -36,12 +36,12 @@ const WSDisconnectionForm = ({ t, config, onSelect, userType }) => { const applicationData = Digit.SessionStorage.get("WS_DISCONNECTION"); const history = useHistory(); const match = useRouteMatch(); - + const [disconnectionData, setDisconnectionData] = useState({ - type: applicationData.WSDisconnectionForm ? applicationData.WSDisconnectionForm.type : "", - date: applicationData.WSDisconnectionForm ? applicationData.WSDisconnectionForm.date : "", - reason: applicationData.WSDisconnectionForm ? applicationData.WSDisconnectionForm.reason : "", - documents: applicationData.WSDisconnectionForm ? applicationData.WSDisconnectionForm.documents : [] + type: applicationData.WSDisconnectionForm ? applicationData.WSDisconnectionForm.type : "", + date: applicationData.WSDisconnectionForm ? applicationData.WSDisconnectionForm.date : "", + reason: applicationData.WSDisconnectionForm ? applicationData.WSDisconnectionForm.reason : "", + documents: applicationData.WSDisconnectionForm ? applicationData.WSDisconnectionForm.documents : [], }); const [documents, setDocuments] = useState(applicationData.WSDisconnectionForm ? applicationData.WSDisconnectionForm.documents : []); const [error, setError] = useState(null); @@ -50,8 +50,8 @@ const WSDisconnectionForm = ({ t, config, onSelect, userType }) => { const [isEnableLoader, setIsEnableLoader] = useState(false); const { isMdmsLoading, data: mdmsData } = Digit.Hooks.ws.useMDMS(stateCode, "ws-services-masters", ["disconnectionType"]); - const { isLoading: wsDocsLoading, data: wsDocs } = Digit.Hooks.ws.WSSearchMdmsTypes.useWSServicesMasters(stateCode, "DisconnectionDocuments"); - const {isLoading: slaLoading, data: slaData } = Digit.Hooks.ws.useDisconnectionWorkflow({tenantId}); + const { isLoading: wsDocsLoading, data: wsDocs } = Digit.Hooks.ws.WSSearchMdmsTypes.useWSServicesMasters(stateCode, "DisconnectionDocuments"); + const { isLoading: slaLoading, data: slaData } = Digit.Hooks.ws.useDisconnectionWorkflow({ tenantId }); const isReSubmit = window.location.href.includes("resubmit"); const { isLoading: creatingWaterApplicationLoading, @@ -69,7 +69,6 @@ const WSDisconnectionForm = ({ t, config, onSelect, userType }) => { mutate: waterUpdateMutation, } = Digit.Hooks.ws.useWSApplicationActions("WATER"); - const { isLoading: creatingSewerageApplicationLoading, isError: createSewerageApplicationError, @@ -86,62 +85,64 @@ const WSDisconnectionForm = ({ t, config, onSelect, userType }) => { mutate: sewerageUpdateMutation, } = Digit.Hooks.ws.useWSApplicationActions("SEWERAGE"); - - const closeToastOfError = () => { setError(null); }; + const closeToastOfError = () => { + setError(null); + }; useEffect(() => { - const oldData = {...disconnectionData}; - oldData['documents'] = documents; + const oldData = { ...disconnectionData }; + oldData["documents"] = documents; setDisconnectionData(oldData); }, [documents]); - useEffect(() => { - const disconnectionTypes = mdmsData?.["ws-services-masters"]?.disconnectionType || []; - disconnectionTypes?.forEach(data => data.i18nKey = `WS_DISCONNECTIONTYPE_${stringReplaceAll(data?.code?.toUpperCase(), " ", "_")}`); + const disconnectionTypes = mdmsData?.["ws-services-masters"]?.disconnectionType || []; + disconnectionTypes?.forEach((data) => (data.i18nKey = `WS_DISCONNECTIONTYPE_${stringReplaceAll(data?.code?.toUpperCase(), " ", "_")}`)); setDisconnectionTypeList(disconnectionTypes); }, [mdmsData]); useEffect(() => { - Digit.SessionStorage.set("WS_DISCONNECTION", {...applicationData, WSDisconnectionForm: disconnectionData}); + Digit.SessionStorage.set("WS_DISCONNECTION", { ...applicationData, WSDisconnectionForm: disconnectionData }); }, [disconnectionData]); const handleSubmit = () => onSelect(config.key, { WSDisConnectionForm: disconnectionData }); const handleEmployeeSubmit = () => { - onSelect(config.key, { WSDisConnectionForm: {...disconnectionData, documents:documents} }); + onSelect(config.key, { WSDisConnectionForm: { ...disconnectionData, documents: documents } }); }; - const onSkip = () => onSelect(); const filedChange = (val) => { - const oldData = {...disconnectionData}; - oldData[val.code]=val; + const oldData = { ...disconnectionData }; + oldData[val.code] = val; setDisconnectionData(oldData); - } + }; const onSubmit = async (data) => { - const appDate= new Date(); - const proposedDate= format(addDays(appDate, slaData?.slaDays), 'yyyy-MM-dd').toString(); + const appDate = new Date(); + const proposedDate = format(addDays(appDate, slaData?.slaDays), "yyyy-MM-dd").toString(); - if( convertDateToEpoch(data?.date) <= convertDateToEpoch(proposedDate)){ - setError({key: "error", message: "PROPOSED_DISCONNECTION_INVALID_DATE"}); + if (convertDateToEpoch(data?.date) <= convertDateToEpoch(proposedDate)) { + setError({ key: "error", message: "PROPOSED_DISCONNECTION_INVALID_DATE" }); setTimeout(() => { setError(false); }, 3000); - } - - else if(wsDocsLoading || documents.length < 2 || disconnectionData?.reason?.value === "" || disconnectionData?.reason === "" || disconnectionData?.date === "" || disconnectionData?.type === ""){ + } else if ( + wsDocsLoading || + documents.length < 2 || + disconnectionData?.reason?.value === "" || + disconnectionData?.reason === "" || + disconnectionData?.date === "" || + disconnectionData?.type === "" + ) { setError({ warning: true, message: "PLEASE_FILL_MANDATORY_DETAILS" }); setTimeout(() => { setError(false); }, 3000); - } - - else { + } else { const payload = await createPayloadOfWSDisconnection(data, applicationData, applicationData?.applicationData?.serviceType); - if(payload?.WaterConnection?.water){ + if (payload?.WaterConnection?.water) { if (waterMutation) { setIsEnableLoader(true); await waterMutation(payload, { @@ -153,27 +154,30 @@ const WSDisconnectionForm = ({ t, config, onSelect, userType }) => { onSuccess: async (data, variables) => { let response = await updatePayloadOfWSDisconnection(data?.WaterConnection?.[0], "WATER"); let waterConnectionUpdate = { WaterConnection: response }; - waterConnectionUpdate = {...waterConnectionUpdate, disconnectRequest: true} + waterConnectionUpdate = { ...waterConnectionUpdate, disconnectRequest: true }; await waterUpdateMutation(waterConnectionUpdate, { onError: (error, variables) => { setIsEnableLoader(false); - setError({ key: "error", message: error?.response?.data?.Errors?.[0].message ? error?.response?.data?.Errors?.[0].message : error }); + setError({ + key: "error", + message: error?.response?.data?.Errors?.[0].message ? error?.response?.data?.Errors?.[0].message : error, + }); setTimeout(closeToastOfError, 5000); }, onSuccess: (data, variables) => { - Digit.SessionStorage.set("WS_DISCONNECTION", {...applicationData, DisconnectionResponse: data?.WaterConnection?.[0]}); - history.push(`/digit-ui/employee/ws/ws-disconnection-response?applicationNumber=${data?.WaterConnection?.[0]?.applicationNo}`); + Digit.SessionStorage.set("WS_DISCONNECTION", { ...applicationData, DisconnectionResponse: data?.WaterConnection?.[0] }); + history.push( + `/mgramseva-digit-ui/employee/ws/ws-disconnection-response?applicationNumber=${data?.WaterConnection?.[0]?.applicationNo}` + ); }, - }) + }); }, }); } - } - else if(payload?.SewerageConnection?.sewerage){ + } else if (payload?.SewerageConnection?.sewerage) { if (sewerageMutation) { setIsEnableLoader(true); await sewerageMutation(payload, { - onError: (error, variables) => { setIsEnableLoader(false); setError({ key: "error", message: error?.response?.data?.Errors?.[0].message ? error?.response?.data?.Errors?.[0].message : error }); @@ -182,114 +186,125 @@ const WSDisconnectionForm = ({ t, config, onSelect, userType }) => { onSuccess: async (data, variables) => { let response = await updatePayloadOfWSDisconnection(data?.SewerageConnections?.[0], "SEWERAGE"); let sewerageConnectionUpdate = { SewerageConnection: response }; - sewerageConnectionUpdate = {...sewerageConnectionUpdate, disconnectRequest: true}; + sewerageConnectionUpdate = { ...sewerageConnectionUpdate, disconnectRequest: true }; await sewerageUpdateMutation(sewerageConnectionUpdate, { onError: (error, variables) => { setIsEnableLoader(false); - setError({ key: "error", message: error?.response?.data?.Errors?.[0].message ? error?.response?.data?.Errors?.[0].message : error }); + setError({ + key: "error", + message: error?.response?.data?.Errors?.[0].message ? error?.response?.data?.Errors?.[0].message : error, + }); setTimeout(closeToastOfError, 5000); }, onSuccess: (data, variables) => { - Digit.SessionStorage.set("WS_DISCONNECTION", {...applicationData, DisconnectionResponse: data?.SewerageConnections?.[0]}); - history.push(`/digit-ui/employee/ws/ws-disconnection-response?applicationNumber=${data?.SewerageConnections?.[0]?.applicationNo}`); + Digit.SessionStorage.set("WS_DISCONNECTION", { ...applicationData, DisconnectionResponse: data?.SewerageConnections?.[0] }); + history.push( + `/mgramseva-digit-ui/employee/ws/ws-disconnection-response?applicationNumber=${data?.SewerageConnections?.[0]?.applicationNo}` + ); }, - }) + }); }, }); } } } - - } ; - - if (isMdmsLoading || wsDocsLoading || isEnableLoader || slaLoading) return + }; + if (isMdmsLoading || wsDocsLoading || isEnableLoader || slaLoading) return ; -if(userType === 'citizen') { + if (userType === "citizen") { return (
- {userType === "citizen" && ()} - - -
- { isReSubmit ? t("RESUBMIT_DISCONNECTION_FORM") : t("WS_APPLICATION_FORM")} - - - - - {t("WS_DISCONNECTION_TYPE") + "*"} - filedChange({code: "type",value: val})} - labelKey="WS_DISCONNECTION_TYPE" - inputStyle={isMobile ? {marginLeft:"unset"} : {}} + {userType === "citizen" && } + +
+ {isReSubmit ? t("RESUBMIT_DISCONNECTION_FORM") : t("WS_APPLICATION_FORM")} + + + + + + {t("WS_DISCONNECTION_TYPE") + "*"} + + filedChange({ code: "type", value: val })} + labelKey="WS_DISCONNECTION_TYPE" + inputStyle={isMobile ? { marginLeft: "unset" } : {}} /> - - {t("WS_DISCONNECTION_PROPOSED_DATE") + "*"} -
- - + {t("WS_DISCONNECTION_PROPOSED_DATE") + "*"} +
+ + - {t("SHOULD_BE_DATE") + " " + slaData?.slaDays + " " + t("DAYS_OF_APPLICATION_DATE")} - + width: Digit.Utils.browser.isMobile() ? "150px" : "unset", + }} + > + {t("SHOULD_BE_DATE") + " " + slaData?.slaDays + " " + t("DAYS_OF_APPLICATION_DATE")} + +
+ +
+ { + setDisconnectionData({ ...disconnectionData, date: date }); + }} + >
- -
- { - setDisconnectionData({ ...disconnectionData, date: date }); - }} - > -
- {t("WS_DISCONNECTION_REASON")+ "*"} - - {comment && comment?.length < 64 && {t("CS_MIN_LENGTH_64")}} -
} - - {!popup &&
- {t("CS_GO_BACK_HOME")} -
} - - - - ); -}; - -export default CitizenFeedback; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/Dialog/LogoutDialog.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/Dialog/LogoutDialog.js deleted file mode 100644 index 5f7e9aa76..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/Dialog/LogoutDialog.js +++ /dev/null @@ -1,111 +0,0 @@ -import { CardText, CloseSvg, Modal } from "@egovernments/digit-ui-react-components"; -import React from "react"; -import { useTranslation } from "react-i18next"; - -const Heading = (props) => { - return

{props.label}

; -}; -const Close = () => ( - - - - -); -const CloseBtn = (props) => { - return ( -
- { - props?.isMobileView - ? () - : (
) - } -
- ) -}; -const LogoutDialog = ({ onSelect, onCancel, onDismiss }) => { - const { t } = useTranslation(); - const mobileDeviceWidth = 780; - const [isMobileView, setIsMobileView] = React.useState(window.innerWidth <= mobileDeviceWidth); - const onResize = () => { - if (window.innerWidth <= mobileDeviceWidth) { - if (!isMobileView) { - setIsMobileView(true); - } - } else { - if (isMobileView) { - setIsMobileView(false); - } - } - } - React.useEffect(() => { - window.addEventListener("resize", () => { - onResize(); - }); - return () => { - window.addEventListener("resize", () => { - onResize(); - }); - }; - }); - return ( - isMobileView - ? } - headerBarEnd={} - actionCancelLabel={t("TL_COMMON_NO")} - actionCancelOnSubmit={onCancel} - actionSaveLabel={t("TL_COMMON_YES")} - actionSaveOnSubmit={onSelect} - formId="modal-action"> -
- - {t("CORE_LOGOUT_MOBILE_CONFIRMATION_MESSAGE") + " "} - -
-
- : } - headerBarEnd={} - actionCancelLabel={t("CORE_LOGOUT_CANCEL")} - actionCancelOnSubmit={onCancel} - actionSaveLabel={t("CORE_LOGOUT_WEB_YES")} - actionSaveOnSubmit={onSelect} - formId="modal-action"> -
- - {t("CORE_LOGOUT_WEB_CONFIRMATION_MESSAGE") + " "} - {t("CORE_LOGOUT_MESSAGE")}? - -
-
- ) -} -export default LogoutDialog; \ No newline at end of file diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/ErrorBoundaries.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/ErrorBoundaries.js deleted file mode 100644 index 74a403811..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/ErrorBoundaries.js +++ /dev/null @@ -1,57 +0,0 @@ -import React from "react"; -import ErrorComponent from "./ErrorComponent"; - -const Redircter = () => { - const path = Digit.UserService.getType() === "employee" ? "/mgramseva-digit-ui/employee/user/error" : "/digit-ui/citizen/error"; - if ( - window.location.href.includes("employee/user/error") || - window.location.href.includes("citizen/error") || - process.env.NODE_ENV === "development" - ) { - //do nothing - } else { - window.location.href = path; - } - return ; -}; - -class ErrorBoundary extends React.Component { - constructor(props) { - super(props); - this.state = { error: null, errorStack: null, hasError: false }; - } - - static getDerivedStateFromError(error) { - // Update state so the next render will show the fallback UI. - return { error: error?.message, hasError: true, errorStack: error?.stack }; - } - - componentDidCatch(error, errorInfo) { - // Catch errors in any components below and re-render with error message - this.setState({ error: error?.message, hasError: true, errorStack: error?.stack }); - // You can also log error messages to an error reporting service here - } - - render() { - if (this.state.hasError) { - // ("UI-errorInfo", this.state?.errorStack); - // ("UI-component-details", this.props); - // You can render any custom fallback UI - return ( -
- - - - {/* Something went wrong -
- {this.state?.errorStack && this.state.errorStack.toString().substring(0, 600)} - {this.state?.error} -
*/} -
- ); - } - return this.props.children; - } -} - -export default ErrorBoundary; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/ErrorComponent.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/ErrorComponent.js deleted file mode 100644 index daada6e1d..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/ErrorComponent.js +++ /dev/null @@ -1,46 +0,0 @@ -import React from "react"; -import { useTranslation } from "react-i18next"; - -const ErrorConfig = { - error: { - imgUrl: `https://s3.ap-south-1.amazonaws.com/egov-qa-assets/error-image.png`, - infoMessage: "CORE_SOMETHING_WENT_WRONG", - buttonInfo: "ACTION_TEST_HOME", - }, - maintenance: { - imgUrl: `https://s3.ap-south-1.amazonaws.com/egov-qa-assets/maintainence-image.png`, - infoMessage: "CORE_UNDER_MAINTENANCE", - buttonInfo: "ACTION_TEST_HOME", - }, - notfound: { - imgUrl: `https://s3.ap-south-1.amazonaws.com/egov-qa-assets/PageNotFound.png`, - infoMessage: "CORE_NOT_FOUND", - buttonInfo: "ACTION_TEST_HOME", - }, -}; - -const ErrorComponent = (props) => { - const { type = "error" } = Digit.Hooks.useQueryParams(); - const config = ErrorConfig[type]; - const { t } = useTranslation(); - - const stateInfo = props.stateInfo; - - return ( -
-
- error -

{t(config.infoMessage)}

- -
-
- ); -}; - -export default ErrorComponent; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/Header.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/Header.js deleted file mode 100644 index a07bdb9d0..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/Header.js +++ /dev/null @@ -1,20 +0,0 @@ -import React from "react"; -import { useTranslation } from "react-i18next"; -import { Loader } from "@egovernments/digit-ui-react-components" - -const Header = () => { - const { data: storeData, isLoading } = Digit.Hooks.useStore.getInitData(); - const { stateInfo } = storeData || {}; - const { t } = useTranslation() - - if (isLoading) return ; - - return ( -
- -

{t(`TENANT_TENANTS_${stateInfo?.code.toUpperCase()}`)}

-
- ); -} - -export default Header; \ No newline at end of file diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/Home.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/Home.js deleted file mode 100644 index 3e131d15c..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/Home.js +++ /dev/null @@ -1,148 +0,0 @@ -import { - BackButton, - BillsIcon, - CitizenHomeCard, - CitizenInfoLabel, - FSMIcon, - Loader, - MCollectIcon, - OBPSIcon, - PGRIcon, - PTIcon, - TLIcon, - WSICon, -} from "@egovernments/digit-ui-react-components"; -import React from "react"; -import { useTranslation } from "react-i18next"; - -/* -Feature :: Citizen All service screen cards -*/ -export const processLinkData = (newData, code, t) => { - const obj = newData?.[`${code}`]; - if (obj) { - obj.map((link) => { - (link.link = link["navigationURL"]), (link.i18nKey = t(link["name"])); - }); - } - const newObj = { - links: obj?.reverse(), - header: Digit.Utils.locale.getTransformedLocale(`ACTION_TEST_${code}`), - iconName: `CITIZEN_${code}_ICON`, - }; - if (code === "FSM") { - const roleBasedLoginRoutes = [ - { - role: "FSM_DSO", - from: "/digit-ui/citizen/fsm/dso-dashboard", - dashoardLink: "CS_LINK_DSO_DASHBOARD", - loginLink: "CS_LINK_LOGIN_DSO", - }, - ]; - //RAIN-7297 - roleBasedLoginRoutes.map(({ role, from, loginLink, dashoardLink }) => { - if (Digit.UserService.hasAccess(role)) - newObj?.links?.push({ - link: from, - i18nKey: t(dashoardLink), - }); - else - newObj?.links?.push({ - link: `/digit-ui/citizen/login`, - state: { role: "FSM_DSO", from }, - i18nKey: t(loginLink), - }); - }); - } - - return newObj; -}; -const iconSelector = (code) => { - switch (code) { - case "PT": - return ; - case "WS": - return ; - case "FSM": - return ; - case "MCollect": - return ; - case "PGR": - return ; - case "TL": - return ; - case "OBPS": - return ; - case "Bills": - return ; - default: - return ; - } -}; -const CitizenHome = ({ modules, getCitizenMenu, fetchedCitizen, isLoading }) => { - const paymentModule = modules.filter(({ code }) => code === "Payment")[0]; - const moduleArr = modules.filter(({ code }) => code !== "Payment"); - const moduleArray = [paymentModule, ...moduleArr]; - const { t } = useTranslation(); - if (isLoading) { - return ; - } - - return ( - -
- -
- {moduleArray - .filter((mod) => mod) - .map(({ code }, index) => { - let mdmsDataObj; - if (fetchedCitizen) mdmsDataObj = fetchedCitizen ? processLinkData(getCitizenMenu, code, t) : undefined; - if (mdmsDataObj?.links?.length > 0) { - return ( - ele?.link)?.sort((x, y) => x?.orderNumber - y?.orderNumber)} - Icon={() => iconSelector(code)} - Info={ - code === "OBPS" - ? () => ( - - ) - : null - } - isInfo={code === "OBPS" ? true : false} - /> - ); - } else return ; - })} -
-
-
- ); -}; - -const EmployeeHome = ({ modules }) => { - if(window.Digit.SessionStorage.get("PT_CREATE_EMP_TRADE_NEW_FORM")) window.Digit.SessionStorage.set("PT_CREATE_EMP_TRADE_NEW_FORM",{}) - return ( -
-
- {modules.map(({ code }, index) => { - const Card = Digit.ComponentRegistryService.getComponent(`${code}Card`) || (() => ); - return ; - })} -
-
- ); -}; - -export const AppHome = ({ userType, modules, getCitizenMenu, fetchedCitizen, isLoading }) => { - if (userType === "citizen") { - return ; - } - return ; -}; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/Search/MobileSearchApplication.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/Search/MobileSearchApplication.js deleted file mode 100644 index a9950815b..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/Search/MobileSearchApplication.js +++ /dev/null @@ -1,188 +0,0 @@ -import React, { Fragment, useCallback, useMemo, useReducer, useState, useEffect } from "react"; -import { - CloseSvg, - SearchForm, - Table, - Card, - SearchAction, - FilterAction, - PopUp, - DetailsCard, - Loader, - Toast, - BackButton, - Header, - DownloadBtnCommon -} from "@egovernments/digit-ui-react-components"; -import SearchFormFields from "./SearchFields"; -// import { convertEpochToDateDMY } from "../../utils"; - -const MobileSearchApplication = ({ Controller, register, control, t, reset, previousPage, handleSubmit, tenantId, data, onSubmit, isLoading}) => { - - function activateModal(state, action) { - switch (action.type) { - case "set": - return action.payload; - case "remove": - return false; - default: - break; } - } - const [tabledata,settabledata ]=useState([]); - const DownloadBtn = (props) => { - return ( -
- -
- ); - }; - const handleExcelDownload = (tabData) => { - if(tabData?.[0] !== undefined){ - return Digit.Download.Excel(tabData?.[0] , "AuditReport"); - } - }; - useEffect(() => { - if ( data?.length >0){ - settabledata([ - - data?.map((obj)=> { - let returnObject={}; - returnObject[ t("AUDIT_DATE_LABEL")]=convertEpochToDate(obj?.timestamp) || "-"; - returnObject[t("AUDIT_TIME_LABEL")]=convertEpochToTimeInHours(obj?.timestamp)|| "-"; - returnObject[t("AUDIT_DATAVIEWED_LABEL")]=obj?.dataView?.join(", ")|| "-"; - returnObject[t("AUDIT_DATAVIEWED_BY_LABEL")]=obj?.dataViewedBy|| "-"; - returnObject[t("AUDIT_ROLE_LABEL")]=obj?.roles?.map(obj=>obj.name).join(", ") || "-"; - return { - ...returnObject, - } - }) - ]) - } - }, [data]); - const convertEpochToDate = (dateEpoch) => { - if (dateEpoch == null || dateEpoch == undefined || dateEpoch == "") { - return "NA"; - } - const dateFromApi = new Date(dateEpoch); - let month = dateFromApi.getMonth() + 1; - let day = dateFromApi.getDate(); - let year = dateFromApi.getFullYear(); - month = (month > 9 ? "" : "0") + month; - day = (day > 9 ? "" : "0") + day; - return `${day}/${month}/${year}`; - }; - const convertEpochToTimeInHours = (dateEpoch) => { - if (dateEpoch == null || dateEpoch == undefined || dateEpoch == "") { - return "NA"; - } - const dateFromApi = new Date(dateEpoch); - let hour = dateFromApi.getHours(); - let min = dateFromApi.getMinutes(); - let period = hour > 12 ? "PM" : "AM"; - hour = hour > 12 ? hour - 12 : hour; - hour = (hour > 9 ? "" : "0") + hour; - min = (min > 9 ? "" : "0") + min; - return `${hour}:${min} ${period}`; - }; - const [currentlyActiveMobileModal, setActiveMobileModal] = useReducer(activateModal, false); - - const closeMobilePopupModal = () => { - setActiveMobileModal({ type: "remove" }); - }; - - const MobilePopUpCloseButton = () => ( -
- -
- ); - const searchFormFieldsComponentProps = { Controller, register, control, t, reset, previousPage }; - - const MobileComponentDirectory = ({ currentlyActiveMobileModal, searchFormFieldsComponentProps, tenantId, ...props }) => { - const { closeMobilePopupModal } = props; - switch (currentlyActiveMobileModal) { - case "SearchFormComponent": - return ( - - -
-

{t("PRIVACY_AUDIT_REPORT")}:

-
- - {/* - -

{t(`ES_COMMON_CLEAR_ALL`)}

-
*/} -
- ); - default: - return ; - } - }; - const CurrentMobileModalComponent = useCallback( - ({ currentlyActiveMobileModal, searchFormFieldsComponentProps, tenantId, ...props }) => - MobileComponentDirectory({ currentlyActiveMobileModal, searchFormFieldsComponentProps, tenantId, ...props }), - [currentlyActiveMobileModal] - ); - let roles = []; - data?.roles?.forEach((item) => { - roles.push(item?.name); -}); - const propsMobileInboxCards = useMemo( - () => { - if (data?.display){ - return [] - } - if(data === "") - { - return []; - } - return data?.map((data) => ({ - [t("AUDIT_DATE_LABEL")]: convertEpochToDate(data.timestamp)|| "-", - [t("AUDIT_TIME_LABEL")]: convertEpochToTimeInHours(data.timestamp)|| "-", - [t("AUDIT_DATAVIEWED_LABEL")]: data.dataView?.join(", ")|| "-", - [t("AUDIT_DATAVIEWED_BY_LABEL")]: data.dataViewedBy|| "-", - [t("AUDIT_ROLE_LABEL")]: data.roles?.slice(0,3)?.map((e)=>e.name).join(", ")|| "-", - })) - }, - [data] - ); - - return ( - - -
- handleExcelDownload(tabledata)}/> -
-
{t("PRIVACY_AUDIT_REPORT")}:
-
- setActiveMobileModal({ type: "set", payload: "SearchFormComponent" })} - {...{tenantId, t}} - /> -
- {currentlyActiveMobileModal ? ( - - { - setActiveMobileModal({ type: "remove" }); - onSubmit(data); - }} - handleSubmit={handleSubmit} - id="search-form" - className="rm-mb form-field-flex-one inboxPopupMobileWrapper" - {...{ searchFormFieldsComponentProps, currentlyActiveMobileModal, closeMobilePopupModal, tenantId }} - /> - - ) : null} - {isLoading && } - -
- ) - } - - export default MobileSearchApplication \ No newline at end of file diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/Search/SearchFields.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/Search/SearchFields.js deleted file mode 100644 index e05239b98..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/Search/SearchFields.js +++ /dev/null @@ -1,49 +0,0 @@ -import React, { Fragment } from "react"; -import { Controller, useWatch } from "react-hook-form"; -import { - TextInput, - SubmitBar, - LinkLabel, - ActionBar, - CloseSvg, - DatePicker, - CardLabelError, - SearchForm, - SearchField, - Dropdown, - Table, - Card, - MobileNumber, - Loader, - CardText, - Header, -} from "@egovernments/digit-ui-react-components"; -const SearchFields = ({ register, control, reset, tenantId, t, previousPage, formState, isLoading }) => { -const isMobile = window.Digit.Utils.browser.isMobile(); - - return ( - <> - - - } - name="fromDate" - control={control} - /> - - - - } - name="toDate" - control={control} - /> - - - - - - ); -}; -export default SearchFields; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/Search/index.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/Search/index.js deleted file mode 100644 index 3a5a22640..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/Search/index.js +++ /dev/null @@ -1,205 +0,0 @@ -import { BackButton, Card, Header, SearchForm, Table, Loader,DownloadBtnCommon } from "@egovernments/digit-ui-react-components"; -import React, { useCallback, useEffect, useMemo , useState} from "react"; -import { Controller, useForm } from "react-hook-form"; -import { Link } from "react-router-dom"; -import MobileSearchApplication from "./MobileSearchApplication"; -import SearchFields from "./SearchFields"; - -const SearchApplication = ({showLoader,isLoading, tenantId, t, onSubmit, data, count }) => { - - const initialValues = Digit.SessionStorage.get("AUDIT_APPLICATION_DETAIL") || { - offset: 0, - limit:10, - sortOrder: "ASC" - }; - - const { register, control, handleSubmit, setValue, getValues, reset } = useForm({ - defaultValues: initialValues, - }); - const convertEpochToDate = (dateEpoch) => { - if (dateEpoch == null || dateEpoch == undefined || dateEpoch == "") { - return "NA"; - } - const dateFromApi = new Date(dateEpoch); - let month = dateFromApi.getMonth() + 1; - let day = dateFromApi.getDate(); - let year = dateFromApi.getFullYear(); - month = (month > 9 ? "" : "0") + month; - day = (day > 9 ? "" : "0") + day; - return `${day}/${month}/${year}`; - }; - const convertEpochToTimeInHours = (dateEpoch) => { - if (dateEpoch == null || dateEpoch == undefined || dateEpoch == "") { - return "NA"; - } - const dateFromApi = new Date(dateEpoch); - let hour = dateFromApi.getHours(); - let min = dateFromApi.getMinutes(); - let period = hour > 12 ? "PM" : "AM"; - hour = hour > 12 ? hour - 12 : hour; - hour = (hour > 9 ? "" : "0") + hour; - min = (min > 9 ? "" : "0") + min; - return `${hour}:${min} ${period}`; - }; - const [tabledata,settabledata ]=useState([]); - const DownloadBtn = (props) => { - return ( -
- -
- ); - }; - const handleExcelDownload = (tabData) => { - if(tabData?.[0] !== undefined){ - return Digit.Download.Excel(tabData?.[0] , "AuditReport"); - } - }; - useEffect(() => { - register("offset", 0); - register("limit", 10); - //register("sortOrder", "DESC"); -}, [register]); -useEffect(() => { - if ( data?.length >0){ - settabledata([ - - data?.map((obj)=> { - let returnObject={}; - returnObject[ t("AUDIT_DATE_LABEL")]=convertEpochToDate(obj?.timestamp)|| "-"; - returnObject[t("AUDIT_TIME_LABEL")]=convertEpochToTimeInHours(obj?.timestamp)|| "-"; - returnObject[t("AUDIT_DATAVIEWED_LABEL")]=obj?.dataView?.join(", ")|| "-"; - returnObject[t("AUDIT_DATAVIEWED_BY_LABEL")]=obj?.dataViewedBy; - returnObject[t("AUDIT_ROLE_LABEL")]=obj?.roles?.map(obj=>obj.name).join(", ")|| "-"; - return { - ...returnObject, - } - }) - ]) - } -}, [data]); -const onSort = useCallback((args) => { - if (args.length === 0) return; - setValue("sortBy", args.id); - setValue("sortOrder", args.desc ? "DESC" : "ASC"); -}, []); - -function onPageSizeChange(e) { - setValue("limit", Number(e.target.value)); - handleSubmit(onSubmit)(); -} - -function nextPage() { - setValue("offset", getValues("offset") + getValues("limit")); - handleSubmit(onSubmit)(); -} -function previousPage() { - setValue("offset", getValues("offset") - getValues("limit")); - handleSubmit(onSubmit)(); -} -const isMobile = window.Digit.Utils.browser.isMobile(); - -if (isMobile) { - return ; -} - -//need to get from workflow -const GetCell = (value) => {value}; -const columns = useMemo( - () => [ - { - Header:t("AUDIT_DATE_LABEL"), - disableSortBy: true, - accessor:( row ) => { - const timestamp = row.timestamp === "NA" ? t("WS_NA") : convertEpochToDate(row.timestamp); - return GetCell(`${timestamp || "-"}`); - }, - }, - { - Header:t("AUDIT_TIME_LABEL"), - disableSortBy: true, - accessor:(row) => { - const timestamp = row.timestamp === "NA" ? t("WS_NA") : convertEpochToTimeInHours(row.timestamp); - return GetCell(`${timestamp || "-"}`); - }, - }, - { - Header:isMobile? t("AUDIT_DATAVIEWED_LABEL"):t("AUDIT_DATAVIEWED_PRIVACY"), - disableSortBy: true, - accessor: (row) => { - return GetCell(`${row?.dataView?.join(", ") || "-"}`); - }, - }, - { - Header:isMobile? t("AUDIT_DATAVIEWED_BY_LABEL"):t("AUDIT_DATAVIEWED_BY_PRIVACY"), - disableSortBy: true, - accessor:(row) => { - return GetCell(`${row?.dataViewedBy || "-"}`); - }, - }, - { - Header:t("AUDIT_ROLE_LABEL"), - disableSortBy: true, - accessor: ( row ) => { - return GetCell(`${row?.roles?.slice(0,3)?.map((e)=>e.name)?.join(", ") || "-"}`); - }, - } - ], - [] - ); - - return ( - -
-
{t("PRIVACY_AUDIT_REPORT")}
- - - -
- {data?.display ? ( -
- {t(data.display) - .split("\\n") - .map((text, index) => ( -

- {text} -

- ))} -
- ) : ( - data !== "" ? ( -
-
- handleExcelDownload(tabledata)}/> -
-
a.timestamp - b.timestamp)} - totalRecords={count} - columns={columns} - getCellProps={(cellInfo) => { - return { - style: { - minWidth: cellInfo.column.Header === t("ES_INBOX_APPLICATION_NO") ? "240px" : "", - padding: "20px 18px", - fontSize: "16px", - }, - }; - }} - onPageSizeChange={onPageSizeChange} - currentPage={getValues("offset") / getValues("limit")} - onNextPage={nextPage} - onPrevPage={previousPage} - pageSizeLimit={getValues("limit")} - onSort={onSort} - disableSort={false} - sortParams={[{ id: getValues("sortBy"), desc: getValues("sortOrder") === "DESC" ? true : false }]} - /> - ) : ( - - - ))} - - ); - }; - - export default SearchApplication; \ No newline at end of file diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/TopBarSideBar/SideBar/CitizenSideBar.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/TopBarSideBar/SideBar/CitizenSideBar.js deleted file mode 100644 index 12fbe3ad8..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/TopBarSideBar/SideBar/CitizenSideBar.js +++ /dev/null @@ -1,269 +0,0 @@ -import { Loader, NavBar } from "@egovernments/digit-ui-react-components"; -import React, { useState } from "react"; -import { useTranslation } from "react-i18next"; -import { useHistory } from "react-router-dom"; -import SideBarMenu from "../../../config/sidebar-menu"; -import ChangeCity from "../../ChangeCity"; -import StaticCitizenSideBar from "./StaticCitizenSideBar"; - -const defaultImage = - "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAO4AAADUCAMAAACs0e/bAAAAM1BMVEXK0eL" + - "/" + - "/" + - "/" + - "/Dy97GzuD4+fvL0uPg5O7T2efb4OvR1+Xr7vTk5/Df4+37/P3v8fbO1eTt8PUsnq5FAAAGqElEQVR4nO2d25ajIBBFCajgvf/" + - "/a0eMyZgEjcI5xgt7Hmatme507UaxuJXidiDqjmSgeVIMlB1ZR1WZAf2gbdu0QwixSYzjOJPmHurfEGEfY9XzjNGG9whQCeVAuv5xQEySLtR9hPuIcwj0EeroN5m3D1IbsbgHK0esiQ9MKs" + - "qXVr8Hm/a/Pulk6wihpCIXBw3dh7bTvRBt9+dC5NfS1VH3xETdM3MxXRN1T0zUPTNR98xcS1dlV9NNfx3DhkTdM6PKqHteVBF1z0vU5f0sKdpc2zWLKutXrjJjdLvpesRmukqYonauPhXpds" + - "Lb6CppmpnltsYIuY2yavi6Mi2/rzAWm1zUfF0limVLqkZyA+mDYevKBS37aGC+L1lX5e7uyU1Cv565uiua9k5LFqbqqrnu2I3m+jJ11ZoLeRtfmdB0Uw/ZDsP0VTxdn7a1VERfmq7Xl" + - "Xyn5D2QWLoq8bZlPoBJumphJjVBw/Ll6CoTZGsTDs4NrGqKbqBth8ZHJUi6cn168QmleSm6GmB7Kxm+6obXlf7PoDHosCwM3QpiS2legi6ocSl3L0G3BdneDDgwQdENfeY+SfDJBkF37Z" + - "B+GvwzA6/rMaafAn8143VhPZWdjMWG1oHXhdnemgPoAvLlB/iZyRTfVeF06wPoQhJmlm4bdcOAZRlRN5gcPc5SoPEQR1fDdbOo6wn+uYvXxY0QCLom6gYROKH+Aj5nvphuFXWDiLpRdxl" + - "/19LFT95k6CHCrnW7pCDqBn1i1PUFvii2c11oZOJ6usWeH0RRNzC4Zs+6FTi2nevCVwCjbugnXklX5fkfTldL8PEilUB1kfNyN1u9MME2sATr4lbuB7AjfLAuvsRm1A0g6gYRdcPAjvBlje" + - "2Z8brI8OC68AcRdlCkwLohx2mcZMjw9q+LzarQurjtnwPYAydX08WecECO/u6Ad0GBdYG7jO5gB4Ap+PwKcA9ZT43dn4/W9TyiPAn4OAJaF7h3uwe8StSCddFdM3jqFa2LvnnB5zzhuuBBAj" + - "Y4gi50cg694gnXhTYvfMdrjtcFZhrwE9r41gUem8IXWMC3LrBzxh+a0gRd1N1LOK7M0IUUGuggvEmHoStA2/MJh7MpupiDU4TzjhxdzLAoO4ouZvqVURbFMHQlZD6SUeWHoguZsSLUGegreh" + - "A+FZFowPdUWTi6iMoZlIpGGUUXkDbjj/9ZOLqAQS/+GIKl5BQOCn/ycqpzkXSDm5dU7ZWkG7wUyGlcmm7g5Ux56AqirgoaJ7BeokPTDbp9CbVunjFxPrl7+HqnkrSq1Da7JX20f3dV8yJi6v" + - "oO81mX8vV0mx3qUsZCPRfTlVRdz2EvdufYGDvNQvvwqHtmXd+a1ITinwNcXc+lT6JuzdT1XDyBn/x7wtX1HCQQdW9MXc8xArGrirowfLeUEbMqqq6f7TF1lfRdOuGNiGi6SpT+WxY06xUfNN" + - "2wBfyE9I4tlm7w5hvOPDNJN3yNiLMipji6gE3chKhouoCtN5x3QlF0EZt8OW/8ougitqJQlk1aii7iFC9l0MvRReyao7xNjKML2Z/PuHlzhi5mFxljiZeiC9rPTEisNEMX9KYAwo5Xhi7qaA" + - "3hamboYm7dG+NVrXhdaYDv5zFaQZsYrCtbbAGnjkQDX2+J1FXCwOsqWOpKoIQNTFdqYBWydxqNqUoG0pVpCS+H8kaJaGKErlIaXj7CRRE+gRWuKwW9YZ80oVOUgbpdT0zpnSZJTIiwCtJVelv" + - "Xntr4P5j6BWfPb5Wcx84C4cq3hb11lco2u2Mdwp6XdJ/Ne3wb8DWdfiRenZaXrhLwOj4e+GQeHroy3YOspS7TlU28Wle2m2QUS0mqdcbrdNW+ZHsSsyK7tBfm0q/dWcv+Z3mytVx3t7KWulq" + - "Ue6ilunu8jF8pFwgv1FXp3mUt35OtRbr7eM4u4Gs6vUBXgeuHc5kfE/cbvWZtkROLm1DMtLCy80tzsu2PRj0hTI8fvrQuvsjlJkyutszq+m423wHaLTyniy/XuiGZ84LuT+m5ZfNfRxyGs7L" + - "XZOvia7VujatUwVTrIt+Q/Csc7Tuhe+BOakT10b4TuoiiJjvgU9emTO42PwEfBa+cuodKkuf42DXr1D3JpXz73Hnn0j10evHKe+nufgfUm+7B84sX9FfdEzXux2DBpWuKokkCqN/5pa/8pmvn" + - "L+RGKCddCGmatiPyPB/+ekO/M/q/7uvbt22kTt3zEnXPzCV13T3Gel4/6NduDu66xRvlPNkM1RjjxUdv+4WhGx6TftD19Q/dfzpwcHO+rE3fAAAAAElFTkSuQmCC"; -const Profile = ({ info, stateName, t }) => { - const [profilePic, setProfilePic] = React.useState(null); - React.useEffect(async () => { - const tenant = Digit.ULBService.getCurrentTenantId(); - const uuid = info?.uuid; - if (uuid) { - const usersResponse = await Digit.UserService.userSearch(tenant, { uuid: [uuid] }, {}); - - if (usersResponse && usersResponse.user && usersResponse.user.length) { - const userDetails = usersResponse.user[0]; - const thumbs = userDetails?.photo?.split(","); - setProfilePic(thumbs?.at(0)); - } - } - }, [profilePic !== null]); - return ( -
-
- -
-
-
{info?.name}
-
-
-
{info?.mobileNumber}
-
- {info?.emailId && ( -
-
{info.emailId}
-
- )} -
- {window.location.href.includes("/employee") && - !window.location.href.includes("/employee/user/login") && - !window.location.href.includes("employee/user/language-selection") && } -
- ); -}; -const PoweredBy = () => ( -
- Powered by DIGIT { - window.open(window?.globalConfigs?.getConfig?.("DIGIT_HOME_URL"), "_blank").focus(); - }} - />{" "} -
-); - -/* -Feature :: Citizen Webview sidebar -*/ -export const CitizenSideBar = ({ - isOpen, - isMobile = false, - toggleSidebar, - onLogout, - isEmployee = false, - linkData, - islinkDataLoading, - isSideBarScroll, -}) => { - const { data: storeData, isFetched } = Digit.Hooks.useStore.getInitData(); - const { stateInfo } = storeData || {}; - const user = Digit.UserService.getUser(); - const [search, setSearch] = useState(""); - - const { t } = useTranslation(); - const history = useHistory(); - const closeSidebar = () => { - Digit.clikOusideFired = true; - toggleSidebar(false); - }; - - const { isLoading, data } = Digit.Hooks.useAccessControl(); - const tenantId = Digit.ULBService.getCitizenCurrentTenant(); - const showProfilePage = () => { - const redirectUrl = isEmployee ? "/mgramseva-digit-ui/employee/user/profile" : "/digit-ui/citizen/user/profile"; - history.push(redirectUrl); - closeSidebar(); - }; - const redirectToLoginPage = () => { - // localStorage.clear(); - // sessionStorage.clear(); - history.push("/digit-ui/citizen/login"); - closeSidebar(); - }; - if (islinkDataLoading || isLoading || !isFetched) { - return ; - } - const filteredTenantContact = storeData?.tenants.filter((e) => e.code === tenantId)[0]?.contactNumber || storeData?.tenants[0]?.contactNumber; - - let menuItems = [...SideBarMenu(t, closeSidebar, redirectToLoginPage, isEmployee, storeData, tenantId)]; - let profileItem; - if (isFetched && user && user.access_token) { - profileItem = ; - menuItems = menuItems.filter((item) => item?.id !== "login-btn" && item?.id !== "help-line"); - menuItems = [ - ...menuItems, - { - text: t("EDIT_PROFILE"), - element: "PROFILE", - icon: "EditPencilIcon", - populators: { - onClick: showProfilePage, - }, - }, - { - text: t("CORE_COMMON_LOGOUT"), - element: "LOGOUT", - icon: "LogoutIcon", - populators: { - onClick: onLogout, - }, - }, - { - text: ( - - {t("CS_COMMON_HELPLINE")} - - - ), - element: "Helpline", - icon: "Phone", - }, - ]; - } - - let configEmployeeSideBar = {}; - - if (!isEmployee) { - Object.keys(linkData) - ?.sort((x, y) => y.localeCompare(x)) - ?.map((key) => { - if (linkData[key][0]?.sidebar === "digit-ui-links") - menuItems.splice(1, 0, { - type: linkData[key][0]?.sidebarURL?.includes("digit-ui") ? "link" : "external-link", - text: t(`ACTION_TEST_${Digit.Utils.locale.getTransformedLocale(key)}`), - links: linkData[key], - icon: linkData[key][0]?.leftIcon, - link: linkData[key][0]?.sidebarURL, - }); - }); - } else { - data?.actions - .filter((e) => e.url === "url" && e.displayName !== "Home") - .forEach((item) => { - if (search == "" && item.path !== "") { - let index = item.path.split(".")[0]; - if (index === "TradeLicense") index = "Trade License"; - if (!configEmployeeSideBar[index]) { - configEmployeeSideBar[index] = [item]; - } else { - configEmployeeSideBar[index].push(item); - } - } else if (item.path !== "" && item?.displayName?.toLowerCase().includes(search.toLowerCase())) { - let index = item.path.split(".")[0]; - if (index === "TradeLicense") index = "Trade License"; - if (!configEmployeeSideBar[index]) { - configEmployeeSideBar[index] = [item]; - } else { - configEmployeeSideBar[index].push(item); - } - } - }); - const keys = Object.keys(configEmployeeSideBar); - for (let i = 0; i < keys.length; i++) { - const getSingleDisplayName = configEmployeeSideBar[keys[i]][0]?.displayName?.toUpperCase()?.replace(/[ -]/g, "_"); - const getParentDisplayName = keys[i]?.toUpperCase()?.replace(/[ -]/g, "_"); - - if (configEmployeeSideBar[keys[i]][0].path.indexOf(".") === -1) { - menuItems.splice(1, 0, { - type: "link", - text: t(`ACTION_TEST_${getSingleDisplayName}`), - link: configEmployeeSideBar[keys[i]][0]?.navigationURL, - icon: configEmployeeSideBar[keys[i]][0]?.leftIcon?.split?.(":")[1], - populators: { - onClick: () => { - history.push(configEmployeeSideBar[keys[i]][0]?.navigationURL); - closeSidebar(); - }, - }, - }); - } else { - menuItems.splice(1, 0, { - type: "dynamic", - moduleName: t(`ACTION_TEST_${getParentDisplayName}`), - links: configEmployeeSideBar[keys[i]]?.map((ob) => { - return { ...ob, displayName: t(`ACTION_TEST_${ob?.displayName?.toUpperCase()?.replace(/[ -]/g, "_")}`) }; - }), - icon: configEmployeeSideBar[keys[i]][1]?.leftIcon, - }); - } - } - const indx = menuItems.findIndex((a) => a.element === "HOME"); - const home = menuItems.splice(indx, 1); - const comp = menuItems.findIndex((a) => a.element === "LANGUAGE"); - const part = menuItems.splice(comp, menuItems?.length - comp); - menuItems.sort((a, b) => { - let c1 = a?.type === "dynamic" ? a?.moduleName : a?.text; - let c2 = b?.type === "dynamic" ? b?.moduleName : b?.text; - return c1.localeCompare(c2); - }); - home?.[0] && menuItems.splice(0, 0, home[0]); - menuItems = part?.length > 0 ? menuItems.concat(part) : menuItems; - } - - /* URL with openlink wont have sidebar and actions */ - if (history.location.pathname.includes("/openlink")) { - profileItem = ; - menuItems = menuItems.filter((ele) => ele.element === "LANGUAGE"); - } - return isMobile ? ( - } - isEmployee={isEmployee} - search={search} - setSearch={setSearch} - /> - ) : ( - - ); -}; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/TopBarSideBar/SideBar/CitizenSubMenuSideBar.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/TopBarSideBar/SideBar/CitizenSubMenuSideBar.js deleted file mode 100644 index 2cffeac7f..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/TopBarSideBar/SideBar/CitizenSubMenuSideBar.js +++ /dev/null @@ -1,72 +0,0 @@ -import React, { useState } from "react"; -import { Link, useLocation } from "react-router-dom"; -import { - PropertyHouse, - CaseIcon, - CollectionIcon, - PTIcon, - OBPSIcon, - PGRIcon, - FSMIcon, - WSICon, - MCollectIcon, - BirthIcon, - DeathIcon, - FirenocIcon, -} from "@egovernments/digit-ui-react-components"; -import { useTranslation } from "react-i18next"; - -const CitizenSubMenuSideBar = ({ item }) => { - const [subnav, setSubnav] = useState(false); - const location = useLocation(); - const { pathname } = location; - const showSubnav = () => setSubnav(!subnav); - const { t } = useTranslation(); - - const IconsObject = { - CommonPTIcon: , - OBPSIcon: , - propertyIcon: , - TLIcon: , - PGRIcon: , - FSMIcon: , - WSIcon: , - BirthIcon: , - DeathIcon: , - FirenocIcon: , - MCollectIcon: , - BillsIcon: , - }; - - const leftIconArray = item.icon; - const leftIcon = leftIconArray ? IconsObject[leftIconArray] : IconsObject.BillsIcon; - return ( - -
-
-
- {leftIcon} - {t(Digit.Utils.locale.getTransformedLocale(`ACTION_TEST_${item.moduleName}`))} -
- -
{item.links && subnav}
-
-
- - {subnav && - item.links - .sort((a, b) => a.orderNumber - b.orderNumber) - .map((item, index) => { - return ( - -
- {item.label || item.displayName} -
- - ); - })} -
- ); -}; - -export default CitizenSubMenuSideBar; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/TopBarSideBar/SideBar/EmployeeSideBar.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/TopBarSideBar/SideBar/EmployeeSideBar.js deleted file mode 100644 index 23be73d3c..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/TopBarSideBar/SideBar/EmployeeSideBar.js +++ /dev/null @@ -1,188 +0,0 @@ -import React, { useRef, useEffect, useState } from "react"; -import SubMenu from "./SubMenu"; -import { Loader, SearchIcon } from "@egovernments/digit-ui-react-components"; -import { useTranslation } from "react-i18next"; -import NavItem from "./NavItem"; -import _, { findIndex } from "lodash"; - -const EmployeeSideBar = () => { - const sidebarRef = useRef(null); - const { isLoading, data } = Digit.Hooks.useAccessControl(); - const [search, setSearch] = useState(""); - const { t } = useTranslation(); - useEffect(() => { - if (isLoading) { - return ; - } - sidebarRef.current.style.cursor = "pointer"; - collapseNav(); - }, [isLoading]); - - const expandNav = () => { - sidebarRef.current.style.width = "260px"; - sidebarRef.current.style.overflow = "auto"; - - sidebarRef.current.querySelectorAll(".dropdown-link").forEach((element) => { - element.style.display = "flex"; - }); - }; - const collapseNav = () => { - sidebarRef.current.style.width = "55px"; - sidebarRef.current.style.overflow = "hidden"; - - sidebarRef.current.querySelectorAll(".dropdown-link").forEach((element) => { - element.style.display = "none"; - }); - sidebarRef.current.querySelectorAll(".actions").forEach((element) => { - element.style.padding = "0"; - }); - }; - - const configEmployeeSideBar = {}; - - //creating the object structure from mdms value for easy iteration - let configEmployeeSideBar1 = {}; - data?.actions - ?.filter((e) => e.url === "url") - ?.forEach((item) => { - _.set(configEmployeeSideBar1, item.path, { ...item }); - }); - - data?.actions - .filter((e) => e.url === "url") - .forEach((item) => { - let index = item.path.split(".")[0]; - if (search == "" && item.path !== "") { - index = item.path.split(".")[0]; - if (index === "TradeLicense") index = "Trade License"; - if (!configEmployeeSideBar[index]) { - configEmployeeSideBar[index] = [item]; - } else { - configEmployeeSideBar[index].push(item); - } - } else if ( - item.path !== "" && - t(`ACTION_TEST_${index?.toUpperCase()?.replace(/[ -]/g, "_")}`) - ?.toLowerCase() - .includes(search.toLowerCase()) - ) { - index = item.path.split(".")[0]; - if (index === "TradeLicense") index = "Trade License"; - if (!configEmployeeSideBar[index]) { - configEmployeeSideBar[index] = [item]; - } else { - configEmployeeSideBar[index].push(item); - } - } - }); - let res = []; - - //method is used for restructing of configEmployeeSideBar1 nested object into nested array object - function restructuringOfConfig(tempconfig) { - const result = []; - for (const key in tempconfig) { - const value = tempconfig[key]; - if (typeof value === "object" && !value?.id) { - const children = restructuringOfConfig(value); - result.push({ label: key, children, icon: children?.[0]?.icon, to: "" }); - } else { - result.push({ label: key, value, icon: value?.leftIcon, to: key === "Home" ? "/mgramseva-digit-ui/employee" : value?.navigationURL }); - } - } - - return result; - } - const splitKeyValue = () => { - const keys = Object.keys(configEmployeeSideBar); - keys.sort((a, b) => a.orderNumber - b.orderNumber); - for (let i = 0; i < keys.length; i++) { - if (configEmployeeSideBar[keys[i]][0].path.indexOf(".") === -1) { - if (configEmployeeSideBar[keys[i]][0].displayName === "Home") { - const homeURL = "/mgramseva-digit-ui/employee"; - res.unshift({ - moduleName: keys[i].toUpperCase(), - icon: configEmployeeSideBar[keys[i]][0], - navigationURL: homeURL, - type: "single", - }); - } else { - res.push({ - moduleName: configEmployeeSideBar[keys[i]][0]?.displayName.toUpperCase(), - type: "single", - icon: configEmployeeSideBar[keys[i]][0], - navigationURL: configEmployeeSideBar[keys[i]][0].navigationURL, - }); - } - } else { - res.push({ - moduleName: keys[i].toUpperCase(), - links: configEmployeeSideBar[keys[i]], - icon: configEmployeeSideBar[keys[i]][0], - orderNumber: configEmployeeSideBar[keys[i]][0].orderNumber, - }); - } - } - if (res.find((a) => a.moduleName === "HOME")) { - //res.splice(0,1); - const indx = res.findIndex((a) => a.moduleName === "HOME"); - const home = res?.filter((ob) => ob?.moduleName === "HOME"); - let res1 = res?.filter((ob) => ob?.moduleName !== "HOME"); - res = res1.sort((a, b) => a.moduleName.localeCompare(b.moduleName)); - home?.[0] && res.unshift(home[0]); - } else { - res.sort((a, b) => a.moduleName.localeCompare(b.moduleName)); - } - //reverting the newsidebar change for now, in order to solve ndss login issue - //let newconfig = restructuringOfConfig(configEmployeeSideBar1); - //below lines are used for shifting home object to first place - // newconfig.splice(newconfig.findIndex((ob) => ob?.label === ""),1); - // newconfig.sort((a,b) => a.label.localeCompare(b.label)); - // const fndindex = newconfig?.findIndex((el) => el?.label === "Home"); - // const homeitem = newconfig.splice(fndindex,1); - // newconfig.unshift(homeitem?.[0]); - // return ( - // newconfig.map((item, index) => { - // return ; - // }) - // ); - return res?.map((item, index) => { - return ; - }); - }; - - if (isLoading) { - return ; - } - if (!res) { - return ""; - } - - const renderSearch = () => { - return ( -
-
-
- - setSearch(e.target.value)} - /> -
-
-
- ); - }; - - return ( -
- {renderSearch()} - {splitKeyValue()} -
- ); -}; - -export default EmployeeSideBar; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/TopBarSideBar/SideBar/NavItem.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/TopBarSideBar/SideBar/NavItem.js deleted file mode 100644 index 1247e2904..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/TopBarSideBar/SideBar/NavItem.js +++ /dev/null @@ -1,79 +0,0 @@ -import React from 'react'; -import { NavLink } from 'react-router-dom'; -import NavItemHeader from './NavItemHeader'; -import { - HomeIcon, - ComplaintIcon, - BPAHomeIcon, - PropertyHouse, - CaseIcon, - ReceiptIcon, - PersonIcon, - DocumentIconSolid, - DropIcon, - CollectionsBookmarIcons, - FinanceChartIcon, - CollectionIcon, -} from "@egovernments/digit-ui-react-components"; -import ReactTooltip from 'react-tooltip'; -import { useTranslation } from 'react-i18next'; - -const NavItem = props => { - let { label, icon, to, children } = props.item; - const { t } = useTranslation(); - const IconsObject = { - home: , - announcement: , - business: , - store: , - assignment: , - receipt: , - "business-center": , - description: , - "water-tap": , - "collections-bookmark": , - "insert-chart": , - edcr: , - collections: , - }; - const leftIconArray = icon?.split?.(":")?.[1]; - const leftIcon = IconsObject[leftIconArray] || IconsObject.collections; - const iconArr=icon?.leftIcon?.split?.(":")|| leftIcon?.split?.(":"); - if(iconArr?.[0]=='dynamic'){ - var IconComp = require("@egovernments/digit-ui-react-components")?.[iconArr?.[1]]; - leftIcon=IconComp?:leftIcon; - } - const getModuleName = label?.replace(/[ -]/g, "_").toUpperCase(); - const appendTranslate = t(`ACTION_TEST_${getModuleName.toUpperCase()}`); - const trimModuleName = t(appendTranslate?.length > 20 ? appendTranslate.substring(0, 20) + "..." : appendTranslate); - - if (children) { - return ; - } - - return ( -
- -
-
- {leftIcon /*className={style.navIcon}*/ } -
- {trimModuleName} - {trimModuleName?.includes("...") && - {t(`ACTION_TEST_${getModuleName}`)} - } -
-
-
- -
-
- ); -}; - -export default NavItem; \ No newline at end of file diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/TopBarSideBar/SideBar/NavItemHeader.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/TopBarSideBar/SideBar/NavItemHeader.js deleted file mode 100644 index 3ecf8bfab..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/TopBarSideBar/SideBar/NavItemHeader.js +++ /dev/null @@ -1,135 +0,0 @@ -import React, { useState } from 'react'; -import { NavLink, useLocation } from 'react-router-dom'; -import { - ArrowForward, - ArrowVectorDown, - ArrowDirection, - HomeIcon, - ComplaintIcon, - BPAHomeIcon, - PropertyHouse, - CaseIcon, - ReceiptIcon, - PersonIcon, - DocumentIconSolid, - DropIcon, - CollectionsBookmarIcons, - FinanceChartIcon, - CollectionIcon, -} from "@egovernments/digit-ui-react-components"; -import ReactTooltip from "react-tooltip"; -import { useTranslation } from 'react-i18next'; - -const resolveLinkPath = (childTo, parentTo) => `${parentTo}/${childTo}`; - -const NavItemHeader = props => { - const { item } = props; - const [expanded, setExpand] = useState( - /*location.pathname.includes(headerToPath)*/ false - ); - let { label, icon, to: headerToPath, children } = item; - const { t } = useTranslation(); - const location = useLocation(); - const getOrigin = window.location.origin - const IconsObject = { - home: , - announcement: , - business: , - store: , - assignment: , - receipt: , - "business-center": , - description: , - "water-tap": , - "collections-bookmark": , - "insert-chart": , - edcr: , - collections: , - }; - const leftIconArray = icon?.split?.(":")?.[1]; - const leftIcon = IconsObject[leftIconArray] || IconsObject.collections; - const iconArr=item?.icon?.leftIcon?.split?.(":")|| item?.leftIcon?.split?.(":"); - if(iconArr?.[0]=='dynamic'){ - var IconComp = require("@egovernments/digit-ui-react-components")?.[iconArr?.[1]]; - leftIcon=IconComp?:leftIcon; - } - const getModuleName = label?.replace(/[ -]/g, "_").toUpperCase(); - const appendTranslate = t(`ACTION_TEST_${getModuleName.toUpperCase()}`); - const trimModuleName = t(appendTranslate?.length > 20 ? appendTranslate.substring(0, 20) + "..." : appendTranslate); - - const onExpandChange = e => { - e.preventDefault(); - setExpand(expanded => !expanded); - }; - - return ( - - - - {expanded && ( -
- {children.map((item, index) => { - const key = `${item.label}-${index}`; - - const { label, icon, children } = item; - const leftIconArray = icon?.split?.(":")?.[1]; - const leftIcon = IconsObject[leftIconArray] || IconsObject.collections; - const getModuleName = label?.replace(/[ -]/g, "_").toUpperCase(); - const appendTranslate = t(`ACTION_TEST_${getModuleName.toUpperCase()}`); - const trimModuleName = t(appendTranslate?.length > 20 ? appendTranslate.substring(0, 20) + "..." : appendTranslate); - - if (children) { - return ( -
- -
- ); - } - - return ( - -
- {trimModuleName} - {trimModuleName?.includes("...") && - {t(`ACTION_TEST_${getModuleName}`)} - } -
-
- ); - })} -
- )} -
- ); -}; - -export default NavItemHeader; \ No newline at end of file diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/TopBarSideBar/SideBar/StaticCitizenSideBar.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/TopBarSideBar/SideBar/StaticCitizenSideBar.js deleted file mode 100644 index f900c37b9..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/TopBarSideBar/SideBar/StaticCitizenSideBar.js +++ /dev/null @@ -1,259 +0,0 @@ -import React, { useEffect, useState } from "react"; -import { - HomeIcon, - EditPencilIcon, - LogoutIcon, - Loader, - AddressBookIcon, - PropertyHouse, - CaseIcon, - CollectionIcon, - PTIcon, - OBPSIcon, - PGRIcon, - FSMIcon, - WSICon, - MCollectIcon, - Phone, - BirthIcon, - DeathIcon, - FirenocIcon, - LoginIcon -} from "@egovernments/digit-ui-react-components"; -import { Link, useLocation } from "react-router-dom"; -import SideBarMenu from "../../../config/sidebar-menu"; -import { useTranslation } from "react-i18next"; -import { useHistory } from "react-router-dom"; -import LogoutDialog from "../../Dialog/LogoutDialog"; -import ChangeCity from "../../ChangeCity"; - -const defaultImage = - "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAO4AAADUCAMAAACs0e/bAAAAM1BMVEXK0eL" + - "/" + - "/" + - "/" + - "/Dy97GzuD4+fvL0uPg5O7T2efb4OvR1+Xr7vTk5/Df4+37/P3v8fbO1eTt8PUsnq5FAAAGqElEQVR4nO2d25ajIBBFCajgvf/" + - "/a0eMyZgEjcI5xgt7Hmatme507UaxuJXidiDqjmSgeVIMlB1ZR1WZAf2gbdu0QwixSYzjOJPmHurfEGEfY9XzjNGG9whQCeVAuv5xQEySLtR9hPuIcwj0EeroN5m3D1IbsbgHK0esiQ9MKs" + - "qXVr8Hm/a/Pulk6wihpCIXBw3dh7bTvRBt9+dC5NfS1VH3xETdM3MxXRN1T0zUPTNR98xcS1dlV9NNfx3DhkTdM6PKqHteVBF1z0vU5f0sKdpc2zWLKutXrjJjdLvpesRmukqYonauPhXpds" + - "Lb6CppmpnltsYIuY2yavi6Mi2/rzAWm1zUfF0limVLqkZyA+mDYevKBS37aGC+L1lX5e7uyU1Cv565uiua9k5LFqbqqrnu2I3m+jJ11ZoLeRtfmdB0Uw/ZDsP0VTxdn7a1VERfmq7Xl" + - "Xyn5D2QWLoq8bZlPoBJumphJjVBw/Ll6CoTZGsTDs4NrGqKbqBth8ZHJUi6cn168QmleSm6GmB7Kxm+6obXlf7PoDHosCwM3QpiS2legi6ocSl3L0G3BdneDDgwQdENfeY+SfDJBkF37Z" + - "B+GvwzA6/rMaafAn8143VhPZWdjMWG1oHXhdnemgPoAvLlB/iZyRTfVeF06wPoQhJmlm4bdcOAZRlRN5gcPc5SoPEQR1fDdbOo6wn+uYvXxY0QCLom6gYROKH+Aj5nvphuFXWDiLpRdxl" + - "/19LFT95k6CHCrnW7pCDqBn1i1PUFvii2c11oZOJ6usWeH0RRNzC4Zs+6FTi2nevCVwCjbugnXklX5fkfTldL8PEilUB1kfNyN1u9MME2sATr4lbuB7AjfLAuvsRm1A0g6gYRdcPAjvBlje" + - "2Z8brI8OC68AcRdlCkwLohx2mcZMjw9q+LzarQurjtnwPYAydX08WecECO/u6Ad0GBdYG7jO5gB4Ap+PwKcA9ZT43dn4/W9TyiPAn4OAJaF7h3uwe8StSCddFdM3jqFa2LvnnB5zzhuuBBAj" + - "Y4gi50cg694gnXhTYvfMdrjtcFZhrwE9r41gUem8IXWMC3LrBzxh+a0gRd1N1LOK7M0IUUGuggvEmHoStA2/MJh7MpupiDU4TzjhxdzLAoO4ouZvqVURbFMHQlZD6SUeWHoguZsSLUGegreh" + - "A+FZFowPdUWTi6iMoZlIpGGUUXkDbjj/9ZOLqAQS/+GIKl5BQOCn/ycqpzkXSDm5dU7ZWkG7wUyGlcmm7g5Ux56AqirgoaJ7BeokPTDbp9CbVunjFxPrl7+HqnkrSq1Da7JX20f3dV8yJi6v" + - "oO81mX8vV0mx3qUsZCPRfTlVRdz2EvdufYGDvNQvvwqHtmXd+a1ITinwNcXc+lT6JuzdT1XDyBn/x7wtX1HCQQdW9MXc8xArGrirowfLeUEbMqqq6f7TF1lfRdOuGNiGi6SpT+WxY06xUfNN" + - "2wBfyE9I4tlm7w5hvOPDNJN3yNiLMipji6gE3chKhouoCtN5x3QlF0EZt8OW/8ougitqJQlk1aii7iFC9l0MvRReyao7xNjKML2Z/PuHlzhi5mFxljiZeiC9rPTEisNEMX9KYAwo5Xhi7qaA" + - "3hamboYm7dG+NVrXhdaYDv5zFaQZsYrCtbbAGnjkQDX2+J1FXCwOsqWOpKoIQNTFdqYBWydxqNqUoG0pVpCS+H8kaJaGKErlIaXj7CRRE+gRWuKwW9YZ80oVOUgbpdT0zpnSZJTIiwCtJVelv" + - "Xntr4P5j6BWfPb5Wcx84C4cq3hb11lco2u2Mdwp6XdJ/Ne3wb8DWdfiRenZaXrhLwOj4e+GQeHroy3YOspS7TlU28Wle2m2QUS0mqdcbrdNW+ZHsSsyK7tBfm0q/dWcv+Z3mytVx3t7KWulq" + - "Ue6ilunu8jF8pFwgv1FXp3mUt35OtRbr7eM4u4Gs6vUBXgeuHc5kfE/cbvWZtkROLm1DMtLCy80tzsu2PRj0hTI8fvrQuvsjlJkyutszq+m423wHaLTyniy/XuiGZ84LuT+m5ZfNfRxyGs7L" + - "XZOvia7VujatUwVTrIt+Q/Csc7Tuhe+BOakT10b4TuoiiJjvgU9emTO42PwEfBa+cuodKkuf42DXr1D3JpXz73Hnn0j10evHKe+nufgfUm+7B84sX9FfdEzXux2DBpWuKokkCqN/5pa/8pmvn" + - "L+RGKCddCGmatiPyPB/+ekO/M/q/7uvbt22kTt3zEnXPzCV13T3Gel4/6NduDu66xRvlPNkM1RjjxUdv+4WhGx6TftD19Q/dfzpwcHO+rE3fAAAAAElFTkSuQmCC"; -/* -Feature :: Citizen Webview sidebar -*/ -const Profile = ({ info, stateName, t }) => ( -
-
- -
-
-
{info?.name}
-
-
-
{info?.mobileNumber}
-
- {info?.emailId && ( -
-
{info.emailId}
-
- )} -
- {window.location.href.includes("/employee") && - !window.location.href.includes("/employee/user/login") && - !window.location.href.includes("employee/user/language-selection") && } -
-); -const IconsObject = { - CommonPTIcon: , - OBPSIcon: , - propertyIcon: , - TLIcon: , - PGRIcon: , - FSMIcon: , - WSIcon: , - MCollectIcon: , - BillsIcon: , - BirthIcon: , - DeathIcon: , - FirenocIcon: , - HomeIcon: , - EditPencilIcon: , - LogoutIcon: , - Phone: , - LoginIcon: , -}; -const StaticCitizenSideBar = ({ linkData, islinkDataLoading }) => { - const { t } = useTranslation(); - const history = useHistory(); - const location = useLocation(); - const { pathname } = location; - const { data: storeData, isFetched } = Digit.Hooks.useStore.getInitData(); - const { stateInfo } = storeData || {}; - const user = Digit.UserService.getUser(); - let isMobile = window.Digit.Utils.browser.isMobile(); - - const [isEmployee, setisEmployee] = useState(false); - const [isSidebarOpen, toggleSidebar] = useState(false); - const [showDialog, setShowDialog] = useState(false); - - const handleLogout = () => { - toggleSidebar(false); - setShowDialog(true); - }; - const handleOnSubmit = () => { - Digit.UserService.logout(); - setShowDialog(false); - }; - const handleOnCancel = () => { - setShowDialog(false); - }; - - if (islinkDataLoading || !isFetched) { - return ; - } - - const redirectToLoginPage = () => { - // localStorage.clear(); - // sessionStorage.clear(); - history.push("/digit-ui/citizen/login"); - }; - const showProfilePage = () => { - history.push("/digit-ui/citizen/user/profile"); - }; - const tenantId = Digit.ULBService.getCitizenCurrentTenant(); - const filteredTenantContact = storeData?.tenants.filter((e) => e.code === tenantId)[0]?.contactNumber || storeData?.tenants[0]?.contactNumber; - - let menuItems = [...SideBarMenu(t, showProfilePage, redirectToLoginPage, isEmployee, storeData, tenantId)]; - - menuItems = menuItems.filter((item) => item.element !== "LANGUAGE"); - - const MenuItem = ({ item }) => { - const leftIconArray = item?.icon || item.icon?.type?.name; - const leftIcon = leftIconArray ? IconsObject[leftIconArray] : IconsObject.BillsIcon; - let itemComponent; - if (item.type === "component") { - itemComponent = item.action; - } else { - itemComponent = item.text; - } - const Item = () => ( - - {leftIcon} -
{itemComponent}
-
- ); - if (item.type === "external-link") { - return ( - - - - ); - } - if (item.type === "link") { - return ( - - - - ); - } - - return ; - }; - let profileItem; - - if (isFetched && user && user.access_token) { - profileItem = ; - menuItems = menuItems.filter((item) => item?.id !== "login-btn" && item?.id !== "help-line"); - menuItems = [ - ...menuItems, - { - text: t("EDIT_PROFILE"), - element: "PROFILE", - icon: "EditPencilIcon", - populators: { - onClick: showProfilePage, - }, - }, - { - text: t("CORE_COMMON_LOGOUT"), - element: "LOGOUT", - icon: "LogoutIcon", - populators: { onClick: handleLogout }, - }, - { - text: ( - - {t("CS_COMMON_HELPLINE")} - - - ), - element: "Helpline", - icon: "Phone", - }, - ]; - } - Object.keys(linkData) - ?.sort((x, y) => y.localeCompare(x)) - ?.map((key) => { - if (linkData[key][0]?.sidebar === "digit-ui-links") { - menuItems.splice(1, 0, { - type: linkData[key][0]?.sidebarURL?.includes("digit-ui") ? "link" : "external-link", - text: t(`ACTION_TEST_${Digit.Utils.locale.getTransformedLocale(key)}`), - links: linkData[key], - icon: linkData[key][0]?.leftIcon, - link: linkData[key][0]?.sidebarURL, - }); - } - }); - - return ( - -
-
-
- {profileItem} -
- {menuItems?.map((item, index) => ( -
- -
- ))} -
-
-
{showDialog && }
-
-
- ); -}; - -export default StaticCitizenSideBar; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/TopBarSideBar/SideBar/SubMenu.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/TopBarSideBar/SideBar/SubMenu.js deleted file mode 100644 index 23829f05a..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/TopBarSideBar/SideBar/SubMenu.js +++ /dev/null @@ -1,174 +0,0 @@ -import React, { useState, useContext } from "react"; -import { Link, useLocation } from "react-router-dom"; -import { - ArrowForward, - ArrowVectorDown, - ArrowDirection, - HomeIcon, - ComplaintIcon, - BPAHomeIcon, - PropertyHouse, - CaseIcon, - ReceiptIcon, - PersonIcon, - DocumentIconSolid, - DropIcon, - CollectionsBookmarIcons, - FinanceChartIcon, - CollectionIcon, -} from "@egovernments/digit-ui-react-components"; -import { useTranslation } from "react-i18next"; -import ReactTooltip from "react-tooltip"; - -const SubMenu = ({ item }) => { - const [subnav, setSubnav] = useState(false); - const location = useLocation(); - const { pathname } = location; - const { t } = useTranslation(); - const showSubnav = () => setSubnav(!subnav); - const IconsObject = { - home: , - announcement: , - business: , - store: , - assignment: , - receipt: , - "business-center": , - description: , - "water-tap": , - "collections-bookmark": , - "insert-chart": , - edcr: , - collections: , - }; - const leftIconArray = item?.icon?.leftIcon?.split?.(":")?.[1] || item?.leftIcon?.split?.(":")[1]; - const leftIcon = IconsObject[leftIconArray] || IconsObject.collections; - const getModuleName = item?.moduleName?.replace(/[ -]/g, "_"); - const appendTranslate = t(`ACTION_TEST_${getModuleName}`); - const trimModuleName = t(appendTranslate?.length > 20 ? appendTranslate.substring(0, 20) + "..." : appendTranslate); - - if (item.type === "single") { - const getOrigin = window.location.origin; - return ( -
-
-
- {leftIcon} - {item.navigationURL?.indexOf("/digit-ui") === -1 ? ( - - {trimModuleName} - - {trimModuleName?.includes("...") && - {t(`ACTION_TEST_${getModuleName}`)} - } - - ) : ( - // - //
- //

{trimModuleName}

- // {t(`ACTION_TEST_${getModuleName}`)} - //
- //
- -
- {trimModuleName} - - {trimModuleName?.includes("...") && - {t(`ACTION_TEST_${getModuleName}`)} - } -
- {/*
-

{trimModuleName}

- {t(`ACTION_TEST_${getModuleName}`)} -
{" "} */} - - )} -
-
-
- ); - } else { - return ( - -
-
-
- {leftIcon} -
- {trimModuleName} - - {trimModuleName?.includes("...") && - {t(`ACTION_TEST_${getModuleName}`)} - } -
- {/*
-

{trimModuleName}

- {t(`ACTION_TEST_${getModuleName}`)} -
{" "} */} -
-
{item.links && subnav ? : item.links ? : null}
-
-
- - {subnav && - item.links - .sort((a, b) => a.orderNumber - b.orderNumber) - .filter((item) => item.url === "url" || item.url !== "") - .map((item, index) => { - const getChildName = item?.displayName?.toUpperCase()?.replace(/[ -]/g, "_"); - const appendTranslate = t(`ACTION_TEST_${getChildName}`); - const trimModuleName = t(appendTranslate?.length > 20 ? appendTranslate.substring(0, 20) + "..." : appendTranslate); - - if (item.navigationURL.indexOf("/digit-ui") === -1) { - const getOrigin = window.location.origin; - return ( - -
- {trimModuleName} - {trimModuleName?.includes("...") && - {t(`ACTION_TEST_${getChildName}`)} - } -
- {/*
-
-

{trimModuleName}

- {t(`ACTION_TEST_${getChildName}`)} -
{" "} -
*/} -
- ); - } - return ( - -
- {trimModuleName} - {trimModuleName?.includes("...") && - {t(`ACTION_TEST_${getChildName}`)} - } - {/*
-

{trimModuleName}

- {t(`ACTION_TEST_${getChildName}`)} -
{" "} */} -
- - ); - })} -
- ); - } -}; - -export default SubMenu; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/TopBarSideBar/SideBar/index.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/TopBarSideBar/SideBar/index.js deleted file mode 100644 index fd7f065a8..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/TopBarSideBar/SideBar/index.js +++ /dev/null @@ -1,25 +0,0 @@ -import React from "react"; -import { CitizenSideBar } from "./CitizenSideBar"; -import EmployeeSideBar from "./EmployeeSideBar"; - -const SideBar = ({ t, CITIZEN, isSidebarOpen, toggleSidebar, handleLogout, mobileView, userDetails, modules, linkData, islinkDataLoading, isSideBarScroll,setSideBarScrollTop }) => { - if (CITIZEN) - return ( - - ); - else { - if (!mobileView && userDetails?.access_token) return ; - else return ; - } -}; - -export default SideBar; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/TopBarSideBar/TopBar.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/TopBarSideBar/TopBar.js deleted file mode 100644 index a069ad250..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/TopBarSideBar/TopBar.js +++ /dev/null @@ -1,158 +0,0 @@ -import { Dropdown, Hamburger, TopBar as TopBarComponent } from "@egovernments/digit-ui-react-components"; -import React from "react"; -import { useHistory, useLocation } from "react-router-dom"; -import ChangeCity from "../ChangeCity"; -import ChangeLanguage from "../ChangeLanguage"; - -const TextToImg = (props) => ( - - {props?.name?.[0]?.toUpperCase()} - -); -const TopBar = ({ - t, - stateInfo, - toggleSidebar, - isSidebarOpen, - handleLogout, - userDetails, - CITIZEN, - cityDetails, - mobileView, - userOptions, - handleUserDropdownSelection, - logoUrl, - showLanguageChange = true, - setSideBarScrollTop, -}) => { - const [profilePic, setProfilePic] = React.useState(null); - - React.useEffect(async () => { - const tenant = Digit.ULBService.getCurrentTenantId(); - const uuid = userDetails?.info?.uuid; - if (uuid) { - const usersResponse = await Digit.UserService.userSearch(tenant, { uuid: [uuid] }, {}); - if (usersResponse && usersResponse.user && usersResponse.user.length) { - const userDetails = usersResponse.user[0]; - const thumbs = userDetails?.photo?.split(","); - setProfilePic(thumbs?.at(0)); - } - } - }, [profilePic !== null, userDetails?.info?.uuid]); - - const CitizenHomePageTenantId = Digit.ULBService.getCitizenCurrentTenant(true); - - let history = useHistory(); - const { pathname } = useLocation(); - - const conditionsToDisableNotificationCountTrigger = () => { - if (Digit.UserService?.getUser()?.info?.type === "EMPLOYEE") return false; - if (Digit.UserService?.getUser()?.info?.type === "CITIZEN") { - if (!CitizenHomePageTenantId) return false; - else return true; - } - return false; - }; - - const { data: { unreadCount: unreadNotificationCount } = {}, isSuccess: notificationCountLoaded } = Digit.Hooks.useNotificationCount({ - tenantId: CitizenHomePageTenantId, - config: { - enabled: conditionsToDisableNotificationCountTrigger(), - }, - }); - - const updateSidebar = () => { - if (!Digit.clikOusideFired) { - toggleSidebar(true); - setSideBarScrollTop(true); - } else { - Digit.clikOusideFired = false; - } - }; - - function onNotificationIconClick() { - history.push("/digit-ui/citizen/engagement/notifications"); - } - - const urlsToDisableNotificationIcon = (pathname) => - !!Digit.UserService?.getUser()?.access_token - ? false - : ["/digit-ui/citizen/select-language", "/digit-ui/citizen/select-location"].includes(pathname); - - if (CITIZEN) { - return ( -
- : null} - /> -
- ); - } - const loggedin = userDetails?.access_token ? true : false; - return ( -
- {mobileView ? : null} - - - {loggedin && - (cityDetails?.city?.ulbGrade ? ( -

- {t(cityDetails?.i18nKey).toUpperCase()}{" "} - {t(`ULBGRADE_${cityDetails?.city?.ulbGrade.toUpperCase().replace(" ", "_").replace(".", "_")}`).toUpperCase()} -

- ) : ( - - ))} - {!loggedin && ( -

- {t(`MYCITY_${stateInfo?.code?.toUpperCase()}_LABEL`)} {t(`MYCITY_STATECODE_LABEL`)} -

- )} - {!mobileView && ( -
-
- {!window.location.href.includes("employee/user/login") && !window.location.href.includes("employee/user/language-selection") && ( - - )} -
-
{showLanguageChange && }
- {userDetails?.access_token && ( -
- - ) : ( - - ) - } - /> -
- )} - -
- )} -
-
- ); -}; - -export default TopBar; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/TopBarSideBar/index.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/TopBarSideBar/index.js deleted file mode 100644 index 66a4414ec..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/TopBarSideBar/index.js +++ /dev/null @@ -1,81 +0,0 @@ -import React, { useState } from "react"; -import { EditPencilIcon, LogoutIcon } from "@egovernments/digit-ui-react-components"; -import TopBar from "./TopBar"; -import { useHistory } from "react-router-dom"; -import SideBar from "./SideBar"; -import LogoutDialog from "../Dialog/LogoutDialog"; -const TopBarSideBar = ({ - t, - stateInfo, - userDetails, - CITIZEN, - cityDetails, - mobileView, - handleUserDropdownSelection, - logoUrl, - showSidebar = true, - showLanguageChange, - linkData, - islinkDataLoading, -}) => { - const [isSidebarOpen, toggleSidebar] = useState(false); - const [isSideBarScroll, setSideBarScrollTop] = useState(false); - const history = useHistory(); - const [showDialog, setShowDialog] = useState(false); - const handleLogout = () => { - toggleSidebar(false); - setShowDialog(true); - }; - const handleOnSubmit = () => { - Digit.UserService.logout(); - setShowDialog(false); - }; - const handleOnCancel = () => { - setShowDialog(false); - }; - const userProfile = () => { - history.push("/mgramseva-digit-ui/employee/user/profile"); - }; - const userOptions = [ - { name: t("EDIT_PROFILE"), icon: , func: userProfile }, - { name: t("CORE_COMMON_LOGOUT"), icon: , func: handleLogout }, - ]; - return ( - - - {showDialog && } - {showSidebar && ( - - )} - - ); -}; -export default TopBarSideBar; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/config/RatingAndFeedback.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/config/RatingAndFeedback.js deleted file mode 100644 index bfbe5337b..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/config/RatingAndFeedback.js +++ /dev/null @@ -1,45 +0,0 @@ -export const RatingAndFeedBack = { - isCitizenRatingEnabled : true, - headerByRating: [ - { - minvalue : 1, - maxvalue : 3, - code : "CS_WHAT_WENT_WRONG" - }, - { - minvalue : 4, - maxvalue : 5, - code : "CS_WHAT_WENT_GOOD" - } - ], - enabledScreensList:[ - { - module : "PT", - bussinessService : "PT_CREATE", - screenfrom : "pt/property/new-application/acknowledgement", - cardHeader : "PT_RATE_HELP_TEXT_CREATE", - cardText : "PT_RATE_CARD_TEXT_CREATE", - }, - { - module : "PT", - bussinessService : "PT_MUTATION", - screenfrom : "pt/property/property-mutation/acknowledgement", - cardHeader : "PT_RATE_HELP_TEXT_MUTATE", - cardText : "PT_RATE_CARD_TEXT_MUTATE", - }, - { - module : "PT", - bussinessService : "PT_UPDATE", - screenfrom : "pt/property/edit-application/acknowledgement", - cardHeader : "PT_RATE_HELP_TEXT_UPDATE", - cardText : "PT_RATE_CARD_TEXT_UPDATE", - }, - { - module : "PT", - bussinessService : "PT", - screenfrom : "digit-ui/citizen/payment/success", - cardHeader : "PT_RATE_HELP_TEXT_PAY", - cardText : "PT_RATE_CARD_TEXT_PAY", - } - ] -} \ No newline at end of file diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/config/employee-sidebar-menu.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/config/employee-sidebar-menu.js deleted file mode 100644 index 760499262..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/config/employee-sidebar-menu.js +++ /dev/null @@ -1,165 +0,0 @@ -import React from "react"; -import { - PersonIcon, - ShippingTruck, - SurveyIconSolid, - EventsIconSolid, - PTIcon, - PropertyHouse, - PMBIconSolid, - DocumentIconSolid, - ReceiptIcon, - CaseIcon, - ComplaintIcon, -} from "@egovernments/digit-ui-react-components"; - -const EmployeeSideBarMenu = (t, HRMS, FSM, PT, mCollect, DSS, RECEIPTS, TL, NOC, FSTPOperator, PGR, ...links) => [ - HRMS && { - Icon: , - moduleName: t("ACTION_TEST_HRMS"), - links: [ - { - label: t("HR_HOME_SEARCH_RESULTS_HEADING"), - link: `/mgramseva-digit-ui/employee/hrms/inbox`, - }, - { - label: t("HR_COMMON_CREATE_EMPLOYEE_HEADER"), - link: `/mgramseva-digit-ui/employee/hrms/create`, - }, - ], - }, - FSM && { - Icon: , - moduleName: t("ES_TITLE_FAECAL_SLUDGE_MGMT"), - links: [ - { - label: t("ES_COMMON_INBOX"), - link: `/mgramseva-digit-ui/employee/fsm/inbox`, - }, - ], - }, - - mCollect && { - Icon: , - moduleName: t("UC_COMMON_HEADER_SEARCH"), - - links: [ - { - label: t("UC_SEARCH_CHALLAN_LABEL"), - link: `/mgramseva-digit-ui/employee/mcollect/inbox`, - }, - { - label: t("UC_GENERATE_NEW_CHALLAN"), - link: `/mgramseva-digit-ui/employee/mcollect/new-application`, - }, - ], - }, - PT && { - Icon: , - moduleName: t("ES_TITLE_PROPERTY_TAX"), - }, - DSS && { - Icon: , - moduleName: t("ACTION_TEST_PUBLIC_MESSAGE_BROADCAST"), - - links: [ - { - label: t("ES_TITLE_INBOX"), - link: `/mgramseva-digit-ui/employee/engagement/messages/inbox`, - }, - { - label: t("NEW_PUBLIC_MESSAGE_BUTTON_LABEL"), - link: `/mgramseva-digit-ui/employee/engagement/messages/create`, - }, - ], - }, - { - Icon: , - moduleName: t("CS_COMMON_SURVEYS"), - links: [ - { - label: t("ES_TITLE_INBOX"), - link: `/mgramseva-digit-ui/employee/engagement/surveys/inbox`, - }, - { - label: t("CS_COMMON_NEW_SURVEY"), - link: `/mgramseva-digit-ui/employee/engagement/surveys/create`, - }, - ], - }, - { - Icon: , - moduleName: t("TOTAL_EVENTS"), - links: [ - { - label: t("ES_TITLE_INBOX"), - link: `/mgramseva-digit-ui/employee/engagement/event/inbox`, - }, - { - label: t("ES_TITLE_NEW_EVENTS"), - link: `/mgramseva-digit-ui/employee/engagement/event/new-event`, - }, - ], - }, - { - Icon: , - moduleName: t("ES_TITLE_DOCS"), - links: [ - { - label: t("ES_TITLE_INBOX"), - link: `/mgramseva-digit-ui/employee/engagement/documents/inbox`, - }, - { - label: t("NEW_DOCUMENT_TEXT"), - link: `/mgramseva-digit-ui/employee/engagement/documents/new-doc`, - }, - ], - }, - RECEIPTS && { - Icon: , - moduleName: t("ACTION_TEST_RECEIPTS"), - - links: [ - { - label: t("CR_SEARCH_COMMON_HEADER"), - link: `/mgramseva-digit-ui/employee/receipts/inbox`, - }, - ], - }, - TL && { - Icon: , - moduleName: t("TL_COMMON_TL"), - links: links, - }, - NOC && { - Icon: , - moduleName: t("ACTION_TEST_NOC"), - - links: [ - { - label: t("ES_COMMON_INBOX"), - link: `/mgramseva-digit-ui/employee/noc/inbox`, - }, - { - label: t("ES_COMMON_SEARCH"), - link: `/mgramseva-digit-ui/employee/noc/search`, - }, - ], - }, - FSTPOperator && { - Icon: , - moduleName: t("ES_TITLE_VEHICLE_LOG"), - - links: [ - { - label: t("ES_COMMON_INBOX"), - link: "/mgramseva-digit-ui/employee/fsm/fstp-inbox", - }, - ], - }, - PGR && { - Icon: , - moduleName: t("ES_PGR_HEADER_COMPLAINT"), - }, -]; -export default EmployeeSideBarMenu; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/config/sidebar-menu.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/config/sidebar-menu.js deleted file mode 100644 index cdef2ea2c..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/config/sidebar-menu.js +++ /dev/null @@ -1,51 +0,0 @@ -import React from "react"; -import { HomeIcon, LanguageIcon, LogoutIcon, AddressBookIcon, LocationIcon, LoginIcon } from "@egovernments/digit-ui-react-components"; -import ChangeLanguage from "../components/ChangeLanguage"; - -const SideBarMenu = (t, closeSidebar, redirectToLoginPage, isEmployee, storeData, tenantId) => { - let filteredTenantData = storeData?.tenants.filter((e) => e.code === tenantId)[0]?.contactNumber || storeData?.tenants[0]?.contactNumber; - return [ - { - type: "link", - element: "HOME", - text: t("COMMON_BOTTOM_NAVIGATION_HOME"), - link: isEmployee ? "/mgramseva-digit-ui/employee" : "/digit-ui/citizen", - icon: "HomeIcon", - populators: { - onClick: closeSidebar, - }, - }, - { - type: "component", - element: "LANGUAGE", - action: , - icon: "LanguageIcon", - }, - { - id: "login-btn", - element: "LOGIN", - text: t("CORE_COMMON_LOGIN"), - icon: "LoginIcon", - populators: { - onClick: redirectToLoginPage, - }, - }, - { - id: "help-line", - text: ( - - {t("CS_COMMON_HELPLINE")} - - - ), - element: "Helpline", - icon: "Phone", - }, - ]; -}; - -export default SideBarMenu; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/context/index.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/context/index.js deleted file mode 100644 index 71c86df0f..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/context/index.js +++ /dev/null @@ -1,3 +0,0 @@ -import React from "react"; - -export const ComponentProvider = React.createContext(); diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/hooks/useInterval.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/hooks/useInterval.js deleted file mode 100644 index 7161e6d42..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/hooks/useInterval.js +++ /dev/null @@ -1,20 +0,0 @@ -import React, { useEffect, useRef } from "react"; - -function useInterval(callback, delay) { - const savedCallback = useRef(); - useEffect(() => { - savedCallback.current = callback; - }, [callback]); - - useEffect(() => { - function tick() { - savedCallback.current(); - } - if (delay !== null) { - const timer = setInterval(tick, delay); - return () => clearInterval(timer); - } - }, [delay]); -} - -export default useInterval; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/citizen/Allservices/index.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/citizen/Allservices/index.js deleted file mode 100644 index 9392c00d9..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/citizen/Allservices/index.js +++ /dev/null @@ -1,11 +0,0 @@ -import React from "react"; -import { useTranslation } from "react-i18next"; -import { AppModules } from "../../../components/AppModules"; - -const CitizenApp = ({stateInfo, userDetails, CITIZEN, cityDetails, mobileView, handleUserDropdownSelection, logoUrl, DSO, stateCode, modules, appTenants, sourceUrl, pathname}) => { - const { t } = useTranslation(); - - return -} - -export default CitizenApp diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/citizen/FAQs/FAQs.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/citizen/FAQs/FAQs.js deleted file mode 100644 index 727108700..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/citizen/FAQs/FAQs.js +++ /dev/null @@ -1,40 +0,0 @@ -import { Header, TextInput, SearchIconSvg, ArrowForward, Loader, BackButton} from "@egovernments/digit-ui-react-components"; -import React, { useState, Fragment, useRef, useEffect}from "react"; -import { useTranslation } from "react-i18next"; -import FaqComponent from "./FaqComponent"; - - -const FAQsSection = ({module}) => { - const user = Digit.UserService.getUser(); - const tenantId = user?.info?.tenantId || Digit.ULBService.getCurrentTenantId(); - const { t } = useTranslation(); - - const SearchImg = () => { - return ; - }; - - const { isLoading, data } = Digit.Hooks.useGetFAQsJSON(Digit.ULBService.getStateId()); - - const moduleFaqs = data?.MdmsRes["common-masters"]?.faqs[0]?.[`${module}`].faqs; - - if(isLoading){ - return - } - return ( - -
- -
-
{t("FAQ_S")}
-
-
- {moduleFaqs.map((faq, i) => ( - - ))} -
-
-
- ); -}; - -export default FAQsSection; \ No newline at end of file diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/citizen/FAQs/FaqComponent.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/citizen/FAQs/FaqComponent.js deleted file mode 100644 index 6720c886a..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/citizen/FAQs/FaqComponent.js +++ /dev/null @@ -1,36 +0,0 @@ -import React, { useState } from "react"; -import { ArrowForward } from "@egovernments/digit-ui-react-components"; -import { useTranslation } from "react-i18next"; - -const FaqComponent = props => { - const { question, answer, subAnswer, lastIndex } = props; - const [isOpen, toggleOpen] = useState(false); - const { t } = useTranslation(); - const isMobile = window.Digit.Utils.browser.isMobile(); - - return ( -
toggleOpen(!isOpen)}> -
30 && isOpen ? "revert" : "space-between", - display: Digit.Utils.browser.isMobile() && t(question).length > 30 && isOpen ? "block" : "flex"}}> - - {t(question)} - - 30 ? "12%" : "8%") : ""*/} : {float: "right"}}> - {isOpen ? : } - -
- -
- - {t(answer) + t(subAnswer)} - -
- {!lastIndex ?
: null} -
- ); -}; - -export default FaqComponent; \ No newline at end of file diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/citizen/Home/ImageUpload/ImgUp.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/citizen/Home/ImageUpload/ImgUp.js deleted file mode 100644 index 77319653f..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/citizen/Home/ImageUpload/ImgUp.js +++ /dev/null @@ -1,48 +0,0 @@ -import React,{useState,useEffect} from "react"; -import{UploadFile} from '@egovernments/digit-ui-react-components'; -const ImgUp=()=>{ - const [uploadedFile, setUploadedFile] = useState("a"); - const [file,setFile] = useState("") - function selectfile(e) { - setFile(e.target.files[0]); - - - } - const [error, setError] = useState(null); - - useEffect(() => { - (async () => { - setError(null); - if (file) { - if (file.size >= 2000000) { - setError(t("PT_MAXIMUM_UPLOAD_SIZE_EXCEEDED")); - } else { - try { - // TODO: change module in file storage - const response = await Digit.UploadServices.Filestorage("citizen-profile", file, Digit.ULBService.getStateId()); if (response?.data?.files?.length > 0) { - setUploadedFile(response?.data?.files[0]?.fileStoreId); - } else { - setError(t("FILE_UPLOAD_ERROR")); - } - } catch (err) { - } - } - } - })(); - }, [file]); - - return( - - - { - setUploadedFile(null);}} - - /> - - ) -} -export default ImgUp \ No newline at end of file diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/citizen/Home/ImageUpload/UploadDrawer.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/citizen/Home/ImageUpload/UploadDrawer.js deleted file mode 100644 index 1eb567693..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/citizen/Home/ImageUpload/UploadDrawer.js +++ /dev/null @@ -1,96 +0,0 @@ -import React, { useState, useEffect } from "react"; -import { GalleryIcon, RemoveIcon, UploadFile } from "@egovernments/digit-ui-react-components"; -import { useTranslation } from "react-i18next"; - -function UploadDrawer({ setProfilePic, closeDrawer, userType, removeProfilePic ,showToast}) { - const [uploadedFile, setUploadedFile] = useState(null); - const [file, setFile] = useState(""); - const [error, setError] = useState(null); - const { t } = useTranslation(); - const selectfile = (e) => setFile(e.target.files[0]); - const removeimg = () => {removeProfilePic(); closeDrawer()}; - const onOverlayBodyClick = () => closeDrawer(); - - useEffect(() => { - (async () => { - setError(null); - if (file) { - if (file.size >= 1000000) { - showToast("error", t("CORE_COMMON_PROFILE_MAXIMUM_UPLOAD_SIZE_EXCEEDED")) - setError(t("CORE_COMMON_PROFILE_MAXIMUM_UPLOAD_SIZE_EXCEEDED")); - } else { - try { - const response = await Digit.UploadServices.Filestorage(`${userType}-profile`, file, Digit.ULBService.getStateId()); - if (response?.data?.files?.length > 0) { - const fileStoreId = response?.data?.files[0]?.fileStoreId; - setUploadedFile(fileStoreId); - setProfilePic(fileStoreId); - } else { - showToast("error", t("CORE_COMMON_PROFILE_FILE_UPLOAD_ERROR")) - setError(t("CORE_COMMON_PROFILE_FILE_UPLOAD_ERROR")); - } - } catch (err) { - showToast("error",t("CORE_COMMON_PROFILE_INVALID_FILE_INPUT")) - // setError(t("PT_FILE_UPLOAD_ERROR")); - } - } - } - })(); - }, [file]); - - return ( - -
-
-
- - - -
- -
- - -
-
-
- ); -} - -export default UploadDrawer; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/citizen/Home/ImageUpload/index.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/citizen/Home/ImageUpload/index.js deleted file mode 100644 index 544f6abdc..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/citizen/Home/ImageUpload/index.js +++ /dev/null @@ -1,122 +0,0 @@ -import React, { Component } from "react"; -import { connect } from "react-redux"; -import { FilePicker, Icon, Image, LoadingIndicator } from "components"; -import FloatingActionButton from "material-ui/FloatingActionButton"; -import { getFileSize, isFileImage } from "egov-ui-kit/utils/commons"; -import Label from "egov-ui-kit/utils/translationNode"; -import { fileUpload, removeFile } from "egov-ui-kit/redux/form/actions"; -import { toggleSnackbarAndSetText } from "egov-ui-kit/redux/app/actions"; -import "./index.css"; - -const iconStyle = { - width: "19px", - height: "19px", - fontSize: "12px", -}; - -const labelStyle = { - letterSpacing: "0.6px", - lineHeight: 1, - margin: "0 auto", - width: "75px", -}; - -const Placeholder = ({ className, onFilePicked, inputProps, hide }) => { - return ( -
- - - - - -
- ); -}; - -class ImageUpload extends Component { - fillPlaceholder = (images, onFilePicked, inputProps) => { - const placeholders = []; - for (let i = 0; i < 3 - images.length; i++) { - placeholders.push(); - } - return placeholders; - }; - - removeImage = (fileIndex) => { - const { formKey, fieldKey, removeFile } = this.props; - removeFile(formKey, fieldKey, fileIndex); - }; - - onFilePicked = (file, imageUri) => { - const { images, formKey, fieldKey, module, fileUpload, toggleSnackbarAndSetText } = this.props; - const MAX_IMAGE_SIZE = 5000; - const fileSize = getFileSize(file); - const isImage = isFileImage(file); - if (!isImage) { - toggleSnackbarAndSetText(true, { labelName: "The file is not a valid image", labelKey: "ERR_NOT_VALID_IMAGE" }, "error"); - } else if (fileSize > MAX_IMAGE_SIZE) { - toggleSnackbarAndSetText(true, { labelName: "The file is more than 5mb", labelKey: "ERR_FILE_MORE_THAN_FIVEMB" },"error"); - } else { - if (images.length < 3) { - fileUpload(formKey, fieldKey, { module, file, imageUri }); - } - } - }; - - render() { - const { onFilePicked, removeImage } = this; - const { images, loading } = this.props; - // file Size in kb - const inputProps = { accept: "image/*", maxFiles: 3, multiple: true }; - - return ( -
- {loading && } - {!images.length ? ( - -
- -
-
- ) : ( -
- {images.map((image, index) => { - return ( -
- -
removeImage(index)}> - -
-
- ); - })} - {this.fillPlaceholder(images, onFilePicked, inputProps)} -
- )} -
- ); - } -} - -const mapStateToProps = (state, ownProps) => { - const images = (state.form[ownProps.formKey] && state.form[ownProps.formKey].files && state.form[ownProps.formKey].files[ownProps.fieldKey]) || []; - const loading = images.reduce((loading, file) => { - return loading || file.loading; - }, false); - return { images, loading }; -}; - -const mapDispatchToProps = (dispatch) => { - return { - toggleSnackbarAndSetText: (open, message, error) => dispatch(toggleSnackbarAndSetText(open, message, error)), - fileUpload: (formKey, fieldKey, module, fileObject) => dispatch(fileUpload(formKey, fieldKey, module, fileObject)), - removeFile: (formKey, fieldKey, index) => dispatch(removeFile(formKey, fieldKey, index)), - }; -}; - -export default connect( - mapStateToProps, - mapDispatchToProps -)(ImageUpload); diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/citizen/Home/ImageUpload/index.scss b/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/citizen/Home/ImageUpload/index.scss deleted file mode 100644 index f8f610a1d..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/citizen/Home/ImageUpload/index.scss +++ /dev/null @@ -1,63 +0,0 @@ -.upload-photo-overlay { - background: #d8d8d8; - padding: 37px 8px; - text-align: center; -} - -.upload-icon-cont { - width: 31px; - height: 31px; - border-radius: 50%; - background: #484848; - display: inline-block; - padding: 5px 0; - margin-bottom: 5px; -} - -.upload-photo-overlay .label-container { - line-height: 1; -} - -.upload-images-cont { - display: flex; - align-items: flex-start; - justify-content: space-evenly; - -} -.upload-placeholder, -.upload-image-cont { - width: 100px; - height: 100px; - margin-right: 14px; - position: relative; -} - -.upload-placeholder { - border: 1px dashed #979797; - display: flex; - flex-direction: column; - justify-content: center; -} - -.image-remove { - position: absolute; - top: -7px; - right: -7px; - width: 20px; - height: 20px; - border-radius: 50%; - background: rgba(0, 0, 0, 0.7); - padding: 3px 0; -} - -.upload-placeholder:last-child { - margin: 0; -} - -.upload-image-cont:last-child { - margin: 0; -} - -.upload-photo-text { - width: 80%; -} diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/citizen/Home/LanguageSelection.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/citizen/Home/LanguageSelection.js deleted file mode 100644 index 08c3e5db0..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/citizen/Home/LanguageSelection.js +++ /dev/null @@ -1,48 +0,0 @@ -import React, { useMemo } from "react"; -import { PageBasedInput, Loader, RadioButtons, CardHeader } from "@egovernments/digit-ui-react-components"; -import { useTranslation } from "react-i18next"; -import { useHistory } from "react-router-dom"; - -const LanguageSelection = () => { - const { t } = useTranslation(); - const history = useHistory(); - - const { data: { languages, stateInfo } = {}, isLoading } = Digit.Hooks.useStore.getInitData(); - const selectedLanguage = Digit.StoreData.getCurrentLanguage(); - - const texts = useMemo( - () => ({ - header: t("CS_COMMON_CHOOSE_LANGUAGE"), - submitBarLabel: t("CORE_COMMON_CONTINUE"), - }), - [t] - ); - - const RadioButtonProps = useMemo( - () => ({ - options: languages, - optionsKey: "label", - additionalWrapperClass: "reverse-radio-selection-wrapper", - onSelect: (language) => Digit.LocalizationService.changeLanguage(language.value, stateInfo.code), - selectedOption: languages?.filter((i) => i.value === selectedLanguage)[0], - }), - [selectedLanguage, languages] - ); - - function onSubmit() { - history.push(`/digit-ui/citizen/select-location`); - } - - return isLoading ? ( - - ) : ( -
- - {t("CS_COMMON_CHOOSE_LANGUAGE")} - - -
- ); -}; - -export default LanguageSelection; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/citizen/Home/LocationSelection.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/citizen/Home/LocationSelection.js deleted file mode 100644 index b1839b6cc..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/citizen/Home/LocationSelection.js +++ /dev/null @@ -1,64 +0,0 @@ -import { BackButton, CardHeader, CardLabelError, PageBasedInput, SearchOnRadioButtons } from "@egovernments/digit-ui-react-components"; -import React, { useMemo, useState } from "react"; -import { useTranslation } from "react-i18next"; -import { useHistory, useLocation } from "react-router-dom"; - -const LocationSelection = () => { - const { t } = useTranslation(); - const history = useHistory(); - const location = useLocation(); - const { data: cities, isLoading } = Digit.Hooks.useTenants(); - - const [selectedCity, setSelectedCity] = useState(() => ({ code: Digit.ULBService.getCitizenCurrentTenant(true) })); - const [showError, setShowError] = useState(false); - - const texts = useMemo( - () => ({ - header: t("CS_COMMON_CHOOSE_LOCATION"), - submitBarLabel: t("CORE_COMMON_CONTINUE"), - }), - [t] - ); - - function selectCity(city) { - setSelectedCity(city); - setShowError(false); - } - - const RadioButtonProps = useMemo(() => { - return { - options: cities, - optionsKey: "i18nKey", - additionalWrapperClass: "reverse-radio-selection-wrapper", - onSelect: selectCity, - selectedOption: selectedCity, - }; - }, [cities, t, selectedCity]); - - function onSubmit() { - if (selectedCity) { - Digit.SessionStorage.set("CITIZEN.COMMON.HOME.CITY", selectedCity); - const redirectBackTo = location.state?.redirectBackTo; - if (redirectBackTo) { - history.replace(redirectBackTo); - } else history.push("/digit-ui/citizen"); - } else { - setShowError(true); - } - } - - return isLoading ? ( - - ) : ( -
- - - {t("CS_COMMON_CHOOSE_LOCATION")} - - {showError ? {t("CS_COMMON_LOCATION_SELECTION_ERROR")} : null} - -
- ); -}; - -export default LocationSelection; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/citizen/Home/UserProfile.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/citizen/Home/UserProfile.js deleted file mode 100644 index 7d45c6ddb..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/citizen/Home/UserProfile.js +++ /dev/null @@ -1,695 +0,0 @@ -import { - CameraIcon, - CardLabel, - Dropdown, - LabelFieldPair, - MobileNumber, - TextInput, - Toast, - CardLabelError, - BreadCrumb, - BackButton, - Loader, -} from "@egovernments/digit-ui-react-components"; -import React, { useEffect, useState } from "react"; -import { useTranslation } from "react-i18next"; -import { useHistory } from "react-router-dom"; -import UploadDrawer from "./ImageUpload/UploadDrawer"; - -const defaultImage = - "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAO4AAADUCAMAAACs0e/bAAAAM1BMVEXK0eL" + - "/" + - "/" + - "/" + - "/Dy97GzuD4+fvL0uPg5O7T2efb4OvR1+Xr7vTk5/Df4+37/P3v8fbO1eTt8PUsnq5FAAAGqElEQVR4nO2d25ajIBBFCajgvf/" + - "/a0eMyZgEjcI5xgt7Hmatme507UaxuJXidiDqjmSgeVIMlB1ZR1WZAf2gbdu0QwixSYzjOJPmHurfEGEfY9XzjNGG9whQCeVAuv5xQEySLtR9hPuIcwj0EeroN5m3D1IbsbgHK0esiQ9MKs" + - "qXVr8Hm/a/Pulk6wihpCIXBw3dh7bTvRBt9+dC5NfS1VH3xETdM3MxXRN1T0zUPTNR98xcS1dlV9NNfx3DhkTdM6PKqHteVBF1z0vU5f0sKdpc2zWLKutXrjJjdLvpesRmukqYonauPhXpds" + - "Lb6CppmpnltsYIuY2yavi6Mi2/rzAWm1zUfF0limVLqkZyA+mDYevKBS37aGC+L1lX5e7uyU1Cv565uiua9k5LFqbqqrnu2I3m+jJ11ZoLeRtfmdB0Uw/ZDsP0VTxdn7a1VERfmq7Xl" + - "Xyn5D2QWLoq8bZlPoBJumphJjVBw/Ll6CoTZGsTDs4NrGqKbqBth8ZHJUi6cn168QmleSm6GmB7Kxm+6obXlf7PoDHosCwM3QpiS2legi6ocSl3L0G3BdneDDgwQdENfeY+SfDJBkF37Z" + - "B+GvwzA6/rMaafAn8143VhPZWdjMWG1oHXhdnemgPoAvLlB/iZyRTfVeF06wPoQhJmlm4bdcOAZRlRN5gcPc5SoPEQR1fDdbOo6wn+uYvXxY0QCLom6gYROKH+Aj5nvphuFXWDiLpRdxl" + - "/19LFT95k6CHCrnW7pCDqBn1i1PUFvii2c11oZOJ6usWeH0RRNzC4Zs+6FTi2nevCVwCjbugnXklX5fkfTldL8PEilUB1kfNyN1u9MME2sATr4lbuB7AjfLAuvsRm1A0g6gYRdcPAjvBlje" + - "2Z8brI8OC68AcRdlCkwLohx2mcZMjw9q+LzarQurjtnwPYAydX08WecECO/u6Ad0GBdYG7jO5gB4Ap+PwKcA9ZT43dn4/W9TyiPAn4OAJaF7h3uwe8StSCddFdM3jqFa2LvnnB5zzhuuBBAj" + - "Y4gi50cg694gnXhTYvfMdrjtcFZhrwE9r41gUem8IXWMC3LrBzxh+a0gRd1N1LOK7M0IUUGuggvEmHoStA2/MJh7MpupiDU4TzjhxdzLAoO4ouZvqVURbFMHQlZD6SUeWHoguZsSLUGegreh" + - "A+FZFowPdUWTi6iMoZlIpGGUUXkDbjj/9ZOLqAQS/+GIKl5BQOCn/ycqpzkXSDm5dU7ZWkG7wUyGlcmm7g5Ux56AqirgoaJ7BeokPTDbp9CbVunjFxPrl7+HqnkrSq1Da7JX20f3dV8yJi6v" + - "oO81mX8vV0mx3qUsZCPRfTlVRdz2EvdufYGDvNQvvwqHtmXd+a1ITinwNcXc+lT6JuzdT1XDyBn/x7wtX1HCQQdW9MXc8xArGrirowfLeUEbMqqq6f7TF1lfRdOuGNiGi6SpT+WxY06xUfNN" + - "2wBfyE9I4tlm7w5hvOPDNJN3yNiLMipji6gE3chKhouoCtN5x3QlF0EZt8OW/8ougitqJQlk1aii7iFC9l0MvRReyao7xNjKML2Z/PuHlzhi5mFxljiZeiC9rPTEisNEMX9KYAwo5Xhi7qaA" + - "3hamboYm7dG+NVrXhdaYDv5zFaQZsYrCtbbAGnjkQDX2+J1FXCwOsqWOpKoIQNTFdqYBWydxqNqUoG0pVpCS+H8kaJaGKErlIaXj7CRRE+gRWuKwW9YZ80oVOUgbpdT0zpnSZJTIiwCtJVelv" + - "Xntr4P5j6BWfPb5Wcx84C4cq3hb11lco2u2Mdwp6XdJ/Ne3wb8DWdfiRenZaXrhLwOj4e+GQeHroy3YOspS7TlU28Wle2m2QUS0mqdcbrdNW+ZHsSsyK7tBfm0q/dWcv+Z3mytVx3t7KWulq" + - "Ue6ilunu8jF8pFwgv1FXp3mUt35OtRbr7eM4u4Gs6vUBXgeuHc5kfE/cbvWZtkROLm1DMtLCy80tzsu2PRj0hTI8fvrQuvsjlJkyutszq+m423wHaLTyniy/XuiGZ84LuT+m5ZfNfRxyGs7L" + - "XZOvia7VujatUwVTrIt+Q/Csc7Tuhe+BOakT10b4TuoiiJjvgU9emTO42PwEfBa+cuodKkuf42DXr1D3JpXz73Hnn0j10evHKe+nufgfUm+7B84sX9FfdEzXux2DBpWuKokkCqN/5pa/8pmvn" + - "L+RGKCddCGmatiPyPB/+ekO/M/q/7uvbt22kTt3zEnXPzCV13T3Gel4/6NduDu66xRvlPNkM1RjjxUdv+4WhGx6TftD19Q/dfzpwcHO+rE3fAAAAAElFTkSuQmCC"; - -const UserProfile = ({ stateCode, userType, cityDetails }) => { - const history = useHistory(); - const { t } = useTranslation(); - const url = window.location.href; - const stateId = Digit.ULBService.getStateId(); - const tenant = Digit.ULBService.getCurrentTenantId(); - const userInfo = Digit.UserService.getUser()?.info || {}; - const [userDetails, setUserDetails] = useState(null); - const [name, setName] = useState(userInfo?.name ? userInfo.name : ""); - const [email, setEmail] = useState(userInfo?.emailId ? userInfo.emailId : ""); - const [gender, setGender] = useState(userDetails?.gender); - const [city, setCity] = useState(userInfo?.permanentCity ? userInfo.permanentCity : cityDetails.name); - const [mobileNumber, setMobileNo] = useState(userInfo?.mobileNumber ? userInfo.mobileNumber : ""); - const [profilePic, setProfilePic] = useState(null); - const [profileImg, setProfileImg] = useState(""); - const [openUploadSlide, setOpenUploadSide] = useState(false); - const [changepassword, setChangepassword] = useState(false); - const [currentPassword, setCurrentPassword] = useState(""); - const [newPassword, setNewPassword] = useState(""); - const [confirmPassword, setConfirmPassword] = useState(""); - const [toast, setToast] = useState(null); - const [loading, setLoading] = useState(false); - const [windowWidth, setWindowWidth] = React.useState(window.innerWidth); - const [errors, setErrors] = React.useState({}); - const isMobile = window.Digit.Utils.browser.isMobile(); - - const getUserInfo = async () => { - const uuid = userInfo?.uuid; - if (uuid) { - const usersResponse = await Digit.UserService.userSearch(tenant, { uuid: [uuid] }, {}); - usersResponse && usersResponse.user && usersResponse.user.length && setUserDetails(usersResponse.user[0]); - } - }; - - React.useEffect(() => { - window.addEventListener("resize", () => setWindowWidth(window.innerWidth)); - return () => { - window.removeEventListener("resize", () => setWindowWidth(window.innerWidth)); - }; - }); - - useEffect(() => { - setLoading(true); - - getUserInfo(); - - setGender({ - i18nKey: undefined, - code: userDetails?.gender, - value: userDetails?.gender, - }); - - const thumbs = userDetails?.photo?.split(","); - setProfileImg(thumbs?.at(0)); - - setLoading(false); - }, [userDetails !== null]); - - let validation = {}; - const editScreen = false; // To-do: Deubug and make me dynamic or remove if not needed - const onClickAddPic = () => setOpenUploadSide(!openUploadSlide); - const TogleforPassword = () => setChangepassword(!changepassword); - const setGenderName = (value) => setGender(value); - const closeFileUploadDrawer = () => setOpenUploadSide(false); - - const setUserName = (value) => { - setName(value); - - if (!new RegExp(/^[a-zA-Z ]+$/i).test(value) || value.length === 0 || value.length > 50) { - setErrors({ ...errors, userName: { type: "pattern", message: t("CORE_COMMON_PROFILE_NAME_INVALID") } }); - } else { - setErrors({ ...errors, userName: null }); - } - }; - - const setUserEmailAddress = (value) => { - setEmail(value); - if (value.length && /*!(value.includes("@") && value.includes("."))*/ !/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(value)) { - setErrors({ ...errors, emailAddress: { type: "pattern", message: t("CORE_COMMON_PROFILE_EMAIL_INVALID") } }); - } else { - setErrors({ ...errors, emailAddress: null }); - } - }; - - const setUserMobileNumber = (value) => { - setMobileNo(value); - - if (userType === "employee" && !new RegExp(/^[6-9]{1}[0-9]{9}$/).test(value)) { - setErrors({ ...errors, mobileNumber: { type: "pattern", message: t("CORE_COMMON_PROFILE_MOBILE_NUMBER_INVALID") } }); - } else { - setErrors({ ...errors, mobileNumber: null }); - } - }; - - const setUserCurrentPassword = (value) => { - setCurrentPassword(value); - - if (!new RegExp(/^([a-zA-Z0-9@#$%]{8,15})$/i).test(value)) { - setErrors({ ...errors, currentPassword: { type: "pattern", message: t("CORE_COMMON_PROFILE_PASSWORD_INVALID") } }); - } else { - setErrors({ ...errors, currentPassword: null }); - } - }; - - const setUserNewPassword = (value) => { - setNewPassword(value); - - if (!new RegExp(/^([a-zA-Z0-9@#$%]{8,15})$/i).test(value)) { - setErrors({ ...errors, newPassword: { type: "pattern", message: t("CORE_COMMON_PROFILE_PASSWORD_INVALID") } }); - } else { - setErrors({ ...errors, newPassword: null }); - } - }; - - const setUserConfirmPassword = (value) => { - setConfirmPassword(value); - - if (!new RegExp(/^([a-zA-Z0-9@#$%]{8,15})$/i).test(value)) { - setErrors({ ...errors, confirmPassword: { type: "pattern", message: t("CORE_COMMON_PROFILE_PASSWORD_INVALID") } }); - } else { - setErrors({ ...errors, confirmPassword: null }); - } - }; - - const removeProfilePic = () => { - setProfilePic(null); - setProfileImg(null); - }; - - const showToast = (type, message, duration = 5000) => { - setToast({ key: type, action: message }); - setTimeout(() => { - setToast(null); - }, duration); - }; - - const updateProfile = async () => { - setLoading(true); - try { - const requestData = { - ...userInfo, - name, - gender: gender?.value, - emailId: email, - photo: profilePic, - }; - - if (!new RegExp(/^([a-zA-Z ])*$/).test(name) || name === "" || name.length > 50 || name.length < 1) { - throw JSON.stringify({ type: "error", message: t("CORE_COMMON_PROFILE_NAME_INVALID") }); - } - - if (userType === "employee" && !new RegExp(/^[6-9]{1}[0-9]{9}$/).test(mobileNumber)) { - throw JSON.stringify({ type: "error", message: t("CORE_COMMON_PROFILE_MOBILE_NUMBER_INVALID") }); - } - - if (email.length && !/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email)) { - throw JSON.stringify({ type: "error", message: t("CORE_COMMON_PROFILE_EMAIL_INVALID") }); - } - - if (currentPassword.length || newPassword.length || confirmPassword.length) { - if (newPassword !== confirmPassword) { - throw JSON.stringify({ type: "error", message: t("CORE_COMMON_PROFILE_PASSWORD_MISMATCH") }); - } - - if (!(currentPassword.length && newPassword.length && confirmPassword.length)) { - throw JSON.stringify({ type: "error", message: t("CORE_COMMON_PROFILE_PASSWORD_INVALID") }); - } - - if (!new RegExp(/^([a-zA-Z0-9@#$%]{8,15})$/i).test(newPassword) && !new RegExp(/^([a-zA-Z0-9@#$%]{8,15})$/i).test(confirmPassword)) { - throw JSON.stringify({ type: "error", message: t("CORE_COMMON_PROFILE_PASSWORD_INVALID") }); - } - } - requestData["locale"] = Digit.StoreData.getCurrentLanguage(); - const { responseInfo, user } = await Digit.UserService.updateUser(requestData, stateCode); - - if (responseInfo && responseInfo.status === "200") { - const user = Digit.UserService.getUser(); - - if (user) { - Digit.UserService.setUser({ - ...user, - info: { - ...user.info, - name, - mobileNumber, - emailId: email, - permanentCity: city, - }, - }); - } - } - - if (currentPassword.length && newPassword.length && confirmPassword.length) { - const requestData = { - existingPassword: currentPassword, - newPassword: newPassword, - tenantId: tenant, - type: "EMPLOYEE", - username: userInfo?.userName, - confirmPassword: confirmPassword, - }; - - if (newPassword === confirmPassword) { - try { - const res = await Digit.UserService.changePassword(requestData, tenant); - - const { responseInfo: changePasswordResponseInfo } = res; - if (changePasswordResponseInfo?.status && changePasswordResponseInfo.status === "200") { - showToast("success", t("CORE_COMMON_PROFILE_UPDATE_SUCCESS_WITH_PASSWORD"), 5000); - } else { - throw ""; - } - } catch (error) { - throw JSON.stringify({ - type: "error", - message: error.Errors?.at(0)?.description ? error.Errors.at(0).description : t("CORE_COMMON_PROFILE_UPDATE_ERROR_WITH_PASSWORD"), - }); - } - } else { - throw JSON.stringify({ type: "error", message: t("CORE_COMMON_PROFILE_ERROR_PASSWORD_NOT_MATCH") }); - } - } else if (responseInfo?.status && responseInfo.status === "200") { - showToast("success", t("CORE_COMMON_PROFILE_UPDATE_SUCCESS"), 5000); - } - } catch (error) { - const errorObj = JSON.parse(error); - showToast(errorObj.type, t(errorObj.message), 5000); - } - - setLoading(false); - }; - - let menu = []; - const { data: Menu } = Digit.Hooks.pt.useGenderMDMS(stateId, "common-masters", "GenderType"); - Menu && - Menu.map((genderDetails) => { - menu.push({ i18nKey: `PT_COMMON_GENDER_${genderDetails.code}`, code: `${genderDetails.code}`, value: `${genderDetails.code}` }); - }); - - const setFileStoreId = async (fileStoreId) => { - setProfilePic(fileStoreId); - - const thumbnails = fileStoreId ? await getThumbnails([fileStoreId], stateId) : null; - - setProfileImg(thumbnails?.thumbs[0]); - - closeFileUploadDrawer(); - }; - - const getThumbnails = async (ids, tenantId) => { - const res = await Digit.UploadServices.Filefetch(ids, tenantId); - if (res.data.fileStoreIds && res.data.fileStoreIds.length !== 0) { - return { - thumbs: res.data.fileStoreIds.map((o) => o.url.split(",")[3]), - images: res.data.fileStoreIds.map((o) => Digit.Utils.getFileUrl(o.url)), - }; - } else { - return null; - } - }; - - if (loading) return ; - - return ( -
-
- {userType === "citizen" ? ( - - ) : ( - - )} -
-
-
-
- - -
-
-
- {userType === "citizen" ? ( - - - {`${t("CORE_COMMON_PROFILE_NAME")}`}* -
- setUserName(e.target.value)} - {...(validation = { - isRequired: true, - pattern: "^[a-zA-Z-.`' ]*$", - type: "tel", - title: t("CORE_COMMON_PROFILE_NAME_ERROR_MESSAGE"), - })} - disable={editScreen} - /> - {errors?.userName && {errors?.userName?.message} } -
-
- - - {`${t("CORE_COMMON_PROFILE_GENDER")}`} - - - - - {`${t("CORE_COMMON_PROFILE_EMAIL")}`} -
- setUserEmailAddress(e.target.value)} - disable={editScreen} - /> - {errors?.emailAddress && {errors?.emailAddress?.message} } -
-
- - -
- ) : ( - - - - {`${t("CORE_COMMON_PROFILE_NAME")}`}* - -
- setUserName(e.target.value)} - placeholder="Enter Your Name" - {...(validation = { - isRequired: true, - pattern: "^[a-zA-Z-.`' ]*$", - type: "text", - title: t("CORE_COMMON_PROFILE_NAME_ERROR_MESSAGE"), - })} - disable={editScreen} - /> - {errors?.userName && {errors?.userName?.message} } -
-
- - - {`${t( - "CORE_COMMON_PROFILE_GENDER" - )}`} - - - - - {`${t( - "CORE_COMMON_PROFILE_CITY" - )}`} -
- setCity(e.target.value)} - placeholder="Enter Your City Name" - {...(validation = { - isRequired: true, - // pattern: "^[a-zA-Z-.`' ]*$", - type: "text", - title: t("CORE_COMMON_PROFILE_CITY_ERROR_MESSAGE"), - })} - disable={true} - /> - -
-
- - - {`${t("CORE_COMMON_PROFILE_MOBILE_NUMBER")}*`} -
- setUserMobileNumber(value)} - disable={true} - {...{ required: true, pattern: "[6-9]{1}[0-9]{9}", type: "tel", title: t("CORE_COMMON_PROFILE_MOBILE_NUMBER_INVALID") }} - /> - {errors?.mobileNumber && {errors?.mobileNumber?.message} } -
-
- - - {`${t( - "CORE_COMMON_PROFILE_EMAIL" - )}`} -
- setUserEmailAddress(e.target.value)} - disable={editScreen} - /> - {errors?.emailAddress && {errors?.emailAddress?.message} } -
-
- - -
- - {t("CORE_COMMON_CHANGE_PASSWORD")} - - {changepassword ? ( -
- - {`${t("CORE_COMMON_PROFILE_CURRENT_PASSWORD")}`} -
- setUserCurrentPassword(e.target.value)} - disable={editScreen} - /> - {errors?.currentPassword && {errors?.currentPassword?.message}} -
-
- - - {`${t("CORE_COMMON_PROFILE_NEW_PASSWORD")}`} -
- setUserNewPassword(e.target.value)} - disable={editScreen} - /> - {errors?.newPassword && {errors?.newPassword?.message}} -
-
- - - {`${t("CORE_COMMON_PROFILE_CONFIRM_PASSWORD")}`} -
- setUserConfirmPassword(e.target.value)} - disable={editScreen} - /> - {errors?.confirmPassword && {errors?.confirmPassword?.message}} -
-
-
- ) : ( - "" - )} -
-
-
- )} -
-
- - {userType === "employee" ? ( -
- -
- ) : ( - "" - )} - {toast && ( - setToast(null)} - style={{ maxWidth: "670px" }} - /> - )} - - {openUploadSlide == true ? ( - - ) : ( - "" - )} -
- ); -}; - -export default UserProfile; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/citizen/Home/index.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/citizen/Home/index.js deleted file mode 100644 index d87a38361..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/citizen/Home/index.js +++ /dev/null @@ -1,181 +0,0 @@ -import React, { useEffect } from "react"; -import { - StandaloneSearchBar, - Loader, - CardBasedOptions, - ComplaintIcon, - PTIcon, - CaseIcon, - DropIcon, - HomeIcon, - Calender, - DocumentIcon, - HelpIcon, - WhatsNewCard, - OBPSIcon, - WSICon, -} from "@egovernments/digit-ui-react-components"; -import { useTranslation } from "react-i18next"; -import { useHistory } from "react-router-dom"; -import { CitizenSideBar } from "../../../components/TopBarSideBar/SideBar/CitizenSideBar"; -import StaticCitizenSideBar from "../../../components/TopBarSideBar/SideBar/StaticCitizenSideBar"; - -const Home = () => { - const { t } = useTranslation(); - const history = useHistory(); - const tenantId = Digit.ULBService.getCitizenCurrentTenant(true); - const { data: { stateInfo, uiHomePage } = {}, isLoading } = Digit.Hooks.useStore.getInitData(); - let isMobile = window.Digit.Utils.browser.isMobile(); - if(window.Digit.SessionStorage.get("TL_CREATE_TRADE")) window.Digit.SessionStorage.set("TL_CREATE_TRADE",{}) - - const conditionsToDisableNotificationCountTrigger = () => { - if (Digit.UserService?.getUser()?.info?.type === "EMPLOYEE") return false; - if (!Digit.UserService?.getUser()?.access_token) return false; - return true; - }; - - const { data: EventsData, isLoading: EventsDataLoading } = Digit.Hooks.useEvents({ - tenantId, - variant: "whats-new", - config: { - enabled: conditionsToDisableNotificationCountTrigger(), - }, - }); - - if (!tenantId) { - Digit.SessionStorage.get("locale") === null - ? history.push(`/digit-ui/citizen/select-language`) - : history.push(`/digit-ui/citizen/select-location`); - } - - const appBannerWebObj = uiHomePage?.appBannerDesktop; - const appBannerMobObj = uiHomePage?.appBannerMobile; - const citizenServicesObj = uiHomePage?.citizenServicesCard; - const infoAndUpdatesObj = uiHomePage?.informationAndUpdatesCard; - const whatsAppBannerWebObj = uiHomePage?.whatsAppBannerDesktop; - const whatsAppBannerMobObj = uiHomePage?.whatsAppBannerMobile; - const whatsNewSectionObj = uiHomePage?.whatsNewSection; - - const handleClickOnWhatsAppBanner = (obj) => { - window.open(obj?.navigationUrl); - }; - - const allCitizenServicesProps = { - header: t(citizenServicesObj?.headerLabel), - sideOption: { - name: t(citizenServicesObj?.sideOption?.name), - onClick: () => history.push(citizenServicesObj?.sideOption?.navigationUrl), - }, - options: [ - { - name: t(citizenServicesObj?.props?.[0]?.label), - Icon: , - onClick: () => history.push(citizenServicesObj?.props?.[0]?.navigationUrl), - }, - { - name: t(citizenServicesObj?.props?.[1]?.label), - Icon: , - onClick: () => history.push(citizenServicesObj?.props?.[1]?.navigationUrl), - }, - { - name: t(citizenServicesObj?.props?.[2]?.label), - Icon: , - onClick: () => history.push(citizenServicesObj?.props?.[2]?.navigationUrl), - }, - // { - // name: t("ACTION_TEST_WATER_AND_SEWERAGE"), - // Icon: , - // onClick: () => history.push("/digit-ui/citizen") - // }, - { - name: t(citizenServicesObj?.props?.[3]?.label), - Icon: , - onClick: () => history.push(citizenServicesObj?.props?.[3]?.navigationUrl), - }, - ], - styles: { display: "flex", flexWrap: "wrap", justifyContent: "flex-start", width: "100%" }, - }; - const allInfoAndUpdatesProps = { - header: t(infoAndUpdatesObj?.headerLabel), - sideOption: { - name: t(infoAndUpdatesObj?.sideOption?.name), - onClick: () => history.push(infoAndUpdatesObj?.sideOption?.navigationUrl), - }, - options: [ - { - name: t(infoAndUpdatesObj?.props?.[0]?.label), - Icon: , - onClick: () => history.push(infoAndUpdatesObj?.props?.[0]?.navigationUrl), - }, - { - name: t(infoAndUpdatesObj?.props?.[1]?.label), - Icon: , - onClick: () => history.push(infoAndUpdatesObj?.props?.[1]?.navigationUrl), - }, - { - name: t(infoAndUpdatesObj?.props?.[2]?.label), - Icon: , - onClick: () => history.push(infoAndUpdatesObj?.props?.[2]?.navigationUrl), - }, - { - name: t(infoAndUpdatesObj?.props?.[3]?.label), - Icon: , - onClick: () => history.push(infoAndUpdatesObj?.props?.[3]?.navigationUrl), - }, - // { - // name: t("CS_COMMON_HELP"), - // Icon: - // } - ], - styles: { display: "flex", flexWrap: "wrap", justifyContent: "flex-start", width: "100%" }, - }; - - return isLoading ? ( - - ) : ( -
- {/*
- -
*/} -
- {
- {isMobile ? : } - {/*
- -
*/} -
- - -
-
} - - - {(whatsAppBannerMobObj || whatsAppBannerWebObj) && ( -
- {isMobile ? ( - handleClickOnWhatsAppBanner(whatsAppBannerMobObj)} /> - ) : ( - handleClickOnWhatsAppBanner(whatsAppBannerWebObj)} /> - )} -
- )} - - {conditionsToDisableNotificationCountTrigger() ? ( - EventsDataLoading ? ( - - ) : ( -
-
-

{t(whatsNewSectionObj?.headerLabel)}

-

history.push(whatsNewSectionObj?.sideOption?.navigationUrl)}>{t(whatsNewSectionObj?.sideOption?.name)}

-
- -
- ) - ) : null} -
-
- ); -}; - -export default Home; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/citizen/HowItWorks/howItWorks.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/citizen/HowItWorks/howItWorks.js deleted file mode 100644 index 2bf381a60..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/citizen/HowItWorks/howItWorks.js +++ /dev/null @@ -1,132 +0,0 @@ -import { Header, CloseSvg, DownloadImgIcon, CustomButton, Loader, BackButton, PDFSvg, DownloadBtnCommon} from "@egovernments/digit-ui-react-components"; -import React, { useState, Fragment }from "react"; -import { useTranslation } from "react-i18next"; - - -const HowItWorks = ({module}) => { - const isMobile = window.Digit.Utils.browser.isMobile(); - const user = Digit.UserService.getUser(); - const tenantId = user?.info?.tenantId || Digit.ULBService.getCurrentTenantId(); - const { t } = useTranslation(); - const storeData = Digit.SessionStorage.get("initData"); - const stateInfo = storeData.stateInfo; - const selectedLanguage = Digit.StoreData.getCurrentLanguage(); - const [selected, setselected] = useState(selectedLanguage); - const handleChangeLanguage = (language) => { - setselected(language.value); - Digit.LocalizationService.changeLanguage(language.value, stateInfo.code); - }; - const [videoPlay, setVideoPlay] = useState(false); - const [vidSrc, setVidSrc] = useState(""); - - const ViDSvg = () => ( - - - - ); - - function CloseVidSvg({onClick}){ - return ( - - - - ); - } - const onClickVideo = (vidObj) => { - if(selected === "hi_IN"){ - setVidSrc(vidObj["hi_IN"]); - } - else{ - setVidSrc(vidObj["en_IN"]); - } - setVideoPlay(true); - } - const onClose = () => { - setVideoPlay(false); - } - - const { isLoading, data } = Digit.Hooks.useGetHowItWorksJSON(Digit.ULBService.getStateId()); - - - const mdmsConfigResult = data?.MdmsRes["common-masters"]?.howItWorks[0]?.[`${module}`]; - const languages = - [ - { - label: "ENGLISH", - value: "en_IN" - }, - { - label: "हिंदी", - value: "hi_IN" - } - ]; - - if(isLoading){ - return - } - return ( - -
-
-
-
{t("HOW_IT_WORKS")}
-
-
- {languages.map((language, index) => ( -
- handleChangeLanguage(language)} - > -
- ))} -
- {mdmsConfigResult.videosJson.map((videos, index) => ( -
-
-
onClickVideo(videos)}> -
- -
-
-
-

{t(videos.headerLabel)}

-

{t(videos.description)}

-
-
-
- - ))} -
-
-
-
- -
-
-

{t(mdmsConfigResult.pdfHeader)}

-

{t(mdmsConfigResult.pdfDesc)}

-
-
-
- -
-
-
- { videoPlay && ( -
-
- -
- -
- )} -
-
- ); -}; - -export default HowItWorks; \ No newline at end of file diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/citizen/Login/SelectMobileNumber.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/citizen/Login/SelectMobileNumber.js deleted file mode 100644 index 91979ed32..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/citizen/Login/SelectMobileNumber.js +++ /dev/null @@ -1,87 +0,0 @@ -import React, { useState, useEffect } from "react"; -import { CardText, FormStep, CitizenConsentForm, Loader, CheckBox } from "@egovernments/digit-ui-react-components"; -import { Link } from "react-router-dom"; - -const SelectMobileNumber = ({ t, onSelect, showRegisterLink, mobileNumber, onMobileChange, config, canSubmit }) => { - - const [isCheckBox, setIsCheckBox] = useState(false); - const [isCCFEnabled, setisCCFEnabled] = useState(false); - const [mdmsConfig, setMdmsConfig] = useState(""); - - const { isLoading, data } = Digit.Hooks.useCustomMDMS(Digit.ULBService.getStateId(), "common-masters", [{ name: "CitizenConsentForm" }]); - - function setTermsAndPolicyDetails(e) { - setIsCheckBox(e.target.checked) - } - - const checkDisbaled = () => { - if (isCCFEnabled?.isCitizenConsentFormEnabled) { - return !(mobileNumber.length === 10 && canSubmit && isCheckBox) - } else { - return !(mobileNumber.length === 10 && canSubmit) - } - } - - useEffect(()=> { - if (data?.["common-masters"]?.CitizenConsentForm?.[0]?.isCitizenConsentFormEnabled) { - setisCCFEnabled(data?.["common-masters"]?.CitizenConsentForm?.[0]) - } - }, [data]); - - const onLinkClick = (e) => { - setMdmsConfig(e.target.id) -} - - const checkLabels = () => { - return - {isCCFEnabled?.checkBoxLabels?.map((data, index) => { - return - {/* {index == 0 && "CCF"} */} - {data?.linkPrefix && {t(`${data?.linkPrefix}_`)}} - {data?.link && { onLinkClick(e) }} style={{ color: "#F47738", cursor: "pointer" }}>{t(`${data?.link}_`)}} - {data?.linkPostfix && {t(`${data?.linkPostfix}_`)}} - {(index == isCCFEnabled?.checkBoxLabels?.length - 1) && t("LABEL")} - - })} - - } - - - - if (isLoading) return - - return ( - - {isCCFEnabled?.isCitizenConsentFormEnabled &&
- - - -
} -
- ); -}; - -export default SelectMobileNumber; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/citizen/Login/SelectName.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/citizen/Login/SelectName.js deleted file mode 100644 index 6f4bc3d7a..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/citizen/Login/SelectName.js +++ /dev/null @@ -1,8 +0,0 @@ -import React from "react"; -import { FormStep } from "@egovernments/digit-ui-react-components"; - -const SelectName = ({ config, onSelect, t, isDisabled }) => { - return ; -}; - -export default SelectName; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/citizen/Login/SelectOtp.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/citizen/Login/SelectOtp.js deleted file mode 100644 index 84d7cd6f9..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/citizen/Login/SelectOtp.js +++ /dev/null @@ -1,51 +0,0 @@ -import React, { useState, Fragment } from "react"; -import { ButtonSelector, CardText, FormStep, LinkButton, OTPInput, CardLabelError } from "@egovernments/digit-ui-react-components"; -import useInterval from "../../../hooks/useInterval"; - -const SelectOtp = ({ config, otp, onOtpChange, onResend, onSelect, t, error, userType = "citizen", canSubmit }) => { - const [timeLeft, setTimeLeft] = useState(30); - - useInterval( - () => { - setTimeLeft(timeLeft - 1); - }, - timeLeft > 0 ? 1000 : null - ); - - const handleResendOtp = () => { - onResend(); - setTimeLeft(2); - }; - - if (userType === "employee") { - return ( - - - {timeLeft > 0 ? ( - {`${t("CS_RESEND_ANOTHER_OTP")} ${timeLeft} ${t("CS_RESEND_SECONDS")}`} - ) : ( -

- {t("CS_RESEND_OTP")} -

- )} - {!error && {t("CS_INVALID_OTP")}} -
- ); - } - - return ( - - - {timeLeft > 0 ? ( - {`${t("CS_RESEND_ANOTHER_OTP")} ${timeLeft} ${t("CS_RESEND_SECONDS")}`} - ) : ( -

- {t("CS_RESEND_OTP")} -

- )} - {!error && {t("CS_INVALID_OTP")}} -
- ); -}; - -export default SelectOtp; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/citizen/Login/config.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/citizen/Login/config.js deleted file mode 100644 index 0fa130d79..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/citizen/Login/config.js +++ /dev/null @@ -1,52 +0,0 @@ -export const loginSteps = [ - { - texts: { - header: "CS_LOGIN_PROVIDE_MOBILE_NUMBER", - cardText: "CS_LOGIN_TEXT", - nextText: "CS_COMMONS_NEXT", - submitBarLabel: "CS_COMMONS_NEXT", - }, - inputs: [ - { - label: "CORE_COMMON_MOBILE_NUMBER", - type: "text", - name: "mobileNumber", - error: "ERR_HRMS_INVALID_MOB_NO", - validation: { - required: true, - minLength: 10, - maxLength: 10, - }, - }, - ], - }, - { - texts: { - header: "CS_LOGIN_OTP", - cardText: "CS_LOGIN_OTP_TEXT", - nextText: "CS_COMMONS_NEXT", - submitBarLabel: "CS_COMMONS_NEXT", - }, - }, - { - texts: { - header: "CS_LOGIN_PROVIDE_NAME", - cardText: "CS_LOGIN_NAME_TEXT", - nextText: "CS_COMMONS_NEXT", - submitBarLabel: "CS_COMMONS_NEXT", - }, - inputs: [ - { - label: "CORE_COMMON_NAME", - type: "text", - name: "name", - error: "CORE_COMMON_NAME_VALIDMSG", - validation: { - required: true, - minLength: 1, - pattern: /^[^{0-9}^\$\"<>?\\\\~!@#$%^()+={}\[\]*,/_:;“”‘’]{1,50}$/i - }, - }, - ], - }, -]; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/citizen/Login/index.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/citizen/Login/index.js deleted file mode 100644 index 87c35f272..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/citizen/Login/index.js +++ /dev/null @@ -1,270 +0,0 @@ -import React, { useEffect, useMemo, useState } from "react"; -import { useTranslation } from "react-i18next"; -import { AppContainer, BackButton, Toast } from "@egovernments/digit-ui-react-components"; -import { Route, Switch, useHistory, useRouteMatch, useLocation } from "react-router-dom"; -import { loginSteps } from "./config"; -import SelectMobileNumber from "./SelectMobileNumber"; -import SelectOtp from "./SelectOtp"; -import SelectName from "./SelectName"; - -const TYPE_REGISTER = { type: "register" }; -const TYPE_LOGIN = { type: "login" }; -const DEFAULT_USER = "digit-user"; -const DEFAULT_REDIRECT_URL = "/digit-ui/citizen"; - -/* set citizen details to enable backward compatiable */ -const setCitizenDetail = (userObject, token, tenantId) => { - let locale = JSON.parse(sessionStorage.getItem("Digit.initData"))?.value?.selectedLanguage; - localStorage.setItem("Citizen.tenant-id", tenantId); - localStorage.setItem("tenant-id", tenantId); - localStorage.setItem("citizen.userRequestObject", JSON.stringify(userObject)); - localStorage.setItem("locale", locale); - localStorage.setItem("Citizen.locale", locale); - localStorage.setItem("token", token); - localStorage.setItem("Citizen.token", token); - localStorage.setItem("user-info", JSON.stringify(userObject)); - localStorage.setItem("Citizen.user-info", JSON.stringify(userObject)); -}; - -const getFromLocation = (state, searchParams) => { - return state?.from || searchParams?.from || DEFAULT_REDIRECT_URL; -}; - -const Login = ({ stateCode, isUserRegistered = true }) => { - const { t } = useTranslation(); - const location = useLocation(); - const { path, url } = useRouteMatch(); - const history = useHistory(); - const [user, setUser] = useState(null); - const [error, setError] = useState(null); - const [isOtpValid, setIsOtpValid] = useState(true); - const [tokens, setTokens] = useState(null); - const [params, setParmas] = useState(isUserRegistered ? {} : location?.state?.data); - const [errorTO, setErrorTO] = useState(null); - const searchParams = Digit.Hooks.useQueryParams(); - const [canSubmitName, setCanSubmitName] = useState(false); - const [canSubmitOtp, setCanSubmitOtp] = useState(true); - const [canSubmitNo, setCanSubmitNo] = useState(true); - - useEffect(() => { - let errorTimeout; - if (error) { - if (errorTO) { - clearTimeout(errorTO); - setErrorTO(null); - } - errorTimeout = setTimeout(() => { - setError(""); - }, 5000); - setErrorTO(errorTimeout); - } - return () => { - errorTimeout && clearTimeout(errorTimeout); - }; - }, [error]); - - useEffect(() => { - if (!user) { - return; - } - Digit.SessionStorage.set("citizen.userRequestObject", user); - Digit.UserService.setUser(user); - setCitizenDetail(user?.info, user?.access_token, stateCode); - const redirectPath = location.state?.from || DEFAULT_REDIRECT_URL; - if (!Digit.ULBService.getCitizenCurrentTenant(true)) { - history.replace("/digit-ui/citizen/select-location", { - redirectBackTo: redirectPath, - }); - } else { - history.replace(redirectPath); - } - }, [user]); - - const stepItems = useMemo(() => - loginSteps.map( - (step) => { - const texts = {}; - for (const key in step.texts) { - texts[key] = t(step.texts[key]); - } - return { ...step, texts }; - }, - [loginSteps] - ) - ); - - const getUserType = () => Digit.UserService.getType(); - - const handleOtpChange = (otp) => { - setParmas({ ...params, otp }); - }; - - const handleMobileChange = (event) => { - const { value } = event.target; - setParmas({ ...params, mobileNumber: value }); - }; - - const selectMobileNumber = async (mobileNumber) => { - setCanSubmitNo(false); - setParmas({ ...params, ...mobileNumber }); - const data = { - ...mobileNumber, - tenantId: stateCode, - userType: getUserType(), - }; - if (isUserRegistered) { - const [res, err] = await sendOtp({ otp: { ...data, ...TYPE_LOGIN } }); - if (!err) { - setCanSubmitNo(true); - history.replace(`${path}/otp`, { from: getFromLocation(location.state, searchParams), role: location.state?.role }); - return; - } else { - setCanSubmitNo(true); - if (!(location.state && location.state.role === "FSM_DSO")) { - history.push(`/digit-ui/citizen/register/name`, { from: getFromLocation(location.state, searchParams), data: data }); - } - } - if (location.state?.role) { - setCanSubmitNo(true); - setError(location.state?.role === "FSM_DSO" ? t("ES_ERROR_DSO_LOGIN") : "User not registered."); - } - } else { - const [res, err] = await sendOtp({ otp: { ...data, ...TYPE_REGISTER } }); - if (!err) { - setCanSubmitNo(true); - history.replace(`${path}/otp`, { from: getFromLocation(location.state, searchParams) }); - return; - } - setCanSubmitNo(true); - } - }; - - const selectName = async (name) => { - const data = { - ...params, - tenantId: stateCode, - userType: getUserType(), - ...name, - }; - setParmas({ ...params, ...name }); - setCanSubmitName(true); - const [res, err] = await sendOtp({ otp: { ...data, ...TYPE_REGISTER } }); - if (res) { - setCanSubmitName(false); - history.replace(`${path}/otp`, { from: getFromLocation(location.state, searchParams) }); - } else { - setCanSubmitName(false); - } - }; - - const selectOtp = async () => { - try { - setIsOtpValid(true); - setCanSubmitOtp(false); - const { mobileNumber, otp, name } = params; - if (isUserRegistered) { - const requestData = { - username: mobileNumber, - password: otp, - tenantId: stateCode, - userType: getUserType(), - }; - const { ResponseInfo, UserRequest: info, ...tokens } = await Digit.UserService.authenticate(requestData); - - if (location.state?.role) { - const roleInfo = info.roles.find((userRole) => userRole.code === location.state.role); - if (!roleInfo || !roleInfo.code) { - setError(t("ES_ERROR_USER_NOT_PERMITTED")); - setTimeout(() => history.replace(DEFAULT_REDIRECT_URL), 5000); - return; - } - } - if (window?.globalConfigs?.getConfig("ENABLE_SINGLEINSTANCE")) { - info.tenantId = Digit.ULBService.getStateId(); - } - - setUser({ info, ...tokens }); - } else if (!isUserRegistered) { - const requestData = { - name, - username: mobileNumber, - otpReference: otp, - tenantId: stateCode, - }; - - const { ResponseInfo, UserRequest: info, ...tokens } = await Digit.UserService.registerUser(requestData, stateCode); - - if (window?.globalConfigs?.getConfig("ENABLE_SINGLEINSTANCE")) { - info.tenantId = Digit.ULBService.getStateId(); - } - - setUser({ info, ...tokens }); - } - } catch (err) { - setCanSubmitOtp(true); - setIsOtpValid(false); - } - }; - - const resendOtp = async () => { - const { mobileNumber } = params; - const data = { - mobileNumber, - tenantId: stateCode, - userType: getUserType(), - }; - if (!isUserRegistered) { - const [res, err] = await sendOtp({ otp: { ...data, ...TYPE_REGISTER } }); - } else if (isUserRegistered) { - const [res, err] = await sendOtp({ otp: { ...data, ...TYPE_LOGIN } }); - } - }; - - const sendOtp = async (data) => { - try { - const res = await Digit.UserService.sendOtp(data, stateCode); - return [res, null]; - } catch (err) { - return [null, err]; - } - }; - - return ( -
- - - - - - - - - - - - - {error && setError(null)} />} - - -
- ); -}; - -export default Login; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/citizen/SearchApp.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/citizen/SearchApp.js deleted file mode 100644 index f152dce11..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/citizen/SearchApp.js +++ /dev/null @@ -1,113 +0,0 @@ -import React, { useEffect, useState } from "react"; -import { useTranslation } from "react-i18next"; -import AuditSearchApplication from "../../components/Search"; -import { Link } from "react-router-dom"; -const Search = ({ path }) => { - const { t } = useTranslation(); - const tenantId = Digit.ULBService.getCitizenCurrentTenant() - const [payload, setPayload] = useState({}); - const isMobile = window.Digit.Utils.browser.isMobile(); - const convertDateToEpoch = (dateString, dayStartOrEnd = "dayend") => { - //example input format : "2018-10-02" - try { - const parts = dateString.match(/(\d{4})-(\d{1,2})-(\d{1,2})/); - const DateObj = new Date(Date.UTC(parts[1], parts[2] - 1, parts[3])); - DateObj.setMinutes(DateObj.getMinutes() + DateObj.getTimezoneOffset()); - if (dayStartOrEnd === "dayend") { - DateObj.setHours(DateObj.getHours() + 24); - DateObj.setSeconds(DateObj.getSeconds() - 1); - } - if (dayStartOrEnd === "daystart") { - DateObj.setHours(DateObj.getHours()); - DateObj.setSeconds(DateObj.getSeconds() + 1); - } - return DateObj.getTime(); - } catch (e) { - return dateString; - } - }; - function onSubmit(_data) { - Digit.SessionStorage.set("AUDIT_APPLICATION_DETAIL", { - offset:0, - limit:10 - }); - let data = { - ..._data, - fromDate: convertDateToEpoch(_data?.fromDate, _data?.fromDate == _data?.toDate ? "daystart":""), - toDate: convertDateToEpoch(_data?.toDate, _data?.fromDate == _data?.toDate ? "dayend":""), - }; - - setPayload( - Object.keys(data) - .filter((k) => data[k]) - .reduce((acc, key) => ({ ...acc, [key]: typeof data[key] === "object" ? data[key] : data[key] }), {}) - ); - } - useEffect(() => { - const storedPayload = Digit.SessionStorage.get("AUDIT_APPLICATION_DETAIL") || {}; - if (storedPayload) { - const data = { - ...storedPayload, - }; - - setPayload( - Object.keys(data) - .filter((k) => data[k]) - .reduce((acc, key) => ({ ...acc, [key]: typeof data[key] === "object" ? data[key].code : data[key] }), {}) - ); - } - }, []); - const config = { - enabled: !!(payload && Object.keys(payload).length > 0), - }; - - let curoffset = window.location.href.split("/").pop(); - let previousoffset; - let currentoffset; - if (!isNaN(parseInt(curoffset))) { - currentoffset = curoffset; - previousoffset = parseInt(curoffset) + 10; - } else { - previousoffset = 10; - } - - const newObj = isMobile ? { ...payload, offset:!isNaN(parseInt(curoffset))? parseInt(currentoffset) : 0 } : { ...payload }; - - const { - isLoading, - data, -} = Digit.Hooks.useAudit({ - tenantId, - filters: { - ...newObj, - }, - config, - }); - - return ( - - !e.total)?.length > 0 - ? data?.ElasticSearchData?.filter((e)=> !e.total) - : { display: "ES_COMMON_NO_DATA" } - : "" - } - count={data?.ElasticSearchData?.filter((e)=> e.total)?.[0]?.total} - isLoading={isLoading} - /> - {isMobile && data?.ElasticSearchData?.filter((e)=> !e.total)?.length && data?.ElasticSearchData?.filter((e)=> !e.total)?.length !== 0 && ( -
-

- {{t("PT_LOAD_MORE_MSG")}} -

-
- )} -
- ); - }; - export default Search; \ No newline at end of file diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/citizen/StaticDynamicComponent/StaticDynamicCard.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/citizen/StaticDynamicComponent/StaticDynamicCard.js deleted file mode 100644 index 842ce2693..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/citizen/StaticDynamicComponent/StaticDynamicCard.js +++ /dev/null @@ -1,273 +0,0 @@ -import { - Card, - CaseIcon, - TimerIcon, - RupeeSymbol, - ValidityTimeIcon, - WhatsappIconGreen, - HelpLineIcon, - ServiceCenterIcon, - Loader, - PTIcon, - MCollectIcon, - ComplaintIcon, - BPAHomeIcon, - WSICon -} from "@egovernments/digit-ui-react-components"; -import React from "react"; -import { useTranslation } from "react-i18next"; - -const StaticDynamicCard = ({moduleCode}) => { - const { t } = useTranslation(); - const tenantId = Digit.ULBService.getCitizenCurrentTenant(); - const { isLoading: isMdmsLoading, data: mdmsData } = Digit.Hooks.useStaticData(Digit.ULBService.getStateId()); - const { isLoading: isSearchLoading, error, data: dynamicData, isSuccess } = Digit.Hooks.useDynamicData({ moduleCode, tenantId: tenantId , filters: {} , t}); - const isMobile = window.Digit.Utils.browser.isMobile(); - const handleClickOnWhatsApp = (obj) => { - window.open(obj); - }; - if(window.location.href.includes("tl") && window.Digit.SessionStorage.get("TL_CREATE_TRADE")) window.Digit.SessionStorage.set("TL_CREATE_TRADE",{}) - const IconComponent = ({module, styles}) => { - - switch(module){ - case 'TL': - return ; - case 'PT': - return ; - case 'MCOLLECT': - return ; - case 'PGR': - return - case 'WS': - return - case 'OBPS': - return - default: - return ; - } - } - const mdmsConfigResult = mdmsData?.MdmsRes["common-masters"]?.StaticData[0]?.[`${moduleCode}`]; - - const StaticDataIconComponentOne = ({module}) => { - - switch(module){ - case 'PT': - case 'WS': - return ( - - ) - default: - return null - } - }; - const StaticDataIconComponentTwo = ({module}) => { - - switch(module){ - case 'PT': - return ( - - ) - case 'WS': - return ( - - ) - default: - return null - } - } - const staticContent = (module) => { - switch(module){ - case 'TL': - return { - staticCommonContent: t("TL_VALIDITY"), - } - case 'MCOLLECT': - return { - staticCommonContent: t("CHALLAN_VALIDITY"), - } - case 'PGR': - return { - staticCommonContent: t("CATEGORIES_OF_COMPLAINT_TYPES_CAN_BE_SUBMITTED_ON_GRIEVANCE_PORTAL"), - } - case 'OBPS': - return { - staticCommonContent: t("BUILDING_PLAN_PERMIT_VALIDITY"), - validity: mdmsConfigResult?.validity + " " + (mdmsConfigResult?.validity === "1" ? t("COMMON_DAY") : t("COMMON_DAYS")) - } - default: - return { - staticCommonContent : "", - } - } - } - - const staticData = (module) => { - switch(module){ - case 'PT': - return { - staticDataOne : mdmsConfigResult?.staticDataOne + " " + t("COMMON_DAYS"), - staticDataOneHeader : t("APPLICATION_PROCESSING_TIME"), - staticDataTwo : mdmsConfigResult?.staticDataTwo, - staticDataTwoHeader : t("APPLICATION_PROCESSING_FEE"), - } - case 'WS': - return { - staticDataOne : "", - staticDataOneHeader : t("PAY_WATER_CHARGES_BY") + " "+ mdmsConfigResult?.staticDataOne + " "+ t("COMMON_DAYS") + " "+ t("OF_BILL_GEN_TO_AVOID_LATE_FEE"), - staticDataTwo : mdmsConfigResult?.staticDataTwo + " " + t("COMMON_DAYS"), - staticDataTwoHeader : t("APPLICATION_PROCESSING_TIME"), - } - default: - return {} - } - } - - if(isMdmsLoading || isSearchLoading){ - return - } - return mdmsConfigResult ? ( - - { mdmsConfigResult && mdmsConfigResult?.payViaWhatsApp ? - -
handleClickOnWhatsApp(mdmsConfigResult?.payViaWhatsApp)}> -
{t("PAY_VIA_WHATSAPP")}
-
- -
-
-
: null } - { mdmsConfigResult && mdmsConfigResult?.helpline ? - -
-
{t("CALL_CENTER_HELPLINE")}
-
- -
-
-
- { mdmsConfigResult?.helpline?.contactOne ? : null} - { mdmsConfigResult?.helpline?.contactTwo ? : null} -
-
: null - } - { mdmsConfigResult && mdmsConfigResult?.serviceCenter ? - -
-
{t("CITIZEN_SERVICE_CENTER")}
-
- -
-
-
-
- {mdmsConfigResult?.serviceCenter} -
-
- { mdmsConfigResult?.viewMapLocation ? : null} -
:
} - - { error || dynamicData == null || dynamicData?.dynamicDataOne === null ? ( -
- ) : ( -
-
- - - - {dynamicData?.dynamicDataOne} - -
-
) } - { error || dynamicData == null || dynamicData?.dynamicDataTwo === null ? ( -
- ) : ( -
-
- - - - {dynamicData?.dynamicDataTwo} - -
-
) } - { mdmsConfigResult && mdmsConfigResult?.staticDataOne - ?
-
- - - - {staticData(moduleCode)?.staticDataOneHeader} - - - {`${staticData(moduleCode)?.staticDataOne}`} - - -
-
:
} - { mdmsConfigResult && mdmsConfigResult?.staticDataTwo - ? -
-
- - - - {staticData(moduleCode)?.staticDataTwoHeader} - - - {staticData(moduleCode)?.staticDataTwo} - - -
-
:
} - { mdmsConfigResult && mdmsConfigResult?.validity - ?
-
- - - - - - {staticContent(moduleCode)?.staticCommonContent} - - - {staticContent(moduleCode)?.validity} - - -
-
:
} - { error || dynamicData == null || !dynamicData?.staticData || dynamicData?.staticData === null ? ( -
- ) : ( -
-
- { moduleCode === "PGR" - ? - - : - - } - - - {staticContent(moduleCode)?.staticCommonContent} - - - {dynamicData?.staticData} - - -
-
)} - - ) : -} - -export default StaticDynamicCard; \ No newline at end of file diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/citizen/index.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/citizen/index.js deleted file mode 100644 index b0186b61a..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/citizen/index.js +++ /dev/null @@ -1,231 +0,0 @@ -import { BackButton, WhatsappIcon, Card, CitizenHomeCard, CitizenInfoLabel, PrivateRoute } from "@egovernments/digit-ui-react-components"; -import React from "react"; -import { useTranslation } from "react-i18next"; -import { Route, Switch, useRouteMatch, useHistory, Link } from "react-router-dom"; -import ErrorBoundary from "../../components/ErrorBoundaries"; -import { AppHome, processLinkData } from "../../components/Home"; -import TopBarSideBar from "../../components/TopBarSideBar"; -import StaticCitizenSideBar from "../../components/TopBarSideBar/SideBar/StaticCitizenSideBar"; -import CitizenHome from "./Home"; -import LanguageSelection from "./Home/LanguageSelection"; -import LocationSelection from "./Home/LocationSelection"; -import Login from "./Login"; -import UserProfile from "./Home/UserProfile"; -import ErrorComponent from "../../components/ErrorComponent"; -import FAQsSection from "./FAQs/FAQs"; -import HowItWorks from "./HowItWorks/howItWorks"; -import StaticDynamicCard from "./StaticDynamicComponent/StaticDynamicCard"; -import AcknowledgementCF from "../../components/AcknowledgementCF"; -import CitizenFeedback from "../../components/CitizenFeedback"; -import Search from "./SearchApp"; -const sidebarHiddenFor = [ - "digit-ui/citizen/register/name", - "/digit-ui/citizen/select-language", - "/digit-ui/citizen/select-location", - "/digit-ui/citizen/login", - "/digit-ui/citizen/register/otp", -]; - -const getTenants = (codes, tenants) => { - return tenants.filter((tenant) => codes.map((item) => item.code).includes(tenant.code)); -}; - -const Home = ({ - stateInfo, - userDetails, - CITIZEN, - cityDetails, - mobileView, - handleUserDropdownSelection, - logoUrl, - DSO, - stateCode, - modules, - appTenants, - sourceUrl, - pathname, - initData, -}) => { - const { isLoading: islinkDataLoading, data: linkData, isFetched: isLinkDataFetched } = Digit.Hooks.useCustomMDMS( - Digit.ULBService.getStateId(), - "ACCESSCONTROL-ACTIONS-TEST", - [ - { - name: "actions-test", - filter: "[?(@.url == 'digit-ui-card')]", - }, - ], - { - select: (data) => { - const formattedData = data?.["ACCESSCONTROL-ACTIONS-TEST"]?.["actions-test"] - ?.filter((el) => el.enabled === true) - .reduce((a, b) => { - a[b.parentModule] = a[b.parentModule]?.length > 0 ? [b, ...a[b.parentModule]] : [b]; - return a; - }, {}); - return formattedData; - }, - } - ); - - const classname = Digit.Hooks.fsm.useRouteSubscription(pathname); - const { t } = useTranslation(); - const { path } = useRouteMatch(); - const history = useHistory(); - const handleClickOnWhatsApp = (obj) => { - window.open(obj); - }; - - const hideSidebar = sidebarHiddenFor.some((e) => window.location.href.includes(e)); - const appRoutes = modules.map(({ code, tenants }, index) => { - const Module = Digit.ComponentRegistryService.getComponent(`${code}Module`); - return Module ? ( - - - - ) : null; - }); - - const ModuleLevelLinkHomePages = modules.map(({ code, bannerImage }, index) => { - let Links = Digit.ComponentRegistryService.getComponent(`${code}Links`) || (() => ); - let mdmsDataObj = isLinkDataFetched ? processLinkData(linkData, code, t) : undefined; - - //if (mdmsDataObj?.header === "ACTION_TEST_WS") { - mdmsDataObj?.links && mdmsDataObj?.links.sort((a, b) => { - return a.orderNumber - b.orderNumber; - }); - // } - return ( - - -
- noimagefound - -

{t("MODULE_" + code.toUpperCase())}

-
- {mdmsDataObj && ( - } - Info={ - code === "OBPS" - ? () => ( - - ) - : null - } - isInfo={code === "OBPS" ? true : false} - /> - )} - {/* */} -
- -
-
- - - - - - -
- ); - }); - - return ( -
- - -
- {hideSidebar ? null : ( -
- -
- )} - - - - - - - - - - - - - - - - - - { - history.push("/digit-ui/citizen"); - }} - /> - - - - - - - - - - - - - - - - - - - - - - {appRoutes} - {ModuleLevelLinkHomePages} - - -
-
- Powered by DIGIT { - window.open(window?.globalConfigs?.getConfig?.("DIGIT_HOME_URL"), "_blank").focus(); - }} - /> -
-
- ); -}; - -export default Home; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/employee/ChangePassword/changePassword.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/employee/ChangePassword/changePassword.js deleted file mode 100644 index ba9aa25e6..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/employee/ChangePassword/changePassword.js +++ /dev/null @@ -1,167 +0,0 @@ -import { BackButton, CardSubHeader, CardText, FormComposer, Toast } from "@egovernments/digit-ui-react-components"; -import PropTypes from "prop-types"; -import React, { useEffect, useState } from "react"; -import { useHistory } from "react-router-dom"; -import Background from "../../../components/Background"; -import Header from "../../../components/Header"; -import SelectOtp from "../../citizen/Login/SelectOtp"; - -const ChangePasswordComponent = ({ config: propsConfig, t }) => { - const [user, setUser] = useState(null); - const { mobile_number: mobileNumber, tenantId } = Digit.Hooks.useQueryParams(); - const history = useHistory(); - const [otp, setOtp] = useState(""); - const [isOtpValid, setIsOtpValid] = useState(true); - const [showToast, setShowToast] = useState(null); - const getUserType = () => Digit.UserService.getType(); - useEffect(() => { - if (!user) { - Digit.UserService.setType("employee"); - return; - } - Digit.UserService.setUser(user); - const redirectPath = location.state?.from || "/mgramseva-digit-ui/employee"; - history.replace(redirectPath); - }, [user]); - - const closeToast = () => { - setShowToast(null); - }; - - const onResendOTP = async () => { - const requestData = { - otp: { - mobileNumber, - userType: getUserType().toUpperCase(), - type: "passwordreset", - tenantId, - }, - }; - - try { - await Digit.UserService.sendOtp(requestData, tenantId); - setShowToast(t("ES_OTP_RESEND")); - } catch (err) { - setShowToast(err?.response?.data?.error_description || t("ES_INVALID_LOGIN_CREDENTIALS")); - } - setTimeout(closeToast, 5000); - }; - - const onChangePassword = async (data) => { - try { - if (data.newPassword !== data.confirmPassword) { - return setShowToast(t("ERR_PASSWORD_DO_NOT_MATCH")); - } - const requestData = { - ...data, - otpReference: otp, - tenantId, - type: getUserType().toUpperCase(), - }; - - const response = await Digit.UserService.changePassword(requestData, tenantId); - navigateToLogin(); - } catch (err) { - setShowToast(err?.response?.data?.error?.fields?.[0]?.message || t("ES_SOMETHING_WRONG")); - setTimeout(closeToast, 5000); - } - }; - - const navigateToLogin = () => { - history.replace("/mgramseva-digit-ui/employee/user/login"); - }; - - const [username, password, confirmPassword] = propsConfig.inputs; - const config = [ - { - body: [ - { - label: t(username.label), - type: username.type, - populators: { - name: username.name, - }, - isMandatory: true, - }, - { - label: t(password.label), - type: password.type, - populators: { - name: password.name, - }, - isMandatory: true, - }, - { - label: t(confirmPassword.label), - type: confirmPassword.type, - populators: { - name: confirmPassword.name, - }, - isMandatory: true, - }, - ], - }, - ]; - - return ( - -
- -
- -
- {propsConfig.texts.header} - - {`${t(`CS_LOGIN_OTP_TEXT`)} `} - - {" "} - {`${t(`+ 91 - `)}`} {mobileNumber} - - - - {/*
- {t("CORE_OTP_SENT_MESSAGE")} - {mobileNumber} - {t("CORE_EMPLOYEE_OTP_CHECK_MESSAGE")} -
- {t("CORE_OTP_OTP")} * - -
-
- {t("CORE_OTP_RESEND")} -
-
*/} - - {showToast && } -
- Powered by DIGIT { - window.open(window?.globalConfigs?.getConfig?.("DIGIT_HOME_URL"), "_blank").focus(); - }} - />{" "} -
- - ); -}; - -ChangePasswordComponent.propTypes = { - loginParams: PropTypes.any, -}; - -ChangePasswordComponent.defaultProps = { - loginParams: null, -}; - -export default ChangePasswordComponent; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/employee/ChangePassword/config.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/employee/ChangePassword/config.js deleted file mode 100644 index 487112dfd..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/employee/ChangePassword/config.js +++ /dev/null @@ -1,28 +0,0 @@ -export const config = [ - { - texts: { - header: "CORE_COMMON_RESET_PASSWORD_LABEL", - submitButtonLabel: "CORE_COMMON_CHANGE_PASSWORD", - }, - inputs: [ - { - label: "CORE_LOGIN_USERNAME", - type: "text", - name: "userName", - error: "ERR_HRMS_INVALID_USERNAME", - }, - { - label: "CORE_LOGIN_NEW_PASSWORD", - type: "password", - name: "newPassword", - error: "CORE_COMMON_REQUIRED_ERRMSG", - }, - { - label: "CORE_LOGIN_CONFIRM_NEW_PASSWORD", - type: "password", - name: "confirmPassword", - error: "CORE_COMMON_REQUIRED_ERRMSG", - }, - ], - }, -]; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/employee/ChangePassword/index.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/employee/ChangePassword/index.js deleted file mode 100644 index b6481305a..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/employee/ChangePassword/index.js +++ /dev/null @@ -1,34 +0,0 @@ -import React, { useMemo } from "react"; -import { useTranslation } from "react-i18next"; -import { AppContainer } from "@egovernments/digit-ui-react-components"; -import { Route, Switch, useRouteMatch } from "react-router-dom"; -import { config } from "./config"; -import ChangePasswordComponent from "./changePassword"; - -const EmployeeChangePassword = () => { - const { t } = useTranslation(); - const { path } = useRouteMatch(); - - const params = useMemo(() => - config.map( - (step) => { - const texts = {}; - for (const key in step.texts) { - texts[key] = t(step.texts[key]); - } - return { ...step, texts }; - }, - [config] - ) - ); - - return ( - - - - - - ); -}; - -export default EmployeeChangePassword; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/employee/ForgotPassword/config.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/employee/ForgotPassword/config.js deleted file mode 100644 index 237f5c8e5..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/employee/ForgotPassword/config.js +++ /dev/null @@ -1,23 +0,0 @@ -export const loginConfig = [ - { - texts: { - header: "CORE_COMMON_FORGOT_PASSWORD_LABEL", - description: "ES_FORGOT_PASSWORD_DESC", - submitButtonLabel: "CORE_COMMON_CONTINUE", - }, - inputs: [ - { - label: "CORE_COMMON_MOBILE_NUMBER", - type: "text", - name: "mobileNumber", - error: "ERR_HRMS_INVALID_MOBILE_NUMBER", - }, - { - label: "CORE_COMMON_CITY", - type: "custom", - name: "city", - error: "ERR_HRMS_INVALID_CITY", - }, - ], - }, -]; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/employee/ForgotPassword/forgotPassword.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/employee/ForgotPassword/forgotPassword.js deleted file mode 100644 index cb7e86494..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/employee/ForgotPassword/forgotPassword.js +++ /dev/null @@ -1,142 +0,0 @@ -import { BackButton, Dropdown, FormComposer, Loader, Toast } from "@egovernments/digit-ui-react-components"; -import PropTypes from "prop-types"; -import React, { useEffect, useState } from "react"; -import { useHistory } from "react-router-dom"; -import Background from "../../../components/Background"; -import Header from "../../../components/Header"; - -const ForgotPassword = ({ config: propsConfig, t }) => { - const { data: cities, isLoading } = Digit.Hooks.useTenants(); - const [user, setUser] = useState(null); - const history = useHistory(); - const [showToast, setShowToast] = useState(null); - const getUserType = () => Digit.UserService.getType(); - - useEffect(() => { - if (!user) { - Digit.UserService.setType("employee"); - return; - } - Digit.UserService.setUser(user); - const redirectPath = location.state?.from || "/mgramseva-digit-ui/employee"; - history.replace(redirectPath); - }, [user]); - - const closeToast = () => { - setShowToast(null); - }; - - const onForgotPassword = async (data) => { - if (!data.city) { - alert("Please Select City!"); - return; - } - const requestData = { - otp: { - mobileNumber: data.mobileNumber, - userType: getUserType().toUpperCase(), - type: "passwordreset", - tenantId: data.city.code, - }, - }; - try { - await Digit.UserService.sendOtp(requestData, data.city.code); - history.push(`/mgramseva-digit-ui/employee/user/change-password?mobile_number=${data.mobileNumber}&tenantId=${data.city.code}`); - } catch (err) { - setShowToast(err?.response?.data?.error?.fields?.[0]?.message || "Invalid login credentials!"); - setTimeout(closeToast, 5000); - } - }; - - const navigateToLogin = () => { - history.replace("/mgramseva-digit-ui/employee/login"); - }; - - const [userId, city] = propsConfig.inputs; - const config = [ - { - body: [ - { - label: t(userId.label), - type: userId.type, - populators: { - name: userId.name, - componentInFront: "+91", - }, - isMandatory: true, - }, - { - label: t(city.label), - type: city.type, - populators: { - name: city.name, - customProps: {}, - component: (props, customProps) => ( - { - props.onChange(d); - }} - {...customProps} - /> - ), - }, - isMandatory: true, - }, - ], - }, - ]; - - if (isLoading) { - return ; - } - - return ( - -
- -
- -
- - {showToast && } -
- Powered by DIGIT { - window.open(window?.globalConfigs?.getConfig?.("DIGIT_HOME_URL"), "_blank").focus(); - }} - />{" "} -
- - ); -}; - -ForgotPassword.propTypes = { - loginParams: PropTypes.any, -}; - -ForgotPassword.defaultProps = { - loginParams: null, -}; - -export default ForgotPassword; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/employee/ForgotPassword/index.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/employee/ForgotPassword/index.js deleted file mode 100644 index 3b4334e64..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/employee/ForgotPassword/index.js +++ /dev/null @@ -1,34 +0,0 @@ -import React, { useMemo } from "react"; -import { useTranslation } from "react-i18next"; -import { AppContainer } from "@egovernments/digit-ui-react-components"; -import { Route, Switch, useRouteMatch } from "react-router-dom"; -import { loginConfig } from "./config"; -import ForgotPasswordComponent from "./forgotPassword"; - -const EmployeeForgotPassword = () => { - const { t } = useTranslation(); - const { path } = useRouteMatch(); - - const params = useMemo(() => - loginConfig.map( - (step) => { - const texts = {}; - for (const key in step.texts) { - texts[key] = t(step.texts[key]); - } - return { ...step, texts }; - }, - [loginConfig] - ) - ); - - return ( - - - - - - ); -}; - -export default EmployeeForgotPassword; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/employee/LanguageSelection/index.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/employee/LanguageSelection/index.js deleted file mode 100644 index 56b5d8fad..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/employee/LanguageSelection/index.js +++ /dev/null @@ -1,60 +0,0 @@ -import { Card, CustomButton, SubmitBar } from "@egovernments/digit-ui-react-components"; -import React, { useState } from "react"; -import { useTranslation } from "react-i18next"; -import { useHistory } from "react-router-dom"; -import Background from "../../../components/Background"; - -const LanguageSelection = () => { - const { data: storeData, isLoading } = Digit.Hooks.useStore.getInitData(); - const { t } = useTranslation(); - const history = useHistory(); - const { languages, stateInfo } = storeData || {}; - const selectedLanguage = Digit.StoreData.getCurrentLanguage(); - const [selected, setselected] = useState(selectedLanguage); - const handleChangeLanguage = (language) => { - setselected(language.value); - Digit.LocalizationService.changeLanguage(language.value, stateInfo.code); - }; - - const handleSubmit = (event) => { - history.push("/mgramseva-digit-ui/employee/user/login"); - }; - - if (isLoading) return null; - - return ( - - -
- Digit - -

{t(`TENANT_TENANTS_${stateInfo?.code.toUpperCase()}`)}

-
-
- {languages.map((language, index) => ( -
- handleChangeLanguage(language)} - > -
- ))} -
- -
-
- Powered by DIGIT { - window.open(window?.globalConfigs?.getConfig?.("DIGIT_HOME_URL"), "_blank").focus(); - }} - />{" "} -
-
- ); -}; - -export default LanguageSelection; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/employee/Login/config.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/employee/Login/config.js deleted file mode 100644 index 9601dc5ed..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/employee/Login/config.js +++ /dev/null @@ -1,29 +0,0 @@ -export const loginConfig = [ - { - texts: { - header: "CORE_COMMON_LOGIN", - submitButtonLabel: "CORE_COMMON_CONTINUE", - secondaryButtonLabel: "CORE_COMMON_FORGOT_PASSWORD", - }, - inputs: [ - { - label: "CORE_LOGIN_USERNAME", - type: "text", - name: "username", - error: "ERR_HRMS_INVALID_USER_ID", - }, - { - label: "CORE_LOGIN_PASSWORD", - type: "password", - name: "password", - error: "ERR_HRMS_WRONG_PASSWORD", - }, - { - label: "CORE_COMMON_CITY", - type: "custom", - name: "city", - error: "ERR_HRMS_INVALID_CITY", - }, - ], - }, -]; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/employee/Login/index.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/employee/Login/index.js deleted file mode 100644 index 5f4c93f5f..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/employee/Login/index.js +++ /dev/null @@ -1,34 +0,0 @@ -import React, { useMemo } from "react"; -import { useTranslation } from "react-i18next"; -import { AppContainer } from "@egovernments/digit-ui-react-components"; -import { Route, Switch, useRouteMatch } from "react-router-dom"; -import { loginConfig } from "./config"; -import LoginComponent from "./login"; - -const EmployeeLogin = () => { - const { t } = useTranslation(); - const { path } = useRouteMatch(); - - const loginParams = useMemo(() => - loginConfig.map( - (step) => { - const texts = {}; - for (const key in step.texts) { - texts[key] = t(step.texts[key]); - } - return { ...step, texts }; - }, - [loginConfig] - ) - ); - - return ( - - - - - - ); -}; - -export default EmployeeLogin; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/employee/Login/login.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/employee/Login/login.js deleted file mode 100644 index 4a410d179..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/employee/Login/login.js +++ /dev/null @@ -1,188 +0,0 @@ -import { BackButton, Dropdown, FormComposer, Loader, Toast } from "@egovernments/digit-ui-react-components"; -import PropTypes from "prop-types"; -import React, { useEffect, useState } from "react"; -import { useHistory } from "react-router-dom"; -import Background from "../../../components/Background"; -import Header from "../../../components/Header"; - -/* set employee details to enable backward compatiable */ -const setEmployeeDetail = (userObject, token) => { - let locale = JSON.parse(sessionStorage.getItem("Digit.locale"))?.value || "en_IN"; - localStorage.setItem("Employee.tenant-id", userObject?.tenantId); - localStorage.setItem("tenant-id", userObject?.tenantId); - localStorage.setItem("citizen.userRequestObject", JSON.stringify(userObject)); - localStorage.setItem("locale", locale); - localStorage.setItem("Employee.locale", locale); - localStorage.setItem("token", token); - localStorage.setItem("Employee.token", token); - localStorage.setItem("user-info", JSON.stringify(userObject)); - localStorage.setItem("Employee.user-info", JSON.stringify(userObject)); -}; - -const Login = ({ config: propsConfig, t, isDisabled }) => { - const { data: cities, isLoading } = Digit.Hooks.useTenants(); - const { data: storeData, isLoading: isStoreLoading } = Digit.Hooks.useStore.getInitData(); - const { stateInfo } = storeData || {}; - const [user, setUser] = useState(null); - const [showToast, setShowToast] = useState(null); - const [disable, setDisable] = useState(false); - - const history = useHistory(); - // const getUserType = () => "EMPLOYEE" || Digit.UserService.getType(); - - useEffect(() => { - if (!user) { - return; - } - Digit.SessionStorage.set("citizen.userRequestObject", user); - const filteredRoles = user?.info?.roles?.filter((role) => role.tenantId === Digit.SessionStorage.get("Employee.tenantId")); - if (user?.info?.roles?.length > 0) user.info.roles = filteredRoles; - Digit.UserService.setUser(user); - setEmployeeDetail(user?.info, user?.access_token); - let redirectPath = "/mgramseva-digit-ui/employee"; - - /* logic to redirect back to same screen where we left off */ - if (window?.location?.href?.includes("from=")) { - redirectPath = decodeURIComponent(window?.location?.href?.split("from=")?.[1]) || "/mgramseva-digit-ui/employee"; - } - - /* RAIN-6489 Logic to navigate to National DSS home incase user has only one role [NATADMIN]*/ - if (user?.info?.roles && user?.info?.roles?.length > 0 && user?.info?.roles?.every((e) => e.code === "NATADMIN")) { - redirectPath = "/mgramseva-digit-ui/employee/dss/landing/NURT_DASHBOARD"; - } - /* RAIN-6489 Logic to navigate to National DSS home incase user has only one role [NATADMIN]*/ - if (user?.info?.roles && user?.info?.roles?.length > 0 && user?.info?.roles?.every((e) => e.code === "STADMIN")) { - redirectPath = "/mgramseva-digit-ui/employee/dss/landing/home"; - } - - history.replace(redirectPath); - }, [user]); - - const onLogin = async (data) => { - if (!data.city) { - alert("Please Select City!"); - return; - } - setDisable(true); - - const requestData = { - ...data, - userType: "EMPLOYEE", - }; - requestData.tenantId = data.city.code; - delete requestData.city; - try { - const { UserRequest: info, ...tokens } = await Digit.UserService.authenticate(requestData); - Digit.SessionStorage.set("Employee.tenantId", info?.tenantId); - setUser({ info, ...tokens }); - } catch (err) { - setShowToast(err?.response?.data?.error_description || "Invalid login credentials!"); - setTimeout(closeToast, 5000); - } - setDisable(false); - }; - - const closeToast = () => { - setShowToast(null); - }; - - const onForgotPassword = () => { - sessionStorage.getItem("User") && sessionStorage.removeItem("User"); - history.push("/mgramseva-digit-ui/employee/user/forgot-password"); - }; - - const [userId, password, city] = propsConfig.inputs; - const config = [ - { - body: [ - { - label: t(userId.label), - type: userId.type, - populators: { - name: userId.name, - }, - isMandatory: true, - }, - { - label: t(password.label), - type: password.type, - populators: { - name: password.name, - }, - isMandatory: true, - }, - { - label: t(city.label), - type: city.type, - populators: { - name: city.name, - customProps: {}, - component: (props, customProps) => ( - { - props.onChange(d); - }} - t={t} - {...customProps} - /> - ), - }, - isMandatory: true, - }, - ], - }, - ]; - - return isLoading || isStoreLoading ? ( - - ) : ( - -
- -
- - -
- - {showToast && } -
- Powered by DIGIT { - window.open(window?.globalConfigs?.getConfig?.("DIGIT_HOME_URL"), "_blank").focus(); - }} - />{" "} -
- - ); -}; - -Login.propTypes = { - loginParams: PropTypes.any, -}; - -Login.defaultProps = { - loginParams: null, -}; - -export default Login; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/employee/chpassword.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/employee/chpassword.js deleted file mode 100644 index 77a775c92..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/employee/chpassword.js +++ /dev/null @@ -1,11 +0,0 @@ -import React from 'react' - -function chpassword() { - return ( -
- -
- ) -} - -export default chpassword \ No newline at end of file diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/employee/index.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/employee/index.js deleted file mode 100644 index b26332c20..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/employee/index.js +++ /dev/null @@ -1,136 +0,0 @@ -import React, { useEffect } from "react"; -import { useTranslation } from "react-i18next"; -import { Redirect, Route, Switch, useLocation, useRouteMatch, useHistory } from "react-router-dom"; -import { AppModules } from "../../components/AppModules"; -import ErrorBoundary from "../../components/ErrorBoundaries"; -import TopBarSideBar from "../../components/TopBarSideBar"; -import ChangePassword from "./ChangePassword"; -import ForgotPassword from "./ForgotPassword"; -import LanguageSelection from "./LanguageSelection"; -import EmployeeLogin from "./Login"; -import UserProfile from "../citizen/Home/UserProfile"; -import ErrorComponent from "../../components/ErrorComponent"; - -const userScreensExempted = ["user/profile", "user/error"]; - -const EmployeeApp = ({ - stateInfo, - userDetails, - CITIZEN, - cityDetails, - mobileView, - handleUserDropdownSelection, - logoUrl, - DSO, - stateCode, - modules, - appTenants, - sourceUrl, - pathname, - initData, -}) => { - const history = useHistory(); - const { t } = useTranslation(); - const { path } = useRouteMatch(); - const location = useLocation(); - const showLanguageChange = location?.pathname?.includes("language-selection"); - const isUserProfile = userScreensExempted.some((url) => location?.pathname?.includes(url)); - useEffect(() => { - Digit.UserService.setType("employee"); - }, []); - - return ( -
- - - {isUserProfile && ( - - )} -
- - - - - - - - - - - - - - - { - history.push("/mgramseva-digit-ui/employee"); - }} - /> - - - - - - - - -
-
- - -
-
- - - -
-
- Powered by DIGIT { - window.open(window?.globalConfigs?.getConfig?.("DIGIT_HOME_URL"), "_blank").focus(); - }} - /> -
-
-
- - - -
-
- ); -}; - -export default EmployeeApp; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/redux/reducers/index.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/redux/reducers/index.js deleted file mode 100644 index 11591c2b2..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/redux/reducers/index.js +++ /dev/null @@ -1,8 +0,0 @@ -export const commonReducer = (defaultData) => (state = defaultData, action) => { - switch (action.type) { - case "LANGUAGE_SELECT": - return { ...state, selectedLanguage: action.payload }; - default: - return state; - } -}; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/redux/store.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/redux/store.js deleted file mode 100644 index 3d2f22ee0..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/redux/store.js +++ /dev/null @@ -1,24 +0,0 @@ -import { createStore, combineReducers, compose, applyMiddleware } from "redux"; -import thunk from "redux-thunk"; -import { commonReducer } from "./reducers"; - -const getRootReducer = (defaultStore, moduleReducers) => - combineReducers({ - common: commonReducer(defaultStore), - ...moduleReducers, - }); - -const middleware = [thunk]; - -const composeEnhancers = - typeof window === "object" && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ ? window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({}) : compose; - -const enhancer = composeEnhancers( - applyMiddleware(...middleware) - // other store enhancers if any -); - -const getStore = (defaultStore, moduleReducers = {}) => { - return createStore(getRootReducer(defaultStore, moduleReducers), enhancer); -}; -export default getStore; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/package.json b/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/package.json deleted file mode 100644 index ddf699fab..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/package.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "name": "@egovernments/digit-ui-module-dss", - "version": "1.7.0-beta.1", - "license": "MIT", - "description": "Digit Dashboard Module", - "main": "dist/index.js", - "module": "dist/index.modern.js", - "source": "src/Module.js", - "files": [ - "dist" - ], - "scripts": { - "start": "microbundle-crl watch --no-compress --format modern,cjs", - "build": "microbundle-crl --compress --no-sourcemap --format cjs", - "prepublish": "yarn build" - }, - "peerDependencies": { - "react": "17.0.2", - "react-router-dom": "5.3.0" - }, - "dependencies": { - "@egovernments/digit-ui-react-components": "^1.7.0-beta.1", - "react": "17.0.2", - "react-date-range": "1.3.0", - "react-dom": "17.0.2", - "react-hook-form": "6.15.8", - "react-i18next": "11.16.2", - "react-query": "3.6.1", - "react-router-dom": "5.3.0", - "react-time-picker": "4.2.1", - "recharts": "^2.0.9", - "react-simple-maps": "2.0.0", - "react-tooltip": "4.1.2", - "react-inlinesvg": "1.1.7", - "lodash": "4.17.21" - } -} diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/Module.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/Module.js deleted file mode 100644 index 1328c36f5..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/Module.js +++ /dev/null @@ -1,108 +0,0 @@ -import React, { Fragment } from "react"; -import { useTranslation } from "react-i18next"; -// import { useRouteMatch } from "react-router"; -import { BackButton, Loader, PrivateRoute, BreadCrumb } from "@egovernments/digit-ui-react-components"; -import DashBoard from "./pages"; -import Home from "./pages/Home"; -import { Route, Switch, useRouteMatch, useLocation } from "react-router-dom"; -import Overview from "./pages/Overview"; -import { checkCurrentScreen, DSSCard, NDSSCard } from "./components/DSSCard"; -import DrillDown from "./pages/DrillDown"; -import FAQsSection from "./pages/FAQs/FAQs"; -import About from "./pages/About"; -const DssBreadCrumb = ({ location }) => { - const { t } = useTranslation(); - const { fromModule = false, title } = Digit.Hooks.useQueryParams(); - const moduleName = Digit.Utils.dss.getCurrentModuleName(); - - const crumbs = [ - { - path: "/mgramseva-digit-ui/employee", - content: t("ES_COMMON_HOME"), - show: true, - }, - { - path: - checkCurrentScreen() || window.location.href.includes("NURT_DASHBOARD") - ? "/mgramseva-digit-ui/employee/dss/landing/NURT_DASHBOARD" - : "/mgramseva-digit-ui/employee/dss/landing/home", - content: t("ES_LANDING_PAGE"), - show: true, - }, - { - path: fromModule - ? `/mgramseva-digit-ui/employee/dss/dashboard/${fromModule}` - : `/mgramseva-digit-ui/employee/dss/dashboard/${Digit.Utils.dss.getCurrentModuleName()}`, - content: t(`ES_COMMON_DSS_${Digit.Utils.locale.getTransformedLocale(fromModule ? fromModule : moduleName)}`), - show: location.pathname.includes("dashboard") ? true : false, - }, - { - path: "/mgramseva-digit-ui/employee/dss/drilldown", - content: location.pathname.includes("drilldown") ? t(title) : t("ES_COMMON_DSS_DRILL"), - show: location.pathname.includes("drilldown") ? true : false, - }, - { - path: "/mgramseva-digit-ui/employee/dss/national-faqs", - content: t("ES_COMMON_DSS_FAQS"), - show: location.pathname.includes("national-faqs") ? true : false, - }, - { - path: "/mgramseva-digit-ui/employee/dss/national-about", - content: t("ES_COMMON_DSS_ABOUT"), - show: location.pathname.includes("national-about") ? true : false, - }, - ]; - - return ele.show)} />; -}; - -const Routes = ({ path, stateCode }) => { - const location = useLocation(); - const isMobile = window.Digit.Utils.browser.isMobile(); - return ( -
- - - } /> - } /> - } /> - - - - - - - -
- ); -}; - -const DSSModule = ({ stateCode, userType, tenants }) => { - const moduleCode = "DSS"; - // const { path, url } = useRouteMatch(); - const { path, url } = useRouteMatch(); - const language = Digit.StoreData.getCurrentLanguage(); - const { isLoading, data: store } = Digit.Services.useStore({ stateCode, moduleCode, language }); - - if (isLoading) { - return ; - } - - Digit.SessionStorage.set("DSS_TENANTS", tenants); - - if (userType !== "citizen") { - return ; - } -}; - -const componentsToRegister = { - DSSModule, - DSSCard, - NDSSCard, -}; - -export const initDSSComponents = () => { - Object.entries(componentsToRegister).forEach(([key, value]) => { - Digit.ComponentRegistryService.setComponent(key, value); - }); -}; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/components/ArrowDownward.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/components/ArrowDownward.js deleted file mode 100644 index 00994098a..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/components/ArrowDownward.js +++ /dev/null @@ -1,14 +0,0 @@ -import React from "react"; -import {ReactComponent as Arrow_Downward} from "../images/Arrow_Downward.svg" - -export function ArrowDownwardElement(marginRight, marginLeft) -{ - return -}; \ No newline at end of file diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/components/ArrowUpward.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/components/ArrowUpward.js deleted file mode 100644 index 8f26393b8..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/components/ArrowUpward.js +++ /dev/null @@ -1,14 +0,0 @@ -import React from "react"; -import {ReactComponent as Arrow_Upward} from "../images/Arrow_Upward.svg"; - -export function ArrowUpwardElement(marginRight, marginLeft) -{ - return -}; \ No newline at end of file diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/components/CustomAreaChart.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/components/CustomAreaChart.js deleted file mode 100644 index 396893406..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/components/CustomAreaChart.js +++ /dev/null @@ -1,356 +0,0 @@ -import { Loader } from "@egovernments/digit-ui-react-components"; -import { getDaysInMonth } from "date-fns"; -import React, { useContext, useEffect, useMemo, useState } from "react"; -import { useTranslation } from "react-i18next"; -import { Area, AreaChart, CartesianGrid, Legend, Line, LineChart, ResponsiveContainer, Tooltip, XAxis, YAxis } from "recharts"; -import FilterContext from "./FilterContext"; -import NoData from "./NoData"; -const COLORS = ["#048BD0", "#FBC02D", "#8E29BF", "#EA8A3B", "#0BABDE", "#6E8459", "#D4351C", "#0CF7E4", "#F80BF4", "#22F80B"]; -const increasedHeightCharts = [ - "nssOBPSTotalPermitsVsTotalOCSubmittedVsTotalOCIssued", - "nssNOCApplicationVsProvisionalVsActual", - "nocApplicationVsProvisionalVsActual", - "permitsandOCissued", -]; -const getColors = (index = 0) => { - index = COLORS.length > index ? index : 0; - return COLORS[index]; -}; - -const getDenominatedValue = (denomination, plotValue) => { - switch (denomination) { - case "Unit": - return plotValue; - case "Lac": - return Number((plotValue / 100000).toFixed(2)); - case "Cr": - return Number((plotValue / 10000000).toFixed(2)); - default: - return ""; - } -}; - -const getValue = (plot) => plot.value; - -const renderUnits = (t, denomination, symbol) => { - if (symbol == "percentage") { - return " %"; - } else if (symbol == "number") { - return ""; - } - switch (denomination) { - case "Unit": - return `(${t("DSS_UNIT")})`; - case "Lac": - return `(${t("DSS_LAC")})`; - case "Cr": - return `(${t("DSS_CR")})`; - default: - return null; - } -}; - -const CustomAreaChart = ({ xDataKey = "name", yDataKey = getValue, data, setChartDenomination, moduleCode }) => { - const lineLegend = { - margin: "10px", - }; - const { t } = useTranslation(); - const { id } = data; - const tenantId = Digit.ULBService.getCurrentTenantId(); - const { value } = useContext(FilterContext); - const [totalCapacity, setTotalCapacity] = useState(0); - const [totalWaste, setTotalWaste] = useState(0); - const [keysArr, setKeysArr] = useState([]); - - const [manageChart, setmanageChart] = useState("Area"); - const stateTenant = Digit.ULBService.getStateId(); - const { isMdmsLoading, data: mdmsData } = Digit.Hooks.useCommonMDMS(stateTenant, "FSM", "FSTPPlantInfo", { - enabled: id === "fsmCapacityUtilization", - }); - const { isLoading, data: response } = Digit.Hooks.dss.useGetChart({ - key: id, - type: "metric", - tenantId, - requestDate: { ...value?.requestDate, startDate: value?.range?.startDate?.getTime(), endDate: value?.range?.endDate?.getTime() }, - filters: value?.filters, - moduleLevel: value?.moduleLevel || moduleCode, - }); - - useEffect(() => { - if (mdmsData) { - let fstpPlants = mdmsData; - if (value?.filters?.tenantId?.length > 0) { - fstpPlants = mdmsData.filter((plant) => value?.filters?.tenantId?.some((tenant) => plant?.ULBS.includes(tenant))); - } - const totalCapacity = fstpPlants.reduce((acc, plant) => acc + Number(plant?.PlantOperationalCapacityKLD), 0); - setTotalCapacity(totalCapacity); - } - }, [mdmsData, value]); - - useEffect(() => { - if (response) { - const totalWaste = Digit.Utils.dss.formatter( - Math.round(response?.responseData?.data?.[0]?.plots[response?.responseData?.data?.[0]?.plots.length - 1]?.value), - "number", - value?.denomination, - true, - t - ); - setTotalWaste(totalWaste); - setChartDenomination(response?.responseData?.data?.[0]?.headerSymbol); - } - }, [response]); - - const chartData = useMemo(() => { - if (response?.responseData?.data?.length == 1) { - setmanageChart("Area"); - if (id !== "fsmCapacityUtilization") { - return response?.responseData?.data?.[0]?.plots; - } - return response?.responseData?.data?.[0]?.plots.map((plot) => { - const [month, year] = plot?.name.split("-"); - const totalDays = getDaysInMonth(Date.parse(`${month} 1, ${year}`)); - const value = Math.round((plot?.value / (totalCapacity * totalDays)) * 100); - return { ...plot, value }; - }); - } else if (response?.responseData?.data?.length > 1) { - setmanageChart("Line"); - let keys = {}; - const mergeObj = response?.responseData?.data?.[0]?.plots.map((x, index) => { - let newObj = {}; - response?.responseData?.data.map((ob) => { - keys[t(Digit.Utils.locale.getTransformedLocale(ob.headerName))] = t(Digit.Utils.locale.getTransformedLocale(ob.headerName)); - newObj[t(Digit.Utils.locale.getTransformedLocale(ob.headerName))] = ob?.plots[index].value; - }); - return { - label: null, - name: response?.responseData?.data?.[0]?.plots[index].name, - strValue: null, - symbol: response?.responseData?.data?.[0]?.plots[index].symbol, - ...newObj, - }; - }); - setKeysArr(Object.values(keys)); - return mergeObj; - } - }, [response, totalCapacity]); - - const renderPlot = (plot, key) => { - const plotValue = key ? plot?.[key] : plot?.value || 0; - if (id === "fsmCapacityUtilization") { - return Number(plotValue.toFixed(1)); - } - if (plot?.symbol?.toLowerCase() === "amount") { - const { denomination } = value; - return getDenominatedValue(denomination, plotValue); - } else if (plot?.symbol?.toLowerCase() === "number") { - return Number(plotValue.toFixed(1)); - } else { - return plotValue; - } - }; - - const renderLegend = () => {t(`DSS_${Digit.Utils.locale.getTransformedLocale(id)}`)}; - - const renderLegendForLine = (ss, sss, index) => {keysArr?.[index]}; - - const tickFormatter = (value) => { - if (typeof value === "string") { - return value.replace("-", ", "); - } - return value; - }; - const yAxistickFormatter = (value) => { - if (typeof value === "string") { - return value.replace("-", ", "); - } else if (typeof value === "number") return Digit.Utils.dss.formatter(value, "number", value?.denomination, true, t); - return value; - }; - - const renderTooltip = ({ payload, label, unit }) => { - let formattedLabel = tickFormatter(label); - let payloadObj = payload?.[0] || {}; - return ( -
- {payloadObj?.payload?.symbol?.toLowerCase() === "amount" && ( -

{`${formattedLabel} : ${value?.denomination === "Unit" ? " ₹" : ""}${Digit.Utils.dss.formatter( - payloadObj?.value, - "number", - value?.denomination, - true, - t - )} ${value?.denomination !== "Unit" ? t(Digit.Utils.locale.getTransformedLocale(`ES_DSS_${value?.denomination}`)) : ""}`}

- )} - {payloadObj?.payload?.symbol?.toLowerCase() === "percentage" && ( -

{`${formattedLabel} : ${Digit.Utils.dss.formatter(payloadObj?.value, "number", value?.denomination, true, t)} %`}

- )} - {payloadObj?.payload?.symbol?.toLowerCase() === "number" && ( -

{`${formattedLabel} : ${Digit.Utils.dss.formatter(payloadObj?.value, "number", value?.denomination, true, t)} `}

- )} - {!payloadObj?.payload?.symbol &&

{`${formattedLabel} : ${payloadObj?.value} `}

} -
- ); - }; - - const renderTooltipForLine = ({ payload, label, unit }) => { - let payloadObj = payload?.[0] || {}; - let prefix = payloadObj?.payload?.symbol?.toLowerCase() === "amount" && value?.denomination === "Unit" ? " ₹" : " "; - let postfix = - payloadObj?.payload?.symbol?.toLowerCase() === "percentage" - ? " %" - : payloadObj?.payload?.symbol?.toLowerCase() === "amount" && value?.denomination !== "Unit" - ? t(Digit.Utils.locale.getTransformedLocale(`ES_DSS_${value?.denomination}`)) - : ""; - let newPayload = { ...payloadObj?.payload }; - delete newPayload?.label; - delete newPayload?.strValue; - delete newPayload?.symbol; - let newObjArray = [newPayload?.name]; - delete newPayload?.name; - Object.keys(newPayload).map((key) => { - newObjArray.push( - `${key} -${prefix}${ - payloadObj?.payload?.symbol?.toLowerCase() === "amount" - ? Digit.Utils.dss.formatter(getDenominatedValue(value?.denomination, newPayload?.[key]), "number", value?.denomination, true, t) - : Digit.Utils.dss.formatter(newPayload?.[key], "number", value?.denomination, true, t) - } ${postfix}` - ); - }); - return ( -
- {newObjArray.map((ele, i) => ( -

{ele}

- ))} -
- ); - }; - - if (isLoading) { - return ; - } - return ( -
- {id === "fsmCapacityUtilization" && ( -

- {t("DSS_FSM_TOTAL_SLUDGE_TREATED")} - {totalWaste} {t("DSS_KL")} -

- )} - - {!chartData || chartData?.length === 0 ? ( - - ) : manageChart == "Area" ? ( - - - - - - - - - - - - - - - ) : ( - - - - - - - {keysArr?.map((key, i) => { - return ( - renderPlot(plot, key)} - stroke={getColors(i)} - activeDot={{ r: 8 }} - strokeWidth={2} - key={i} - dot={{ stroke: getColors(i), strokeWidth: 1, r: 2, fill: getColors(i) }} - /> - ); - })} - {/* - */} - - )} - -
- ); -}; - -export default CustomAreaChart; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/components/CustomBarChart.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/components/CustomBarChart.js deleted file mode 100644 index 407804ad9..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/components/CustomBarChart.js +++ /dev/null @@ -1,144 +0,0 @@ -import { Loader } from "@egovernments/digit-ui-react-components"; -import React, { Fragment, useContext, useMemo, useState } from "react"; -import { useTranslation } from "react-i18next"; -import { useHistory } from "react-router-dom"; -import { Bar, BarChart, CartesianGrid, ResponsiveContainer, XAxis, YAxis } from "recharts"; -import FilterContext from "./FilterContext"; -import NoData from "./NoData"; -import { checkCurrentScreen } from "./DSSCard"; - -const formatValue = (value, symbol) => { - if (symbol?.toLowerCase() === "percentage") { - /* Removed by percentage formatter. - const Pformatter = new Intl.NumberFormat("en-IN", { maximumSignificantDigits: 3 }); - return `${Pformatter.format(Number(value).toFixed(2))}`; - */ - return `${Number(value).toFixed()}`; - } else { - return value; - } -}; - -const CustomLabel = ({ x, y, name, stroke, value, maxValue }) => { - const { t } = useTranslation(); - return ( - <> - - {`${maxValue?.[t(name)]}%`} - - - {t(`DSS_TB_${Digit.Utils.locale.getTransformedLocale(name)}`)} - - - ); -}; -const COLORS = { RED: "#00703C", GREEN: "#D4351C", default: "#00703C" }; - -const CustomBarChart = ({ - xDataKey = "value", - xAxisType = "number", - yAxisType = "category", - yDataKey = "name", - hideAxis = true, - layout = "vertical", - fillColor = "default", - showGrid = false, - showDrillDown = false, - data, - title, - setChartDenomination, - moduleCode, -}) => { - const { id } = data; - const { t } = useTranslation(); - const history = useHistory(); - const { value } = useContext(FilterContext); - const [maxValue, setMaxValue] = useState({}); - const tenantId = Digit.ULBService.getCurrentTenantId(); - const { isLoading, data: response } = Digit.Hooks.dss.useGetChart({ - key: id, - type: "metric", - tenantId, - requestDate: { ...value?.requestDate, startDate: value?.range?.startDate?.getTime(), endDate: value?.range?.endDate?.getTime() }, - filters: value?.filters, - moduleLevel: value?.moduleLevel || moduleCode, - }); - const chartData = useMemo(() => { - if (!response) return null; - setChartDenomination(response?.responseData?.data?.[0]?.headerSymbol); - const dd = response?.responseData?.data?.map((bar) => { - let plotValue = bar?.plots?.[0].value || 0; - return { - name: t(bar?.plots?.[0].name), - value: formatValue(plotValue, bar?.plots?.[0].symbol), - // value: Digit.Utils.dss.formatter(plotValue, bar?.plots?.[0].symbol), - }; - }); - let newMax = Math.max(...dd.map((e) => Number(e.value))); - let newObj = {}; - let newReturn = dd.map((ele) => { - newObj[ele.name] = ele.value; - return { ...ele, value: (Number(ele.value) / newMax) * 100 }; - }); - setMaxValue(newObj); - return newReturn; - }, [response]); - - const goToDrillDownCharts = () => { - history.push( - `/mgramseva-digit-ui/employee/dss/drilldown?chart=${response?.responseData?.visualizationCode}&ulb=${ - value?.filters?.tenantId - }&title=${title}&fromModule=${Digit.Utils.dss.getCurrentModuleName()}&type=performing-metric&fillColor=${fillColor}&isNational=${ - checkCurrentScreen() ? "YES" : "NO" - }` - ); - }; - if (isLoading) { - return ; - } - if (chartData?.length === 0 || !chartData) { - return ; - } - return ( - - - - {showGrid && } - - - } - radius={[8, 8, 8, 8]} - isAnimationActive={false} - /> - - - {chartData?.length > 3 && showDrillDown && ( -

- {t("DSS_SHOW_MORE")} -

- )} -
- ); -}; - -export default CustomBarChart; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/components/CustomHorizontalBarChart.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/components/CustomHorizontalBarChart.js deleted file mode 100644 index b5854ac09..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/components/CustomHorizontalBarChart.js +++ /dev/null @@ -1,190 +0,0 @@ -import { Loader } from "@egovernments/digit-ui-react-components"; -import React, { Fragment, useContext, useEffect, useMemo } from "react"; -import { useTranslation } from "react-i18next"; -import { useHistory } from "react-router-dom"; -import { Bar, BarChart, CartesianGrid, Legend, ResponsiveContainer, Tooltip, XAxis, YAxis } from "recharts"; -import FilterContext from "./FilterContext"; -import NoData from "./NoData"; - -const barColors = ["#048BD0", "#FBC02D", "#8E29BF", "#EA8A3B", "#0BABDE", "#6E8459", "#D4351C", "#0CF7E4", "#F80BF4", "#22F80B"]; - -const renderPlot = (plot, key, denomination) => { - const plotValue = key ? plot?.[key] : plot?.value || 0; - if (plot?.symbol?.toLowerCase() === "amount") { - switch (denomination) { - case "Unit": - return plotValue; - case "Lac": - return Number((plotValue / 100000).toFixed(2)); - case "Cr": - return Number((plotValue / 10000000).toFixed(2)); - default: - return ""; - } - } else if (plot?.symbol?.toLowerCase() === "number") { - return Number(plotValue.toFixed(1)); - } else { - return plotValue; - } -}; - -const CustomHorizontalBarChart = ({ - data, - xAxisType = "category", - yAxisType = "number", - xDataKey = "name", - yDataKey = "", - xAxisLabel = "", - yAxisLabel = "", - layout = "horizontal", - title, - showDrillDown = false, - setChartDenomination, - moduleCode, -}) => { - const { id } = data; - const { t } = useTranslation(); - const history = useHistory(); - const { value } = useContext(FilterContext); - const tenantId = Digit.ULBService.getCurrentTenantId(); - const { isLoading, data: response } = Digit.Hooks.dss.useGetChart({ - key: id, - type: "metric", - tenantId, - requestDate: { ...value?.requestDate, startDate: value?.range?.startDate?.getTime(), endDate: value?.range?.endDate?.getTime() }, - filters: value?.filters, - moduleLevel: value?.moduleLevel || moduleCode, - }); - const constructChartData = (data, denomination) => { - let result = {}; - for (let i = 0; i < data?.length; i++) { - const row = data[i]; - for (let j = 0; j < row.plots.length; j++) { - const plot = row.plots[j]; - result[plot.name] = { ...result[plot.name], [t(row.headerName)]: renderPlot(plot, "value", denomination), name: t(plot.name) }; - } - } - return Object.keys(result).map((key) => { - return { - name: key, - ...result[key], - }; - }); - }; - - const goToDrillDownCharts = () => { - history.push( - `/mgramseva-digit-ui/employee/dss/drilldown?chart=${response?.responseData?.drillDownChartId}&ulb=${value?.filters?.tenantId}&title=${title}` - ); - }; - - const tooltipFormatter = (value, name) => { - if (id === "fsmMonthlyWasteCal") { - return [ - `${Digit.Utils.dss.formatter(Math.round((value + Number.EPSILON) * 100) / 100, "number", value?.denomination, true, t)} ${t("DSS_KL")}`, - name, - ]; - } - return [Digit.Utils.dss.formatter(Math.round((value + Number.EPSILON) * 100) / 100, "number", value?.denomination, true, t), name]; - }; - - useEffect(() => { - if (response) setChartDenomination(response?.responseData?.data?.[0]?.headerSymbol); - }, [response]); - - const chartData = useMemo(() => constructChartData(response?.responseData?.data, value?.denomination), [response, value?.denomination]); - - const renderLegend = (value) => {value}; - - const tickFormatter = (value) => { - if (typeof value === "string") { - return value.replace("-", ", "); - } else if (typeof value === "number") return Digit.Utils.dss.formatter(value, "number", value?.denomination, true, t); - return value; - }; - - if (isLoading) { - return ; - } - const formatXAxis = (tickFormat) => { - // if (tickFormat && typeof tickFormat == "string") { - // return `${tickFormat.slice(0, 16)}${tickFormat.length > 17 ? ".." : ""}`; - // } - return `${tickFormat}`; - }; - - const getVerticalWidth = (layout) => { - if (window?.location.href.includes("dss/dashboard/pgr")) { - return layout === "vertical" ? 150 : 60; - } else { - return layout === "vertical" ? 120 : 60; - } - }; - - const bars = response?.responseData?.data?.map((bar) => bar?.headerName); - return ( - - - {chartData?.length === 0 || !chartData ? ( - - ) : ( - - - - - {bars?.map((bar, id) => ( - 2 ? 1 : id} /> - ))} - - - - )} - - {showDrillDown && ( -

- {t("DSS_SHOW_MORE")} -

- )} -
- ); -}; - -export default CustomHorizontalBarChart; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/components/CustomPieChart.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/components/CustomPieChart.js deleted file mode 100644 index 48f17f113..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/components/CustomPieChart.js +++ /dev/null @@ -1,235 +0,0 @@ -import { Loader, RemoveableTag } from "@egovernments/digit-ui-react-components"; -import React, { useContext, useMemo, useState, Fragment, useEffect } from "react"; -import { useTranslation } from "react-i18next"; -import { Cell, Legend, Pie, PieChart, ResponsiveContainer, Tooltip } from "recharts"; -import FilterContext from "./FilterContext"; -import NoData from "./NoData"; -// ["#048BD0", "#FBC02D", "#8E29BF","#EA8A3B","#0BABDE","#6E8459"] -const COLORS = ["#048BD0", "#FBC02D", "#8E29BF", "#EA8A3B", "#0BABDE", "#6E8459", "#D4351C", "#0CF7E4", "#F80BF4", "#22F80B"]; -const mobileView = innerWidth <= 640; - -const CustomPieChart = ({ dataKey = "value", data, setChartDenomination, moduleCode }) => { - const { id } = data; - const tenantId = Digit.ULBService.getCurrentTenantId(); - const { t } = useTranslation(); - const { value } = useContext(FilterContext); - const [isPieClicked, setIsPieClicked] = useState(false); - const [pieSelected, setPieSelected] = useState(null); - const [drillDownId, setdrillDownId] = useState(null); - const { isLoading, data: response } = Digit.Hooks.dss.useGetChart({ - key: isPieClicked ? drillDownId : id, - type: "metric", - tenantId, - requestDate: { ...value?.requestDate, startDate: value?.range?.startDate?.getTime(), endDate: value?.range?.endDate?.getTime() }, - filters: isPieClicked ? { ...value?.filters, selectedType: pieSelected } : value?.filters, - moduleLevel: value?.moduleLevel || moduleCode, - }); - - const chartData = useMemo(() => { - if (!response) return null; - setChartDenomination(response?.responseData?.data?.[0]?.headerSymbol); - const compareFn = (a, b) => b.value - a.value; - return drillDownId === "deathByCategoryDrilldownAge" || response?.responseData?.visualizationCode === "nssNumberOfDeathsByAge" // || drillDownId === "nssDeathByCategoryDrillDownAge") - ? response?.responseData?.data?.[0]?.plots.reduce((acc, plot, index) => { - acc = acc.concat(plot); - return acc; - }, []) - : response?.responseData?.data?.[0]?.plots.sort(compareFn).reduce((acc, plot, index) => { - // if (index < 4) acc = acc.concat(plot); - //else if (index === 4) acc = acc.concat({ label: null, name: "DSS.OTHERS", value: plot?.value, symbol: "amount" }); - // else acc[3].value += plot?.value; - /* Commnted logic of pie chart which hides more that 4 and show max of 4*/ - acc = acc.concat(plot); - return acc; - }, []); - }, [response]); - - const renderLegend = (value) => ( - {t(`COMMON_MASTERS_${value && Digit.Utils.locale.getTransformedLocale(value)}`)} - ); - - const renderCustomLabel = (args) => { - const { value, endAngle, startAngle, x, cx, y, cy, percent, name } = args; - const diffAngle = endAngle - startAngle; - if (diffAngle > 1.5 && diffAngle < 7) { - return ( - cx ? "start" : "end"} - > - {`${(percent * 100).toFixed(0)}%`} - - ); - } else if (diffAngle < 1.5) { - return null; - } - return ( - cx ? "start" : "end"} - > - {`${(percent * 100).toFixed(0)}%`} - - ); - }; - - const renderTooltip = ({ payload, label }) => { - return ( -
-

{`${t( - `COMMON_MASTERS_${payload?.[0]?.name && Digit.Utils.locale.getTransformedLocale(payload?.[0]?.name)}` - )}: ${Digit.Utils.dss.formatter(payload?.[0]?.value, payload?.[0]?.payload?.payload?.symbol, value?.denomination, true, t)}`}

-

{`(${Number((payload?.[0]?.value / response?.responseData?.data?.[0]?.headerValue) * 100).toFixed(1)}%)`}

-
- ); - }; - - ///chartIDArray : Array of id's which are placed in a row of 2 charts - const chartIDArray = [ - "mcCollectionByPaymentModev2", - "mcRceiptsByPaymentModev2", - "nssWsCollectionByChannel", - "nssWsCollectionByUsage", - "nssOBPSPermitIssuedByOccupancyType", - "nssOBPSPermitIssuedByRiskType", - "mcCollectionByPaymentType", - "mcReceiptsByPaymentMode", - "wscollectionByUsage", - "wscollectionByChannel", - "permitIssuedByOccupancyType", - "permitIssuedByRiskType", - ]; - - ///checkChartID: This function will check if the id is of chartIDArray - const checkChartID = (chartID) => { - return chartIDArray.includes(chartID); - }; - - const onPieClick = ({ payload }) => { - setIsPieClicked(true); - setdrillDownId(response?.responseData?.drillDownChartId); - setPieSelected(payload.name); - }; - - const removeFilter = () => { - setIsPieClicked(false); - }; - - useEffect(() => { - setIsPieClicked(false); - setdrillDownId(null); - setPieSelected(null); - }, [id]); - - if (isLoading) { - return ; - } - return ( - - {id === "deathByCategory" && ( //|| id === "nssNumberOfDeathsByCategory") && ( - - {t("DSS_CMN_PIE_INFO")} - - )} - {isPieClicked && ( -
-
- {t("DSS_FILTERS_APPLIED")}: - -
- {/*
- {t("DSS_FILTERS_APPLIED")}: - -
*/} -
- )} - {chartData?.length === 0 || !chartData ? ( - - ) : ( - - - - {response?.responseData?.data?.[0]?.plots.map((entry, index) => ( - - ))} - - - 6 - ? { - paddingRight: checkChartID(id) && !mobileView ? 60 : 0, ///Padding for 2 charts in a row cases - overflowY: "scroll", - height: 250, - width: "35%", - overflowX: "auto", - paddingTop: -20, - } - : { paddingRight: checkChartID(id) && !mobileView ? 60 : 0, width: "27%", overflowX: "auto", paddingTop: -20 } ///Padding for 2 charts in a row cases - } - /> - - - )} - {isPieClicked && ( -
- {t(Digit.Utils.locale.getTransformedLocale(`${response?.responseData?.data?.[0]?.headerName}_${pieSelected}`))} -
- )} -
- ); -}; - -export default CustomPieChart; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/components/CustomTable.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/components/CustomTable.js deleted file mode 100644 index 7f527330b..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/components/CustomTable.js +++ /dev/null @@ -1,427 +0,0 @@ -import { DownwardArrow, Loader, Rating, RemoveableTag, Table, UpwardArrow } from "@egovernments/digit-ui-react-components"; -import { differenceInCalendarDays, subYears } from "date-fns"; -import React, { useCallback, useContext, useEffect, useMemo, useState } from "react"; -import { useTranslation } from "react-i18next"; -import FilterContext from "./FilterContext"; -import NoData from "./NoData"; -import { ArrowDownwardElement } from "./ArrowDownward"; -import { ArrowUpwardElement } from "./ArrowUpward"; -import ReactTooltip from "react-tooltip"; - -const rowNamesToBeLocalised = ["Department", "", "Usage Type", "Ward", "Wards", "City Name"]; - -const InsightView = ({ rowValue, insight, t, isFinance }) => { - return ( - - {rowValue} - {!(isFinance) &&
- {` `} - {insight >= 0 ? ArrowUpwardElement() : ArrowDownwardElement()} - {` `} - {isNaN(insight) ? `0%` : `${Digit.Utils.dss.formatter(Math.abs(insight), "number", "Lac", true, t)}%`} -
} -
- ); -}; - -const calculateFSTPCapacityUtilization = (value, totalCapacity, numberOfDays = 1) => { - if (value === undefined) return value; - return Math.round((value / (totalCapacity * numberOfDays)) * 100); -}; - -const CustomTable = ({ data = {}, onSearch, setChartData, setChartDenomination, moduleCode }) => { - const { id } = data; - const [chartKey, setChartKey] = useState(id); - const [filterStack, setFilterStack] = useState([{ id: chartKey }]); - const { t } = useTranslation(); - const { value, setValue, ulbTenants, fstpMdmsData } = useContext(FilterContext); - const tenantId = Digit.ULBService.getCurrentTenantId(); - const dssTenants = Digit.SessionStorage.get("DSS_TENANTS"); - let isFinance = window.location.href.includes("/employee/dss/dashboard/finance"); - const lastYearDate = { - startDate: subYears(value?.range?.startDate, 1).getTime(), - endDate: subYears(value?.range?.endDate, 1).getTime(), - interval: "month", - title: "", - }; - const { isLoading: isRequestLoading, data: lastYearResponse } = Digit.Hooks.dss.useGetChart({ - key: chartKey, - type: "metric", - tenantId, - requestDate: { ...lastYearDate }, - filters: - id === chartKey - ? value?.filters - : { ...value?.filters, [filterStack[filterStack.length - 1]?.filterKey]: filterStack[filterStack.length - 1]?.filterValue }, - addlFilter: filterStack[filterStack.length - 1]?.addlFilter, - moduleLevel: value?.moduleLevel || moduleCode, - }); - const { isLoading, data: response } = Digit.Hooks.dss.useGetChart({ - key: chartKey, - type: "metric", - tenantId, - requestDate: { ...value?.requestDate, startDate: value?.range?.startDate?.getTime(), endDate: value?.range?.endDate?.getTime() }, - filters: - id === chartKey - ? value?.filters - : { ...value?.filters, [filterStack[filterStack.length - 1]?.filterKey]: filterStack[filterStack.length - 1]?.filterValue }, - addlFilter: filterStack[filterStack.length - 1]?.addlFilter, - moduleLevel: value?.moduleLevel || moduleCode, - }); - useEffect(() => { - const { id } = data; - setChartKey(id); - setFilterStack([{ id: id }]); - }, [data, value]); - const tableData = useMemo(() => { - if (!response || !lastYearResponse) return; - setChartDenomination(response?.responseData?.data?.[0]?.headerSymbol); - return response?.responseData?.data?.map((rows, id) => { - const lyData = lastYearResponse?.responseData?.data?.find((lyRow) => lyRow?.headerName === rows?.headerName); - return rows?.plots?.reduce((acc, row, currentIndex) => { - let cellValue = row?.value !== null ? row?.value : row?.label || ""; - if (row?.strValue && row?.symbol === "string" && !row?.label) { - cellValue = row?.strValue; - } - let prevData = lyData?.plots?.[currentIndex]?.value; - let insight = null; - if (row?.name === "CapacityUtilization" && chartKey !== "fsmVehicleLogReportByVehicleNo") { - const { range } = value; - const { startDate, endDate } = range; - const numberOfDays = differenceInCalendarDays(endDate, startDate) + 1; - const ulbs = dssTenants - .filter((tenant) => tenant?.city?.ddrName === rows?.headerName || tenant?.code === rows?.headerName) - .map((tenant) => tenant?.code); - const totalCapacity = fstpMdmsData - ?.filter((plant) => ulbs.find((ulb) => plant?.ULBS?.includes(ulb))) - .reduce((acc, plant) => acc + Number(plant?.PlantOperationalCapacityKLD), 0); - cellValue = calculateFSTPCapacityUtilization(cellValue, totalCapacity, numberOfDays); - prevData = calculateFSTPCapacityUtilization(prevData, totalCapacity, numberOfDays); - } - if (row?.name === "CapacityUtilization" && chartKey === "fsmVehicleLogReportByVehicleNo") { - const tankCapcity = rows?.plots.find((plot) => plot?.name === "TankCapacity"); - cellValue = calculateFSTPCapacityUtilization(cellValue, tankCapcity?.value); - prevData = calculateFSTPCapacityUtilization(prevData, tankCapcity?.value); - } - if ( - (row?.symbol === "number" || row?.symbol === "percentage" || row?.symbol === "amount") && - row?.name !== "CitizenAverageRating" && - row?.name !== "TankCapacity" && - lyData !== undefined - ) { - if (prevData === cellValue) insight = 0; - else insight = prevData === 0 ? 100 : Math.round(((cellValue - prevData) / prevData) * 100); - } - if (typeof cellValue === "number" && !Number.isInteger(cellValue)) { - cellValue = Math.round((cellValue + Number.EPSILON) * 100) / 100; - } - if (typeof cellValue === "string" && rowNamesToBeLocalised?.includes(row.name)) { - cellValue = t(`DSS_TB_` + Digit.Utils.locale.getTransformedLocale(cellValue)); - } - acc[t(`DSS_HEADER_${Digit.Utils.locale.getTransformedLocale(row?.name)}`)] = - insight !== null ? { value: cellValue, insight } : row?.name === "S.N." ? id + 1 : cellValue; - acc["key"] = rows?.headerName; - return acc; - }, {}); - }); - }, [response, lastYearResponse]); - - useEffect(() => { - if (tableData) { - const result = tableData?.map((row) => { - return Object.keys(row).reduce((acc, key) => { - if (key === "key") return acc; - acc[key] = typeof row?.[key] === "object" ? row?.[key]?.value : row?.[key]; - return acc; - }, {}); - }); - setChartData(result); - } else { - const result = []; - setChartData(result); - } - }, [tableData]); - - const filterValue = useCallback((rows, id, filterValue = "") => { - return rows.filter((row) => { - const res = Object.keys(row?.values).find((key) => { - if (typeof row?.values?.[key] === "object") { - return Object.keys(row?.values?.[key]).find((id) => { - if (id === "insight") { - return String(Math.abs(row?.values?.[key]?.[id]) + "%") - .toLowerCase() - .startsWith(filterValue?.toLowerCase()); - } - return String(row?.values?.[key]?.[id])?.toLowerCase().includes(filterValue?.toLowerCase()); - }); - } - return ( - String(row?.values?.[key]).toLowerCase()?.includes(filterValue?.toLowerCase()) || - String(t(row?.values?.[key])).toLowerCase()?.includes(filterValue?.toLowerCase()) - /* search in the table to get filter along with space is currently enabled - Also replace startsWith with includes - String(row?.values?.[key]) - .toLowerCase() - .split(" ") - .some((str) => str?.startsWith(filterValue?.toLowerCase())) || - String(t(row?.values?.[key])) - .toLowerCase() - .split(" ") - .some((str) => str.startsWith(filterValue?.toLowerCase())) - */ - ); - }); - return res; - }); - }, []); - - const renderUnits = (denomination) => { - switch (denomination) { - case "Unit": - return `(${t("DSS_" + Digit.Utils.locale.getTransformedLocale(denomination))})`; - case "Lac": - return `(${t("DSS_" + Digit.Utils.locale.getTransformedLocale(denomination))})`; - case "Cr": - return `(${t("DSS_" + Digit.Utils.locale.getTransformedLocale(denomination))})`; - default: - return ""; - } - }; - - const renderHeader = (plot) => { - const code = `DSS_HEADER_${Digit.Utils.locale.getTransformedLocale(plot?.name)}`; - if (plot?.symbol === "amount") { - return `${t(code)} ${renderUnits(value?.denomination)}`; - } - return t(code); - }; - - const getDrilldownCharts = (value, filterKey, label, filters = []) => { - if (response?.responseData?.drillDownChartId && response?.responseData?.drillDownChartId !== "none") { - let currentValue = value; - if (filterKey === "tenantId") { - currentValue = dssTenants - ?.filter((tenant) => tenant?.city?.ddrName === value || tenant?.code === value || tenant?.description === value) - .map((tenant) => tenant?.code); - if (currentValue?.length == 0 && value) { - currentValue = [value]; - } - /* Removed this mdms active tenants filter logic as per RAIN-5454 - currentValue = dssTenants.filter((tenant) => tenant?.city?.ddrName === value || tenant?.code === value).map((tenant) => tenant?.code); - */ - if (currentValue === undefined) return; - } - - let newStack = { id: response?.responseData?.drillDownChartId, name: value, filterKey, filterValue: currentValue, label }; - if (filters.length > 1) { - let newFilter = filters.filter((ele) => ele.key != filterKey); - newStack["addlFilter"] = { [newFilter?.[0]?.key]: filterStack?.[filterStack?.length - 1]?.filterValue }; - newFilter.map((fil) => { - newStack["addlFilter"][fil?.key] = - filterStack?.filter((e) => e.filterKey == fil?.key)?.[0]?.filterValue || - filterStack?.filter((e) => e.filterKey == "tenantId")?.[0]?.filterValue; - }); - } - setFilterStack([...filterStack, newStack]); - setChartKey(response?.responseData?.drillDownChartId); - } - }; - - const sortRows = useCallback((rowA, rowB, columnId) => { - const firstCell = rowA?.values?.[columnId]; - const secondCell = rowB?.values?.[columnId]; - let value1, value2; - value1 = typeof firstCell === "object" ? firstCell?.value : firstCell; - value2 = typeof secondCell === "object" ? secondCell?.value : secondCell; - return String(value1).localeCompare(String(value2), undefined, { numeric: true }); - }, []); - - const accessData = (plot) => { - const name = t(`DSS_HEADER_${Digit.Utils.locale.getTransformedLocale(plot?.name)}`); - return (originalRow, rowIndex, columns) => { - const cellValue = originalRow?.[name]; - if (plot?.symbol === "amount") { - return typeof cellValue === "object" - ? { value: Digit.Utils.dss.formatter(convertDenomination(cellValue?.value), "number", "Lac", true, t, isFinance ? true : false), insight: cellValue?.insight } - : String(Digit.Utils.dss.formatter(convertDenomination(cellValue), "number", "Lac", true, t, isFinance ? true : false)); - } else if (plot?.symbol === "number" || plot?.symbol === "percentage") { - return typeof cellValue === "object" - ? { value: Digit.Utils.dss.formatter(cellValue?.value, "number", "Lac", true, t), insight: cellValue?.insight } - : String(Digit.Utils.dss.formatter(cellValue, "number", "Lac", true, t)); - } - - return originalRow[name]; - }; - }; - const isMobile = window.Digit.Utils.browser.isMobile(); - - const getTooltipStyles = (name) => { - if (isMobile) - return { - height: "fit-content", - background: "#555", - padding: "5px", - wordBreak: name?.length > 100 ? "break-all" : "break-word", - overflowWrap: "break-word", - borderRadius: "6px", - maxWidth: "205px", - }; - else - return { - height: "fit-content", - background: "#555", - width: "fit-content", - padding: "5px", - wordBreak: name?.length > 100 ? "break-all" : "break-word", - overflowWrap: "break-word", - borderRadius: "6px", - }; - }; - - const tableColumns = useMemo(() => { - const columns = response?.responseData?.data?.find((row) => !!row); - return columns?.plots - ?.filter((plot) => plot?.name !== "TankCapacity") - .map((plot, index) => ({ - Header: ( - - {renderHeader(plot)} - - - {t(`TIP_DSS_HEADER_${Digit.Utils.locale.getTransformedLocale(plot?.name)}`)} - - {/* 2 ? -100 : -160, - height: "35px", - bottom: "0%", - top: "100%", - background: "none", - width: - tableData?.length > 2 || t(`TIP_DSS_HEADER_${Digit.Utils.locale.getTransformedLocale(plot?.name)}`).length < 42 ? "150px" : "250px", - }} - > -
- {t(`TIP_DSS_HEADER_${Digit.Utils.locale.getTransformedLocale(plot?.name)}`)} -
-
**/} -
- ), - accessor: accessData(plot), - id: plot?.name?.replaceAll(".", " "), - symbol: plot?.symbol, - sortType: sortRows, - Cell: (args) => { - const { value: cellValue, column, row } = args; - if (typeof cellValue === "object") { - return ; - } - const filter = response?.responseData?.filter?.find((elem) => elem?.column === column?.id); - if (response?.responseData?.drillDownChartId !== "none" && filter !== undefined) { - return ( - - getDrilldownCharts( - cellValue?.includes("DSS_TB_") ? row?.original?.key : cellValue, - filter?.key, - t(`DSS_HEADER_${Digit.Utils.locale.getTransformedLocale(plot?.name)}`), - response?.responseData?.filter - ) - } - > - {t(`DSS_TB_${Digit.Utils.locale.getTransformedLocale(cellValue)}`)} - - ); - } - if (column?.id === "CitizenAverageRating") { - return ( - - ); - } - return String(t(cellValue)); - }, - })); - }, [response, value?.denomination, value?.range]); - - const convertDenomination = (val) => { - const { denomination } = value; - switch (denomination) { - case "Unit": - return val; - case "Lac": - return Number((val / 100000).toFixed(2)); - case "Cr": - return Number((val / 10000000).toFixed(2)); - default: - return val; - } - }; - - const removeULB = (id) => { - const nextState = filterStack?.filter((filter, index) => index < id); - setFilterStack(nextState); - setChartKey(nextState[nextState?.length - 1]?.id); - }; - - if (isLoading || isRequestLoading) { - return ; - } - return ( -
- { !(isFinance) && - {t("DSS_CMN_TABLE_INFO")} - } - {filterStack?.length > 1 && ( -
- {t("DSS_FILTERS_APPLIED")}: - {filterStack.map((filter, id) => - id > 0 ? ( - removeULB(id)} - /> - ) : null - )} -
- )} - - {!tableColumns || !tableData ? ( - - ) : ( -
tRow) || []} - totalRecords={tableData?.length} - columns={tableColumns?.filter((row) => row)?.slice(1)} - showAutoSerialNo={"DSS_HEADER_S_N_"} - styles={{ overflow: "hidden" }} - getCellProps={(cellInfo) => { - return { - style: {}, - }; - }} - /> - )} - - ); -}; - -export default CustomTable; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/components/DSSCard.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/components/DSSCard.js deleted file mode 100644 index 50d710b6b..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/components/DSSCard.js +++ /dev/null @@ -1,82 +0,0 @@ -import { ModuleCardFullWidth } from "@egovernments/digit-ui-react-components"; -import React from "react"; -import { useTranslation } from "react-i18next"; - -const nationalScreenURLs = { - overview: { key: "national-overview", stateKey: "overview", label: "NURT_OVERVIEW", active: true, nActive: true }, - propertytax: { key: "national-propertytax", stateKey: "propertytax", label: "NURT_PROPERTY_TAX", active: true, nActive: true }, - tradelicense: { key: "national-tradelicense", stateKey: "tradelicense", label: "NURT_TRADE_LICENCE", active: true, nActive: true }, - pgr: { key: "national-pgr", stateKey: "pgr", label: "NURT_COMPLAINS", active: true, nActive: true }, - fsm: { key: "fsm", stateKey: "fsm", label: "CS_HOME_FSM_SERVICES", active: true, nActive: false }, - mCollect: { key: "national-mcollect", stateKey: "mCollect", label: "NURT_MCOLLECT", active: true, nActive: true }, - ws: { key: "national-ws", stateKey: "ws", label: "NURT_WATER_SEWERAGE", active: true, nActive: true }, - obps: { key: "nss-obps", stateKey: "obps", label: "DSS_BUILDING_PERMISSION", active: true, nActive: true }, - noc: { key: "national-firenoc", stateKey: "noc", label: "NURT_FIRENOC", active: true, nActive: true }, - bnd: { key: "nss-birth-death", stateKey: "birth-death", label: "BIRTH_AND_DEATH", active: true, nActive: true }, - faqs: { key: "national-faqs", stateKey: "national-faqs", label: "DSS_FAQS", active: false, nActive: true, others: true }, - finance: { key: "national-finance", stateKey: "finance", label: "DSS_FINANCE", active: true, nActive: false }, - about: { key: "national-about", stateKey: "national-about", label: "DSS_ABOUT_DASHBOARD", active: false, nActive: true, others: true }, -}; - -export const checkCurrentScreen = () => { - const moduleName = Digit.Utils.dss.getCurrentModuleName(); - const nationalURLS = Object.keys(nationalScreenURLs).map((key) => nationalScreenURLs[key].key); - return nationalURLS.filter((ele) => ele !== "fsm").some((e) => moduleName?.includes(e)); -}; - -const NDSSCard = () => { - const NATADMIN = Digit.UserService.hasAccess("NATADMIN"); - const { t } = useTranslation(); - - if (!NATADMIN) { - return null; - } - - let links = Object.values(nationalScreenURLs) - .filter((ele) => ele["nActive"] === true) - .map((obj) => ({ - label: t(obj?.label), - link: `/mgramseva-digit-ui/employee/dss/dashboard/${obj?.key}`, - link: obj?.others ? `/mgramseva-digit-ui/employee/dss/${obj?.key}` : `/mgramseva-digit-ui/employee/dss/dashboard/${obj?.key}`, - })); - - const propsForModuleCard = { - headerStyle: { border: "none", height: "48px" }, - moduleName: t("ACTION_TEST_NATDASHBOARD"), - subHeader: t("ACTION_TEST_NATDASHBOARD"), - // subHeaderLink: `/mgramseva-digit-ui/employee/payment/integration/dss/NURT_DASHBOARD`, - subHeaderLink: `/mgramseva-digit-ui/employee/dss/landing/NURT_DASHBOARD`, - className: "employeeCard customEmployeeCard card-home full-width-card full-employee-card-height", - links: [...links], - }; - return ; -}; - -const DSSCard = () => { - const STADMIN = Digit.UserService.hasAccess("STADMIN"); - const { t } = useTranslation(); - - if (!STADMIN) { - return null; - } - - let links = Object.values(nationalScreenURLs) - .filter((ele) => ele["active"] === true) - .map((obj) => ({ - label: t(obj?.label), - link: obj.active ? `/mgramseva-digit-ui/employee/dss/dashboard/${obj?.stateKey}` : `/employee/integration/dss/${obj?.stateKey}`, - })); - - const propsForModuleCard = { - headerStyle: { border: "none", height: "48px" }, - moduleName: t("ES_TITLE_DSS"), - subHeader: t("ACTION_TEST_SURE_DASHBOARD"), - // subHeaderLink: `/mgramseva-digit-ui/employee/payment/integration/dss/home`, - subHeaderLink: `/mgramseva-digit-ui/employee/dss/landing/home`, - className: "employeeCard card-home customEmployeeCard full-width-card full-employee-card-height", - links: [...links], - }; - return ; -}; - -export { DSSCard, NDSSCard }; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/components/DateRange.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/components/DateRange.js deleted file mode 100644 index 267fecc71..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/components/DateRange.js +++ /dev/null @@ -1,222 +0,0 @@ -import { Calender } from "@egovernments/digit-ui-react-components"; -import { - addHours, - addMinutes, - addMonths, - addSeconds, - differenceInDays, - endOfMonth, - endOfDay, - endOfQuarter, - endOfToday, - endOfWeek, - endOfYear, - endOfYesterday, - format, - startOfMonth, - startOfQuarter, - startOfToday, - startOfWeek, - startOfYear, - startOfYesterday, - subSeconds, - subYears, -} from "date-fns"; -import React, { useEffect, Fragment, useMemo, useRef, useState } from "react"; -import { createStaticRanges, DateRangePicker } from "react-date-range"; - -function isEndDateFocused(focusNumber) { - return focusNumber === 1; -} - -function isStartDateFocused(focusNumber) { - return focusNumber === 0; -} - -const DateRange = ({ values, onFilterChange, t }) => { - const [isModalOpen, setIsModalOpen] = useState(false); - const [focusedRange, setFocusedRange] = useState([0, 0]); - const [selectionRange, setSelectionRange] = useState(values); - const wrapperRef = useRef(null); - - useEffect(() => { - const handleClickOutside = (event) => { - if (wrapperRef.current && !wrapperRef.current.contains(event.target)) { - setIsModalOpen(false); - } - }; - document.addEventListener("mousedown", handleClickOutside); - return () => { - document.removeEventListener("mousedown", handleClickOutside); - }; - }, [wrapperRef]); - - useEffect(() => { - if (!isModalOpen) { - const startDate = selectionRange?.startDate; - const endDate = selectionRange?.endDate; - const interval = getDuration(selectionRange?.startDate, selectionRange?.endDate); - const title = `${format(selectionRange?.startDate, "MMM d, yyyy")} - ${format(selectionRange?.endDate, "MMM d, yyyy")}`; - onFilterChange({ range: { startDate, endDate, interval, title }, requestDate: { startDate, endDate, interval, title } }); - } - }, [selectionRange, isModalOpen]); - - const staticRanges = useMemo(() => { - return createStaticRanges([ - { - label: t("DSS_TODAY"), - range: () => ({ - startDate: startOfToday(new Date()), - endDate: endOfToday(new Date()), - }), - }, - { - label: t("DSS_YESTERDAY"), - range: () => ({ - startDate: startOfYesterday(new Date()), - endDate: subSeconds(endOfYesterday(new Date()), 1), - }), - }, - { - label: t("DSS_THIS_WEEK"), - range: () => ({ - startDate: startOfWeek(new Date()), - endDate: endOfToday(new Date()), - }), - }, - { - label: t("DSS_THIS_MONTH"), - range: () => ({ - startDate: startOfMonth(new Date()), - endDate: endOfToday(new Date()), - // endDate: subSeconds(endOfMonth(new Date()), 1), - }), - }, - { - label: t("DSS_THIS_QUARTER"), - range: () => ({ - startDate: startOfQuarter(new Date()), - endDate: subSeconds(endOfToday(new Date()), 1), - // endDate: subSeconds(endOfQuarter(new Date()), 1), - }), - }, - { - label: t("DSS_PREVIOUS_YEAR"), - range: () => { - if (new Date().getMonth() < 3) { - return { - startDate: subYears(addMonths(startOfYear(new Date()), 3), 2), - endDate: subSeconds(subYears(addMonths(endOfYear(new Date()), 3), 2), 1), - }; - } else { - return { - startDate: subYears(addMonths(startOfYear(new Date()), 3), 1), - endDate: subSeconds(subYears(addMonths(endOfYear(new Date()), 3), 1), 1), - }; - } - }, - }, - { - label: t("DSS_THIS_YEAR"), - range: () => { - return { - startDate: Digit.Utils.dss.getDefaultFinacialYear().startDate, - endDate: Digit.Utils.dss.getDefaultFinacialYear().endDate, - }; - /* - Removed Current financial thing - const currDate = new Date().getMonth(); - if (currDate < 3) { - return { - startDate: subYears(addMonths(startOfYear(new Date()), 3), 1), - endDate: subSeconds(subYears(addMonths(endOfYear(new Date()), 3), 1), 1), - }; - } else { - return { - startDate: addMonths(startOfYear(new Date()), 3), - endDate: subSeconds(addMonths(endOfYear(new Date()), 3), 1), - }; - } - */ - }, - }, - ]); - }, []); - const getDuration = (startDate, endDate) => { - let noOfDays = (new Date(endDate).getTime() - new Date(startDate).getTime()) / (1000 * 3600 * 24); - if (noOfDays > 91) { - return "month"; - } - if (noOfDays < 90 && noOfDays >= 14) { - return "week"; - } - if (noOfDays <= 14) { - return "day"; - } - }; - - const handleSelect = (ranges, e) => { - let { range1: selection } = ranges; - selection = { ...selection, endDate: endOfDay(selection?.endDate) }; - const { startDate, endDate, title, interval } = selection; - if ( - staticRanges.some((range) => { - let newRange = range.range(); - return differenceInDays(newRange.startDate, startDate) === 0 && differenceInDays(newRange.endDate, endDate) === 0; - }) - ) { - setSelectionRange(selection); - setIsModalOpen(false); - } else if (isStartDateFocused(focusedRange[1])) { - setSelectionRange(selection); - } else if (isEndDateFocused(focusedRange[1])) { - setSelectionRange({ title, interval, startDate, endDate: endDate }); - setIsModalOpen(false); - } - }; - - const handleFocusChange = (focusedRange) => { - const [rangeIndex, rangeStep] = focusedRange; - setFocusedRange(focusedRange); - }; - - const handleClose = () => { - setIsModalOpen(false); - }; - - return ( - <> -
{t(`ES_DSS_DATE_RANGE`)}
-
-
- setIsModalOpen((prevState) => !prevState)} - /> - setIsModalOpen((prevState) => !prevState)} /> -
- {isModalOpen && ( -
- -
- )} -
- - ); -}; - -export default DateRange; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/components/FilterContext.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/components/FilterContext.js deleted file mode 100644 index b74b5c963..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/components/FilterContext.js +++ /dev/null @@ -1,4 +0,0 @@ -import React from "react"; - -const FilterContext = React.createContext({}); -export default FilterContext; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/components/Filters.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/components/Filters.js deleted file mode 100644 index e65aa305d..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/components/Filters.js +++ /dev/null @@ -1,149 +0,0 @@ -import { CloseSvg, FilterIcon, MultiSelectDropdown, RefreshIcon, Dropdown } from "@egovernments/digit-ui-react-components"; -import React, { useContext, useEffect, useMemo, useState } from "react"; -import DateRange from "./DateRange"; -import FilterContext from "./FilterContext"; -import Switch from "./Switch"; - - -const Filters = ({ - t, - ulbTenants, - services, - isOpen, - closeFilters, - showDateRange = true, - showDDR = true, - showUlb = true, - showDenomination = true, - showModuleFilter = true, - isNational = false, -}) => { - const { value, setValue } = useContext(FilterContext); - - const [selected, setSelected] = useState(() => - ulbTenants?.ulb.filter((tenant) => value?.filters?.tenantId?.find((selectedTenant) => selectedTenant === tenant?.code)) - ); - - useEffect(() => { - setSelected(ulbTenants?.ulb?.filter((tenant) => value?.filters?.tenantId?.find((selectedTenant) => selectedTenant === tenant?.code))); - }, [value?.filters?.tenantId]); - - const [selectService, setSelectedService] = useState(() => - services?.filter((module) => value?.moduleLevel === module?.code) - ) - - useEffect(() => { - setSelectedService(services?.filter((module) => value?.moduleLevel === module?.code)); - }, [value?.moduleLevel]); - - const handleFilterChange = (data) => { - setValue({ ...value, ...data }); - }; - - const selectFilters = (e, data) => { - setValue({ ...value, filters: { tenantId: e.map((allPropsData) => allPropsData?.[1]?.code) } }); - }; - - const selectServicesFilters = (e, data) => { - setValue({ ...value, moduleLevel: e?.code }); - }; - - const selectDDR = (e, data) => { - const DDRsSelectedByUser = ulbTenants.ulb.filter((ulb) => { - return !!e.find((tenant) => { - return ulb.ddrKey === tenant?.[1].ddrKey; - }); - }); - setValue({ ...value, filters: { tenantId: DDRsSelectedByUser.map((allPropsData) => allPropsData?.code) } }); - }; - - const selectedDDRs = useMemo( - () => - selected - .map((ulb) => ulbTenants.ulb.filter((e) => e.code === ulb.code)[0]) - .filter((item, i, arr) => i === arr.findIndex((t) => t.ddrKey === item.ddrKey)), - [selected, ulbTenants] - ); - - const handleClear = () => { - setValue({ - denomination: "Unit", - range: Digit.Utils.dss.getInitialRange(), - }); - }; - return ( -
- closeFilters()}> - - - {isOpen && ( -
- -

{t(`DSS_FILTERS`)}

- - - -
- )} - {showDateRange && ( -
- -
- )} - {showDDR && ( -
-
{t(isNational ? "ES_DSS_STATE" : "ES_DSS_DDR")}
- x?.ddrKey?.localeCompare(y?.ddrKey))} - optionsKey="ddrKey" - onSelect={selectDDR} - selected={selectedDDRs} - defaultLabel={t(isNational ? "ES_DSS_ALL_STATE_SELECTED" : "ES_DSS_ALL_DDR_SELECTED")} - defaultUnit={t(isNational ? "ES_DSS_STATE_SELECTED" : "ES_DSS_DDR_SELECTED")} - /> -
- )} - {showUlb && ( -
-
{t("ES_DSS_ULB")}
- x?.ulbKey?.localeCompare(y?.ulbKey)) - /* Removed filter for selected ddr/state rain-5426 - ulbTenants?.ulb && ulbTenants.ulb.filter((e) => Digit.Utils.dss.checkSelected(e, selectedDDRs))?.sort((x, y) => x?.ulbKey?.localeCompare(y?.ulbKey)) - */ - } - optionsKey="ulbKey" - onSelect={selectFilters} - selected={selected} - defaultLabel={t("ES_DSS_ALL_ULB_SELECTED")} - defaultUnit={t("ES_DSS_DDR_SELECTED")} - /> -
- )} - {!isNational && showModuleFilter && ( -
-
{t("ES_DSS_SERVICES")}
- -
- )} - {showDenomination && ( -
- -
- )} -
- ); -}; - -export default Filters; \ No newline at end of file diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/components/FiltersNational.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/components/FiltersNational.js deleted file mode 100644 index b82231381..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/components/FiltersNational.js +++ /dev/null @@ -1,110 +0,0 @@ -import { CloseSvg, FilterIcon, MultiSelectDropdown, RefreshIcon } from "@egovernments/digit-ui-react-components"; -import React, { useContext, useEffect, useState } from "react"; -import DateRange from "./DateRange"; -import FilterContext from "./FilterContext"; -import Switch from "./Switch"; - - -const Filters = ({ - t, - ulbTenants, - isOpen, - closeFilters, - showDateRange = true, - showDDR = true, - showUlb = true, - showDenomination = true, - isNational = false, -}) => { - const { value, setValue } = useContext(FilterContext); - const [selected, setSelected] = useState(() => - ulbTenants?.ulb?.filter((tenant) => value?.filters?.ulb?.find((selectedTenant) => selectedTenant === tenant?.code)) - ); - const [selectedSt, setSelectedSt] = useState(() => - ulbTenants?.ddr?.filter((tenant) => value?.filters?.state?.find((selectedTenant) => selectedTenant === tenant?.code)) - ); - useEffect(() => { - setSelected(ulbTenants?.ulb?.filter((tenant) => value?.filters?.ulb?.find((selectedTenant) => selectedTenant === tenant?.code))); - setSelectedSt(ulbTenants?.ddr?.filter((tenant) => value?.filters?.state?.find((selectedTenant) => selectedTenant === tenant?.code))); - }, [value]); - - const handleFilterChange = (data) => { - setValue({ ...value, ...data }); - }; - - const selectFilters = (e, data) => { - let ulbs = e.map((allPropsData) => allPropsData?.[1]?.code); - let states = ulbTenants?.ulb.filter((ele) => ulbs.includes(ele.code)).map((e) => e.ddrKey); - let newStates = ulbTenants?.ddr.filter((ele) => states.includes(ele.ddrKey)).map((e) => e.code); - if (value?.filters?.state?.length > 0) { - value?.filters?.state.map((stt) => { - if (!newStates.includes(stt)) { - newStates.push(stt); - } - }); - } - setValue({ ...value, filters: { ...value.filters, ulb: ulbs, state: newStates } }); - }; - const selectStFilters = (e, data) => { - setValue({ ...value, filters: { ...value.filters, state: e.map((allPropsData) => allPropsData?.[1]?.code) } }); - }; - - const handleClear = () => { - setValue({ - denomination: "Unit", - range: Digit.Utils.dss.getInitialRange(), - }); - }; - return ( -
- closeFilters()}> - - - {isOpen && ( -
- -

{t(`DSS_FILTERS`)}

- - - -
- )} - {showDateRange && ( -
- -
- )} -
-
{t(isNational ? "ES_DSS_STATE" : "ES_DSS_DDR")}
- x?.ddrKey?.localeCompare(y?.ddrKey))?.map(ele=>({...ele,i18Key:`DSS_TB_${Digit.Utils.locale.getTransformedLocale(ele?.ddrKey)}`}))} - optionsKey="i18Key" - onSelect={selectStFilters} - selected={selectedSt?.map(ele=>({...ele,i18Key:`DSS_TB_${Digit.Utils.locale.getTransformedLocale(ele?.ddrKey)}`}))} - defaultLabel={t(isNational ? "ES_DSS_ALL_STATE_SELECTED" : "ES_DSS_ALL_DDR_SELECTED")} - defaultUnit={t(isNational ? "ES_DSS_STATE_SELECTED" : "ES_DSS_DDR_SELECTED")} - /> -
- -
-
{t("ES_DSS_ULB")}
- Digit.Utils.dss.checkSelected(e, selectedSt)).sort((x, y) => x?.ulbKey?.localeCompare(y?.ulbKey))?.map(ele=>({...ele,i18Key:`DSS_TB_${Digit.Utils.locale.getTransformedLocale(ele?.ulbKey)}`}))} - optionsKey="i18Key" - onSelect={selectFilters} - selected={selected?.map(ele=>({...ele,i18Key:`DSS_TB_${Digit.Utils.locale.getTransformedLocale(ele?.ulbKey)}`}))} - defaultLabel={t("ES_DSS_ALL_ULB_SELECTED")} - defaultUnit={t("ES_DSS_DDR_SELECTED")} - /> -
- - {showDenomination && ( -
- -
- )} -
- ); -}; - -export default Filters; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/components/GenericChart.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/components/GenericChart.js deleted file mode 100644 index 7df8e69bf..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/components/GenericChart.js +++ /dev/null @@ -1,145 +0,0 @@ -import { - Card, - CardCaption, - CardLabel, - DownloadIcon, - EllipsisMenu, - EmailIcon, - SearchIconSvg, - TextInput, - WhatsappIcon, -} from "@egovernments/digit-ui-react-components"; -import React, { useRef, Fragment, useState } from "react"; -import { useTranslation } from "react-i18next"; - -const SearchImg = () => { - return ; -}; - -const GenericChart = ({ - header, - subHeader, - className, - caption, - children, - showHeader = true, - showSearch = false, - showDownload = false, - onChange, - chip = [], - updateChip, - value = {}, -}) => { - const { t } = useTranslation(); - const tenantId = Digit.ULBService.getCurrentTenantId(); - const [chartData, setChartData] = useState(null); - const [chartDenomination, setChartDenomination] = useState(null); - const isMobile = window.Digit.Utils.browser.isMobile(); - const chart = useRef(); - const menuItems = [ - { - code: "image", - i18nKey: t("ES_COMMON_DOWNLOAD_IMAGE"), - icon: , - }, - { - code: "shareImage", - i18nKey: t("ES_DSS_SHARE_IMAGE"), - target: "mail", - icon: , - }, - { - code: "shareImage", - i18nKey: t("ES_DSS_SHARE_IMAGE"), - target: "whatsapp", - icon: , - }, - ]; - - function download(data) { - setTimeout(() => { - switch (data.code) { - case "pdf": - return Digit.Download.PDF(chart, t(header)); - case "image": - return Digit.Download.IndividualChartImage(chart, t(header)); - case "sharePdf": - return Digit.ShareFiles.PDF(tenantId, chart, t(header), data.target); - case "shareImage": - return Digit.ShareFiles.IndividualChartImage(tenantId, chart, t(header), data.target); - default: - return null; - } - }, 500); - } - - const handleExcelDownload = () => { - return Digit.Download.Excel(chartData, t(header)); - }; - let headerName = t(Digit.Utils.locale.getTransformedLocale(header)); - return ( - -
-
- {showHeader && ( - - - {headerName} - {chartDenomination?.toLowerCase() === "amount" && ( - ({t(`DSS_${Digit.Utils.locale.getTransformedLocale(value?.denomination)}`)}) - )} - 30 ? -120 : -60, - }} - > - {t(`TIP_${Digit.Utils.locale.getTransformedLocale(header)}`)} - - - {/* {`${t(header)}`} */} - - )} - {subHeader &&

{subHeader}

} -
-
- {chip && chip.length > 1 && } - - {showSearch && ( - } onChange={onChange} /> - )} - {showDownload && } - - {!showDownload && download(data)} />} -
-
- {caption && {caption}} - {React.cloneElement(children, { setChartData, setChartDenomination })} -
- ); -}; - -export default GenericChart; - -const Chip = (props) => { - const [state, setState] = useState(1); - return ( -
- {props.items.map((item, index) => { - return ( -
{ - props.onClick && props.onClick(item.index); - setState((prev) => prev + 1); - }} - > - {props.t(`DSS_TAB_${item?.tabName?.toUpperCase()}`)} -
- ); - })} -
- ); -}; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/components/Layout.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/components/Layout.js deleted file mode 100644 index 876a1ff27..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/components/Layout.js +++ /dev/null @@ -1,154 +0,0 @@ -import React, { useCallback, useContext, useEffect, useState } from "react"; -import { useTranslation } from "react-i18next"; -import CustomAreaChart from "./CustomAreaChart"; -import CustomBarChart from "./CustomBarChart"; -import CustomHorizontalBarChart from "./CustomHorizontalBarChart"; -import CustomPieChart from "./CustomPieChart"; -import CustomTable from "./CustomTable"; -import FilterContext from "./FilterContext"; -import GenericChart from "./GenericChart"; -import MetricChart from "./MetricChart"; -import Summary from "./Summary"; - -let index = 1; - -const showCustomLabel = (title, t) => { - switch (title) { - case "DSS_FSM_MONTHLY_WASTE_CAL": - return `${t("DSS_WASTE_RECIEVED")} ${t(`DSS_WASTE_UNIT`)}`; - default: - return ""; - } -}; - -const Layout = ({ rowData, forHome = false, services, configName }) => { - const { t } = useTranslation(); - const { value } = useContext(FilterContext); - const [searchQuery, onSearch] = useState(""); - const [chip, updateChip] = useState({}); - const moduleCode = services.filter((e) => configName?.includes(e.name))?.[0]?.code; - const renderChart = (chart, title, moduleCode) => { - switch (chart.chartType) { - case "table": - return ; - case "donut": - return ; - case "line": - return ; - case "horizontalBar": - return ( - - ); - case "bar": - return ; - default: - return null; - } - }; - - const renderVisualizer = (visualizer, key, chip, onChipChange, moduleCode = "") => { - switch (visualizer.vizType) { - case "metric-collection": - return ( - - - - ); - case "chart": - if ( - value?.filters?.tenantId?.length === 0 && - (visualizer?.charts?.[0].id === "fsmTopDsoByPerformance" || visualizer?.charts?.[0].id === "fsmBottomDsoByPerformance") - ) - return null; - return ( - ele.active)?.[0]?.index : 0].chartType === "line" - ? `${visualizer.name}` - : visualizer.name - } - chip={chip} - updateChip={onChipChange} - showDownload={visualizer?.charts?.[0].chartType === "table"} - showSearch={visualizer?.charts?.[0].chartType === "table"} - className={visualizer?.charts?.[0].chartType === "table" && "fullWidth"} - onChange={(e) => onSearch(e.target.value)} - > - {/* {visualizer.charts.map((chart, key) => renderChart(chart, key))} */} - {renderChart(visualizer?.charts?.[chip ? chip.filter((ele) => ele.active)?.[0]?.index : 0], visualizer.name, moduleCode)} - - ); - case "performing-metric": - if ( - value?.filters?.tenantId?.length > 0 && - (visualizer?.charts?.[0].id === "fsmTopUlbByPerformance" || visualizer?.charts?.[0].id === "fsmBottomUlbByPerformance") - ) - return null; - return ( - - ele.active)?.[0]?.index : 0]} - fillColor={index++ % 2 ? "RED" : "GREEN"} - title={visualizer.name} - showDrillDown={true} - /> - - ); - case "collection": - case "module": - return ; - default: - return null; - } - }; - useEffect(() => { - let chipData = {}; - rowData.vizArray.map((chart) => { - if (chart?.charts?.length > 1) { - chipData[chart.name] = chart.charts.map((ele, ind) => ({ tabName: ele.tabName, active: ind === 0, index: ind })); - } - }); - updateChip({ ...chipData }); - }, []); - return ( -
- {rowData.vizArray.map( - useCallback( - (chart, key) => { - let chipData = chip?.[chart.name]; - let onChipChange = (index) => - updateChip((oldState) => { - let prevChip = oldState[chart.name]; - oldState[chart.name] = prevChip.map((ele) => ({ ...ele, active: ele.index === index })); - return { ...oldState }; - }); - return renderVisualizer(chart, key, chipData, onChipChange, moduleCode); - }, - [renderVisualizer, chip] - ) - )} -
- ); -}; - -export default Layout; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/components/MapChart.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/components/MapChart.js deleted file mode 100644 index c37b6a343..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/components/MapChart.js +++ /dev/null @@ -1,229 +0,0 @@ -import React, { useState, Fragment } from "react"; -import { ComposableMap, Geographies, Geography } from "react-simple-maps"; -import ReactTooltip from "react-tooltip"; -import { useTranslation } from "react-i18next"; -import { get } from "lodash"; -import FilterContext from "./FilterContext"; -import { endOfMonth, getTime, startOfMonth } from "date-fns"; -import { Loader } from "@egovernments/digit-ui-react-components" -import { ResponsiveContainer } from "recharts"; -import { format } from "date-fns"; - - - -const PROJECTION_CONFIG = { scale: 320, center: [85.9629, 22.5937] }; - -// Red Variants -const COLOR_RANGE = ["#54D140", "#298CFF", "#F47738", "#D1D1D1"]; - -const STATUS = ["Live", "UnderImplementation", "OnBoarded", "None"]; -const DEFAULT_COLOR = "#D1D1D1"; -const key = "DSS_FILTERS"; - - -const getInitialRange = () => { - const data = Digit.SessionStorage.get(key); - const startDate = data?.range?.startDate ? new Date(data?.range?.startDate) : Digit.Utils.dss.getDefaultFinacialYear().startDate; - const endDate = data?.range?.endDate ? new Date(data?.range?.endDate) : Digit.Utils.dss.getDefaultFinacialYear().endDate; - const title = `${format(startDate, "MMM d, yyyy")} - ${format(endDate, "MMM d, yyyy")}`; - const interval = Digit.Utils.dss.getDuration(startDate, endDate); - const denomination = data?.denomination || "Lac"; - const tenantId = data?.filters?.tenantId || []; - return { startDate, endDate, title, interval, denomination, tenantId }; -}; - -const getColor = (current) => { - const status = current && current.status; - if (current) { - switch (status) { - case "Live": - return COLOR_RANGE[0]; - case "OnBoarded": - return COLOR_RANGE[1]; - case "UnderImplementation": - return COLOR_RANGE[2]; - case "None": - return DEFAULT_COLOR; - default: - return DEFAULT_COLOR; - } - } - return DEFAULT_COLOR; -}; - -const geographyStyle = { - default: { - outline: "none", - stroke: "white", - strokeWidth: "0.5", - strokeOpacity: "0.9", - }, - hover: { - outline: "none", - stroke: "white", - strokeWidth: "0.5", - strokeOpacity: "0.9", - }, - pressed: { - outline: "none", - stroke: "white", - strokeWidth: "0.5", - strokeOpacity: "0.9", - }, -}; - -const MapChart = ({ - data, - drillDown = false, - setselectedState, - setdrilldownId, - settotalCount, - setliveCount -}) => { - - const { t } = useTranslation(); - const { id } = data; - const tenantId = Digit.ULBService.getCurrentTenantId(); - const [tooltipContent, settooltipContent] = useState(""); - const { startDate, endDate, interval, } = getInitialRange(); - const requestDate = { - startDate: startDate.getTime(), - endDate: endDate.getTime(), - interval: interval, - title: "home", - }; - - const { data: topoJSON, isLoading: isLoadingNAT } = Digit.Hooks.dss.useMDMS(Digit.ULBService.getStateId(), "dss-dashboard", ["dashboard-config"], { - select: (data) => { - const topoJson = data?.["dss-dashboard"]?.["dashboard-config"]?.[0]?.["MAP_CONFIG"]?.[0] || {}; - return topoJson; - }, - enabled: true, - }); - - const mapData = get(topoJSON, "objects.india.geometries", [])?.map( - (ee) => { - return { state: ee.properties.name, value: 0, id: ee.id }; - } - ); - let DataObj = - mapData?.reduce((acc, curr) => { - acc[curr.state] = { ...curr }; - return { ...acc }; - }, {}) || {}; - - const { isLoading, data: response } = Digit.Hooks.dss.useGetChart({ - key: id, - type: "metric", - tenantId, - requestDate: requestDate, - }); - - let data1 = !isLoading ? response?.responseData?.data?.filter((dat) => - { - let totalCount = dat.plots[3].value; - let liveCount = dat.plots[4].value; - let live = dat.plots[4].strValue > 0 ? true : false; - DataObj[dat.headerName] = { - ...DataObj?.[dat.headerName], - status: dat.plots[2].strValue, - value: live ? liveCount : totalCount, - live, - totalCount, - liveCount, - }; - }) : null; - - - if (!data1) { - return
Loading...
; - } - - - const onMouseEnter = (geo, current = { value: "0" }, event) => { - return settooltipContent(`${t(`${geo.properties.name}`)}: ${current.value ? Number(current.value).toFixed() + " ULBs" : "NA"} `); - } - const onMouseClick = (geo, current = { value: "NA" }, event) => { - /* to make the map clickable only on the live states */ - if (current && current.value > 0 && current.status === "Live") - setselectedState(current.state); - setdrilldownId(response?.responseData?.drillDownChartId); - settotalCount(current.totalCount); - setliveCount(current.liveCount); - } - const onMouseLeave = (geo, current = { value: "NA" }, event) => { - settooltipContent(""); - } - - - if (isLoading || isLoadingNAT) { - return - } - - return ( - -
- {tooltipContent} - - - {({ geographies }) => - geographies.map((geo) => { - const current = Object.values(DataObj).find( - (s) => s.id === geo.id - ); - return ( - - onMouseEnter(geo, current, event) - } - onClick={(event) => - onMouseClick(geo, current, event) - } - onMouseLeave={(event) => - onMouseLeave(geo, current, event) - } - /> - ); - }) - } - - - - {STATUS.map((sta) => { - return ( - - - - {t(`DSS_${sta.toUpperCase()}`)} - - - ); - })} - -
-
); -} - -export default MapChart; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/components/MetricChart.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/components/MetricChart.js deleted file mode 100644 index c7ec498ef..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/components/MetricChart.js +++ /dev/null @@ -1,166 +0,0 @@ -import { DownwardArrow, Rating, UpwardArrow } from "@egovernments/digit-ui-react-components"; -import React, { Fragment, useContext, useEffect, useState } from "react"; -import { useTranslation } from "react-i18next"; -import FilterContext from "./FilterContext"; -//import {ReactComponent as Arrow_Downward} from "../images/Arrow_Downward.svg"; -import { ArrowDownwardElement } from "./ArrowDownward"; -import { ArrowUpwardElement } from "./ArrowUpward"; - -const MetricData = ({ t, data, code, indexValuesWithStar }) => { - const { value } = useContext(FilterContext); - const insight = data?.insight?.value?.replace(/[+-]/g, "")?.split("%"); - return ( -
-

- {indexValuesWithStar?.includes(code) ? ( - - ) : ( - `${Digit.Utils.dss.formatter(data?.headerValue, data?.headerSymbol, value?.denomination, true, t)} ${ - code === "totalSludgeTreated" ? t(`DSS_KL`) : "" - }` - )} -

- {data?.insight && ( -
- {data?.insight?.indicator === "upper_green" ? ArrowUpwardElement("10px") : ArrowDownwardElement("10px")} -

- {insight?.[0] && - `${Digit.Utils.dss.formatter(insight[0], "number", value?.denomination, true, t)}% ${t( - Digit.Utils.locale.getTransformedLocale("DSS" + insight?.[1] || "") - )}`} -

-
- )} -
- ); -}; - -const MetricChartRow = ({ data, setChartDenomination, index, moduleCode, indexValuesWithStar }) => { - const { id, chartType } = data; - const tenantId = Digit.ULBService.getCurrentTenantId(); - const { t } = useTranslation(); - const { value } = useContext(FilterContext); - const [showDate, setShowDate] = useState({}); - const isMobile = window.Digit.Utils.browser.isMobile(); - const { isLoading, data: response } = Digit.Hooks.dss.useGetChart({ - key: id, - type: chartType, - tenantId, - requestDate: { ...value?.requestDate, startDate: value?.range?.startDate?.getTime(), endDate: value?.range?.endDate?.getTime() }, - filters: value?.filters, - moduleLevel: value?.moduleLevel || moduleCode, - }); - - useEffect(() => { - if (response) { - let plots = response?.responseData?.data?.[0]?.plots || null; - if (plots && Array.isArray(plots) && plots.length > 0 && plots?.every((e) => e.value)) - setShowDate((oldstate) => ({ - ...oldstate, - [id]: { - todaysDate: Digit.DateUtils.ConvertEpochToDate(plots?.[0]?.value), - lastUpdatedTime: Digit.DateUtils.ConvertEpochToTimeInHours(plots?.[1]?.value), - }, - })); - index === 0 && setChartDenomination(response?.responseData?.data?.[0]?.headerSymbol); - } else { - setShowDate({}); - } - }, [response]); - - if (isLoading) { - return false; - } - - if (!response) { - return ( -
-
- {t(data.name)} - - {t(`TIP_${data.name}`)} - -
- {t("DSS_NO_DATA")} -
- ); - } - let name = t(data?.name) || ""; - - const getWidth = (data) => { - if (isMobile) return "auto"; - else return t(`TIP_${data.name}`).length < 50 ? "fit-content" : 400; - // if (isMobile) return t(`TIP_${data.name}`).length < 50 ? "fit-content" : 300; - // else return t(`TIP_${data.name}`).length < 50 ? "fit-content" : 400; - }; - - const getHeight = (data) => { - if (isMobile) return "auto"; - else return 50; - // if (isMobile) return t(`TIP_${data.name}`).length < 50 ? 50 : "auto"; - // else return 50; - }; - - return ( -
-
- {typeof name == "string" && name} - {Array.isArray(name) && name?.filter((ele) => ele)?.map((ele) =>
{ele}
)} - - {" "} - {showDate?.[id]?.todaysDate} - - - {t(`TIP_${data.name}`)} - {showDate?.[id]?.lastUpdatedTime} - -
- - {/*
{`${displaySymbol(response.headerSymbol)} ${response.headerValue}`}
*/} -
- ); -}; - -const MetricChart = ({ data, setChartDenomination, moduleCode }) => { - const { charts } = data; - const indexValuesWithStar = [ - "citizenAvgRating", - "nssOverviewCitizenFeedbackScore", - "nssPtCitizenFeedbackScore", - "sdssPtCitizenFeedbackScore", - "sdssOverviewCitizenFeedbackScore", - ]; - return ( - <> - - {charts.map((chart, index) => ( - - ))} - - - ); -}; - -export default MetricChart; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/components/NoData.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/components/NoData.js deleted file mode 100644 index 958243d6d..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/components/NoData.js +++ /dev/null @@ -1,8 +0,0 @@ -import React from "react"; - -const NoData = ({ t }) => ( -
-

{t("DSS_NO_DATA")}

-
-); -export default NoData; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/components/Summary.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/components/Summary.js deleted file mode 100644 index d70a15eda..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/components/Summary.js +++ /dev/null @@ -1,115 +0,0 @@ -import { Card, Loader } from "@egovernments/digit-ui-react-components"; -import React, { useContext, useState } from "react"; -import { useTranslation } from "react-i18next"; -import { ArrowDownwardElement } from "./ArrowDownward"; -import { ArrowUpwardElement } from "./ArrowUpward"; -import FilterContext from "./FilterContext"; - -const MetricData = ({ t, data }) => { - const { value } = useContext(FilterContext); - const insight = data?.insight?.value?.replace(/[+-]/g, "")?.split("%"); - return ( -
-

- {`${Digit.Utils.dss.formatter(data?.headerValue, data?.headerSymbol, value?.denomination, true, t)}`} -

- {data?.insight && ( -
- {data?.insight?.indicator === "upper_green" ? ArrowUpwardElement("10px") : ArrowDownwardElement("10px")} -

- {insight?.[0] && - `${Digit.Utils.dss.formatter(insight[0], "number", value?.denomination, true, t)}% ${t( - Digit.Utils.locale.getTransformedLocale("DSS" + insight?.[1] || "") - )}`} -

-
- )} -
- ); -}; - -const Chart = ({ data }) => { - const { id, chartType } = data; - const tenantId = Digit.ULBService.getCurrentTenantId(); - const { t } = useTranslation(); - const { value } = useContext(FilterContext); - const [showDate, setShowDate] = useState({}); - const isMobile = window.Digit.Utils.browser.isMobile(); - const { isLoading, data: response } = Digit.Hooks.dss.useGetChart({ - key: id, - type: chartType, - tenantId, - requestDate: { ...value?.requestDate, startDate: value?.range?.startDate?.getTime(), endDate: value?.range?.endDate?.getTime() }, - filters: value?.filters, - }); - if (isLoading) { - return ; - } - let name = t(data?.name) || ""; - - const getWidth = (data) => { - if (isMobile) return "auto"; - else return t(`TIP_${data.name}`).length < 50 ? "fit-content" : 400; - }; - - const getHeight = (data) => { - if (isMobile) return "auto"; - else return 50; - }; - return ( -
-
- {typeof name == "string" && name} - {Array.isArray(name) && name?.filter((ele) => ele)?.map((ele) =>
{ele}
)} - - {" "} - {showDate?.[id]?.todaysDate} - - - {t(`TIP_${data.name}`)} - {showDate?.[id]?.lastUpdatedTime} - -
- -
- ); -}; -const Summary = ({ data }) => { - const { t } = useTranslation(); - const { value } = useContext(FilterContext); - return ( - -
-
-
-

- {t(data?.name)}{" "} - { ({t(`DSS_${Digit.Utils.locale.getTransformedLocale(value?.denomination)}`)})} -

-
-
- {data.charts.map((chart, key) => ( - - ))} -
-
-
-
- ); -}; - -export default Summary; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/components/Switch.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/components/Switch.js deleted file mode 100644 index ac75885ae..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/components/Switch.js +++ /dev/null @@ -1,30 +0,0 @@ -import React, { useContext ,Fragment} from "react"; -import FilterContext from "./FilterContext"; - -const denominations = ["Cr", "Lac", "Unit"]; - -const Switch = ({ onSelect, t }) => { - const { value } = useContext(FilterContext); - return ( - <> -
{t(`ES_DSS_DENOMINATION`)}
-
- {denominations.map((label, idx) => ( -
- onSelect({ denomination: label })} - /> - -
- ))} -
- - ); -}; - -export default Switch; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/components/common/Icon.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/components/common/Icon.js deleted file mode 100644 index 7cf22abfb..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/components/common/Icon.js +++ /dev/null @@ -1,77 +0,0 @@ -import React from "react"; -import { ReactComponent as PropertyTaxIcon } from '../../images/property-tax.svg' -import { ReactComponent as DashBoardIcon } from '../../images/dashboards.svg' -import { ReactComponent as ComplaintsIcon } from '../../images/complaints.svg' -import { ReactComponent as TradeIcon } from '../../images/trade-license.svg' -import { ReactComponent as WaterSewerage } from '../../images/water_sewerage.svg' -import { ReactComponent as FSM } from '../../images/fsm.svg' -import { ReactComponent as FireNoc } from '../../images/firenocdashboard.svg' -import { ReactComponent as Mcollect } from '../../images/mcollect.svg' -import { ReactComponent as OBPS } from '../../images/obps.svg' -import { ReactComponent as Tradelic } from '../../images/tradeLic_nurt.svg' -import { ReactComponent as BuildingPermission } from '../../images/building_permission.svg' -import { ReactComponent as BirthDeath } from '../../images/birth_death.svg' -import { ReactComponent as Finance } from '../../images/finance.svg' - -//import SVG from 'react-inlinesvg'; - -export function Icon(type, iconColor) -{ - switch (type.toLowerCase()) { - case 'overview': - case 'dss_overview': - return - case 'fsm': - case 'dss_fsm': - return
- case 'obps dashboard': - case 'obps dashboard': - return
- case 'online building plan approval system': - case 'dss_obps_overview': - return
- case 'nurt_overview': - return - case 'nurt_project_staus': - return - case 'nurt_property_tax': - case 'dss_property_tax': - return
- case 'nurt_trade_licence': - case 'dss_trade_licence': - return
- case 'nurt_complains': - case 'dss_complains': - case 'public grievances & redressal': - case 'dss_pgr_overview': - return
- case 'nurt_water_sewerage': - case 'dss_water_sewerage': - return
- case 'dss_building_permission': - return
- case 'nurt_firenoc': - case 'fire noc dashboard': - case 'fire noc': - case 'dss_firenoc_overview': - return
- case 'nurt_mcollect': - case 'dss_mcollect': - return
- case 'dss_finance': - return
- case 'nurt_live_active_ulbs': - return - case 'dss_birth_death': - case 'nss_birth_death': - case "nurt_birth": - case "nurt_death": - case "nurt_bnd": - return
- default: - return
- - } -}; - -export default Icon; \ No newline at end of file diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/components/india.topo.json b/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/components/india.topo.json deleted file mode 100644 index 7f384c760..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/components/india.topo.json +++ /dev/null @@ -1 +0,0 @@ -{"type":"Topology","objects":{"india":{"type":"GeometryCollection","geometries":[{"type":"Polygon","properties":{"name":null},"id":"-99","arcs":[[0]]},{"type":"MultiPolygon","id":"AN","properties":{"name":"Andaman & Nicobar Island"},"arcs":[[[0]],[[1]],[[2]],[[3]],[[4]],[[5]],[[6]],[[7]],[[8]],[[9]],[[10]],[[11]],[[12]]]},{"type":"MultiPolygon","id":"AP","properties":{"name":"Andhra Pradesh"},"arcs":[[[13]],[[14,15,16,17,18]]]},{"type":"Polygon","id":"AR","properties":{"name":"Arunanchal Pradesh"},"arcs":[[19,20,21]]},{"type":"Polygon","id":"AS","properties":{"name":"Assam"},"arcs":[[22,23,24,25,26,27,28,29,30,-21]]},{"type":"Polygon","id":"BR","properties":{"name":"Bihar"},"arcs":[[31,32,33,34]]},{"type":"Polygon","id":"CT","properties":{"name":"Chhattisgarh"},"arcs":[[35,36,37,38,39,40]]},{"type":"MultiPolygon","id":"PY","properties":{"name":"Puducherry"},"arcs":[[[41,42]],[[-44]],[[44]],[[45,46]],[[47]],[[48]],[[49]],[[50]],[[51,52],[53]],[[54,55]]]},{"type":"Polygon","id":"PB","properties":{"name":"Punjab"},"arcs":[[56,57,58,59,60,61,62]]},{"type":"Polygon","id":"RJ","properties":{"name":"Rajasthan"},"arcs":[[63,64,65,66,67,-60]]},{"type":"Polygon","id":"SK","properties":{"name":"Sikkim"},"arcs":[[68,69]]},{"type":"MultiPolygon","id":"TN","properties":{"name":"Tamil Nadu"},"arcs":[[[-54]],[[70,-47,71,-43,72,73,74,-16,75,-55,76,-53],[-49],[-51],[-50],[-48],[-45]]]},{"type":"Polygon","id":"CH","properties":{"name":"Chandigarh"},"arcs":[[77,-58]]},{"type":"Polygon","id":"TS","properties":{"name":"Telangana"},"arcs":[[-37,78,-18,79,80]]},{"type":"Polygon","id":"TR","properties":{"name":"Tripura"},"arcs":[[-26,81,82]]},{"type":"Polygon","id":"UP","properties":{"name":"Uttar Pradesh"},"arcs":[[83,-34,84,-40,85,-65,86,87,88,89,90]]},{"type":"Polygon","id":"UK","properties":{"name":"Uttarakhand"},"arcs":[[-91,91,92]]},{"type":"MultiPolygon","id":"WB","properties":{"name":"West Bengal"},"arcs":[[[93]],[[94]],[[95]],[[96]],[[97]],[[98]],[[99]],[[100]],[[101]],[[102]],[[103]],[[104]],[[105]],[[106]],[[107,-30,108,109,110,-32,111,-69]]]},{"type":"Polygon","id":"OD","properties":{"name":"Odisha"},"arcs":[[-110,112,-19,-79,-36,113]]},{"type":"Polygon","id":"DN","properties":{"name":"Dadara & Nagar Havelli"},"arcs":[[114,115]]},{"type":"Polygon","id":"DD","properties":{"name":"Daman & Diu"},"arcs":[[116,117]]},{"type":"Polygon","id":"GA","properties":{"name":"Goa"},"arcs":[[118,119,120]]},{"type":"MultiPolygon","id":"GJ","properties":{"name":"Gujarat"},"arcs":[[[121]],[[122]],[[123]],[[124]],[[125]],[[-67,126,127,-116,128,129,-118,130]]]},{"type":"Polygon","id":"HR","properties":{"name":"Haryana"},"arcs":[[-89,131,-87,-64,-59,-78,-57,132]]},{"type":"Polygon","id":"HP","properties":{"name":"Himachal Pradesh"},"arcs":[[133,-92,-90,-133,-63,134]]},{"type":"Polygon","id":"JK","properties":{"name":"Jammu & Kashmir"},"arcs":[[-135,-62,135]]},{"type":"Polygon","id":"JH","properties":{"name":"Jharkhand"},"arcs":[[-111,-114,-41,-85,-33]]},{"type":"Polygon","id":"KA","properties":{"name":"Karnataka"},"arcs":[[-80,-17,-75,136,137,-119,138]]},{"type":"Polygon","id":"KL","properties":{"name":"Kerala"},"arcs":[[-74,139,-137],[43]]},{"type":"MultiPolygon","id":"LD","properties":{"name":"Lakshadweep"},"arcs":[[[140]],[[141]]]},{"type":"Polygon","id":"MP","properties":{"name":"Madhya Pradesh"},"arcs":[[-39,142,-127,-66,-86]]},{"type":"Polygon","id":"MH","properties":{"name":"Maharashtra"},"arcs":[[-38,-81,-139,-121,143,-129,-115,-128,-143]]},{"type":"Polygon","id":"MN","properties":{"name":"Manipur"},"arcs":[[144,145,-24,146]]},{"type":"Polygon","id":"ML","properties":{"name":"Meghalaya"},"arcs":[[147,-28]]},{"type":"Polygon","id":"MZ","properties":{"name":"Mizoram"},"arcs":[[-146,148,-82,-25]]},{"type":"Polygon","id":"NL","properties":{"name":"Nagaland"},"arcs":[[149,-147,-23,-20]]},{"type":"Polygon","id":"DL","properties":{"name":"NCT of Delhi"},"arcs":[[-88,-132]]}]},"places":{"type":"GeometryCollection","geometries":[{"type":"Point","properties":{"name":"Delhi"},"coordinates":[3093,7227]},{"type":"Point","properties":{"name":"Hyderabad"},"coordinates":[3521,3510]},{"type":"Point","properties":{"name":"Pune"},"coordinates":[1936,3883]},{"type":"Point","properties":{"name":"Nagpur"},"coordinates":[3730,4754]},{"type":"Point","properties":{"name":"Jaipur"},"coordinates":[2607,6650]},{"type":"Point","properties":{"name":"Kanpur"},"coordinates":[4151,6498]},{"type":"Point","properties":{"name":"Patna"},"coordinates":[5798,6223]},{"type":"Point","properties":{"name":"Chennai"},"coordinates":[4137,2089]},{"type":"Point","properties":{"name":"Ahmedabad"},"coordinates":[1501,5367]},{"type":"Point","properties":{"name":"Surat"},"coordinates":[1590,4764]},{"type":"Point","properties":{"name":"New Delhi"},"coordinates":[3083,7203]},{"type":"Point","properties":{"name":"Bangalore"},"coordinates":[3206,2050]},{"type":"Point","properties":{"name":"Mumbai"},"coordinates":[1596,4044]},{"type":"Point","properties":{"name":"Kolkata"},"coordinates":[6892,5191]}]}},"arcs":[[[8784,159],[11,-12],[2,-38],[15,-26],[-15,-69],[-18,-14],[-21,36],[-9,32],[-24,17],[-7,37],[12,21],[16,0],[38,16]],[[8737,226],[15,-22],[-11,-22],[-33,-13],[2,33],[25,8],[2,16]],[[8624,417],[5,-17],[22,-12],[-29,-17],[-23,26],[25,20]],[[8673,486],[-5,-30],[14,-22],[-23,-7],[-10,41],[24,18]],[[8423,819],[12,-25],[-10,-15],[-23,1],[-3,32],[24,7]],[[8328,1365],[14,-11],[13,-54],[-20,-28],[10,-13],[-23,-21],[-28,12],[1,22],[-13,18],[-1,31],[47,44]],[[8370,1567],[15,-24],[2,-21],[-32,-8],[5,36],[10,17]],[[8484,1743],[27,-46],[-40,27],[13,19]],[[8389,1808],[21,-21],[-7,-30],[17,-72],[-11,-49],[-1,-36],[-8,-30],[-28,1],[-19,49],[-13,18],[-1,31],[-13,10],[17,32],[17,4],[11,72],[18,21]],[[8433,1829],[16,-1],[1,-31],[-17,-13],[-11,-27],[-18,5],[10,43],[19,24]],[[8458,2031],[10,-10],[14,-48],[-4,-48],[7,-17],[-12,-31],[-14,-11],[-24,-37],[-45,10],[0,88],[13,13],[-5,62],[34,23],[26,6]],[[8389,2056],[8,-5],[0,-34],[-19,3],[11,36]],[[8503,2247],[1,-48],[13,-26],[-32,1],[28,-32],[-9,-25],[1,-31],[-10,-17],[-19,-1],[-4,-18],[-49,-19],[-3,33],[14,64],[0,39],[15,47],[54,33]],[[4519,3158],[-40,-18],[-3,11],[43,7]],[[5675,4064],[-27,-37],[-37,-33],[-9,-27],[-22,-17],[-44,-52],[-18,-8],[-10,-19],[-50,-48],[-6,-16],[-76,-34],[-9,-9],[-57,-23],[-47,-33],[-4,-13],[-27,-17],[-20,-34],[-68,-72],[-60,-24],[-17,-15],[-82,-34],[-66,-37],[-40,-30],[-49,-46],[-18,-42],[40,-23],[-5,-34],[-18,-51],[-40,-22],[-73,-35],[-39,-9],[-44,-20],[-26,10],[-42,4],[-42,-5],[-8,8],[-42,-14],[2,-17],[-14,-13],[-24,-83],[-37,-26],[-17,-24],[5,-16],[-17,-13],[-42,-10],[-12,5],[4,29],[-29,26],[-75,-10],[-8,-10],[-49,-25],[-36,-45],[-15,-50],[-22,-27],[-18,-41],[3,-13],[-14,-55],[23,-105],[28,-55],[-8,-72],[-15,-54],[6,-42],[35,-88],[-4,-35],[11,-40]],[[4134,2244],[-15,-26],[-71,6],[-15,-12],[-12,-38],[-43,-11],[-44,-22],[-1,15],[-36,-11],[-10,20],[-40,4],[1,-45],[-25,-7],[-17,-16],[-25,6],[-25,-42],[-59,23],[-12,-5],[-50,4],[-62,-33],[2,-20],[-25,-72],[-32,-11],[1,-15],[-32,-2],[-48,26],[-2,21]],[[3437,1981],[6,31],[22,0],[14,26],[39,12],[-2,23],[18,7],[1,22],[15,23],[5,27],[-23,2],[-50,25],[6,12],[3,63],[-45,-3],[-36,25],[-22,0],[13,42],[-4,25],[-23,11],[-44,3],[-17,10],[-12,-22],[-34,-19],[-39,-14],[-30,-18],[-22,12],[-13,28],[-41,10],[-23,12],[-26,-26],[1,-20],[-45,5],[-23,13],[23,38],[-14,19],[-18,43],[-18,15],[45,5],[1,-40],[33,-3],[5,-15],[49,3],[12,6],[12,-42],[25,-1],[-13,37],[-15,16],[20,16],[-2,20],[41,3],[-4,29],[-36,22],[-12,-19],[-27,2],[0,18],[-29,-6],[-15,8],[-35,-32],[-39,0],[2,21],[-15,5],[-6,23],[31,29],[-37,-1],[-22,17],[-14,23],[4,26],[21,36],[11,59],[-35,2],[12,40],[27,-21],[31,-5],[49,6],[19,46],[-6,38],[-38,24],[-3,25],[-1,64],[19,8],[-12,24],[10,61],[23,10],[37,6],[60,-5],[29,-7]],[[3191,3024],[60,-16],[39,-2],[31,10],[73,-23],[22,7],[5,17],[22,12],[8,33],[17,-2],[30,17],[53,-8],[27,11],[35,-23],[33,22],[29,12],[-4,22],[38,18],[54,-9],[16,11],[-4,37],[6,52],[12,13],[55,7],[25,16],[51,11],[44,22],[30,-10],[27,-22],[36,37],[8,23],[-27,16],[19,34],[13,-1],[38,18],[23,-2],[13,-18],[6,-28],[34,-9],[13,-18],[37,-9],[-3,21],[10,33],[-18,8],[-31,-2],[2,24],[17,28],[22,12],[42,-23],[48,-10],[12,4],[4,32],[12,18],[27,-7],[61,17],[10,32],[26,-3],[19,23],[21,-11],[20,9],[17,22],[4,46],[41,57],[17,2],[41,25],[-12,16]],[[4647,3675],[15,14],[46,16],[30,24],[48,-5],[26,-20],[6,18],[27,4],[-1,56],[9,63],[41,35],[15,-4],[4,-31],[22,-14],[-4,-36],[61,25],[11,35],[61,-27],[31,12],[-14,57],[20,30],[104,71],[-26,31],[7,13],[48,-2],[45,31],[5,16],[36,-55],[22,11],[28,-63],[61,-11],[14,-13],[43,14],[40,2],[28,48],[33,33],[29,-6],[22,34],[35,-17]],[[9259,6570],[-18,59],[15,7],[-11,52]],[[9245,6688],[18,-4],[40,27],[32,7],[0,25],[26,20],[19,-14],[128,29],[17,19],[-14,20],[-31,3],[0,36],[-29,18],[-13,41],[22,26],[36,26],[17,26],[-52,3],[-75,-6],[-31,-25],[-45,-13],[-23,9],[-148,-42],[-49,-26],[-20,0],[-63,-28],[-27,8],[-18,-8],[-27,6],[-10,-24],[-35,-15],[-33,-38],[-21,-9],[-66,-60],[10,-25],[-40,-19],[-15,-16],[-71,-10],[-41,8],[-113,-16],[-34,16],[-16,15],[-35,8],[-38,2],[-4,-17],[-21,-8],[-48,-1],[-86,-23],[-29,1]],[[8189,6640],[-2,38],[-26,23],[15,66],[-5,40],[-13,19],[-57,9],[-26,-6],[-41,6],[-32,33],[-1,16],[23,24],[1,32],[14,18],[27,-18],[27,2],[18,-28],[36,15],[24,-3],[35,25],[34,9],[17,-28],[37,15],[50,-1],[15,19],[22,7],[24,30],[-26,24],[6,18],[35,22],[39,7],[43,31],[35,9],[24,-3],[13,27],[-14,9],[29,26],[20,42],[55,17],[39,-10],[42,11],[15,-6],[24,12],[31,-10],[20,55],[55,37],[21,43],[25,21],[21,1],[28,25],[43,0],[25,40],[47,-32],[10,-29],[26,7],[45,-5],[40,-18],[44,-2],[0,-14],[70,-10],[31,59],[14,0],[66,46],[35,12],[26,-3],[42,26],[24,-21],[11,-30],[18,-21],[54,4],[-16,-28],[-44,-11],[-23,-28],[26,-41],[41,34],[31,1],[29,-24],[5,-26],[24,-29],[-7,-25],[-40,-12],[8,-14],[-32,-27],[-26,-10],[15,-17],[-35,-21],[36,-7],[47,7],[31,16],[22,0],[32,-17],[6,-13],[42,3],[34,-23],[19,14],[25,-1],[15,-17],[19,-1],[51,-25],[-15,-21],[23,-42],[-7,-39],[-42,-2],[-33,-29],[-49,-27],[-9,-23],[-32,-17],[14,-30],[-9,-22],[18,-16],[13,-28],[31,-27],[27,-37],[-38,-8],[-26,18],[-41,11],[7,23],[-28,28],[-63,7],[-30,-25],[-34,4],[-68,-8],[-68,-29],[-27,-42],[-27,-16],[-21,1],[-19,-20],[-2,-18],[-40,-10],[-9,-19],[-23,6],[-42,-47],[-41,-13],[-22,10]],[[9245,6688],[-37,-30],[-35,-11],[-34,5],[-29,-42],[-39,-24],[-49,-7],[-46,-31],[-5,-29],[-35,-16],[-4,27],[-33,-34],[-7,-33],[-20,-11],[-32,-46],[-20,-59],[9,-27],[-44,-21],[-25,-5],[2,37],[-34,-16],[7,-19],[-46,-32],[-31,-36],[-22,-8],[-29,-24],[42,-35],[6,-44]],[[8655,6117],[-24,-15],[-17,-27],[-6,-29],[-31,-30],[2,-28],[-20,-37],[-28,-1],[-3,-18],[-6,-33],[4,-22],[-15,-12],[-7,-38],[-11,-9]],[[8493,5818],[-58,-1],[-23,40],[-25,-54],[-22,-7],[-5,-27],[-21,-2],[-7,-24],[-32,-7],[-5,33],[-43,0]],[[8252,5769],[-29,-1],[21,46],[-14,38]],[[8230,5852],[3,48],[9,21],[2,39],[-8,26],[35,-7],[17,-11],[33,5],[-22,53]],[[8299,6026],[31,36],[34,-8],[19,21],[23,9],[16,26],[-11,16],[-37,32],[-15,-5],[-7,45],[-10,19],[-21,5],[-27,38],[-62,-11],[-23,-14],[-5,49],[9,19],[-5,31],[31,21],[-27,17],[-15,-12],[-86,-5],[-2,23],[-19,7],[-31,-20],[-3,-35],[-31,-3],[1,26],[-22,2],[-32,-57],[-2,1],[-47,-9],[-20,-28],[-17,-8],[-24,42],[-30,-8],[-37,36],[-26,6],[-48,-12],[-10,12],[-29,-5],[-32,7],[-19,19],[-17,-9],[-22,7],[-14,-12],[-38,-6],[-34,1],[-54,-60],[-21,-16],[37,-47],[-40,-9],[-11,-27]],[[7417,6173],[9,46],[-19,42],[4,45],[11,32],[-29,25],[-12,33],[-10,4]],[[7371,6400],[0,31],[47,41],[1,1],[-2,34],[9,32],[-7,39]],[[7419,6578],[11,7],[53,1],[49,14],[13,29],[29,-3],[34,17],[51,-33],[31,-9],[138,2],[12,13],[59,-5],[26,-8],[24,18],[24,-14],[50,9],[35,-2],[59,34],[30,-19],[24,-4],[18,15]],[[6819,6524],[48,-30],[10,-24],[-17,-29],[-64,-37],[-27,-30],[-16,2],[-24,-15],[-12,-38],[6,-19],[30,-7],[-4,-24],[51,-31],[-8,-43],[-54,-17],[-28,-18],[-2,-36],[24,-14],[-22,-25]],[[6710,6089],[-27,12],[-8,18],[-40,7],[-32,-30],[-52,-6],[-11,-44],[-39,-9],[-8,-24],[-2,-42],[-24,-18],[2,-27],[-13,-34],[-37,2],[-28,-26],[-22,22],[-42,-19],[-23,13],[-38,-38],[-9,-35],[-16,1],[-36,42],[-6,26],[-44,-1],[-13,9],[-7,41],[-20,14],[-33,-15],[-25,22],[-35,0],[-13,8],[-11,-31],[-16,-18],[2,-31],[-19,1],[-26,-17],[-13,6],[-74,-10],[-38,-30],[-18,-7],[-29,6],[-21,-17],[-23,-1],[-28,50],[-49,-22],[-7,-21],[-29,6],[-27,-41],[-13,17],[-41,19],[-15,18],[10,13],[-21,15],[-30,2],[-21,-20],[-22,43],[-18,8],[-22,-29],[-21,-5],[-3,1],[-27,-4],[-11,-5],[-86,6]],[[5242,5860],[7,7],[0,2],[6,20],[-23,39],[-2,0],[-26,16],[-23,77],[11,60],[20,17],[69,27],[34,21],[25,1],[47,54],[54,25],[-3,19],[34,8],[17,-19],[34,3],[3,22],[19,-1],[4,-2],[42,-17],[36,38],[-32,28],[-33,5],[-27,22],[-21,-4],[-83,50],[-16,30],[53,23],[5,37],[-37,6],[-16,17],[-39,2],[2,19],[48,12],[13,22],[23,10],[41,-13],[49,9],[-5,14],[-26,5],[-33,61],[-33,-5],[-27,12],[-1,33],[-9,17],[-28,25],[15,21],[-29,23],[2,26],[-17,5]],[[5366,6789],[-7,32],[61,-2],[32,28],[47,-23],[7,-18],[120,-19],[22,-38],[-1,-22],[-14,-36],[40,-15],[22,7],[46,-20],[24,-29],[56,-2],[-6,-17],[11,-18],[43,-7],[25,17],[16,-4],[53,25],[23,-4],[20,-16],[-4,-38],[6,-11],[38,-13],[61,20],[56,-17],[52,0],[77,-39],[56,-24],[55,12],[13,17],[28,7],[19,17],[7,-44],[23,-15],[37,0],[25,-19],[17,23],[30,7],[38,-15],[22,-1],[9,14],[30,-8],[10,19],[43,-12],[31,-25],[30,26],[4,35]],[[5415,5199],[13,-18],[-14,-32],[-48,-8],[-39,-34],[-34,-5],[-31,-42],[-7,-44],[22,-18],[-37,-33],[-3,-23],[-14,-30],[-21,-12],[-13,-42],[17,-28],[-6,-20],[-36,12],[-26,-78],[-25,-12],[-48,18],[-48,2],[-70,-5],[-5,-37],[-23,-31],[-24,-14],[-2,-17],[-26,5],[-23,-8],[3,-46],[8,-23],[-15,-25],[20,-14],[10,-36],[-6,-22],[7,-44],[-12,-19],[6,-31],[64,-19],[44,-3],[-5,-51],[-76,24],[-30,-6],[-16,-17],[-27,46],[-27,4],[-43,22],[-15,-10],[-27,26],[-26,-25],[-7,-24],[7,-16],[35,-15],[7,-20],[24,-1],[-5,-29],[3,-54],[16,-10],[9,-28],[18,2],[3,-32],[-10,-22],[6,-43],[14,-19],[11,-55],[-24,-6],[-9,-39],[-65,-31],[-3,-40],[-63,-48],[-6,-22],[-29,-2],[-45,-27],[-2,-33],[-17,-42],[1,-18],[-27,-29],[-4,-27]],[[4519,3646],[-45,2],[-32,13],[-30,-21],[-23,17],[-19,93],[-30,4],[-44,12],[17,24],[-24,53],[-28,38],[-49,35],[-50,-13],[-26,43]],[[4136,3946],[-9,10],[36,21],[-4,14],[-24,28],[1,16],[39,63],[2,21],[20,9],[9,19],[30,23],[15,-28],[50,-9],[31,23],[-18,23],[36,13],[-5,18],[-54,29],[-20,0],[1,28],[-43,27],[-17,39],[19,29],[-7,47],[-25,7],[-24,32],[44,9],[37,18],[-11,22],[6,14],[3,52],[-24,66],[-2,46],[-27,-1],[-12,26],[12,54],[35,11],[27,16],[6,25]],[[4269,4806],[25,47],[-7,66],[11,27],[24,-2],[10,42],[-2,23],[28,58],[29,-20],[9,45],[30,32],[-2,48],[21,16],[18,-12],[34,24],[20,-7],[3,-20],[43,31],[32,0],[24,37],[30,9],[6,29],[-5,36],[32,6],[27,21],[-8,28],[7,12],[61,9],[12,12],[-3,28],[16,32],[-31,24],[-26,-4],[-18,13],[-18,36],[-31,-7],[-33,17],[-13,-13],[-30,-4],[3,49],[25,20],[-30,43],[22,24],[14,-20],[37,-18],[48,14],[4,2],[28,-12],[53,3],[33,-7],[57,1],[28,-6],[29,15],[9,22],[32,5],[20,14]],[[5006,5674],[50,-30],[59,6],[22,10],[9,23],[21,11],[16,25]],[[5183,5719],[34,-5],[29,-19],[1,-20],[24,-34],[25,-6],[25,-30],[-5,-23],[21,-28],[55,-12],[1,20],[3,1],[25,-8],[-4,-34],[-13,-17],[-1,-24],[35,-14],[-14,-58],[64,-59],[21,-5],[32,5],[2,-34],[-19,-8],[-12,-28],[-21,-9],[2,-16],[-28,-17],[-24,0],[-25,-22],[-1,-16]],[[3991,1395],[-1,-53]],[[3990,1342],[-10,20],[-20,6],[-1,1],[1,2],[-6,-1],[1,2],[-1,0],[0,2],[-1,0],[-1,-1],[0,2],[-4,1],[1,1],[0,1],[-2,-1],[1,3],[2,0],[2,3],[0,2],[-4,-2],[-1,0],[-1,5],[3,1],[10,-3],[2,0],[0,2],[-2,5],[-1,1],[-3,1],[0,3],[0,1],[3,2],[2,-2],[28,0],[0,-1],[3,-3]],[[2520,1636],[-6,10],[-1,1],[7,-11]],[[3931,1664],[0,1],[0,3],[4,-1],[-4,-3]],[[3975,1673],[-3,-15]],[[3972,1658],[-5,-1],[0,-1],[-2,1],[-2,0],[-17,5],[1,2],[1,0],[0,2],[3,0],[0,1],[0,3],[-1,1],[-1,4],[1,1],[1,0],[2,1],[5,-2],[3,-2],[0,-2],[3,-1],[7,2],[1,0],[-1,2],[2,0],[0,1],[1,-1],[1,-1]],[[3929,1668],[-8,0],[-2,3],[10,-3]],[[3915,1690],[2,0],[1,2],[4,-2],[5,-7],[-2,-2],[-1,-1],[-3,-1],[-6,6],[-3,-1],[0,-1],[-3,0],[-3,-1],[10,10],[-1,-2]],[[3935,1718],[-1,-4],[-7,-1],[-3,1],[2,1],[0,2],[9,1]],[[3914,1739],[10,-2],[-1,-1],[-1,-5],[-2,-2],[2,-13],[0,-2],[-1,-1],[-1,-2],[10,-10],[-1,0],[-2,0],[-3,-3],[-4,1],[-1,-1],[0,-2],[-3,0],[-2,1],[-2,7],[0,5],[0,2],[3,1],[0,2],[0,4],[-4,1],[1,12],[0,1],[3,4],[-1,3]],[[3987,1714],[-11,-40]],[[3976,1674],[-1,5],[-3,2],[-5,0],[0,-2],[-2,-4],[-1,0],[-2,1],[-1,3],[3,5],[-1,3],[-9,-9],[-3,6],[-9,2],[1,6],[-5,0],[0,-1],[-1,0],[-2,0],[3,3],[0,2],[1,1],[-1,2],[7,1],[-3,-6],[1,17],[0,-2],[1,-3],[-2,2],[-5,5],[0,1],[8,4],[-2,3],[1,3],[-4,1],[-1,0],[-2,0],[-9,-1],[-2,7],[0,2],[16,4],[-1,-3],[4,-5],[1,-2],[16,-1],[-2,-2],[-3,-2],[-5,1],[-1,0],[-2,-4],[8,-9],[0,-6],[0,-1],[1,0],[0,1],[3,2],[0,4],[15,7],[0,3],[11,-6]],[[3964,1688],[2,1],[1,0],[0,-2],[-1,-3],[2,-1],[2,5],[-6,0]],[[3988,1733],[1,7],[0,2],[10,1]],[[3999,1743],[-11,-10]],[[2941,7963],[19,-25],[1,-22]],[[2961,7916],[-24,11],[-24,-13],[9,-15],[36,-9]],[[2958,7890],[32,-29],[1,-30],[-1,-3],[-17,-30],[-40,6],[-3,-22],[-51,-35],[16,-15],[-4,-17],[-32,-24],[-28,6],[-9,15],[-33,-12],[-27,3],[-18,-27],[4,-64],[-2,1],[-56,-32],[-36,-5],[-25,6],[-15,21],[-39,-2],[-13,-12],[-38,-2],[-38,7],[-44,-38],[-33,-22],[-16,8],[8,34],[12,7],[-17,28],[-27,-12],[-13,26],[-26,-8],[-22,28],[-43,17],[-73,-25],[-23,9]],[[2169,7646],[-68,4],[-11,1],[-4,-1],[-132,6],[2,27],[22,24],[1,23]],[[1979,7730],[-2,22],[-21,29],[21,24],[1,21],[33,11],[12,26],[33,22],[26,30],[18,30],[33,21],[12,19],[31,9],[5,19],[35,0],[8,25],[-59,2],[2,45],[10,31],[35,31],[-24,20],[12,15],[-23,17],[-23,34],[27,12],[2,24],[33,26],[51,17],[43,35],[23,-8],[43,13],[36,3],[15,9],[17,33],[2,40]],[[2446,8437],[49,-8],[43,21],[41,12],[12,20],[20,3],[23,29]],[[2634,8514],[-6,-25],[24,-29],[-28,-11],[-37,-34],[-39,-13],[12,-29],[-16,-16],[63,-37],[34,-12],[19,-34],[-9,-10],[27,-57],[28,-36],[42,-76],[42,13],[10,23],[24,-30],[71,-37],[-16,-10],[12,-24],[-5,-35],[35,-13],[20,-19]],[[2169,7646],[11,-26],[-21,-12],[-7,-28],[46,3],[-11,-65],[13,-8],[-14,-41],[27,-11],[43,-5],[26,14],[26,-12],[9,-27],[24,3],[19,-20],[103,10],[7,-24],[-13,-16],[6,-24],[19,-17],[26,-2],[-8,-50],[23,-81],[19,-3],[6,-20],[51,-29],[9,-14],[41,-15],[33,-29],[-4,-10],[15,-9],[-26,-46],[-7,-32],[7,-41],[38,2],[29,-21],[12,14],[-18,47],[8,22],[25,4],[30,-13],[8,37],[38,2],[23,-36],[-3,-20],[44,13],[-4,24],[49,22],[15,22],[44,-27],[-15,-48],[3,-54],[-13,-38],[28,-20],[23,53],[21,-11],[17,9],[29,-9],[14,7]],[[3112,6940],[10,-6],[13,-45],[-1,-42],[31,-21],[1,-21],[48,-23],[24,-29],[4,-21],[-38,-20],[5,-22],[34,-9],[12,-14],[-72,-25],[-23,-20],[16,-24],[20,17],[30,4],[37,16],[17,18],[36,-10],[59,3],[15,-5],[18,19],[32,-8],[-8,-32]],[[3432,6620],[-11,-12],[-28,-4],[-3,-34],[-33,6],[-61,-49],[-49,-15],[-51,-31],[-32,-3],[-38,-20],[-17,-23],[-25,-13],[-28,-2],[-1,-2],[-40,-28],[-34,-14],[-17,-19],[-2,0],[-15,-31],[-22,-14],[-31,1],[-38,-35],[-7,-42],[3,-47],[28,-46],[59,-24],[24,4],[40,-11],[40,14],[26,-8],[52,40],[35,-69],[-7,-34],[-29,-13],[-13,12],[-32,-2],[-32,-18],[-32,6],[-39,-22],[1,-18],[26,-27],[-18,-11],[-32,-5],[15,-18],[59,-18],[14,-24],[-3,-39],[-31,-21],[-15,24],[-35,0],[12,-21],[-5,-36],[13,-30],[24,-24],[-15,-22],[-37,-2],[-40,23],[9,18],[-29,5],[-32,-33],[-21,21],[-17,-6],[-21,13],[-26,-11],[-24,6],[-28,-9],[4,-37],[-32,-7],[-28,-16],[5,-30],[-42,-13],[-70,-31],[-23,0],[-7,19],[-36,21],[3,20],[17,22],[64,-26],[21,9],[6,22],[-13,25],[24,53],[-16,3],[-10,31],[17,18],[15,-12],[25,8],[8,30],[-25,26],[-5,38],[-33,10],[-44,-24],[-11,11],[-44,-9],[-77,14],[-12,17],[17,24],[20,-15],[12,49],[-9,27],[-53,-6],[-12,-17],[-1,-29],[-26,-9],[-33,6],[-27,19],[-14,-12],[11,-29],[53,-6],[-5,-28],[-19,-15],[-24,2],[-19,32],[-14,-26],[-22,-59],[1,0],[34,-5],[15,-14],[-26,-28],[-10,-29],[4,-2],[38,2],[8,-34],[20,-21],[12,-27],[-27,-39],[-3,-14],[12,-44],[-6,-22],[-25,-37],[-82,-31],[-27,-46],[5,-12],[29,-7],[12,-21],[-46,-33],[-23,-5],[-26,9],[-24,-17]],[[2097,5376],[-25,39],[-23,-9],[-19,9],[3,28],[-30,10],[-8,13],[-7,1],[-38,0],[-23,36],[-66,2],[9,57],[-31,10],[-58,43],[-14,23],[21,23],[-2,42],[-30,4],[-26,-17],[-17,11],[8,18],[-35,14],[-14,14],[12,26],[24,24],[-35,19],[3,33],[-39,-14],[-1,-30],[-18,-11],[-19,13],[-47,-1],[-25,31],[-40,16],[-27,-32],[-36,48],[-22,-4],[-22,31],[-15,-8],[-35,14],[-11,18],[-21,-16],[-71,4],[-43,-12],[-15,13],[-44,1],[-37,-17],[-29,-5],[-65,25]],[[994,5913],[-55,84],[-18,69],[-46,43],[-29,38],[3,90],[-28,14],[-23,-9],[-46,-4],[-39,12],[-14,22],[-23,18],[-24,35],[-4,50],[29,47],[4,43],[-4,63],[-42,16],[-58,-7],[-27,6],[-31,21],[-67,27],[-10,21],[10,68],[26,56],[39,34],[57,41],[24,30],[29,20],[37,81],[31,30],[51,37],[42,8],[33,-8],[29,-29],[4,-31],[27,-34],[47,-5],[104,40],[69,14],[85,0],[82,29],[12,55],[23,28],[44,31],[26,27],[37,98],[32,32],[40,16],[77,39],[69,27],[17,36],[29,31],[67,107],[39,122],[5,5],[73,26],[62,16],[59,41]],[[7041,6724],[-55,16],[-55,-38],[-43,16],[-52,-6],[-22,9],[-10,25],[-17,1]],[[6787,6747],[15,37],[3,32],[-8,22],[36,58],[16,40],[1,20],[-23,8],[5,29],[35,-5],[33,13],[17,-3],[32,22],[18,-3],[14,17],[60,-4],[31,-28],[-2,-19],[15,-12],[-8,-26],[-3,-49],[-28,-34],[6,-36],[25,-23],[14,-37],[-33,-9],[-17,-33]],[[3976,1674],[-1,-1]],[[3972,1658],[-12,-57],[1,-25],[26,-60],[6,-67],[-2,-54]],[[3990,1342],[8,-160],[3,-17],[-28,-6],[-123,18],[-18,-1],[-38,-28],[-17,-44],[13,-23],[-14,-9],[-33,-39],[-1,-10],[-45,-48],[-23,-42],[-8,-43],[29,-34],[37,-31],[-37,5],[-37,-6],[-70,-20],[-8,-12],[-26,-10],[-52,-5],[-48,-30],[-24,-20],[-14,-27],[1,-37],[-17,-44],[3,-45],[-32,-46],[-23,-8],[-35,-24],[-19,-5],[-28,-25],[-49,-9],[-12,-21],[-81,14],[-75,56]],[[3049,506],[37,50],[1,18],[25,16],[-23,34],[-8,31],[25,32],[-40,59],[41,44],[5,49],[18,19],[1,18],[20,19],[-14,38],[-40,-1],[-20,24],[14,25],[6,40],[-9,7],[21,32],[-4,18],[-21,26],[22,5],[-1,47],[-30,31],[-62,-42],[-31,4],[-25,20],[7,22],[-8,26],[5,48],[14,15],[9,46],[-28,30],[-29,7],[-29,15],[32,60],[-41,25],[-62,5],[24,20],[9,30],[-31,9],[-30,22],[-36,9],[-11,30],[25,0],[42,20],[1,11]],[[2820,1619],[28,13],[17,-28],[19,-4],[83,0],[-7,16],[24,44],[36,7],[24,-26],[9,13],[48,13],[65,-10],[20,52],[29,-2],[31,10],[35,51],[-14,19],[-42,9],[-32,-3],[-15,6],[47,50],[7,40],[-16,10],[7,38],[52,22],[26,56],[35,-2],[18,-14],[29,7],[19,-20],[35,-5]],[[4134,2244],[11,-28],[-4,-24],[13,-6],[7,-24],[-30,-124],[-2,-56],[-40,-110],[-40,-50],[-50,-79]],[[3988,1733],[-1,-19]],[[2961,7916],[-3,-26]],[[4519,3646],[78,3],[17,21],[33,5]],[[3191,3024],[-2,50],[-6,14],[0,44],[36,21],[-25,19],[-37,-3],[-43,13],[-12,22],[40,5],[16,11],[14,30],[-13,18],[7,33],[12,11],[-7,37],[16,32],[-12,32],[-30,11],[1,27],[26,42],[22,5],[-3,22],[21,1],[29,30],[-74,20],[6,38],[28,9],[-12,19],[7,14],[31,25],[13,22],[-16,16],[-3,44],[-17,46]],[[3204,3804],[-7,16],[19,34],[5,35],[20,-7],[31,20],[-5,29],[18,6],[18,37],[21,20],[-16,28],[-29,10],[-2,26],[29,17],[5,62],[30,13],[33,-23],[48,-10],[1,51],[13,13],[29,7],[0,49],[-8,28],[20,8],[18,40],[44,-4],[110,-21],[4,-34],[38,-2],[3,-23],[14,-13],[29,-4],[29,-23],[17,23],[6,28],[74,-38],[25,17],[80,16],[17,-20],[29,-14],[21,-30],[-18,-58],[8,-16],[-29,-24],[23,-20],[4,-61],[-2,-24],[28,-6],[32,-29],[55,13]],[[8252,5769],[10,-15],[2,-97],[-25,-32],[3,-30]],[[8242,5595],[-45,-5],[-19,-19],[-48,5],[13,-60],[-29,-16],[-36,-42],[11,-69],[-36,-37],[-32,-14],[-26,18],[-10,48],[-20,38],[-25,-21],[8,-34],[-18,1],[-10,47],[-26,83],[-30,37],[0,48],[22,-1],[9,31],[-7,16],[18,31],[27,1],[22,41],[43,-11],[31,15],[6,22],[36,-13],[-6,32],[34,-13],[22,-21],[11,44],[-6,21],[16,15],[41,-3],[26,15],[-6,27],[27,0]],[[4066,7279],[22,-2],[39,-22],[42,-41],[31,-3],[33,22],[50,-38],[23,-4],[47,-35],[37,-3],[32,-24],[36,-6],[9,-25],[27,-26],[4,-21],[33,11],[17,-29],[53,-27],[23,-4],[28,-23],[37,-21],[28,24],[35,-2],[18,-19],[28,-6],[61,-44],[25,-12],[79,13],[19,-28],[0,-43],[62,0],[43,-18],[45,2],[44,-41],[32,23],[-1,26],[71,-2],[73,-32],[15,-10]],[[5242,5860],[-36,-9],[-4,-15],[17,-17],[2,-18],[-21,-12],[9,-15],[-18,-46],[-8,-9]],[[5006,5674],[-21,16],[-13,23],[6,46],[13,23],[-1,27],[-12,17],[-3,43],[29,-1],[-12,29],[-26,3],[-9,16],[-46,-15],[-38,17],[-3,-35],[-38,10],[-19,24],[-12,32],[-33,-2],[-37,19],[-17,-4],[-18,15],[0,32],[-38,9],[-49,22],[-39,36],[-14,-12],[-3,-24],[-46,30],[-28,-1],[-2,-32],[-35,-36],[-104,-7],[5,44],[-18,20],[-23,4],[-27,-29],[-32,11],[-25,-15],[-10,-16],[-44,48],[26,11],[-8,16],[-30,20],[-1,36],[-42,5],[-21,-22],[-36,1],[-8,-24],[-52,-11],[5,-27],[-12,-18],[-30,14],[-25,-6],[-39,14],[-21,-28],[-35,12],[-1,17],[17,23],[-35,30],[-25,-7],[28,-26],[-22,-7],[13,-19],[-13,-11],[-49,-3],[-37,41],[-54,-15],[-26,34],[47,45],[4,34],[-22,-3],[-52,-20],[14,-11],[-1,-23],[-55,19],[-28,-43],[25,-43],[1,-19],[15,-12],[-5,-33],[14,-20],[33,-13],[3,-52],[-7,-34],[44,13],[22,-29],[-1,-35],[16,-6],[-7,-23],[-21,-19],[-17,-29],[-25,-9],[-10,20],[-19,-4],[-28,21],[-14,20],[-26,12],[-23,-32],[-17,-8],[-20,21],[12,14],[-32,22],[-4,35],[4,39],[-33,71],[54,37],[-1,28],[40,24],[-20,13],[-18,46],[-13,11],[14,21],[30,16],[-4,17],[24,16],[58,-5],[10,9],[40,8],[6,19],[-18,15],[19,36],[44,53],[0,15],[20,15],[0,24],[19,43],[20,23],[-23,35],[4,14],[-21,16],[-5,44],[-41,6],[-18,20],[-33,12],[-51,-14],[-62,23],[-8,14],[-52,-11]],[[3112,6940],[22,17],[25,0],[37,24],[5,20],[-19,19],[-2,18],[22,28],[-35,80],[-33,25]],[[3134,7171],[-15,18],[11,43],[-45,36],[-3,22]],[[3082,7290],[10,45],[-31,32],[2,56],[8,15],[-23,72],[0,22],[19,38],[13,61],[25,29],[7,19],[44,22],[59,65],[1,24]],[[3216,7790],[-4,7]],[[3212,7797],[25,2],[26,-24],[70,-27],[-7,-23],[-47,-46],[-19,-59],[21,-28],[-3,-22],[27,-15],[13,10],[25,-5],[10,-15],[1,-29],[64,41],[23,9],[34,30],[53,-18],[9,-30],[22,-23],[40,-24],[71,-17],[-15,-24],[-45,-24],[30,-20],[17,-1],[14,-28],[58,-4],[21,-23],[49,-38],[42,-11],[3,-25],[42,11],[46,-14],[37,15],[22,-28],[51,-30],[24,39]],[[3212,7797],[81,35],[2,16],[-25,16],[15,11],[-30,42],[33,34],[-10,35],[24,9],[-7,16],[34,35],[65,11],[19,13],[29,1],[23,17],[24,0],[34,-28],[45,11],[17,-13],[50,3],[8,-19],[21,-15],[40,5],[-31,47]],[[3673,8079],[8,26],[17,6],[26,38],[25,-11],[41,-47],[17,-49],[29,-10],[10,-27],[30,1],[11,-22],[20,-10],[51,21],[39,-9],[21,-29],[44,-16],[20,-21],[20,11],[26,-24],[-9,-52],[23,-2],[87,-38],[21,7],[47,-26],[28,-27],[62,-17],[12,-22],[-60,-8],[2,-14],[-38,-27],[-28,-29],[-37,-12],[-6,-23],[-22,-20],[-28,-1],[-13,-22],[18,-29],[-3,-13],[-38,-37],[-9,-30],[13,-23],[-6,-29],[-15,-6],[6,-24],[-28,-4],[-18,-20],[-6,-29],[-18,-22],[1,-29]],[[7144,4935],[11,-28],[-23,2],[12,26]],[[6857,4948],[31,-29],[-7,-36],[-26,18],[2,47]],[[7066,4950],[9,-41],[-17,-1],[8,42]],[[6894,4981],[11,-21],[-20,-12],[-13,17],[22,16]],[[6828,4986],[12,-43],[-6,-31],[-13,-9],[-26,8],[1,23],[32,52]],[[6934,4995],[15,-18],[-16,-15],[-18,10],[19,23]],[[7067,5000],[27,3],[21,-20],[-29,-18],[-19,35]],[[7059,5033],[30,-2],[3,-27],[-18,-4],[-36,13],[21,20]],[[7129,5044],[21,-22],[-5,-17],[-30,20],[14,19]],[[7106,5089],[12,-13],[-9,-29],[12,-51],[-21,12],[-10,40],[2,23],[14,18]],[[7124,5092],[10,-34],[-17,-5],[7,39]],[[7019,5096],[32,-13],[-34,-27],[-19,6],[21,34]],[[7088,5208],[3,-45],[-15,0],[2,39],[10,6]],[[7096,5213],[12,-4],[15,-41],[-25,-7],[-11,19],[9,33]],[[7041,6724],[40,-13],[3,-23],[36,-39],[35,-7],[15,-29],[42,2],[23,12],[71,-11],[39,-24],[74,-14]],[[7371,6400],[-28,17],[-15,-18],[8,-32],[-24,-22],[-66,5],[-26,13],[-20,24],[-21,5],[-8,34],[-11,15],[-5,37],[-36,6],[6,-41],[-27,-3],[-57,8],[-18,9],[-7,24],[-39,16],[-61,52],[-12,-35],[44,-16],[12,-26],[-24,-7],[-30,-22],[-12,-29],[-26,-5],[-31,-28],[6,-28],[-19,-18],[-11,-24],[8,-32],[33,-4],[20,8],[10,-17],[26,-14],[25,-37],[36,-29],[32,-11],[41,5],[23,-5],[4,-38],[15,-13],[39,-9],[-29,-44],[-24,14],[-14,-12],[-42,12],[-40,-11],[-28,13],[-15,-5],[3,-55],[-19,-29],[-17,-2],[-4,-22],[-20,6],[-19,22],[-16,-4],[-5,-31],[-50,-60],[30,-40],[32,-27],[26,-8],[25,-21],[28,1],[50,-19],[53,-8],[5,-12],[-4,-55],[2,-59],[-53,-18],[-5,-71],[28,-12],[6,-19],[28,-23],[6,-37],[-22,-25],[30,-25],[44,4],[16,-13],[-31,-31],[0,-42],[13,-30],[20,-11],[-16,-36],[13,-14],[-10,-18],[2,-23],[-23,-8],[-8,-38],[5,-22],[26,-22],[-12,-40],[-79,9],[-18,-32],[6,-21],[-13,-25],[1,-20],[-25,-18],[-38,16],[-11,-20],[-25,5],[-33,-30],[-18,38],[-3,26],[20,25],[-16,13],[-39,-20],[-31,-62],[-43,-36],[-58,-27],[-61,-10]],[[6606,4896],[-5,36],[-9,18],[-56,12],[-12,19],[-3,32],[-49,-15],[-21,-14],[-11,14],[12,27],[-6,17],[-20,14],[-52,10],[-5,13],[-26,-4],[2,24]],[[6345,5099],[24,1],[10,14],[8,45],[-27,8],[8,17],[-11,33],[-36,1],[-5,26],[-30,18],[-24,4],[-21,18],[5,46],[-13,19],[-39,12],[-23,-6],[-33,33],[-27,17],[-42,-5],[-27,21],[-3,23],[12,13],[-1,49],[27,1],[36,12],[-2,31],[35,-5],[5,-22],[24,-22],[44,9],[2,26],[30,29],[28,0],[63,22],[27,-3],[9,29],[27,34],[55,-21],[31,-7],[-4,24],[30,-3],[24,11],[-1,21],[-20,23],[34,2],[37,-17],[21,14],[-2,31],[26,-9],[3,24],[37,-4],[-2,32],[19,14],[20,31],[0,59],[31,0],[9,33],[-4,20],[-21,5],[20,35],[23,12],[-1,18],[-34,34],[-31,20],[5,40]],[[6819,6524],[26,59],[-5,49],[-13,37],[-30,19],[-18,23],[8,36]],[[6606,4896],[-32,-20],[-54,-2],[-30,-10],[-69,-51],[-28,-43],[-8,-21],[11,-38],[36,-60],[-2,-22],[14,-36],[-78,-51],[-19,-39],[17,-10],[1,-18],[-60,-33],[-28,-20],[-34,-37],[-21,-35],[-47,-18],[-63,-17],[-51,-8],[-69,-22],[-118,-55],[-47,-30],[-42,-37],[-68,-45],[-29,-30],[-13,-24]],[[5415,5199],[46,-17],[-1,-16],[20,-16],[33,-11],[47,5],[26,21],[44,4],[38,-5],[20,10],[27,-9],[59,21],[18,-62],[-27,-45],[-1,-14],[26,-5],[38,-18],[52,37],[16,0],[62,-26],[65,-13],[1,-19],[38,0],[17,13],[28,55],[-19,19],[16,20],[2,26],[-24,24],[6,15],[34,14],[11,-17],[34,-7],[30,-15],[22,-26],[24,-13],[26,11],[51,-34],[25,-7]],[[1716,4408],[-18,-17],[-55,15],[-11,31]],[[1632,4437],[-9,27],[34,0],[4,11],[42,-5],[-26,-27],[6,-23],[21,14],[12,-26]],[[1578,4491],[14,33]],[[1592,4524],[18,-18],[-5,-17],[-27,2]],[[2028,2934],[45,1],[0,-54],[12,-36],[13,-5],[5,-24],[-23,-6],[16,-30],[-14,-27],[7,-21],[-21,-30],[-19,2],[-31,-20]],[[2018,2684],[-16,6],[1,24],[-21,13],[-15,31],[0,19],[-16,53],[-44,53],[-21,63],[-9,12]],[[1877,2958],[34,0],[28,24],[27,-18],[11,-38],[9,-6],[42,14]],[[56,5622],[21,-27],[-25,-41],[-18,-7],[-8,24],[23,26],[7,25]],[[69,5646],[15,-13],[-14,-16],[-19,15],[18,14]],[[117,5669],[16,-11],[-21,-19],[-12,11],[17,19]],[[104,5676],[7,-15],[-22,-14],[-4,29],[19,0]],[[56,5678],[-7,-51],[-22,-8],[-12,-38],[-15,15],[5,28],[24,35],[22,2],[5,17]],[[2097,5376],[17,-27],[3,-23],[28,1],[1,-32],[-21,-28],[-7,-29],[-36,2],[-22,-27],[-44,-19],[6,-25],[46,2],[12,-15],[-26,-17],[-22,-3],[-21,9],[1,-46],[16,-3],[5,-52],[-12,-17],[15,-16]],[[2036,5011],[-42,-16],[-67,-31],[6,-23],[15,-10],[-1,-22],[-21,-15],[12,-34],[71,21],[48,-10],[29,10],[5,-26],[-29,-7],[-57,-1],[-3,-12],[-29,-9],[-5,-31],[-19,-12],[-21,2],[-3,-32],[-28,-1],[-36,-12],[55,-21],[19,-23],[32,-52],[-2,-24],[-33,-22],[1,-25],[-34,-19],[-38,4],[-5,15],[-56,30],[-7,-40],[14,-3],[-2,-30],[-21,-37],[8,-33],[-4,-26],[-39,2],[-6,-18],[-27,-10]],[[1632,4437],[-30,5],[-19,-23],[-30,-7]],[[1553,4412],[3,36],[22,43]],[[1592,4524],[10,10],[3,34],[-34,96],[-28,53],[5,26],[-17,5],[-25,52],[24,37],[-2,15],[12,19],[-27,10],[5,19],[41,9],[25,5],[-73,8],[-21,-8],[-10,16],[12,28],[20,23],[-32,6],[-3,38],[18,60],[18,13],[49,-14],[15,22],[-37,-1],[-19,16],[-44,-18],[-32,18],[-16,-15],[-18,-45],[-20,-70],[1,-55],[16,-32],[-13,-18],[-10,-35],[-38,-43],[-16,-30],[11,-14],[-23,-14],[-86,-34],[-55,-28],[-43,-10],[-24,-24],[-40,-8],[-59,-24],[-2,-5],[-45,-6],[-7,-3],[-28,2],[-31,-15],[-80,30],[-55,27],[-49,30],[-63,49],[-32,32],[-95,103],[-168,140],[-61,62],[-36,41],[-6,21],[24,41],[21,-14],[42,9],[-8,-41],[19,-13],[23,6],[17,18],[27,-5],[35,21],[33,-10],[28,15],[14,21],[18,-18],[28,14],[25,27],[28,7],[49,2],[44,67],[14,30],[28,27],[17,27],[-26,4],[-1,-21],[-15,-10],[-39,16],[-35,-12],[-10,-11],[-53,-6],[-43,-12],[-25,-12],[-19,-25],[-56,14],[-30,-3],[-43,18],[-42,2],[-186,105],[-23,22],[20,8],[0,25],[-13,19],[-36,31],[-4,53],[24,28],[24,13],[14,34],[-34,6],[-7,29],[69,0],[6,100],[20,15],[8,-32],[31,27],[22,-26],[31,16],[33,-11],[39,14],[61,-4],[35,7],[49,-39],[98,-1],[16,9],[15,32],[91,20],[69,22],[-5,-22],[5,-33],[50,-12],[54,10],[-2,16],[39,23],[17,-4],[26,14],[-1,13],[-37,3],[-4,53],[37,27]],[[3082,7290],[-47,2],[-6,-12],[-30,-6],[1,-45],[-39,-33],[16,-19],[47,3],[31,-13],[20,-29],[21,21],[38,12]],[[2941,7963],[28,-12],[17,9],[38,-52],[30,-3],[18,-14],[1,-30],[-15,-10],[-1,0],[31,-20],[0,-3],[38,-15],[12,3],[30,-19],[20,4],[28,-11]],[[3494,8498],[19,-24],[28,-13],[-20,-27],[1,-19],[44,-20],[-6,-20],[55,-51],[12,-1],[-28,-68],[15,-34],[32,-21],[-10,-17],[-26,-11],[25,-30],[11,-40],[27,-23]],[[2634,8514],[18,23],[-4,37],[-43,45],[28,12],[23,-15],[28,11],[26,29],[50,9],[13,24],[37,26],[29,-1],[27,9],[27,-15],[59,3],[27,-19],[14,-27],[27,-15],[48,-3],[7,-22],[24,-6],[32,-24],[20,19],[26,-6],[43,25],[45,11],[27,-22],[-10,-13],[34,-16],[19,-20],[-5,-21],[25,-33],[20,0],[20,23],[31,0],[39,16],[31,-29],[-31,-15],[4,-34],[25,18]],[[2446,8437],[-27,8],[-24,18],[-20,-5],[-7,22],[-27,7],[-29,-16],[-30,13],[-26,-5],[-35,6],[-10,24],[-1,46],[-11,19],[-25,-4],[-31,13],[-24,-9],[-29,22],[-41,20],[-42,9],[-34,25],[-46,6],[-6,-11],[-40,38],[-19,0],[9,39],[-18,15],[-16,39],[20,69],[-19,32],[10,26],[-12,10],[10,38],[-24,35],[-9,46],[1,25],[-23,42],[-9,4],[17,70],[58,4],[25,19],[-7,16],[35,35],[43,8],[45,19],[15,20],[-3,36],[13,32],[-20,0],[-44,22],[-47,10],[-18,12],[-9,26],[13,23],[20,11],[-4,21],[-50,15],[-28,-5],[-26,7],[-25,-4],[-13,13],[-33,9],[-46,29],[5,41],[-26,14],[-14,-10],[-37,-3],[-9,12],[-61,-10],[-11,-6],[-54,27],[21,37],[-22,15],[14,25],[-7,10],[15,28],[23,0],[39,15],[39,29],[-5,13],[63,33],[18,24],[-10,24],[79,8],[42,12],[90,-20],[9,9],[60,-1],[-13,27],[-47,14],[-5,27],[57,-6],[60,-29],[32,13],[9,19],[30,-6],[58,34],[35,-1],[60,30],[7,-17],[36,0],[28,-39],[35,23],[41,-7],[44,32],[27,-17],[35,-40],[11,-24],[47,-15],[45,-57],[60,-29],[50,-8],[36,-29],[28,-14],[33,4],[27,-17],[17,-32],[74,-25],[10,-18],[26,-10],[-27,-32],[28,-34],[45,-22],[33,-2],[30,6],[36,-26],[46,1],[27,-26],[12,-39],[-33,9],[0,-23],[25,-5],[23,8],[71,-4],[35,11],[27,-13],[21,34],[27,4],[31,-15],[22,37],[24,5],[1,18],[40,5],[11,16],[34,-7],[47,29],[50,1],[46,8],[61,-14],[21,11],[4,25],[17,13],[50,1],[13,-31],[32,-4],[78,-27],[42,-6],[45,18],[39,-53],[42,-11],[20,-13],[12,-43],[-16,-28],[-19,-53],[-15,-20],[-5,-59],[-33,-53],[-1,-37],[-43,-11],[-29,2],[-30,-22],[-5,-22],[12,-23],[-73,2],[-24,-6],[17,-20],[9,-57],[-31,-20],[0,-14],[-41,-34],[-61,6],[-39,-10],[-23,10],[-26,-9],[-12,-16],[40,-66],[0,-23],[24,-9],[5,-21],[-40,-1],[-24,7],[7,-35],[-2,-31],[20,-34],[36,-12],[49,2],[73,-13],[-5,-23],[-21,-35],[2,-37],[27,-17],[38,-45],[18,-15],[-61,-68],[-37,20],[-50,-36],[-27,-33],[-53,-5],[-46,23],[-17,45],[6,14],[-15,21],[-30,-9],[-15,-19],[-28,4],[-47,-27]],[[2820,1619],[-6,30],[-24,-7],[-21,24],[-19,-1],[-12,21],[-26,-4],[-1,39],[-45,-15],[-34,5],[-18,15],[-10,29],[-27,-4],[-28,27],[-20,2],[-33,45],[-18,2],[-18,31],[-3,32],[-22,5],[-12,18],[-19,7],[-5,17],[-30,16],[-23,-5],[-15,18],[1,23],[-49,-10]],[[2283,1979],[-19,45],[-20,96],[-12,34],[-14,103],[-20,77],[-16,38],[-18,13],[-24,96],[-11,10],[-5,32],[-41,70],[-5,34],[-21,3],[-32,18],[6,15],[-13,21]],[[2028,2934],[15,32],[42,-3],[21,8],[12,27],[-6,10],[23,25],[18,45],[7,44],[-55,23],[-9,20],[5,33],[-21,22],[75,36],[20,1],[7,-26],[71,64],[47,13],[-1,23],[31,30],[31,-9],[47,-26],[18,11],[1,26],[20,0],[43,11],[8,-14],[27,6],[25,-4],[9,11],[1,43],[-14,15],[9,37],[-18,10],[10,58],[61,-36],[3,17],[25,-5],[13,-27],[65,14],[14,-8],[23,7],[16,-10],[36,-7],[-6,21],[-11,73],[29,3],[24,21],[13,30],[28,-1],[30,-17],[55,64],[21,13],[1,31],[12,2],[1,48],[35,-11],[28,19],[23,23],[12,43],[25,10],[30,-14],[3,-32],[19,-13],[29,10]],[[3049,506],[-34,28],[-37,41],[-95,117],[-21,12],[-10,34],[-55,118],[-9,23],[-16,82],[-4,45],[-12,53],[-14,27],[-12,46],[-10,14],[-12,44],[-68,142],[-24,104],[-13,22],[-20,59],[-21,31],[-19,8],[-29,72],[-3,4],[-49,51],[-18,11],[-29,40],[-16,1],[-38,89],[-37,66],[-41,89]],[[2022,1467],[-30,12],[-16,21],[9,15],[33,-18],[4,-30]],[[1250,1675],[-22,0],[-16,41],[18,14],[20,-55]],[[4269,4806],[-22,-2],[-25,22],[-24,4],[-27,39],[-38,32],[-24,5],[-24,-8],[-19,-18],[-47,-1],[-24,-7],[-42,23],[-54,-19],[-24,15],[-6,28],[-32,0],[-55,13],[-6,-21],[-24,3],[-15,-16],[-44,2],[-21,-18],[6,-25],[-58,1],[-13,-8],[-35,4],[-39,17],[-24,-8],[-5,32],[-22,-8],[-61,-6],[-4,-20],[-37,-20],[-56,-20],[-36,4],[-43,-6],[-38,9],[-41,24],[-5,23],[28,4],[21,-8],[-3,46],[-21,26],[-75,4],[-24,-22],[-48,9],[-60,-40],[-34,-1],[-11,-24],[10,-11],[-20,-27],[-37,-26],[12,-16],[-13,-29],[-45,2],[-13,-28],[-26,-12],[-66,4],[-9,56],[-21,38],[-15,-7],[-29,13],[-47,-3],[-73,3],[-25,-7],[-27,7],[-29,-3],[-56,9],[-39,19],[-17,32],[-67,22],[-13,-7],[-81,18],[-26,19],[-3,28],[8,33],[-48,37],[-33,-28],[-29,-3],[-21,9]],[[1877,2958],[-16,43],[-14,17],[-35,22],[-4,40],[-30,86],[-25,60],[13,27],[-16,40],[4,18],[-12,32],[4,27],[-4,45],[-21,54],[7,14],[-18,21],[-2,41],[-13,14],[-10,47],[8,9],[-22,52],[-14,20],[-8,36],[-14,27],[2,23],[-15,27],[-14,59],[6,39],[-14,14],[-5,24],[4,37],[-18,29],[2,76],[-11,8],[-1,50],[-9,25],[-3,37],[-13,22],[4,22],[-16,31],[4,26],[-14,15],[30,23],[-10,57],[9,18]],[[9068,6166],[-28,-57],[1,-31],[49,-19],[-1,-37],[-17,-41],[-18,-17],[-10,-42],[-21,-2],[-10,-32],[-19,-14],[-70,-134],[-6,-41],[-26,-38],[-2,-25],[-49,27],[-42,7],[-30,-7],[-16,23],[-50,2],[-2,-12],[-47,-1],[-19,36],[-27,-8]],[[8608,5703],[-71,3],[-49,22],[13,29],[4,33],[-12,28]],[[8655,6117],[10,-19],[36,-17],[27,43],[32,31],[19,45],[44,-2],[16,6],[28,-14],[33,-1],[11,-11],[28,-1],[42,20],[16,22],[42,22],[-14,-34],[1,-24],[42,-17]],[[8299,6026],[-69,22],[-53,29],[-112,-4],[-36,-16],[-13,16],[-38,-13],[-27,13],[-24,0],[-27,11],[-69,-5],[-53,-10],[-74,0],[-62,2],[-23,-8],[-39,16],[-75,11],[-70,27],[-13,-6],[-19,27],[14,35]],[[8608,5703],[0,-24],[21,-17],[0,-35],[11,-80],[-8,-24],[-10,-58],[5,-36],[-12,-48],[-19,-23],[-17,0],[-16,16],[-25,-3],[10,-44],[-22,-34],[0,-36],[16,-38],[-10,-10],[6,-27],[19,-15],[4,-49],[-17,-10],[4,-22],[-38,7],[-2,-21],[-16,-28],[-36,-14],[-26,28],[-38,19],[-6,-37],[-30,-10],[3,38],[-9,62],[-9,34],[-12,94],[-22,38],[1,19],[-29,20],[7,38],[-13,61],[12,9],[-5,36],[-15,31],[-23,85]],[[9259,6570],[-28,-22],[-1,-13],[-29,-37],[23,-26],[-3,-95],[20,-6],[-27,-38],[-27,-16],[-4,-16],[12,-36],[-40,-32],[-5,-16],[-29,-22],[-8,-18],[-45,-11]]],"transform":{"scale":[0.0029221772689268836,0.0028752730004000387],"translate":[68.14340254000012,6.74555084800015]}} \ No newline at end of file diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/components/mapDrillDownTable.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/components/mapDrillDownTable.js deleted file mode 100644 index 89b334662..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/components/mapDrillDownTable.js +++ /dev/null @@ -1,133 +0,0 @@ -import React, { useContext } from "react"; -import { useTranslation } from "react-i18next"; -import { Loader } from "@egovernments/digit-ui-react-components"; -import { ResponsiveContainer } from "recharts"; -import { format } from "date-fns"; - - -const Backsvg = ({ onClick }) => ( - - - - ); - const key = "DSS_FILTERS"; - - -const getInitialRange = () => { - const data = Digit.SessionStorage.get(key); - const startDate = data?.range?.startDate ? new Date(data?.range?.startDate) : Digit.Utils.dss.getDefaultFinacialYear().startDate; - const endDate = data?.range?.endDate ? new Date(data?.range?.endDate) : Digit.Utils.dss.getDefaultFinacialYear().endDate; - const title = `${format(startDate, "MMM d, yyyy")} - ${format(endDate, "MMM d, yyyy")}`; - const interval = Digit.Utils.dss.getDuration(startDate, endDate); - const denomination = data?.denomination || "Lac"; - const tenantId = data?.filters?.tenantId || []; - return { startDate, endDate, title, interval, denomination, tenantId }; -}; - -const MapDrillChart = ({ - data, - drilldown = true, - selectedState, - setselectedState, - drilldownId, - setdrilldownId, - setTotalCount, - setLiveCount, - -}) => { - const { t } = useTranslation(); - const { id } = data; - const tenantId = Digit.ULBService.getCurrentTenantId(); - let filters = {} - if(selectedState != "") { - filters.state = selectedState; - } - - filters = {...filters}; - - const { startDate, endDate, interval, } = getInitialRange(); - const requestDate = { - startDate: startDate.getTime(), - endDate: endDate.getTime(), - interval: interval, - title: "home", - }; - - const { isLoading, data: response } = Digit.Hooks.dss.useGetChart({ - key: drilldownId, - type: "metric", - tenantId, - requestDate: requestDate, - filters: filters - }); - - const onBack = (selectedState ) => { - setselectedState(""); - setdrilldownId("none"); - setTotalCount(""); - setLiveCount(""); - } - - if(isLoading){ - return ; - } - - const data2 = response?.responseData?.data; - - return ( - -
- {" "} -
- -
- {data2 && data2.length == 0 && ( -
- {t("DSS_NO_DATA")} -
- )} - {data2 && data2[0] && ( - - {t(`DSS_${data2[0].plots[1].name}`)} - {t(`DSS_${data2[0].plots[2].name}`)} - - )} - {data2.map((dat, i) => { - return ( - - {t(`DSS_${dat.plots[1].label}`)} - {dat.plots[2].value} - - ); - })} -
-
); - -} - - -export default MapDrillChart; \ No newline at end of file diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/images/Arrow_Downward.svg b/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/images/Arrow_Downward.svg deleted file mode 100644 index 7f5755afc..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/images/Arrow_Downward.svg +++ /dev/null @@ -1,18 +0,0 @@ - - - - Arrow Downward - Created with Sketch. - - - - - - - - - - - - - \ No newline at end of file diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/images/Arrow_Right.svg b/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/images/Arrow_Right.svg deleted file mode 100644 index c7017054f..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/images/Arrow_Right.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/images/Arrow_Upward.svg b/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/images/Arrow_Upward.svg deleted file mode 100644 index 7bad9d639..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/images/Arrow_Upward.svg +++ /dev/null @@ -1,18 +0,0 @@ - - - - Arrow Upward - Created with Sketch. - - - - - - - - - - - - - \ No newline at end of file diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/images/Digit.png b/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/images/Digit.png deleted file mode 100644 index a82c3aee4c8ab8e422331bde5283808341e6db06..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 9137 zcma)CWm_Cf&s}_xBE{WG(W1p27BB8w++7M3S)2lk7hl}nWs%~=%8fh4p}4!t%kvN3 zxvnH%Co^Y~oJ=CrROH@akYNA-fOiV=AdNRW_$CrS)HhvSYhL_jklmydw198R7ia+m z0B8UTAW1E+%;PL?FQVD&!LHrqG;jWdpS9>Z2>mQ3EB5^{$_ULmRcaWBU`^cQCa{I( zW5OJU2G{^x!3+gzVTl{Csv!qMXTgpYgj$h^kxa-y{Z&V+6VWd51c|_{QK?|XOYiJk z+K~}ax05$%b{l8VGJlM+4qw9PM6>fq>|aHz)7r!#oqsv>n+bycd^M|yiuo#*c(v*l zog!UrYE`OsqXb4f{Z{?_*ao2VQO8$PQ_Ee1+skS}3y2nomHoB851gNA2H$89|K z9QWC{`RRlew8|sOZbA8)%=h9+vkAbpS~X3A_r<#ZDUftNDpTlQ4W9nhw7IY{vC1oZ z$cE(N$ZsB|qj)^!lJcSOSX5uyF6A$YYz&#lckZHvf9F-eAmI7Bq^(n2@$;`J80;J3u!>*=@y_DP1jD3 z3lwQE>A|l-Odg28>(U%=E_$++dEqxurO|Me;>x8!nfKfg5V#~Ft6!*McR2m+Y#Dxh zQR2ANHKRld^YO(eKuYO#F@)TF6nmV@MjLX#>J5)ONL1|KMc?z%q-J2D6{-!!!vm^0 z)Lm2Ib?gh=l*@m(YcBqrlqVg&a^Q1<75JMDkq$8^A=Z5Dc~_j{&d`luZn8kmx?l7Z zly#*-bl&#RDHf(@iK}OO%=kCI<3syO{gHA{?zQo7z1ZmZcpQI!M|cbg*MxHM3sZ3Q z0L*WEx#{SsvQh{C;L;%+o7z7n!=0Kj*TW6WjTZ!zNx`RRw%JHjO&mF>s> zzCAZVK^I79TO}2OwDx-1Fgsp^q0-)KdfQxWKY?462GA%J{qM=&>nv;+hf$hdHrj?- zsimTCPm|n?1g?G_$l^ahQjp{$$0eQ^kC!HHJ(gJ&P7k>|Bk#=mGGH_}V4(nyjDdE8 z>Lh4B@0FG8)CeDa0g&+8X{mwOzkGbIh(2e(f!}|`3&nY%(Hhj+)2fv37$@pFLeAP= z`Q`4-%E2-29F0vc7c0^vlC4KC`-}3)iETL8Q9qIB)5GQSzC|>pFdt-hY{fnrHl4ot zJcq&)0uvW{AAQ!(VTaMN7guoa3bnq6*1lW zF&{bd^3emm9*8s&K}y7P%S)#lN$(a~qwe?Rg>?e3GHKv>zonKDgnbB~VwnsVieJFk%@eXvD0hW}W~tX)G*zbeET5mw93;ryC03T;$Lkgu#$#7CH@CvNi8^TW=U z1zRKG;X#46#yBf&&F<&#_?KO#;#-{kNd5oCh$@Ob9=$f62Uta;+pm1~gH-te1Q>{v z{F?J@)25eN%k3wSC3eTM_*wfoz>1Vpat?M-V2Y)r{!_l=^qL;L-UwySPgq$D8Mzkz z>*0*`otGf$4!n@8q&ComKxb-uSR>~Bgb7fQnUf1BkGIanlcYg7n09!52A|`k+f5$) zr@FJV^Ia4%a()PkCoaUOPX-ygD|Ysa4uafwJcpQSq7iea*H~S_|q94 z_nGw2=;(2+r}KU!Obu~4YOH7XTGYDQAl1UJ>j|6{WQF!+9%7s?527%NHH87^hd{o<_ zYjC9Oxp&cL-m~j*#WM_xG#{ZGG0?*?Z2SanPy5xS1erpxsoe1B-okgZ<~^GK`&Or3 zVzf0Tm*a<9e5Fp_V2{7(HV$oupVDEnC8VKVq3Uv zMgjOe?%V^YnEh^&l4<|Fo5_Z}Z(t#2J^PjA{bWaW_N}ssJgoCI2M)m)>tq{dZvB0E zC1df^(q%8oOb2(P!{kw0c;UOCVQY2EoWbW$?}5mdQ>3VXt?lhr03RYOJ|m;8rSJov zI%uE}vH$`xk5dO+j`DY%?G?nGIGA-DZr$(p>Uufdm%76<&BBUi{sl=`tv=n~=NyS& zez>?C1O(#b7GB);w7CAuUVvBJDXw`v6aLK!m%71s+Z}su^mhB^HIgj~St?a8_?VQ; zsDt#et?3Z97Zn}-#}Q6C&_lr)o$ft~My{?dQGRZkCG{<=-4JnoJWzyz8$N)#zS&Q1 z^XDhxw1E>nue!dy?|TeECGrHPo1?!OgE8c{)0D!IzT>yfRihHoTxxxc#KfsaC?+bJ zdj`h-R|V9TNhv9+H2D&a1Cq#V-!jo+j~6zG8>~hZXXKnL@m&?RPwk~s*$r2hYE65; z((%qyjbQ1_Ww`B(=)d0miQU`AuK^YUBTA@BWhthrAg+#iI)86vA)hFjGqXecD+--8qWXP?Bwixw;qCcoKXk&@JVCh+27|uXm|bKPA2N( zzGMiA951VyqoG5l*gbD`qh=R+|3FbSQ?Vm(l6vTK!luyqb81JGSzTIl9YLWktl!{u zNLlD+=6q6DRX{*FPQ23j8e;H}0kh6lig<9v5Mi?2Bb%RS7TUS@s9^T5~SO0xDar^hM*7idh4$i_WVNNo_j_sV%AJ zqR^aRt(OXT*x;C_68!1Ai+hKr=t^u>+vyk5Wz$C2J|#(C;?1@RBaCX7)Rt56MQ^Za zs@1T5V!k*{e!hD(F8FbfvdoG;J`6PZ}Zh(Xfl+_&Dys% zV|a9V$|nov+JmVOTY=Z~R2PYEG_7-buSdPj1Tl;p6T1;@ zqAPv9L(1cCPqzzl{+?Ar#a8`M%ITjI)>V-o)l9n4XV+LXR#UYRQ~D z2VW#PUtMb0g|fL3#y5tp-FC><2qFYdOaSJyt9 z6~3$tRJ>!qy}WR2$dI!iP5z4Q*l!Xyz181frTKJX3x$k}Z(TaK(FHL=G3HB@9b%ZM z_f9hJ8HW*|tjit|k~)B_;;?iY1vnD!F!Giz}ajYIcwDc5zWA8D(%jVrcH;-XK-Q_OKRzrQKLKmu#TV zAn0yUv&K8ta55^#$uc7kA;mJXE()liG&x3-Va>zl;W260kwTeiH7rW(zp#joh5b`x z2iKWFO{ynJ0K@sm!tzwm;_{=%{&FkWSYl*jaSR_1dbsgp4g?*gmac6s4(g1Q(J!{X zfX|a@L$vyQ1%ii9I)Bf!@wC$~?)EoOL+tNkk1ezQqFW_wY`UqgJ`8OtuHB|D_>6n< zVRGKIKy*F02^_4WbL^MfzvN99OoHE#^t=;4wcmnG z$>*%#uu>Y62|455{tw7%b9VA7ml5RV!|&>^}*fzw@F{yJ}+5&`I0 zc@{@HBL#eZM2rnFadLSIM`DWVcOu}jHRRQsY#VHJd_3)KRh5Pbx>+5eiQjFo%07`H zQInWU7#$2OFE4xlFKbS&lf!CWmZ#&_OJAjI=r{87^JU)=$K7o}SF0-mj0V%O^%O-f z*F$hl92*m2x?O{n3R8HW2zxMH6!rD>-LLj0V@@DXHPc6KSg9Q%SD7uRhRhbf64ZWM zy<}AJq_lJBd8Z)kJ5!2KSFa})2$m~jNy(a$tNPmPUyeTG zh^uSp@%L*KvG~_@`_qB+E1m(G?f*vm`z?K^mHCz5a)e4pzLH9o&@3MvmCS5W9H|o?lhiwa~xYb z9J`H?REh0fB(j}1WLp@ zjj8>v)WyxO^yOGoW^~i6Dg+-swXx4PJfZm&NGFuvVQ7mw5q8UPH6KN=Vg`848b655 zR@x`VaGm)DfLs;QqABkG?O*O}zc$+?eF52wz_{`(xYLfKG7lJ5Rw1`3zN+N=>ZFk+ zI<3j^U*@*9KvecB&(mDatL->p*wil-76#(MVBZ;*;OX;iF7ZkGv-P~tH&2Y6mYz6< z>%TJ<8333#=40_Unw;3YZRye;BA^s=A2uhY8b}6tS!EkJrWnNMfBu|VH!jj7v#7XK zOdK)=P}yNqmYYYbckZs}?GWL#JDuUIQgFN5#M>;)8}ffZ>vQbC8zh%xw6ZdvlA}Uk zq1VIhBF2yz;MMKke@GyW7~ulv96%oC7Uwdw21-YX3Tk+>Tlvzs6+SLvZVJTzocsv; zLK{^|=kKhPSRQO;tCQ?irWq}%`)}TemmHC1Pq>BVVCJpoVHO=EAw){A`MYAsuz-Y+0>&MooLFOMG)#UizNF>%hijJb@7=J7c+ zx(t}Czs6Cdff0HCY{JCp&=ZVO!xs`6!{T*+f6p-ZUF73@Q>8JFTRu0RCb--V8a6`! za%pJjy}k*>_az<9&xp0+!WQ209m~CFtVu`zeb=IWFB87)C2zqCASo#MQ`?V@0~REr8k>F%UP%z z=OYWFiK<2f{kA{+QIvj5^(V=D&-N6l*J-+C{6wabgmNNc69 zkx@|@7SyxhQY0tU=JPvjKM9gFrjBL_Hv{#4s(`ZeK;yOp zdJ@;AtKK?_2p=*KgCr71Qr{4;rvkW*qZ0K|VIvY=yM9*cUpH_pD2oAeg1ea6`oVegoW@}|+e7m{AxI|P!e2=hutA^i=~ zOSBQ^1USXKae$xP{I#`rr#KAS+Qj(^R~JlgSkkbIqHQOx&D2f)z4k`ke&dj9GEH&$ z-o0B>@s0?O=G)b#H1B_HT%c;UnGEjY-R>yod24O_iKT=rktgmUm)>-qT9TMM02W;l z(W{grEKN(etUOCpvcB_bV^!Cg4^lO^wQS9I?&6>n*7K`UhfC!RUG9q4wJ>L?7ECfZ zFSnfUR`0$_{QzqxBhh`()8|1Yf7O*HtA!ghc*0PLSEuZB^Y;v-PtN&JHe<10Ap3-> zbBpaZY;WNX%DMFHxO9L53*_3T7UDq<6pa8K@c@KPmzF5U12~Ig#%SGFKCVR3OP7#Z(=RiJdJ^as@m<`rYHufV%0<;%K{_U~V z=_%b}%Ko3gShWPr*;BHvk&ai3@*EM^CNK2=tzt2LASPn8g`TpB>S__Y9gS1SdLlTeoh!THDehblN2Sr<~DEPxuL)8M}*;&5L7SB4lM=3;d8*BvH8 z1KO}`6c@RUX_Dj5_XleWFpovs;q>IfuXqw&-xpQ0fzYMfEQ&5Vv%f(NQfGWg%54?_m8a!e1i_F z63ml74&o_)(BWf3fSS61v%K43pQBI0cdmau-G-9UETi*hb(AW#?(gtnm3G z`wN8tI2vg)q*U&YW3#NhkaSzN1RO_I|B=7Sqgv-<&td>O3NKpsctue`ZL?J;XJc31 z-p{I>Ec6<8-E0wT*a_!?bf11+ZJYE*qF9yHHBZWc8Yu3T*m*+exvihGxEGiE#r$(K zA`CvBfJ$6y(v0mHv}c{~fpKOy`aNSkNjK%|d-6ktd_sGO%tCzt9@@zoBNN!hRU@0e z7>CQ_;PB6|@D(1eI;oIAsU=d(pF6^151Kn5DJk;W$|o8$BE%jAdn<-F5=TvhGl^G< zAL{L>_;nu9tBJ)CN?(F|xmZ}kfmX{#fC0x(=qmoB|EbpJw@onYr2ea&XV+Qnvr05zaTWB4&rBw`S|4)*poT{$#_cZyDZof2(GaEm^#h6+d31DE_*;Bn zoaGmf+jBJ*&e*BslX74(m)8^>OLOz_UJjt?t6IZ5W@-s>z#HUl1m0i5@LEaEJW2Ct z7BqT>DoPkit{*7@A3lkVqjuS}UQv9VQEJRVrX>$-VkCT-$yoK=P@k+s?6b7IB{nHj zUbT&|C~ez?AcbyQ(CHI2JQ44)ad$#f3V%>=-{8&83_oOw8BbVRct&n>W@S|J)~mm zi@xvC^DG#>g_Sj@bmN!pr~0yi#|eAJzvV04I!2Nz{@Lzx7lIb&rC1ixeW|Vx3N2wf zZFy~OqL=NmEXb80Ey^~La;D!o0CCQ(LQK{`x-XB3mU>mCKCEf>A_}grgk@pu^X_{XwYr!EAMUK$vGkKJG`+xHZk64V_~I z8vt}anj1HJYAY)h*#6C|U1U-l*|P_Gnd;tpX|>23DGGnF3t*;$)F_7c^JGZl;rr$b zrdZ9$^NV9tL8#2Arz;U0k}xaZEO zxK-^A??GK)v4U6d(~d-h>GpM4eOpwHk37<#Tygu9c9dl_jQGq@&+7C_id|Khfmb9nTT-nx zLd%3CP!5k!w%(;4&zn}T%6N2%0{B^9h4py2BKH7ukN4js1&OQ@xVyoYG{Hww%v*u3<%*A^SpSkiMuGo6ZKEB&G>_Axw3go6iSfAgBs6Y+$q6qXh(Kg**T*l9s z++F!^D`&EBwjmcWWisP+DLOn8ZYj;A3WubhiqfUu^ zi$1hkT|PGk*I59hx`QJT4OAaoXjH;LO4Q*n%Rh%I`hU<~kb{kfq!_`iaw7Uw2R^~< zf3&*4qGK9uMk%Y5K6}$3PUf|#qMwN&5F?PYwUjQfk@-q2tq@xtg@ot;f82L}0w)!T zu61wwk;|vYPWb4uExZPL+@F7vk;$uejC|LC7#Kaox^!2Yb2W5DkQW!h(2t8&3Frcg z=+kTI&LH(pWyge(c*uL>{+0zGv2vpT*iEKykfx$y8zymGj|+Ya$gfLoNkxApD-|0- z`wf6f^erL-7VD|$3Y^`TuIbHP$^+L_9N5A71z*n400^K4{OL#b@_jO52^+JGM6)IH zDq&sr^8mLY1a;h@)V@x~q05H{Zrkf{#Vrji_Lepuo>*WA2-3+{PYPgbvLZ2mq5M+a zJ|+=^Y+-38yT)(l2cQEXQ(_RjwlO)&-}jU}pR+dAzRS^LN2+yNi|9d#ggr)ak;l(Z z{}VP=umy1Lv>fa^9%so00sBNjS3!0yktViUvqn-^)MnO6l*WExx{jF8vk1p=++o2m zzi~8x@r;StujSiks*`A?HMBsTL}SO2n6Bq;ldr!u1_y-rCS~!0kOFeio~+j*)I%ld zI`#T0(Eu)^-+VuQ0|e^DV*KO8?QNRoA;{bH`dz+8>Qcvv8d-n2UbN$r2R}rhxj&2& zf2Ru0s$ttrpV>W*4q zs9-BI6O8k7AO}L5W(0yggd~m8CI0*E*c_H1yc$>^yTC~g03aFsZx*1SC!!*%F<#lB ztU<pqAYwfjDQwx-L>tT$x=ddN1*JSsGMaU;oKf6cJ!` z6k4C#cZD8p9KRK~GQj_0_@Aw18VDZw(+iW$-o$3Jyh0DRMNJZ z@rU)o*|>yn#b}I#sDIXL!Y0%8V~Ee{5SIY}FqD9`Tl|ka7M=sj-529m?0f!kqW1(* z8R-n&M2_bMOkhP&>xT#32;4OdzdcRN(cl{-#P(FC)s{w`R%!V`%{=m<+Y(G#;;@v2 zGagwNAs~mTUH>rC=pmfZDcL|Wza(%`2;W9AlbvKzaE+jzuL(;9YcQ0B@%! zDZVASbdr4FGggG?fOXR>8QGean7=Wvmwk9$vx@2cDh~v;v0{##6pIU(j$3YA(Bi>L*L)( z??Qr7dUMWl*B(NVu`Hz; zFF)|IPogFqP$%wD2o - - \ No newline at end of file diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/images/building_permission.svg b/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/images/building_permission.svg deleted file mode 100644 index 0ac430f5a..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/images/building_permission.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/images/complaints.svg b/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/images/complaints.svg deleted file mode 100644 index ae602d545..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/images/complaints.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/images/dashboards.svg b/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/images/dashboards.svg deleted file mode 100644 index 9cf3c33b1..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/images/dashboards.svg +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/images/download.svg b/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/images/download.svg deleted file mode 100644 index 5edf25a1c..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/images/download.svg +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/images/finance.svg b/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/images/finance.svg deleted file mode 100644 index 6b7040bf4..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/images/finance.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/images/fire-noc.svg b/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/images/fire-noc.svg deleted file mode 100644 index bb54060d2..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/images/fire-noc.svg +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/images/firenocdashboard.svg b/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/images/firenocdashboard.svg deleted file mode 100644 index 13d95a012..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/images/firenocdashboard.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/images/fsm.svg b/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/images/fsm.svg deleted file mode 100644 index f0ec928c9..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/images/fsm.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/images/home.svg b/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/images/home.svg deleted file mode 100644 index f7d162b58..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/images/home.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/images/icon-calendar.svg b/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/images/icon-calendar.svg deleted file mode 100644 index 420fabc64..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/images/icon-calendar.svg +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/images/icon-department.svg b/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/images/icon-department.svg deleted file mode 100644 index 4bccbbf39..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/images/icon-department.svg +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/images/icon-districts.svg b/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/images/icon-districts.svg deleted file mode 100644 index da5a0a7a6..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/images/icon-districts.svg +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/images/icon-ul-bs.svg b/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/images/icon-ul-bs.svg deleted file mode 100644 index 1e7e81ee1..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/images/icon-ul-bs.svg +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/images/mcollect.svg b/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/images/mcollect.svg deleted file mode 100644 index 31fabe1ab..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/images/mcollect.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/images/obps.svg b/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/images/obps.svg deleted file mode 100644 index 5b6a282c0..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/images/obps.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/images/property-tax.svg b/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/images/property-tax.svg deleted file mode 100644 index 8c194e6e5..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/images/property-tax.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/images/propertytax_nurt.svg b/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/images/propertytax_nurt.svg deleted file mode 100644 index bda170969..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/images/propertytax_nurt.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/images/shape.svg b/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/images/shape.svg deleted file mode 100644 index 1fe87cad0..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/images/shape.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/images/share.svg b/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/images/share.svg deleted file mode 100644 index 54797ebab..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/images/share.svg +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/images/trade-license.svg b/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/images/trade-license.svg deleted file mode 100644 index fbff29d08..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/images/trade-license.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/images/tradeLic_nurt.svg b/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/images/tradeLic_nurt.svg deleted file mode 100644 index 6020a9214..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/images/tradeLic_nurt.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/images/w&s_nurt.svg b/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/images/w&s_nurt.svg deleted file mode 100644 index b6522744c..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/images/w&s_nurt.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/images/water_sewerage.svg b/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/images/water_sewerage.svg deleted file mode 100644 index 953889e1d..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/images/water_sewerage.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/pages/About.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/pages/About.js deleted file mode 100644 index 1025d3063..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/pages/About.js +++ /dev/null @@ -1,49 +0,0 @@ -import { Card, Loader, Header, CardSubHeader } from "@egovernments/digit-ui-react-components"; -import React, { Fragment } from "react"; -import { useTranslation } from "react-i18next"; -const About = () => { - const { t } = useTranslation(); - const { isLoading, data } = Digit.Hooks.useGetDSSAboutJSON(Digit.ULBService.getStateId()); - const moduleAbout = data?.MdmsRes["dss-dashboard"]?.About[0]?.[`DSS`].About; - const definitionlist = (defineObj) => { - let array = []; - for (var i = 0; i < defineObj.length; i++) { - array.push(t(defineObj[i])); - } - return array.join(" "); - } - if (isLoading) { - return - } - return ( - -
{t("DSS_ABOUT_DASHBOARD")}
- {moduleAbout.map((obj) => ( -
- {t(obj?.titleHeader)} -
{definitionlist(obj?.define)}
- {obj?.definePoints && obj?.titleHeader === "KEY_TERMS" ? -
- {obj?.definePoints?.map((about, i) => ( -
{"•"}
{t(`${about?.point}_HEADER`)} - {t(`${about?.point}_MSG`)}
- ))} -
: null} - {obj?.definePoints && obj?.titleHeader !== "KEY_TERMS" ? -
- {obj?.definePoints?.map((about, i) => ( -
{"•"}
{t(about?.point)}
- ))} -
: null} -
{t(obj?.subdefine)}
- {obj?.subdefinePoints ? -
- {obj?.subdefinePoints?.map((about, i) => ( -
{"•"}
{t(about?.point)}
- ))} -
: null} -
- ))}
-
- ); -}; -export default About; \ No newline at end of file diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/pages/DrillDown.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/pages/DrillDown.js deleted file mode 100644 index 1763d6bc3..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/pages/DrillDown.js +++ /dev/null @@ -1,276 +0,0 @@ -import { Header, Loader, RemoveableTag } from "@egovernments/digit-ui-react-components"; -import { addMonths, endOfYear, format, startOfYear } from "date-fns"; -import React, { useMemo, useState } from "react"; -import { useTranslation } from "react-i18next"; -import CustomBarChart from "../components/CustomBarChart"; -import CustomTable from "../components/CustomTable"; -import FilterContext from "../components/FilterContext"; -import Filters from "../components/Filters"; -import FiltersNational from "../components/FiltersNational"; -import GenericChart from "../components/GenericChart"; - -const key = "DSS_FILTERS"; - -const getInitialRange = () => { - const data = Digit.SessionStorage.get(key); - const startDate = data?.range?.startDate ? new Date(data?.range?.startDate) : addMonths(startOfYear(new Date()), 3); - const endDate = data?.range?.endDate ? new Date(data?.range?.endDate) : addMonths(endOfYear(new Date()), 3); - const title = `${format(startDate, "MMM d, yyyy")} - ${format(endDate, "MMM d, yyyy")}`; - const interval = Digit.Utils.dss.getDuration(startDate, endDate); - const denomination = data?.denomination || "Unit"; - const tenantId = data?.filters?.tenantId || []; - return { startDate, endDate, title, interval, denomination, tenantId }; -}; - -const DrillDown = ({ stateCode }) => { - const [searchQuery, onSearch] = useState(""); - const { ulb, chart, title, type = "table", fillColor = "", isNational = "NO" } = Digit.Hooks.useQueryParams(); - const { t } = useTranslation(); - const nationalDB = isNational == "YES" ? true : false; - const [filters, setFilters] = useState(() => { - const { startDate, endDate, title, interval, denomination, tenantId } = getInitialRange(); - return { - range: { startDate, endDate, title, interval }, - requestDate: { - startDate: startDate.getTime(), - endDate: endDate.getTime(), - interval: interval, - title: title, - }, - filters: { - tenantId: tenantId, - }, - }; - }); - const [showFilters, setShowFilters] = useState(false); - - const handleFilters = (data) => { - Digit.SessionStorage.set(key, data); - setFilters(data); - }; - - const { data: ulbTenants, isLoading: isUlbLoading } = Digit.Hooks.useModuleTenants("DSS"); - const provided = useMemo( - () => ({ - value: filters, - setValue: handleFilters, - }), - [filters] - ); - const { data: nationalInfo, isLoadingNAT } = Digit.Hooks.dss.useMDMS(stateCode, "tenant", ["nationalInfo"], { - select: (data) => { - let nationalInfo = data?.tenant?.nationalInfo || []; - let combinedResult = nationalInfo.reduce((acc, curr) => { - if (acc[curr.stateCode]) { - acc[curr.stateCode].push(curr); - } else { - acc[curr.stateCode] = [curr]; - } - return { ...acc }; - }, {}); - let formattedResponse = { ddr: [], ulb: [] }; - Object.keys(combinedResult).map((key) => { - let stateName = combinedResult[key]?.[0].stateName; - formattedResponse.ddr.push({ code: key, ddrKey: stateName, ulbKey: stateName }); - formattedResponse.ulb.push(...combinedResult[key].map((e) => ({ code: e.code, ulbKey: e.name, ddrKey: e.stateName }))); - }); - return formattedResponse; - }, - enabled: nationalDB, - }); - const removeULB = (id) => { - handleFilters({ - ...filters, - filters: { ...filters?.filters, tenantId: [...filters?.filters?.tenantId].filter((tenant, index) => index !== id) }, - }); - }; - const removeST = (id) => { - let newStates = [...filters?.filters?.state].filter((tenant, index) => index !== id); - let newUlbs = filters?.filters?.ulb || []; - if (newStates?.length == 0) { - newUlbs = []; - } else { - let filteredUlbs = nationalInfo?.ulb?.filter((e) => Digit.Utils.dss.getCitiesAvailable(e, newStates))?.map((ulbs) => ulbs?.code); - newUlbs = newUlbs.filter((ulb) => filteredUlbs.includes(ulb)); - } - handleFilters({ - ...filters, - filters: { ...filters?.filters, state: newStates, ulb: newUlbs }, - }); - }; - - const removeTenant = (id) => { - handleFilters({ - ...filters, - filters: { ...filters?.filters, ulb: [...filters?.filters?.ulb].filter((tenant, index) => index !== id) }, - }); - }; - const handleClear = () => { - handleFilters({ ...filters, filters: { ...filters?.filters, tenantId: [] } }); - }; - const clearAllTn = () => { - handleFilters({ ...filters, filters: { ...filters?.filters, ulb: [] } }); - }; - const clearAllSt = () => { - handleFilters({ ...filters, filters: { ...filters?.filters, state: [], ulb: [] } }); - }; - - if (isUlbLoading) { - return ; - } - - return ( - -
{t(title)}
- {isNational ? ( - - ) : ( - - )} - {filters?.filters?.tenantId?.length > 0 && ( -
- {!showFilters && - filters?.filters?.tenantId && - filters.filters.tenantId - .slice(0, 5) - .map((filter, id) => ( - removeULB(id)} - /> - ))} - {filters?.filters?.tenantId?.length > 6 && ( - <> - {showFilters && - filters.filters.tenantId.map((filter, id) => ( - removeULB(id)} - /> - ))} - {!showFilters && ( -

setShowFilters(true)}> - {t(`DSS_FILTER_SHOWALL`)} -

- )} - {showFilters && ( -

setShowFilters(false)}> - {t(`DSS_FILTER_SHOWLESS`)} -

- )} - - )} -

- {t(`DSS_FILTER_CLEAR`)} -

-
- )} - {filters?.filters?.state?.length > 0 && ( -
- {!showFilters && - filters?.filters?.state && - filters.filters.state - .slice(0, 5) - .map((filter, id) => ( - removeST(id)} - /> - ))} - {filters?.filters?.state?.length > 6 && ( - <> - {showFilters && - filters.filters.state.map((filter, id) => ( - removeST(id)} - /> - ))} - {!showFilters && ( -

setShowFilters(true)}> - {t(`DSS_FILTER_SHOWALL`)} -

- )} - {showFilters && ( -

setShowFilters(false)}> - {t(`DSS_FILTER_SHOWLESS`)} -

- )} - - )} -

- {t(`DSS_FILTER_CLEAR_ST`)} -

-
- )} - {filters?.filters?.ulb?.length > 0 && ( -
- {!showFilters && - filters?.filters?.ulb && - filters.filters.ulb - .slice(0, 5) - .map((filter, id) => ( - removeTenant(id)} - /> - ))} - {filters?.filters?.ulb?.length > 6 && ( - <> - {showFilters && - filters.filters.ulb.map((filter, id) => ( - removeTenant(id)} - /> - ))} - {!showFilters && ( -

setShowFilters(true)}> - {t(`DSS_FILTER_SHOWALL`)} -

- )} - {showFilters && ( -

setShowFilters(false)}> - {t(`DSS_FILTER_SHOWLESS`)} -

- )} - - )} -

- {t(`DSS_FILTER_CLEAR_TN`)} -

-
- )} - {type === "table" && ( - onSearch(e.target.value)} - showHeader={false} - > - - - )} - {type === "performing-metric" && ( - - - - )} -
- ); -}; - -export default DrillDown; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/pages/FAQs/FAQComponent.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/pages/FAQs/FAQComponent.js deleted file mode 100644 index f6995d6dd..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/pages/FAQs/FAQComponent.js +++ /dev/null @@ -1,59 +0,0 @@ -import React, { useState } from "react"; -import { ArrowForward } from "@egovernments/digit-ui-react-components"; -import { useTranslation } from "react-i18next"; - -const FAQComponent = props => { - const { question, answer, index, lastIndex, subAnswer, acrynom} = props; - const [isOpen, toggleOpen] = useState(false); - const { t } = useTranslation(); - const selectedLanguage = Digit.StoreData.getCurrentLanguage(); - return ( -
toggleOpen(!isOpen)}> -
30 && isOpen ? "revert" : "space-between", display: Digit.Utils.browser.isMobile() && t(question).length > 30 && isOpen ? "block" : "flex"}}> - - {`${index}. `+ t(question)} - - 27 ? "12%" : "8%") : ""*/}}> - {isOpen ? : } - -
- -
- -
- {answer?.map((obj,i) => - - {t(obj.ans)} - )} - {acrynom?.map((obj,i) => -
- {t(obj.acr)} - - - {t(obj.fullForm)} -
)} - - {answer?.map((obj) => - - {obj.point ? "•" : null}
{t(obj.point)}
-
)} -
-
{subAnswer?.map((obj) => - - {t(obj.ans)} - )} - {subAnswer?.map((obj) => - - {obj.point ? "•" : null}
{t(obj.point)}
-
)} -
-
- {!lastIndex ?
: null} -
- ); -}; - -export default FAQComponent; \ No newline at end of file diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/pages/FAQs/FAQs.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/pages/FAQs/FAQs.js deleted file mode 100644 index fb91f6547..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/pages/FAQs/FAQs.js +++ /dev/null @@ -1,32 +0,0 @@ -import { Header, TextInput, ArrowForward, Loader, BackButton} from "@egovernments/digit-ui-react-components"; -import React, { useState, Fragment, useRef, useEffect}from "react"; -import { useTranslation } from "react-i18next"; -import FAQComponent from "./FAQComponent"; -const FAQsSection = () => { - const user = Digit.UserService.getUser(); - const tenantId = user?.info?.tenantId || Digit.ULBService.getCurrentTenantId(); - const { t } = useTranslation(); - const { isLoading, data } = Digit.Hooks.useGetDSSFAQsJSON(Digit.ULBService.getStateId()); - const moduleFAQs = data?.MdmsRes["dss-dashboard"]?.FAQs[0]?.[`DSS`].FAQs; - - if(isLoading){ - return - } - return ( - -
-
-
{t("DSS_FAQS")}
-
- -
- {moduleFAQs.map((faq, i) => ( - - ))} -
-
-
- ); -}; - -export default FAQsSection; \ No newline at end of file diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/pages/Home.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/pages/Home.js deleted file mode 100644 index 2ecc84014..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/pages/Home.js +++ /dev/null @@ -1,512 +0,0 @@ -import { - Card, - CardHeader, - DownloadIcon, - EmailIcon, - Header, - Loader, - MultiLink, - Poll, - Rating, - ShareIcon, - WhatsappIcon, -} from "@egovernments/digit-ui-react-components"; -import { format } from "date-fns"; -import React, { useMemo, useRef, useState, useContext } from "react"; -import { useTranslation } from "react-i18next"; -import { useParams } from "react-router-dom"; -import FilterContext from "../components/FilterContext"; -import { ArrowUpwardElement } from "../components/ArrowUpward"; -import { ArrowDownwardElement } from "../components/ArrowDownward"; -import { Bar, BarChart, CartesianGrid, Legend, ResponsiveContainer, Tooltip, XAxis, YAxis } from "recharts"; -import { Icon } from "../components/common/Icon"; -import MapChart from "../components/MapChart"; -import MapDrillChart from "../components/mapDrillDownTable"; -import NoData from "../components/NoData"; -import { ReactComponent as Arrow_Right } from "../images/Arrow_Right.svg"; -import { checkCurrentScreen } from "../components/DSSCard"; - -const key = "DSS_FILTERS"; -const getInitialRange = () => { - const data = Digit.SessionStorage.get(key); - const startDate = data?.range?.startDate ? new Date(data?.range?.startDate) : Digit.Utils.dss.getDefaultFinacialYear().startDate; - const endDate = data?.range?.endDate ? new Date(data?.range?.endDate) : Digit.Utils.dss.getDefaultFinacialYear().endDate; - const title = `${format(startDate, "MMM d, yyyy")} - ${format(endDate, "MMM d, yyyy")}`; - const interval = Digit.Utils.dss.getDuration(startDate, endDate); - const denomination = data?.denomination || "Lac"; - const tenantId = data?.filters?.tenantId || []; - return { startDate, endDate, title, interval, denomination, tenantId }; -}; -const colors = [ - { dark: "rgba(12, 157, 149, 0.85)", light: "rgba(11, 222, 133, 0.14)" }, - { dark: "rgba(251, 192, 45, 0.85)", light: "rgba(255, 202, 69, 0.24)" }, - { dark: "rgba(75, 31, 165, 0.85)", light: "rgba(138, 83, 255, 0.24)" }, - { dark: "rgba(4, 139, 208, 0.85)", light: "rgba(4, 139, 208, 0.24)" }, - { dark: "rgba(239, 124, 91, 0.85)", light: "rgba(255, 114, 69, 0.24)" }, - { dark: "rgba(81, 210, 198, 0.85)", light: "rgba(83, 255, 234, 0.14)" }, - { dark: "rgba(183, 165, 69, 0.85)", light: "rgba(222, 188, 11, 0.24)" }, - { dark: "rgba(110, 132, 89, 1)", light: "rgba(159, 255, 83, 0.24)" }, - { dark: "rgba(120, 120, 120, 0.85)", light: "rgb(120,120,120,0.35)" }, - { dark: "rgba(183, 165, 69, 0.85)", light: "rgba(222, 188, 11, 0.24)" }, - { dark: "rgba(183, 165, 69, 0.85)", light: "rgba(222, 188, 11, 0.24)" }, -]; - -const Chart = ({ data, moduleLevel, overview = false }) => { - const { t } = useTranslation(); - const tenantId = Digit.ULBService.getCurrentTenantId(); - const { id, chartType } = data; - const { startDate, endDate, interval } = getInitialRange(); - const requestDate = { - startDate: startDate.getTime(), - endDate: endDate.getTime(), - interval: interval, - title: "home", - }; - - const { isLoading, data: response } = Digit.Hooks.dss.useGetChart({ - key: id, - type: chartType, - tenantId, - requestDate, - moduleLevel: moduleLevel, - }); - - if (isLoading) { - return ; - } - const insight = response?.responseData?.data?.[0]?.insight?.value?.replace(/[+-]/g, "")?.split("%"); - return ( -
-
-

{t(data?.name)}

- - {t(`TIP_${data.name}`)} - -
- {data.name === "NATIONAL_DSS_OVERVIEW_CITIZEN_FEEDBACK_SCORE" ? ( - - ) : ( -

- {Digit.Utils.dss.formatter(response?.responseData?.data?.[0]?.headerValue, response?.responseData?.data?.[0]?.headerSymbol, "Lac", true, t)} -

- )} - {response?.responseData?.data?.[0]?.insight?.value ? ( -

- {response?.responseData?.data?.[0]?.insight?.indicator === "upper_green" ? ArrowUpwardElement("10px") : ArrowDownwardElement("10px")} - {insight?.[0] && `${insight[0]}% ${t(Digit.Utils.locale.getTransformedLocale("DSS" + insight?.[1] || ""))}`} -

- ) : null} -
- ); -}; - -const HorBarChart = ({ data, setselectState = "" }) => { - const barColors = ["#298CFF", "#54D140"]; - const { t } = useTranslation(); - const tenantId = Digit.ULBService.getCurrentTenantId(); - const { id, chartType } = data; - let filters = {}; - - if (setselectState !== "") filters.state = setselectState; - - filters = { ...filters }; - const { startDate, endDate, interval } = getInitialRange(); - const requestDate = { - startDate: startDate.getTime(), - endDate: endDate.getTime(), - interval: interval, - title: "home", - }; - - const { isLoading, data: response } = Digit.Hooks.dss.useGetChart({ - key: id, - type: chartType, - tenantId, - requestDate, - filters: filters, - }); - - const constructChartData = (data) => { - let result = {}; - for (let i = 0; i < data?.length; i++) { - const row = data[i]; - for (let j = 0; j < row.plots.length; j++) { - const plot = row.plots[j]; - result[plot.name] = { ...result[plot.name], [t(row.headerName)]: plot?.value, name: t(plot.name) }; - } - } - return Object.keys(result).map((key) => { - return { - name: key, - ...result[key], - }; - }); - }; - const renderLegend = (value) => ( - {t(`DSS_${Digit.Utils.locale.getTransformedLocale(value)}`)} - ); - const chartData = useMemo(() => constructChartData(response?.responseData?.data)); - - if (isLoading) { - return ; - } - - const bars = response?.responseData?.data?.map((bar) => bar?.headerName); - return ( - - {chartData?.length === 0 || !chartData ? ( - - ) : ( - - - - - {bars?.map((bar, id) => ( - 2 ? 1 : id} /> - ))} - - - - )} - - ); -}; - -const Home = ({ stateCode }) => { - const tenantId = Digit.ULBService.getCurrentTenantId(); - const { t } = useTranslation(); - const [filters, setFilters] = useState(() => {}); - const { moduleCode } = useParams(); - const language = Digit.StoreData.getCurrentLanguage(); - const { isLoading: localizationLoading, data: store } = Digit.Services.useStore({ stateCode, moduleCode, language }); - const { data: response, isLoading } = Digit.Hooks.dss.useDashboardConfig(moduleCode); - const [showOptions, setShowOptions] = useState(false); - const [selectedState, setselectedState] = useState(""); - const [drillDownId, setdrillDownId] = useState("none"); - const [totalCount, setTotalCount] = useState(""); - const [liveCount, setLiveCount] = useState(""); - - const handleFilters = (data) => { - Digit.SessionStorage.set(key, data); - setFilters(data); - }; - function routeTo(jumpTo) { - location.href = jumpTo; - } - const fullPageRef = useRef(); - const provided = useMemo( - () => ({ - value: filters, - setValue: handleFilters, - }), - [filters] - ); - - const mobileView = innerWidth <= 640; - - const handlePrint = () => Digit.Download.PDF(fullPageRef, t(dashboardConfig?.[0]?.name)); - - const dashboardConfig = response?.responseData; - - const shareOptions = navigator.share - ? [ - { - label: t("ES_DSS_SHARE_PDF"), - onClick: () => { - setShowOptions(!showOptions); - setTimeout(() => { - return Digit.ShareFiles.PDF(tenantId, fullPageRef, t(dashboardConfig?.[0]?.name)); - }, 500); - }, - }, - { - label: t("ES_DSS_SHARE_IMAGE"), - onClick: () => { - setShowOptions(!showOptions); - setTimeout(() => { - return Digit.ShareFiles.Image(tenantId, fullPageRef, t(dashboardConfig?.[0]?.name)); - }, 500); - }, - }, - ] - : [ - { - icon: , - label: t("ES_DSS_SHARE_PDF"), - onClick: () => { - setShowOptions(!showOptions); - setTimeout(() => { - return Digit.ShareFiles.PDF(tenantId, fullPageRef, t(dashboardConfig?.[0]?.name), "mail"); - }, 500); - }, - }, - { - icon: , - label: t("ES_DSS_SHARE_PDF"), - onClick: () => { - setShowOptions(!showOptions); - setTimeout(() => { - return Digit.ShareFiles.PDF(tenantId, fullPageRef, t(dashboardConfig?.[0]?.name), "whatsapp"); - }, 500); - }, - }, - { - icon: , - label: t("ES_DSS_SHARE_IMAGE"), - onClick: () => { - setShowOptions(!showOptions); - setTimeout(() => { - return Digit.ShareFiles.Image(tenantId, fullPageRef, t(dashboardConfig?.[0]?.name), "mail"); - }, 500); - }, - }, - { - icon: , - label: t("ES_DSS_SHARE_IMAGE"), - onClick: () => { - setShowOptions(!showOptions); - setTimeout(() => { - return Digit.ShareFiles.Image(tenantId, fullPageRef, t(dashboardConfig?.[0]?.name), "whatsapp"); - }, 500); - }, - }, - ]; - - if (isLoading || localizationLoading) { - return ; - } - - return ( - -
-
-
{t(dashboardConfig?.[0]?.name)}
- {mobileView ? null : ( -
-
- } - showOptions={(e) => setShowOptions(e)} - onHeadClick={(e) => setShowOptions(e !== undefined ? e : !showOptions)} - displayOptions={showOptions} - options={shareOptions} - /> -
-
- - {t(`ES_DSS_DOWNLOAD`)} -
-
- )} -
- - {mobileView ? ( -
-
- } - showOptions={(e) => setShowOptions(e)} - onHeadClick={(e) => setShowOptions(e !== undefined ? e : !showOptions)} - displayOptions={showOptions} - options={shareOptions} - /> -
-
- - {t(`ES_DSS_DOWNLOAD`)} -
-
- ) : null} - {dashboardConfig?.[0]?.visualizations.map((row, key) => { - return ( -
- {row.vizArray.map((item, index) => { - if (item?.charts?.[0]?.chartType == "bar") { - return null; - } else if (item?.charts?.[0]?.chartType == "map") { - return ( -
-
-
- {Icon(item.name)} -

- {selectedState === "" ? t(item.name) : t(`DSS_TB_${Digit.Utils.locale.getTransformedLocale(selectedState)}`)} -

- {selectedState != "" && item.name.includes("PROJECT_STAUS") && ( - - {t(`DSS_TOTAL_ULBS`)} {Number(totalCount).toFixed()} | {t(`DSS_LIVE_ULBS`)} {Number(liveCount).toFixed()} - - )} -
- {item?.charts?.[0]?.chartType == "map" && ( -
- {Icon(row.vizArray?.[1]?.name)} -

- {selectedState === "" - ? t(row.vizArray?.[1]?.name) - : t(`${Digit.Utils.locale.getTransformedLocale(selectedState)}_${row.vizArray?.[1]?.name}`)} -

-
- )} -
-
- {item?.charts?.[0]?.chartType == "map" && - (selectedState != "" ? ( - - ) : ( - - ))} - {item?.charts?.[0]?.chartType == "map" && ( - - )} -
-
- ); - } else { - return ( -
routeTo(`/mgramseva-digit-ui/employee/dss/dashboard/${item.ref.url}`)} - > -
-
- {Icon(item.name, colors[index].dark)} -

{t(item.name)}

-
- {item.vizType == "collection" ? ( -
- {t("DSS_OVERVIEW")} - - {" "} - - -
- ) : null} -
- -
- {item.charts.map((chart, key) => ( -
- -
- ))} -
-
- ); - } - })} -
- ); - })} -
-
- ); -}; - -export default Home; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/pages/Overview.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/pages/Overview.js deleted file mode 100644 index 45d8bcbc8..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/pages/Overview.js +++ /dev/null @@ -1,25 +0,0 @@ -import React from "react"; -import { useTranslation } from "react-i18next"; -import { Header, Loader } from "@egovernments/digit-ui-react-components"; -import Layout from "../components/Layout"; - -const Overview = () => { - const { t } = useTranslation(); - const moduleCode = "home"; - const { data: response, isLoading } = Digit.Hooks.dss.useDashboardConfig(moduleCode); - - if (isLoading) { - return ; - } - - return ( -
-
{t(response?.[0]?.name)}
- {response?.responseData?.[0]?.visualizations.map((item, key) => ( - - ))} -
- ); -}; - -export default Overview; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/pages/index.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/pages/index.js deleted file mode 100644 index 8e58cf58d..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/dss/src/pages/index.js +++ /dev/null @@ -1,487 +0,0 @@ -import { - DownloadIcon, - EmailIcon, - FilterIcon, - Header, - Loader, - MultiLink, - RemoveableTag, - ShareIcon, - WhatsappIcon, -} from "@egovernments/digit-ui-react-components"; -import { format } from "date-fns"; -import React, { useEffect, Fragment, useMemo, useRef, useState } from "react"; -import { useTranslation } from "react-i18next"; -import { useParams } from "react-router-dom"; -import { checkCurrentScreen } from "../components/DSSCard"; -import FilterContext from "../components/FilterContext"; -import Filters from "../components/Filters"; -import FiltersNational from "../components/FiltersNational"; -import Layout from "../components/Layout"; - -const key = "DSS_FILTERS"; - -const getInitialRange = () => { - const data = Digit.SessionStorage.get(key); - const startDate = data?.range?.startDate ? new Date(data?.range?.startDate) : Digit.Utils.dss.getDefaultFinacialYear().startDate; - const endDate = data?.range?.endDate ? new Date(data?.range?.endDate) : Digit.Utils.dss.getDefaultFinacialYear().endDate; - const title = `${format(startDate, "MMM d, yyyy")} - ${format(endDate, "MMM d, yyyy")}`; - const interval = Digit.Utils.dss.getDuration(startDate, endDate); - const denomination = data?.denomination || "Lac"; - const tenantId = data?.filters?.tenantId || []; - const moduleLevel = data?.moduleLevel || ""; - return { startDate, endDate, title, interval, denomination, tenantId, moduleLevel }; -}; - -const DashBoard = ({ stateCode }) => { - const tenantId = Digit.ULBService.getCurrentTenantId(); - const { t } = useTranslation(); - const [filters, setFilters] = useState(() => { - const { startDate, endDate, title, interval, denomination, tenantId, moduleLevel } = getInitialRange(); - return { - denomination, - range: { startDate, endDate, title, interval }, - requestDate: { - startDate: startDate.getTime(), - endDate: endDate.getTime(), - interval: interval, - title: title, - }, - filters: { - tenantId, - }, - moduleLevel: moduleLevel, - }; - }); - const [isFilterModalOpen, setIsFilterModalOpen] = useState(false); - const isNational = checkCurrentScreen(); - const { moduleCode } = useParams(); - - const language = Digit.StoreData.getCurrentLanguage(); - - const { isLoading: localizationLoading, data: store } = Digit.Services.useStore({ stateCode, moduleCode, language }); - const { data: screenConfig, isLoading: isServicesLoading } = Digit.Hooks.dss.useMDMS(stateCode, "dss-dashboard", "DssDashboard", { - select: (data) => { - let screenConfig = data?.["dss-dashboard"]["dashboard-config"][0].MODULE_LEVEL; - let reduced_array = []; - for (let i = 0; i < screenConfig.length; i++) { - if (screenConfig[i].dashboard !== null) { - reduced_array.push(screenConfig[i]); - } - } - - const serviceJS = reduced_array.map((obj, idx) => { - return { - code: obj[Object.keys(obj)[0]].filterKey, - name: Digit.Utils.locale.getTransformedLocale(`DSS_${obj[Object.keys(obj)[0]].services_name}`), - }; - }); - return serviceJS; - }, - }); - const { data: nationalInfo, isLoadingNAT } = Digit.Hooks.dss.useMDMS(stateCode, "tenant", ["nationalInfo"], { - select: (data) => { - let nationalInfo = data?.tenant?.nationalInfo || []; - let combinedResult = nationalInfo.reduce((acc, curr) => { - if (acc[curr.stateCode]) { - acc[curr.stateCode].push(curr); - } else { - acc[curr.stateCode] = [curr]; - } - return { ...acc }; - }, {}); - let formattedResponse = { ddr: [], ulb: [] }; - Object.keys(combinedResult).map((key) => { - let stateName = combinedResult[key]?.[0].stateName; - formattedResponse.ddr.push({ code: key, ddrKey: stateName, ulbKey: stateName }); - formattedResponse.ulb.push(...combinedResult[key].map((e) => ({ code: e.code, ulbKey: e.name, ddrKey: e.stateName }))); - }); - return formattedResponse; - }, - enabled: isNational, - }); - - const { data: response, isLoading } = Digit.Hooks.dss.useDashboardConfig(moduleCode); - const { data: ulbTenants, isLoading: isUlbLoading } = Digit.Hooks.useModuleTenants("DSS"); - const { isLoading: isMdmsLoading, data: mdmsData } = Digit.Hooks.useCommonMDMS(stateCode, "FSM", "FSTPPlantInfo"); - const [showOptions, setShowOptions] = useState(false); - const [showFilters, setShowFilters] = useState(false); - const [tabState, setTabState] = useState(""); - - const handleFilters = (data) => { - Digit.SessionStorage.set(key, data); - setFilters(data); - }; - const fullPageRef = useRef(); - const provided = useMemo( - () => ({ - value: filters, - setValue: handleFilters, - ulbTenants: isNational ? nationalInfo : ulbTenants, - fstpMdmsData: mdmsData, - screenConfig: screenConfig, - }), - [filters, isUlbLoading, isMdmsLoading, isServicesLoading] - ); - - const mobileView = window.Digit.Utils.browser.isMobile(); - - const handlePrint = () => Digit.Download.PDF(fullPageRef, t(dashboardConfig?.[0]?.name)); - - const removeULB = (id) => { - handleFilters({ - ...filters, - filters: { ...filters?.filters, tenantId: [...filters?.filters?.tenantId].filter((tenant, index) => index !== id) }, - }); - }; - const removeST = (id) => { - let newStates = [...filters?.filters?.state].filter((tenant, index) => index !== id); - let newUlbs = filters?.filters?.ulb || []; - if (newStates?.length == 0) { - newUlbs = []; - } else { - let filteredUlbs = nationalInfo?.ulb?.filter((e) => Digit.Utils.dss.getCitiesAvailable(e, newStates))?.map((ulbs) => ulbs?.code); - newUlbs = newUlbs.filter((ulb) => filteredUlbs.includes(ulb)); - } - handleFilters({ - ...filters, - filters: { ...filters?.filters, state: newStates, ulb: newUlbs }, - }); - }; - - const removeService = () => { - handleFilters({ - ...filters, - moduleLevel: "", - }); - }; - - const removeTenant = (id) => { - handleFilters({ - ...filters, - filters: { ...filters?.filters, ulb: [...filters?.filters?.ulb].filter((tenant, index) => index !== id) }, - }); - }; - - const handleClear = () => { - handleFilters({ ...filters, filters: { ...filters?.filters, tenantId: [] } }); - }; - - const clearAllTn = () => { - handleFilters({ ...filters, filters: { ...filters?.filters, ulb: [] } }); - }; - const clearAllSt = () => { - handleFilters({ ...filters, filters: { ...filters?.filters, state: [], ulb: [] } }); - }; - const clearAllServices = () => { - handleFilters({ ...filters, moduleLevel: "" }); - }; - - const dashboardConfig = response?.responseData; - let tabArrayObj = - dashboardConfig?.[0]?.visualizations?.reduce((curr, acc) => { - curr[acc.name] = 0; - return { ...curr }; - }, {}) || {}; - let tabArray = Object.keys(tabArrayObj).map((key) => key); - - useEffect(() => { - if (tabArray?.length > 0 && tabState == "") { - setTabState(tabArray[0]); - } - }, [tabArray]); - - const shareOptions = - // navigator.share - // ? [ - // { - // label: t("ES_DSS_SHARE_PDF"), - // onClick: (e) => { - // setShowOptions(!showOptions); - // setTimeout(() => { - // return Digit.ShareFiles.DownloadImage(tenantId, fullPageRef, t(dashboardConfig?.[0]?.name)); - // }, 500); - // }, - // }, - // { - // label: t("ES_DSS_SHARE_IMAGE"), - // onClick: () => { - // setShowOptions(!showOptions); - // setTimeout(() => { - // return Digit.ShareFiles.DownloadImage(tenantId, fullPageRef, t(dashboardConfig?.[0]?.name)); - // }, 500); - // }, - // }, - // ] - // : - [ - /* - { - icon: , - label: t("ES_DSS_SHARE_PDF"), - onClick: () => { - setShowOptions(!showOptions); - setTimeout(() => { - return Digit.ShareFiles.PDF(tenantId, fullPageRef, t(dashboardConfig?.[0]?.name), "mail"); - }, 500); - }, - }, - { - icon: , - label: t("ES_DSS_SHARE_PDF"), - onClick: () => { - setShowOptions(!showOptions); - setTimeout(() => { - return Digit.ShareFiles.PDF(tenantId, fullPageRef, t(dashboardConfig?.[0]?.name), "whatsapp"); - }, 500); - }, - }, - */ - { - icon: , - label: t("ES_DSS_SHARE_IMAGE"), - onClick: () => { - setShowOptions(!showOptions); - setTimeout(() => { - return Digit.ShareFiles.DownloadImage(tenantId, fullPageRef, t(dashboardConfig?.[0]?.name), "mail"); - }, 500); - }, - }, - { - icon: , - label: t("ES_DSS_SHARE_IMAGE"), - onClick: () => { - setShowOptions(!showOptions); - setTimeout(() => { - return Digit.ShareFiles.DownloadImage(tenantId, fullPageRef, t(dashboardConfig?.[0]?.name), "whatsapp"); - }, 500); - }, - }, - ]; - - if (isLoading || isUlbLoading || localizationLoading || isMdmsLoading || isLoadingNAT || isServicesLoading) { - return ; - } - return ( - -
-
-
- {t(dashboardConfig?.[0]?.name)} -
- {mobileView ? null : ( -
-
- } - // showOptions={(e) => { - // setShowOptions(e)} - // } - onHeadClick={(e) => { - setShowOptions(!showOptions); - }} - displayOptions={showOptions} - options={shareOptions} - /> -
-
- - {t(`ES_DSS_DOWNLOAD`)} -
-
- )} -
- {isNational ? ( - setIsFilterModalOpen(false)} - isNational={isNational} - /> - ) : ( - setIsFilterModalOpen(false)} - isNational={isNational} - showDateRange={dashboardConfig?.[0]?.name.includes("DSS_FINANCE_DASHBOARD") ? false : true} - /> - )} - {filters?.filters?.tenantId?.length > 0 && ( -
- {!showFilters && - filters?.filters?.tenantId && - filters.filters.tenantId - .slice(0, 5) - .map((filter, id) => removeULB(id)} />)} - {filters?.filters?.tenantId?.length > 6 && ( - <> - {showFilters && - filters.filters.tenantId.map((filter, id) => ( - removeULB(id)} /> - ))} - {!showFilters && ( -

setShowFilters(true)}> - {t(`DSS_FILTER_SHOWALL`)} -

- )} - {showFilters && ( -

setShowFilters(false)}> - {t(`DSS_FILTER_SHOWLESS`)} -

- )} - - )} -

- {t(`DSS_FILTER_CLEAR`)} -

-
- )} - {filters?.filters?.state?.length > 0 && ( -
- {!showFilters && - filters?.filters?.state && - filters.filters.state - .slice(0, 5) - .map((filter, id) => ( - removeST(id)} - /> - ))} - {filters?.filters?.state?.length > 6 && ( - <> - {showFilters && - filters.filters.state.map((filter, id) => ( - removeST(id)} - /> - ))} - {!showFilters && ( -

setShowFilters(true)}> - {t(`DSS_FILTER_SHOWALL`)} -

- )} - {showFilters && ( -

setShowFilters(false)}> - {t(`DSS_FILTER_SHOWLESS`)} -

- )} - - )} -

- {t(`DSS_FILTER_CLEAR_ST`)} -

-
- )} - {filters?.filters?.ulb?.length > 0 && ( -
- {!showFilters && - filters?.filters?.ulb && - filters.filters.ulb - .slice(0, 5) - .map((filter, id) => ( - removeTenant(id)} - /> - ))} - {filters?.filters?.ulb?.length > 6 && ( - <> - {showFilters && - filters.filters.ulb.map((filter, id) => ( - removeTenant(id)} - /> - ))} - {!showFilters && ( -

setShowFilters(true)}> - {t(`DSS_FILTER_SHOWALL`)} -

- )} - {showFilters && ( -

setShowFilters(false)}> - {t(`DSS_FILTER_SHOWLESS`)} -

- )} - - )} -

- {t(`DSS_FILTER_CLEAR_TN`)} -

-
- )} - {filters?.moduleLevel?.length > 0 && ( -
- {!showFilters && filters?.moduleLevel && ( - removeService()} - /> - )} -

- {t(`DSS_FILTER_CLEAR`)} -

-
- )} - - {mobileView ? ( -
-
- setIsFilterModalOpen(!isFilterModalOpen)} style /> -
-
- } - onHeadClick={(e) => { - setShowOptions(!showOptions); - }} - displayOptions={showOptions} - options={shareOptions} - /> -
-
- - {t(`ES_DSS_DOWNLOAD`)} -
-
- ) : null} -
- {tabArray && tabArray?.length > 1 && ( -
-
- {tabArray?.map((key) => ( -
setTabState(key)}> - {t(key)} -
- ))} -
-
- )} -
- {dashboardConfig?.[0]?.visualizations - .filter((row) => row.name === tabState) - .map((row, key) => { - return ; - })} -
-
- ); -}; - -export default DashBoard; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/package.json b/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/package.json deleted file mode 100644 index a5727349c..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/package.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "name": "@egovernments/digit-ui-module-engagement", - "version": "1.7.0-beta.1", - "license": "MIT", - "main": "dist/index.js", - "module": "dist/index.modern.js", - "source": "src/Module.js", - "files": [ - "dist" - ], - "scripts": { - "start": "microbundle-crl watch --no-compress --format modern,cjs", - "build": "microbundle-crl --compress --no-sourcemap --format cjs", - "prepublish": "yarn build" - }, - "peerDependencies": { - "react": "17.0.2", - "react-router-dom": "5.3.0" - }, - "dependencies": { - "@egovernments/digit-ui-react-components": "^1.7.0-beta.1", - "react": "17.0.2", - "react-dom": "17.0.2", - "react-hook-form": "6.15.8", - "react-i18next": "11.16.2", - "react-query": "3.6.1", - "react-router-dom": "5.3.0", - "react-time-picker": "4.2.1", - "recharts": "^2.0.9" - } -} diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/Module.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/Module.js deleted file mode 100644 index e6f6645fd..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/Module.js +++ /dev/null @@ -1,306 +0,0 @@ -import { Loader, BreadCrumb } from "@egovernments/digit-ui-react-components"; -import React, { Fragment } from "react"; -import { useTranslation } from "react-i18next"; -import { Switch, useLocation, useRouteMatch, Route } from "react-router-dom"; - -import EngagementCard from "./components/EngagementCard"; -import EngagementDocSelectULB from "./components/Documents/EngagementDocsULB"; -import EngagementULBDropdown from "./components/Documents/EngagementULBDropdown"; -import EnagementDocName from "./components/Documents/engagement-doc-name"; -import EngagementDocCategory from "./components/Documents/engagement-doc-category"; -import EngagementDocDescription from "./components/Documents/engagement-doc-description"; -import EngagementDocUploadDocument from "./components/Documents/engagement-doc-documents"; -import NewEvent from "./pages/employee/Events/NewEvent"; -import EditEvent from "./pages/employee/Events/EditEvent"; -import Response from "./pages/employee/Events/NewEvent/Response"; -import Inbox from "./pages/employee/Events/Inbox"; -import Messages from "./pages/employee/Messages"; -import EventForm from "./components/Events/EventForm"; -import MessageForm from "./components/Messages/MessageForm"; -import SelectEventGeolocation from "./components/Events/SelectGeoLocation"; -import SelectToDate from "./components/Events/SelectToDate"; -import NotificationsAndWhatsNew from "./pages/citizen/NotificationsAndWhatsNew"; -import EventsListOnGround from "./pages/citizen/EventsListOnGround"; -import EmployeeEventDetails from "./pages/employee/Events/EventDetails"; -import CitizenApp from "./pages/citizen"; -import EventDetails from "./pages/citizen/EventsListOnGround/EventDetails"; -import DocumenetCreate from "./pages/employee/Documents/documents-create"; -import DocumentUpdate from "./pages/employee/Documents/documents-update"; -import DocumentResponse from "./pages/employee/Documents/response"; -import DocUpdateResponse from "./pages/employee/Documents/update-response"; -import DocDeleteResponse from "./pages/employee/Documents/delete-response"; -import DocumentNotification from "./pages/employee/Documents/Inbox"; -import DocumentList from "./pages/citizen/Documents/DocumentList"; -import SurveyList from "./pages/citizen/CitizenSurvey/SurveyList"; -import DocumentDetails from "./components/Documents/DocumentDetails"; -import Surveys from "./pages/employee/CitizenSurveys"; -import FillSurvey from "./pages/citizen/CitizenSurvey/FillSurvey"; -import CitizenSurveyForm from "./components/Surveys/CitizenSurveyForm"; -import ShowSurvey from "./pages/citizen/CitizenSurvey/ShowSurvey"; - -import SurveyResults from "./pages/employee/CitizenSurveys/SurveyResults"; -const EventsBreadCrumb = ({ location }) => { - const { t } = useTranslation(); - const crumbs = [ - { - path: "/mgramseva-digit-ui/employee", - content: t("ES_COMMON_HOME"), - show: true, - }, - { - path: "/mgramseva-digit-ui/employee/engagement/event/inbox", - content: t("ES_EVENT_INBOX"), - show: location.pathname.includes("event/inbox") ? true : false, - }, - { - path: "/mgramseva-digit-ui/employee/event/new-event", - content: t("ES_EVENT_NEW_EVENT"), - show: location.pathname.includes("event/new-event") ? true : false, - }, - { - path: "/mgramseva-digit-ui/employee/event/inbox/new-event", - content: t("ES_EVENT_NEW_EVENT"), - show: location.pathname.includes("event/inbox/new-event") ? true : false, - }, - { - path: "/mgramseva-digit-ui/employee/event/inbox/event-details", - content: t("ES_EVENT_EVENT_DETAILS"), - show: location.pathname.includes("event-details") ? true : false, - }, - { - path: "/mgramseva-digit-ui/employee/engagement/event/edit-event", - content: t("ES_EVENT_EDIT_EVENT"), - show: location.pathname.includes("event/edit-event") ? true : false, - }, - { - path: "/mgramseva-digit-ui/employee/event/response", - content: t("ES_EVENT_NEW_EVENT_RESPONSE"), - show: location.pathname.includes("event/response") ? true : false, - }, - { - path: "/mgramseva-digit-ui/employee/engagement/documents/inbox", - content: t("ES_EVENT_INBOX"), - show: location.pathname.includes("/documents/inbox") ? true : false, - }, - { - path: "/mgramseva-digit-ui/employee/engagement/documents/new-doc", - content: t("NEW_DOCUMENT_TEXT"), - show: location.pathname.includes("/documents/new-doc") ? true : false, - }, - { - path: "/mgramseva-digit-ui/employee/engagement/documents/inbox/new-doc", - content: t("NEW_DOCUMENT_TEXT"), - show: location.pathname.includes("/documents/inbox/new-doc") ? true : false, - }, - { - path: "/mgramseva-digit-ui/employee/engagement/documents/response", - content: t("ES_EVENT_NEW_EVENT_RESPONSE"), - show: location.pathname.includes("/documents/response") ? true : false, - }, - { - path: "/mgramseva-digit-ui/employee/engagement/documents/delete-response", - content: t("ES_EVENT_NEW_EVENT_RESPONSE"), - show: location.pathname.includes("/documents/delete-response") ? true : false, - }, - { - path: "/mgramseva-digit-ui/employee/engagement/documents/update-response", - content: t("ES_EVENT_NEW_EVENT_RESPONSE"), - show: location.pathname.includes("/documents/update-response") ? true : false, - }, - { - path: "/mgramseva-digit-ui/employee/engagement/documents/inbox/details/:id", - content: t("CE_DOCUMENT_DETAILS"), - show: location.pathname.includes("/documents/inbox/details") ? true : false, - }, - { - path: "/mgramseva-digit-ui/employee/engagement/documents/inbox/update", - content: t("DOCUMENTS_EDIT_HEADER"), - show: location.pathname.includes("/documents/inbox/update") ? true : false, - }, - { - path: "/mgramseva-digit-ui/employee/engagement/messages/inbox", - content: t("ES_EVENT_INBOX"), - show: location.pathname.includes("/messages/inbox") ? true : false, - }, - { - path: "/mgramseva-digit-ui/employee/engagement/messages/create", - content: t("NEW_PUBLIC_BRDCST"), - show: location.pathname.includes("/messages/create") ? true : false, - }, - { - path: "/mgramseva-digit-ui/employee/engagement/messages/inbox/create", - content: t("NEW_PUBLIC_BRDCST"), - show: location.pathname.includes("/messages/inbox/create") ? true : false, - }, - { - path: "/mgramseva-digit-ui/employee/engagement/messages/inbox/details/:id", - content: t("CS_HEADER_PUBLIC_BRDCST"), - show: location.pathname.includes("/messages/inbox/details") ? true : false, - }, - { - path: "/mgramseva-digit-ui/employee/engagement/messages/inbox/edit/:id", - content: t("EDIT_PUBLIC_BRDCST"), - show: location.pathname.includes("/messages/inbox/edit") ? true : false, - }, - { - path: "/mgramseva-digit-ui/employee/engagement/messages/response", - content: t("ES_EVENT_NEW_EVENT_RESPONSE"), - show: location.pathname.includes("/messages/response") ? true : false, - }, - { - path: "/mgramseva-digit-ui/employee/engagement/messages/response?update=true", - content: t("ES_EVENT_NEW_EVENT_RESPONSE"), - show: location.pathname.includes("/messages/response?update=true") ? true : false, - }, - { - path: "/mgramseva-digit-ui/employee/engagement/messages/response?delete=true", - content: t("ES_EVENT_NEW_EVENT_RESPONSE"), - show: location.pathname.includes("/messages/response?delete=true") ? true : false, - }, - { - path: "/mgramseva-digit-ui/employee/engagement/surveys/inbox", - content: t("ES_EVENT_INBOX"), - show: location.pathname.includes("/surveys/inbox") ? true : false, - }, - { - path: "/mgramseva-digit-ui/employee/engagement/surveys/inbox/create", - content: t("CS_COMMON_SURVEYS"), - show: location.pathname.includes("/surveys/inbox/create") ? true : false, - }, - { - path: "/mgramseva-digit-ui/employee/engagement/surveys/create", - content: t("CS_COMMON_SURVEYS"), - show: location.pathname.includes("/surveys/create") ? true : false, - }, - { - path: "/mgramseva-digit-ui/employee/engagement/survey/create-response", - content: t("ES_EVENT_NEW_EVENT_RESPONSE"), - show: location.pathname.includes("/engagement/survey/create-response") ? true : false, - }, - ]; - - return ; -}; - -const EmployeeApp = ({ path, url, userType, tenants }) => { - const location = useLocation(); - - return ( - //
- <> - - - - - - } /> - - - - - - - - - - - - - } /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - {/* documents/update-response */} - {/* */} - - - //
- ); -}; - -const EngagementModule = ({ stateCode, userType, tenants }) => { - const moduleCode = "Engagement"; - const { path, url } = useRouteMatch(); - const language = Digit.StoreData.getCurrentLanguage(); - const { isLoading, data: store } = Digit.Services.useStore({ stateCode, moduleCode, language }); - - if (isLoading) { - return ; - } - Digit.SessionStorage.set("ENGAGEMENT_TENANTS", tenants); - - if (userType === "citizen") { - return ; - } else { - return ; - } -}; - -const EngagementLinks = ({ matchPath, userType }) => { - const { t } = useTranslation(); - if (userType === "citizen") { - return null; - } else { - return ( -
-
-
-
-
- - - - - - - {t("ES_TITLE_ENGAGEMENT")} -
-
-

engagement

-
-
-
-
-
- ); - } -}; - -const componentsToRegister = { - EngagementModule, - EngagementCard, - EngagementDocSelectULB, - EngagementULBDropdown, - EnagementDocName, - EngagementDocCategory, - EngagementDocDescription, - EngagementDocUploadDocument, - NotificationsAndWhatsNew, - EventsListOnGround, - EventDetails, - EventForm, - MessageForm, - DocumentList, - SelectEventGeolocation, - SelectToDate, - SurveyList, - FillSurvey, - CitizenSurveyForm, - ShowSurvey, - SurveyResults, -}; - -export const initEngagementComponents = () => { - Object.entries(componentsToRegister).forEach(([key, value]) => { - Digit.ComponentRegistryService.setComponent(key, value); - }); -}; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/components/Documents/ApplicationCard.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/components/Documents/ApplicationCard.js deleted file mode 100644 index 6fc619cec..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/components/Documents/ApplicationCard.js +++ /dev/null @@ -1,87 +0,0 @@ -import React, { useState, useEffect } from "react"; -import { Card, DetailsCard, Loader, PopUp, SearchAction, FilterAction } from "@egovernments/digit-ui-react-components"; -import Filter from "./Filter"; -import Search from "./Search"; -import { useHistory, Link } from "react-router-dom"; -import { areEqual } from "../../utils"; - -const ApplicationCard = ({ searchFields, searchParams, onFilterChange, onSearch, t, data, responseData }) => { - const [type, setType] = useState(""); - const [popup, setPopup] = useState(false); - const [params, setParams] = useState(searchParams); - const tenantId = Digit.ULBService.getCurrentTenantId(); - const history = useHistory(); - useEffect(() => { - if (type) setPopup(true); - }, [type]); - - const selectParams = (param) => { - setParams((o) => ({ ...o, ...param })); - }; - - const handlePopupClose = () => { - setPopup(false); - setParams(searchParams); - }; - - const redirectToDetailsPage = (data) => { - const details = responseData?.find((item) => areEqual(item.postedBy, data["Posted By"]) && areEqual(item.name, data["Document Name"])); - if (details) { - history.push(`/mgramseva-digit-ui/employee/engagement/documents/inbox/details/${details?.name}`, { details }); - } - }; - - let result; - if (data?.length === 0) { - result = ( - - {t("CE_DOCUMENTS_NOT_FOUND")} -
- - {t("NEW_DOCUMENT_TEXT")} - -
- ); - } else if (data && data?.length > 0) { - result = {}} handleDetailCardClick={redirectToDetailsPage} />; - } - return ( - -
- {onSearch && ( - { - setType("SEARCH"); - setPopup(true); - }} - /> - )} - { - setType("FILTER"); - setPopup(true); - }} - /> -
- {result} - {popup && ( - - {type === "FILTER" && ( -
- {} -
- )} - {type === "SEARCH" && ( -
- -
- )} -
- )} -
- ); -}; - -export default ApplicationCard; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/components/Documents/DesktopInbox.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/components/Documents/DesktopInbox.js deleted file mode 100644 index 53e74bcc4..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/components/Documents/DesktopInbox.js +++ /dev/null @@ -1,146 +0,0 @@ -import React from "react"; -import { Card, Loader } from "@egovernments/digit-ui-react-components"; -import { Link } from "react-router-dom"; - -import EventLink from "../Events/EventLink"; -import DocumentNotificationTable from "./DocumentNotificationTable"; -import Search from "./Search"; -import Filter from "./Filter"; -import { openDocumentLink, openUploadedDocument } from "../../utils"; - -const getDocumentDetailsPath = (document) => { - return { - pathname: `inbox/details/${document.name}`, - state: { details: document }, - }; -}; - -const GetCell = (value) => {value}; -const getDocumentDetails = (value = "", link, t) => ( - - - {value.length ? value : t("CE_DOCUMENT_TITLE")} - - -); -const getDocumentCell = (name = "mSeva", link, docLink, t) => ( - - {link?.length ? ( - openUploadedDocument(link, name)}> - {" "} - {t("CE_DOCUMENT_VIEW_LINK")}{" "} - - ) : null} - {docLink.length ? ( - openDocumentLink(docLink, name)}> - {" "} - {t("CE_DOCUMENT_OPEN_LINK")}{" "} - - ) : null} - -); - -const DocumentDesktopInbox = ({ - isLoading, - data, - t, - onSearch, - title, - iconName, - links, - onSort, - sortParams, - globalSearch, - searchFields, - searchParams, - onFilterChange, - pageSizeLimit, - totalRecords, - currentPage, - onNextPage, - onPrevPage, - onPageSizeChange, -}) => { - const columns = React.useMemo( - () => [ - { - Header: t("CE_TABLE_DOCUMENT_NAME"), - accessor: (row) => getDocumentDetails(row?.name, getDocumentDetailsPath(row), t), - }, - { - Header: t("DOCUMENTS_CATEGORY_CARD_LABEL"), - accessor: (row) => GetCell(row?.category ? t(`${row?.category}`) : ""), - }, - { - Header: t("CE_TABLE_DOCUMENT_LINK"), - accessor: (row) => getDocumentCell(row?.name, row.filestoreId, row.documentLink || "", t), - }, - { - Header: t("CE_TABLE_DOCUMENT_POSTED_BY"), - accessor: (row) => GetCell(row.postedBy), - }, - ], - [] - ); - - let result; - if (isLoading) { - result = ; - } else if (!data || data?.length === 0) { - result = ( - - {t("CE_DOCUMENTS_NOT_FOUND")} -
- - {t("NEW_DOCUMENT_TEXT")} - -
- ); - } else if (data?.length > 0) { - result = ( - { - return { - style: { - minWidth: cellInfo.column.Header === t("CE_TABLE_DOCUMENT_NAME") ? "240px" : "", - padding: "20px 18px", - fontSize: "16px", - }, - }; - }} - /> - ); - } - - return ( -
-
- -
- -
-
-
- -
- {result} -
-
-
- ); -}; - -export default DocumentDesktopInbox; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/components/Documents/DocumentCard.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/components/Documents/DocumentCard.js deleted file mode 100644 index 645c857be..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/components/Documents/DocumentCard.js +++ /dev/null @@ -1,81 +0,0 @@ -import React from 'react' -import { - Card, - CardCaption, - CardHeader, - CardText, - LinkButton, - DownloadImgIcon, - ViewsIcon, - ExternalLinkIcon, - GenericFileIcon, - PDFSvg -} from "@egovernments/digit-ui-react-components"; -import { format } from 'date-fns'; -import { getFileSize } from '../../utils'; -import { downloadDocument, openDocumentLink, openUploadedDocument } from '../../utils'; - - -const DocumentCard = ({ documentTitle, documentSize = 2.3, lastModifiedData, description, filestoreId, documentLink, t }) => { - let isMobile = window.Digit.Utils.browser.isMobile(); - - - return ( -
-
- -
-
-
- {documentTitle} - {documentSize ? {getFileSize(documentSize)} : null} -
-
- {`${t(`CE_DCOUMENT_UPLOADED_ON`)} ${lastModifiedData ? format(new Date(lastModifiedData), "do MMMM yyyy") : "-"}`} -
-
- - {description?.length ? description : "NA"} - -
-
- {filestoreId && filestoreId.length ? openUploadedDocument(filestoreId ? filestoreId : null, documentTitle)}> - -

{t(`CE_DOCUMENT_VIEW_LINK`)}

-
- } - /> : null - } - {documentLink && documentLink.length ? - ( openDocumentLink(documentLink, documentTitle)}> - -

{t(`CE_DOCUMENT_OPEN_LINK`)}

-
- } - />) : null - } - {filestoreId && filestoreId.length ? - - -

{t(`CE_DOCUMENT_DOWNLOAD_LINK`)}

-
- } - onClick={() => downloadDocument(filestoreId ? filestoreId : null, documentTitle)} - /> : null - } -
- - - - ) -} - -export default DocumentCard; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/components/Documents/DocumentDetails.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/components/Documents/DocumentDetails.js deleted file mode 100644 index bf2a655e5..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/components/Documents/DocumentDetails.js +++ /dev/null @@ -1,130 +0,0 @@ -import { Header, ActionBar, SubmitBar, ExternalLinkIcon, Menu, GenericFileIcon, LinkButton } from "@egovernments/digit-ui-react-components"; -import React, { useState } from "react"; -import { useTranslation } from "react-i18next"; -import { openDocumentLink, openUploadedDocument } from "../../utils"; -import Confirmation from "../Modal/Confirmation"; - -const Actions = ["EDIT_DOCUMENT", "DELETE"]; -const getUlbName = (tenantId) => { - let ulbName = tenantId?.split(".")[1]; - ulbName = `${ulbName[0]?.toUpperCase()}${ulbName?.slice(1)} `; - return ulbName; -}; -const DocumentDetails = ({ location, match, history }) => { - let isMobile = window.Digit.Utils.browser.isMobile(); - const { t } = useTranslation(); - const { details } = location?.state; - const [displayMenu, setDisplayMenu] = React.useState(false); - const [showModal, setShowModal] = useState(false); - - const { data: ulbArray, isLoading: loading } = Digit.Hooks.useTenants(); - const currrentUlb = Digit.ULBService.getCurrentUlb(); - const stateId = Digit.ULBService.getStateId(); - const { data: categoryOptions, isLoading } = Digit.Hooks.engagement.useMDMS(stateId, "DocumentUploader", ["UlbLevelCategories"], { - select: (d) => { - const data = d?.DocumentUploader?.UlbLevelCategories?.filter?.((e) => e.ulb === currrentUlb.code); - return data[0].categoryList.map((name) => ({ name })); - }, - }); - - function onActionSelect(action) { - setDisplayMenu(false); - - if (action?.includes("EDIT")) { - const DocumentEntity = { - tenantIds: details?.tenantId, - documentName: details?.name, - docCategory: categoryOptions?.filter((item) => item.name === details?.category)?.[0], - document: { - filestoreId: { fileStoreId: details?.filestoreId }, - documentLink: details?.documentLink, - }, - ULB: { code: details?.tenantId }, - ...details, - }; - history.push({ - pathname: `/mgramseva-digit-ui/employee/engagement/documents/inbox/update`, - state: { DocumentEntity }, - }); - } - - if (action?.includes("DELETE")) { - setShowModal(true); - } - } - - function onModalSubmit() { - setShowModal(false); - const DocumentEntity = { - ...details, - }; - history.push({ - pathname: `/mgramseva-digit-ui/employee/engagement/documents/delete-response`, - state: { DocumentEntity }, - }); - } - - function onModalCancel() { - setShowModal(false); - } - - return ( -
- {showModal ? ( - setShowModal(!showModal)} - actionCancelLabel={"CS_COMMON_CANCEL"} - actionCancelOnSubmit={onModalCancel} - actionSaveLabel={"ES_COMMON_Y_DEL"} - actionSaveOnSubmit={onModalSubmit} - /> - ) : null} -
{t(`CE_DOCUMENT_DETAILS`)}
-
-
-
-

{`${t("ULB")}:`}

{getUlbName(details?.tenantId)}

{" "} -
-
-

{`${t("DOCUMENT_NAME")}:`}

{details?.name}

{" "} -
-
-

{`${t("DOCUMENT_CATEGORY")}:`}

{t(details?.category)}

{" "} -
-
-

{`${t("DCOUMENT_DESCRIPTION")}:`}

{" "} -

{details?.description?.length ? details?.description : "NA"}

{" "} -
- {/*

{`${t('ES_COMMON_LINK_LABEL')}:`}

- {details?.documentLink ? openDocumentLink(details?.documentLink, details?.name)}> -

{t(`CE_DOCUMENT_OPEN_LINK`)}

-
- } - /> : 'NA'} -
*/} - {details?.filestoreId ? ( -
- {`${t("Document")}`} -
openUploadedDocument(details?.filestoreId, details?.name)}> - -
-
- ) : null} -
-
- - {displayMenu ? ( - - ) : null} - setDisplayMenu(!displayMenu)} /> - - - ); -}; - -export default DocumentDetails; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/components/Documents/DocumentNotificationTable.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/components/Documents/DocumentNotificationTable.js deleted file mode 100644 index a881bb1ee..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/components/Documents/DocumentNotificationTable.js +++ /dev/null @@ -1,42 +0,0 @@ -import React from "react"; -import { Table } from "@egovernments/digit-ui-react-components"; - -const DocumentNotificationTable = ({ - t, - data, - columns, - globalSearch, - onSearch, - getCellProps, - pageSizeLimit, - totalRecords, - currentPage, - onNextPage, - onPrevPage, - onPageSizeChange, - onSort, - sortParams -}) => { - return ( -
- ) -} - -export default DocumentNotificationTable; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/components/Documents/EngagementDocsULB.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/components/Documents/EngagementDocsULB.js deleted file mode 100644 index 8d04d8c11..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/components/Documents/EngagementDocsULB.js +++ /dev/null @@ -1,77 +0,0 @@ -import React, { useEffect, useMemo } from "react"; -import { Card, Header, LabelFieldPair, CardLabel, TextInput, Dropdown, FormComposer, RemoveableTag } from "@egovernments/digit-ui-react-components"; -import { useForm, Controller } from "react-hook-form"; -import { useLocation } from "react-router-dom"; -import { alphabeticalSortFunctionForTenantsBasedOnName } from "../../utils"; - -const SelectULB = ({ userType, t, setValue, onSelect, config, data, formData, register, errors, setError, clearErrors, formState, control }) => { - const ulbs = Digit.SessionStorage.get("ENGAGEMENT_TENANTS"); - const tenantId = Digit.ULBService.getCurrentTenantId(); - const selectedTenat = useMemo(() => { - if (formData?.defaultTenantId) { - return ulbs?.find(ulb => ulb?.code === formData?.defaultTenantId); - } - if (tenantId && ulbs) { - const filtered = ulbs?.filter((item) => item.code === tenantId) - return filtered; - } - return userUlbs?.length === 1 ? userUlbs?.[0] : null - }, [tenantId, ulbs]) - - const userInfo = Digit.SessionStorage.get("citizen.userRequestObject") - const userUlbs = ulbs.filter(ulb => userInfo?.info?.roles?.some(role => role?.tenantId === ulb?.code)).sort(alphabeticalSortFunctionForTenantsBasedOnName) - - const dropDownData = Digit.ULBService.getUserUlbs("SUPERUSER").sort(alphabeticalSortFunctionForTenantsBasedOnName); - return ( - - - {t("ES_COMMON_ULB") + " *"} -
- ( - { - props.onChange([...(formData?.[config?.key]?.filter?.((f) => e.code != f?.code) || []), e]); - }} - keepNull={true} - selected={props.value} - disable={ulbs?.length === 1} - t={t} - /> - )} - /> -
- {formData && formData[config?.key]?.length > 0 && formData?.[config.key]?.map((ulb, index) => { - return ( - { - // if(isInEditFormMode) return; - setValue( - config.key, - formData?.[config.key]?.filter((e) => e.i18nKey != ulb.i18nKey) - ) - }} - /> - ); - })} -
- {errors && errors[config.key] && {t(`EVENTS_TENANT_ERROR_REQUIRED`)}} -
-
-
- ); -}; - -export default SelectULB; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/components/Documents/EngagementULBDropdown.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/components/Documents/EngagementULBDropdown.js deleted file mode 100644 index 06a013775..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/components/Documents/EngagementULBDropdown.js +++ /dev/null @@ -1,28 +0,0 @@ -import React from "react"; -import { LabelFieldPair, CardLabel, Dropdown,} from "@egovernments/digit-ui-react-components"; -import { Controller } from "react-hook-form"; -import { alphabeticalSortFunctionForTenantsBasedOnName } from "../../utils"; - -const ULBDropdown = ({ userType, t, setValue, onSelect, config, data, formData, register, errors, setError, clearErrors, formState, control }) => { - const ulbs = Digit.SessionStorage.get("ENGAGEMENT_TENANTS"); - const userInfo = Digit.UserService.getUser().info; - const userUlbs = ulbs.filter(ulb => userInfo?.roles?.some(role => role?.tenantId === ulb?.code)).sort(alphabeticalSortFunctionForTenantsBasedOnName); - return ( - - - {t("ES_COMMON_ULB") + "*"} -
- } - /> - {errors && errors[config?.key] && {t(`EVENTS_TENANT_ERROR_REQUIRED`)}} -
-
-
- ); -}; - -export default ULBDropdown; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/components/Documents/Filter.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/components/Documents/Filter.js deleted file mode 100644 index f4677a2a8..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/components/Documents/Filter.js +++ /dev/null @@ -1,77 +0,0 @@ -import React, { useState } from "react"; -import { CloseSvg, Loader, SubmitBar, Dropdown, RefreshIcon } from "@egovernments/digit-ui-react-components"; -import { useTranslation } from "react-i18next"; - - -const Filter = ({ type = "desktop", onClose, onSearch, onFilterChange, searchParams }) => { - const { t } = useTranslation(); - const [localSearchParams, setLocalSearchParams] = useState(() => ({ ...searchParams })); - const tenantId = Digit.ULBService.getCurrentTenantId(); - const stateId = tenantId?.split('.')[0]; - const currrentUlb = Digit.ULBService.getCurrentUlb(); - const { data: categoryData, isLoading } = Digit.Hooks.engagement.useMDMS(stateId, "DocumentUploader", ["UlbLevelCategories"], { - select: (d) => { - const data = d?.DocumentUploader?.UlbLevelCategories?.filter?.((e) => e.ulb === currrentUlb.code); - return data[0].categoryList.map((category) => ({ category })); - }, - }); - - const clearAll = () => { - setLocalSearchParams({ category: null, name: null, postedBy: null, }) - onFilterChange({ category: null, name: null, postedBy: null, }); - onClose?.(); - }; - - const applyLocalFilters = () => { - onFilterChange(localSearchParams); - onClose?.(); - }; - const handleChange = (data) => { - setLocalSearchParams({ ...localSearchParams, ...data }); - }; - - - if (isLoading) { - return ( - - ); - } - return ( -
-
-
-
{t("ES_COMMON_FILTER_BY")}:
-
- {t("ES_COMMON_CLEAR_ALL")} -
- {type === "desktop" && ( - - - - )} - {type === "mobile" && ( - - - - )} -
-
{`${t('DOCUMENTS_CATEGORY_CARD_LABEL')}`}
- { - handleChange(value) - } - } - t={t} - /> -
- applyLocalFilters()} label={t("ES_COMMON_APPLY")} /> -
-
-
- ) -} - -export default Filter; \ No newline at end of file diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/components/Documents/MobileInbox.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/components/Documents/MobileInbox.js deleted file mode 100644 index 13a8fb464..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/components/Documents/MobileInbox.js +++ /dev/null @@ -1,62 +0,0 @@ -import React from "react"; -import { Link } from 'react-router-dom' -import ApplicationCard from "./ApplicationCard"; -import EventLink from "../Events/EventLink"; -import { openDocumentLink, openUploadedDocument } from "../../utils"; - - - -const MobileInbox = ({ data, t, title, iconName, links, searchFields, searchParams, onFilterChange, onSearch, isLoading }) => { - const getData = () => { - return data?. - filter(document => - (searchParams?.tenantIds?.length > 0 ? searchParams?.tenantIds?.includes(document.tenantId) : true) && - (searchParams?.name ? document.name?.toUpperCase().startsWith(searchParams?.name?.toUpperCase()) : true) && - (searchParams?.postedBy ? document.postedBy?.trim()?.toLowerCase() === searchParams?.postedBy?.trim()?.toLowerCase() : true) && - (searchParams?.category ? document.category === searchParams?.category : true)) - .map((document) => { - return { - [t("CE_TABLE_DOCUMENT_NAME")]: document?.name, - [t("DOCUMENTS_CATEGORY_CARD_LABEL")]: t(`${document?.category}`), - [t("CE_TABLE_DOCUMENT_LINK")]: -
- { document?.filestoreId ?
{openUploadedDocument(document.filestoreId, document.name)}}>{t('CE_DOCUMENT_VIEW_LINK')}
: null} - { document?.documentLink ?
{ openDocumentLink(document.documentLink, document.name)}}>{t('CE_DOCUMENT_OPEN_LINK')}
: null} -
- , - [t("CE_TABLE_DOCUMENT_POSTED_BY")]: document?.postedBy - } - }) - } - - - return ( -
-
-
- {/* {!isFstpOperator && !isSearch && } */} - - -
-
-
- ) -}; - -export default MobileInbox; \ No newline at end of file diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/components/Documents/Search.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/components/Documents/Search.js deleted file mode 100644 index 7370d720a..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/components/Documents/Search.js +++ /dev/null @@ -1,148 +0,0 @@ -import React, { useMemo } from "react"; -import { useForm, Controller } from "react-hook-form"; -import { TextInput, Label, SubmitBar, LinkLabel, ActionBar, CloseSvg, Dropdown } from "@egovernments/digit-ui-react-components"; -import { alphabeticalSortFunctionForTenantsBasedOnName } from "../../utils"; - -const Search = ({ onSearch, searchParams, searchFields, type, onClose, isInboxPage, t }) => { - const { register, handleSubmit, formState, reset, watch, control } = useForm({ - defaultValues: searchParams, - }); - const mobileView = innerWidth <= 640; - const ulbs = Digit.SessionStorage.get("ENGAGEMENT_TENANTS"); - const tenantId = Digit.ULBService.getCurrentTenantId(); - - const userInfo = Digit.UserService.getUser().info; - const userUlbs = ulbs.filter(ulb => userInfo?.roles?.some(role => role?.tenantId === ulb?.code)).sort(alphabeticalSortFunctionForTenantsBasedOnName); - - - const selectedTenat = useMemo(() => { - const filtered = ulbs.filter((item) => item.code === tenantId) - return filtered; - }, [tenantId, ulbs]) - - const getFields = (input) => { - switch (input.type) { - case "ulb": - return ( - ( - - )} - name={input.name} - control={control} - - /> - ) - default: - return ( - } - name={input.name} - control={control} - defaultValue={null} - /> - ) - } - } - - const onSubmitInput = (data) => { - // searchFields.forEach((field) => { - // if (!data[field.name]) data.delete.push(field.name); - // }); - - onSearch(data); - if (type === "mobile") { - onClose(); - } - } - - const clearSearch = () => { - reset({ name: '', ulbs: { code: tenantId.code }, postedBy: "" }); - onSearch({ name: '', ulbs: { code: tenantId.code }, postedBy: "" }) - }; - - const clearAll = (mobileView) => { - const mobileViewStyles = mobileView ? { margin: 0 } : {}; - return ( - - {t("ES_COMMON_CLEAR_SEARCH")} - - ); - }; - - return ( -
-
-
- {(type === "mobile" || mobileView) && ( -
-

{t("ES_COMMON_SEARCH_BY")}

- - - -
- )} -
- {searchFields - ?.map((input, index) => ( -
- {/* */} - - - {getFields(input)} - - {formState?.dirtyFields?.[input.name] ? ( - - {formState?.errors?.[input.name]?.message} - - ) : null} -
- ))} - - {/* {isInboxPage && ( */} - {/* //
*/} - {/*
{clearAll()}
*/} - {/* //
*/} - {/* )} */} - - {type === "desktop" && !mobileView && ( -
- -
- )} - {type === "desktop" && !mobileView && ( -
{clearAll()}
) - } -
-
-
- {(type === "mobile" || mobileView) && ( - - - - - )} - - ) - -} - -export default Search; \ No newline at end of file diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/components/Documents/Searchbar.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/components/Documents/Searchbar.js deleted file mode 100644 index 5acc271fa..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/components/Documents/Searchbar.js +++ /dev/null @@ -1,26 +0,0 @@ -import React from 'react' -import { - TextInput, - SearchIconSvg, - -} from "@egovernments/digit-ui-react-components"; - -const Searchbar = ({searchValue, onChange, handleKeyPress, handleSearch, t}) => { - - - return ( -
- onChange(ev.target.value)} - signature={true} - signatureImg={ handleSearch()}/>} - onKeyPress={handleKeyPress} - /> -
- ) -} - -export default Searchbar; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/components/Documents/engagement-doc-category.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/components/Documents/engagement-doc-category.js deleted file mode 100644 index 91bb21602..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/components/Documents/engagement-doc-category.js +++ /dev/null @@ -1,44 +0,0 @@ -import React, { useEffect, useState } from "react"; -import { Card, Header, LabelFieldPair, CardLabel, TextInput, Dropdown, FormComposer, Loader } from "@egovernments/digit-ui-react-components"; -import { Controller } from "react-hook-form"; - -const SelectCategory = ({ userType, t, setValue, onSelect, config, data, formData, register, errors, setError, clearErrors, formState, control }) => { - const stateId = Digit.ULBService.getStateId(); - - const [ulbs, setUlbs] = useState(() => { - return []; - }); - - const currrentUlb = Digit.ULBService.getCurrentUlb() || "pb.amritsar" ; - const { data: categoryData, isLoading } = Digit.Hooks.engagement.useMDMS(stateId, "DocumentUploader", ["UlbLevelCategories"], { - select: (d) => { - - const data = d?.DocumentUploader?.UlbLevelCategories?.filter?.((e) => e.ulb === currrentUlb.code); - return data[0].categoryList.map((name)=>({name})); - }, - }); - - - useEffect(() => { - formData?.ULB?.length ? setUlbs(formData?.ULB?.map((e) => e?.code)): null; - }, [formData?.ULB]); - - return ( - - - {t("ES_COMMON_DOC_CATEGORY") + "*"} - ( -
- -
- )} - /> -
-
- ); -}; - -export default SelectCategory; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/components/Documents/engagement-doc-description.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/components/Documents/engagement-doc-description.js deleted file mode 100644 index 8baca355c..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/engagement/src/components/Documents/engagement-doc-description.js +++ /dev/null @@ -1,33 +0,0 @@ -import React, { useState } from "react"; -import { - Card, - Header, - LabelFieldPair, - CardLabelError, - CardLabel, - TextInput, - Dropdown, - FormComposer, - TextArea, -} from "@egovernments/digit-ui-react-components"; -import { useTranslation } from "react-i18next"; - -const SelectULB = ({ userType, t, setValue, onSelect, config, data, formData, register, errors, setError, clearErrors, formState, control }) => { return ( - - - {t("ES_COMMON_DOC_DESCRIPTION")} -
- - - - - - ); -}; - -export default RatingAndFeedBack; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/pages/citizen/Rating/SelectRating.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/pages/citizen/Rating/SelectRating.js deleted file mode 100644 index c24bce32f..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/pages/citizen/Rating/SelectRating.js +++ /dev/null @@ -1,62 +0,0 @@ -import React, { useCallback, useState } from "react"; -import { useDispatch } from "react-redux"; -import { RatingCard, CardLabelError } from "@egovernments/digit-ui-react-components"; -import { useParams, Redirect, useHistory } from "react-router-dom"; -import { useTranslation } from "react-i18next"; -import { updateComplaints } from "../../../redux/actions/index"; - -const SelectRating = ({ parentRoute }) => { - const { t } = useTranslation(); - const { id } = useParams(); - const dispatch = useDispatch(); - const history = useHistory(); - - let tenantId = Digit.SessionStorage.get("CITIZEN.COMMON.HOME.CITY")?.code || Digit.ULBService.getCurrentTenantId(); - const complaintDetails = Digit.Hooks.pgr.useComplaintDetails({ tenantId: tenantId, id: id }).complaintDetails; - const updateComplaint = useCallback((complaintDetails) => dispatch(updateComplaints(complaintDetails)), [dispatch]); - const [submitError, setError] = useState(false) - - function log(data) { - if (complaintDetails && data.rating > 0 ) { - complaintDetails.service.rating = data.rating; - complaintDetails.service.additionalDetail = data.CS_FEEDBACK_WHAT_WAS_GOOD.join(","); - complaintDetails.workflow = { - action: "RATE", - comments: data.comments, - verificationDocuments: [], - }; - updateComplaint({ service: complaintDetails.service, workflow: complaintDetails.workflow }); - history.push(`${parentRoute}/response`); - } - else{ - setError(true) - } - } - - const config = { - texts: { - header: "CS_COMPLAINT_RATE_HELP_TEXT", - submitBarLabel: "CS_COMMONS_NEXT", - }, - inputs: [ - { - type: "rate", - maxRating: 5, - label: t("CS_COMPLAINT_RATE_TEXT"), - error: submitError ? {t("CS_FEEDBACK_ENTER_RATING_ERROR")} : null - }, - { - type: "checkbox", - label: "CS_FEEDBACK_WHAT_WAS_GOOD", - checkLabels: [t("CS_FEEDBACK_SERVICES"), t("CS_FEEDBACK_RESOLUTION_TIME"), t("CS_FEEDBACK_QUALITY_OF_WORK"), t("CS_FEEDBACK_OTHERS")], - }, - { - type: "textarea", - label: t("CS_COMMON_COMMENTS"), - name: "comments", - }, - ], - }; - return ; -}; -export default SelectRating; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/pages/citizen/ReopenComplaint/AddtionalDetails.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/pages/citizen/ReopenComplaint/AddtionalDetails.js deleted file mode 100644 index 7c9ae3f20..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/pages/citizen/ReopenComplaint/AddtionalDetails.js +++ /dev/null @@ -1,97 +0,0 @@ -import React, { useCallback, useEffect } from "react"; -import { useTranslation } from "react-i18next"; -import { useDispatch, useSelector } from "react-redux"; -import { useParams, useHistory, Redirect } from "react-router-dom"; - -import { BackButton, Card, CardHeader, CardText, TextArea, SubmitBar } from "@egovernments/digit-ui-react-components"; - -import { updateComplaints } from "../../../redux/actions/index"; -import { LOCALIZATION_KEY } from "../../../constants/Localization"; - -const AddtionalDetails = (props) => { - // const [details, setDetails] = useState(null); - const history = useHistory(); - let { id } = useParams(); - const dispatch = useDispatch(); - const appState = useSelector((state) => state)["common"]; - let { t } = useTranslation(); - - const {complaintDetails} = props - useEffect(() => { - if (appState.complaints) { - const { response } = appState.complaints; - if (response && response.responseInfo.status === "successful") { - history.push(`${props.match.path}/response/:${id}`); - } - } - }, [appState.complaints, props.history]); - - const updateComplaint = useCallback( - async (complaintDetails) => { - await dispatch(updateComplaints(complaintDetails)); - history.push(`${props.match.path}/response/${id}`); - }, - [dispatch] - ); - - const getUpdatedWorkflow = (reopenDetails, type) => { - switch (type) { - case "REOPEN": - return { - action: "REOPEN", - comments: reopenDetails.addtionalDetail, - assignes: [], - verificationDocuments: reopenDetails.verificationDocuments, - }; - default: - return ""; - } - }; - - function reopenComplaint() { - let reopenDetails = Digit.SessionStorage.get(`reopen.${id}`); - if (complaintDetails) { - complaintDetails.workflow = getUpdatedWorkflow( - reopenDetails, - // complaintDetails, - "REOPEN" - ); - complaintDetails.service.additionalDetail = { - REOPEN_REASON: reopenDetails.reason, - }; - updateComplaint({ service: complaintDetails.service, workflow: complaintDetails.workflow }); - } - return ( - - ); - } - - function textInput(e) { - // setDetails(e.target.value); - let reopenDetails = Digit.SessionStorage.get(`reopen.${id}`); - Digit.SessionStorage.set(`reopen.${id}`, { - ...reopenDetails, - addtionalDetail: e.target.value, - }); - } - - return ( - - - {t(`${LOCALIZATION_KEY.CS_ADDCOMPLAINT}_PROVIDE_ADDITIONAL_DETAILS`)} - {t(`${LOCALIZATION_KEY.CS_ADDCOMPLAINT}_ADDITIONAL_DETAILS_TEXT`)} - -
- -
-
-
- ); -}; - -export default AddtionalDetails; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/pages/citizen/ReopenComplaint/Reason.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/pages/citizen/ReopenComplaint/Reason.js deleted file mode 100644 index a67b9b52c..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/pages/citizen/ReopenComplaint/Reason.js +++ /dev/null @@ -1,57 +0,0 @@ -import React, { useState } from "react"; -import { useTranslation } from "react-i18next"; -import { Link, useHistory, useParams } from "react-router-dom"; -import { BackButton, Card, CardHeader, CardLabelError, CardText, RadioButtons, SubmitBar } from "@egovernments/digit-ui-react-components"; - -import { LOCALIZATION_KEY } from "../../../constants/Localization"; -import { getRoute, PgrRoutes, PGR_BASE } from "../../../constants/Routes"; - -const ReasonPage = (props) => { - const history = useHistory(); - const { t } = useTranslation(); - const { id } = useParams(); - const [selected, setSelected] = useState(null); - const [valid, setValid] = useState(true); - - const onRadioChange = (value) => { - let reopenDetails = Digit.SessionStorage.get(`reopen.${id}`); - Digit.SessionStorage.set(`reopen.${id}`, { ...reopenDetails, reason: value }); - setSelected(value); - }; - - function onSave() { - if (selected === null) { - setValid(false); - } else { - history.push(`${props.match.path}/upload-photo/${id}`); - } - } - - return ( - - {t(`${LOCALIZATION_KEY.CS_REOPEN}_COMPLAINT`)} - - {/* Select the option related to your complaint from the list given below. - If the complaint type you are looking for is not listed select others.{" "} */} - {/* {t(`${TRANSLATION_KEY}_OPTION_ONE`)} */} - - {valid ? null : {t(`${LOCALIZATION_KEY.CS_ADDCOMPLAINT}_ERROR_REOPEN_REASON`)}} - setSelected(value)} - options={[ - t(`${LOCALIZATION_KEY.CS_REOPEN}_OPTION_ONE`), - t(`${LOCALIZATION_KEY.CS_REOPEN}_OPTION_TWO`), - t(`${LOCALIZATION_KEY.CS_REOPEN}_OPTION_THREE`), - t(`${LOCALIZATION_KEY.CS_REOPEN}_OPTION_FOUR`), - ]} - /> - - - - ); -}; - -export default ReasonPage; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/pages/citizen/ReopenComplaint/UploadPhoto.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/pages/citizen/ReopenComplaint/UploadPhoto.js deleted file mode 100644 index a50ae8af6..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/pages/citizen/ReopenComplaint/UploadPhoto.js +++ /dev/null @@ -1,71 +0,0 @@ -import React, { useEffect, useState } from "react"; -import { Link, useHistory, useParams } from "react-router-dom"; -import { useTranslation } from "react-i18next"; - -import { Card, SubmitBar, BackButton, ImageUploadHandler, CardLabelError, LinkButton } from "@egovernments/digit-ui-react-components"; - -import { LOCALIZATION_KEY } from "../../../constants/Localization"; - -const UploadPhoto = (props) => { - const { t } = useTranslation(); - const history = useHistory(); - let { id } = useParams(); - const [verificationDocuments, setVerificationDocuments] = useState(null); - const [valid, setValid] = useState(true); - - const handleUpload = (ids) => { - setDocState(ids); - }; - - const setDocState = (ids) => { - if (ids?.length) { - const documents = ids.map((id) => ({ - documentType: "PHOTO", - fileStoreId: id, - documentUid: "", - additionalDetails: {}, - })); - setVerificationDocuments(documents); - } - }; - - function save() { - if (verificationDocuments === null) { - setValid(false); - } else { - history.push(`${props.match.path}/addional-details/${id}`); - } - } - - function skip() { - history.push(`${props.match.path}/addional-details/${id}`); - } - - useEffect(() => { - let reopenDetails = Digit.SessionStorage.get(`reopen.${id}`); - Digit.SessionStorage.set(`reopen.${id}`, { ...reopenDetails, verificationDocuments }); - }, [verificationDocuments, id]); - - return ( - - - - {/* - - */} - - {valid ? null : {t(`${LOCALIZATION_KEY.CS_ADDCOMPLAINT}_UPLOAD_ERROR_MESSAGE`)}} - - {props.skip ? : null} - - - ); -}; - -export default UploadPhoto; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/pages/citizen/ReopenComplaint/index.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/pages/citizen/ReopenComplaint/index.js deleted file mode 100644 index ddd9dab9a..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/pages/citizen/ReopenComplaint/index.js +++ /dev/null @@ -1,28 +0,0 @@ -import React, { useMemo } from "react"; - -import { Route, Switch, useRouteMatch } from "react-router-dom"; -// import UserOnboarding from "../UserOnboarding/index"; -import { PgrRoutes, getRoute } from "../../../constants/Routes"; -import ReasonPage from "./Reason"; -import UploadPhoto from "./UploadPhoto"; -import AddtionalDetails from "./AddtionalDetails"; -import Response from "../Response"; - -const ReopenComplaint = ({ match, history, parentRoute }) => { - - const allParams = window.location.pathname.split("/") - const id = allParams[allParams.length - 1] - const tenantId = Digit.SessionStorage.get("CITIZEN.COMMON.HOME.CITY")?.code || Digit.ULBService.getCurrentTenantId(); - - const complaintDetails = Digit.Hooks.pgr.useComplaintDetails({ tenantId: tenantId, id: id }).complaintDetails; - return ( - - } /> - } /> - } /> - } /> - - ); -}; - -export { ReopenComplaint }; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/pages/citizen/Response.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/pages/citizen/Response.js deleted file mode 100644 index 28b77b73e..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/pages/citizen/Response.js +++ /dev/null @@ -1,59 +0,0 @@ -import React from "react"; -import { Card, Banner, CardText, SubmitBar } from "@egovernments/digit-ui-react-components"; -import { Link } from "react-router-dom"; -import { useSelector } from "react-redux"; -import { PgrRoutes, getRoute } from "../../constants/Routes"; -import { useTranslation } from "react-i18next"; - -const GetActionMessage = ({ action }) => { - const { t } = useTranslation(); - switch (action) { - case "REOPEN": - return t(`CS_COMMON_COMPLAINT_REOPENED`); - case "RATE": - return t("CS_COMMON_THANK_YOU"); - default: - return t(`CS_COMMON_COMPLAINT_SUBMITTED`); - } -}; - -const BannerPicker = ({ response }) => { - const { complaints } = response; - const { t } = useTranslation(); - if (complaints && complaints.response && complaints.response.responseInfo) { - return ( - - ); - } else { - return ; - } -}; - -const TextPicker = ({ response }) => { - const { complaints } = response; - const { t } = useTranslation(); - if (complaints && complaints.response && complaints.response.responseInfo) { - const { action } = complaints.response.ServiceWrappers[0].workflow; - return action === "RATE" ? {t("CS_COMMON_RATING_SUBMIT_TEXT")} : {t("CS_COMMON_TRACK_COMPLAINT_TEXT")}; - } -}; - -const Response = (props) => { - const { t } = useTranslation(); - const appState = useSelector((state) => state)["pgr"]; - return ( - - {appState.complaints.response && } - {appState.complaints.response && } - - - - - ); -}; - -export default Response; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/pages/citizen/index.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/pages/citizen/index.js deleted file mode 100644 index 9319f81be..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/pages/citizen/index.js +++ /dev/null @@ -1,48 +0,0 @@ -import React from "react"; -import { ReopenComplaint } from "./ReopenComplaint/index"; -import SelectRating from "./Rating/SelectRating"; -import { PgrRoutes, getRoute } from "../../constants/Routes"; -import { useRouteMatch, Switch, useLocation } from "react-router-dom"; -import { AppContainer, BackButton, PrivateRoute } from "@egovernments/digit-ui-react-components"; - -import { CreateComplaint } from "./Create"; -import { ComplaintsList } from "./ComplaintsList"; -import ComplaintDetailsPage from "./ComplaintDetails"; -import Response from "./Response"; -import { useTranslation } from "react-i18next"; - -const App = () => { - const { t } = useTranslation(); - const { path, url, ...match } = useRouteMatch(); - const location = useLocation(); - - const CreateComplaint = Digit?.ComponentRegistryService?.getComponent("PGRCreateComplaintCitizen"); - const ComplaintsList = Digit?.ComponentRegistryService?.getComponent("PGRComplaintsList"); - const ComplaintDetailsPage = Digit?.ComponentRegistryService?.getComponent("PGRComplaintDetailsPage"); - const SelectRating = Digit?.ComponentRegistryService?.getComponent("PGRSelectRating"); - const Response = Digit?.ComponentRegistryService?.getComponent("PGRResponseCitzen"); - - return ( - -
- {!location.pathname.includes("/response") && {t("CS_COMMON_BACK")}} - - {/* */} - - - - } - /> - } /> - } /> - - {/* */} - -
-
- ); -}; - -export default App; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/pages/employee/ComplaintDetails.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/pages/employee/ComplaintDetails.js deleted file mode 100644 index 916413781..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/pages/employee/ComplaintDetails.js +++ /dev/null @@ -1,504 +0,0 @@ -import React, { useState, useEffect, Fragment } from "react"; -import { useParams } from "react-router-dom"; -import { - BreakLine, - Card, - CardLabel, - CardLabelDesc, - CardSubHeader, - ConnectingCheckPoints, - CheckPoint, - DisplayPhotos, - MediaRow, - LastRow, - Row, - StatusTable, - PopUp, - HeaderBar, - ImageViewer, - TextInput, - TextArea, - UploadFile, - ButtonSelector, - Toast, - ActionBar, - Menu, - SubmitBar, - Dropdown, - Loader, - Modal, - SectionalDropdown, -} from "@egovernments/digit-ui-react-components"; - -import { Close } from "../../Icons"; -import { useTranslation } from "react-i18next"; -import { isError, useQueryClient } from "react-query"; -import StarRated from "../../components/timelineInstances/StarRated"; - -const MapView = (props) => { - return ( -
- -
- ); -}; - -const Heading = (props) => { - return

{props.label}

; -}; - -const CloseBtn = (props) => { - return ( -
- -
- ); -}; - -const TLCaption = ({ data, comments }) => { - const { t } = useTranslation() - return ( -
- {data?.date &&

{data?.date}

} -

{data?.name}

-

{data?.mobileNumber}

- {data?.source &&

{t("ES_COMMON_FILED_VIA_" + data?.source.toUpperCase())}

} - {comments?.map( e => -
-

{t("WF_COMMON_COMMENTS")}

-

{e}

-
- )} -
- ); -}; - -const ComplaintDetailsModal = ({ workflowDetails, complaintDetails, close, popup, selectedAction, onAssign, tenantId, t }) => { - - // RAIN-5692 PGR : GRO is assigning complaint, Selecting employee and assign. Its not getting assigned. - // Fix for next action assignee dropdown issue - const stateArray = workflowDetails?.data?.initialActionState?.nextActions?.filter( ele => ele?.action == selectedAction ); - const useEmployeeData = Digit.Hooks.pgr.useEmployeeFilter( - tenantId, - stateArray?.[0]?.assigneeRoles?.length > 0 ? stateArray?.[0]?.assigneeRoles?.join(",") : "", - complaintDetails - ); - const employeeData = useEmployeeData - ? useEmployeeData.map((departmentData) => { - return { heading: departmentData.department, options: departmentData.employees }; - }) - : null; - - const [selectedEmployee, setSelectedEmployee] = useState(null); - const [comments, setComments] = useState(""); - const [file, setFile] = useState(null); - const [uploadedFile, setUploadedFile] = useState(null); - const [error, setError] = useState(null); - const cityDetails = Digit.ULBService.getCurrentUlb(); - const [selectedReopenReason, setSelectedReopenReason] = useState(null); - - useEffect(() => { - (async () => { - setError(null); - if (file) { - if (file.size >= 5242880) { - setError(t("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED")); - } else { - try { - // TODO: change module in file storage - const response = await Digit.UploadServices.Filestorage("property-upload", file, cityDetails.code); - if (response?.data?.files?.length > 0) { - setUploadedFile(response?.data?.files[0]?.fileStoreId); - } else { - setError(t("CS_FILE_UPLOAD_ERROR")); - } - } catch (err) { - setError(t("CS_FILE_UPLOAD_ERROR")); - } - } - } - })(); - }, [file]); - - const reopenReasonMenu = [t(`CS_REOPEN_OPTION_ONE`), t(`CS_REOPEN_OPTION_TWO`), t(`CS_REOPEN_OPTION_THREE`), t(`CS_REOPEN_OPTION_FOUR`)]; - // const uploadFile = useCallback( () => { - - // }, [file]); - - function onSelectEmployee(employee) { - setSelectedEmployee(employee); - } - - function addComment(e) { - setError(null); - setComments(e.target.value); - } - - function selectfile(e) { - setFile(e.target.files[0]); - } - - function onSelectReopenReason(reason) { - setSelectedReopenReason(reason); - } - - return ( - - } - headerBarEnd={ close(popup)} />} - actionCancelLabel={t("CS_COMMON_CANCEL")} - actionCancelOnSubmit={() => close(popup)} - actionSaveLabel={ - selectedAction === "ASSIGN" || selectedAction === "REASSIGN" - ? t("CS_COMMON_ASSIGN") - : selectedAction === "REJECT" - ? t("CS_COMMON_REJECT") - : selectedAction === "REOPEN" - ? t("CS_COMMON_REOPEN") - : t("CS_COMMON_RESOLVE") - } - actionSaveOnSubmit={() => { - if(selectedAction === "REJECT" && !comments) - setError(t("CS_MANDATORY_COMMENTS")); - else - onAssign(selectedEmployee, comments, uploadedFile); - }} - error={error} - setError={setError} - > - - {selectedAction === "REJECT" || selectedAction === "RESOLVE" || selectedAction === "REOPEN" ? null : ( - - {t("CS_COMMON_EMPLOYEE_NAME")} - {employeeData && } - - )} - {selectedAction === "REOPEN" ? ( - - {t("CS_REOPEN_COMPLAINT")} - - - ) : null} - {t("CS_COMMON_EMPLOYEE_COMMENTS")} - {

{props.hintText}

} diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/react-components/src/atoms/TextInput.js b/frontend/micro-ui/web/micro-ui-internals/packages/react-components/src/atoms/TextInput.js index c403c632e..e86b8a898 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/react-components/src/atoms/TextInput.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/react-components/src/atoms/TextInput.js @@ -1,9 +1,10 @@ import React, { useEffect, useState } from "react"; import PropTypes from "prop-types"; +import { LocateIcon } from "./svgindex"; const TextInput = (props) => { const user_type = Digit.SessionStorage.get("userType"); - const [date, setDate] = useState(); + const [date, setDate] = useState(props?.type==="date"&&props?.value); const data = props?.watch ? { fromDate: props?.watch("fromDate"), @@ -24,9 +25,14 @@ const TextInput = (props) => { type={props?.validation && props.ValidationRequired ? props?.validation?.type : (props.type || "text")} name={props.name} id={props.id} - className={`${user_type ? "employee-card-input-error" : "card-input-error"} ${props.disable && "disabled"}`} + className={`${user_type ? "employee-card-input-error" : "card-input-error"} ${props.disable && "disabled"} ${props.customClass}`} placeholder={props.placeholder} onChange={(event) => { + if(props?.type === "number" && props?.maxlength) { + if(event.target.value.length > props?.maxlength) { + event.target.value = event.target.value.slice(0,-1); + } + } if (props?.onChange) { props?.onChange(event); } @@ -56,9 +62,14 @@ const TextInput = (props) => { type={props?.validation && props.ValidationRequired ? props?.validation?.type : (props.type || "text")} name={props.name} id={props.id} - className={`${user_type ? "employee-card-input" : "citizen-card-input"} ${props.disable && "disabled"} focus-visible ${props.errorStyle && "employee-card-input-error"}`} + className={`${user_type ? "employee-card-input" : "citizen-card-input"} ${props.disable && "disabled"} focus-visible ${props.errorStyle && "employee-card-input-error"} ${props.customClass}`} placeholder={props.placeholder} onChange={(event) => { + if(props?.type === "number" && props?.maxlength) { + if(event.target.value.length > props?.maxlength) { + event.target.value = event.target.value.slice(0,-1); + } + } if (props?.onChange) { props?.onChange(event); } @@ -86,8 +97,9 @@ const TextInput = (props) => { disabled={props.disabled} /> )} - {props.type === "date" && } + {/* {props.type === "date" && } */} {props.signature ? props.signatureImg : null} + {props.customIcon ? props.customIcon === "geolocation" ? : null : null}
); @@ -134,7 +146,7 @@ function DatePicker(props) { function getDDMMYYYY(date) { if (!date) return ""; - return new Date(date).toLocaleString("en-In").split(",")[0]; + return new Date(date)?.toLocaleString("en-In")?.split(",")?.[0]; } export default TextInput; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/react-components/src/atoms/Toast.js b/frontend/micro-ui/web/micro-ui-internals/packages/react-components/src/atoms/Toast.js index cf6a22938..469b88d8b 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/react-components/src/atoms/Toast.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/react-components/src/atoms/Toast.js @@ -52,13 +52,13 @@ const Toast = (props) => { Toast.propTypes = { label: PropTypes.string, onClose: PropTypes.func, - isDleteBtn: PropTypes.string + isDleteBtn: PropTypes.bool }; Toast.defaultProps = { label: "", onClose: undefined, - isDleteBtn: "" + isDleteBtn: false }; export default Toast; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/react-components/src/atoms/TopBar.js b/frontend/micro-ui/web/micro-ui-internals/packages/react-components/src/atoms/TopBar.js index bde71fa10..c26314496 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/react-components/src/atoms/TopBar.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/react-components/src/atoms/TopBar.js @@ -34,14 +34,12 @@ const TopBar = ({
{isMobile && } - - - +

{cityOfCitizenShownBesideLogo}

diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/react-components/src/atoms/ULBHomeCard.js b/frontend/micro-ui/web/micro-ui-internals/packages/react-components/src/atoms/ULBHomeCard.js index 58baa025c..2b78d56f2 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/react-components/src/atoms/ULBHomeCard.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/react-components/src/atoms/ULBHomeCard.js @@ -14,12 +14,12 @@ const ULBHomeCard = (props) => { {t(props.title)} -
+
{props.module.map((i) => { return ( (i.hyperlink ? location.assign(i.link) : history.push(i.link))} + onClick={() => (i.link ? history.push(i.link) : location.assign(i.locate))} children={ <> {" "} diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/react-components/src/atoms/UnMaskComponent.js b/frontend/micro-ui/web/micro-ui-internals/packages/react-components/src/atoms/UnMaskComponent.js index 78e496aea..a8f6f279e 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/react-components/src/atoms/UnMaskComponent.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/react-components/src/atoms/UnMaskComponent.js @@ -1,6 +1,5 @@ import PropTypes from "prop-types"; import React from "react"; -import { useTranslation } from "react-i18next"; import { PrivacyMaskIcon } from ".."; /** @@ -11,48 +10,31 @@ import { PrivacyMaskIcon } from ".."; * Feature :: Privacy * * @example - * { - * // function to be called while clicking on eye icon - * }} /> + * */ -const UnMaskComponent = React.memo(({ iseyevisible = true, privacy = {}, style = {}, unmaskData }) => { - const { t } = useTranslation(); - const { isLoading, data } = Digit.Hooks.useCustomMDMS(Digit.ULBService.getStateId(), "DataSecurity", [{ name: "SecurityPolicy" }], { - select: (data) => data?.DataSecurity?.SecurityPolicy?.find((elem) => elem?.model == privacy?.model) || {}, - }); +const UnMaskComponent = React.memo(({ privacy = {}, style = {} }) => { + const { isLoading, data } = Digit.Hooks.useCustomMDMS( + Digit.ULBService.getStateId(), + "DataSecurity", + [{ name: "SecurityPolicy" }], + { + select: (data) => data?.DataSecurity?.SecurityPolicy?.find((elem) => elem?.model == privacy?.model) || {}, + } + ); const { privacy: privacyValue, updatePrivacy } = Digit.Hooks.usePrivacyContext(); if (isLoading || privacy?.hide) { return null; } - if (Digit.Utils.checkPrivacy(data, privacy) && iseyevisible) { - sessionStorage.setItem("isPrivacyEnabled", "true"); + if (Digit.Utils.checkPrivacy(data, privacy)) { return ( { - if (unmaskData) { - unmaskData(); - } else { - sessionStorage.setItem("eyeIconClicked", privacy?.fieldName); - updatePrivacy(privacy?.uuid, privacy?.fieldName); - } + updatePrivacy(privacy?.uuid, privacy?.fieldName); }} > -
- - - {t("CORE_UNMASK_DATA")} - -
+
); } @@ -62,6 +44,7 @@ const UnMaskComponent = React.memo(({ iseyevisible = true, privacy = {}, style = UnMaskComponent.propTypes = { privacy: PropTypes.object, }; + UnMaskComponent.defaultProps = { privacy: { uuid: "", fieldName: "", model: "" }, }; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/react-components/src/atoms/UploadFile.js b/frontend/micro-ui/web/micro-ui-internals/packages/react-components/src/atoms/UploadFile.js index cf245d78f..9267e9098 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/react-components/src/atoms/UploadFile.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/react-components/src/atoms/UploadFile.js @@ -80,8 +80,7 @@ const getCitizenStyles = (value) => { }, tagContainerStyles: { margin: "0px", - padding: "0px", - width: "46%" + padding: "0px" }, tagStyles: { height: "auto", @@ -91,19 +90,20 @@ const getCitizenStyles = (value) => { margin: "5px" }, textStyles: { - wordBreak: "break-word", + wordBreak: "break-all", height: "auto", lineHeight: "16px", overflow: "hidden", // minHeight: "35px", - maxHeight: "34px" + maxHeight: "34px", + maxWidth: "100%" }, inputStyles: { - width: "43%", + width: "42%", minHeight: "42px", maxHeight: "42px", - top: "5px", - left: "5px" + top: "12px", + left: "12px" }, buttonStyles: { height: "auto", @@ -150,6 +150,7 @@ const UploadFile = (props) => { // for common aligmnent issues added common styles extraStyles = getCitizenStyles("OBPS"); + // if (window.location.href.includes("/obps") || window.location.href.includes("/noc")) { // extraStyles = getCitizenStyles("OBPS"); @@ -194,12 +195,12 @@ const UploadFile = (props) => { return ( {showHint &&

{t(props?.hintText)}

} -
+
@@ -209,24 +210,11 @@ const UploadFile = (props) => { props?.removeTargetedFile(fileDetailsData, e)} />
})} - {!hasFile || props.error ? ( -

{props.message}

- ) : ( -
-
- - {(typeof inpRef.current.files[0]?.name !== "undefined") && !(props?.file) ? inpRef.current.files[0]?.name : props.file?.name} - - handleDelete()} style={extraStyles ? extraStyles?.closeIconStyles : null}> - - -
-
- )} + {props?.uploadedFiles.length === 0 &&

{props.message}

}
{ disabled={props.disabled} onChange={(e) => props.onUpload(e)} onClick ={ event => { - const { target = {} } = event || {}; - target.value = ""; + if (!props?.enableButton) { + event.preventDefault() + } else { + const { target = {} } = event || {}; + target.value = ""; + } }} />
{props.iserror &&

{props.iserror}

} - {props?.showHintBelow &&

{t(props?.hintText)}

} + {props?.showHintBelow &&

{t(props?.hintText)}

}
); }; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/react-components/src/atoms/ViewDetailsCard.js b/frontend/micro-ui/web/micro-ui-internals/packages/react-components/src/atoms/ViewDetailsCard.js new file mode 100644 index 000000000..b29f9ead4 --- /dev/null +++ b/frontend/micro-ui/web/micro-ui-internals/packages/react-components/src/atoms/ViewDetailsCard.js @@ -0,0 +1,31 @@ +import React from 'react' +import Card from './Card' +import {StatusTable,Row} from './StatusTable' +import CardSubHeader from './CardSectionHeader' + +const ViewDetailsCard = ({cardState,t,createScreen,...props}) => { + return ( + + + { + cardState.map((item, index) => { + return ( +
+ { + item?.title ? {t(item?.title)} : '' + } + { + item?.values?.map((item, index) => { + return () + }) + } +
+ ) + }) + } +
+
+ ) +} + +export default ViewDetailsCard \ No newline at end of file diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/react-components/src/atoms/ViewImages.js b/frontend/micro-ui/web/micro-ui-internals/packages/react-components/src/atoms/ViewImages.js new file mode 100644 index 000000000..22f869add --- /dev/null +++ b/frontend/micro-ui/web/micro-ui-internals/packages/react-components/src/atoms/ViewImages.js @@ -0,0 +1,53 @@ +import React, { useCallback, useEffect, useState } from "react"; + +export const ViewImages = (props) => { + const [uploadedImagesThumbs, setUploadedImagesThumbs] = useState(null); + const [uploadedImagesIds, setUploadedImagesIds] = useState(props.fileStoreIds); + + useEffect(() => { + setUploadedImagesIds(props.fileStoreIds) + }, [props.fileStoreIds]); + + useEffect(() => { + (async () => { + if (uploadedImagesIds !== null) { + await submit(); + } + })(); + }, [uploadedImagesIds]); + + function addImageThumbnails(thumbnailsData) { + var keys = Object.keys(thumbnailsData.data); + var index = keys.findIndex((key) => key === "fileStoreIds"); + if (index > -1) { + keys.splice(index, 1); + } + var thumbnails = []; + + const newThumbnails = keys.map((key) => { + return { image: thumbnailsData.data[key].split(",")[2], key, fullImage: Digit.Utils.getFileUrl(thumbnailsData.data[key]) }; + }); + setUploadedImagesThumbs([...thumbnails, ...newThumbnails]); + } + + const submit = useCallback(async () => { + if (uploadedImagesIds !== null && uploadedImagesIds.length > 0) { + const res = await Digit.UploadServices.Filefetch(uploadedImagesIds, props.tenantId); + addImageThumbnails(res); + } + }, [uploadedImagesIds]); + + return ( + +
+ {uploadedImagesThumbs?.map((thumbnail, index) => { + return ( +
+ uploaded thumbnail props.onClick(thumbnail.fullImage, index)} /> +
+ ); + })} +
+
+ ); +}; \ No newline at end of file diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/react-components/src/atoms/WeekPicker.js b/frontend/micro-ui/web/micro-ui-internals/packages/react-components/src/atoms/WeekPicker.js new file mode 100644 index 000000000..ee1ced7fe --- /dev/null +++ b/frontend/micro-ui/web/micro-ui-internals/packages/react-components/src/atoms/WeekPicker.js @@ -0,0 +1,12 @@ +import React,{ useState } from 'react' +import { Calendar } from "react-date-range"; +const WeekPicker = () => { + const [startDate, setStartDate] = useState(new Date()); + + return ( + setStartDate(item)} + date={startDate} /> + ) +} + +export default WeekPicker \ No newline at end of file diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/react-components/src/atoms/WorkflowActions.js b/frontend/micro-ui/web/micro-ui-internals/packages/react-components/src/atoms/WorkflowActions.js new file mode 100644 index 000000000..5aec95b7f --- /dev/null +++ b/frontend/micro-ui/web/micro-ui-internals/packages/react-components/src/atoms/WorkflowActions.js @@ -0,0 +1,212 @@ +import React, { useEffect, useRef,useState } from "react"; +import { useTranslation } from "react-i18next"; +import SubmitBar from "./SubmitBar"; +import ActionBar from "./ActionBar"; +import Menu from "./Menu"; +import ActionModal from "./Modals"; +import { Loader } from "./Loader"; +import Toast from "./Toast"; +import { useHistory } from "react-router-dom"; +const WorkflowActions = ({ businessService, tenantId, applicationNo, forcedActionPrefix, ActionBarStyle = {}, MenuStyle = {}, applicationDetails, url, setStateChanged, moduleCode,editApplicationNumber,editCallback ,callback}) => { + + const history = useHistory() + const { estimateNumber } = Digit.Hooks.useQueryParams(); + applicationNo = applicationNo ? applicationNo : estimateNumber + + const { mutate } = Digit.Hooks.useUpdateCustom(url) + + const [displayMenu,setDisplayMenu] = useState(false) + const [showModal,setShowModal] = useState(false) + const [selectedAction,setSelectedAction] = useState(null) + const [isEnableLoader, setIsEnableLoader] = useState(false); + const [showToast,setShowToast] = useState(null) + + + + const { t } = useTranslation(); + let user = Digit.UserService.getUser(); + + let workflowDetails = Digit.Hooks.useWorkflowDetailsV2( + { + tenantId: tenantId, + id: applicationNo, + moduleCode: businessService, + config: { + enabled: true, + cacheTime: 0 + } + } + ); + + + + const menuRef = useRef(); + + const userRoles = user?.info?.roles?.map((e) => e.code); + let isSingleButton = false; + let isMenuBotton = false; + let actions = workflowDetails?.data?.actionState?.nextActions?.filter((e) => { + return userRoles.some((role) => e.roles?.includes(role)) || !e.roles; + }) || workflowDetails?.data?.nextActions?.filter((e) => { + return userRoles.some((role) => e.roles?.includes(role)) || !e.roles; + }); + + const closeMenu = () => { + setDisplayMenu(false); + } + + const closeToast = () => { + setTimeout(() => { + setShowToast(null) + }, 5000); + } + + setTimeout(() => { + setShowToast(null); + }, 20000); + + + + Digit.Hooks.useClickOutside(menuRef, closeMenu, displayMenu); + + if (actions?.length > 0) { + isMenuBotton = true; + isSingleButton = false; + } + + const closeModal = () => { + setSelectedAction(null); + setShowModal(false); + setShowToast({ warning:true,label:`WF_ACTION_CANCELLED`}) + closeToast() + }; + + const onActionSelect = (action) => { + + const bsContract = Digit?.Customizations?.["commonUiConfig"]?.getBusinessService("contract"); + const bsEstimate = Digit?.Customizations?.["commonUiConfig"]?.getBusinessService("estimate") + const bsAttendance = Digit?.Customizations?.["commonUiConfig"]?.getBusinessService("muster roll") + const bsPurchaseBill = Digit?.Customizations?.["commonUiConfig"]?.getBusinessService("works.purchase") + + + setDisplayMenu(false) + setSelectedAction(action) + + //here check if actin is edit then do a history.push acc to the businessServ and action + //send appropriate states over + + if(bsEstimate === businessService && action?.action === "RE-SUBMIT"){ + history.push(`/${window?.contextPath}/employee/estimate/create-estimate?tenantId=${tenantId}&projectNumber=${editApplicationNumber}&estimateNumber=${applicationDetails?.estimateNumber}&isEdit=true`); + return + } + + if(bsContract === businessService && action?.action === "EDIT"){ + history.push(`/${window?.contextPath}/employee/contracts/create-contract?tenantId=${tenantId}&workOrderNumber=${applicationNo}`); + return + } + if(bsAttendance === businessService && action?.action === "RE-SUBMIT"){ + editCallback() + return + } + + if(bsPurchaseBill === businessService && action?.action==="RE-SUBMIT"){ + history.push(`/${window?.contextPath}/employee/expenditure/create-purchase-bill?tenantId=${tenantId}&billNumber=${editApplicationNumber}`); + return + } + //here we can add cases of toast messages,edit application and more... + // the default result is setting the modal to show + setShowModal(true) + + } + + const submitAction = (data,selectAction) => { + setShowModal(false) + setIsEnableLoader(true) + const mutateObj = {...data} + + mutate(mutateObj,{ + onError:(error,variables)=>{ + setIsEnableLoader(false) + //show error toast acc to selectAction + setShowToast({ error: true, label: Digit.Utils.locale.getTransformedLocale(`WF_UPDATE_ERROR_${businessService}_${selectAction.action}`), isDleteBtn:true }) + + callback?.onError?.(); + + + + }, + onSuccess:(data,variables) => { + setIsEnableLoader(false) + //show success toast acc to selectAction + setShowToast({ label: Digit.Utils.locale.getTransformedLocale(`WF_UPDATE_SUCCESS_${businessService}_${selectAction.action}`) }) + + callback?.onSuccess?.(); + // to refetch updated workflowData and re-render timeline and actions + workflowDetails.revalidate() + + + //COMMENTING THIS FOR NOW BECAUSE DUE TO THIS TOAST IS NOT SHOWING SINCE THE WHOLE PARENT COMP RE-RENDERS + // setStateChanged(`WF_UPDATE_SUCCESS_${selectAction.action}`) + } + }) + } + + //if workflowDetails are loading then a loader is displayed in workflowTimeline comp anyway + if(isEnableLoader){ + return + } + return ( + + {!workflowDetails?.isLoading && isMenuBotton && !isSingleButton && ( + + {displayMenu && (workflowDetails?.data?.actionState?.nextActions || workflowDetails?.data?.nextActions) ? ( + + ) : null} + setDisplayMenu(!displayMenu)} /> + + )} + {!workflowDetails?.isLoading && !isMenuBotton && isSingleButton && ( + + + + )} + + {showModal && } + {showToast && { + setShowToast(null); + }} + isDleteBtn={showToast?.isDleteBtn} + />} + + ); +} + +export default WorkflowActions \ No newline at end of file diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/react-components/src/atoms/WorkflowTimeline.js b/frontend/micro-ui/web/micro-ui-internals/packages/react-components/src/atoms/WorkflowTimeline.js new file mode 100644 index 000000000..13bab32fd --- /dev/null +++ b/frontend/micro-ui/web/micro-ui-internals/packages/react-components/src/atoms/WorkflowTimeline.js @@ -0,0 +1,133 @@ +import React, { Fragment,useState,useEffect } from 'react' +import { Loader } from "./Loader" +import CardSectionHeader from './CardSectionHeader'; +import { CheckPoint, ConnectingCheckPoints } from './ConnectingCheckPoints'; +import BreakLine from './BreakLine'; +import { useTranslation } from "react-i18next"; +import TLCaption from './TLCaption'; + +function OpenImage(imageSource, index, thumbnailsToShow) { + window.open(thumbnailsToShow?.fullImage?.[0], "_blank"); +} + +const WorkflowTimeline = ({ businessService, tenantId,applicationNo, timelineStatusPrefix="WF_SERVICE_" ,statusAttribute="status", ...props}) => { + const [additionalComment,setAdditionalComment] = useState(false) + //for testing from url these 2 lines of code are kept here + // const { estimateNumber } = Digit.Hooks.useQueryParams(); + // applicationNo = applicationNo? applicationNo : estimateNumber + const { t } = useTranslation(); + + const getTimelineCaptions = (checkpoint, index) => { + + let captionDetails = { + name : '', + date : '', + mobileNumber : '', + wfComment : '', + additionalComment : '', + thumbnailsToShow : '' + } + if(index === -1) { + captionDetails.name = checkpoint?.assignes?.[0]?.name; + captionDetails.date = ''; + captionDetails.mobileNumber = ''; + captionDetails.wfComment = ''; + captionDetails.additionalComment = ''; + captionDetails.thumbnailsToShow = ''; + }else { + captionDetails.name = checkpoint?.assigner?.name; + captionDetails.date = `${Digit.DateUtils?.ConvertTimestampToDate(checkpoint.auditDetails.lastModifiedEpoch)} ${Digit.DateUtils?.ConvertEpochToTimeInHours( + checkpoint.auditDetails.lastModifiedEpoch + )} ${Digit.DateUtils?.getDayfromTimeStamp(checkpoint.auditDetails.lastModifiedEpoch)}`; + captionDetails.mobileNumber = checkpoint?.assigner?.mobileNumber; + captionDetails.wfComment = checkpoint?.comment ? [checkpoint?.comment] : []; + captionDetails.additionalComment = additionalComment && checkpoint?.performedAction === "APPROVE", + captionDetails.thumbnailsToShow = checkpoint?.thumbnailsToShow; + } + + const caption = { + date: captionDetails?.date, + name: captionDetails?.name, + mobileNumber: captionDetails?.mobileNumber, + wfComment: captionDetails?.wfComment, + additionalComment: captionDetails?.additionalComment, + thumbnailsToShow: checkpoint?.thumbnailsToShow + }; + + return ; + + }; + + let workflowDetails = Digit.Hooks.useWorkflowDetailsV2( + { + tenantId: tenantId, + id: applicationNo, + moduleCode: businessService, + config: { + enabled: true, + cacheTime: 0 + } + } + ); + + useEffect(() => { + if (workflowDetails?.data?.applicationBusinessService === "muster-roll-approval" && workflowDetails?.data?.actionState?.applicationStatus === "APPROVED") { + setAdditionalComment(true) + } + }, [workflowDetails]) + + + return ( + + {workflowDetails?.isLoading && } + { workflowDetails?.data?.timeline?.length > 0 && ( + + {workflowDetails?.breakLineRequired === undefined ? : workflowDetails?.breakLineRequired ? : null} + {!workflowDetails?.isLoading && ( + + + {t("WORKS_WORKFLOW_TIMELINE")} + + {workflowDetails?.data?.timeline && + + {workflowDetails?.data?.timeline && + workflowDetails?.data?.timeline.map((checkpoint, index, arr) => { + return ( + + { + index === 0 && !checkpoint?.isTerminateState && + + + + } + + + ); + })} + + } + + )} + + )} + + ) +} + +export default WorkflowTimeline \ No newline at end of file diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/react-components/src/atoms/WrapUnMaskComponent.js b/frontend/micro-ui/web/micro-ui-internals/packages/react-components/src/atoms/WrapUnMaskComponent.js deleted file mode 100644 index 0d528e535..000000000 --- a/frontend/micro-ui/web/micro-ui-internals/packages/react-components/src/atoms/WrapUnMaskComponent.js +++ /dev/null @@ -1,79 +0,0 @@ -import _ from "lodash"; -import PropTypes from "prop-types"; -import React, { useState } from "react"; -import { useTranslation } from "react-i18next"; -import { Loader, UnMaskComponent } from ".."; -import { PrivacyMaskIcon } from ".."; -/** - * Custom Component to demask the masked values. - * - * @author jagankumar-egov - * - * Feature :: Privacy - * - * @example - * - */ - -const formatValue = (showValue) => { - return ( - showValue && Digit.Utils.locale.stringReplaceAll(showValue, showValue?.substring(showValue?.indexOf("*"), showValue?.lastIndexOf("*") + 1), "") - ); -}; - -const WrapUnMaskComponent = React.memo(({ privacy = {}, value, unmaskField, ...rem }) => { - const [privacyState, setPrivacyState] = useState(false); - const { loadData = {} } = privacy; - const { t } = useTranslation(); - const aaa = [ - loadData?.serviceName, - loadData?.requestParam, - loadData?.requestBody, - { recordId: privacy?.uuid, plainRequestFields: Array.isArray(privacy?.fieldName) ? privacy?.fieldName : [privacy?.fieldName] }, - { - enabled: privacyState, - select: (data) => { - if (loadData?.d) { - return loadData?.d(data, value); - } - return unmaskField ? unmaskField(_.get(data, loadData?.jsonPath, value)) : _.get(data, loadData?.jsonPath, value); - }, - }, - ]; - const { isLoading, data, ...orr } = Digit.Hooks.useCustomAPIHook(...aaa); - if (isLoading) { - return !unmaskField ? :
-
; - } - - return privacy?.uuid && data ? ( - - {!unmaskField && t(data)} - {!unmaskField && privacy?.showValue && formatValue(value)} - - ) : ( - - {!unmaskField && value} - {privacy && ( - - { - privacy?.uuid && loadData && setPrivacyState(true); - }} - {...rem} - > - - )} - - ); -}); - -WrapUnMaskComponent.propTypes = { - privacy: PropTypes.object, -}; -WrapUnMaskComponent.defaultProps = { - privacy: { uuid: "", fieldName: "", model: "" }, -}; - -export default WrapUnMaskComponent; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/react-components/src/atoms/amtUtils/index.js b/frontend/micro-ui/web/micro-ui-internals/packages/react-components/src/atoms/amtUtils/index.js new file mode 100644 index 000000000..38ef1bb5c --- /dev/null +++ b/frontend/micro-ui/web/micro-ui-internals/packages/react-components/src/atoms/amtUtils/index.js @@ -0,0 +1,414 @@ +/** + * Add group separator to value eg. 1000 > 1,000 + */ +export const addSeparators = (value, separator = ",") => { + return value.replace(/\B(?=(\d{3})+(?!\d))/g, separator); +}; + +/** + * Remove prefix, separators and extra decimals from value + */ +export const cleanValue = ({ + value, + groupSeparator = ",", + decimalSeparator = ".", + allowDecimals = true, + decimalsLimit = 2, + allowNegativeValue = true, + disableAbbreviations = false, + prefix = "", + transformRawValue = (rawValue) => rawValue, +}) => { + const transformedValue = transformRawValue(value); + + if (transformedValue === "-") { + return transformedValue; + } + + const abbreviations = disableAbbreviations ? [] : ["k", "m", "b"]; + const reg = new RegExp(`((^|\\D)-\\d)|(-${escapeRegExp(prefix)})`); + const isNegative = reg.test(transformedValue); + + // Is there a digit before the prefix? eg. 1$ + const [prefixWithValue, preValue] = RegExp(`(\\d+)-?${escapeRegExp(prefix)}`).exec(value) || []; + const withoutPrefix = prefix + ? prefixWithValue + ? transformedValue.replace(prefixWithValue, "").concat(preValue) + : transformedValue.replace(prefix, "") + : transformedValue; + const withoutSeparators = removeSeparators(withoutPrefix, groupSeparator); + const withoutInvalidChars = removeInvalidChars(withoutSeparators, [groupSeparator, decimalSeparator, ...abbreviations]); + + let valueOnly = withoutInvalidChars; + + if (!disableAbbreviations) { + // disallow letter without number + if (abbreviations.some((letter) => letter === withoutInvalidChars.toLowerCase())) { + return ""; + } + const parsed = parseAbbrValue(withoutInvalidChars, decimalSeparator); + if (parsed) { + valueOnly = String(parsed); + } + } + + const includeNegative = isNegative && allowNegativeValue ? "-" : ""; + + if (decimalSeparator && valueOnly.includes(decimalSeparator)) { + const [int, decimals] = withoutInvalidChars.split(decimalSeparator); + const trimmedDecimals = decimalsLimit && decimals ? decimals.slice(0, decimalsLimit) : decimals; + const includeDecimals = allowDecimals ? `${decimalSeparator}${trimmedDecimals}` : ""; + + return `${includeNegative}${int}${includeDecimals}`; + } + + return `${includeNegative}${valueOnly}`; +}; + +/** + * Escape regex char + * + * See: https://stackoverflow.com/questions/17885855/use-dynamic-variable-string-as-regex-pattern-in-javascript + */ +export const escapeRegExp = (stringToGoIntoTheRegex) => { + return stringToGoIntoTheRegex.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&"); +}; + +export const fixedDecimalValue = (value, decimalSeparator, fixedDecimalLength) => { + if (fixedDecimalLength && value.length > 1) { + if (value.includes(decimalSeparator)) { + const [int, decimals] = value.split(decimalSeparator); + if (decimals.length > fixedDecimalLength) { + return `${int}${decimalSeparator}${decimals.slice(0, fixedDecimalLength)}`; + } + } + + const reg = value.length > fixedDecimalLength ? new RegExp(`(\\d+)(\\d{${fixedDecimalLength}})`) : new RegExp(`(\\d)(\\d+)`); + + const match = value.match(reg); + if (match) { + const [, int, decimals] = match; + return `${int}${decimalSeparator}${decimals}`; + } + } + + return value; +}; + +/** + * Format value with decimal separator, group separator and prefix + */ +export const formatValue = (options) => { + const { value: _value, decimalSeparator, intlConfig, decimalScale, prefix = "", suffix = "" } = options; + + if (_value === "" || _value === undefined) { + return ""; + } + + if (_value === "-") { + return "-"; + } + + const isNegative = new RegExp(`^\\d?-${prefix ? `${escapeRegExp(prefix)}?` : ""}\\d`).test(_value); + + const value = decimalSeparator !== "." ? replaceDecimalSeparator(_value, decimalSeparator, isNegative) : _value; + + const defaultNumberFormatOptions = { + minimumFractionDigits: decimalScale || 0, + maximumFractionDigits: 20, + }; + + const numberFormatter = intlConfig + ? new Intl.NumberFormat( + intlConfig.locale, + intlConfig.currency + ? { + ...defaultNumberFormatOptions, + style: "currency", + currency: intlConfig.currency, + } + : defaultNumberFormatOptions + ) + : new Intl.NumberFormat(undefined, defaultNumberFormatOptions); + + const parts = numberFormatter.formatToParts(Number(value)); + + let formatted = replaceParts(parts, options); + + // Does intl formatting add a suffix? + const intlSuffix = getSuffix(formatted, { ...options }); + + // Include decimal separator if user input ends with decimal separator + const includeDecimalSeparator = _value.slice(-1) === decimalSeparator ? decimalSeparator : ""; + + const [, decimals] = value.match(RegExp("\\d+\\.(\\d+)")) || []; + + // Keep original decimal padding if no decimalScale + if (decimalScale === undefined && decimals && decimalSeparator) { + if (formatted.includes(decimalSeparator)) { + formatted = formatted.replace(RegExp(`(\\d+)(${escapeRegExp(decimalSeparator)})(\\d+)`, "g"), `$1$2${decimals}`); + } else { + if (intlSuffix && !suffix) { + formatted = formatted.replace(intlSuffix, `${decimalSeparator}${decimals}${intlSuffix}`); + } else { + formatted = `${formatted}${decimalSeparator}${decimals}`; + } + } + } + + if (suffix && includeDecimalSeparator) { + return `${formatted}${includeDecimalSeparator}${suffix}`; + } + + if (intlSuffix && includeDecimalSeparator) { + return formatted.replace(intlSuffix, `${includeDecimalSeparator}${intlSuffix}`); + } + + if (intlSuffix && suffix) { + return formatted.replace(intlSuffix, `${includeDecimalSeparator}${suffix}`); + } + + return [formatted, includeDecimalSeparator, suffix].join(""); +}; + +/** + * Before converting to Number, decimal separator has to be . + */ +const replaceDecimalSeparator = (value, decimalSeparator, isNegative) => { + let newValue = value; + if (decimalSeparator && decimalSeparator !== ".") { + newValue = newValue.replace(RegExp(escapeRegExp(decimalSeparator), "g"), "."); + if (isNegative && decimalSeparator === "-") { + newValue = `-${newValue.slice(1)}`; + } + } + return newValue; +}; + +const replaceParts = (parts, { prefix, groupSeparator, decimalSeparator, decimalScale, disableGroupSeparators = false }) => { + return parts + .reduce( + (prev, { type, value }, i) => { + if (i === 0 && prefix) { + if (type === "minusSign") { + return [value, prefix]; + } + + if (type === "currency") { + return [...prev, prefix]; + } + + return [prefix, value]; + } + + if (type === "currency") { + return prefix ? prev : [...prev, value]; + } + + if (type === "group") { + return !disableGroupSeparators ? [...prev, groupSeparator !== undefined ? groupSeparator : value] : prev; + } + + if (type === "decimal") { + if (decimalScale !== undefined && decimalScale === 0) { + return prev; + } + + return [...prev, decimalSeparator !== undefined ? decimalSeparator : value]; + } + + if (type === "fraction") { + return [...prev, decimalScale !== undefined ? value.slice(0, decimalScale) : value]; + } + + return [...prev, value]; + }, + [""] + ) + .join(""); +}; + +const defaultConfig = { + currencySymbol: "", + groupSeparator: "", + decimalSeparator: "", + prefix: "", + suffix: "", +}; + +/** + * Get locale config from input or default + */ +//tried locale hardcoded +export const getLocaleConfig = (intlConfig) => { + const { locale, currency } = intlConfig || {}; + + const numberFormatter = locale ? new Intl.NumberFormat(locale, currency ? { currency, style: "currency" } : undefined) : new Intl.NumberFormat(); + + return numberFormatter.formatToParts(1000.1).reduce((prev, curr, i) => { + if (curr.type === "currency") { + if (i === 0) { + return { ...prev, currencySymbol: curr.value, prefix: curr.value }; + } else { + return { ...prev, currencySymbol: curr.value, suffix: curr.value }; + } + } + if (curr.type === "group") { + return { ...prev, groupSeparator: curr.value }; + } + if (curr.type === "decimal") { + return { ...prev, decimalSeparator: curr.value }; + } + + return prev; + }, defaultConfig); +}; + +export const getSuffix = (value, { groupSeparator = ",", decimalSeparator = "." }) => { + const suffixReg = new RegExp(`\\d([^${escapeRegExp(groupSeparator)}${escapeRegExp(decimalSeparator)}0-9]+)`); + const suffixMatch = value.match(suffixReg); + return suffixMatch ? suffixMatch[1] : undefined; +}; + +export const isNumber = (input) => RegExp(/\d/, "gi").test(input); + +export const padTrimValue = (value, decimalSeparator = ".", decimalScale) => { + if (decimalScale === undefined || value === "" || value === undefined) { + return value; + } + + if (!value.match(/\d/g)) { + return ""; + } + + const [int, decimals] = value.split(decimalSeparator); + + if (decimalScale === 0) { + return int; + } + + let newValue = decimals || ""; + + if (newValue.length < decimalScale) { + while (newValue.length < decimalScale) { + newValue += "0"; + } + } else { + newValue = newValue.slice(0, decimalScale); + } + + return `${int}${decimalSeparator}${newValue}`; +}; + +/** + * Abbreviate number eg. 1000 = 1k + * + * Source: https://stackoverflow.com/a/9345181 + */ +export const abbrValue = (value, decimalSeparator = ".", _decimalPlaces = 10) => { + if (value > 999) { + let valueLength = ("" + value).length; + const p = Math.pow; + const d = p(10, _decimalPlaces); + valueLength -= valueLength % 3; + + const abbrValue = Math.round((value * d) / p(10, valueLength)) / d + " kMGTPE"[valueLength / 3]; + return abbrValue.replace(".", decimalSeparator); + } + + return String(value); +}; + +const abbrMap = { k: 1000, m: 1000000, b: 1000000000 }; + +/** + * Parse a value with abbreviation e.g 1k = 1000 + */ +export const parseAbbrValue = (value, decimalSeparator = ".") => { + const reg = new RegExp(`(\\d+(${escapeRegExp(decimalSeparator)}\\d*)?)([kmb])$`, "i"); + const match = value.match(reg); + + if (match) { + const [, digits, , abbr] = match; + const multiplier = abbrMap[abbr.toLowerCase()]; + + return Number(digits.replace(decimalSeparator, ".")) * multiplier; + } + + return undefined; +}; + +/** + * Remove invalid characters + */ +export const removeInvalidChars = (value, validChars) => { + const chars = escapeRegExp(validChars.join("")); + const reg = new RegExp(`[^\\d${chars}]`, "gi"); + return value.replace(reg, ""); +}; + +/** + * Remove group separator from value eg. 1,000 > 1000 + */ +export const removeSeparators = (value, separator = ",") => { + const reg = new RegExp(escapeRegExp(separator), "g"); + return value.replace(reg, ""); +}; + +/** + * Based on the last key stroke and the cursor position, update the value + * and reposition the cursor to the right place + */ +export const repositionCursor = ({ selectionStart, value, lastKeyStroke, stateValue, groupSeparator }) => { + let cursorPosition = selectionStart; + let modifiedValue = value; + if (stateValue && cursorPosition) { + const splitValue = value.split(""); + // if cursor is to right of groupSeparator and backspace pressed, delete the character to the left of the separator and reposition the cursor + if (lastKeyStroke === "Backspace" && stateValue[cursorPosition] === groupSeparator) { + splitValue.splice(cursorPosition - 1, 1); + cursorPosition -= 1; + } + // if cursor is to left of groupSeparator and delete pressed, delete the character to the right of the separator and reposition the cursor + if (lastKeyStroke === "Delete" && stateValue[cursorPosition] === groupSeparator) { + splitValue.splice(cursorPosition, 1); + cursorPosition += 1; + } + modifiedValue = splitValue.join(""); + return { modifiedValue, cursorPosition }; + } + + return { modifiedValue, cursorPosition: selectionStart }; +}; + +export const getIntlConfig = (prefix = "") => { + const currencyMatch = Object.keys(CURRENCY_MAP).filter((e) => prefix.includes(e)); + if (currencyMatch && currencyMatch?.length > 0) { + return CURRENCY_MAP[currencyMatch[0]]; + } else { + CURRENCY_MAP["₹"]; + } +}; + +const CURRENCY_MAP = { + "¥": { + locale: "ja-JP", + currency: "JPY", + }, + "₹": { + locale: "en-IN", + currency: "INR", + }, + "£": { + locale: "en-GB", + currency: "GBP", + }, + "€": { + locale: "de-DE", + currency: "EUR", + }, + $: { + locale: "en-US", + currency: "USD", + }, +}; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/react-components/src/atoms/svgindex.js b/frontend/micro-ui/web/micro-ui-internals/packages/react-components/src/atoms/svgindex.js index dbabff4f6..39c8d6268 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/react-components/src/atoms/svgindex.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/react-components/src/atoms/svgindex.js @@ -1,4 +1,23 @@ import React from "react"; + +const CreateEstimateIcon = ({ className, style = {}, fill = "#F47738" }) => ( + + + +); + +const GotoInboxIcon = ({ className, style = {}, fill = "#F47738" }) => ( + + + +); + const ArrowLeft = ({ className }) => ( @@ -6,22 +25,17 @@ const ArrowLeft = ({ className }) => ( ); -const ArrowLeftWhite = ({ className }) => ( - - +const ArrowLeftWhite = ({ className, fill = "white", style = {} }) => ( + + ); const PrivacyMaskIcon = ({ className, style = {} }) => ( - // - // - // + d="M11 0C6 0 1.73 3.11 0 7.5C1.73 11.89 6 15 11 15C16 15 20.27 11.89 22 7.5C20.27 3.11 16 0 11 0ZM11 12.5C8.24 12.5 6 10.26 6 7.5C6 4.74 8.24 2.5 11 2.5C13.76 2.5 16 4.74 16 7.5C16 10.26 13.76 12.5 11 12.5ZM11 4.5C9.34 4.5 8 5.84 8 7.5C8 9.16 9.34 10.5 11 10.5C12.66 10.5 14 9.16 14 7.5C14 5.84 12.66 4.5 11 4.5Z" + fill="#EEEEEE" + /> ); @@ -192,8 +206,8 @@ const DocumentIcon = () => ( ); -const DocumentIconSolid = ({styles, className}) => ( - +const DocumentIconSolid = () => ( + @@ -269,7 +283,7 @@ const PDFSvg = ({ className, width = 80, height = 80, - style = { background: "#f6f6f6", padding: "8px", boxShadow: "0px 2px 0px #d6d5d3", borderRadius: "2px" }, + style = { background: "#f6f6f6", padding: "8px", boxShadow: "0px 2px 0px #d6d5d3", borderRadius: "4px" }, viewBox = "0 0 80 80", }) => ( @@ -372,16 +386,11 @@ export const LanguageIcon = ({ className, styles }) => ( ); export const LogoutIcon = ({ className, styles }) => ( - - - -); - -export const LoginIcon = ({ className, styles }) => ( ); + const CalendarIcon = (props) => ( @@ -427,7 +436,6 @@ const ShippingTruck = ({ className, styles }) => ( @@ -581,16 +589,6 @@ const InfoBannerIcon = ({ fill = "#3498DB" }) => { ); }; - -const InfoIcon = () => { - return ( - - - - - ); -}; - const ShareIcon = ({ styles, className }) => ( ( ); const ComplaintIcon = ({ className, styles }) => ( - + ); @@ -671,10 +669,10 @@ const PersonIcon = ({ className, styles }) => ( ); -const ReceiptIcon = ({styles, className}) => ( - +const ReceiptIcon = () => ( + - + ); @@ -760,7 +758,7 @@ const BPAHomeIcon = ({ className, styles }) => ( fillRule="evenodd" clipRule="evenodd" d="M30.3333 0H3.66659C1.83325 0 0.333252 1.5 0.333252 3.33333V26.6667C0.333252 28.5 1.83325 30 3.66659 30H30.3333C32.1666 30 33.6666 28.5 33.6666 26.6667V3.33333C33.6666 1.5 32.1666 0 30.3333 0ZM13.6666 23.3333H5.33325V20H13.6666V23.3333ZM13.6666 16.6667H5.33325V13.3333H13.6666V16.6667ZM13.6666 10H5.33325V6.66667H13.6666V10ZM21.6999 20L16.9999 15.2667L19.3499 12.9167L21.6999 15.2833L26.9833 10L29.3499 12.3667L21.6999 20Z" - //fill="white" + fill="white" /> ); @@ -838,8 +836,17 @@ const SearchIcon = ({ className }) => ( ); const DeleteIcon = ({ style, fill }) => ( - - + + + +); + +const CreateLoiIcon = ({ style, fill = "#F47738" }) => ( + + ); @@ -1056,13 +1063,22 @@ const ValidityTimeIcon = ({ className, styles }) => ( ); const AddIcon = ({ styles, className, fill = "white" }) => ( + + + +); + +const SubtractIcon = ({ styles, className, fill = "white" }) => ( - + ); -const AddNewIcon = () => ( - +const AddNewIcon = ({ style }) => ( + ( ); +const ArrowCollapseUp = () => ( + + + +); + +const ArrowCollapseDown = () => ( + + + +); + +const AddFilled = ({ style = {} }) => ( + + + +); + +const NoResultsFoundIcon = () => ( + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +); + +const WorksMgmtIcon = ({ fill = "white" }) => ( + + + + +); + +const BioMetricIcon = ({ fill = "#F47738" }) => ( + + + +); + +const AddFileFilled = ({ className = "", fill = "", style = {} }) => ( + + + +); + +const LocateIcon = ({ className = "" }) => ( + + + +); + +const ProjectIcon = ({ className = "", fill = "none", style = {} }) => ( + + + +); +const EstimateIcon = ({ className = "", fill = "none", style = {} }) => ( + + + + + +); +const OrganisationIcon = ({ className = "", fill = "none", style = {} }) => ( + + + +); +const WageseekerIcon = ({ className = "", fill = "none", style = {} }) => ( + + + +); +const ContractIcon = ({ className = "", fill = "none", style = {} }) => ( + + + + + + + + + + + + +); +const DashboardIcon = ({ className = "", fill = "none", style = {} }) => ( + + + +); +const HelperIcon = ({ className = "", fill = "none", style = {} }) => ( + + + + + + + + + + +); +const AttendanceIcon = ({ className = "", fill = "none", style = {} }) => ( + + + + + + + + + +); +const HRIcon = ({ className = "", fill = "none", style = {} }) => ( + + + +); +const MuktaHomeIcon = ({ className = "", fill = "none", style = {} }) => ( + + + +); +const DoubleTickIcon = ({ className = "", fill = "none", style = {} }) => ( + + + +) +const InfoIcon = ({ className = "", fill = "none", style = {} }) => ( + + + +) +const PaymentIcon = ({ className = "", fill = "none", style = {} }) => ( + + + + + + + + + + +); + +const HistoryIcon =({ className = "", fill = "none", style = {} })=>( + + + + + + + + +) + +const WarningIcon =({ className = "", fill = "none", style = {} })=>( + + + + + + + + + +) +const ExpenditureIcon = BillsIcon; + export { AnnouncementIcon, ReceiptIcon, + CreateEstimateIcon, + GotoInboxIcon, ArrowLeft, ArrowDown, CameraSvg, @@ -1173,6 +1824,7 @@ export { EditIcon, SearchIcon, DeleteIcon, + CreateLoiIcon, PMBIcon, GenericFileIcon, ArrowLeftWhite, @@ -1202,6 +1854,7 @@ export { RupeeSymbol, ValidityTimeIcon, AddIcon, + SubtractIcon, AddNewIcon, ViewReportIcon, InboxIcon, @@ -1209,5 +1862,29 @@ export { FirenocIcon, BirthIcon, DeathIcon, + ArrowCollapseUp, + ArrowCollapseDown, + AddFilled, + AddFileFilled, + LocateIcon, + /* Works Management */ + NoResultsFoundIcon, + WorksMgmtIcon, + BioMetricIcon, + MuktaHomeIcon, + HRIcon, + ProjectIcon, + EstimateIcon, + ContractIcon, + AttendanceIcon, + WageseekerIcon, + OrganisationIcon, + HelperIcon, + DashboardIcon, + ExpenditureIcon, + DoubleTickIcon, InfoIcon, + PaymentIcon, + HistoryIcon, + WarningIcon }; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/react-components/src/hoc/FormComposer.js b/frontend/micro-ui/web/micro-ui-internals/packages/react-components/src/hoc/FormComposer.js index 96b6fbd7d..c0ee3d476 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/react-components/src/hoc/FormComposer.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/react-components/src/hoc/FormComposer.js @@ -1,4 +1,4 @@ -import React, { useEffect, useMemo, useState, Fragment } from "react"; +import React, { useEffect, useMemo, useState, Fragment, useCallback } from "react"; import { useForm, Controller } from "react-hook-form"; import BreakLine from "../atoms/BreakLine"; import Card from "../atoms/Card"; @@ -19,6 +19,43 @@ import LinkButton from "../atoms/LinkButton"; import { useTranslation } from "react-i18next"; import MobileNumber from "../atoms/MobileNumber"; import _ from "lodash"; +import CustomDropdown from "../molecules/CustomDropdown"; +import MultiUploadWrapper from "../molecules/MultiUploadWrapper"; +import HorizontalNav from "../atoms/HorizontalNav" + +const wrapperStyles = { + // "display":"flex", + // "flexDirection":"column", + // "justifyContent":"center", + // "padding":"2rem", + // "margin":"1rem", + // "width":"80%", + // "backgroundColor":"#FAFAFA", + // "border": "1px solid #D6D5D4" + display: "flex", + flexDirection: "column", + alignItems: "flex-start", + border: "solid", + borderRadius: "5px", + padding: "10px", + paddingTop: "20px", + marginTop: "10px", + borderColor: "#f3f3f3", + background: "#FAFAFA", + marginBottom: "20px", +}; + +/** + * formcomposer used to render forms + * + * @author jagankumar-egov + * + * @example + * + * refer this implementation of sample file + * frontend/micro-ui/web/micro-ui-internals/packages/modules/AttendenceMgmt/src/pages/citizen/Sample.js + * + */ export const FormComposer = (props) => { const { @@ -36,14 +73,17 @@ export const FormComposer = (props) => { clearErrors, unregister, } = useForm({ - defaultValues: props.defaultValues, + defaultValues: props?.defaultValues, }); const { t } = useTranslation(); const formData = watch(); useEffect(() => { - const iseyeIconClicked = sessionStorage.getItem("eyeIconClicked"); - if (props?.appData && !(props?.appData?.ConnectionHolderDetails?.[0]?.sameAsOwnerDetails) && iseyeIconClicked && Object.keys(props?.appData)?.length > 0 && (!(_.isEqual(props?.appData?.ConnectionHolderDetails?.[0],formData?.ConnectionHolderDetails?.[0] ))) ) { + if ( + props?.appData && + Object.keys(props?.appData)?.length > 0 && + (!_.isEqual(props?.appData, formData) || !_.isEqual(props?.appData?.ConnectionHolderDetails?.[0], formData?.ConnectionHolderDetails?.[0])) + ) { reset({ ...props?.appData }); } }, [props?.appData, formData, props?.appData?.ConnectionHolderDetails]); @@ -61,46 +101,93 @@ export const FormComposer = (props) => { } useEffect(() => { - props.onFormValueChange && props.onFormValueChange(setValue, formData, formState); + props.onFormValueChange && props.onFormValueChange(setValue, formData, formState, reset); }, [formData]); - const fieldSelector = (type, populators, isMandatory, disable = false, component, config) => { + const fieldSelector = (type, populators, isMandatory, disable = false, component, config, sectionFormCategory) => { + let disableFormValidation = false; + // disable form validation if section category does not matches with the current category + // this will avoid validation for the other categories other than the current category. + // sectionFormCategory comes as part of section config and currentFormCategory is a state managed by the FormComposer consumer. + if (sectionFormCategory && props?.currentFormCategory) { + disableFormValidation = sectionFormCategory !== props?.currentFormCategory ? true : false; + } const Component = typeof component === "string" ? Digit.ComponentRegistryService.getComponent(component) : component; - switch (type) { - case "text": case "date": + case "text": case "number": case "password": case "time": - // if (populators.defaultValue) setTimeout(setValue(populators?.name, populators.defaultValue)); + // if (populators.defaultValue) setTimeout(setValue(populators?.name, populators.defaultValue)); return (
{populators?.componentInFront ? ( {populators.componentInFront} ) : null} - ( + + )} + name={populators.name} + rules={!disableFormValidation ? { required: isMandatory, ...populators.validation } : {}} + control={control} />
); + case "textarea": // if (populators.defaultValue) setTimeout(setValue(populators?.name, populators.defaultValue)); return ( -