From 8c7b52b8819fdbfed0411049ad9cfd89148ec8d4 Mon Sep 17 00:00:00 2001 From: Jagankumar <53823168+jagankumar-egov@users.noreply.github.com> Date: Thu, 1 Feb 2024 16:40:43 +0530 Subject: [PATCH 01/83] FIxed build issue by Updating dependency version in package.json --- micro-ui/web/core/package.json | 7 +++++++ micro-ui/web/package.json | 7 +++++++ micro-ui/web/workbench/package.json | 7 +++++++ 3 files changed, 21 insertions(+) diff --git a/micro-ui/web/core/package.json b/micro-ui/web/core/package.json index 4923cc2afe0..554071f4f79 100644 --- a/micro-ui/web/core/package.json +++ b/micro-ui/web/core/package.json @@ -51,6 +51,13 @@ "npm-run-all": "4.1.5", "prettier": "2.1.2" }, + "resolutions": { + "**/babel-loader": "8.2.2", + "**/@babel/core": "7.14.0", + "**/@babel/preset-env": "7.14.0", + "**/@babel/plugin-transform-modules-commonjs": "7.14.0", + "**/polished":"4.2.2" + }, "scripts": { "start": "react-scripts start", "build": "GENERATE_SOURCEMAP=false SKIP_PREFLIGHT_CHECK=true react-scripts build", diff --git a/micro-ui/web/package.json b/micro-ui/web/package.json index 9788619c404..dfb709accbb 100644 --- a/micro-ui/web/package.json +++ b/micro-ui/web/package.json @@ -55,6 +55,13 @@ "npm-run-all": "4.1.5", "prettier": "2.1.2" }, + "resolutions": { + "**/babel-loader": "8.2.2", + "**/@babel/core": "7.14.0", + "**/@babel/preset-env": "7.14.0", + "**/@babel/plugin-transform-modules-commonjs": "7.14.0", + "**/polished":"4.2.2" + }, "scripts": { "start": "react-scripts start", "build": "GENERATE_SOURCEMAP=false SKIP_PREFLIGHT_CHECK=true react-scripts build", diff --git a/micro-ui/web/workbench/package.json b/micro-ui/web/workbench/package.json index 098a6aac640..2a01e85bd81 100644 --- a/micro-ui/web/workbench/package.json +++ b/micro-ui/web/workbench/package.json @@ -45,6 +45,13 @@ "npm-run-all": "4.1.5", "prettier": "2.1.2" }, + "resolutions": { + "**/babel-loader": "8.2.2", + "**/@babel/core": "7.14.0", + "**/@babel/preset-env": "7.14.0", + "**/@babel/plugin-transform-modules-commonjs": "7.14.0", + "**/polished":"4.2.2" + }, "scripts": { "start": "react-scripts start", "build": "GENERATE_SOURCEMAP=false SKIP_PREFLIGHT_CHECK=true react-scripts build", From a990445f944450c48e7251bd125fddaa45c6dc9a Mon Sep 17 00:00:00 2001 From: Jagankumar <53823168+jagankumar-egov@users.noreply.github.com> Date: Mon, 5 Feb 2024 14:56:48 +0530 Subject: [PATCH 02/83] Added the Build configs for the Microfrontend Apps --- build/build-config.yml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/build/build-config.yml b/build/build-config.yml index e243dfec3cc..a6ae87042db 100644 --- a/build/build-config.yml +++ b/build/build-config.yml @@ -53,3 +53,31 @@ config: build: - work-dir: utilities/egov-bff image-name: egov-bff + + + #micro frontends + - name: builds/Digit-Frontend/modules/core-digit-ui + build: + - work-dir: micro-ui/ + dockerfile: micro-ui/web/docker/Dockerfile + image-name: core-digit-ui + + - name: builds/Digit-Frontend/modules/dss-ui + build: + - work-dir: micro-ui/ + dockerfile: micro-ui/web/docker/Dockerfile + image-name: dss-ui + + + - name: builds/Digit-Frontend/modules/workbench-ui + build: + - work-dir: micro-ui/ + dockerfile: micro-ui/web/docker/Dockerfile + image-name: workbench-ui + + + - name: builds/Digit-Frontend/modules/hrms-ui + build: + - work-dir: micro-ui/ + dockerfile: micro-ui/web/docker/Dockerfile + image-name: hrms-ui From dbaf47d0fdabeddee9fd189d64646fa1cb64de87 Mon Sep 17 00:00:00 2001 From: Jagankumar <53823168+jagankumar-egov@users.noreply.github.com> Date: Tue, 12 Mar 2024 09:51:08 +0530 Subject: [PATCH 03/83] Update build-config.yml --- build/build-config.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/build/build-config.yml b/build/build-config.yml index a6ae87042db..7fcfd624e35 100644 --- a/build/build-config.yml +++ b/build/build-config.yml @@ -24,6 +24,12 @@ config: - work-dir: micro-ui/ dockerfile: micro-ui/web/workbench/Dockerfile image-name: workbench-ui + + - name: builds/Digit-Frontend/microplan-ui + build: + - work-dir: micro-ui/ + dockerfile: micro-ui/web/microplan/Dockerfile + image-name: microplan-ui - name: builds/Digit-Frontend/storybook-svg build: From 2873b1f2fe6adca134749ffcc141bee2c6e62cf2 Mon Sep 17 00:00:00 2001 From: Jagankumar <53823168+jagankumar-egov@users.noreply.github.com> Date: Thu, 2 May 2024 14:23:50 +0530 Subject: [PATCH 04/83] Added PGR code from OSS (Urban) (#431) * enabled hrms,pgr with workbench * Added the pgr module code * added module enable codes * core 1.8.1 sidebar null check fixes * updated pgr versions --- micro-ui/package.json | 2 +- micro-ui/web/core/App.js | 5 +- micro-ui/web/core/inter-package.json | 2 + micro-ui/web/core/package.json | 3 +- .../micro-ui-internals/example/package.json | 3 +- .../micro-ui-internals/example/src/index.js | 8 +- micro-ui/web/micro-ui-internals/package.json | 2 + .../packages/modules/core/README.md | 1 + .../packages/modules/core/package.json | 2 +- .../TopBarSideBar/SideBar/EmployeeSideBar.js | 25 +- .../TopBarSideBar/SideBar/SideBar.js | 265 +++++++-- .../packages/modules/pgr/README.md | 77 +++ .../packages/modules/pgr/package.json | 33 ++ .../packages/modules/pgr/src/EmployeeApp.js | 13 + .../packages/modules/pgr/src/Icons.js | 8 + .../packages/modules/pgr/src/Module.js | 85 +++ .../modules/pgr/src/components/Complaint.js | 41 ++ .../pgr/src/components/DesktopInbox.js | 143 +++++ .../pgr/src/components/FormComposer.js | 86 +++ .../modules/pgr/src/components/MobileInbox.js | 64 +++ .../modules/pgr/src/components/PGRCard.js | 58 ++ .../modules/pgr/src/components/TimeLine.js | 162 ++++++ .../pgr/src/components/inbox/ComplaintCard.js | 75 +++ .../src/components/inbox/ComplaintLinks.js | 68 +++ .../src/components/inbox/ComplaintTable.js | 19 + .../pgr/src/components/inbox/Filter.js | 227 ++++++++ .../pgr/src/components/inbox/Status.js | 27 + .../pgr/src/components/inbox/search.js | 110 ++++ .../timelineInstances/PendingForAssignment.js | 8 + .../PendingForReassignment.js | 5 + .../components/timelineInstances/StarRated.js | 6 + .../timelineInstances/pendingAtLme.js | 15 + .../components/timelineInstances/rejected.js | 55 ++ .../components/timelineInstances/reopen.js | 14 + .../components/timelineInstances/resolved.js | 55 ++ .../modules/pgr/src/constants/Citizen.js | 3 + .../modules/pgr/src/constants/Employee.js | 2 + .../modules/pgr/src/constants/Localization.js | 20 + .../modules/pgr/src/constants/Routes.js | 37 ++ .../pgr/src/pages/citizen/ComplaintDetails.js | 186 +++++++ .../pgr/src/pages/citizen/ComplaintsList.js | 68 +++ .../pgr/src/pages/citizen/Create/Response.js | 51 ++ .../pages/citizen/Create/Steps/Response.js | 39 ++ .../citizen/Create/Steps/SelectAddress.js | 74 +++ .../Create/Steps/SelectComplaintType.js | 37 ++ .../citizen/Create/Steps/SelectDetails.js | 18 + .../citizen/Create/Steps/SelectGeolocation.js | 19 + .../citizen/Create/Steps/SelectImages.js | 36 ++ .../citizen/Create/Steps/SelectLandmark.js | 19 + .../citizen/Create/Steps/SelectPincode.js | 56 ++ .../citizen/Create/Steps/SelectSubType.js | 34 ++ .../pgr/src/pages/citizen/Create/config.js | 98 ++++ .../src/pages/citizen/Create/defaultConfig.js | 114 ++++ .../pgr/src/pages/citizen/Create/index.js | 129 +++++ .../pgr/src/pages/citizen/Rating/Rating.js | 76 +++ .../src/pages/citizen/Rating/SelectRating.js | 62 +++ .../ReopenComplaint/AddtionalDetails.js | 97 ++++ .../pages/citizen/ReopenComplaint/Reason.js | 57 ++ .../citizen/ReopenComplaint/UploadPhoto.js | 71 +++ .../pages/citizen/ReopenComplaint/index.js | 28 + .../modules/pgr/src/pages/citizen/Response.js | 59 ++ .../modules/pgr/src/pages/citizen/index.js | 48 ++ .../src/pages/employee/ComplaintDetails.js | 504 ++++++++++++++++++ .../pages/employee/CreateComplaint/index.js | 261 +++++++++ .../modules/pgr/src/pages/employee/Inbox.js | 82 +++ .../pgr/src/pages/employee/Response.js | 48 ++ .../modules/pgr/src/pages/employee/index.js | 89 ++++ .../pgr/src/redux/actions/complaint.js | 41 ++ .../modules/pgr/src/redux/actions/index.js | 52 ++ .../modules/pgr/src/redux/actions/types.js | 16 + .../src/redux/reducers/complaintReducer.js | 18 + .../modules/pgr/src/redux/reducers/index.js | 9 + .../packages/modules/pgr/src/redux/store.js | 14 + .../modules/pgr/src/selectors/complaint.js | 3 + .../pgr/src/selectors/processInstance.js | 1 + micro-ui/web/micro-ui-internals/publish.sh | 5 +- micro-ui/web/package.json | 5 +- micro-ui/web/src/App.js | 9 +- micro-ui/web/workbench/App.js | 15 +- micro-ui/web/workbench/package.json | 5 +- micro-ui/web/workbench/webpack.config.js | 4 + 81 files changed, 4410 insertions(+), 81 deletions(-) create mode 100644 micro-ui/web/micro-ui-internals/packages/modules/pgr/README.md create mode 100644 micro-ui/web/micro-ui-internals/packages/modules/pgr/package.json create mode 100644 micro-ui/web/micro-ui-internals/packages/modules/pgr/src/EmployeeApp.js create mode 100644 micro-ui/web/micro-ui-internals/packages/modules/pgr/src/Icons.js create mode 100644 micro-ui/web/micro-ui-internals/packages/modules/pgr/src/Module.js create mode 100644 micro-ui/web/micro-ui-internals/packages/modules/pgr/src/components/Complaint.js create mode 100644 micro-ui/web/micro-ui-internals/packages/modules/pgr/src/components/DesktopInbox.js create mode 100644 micro-ui/web/micro-ui-internals/packages/modules/pgr/src/components/FormComposer.js create mode 100644 micro-ui/web/micro-ui-internals/packages/modules/pgr/src/components/MobileInbox.js create mode 100644 micro-ui/web/micro-ui-internals/packages/modules/pgr/src/components/PGRCard.js create mode 100644 micro-ui/web/micro-ui-internals/packages/modules/pgr/src/components/TimeLine.js create mode 100644 micro-ui/web/micro-ui-internals/packages/modules/pgr/src/components/inbox/ComplaintCard.js create mode 100644 micro-ui/web/micro-ui-internals/packages/modules/pgr/src/components/inbox/ComplaintLinks.js create mode 100644 micro-ui/web/micro-ui-internals/packages/modules/pgr/src/components/inbox/ComplaintTable.js create mode 100644 micro-ui/web/micro-ui-internals/packages/modules/pgr/src/components/inbox/Filter.js create mode 100644 micro-ui/web/micro-ui-internals/packages/modules/pgr/src/components/inbox/Status.js create mode 100644 micro-ui/web/micro-ui-internals/packages/modules/pgr/src/components/inbox/search.js create mode 100644 micro-ui/web/micro-ui-internals/packages/modules/pgr/src/components/timelineInstances/PendingForAssignment.js create mode 100644 micro-ui/web/micro-ui-internals/packages/modules/pgr/src/components/timelineInstances/PendingForReassignment.js create mode 100644 micro-ui/web/micro-ui-internals/packages/modules/pgr/src/components/timelineInstances/StarRated.js create mode 100644 micro-ui/web/micro-ui-internals/packages/modules/pgr/src/components/timelineInstances/pendingAtLme.js create mode 100644 micro-ui/web/micro-ui-internals/packages/modules/pgr/src/components/timelineInstances/rejected.js create mode 100644 micro-ui/web/micro-ui-internals/packages/modules/pgr/src/components/timelineInstances/reopen.js create mode 100644 micro-ui/web/micro-ui-internals/packages/modules/pgr/src/components/timelineInstances/resolved.js create mode 100644 micro-ui/web/micro-ui-internals/packages/modules/pgr/src/constants/Citizen.js create mode 100644 micro-ui/web/micro-ui-internals/packages/modules/pgr/src/constants/Employee.js create mode 100644 micro-ui/web/micro-ui-internals/packages/modules/pgr/src/constants/Localization.js create mode 100644 micro-ui/web/micro-ui-internals/packages/modules/pgr/src/constants/Routes.js create mode 100644 micro-ui/web/micro-ui-internals/packages/modules/pgr/src/pages/citizen/ComplaintDetails.js create mode 100644 micro-ui/web/micro-ui-internals/packages/modules/pgr/src/pages/citizen/ComplaintsList.js create mode 100644 micro-ui/web/micro-ui-internals/packages/modules/pgr/src/pages/citizen/Create/Response.js create mode 100644 micro-ui/web/micro-ui-internals/packages/modules/pgr/src/pages/citizen/Create/Steps/Response.js create mode 100644 micro-ui/web/micro-ui-internals/packages/modules/pgr/src/pages/citizen/Create/Steps/SelectAddress.js create mode 100644 micro-ui/web/micro-ui-internals/packages/modules/pgr/src/pages/citizen/Create/Steps/SelectComplaintType.js create mode 100644 micro-ui/web/micro-ui-internals/packages/modules/pgr/src/pages/citizen/Create/Steps/SelectDetails.js create mode 100644 micro-ui/web/micro-ui-internals/packages/modules/pgr/src/pages/citizen/Create/Steps/SelectGeolocation.js create mode 100644 micro-ui/web/micro-ui-internals/packages/modules/pgr/src/pages/citizen/Create/Steps/SelectImages.js create mode 100644 micro-ui/web/micro-ui-internals/packages/modules/pgr/src/pages/citizen/Create/Steps/SelectLandmark.js create mode 100644 micro-ui/web/micro-ui-internals/packages/modules/pgr/src/pages/citizen/Create/Steps/SelectPincode.js create mode 100644 micro-ui/web/micro-ui-internals/packages/modules/pgr/src/pages/citizen/Create/Steps/SelectSubType.js create mode 100644 micro-ui/web/micro-ui-internals/packages/modules/pgr/src/pages/citizen/Create/config.js create mode 100644 micro-ui/web/micro-ui-internals/packages/modules/pgr/src/pages/citizen/Create/defaultConfig.js create mode 100644 micro-ui/web/micro-ui-internals/packages/modules/pgr/src/pages/citizen/Create/index.js create mode 100644 micro-ui/web/micro-ui-internals/packages/modules/pgr/src/pages/citizen/Rating/Rating.js create mode 100644 micro-ui/web/micro-ui-internals/packages/modules/pgr/src/pages/citizen/Rating/SelectRating.js create mode 100644 micro-ui/web/micro-ui-internals/packages/modules/pgr/src/pages/citizen/ReopenComplaint/AddtionalDetails.js create mode 100644 micro-ui/web/micro-ui-internals/packages/modules/pgr/src/pages/citizen/ReopenComplaint/Reason.js create mode 100644 micro-ui/web/micro-ui-internals/packages/modules/pgr/src/pages/citizen/ReopenComplaint/UploadPhoto.js create mode 100644 micro-ui/web/micro-ui-internals/packages/modules/pgr/src/pages/citizen/ReopenComplaint/index.js create mode 100644 micro-ui/web/micro-ui-internals/packages/modules/pgr/src/pages/citizen/Response.js create mode 100644 micro-ui/web/micro-ui-internals/packages/modules/pgr/src/pages/citizen/index.js create mode 100644 micro-ui/web/micro-ui-internals/packages/modules/pgr/src/pages/employee/ComplaintDetails.js create mode 100644 micro-ui/web/micro-ui-internals/packages/modules/pgr/src/pages/employee/CreateComplaint/index.js create mode 100644 micro-ui/web/micro-ui-internals/packages/modules/pgr/src/pages/employee/Inbox.js create mode 100644 micro-ui/web/micro-ui-internals/packages/modules/pgr/src/pages/employee/Response.js create mode 100644 micro-ui/web/micro-ui-internals/packages/modules/pgr/src/pages/employee/index.js create mode 100644 micro-ui/web/micro-ui-internals/packages/modules/pgr/src/redux/actions/complaint.js create mode 100644 micro-ui/web/micro-ui-internals/packages/modules/pgr/src/redux/actions/index.js create mode 100644 micro-ui/web/micro-ui-internals/packages/modules/pgr/src/redux/actions/types.js create mode 100644 micro-ui/web/micro-ui-internals/packages/modules/pgr/src/redux/reducers/complaintReducer.js create mode 100644 micro-ui/web/micro-ui-internals/packages/modules/pgr/src/redux/reducers/index.js create mode 100644 micro-ui/web/micro-ui-internals/packages/modules/pgr/src/redux/store.js create mode 100644 micro-ui/web/micro-ui-internals/packages/modules/pgr/src/selectors/complaint.js create mode 100644 micro-ui/web/micro-ui-internals/packages/modules/pgr/src/selectors/processInstance.js diff --git a/micro-ui/package.json b/micro-ui/package.json index 19a3c47d6ee..b87ac65e859 100644 --- a/micro-ui/package.json +++ b/micro-ui/package.json @@ -1,4 +1,4 @@ { "name": "workbench-ui", - "version": "1.0.0" + "version": "1.8.0" } \ No newline at end of file diff --git a/micro-ui/web/core/App.js b/micro-ui/web/core/App.js index df812819252..5f6261e53b5 100644 --- a/micro-ui/web/core/App.js +++ b/micro-ui/web/core/App.js @@ -4,6 +4,8 @@ import { DigitUI } from "@egovernments/digit-ui-module-core"; import { UICustomizations } from "./Customisations/UICustomizations"; import { initWorkbenchComponents } from "@egovernments/digit-ui-module-workbench"; import { initUtilitiesComponents } from "@egovernments/digit-ui-module-utilities"; +import { initPGRComponents,PGRReducers } from "@egovernments/digit-ui-module-pgr"; + window.contextPath = window?.globalConfigs?.getConfig("CONTEXT_PATH"); const enabledModules = [ @@ -15,7 +17,7 @@ const enabledModules = [ ]; const moduleReducers = (initData) => ({ - initData, + initData, pgr: PGRReducers(initData), }); const initDigitUI = () => { @@ -26,6 +28,7 @@ const initDigitUI = () => { }; initUtilitiesComponents(); initWorkbenchComponents(); + initPGRComponents(); }; initLibraries().then(() => { diff --git a/micro-ui/web/core/inter-package.json b/micro-ui/web/core/inter-package.json index db4893077d1..db6e884f6ce 100644 --- a/micro-ui/web/core/inter-package.json +++ b/micro-ui/web/core/inter-package.json @@ -25,6 +25,7 @@ "dev:example": "cd example && yarn start", "dev:core": "cd packages/modules/core && yarn start", "dev:dss": "cd packages/modules/dss && yarn start", + "dev:pgr": "cd packages/modules/pgr && yarn start", "dev:hrms": "cd packages/modules/hrms && yarn start", "devD:common": "cd packages/modules/common && yarn start", "devD:utilities": "cd packages/modules/utilities && yarn start", @@ -36,6 +37,7 @@ "build:svgcomponents": "cd packages/svg-components && yarn build", "buildD:dss": "cd packages/modules/dss && yarn build", "buildD:core": "cd packages/modules/core && yarn build", + "buildD:pgr": "cd packages/modules/pgr && yarn build", "buildD:hrms": "cd packages/modules/hrms && yarn build", "buildD:common": "cd packages/modules/common && yarn build", "buildD:utilities": "cd packages/modules/utilities && yarn build", diff --git a/micro-ui/web/core/package.json b/micro-ui/web/core/package.json index 554071f4f79..264a386922e 100644 --- a/micro-ui/web/core/package.json +++ b/micro-ui/web/core/package.json @@ -16,7 +16,8 @@ "dependencies": { "@egovernments/digit-ui-libraries": "1.8.0", "@egovernments/digit-ui-module-workbench": "1.0.1", - "@egovernments/digit-ui-module-core": "1.8.0", + "@egovernments/digit-ui-module-core": "1.8.1", + "@egovernments/digit-ui-module-pgr": "1.8.0", "@egovernments/digit-ui-react-components": "1.8.0", "@egovernments/digit-ui-module-utilities": "1.0.0", "babel-loader": "8.1.0", diff --git a/micro-ui/web/micro-ui-internals/example/package.json b/micro-ui/web/micro-ui-internals/example/package.json index bb5f657d59c..236dc6960a4 100644 --- a/micro-ui/web/micro-ui-internals/example/package.json +++ b/micro-ui/web/micro-ui-internals/example/package.json @@ -12,8 +12,9 @@ "@egovernments/digit-ui-libraries": "1.8.0", "@egovernments/digit-ui-module-workbench": "1.0.1", "@egovernments/digit-ui-module-dss": "1.8.0", - "@egovernments/digit-ui-module-core": "1.8.0", + "@egovernments/digit-ui-module-core": "1.8.1", "@egovernments/digit-ui-module-common": "1.8.0", + "@egovernments/digit-ui-module-pgr": "1.8.0", "@egovernments/digit-ui-module-hrms": "1.8.0", "@egovernments/digit-ui-module-utilities": "1.0.0", "@egovernments/digit-ui-module-engagement": "1.8.0", diff --git a/micro-ui/web/micro-ui-internals/example/src/index.js b/micro-ui/web/micro-ui-internals/example/src/index.js index e2946604fc0..a815cae05e7 100644 --- a/micro-ui/web/micro-ui-internals/example/src/index.js +++ b/micro-ui/web/micro-ui-internals/example/src/index.js @@ -9,6 +9,7 @@ import { initEngagementComponents } from "@egovernments/digit-ui-module-engageme import { initHRMSComponents } from "@egovernments/digit-ui-module-hrms"; // import { initUtilitiesComponents } from "@egovernments/digit-ui-module-utilities"; import {initWorkbenchComponents} from "@egovernments/digit-ui-module-workbench"; +import { PGRReducers , initPGRComponents} from "@egovernments/digit-ui-module-pgr"; import "@egovernments/digit-ui-css/example/index.css"; @@ -19,6 +20,7 @@ var Digit = window.Digit || {}; const enabledModules = [ "DSS", "HRMS", "Workbench" +,"PGR" // "Engagement", "NDSS","QuickPayLinks", "Payment", // "Utilities", //added to check fsm @@ -68,10 +70,12 @@ const initDigitUI = () => { initEngagementComponents(); // initUtilitiesComponents(); initWorkbenchComponents(); + initPGRComponents(); - const moduleReducers = (initData) => initData; - + const moduleReducers = (initData) => ({ + pgr: PGRReducers(initData), + }); const stateCode = window?.globalConfigs?.getConfig("STATE_LEVEL_TENANT_ID") || "pb"; initTokens(stateCode); diff --git a/micro-ui/web/micro-ui-internals/package.json b/micro-ui/web/micro-ui-internals/package.json index e6d9e47afb2..19a69c78172 100644 --- a/micro-ui/web/micro-ui-internals/package.json +++ b/micro-ui/web/micro-ui-internals/package.json @@ -26,6 +26,7 @@ "dev:components": "cd packages/react-components && yarn start", "dev:example": "cd example && yarn start", "dev:core": "cd packages/modules/core && yarn start", + "dev:pgr": "cd packages/modules/pgr && yarn start", "dev:dss": "cd packages/modules/dss && yarn start", "dev:hrms": "cd packages/modules/hrms && yarn start", "devD:common": "cd packages/modules/common && yarn start", @@ -39,6 +40,7 @@ "build:dss": "cd packages/modules/dss && yarn build", "build:core": "cd packages/modules/core && yarn build", "build:hrms": "cd packages/modules/hrms && yarn build", + "build:pgr": "cd packages/modules/pgr && yarn build", "build:common": "cd packages/modules/common && yarn build", "build:utilities": "cd packages/modules/utilities && yarn build", "build:engagement": "cd packages/modules/engagement && yarn build", diff --git a/micro-ui/web/micro-ui-internals/packages/modules/core/README.md b/micro-ui/web/micro-ui-internals/packages/modules/core/README.md index e8ad329acf0..0b5a1d4d023 100644 --- a/micro-ui/web/micro-ui-internals/packages/modules/core/README.md +++ b/micro-ui/web/micro-ui-internals/packages/modules/core/README.md @@ -65,6 +65,7 @@ with ### Changelog ```bash +1.8.1 sidebar null check fixes 1.8.0 workbench v1.0 1.8.0-beta.5 fix for login screen alignments 1.8.0-beta.4 made the default localisation in globalconfig diff --git a/micro-ui/web/micro-ui-internals/packages/modules/core/package.json b/micro-ui/web/micro-ui-internals/packages/modules/core/package.json index 3720d255b0f..7d9a8ef9b01 100644 --- a/micro-ui/web/micro-ui-internals/packages/modules/core/package.json +++ b/micro-ui/web/micro-ui-internals/packages/modules/core/package.json @@ -1,6 +1,6 @@ { "name": "@egovernments/digit-ui-module-core", - "version": "1.8.0", + "version": "1.8.1", "license": "MIT", "main": "dist/index.js", "module": "dist/index.modern.js", diff --git a/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/TopBarSideBar/SideBar/EmployeeSideBar.js b/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/TopBarSideBar/SideBar/EmployeeSideBar.js index 3314ef65184..1386aa5c5ce 100644 --- a/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/TopBarSideBar/SideBar/EmployeeSideBar.js +++ b/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/TopBarSideBar/SideBar/EmployeeSideBar.js @@ -40,12 +40,7 @@ const EmployeeSideBar = () => { } mergeObjects(obj1[key], obj2[key]); } else { - if (obj1[key]) { - if (!Array.isArray(obj1[key])) { - obj1[key] = [obj1[key]]; - } - obj1[key].push(obj2[key]); - } else { + if (!obj1[key]) { obj1[key] = obj2[key]; } } @@ -96,14 +91,18 @@ const EmployeeSideBar = () => { const objectArray = Object.entries(configEmployeeSideBar); // Sort the array based on the 'orderNumber' or the length of the object if 'orderNumber' is not present + // sort logic updated to sort the parent item by alphabetical objectArray.sort((a, b) => { - const orderNumberA = a[1].item - ? a[1].item.orderNumber || Object.keys(configEmployeeSideBar).length + 1 - : Object.keys(configEmployeeSideBar).length + 1; - const orderNumberB = b[1].item - ? b[1].item.orderNumber || Object.keys(configEmployeeSideBar).length + 1 - : Object.keys(configEmployeeSideBar).length + 1; - return orderNumberA - orderNumberB; + if (a[0] < b[0]) { return -1; } + if (a[0] > b[0]) { return 1; } + return 0; + // const orderNumberA = a[1].item + // ? a[1].item.orderNumber || Object.keys(configEmployeeSideBar).length + 1 + // : Object.keys(configEmployeeSideBar).length + 1; + // const orderNumberB = b[1].item + // ? b[1].item.orderNumber || Object.keys(configEmployeeSideBar).length + 1 + // : Object.keys(configEmployeeSideBar).length + 1; + // return orderNumberA - orderNumberB; }); const sortedObject = Object.fromEntries(objectArray); configEmployeeSideBar = sortedObject; diff --git a/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/TopBarSideBar/SideBar/SideBar.js b/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/TopBarSideBar/SideBar/SideBar.js index 9a38a79a4a8..e17e61c81fd 100644 --- a/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/TopBarSideBar/SideBar/SideBar.js +++ b/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/TopBarSideBar/SideBar/SideBar.js @@ -6,29 +6,78 @@ import { HomeIcon, ComplaintIcon, BPAHomeIcon, + CollectionIcon, + FinanceChartIcon, + CollectionsBookmarIcons, + DropIcon, + DocumentIconSolid, + PersonIcon, PropertyHouse, - CaseIcon, ReceiptIcon, - PersonIcon, - DocumentIconSolid, - DropIcon, - CollectionsBookmarIcons, - FinanceChartIcon, - CollectionIcon, + CaseIcon, } from "@egovernments/digit-ui-react-components"; import ReactTooltip from "react-tooltip"; import { set } from "lodash"; import { useHistory, useLocation, Link } from "react-router-dom"; import { useTranslation } from "react-i18next"; -const DIGIT_UI_CONTEXTS = ["digit-ui", "works-ui", "workbench-ui", "health-ui", "sanitation-ui", "core-ui","mgramseva-web"]; +const DIGIT_UI_CONTEXTS = [ + "digit-ui", + "works-ui", + "workbench-ui", + "health-ui", + "sanitation-ui", + "core-ui", + "microplan-ui", + "pucar-ui", + "selco-ui", + "mgramseva-web", +]; + +// Function to recursively get the key of a nested object based on a parent key +const getKey = (obj, parent) => { + if (typeof obj !== "object" || obj === null) { + // If obj is not an object or is null, return null + return null; + } + // Use Object.keys to get an array of keys in the object + const key = Object.keys(obj).map((key) => { + // Check if the object has an 'item' property with a 'path' property + if (typeof obj[key]?.item?.path === "string") { + return ( + obj[key]?.item?.path?.split(parent ? `${parent}.${key}` : `.${key}`) || + getKey(obj[key], key) + ); + } + return null; // or return some default value if neither condition is met + }); + // Return the first element of the array (the key) + return key?.[0]; +}; + +// Function to find the last key in a dot-separated key string +const findKey = (key = "") => { + // Split the key string into an array using dot as a separator + const newSplitedList = key?.split("."); + // Check if the key string ends with a dot + return key?.endsWith?.(".") + ? // If it ends with a dot, return the first element of the array + newSplitedList[0] + : // If not, return the last element of the array + newSplitedList[newSplitedList?.length - 1]; +}; + /* Used to navigate to other mission's ui if user has access */ const navigateToRespectiveURL = (history = {}, url = "") => { if (url?.indexOf(`/${window?.contextPath}`) === -1) { const hostUrl = window.location.origin; - const updatedURL = DIGIT_UI_CONTEXTS?.every((e) => url?.indexOf(`/${e}`) === -1) ? hostUrl + "/employee/" + url : hostUrl + url; + const updatedURL = DIGIT_UI_CONTEXTS?.every( + (e) => url?.indexOf(`/${e}`) === -1 + ) + ? hostUrl + "/employee/" + url + : hostUrl + url; window.location.href = updatedURL; } else { history.push(url); @@ -85,8 +134,8 @@ const Sidebar = ({ data }) => { if (key === "item" && item?.leftIcon !== "") { return { - isDynamic: item.leftIcon.split(":")[0], - leftIconArray: item.leftIcon.split(":")[1], + iconKey: item?.leftIcon?.split(":")?.[0], + iconName: item?.leftIcon?.split(":")?.[1], }; } @@ -100,54 +149,105 @@ const Sidebar = ({ data }) => { return null; // Return null if no non-empty leftIcon is found } - const renderSidebarItems = (items, parentKey = null, flag = true, level = 0) => { + const renderSidebarItems = ( + items, + parentKey = null, + flag = true, + level = 0 + ) => { + /* added the logic to sort the side bar items based on the ordernumber */ + const keysArray = Object.values(items) + .sort((x, y) => { + if (x?.item && y?.item) { + return x?.item?.orderNumber - y?.item?.orderNumber; + } else { + if (x?.[0] < y?.[0]) { + return -1; + } + if (x?.[0] > y?.[0]) { + return 1; + } + return 0; + } + }) + .map( + (x) => + (x?.item?.path && findKey(x?.item?.path)) || findKey(getKey(x)?.[0]) + ); + return (
- {Object.keys(items).map((key, index) => { + {keysArray.map((key, index) => { const subItems = items[key]; - const subItemKeys = Object.keys(subItems)[0] === "item"; + const subItemKeys = subItems + ? Object.keys(subItems)[0] === "item" + : null; const isSubItemOpen = openItems[key] || false; var itemKey = parentKey ? `${parentKey}` : key; const getModuleName = key?.replace(/[ -]/g, "_"); - const appendTranslate = t(Digit.Utils.locale.getTransformedLocale(`ACTION_TEST_${getModuleName}`)); - const trimModuleName = t(appendTranslate?.length > 20 ? appendTranslate.substring(0, 20) + "..." : appendTranslate); + const appendTranslate = t( + Digit.Utils.locale.getTransformedLocale( + `ACTION_TEST_${getModuleName}` + ) + ); + const trimModuleName = t( + appendTranslate?.length > 20 + ? appendTranslate.substring(0, 20) + "..." + : appendTranslate + ); if (!subItemKeys && subItems && Object.keys(subItems).length > 0) { // If the item has sub-items, render a dropdown with toggle button - const { leftIconArray, isDynamic } = extractLeftIcon(subItems) || {}; - let leftIcon = IconsObject[leftIconArray] || IconsObject.collections; - if (isDynamic === "dynamic") { - var IconComp = require("@egovernments/digit-ui-react-components")?.[leftIconArray]; + const { iconKey,iconName } = extractLeftIcon(subItems) || {}; + let leftIcon = + IconsObject[iconName] || IconsObject.collections; + if (iconKey === "dynamic") { + var IconComp = require("@egovernments/digit-ui-react-components")?.[ + iconName + ]; leftIcon = IconComp ? : leftIcon; } + if (iconKey === "svg") { + var IconComp = require("@egovernments/digit-ui-react-components")?.SVG?.[iconName]; + leftIcon = IconComp ? : leftIcon; + } const isParentActive = selectedParent === itemKey; const isChildActive = selectedChildLevelOne === trimModuleName; //we need to have a heirarchy such as parent -> child1 -> child2 to differentiate b/w different levels in the sidebar return (
{ toggleSidebar(key); - setSelectedParent((prevItem)=> { - if(prevItem===itemKey ){ - return null - } - else return itemKey - + setSelectedParent((prevItem) => { + if (prevItem === itemKey) { + return null; + } else return itemKey; }); - const itemToHighlight = e.target.innerText - setSelectedChildLevelOne((prevItem)=>{ - if(prevItem===itemToHighlight || isSubItemOpen){ - return null - } - else return itemToHighlight + const itemToHighlight = e.target.innerText; + setSelectedChildLevelOne((prevItem) => { + if (prevItem === itemToHighlight || isSubItemOpen) { + return null; + } else return itemToHighlight; }); setSelectedChild(null); // setOpenItems(prevState => { @@ -158,57 +258,112 @@ const Sidebar = ({ data }) => { // } // }) }} - style={{ display: "flex", flexDirection: "row", width: "100%" }} + style={{ + display: "flex", + flexDirection: "row", + width: "100%", + }} > {flag &&
{leftIcon}
}
{trimModuleName} {trimModuleName?.includes("...") && ( - - {t(Digit.Utils.locale.getTransformedLocale(`ACTION_TEST_${key}`))} + + {t( + Digit.Utils.locale.getTransformedLocale( + `ACTION_TEST_${key}` + ) + )} )}
-
- {isSubItemOpen ? : } +
+ {isSubItemOpen ? ( + + ) : ( + + )}
- {subNav &&
{isSubItemOpen && renderSidebarItems(subItems, itemKey, false, level + 1)}
} + {subNav && ( +
+ {isSubItemOpen && + renderSidebarItems(subItems, itemKey, false, level + 1)} +
+ )}
); } else if (subItemKeys) { // If the item is a link, render it - const { leftIconArray, isDynamic } = extractLeftIcon(subItems) || {}; - let leftIcon = IconsObject[leftIconArray] || IconsObject.collections; - if (isDynamic === "dynamic") { - var IconComp = require("@egovernments/digit-ui-react-components")?.[leftIconArray]; + const { iconName, iconKey } = + extractLeftIcon(subItems) || {}; + let leftIcon = + IconsObject[iconName] || IconsObject.collections; + if (iconKey === "dynamic") { + var IconComp = require("@egovernments/digit-ui-react-components")?.[ + iconName + ]; leftIcon = IconComp ? : leftIcon; } + if (iconKey === "svg") { + var IconComp = require("@egovernments/digit-ui-react-components")?.SVG?.[iconName]; + leftIcon = IconComp ? : leftIcon; + } const isChildActive = selectedChild === subItems.item.path; return ( { const keyToHighlight = subItems.item.path; setSelectedParent(parentKey); // Update the selected parent when a child is clicked setSelectedChild(keyToHighlight); - setSelectedChildLevelOne(null) + setSelectedChildLevelOne(null); // setOpenItems({}); // setSelectedChildLevelOne(null) - navigateToRespectiveURL(history, `${subItems?.item?.navigationURL}`); + navigateToRespectiveURL( + history, + `${subItems?.item?.navigationURL}` + ); }} >
{flag &&
{leftIcon}
} {trimModuleName} {trimModuleName?.includes("...") && ( - - {t(Digit.Utils.locale.getTransformedLocale(`ACTION_TEST_${key}`))} + + {t( + Digit.Utils.locale.getTransformedLocale( + `ACTION_TEST_${key}` + ) + )} )}
@@ -221,7 +376,11 @@ const Sidebar = ({ data }) => { }; return ( -
+
{renderSidebarItems(data)}
); diff --git a/micro-ui/web/micro-ui-internals/packages/modules/pgr/README.md b/micro-ui/web/micro-ui-internals/packages/modules/pgr/README.md new file mode 100644 index 00000000000..429486f43b6 --- /dev/null +++ b/micro-ui/web/micro-ui-internals/packages/modules/pgr/README.md @@ -0,0 +1,77 @@ + +# digit-ui-module-pgr + +## Install + +```bash +npm install --save @egovernments/digit-ui-module-pgr +``` + +## Limitation + +```bash +This Package is more specific to DIGIT-UI's can be used across mission's +``` + +## Usage + +After adding the dependency make sure you have this dependency in + +```bash +frontend/micro-ui/web/package.json +``` + +```json +"@egovernments/digit-ui-module-pgr":"1.7.6", +``` + +then navigate to App.js + +```bash + frontend/micro-ui/web/src/App.js +``` + + +```jsx +/** add this import **/ + +import { initPGRComponents } from "@egovernments/digit-ui-module-pgr"; + +/** inside enabledModules add this new module key **/ + +const enabledModules = ["PGR"]; + +/** inside init Function call this function **/ + +const initDigitUI = () => { + initPGRComponents(); +}; +``` + +### Changelog + +```bash +1.8.0 base urban version released +1.7.8 added some null checks to improve stability +1.7.7 used new color constants +1.7.6 fixed routing issue +1.7.5 base urban version +``` + +### Contributors + +[jagankumar-egov] [Tulika-eGov] + +## Documentation + +Documentation Site (https://core.digit.org/guides/developer-guide/ui-developer-guide/digit-ui) + +## Maintainer + +- [jagankumar-egov](https://www.github.com/jagankumar-egov) + + +### Published from DIGIT Frontend +DIGIT Frontend Repo (https://github.com/egovernments/Digit-Frontend/tree/master) + +![Logo](https://s3.ap-south-1.amazonaws.com/works-dev-asset/mseva-white-logo.png) diff --git a/micro-ui/web/micro-ui-internals/packages/modules/pgr/package.json b/micro-ui/web/micro-ui-internals/packages/modules/pgr/package.json new file mode 100644 index 00000000000..e89bc077589 --- /dev/null +++ b/micro-ui/web/micro-ui-internals/packages/modules/pgr/package.json @@ -0,0 +1,33 @@ +{ + "name": "@egovernments/digit-ui-module-pgr", + "version": "1.8.0", + "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.8.0", + "lodash.merge": "^4.6.2", + "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-redux": "7.2.8", + "react-router-dom": "5.3.0", + "redux": "4.1.2", + "redux-thunk": "2.4.1" + } +} diff --git a/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/EmployeeApp.js b/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/EmployeeApp.js new file mode 100644 index 00000000000..3cbbdc4f52a --- /dev/null +++ b/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/EmployeeApp.js @@ -0,0 +1,13 @@ +import React from "react"; +import { AppContainer, EmployeeAppContainer } from "@egovernments/digit-ui-react-components"; + +import Complaint from "./pages/employee/index"; +const App = () => { + return ( + + + + ); +}; + +export default App; diff --git a/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/Icons.js b/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/Icons.js new file mode 100644 index 00000000000..c932e7ad466 --- /dev/null +++ b/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/Icons.js @@ -0,0 +1,8 @@ +import React from "react"; + +export const Close = () => ( + + + + +); diff --git a/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/Module.js b/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/Module.js new file mode 100644 index 00000000000..430b1e75e27 --- /dev/null +++ b/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/Module.js @@ -0,0 +1,85 @@ +import React, { useEffect } from "react"; +import PGRCard from "./components/PGRCard"; + +import getRootReducer from "./redux/reducers"; +import CitizenApp from "./pages/citizen"; + +import EmployeeApp from "./EmployeeApp"; +import { ComplaintIcon, CitizenHomeCard, Loader } from "@egovernments/digit-ui-react-components"; +import { PGR_CITIZEN_CREATE_COMPLAINT } from "./constants/Citizen"; +import { useTranslation } from "react-i18next"; +import { LOCALE } from "./constants/Localization"; +import { ComplaintDetails } from "./pages/employee/ComplaintDetails"; +import { CreateComplaint as CreateComplaintEmp } from "./pages/employee/CreateComplaint"; +import Inbox from "./pages/employee/Inbox"; +import ResponseEmp from "./pages/employee/Response"; + +import { CreateComplaint as CreateComplaintCitizen } from "./pages/citizen/Create"; +import { ComplaintsList } from "./pages/citizen/ComplaintsList"; +import ComplaintDetailsPage from "./pages/citizen/ComplaintDetails"; +import SelectRating from "./pages/citizen/Rating/SelectRating"; +import ResponseCitizen from "./pages/citizen/Response"; + + +export const PGRReducers = getRootReducer; + +const PGRModule = ({ stateCode, userType, tenants }) => { + const moduleCode = "PGR"; + const language = Digit.StoreData.getCurrentLanguage(); + const { isLoading, data: store } = Digit.Services.useStore({ stateCode, moduleCode, language }); + + if (isLoading) { + return ; + } + + Digit.SessionStorage.set("PGR_TENANTS", tenants); + + if (userType === "citizen") { + return ; + } else { + return ; + } +}; + +const PGRLinks = ({ matchPath }) => { + const { t } = useTranslation(); + const [params, setParams, clearParams] = Digit.Hooks.useSessionStorage(PGR_CITIZEN_CREATE_COMPLAINT, {}); + + useEffect(() => { + clearParams(); + }, []); + + const links = [ + { + link: `${matchPath}/create-complaint/complaint-type`, + i18nKey: t("CS_COMMON_FILE_A_COMPLAINT"), + }, + { + link: `${matchPath}/complaints`, + i18nKey: t(LOCALE.MY_COMPLAINTS), + }, + ]; + + return ; +}; + +const componentsToRegister = { + PGRModule, + PGRLinks, + PGRCard, + PGRComplaintDetails : ComplaintDetails, + PGRCreateComplaintEmp : CreateComplaintEmp, + PGRInbox : Inbox, + PGRResponseEmp : ResponseEmp, + PGRCreateComplaintCitizen : CreateComplaintCitizen, + PGRComplaintsList : ComplaintsList, + PGRComplaintDetailsPage : ComplaintDetailsPage, + PGRSelectRating : SelectRating, + PGRResponseCitzen : ResponseCitizen +}; + +export const initPGRComponents = () => { + Object.entries(componentsToRegister).forEach(([key, value]) => { + Digit.ComponentRegistryService.setComponent(key, value); + }); +}; diff --git a/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/components/Complaint.js b/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/components/Complaint.js new file mode 100644 index 00000000000..3583fa17aad --- /dev/null +++ b/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/components/Complaint.js @@ -0,0 +1,41 @@ +import React from "react"; +import { useTranslation } from "react-i18next"; +import { useHistory } from "react-router-dom"; +import { Card, DateWrap, KeyNote } from "@egovernments/digit-ui-react-components"; +import { CardSubHeader } from "@egovernments/digit-ui-react-components"; +import { LOCALIZATION_KEY } from "../constants/Localization"; + +// import { ConvertTimestampToDate } from "../@egovernments/digit-utils/services/date"; + +const Complaint = ({ data, path }) => { + let { serviceCode, serviceRequestId, applicationStatus } = data; + + const history = useHistory(); + const { t } = useTranslation(); + + const handleClick = () => { + history.push(`${path}/${serviceRequestId}`); + }; + + const closedStatus = ["RESOLVED", "REJECTED", "CLOSEDAFTERREJECTION", "CLOSEDAFTERRESOLUTION"]; + + return ( + + + {t(`SERVICEDEFS.${serviceCode.toUpperCase()}`)} + + + + + +
+

{(closedStatus.includes(applicationStatus) ? t("CS_COMMON_CLOSED") : t("CS_COMMON_OPEN")).toUpperCase()}

+
+ + {t(`${LOCALIZATION_KEY.CS_COMMON}_${applicationStatus}`)} +
+
+ ); +}; + +export default Complaint; diff --git a/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/components/DesktopInbox.js b/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/components/DesktopInbox.js new file mode 100644 index 00000000000..ee2b1f75c8f --- /dev/null +++ b/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/components/DesktopInbox.js @@ -0,0 +1,143 @@ +import React from "react"; +import { useTranslation } from "react-i18next"; +import { Link } from "react-router-dom"; +import { Card, Loader } from "@egovernments/digit-ui-react-components"; +import ComplaintsLink from "./inbox/ComplaintLinks"; +import ComplaintTable from "./inbox/ComplaintTable"; +import Filter from "./inbox/Filter"; +import SearchComplaint from "./inbox/search"; +import { LOCALE } from "../constants/Localization"; + +const DesktopInbox = ({ + data, + onFilterChange, + onSearch, + isLoading, + searchParams, + onNextPage, + onPrevPage, + currentPage, + pageSizeLimit, + onPageSizeChange, + totalRecords, +}) => { + const { t } = useTranslation(); + const GetCell = (value) => {value}; + const GetSlaCell = (value) => { + return value < 0 ? {value || ""} : {value || ""}; + }; + + const columns = React.useMemo( + () => [ + { + Header: t("CS_COMMON_COMPLAINT_NO"), + Cell: ({ row }) => { + return ( +
+ ); + }, + }, + { + Header: t("WF_INBOX_HEADER_LOCALITY"), + Cell: ({ row }) => { + return GetCell(t(Digit.Utils.locale.getLocalityCode(row.original["locality"], row.original["tenantId"]))); + }, + }, + { + Header: t("CS_COMPLAINT_DETAILS_CURRENT_STATUS"), + Cell: ({ row }) => { + return GetCell(t(`CS_COMMON_${row.original["status"]}`)); + }, + }, + { + Header: t("WF_INBOX_HEADER_CURRENT_OWNER"), + Cell: ({ row }) => { + return GetCell(row.original["taskOwner"]); + }, + }, + { + Header: t("WF_INBOX_HEADER_SLA_DAYS_REMAINING"), + Cell: ({ row }) => { + return GetSlaCell(row.original["sla"]); + }, + }, + ], + [t] + ); + + let result; + if (isLoading) { + result = ; + } else if (data && data?.length === 0) { + result = ( + + {t(LOCALE.NO_COMPLAINTS_EMPLOYEE) + .split("\\n") + .map((text, index) => ( +

+ {text} +

+ ))} +
+ ); + } else if (data?.length > 0) { + result = ( + { + return { + style: { + minWidth: cellInfo.column.Header === t("CS_COMMON_COMPLAINT_NO") ? "240px" : "", + padding: "20px 18px", + fontSize: "16px", + }, + }; + }} + onNextPage={onNextPage} + onPrevPage={onPrevPage} + totalRecords={totalRecords} + onPageSizeChagne={onPageSizeChange} + currentPage={currentPage} + pageSizeLimit={pageSizeLimit} + /> + ); + } else { + result = ( + + {t(LOCALE.ERROR_LOADING_RESULTS) + .split("\\n") + .map((text, index) => ( +

+ {text} +

+ ))} +
+ ); + } + + return ( +
+
+ +
+ +
+
+
+ +
{result}
+
+
+ ); +}; + +export default DesktopInbox; diff --git a/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/components/FormComposer.js b/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/components/FormComposer.js new file mode 100644 index 00000000000..785f9cde039 --- /dev/null +++ b/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/components/FormComposer.js @@ -0,0 +1,86 @@ +import React, { useMemo } from "react"; +import { useForm } from "react-hook-form"; +import { + BreakLine, + Card, + CardLabel, + CardLabelError, + CardSubHeader, + CardSectionHeader, + TextArea, + TextInput, + ActionBar, + SubmitBar, + LabelFieldPair, +} from "@egovernments/digit-ui-react-components"; + +import { useTranslation } from "react-i18next"; + +export const FormComposer = (props) => { + const { register, handleSubmit, errors } = useForm(); + const { t } = useTranslation(); + + function onSubmit(data) { + props.onSubmit(data); + } + + const fieldSelector = (type, populators) => { + switch (type) { + case "text": + return ( +
+ {populators.componentInFront ? populators.componentInFront : null} + +
+ ); + case "textarea": + return + + + + + ); +}; + +export default RatingAndFeedBack; diff --git a/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/pages/citizen/Rating/SelectRating.js b/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/pages/citizen/Rating/SelectRating.js new file mode 100644 index 00000000000..c24bce32f20 --- /dev/null +++ b/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/pages/citizen/Rating/SelectRating.js @@ -0,0 +1,62 @@ +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/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/pages/citizen/ReopenComplaint/AddtionalDetails.js b/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/pages/citizen/ReopenComplaint/AddtionalDetails.js new file mode 100644 index 00000000000..7c9ae3f20ac --- /dev/null +++ b/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/pages/citizen/ReopenComplaint/AddtionalDetails.js @@ -0,0 +1,97 @@ +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/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/pages/citizen/ReopenComplaint/Reason.js b/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/pages/citizen/ReopenComplaint/Reason.js new file mode 100644 index 00000000000..a67b9b52c1c --- /dev/null +++ b/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/pages/citizen/ReopenComplaint/Reason.js @@ -0,0 +1,57 @@ +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/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/pages/citizen/ReopenComplaint/UploadPhoto.js b/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/pages/citizen/ReopenComplaint/UploadPhoto.js new file mode 100644 index 00000000000..a50ae8af67f --- /dev/null +++ b/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/pages/citizen/ReopenComplaint/UploadPhoto.js @@ -0,0 +1,71 @@ +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/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/pages/citizen/ReopenComplaint/index.js b/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/pages/citizen/ReopenComplaint/index.js new file mode 100644 index 00000000000..ddd9dab9acd --- /dev/null +++ b/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/pages/citizen/ReopenComplaint/index.js @@ -0,0 +1,28 @@ +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/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/pages/citizen/Response.js b/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/pages/citizen/Response.js new file mode 100644 index 00000000000..7712051c928 --- /dev/null +++ b/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/pages/citizen/Response.js @@ -0,0 +1,59 @@ +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/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/pages/citizen/index.js b/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/pages/citizen/index.js new file mode 100644 index 00000000000..9319f81beb7 --- /dev/null +++ b/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/pages/citizen/index.js @@ -0,0 +1,48 @@ +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/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/pages/employee/ComplaintDetails.js b/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/pages/employee/ComplaintDetails.js new file mode 100644 index 00000000000..91641378146 --- /dev/null +++ b/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/pages/employee/ComplaintDetails.js @@ -0,0 +1,504 @@ +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")} +