diff --git a/.github/workflows/publishAllPackages.yml b/.github/workflows/publishAllPackages.yml index ffaa1e6c016..6bb4b51d612 100644 --- a/.github/workflows/publishAllPackages.yml +++ b/.github/workflows/publishAllPackages.yml @@ -2,9 +2,14 @@ name: Node.js Publish UI Packages on: push: - branches: [ 'develop' ] + branches: [ 'develop','campaign' ] paths: - 'micro-ui/web/micro-ui-internals/**' + + pull_request: + branches: + - 'dev-hcm' + # Push events to branches matching refs/heads/mona/octocat jobs: build: @@ -15,6 +20,6 @@ jobs: with: node-version: 14 registry-url: https://registry.npmjs.org/ - - run: cd micro-ui/web/micro-ui-internals/ && bash ./publish-workbench.sh + - run: cd micro-ui/web/micro-ui-internals/ && bash ./publish-develop.sh env: NODE_AUTH_TOKEN: ${{secrets.npm_token}} diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000000..84763f33d2a --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +.DS_Store +accelerators/frontend/micro-ui-internals/node_modules/* +.idea +index.lock +utilities/ \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000000..2b8c08a8854 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "editor.inlineSuggest.showToolbar": "always" +} \ No newline at end of file diff --git a/CODEOWNERS b/CODEOWNERS new file mode 100644 index 00000000000..259b2843037 --- /dev/null +++ b/CODEOWNERS @@ -0,0 +1,4 @@ +* @egovernments/core-ui-reviewers + +##Frontend +micro-ui/web @nabeelmd-eGov diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000000..335fd5f8652 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 eGovernments Foundation + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index e5fa890e62d..457872b5b21 100644 --- a/README.md +++ b/README.md @@ -1 +1,141 @@ -DIGIT-Frontend + +# workbench ui + +A React App built on top of DIGIT UI Core. + +# DIGIT + +DIGIT eGovernance Platform Services + +DIGIT (Digital Infrastructure for Governance, Impact & Transformation) is India's largest platform for governance services. Visit https://core.digit.org/ for more details. + +DIGIT platform is microservices based API platform enabling quick rebundling of services as per specific needs. This is a repo that lays down the core platform on top of which other mission services depend. + + +# DIGIT UI + + +This repository contains source code for web implementation of the new Digit UI modules with dependencies and libraries. + +Workbench module is used to Manage the master data (MDMS V2 Service) used across the DIGIT Services / Applications + +It is also used to manage the Localisation data present in the system (Localisation service) + + +## Run Locally + +Clone the project + +```bash + git clone https://github.com/egovernments/DIGIT-Frontend.git +``` + +Go to the Sub directory to run UI +```bash + cd into micro-ui/web/micro-ui-internals +``` + +Install dependencies + +```bash + yarn install +``` + +Add .env file +```bash + micro-ui/web/micro-ui-internals/example/.env +``` + +Start the server + +```bash + yarn start +``` + + +## Environment Variables + +To run this project, you will need to add the following environment variables to your .env file + +`REACT_APP_PROXY_API` :: `{{server url}}` + +`REACT_APP_GLOBAL` :: `{{server url}}` + +`REACT_APP_PROXY_ASSETS` :: `{{server url}}` + +`REACT_APP_USER_TYPE` :: `{{EMPLOYEE||CITIZEN}}` + +`SKIP_PREFLIGHT_CHECK` :: `true` + +[sample .env file](https://github.com/egovernments/Digit-Core/blob/workbench/frontend/micro-ui/web/micro-ui-internals/example/.env-unifieddev) + +## Tech Stack + +**Libraries:** + +[React](https://react.dev/) + +[React Hook Form](https://www.react-hook-form.com/) + +[React Query](https://tanstack.com/query/v3/) + +[Tailwind CSS](https://tailwindcss.com/) + +[Webpack](https://webpack.js.org/) + +## License + +[MIT](https://choosealicense.com/licenses/mit/) + + +## Author + +- [@jagankumar-egov](https://www.github.com/jagankumar-egov) + + +## Documentation + +[Documentation](https://https://core.digit.org/guides/developer-guide/ui-developer-guide/digit-ui) + + +## Support + +For support, add the issues in https://github.com/egovernments/DIGIT-core/issues. + + +## Modules + + 1. Core + 2. Workbench + 3. HRMS + 4. Dashboard + 5. Engagement + 6. Payment + +## Starting with Digit-UI App (Impelmentation Teams) - MICRO-UI + + +Go to the Sub directory to run UI + +```bash + cd into micro-ui/web +``` + +```bash + yarn install +``` + +Add .env file +```bash + micro-ui/web/.env +``` + +Start the server + +```bash + yarn start +``` + + +![Logo](https://s3.ap-south-1.amazonaws.com/works-dev-asset/mseva-white-logo.png) + diff --git a/build/build-config.yml b/build/build-config.yml index b50ee7558da..e4487a809dd 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: @@ -46,6 +52,6 @@ config: - name: builds/Digit-Frontend/core-ui build: - work-dir: micro-ui/ - dockerfile: micro-ui/web/docker/Dockerfile + dockerfile: micro-ui/web/core/Dockerfile image-name: core-ui diff --git a/micro-ui/.gitignore b/micro-ui/.gitignore new file mode 100644 index 00000000000..feb4cac5c94 --- /dev/null +++ b/micro-ui/.gitignore @@ -0,0 +1,32 @@ +# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. + +.env +.eslintcache + +# yarn $ +.yarn +yarn.lock +.yarnrc.yml + +# dependencies +node_modules +.yarn +/.pnp +.pnp.js + +# testing +/coverage + +# production +/web/build +dist +# misc +.DS_Store +.env.local +.env.development.local +.env.test.local +.env.production.local + +npm-debug.log* +yarn-debug.log* +yarn-error.log* diff --git a/micro-ui/Jenkinsfile b/micro-ui/Jenkinsfile new file mode 100644 index 00000000000..1206b9c141d --- /dev/null +++ b/micro-ui/Jenkinsfile @@ -0,0 +1,3 @@ +library 'ci-libs' + +buildPipeline(configFile: './build/build-config.yml') diff --git a/micro-ui/README.md b/micro-ui/README.md new file mode 100644 index 00000000000..9420dbb760d --- /dev/null +++ b/micro-ui/README.md @@ -0,0 +1,140 @@ + +# workbench ui + +A React App built on top of DIGIT UI Core. + +# DIGIT + +DIGIT eGovernance Platform Services + +DIGIT (Digital Infrastructure for Governance, Impact & Transformation) is India's largest platform for governance services. Visit https://core.digit.org/ for more details. + +DIGIT platform is microservices based API platform enabling quick rebundling of services as per specific needs. This is a repo that lays down the core platform on top of which other mission services depend. + + +# DIGIT UI + + +This repository contains source code for web implementation of the new Digit UI modules with dependencies and libraries. + +Workbench module is used to Manage the master data (MDMS V2 Service) used across the DIGIT Services / Applications + +It is also used to manage the Localisation data present in the system (Localisation service) + + +## Run Locally + +Clone the project + +```bash + git clone https://github.com/egovernments/DIGIT-Frontend.git +``` + +Go to the Sub directory to run UI +```bash + cd into micro-ui/web/micro-ui-internals +``` + +Install dependencies + +```bash + yarn install +``` + +Add .env file +```bash + micro-ui/web/micro-ui-internals/example/.env +``` + +Start the server + +```bash + yarn start +``` + + +## Environment Variables + +To run this project, you will need to add the following environment variables to your .env file + +`REACT_APP_PROXY_API` :: `{{server url}}` + +`REACT_APP_GLOBAL` :: `{{server url}}` + +`REACT_APP_PROXY_ASSETS` :: `{{server url}}` + +`REACT_APP_USER_TYPE` :: `{{EMPLOYEE||CITIZEN}}` + +`SKIP_PREFLIGHT_CHECK` :: `true` + +[sample .env file](https://github.com/egovernments/Digit-Core/blob/workbench/frontend/micro-ui/web/micro-ui-internals/example/.env-unifieddev) + +## Tech Stack + +**Libraries:** + +[React](https://react.dev/) + +[React Hook Form](https://www.react-hook-form.com/) + +[React Query](https://tanstack.com/query/v3/) + +[Tailwind CSS](https://tailwindcss.com/) + +[Webpack](https://webpack.js.org/) + +## License + +[MIT](https://choosealicense.com/licenses/mit/) + + +## Author + +- [@jagankumar-egov](https://www.github.com/jagankumar-egov) + + +## Documentation + +[Documentation](https://https://core.digit.org/guides/developer-guide/ui-developer-guide/digit-ui) + + +## Support + +For support, add the issues in https://github.com/egovernments/DIGIT-core/issues. + + +## Modules + + 1. Core + 2. Workbench + 3. HRMS + 4. Dashboard + 5. Engagement + 6. Payment + +## Starting with Digit-UI App (Impelmentation Teams) - MICRO-UI + + +Go to the Sub directory to run UI + +```bash + cd into micro-ui/web +``` + +```bash + yarn install +``` + +Add .env file +```bash + micro-ui/web/.env +``` + +Start the server + +```bash + yarn start +``` + + +![Logo](https://s3.ap-south-1.amazonaws.com/works-dev-asset/mseva-white-logo.png) diff --git a/micro-ui/package.json b/micro-ui/package.json new file mode 100644 index 00000000000..19a3c47d6ee --- /dev/null +++ b/micro-ui/package.json @@ -0,0 +1,4 @@ +{ + "name": "workbench-ui", + "version": "1.0.0" +} \ No newline at end of file diff --git a/micro-ui/web/.babelrc b/micro-ui/web/.babelrc new file mode 100644 index 00000000000..5f90443d15e --- /dev/null +++ b/micro-ui/web/.babelrc @@ -0,0 +1,5 @@ +{ + "presets": [ + "@babel/preset-env","@babel/preset-react" + ] + } \ No newline at end of file diff --git a/micro-ui/web/.env.sample b/micro-ui/web/.env.sample new file mode 100644 index 00000000000..e87c7f586c4 --- /dev/null +++ b/micro-ui/web/.env.sample @@ -0,0 +1,3 @@ +SKIP_PREFLIGHT_CHECK=true +REACT_APP_STATE_LEVEL_TENANT_ID=pb +REACT_APP_PROXY_URL=https://works-dev.digit.org diff --git a/micro-ui/web/docker/Dockerfile b/micro-ui/web/docker/Dockerfile new file mode 100644 index 00000000000..8e9b173bb85 --- /dev/null +++ b/micro-ui/web/docker/Dockerfile @@ -0,0 +1,25 @@ +# FROM egovio/alpine-node-builder-14:yarn AS build +FROM ghcr.io/egovernments/alpine-node-builder-14:yarn AS build +RUN apk update && apk upgrade +RUN apk add --no-cache git>2.30.0 +ARG WORK_DIR +WORKDIR /app +ENV NODE_OPTIONS "--max-old-space-size=8168" + +COPY ${WORK_DIR} . +RUN ls -lah + +#RUN node web/envs.js +RUN cd web/ \ + && ./install-deps.sh \ + && yarn install \ + && yarn build:webpack + +FROM nginx:mainline-alpine +#FROM ghcr.io/egovernments/nginx:mainline-alpine +ENV WORK_DIR=/var/web/digit-ui + +RUN mkdir -p ${WORK_DIR} + +COPY --from=build /app/web/build ${WORK_DIR}/ +COPY --from=build /app/web/docker/nginx.conf /etc/nginx/conf.d/default.conf diff --git a/micro-ui/web/docker/devDockerfile b/micro-ui/web/docker/devDockerfile new file mode 100644 index 00000000000..d7b1ba1870a --- /dev/null +++ b/micro-ui/web/docker/devDockerfile @@ -0,0 +1,26 @@ +#FROM egovio/alpine-node-builder-14:yarn AS build +FROM ghcr.io/egovernments/alpine-node-builder-14:yarn AS build +RUN apk update && apk upgrade +RUN apk add --no-cache git>2.30.0 +ARG WORK_DIR +WORKDIR /app +ENV NODE_OPTIONS "--max-old-space-size=1792" + +COPY ${WORK_DIR} . +RUN ls -lah + +#RUN node web/envs.js +RUN cd web/ \ + && node envs.js \ + && ./install-deps.sh \ + && yarn install \ + && yarn build + +#FROM nginx:mainline-alpine +FROM ghcr.io/egovernments/nginx:mainline-alpine +ENV WORK_DIR=/var/web/digit-ui + +RUN mkdir -p ${WORK_DIR} + +COPY --from=build /app/web/build ${WORK_DIR}/ +COPY --from=build /app/web/docker/nginx.conf /etc/nginx/conf.d/default.conf diff --git a/micro-ui/web/docker/masDockerfile b/micro-ui/web/docker/masDockerfile new file mode 100644 index 00000000000..5d7cf45dd87 --- /dev/null +++ b/micro-ui/web/docker/masDockerfile @@ -0,0 +1,25 @@ +#FROM egovio/alpine-node-builder-14:yarn AS build +FROM ghcr.io/egovernments/alpine-node-builder-14:yarn AS build +RUN apk update && apk upgrade +RUN apk add --no-cache git>2.30.0 +ARG WORK_DIR +WORKDIR /app +ENV NODE_OPTIONS "--max-old-space-size=3792" + +COPY ${WORK_DIR} . +RUN ls -lah + +#RUN node web/envs.js +RUN cd web/ \ + && node envs.js \ + && yarn install \ + && yarn build + +#FROM nginx:mainline-alpine +FROM ghcr.io/egovernments/nginx:mainline-alpine +ENV WORK_DIR=/var/web/digit-ui + +RUN mkdir -p ${WORK_DIR} + +COPY --from=build /app/web/build ${WORK_DIR}/ +COPY --from=build /app/web/docker/nginx.conf /etc/nginx/conf.d/default.conf diff --git a/micro-ui/web/docker/nginx.conf b/micro-ui/web/docker/nginx.conf new file mode 100644 index 00000000000..4f532e4a6ed --- /dev/null +++ b/micro-ui/web/docker/nginx.conf @@ -0,0 +1,12 @@ +server +{ + listen 80; + underscores_in_headers on; + + location /digit-ui + { + root /var/web; + index index.html index.htm; + try_files $uri $uri/ /digit-ui/index.html; + } +} \ No newline at end of file diff --git a/micro-ui/web/envs.js b/micro-ui/web/envs.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/micro-ui/web/install-deps.sh b/micro-ui/web/install-deps.sh new file mode 100755 index 00000000000..efaceaee20d --- /dev/null +++ b/micro-ui/web/install-deps.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +BRANCH="$(git branch --show-current)" + +echo "Main Branch: $BRANCH" + +INTERNALS="micro-ui-internals" + +cp $INTERNALS/example/src/UICustomizations.js src/Customisations + +cd $INTERNALS && echo "Branch: $(git branch --show-current)" && echo "$(git log -1 --pretty=%B)" && echo "installing packages" + + +# yarn install diff --git a/micro-ui/web/micro-ui-internals/.gitignore b/micro-ui/web/micro-ui-internals/.gitignore new file mode 100644 index 00000000000..1747c795d6f --- /dev/null +++ b/micro-ui/web/micro-ui-internals/.gitignore @@ -0,0 +1,143 @@ +# Created by https://www.toptal.com/developers/gitignore/api/node,react +# Edit at https://www.toptal.com/developers/gitignore?templates=node,react + +### eGov ### +packages/css/example/index.css +package-lock.json +locales/ +build/ +packages/**/dist/ + +# yarn # +.yarn +.yarnrc.yml + +### Node ### +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +lerna-debug.log* + +# Diagnostic reports (https://nodejs.org/api/report.html) +report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage +*.lcov + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (https://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules/ +jspm_packages/ + +# TypeScript v1 declaration files +typings/ + +# TypeScript cache +*.tsbuildinfo + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Microbundle cache +.rpt2_cache/ +.rts2_cache_cjs/ +.rts2_cache_es/ +.rts2_cache_umd/ + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variables file +.env +.env.test +.env*.local + +# parcel-bundler cache (https://parceljs.org/) +.cache +.parcel-cache + +# Next.js build output +.next + +# Nuxt.js build / generate output +.nuxt +dist +dist-storybook + +# Gatsby files +.cache/ +# Comment in the public line in if your project uses Gatsby and not Next.js +# https://nextjs.org/blog/next-9-1#public-directory-support +# public + +# vuepress build output +.vuepress/dist + +# Serverless directories +.serverless/ + +# FuseBox cache +.fusebox/ + +# DynamoDB Local files +.dynamodb/ + +# TernJS port file +.tern-port + +# Stores VSCode versions used for testing VSCode extensions +.vscode-test + +### react ### +.DS_* +**/*.backup.* +**/*.back.* + +node_modules + +*.sublime* + +psd +thumb +sketch + +# vs code +.vscode/ + +# End of https://www.toptal.com/developers/gitignore/api/node,react \ No newline at end of file diff --git a/micro-ui/web/micro-ui-internals/.prettierignore b/micro-ui/web/micro-ui-internals/.prettierignore new file mode 100644 index 00000000000..d54de016ef0 --- /dev/null +++ b/micro-ui/web/micro-ui-internals/.prettierignore @@ -0,0 +1,23 @@ + +# See https://help.github.com/ignore-files/ for more about ignoring files. +# dependencies +node_modules +# builds +build +dist +.rpt2_cache +# dev +dev.css +index.css +index.compat.css +index.min.css +# misc +.DS_Store +.env +.env.local +.env.development.local +.env.test.local +.env.production.local +npm-debug.log* +yarn-debug.log* +yarn-error.log* diff --git a/micro-ui/web/micro-ui-internals/.prettierrc.json b/micro-ui/web/micro-ui-internals/.prettierrc.json new file mode 100644 index 00000000000..b975008d6f8 --- /dev/null +++ b/micro-ui/web/micro-ui-internals/.prettierrc.json @@ -0,0 +1,3 @@ +{ + "printWidth": 150 +} diff --git a/micro-ui/web/micro-ui-internals/README.md b/micro-ui/web/micro-ui-internals/README.md new file mode 100644 index 00000000000..f23a1fcfe9c --- /dev/null +++ b/micro-ui/web/micro-ui-internals/README.md @@ -0,0 +1,100 @@ + +# workbench ui + +A React App built on top of DIGIT UI Core. + + +# DIGIT UI + +DIGIT (Digital Infrastructure for Governance, Impact & Transformation) is India's largest platform for governance services. Visit https://www.digit.org for more details. + +This repository contains source code for web implementation of the new Digit UI modules with dependencies and libraries. + +Workbench module is used to Manage the master data (MDMS V2 Service) used across the DIGIT Services / Applications + +It is also used to manage the Localisation data present in the system (Localisation service) + + +## Run Locally + +Clone the project + +```bash + git clone https://github.com/egovernments/Digit-Core.git +``` + +Go to the Sub directory to run UI +```bash + cd into frontend/micro-ui/web/micro-ui-internals +``` + +Install dependencies + +```bash + yarn install +``` + +Add .env file +```bash + frontend/micro-ui/web/micro-ui-internals/example/.env +``` + +Start the server + +```bash + yarn start +``` + + +## Environment Variables + +To run this project, you will need to add the following environment variables to your .env file + +`REACT_APP_PROXY_API` :: `{{server url}}` + +`REACT_APP_GLOBAL` :: `{{server url}}` + +`REACT_APP_PROXY_ASSETS` :: `{{server url}}` + +`REACT_APP_USER_TYPE` :: `{{EMPLOYEE||CITIZEN}}` + +`SKIP_PREFLIGHT_CHECK` :: `true` + +[sample .env file](https://github.com/egovernments/Digit-Core/blob/workbench/frontend/micro-ui/web/micro-ui-internals/example/.env-unifieddev) + +## Tech Stack + +**Libraries:** + +[React](https://react.dev/) + +[React Hook Form](https://www.react-hook-form.com/) + +[React Query](https://tanstack.com/query/v3/) + +[Tailwind CSS](https://tailwindcss.com/) + +[Webpack](https://webpack.js.org/) + +## License + +[MIT](https://choosealicense.com/licenses/mit/) + + +## Author + +- [@jagankumar-egov](https://www.github.com/jagankumar-egov) + + +## Documentation + +[Documentation](https://https://core.digit.org/guides/developer-guide/ui-developer-guide/digit-ui) + + +## Support + +For support, add the issues in https://github.com/egovernments/DIGIT-core/issues. + + +![Logo](https://s3.ap-south-1.amazonaws.com/works-dev-asset/mseva-white-logo.png) + diff --git a/micro-ui/web/micro-ui-internals/clean.sh b/micro-ui/web/micro-ui-internals/clean.sh new file mode 100644 index 00000000000..2235ef1c1d0 --- /dev/null +++ b/micro-ui/web/micro-ui-internals/clean.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +BASEDIR="$( cd "$( dirname "$0" )" && pwd )" + +msg() { + echo -e "\n\n\033[32;32m$1\033[0m" +} + +msg "Cleaning root" +rm -rf node_modules + +msg "Cleaning css" +cd "$BASEDIR/packages/css" && rm -rf node_modules + +msg "Cleaning libraries" +cd "$BASEDIR/packages/libraries" && rm -rf node_modules + +msg "Cleaning react-components" +cd "$BASEDIR/packages/react-components" && rm -rf node_modules + +msg "Cleaning PGR module" +cd "$BASEDIR/packages/modules/pgr" && rm -rf node_modules + +msg "Cleaning FSM module" +cd "$BASEDIR/packages/modules/fsm" && rm -rf node_modules + +msg "Cleaning Core module" +cd "$BASEDIR/packages/modules/core" && rm -rf node_modules diff --git a/micro-ui/web/micro-ui-internals/example/.env-unifiedDev b/micro-ui/web/micro-ui-internals/example/.env-unifiedDev new file mode 100644 index 00000000000..c1cf23a713e --- /dev/null +++ b/micro-ui/web/micro-ui-internals/example/.env-unifiedDev @@ -0,0 +1,8 @@ +SKIP_PREFLIGHT_CHECK=true +REACT_APP_USER_TYPE=EMPLOYEE +REACT_APP_EMPLOYEE_TOKEN=c835932f-2ad4-4d05-83d6-49e0b8c59f8a +REACT_APP_CITIZEN_TOKEN=7cd58aae-30b3-41ed-a1b3-3417107a993c +REACT_APP_PROXY_API=https://unified-dev.digit.org +REACT_APP_PROXY_ASSETS=https://unified-dev.digit.org +REACT_APP_GLOBAL=https://egov-dev-assets.s3.ap-south-1.amazonaws.com/globalConfigsMicroplan.js +REACT_APP_CONTEXT=works \ No newline at end of file diff --git a/micro-ui/web/micro-ui-internals/example/.env-unifieddev b/micro-ui/web/micro-ui-internals/example/.env-unifieddev new file mode 100644 index 00000000000..c1cf23a713e --- /dev/null +++ b/micro-ui/web/micro-ui-internals/example/.env-unifieddev @@ -0,0 +1,8 @@ +SKIP_PREFLIGHT_CHECK=true +REACT_APP_USER_TYPE=EMPLOYEE +REACT_APP_EMPLOYEE_TOKEN=c835932f-2ad4-4d05-83d6-49e0b8c59f8a +REACT_APP_CITIZEN_TOKEN=7cd58aae-30b3-41ed-a1b3-3417107a993c +REACT_APP_PROXY_API=https://unified-dev.digit.org +REACT_APP_PROXY_ASSETS=https://unified-dev.digit.org +REACT_APP_GLOBAL=https://egov-dev-assets.s3.ap-south-1.amazonaws.com/globalConfigsMicroplan.js +REACT_APP_CONTEXT=works \ No newline at end of file diff --git a/micro-ui/web/micro-ui-internals/example/package.json b/micro-ui/web/micro-ui-internals/example/package.json new file mode 100644 index 00000000000..8e90029d64d --- /dev/null +++ b/micro-ui/web/micro-ui-internals/example/package.json @@ -0,0 +1,37 @@ +{ + "name": "@egovernments/digit-ui-example", + "version": "1.0.0", + "main": "index.js", + "license": "MIT", + "private": true, + "homepage": "digit-ui", + "scripts": { + "start": "react-scripts start" + }, + "devDependencies": { + "@egovernments/digit-ui-libraries": "1.8.2-beta.1", + "@egovernments/digit-ui-components": "0.0.2-beta.1", + "@egovernments/digit-ui-module-core": "1.8.2-beta.6", + "@egovernments/digit-ui-module-utilities": "1.0.1-beta.30", + "@egovernments/digit-ui-react-components": "1.8.2-beta.5", + "@egovernments/digit-ui-module-sample": "0.0.1", + "http-proxy-middleware": "^1.0.5", + "react": "17.0.2", + "react-dom": "17.0.2", + "react-i18next": "11.16.2", + "react-router-dom": "5.3.0", + "react-scripts": "^4.0.1" + }, + "browserslist": { + "production": [ + ">0.2%", + "not dead", + "not op_mini all" + ], + "development": [ + "last 1 chrome version", + "last 1 firefox version", + "last 1 safari version" + ] + } +} diff --git a/micro-ui/web/micro-ui-internals/example/public/index.html b/micro-ui/web/micro-ui-internals/example/public/index.html new file mode 100644 index 00000000000..9276b24baf0 --- /dev/null +++ b/micro-ui/web/micro-ui-internals/example/public/index.html @@ -0,0 +1,67 @@ + + + + + + + + + + DIGIT + + + + + + + + + + + +
+ + + diff --git a/micro-ui/web/micro-ui-internals/example/src/ComponentRegistry.js b/micro-ui/web/micro-ui-internals/example/src/ComponentRegistry.js new file mode 100644 index 00000000000..9bafce3dc89 --- /dev/null +++ b/micro-ui/web/micro-ui-internals/example/src/ComponentRegistry.js @@ -0,0 +1,11 @@ +class Registry { + constructor(registry = {}) { + this._registry = registry; + } + + getComponent(id) { + return this._registry[id]; + } +} + +export default Registry; diff --git a/micro-ui/web/micro-ui-internals/example/src/UICustomizations.js b/micro-ui/web/micro-ui-internals/example/src/UICustomizations.js new file mode 100644 index 00000000000..d428d95394e --- /dev/null +++ b/micro-ui/web/micro-ui-internals/example/src/UICustomizations.js @@ -0,0 +1,670 @@ +import { Link } from "react-router-dom"; +import _ from "lodash"; +import { useLocation, useHistory } from "react-router-dom"; +import { useParams } from "react-router-dom"; + +//create functions here based on module name set in mdms(eg->SearchProjectConfig) +//how to call these -> Digit?.Customizations?.[masterName]?.[moduleName] +// these functions will act as middlewares +var Digit = window.Digit || {}; + + +const businessServiceMap = { + + "muster roll": "MR", + "estimate":"ESTIMATE" +}; + +const inboxModuleNameMap = { + "muster-roll-approval": "muster-roll-service", +}; + +export const UICustomizations = { + businessServiceMap, + updatePayload: (applicationDetails, data, action, businessService) => { + if (businessService === businessServiceMap.estimate) { + const workflow = { + comment: data.comments, + documents: data?.documents?.map((document) => { + return { + documentType: action?.action + " DOC", + fileName: document?.[1]?.file?.name, + fileStoreId: document?.[1]?.fileStoreId?.fileStoreId, + documentUid: document?.[1]?.fileStoreId?.fileStoreId, + tenantId: document?.[1]?.fileStoreId?.tenantId, + }; + }), + assignees: data?.assignees?.uuid ? [data?.assignees?.uuid] : null, + action: action.action, + }; + //filtering out the data + Object.keys(workflow).forEach((key, index) => { + if (!workflow[key] || workflow[key]?.length === 0) delete workflow[key]; + }); + + return { + estimate: applicationDetails, + workflow, + }; + } + if (businessService === businessServiceMap.contract) { + const workflow = { + comment: data?.comments, + documents: data?.documents?.map((document) => { + return { + documentType: action?.action + " DOC", + fileName: document?.[1]?.file?.name, + fileStoreId: document?.[1]?.fileStoreId?.fileStoreId, + documentUid: document?.[1]?.fileStoreId?.fileStoreId, + tenantId: document?.[1]?.fileStoreId?.tenantId, + }; + }), + assignees: data?.assignees?.uuid ? [data?.assignees?.uuid] : null, + action: action.action, + }; + //filtering out the data + Object.keys(workflow).forEach((key, index) => { + if (!workflow[key] || workflow[key]?.length === 0) delete workflow[key]; + }); + + return { + contract: applicationDetails, + workflow, + }; + } + if (businessService === businessServiceMap?.["muster roll"]) { + const workflow = { + comment: data?.comments, + documents: data?.documents?.map((document) => { + return { + documentType: action?.action + " DOC", + fileName: document?.[1]?.file?.name, + fileStoreId: document?.[1]?.fileStoreId?.fileStoreId, + documentUid: document?.[1]?.fileStoreId?.fileStoreId, + tenantId: document?.[1]?.fileStoreId?.tenantId, + }; + }), + assignees: data?.assignees?.uuid ? [data?.assignees?.uuid] : null, + action: action.action, + }; + //filtering out the data + Object.keys(workflow).forEach((key, index) => { + if (!workflow[key] || workflow[key]?.length === 0) delete workflow[key]; + }); + + return { + musterRoll: applicationDetails, + workflow, + }; + } + if (businessService === businessServiceMap?.["works.purchase"]) { + const workflow = { + comment: data.comments, + documents: data?.documents?.map((document) => { + return { + documentType: action?.action + " DOC", + fileName: document?.[1]?.file?.name, + fileStoreId: document?.[1]?.fileStoreId?.fileStoreId, + documentUid: document?.[1]?.fileStoreId?.fileStoreId, + tenantId: document?.[1]?.fileStoreId?.tenantId, + }; + }), + assignees: data?.assignees?.uuid ? [data?.assignees?.uuid] : null, + action: action.action, + }; + //filtering out the data + Object.keys(workflow).forEach((key, index) => { + if (!workflow[key] || workflow[key]?.length === 0) delete workflow[key]; + }); + + const additionalFieldsToSet = { + projectId: applicationDetails.additionalDetails.projectId, + invoiceDate: applicationDetails.billDate, + invoiceNumber: applicationDetails.referenceId.split("_")?.[1], + contractNumber: applicationDetails.referenceId.split("_")?.[0], + documents: applicationDetails.additionalDetails.documents, + }; + return { + bill: { ...applicationDetails, ...additionalFieldsToSet }, + workflow, + }; + } + }, + enableModalSubmit: (businessService, action, setModalSubmit, data) => { + if (businessService === businessServiceMap?.["muster roll"] && action.action === "APPROVE") { + setModalSubmit(data?.acceptTerms); + } + }, + enableHrmsSearch: (businessService, action) => { + if (businessService === businessServiceMap.estimate) { + return action.action.includes("TECHNICALSANCTION") || action.action.includes("VERIFYANDFORWARD"); + } + if (businessService === businessServiceMap.contract) { + return action.action.includes("VERIFY_AND_FORWARD"); + } + if (businessService === businessServiceMap?.["muster roll"]) { + return action.action.includes("VERIFY"); + } + if (businessService === businessServiceMap?.["works.purchase"]) { + return action.action.includes("VERIFY_AND_FORWARD"); + } + return false; + }, + getBusinessService: (moduleCode) => { + if (moduleCode?.includes("estimate")) { + return businessServiceMap?.estimate; + } else if (moduleCode?.includes("contract")) { + return businessServiceMap?.contract; + } else if (moduleCode?.includes("muster roll")) { + return businessServiceMap?.["muster roll"]; + } + else if (moduleCode?.includes("works.purchase")) { + return businessServiceMap?.["works.purchase"]; + } + else if (moduleCode?.includes("works.wages")) { + return businessServiceMap?.["works.wages"]; + } + else if (moduleCode?.includes("works.supervision")) { + return businessServiceMap?.["works.supervision"]; + } + else { + return businessServiceMap; + } + }, + getInboxModuleName: (moduleCode) => { + if (moduleCode?.includes("estimate")) { + return inboxModuleNameMap?.estimate; + } else if (moduleCode?.includes("contract")) { + return inboxModuleNameMap?.contracts; + } else if (moduleCode?.includes("attendence")) { + return inboxModuleNameMap?.attendencemgmt; + } else { + return inboxModuleNameMap; + } + }, + + AttendanceInboxConfig: { + preProcess: (data) => { + //set tenantId + data.body.inbox.tenantId = Digit.ULBService.getCurrentTenantId(); + data.body.inbox.processSearchCriteria.tenantId = Digit.ULBService.getCurrentTenantId(); + + const musterRollNumber = data?.body?.inbox?.moduleSearchCriteria?.musterRollNumber?.trim(); + if (musterRollNumber) data.body.inbox.moduleSearchCriteria.musterRollNumber = musterRollNumber; + + const attendanceRegisterName = data?.body?.inbox?.moduleSearchCriteria?.attendanceRegisterName?.trim(); + if (attendanceRegisterName) data.body.inbox.moduleSearchCriteria.attendanceRegisterName = attendanceRegisterName; + + // deleting them for now(assignee-> need clarity from pintu,ward-> static for now,not implemented BE side) + const assignee = _.clone(data.body.inbox.moduleSearchCriteria.assignee); + delete data.body.inbox.moduleSearchCriteria.assignee; + if (assignee?.code === "ASSIGNED_TO_ME") { + data.body.inbox.moduleSearchCriteria.assignee = Digit.UserService.getUser().info.uuid; + } + + //cloning locality and workflow states to format them + // let locality = _.clone(data.body.inbox.moduleSearchCriteria.locality ? data.body.inbox.moduleSearchCriteria.locality : []); + + let selectedOrg = _.clone(data.body.inbox.moduleSearchCriteria.orgId ? data.body.inbox.moduleSearchCriteria.orgId : null); + delete data.body.inbox.moduleSearchCriteria.orgId; + if (selectedOrg) { + data.body.inbox.moduleSearchCriteria.orgId = selectedOrg?.[0]?.applicationNumber; + } + + // let selectedWard = _.clone(data.body.inbox.moduleSearchCriteria.ward ? data.body.inbox.moduleSearchCriteria.ward : null); + // delete data.body.inbox.moduleSearchCriteria.ward; + // if(selectedWard) { + // data.body.inbox.moduleSearchCriteria.ward = selectedWard?.[0]?.code; + // } + + let states = _.clone(data.body.inbox.moduleSearchCriteria.state ? data.body.inbox.moduleSearchCriteria.state : []); + let ward = _.clone(data.body.inbox.moduleSearchCriteria.ward ? data.body.inbox.moduleSearchCriteria.ward : []); + // delete data.body.inbox.moduleSearchCriteria.locality; + delete data.body.inbox.moduleSearchCriteria.state; + delete data.body.inbox.moduleSearchCriteria.ward; + + // locality = locality?.map((row) => row?.code); + states = Object.keys(states)?.filter((key) => states[key]); + ward = ward?.map((row) => row?.code); + + // //adding formatted data to these keys + // if (locality.length > 0) data.body.inbox.moduleSearchCriteria.locality = locality; + if (states.length > 0) data.body.inbox.moduleSearchCriteria.status = states; + if (ward.length > 0) data.body.inbox.moduleSearchCriteria.ward = ward; + const projectType = _.clone(data.body.inbox.moduleSearchCriteria.projectType ? data.body.inbox.moduleSearchCriteria.projectType : {}); + if (projectType?.code) data.body.inbox.moduleSearchCriteria.projectType = projectType.code; + + //adding tenantId to moduleSearchCriteria + data.body.inbox.moduleSearchCriteria.tenantId = Digit.ULBService.getCurrentTenantId(); + + //setting limit and offset becoz somehow they are not getting set in muster inbox + data.body.inbox.limit = data.state.tableForm.limit; + data.body.inbox.offset = data.state.tableForm.offset; + delete data.state; + return data; + }, + postProcess: (responseArray, uiConfig) => { + const statusOptions = responseArray?.statusMap + ?.filter((item) => item.applicationstatus) + ?.map((item) => ({ code: item.applicationstatus, i18nKey: `COMMON_MASTERS_${item.applicationstatus}` })); + if (uiConfig?.type === "filter") { + let fieldConfig = uiConfig?.fields?.filter((item) => item.type === "dropdown" && item.populators.name === "musterRollStatus"); + if (fieldConfig.length) { + fieldConfig[0].populators.options = statusOptions; + } + } + }, + additionalCustomizations: (row, key, column, value, t, searchResult) => { + if (key === "ATM_MUSTER_ROLL_ID") { + return ( + + + {String(value ? (column.translate ? t(column.prefix ? `${column.prefix}${value}` : value) : value) : t("ES_COMMON_NA"))} + + + ); + } + if (key === "ATM_ATTENDANCE_WEEK") { + const week = `${Digit.DateUtils.ConvertTimestampToDate(value?.startDate, "dd/MM/yyyy")}-${Digit.DateUtils.ConvertTimestampToDate( + value?.endDate, + "dd/MM/yyyy" + )}`; + return
{week}
; + } + if (key === "ATM_NO_OF_INDIVIDUALS") { + return
{value?.length}
; + } + if (key === "ATM_AMOUNT_IN_RS") { + return {value ? Digit.Utils.dss.formatterWithoutRound(value, "number") : t("ES_COMMON_NA")}; + } + if (key === "ATM_SLA") { + return parseInt(value) > 0 ? ( + {t(value) || ""} + ) : ( + {t(value) || ""} + ); + } + if (key === "COMMON_WORKFLOW_STATES") { + return {t(`WF_MUSTOR_${value}`)}; + } + //added this in case we change the key and not updated here , it'll throw that nothing was returned from cell error if that case is not handled here. To prevent that error putting this default + return {t(`CASE_NOT_HANDLED`)}; + }, + MobileDetailsOnClick: (row, tenantId) => { + let link; + Object.keys(row).map((key) => { + if (key === "ATM_MUSTER_ROLL_ID") + link = `/${window.contextPath}/employee/attendencemgmt/view-attendance?tenantId=${tenantId}&musterRollNumber=${row[key]}`; + }); + return link; + }, + populateReqCriteria: () => { + const tenantId = Digit.ULBService.getCurrentTenantId(); + return { + url: "/org-services/organisation/v1/_search", + params: { limit: 50, offset: 0 }, + body: { + SearchCriteria: { + tenantId: tenantId, + functions: { + type: "CBO", + }, + }, + }, + config: { + enabled: true, + select: (data) => { + return data?.organisations; + }, + }, + }; + }, + }, + SearchWageSeekerConfig: { + customValidationCheck: (data) => { + //checking both to and from date are present + const { createdFrom, createdTo } = data; + if ((createdFrom === "" && createdTo !== "") || (createdFrom !== "" && createdTo === "")) + return { warning: true, label: "ES_COMMON_ENTER_DATE_RANGE" }; + + return false; + }, + preProcess: (data) => { + data.params = { ...data.params, tenantId: Digit.ULBService.getCurrentTenantId() }; + + let requestBody = { ...data.body.Individual }; + const pathConfig = { + name: "name.givenName", + }; + const dateConfig = { + createdFrom: "daystart", + createdTo: "dayend", + }; + const selectConfig = { + wardCode: "wardCode[0].code", + socialCategory: "socialCategory.code", + }; + const textConfig = ["name", "individualId"]; + let Individual = Object.keys(requestBody) + .map((key) => { + if (selectConfig[key]) { + requestBody[key] = _.get(requestBody, selectConfig[key], null); + } else if (typeof requestBody[key] == "object") { + requestBody[key] = requestBody[key]?.code; + } else if (textConfig?.includes(key)) { + requestBody[key] = requestBody[key]?.trim(); + } + return key; + }) + .filter((key) => requestBody[key]) + .reduce((acc, curr) => { + if (pathConfig[curr]) { + _.set(acc, pathConfig[curr], requestBody[curr]); + } else if (dateConfig[curr] && dateConfig[curr]?.includes("day")) { + _.set(acc, curr, Digit.Utils.date.convertDateToEpoch(requestBody[curr], dateConfig[curr])); + } else { + _.set(acc, curr, requestBody[curr]); + } + return acc; + }, {}); + + data.body.Individual = { ...Individual }; + return data; + }, + additionalCustomizations: (row, key, column, value, t, searchResult) => { + //here we can add multiple conditions + //like if a cell is link then we return link + //first we can identify which column it belongs to then we can return relevant result + switch (key) { + case "MASTERS_WAGESEEKER_ID": + return ( + + + {String(value ? (column.translate ? t(column.prefix ? `${column.prefix}${value}` : value) : value) : t("ES_COMMON_NA"))} + + + ); + + case "MASTERS_SOCIAL_CATEGORY": + return value ? {String(t(`MASTERS_${value}`))} : t("ES_COMMON_NA"); + + case "CORE_COMMON_PROFILE_CITY": + return value ? {String(t(Digit.Utils.locale.getCityLocale(value)))} : t("ES_COMMON_NA"); + + case "MASTERS_WARD": + return value ? ( + {String(t(Digit.Utils.locale.getMohallaLocale(value, row?.tenantId)))} + ) : ( + t("ES_COMMON_NA") + ); + + case "MASTERS_LOCALITY": + return value ? ( + {String(t(Digit.Utils.locale.getMohallaLocale(value, row?.tenantId)))} + ) : ( + t("ES_COMMON_NA") + ); + default: + return t("ES_COMMON_NA"); + } + }, + MobileDetailsOnClick: (row, tenantId) => { + let link; + Object.keys(row).map((key) => { + if (key === "MASTERS_WAGESEEKER_ID") + link = `/${window.contextPath}/employee/masters/view-wageseeker?tenantId=${tenantId}&wageseekerId=${row[key]}`; + }); + return link; + }, + additionalValidations: (type, data, keys) => { + if (type === "date") { + return data[keys.start] && data[keys.end] ? () => new Date(data[keys.start]).getTime() <= new Date(data[keys.end]).getTime() : true; + } + }, + }, + SearchDefaultConfig: { + customValidationCheck: (data) => { + //checking both to and from date are present + const { createdFrom, createdTo } = data; + if ((createdFrom === "" && createdTo !== "") || (createdFrom !== "" && createdTo === "")) + return { warning: true, label: "ES_COMMON_ENTER_DATE_RANGE" }; + + return false; + }, + preProcess: (data) => { + const location = useLocation(); + data.params = { ...data.params }; + const { masterName } = useParams(); + + const searchParams = new URLSearchParams(location.search); + const paths = { + "SearchProjectConfig": { + basePath: "Projects", + pathConfig: { + // id: "id[0]", + tenantId: "tenantId", + }, + dateConfig: { + endDate: "dayend", + startDate: "daystart" + }, + selectConfig: { + }, + textConfig :["id", "tenantId", "name", "projectNumber", "projectSubType" , "projectType"] + }, + "SearchProductConfig": { + basePath: "Product", + pathConfig: { + id: "id[0]", + }, + dateConfig: { + }, + selectConfig: { + }, + textConfig :["id", "manufacturer", "name", "type"] + }, + "SearchHouseholdConfig": { + basePath: "Household", + pathConfig: { + id: "id[0]", + clientReferenceId: "clientReferenceId[0]", + }, + dateConfig: { + }, + selectConfig: { + }, + textConfig :["boundaryCode", "clientReferenceId", "id"] + }, + "SearchProductVariantConfig": { + basePath: "ProductVariant", + pathConfig: { + id: "id[0]", + }, + dateConfig: { + }, + selectConfig: { + }, + textConfig :["productId", "sku", "variation"] + }, + "SearchProjectBeneficiaryConfig": { + basePath: "ProjectBeneficiary", + pathConfig: { + id: "id[0]", + clientReferenceId: "clientReferenceId[0]", + + }, + dateConfig: { + dateOfRegistration: "daystart" + }, + selectConfig: { + }, + textConfig :["beneficiaryId", "projectId"] + }, + "SearchProjectStaffConfig": { + basePath: "ProjectStaff", + pathConfig: { + id: "id[0]", + }, + dateConfig: { + startDate: "daystart", + endDate: "dayend", + }, + selectConfig: { + }, + textConfig :["projectId", "userId"] + }, + "SearchProjectResourceConfig": { + basePath: "ProjectResource", + pathConfig: { + id: "id[0]" + }, + dateConfig: { + }, + selectConfig: { + }, + textConfig : [] + }, + "SearchProjectTaskConfig": { + basePath: "Task", + pathConfig: { + id: "id[0]", + clientReferenceId: "clientReferenceId[0]", + }, + dateConfig: { + plannedEndDate: "dayend", + plannedStartDate: "daystart", + actualEndDate: "dayend", + actualStartDate: "daystart", + }, + selectConfig: { + }, + textConfig :["projectId","localityCode", "projectBeneficiaryId", "status"] + }, + "SearchFacilityConfig": { + basePath: "Facility", + pathConfig: { + id: "id[0]" + }, + dateConfig: { + }, + selectConfig: { + }, + textConfig :["faciltyUsage","localityCode", "storageCapacity","id"] + }, + "SearchProjectFacilityConfig": { + basePath: "ProjectFacility", + pathConfig: { + id: "id[0]", + projectId: "projectId[0]", + facilityId: "facilityId[0]" + }, + dateConfig: { + }, + selectConfig: { + }, + textConfig :[] + }, + } + + const id = searchParams.get("config")|| masterName; + + if(!paths||!paths?.[id]){ + return data; + } + let requestBody = { ...data.body[paths[id]?.basePath] }; + const pathConfig = paths[id]?.pathConfig; + const dateConfig = paths[id]?.dateConfig; + const selectConfig = paths[id]?.selectConfig; + const textConfig = paths[id]?.textConfig + + if(paths[id].basePath == "Projects"){ + data.state.searchForm={...data.state.searchForm,tenantId:"mz"} + } + let Product = Object.keys(requestBody) + .map((key) => { + if (selectConfig[key]) { + requestBody[key] = _.get(requestBody, selectConfig[key], null); + } else if (typeof requestBody[key] == "object") { + requestBody[key] = requestBody[key]?.code; + } else if (textConfig?.includes(key)) { + requestBody[key] = requestBody[key]?.trim(); + } + return key; + }) + .filter((key) => requestBody[key]) + .reduce((acc, curr) => { + if (pathConfig[curr]) { + _.set(acc, pathConfig[curr], requestBody[curr]); + } else if (dateConfig[curr] && dateConfig[curr]?.includes("day")) { + _.set(acc, curr, Digit.Utils.date.convertDateToEpoch(requestBody[curr], dateConfig[curr])); + } else { + _.set(acc, curr, requestBody[curr]); + } + return acc; + }, {}); + + if(paths[id].basePath == "Projects"){ + + data.body[paths[id].basePath] = [{ ...Product}]; + } + else data.body[paths[id].basePath] = { ...Product}; + return data; + }, + additionalCustomizations: (row, key, column, value, t, searchResult) => { + //here we can add multiple conditions + //like if a cell is link then we return link + //first we can identify which column it belongs to then we can return relevant result + switch (key) { + case "ID": + + return ( + + + + + ); + + case "MASTERS_SOCIAL_CATEGORY": + return value ? {String(t(`MASTERS_${value}`))} : t("ES_COMMON_NA"); + + case "CORE_COMMON_PROFILE_CITY": + return value ? {String(t(Digit.Utils.locale.getCityLocale(value)))} : t("ES_COMMON_NA"); + + case "MASTERS_WARD": + return value ? ( + {String(t(Digit.Utils.locale.getMohallaLocale(value, row?.tenantId)))} + ) : ( + t("ES_COMMON_NA") + ); + + case "MASTERS_LOCALITY": + return value ? ( + {String(t(Digit.Utils.locale.getMohallaLocale(value, row?.tenantId)))} + ) : ( + t("ES_COMMON_NA") + ); + default: + return t("ES_COMMON_NA"); + } + }, + MobileDetailsOnClick: (row, tenantId) => { + let link; + Object.keys(row).map((key) => { + if (key === "MASTERS_WAGESEEKER_ID") + link = `/${window.contextPath}/employee/masters/view-wageseeker?tenantId=${tenantId}&wageseekerId=${row[key]}`; + }); + return link; + }, + additionalValidations: (type, data, keys) => { + if (type === "date") { + return data[keys.start] && data[keys.end] ? () => new Date(data[keys.start]).getTime() <= new Date(data[keys.end]).getTime() : true; + } + }, + } +}; diff --git a/micro-ui/web/micro-ui-internals/example/src/complaintConfig.js b/micro-ui/web/micro-ui-internals/example/src/complaintConfig.js new file mode 100644 index 00000000000..28c85515205 --- /dev/null +++ b/micro-ui/web/micro-ui-internals/example/src/complaintConfig.js @@ -0,0 +1,31 @@ +export const config = { + routes: { + "complaint-type": { + nextStep: "pincode", + }, + landmark: { + nextStep: "apartment", + }, + apartment: { + component: "SelectName", + texts: { + header: "Apartment or Society", + cardText: "CS_COMPLAINT_SUBTYPE_TEXT", + submitBarLabel: "PT_COMMONS_NEXT", + }, + inputs: [ + { + label: "Apartment", + type: "text", + name: "custom.additionalDetails.apartment", + validation: { + minLength: 6, + maxLength: 7, + }, + error: "CORE_COMMON_PINCODE_INVALID", + }, + ], + nextStep: "upload-photos", + }, + }, +}; diff --git a/micro-ui/web/micro-ui-internals/example/src/components/SelectName.js b/micro-ui/web/micro-ui-internals/example/src/components/SelectName.js new file mode 100644 index 00000000000..56d2a195c12 --- /dev/null +++ b/micro-ui/web/micro-ui-internals/example/src/components/SelectName.js @@ -0,0 +1,8 @@ +import React from "react"; +import { FormStep } from "@egovernments/digit-ui-react-components"; + +const SelectName = ({ config, onSelect, onSkip, t }) => { + return ; +}; + +export default SelectName; diff --git a/micro-ui/web/micro-ui-internals/example/src/fsm.js b/micro-ui/web/micro-ui-internals/example/src/fsm.js new file mode 100644 index 00000000000..271d3ddad56 --- /dev/null +++ b/micro-ui/web/micro-ui-internals/example/src/fsm.js @@ -0,0 +1,38 @@ +const fsmCustomizations = { + getEmployeeApplicationCustomization: (config, t) => { + const employeeConfig = [ + { + name: "applicationDetails", + // fields: ["sanitationType", "applicationChannel"], + // fieldsOrder: {sanitationType: 0, applicationChannel: 1}, // TODO + allFields: true, // for example: If in applicationDetails you have 10 fields and in fieldsOrder you only enter 3 fields name then on browser you will only see 3 fields in that order but if you want to see rest of 7 fields at the bottom. + // removeFields: ["applicantName"], // type the name of the field in camelCase to remove it + addFields: [ + // by default all the custom fields will add at the bottom, you can add "field name" to "fieldsOrder" if you want them in your custom order. + { + name: "example", + label: t("EXAMPLE"), + type: "text", + isMandatory: true, + populators: { + name: "example", + validation: { + required: true, + pattern: /[A-Za-z]/, + }, + }, + }, + ], + }, + ]; + + return { + config: employeeConfig, + defaultConfig: true, // You want to use defaultConfig and you only want to update one field section. The above employeeConfig is also an order for all the field section. So if defaultConfig is false then on browser you will only see those field section who are inside employeeConfig + }; + }, +}; + +const fsmComponents = {}; + +export { fsmCustomizations, fsmComponents }; diff --git a/micro-ui/web/micro-ui-internals/example/src/index.js b/micro-ui/web/micro-ui-internals/example/src/index.js new file mode 100644 index 00000000000..2db8b797a48 --- /dev/null +++ b/micro-ui/web/micro-ui-internals/example/src/index.js @@ -0,0 +1,81 @@ +import React from "react"; +import ReactDOM from "react-dom"; + +import { initLibraries } from "@egovernments/digit-ui-libraries"; +// import { paymentConfigs, PaymentLinks, PaymentModule } from "@egovernments/digit-ui-module-common"; +import { DigitUI } from "@egovernments/digit-ui-module-core"; +import "@egovernments/digit-ui-sample-css/example/index.css"; + +import { pgrCustomizations } from "./pgr"; +import { UICustomizations } from "./UICustomizations"; +import { initUtilitiesComponents } from "@egovernments/digit-ui-module-utilities"; +import {initSampleComponents} from "@egovernments/digit-ui-module-sample"; + +var Digit = window.Digit || {}; + +const enabledModules = [ + "DSS", + "HRMS", + "Workbench", + "HCMWORKBENCH", + // "Engagement", "NDSS","QuickPayLinks", "Payment", + "Utilities", + "Microplanning", + "Sample" + //added to check fsm + // "FSM" +]; + +const initTokens = (stateCode) => { + const userType = window.sessionStorage.getItem("userType") || process.env.REACT_APP_USER_TYPE || "CITIZEN"; + const token = window.localStorage.getItem("token") || process.env[`REACT_APP_${userType}_TOKEN`]; + + const citizenInfo = window.localStorage.getItem("Citizen.user-info"); + + const citizenTenantId = window.localStorage.getItem("Citizen.tenant-id") || stateCode; + + const employeeInfo = window.localStorage.getItem("Employee.user-info"); + const employeeTenantId = window.localStorage.getItem("Employee.tenant-id"); + + const userTypeInfo = userType === "CITIZEN" || userType === "QACT" ? "citizen" : "employee"; + window.Digit.SessionStorage.set("user_type", userTypeInfo); + window.Digit.SessionStorage.set("userType", userTypeInfo); + + if (userType !== "CITIZEN") { + window.Digit.SessionStorage.set("User", { access_token: token, info: userType !== "CITIZEN" ? JSON.parse(employeeInfo) : citizenInfo }); + } else { + // if (!window.Digit.SessionStorage.get("User")?.extraRoleInfo) window.Digit.SessionStorage.set("User", { access_token: token, info: citizenInfo }); + } + + window.Digit.SessionStorage.set("Citizen.tenantId", citizenTenantId); + + if (employeeTenantId && employeeTenantId.length) window.Digit.SessionStorage.set("Employee.tenantId", employeeTenantId); +}; + +const initDigitUI = () => { + window.contextPath = window?.globalConfigs?.getConfig("CONTEXT_PATH") || "digit-ui"; + window.Digit.Customizations = { + PGR: pgrCustomizations, + commonUiConfig: UICustomizations + }; + window?.Digit.ComponentRegistryService.setupRegistry({ + // PaymentModule, + // ...paymentConfigs, + // PaymentLinks, + }); + + initUtilitiesComponents(); + initSampleComponents(); + + const moduleReducers = (initData) => initData; + + + const stateCode = window?.globalConfigs?.getConfig("STATE_LEVEL_TENANT_ID") || "pb"; + initTokens(stateCode); + + ReactDOM.render(, document.getElementById("root")); +}; + +initLibraries().then(() => { + initDigitUI(); +}); diff --git a/micro-ui/web/micro-ui-internals/example/src/pgr.js b/micro-ui/web/micro-ui-internals/example/src/pgr.js new file mode 100644 index 00000000000..48a498e4582 --- /dev/null +++ b/micro-ui/web/micro-ui-internals/example/src/pgr.js @@ -0,0 +1,15 @@ +import SelectName from "./components/SelectName"; + +// import { config as complaintConfig } from "./complaintConfig"; + +const pgrCustomizations = { + // complaintConfig, + getComplaintDetailsTableRows: ({ id, service, role, t }) => { + return {}; + }, +}; + +const pgrComponents = { + SelectName: SelectName, +}; +export { pgrCustomizations, pgrComponents }; diff --git a/micro-ui/web/micro-ui-internals/example/src/setupProxy.js b/micro-ui/web/micro-ui-internals/example/src/setupProxy.js new file mode 100644 index 00000000000..1a7a9eed23e --- /dev/null +++ b/micro-ui/web/micro-ui-internals/example/src/setupProxy.js @@ -0,0 +1,98 @@ +const { createProxyMiddleware } = require("http-proxy-middleware"); + +const createProxy = createProxyMiddleware({ + //target: process.env.REACT_APP_PROXY_API || "https://uat.digit.org", + // target: process.env.REACT_APP_PROXY_API || "https://qa.digit.org", + target: process.env.REACT_APP_PROXY_API || "https://works-dev.digit.org", + changeOrigin: true, + secure: false, +}); +const assetsProxy = createProxyMiddleware({ + target: process.env.REACT_APP_PROXY_ASSETS || "https://works-dev.digit.org", + changeOrigin: true, + secure: false, +}); +const mdmsProxy = createProxyMiddleware({ + target: process.env.REACT_APP_PROXY_ASSETS || "http://localhost:8080", + changeOrigin: true, + secure: false, +}); +module.exports = function (app) { + ["/mdms-v2/v2/_create"].forEach((location) => app.use(location, mdmsProxy)); + [ + "/access/v1/actions/mdms", + "/egov-mdms-service", + "/mdms-v2", + "/egov-idgen", + "/egov-location", + "/localization", + "/egov-workflow-v2", + "/pgr-services", + "/filestore", + "/egov-hrms", + "/user-otp", + "/user", + "/fsm", + "/billing-service", + "/collection-services", + "/pdf-service", + "/pg-service", + "/vehicle", + "/estimate", + "/vendor", + "/property-services", + "/fsm-calculator/v1/billingSlab/_search", + "/pt-calculator-v2", + "/dashboard-analytics", + "/echallan-services", + "/egov-searcher/bill-genie/mcollectbills/_get", + "/egov-searcher/bill-genie/billswithaddranduser/_get", + "/egov-searcher/bill-genie/waterbills/_get", + "/egov-searcher/bill-genie/seweragebills/_get", + "/egov-pdf/download/UC/mcollect-challan", + "/egov-hrms/employees/_count", + "/tl-services/v1/_create", + "/tl-services/v1/_search", + "/egov-url-shortening/shortener", + "/inbox/v1/_search", + "/inbox/v2/_search", + "/tl-services", + "/tl-calculator", + "/org-services", + "/edcr", + "/bpa-services", + "/noc-services", + "/egov-user-event", + "/egov-document-uploader", + "/egov-pdf", + "/egov-survey-services", + "/ws-services", + "/sw-services", + "/ws-calculator", + "/sw-calculator/", + "/egov-searcher", + "/report", + "/inbox/v1/dss/_search", + "/loi-service", + "/project/v1/", + "/estimate-service", + "/loi-service", + "/works-inbox-service/v2/_search", + "/egov-pdf/download/WORKSESTIMATE/estimatepdf", + "/muster-roll", + "/individual", + "/mdms-v2", + "/hcm-moz-impl", + "/project", + "/project/staff/v1/_search", + "/project/v1/_search", + "/facility/v1/_search", + "/product/v1/_search", + "/product/variant/v1/_search", + "/hcm-bff/bulk/_transform", + "/hcm-bff/hcm/_processmicroplan", + "/health-hrms", + ].forEach((location) => app.use(location, createProxy)); + ["/pb-egov-assets"].forEach((location) => app.use(location, assetsProxy)); + ["/mdms-v2/v2/_create"].forEach((location) => app.use(location, mdmsProxy)); +}; diff --git a/micro-ui/web/micro-ui-internals/package.json b/micro-ui/web/micro-ui-internals/package.json new file mode 100644 index 00000000000..34bc0026f97 --- /dev/null +++ b/micro-ui/web/micro-ui-internals/package.json @@ -0,0 +1,55 @@ +{ + "name": "egovernments", + "version": "1.0.0", + "main": "index.js", + "workspaces": [ + "example", + "packages/css", + "packages/modules/*" + ], + "author": "JaganKumar ", + "license": "MIT", + "private": true, + "engines": { + "node": ">=14" + }, + "scripts": { + "start": "SKIP_PREFLIGHT_CHECK=true run-s build start:dev", + "sprint": "SKIP_PREFLIGHT_CHECK=true run-s start:script", + "start:dev": "run-p dev:**", + "start:script": "./scripts/create.sh", + "dev:css": "cd packages/css && yarn start", + "publish:css": "cd packages/css && yarn && npm publish --tag workbench-1.0", + "dev:example": "cd example && yarn start", + "dev:sample": "cd packages/modules/sample && yarn start", + "build": "run-p build:**", + "build:sample": "cd packages/modules/sample && yarn build", + "deploy:jenkins": "./scripts/jenkins.sh", + "clean": "rm -rf node_modules" + }, + "resolutions": { + "**/@babel/runtime": "7.20.1", + "**/babel-preset-react-app": "10.0.0" + }, + "devDependencies": { + "husky": "7.0.4", + "lint-staged": "12.3.7", + "npm-run-all": "4.1.5", + "prettier": "2.1.2" + }, + "husky": {}, + "lint-staged": { + "*.{js,css,md}": "prettier --write" + }, + "dependencies": { + "lodash": "4.17.21", + "microbundle-crl": "0.13.11", + "@egovernments/digit-ui-react-components": "1.8.2-beta.5", + "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" + } +} diff --git a/micro-ui/web/micro-ui-internals/packages/css/README.md b/micro-ui/web/micro-ui-internals/packages/css/README.md new file mode 100644 index 00000000000..c2597b2240d --- /dev/null +++ b/micro-ui/web/micro-ui-internals/packages/css/README.md @@ -0,0 +1,57 @@ + + +# digit-ui-css + +## Install + +```bash +npm install --save @egovernments/digit-ui-css +``` + +## Limitation + +```bash +This Package is more specific to DIGIT-UI's can be used across mission's +It is the base css for all Digit UI's +``` + +## Usage + +After adding the dependency make sure you have this dependency in + +```bash +frontend/micro-ui/web/package.json +``` + +```json +"@egovernments/digit-ui-css":"^1.5.0", +``` + +then navigate to App.js + +```bash +frontend/micro-ui/web/public/index.html +``` + +```jsx +/** add this import **/ + + + +``` +### Changelog + +```bash +1.0.0-microlan Base version + +``` +## Contributors + +[jagankumar-egov] [nipunarora-eGov] + +### Published from DIGIT Frontend +DIGIT Frontend Repo (https://github.com/egovernments/Digit-Frontend/tree/develop) + +## License + +MIT © [jagankumar-egov](https://github.com/jagankumar-egov) diff --git a/micro-ui/web/micro-ui-internals/packages/css/gulpfile.js b/micro-ui/web/micro-ui-internals/packages/css/gulpfile.js new file mode 100644 index 00000000000..5d1a705494a --- /dev/null +++ b/micro-ui/web/micro-ui-internals/packages/css/gulpfile.js @@ -0,0 +1,71 @@ +const fs = require("fs"); +const { name, version, author, cssConfig } = JSON.parse(fs.readFileSync("package.json")); + +const headerString = ` +@charset "UTF-8"; +/*! + * ${name} - ${version} + * + * Copyright (c) ${new Date().getFullYear()} ${author} + * + */ + `; +const { series, src, dest, watch, task } = require("gulp"); +const header = require("postcss-header"); + +const clean = require("gulp-clean"); +const postcss = require("gulp-postcss"); +const sass = require('gulp-sass'); + +const postcssPresetEnv = require("postcss-preset-env"); +const cleanCSS = require("gulp-clean-css"); +const rename = require("gulp-rename"); +const livereload = require("gulp-livereload"); + +let output = "./example"; +if (process.env.NODE_ENV === "production") { + output = "./dist"; +} + +function cleanStyles() { + return src(`${output}/*.css`, { read: false }).pipe(clean()); +} + +function styles() { + const plugins = [ + require("postcss-import"), + require("tailwindcss"), + postcssPresetEnv({ stage: 2, autoprefixer: { cascade: false }, features: { "custom-properties": true } }), + require("autoprefixer"), + require("cssnano"), + header({ header: headerString }), + ]; + return src("src/index.scss").pipe(postcss(plugins)).pipe(sass()).pipe(dest(output)); +} + +function minify() { + return src(`${output}/index.css`).pipe(cleanCSS()).pipe(rename(`index.min.css`)).pipe(dest(output)); +} + +function stylesLive() { + styles().pipe(livereload({ start: true })); +} + +function livereloadStyles() { + livereload.listen(); + watch("src/**/*.scss", series(stylesLive)); +} + +exports.styles = styles; +exports.default = series(styles); +exports.watch = livereloadStyles; +if (process.env.NODE_ENV === "production") { + exports.build = series(cleanStyles, styles, minify); +} else { + exports.build = series(styles, livereloadStyles); +} + +// gulp.task("watch:styles", function () { +// livereload.listen(); +// gulp.watch("**/*.scss", ["styles"]); +// }); diff --git a/micro-ui/web/micro-ui-internals/packages/css/package.json b/micro-ui/web/micro-ui-internals/packages/css/package.json new file mode 100644 index 00000000000..8e35f8237d0 --- /dev/null +++ b/micro-ui/web/micro-ui-internals/packages/css/package.json @@ -0,0 +1,65 @@ +{ + "name": "@egovernments/digit-ui-sample-css", + "version": "0.0.1", + "license": "MIT", + "main": "dist/index.css", + "author": "Jagankumar ", + "engines": { + "node": ">=14" + }, + "cssConfig": { + "prefix": "" + }, + "scripts": { + "start": "gulp build", + "build:prod": "NODE_ENV=production gulp build", + "prepublish": "yarn build:prod", + "deploy": "gulp && cp -R svg example && cp -R img example && gh-pages -d example" + }, + "browserslist": [ + "> 3%", + "last 2 versions" + ], + "style": "./dist/index.css", + "dependencies": { + "node-sass": "4.14.1", + "normalize.css": "8.0.1", + "postcss-scss": "3.0.5", + "tailwindcss": "1.9.6" + }, + "devDependencies": { + "autoprefixer": "10.4.14", + "cssnano": "4.1.11", + "gh-pages": "3.2.3", + "gulp": "4.0.2", + "gulp-clean": "0.4.0", + "gulp-clean-css": "4.3.0", + "gulp-livereload": "4.0.2", + "gulp-postcss": "9.0.1", + "gulp-rename": "2.0.0", + "gulp-sass": "4.1.1", + "postcss": "8.4.26", + "postcss-cli": "8.3.1", + "postcss-header": "2.0.0", + "postcss-import": "12.0.1", + "postcss-prefixer": "2.1.3", + "postcss-preset-env": "6.7.1", + "postcss-scss": "3.0.5", + "sass": "^1.26.11" + }, + "files": [ + "dist/index.min.css", + "dist/index.css", + "svg/**/*.svg", + "img/**/*.png", + "src/**/*.scss", + "src/**/*.css" + ], + "keywords": [ + "digit", + "egov", + "dpg", + "digit-ui", + "css" + ] +} \ No newline at end of file diff --git a/micro-ui/web/micro-ui-internals/packages/css/postcss.config.js b/micro-ui/web/micro-ui-internals/packages/css/postcss.config.js new file mode 100644 index 00000000000..18485de221e --- /dev/null +++ b/micro-ui/web/micro-ui-internals/packages/css/postcss.config.js @@ -0,0 +1,55 @@ +const postcssPresetEnv = require("postcss-preset-env"); + +module.exports = { + parser: require("postcss-scss"), + plugins: [ + require("postcss-import"), + require("postcss-nested").default, + require("tailwindcss"), + require("postcss-preset-env"), + require("autoprefixer"), + // require("cssnano"), + ], +}; + +// const fs = require('fs'); +// const { name, version, author, cssConfig } = JSON.parse(fs.readFileSync('package.json')); + +// const header = ` +// @charset "UTF-8"; +// /*! +// * ${name} - ${version} +// * +// * Copyright (c) ${new Date().getFullYear()} ${author.name} +// */ +// `; + +// module.exports = (ctx) => { +// const prefix = ctx.env === 'compat' ? '' : cssConfig.prefix; +// const devMessage = `🎉🎉🎉🎉 \n${name} ${ctx.env} build was compiled sucessfully! \n`; + + +// return { +// map: ctx.options.map, +// parser: ctx.options.parser, +// plugins: { +// 'postcss-import': { root: ctx.file.dirname }, +// 'postcss-prefixer': { +// prefix, +// ignore: [/\[class\*=.*\]/], +// }, +// 'postcss-preset-env': { +// autoprefixer: { +// cascade: false, +// }, +// features: { +// 'custom-properties': true, +// }, +// }, +// cssnano: ctx.env === 'production' || ctx.env === 'compat' ? {} : false, +// 'postcss-header': { +// header, +// }, +// }, +// }; +// }; diff --git a/micro-ui/web/micro-ui-internals/packages/css/src/components/microplanning.scss b/micro-ui/web/micro-ui-internals/packages/css/src/components/microplanning.scss new file mode 100644 index 00000000000..f01756f1e7d --- /dev/null +++ b/micro-ui/web/micro-ui-internals/packages/css/src/components/microplanning.scss @@ -0,0 +1,363 @@ +.microplanning { + .upload { + display: flex; + width: 100%; + justify-content: space-between; + margin-top: 1.25rem; + } + + .upload-section-option { + width: 12.5rem; + min-height: 32rem; + background-color: #ffffff; + border-top-left-radius: 0.5rem; + border-bottom-left-radius: 0.5rem; + padding: 0.625rem; + box-shadow: 0px 1px 2px 0px #00000029; + } + + .upload-section-options-active { + min-height: 3.7rem; + display: flex; + align-items: center; + border-bottom: 1px rgba(214, 213, 212, 1) solid; + cursor: pointer; + border-right: 0.3rem solid rgba(244, 119, 56, 1); + background-color: rgba(244, 119, 56, 0.12); + + p { + color: rgba(80, 90, 95, 1); + font-weight: 400; + font-size: 16px; + } + } + + .upload-section-options-inactive { + min-height: 3.7rem; + display: flex; + align-items: center; + border-bottom: 1px rgba(214, 213, 212, 1) solid; + cursor: pointer; + border-right: none; + background-color: rgba(255, 255, 255, 1); + + p { + color: rgba(80, 90, 95, 1); + font-weight: 400; + font-size: 16px; + } + } + + .upload-component { + width: 80%; + height: min-content; + border-radius: 0.25rem; + padding: 1.5rem; + background-color: rgba(255, 255, 255, 1); + margin: 0; + margin-right: 0.3rem; + padding-bottom: 0.625rem; + } + + .upload-component-active { + display: flex; + flex-direction: column; + margin-bottom: 0; + + .greyedout-name { + color: rgba(177, 180, 182, 1); + margin: 0 0.625rem; + font-size: 1.25rem; + padding-top: 0px; + font-weight: 500; + } + + h2 { + margin-top: 0.625rem; + font-size: 2.5rem; + margin: 0.625rem 0; + font-weight: 700; + } + + p { + margin: 0.625rem 0; + padding-top: 0.625; + font-size: 1rem; + margin-top: 0.625rem; + font-weight: 400; + } + } + + .upload-component-inactive { + display: none; + } + + .upload-option-container { + display: flex; + align-items: center; + justify-content: center; + padding: 1.25rem 0; + flex-wrap: wrap; + + .upload-option-container-selected { + border: 2px rgba(244, 119, 56, 1) solid; + color: rgba(244, 119, 56, 1); + } + } + + .upload-option { + border-radius: 0.25rem; + border: 0.0625rem rgba(214, 213, 212, 1) solid; + min-width: 12.5rem; + min-height: 8.75rem; + box-shadow: 0 0.0625rem rgba(0, 0, 0, 0.16); + padding: 0.625rem 0; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + justify-items: center; + margin: 0 1.25rem; + cursor: pointer; + + &:hover { + border: 2px rgba(244, 119, 56, 1) solid; + } + + p { + margin-top: 0.625rem; + } + + .upload-option-selected { + border: 0.125rem rgba(244, 119, 56, 1) solid; + color: rgba(244, 119, 56, 1); + } + + .select-button { + justify-self: end; + border: 1px solid rgba(244, 119, 56, 1); + background-color: rgba(255, 255, 255, 1); + width: 11rem; + height: 2.5rem; + padding: 0.6rem 0.5rem; + color: rgba(244, 119, 56, 1); + font-size: 1rem; + font-weight: 600; + } + + .selected-button { + justify-self: end; + border: 1px solid rgba(244, 119, 56, 1); + background-color: rgba(244, 119, 56, 1); + width: 11rem; + height: 2.5rem; + padding: 0.6rem 0.5rem; + color: rgb(255, 255, 255); + font-size: 1rem; + font-weight: 600; + } + } + + .modal-header { + width: 30rem; + font-weight: 700; + font-size: 1.5rem; + padding-left: 1rem; + margin-bottom: 0; + display: flex; + flex-wrap: wrap; + overflow: hidden; + } + + .modal-body { + overflow: hidden; + padding-left: 1rem; + padding-right: 1rem; + margin-bottom: 1rem; + margin-right: 1rem; + + p { + font-weight: 400; + font-size: 1rem; + } + } + + .upload-file { + min-width: 90%; + min-height: 10rem; + padding-top: 0.625; + border: 1px rgba(214, 213, 212, 1) dotted; + margin: 1rem 0; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + background-color: rgba(250, 250, 250, 255); + } + + .uploaded-file { + border: 1px solid rgba(214, 213, 212, 1); + min-height: 4.75rem; + background-color: rgb(256, 252, 252); + display: flex !important; + flex-direction: row; + justify-content: space-between; + align-items: center; + margin-top: 0.625rem; + padding: 0 0.625rem; + flex-wrap: wrap; + + .uploaded-file-details { + display: flex; + flex-direction: row; + align-items: center; + flex-wrap: wrap; + padding: 1rem 0; + + p { + padding: 0; + margin: 0; + height: min-content; + font-weight: 700; + font-size: 1.5rem; + color: rgba(80, 90, 95, 1); + text-align: start; + } + } + + .uploaded-file-operations { + display: flex !important; + flex-direction: row; + align-items: center; + justify-items: end; + flex-wrap: wrap; + .button { + display: flex !important; + flex-direction: row; + align-items: center !important; + justify-content: center; + margin-left: 1rem; + min-width: 9rem; + height: 2.5rem; + border: 1px rgba(244, 119, 56, 1) solid; + background-color: white; + cursor: pointer; + } + + p { + padding: 0; + margin: 0; + color: rgba(244, 119, 56, 1); + font-weight: 600; + font-size: 1rem; + } + + .deletebutton { + background-color: rgb(255, 255, 255, 0); + border: none; + } + } + } + + .loader-container { + display: flex; + justify-content: center; + align-items: center; + height: 100%; + width: 100%; + display: flex; + flex-direction: column; + background-color: rgba(0, 0, 0, 0.7); + position: fixed; + top: 0; + left: 0; + z-index: 99999; + + .loader { + border: 0.5rem solid rgb(255, 255, 255); + border-top: 0.5rem solid rgba(80, 76, 76, 0); + border-radius: 50%; + width: 3.125rem; + height: 3.125rem; + animation: spin 2s linear infinite; + } + + .loader-inner { + border: 1px solid rgb(255, 255, 255); + border-radius: 50%; + width: 100%; + height: 100%; + } + + .loader-text { + color: whitesmoke; + padding-top: 1.25rem; + } + } + + @keyframes spin { + 0% { + transform: rotate(0deg); + } + + 100% { + transform: rotate(360deg); + } + } + + .toast-container { + position: fixed; + width: 50%; + bottom: 1.25rem; + left: 50%; + transform: translateX(-50%); + color: #fff; + padding: 1rem; + z-index: 9999; + } + + .success { + background-color: rgba(0, 112, 60, 1); + } + + .toast-content { + display: flex; + align-items: center; + justify-content: space-between; + } + + .message { + margin-right: 0.6px; + } + + .close-button { + background: transparent; + border: none; + color: inherit; + cursor: pointer; + } + + .altrady-have-template-button { + display: flex !important; + justify-content: center; + font-weight: 600; + font-size: 1rem; + } + + .download-template-button { + display: flex !important; + justify-content: center; + + .icon { + display: flex; + align-items: center; + margin: 0; + padding: 0; + } + + p { + font-weight: 500; + font-size: 1rem; + } + } +} \ No newline at end of file diff --git a/micro-ui/web/micro-ui-internals/packages/css/src/index.scss b/micro-ui/web/micro-ui-internals/packages/css/src/index.scss new file mode 100644 index 00000000000..11eb5b4de6c --- /dev/null +++ b/micro-ui/web/micro-ui-internals/packages/css/src/index.scss @@ -0,0 +1,12 @@ +/*@import 'normalize.css';*/ + +/*@import url("https://fonts.googleapis.com/css2?family=Roboto+Condensed:wght@400;500;700&family=Roboto:wght@400;500;700&display=swap");*/ + +@import "tailwindcss/base"; + +@import "tailwindcss/components"; + +@import "tailwindcss/utilities"; + +@import "./components/microplanning.scss"; +@import "./pages/employee/index.scss"; diff --git a/micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/index.scss b/micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/index.scss new file mode 100644 index 00000000000..e69de29bb2d diff --git a/micro-ui/web/micro-ui-internals/packages/css/tailwind.config.js b/micro-ui/web/micro-ui-internals/packages/css/tailwind.config.js new file mode 100644 index 00000000000..673ba2cfaba --- /dev/null +++ b/micro-ui/web/micro-ui-internals/packages/css/tailwind.config.js @@ -0,0 +1,231 @@ +module.exports = { + future: { + removeDeprecatedGapUtilities: true, + purgeLayersByDefault: true, + }, + purge: { enabled: true, content: ["./example/index.html"] }, + theme: { + screens: { + dt: "780px", + sm: { max: "425px" }, + }, + colors: { + primary: { + light: "#F18F5E", + main: "#F47738", + dark: "#C8602B", + }, + secondary: "#22394D", + text: { + primary: "#0B0C0C", + secondary: "#505A5F", + }, + link: { + normal: "#1D70B8", + hover: "#003078", + }, + border: "#D6D5D4", + inputBorder: "#464646", + "input-border": "#464646", + focus: "#F47738", + error: "#D4351C", + success: "#00703C", + black: "#000000", + grey: { + dark: "#9E9E9E", + mid: "#EEEEEE", + light: "#FAFAFA", + bg: "#E3E3E3", + }, + white: "#FFFFFF", + }, + fontFamily: { + sans: ["Roboto", "sans-serif"], + rc: ['"Roboto Condensed"', "sans-serif"], + }, + fontSize: { + "heading-xl-dt": ["48px", "56px"], + "heading-xl": ["32px", "40px"], + "heading-l-dt": ["36px", "40px"], + "heading-l": ["24px", "32px"], + "heading-m-dt": ["24px", "32px"], + "heading-m": ["18px", "28px"], + "heading-s": ["16px", "24px"], + "caption-xl-dt": ["27px", "32px"], + "caption-xl": ["18px", "26px"], + "caption-l-dt": ["24px", "28px"], + "caption-l": ["18px", "21px"], + "caption-m-dt": ["19px", "23px"], + "caption-m": ["16px", "19px"], + "form-field": ["16px", "20px"], + "body-l-dt": ["19px", "28px"], + "body-l": ["16px", "24px"], + "body-s-dt": ["16px", "24px"], + "body-s": ["14px", "16px"], + legend: ["19px", "23px"], + link: ["16px", "24px"], + "text-btn": ["16px", "24px"], + }, + fontWeight: { + regular: 400, + medium: 500, + bold: 700, + }, + padding: { + sm: "8px", + md: "16px", + lg: "24px", + xl: "36px", + }, + margin: { + xs: "4px", + sm: "8px", + md: "16px", + lg: "24px", + xl: "64px", + }, + borderWidth: { + default: "1px", + 0: "0", + 2: "1px", + 4: "4px", + 10: "10px", + }, + boxShadow: { + card: "0 1px 2px 0 rgba(0, 0, 0, 0.16)", + radiobtn: "0 0 0 5px #F47738", + }, + inset: { + 0: 0, + 6: "6px", + 10: "10px", + }, + extend: {}, + digitv2: { + lightTheme: { + primary: "#F47738", + "text-color-primary": "#0B0C0C", + "text-color-secondary": "#505A5F", + "text-color-disabled": "#B1B4B6", + background: "#EEEEEE", + paper: "#FFFFFF", + "paper-secondary": "#FAFAFA", + divider: "#D6D5D4", + "header-sidenav": "#0B4B66", + "input-border": "#505A5F", + "primary-bg": "#FEEFE7", + }, + alert: { + error: "#D4351C", + "error-bg": "#EFC7C1", + success: "#00703C", + "success-bg": "#BAD6C9", + info: "#3498DB", + "info-bg": "#C7E0F1", + }, + chart: { + "chart-1": "#048BD0", + "chart-1-gradient": "#048BD0", + "chart-2": "#FBC02D", + "chart-2-gradient": "#FBC02D", + "chart-3": "#8E29BF", + "chart-4": "#EA8A3B", + "chart-5": "#0BABDE", + }, + fontSize: { + "heading-xl": { + mobile: "2rem", + tablet: "2.25rem", + desktop: "2.5rem", + }, + "heading-l": { + mobile: "1.5rem", + tablet: "1.75rem", + desktop: "2rem", + }, + "heading-m": { + mobile: "1.25rem", + tablet: "1.375rem", + desktop: "1.5rem", + }, + "heading-s": { + mobile: "1rem", + tablet: "1rem", + desktop: "1rem", + }, + "heading-xs": { + mobile: "0.75rem", + }, + "caption-l": { + mobile: "1.5rem", + tablet: "1.75rem", + desktop: "1.75rem", + }, + "caption-m": { + mobile: "1.25rem", + tablet: "1.5rem", + desktop: "1.5rem", + }, + "caption-s": { + mobile: "1rem", + tablet: "1.25rem", + desktop: "1.25rem", + }, + "body-l": { + mobile: "1rem", + tablet: "1.25rem", + desktop: "1.25rem", + }, + "body-s": { + mobile: "0.875rem", + tablet: "1rem", + desktop: "1rem", + }, + "body-xs": { + mobile: "0.75rem", + tablet: "0.875rem", + desktop: "0.875rem", + }, + label: { + mobile: "1rem", + tablet: "1rem", + desktop: "1rem", + }, + link: { + mobile: "1rem", + tablet: "1rem", + desktop: "1rem", + }, + }, + fontFamily: { + sans: ["Roboto"], + rc: ['"Roboto Condensed"'], + }, + fontStyle: { + normal: "normal", + italic: "italic", + }, + textDecorationLine: { + underline: "underline", + }, + fontWeight: { + regular: 400, + medium: 500, + bold: 700, + }, + lineHeight: { + "line-height-body-l": { mobile: "1.5rem", tablet: "1.75rem", desktop: "1.75rem" }, + "line-height-body-s": { mobile: "1.0938rem", tablet: "1.5rem", desktop: "1.5rem" }, + "line-height-body-xs": { mobile: "1.125rem", tablet: "1.5rem", desktop: "1.5rem" }, + normal: "normal", + }, + screens: { + mobile: "400px", + tablet: "768px", + desktop: "1024px", + }, + }, + }, + variants: {}, + plugins: [], +}; \ No newline at end of file diff --git a/micro-ui/web/micro-ui-internals/packages/libraries/package.json b/micro-ui/web/micro-ui-internals/packages/libraries/package.json new file mode 100644 index 00000000000..b3ccfa605d2 --- /dev/null +++ b/micro-ui/web/micro-ui-internals/packages/libraries/package.json @@ -0,0 +1,50 @@ +{ + "name": "@egovernments/digit-ui-libraries", + "version": "1.8.1-beta.4", + "main": "dist/index.js", + "module": "dist/index.modern.js", + "source": "src/index.js", + "license": "MIT", + "files": [ + "dist" + ], + "scripts": { + "build": "microbundle-crl --compress --no-sourcemap --format cjs", + "start": "microbundle-crl watch --no-compress --format modern,cjs", + "prepublish": "yarn build" + }, + "peerDependencies": { + "react": "17.0.2" + }, + "devDependencies": { + "gh-pages": "2.2.0", + "microbundle-crl": "0.13.11", + "react-dom": "17.0.2", + "react-scripts": "^4.0.1" + }, + "dependencies": { + "axios": "0.21.1", + "babel-preset-react": "6.24.1", + "date-fns": "2.28.0", + "html2canvas": "1.4.1", + "dom-to-image": "2.6.0", + "i18next": "19.9.2", + "i18next-react-postprocessor": "3.0.7", + "pdfmake": "0.1.72", + "react": "17.0.2", + "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", + "xlsx": "0.17.5" + }, + "author": "JaganKumar ", + "keywords": [ + "digit", + "egov", + "dpg", + "digit-ui", + "libraries" + ] + } \ No newline at end of file diff --git a/micro-ui/web/micro-ui-internals/packages/modules/sample/README.md b/micro-ui/web/micro-ui-internals/packages/modules/sample/README.md new file mode 100644 index 00000000000..2d4e683aa5d --- /dev/null +++ b/micro-ui/web/micro-ui-internals/packages/modules/sample/README.md @@ -0,0 +1,3 @@ + + +# digit-ui-module-sample diff --git a/micro-ui/web/micro-ui-internals/packages/modules/sample/package.json b/micro-ui/web/micro-ui-internals/packages/modules/sample/package.json new file mode 100644 index 00000000000..dc9c65f2525 --- /dev/null +++ b/micro-ui/web/micro-ui-internals/packages/modules/sample/package.json @@ -0,0 +1,33 @@ +{ + "name": "@egovernments/digit-ui-module-sample", + "version": "0.0.1", + "description": "Sample Module UI", + "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.2-beta.5", + "@egovernments/digit-ui-components": "0.0.2-beta.1", + "react": "17.0.2", + "react-date-range": "^1.4.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" + }, + "author": "Jagankumar ", + "license": "MIT" +} diff --git a/micro-ui/web/micro-ui-internals/packages/modules/sample/src/Module.js b/micro-ui/web/micro-ui-internals/packages/modules/sample/src/Module.js new file mode 100644 index 00000000000..d0bcb869d1b --- /dev/null +++ b/micro-ui/web/micro-ui-internals/packages/modules/sample/src/Module.js @@ -0,0 +1,46 @@ +import { Loader } from "@egovernments/digit-ui-react-components"; +import React from "react"; +import { useRouteMatch } from "react-router-dom"; +import { default as EmployeeApp } from "./pages/employee"; +import SampleCard from "./components/SampleCard"; +import ViewEstimateComponent from "./components/ViewEstimateComponent"; +import { overrideHooks, updateCustomConfigs } from "./utils"; +import AdditionalComponentWrapper from "./components/AdditionalComponent"; +import SampleMultiComponent from "./components/SampleMultiComponent"; +import AddressComponent from "./components/AddressComponent"; +import EstimateComponent from "./components/EstimateComponent"; + +export const SampleModule = ({ stateCode, userType, tenants }) => { + const { path, url } = useRouteMatch(); + const tenantId = Digit.ULBService.getCurrentTenantId(); + const moduleCode = ["sample", "common", "workflow"]; + const language = Digit.StoreData.getCurrentLanguage(); + const { isLoading, data: store } = Digit.Services.useStore({ + stateCode, + moduleCode, + language, + }); + + if (isLoading) { + return ; + } + return ; +}; + +const componentsToRegister = { + SampleModule, + SampleCard, + ViewEstimatePage: ViewEstimateComponent, + SampleAdditionalComponent: AdditionalComponentWrapper, + SampleMultiComponent: SampleMultiComponent, + AddressComponent:AddressComponent, + EstimateComponent:EstimateComponent +}; + +export const initSampleComponents = () => { + overrideHooks(); + updateCustomConfigs(); + Object.entries(componentsToRegister).forEach(([key, value]) => { + Digit.ComponentRegistryService.setComponent(key, value); + }); +}; diff --git a/micro-ui/web/micro-ui-internals/packages/modules/sample/src/components/AdditionalComponent.js b/micro-ui/web/micro-ui-internals/packages/modules/sample/src/components/AdditionalComponent.js new file mode 100644 index 00000000000..d97544ed68c --- /dev/null +++ b/micro-ui/web/micro-ui-internals/packages/modules/sample/src/components/AdditionalComponent.js @@ -0,0 +1,145 @@ +import { AddNewIcon } from "@egovernments/digit-ui-components"; +import { AddIcon, Button, Dropdown, DustbinIcon, LabelFieldPair, TextInput } from "@egovernments/digit-ui-react-components"; +import React, { Fragment, useEffect, useState } from "react"; +import { useTranslation } from "react-i18next"; + +const AdditionalComponent = ({ onSelect, ...props }) => { + const { t } = useTranslation(); + // option for dropdown + const [options, setOptions] = useState([ + { + code: "ADHAAR", + name: "Adhaar", + }, + { + code: "PANCARD", + name: "Pan Card", + }, + { + code: "PASSPORT", + name: "Passport", + }, + ]); + + // state for storing data + const [documentData, setDocumentData] = useState([ + { + key: 1, + type: null, + value: null, + }, + ]); + + // fn to update the value based on type. + const handleUpdateField = ({ type, value, item, index }) => { + switch (type) { + case "TYPE": + setDocumentData((prev) => { + return prev?.map((i, n) => { + if (i.key === item.key) { + return { + ...i, + type: value?.code, + }; + } + return i; + }); + }); + break; + case "VALUE": + setDocumentData((prev) => { + return prev?.map((i, n) => { + if (i.key === item.key) { + return { + ...i, + value: value, + }; + } + return i; + }); + }); + break; + default: + break; + } + }; + + //fn to add more field + const add = () => { + setDocumentData((prev) => [ + ...prev, + { + key: prev?.length + 1, + value: null, + type: null, + }, + ]); + }; + //fn to delete field + const deleteItem = (data) => { + const fil = documentData.filter((i) => i.key !== data.key); + const up = fil.map((item, index) => ({ ...item, key: index + 1 })); + setDocumentData(up); + }; + + // when doc update calling onselect for update the value in formdata + useEffect(() => { + onSelect("additionalDetails", documentData); + }, [documentData]); + + return ( + <> + {documentData?.map((item, index) => ( +
+ {documentData?.length > 1 ? ( +
deleteItem(item, index)}> + +
+ ) : null} + +
+ {`${t("Document Type")}`} +
+ i.code === item?.type)} + select={(value) => { + handleUpdateField({ type: "TYPE", value: value, item: item, index: index }); + }} + /> +
+ +
+ {`${t("Document ID")}`} +
+ handleUpdateField({ type: "VALUE", value: event.target.value, item: item, index: index })} + /> +
+
+ ))} + + + )} + + ); +} + +export default ApplicationDetailsActionBar; diff --git a/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/components/ApplicationDetailsContent.js b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/components/ApplicationDetailsContent.js new file mode 100644 index 00000000000..5596d7b694b --- /dev/null +++ b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/components/ApplicationDetailsContent.js @@ -0,0 +1,484 @@ +import { + BreakLine, + Card, + CardSectionHeader, + CardSubHeader, + CheckPoint, + CollapseAndExpandGroups, + ConnectingCheckPoints, + ViewImages, + Loader, + Row, + StatusTable, + Table, +} from "@egovernments/digit-ui-react-components"; +import { values } from "lodash"; +import React, { Fragment, useCallback, useReducer, useState } from "react"; +import { useTranslation } from "react-i18next"; +import { Link } from "react-router-dom"; +import BPADocuments from "./BPADocuments"; +import InspectionReport from "./InspectionReport"; +import NOCDocuments from "./NOCDocuments"; +import PermissionCheck from "./PermissionCheck"; +import PropertyDocuments from "./PropertyDocuments"; +import PropertyEstimates from "./PropertyEstimates"; +import PropertyFloors from "./PropertyFloors"; +import PropertyOwners from "./PropertyOwners"; +import ScruntinyDetails from "./ScruntinyDetails"; +import SubOccupancyTable from "./SubOccupancyTable"; +import TLCaption from "./TLCaption"; +import TLTradeAccessories from "./TLTradeAccessories"; +import TLTradeUnits from "./TLTradeUnits"; +//import WSAdditonalDetails from "./WSAdditonalDetails"; +import WSFeeEstimation from "./WSFeeEstimation"; +//import WSInfoLabel from "../../../ws/src/pageComponents/WSInfoLabel"; +import DocumentsPreview from "./DocumentsPreview"; +import InfoDetails from "./InfoDetails"; +import ViewBreakup from "./ViewBreakup"; +import SubWorkTableDetails from "./SubWorkTableDetails"; + + + +function ApplicationDetailsContent({ + applicationDetails, + workflowDetails, + isDataLoading, + applicationData, + businessService, + timelineStatusPrefix, + showTimeLine = true, + statusAttribute = "status", + paymentsList, + oldValue, + isInfoLabel = false, + noBoxShadow = false, + sectionHeadStyle = false, + modify, + setSaveAttendanceState +}) { + const { t } = useTranslation(); + const [localSearchParams, setLocalSearchParams] = useState(() => ({})); + + + const handleDateRangeChange = useCallback((data) => { + setLocalSearchParams(() => ({ ...data })); + }, []); + + function OpenImage(imageSource, index, thumbnailsToShow) { + window.open(thumbnailsToShow?.fullImage?.[0], "_blank"); + } + + const convertEpochToDateDMY = (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 getTimelineCaptions = (checkpoint) => { + if (checkpoint.state === "OPEN" || (checkpoint.status === "INITIATED" && !window.location.href.includes("/obps/"))) { + const caption = { + date: convertEpochToDateDMY(applicationData?.auditDetails?.createdTime), + source: applicationData?.channel || "", + }; + return ; + } else if (window.location.href.includes("/obps/") || window.location.href.includes("/noc/") || window.location.href.includes("/ws/")) { + //From BE side assigneeMobileNumber is masked/unmasked with connectionHoldersMobileNumber and not assigneeMobileNumber + const privacy = { uuid: checkpoint?.assignes?.[0]?.uuid, fieldName: ["connectionHoldersMobileNumber"], model: "WaterConnectionOwner" }; + const caption = { + date: checkpoint?.auditDetails?.lastModified, + name: checkpoint?.assignes?.[0]?.name, + mobileNumber: + applicationData?.processInstance?.assignes?.[0]?.uuid === checkpoint?.assignes?.[0]?.uuid && + applicationData?.processInstance?.assignes?.[0]?.mobileNumber + ? applicationData?.processInstance?.assignes?.[0]?.mobileNumber + : checkpoint?.assignes?.[0]?.mobileNumber, + comment: t(checkpoint?.comment), + wfComment: checkpoint.wfComment, + thumbnailsToShow: checkpoint?.thumbnailsToShow, + }; + return ; + } else { + const caption = { + date: `${Digit.DateUtils?.ConvertTimestampToDate(checkpoint.auditDetails.lastModifiedEpoch)} ${Digit.DateUtils?.ConvertEpochToTimeInHours( + checkpoint.auditDetails.lastModifiedEpoch + )} ${Digit.DateUtils?.getDayfromTimeStamp(checkpoint.auditDetails.lastModifiedEpoch)}`, + // name: checkpoint?.assigner?.name, + name: checkpoint?.assignes?.[0]?.name, + // mobileNumber: checkpoint?.assigner?.mobileNumber, + wfComment: checkpoint?.wfComment, + mobileNumber: checkpoint?.assignes?.[0]?.mobileNumber, + }; + + return ; + } + }; + + const getTranslatedValues = (dataValue, isNotTranslated) => { + if (dataValue) { + return !isNotTranslated ? t(dataValue) : dataValue; + } else { + return t("NA"); + } + }; + + 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"); + let isWS = window.location.href.includes("employee/ws") || window.location.href.includes("employee/works")|| window.location.href.includes("employee/project") || window.location.href.includes("employee/estimate") ; + + + + const getRowStyles = (tab="") => { + + if (window.location.href.includes("employee/obps") || window.location.href.includes("employee/noc")) { + return { justifyContent: "space-between", fontSize: "16px", lineHeight: "19px", color: "#0B0C0C" }; + } else if (checkLocation) { + return { justifyContent: "space-between", fontSize: "16px", lineHeight: "19px", color: "#0B0C0C" }; + } + else if ( tab==="fieldSurvey") { + return { + justifyContent: "space-between", flexDirection:"column" + } + } + else { + return {}; + } + + }; + const getTextStyles = (tab="") => { + if ( tab==="fieldSurvey" ) { + return { + marginTop:"1rem", + marginBottom:"1rem" + } + } + else { + return {}; + } + + }; + const getLabelStyles = (tab = "") => { + if ( tab === "fieldSurvey") { + return { + width:"100%" + } + } + else { + return {}; + } + + }; + + const getTableStyles = () => { + if (window.location.href.includes("employee/obps") || window.location.href.includes("employee/noc")) { + return { position: "relative", marginTop: "19px" }; + } else if (checkLocation) { + return { position: "relative", marginTop: "19px" }; + } else { + return {}; + } + }; + + const getMainDivStyles = () => { + if ( + window.location.href.includes("employee/obps") || + window.location.href.includes("employee/noc") || + window.location.href.includes("employee/ws") || + window.location.href.includes("employee/works") || + window.location.href.includes("employee/contracts") + ) { + return { lineHeight: "19px", maxWidth: "950px", minWidth: "280px" }; + } else if (checkLocation) { + return { lineHeight: "19px", maxWidth: "600px", minWidth: "280px" }; + } else { + return {}; + } + }; + + 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 if (value?.value === "Approved") return { `${getTranslatedValues(value?.value, value?.isNotTranslated)}`} + else if (value?.value === "Rejected") return {t(value?.value)} + else return value?.value ? getTranslatedValues(value?.value, value?.isNotTranslated) : t("N/A"); + }; + + const getClickInfoDetails = () => { + if (window.location.href.includes("disconnection") || window.location.href.includes("application")) { + return "WS_DISCONNECTION_CLICK_ON_INFO_LABEL"; + } else { + return "WS_CLICK_ON_INFO_LABEL"; + } + }; + + const getClickInfoDetails1 = () => { + if (window.location.href.includes("disconnection") || window.location.href.includes("application")) { + return "WS_DISCONNECTION_CLICK_ON_INFO1_LABEL"; + } else { + return ""; + } + }; + + const getCardStyles = () => { + let styles = { position: "relative" } + if (noBoxShadow) styles = { ...styles, boxShadow: "none" }; + return styles; + }; + + return ( + + + {isInfoLabel ? ( + + ) : 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,index)=>{ + if(index===detail?.tableRows.length - 1){ + return <> +
+ + {row.map(element => )} + + + } + return + {row.map(element => )} + })} +
{t(header)}
{t(element)}
{t(element)}
+ )} */} + {detail?.isTable && } + + + {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={getRowStyles()} + /> + ); + } + return ( + { }} />: getTextValue(value)} + last={index === detail?.values?.length - 1} + caption={value.caption} + className="border-none" + /* privacy object set to the Row Component */ + privacy={value?.privacy} + // TODO, Later will move to classes + rowContainerStyle={getRowStyles(detail?.tab)} + textStyle={getTextStyles(detail?.tab)} + labelStyle={getLabelStyles(detail?.tab)} + /> + ); + })} + + + + + {detail?.additionalDetails?.table + ? detail?.additionalDetails?.table?.weekTable?.tableHeader && ( + <> + + {t(detail?.additionalDetails?.table?.weekTable?.tableHeader)} + + + ) + : null} + + {detail?.additionalDetails?.inspectionReport && ( + + )} + {applicationDetails?.applicationData?.additionalDetails?.fieldinspection_pending?.length > 0 && detail?.additionalDetails?.fiReport && ( + + )} + {/* {detail?.additionalDetails?.FIdocuments && detail?.additionalDetails?.values?.map((doc,index) => ( +
+ {doc.isNotDuplicate &&
+ + + +
+
+
} +
+ )) } */} + {detail?.additionalDetails?.floors && } + {detail?.additionalDetails?.owners && } + {detail?.additionalDetails?.units && } + {detail?.additionalDetails?.accessories && } + {detail?.additionalDetails?.permissions && workflowDetails?.data?.nextActions?.length > 0 && ( + + )} + {detail?.additionalDetails?.obpsDocuments && ( + + )} + {detail?.additionalDetails?.noc && ( + + )} + {detail?.additionalDetails?.scruntinyDetails && } + {detail?.additionalDetails?.buildingExtractionDetails && } + {detail?.additionalDetails?.subOccupancyTableDetails && ( + + )} + {detail?.additionalDetails?.documentsWithUrl && } + {detail?.additionalDetails?.documents && } + {detail?.additionalDetails?.taxHeadEstimatesCalculation && ( + + )} + {/* {detail?.isWaterConnectionDetails && } */} + {detail?.additionalDetails?.redirectUrl && ( +
+ + + {detail?.additionalDetails?.redirectUrl?.title} + + +
+ )} + {detail?.additionalDetails?.estimationDetails && } + {detail?.additionalDetails?.estimationDetails && } +
+
+ ))} + {showTimeLine && workflowDetails?.data?.timeline?.length > 0 && ( + + {workflowDetails?.breakLineRequired === undefined ? : workflowDetails?.breakLineRequired ? : null} + {(workflowDetails?.isLoading || isDataLoading) && } + {!workflowDetails?.isLoading && !isDataLoading && ( + + + {/* {t("ES_APPLICATION_DETAILS_APPLICATION_TIMELINE")} */} + {t("WORKS_WORKFLOW_HISTORY")} + + {workflowDetails?.data?.timeline && workflowDetails?.data?.timeline?.length === 1 ? ( + + ) : ( + + {workflowDetails?.data?.timeline && + workflowDetails?.data?.timeline.map((checkpoint, index, arr) => { + return ( + + + + ); + })} + + )} + + )} + + )} +
+
+ ); +} + +export default ApplicationDetailsContent; diff --git a/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/components/ApplicationDetailsToast.js b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/components/ApplicationDetailsToast.js new file mode 100644 index 00000000000..9540495f32a --- /dev/null +++ b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/components/ApplicationDetailsToast.js @@ -0,0 +1,74 @@ +import React from "react"; +import { Toast } from "@egovernments/digit-ui-react-components"; + +function ApplicationDetailsToast({ t, showToast, closeToast, businessService }) { + if (businessService?.includes("NewTL") || businessService?.includes("TL") || businessService?.includes("EDITRENEWAL")) { + let label = ""; + switch (showToast?.action?.action) { + case "SENDBACK": + label = showToast?.key === "error" ? showToast?.error?.message : t("TL_SENDBACK_CHECKLIST_MESSAGE_HEAD"); + break; + case "FORWARD": + label = showToast?.key === "error" ? showToast?.error?.message : t("TL_FORWARD_SUCCESS_MESSAGE_MAIN"); + break; + case "APPROVE": + label = showToast?.key === "error" ? showToast?.error?.message : t("TL_APPROVAL_CHECKLIST_MESSAGE_HEAD"); + break; + case "SENDBACKTOCITIZEN": + label = showToast?.key === "error" ? showToast?.error?.message : t("TL_SENDBACK_TOCITIZEN_CHECKLIST_MESSAGE_HEAD"); + break; + case "REJECT": + label = showToast?.key === "error" ? showToast?.error?.message : t("TL_APPROVAL_REJ_MESSAGE_HEAD"); + break; + case "RESUBMIT": + label = showToast?.key === "error" ? showToast?.error?.message : t("TL_APPLICATION_RESUBMIT_SUCCESS_MESSAGE_MAIN"); + break; + case "CANCEL": + label = showToast?.key === "error" ? showToast?.error?.message : t("TL_TL_CANCELLED_MESSAGE_HEAD"); + break; + default: + label = showToast?.key === "error" ? showToast?.error?.message : t(`ES_${businessService}_${showToast?.action?.action}_UPDATE_SUCCESS`); + } + return {showToast && }; + } else if (businessService?.includes("BPA") || businessService?.includes("BPA_LOW") || businessService?.includes("BPA_OC")) { + const getMessage = (messages = []) => { + let returnValue = messages[0]; + if(messages?.length == 2) returnValue = businessService?.includes("BPA_OC") ? t(messages[1]) : t(messages [0]); + else returnValue = t(messages[0]); + return returnValue; + } + let label = ""; + switch (showToast?.action?.action) { + case "REVOCATE": + label = showToast?.key === "error" ? showToast?.error?.message : getMessage(["BPA_APPROVAL_REVOCATED_MESSAGE_HEAD", "BPA_APPROVAL_OC_REVOCATED_MESSAGE_HEAD"]); + break; + case "VERIFY_AND_FORWARD": + label = showToast?.key === "error" ? showToast?.error?.message : getMessage(["BPA_FORWARD_SUCCESS_MESSAGE_MAIN"]); + break; + case "SEND_BACK_TO_CITIZEN": + label = showToast?.key === "error" ? showToast?.error?.message : getMessage(["BPA_SENDBACK_SUCCESS_MESSAGE_MAIN"]); + break; + case "APPROVE": + label = showToast?.key === "error" ? showToast?.error?.message : getMessage(["BPA_APPROVAL_CHECKLIST_MESSAGE_HEAD"]); + break; + case "REJECT": + label = showToast?.key === "error" ? showToast?.error?.message : getMessage(["BPA_APPROVAL_REJECTED_MESSAGE_HEAD", "BPA_OC_APPROVAL_REJECTED_MESSAGE_HEAD"]); + break; + case "FORWARD": + label = showToast?.key === "error" ? showToast?.error?.message : getMessage(["BPA_FORWARD_SUCCESS_MESSAGE_MAIN"]); + break; + case "SEND_BACK_FOR_DOCUMENT_VERIFICATION": + case "SEND_BACK_FOR_FIELD_INSPECTION": + label = showToast?.key === "error" ? showToast?.error?.message : getMessage(["BPA_SENDBACK_SUCCESS_MESSAGE_MAIN"]); + break; + default: + label = showToast?.key === "error" ? showToast?.error?.message : t(`ES_${businessService}_${showToast?.action?.action}_UPDATE_SUCCESS`); + } + return {showToast && }; + } else { + const label = showToast?.key === "error" ? showToast?.error?.message : `ES_${businessService}_${showToast?.action?.action}_UPDATE_SUCCESS`; + return {showToast && }; + } +} + +export default ApplicationDetailsToast; diff --git a/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/components/ApplicationDetailsWarningPopup.js b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/components/ApplicationDetailsWarningPopup.js new file mode 100644 index 00000000000..e95b9e038cd --- /dev/null +++ b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/components/ApplicationDetailsWarningPopup.js @@ -0,0 +1,54 @@ +import { Card, ButtonSelector, CardText, CardSubHeader, Modal, CardSectionHeader, Row } from "@egovernments/digit-ui-react-components"; +import React from "react"; +import { useTranslation } from "react-i18next"; + +const Close = () => ( + + + + + ); + +const CloseBtn = (props) => { + return ( +
+ +
+ ); + }; + +function ApplicationDetailsWarningPopup({ action,workflowDetails,businessService,isWarningPop,closeWarningPopup }) { +const { t } = useTranslation(); +const isMobile = window.Digit.Utils.browser.isMobile(); +return ( + + {t("PT_DUES_ARE_PENDING")}} + headerBarEnd={ + { + closeWarningPopup(); + }} + /> + } + hideSubmit={true} + isDisabled={false} + popupStyles={isMobile ? {} : { width: "29%", marginTop: "auto" }} + > + +
+

{t("PT_YOU_HAVE")} ₹{action?.AmountDueForPay} {t("PT_DUE_WARNING_MSG2")}

+
+ +
+ + window.location.assign(`${window.location.origin}${action?.redirectionUrl?.pathname}`)} style={{ marginLeft: "10px" }} /> +
+
+
+ ) +
+) +} + +export default ApplicationDetailsWarningPopup; \ No newline at end of file diff --git a/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/components/BPADocuments.js b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/components/BPADocuments.js new file mode 100644 index 00000000000..9a1febe081b --- /dev/null +++ b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/components/BPADocuments.js @@ -0,0 +1,234 @@ +import React, { useEffect, useState } from "react"; +import { + CardLabel, + Dropdown, + LabelFieldPair, + MultiUploadWrapper, + CardSubHeader +} from "@egovernments/digit-ui-react-components"; +import DocumentsPreview from "./DocumentsPreview"; + +const BPADocuments = ({ t, formData, applicationData, docs, bpaActionsDetails }) => { + const applicationStatus = applicationData?.status || ""; + const actions = bpaActionsDetails?.data?.nextActions || []; + const stateId = Digit.ULBService.getStateId(); + const [documents, setDocuments] = useState(formData?.documents?.documents || []); + const [error, setError] = useState(null); + const [bpaTaxDocuments, setBpaTaxDocuments] = useState([]); + const [enableSubmit, setEnableSubmit] = useState(true) + const [checkRequiredFields, setCheckRequiredFields] = useState(false); + const [checkEnablingDocs, setCheckEnablingDocs] = useState(false); + + const { isLoading: bpaDocsLoading, data: bpaDocs } = Digit.Hooks.obps.useMDMS(stateId, "BPA", ["DocTypeMapping"]); + const { isLoading: commonDocsLoading, data: commonDocs } = Digit.Hooks.obps.useMDMS(stateId, "common-masters", ["DocumentType"]); + + useEffect(() => { + let filtredBpaDocs = []; + if (bpaDocs?.BPA?.DocTypeMapping) { + // filtredBpaDocs = bpaDocs?.BPA?.DocTypeMapping?.filter(data => (data.WFState == "INPROGRESS")) + filtredBpaDocs = bpaDocs?.BPA?.DocTypeMapping?.filter(data => (data.WFState == applicationData?.status ? applicationData?.status : "INPROGRESS" && data.RiskType == applicationData?.riskType && data.ServiceType == applicationData?.additionalDetails?.serviceType && data.applicationType == applicationData?.additionalDetails?.applicationType)) + } + let documentsList = []; + filtredBpaDocs?.[0]?.docTypes?.forEach(doc => { + let code = doc.code; doc.dropdownData = []; doc.uploadedDocuments = []; + commonDocs?.["common-masters"]?.DocumentType?.forEach(value => { + let values = value.code.slice(0, code.length); + if (code === values) { + doc.hasDropdown = true; + value.i18nKey = value.code; + doc.dropdownData.push(value); + } + }); + doc.uploadedDocuments[0] = {}; + doc.uploadedDocuments[0].values = []; + docs?.[0]?.values?.map(upDocs => { + if (code === `${upDocs?.documentType?.split('.')[0]}.${upDocs?.documentType?.split('.')[1]}`) { + doc.uploadedDocuments[0].values.push(upDocs) + } + }) + documentsList.push(doc); + }); + sessionStorage.setItem("BPA_DOCUMENTS", JSON.stringify(documentsList)); + setBpaTaxDocuments(documentsList); + + }, [!bpaDocsLoading, !commonDocsLoading]); + + useEffect(() => { + let count = 0; + bpaTaxDocuments.map(doc => { + let isRequired = false; + documents.map(data => { + if (doc.required && doc.code == `${data.documentType.split('.')[0]}.${data.documentType.split('.')[1]}`) { + isRequired = true; + } + }); + if (!isRequired && doc.required) { + count = count + 1; + } + }); + if ((count == "0" || count == 0) && documents.length > 0) setEnableSubmit(false); + else setEnableSubmit(true); + }, [documents, checkRequiredFields]) + + useEffect(() => { + if ( applicationStatus === "DOC_VERIFICATION_INPROGRESS" && actions?.length > 0 ) setCheckEnablingDocs(true); + else setCheckEnablingDocs(false); + }, [applicationData, bpaActionsDetails]) + + return ( +
+ {bpaTaxDocuments?.map((document, index) => { + return ( +
+ +
+ ); + })} +
+ ); +} + +function SelectDocument({ + t, + document: doc, + setDocuments, + error, + setError, + documents, + setCheckRequiredFields, + index, + applicationStatus, + actions, + bpaTaxDocuments, + checkEnablingDocs +}) { + + const filteredDocument = documents?.filter((item) => item?.documentType?.includes(doc?.code))[0]; + const tenantId = Digit.ULBService.getStateId(); + const [selectedDocument, setSelectedDocument] = useState( + filteredDocument + ? { ...filteredDocument, active: true, code: filteredDocument?.documentType, i18nKey: filteredDocument?.documentType } + : doc?.dropdownData?.length === 1 + ? doc?.dropdownData[0] + : {} + ); + const [file, setFile] = useState(null); + const [uploadedFile, setUploadedFile] = useState(() => filteredDocument?.fileStoreId || null); + const [selectArrayFiles, SetSelectArrayFiles] = useState([]); + const handleSelectDocument = (value) => setSelectedDocument(value); + const allowedFileTypes = /(.*?)(jpg|jpeg|png|image|pdf)$/i; + + function selectfiles(e) { + e && setFile(e.file); + } + + + useEffect(() => { + if (selectedDocument?.code) { + setDocuments((prev) => { + const filteredDocumentsByDocumentType = prev?.filter((item) => item?.documentType !== selectedDocument?.code); + if (uploadedFile?.length === 0 || uploadedFile === null) return filteredDocumentsByDocumentType; + const filteredDocumentsByFileStoreId = filteredDocumentsByDocumentType?.filter((item) => item?.fileStoreId !== uploadedFile); + return [ + ...filteredDocumentsByFileStoreId, + { + documentType: selectedDocument?.code, + fileStoreId: uploadedFile, + documentUid: uploadedFile, + fileName: file?.name || "", + id: documents ? documents.find(x => x.documentType === selectedDocument?.code)?.id : undefined, + }, + ]; + }); + } + }, [uploadedFile, selectedDocument]); + + useEffect(() => { + (async () => { + if (selectArrayFiles.length > 0) { + sessionStorage.removeItem("BPA_DOCUMENTS"); + doc.newUploadedDocs = []; + selectArrayFiles.map(newDoc => { + if (selectedDocument?.code) { + doc.newUploadedDocs.push({ + documentType: selectedDocument?.code, + fileStoreId: newDoc?.fileStoreId?.fileStoreId, + documentUid: newDoc?.fileStoreId?.fileStoreId, + tenantId: newDoc?.fileStoreId?.tenantId + }); + } + }) + bpaTaxDocuments[index] = doc; + sessionStorage.setItem("BPA_DOCUMENTS", JSON.stringify(bpaTaxDocuments)); + } + })(); + }, [selectArrayFiles, selectedDocument]); + + useEffect(() => { + (async () => { + + })(); + }, [file]); + + const getData = (index, state) => { + let data = Object.fromEntries(state); + let newArr = Object.values(data); + if (Object.keys(data).length !== 0) SetSelectArrayFiles(newArr); + selectfiles(newArr[newArr.length - 1]); + } + + return ( +
+ {`${t(doc?.code)}`} + {doc?.uploadedDocuments?.length && } + { + checkEnablingDocs ? +
+ + {doc?.required ? `${t(doc?.code)}* ` : `${t(doc?.code)}`} + + + + +
+ getData(index, e)} + t={t} + allowedFileTypesRegex={allowedFileTypes} + allowedMaxSizeInMB={5} + acceptFiles= "image/*, .pdf, .png, .jpeg, .jpg" + /> +
+
+
: null + } +
+ ); +} + +export default BPADocuments; diff --git a/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/components/DocumentsPreview.js b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/components/DocumentsPreview.js new file mode 100644 index 00000000000..dfd57683def --- /dev/null +++ b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/components/DocumentsPreview.js @@ -0,0 +1,49 @@ +import React from "react"; +import { useTranslation } from "react-i18next"; +import { CardSubHeader, PDFSvg } from "@egovernments/digit-ui-react-components"; + +function DocumentsPreview({ documents, svgStyles = {}, isSendBackFlow = false, isHrLine = false, titleStyles }) { + const { t } = useTranslation(); + const isStakeholderApplication = window.location.href.includes("stakeholder"); + + return ( +
+ {!isStakeholderApplication && documents?.map((document, index) => ( + + {document?.title ? {t(document?.title)} : null} +
+ {document?.values && document?.values.length > 0 ? document?.values?.map((value, index) => ( + +
+ +
+

{t(value?.title)}

+ {isSendBackFlow ? value?.documentType?.includes("NOC") ?

{t(value?.documentType.split(".")[1])}

:

{t(value?.documentType)}

: ""} +
+ )) : !(window.location.href.includes("citizen")) &&

{t("BPA_NO_DOCUMENTS_UPLOADED_LABEL")}

} +
+ {isHrLine && documents?.length != index + 1 ?
: null} +
+ ))} + {isStakeholderApplication && documents?.map((document, index) => ( + + {document?.title ? {t(document?.title)} : null} +
+ {document?.values && document?.values.length > 0 ? document?.values?.map((value, index) => ( + +
+

{t(value?.title)}

+ {value?.docInfo ?
{`${t(value?.docInfo)}`}
: null} + +

{`${t(value?.title)}`}

+
+
+ )) : !(window.location.href.includes("citizen")) &&

{t("BPA_NO_DOCUMENTS_UPLOADED_LABEL")}

} +
+
+ ))} +
+ ); +} + +export default DocumentsPreview; diff --git a/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/components/InfoDetails.js b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/components/InfoDetails.js new file mode 100644 index 00000000000..12e2f64fac6 --- /dev/null +++ b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/components/InfoDetails.js @@ -0,0 +1,34 @@ +import React from "react"; +import { InfoBannerIcon } from "@egovernments/digit-ui-react-components"; + +const EyeSvgINdex = ({ style }) => { + return + + + + + +} +const InfoDetails = ({ t, userType = false, infoBannerLabel = "", infoClickLable = "", infoClickInfoLabel = "", infoClickInfoLabel1 = "" }) => { + userType = userType || Digit.SessionStorage.get("userType"); + return ( + +
+
+
+ +

{t(infoBannerLabel)}

+
+ {`${t(infoClickLable)} `} + + {` ${t(infoClickInfoLabel)}`} +
+ {` ${t(infoClickInfoLabel1)}`} +
+
+
+
+ ); +}; + +export default InfoDetails; \ No newline at end of file diff --git a/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/components/InspectionReport.js b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/components/InspectionReport.js new file mode 100644 index 00000000000..a824b05a435 --- /dev/null +++ b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/components/InspectionReport.js @@ -0,0 +1,49 @@ +import { StatusTable, Row, CardHeader, CardSectionHeader } from "@egovernments/digit-ui-react-components"; +import React from "react"; +import { useTranslation } from "react-i18next"; +import DocumentsPreview from "./DocumentsPreview"; + +const getDocuments = (fiDocuments) => { + const returnDocuments = [{ + title: "BPA_DOCUMENT_DETAILS_LABEL", + values: fiDocuments?.map(doc => ({ + title: doc?.documentType?.replaceAll('.', '_'), + documentType: doc?.documentType, + documentUid: doc?.documentUid, + fileStoreId: doc?.fileStoreId, + id: doc?.id, + url: doc?.url + })) + }]; + return returnDocuments; +}; + +function InspectionReport({ fiReport, isCitizen=false }) { + const { t } = useTranslation(); + + return ( + +
+ {isCitizen?{`${t(`BPA_FI_REPORT`)}`}: + {`${t(`BPA_FI_REPORT`)}`}} + {fiReport.map((fiData, index) => +
+ + {fiReport?.length == 1 ? `${t(`BPA_FI_REPORT`)}` : `${t(`BPA_FI_REPORT`)} - ${index + 1}`} + + + {fiData?.questions?.length && + fiData?.questions?.map((qstn) => +
+ + +
)} + +
+
)} +
+
+ ); +} + +export default InspectionReport; diff --git a/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/components/NOCDocuments.js b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/components/NOCDocuments.js new file mode 100644 index 00000000000..1581744f756 --- /dev/null +++ b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/components/NOCDocuments.js @@ -0,0 +1,202 @@ +import React, { useEffect, useState } from "react"; +import { + CardLabel, + MultiUploadWrapper, + StatusTable, + Row, + LabelFieldPair +} from "@egovernments/digit-ui-react-components"; +import DocumentsPreview from "./DocumentsPreview"; + +function SelectDocument({ + t, + document: doc, + setNocDocuments, + setError, + nocDocuments +}) { + const filteredDocument = nocDocuments?.filter((item) => item?.documentType?.includes(doc?.code))[0]; + const tenantId = Digit.ULBService.getStateId(); + const [selectedDocument, setSelectedDocument] = useState(); + const [file, setFile] = useState(null); + const [uploadedFile, setUploadedFile] = useState(() => filteredDocument?.fileStoreId || null); + const handleSelectDocument = (value) => setSelectedDocument(value); + const allowedFileTypes = /(.*?)(jpg|jpeg|png|image|pdf)$/i; + + function selectfile(e) { + e && setFile(e.file); + } + + useEffect(() => { + if (doc?.dropdownData?.[0]?.code) { + setNocDocuments((prev) => { + const filteredDocumentsByDocumentType = prev?.filter((item) => item?.documentType !== doc?.dropdownData?.[0]?.code); + + if (uploadedFile?.length === 0 || uploadedFile === null) { + return filteredDocumentsByDocumentType; + } + + const filteredDocumentsByFileStoreId = filteredDocumentsByDocumentType?.filter((item) => item?.fileStoreId !== uploadedFile); + return [ + ...filteredDocumentsByFileStoreId, + { + documentType: doc?.dropdownData?.[0].code, + fileStoreId: uploadedFile, + documentUid: uploadedFile, + fileName: file?.name || "", + }, + ]; + }); + } + }, [uploadedFile]); + + + useEffect(() => { + (async () => { + setError(null); + if (file) { + const allowedFileTypesRegex = /(.*?)(jpg|jpeg|png|image|pdf)$/i + if (file.size >= 5242880) { + setError(t("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED")); + } else if (file?.type && !allowedFileTypesRegex.test(file?.type)) { + setError(t(`NOT_SUPPORTED_FILE_TYPE`)) + } else { + try { + setUploadedFile(null); + const response = await Digit.UploadServices.Filestorage("PT", file, Digit.ULBService.getStateId()); + 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 getData =(state) => { + let data = Object.fromEntries(state); + let newArr = Object.values(data); + selectfile(newArr[newArr.length-1]); + } + + return ( +
+ + {doc?.required ? `${t("TL_BUTTON_UPLOAD FILE")}*` : `${t("TL_BUTTON_UPLOAD FILE")}`} +
+ getData(e)} + t={t} + allowedFileTypesRegex={allowedFileTypes} + allowedMaxSizeInMB={5} + acceptFiles="image/*, .pdf, .png, .jpeg, .jpg" + /> +
+
+
+ ); +} +const NOCDocuments = ({ t, noc, docs, isNoc, applicationData,NOCdata, bpaActionsDetails }) => { + const tenantId = Digit.ULBService.getStateId(); + const stateId = Digit.ULBService.getStateId(); + const bpaApplicationStatus = applicationData?.status || ""; + const actions = bpaActionsDetails?.data?.nextActions || []; + const { isLoading: nocDocsLoading, data: nocDocs } = Digit.Hooks.obps.useMDMS(stateId, "NOC", ["DocumentTypeMapping"], { enabled: isNoc }); + const { isLoading: bpaDocsLoading, data: bpaDocs } = Digit.Hooks.obps.useMDMS(stateId, "BPA", ["DocTypeMapping"], { enabled: !isNoc }); + const { isLoading: commonDocsLoading, data: commonDocs } = Digit.Hooks.obps.useMDMS(stateId, "common-masters", ["DocumentType"]); + const [commonDocMaping, setCommonDocMaping] = useState([]); + const [nocTaxDocuments, setNocTaxDocuments] = useState([]); + const [checkEnablingDocs, setCheckEnablingDocs] = useState(false); + const [nocDocuments, setNocDocuments] = Digit.Hooks.useSessionStorage(noc?.nocType, []); + const [error, setError] = useState(null); + const isEmployee = window.location.href.includes("/employee/") + + useEffect(() => { + setCommonDocMaping(commonDocs?.["common-masters"]?.DocumentType); + }, [commonDocs]); + + useEffect(() => { + let documents = []; + let filteredData + if (isNoc) { + filteredData = nocDocs?.NOC?.DocumentTypeMapping?.filter((data => { + return data?.applicationType === noc?.applicationType && data?.nocType === noc?.nocType + })); + } + else { + filteredData = bpaDocs?.BPA?.DocTypeMapping?.filter(data => (data.WFState == applicationData?.status && data.RiskType == applicationData?.riskType && data.ServiceType == applicationData?.additionalDetails?.serviceType && data.applicationType == applicationData?.additionalDetails?.applicationType)) + } + if (filteredData?.[0]?.docTypes?.[0]) { + filteredData[0].docTypes[0].nocType = filteredData[0].nocType; + filteredData[0].docTypes[0].additionalDetails = { + submissionDetails: noc?.additionalDetails, + applicationStatus: noc?.applicationStatus, + appNumberLink: noc?.applicationNo, + nocNo: noc?.nocNo + } + documents.push(filteredData[0].docTypes[0]); + } + let documentsList = []; + if (documents && documents.length > 0) { + documents.map((doc) => { + let code = doc.documentType; + let nocType = doc.nocType; + doc.dropdownData = []; + commonDocMaping?.forEach((value) => { + let values = value.code.slice(0, code?.length); + if (code === values) { + doc.hasDropdown = true; + doc.dropdownData.push(value); + } + }); + documentsList.push(doc); + }); + setNocTaxDocuments(documentsList); + } + }, [nocDocs, commonDocMaping]); + + useEffect(() => { + if (bpaApplicationStatus === 'NOC_VERIFICATION_INPROGRESS' && actions?.length > 0) setCheckEnablingDocs(true); + else setCheckEnablingDocs(false); + }, [applicationData, bpaActionsDetails]) + + return ( +
+ + + {NOCdata && NOCdata.map((noc,index) => { + if (noc?.value) { + if (noc?.field == "STATUS") { + return + } else { + return + } + } + })} + + + {checkEnablingDocs && nocTaxDocuments?.map((document, index) => { + return ( + + ); + })} +
+ ); +} + +export default NOCDocuments; \ No newline at end of file diff --git a/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/components/PermissionCheck.js b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/components/PermissionCheck.js new file mode 100644 index 00000000000..89007789722 --- /dev/null +++ b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/components/PermissionCheck.js @@ -0,0 +1,87 @@ +import { CheckBox, LinkButton, TextInput,Close, CardSubHeader } from "@egovernments/digit-ui-react-components"; +import React, { useEffect, useState } from "react"; + +const PermissionCheck = ({ permissions, t }) => { + const [approvalChecks, setApprovalChecks, clearApprovals] = Digit.Hooks.useSessionStorage("OBPS_APPROVAL_CHECKS", permissions?.map(permission => ({ label: permission, checked: false }))); //useState(() => permissions?.map(permission => ({ label: permission, checked: false }))) + const [newApprovals, setNewApprovals, clearNewApprovals] = Digit.Hooks.useSessionStorage('OBPS_NEW_APPROVALS', []); + + useEffect(() => { + return () => { + Digit.SessionStorage.del("OBPS_NEW_APPROVALS"); + Digit.SessionStorage.del("OBPS_APPROVAL_CHECKS"); + } + }, []) + + const handleAdd = () => { + setNewApprovals([...newApprovals, { label: '' }]); + } + + const handleRemove = (index) => { + const values = [...newApprovals]; + values.splice(index, 1); + setNewApprovals([...values]); + } + + const handleChange = (event, index) => { + setNewApprovals(() => { + return newApprovals?.map((approval, id) => { + if (index === id) { + return { + label: event?.target?.value, + } + } + return approval; + }) + }) + } + + const handleCheck = (event, label, index) => { + const isChecked = event.target.checked; + setApprovalChecks(() => { + return approvalChecks?.map((approval, id) => { + if (index === id) { + return { + ...approval, + checked: isChecked + } + } + return approval; + }) + }) + } + + return ( +
+ {t("BPA_PERMIT_CONDITIONS")} + {approvalChecks?.map((permission, index) => ( + handleCheck(event, permission?.label, index))} + isLabelFirst={true} + index={index} + /> + ))} + {newApprovals?.map((approval, index) => ( +
handleChange(event, index)} textInputStyle={{maxWidth: "830px", width: "830px"}} placeholder={"Enter permit conditions.........."} /> + { + + + +
+ } + style={{ }} + onClick={(e) => handleRemove(index)} + />} +
+ ))} + + + ) +} + +export default PermissionCheck; \ No newline at end of file diff --git a/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/components/PropertyDocuments.js b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/components/PropertyDocuments.js new file mode 100644 index 00000000000..ea8cd1eb104 --- /dev/null +++ b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/components/PropertyDocuments.js @@ -0,0 +1,83 @@ +import React, { useState, useEffect } from "react"; +import { useTranslation } from "react-i18next"; +import { CardSubHeader, PDFSvg } from "@egovernments/digit-ui-react-components"; + +// const PDFSvg = ({ width = 34, height = 34, style, viewBox = "0 0 34 34" }) => ( +// +// +// +// ); + +function PropertyDocuments({ documents, svgStyles = {}, isSendBackFlow=false }) { + const { t } = useTranslation(); + const [filesArray, setFilesArray] = useState(() => [] ); + const tenantId = Digit.ULBService.getCurrentTenantId(); + const [pdfFiles, setPdfFiles] = useState({}); + + useEffect(() => { + let acc = []; + documents?.forEach((element, index, array) => { + acc = [...acc, ...(element.values?element.values:[])]; + }); + setFilesArray(acc?.map((value) => value?.fileStoreId)); + }, [documents]); + + useEffect(() => { + if (filesArray?.length && documents?.[0]?.BS === "BillAmend") { + Digit.UploadServices.Filefetch(filesArray, Digit.ULBService.getCurrentTenantId()).then((res) => { + setPdfFiles(res?.data); + }); + } + else if(filesArray?.length) + { + Digit.UploadServices.Filefetch(filesArray, Digit.ULBService.getStateId()).then((res) => { + setPdfFiles(res?.data); + }); + } + + }, [filesArray]); + + const checkLocation = window.location.href.includes("employee/tl") || window.location.href.includes("/obps") || window.location.href.includes("employee/ws"); + const isStakeholderApplication = window.location.href.includes("stakeholder"); + + return ( +
+ {!isStakeholderApplication && documents?.map((document, index) => ( + + {document?.title ? {t(document?.title)}: null} +
+ {document?.values && document?.values.length>0 ? document?.values?.map((value, index) => ( + +
+ +
+

{t(value?.title)}

+ {isSendBackFlow? value?.documentType?.includes("NOC")?

{t(value?.documentType.split(".")[1])}

:

{t(value?.documentType)}

:""} +
+ )):!(window.location.href.includes("citizen"))&&

{t("BPA_NO_DOCUMENTS_UPLOADED_LABEL")}

} +
+
+ ))} + {isStakeholderApplication && documents?.map((document, index) => ( + + {document?.title ? {t(document?.title)} : null} +
+ {document?.values && document?.values.length>0 ? document?.values?.map((value, index) => ( + +
+

{t(value?.title)}

+ {value?.docInfo ?
{`${t(value?.docInfo)}`}
: null} + + {/*
{decodeURIComponent(pdfFiles[value.fileStoreId]?.split(",")[0].split("?")[0].split("/").pop().slice(13))}
*/} +

{`${t(value?.title)}`}

+
+
+ )):!(window.location.href.includes("citizen"))&&

{t("BPA_NO_DOCUMENTS_UPLOADED_LABEL")}

} +
+
+ ))} +
+ ); +} + +export default PropertyDocuments; diff --git a/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/components/PropertyEstimates.js b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/components/PropertyEstimates.js new file mode 100644 index 00000000000..c4cde76709f --- /dev/null +++ b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/components/PropertyEstimates.js @@ -0,0 +1,39 @@ +import React from "react"; +import { useTranslation } from "react-i18next"; +import { StatusTable, Row, BreakLine } from "@egovernments/digit-ui-react-components"; + +function PropertyEstimates({ taxHeadEstimatesCalculation }) { + const { taxHeadEstimates } = taxHeadEstimatesCalculation; + const { t } = useTranslation(); + + return ( +
+ + + + {taxHeadEstimates?.map((estimate, index) => { + return ( + + ); + })} + + + +
+ ); +} + +export default PropertyEstimates; diff --git a/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/components/PropertyFloors.js b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/components/PropertyFloors.js new file mode 100644 index 00000000000..4f33bbdcff4 --- /dev/null +++ b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/components/PropertyFloors.js @@ -0,0 +1,49 @@ +import React from "react"; +import { useTranslation } from "react-i18next"; +import { CardSubHeader, StatusTable, Row, CardSectionHeader } from "@egovernments/digit-ui-react-components"; + +function PropertyFloors({ floors }) { + const { t } = useTranslation(); + + return ( + + {floors.map((floor) => ( +
+ {t(floor?.title)} + {floor?.values?.map((value, index) => { + return ( + + + {t(value.title)} + + +
+ {value?.values?.map((value, index) => { + if (value.map === true && value.value !== "N/A") { + return } />; + } + return ( + + ); + })} +
+
+
+ ); + })} +
+ ))} +
+ ); +} + +export default PropertyFloors; diff --git a/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/components/PropertyOwners.js b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/components/PropertyOwners.js new file mode 100644 index 00000000000..dac9f41c79b --- /dev/null +++ b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/components/PropertyOwners.js @@ -0,0 +1,94 @@ +import { CardSubHeader, Row, StatusTable } from "@egovernments/digit-ui-react-components"; +import React from "react"; +import { useTranslation } from "react-i18next"; + +function PropertyOwners({ owners }) { + const { t } = useTranslation(); + + const checkLocation = true; + const checkOwnerLength = owners?.length || 1; + let cardStyles = { marginTop: "19px" }; + let statusTableStyles = { position: "relative", padding: "8px" }; + let rowContainerStyle = { justifyContent: "space-between", fontSize: "16px", lineHeight: "19px", color: "#0B0C0C" }; + if (checkLocation && Number(checkOwnerLength) > 1) { + cardStyles = { + marginTop: "19px", + background: "#FAFAFA", + border: "1px solid #D6D5D4", + borderRadius: "4px", + padding: "8px", + lineHeight: "19px", + maxWidth: "600px", + minWidth: "280px", + }; + } else if (checkLocation && !(Number(checkOwnerLength) > 1)) { + cardStyles = { marginTop: "19px", lineHeight: "19px", maxWidth: "600px", minWidth: "280px" }; + statusTableStyles = { position: "relative", marginTop: "19px" }; + } + + if (window.location.href.includes("obps")) { + cardStyles = { ...cardStyles, maxWidth: "950px" }; + cardStyles = { ...cardStyles, maxWidth: "950px" }; + rowContainerStyle = {}; + } + + return ( + + {owners.map((owner, index) => ( +
+ {/* TODO, Later will move to classes */} + 1 + ? { marginBottom: "8px", paddingBottom: "9px", color: "#0B0C0C", fontSize: "16px", lineHeight: "19px" } + : { marginBottom: "8px", color: "#505A5F", fontSize: "24px" } + } + > + {checkLocation && Number(checkOwnerLength) > 1 ? `${t(owner?.title)} ${index + 1}` : t(owner?.title)} + + + +
+ {owner?.values?.map((value, index) => { + if (value.map === true && value.value !== "N/A") { + return } />; + } + return ( + + + + ); + })} +
+
+
+ ))} +
+ ); +} + +export default PropertyOwners; diff --git a/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/components/Reason.js b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/components/Reason.js new file mode 100644 index 00000000000..0f226935c5b --- /dev/null +++ b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/components/Reason.js @@ -0,0 +1,10 @@ +import React from "react"; + +const Reason = ({ headComment, otherComment }) => ( +
+

{headComment}

+

{otherComment}

+
+); + +export default Reason; diff --git a/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/components/ScruntinyDetails.js b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/components/ScruntinyDetails.js new file mode 100644 index 00000000000..bde27623ba8 --- /dev/null +++ b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/components/ScruntinyDetails.js @@ -0,0 +1,46 @@ +import { StatusTable, Row, PDFSvg, CardLabel, CardSubHeader } from "@egovernments/digit-ui-react-components"; +import React, { Fragment } from "react"; +import { useTranslation } from "react-i18next"; + +const ScruntinyDetails = ({ scrutinyDetails, paymentsList=[] }) => { + const { t } = useTranslation(); + let count = 0; + const getTextValues = (data) => { + if (data?.value && data?.isTransLate) return {t(data?.value)}; + else if (data?.value && data?.isTransLate) return t(data?.value); + else if (data?.value) return data?.value; + else t("NA"); + } + return ( + + {!scrutinyDetails?.isChecklist &&
+ +
+ {scrutinyDetails?.values?.map((value, index) => { + if (value?.isUnit) return + else if (value?.isHeader && !value?.isUnit) return {t(value?.title)} + else if (value?.isSubTitle && !value?.isUnit) return {t(value?.title)} + else return + })} + {scrutinyDetails?.permit?.map((value,ind) => { + return {value?.title} + })} +
+
+ {scrutinyDetails?.scruntinyDetails?.map((report, index) => { + return ( + + + +

{t(report?.text)}

+
+ ) + })} +
+
+
} +
+ ) +} + +export default ScruntinyDetails; \ No newline at end of file diff --git a/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/components/SubOccupancyTable.js b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/components/SubOccupancyTable.js new file mode 100644 index 00000000000..e266bed6be2 --- /dev/null +++ b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/components/SubOccupancyTable.js @@ -0,0 +1,126 @@ +import React, { Fragment, useMemo } from "react"; +import { Table, StatusTable, Row, CardSubHeader, CardSectionHeader } from "@egovernments/digit-ui-react-components"; +import { useTranslation } from "react-i18next"; + +const SubOccupancyTable = ({ edcrDetails, applicationData }) => { + const { t } = useTranslation(); + const isMobile = window.Digit.Utils.browser.isMobile(); + + const tableHeader = [ + { + name: "BPA_TABLE_COL_FLOOR", + id: "Floor", + }, + { + name: "BPA_TABLE_COL_LEVEL", + id: "Level", + }, + { + name: "BPA_TABLE_COL_OCCUPANCY", + id: "Occupancy", + }, + { + name: "BPA_TABLE_COL_BUILDUPAREA", + id: "BuildupArea", + }, + { + name: "BPA_TABLE_COL_FLOORAREA", + id: "FloorArea", + }, + { + name: "BPA_TABLE_COL_CARPETAREA", + id: "CarpetArea", + } + ] + + const accessData = (plot) => { + const name = plot; + return (originalRow, rowIndex, columns) => { + return originalRow[name]; + } + } + + + const tableColumns = useMemo( + () => { + return tableHeader.map((ob) => ({ + Header: t(`${ob.name}`), + accessor: accessData(ob.id), + id: ob.id + })); + }); + + function getFloorData(block) { + let floors = []; + block?.building?.floors.map((ob) => { + floors.push({ + Floor: t(`BPA_FLOOR_NAME_${ob.number}`), + Level: ob.number, + Occupancy: t(`${ob.occupancies?.[0]?.type}`), + BuildupArea: ob.occupancies?.[0]?.builtUpArea, + FloorArea: ob.occupancies?.[0]?.floorArea || 0, + CarpetArea: ob.occupancies?.[0]?.CarpetArea || 0, + key: t(`BPA_FLOOR_NAME_${ob.number}`), + }); + }); + return floors; + } + + const stringReplaceAll = (str = "", searcher = "", replaceWith = "") => { + if (searcher == "") return str; + while (str.includes(searcher)) { + str = str.replace(searcher, replaceWith); + } + return str; + }; + + function getSubOccupancyValues(index) { + let values = applicationData?.landInfo?.unit; + let returnValue = ""; + if (values?.length > 0) { + let splitArray = values[index]?.usageCategory?.split(','); + if (splitArray?.length) { + const returnValueArray = splitArray.map(data => data ? `${t(`BPA_SUBOCCUPANCYTYPE_${stringReplaceAll(data?.toUpperCase(), "-", "_")}`)}` : "NA"); + returnValue = returnValueArray.join(', ') + } + } + return returnValue ? returnValue : "NA"; + } + + return ( + +
+ + {edcrDetails?.values?.map((value, index) => { + if (value?.isHeader) return {t(value?.title)} + else return + })} + + + {edcrDetails?.subOccupancyTableDetails?.[0]?.value?.planDetail?.blocks.map((block, index) => ( +
0 ? {marginBottom: "30px", background: "#FAFAFA", border: "1px solid #D6D5D4", padding: "8px", borderRadius: "4px", maxWidth: "950px", minWidth: "280px"} : {marginBottom: "30px"}}> + {t("BPA_BLOCK_SUBHEADER")} {index + 1} + + + +
+ { return { style: {} } }} + /> + + ))} + + + ) +} + +export default SubOccupancyTable; \ No newline at end of file diff --git a/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/components/SubWorkTableDetails.js b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/components/SubWorkTableDetails.js new file mode 100644 index 00000000000..08b89e68419 --- /dev/null +++ b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/components/SubWorkTableDetails.js @@ -0,0 +1,77 @@ +import { EditIcon } from '@egovernments/digit-ui-react-components'; +import React from 'react' +import { useTranslation } from "react-i18next"; +import { useHistory } from 'react-router-dom'; + +const SubWorkTableDetails = ({data}) => { + const { t } = useTranslation(); + const history = useHistory(); + const getStyles = (index) => { + let obj = {} + switch (index) { + case 1: + obj = { "width": "1vw" } + break; + case 2: + obj = { "width": "60vw" } + break; + case 3: + obj = { "width": "20vw" } + break; + case 4: + obj = { "width": "10vw" } + break; + default: + obj = { "width": "1vw" } + break; + } + return obj + } + const renderHeader = (headers) => { + return headers?.map((key, index) => { + return + }) + } + + const renderBody = (rows) => { + return rows?.map((row, index) => { + return + + + {row[1] === t("WORKS_TOTAL_AMT") + ? + : } + {row[3] && } + {/* */} + + }) + } + + return ( +
{t(key)}
{row[0]} { row[1] === t("WORKS_TOTAL_AMT") ?
{row[1]}
:
{row[1]}
}
{row[2]}
{row[2]}
+
history.push( + { + pathname: `/digit-ui/employee/contracts/create-contract?estimateNumber=${data?.state?.estimateNumber}&task=${data?.state?.estimateDetails[index]?.name}&subEstimate=${data?.state?.estimateDetails[index]?.estimateDetailNumber}`, + state:{index, data} + } + )}> + {row[3]} +
+
{showDelete() && removeRow(row)}>}
+ + {renderHeader(data?.headers)} + + + {renderBody(data?.tableRows)} + {/* + + + + + */} + +
+ ) +} + +export default SubWorkTableDetails \ No newline at end of file diff --git a/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/components/TLCaption.js b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/components/TLCaption.js new file mode 100644 index 00000000000..e5fbcde20cd --- /dev/null +++ b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/components/TLCaption.js @@ -0,0 +1,34 @@ +import React from "react"; +import { useTranslation } from "react-i18next"; +import { TelePhone, DisplayPhotos, UnMaskComponent } from "@egovernments/digit-ui-react-components"; +import Reason from "./Reason"; + +const TLCaption = ({ data,OpenImage,privacy={}}) => { + + const { t } = useTranslation(); + return ( +
+ {data.date &&

{data.date}

} +

{data.name}

+ {data.mobileNumber && + +

    

+ +
} + {data.source &&

{t("ES_APPLICATION_DETAILS_APPLICATION_CHANNEL_" + data.source.toUpperCase())}

} + {data.comment && } + {data?.wfComment ?
{data?.wfComment?.map( e => +
+

{t("WF_COMMON_COMMENTS")}

+

{e}

+
+ )}
: null} + {data?.thumbnailsToShow?.thumbs?.length > 0 ?
+

{t("CS_COMMON_ATTACHMENTS")}

+ {OpenImage(src, index,data?.thumbnailsToShow)}} /> +
: null} +
+ ); +}; + +export default TLCaption; diff --git a/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/components/TLTradeAccessories.js b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/components/TLTradeAccessories.js new file mode 100644 index 00000000000..536a2ce3eca --- /dev/null +++ b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/components/TLTradeAccessories.js @@ -0,0 +1,52 @@ + +import React from "react"; +import { useTranslation } from "react-i18next"; +import { CardSubHeader, StatusTable, Row, CardSectionHeader } from "@egovernments/digit-ui-react-components"; + +function TLTradeAccessories({ units }) { + const { t } = useTranslation(); + return ( + + {units.map((unit, index) => ( + // TODO, Later will move to classes +
+ {`${t(unit?.title)} ${index + 1}`} + + +
+ {unit?.values?.map((value, index) => { + if (value.map === true && value.value !== "N/A") { + return } />; + } + return ( + + ); + })} +
+
+
+ ))} +
+ ); +} + +export default TLTradeAccessories; diff --git a/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/components/TLTradeUnits.js b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/components/TLTradeUnits.js new file mode 100644 index 00000000000..bf1c1fbc780 --- /dev/null +++ b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/components/TLTradeUnits.js @@ -0,0 +1,51 @@ +import React from "react"; +import { useTranslation } from "react-i18next"; +import { CardSubHeader, StatusTable, Row, CardSectionHeader } from "@egovernments/digit-ui-react-components"; + +function TLTradeUnits({ units }) { + const { t } = useTranslation(); + return ( + + {units.map((unit, index) => ( + // TODO, Later will move to classes +
+ {`${t(unit?.title)} ${index + 1}`} + + +
+ {unit?.values?.map((value, index) => { + if (value.map === true && value.value !== "N/A") { + return } />; + } + return ( + + ); + })} +
+
+
+ ))} +
+ ); +} + +export default TLTradeUnits; diff --git a/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/components/ViewBreakup.js b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/components/ViewBreakup.js new file mode 100644 index 00000000000..5608aeb2d2a --- /dev/null +++ b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/components/ViewBreakup.js @@ -0,0 +1,73 @@ +import React, { useState, Fragment } from "react"; +import { useTranslation } from "react-i18next"; +import { CardSectionHeader, Modal, Row, StatusTable } from "@egovernments/digit-ui-react-components"; + +const ViewBreakup = ({ wsAdditionalDetails, workflowDetails }) => { + const { t } = useTranslation(); + const [popup, showPopUp] = useState(false); + const [breakUpData, setBreakUpData] = useState({}); + + const Heading = (props) => { + return

{props.label}

; + }; + + const Close = () => ( + + + + + ); + + const CloseBtn = (props) => { + return ( +
+ +
+ ); + }; + + const onPopupOpen = () => { + let breakupData = wsAdditionalDetails.additionalDetails.data || {}; + const sessionBillData = sessionStorage.getItem("Digit.ADHOC_BILL_ADD_REBATE_DATA"); + const sessionBillFormData = sessionBillData ? JSON.parse(sessionBillData) : {}; + if (sessionBillFormData?.value?.totalAmount) breakupData = sessionBillFormData?.value; + setBreakUpData(breakupData); + showPopUp(true); + } + + return ( + +
+ {wsAdditionalDetails?.additionalDetails?.isViewBreakup ?
onPopupOpen()} style={{ marginTop: "12px" }}> + {t("WS_PAYMENT_VIEW_BREAKUP")} +
: null + } + {popup && + } + headerBarEnd={ { showPopUp(false); }} />} + hideSubmit={true} + popupStyles={{ overflowY: "auto" }} //maxHeight: "calc(100% - 90px)" + headerBarMainStyle={{ marginBottom: "0px" }} + popupModuleMianStyles={{ paddingTop: "0px" }} + > + { + {t("WS_APPLICATION_FEE_HEADER")} + {breakUpData?.billSlabData?.FEE?.map(data => ₹{Number(data?.amount) || 0}} textStyle={{ textAlign: "right" }} />)} +
+ ₹{Number(breakUpData?.fee) || 0}} textStyle={{ textAlign: "right", fontWeight: "700", fontSize: "24px" }} /> + {t("WS_SERVICE_FEE_HEADER")} + {breakUpData?.billSlabData?.CHARGES?.map(data => ₹{Number(data?.amount) || 0}} textStyle={{ textAlign: "right" }} />)} +
+ ₹{Number(breakUpData?.charge) || 0}} textStyle={{ textAlign: "right", fontWeight: "700", fontSize: "24px" }} /> + {breakUpData?.billSlabData?.TAX?.map(data => ₹{Number(data?.amount) || 0}} textStyle={{ textAlign: "right" }} />)} +
+ ₹{Number(breakUpData?.totalAmount) || 0}} textStyle={{ textAlign: "right", fontWeight: "700", fontSize: "24px" }} /> +
} +
} +
+
+ ) +} + +export default ViewBreakup; \ No newline at end of file diff --git a/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/components/WSAdditonalDetails.js b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/components/WSAdditonalDetails.js new file mode 100644 index 00000000000..06814062d96 --- /dev/null +++ b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/components/WSAdditonalDetails.js @@ -0,0 +1,399 @@ +import { StatusTable, Row, CardSubHeader } from "@egovernments/digit-ui-react-components"; +import React, { Fragment } from "react"; +import { useTranslation } from "react-i18next"; +import { getQueryStringParams } from "../../../ws/src/utils"; + +const cardSubHeaderStyles = () => { + // return { fontSize: "24px", padding: "0px", margin: "0px", color: "#505A5F" }; + return { fontSize: "24px", marginBottom: "16px", marginTop: "32px" }; +}; + +const cardDivStyles = () => { + return { + border: "1px solid #D6D5D4", + background: "#FAFAFA", + borderRadius: "4px", + padding: "10px 10px 0px 10px", + marginBottom: "10px", + display: "flex", + }; +}; + +const convertEpochToDate = (dateEpoch) => { + if (dateEpoch) { + 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}`; + } else { + return null; + } +}; + +const WSAdditonalDetails = ({ wsAdditionalDetails, oldValue }) => { + const { t } = useTranslation(); + let filters = getQueryStringParams(location.search); + const serviceType = filters?.service; + const isModify = filters?.mode; + + const oldValueData = oldValue?.[1]; + + const stringReplaceAll = (str = "", searcher = "", replaceWith = "") => { + if (searcher == "") return str; + while (str.includes(searcher)) { + str = str.replace(searcher, replaceWith); + } + return str; + }; + + const renderSWConnectionDetails = () => { + return ( +
+ {oldValueData?.connectionType ? ( + + ) : ( +
{"NA"}
+ )} + + {oldValueData?.noOfWaterClosets ? ( + + ) : ( +
{"NA"}
+ )} + {oldValueData?.noOfToilets ? ( + + ) : ( +
{"NA"}
+ )} +
+ ); + }; + + const renderWSConnectionDetails = () => { + return ( +
+ {oldValueData?.connectionType && ( )} + {oldValueData?.noOfTaps && ( )} + {oldValueData?.waterSource && ( )} + {oldValueData?.pipeSize && ( )} + {oldValueData?.waterSource && ( )} +
+ ); + }; + + const renderSWPlumberDetails = () => { + return ( +
+ {oldValueData?.additionalDetails?.detailsProvidedBy !== wsAdditionalDetails?.additionalDetails?.plumberDetails[0]?.value && + oldValueData?.additionalDetails?.detailsProvidedBy !== null ? ( + + ) : ( +
{"NA"}
+ )} + {oldValueData?.plumberInfo ? ( + + ) : ( +
{"NA"}
+ )} + {oldValueData?.plumberInfo ? ( + + ) : ( +
{"NA"}
+ )} + {oldValueData?.plumberInfo ? ( + + ) : ( +
{"NA"}
+ )} +
+ ); + }; + + const renderWSPlumberDetails = () => { + return ( +
+ {oldValueData?.additionalDetails?.detailsProvidedBy !== wsAdditionalDetails?.additionalDetails?.plumberDetails[0]?.value ? ( + + ) : ( +
{"NA"}
+ )} +
+ ); + }; + + const renderSWRoadCuttingDetails = () => { + { + oldValueData?.roadCuttingInfo?.map((info) => { + return ( +
+ + +
+ ); + }); + } + }; + + const renderSWActivationDetails = () => { + return ( +
+ {oldValueData?.connectionExecutionDate ? ( + + ) : ( +
{"NA"}
+ )} +
+ ); + }; + + const renderWSActivationDetails = () => { + return ( +
+ {oldValueData?.meterId && ( )} + {oldValueData?.additionalDetails?.initialMeterReading && ( )} + {oldValueData?.meterInstallationDate && ( )} + {oldValueData?.connectionExecutionDate && ( )} +
+ ); + }; + + var { connectionDetails, plumberDetails, roadCuttingDetails, activationDetails } = wsAdditionalDetails?.additionalDetails || {connectionDetails:[], plumberDetails: []}; + + // binding old values with new values + if(isModify === "MODIFY"){ + + connectionDetails = connectionDetails?.map((value) => { + if(value.title == "WS_SERV_DETAIL_CONN_TYPE" && oldValueData?.connectionType) value["oldValue"] = [ + { value:value?.value, className:"newValue", style:{ display:"inline"} }, + { + value:`${t("WS_OLD_LABEL_NAME")} ${oldValueData?.connectionType}`, + className:"oldValue", style:{color:'gray', paddingLeft:"10px", display:"inline", fontSize:"13px"} + }]; + if(value.title == "WS_SERV_DETAIL_NO_OF_TAPS" && oldValueData?.noOfTaps) value["oldValue"] = [ + {value:value?.value,className:"newValue", style:{ display:"inline"}}, + {value:`${t("WS_OLD_LABEL_NAME")} ${oldValueData?.noOfTaps}`, style:{color:'gray', paddingLeft:"10px", display:"inline", fontSize:"13px"},className:"oldValue"} + ]; + if(value.title == "WS_SERV_DETAIL_WATER_SOURCE" && oldValueData?.waterSource) value["oldValue"] = [ + {value:value?.value, className:"newValue", style:{ display:"inline"}}, + { + value: `${t("WS_OLD_LABEL_NAME")} ${t(oldValueData?.waterSource?.toUpperCase()?.split(".")[0])}`, + style:{color:'gray', paddingLeft:"10px", display:"inline", fontSize:"13px"}, className:"oldValue" + } + ]; + if(value.title == "WS_PIPE_SIZE_IN_INCHES_LABEL" && oldValueData?.pipeSize) value["oldValue"] = [ + {value:value?.value, className:"newValue", style:{ display:"inline"}}, + { + value: `${t("WS_OLD_LABEL_NAME")} ${oldValueData?.pipeSize}`, + style:{color:'gray', paddingLeft:"10px", display:"inline", fontSize:"13px"}, className:"oldValue" + } + ]; + if(value.title == "WS_SERV_DETAIL_WATER_SUB_SOURCE" && oldValueData?.waterSource) value["oldValue"] = [ + {value:value?.value, className:"newValue", style:{ display:"inline"}}, + { + value: `${t("WS_OLD_LABEL_NAME")} ${t(oldValueData?.waterSource?.toUpperCase()?.split(".")[1])}`, + style:{color:'gray', paddingLeft:"10px", display:"inline", fontSize:"13px"}, className:"oldValue" + } + ]; + if(value.title == "WS_NUMBER_WATER_CLOSETS_LABEL" && oldValueData?.noOfWaterClosets) value["oldValue"] = [ + {value:value?.value, className:"newValue", style:{ display:"inline"}}, + { + value: `${t("WS_OLD_LABEL_NAME")} ${oldValueData?.noOfWaterClosets}`, + style:{color:'gray', paddingLeft:"10px", display:"inline", fontSize:"13px"}, className:"oldValue" + } + ]; + if(value.title == "WS_SERV_DETAIL_NO_OF_TOILETS" && oldValueData?.noOfWaterClosets) value["oldValue"] = [ + {value:value?.value, className:"newValue", style:{ display:"inline"}}, + { + value: `${t("WS_OLD_LABEL_NAME")} ${oldValueData?.noOfWaterClosets}`, + style:{color:'gray', paddingLeft:"10px", display:"inline", fontSize:"13px"}, className:"oldValue" + } + ]; + + return value; + }) + + plumberDetails = plumberDetails?.map((value) => { + if(value.title == "WS_ADDN_DETAILS_PLUMBER_PROVIDED_BY" && oldValueData?.additionalDetails?.detailsProvidedBy && oldValueData?.additionalDetails?.detailsProvidedBy !== value.value ) value["oldValue"] = [ + {value:value?.value, className:"newValue", style:{ display:"inline"}}, + { + value: `${t("WS_OLD_LABEL_NAME")} ${oldValueData?.additionalDetails?.detailsProvidedBy}`, + style:{color:'gray', paddingLeft:"10px", display:"inline", fontSize:"13px"}, className:"oldValue" + } + ]; + if(value.title == "WS_ADDN_DETAILS_PLUMBER_LICENCE_NO_LABEL" && oldValueData?.plumberInfo[0]?.licenseNo ) value["oldValue"] = [ + {value:value?.value, className:"newValue", style:{ display:"inline"}}, + { + value: `${t("WS_OLD_LABEL_NAME")} ${oldValueData?.plumberInfo[0]?.licenseNo}`, + style:{color:'gray', paddingLeft:"10px", display:"inline", fontSize:"13px"}, className:"oldValue" + } + ]; + if(value.title == "WS_ADDN_DETAILS_PLUMBER_NAME_LABEL" && oldValueData?.plumberInfo[0]?.name ) value["oldValue"] = [ + {value:value?.value, className:"newValue", style:{ display:"inline"}}, + { + value: `${t("WS_OLD_LABEL_NAME")} ${oldValueData?.plumberInfo[0]?.name}`, + style:{color:'gray', paddingLeft:"10px", display:"inline", fontSize:"13px"}, className:"oldValue" + } + ]; + if(value.title == "WS_PLUMBER_MOBILE_NO_LABEL" && oldValueData?.plumberInfo[0]?.mobileNumber ) value["oldValue"] = [ + {value:value?.value, className:"newValue", style:{ display:"inline"}}, + { + value: `${t("WS_OLD_LABEL_NAME")} ${oldValueData?.plumberInfo[0]?.mobileNumber}`, + style:{color:'gray', paddingLeft:"10px", display:"inline", fontSize:"13px"}, className:"oldValue" + } + ]; + return value; + }) + + roadCuttingDetails = roadCuttingDetails?.map((roadDetail) => { + const roadDetailValues = roadDetail?.values?.map((value) => { + if(value.title == "WS_ADDN_DETAIL_ROAD_TYPE" && oldValueData?.roadCuttingInfo[0]?.roadType) value["oldValue"] = [ + {value:value?.value, className:"newValue", style:{ display:"inline"}}, + { + value: `${t("WS_OLD_LABEL_NAME")} ${oldValueData?.roadCuttingInfo[0]?.roadType}`, + style:{color:'gray', paddingLeft:"10px", display:"inline", fontSize:"13px"}, className:"oldValue" + } + ]; + if(value.title == "WS_ROAD_CUTTING_AREA_LABEL" && oldValueData?.roadCuttingInfo[0]?.roadCuttingArea) value["oldValue"] = [ + {value:value?.value, className:"newValue", style:{ display:"inline"}}, + { + value: `${t("WS_OLD_LABEL_NAME")} ${oldValueData?.roadCuttingInfo[0]?.roadCuttingArea}`, + style:{color:'gray', paddingLeft:"10px", display:"inline", fontSize:"13px"}, className:"oldValue" + } + ]; + return value; + }) + return ({...roadDetail,values:roadDetailValues}); + }) + + activationDetails = activationDetails?.map((value) => { + if(value.title == "WS_SERV_DETAIL_CONN_EXECUTION_DATE" && oldValueData?.connectionExecutionDate) value["oldValue"] = [ + {value:value?.value, className:"newValue", style:{ display:"inline"}}, + { + value: `${t("WS_OLD_LABEL_NAME")} ${convertEpochToDate(oldValueData?.connectionExecutionDate)}`, + style:{color:'gray', paddingLeft:"10px", display:"inline", fontSize:"13px"}, className:"oldValue" + } + ]; + + if(value.title == "WS_SERV_DETAIL_METER_ID" && oldValueData?.meterId) value["oldValue"] = [ + {value:value?.value, className:"newValue", style:{ display:"inline"}}, + { + value: `${t("WS_OLD_LABEL_NAME")} ${oldValueData?.meterId}`, + style:{color:'gray', paddingLeft:"10px", display:"inline", fontSize:"13px"}, className:"oldValue" + } + ]; + + if(value.title == "WS_INITIAL_METER_READING_LABEL" && oldValueData?.initialMeterReading) value["oldValue"] = [ + {value:value?.value, className:"newValue", style:{ display:"inline"}}, + { + value: `${t("WS_OLD_LABEL_NAME")} ${oldValueData?.initialMeterReading}`, + style:{color:'gray', paddingLeft:"10px", display:"inline", fontSize:"13px"}, className:"oldValue" + } + ]; + + if(value.title == "WS_INSTALLATION_DATE_LABEL" && oldValueData?.meterInstallationDate) value["oldValue"] = [ + {value:value?.value, className:"newValue", style:{ display:"inline"}}, + { + value: `${t("WS_OLD_LABEL_NAME")} ${convertEpochToDate(oldValueData?.meterInstallationDate)}`, + style:{color:'gray', paddingLeft:"10px", display:"inline", fontSize:"13px"}, className:"oldValue" + } + ]; + if(value.title == "WS_SERV_DETAIL_CONN_EXECUTION_DATE" && oldValueData?.connectionExecutionDate) value["oldValue"] = [ + {value:value?.value, className:"newValue", style:{ display:"inline"}}, + { + value: `${t("WS_OLD_LABEL_NAME")} ${convertEpochToDate(oldValueData?.connectionExecutionDate)}`, + style:{color:'gray', paddingLeft:"10px", display:"inline", fontSize:"13px"}, className:"oldValue" + } + ]; + return value; + }) + }; + + return ( + +
+ {wsAdditionalDetails?.additionalDetails?.connectionDetails && ( + + {t("WS_COMMON_CONNECTION_DETAIL")} +
+
+ {connectionDetails?.map((value, index) => { + return ( +
+ +
+ ); + })} +
+
+
+ )} + {wsAdditionalDetails?.additionalDetails?.plumberDetails && ( + + {t("WS_COMMON_PLUMBER_DETAILS")} +
+
+ + {plumberDetails?.map((value, index) => { + return ; + })} +
+
+
+ )} + {wsAdditionalDetails?.additionalDetails?.roadCuttingDetails && ( + + {t("WS_ROAD_CUTTING_DETAILS")} +
+
+ {roadCuttingDetails?.map((value) => { + return ( +
1 + ? { + border: "1px solid #D6D5D4", + background: "#FAFAFA", + borderRadius: "4px", + padding: "10px 10px 0px 10px", + margin: "5px 0px", + } + : {} + } + > + {value?.values?.map((roadValue) => ( + + ))} +
+ ); + })} +
+
+
+ )} + {wsAdditionalDetails?.additionalDetails?.activationDetails && ( + + {t("WS_ACTIVATION_DETAILS")} +
+
+ {activationDetails?.map((value, index) => { + return ( + + ); + })} +
+
+
+ )} +
+
+ ); +}; + +export default WSAdditonalDetails; diff --git a/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/components/WSFeeEstimation.js b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/components/WSFeeEstimation.js new file mode 100644 index 00000000000..9a4fe591f9d --- /dev/null +++ b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/components/WSFeeEstimation.js @@ -0,0 +1,346 @@ +import React, { useState, Fragment, useEffect } from "react"; +import { useTranslation } from "react-i18next"; +import { Card, CardSectionHeader, CardLabel } from "@egovernments/digit-ui-react-components"; +import { Modal, Dropdown, Row, StatusTable, TextInput, Toast } from "@egovernments/digit-ui-react-components"; +import cloneDeep from "lodash/cloneDeep"; + +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_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_OTHERS", + value: "Others", + }, +]; + + +const WSFeeEstimation = ({ wsAdditionalDetails, workflowDetails }) => { + const { t } = useTranslation(); + const [sessionFormData, setSessionFormData, clearSessionFormData] = Digit.Hooks.useSessionStorage("ADHOC_ADD_REBATE_DATA", {}); + const [sessionBillFormData, setSessionBillFormData, clearBillSessionFormData] = Digit.Hooks.useSessionStorage("ADHOC_BILL_ADD_REBATE_DATA", {}); + const isPaid = wsAdditionalDetails?.additionalDetails?.isPaid ? true : false; + const [popup, showPopUp] = useState(false); + const [fields, setFields] = useState(sessionFormData ? sessionFormData : {}); + const [showToast, setShowToast] = useState(null); + const [billDetails, setBillDetails] = useState(wsAdditionalDetails.additionalDetails.data ? wsAdditionalDetails.additionalDetails.data : {}); + const [values, setValues] = useState(wsAdditionalDetails.additionalDetails.values ? wsAdditionalDetails.additionalDetails.values : []); + + const stateCode = Digit.ULBService.getStateId(); + const { isMdmsLoading, data: mdmsRes } = Digit.Hooks.ws.useMDMS(stateCode, "BillingService", ["TaxHeadMaster"]); + + useEffect(() => { + const data = { ...wsAdditionalDetails?.additionalDetails?.appDetails?.additionalDetails }; + setSessionFormData(data); + setFields(data); + if (sessionFormData?.billDetails?.length > 0) { + const values = [ + { title: "WS_APPLICATION_FEE_HEADER", value: sessionFormData?.billDetails?.[0]?.fee }, + { title: "WS_SERVICE_FEE_HEADER", value: sessionFormData?.billDetails?.[0]?.charge }, + { title: "WS_TAX_HEADER", value: sessionFormData?.billDetails?.[0]?.taxAmount }, + ]; + setValues(values); + setBillDetails(sessionFormData?.billDetails?.[0]); + } + }, []); + + let validation = {}; + + const Heading = (props) => { + return

{props.label}

; + }; + + const Close = () => ( + + + + + ); + + const CloseBtn = (props) => { + return ( +
+ +
+ ); + }; + + const closeToast = () => { + setShowToast(false); + }; + + const addAdhocRebatePenality = (e) => { + const adhocAmount = fields?.adhocPenalty ? Number(fields?.adhocPenalty) : 0; + const rebateAmount = fields?.adhocRebate ? Number(fields?.adhocRebate) : 0; + if (adhocAmount || rebateAmount) { + + const totalAmount = wsAdditionalDetails?.additionalDetails?.data?.totalAmount; + const demandId = wsAdditionalDetails?.additionalDetails?.data?.billDetails?.[0]?.demandId; + + if (rebateAmount > totalAmount) { + setShowToast({ isError: false, isWarning: true, key: "error", message: t("ERR_WS_REBATE_GREATER_THAN_AMOUNT") }); + } else { + const applicationNo = wsAdditionalDetails?.additionalDetails?.appDetails?.applicationNo; + const tenantId = wsAdditionalDetails?.additionalDetails?.appDetails?.tenantId; + const appAdditionalDetails = { ...wsAdditionalDetails?.additionalDetails?.appDetails?.additionalDetails, ...fields } + wsAdditionalDetails.additionalDetails.appDetails.additionalDetails = appAdditionalDetails; + + const data = { + CalculationCriteria: + wsAdditionalDetails?.additionalDetails?.appDetails?.service == "WATER" + ? [ + { + applicationNo: applicationNo, + tenantId: tenantId, + waterConnection: wsAdditionalDetails.additionalDetails.appDetails, + }, + ] + : [ + { + applicationNo: applicationNo, + tenantId: tenantId, + sewerageConnection: wsAdditionalDetails.additionalDetails.appDetails, + }, + ], + isconnectionCalculation: false, + }; + + let businessService = wsAdditionalDetails?.additionalDetails?.appDetails?.service == "WATER" ? "WS" : "SW"; + Digit.WSService.wsCalculationEstimate(data, businessService) + .then((result, err) => { + if (result?.Calculation?.[0]?.taxHeadEstimates?.length > 0) { + result?.Calculation?.[0]?.taxHeadEstimates?.forEach(data => data.amount = data.estimateAmount); + } + + result.Calculation[0].billSlabData = _.groupBy(result?.Calculation?.[0]?.taxHeadEstimates, 'category'); + const values = [ + { title: "WS_APPLICATION_FEE_HEADER", value: result.Calculation?.[0]?.fee }, + { title: "WS_SERVICE_FEE_HEADER", value: result.Calculation?.[0]?.charge }, + { title: "WS_TAX_HEADER", value: result.Calculation?.[0]?.taxAmount }, + ]; + setSessionBillFormData(cloneDeep(result.Calculation[0])); + setBillDetails(result?.Calculation?.[0]); + setValues(values); + fields.billDetails = result?.Calculation; + setSessionFormData(fields); + showPopUp(false); + }) + .catch((e) => { + setShowToast({ isError: true, isWarning: false, key: "error", message: e?.response?.data?.Errors[0]?.message ? t(`${e?.response?.data?.Errors[0]?.code}`) : t("PT_COMMON_ADD_REBATE_PENALITY") }); + }); + } + } else { + setShowToast({ isError: false, isWarning: true, key: "warning", message: t("ERR_WS_ENTER_ATLEAST_ONE_FIELD") }); + } + } + + const selectedValuesData = (value, isDropDownValue = false, e) => { + let values = { ...fields }; + if (isDropDownValue) { + values[`${value}_data`] = e; + values[value] = e.title; + if (e.title == "PT_OTHERS" && value == "adhocPenaltyReason") values[`adhocPenaltyComment`] = ""; + if (e.title == "PT_OTHERS" && value == "adhocRebateReason") values[`adhocRebateComment`] = ""; + } else { + values[value] = e.target.value; + } + setFields(values); + } + + return ( + +
+ {values && + +
+ {values?.map((value, index) => { + return + })} +
+
+
+ + +
+
} + { + wsAdditionalDetails?.additionalDetails?.isAdhocRebate ?
{ + showPopUp(true) + }} + > + {t("WS_PAYMENT_ADD_REBATE_PENALTY")} +
: null + } + {popup && + } + headerBarEnd={ + { + setFields(sessionFormData); + showPopUp(false); + }} />} + actionCancelLabel={t("PT_CANCEL")} + actionCancelOnSubmit={() => { + setFields(sessionFormData); + showPopUp(false); + }} + actionSaveLabel={t("PT_ADD")} + actionSaveOnSubmit={(e) => addAdhocRebatePenality(e)} + hideSubmit={false} + popupStyles={{ overflowY: "auto" }} + > + { +
+ + {t("PT_AD_PENALTY")} + + {t("PT_TX_HEADS")} + +
+ selectedValuesData("adhocPenaltyReason", true, e)} + selected={fields?.adhocPenaltyReason_data || ""} + isPropertyAssess={true} + name={"adhocPenaltyReason_data"} + t={t} + /> +
+ {fields?.adhocPenaltyReason_data?.title === "PT_OTHERS" &&
+ {t("PT_REASON")} +
+ selectedValuesData("adhocPenaltyComment", false, e)} + {...(validation = { + isRequired: true, + pattern: "^[a-zA-Z-.`' ]*$", + type: "text", + title: t("TL_NAME_ERROR_MESSAGE"), + })} + /> +
+
} + {t("PT_HEAD_AMT")} +
+ selectedValuesData("adhocPenalty", false, e)} + {...(validation = { + isRequired: true, + pattern: "^[1-9]+[0-9]*$", + title: t("ERR_DEFAULT_INPUT_FIELD_MSG"), + })} + /> + +
+
+ + {t("PT_AD_REBATE")} + {t("PT_TX_HEADS")} +
+ selectedValuesData("adhocRebateReason", true, e)} + selected={fields?.adhocRebateReason_data || ""} + name={"adhocRebateReason_data"} + isPropertyAssess={true} + t={t} + /> +
+ {fields?.adhocRebateReason_data?.title === "PT_OTHERS" &&
+ {t("PT_REASON")} + selectedValuesData("adhocRebateComment", false, e)} + {...(validation = { + isRequired: true, + pattern: "^[a-zA-Z-.`' ]*$", + type: "text", + title: t("TL_NAME_ERROR_MESSAGE"), + })} + /> +
} + {t("PT_HEAD_AMT")} +
+ selectedValuesData("adhocRebate", false, e)} + {...(validation = { + isRequired: true, + pattern: "^[1-9]+[0-9]*$", + title: t("ERR_DEFAULT_INPUT_FIELD_MSG"), + })} + /> +
+
+
+ }
} + {showToast && + } +
+
+ ) +} + +export default WSFeeEstimation; \ No newline at end of file diff --git a/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/components/WeekDateRange.js b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/components/WeekDateRange.js new file mode 100644 index 00000000000..75069dd741f --- /dev/null +++ b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/components/WeekDateRange.js @@ -0,0 +1,30 @@ +import React, { useCallback, useState } from "react"; +import { useTranslation } from "react-i18next"; + +const WeekDateRange = (props) => { + const [localSearchParams, setLocalSearchParams] = useState(() => ({})); + const { t } = useTranslation(); + const handleChange = useCallback((data) => { + setLocalSearchParams(() => ({ ...data })); + }, []); + + return ( +
+
+

{props.title}

+
+ +
+
+
+ ); +}; + +export default WeekDateRange; diff --git a/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/config/AcceptDso.js b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/config/AcceptDso.js new file mode 100644 index 00000000000..e870f2e9a67 --- /dev/null +++ b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/config/AcceptDso.js @@ -0,0 +1,45 @@ +import React from "react"; +import { Dropdown } from "@egovernments/digit-ui-react-components"; + +export const configAcceptDso = ({ t, dsoData, dso, selectVehicleNo, vehicleNoList, vehicleNo, vehicle, action }) => { + return { + label: { + heading: `ES_FSM_ACTION_TITLE_${action}`, + submit: `CS_COMMON_${action}`, + cancel: "CS_COMMON_CANCEL", + }, + form: [ + { + body: [ + { + label: t("ES_FSM_ACTION_VEHICLE_REGISTRATION_NO"), + isMandatory: true, + type: "dropdown", + populators: ( + + ), + }, + { + label: t("ES_FSM_ACTION_VEHICLE_CAPACITY_IN_LTRS"), + isMandatory: true, + type: "text", + populators: { + name: "capacity", + validation: { + required: true, + }, + }, + disable: true, + }, + ], + }, + ], + }; +}; diff --git a/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/config/AssignDso.js b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/config/AssignDso.js new file mode 100644 index 00000000000..418caf1e4bc --- /dev/null +++ b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/config/AssignDso.js @@ -0,0 +1,115 @@ +import React from "react"; +import { DatePicker, Dropdown, CardLabelError } from "@egovernments/digit-ui-react-components"; + +function todayDate() { + var today = new Date(); + var dd = today.getDate(); + var mm = today.getMonth() + 1; + var yyyy = today.getFullYear(); + + if (dd < 10) { + dd = "0" + dd; + } + + if (mm < 10) { + mm = "0" + mm; + } + + return yyyy + "-" + mm + "-" + dd; +} + +function getFilteredDsoData(dsoData, vehicle) { + return dsoData?.filter((e) => e.vehicles?.find((veh) => veh?.type == vehicle?.code)); +} + +export const configAssignDso = ({ t, dsoData, dso, selectDSO, vehicleMenu, vehicle, selectVehicle, action }) => { + return { + label: { + heading: `ES_FSM_ACTION_TITLE_${action}`, + submit: `CS_COMMON_${action}`, + cancel: "CS_COMMON_CANCEL", + }, + form: [ + { + body: [ + { + label: t("ES_FSM_ACTION_VEHICLE_TYPE"), + isMandatory: true, + type: "dropdown", + populators: ( + + ), + }, + { + label: t("ES_FSM_ACTION_DSO_NAME"), + isMandatory: true, + type: "dropdown", + populators: ( + + {getFilteredDsoData(dsoData, vehicle) && !getFilteredDsoData(dsoData, vehicle).length ? ( + {t("ES_COMMON_NO_DSO_AVAILABLE_WITH_SUCH_VEHICLE")} + ) : null} + + + ), + }, + { + label: t("ES_FSM_ACTION_VEHICLE_CAPACITY_IN_LTRS"), + isMandatory: true, + type: "text", + populators: { + name: "capacity", + validation: { + required: true, + }, + }, + disable: true, + }, + // { + // label: t("ES_FSM_ACTION_SERVICE_DATE"), + // isMandatory: true, + // type: "date", + // populators: { + // name: "date", + // validation: { + // required: true, + // }, + // min: Digit.Utils.date.getDate(), + // defaultValue: Digit.Utils.date.getDate(), + // }, + // }, + { + label: t("ES_FSM_ACTION_SERVICE_DATE"), + isMandatory: true, + type: "custom", + populators: { + name: "date", + validation: { + required: true, + }, + customProps: { min: Digit.Utils.date.getDate() }, + defaultValue: Digit.Utils.date.getDate(), + component: (props, customProps) => , + }, + }, + ], + }, + ], + }; +}; diff --git a/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/config/BPAApproverApplication.js b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/config/BPAApproverApplication.js new file mode 100644 index 00000000000..ca66865bb77 --- /dev/null +++ b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/config/BPAApproverApplication.js @@ -0,0 +1,77 @@ +import { Dropdown, UploadFile } from "@egovernments/digit-ui-react-components"; +import React from "react"; + +export const configBPAApproverApplication = ({ + t, + action, + approvers, + selectedApprover, + setSelectedApprover, + selectFile, + uploadedFile, + setUploadedFile, + assigneeLabel, + businessService, + error +}) => { + let isRejectOrRevocate = false; + if(action?.action == "REVOCATE" || action?.action == "REJECT" || action.action == "SKIP_PAYMENT" || action?.action == "SEND_BACK_TO_CITIZEN" || action?.action == "APPROVE") { + isRejectOrRevocate = true; + } + + let isCommentRequired = false; + if(action?.action == "REVOCATE" || action?.action == "REJECT") { + isCommentRequired = true; + } + + return { + label: { + heading: `WF_${action?.action}_APPLICATION`, + submit: `WF_${businessService}_${action?.action}`, + cancel: "BPA_CITIZEN_CANCEL_BUTTON", + }, + form: [ + { + body: [ + { + label: action.isTerminateState || isRejectOrRevocate ? null : t(assigneeLabel || `WF_ROLE_${action.assigneeRoles?.[0]}`), + type: "dropdown", + populators: action.isTerminateState || isRejectOrRevocate ? null : ( + + ), + }, + { + label: t("WF_COMMON_COMMENTS"), + type: "textarea", + isMandatory: isCommentRequired, + populators: { + name: "comments", + }, + }, + { + label: `${t("WF_APPROVAL_UPLOAD_HEAD")}`, + populators: ( + { + setUploadedFile(null); + }} + message={uploadedFile ? `1 ${t(`ES_PT_ACTION_FILEUPLOADED`)}` : t(`CS_ACTION_NO_FILEUPLOADED`)} + accept= "image/*, .pdf, .png, .jpeg, .jpg" + iserror={error} + /> + ), + }, + ], + }, + ], + }; +}; diff --git a/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/config/BPAREGApproverApplication.js b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/config/BPAREGApproverApplication.js new file mode 100644 index 00000000000..0bdba14bc5b --- /dev/null +++ b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/config/BPAREGApproverApplication.js @@ -0,0 +1,71 @@ +import { Dropdown, UploadFile } from "@egovernments/digit-ui-react-components"; +import React from "react"; + +export const configBPAREGApproverApplication = ({ + t, + action, + approvers, + selectedApprover, + setSelectedApprover, + selectFile, + uploadedFile, + setUploadedFile, + assigneeLabel, + businessService, + error +}) => { + let checkCondtions = true; + if (action?.action == "SENDBACKTOCITIZEN") checkCondtions = false; + if (action.isTerminateState) checkCondtions = false; + + return { + label: { + heading: `WF_${action?.action}_APPLICATION`, + submit: `WF_${businessService?.toUpperCase()}_${action?.action}`, + cancel: "WF_EMPLOYEE_BPAREG_CANCEL", + }, + form: [ + { + body: [ + { + label: !checkCondtions ? null : t("WF_ASSIGNEE_NAME_LABEL"), + placeholder: !checkCondtions ? null : t("WF_ASSIGNEE_NAME_PLACEHOLDER"), + type: "dropdown", + populators: !checkCondtions ? null : ( + + ), + }, + { + label: t("WF_COMMON_COMMENTS"), + type: "textarea", + populators: { + name: "comments", + }, + }, + { + label: t("BPA_APPROVAL_CHECKLIST_BUTTON_UP_FILE"), + populators: ( + { + setUploadedFile(null); + }} + message={uploadedFile ? `1 ${t(`ES_PT_ACTION_FILEUPLOADED`)}` : t(`CS_ACTION_NO_FILEUPLOADED`)} + accept= "image/*, .pdf, .png, .jpeg, .jpg" + iserror={error} + /> + ) + }, + ], + }, + ], + }; +}; diff --git a/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/config/CompleteApplication.js b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/config/CompleteApplication.js new file mode 100644 index 00000000000..a4c7c96b2fd --- /dev/null +++ b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/config/CompleteApplication.js @@ -0,0 +1,46 @@ +import React from "react"; +import { DatePicker } from "@egovernments/digit-ui-react-components"; + +export const configCompleteApplication = ({ t, vehicle, applicationCreatedTime = 0, action }) => ({ + label: { + heading: `ES_FSM_ACTION_TITLE_${action}`, + submit: `CS_COMMON_${action}`, + cancel: "CS_COMMON_CANCEL", + }, + form: [ + { + body: [ + { + label: t("ES_FSM_ACTION_DESLUGED_DATE_LABEL"), + isMandatory: true, + type: "custom", + populators: { + name: "desluged", + validation: { + required: true, + }, + defaultValue: Digit.Utils.date.getDate(), + customProps: { + min: Digit.Utils.date.getDate(applicationCreatedTime), + max: Digit.Utils.date.getDate(), + }, + component: (props, customProps) => , + }, + }, + { + label: t("ES_FSM_ACTION_WASTE_VOLUME_LABEL"), + type: "text", + isMandatory: true, + populators: { + name: "wasteCollected", + validation: { + required: true, + validate: (value) => parseInt(value) <= parseInt(vehicle.capacity), + }, + error: `${t("ES_FSM_ACTION_INVALID_WASTE_VOLUME")} ${vehicle?.capacity} ${t("CS_COMMON_LITRES")}`, + }, + }, + ], + }, + ], +}); diff --git a/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/config/NOCApproverApplication.js b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/config/NOCApproverApplication.js new file mode 100644 index 00000000000..12922b0575e --- /dev/null +++ b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/config/NOCApproverApplication.js @@ -0,0 +1,79 @@ +import { Dropdown, UploadFile } from "@egovernments/digit-ui-react-components"; +import React from "react"; + +export const configNOCApproverApplication = ({ + t, + action, + approvers, + selectedApprover, + setSelectedApprover, + selectFile, + uploadedFile, + setUploadedFile, + assigneeLabel, + businessService, + error +}) => { + + let isCommentRequired = false; + if(action?.action == "REVOCATE" || action?.action == "REJECT") { + isCommentRequired = true; + } + + let isRejectOrRevocate = false; + if(action?.action == "APPROVE" || action?.action == "REJECT" || action.action == "AUTO_APPROVE" || action.action == "AUTO_REJECT") { + isRejectOrRevocate = true; + } + + return { + label: { + heading: `WF_${action?.action}_APPLICATION`, + submit: `WF_${businessService}_${action?.action}`, + cancel: "CORE_LOGOUTPOPUP_CANCEL", + }, + form: [ + { + body: [ + { + label: action.isTerminateState || isRejectOrRevocate ? null : t(assigneeLabel || `WF_ROLE_${action.assigneeRoles?.[0]}`), + type: "dropdown", + populators: action.isTerminateState || isRejectOrRevocate ? null : ( + + ), + }, + { + label: t("WF_COMMON_COMMENTS"), + type: "textarea", + isMandatory: isCommentRequired, + populators: { + name: "comments", + }, + }, + { + label: `${t("WF_APPROVAL_UPLOAD_HEAD")}`, + populators: ( + { + setUploadedFile(null); + }} + showHint={true} + message={uploadedFile ? `1 ${t(`ES_PT_ACTION_FILEUPLOADED`)}` : t(`CS_ACTION_NO_FILEUPLOADED`)} + accept= "image/*, .pdf, .png, .jpeg, .jpg" + iserror={error} + /> + ), + }, + ], + }, + ], + }; +}; \ No newline at end of file diff --git a/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/config/PTApproverApplication.js b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/config/PTApproverApplication.js new file mode 100644 index 00000000000..afcc6a19be2 --- /dev/null +++ b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/config/PTApproverApplication.js @@ -0,0 +1,66 @@ +import { Dropdown, UploadFile } from "@egovernments/digit-ui-react-components"; +import React from "react"; + +export const configPTApproverApplication = ({ + t, + action, + approvers, + selectedApprover, + setSelectedApprover, + selectFile, + uploadedFile, + setUploadedFile, + assigneeLabel, + businessService, +}) => { + return { + label: { + heading: `WF_${action?.action}_APPLICATION`, + submit: `WF_${businessService}_${action?.action}`, + cancel: "ES_PT_COMMON_CANCEL", + }, + form: [ + { + body: [ + { + label: action.isTerminateState || action?.action === "SENDBACKTOCITIZEN" ? null : t(assigneeLabel || `WF_ROLE_${action.assigneeRoles?.[0]}`), + // isMandatory: !action.isTerminateState, + type: "dropdown", + populators: action.isTerminateState || action?.action === "SENDBACKTOCITIZEN" ? null : ( + + ), + }, + { + label: t("ES_PT_ACTION_COMMENTS"), + type: "textarea", + populators: { + name: "comments", + }, + }, + { + label: `${t("ES_PT_ATTACH_FILE")}${action.docUploadRequired ? " *" : ""}`, + populators: ( + { + setUploadedFile(null); + }} + showHint={true} + hintText={t("PT_ATTACH_RESTRICTIONS_SIZE")} + message={uploadedFile ? `1 ${t(`ES_PT_ACTION_FILEUPLOADED`)}` : t(`ES_PT_ACTION_NO_FILEUPLOADED`)} + /> + ), + }, + ], + }, + ], + }; +}; diff --git a/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/config/PTAssessProperty.js b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/config/PTAssessProperty.js new file mode 100644 index 00000000000..dd04037aab6 --- /dev/null +++ b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/config/PTAssessProperty.js @@ -0,0 +1,26 @@ +import React from "react"; +import { RadioButtons } from "@egovernments/digit-ui-react-components"; + +export const configPTAssessProperty = ({ t, action, financialYears, selectedFinancialYear, setSelectedFinancialYear }) => { + return { + label: { + heading: `WF_${action.action}_APPLICATION`, + submit: `WF_PT.CREATE_${action.action}`, + cancel: "ES_PT_COMMON_CANCEL", + }, + form: [ + { + body: [ + { + label: t("ES_PT_FINANCIAL_YEARS"), + isMandatory: true, + type: "radio", + populators: ( + + ), + }, + ], + }, + ], + }; +}; diff --git a/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/config/ReassignDso.js b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/config/ReassignDso.js new file mode 100644 index 00000000000..132a5bc6a7c --- /dev/null +++ b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/config/ReassignDso.js @@ -0,0 +1,101 @@ +import React from "react"; +import { Dropdown } from "@egovernments/digit-ui-react-components"; + +function getFilteredDsoData(dsoData, vehicle) { + return dsoData?.filter((e) => e.vehicles?.find((veh) => veh?.type == vehicle?.code)); +} + +export const configReassignDSO = ({ + t, + dsoData, + dso, + selectDSO, + vehicleMenu, + vehicle, + selectVehicle, + reassignReasonMenu, + reassignReason, + selectReassignReason, + action, + showReassignReason, +}) => ({ + label: { + heading: `ES_FSM_ACTION_TITLE_${action}`, + submit: `CS_COMMON_${action}`, + cancel: "CS_COMMON_CANCEL", + }, + form: [ + { + body: [ + ...(showReassignReason + ? [ + { + label: t("ES_FSM_ACTION_REASSIGN_REASON"), + type: "dropdown", + isMandatory: true, + populators: ( + + ), + }, + ] + : []), + { + label: t("ES_FSM_ACTION_VEHICLE_TYPE"), + isMandatory: vehicle ? false : true, + type: "dropdown", + populators: ( + + ), + }, + { + label: t("ES_FSM_ACTION_DSO_NAME"), + isMandatory: true, + type: "dropdown", + populators: ( + + ), + }, + { + label: t("ES_FSM_ACTION_VEHICLE_CAPACITY_IN_LTRS"), + type: "text", + populators: { + name: "capacity", + validation: { + required: true, + }, + }, + disable: true, + }, + { + label: t("ES_FSM_ACTION_SERVICE_DATE"), + isMandatory: true, + type: "date", + populators: { + name: "date", + validation: { + required: true, + }, + min: Digit.Utils.date.getDate(), + defaultValue: Digit.Utils.date.getDate(), + }, + }, + ], + }, + ], +}); diff --git a/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/config/RejectApplication.js b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/config/RejectApplication.js new file mode 100644 index 00000000000..a18bdaf1110 --- /dev/null +++ b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/config/RejectApplication.js @@ -0,0 +1,31 @@ +import React from "react"; +import { Dropdown } from "@egovernments/digit-ui-react-components"; + +export const configRejectApplication = ({ t, rejectMenu, setReason, reason, action }) => { + return { + label: { + heading: `ES_FSM_ACTION_TITLE_${action}`, + submit: `CS_COMMON_${action}`, + cancel: "CS_COMMON_CANCEL", + }, + form: [ + { + body: [ + { + label: t(`ES_FSM_ACTION_${action.toUpperCase()}_REASON`), + type: "dropdown", + populators: , + isMandatory: true, + }, + { + label: t("ES_FSM_ACTION_COMMENTS"), + type: "textarea", + populators: { + name: "comments", + }, + }, + ], + }, + ], + }; +}; diff --git a/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/config/TLApproverApplication.js b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/config/TLApproverApplication.js new file mode 100644 index 00000000000..23b20e5be2b --- /dev/null +++ b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/config/TLApproverApplication.js @@ -0,0 +1,83 @@ +import { Dropdown, UploadFile } from "@egovernments/digit-ui-react-components"; +import React from "react"; + +export const configTLApproverApplication = ({ + t, + action, + approvers, + selectedApprover, + setSelectedApprover, + selectFile, + uploadedFile, + setUploadedFile, + assigneeLabel, + businessService, +}) => { + let checkCondtions = true; + if (action?.action == "SENDBACKTOCITIZEN" || action?.action == "APPROVE") checkCondtions = false; + if (action.isTerminateState) checkCondtions = false; + + return { + label: { + heading: `WF_${action?.action}_APPLICATION`, + submit: `WF_${businessService?.toUpperCase()}_${action?.action}`, + cancel: "WF_EMPLOYEE_NEWTL_CANCEL", + }, + form: [ + { + body: [ + { + label: !checkCondtions ? null : t("WF_ASSIGNEE_NAME_LABEL"), + placeholder: !checkCondtions ? null : t("WF_ASSIGNEE_NAME_PLACEHOLDER"), + // isMandatory: false, + type: "dropdown", + populators: !checkCondtions ? null : ( + + ), + }, + { + label: t("WF_COMMON_COMMENTS"), + type: "textarea", + populators: { + name: "comments", + }, + }, + { + label: t("TL_APPROVAL_CHECKLIST_BUTTON_UP_FILE"), + populators: ( + { + setUploadedFile(null); + }} + message={uploadedFile ? `1 ${t(`ES_PT_ACTION_FILEUPLOADED`)}` : t(`CS_ACTION_NO_FILEUPLOADED`)} + /> + ) + }, + // { + // label: action.docUploadRequired ? t("ES_PT_UPLOAD_FILE") : null, + // populators: action.docUploadRequired ? ( + // { + // setUploadedFile(null); + // }} + // message={uploadedFile ? `1 ${t(`ES_PT_ACTION_FILEUPLOADED`)}` : t(`ES_PT_ACTION_NO_FILEUPLOADED`)} + // /> + // ) : null, + // }, + ], + }, + ], + }; +}; diff --git a/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/config/WSApproverApplication.js b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/config/WSApproverApplication.js new file mode 100644 index 00000000000..2f5f2d45a6a --- /dev/null +++ b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/config/WSApproverApplication.js @@ -0,0 +1,73 @@ +import { Dropdown, UploadFile } from "@egovernments/digit-ui-react-components"; +import React from "react"; + +export const configWSApproverApplication = ({ + t, + action, + approvers, + selectedApprover, + setSelectedApprover, + selectFile, + uploadedFile, + setUploadedFile, + assigneeLabel, + businessService, + error +}) => { + let checkCondtions = true; + if (action?.action?.includes("SEND_BACK") || action?.action == "APPROVE_FOR_CONNECTION") checkCondtions = false; + if (action.isTerminateState) checkCondtions = false; + + return { + label: { + heading: `WF_${action?.action}_APPLICATION`, + submit: `WF_${businessService?.toUpperCase()}_${action?.action}`, + cancel: "CS_COMMON_CANCEL", + }, + form: [ + { + body: [ + { + label: !checkCondtions ? null : t("WF_ASSIGNEE_NAME_LABEL"), + placeholder: !checkCondtions ? null : t("WF_ASSIGNEE_NAME_PLACEHOLDER"), + // isMandatory: false, + type: "dropdown", + populators: !checkCondtions ? null : ( + + ), + }, + { + label: t("WF_COMMON_COMMENTS"), + type: "textarea", + populators: { + name: "comments", + }, + }, + { + label: t("WS_APPROVAL_CHECKLIST_BUTTON_UP_FILE"), + populators: ( + { + setUploadedFile(null); + }} + message={uploadedFile ? `1 ${t(`ES_PT_ACTION_FILEUPLOADED`)}` : t(`CS_ACTION_NO_FILEUPLOADED`)} + error={error} + iserror={error} + /> + ) + }, + ], + }, + ], + }; +}; diff --git a/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/config/WSDisconnectApplication.js b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/config/WSDisconnectApplication.js new file mode 100644 index 00000000000..5acdcebe041 --- /dev/null +++ b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/config/WSDisconnectApplication.js @@ -0,0 +1,89 @@ +import { Dropdown, UploadFile, DatePicker } from "@egovernments/digit-ui-react-components"; +import React from "react"; + +export const configWSDisConnectApplication = ({ + t, + action, + approvers, + selectedApprover, + setSelectedApprover, + selectFile, + uploadedFile, + setUploadedFile, + assigneeLabel, + businessService, + error +}) => { + let checkCondtions = true, isDatePickerDisplay = false; + if (action?.action?.includes("SEND_BACK") || action?.action == "APPROVE_FOR_DISCONNECTION" || action?.action == "RESUBMIT_APPLICATION") checkCondtions = false; + if (action.isTerminateState) checkCondtions = false; + if (action?.action == "EXECUTE_DISCONNECTION" || action?.action == "DISCONNECTION_EXECUTED") isDatePickerDisplay = true; + + + return { + label: { + heading: `WF_${action?.action}_APPLICATION`, + submit: `WF_${businessService?.toUpperCase()}_${action?.action}`, + cancel: "CS_COMMON_CANCEL", + }, + form: [ + { + body: [ + { + label: !checkCondtions ? null : t("WF_ASSIGNEE_NAME_LABEL"), + placeholder: !checkCondtions ? null : t("WF_ASSIGNEE_NAME_PLACEHOLDER"), + // isMandatory: false, + type: "dropdown", + populators: !checkCondtions ? null : ( + + ), + }, + isDatePickerDisplay && { + label: t("ES_FSM_ACTION_SERVICE_DATE"), + isMandatory: isDatePickerDisplay ? true : false, + type: "custom", + populators: isDatePickerDisplay ? { + name: "date", + validation: { + required: true, + }, + // customProps: { max: Digit.Utils.date.getDate() }, + defaultValue: Digit.Utils.date.getDate(), + component: (props, customProps) => , + } : null, + }, + { + label: t("WF_COMMON_COMMENTS"), + type: "textarea", + populators: { + name: "comments", + }, + }, + { + label: t("WS_APPROVAL_CHECKLIST_BUTTON_UP_FILE"), + populators: ( + { + setUploadedFile(null); + }} + message={uploadedFile ? `1 ${t(`ES_PT_ACTION_FILEUPLOADED`)}` : t(`CS_ACTION_NO_FILEUPLOADED`)} + error={error} + iserror={error} + /> + ) + }, + ], + }, + ], + }; +}; \ No newline at end of file diff --git a/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/config/configApproveModal.js b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/config/configApproveModal.js new file mode 100644 index 00000000000..03beb885925 --- /dev/null +++ b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/config/configApproveModal.js @@ -0,0 +1,53 @@ +import { Dropdown } from '@egovernments/digit-ui-react-components'; +import React, { useState } from 'react' + +const configApproveModal = ({ + t, + action +}) => { + if(action?.action === 'ADMINSANCTION'){ + return { + label: { + heading: `WORKS_APPROVE_ESTIMATE`, + submit: `WORKS_APPROVE_ESTIMATE`, + cancel: "CS_COMMON_CANCEL", + }, + form: [ + { + body: [ + { + label: t("WF_COMMON_COMMENTS"), + type: "textarea", + populators: { + name: "comments", + }, + }, + ] + } + ] + } + + }else + return { + label: { + heading: `WORKS_APPROVE_LOI`, + submit: `WORKS_APPROVE_LOI`, + cancel: "CS_COMMON_CANCEL", + }, + form: [ + { + body: [ + { + label: t("WF_COMMON_COMMENTS"), + type: "textarea", + populators: { + name: "comments", + }, + }, + ] + } + ] + } +} + +export default configApproveModal \ No newline at end of file diff --git a/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/config/configAttendanceApproveModal.js b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/config/configAttendanceApproveModal.js new file mode 100644 index 00000000000..06a29a26339 --- /dev/null +++ b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/config/configAttendanceApproveModal.js @@ -0,0 +1,27 @@ + +const configAttendanceApproveModal = ({ t, action }) => { + if (action?.applicationStatus === "APPROVED") { + return { + label: { + heading: t("ATM_PROCESSINGMODAL_HEADER"), + submit: t("ATM_FORWARD_FOR_APPROVAL"), + cancel: t("CS_COMMON_CANCEL"), + }, + form: [ + { + body: [ + { + label: t("WF_COMMON_COMMENTS"), + type: "textarea", + populators: { + name: "comments", + }, + }, + ], + }, + ] + }; + } +}; + +export default configAttendanceApproveModal; diff --git a/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/config/configAttendanceCheckModal.js b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/config/configAttendanceCheckModal.js new file mode 100644 index 00000000000..374219cc6d4 --- /dev/null +++ b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/config/configAttendanceCheckModal.js @@ -0,0 +1,93 @@ +const configAttendanceCheckModal = ({ + t, + action, + businessService, + approvers, + selectedApprover, + setSelectedApprover, + designation, + selectedDesignation, + setSelectedDesignation, + department, + selectedDept, + setSelectedDept, + approverLoading = false, +}) => { + let checkConditions = true; + if (action.isTerminateState) checkConditions = false; + + if (designation?.length === 0 || department?.length === 0) return {}; + + if (action?.applicationStatus === "ATTENDANCE_CHECKED") { + return { + label: { + heading: t("ATM_PROCESSINGMODAL_HEADER"), + submit: t("ATM_FORWARD_FOR_CHECK"), + cancel: t("WORKS_CANCEL"), + }, + form: [ + { + body: [ + { + isMandatory: true, + key: "department", + type: "radioordropdown", + label: !checkConditions ? null : t("ATM_APPROVER_DEPT"), + disable: false, + populators: { + name: "department", + optionsKey: "i18nKey", + error: "Department is required", + required: true, + options: department, + }, + }, + { + isMandatory: true, + key: "designation", + type: "radioordropdown", + label: !checkConditions ? null : t("ATM_APPROVER_DESIGNATION"), + disable: false, + populators: { + name: "designation", + optionsKey: "i18nKey", + error: "Designation is required", + required: true, + options: designation, + }, + }, + { + isMandatory: true, + key: "approvers", + type: "radioordropdown", + label: !checkConditions ? null : t("WORKS_APPROVER"), + disable: false, + populators: { + name: "approvers", + optionsKey: "nameOfEmp", + error: "Designation is required", + required: true, + options: approvers, + }, + }, + { + label: t("WF_COMMON_COMMENTS"), + type: "textarea", + populators: { + name: "comments", + }, + }, + ], + }, + ], + defaultValues: { + department: "", + designation: "", + approvers: "", + comments: "", + }, + }; + } +}; + +export default configAttendanceCheckModal; diff --git a/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/config/configAttendanceRejectModal.js b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/config/configAttendanceRejectModal.js new file mode 100644 index 00000000000..c732127aac7 --- /dev/null +++ b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/config/configAttendanceRejectModal.js @@ -0,0 +1,61 @@ +import { LabelFieldPair,CardLabel} from '@egovernments/digit-ui-react-components'; +import React from 'react' + +const configAttendanceRejectModal = ({ + t, + empDepartment, + empDesignation, + empName +}) => { + + const fieldLabelStyle = { + "display" : "grid", + "gridTemplateColumns" : "60% 1fr" + }; + + return { + label: { + heading: t("ATM_PROCESSINGMODAL_HEADER"), + submit: t("ATM_CONFIRM_REJECT"), + cancel: t("CS_COMMON_CANCEL"), + }, + form: [ + { + body: [ + { + withoutLabel:true, + populators: + {t("ATM_DEPARTMENT")} + {empDepartment} + , + }, + { + withoutLabel:true, + populators: + {t("ATM_DESIGNATION")} + {empDesignation} + , + }, + { + withoutLabel:true, + populators: + {t("ATM_REJECTED_BY")} + {empName} + , + }, + { + label: t("WF_COMMON_COMMENTS"), + type: "textarea", + key: "org_name", + populators: { + name: "comments", + }, + }, + ] + } + ] + } + +} + +export default configAttendanceRejectModal \ No newline at end of file diff --git a/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/config/configCheckModal.js b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/config/configCheckModal.js new file mode 100644 index 00000000000..c267eb9f32f --- /dev/null +++ b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/config/configCheckModal.js @@ -0,0 +1,105 @@ +import { Dropdown,Loader } from '@egovernments/digit-ui-react-components'; +import React,{useState} from 'react' + +const configCheckModal = ({ + t, + action, + businessService, + approvers, + selectedApprover, + setSelectedApprover, + designation, + selectedDesignation, + setSelectedDesignation, + department, + selectedDept, + setSelectedDept, + approverLoading=false, +}) => { + + let checkConditions = true + if (action.isTerminateState) checkConditions = false; + + if(designation?.length===0 || department?.length===0) return {} + + return { + label: { + heading: `WORKS_CHECK_FORWARD`, + submit: `WORKS_FORWARD_FOR_APPROVAL`, + cancel: "WORKS_CANCEL", + }, + form: [ + { + body:[ + { + label: !checkConditions ? null : t("WORKS_APPROVER_DEPT"), + placeholder: !checkConditions ? null : t("WF_ASSIGNEE_NAME_PLACEHOLDER"), + isMandatory: true, + type: "goToDefaultCase", + populators: !checkConditions ? null : ( + { + setSelectedDept(val) + setSelectedApprover("") + //setValue() + }} + selected={selectedDept} + t={t} + /> + ), + }, + { + label: !checkConditions ? null : t("WORKS_APPROVER_DESIGNATION"), + //placeholder: !checkConditions ? null : t("WF_ASSIGNEE_NAME_PLACEHOLDER"), + isMandatory: true, + type: "goToDefaultCase", + populators: !checkConditions ? null : ( + { + setSelectedDesignation(val) + setSelectedApprover("") + //resetting approver dropdown when dept/designation changes + }} + selected={selectedDesignation} + t={t} + /> + ), + }, + { + label: !checkConditions ? null : t("WORKS_APPROVER"), + //placeholder: !checkConditions ? null : t("WF_ASSIGNEE_NAME_PLACEHOLDER"), + isMandatory: true, + type: "goToDefaultCase", + populators: !checkConditions ? null : ( + approverLoading ? : + ), + }, + { + label: t("WF_COMMON_COMMENTS"), + type: "textarea", + populators: { + name: "comments", + }, + }, + ] + } + ] + } +} + +export default configCheckModal \ No newline at end of file diff --git a/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/config/configRejectModal.js b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/config/configRejectModal.js new file mode 100644 index 00000000000..ae4be5af3fd --- /dev/null +++ b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/config/configRejectModal.js @@ -0,0 +1,127 @@ +import { Dropdown,LabelFieldPair,CardLabel} from '@egovernments/digit-ui-react-components'; +import React, { useState } from 'react' + +const configRejectModal = ({ + t, + action, + rejectReasons, + selectedReason, + setSelectedReason, + loiNumber, + department, + estimateNumber +}) => { + + let checkConditions = true + if (action.isTerminateState) checkConditions = false; + + if(rejectReasons?.length === 0) return {} + if(loiNumber){ + return { + label: { + heading: `WORKS_REJECT_LOI`, + submit: `WORKS_REJECT_LOI`, + //cancel: "CS_COMMON_CANCEL", + }, + form: [ + { + body: [ + { + withoutLabel:true, + populators: + {t("WORKS_DEPARTMENT")} + {"ENGG"} + , + }, + { + //label: t("WORKS_LOI_ID"), + //type: "text", + withoutLabel: true, + populators: + {t("WORKS_LOI_ID")} + {loiNumber} + + }, + { + label: !checkConditions ? null : t("WORKS_REJECT_REASON"), + //placeholder: !checkConditions ? null : t("WF_ASSIGNEE_NAME_PLACEHOLDER"), + // isMandatory: false, + type: "goToDefaultCase", + populators: !checkConditions ? null : ( + + ), + }, + { + label: t("WF_COMMON_COMMENTS"), + type: "textarea", + populators: { + name: "comments", + }, + }, + ] + } + ] + } + }else{ + return { + label: { + heading: `WORKS_REJECT_ESTIMATE`, + submit: `WORKS_REJECT_ESTIMATE`, + //cancel: "CS_COMMON_CANCEL", + }, + form: [ + { + body: [ + { + withoutLabel:true, + populators: + {t("WORKS_DEPARTMENT")} + {"ENGG"} + , + }, + { + //label: t("WORKS_LOI_ID"), + //type: "text", + withoutLabel: true, + populators: + {t("WORKS_ESTIMATE_ID")} + {estimateNumber} + + }, + { + label: !checkConditions ? null : t("WORKS_REJECT_REASON"), + //placeholder: !checkConditions ? null : t("WF_ASSIGNEE_NAME_PLACEHOLDER"), + // isMandatory: false, + type: "goToDefaultCase", + populators: !checkConditions ? null : ( + + ), + }, + { + label: t("WF_COMMON_COMMENTS"), + type: "textarea", + populators: { + name: "comments", + }, + }, + ] + } + ] + } + + } +} + +export default configRejectModal \ No newline at end of file diff --git a/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/config/configViewBillApproveModal.js b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/config/configViewBillApproveModal.js new file mode 100644 index 00000000000..cd01fdc4414 --- /dev/null +++ b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/config/configViewBillApproveModal.js @@ -0,0 +1,57 @@ +import React from 'react' +import { LabelFieldPair,CardLabel} from '@egovernments/digit-ui-react-components'; + +const configViewBillApprovalModal = ({ + t, +}) => { + const fieldLabelStyle = { + "display" : "grid", + "gridTemplateColumns" : "60% 1fr" + }; + return { + label: { + heading: t("EXP_PROCESSINGMODAL_HEADER"), + submit: t("EXP_FORWARD_FOR_APPROVAL"), + cancel: t("CS_COMMON_CANCEL"), + }, + form: [ + { + body: [ + { + withoutLabel:true, + populators: + {t("EXP_DEPARTMENT")} + Engineering + , + }, + { + withoutLabel:true, + populators: + {t("EXP_DESIGNATION")} + Junior Engineer + , + }, + { + withoutLabel:true, + populators: + {t("EXP_APPROVER")} + {"RASHMI"} + , + }, + { + label: t("WF_COMMON_COMMENTS"), + type: "textarea", + populators: { + name: "comments", + }, + }, + ], + }, + ], + defaultValues: { + comments: "", + }, + }; +} + +export default configViewBillApprovalModal \ No newline at end of file diff --git a/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/config/configViewBillCheckModal.js b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/config/configViewBillCheckModal.js new file mode 100644 index 00000000000..53204b28e75 --- /dev/null +++ b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/config/configViewBillCheckModal.js @@ -0,0 +1,107 @@ +import { Dropdown, Loader } from '@egovernments/digit-ui-react-components'; +import React, { useState } from 'react' + +const configViewBillCheckModal = ({ + t, + approvers, + selectedApprover, + setSelectedApprover, + designation, + selectedDesignation, + setSelectedDesignation, + department, + selectedDept, + setSelectedDept, + approverLoading = false, +}) => { + + let checkConditions = true + + + if (designation?.length === 0 || department?.length === 0) return {} + + return { + label: { + heading: t("EXP_FORWARD_BILL_FOR_APPROVAL"), + submit: t("EXP_FORWARD_BILL_FOR_APPROVAL"), + cancel: t("CS_COMMON_CANCEL"), + }, + form: [ + { + body: [ + { + label: !checkConditions ? null : t("WORKS_APPROVER_DEPT"), + placeholder: !checkConditions ? null : t("WF_ASSIGNEE_NAME_PLACEHOLDER"), + isMandatory: true, + type: "goToDefaultCase", + populators: !checkConditions ? null : ( + { + setSelectedDept(val) + setSelectedApprover("") + //setValue() + }} + selected={selectedDept} + t={t} + /> + ), + }, + { + label: !checkConditions ? null : t("WORKS_APPROVER_DESIGNATION"), + //placeholder: !checkConditions ? null : t("WF_ASSIGNEE_NAME_PLACEHOLDER"), + isMandatory: true, + type: "goToDefaultCase", + name: "designation", + populators: !checkConditions ? null : ( + { + setSelectedDesignation(val) + setSelectedApprover("") + //resetting approver dropdown when dept/designation changes + }} + selected={selectedDesignation} + t={t} + /> + ), + }, + { + label: !checkConditions ? null : t("WORKS_APPROVER"), + //placeholder: !checkConditions ? null : t("WF_ASSIGNEE_NAME_PLACEHOLDER"), + isMandatory: true, + type: "goToDefaultCase", + populators: !checkConditions ? null : ( + approverLoading ? : + ), + }, + { + label: t("WF_COMMON_COMMENTS"), + type: "textarea", + populators: { + name: "comments", + }, + }, + ] + } + ] + } +} + +export default configViewBillCheckModal; \ No newline at end of file diff --git a/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/config/configViewBillRejectModal.js b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/config/configViewBillRejectModal.js new file mode 100644 index 00000000000..716d6179d10 --- /dev/null +++ b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/config/configViewBillRejectModal.js @@ -0,0 +1,59 @@ +import React from 'react' +import { LabelFieldPair,CardLabel} from '@egovernments/digit-ui-react-components'; + +const configViewBillRejectModal = ({ + t, +}) => { + + const fieldLabelStyle = { + "display" : "grid", + "gridTemplateColumns" : "60% 1fr" + }; + + return { + label: { + heading: t("EXP_PROCESSINGMODAL_HEADER"), + submit: t("EXP_CONFIRM_REJECT"), + cancel: t("CS_COMMON_CANCEL"), + }, + form: [ + { + body: [ + { + withoutLabel:true, + populators: + {t("EXP_DEPARTMENT")} + Engineering + , + }, + { + withoutLabel:true, + populators: + {t("EXP_DESIGNATION")} + Junior Engineer + , + }, + { + withoutLabel:true, + populators: + {t("EXP_REJECTED_BY")} + {"RASHMI"} + , + }, + { + label: t("WF_COMMON_COMMENTS"), + type: "textarea", + populators: { + name: "comments", + }, + }, + ] + } + ], + defaultValues : { + comments : "", + } + } +} + +export default configViewBillRejectModal \ No newline at end of file diff --git a/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/config/index.js b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/config/index.js new file mode 100644 index 00000000000..a736b8ed3eb --- /dev/null +++ b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/config/index.js @@ -0,0 +1,47 @@ +import { configAssignDso } from "./AssignDso"; +import { configCompleteApplication } from "./CompleteApplication"; +import { configReassignDSO } from "./ReassignDso"; +import { configRejectApplication } from "./RejectApplication"; +import { configAcceptDso } from "./AcceptDso"; +import { configPTApproverApplication } from "./PTApproverApplication"; +import { configPTAssessProperty } from "./PTAssessProperty"; +import { configTLApproverApplication } from "./TLApproverApplication"; +import { configBPAREGApproverApplication } from "./BPAREGApproverApplication"; +import { configBPAApproverApplication } from "./BPAApproverApplication"; +import { configNOCApproverApplication } from "./NOCApproverApplication"; +import { configWSApproverApplication } from "./WSApproverApplication"; +import { configWSDisConnectApplication } from "./WSDisconnectApplication"; +import configCheckModal from "./configCheckModal" +import configApproveModal from "./configApproveModal" +import configRejectModal from "./configRejectModal" +import configAttendanceApproveModal from "./configAttendanceApproveModal"; +import configAttendanceCheckModal from "./configAttendanceCheckModal"; +import configAttendanceRejectModal from "./configAttendanceRejectModal"; +import configViewBillApproveModal from "./configViewBillApproveModal"; +import configViewBillCheckModal from "./configViewBillCheckModal"; +import configViewBillRejectModal from "./configViewBillRejectModal"; + +export { + configAttendanceRejectModal, + configAttendanceCheckModal, + configAttendanceApproveModal, + configCheckModal, + configApproveModal, + configRejectModal, + configAssignDso, + configCompleteApplication, + configReassignDSO, + configRejectApplication, + configAcceptDso, + configPTApproverApplication, + configPTAssessProperty, + configTLApproverApplication, + configBPAREGApproverApplication, + configBPAApproverApplication, + configNOCApproverApplication, + configWSApproverApplication, + configWSDisConnectApplication, + configViewBillRejectModal, + configViewBillCheckModal, + configViewBillApproveModal +}; diff --git a/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/index.js b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/index.js new file mode 100644 index 00000000000..feb622ab712 --- /dev/null +++ b/micro-ui/web/micro-ui-internals/packages/modules/templates/ApplicationDetails/index.js @@ -0,0 +1,368 @@ +import React, { useEffect, useState } from "react"; +import { useTranslation } from "react-i18next"; +import { useQueryClient } from "react-query"; +import { format } from "date-fns"; + +import { Loader } from "@egovernments/digit-ui-react-components"; + +import ActionModal from "./Modal"; + +import { useHistory, useParams } from "react-router-dom"; +import ApplicationDetailsContent from "./components/ApplicationDetailsContent"; +import ApplicationDetailsToast from "./components/ApplicationDetailsToast"; +import ApplicationDetailsActionBar from "./components/ApplicationDetailsActionBar"; +import ApplicationDetailsWarningPopup from "./components/ApplicationDetailsWarningPopup"; + +const ApplicationDetails = (props) => { + const tenantId = Digit.ULBService.getCurrentTenantId(); + const state = Digit.ULBService.getStateId(); + const { t } = useTranslation(); + const history = useHistory(); + let { id: applicationNumber } = useParams(); + const [displayMenu, setDisplayMenu] = useState(false); + const [selectedAction, setSelectedAction] = useState(null); + const [showModal, setShowModal] = useState(false); + const [isEnableLoader, setIsEnableLoader] = useState(false); + const [isWarningPop, setWarningPopUp] = useState(false); + const [modify, setModify] = useState(false); + const [saveAttendanceState, setSaveAttendanceState] = useState({ displaySave : false, updatePayload: []}) + + const { + applicationDetails, + showToast, + setShowToast, + isLoading, + isDataLoading, + applicationData, + mutate, + nocMutation, + workflowDetails, + businessService, + closeToast, + moduleCode, + timelineStatusPrefix, + forcedActionPrefix, + statusAttribute, + ActionBarStyle, + MenuStyle, + paymentsList, + showTimeLine = true, + oldValue, + isInfoLabel = false, + clearDataDetails, + noBoxShadow, + sectionHeadStyle, + showActionBar = true + } = props; + + useEffect(() => { + if (showToast) { + workflowDetails.revalidate(); + } + }, [showToast]); + + function onActionSelect(action) { + if (action) { + if(action?.isToast){ + setShowToast({ key: "error", error: { message: action?.toastMessage } }); + setTimeout(closeToast, 5000); + } + else if (action?.isWarningPopUp) { + setWarningPopUp(true); + } else if (action?.redirectionUrll) { + //here do the loi edit upon rejection + if (action?.redirectionUrll?.action === "EDIT_LOI_APPLICATION") { + history.push(`${action?.redirectionUrll?.pathname}`, { data: action?.redirectionUrll?.state }); + } + if (action?.redirectionUrll?.action === "EDIT_ESTIMATE_APPLICATION") { + history.push(`${action?.redirectionUrll?.pathname}`,{ data: action?.redirectionUrll?.state }); + } + + } else if (!action?.redirectionUrl) { + if(action?.action === 'EDIT') setModify(true) + else setShowModal(true); + } else { + history.push({ + pathname: action.redirectionUrl?.pathname, + state: { ...action.redirectionUrl?.state }, + }); + } + } + setSelectedAction(action); + setDisplayMenu(false); + } + + const queryClient = useQueryClient(); + + const closeModal = () => { + setSelectedAction(null); + setShowModal(false); + }; + + const closeWarningPopup = () => { + setWarningPopUp(false); + }; + + const getResponseHeader = (action) => { + + if(action?.includes("CHECK")){ + return t("WORKS_LOI_RESPONSE_FORWARD_HEADER") + } else if (action?.includes("APPROVE")){ + return t("WORKS_LOI_RESPONSE_APPROVE_HEADER") + }else if(action?.includes("REJECT")){ + return t("WORKS_LOI_RESPONSE_REJECT_HEADER") + } + } + + const getResponseMessage = (action,updatedLOI) => { + + if (action?.includes("CHECK")) { + return t("WORKS_LOI_RESPONSE_MESSAGE_CHECK", { loiNumber: updatedLOI?.letterOfIndentNumber,name:"Nipun",designation:"SE" }) + } else if (action?.includes("APPROVE")) { + return t("WORKS_LOI_RESPONSE_MESSAGE_APPROVE", { loiNumber: updatedLOI?.letterOfIndentNumber }) + } else if (action?.includes("REJECT")) { + return t("WORKS_LOI_RESPONSE_MESSAGE_REJECT", { loiNumber: updatedLOI?.letterOfIndentNumber }) + } + } + + const getEstimateResponseHeader = (action) => { + + if(action?.includes("CHECK")){ + return t("WORKS_ESTIMATE_RESPONSE_FORWARD_HEADER") + } else if (action?.includes("TECHNICALSANCATION")){ + return t("WORKS_ESTIMATE_RESPONSE_FORWARD_HEADER") + }else if (action?.includes("ADMINSANCTION")){ + return t("WORKS_ESTIMATE_RESPONSE_APPROVE_HEADER") + }else if(action?.includes("REJECT")){ + return t("WORKS_ESTIMATE_RESPONSE_REJECT_HEADER") + } + } + + const getEstimateResponseMessage = (action,updatedEstimate) => { + + if (action?.includes("CHECK")) { + return t("WORKS_ESTIMATE_RESPONSE_MESSAGE_CHECK", { estimateNumber: updatedEstimate?.estimateNumber,Name:"Super",Designation:"SE",Department:"Health" }) + } else if (action?.includes("TECHNICALSANCATION")) { + return t("WORKS_ESTIMATE_RESPONSE_MESSAGE_CHECK", { estimateNumber: updatedEstimate?.estimateNumber,Name:"Super",Designation:"SE",Department:"Health" }) + } else if (action?.includes("ADMINSANCTION")) { + return t("WORKS_ESTIMATE_RESPONSE_MESSAGE_APPROVE", { estimateNumber: updatedEstimate?.estimateNumber }) + } else if (action?.includes("REJECT")) { + return t("WORKS_ESTIMATE_RESPONSE_MESSAGE_REJECT", { estimateNumber: updatedEstimate?.estimateNumber }) + } + } + + const getAttendanceResponseHeaderAndMessage = (action) => { + let response = {} + if (action?.includes("VERIFY")) { + response.header = t("ATM_ATTENDANCE_VERIFIED") + response.message = t("ATM_ATTENDANCE_VERIFIED_SUCCESS") + } else if (action?.includes("REJECT")) { + response.header = t("ATM_ATTENDANCE_REJECTED") + response.message = t("ATM_ATTENDANCE_REJECTED_SUCCESS") + } else if (action?.includes("APPROVE")) { + response.header = t("ATM_ATTENDANCE_APPROVED") + response.message = t("ATM_ATTENDANCE_APPROVED_SUCCESS") + } + return response + } + + const submitAction = async (data, nocData = false, isOBPS = {}) => { + const performedAction = data?.workflow?.action + setIsEnableLoader(true); + if (mutate) { + setIsEnableLoader(true); + mutate(data, { + onError: (error, variables) => { + setIsEnableLoader(false); + setShowToast({ key: "error", error }); + setTimeout(closeToast, 5000); + }, + onSuccess: (data, variables) => { + setIsEnableLoader(false); + //just history.push to the response component from here and show relevant details + if(data?.letterOfIndents?.[0]){ + const updatedLOI = data?.letterOfIndents?.[0] + const state = { + header:getResponseHeader(performedAction,updatedLOI), + id: updatedLOI?.letterOfIndentNumber, + info: t("WORKS_LOI_ID"), + message: getResponseMessage(performedAction,updatedLOI), + links: [ + { + name: t("WORKS_CREATE_NEW_LOI"), + redirectUrl: `/${window.contextPath}/employee/works/create-loi`, + code: "", + svg: "CreateEstimateIcon", + isVisible:false, + type:"add" + }, + { + name: t("WORKS_GOTO_LOI_INBOX"), + redirectUrl: `/${window.contextPath}/employee/works/LOIInbox`, + code: "", + svg: "CreateEstimateIcon", + isVisible:true, + type:"inbox" + }, + ], + responseData:data, + requestData:variables + } + history.push(`/${window.contextPath}/employee/works/response`, state) + } + if(data?.estimates?.[0]){ + const updatedEstimate = data?.estimates?.[0] + const state = { + header:getEstimateResponseHeader(performedAction,updatedEstimate), + id: updatedEstimate?.estimateNumber, + info: t("WORKS_ESTIMATE_ID"), + message: getEstimateResponseMessage(performedAction,updatedEstimate), + links: [ + { + name: t("WORKS_CREATE_ESTIMATE"), + redirectUrl: `/${window.contextPath}/employee/works/create-estimate`, + code: "", + svg: "CreateEstimateIcon", + isVisible:false, + type:"add" + }, + { + name: t("WORKS_GOTO_ESTIMATE_INBOX"), + redirectUrl: `/${window.contextPath}/employee/works/inbox`, + code: "", + svg: "RefreshIcon", + isVisible:true, + type:"inbox" + }, + ], + responseData:data, + requestData:variables + } + history.push(`/${window.contextPath}/employee/works/response`, state) + } + if (isOBPS?.bpa) { + data.selectedAction = selectedAction; + history.replace(`/${window?.contextPath}/employee/obps/response`, { data: data }); + } + if (isOBPS?.isStakeholder) { + data.selectedAction = selectedAction; + history.push(`/${window?.contextPath}/employee/obps/stakeholder-response`, { data: data }); + } + if (isOBPS?.isNoc) { + history.push(`/${window?.contextPath}/employee/noc/response`, { data: data }); + } + if (data?.Amendments?.length > 0 ){ + //RAIN-6981 instead just show a toast here with appropriate message + //show toast here and return + //history.push("/${window?.contextPath}/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") }) + } + return + } + if(data?.musterRolls?.[0]) { + const musterRoll = data?.musterRolls?.[0] + const response = getAttendanceResponseHeaderAndMessage(performedAction) + const state = { + header: response?.header, + message: response?.message, + info: t("ATM_REGISTER_ID_WEEK"), + id: `${musterRoll.registerId} | ${format(new Date(musterRoll.startDate), "dd/MM/yyyy")} - ${format(new Date(musterRoll.endDate), "dd/MM/yyyy")}`, + } + history.push(`/${window.contextPath}/employee/attendencemgmt/response`, state) + } + setShowToast({ key: "success", action: selectedAction }); + clearDataDetails && setTimeout(clearDataDetails, 3000); + setTimeout(closeToast, 5000); + queryClient.clear(); + queryClient.refetchQueries("APPLICATION_SEARCH"); + //push false status when reject + + }, + }); + } + + closeModal(); + }; + + if (isLoading || isEnableLoader) { + return ; + } + + return ( + + {!isLoading ? ( + + + {showModal ? ( + + ) : null} + {isWarningPop ? ( + + ) : null} + + {showActionBar && } + + ) : ( + + )} + + ); +}; + +export default ApplicationDetails; diff --git a/micro-ui/web/micro-ui-internals/publish-develop.sh b/micro-ui/web/micro-ui-internals/publish-develop.sh new file mode 100644 index 00000000000..4909658c697 --- /dev/null +++ b/micro-ui/web/micro-ui-internals/publish-develop.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +BASEDIR="$(cd "$(dirname "$0")" && pwd)" + +msg() { + echo -e "\n\n\033[32;32m$1\033[0m" +} + + +# msg "Pre-building all packages" +# yarn build +# sleep 5 + +msg "Building and publishing css" +cd "$BASEDIR/packages/css" && rm -rf dist && yarn && npm publish --tag campaign-1.0 + + +# msg "Building and publishing libraries" +# cd "$BASEDIR/packages/modules/workbench-hcm" && rm -rf dist && yarn&& npm publish --tag workbench-1.0 + diff --git a/micro-ui/web/micro-ui-internals/publish.sh b/micro-ui/web/micro-ui-internals/publish.sh new file mode 100644 index 00000000000..4909658c697 --- /dev/null +++ b/micro-ui/web/micro-ui-internals/publish.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +BASEDIR="$(cd "$(dirname "$0")" && pwd)" + +msg() { + echo -e "\n\n\033[32;32m$1\033[0m" +} + + +# msg "Pre-building all packages" +# yarn build +# sleep 5 + +msg "Building and publishing css" +cd "$BASEDIR/packages/css" && rm -rf dist && yarn && npm publish --tag campaign-1.0 + + +# msg "Building and publishing libraries" +# cd "$BASEDIR/packages/modules/workbench-hcm" && rm -rf dist && yarn&& npm publish --tag workbench-1.0 + diff --git a/micro-ui/web/micro-ui-internals/scripts/create.sh b/micro-ui/web/micro-ui-internals/scripts/create.sh new file mode 100755 index 00000000000..9de72331774 --- /dev/null +++ b/micro-ui/web/micro-ui-internals/scripts/create.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +./scripts/run.sh core utilities diff --git a/micro-ui/web/micro-ui-internals/scripts/deploy.sh b/micro-ui/web/micro-ui-internals/scripts/deploy.sh new file mode 100755 index 00000000000..5b0c7b831ed --- /dev/null +++ b/micro-ui/web/micro-ui-internals/scripts/deploy.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +curl -v -X POST https://builds.digit.org/job/builds/job/digit-ui/buildWithParameters \ + --user saurabh-egov:114cbf3df675835931688b2d3f0014a1f7 \ + --data-urlencode json='{"parameter": [{"name":"BRANCH", "value":"origin/'$1'"}]}' + +# curl https://builds.digit.org/job/builds/job/digit-ui/lastBuild/api/json | grep --color result\":null + diff --git a/micro-ui/web/micro-ui-internals/scripts/jenkins.sh b/micro-ui/web/micro-ui-internals/scripts/jenkins.sh new file mode 100755 index 00000000000..a1711fec55b --- /dev/null +++ b/micro-ui/web/micro-ui-internals/scripts/jenkins.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +./scripts/deploy.sh dev \ No newline at end of file diff --git a/micro-ui/web/micro-ui-internals/scripts/run.sh b/micro-ui/web/micro-ui-internals/scripts/run.sh new file mode 100755 index 00000000000..f00c59f13b8 --- /dev/null +++ b/micro-ui/web/micro-ui-internals/scripts/run.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +MODULES=( "components" "core" "libraries" "example" ) + +RUNARGS=() +BUILDARGS=() + +for var in "$@" +do + BUILDARGS=( ${BUILDARGS[@]} build:"$var" ) + RUNARGS=( ${RUNARGS[@]} dev:"$var" ) +done + +a=0 +while [ "$a" -lt 3 ] +do + BUILD[$a]=build:${MODULES[$a]} + a=` expr $a + 1 ` +done + +echo "BUILDING MODULES:-" ${BUILD[*]} ${BUILDARGS[*]} +yarn run-p ${BUILD[*]} ${BUILDARGS[*]} + +b=0 +while [ "$b" -lt 4 ] +do + RUN[$b]=dev:${MODULES[$b]} + b=` expr $b + 1 ` +done + +echo "SERVING MODULES:-" ${RUN[*]} ${RUNARGS[*]} +yarn run-p ${RUN[*]} ${RUNARGS[*]} \ No newline at end of file diff --git a/micro-ui/web/micro-ui-internals/test.js b/micro-ui/web/micro-ui-internals/test.js new file mode 100644 index 00000000000..60c958d0bac --- /dev/null +++ b/micro-ui/web/micro-ui-internals/test.js @@ -0,0 +1,31 @@ +const middleWare_1 = (data, _break, _next) => { + data.a = "a"; + _next(data); +}; + + +const middleWare_2 = (data, _break, _next) => { + data.b = "b"; + // _break(); + _next(data); +}; + +const middleWare_3 = (data, _break, _next) => { + data.c = "c"; + _next(data); +}; + +let middleWares = [middleWare_1, middleWare_2, middleWare_3]; + +const callMiddlewares = () => { + let applyBreak = false; + let itr = -1; + let _break = () => (applyBreak = true); + let _next = (data) => { + if (!applyBreak && ++itr < middleWares.length) middleWares[itr](data, _break, _next); + else return; + }; + _next({}); +}; + +callMiddlewares(); diff --git a/micro-ui/web/package.json b/micro-ui/web/package.json new file mode 100644 index 00000000000..7839e7edf28 --- /dev/null +++ b/micro-ui/web/package.json @@ -0,0 +1,81 @@ +{ + "name": "micro-ui", + "version": "1.0.0", + "author": "Jagankumar ", + "license": "MIT", + "private": true, + "engines": { + "node": ">=14" + }, + "workspaces": [ + + "micro-ui-internals/packages/modules/*" + ], + "homepage": "/digit-ui", + "dependencies": { + "@egovernments/digit-ui-libraries": "1.8.1-beta.4", + "@egovernments/digit-ui-module-core": "1.8.2-beta.6", + "@egovernments/digit-ui-module-utilities": "1.0.1-beta.1", + "@egovernments/digit-ui-react-components": "1.8.1-beta.2", + "@egovernments/digit-ui-module-workbench": "1.0.1-beta.1", + "@egovernments/digit-ui-module-hcmworkbench":"0.0.38", + "@egovernments/digit-ui-module-sample": "0.0.1", + "babel-loader": "8.1.0", + "clean-webpack-plugin": "4.0.0", + "react": "17.0.2", + "react-dom": "17.0.2", + "jsonpath": "^1.1.1", + "react-router-dom": "5.3.0", + "react-scripts": "4.0.1", + "web-vitals": "1.1.2", + "terser-brunch": "^4.1.0", + "react-hook-form": "6.15.8", + "react-i18next": "11.16.2", + "react-query": "3.6.1", + "css-loader": "5.2.6", + "style-loader": "2.0.0", + "webpack-cli": "4.10.0" + }, + "devDependencies": { + "@babel/plugin-proposal-private-property-in-object": "7.21.0", + "http-proxy-middleware": "1.3.1", + "lodash": "4.17.21", + "microbundle-crl": "0.13.11", + "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", + "husky": "7.0.4", + "lint-staged": "12.3.7", + "npm-run-all": "4.1.5", + "prettier": "2.1.2" + }, + "scripts": { + "start": "react-scripts start", + "build": "GENERATE_SOURCEMAP=false SKIP_PREFLIGHT_CHECK=true react-scripts build", + "build:prepare": "./build.sh", + "build:libraries": "cd micro-ui-internals && yarn build", + "build:prod": "webpack --mode production", + "build:webpack": "yarn build:libraries &&cd .. && ls && cd ./web && ls && yarn build:prod", + "clean": "rm -rf node_modules" + }, + "eslintConfig": { + "extends": [ + "react-app" + ] + }, + "browserslist": { + "production": [ + ">0.2%", + "not dead", + "not op_mini all" + ], + "development": [ + "last 1 chrome version", + "last 1 firefox version", + "last 1 safari version" + ] + } +} \ No newline at end of file diff --git a/micro-ui/web/public/index.html b/micro-ui/web/public/index.html new file mode 100644 index 00000000000..38910917406 --- /dev/null +++ b/micro-ui/web/public/index.html @@ -0,0 +1,34 @@ + + + + + + + + + + + + DIGIT + + + + + + +
+ + + + \ No newline at end of file diff --git a/micro-ui/web/public/robots.txt b/micro-ui/web/public/robots.txt new file mode 100644 index 00000000000..e9e57dc4d41 --- /dev/null +++ b/micro-ui/web/public/robots.txt @@ -0,0 +1,3 @@ +# https://www.robotstxt.org/robotstxt.html +User-agent: * +Disallow: diff --git a/micro-ui/web/src/App.js b/micro-ui/web/src/App.js new file mode 100644 index 00000000000..56dc2c68c0d --- /dev/null +++ b/micro-ui/web/src/App.js @@ -0,0 +1,63 @@ +import React from "react"; +import { initLibraries } from "@egovernments/digit-ui-libraries"; +import { DigitUI } from "@egovernments/digit-ui-module-core"; +// import { initHRMSComponents } from "@egovernments/digit-ui-module-hrms"; +import { UICustomizations } from "./Customisations/UICustomizations"; +import { initWorkbenchComponents } from "@egovernments/digit-ui-module-workbench"; +import { initUtilitiesComponents } from "@egovernments/digit-ui-module-utilities"; +import { initWorkbenchHCMComponents } from "@egovernments/digit-ui-module-hcmworkbench"; +import {initSampleComponents} from "@egovernments/digit-ui-module-sample"; +window.contextPath = window?.globalConfigs?.getConfig("CONTEXT_PATH"); + +const enabledModules = [ + "DSS", + "NDSS", + "Utilities", + // "HRMS", + "Engagement", + "Workbench", + "HCMWORKBENCH", + "sample" +]; + +const moduleReducers = (initData) => ({ + initData, +}); + +const initDigitUI = () => { + window.Digit.ComponentRegistryService.setupRegistry({}); + window.Digit.Customizations = { + PGR: {}, + commonUiConfig: UICustomizations, + }; + // initHRMSComponents(); + initUtilitiesComponents(); + initWorkbenchComponents(); + initWorkbenchHCMComponents(); + initSampleComponents(); + +}; + +initLibraries().then(() => { + initDigitUI(); +}); + +function App() { + window.contextPath = window?.globalConfigs?.getConfig("CONTEXT_PATH"); + const stateCode = + window.globalConfigs?.getConfig("STATE_LEVEL_TENANT_ID") || + process.env.REACT_APP_STATE_LEVEL_TENANT_ID; + if (!stateCode) { + return

stateCode is not defined

; + } + return ( + + ); +} + +export default App; diff --git a/micro-ui/web/src/ComponentRegistry.js b/micro-ui/web/src/ComponentRegistry.js new file mode 100644 index 00000000000..9bafce3dc89 --- /dev/null +++ b/micro-ui/web/src/ComponentRegistry.js @@ -0,0 +1,11 @@ +class Registry { + constructor(registry = {}) { + this._registry = registry; + } + + getComponent(id) { + return this._registry[id]; + } +} + +export default Registry; diff --git a/micro-ui/web/src/Customisations/UICustomizations.js b/micro-ui/web/src/Customisations/UICustomizations.js new file mode 100644 index 00000000000..6d17ab0d51b --- /dev/null +++ b/micro-ui/web/src/Customisations/UICustomizations.js @@ -0,0 +1,428 @@ +import { Link } from "react-router-dom"; +import _ from "lodash"; + +//create functions here based on module name set in mdms(eg->SearchProjectConfig) +//how to call these -> Digit?.Customizations?.[masterName]?.[moduleName] +// these functions will act as middlewares +var Digit = window.Digit || {}; + + + +const businessServiceMap = { + + "muster roll": "MR" +}; + +const inboxModuleNameMap = { + "muster-roll-approval": "muster-roll-service", +}; + +export const UICustomizations = { + businessServiceMap, + updatePayload: (applicationDetails, data, action, businessService) => { + + if (businessService === businessServiceMap.estimate) { + const workflow = { + comment: data.comments, + documents: data?.documents?.map((document) => { + return { + documentType: action?.action + " DOC", + fileName: document?.[1]?.file?.name, + fileStoreId: document?.[1]?.fileStoreId?.fileStoreId, + documentUid: document?.[1]?.fileStoreId?.fileStoreId, + tenantId: document?.[1]?.fileStoreId?.tenantId, + }; + }), + assignees: data?.assignees?.uuid ? [data?.assignees?.uuid] : null, + action: action.action, + }; + //filtering out the data + Object.keys(workflow).forEach((key, index) => { + if (!workflow[key] || workflow[key]?.length === 0) delete workflow[key]; + }); + + return { + estimate: applicationDetails, + workflow, + }; + } + if (businessService === businessServiceMap.contract) { + const workflow = { + comment: data?.comments, + documents: data?.documents?.map((document) => { + return { + documentType: action?.action + " DOC", + fileName: document?.[1]?.file?.name, + fileStoreId: document?.[1]?.fileStoreId?.fileStoreId, + documentUid: document?.[1]?.fileStoreId?.fileStoreId, + tenantId: document?.[1]?.fileStoreId?.tenantId, + }; + }), + assignees: data?.assignees?.uuid ? [data?.assignees?.uuid] : null, + action: action.action, + }; + //filtering out the data + Object.keys(workflow).forEach((key, index) => { + if (!workflow[key] || workflow[key]?.length === 0) delete workflow[key]; + }); + + return { + contract: applicationDetails, + workflow, + }; + } + if (businessService === businessServiceMap?.["muster roll"]) { + const workflow = { + comment: data?.comments, + documents: data?.documents?.map((document) => { + return { + documentType: action?.action + " DOC", + fileName: document?.[1]?.file?.name, + fileStoreId: document?.[1]?.fileStoreId?.fileStoreId, + documentUid: document?.[1]?.fileStoreId?.fileStoreId, + tenantId: document?.[1]?.fileStoreId?.tenantId, + }; + }), + assignees: data?.assignees?.uuid ? [data?.assignees?.uuid] : null, + action: action.action, + }; + //filtering out the data + Object.keys(workflow).forEach((key, index) => { + if (!workflow[key] || workflow[key]?.length === 0) delete workflow[key]; + }); + + return { + musterRoll: applicationDetails, + workflow, + }; + } + if(businessService === businessServiceMap?.["works.purchase"]){ + const workflow = { + comment: data.comments, + documents: data?.documents?.map((document) => { + return { + documentType: action?.action + " DOC", + fileName: document?.[1]?.file?.name, + fileStoreId: document?.[1]?.fileStoreId?.fileStoreId, + documentUid: document?.[1]?.fileStoreId?.fileStoreId, + tenantId: document?.[1]?.fileStoreId?.tenantId, + }; + }), + assignees: data?.assignees?.uuid ? [data?.assignees?.uuid] : null, + action: action.action, + }; + //filtering out the data + Object.keys(workflow).forEach((key, index) => { + if (!workflow[key] || workflow[key]?.length === 0) delete workflow[key]; + }); + + const additionalFieldsToSet = { + projectId:applicationDetails.additionalDetails.projectId, + invoiceDate:applicationDetails.billDate, + invoiceNumber:applicationDetails.referenceId.split('_')?.[1], + contractNumber:applicationDetails.referenceId.split('_')?.[0], + documents:applicationDetails.additionalDetails.documents + } + return { + bill: {...applicationDetails,...additionalFieldsToSet}, + workflow, + }; + } + }, + enableModalSubmit:(businessService,action,setModalSubmit,data)=>{ + if(businessService === businessServiceMap?.["muster roll"] && action.action==="APPROVE"){ + setModalSubmit(data?.acceptTerms) + } + }, + enableHrmsSearch: (businessService, action) => { + if (businessService === businessServiceMap.estimate) { + return action.action.includes("TECHNICALSANCTION") || action.action.includes("VERIFYANDFORWARD"); + } + if (businessService === businessServiceMap.contract) { + return action.action.includes("VERIFY_AND_FORWARD"); + } + if (businessService === businessServiceMap?.["muster roll"]) { + return action.action.includes("VERIFY"); + } + if(businessService === businessServiceMap?.["works.purchase"]){ + return action.action.includes("VERIFY_AND_FORWARD") + } + return false; + }, + getBusinessService: (moduleCode) => { + if (moduleCode?.includes("estimate")) { + return businessServiceMap?.estimate; + } else if (moduleCode?.includes("contract")) { + return businessServiceMap?.contract; + } else if (moduleCode?.includes("muster roll")) { + return businessServiceMap?.["muster roll"]; + } + else if (moduleCode?.includes("works.purchase")) { + return businessServiceMap?.["works.purchase"]; + } + else if (moduleCode?.includes("works.wages")) { + return businessServiceMap?.["works.wages"]; + } + else if (moduleCode?.includes("works.supervision")) { + return businessServiceMap?.["works.supervision"]; + } + else { + return businessServiceMap; + } + }, + getInboxModuleName: (moduleCode) => { + if (moduleCode?.includes("estimate")) { + return inboxModuleNameMap?.estimate; + } else if (moduleCode?.includes("contract")) { + return inboxModuleNameMap?.contracts; + } else if (moduleCode?.includes("attendence")) { + return inboxModuleNameMap?.attendencemgmt; + } else { + return inboxModuleNameMap; + } + }, + + AttendanceInboxConfig: { + preProcess: (data) => { + + //set tenantId + data.body.inbox.tenantId = Digit.ULBService.getCurrentTenantId(); + data.body.inbox.processSearchCriteria.tenantId = Digit.ULBService.getCurrentTenantId(); + + const musterRollNumber = data?.body?.inbox?.moduleSearchCriteria?.musterRollNumber?.trim(); + if(musterRollNumber) data.body.inbox.moduleSearchCriteria.musterRollNumber = musterRollNumber + + const attendanceRegisterName = data?.body?.inbox?.moduleSearchCriteria?.attendanceRegisterName?.trim(); + if(attendanceRegisterName) data.body.inbox.moduleSearchCriteria.attendanceRegisterName = attendanceRegisterName + + // deleting them for now(assignee-> need clarity from pintu,ward-> static for now,not implemented BE side) + const assignee = _.clone(data.body.inbox.moduleSearchCriteria.assignee); + delete data.body.inbox.moduleSearchCriteria.assignee; + if (assignee?.code === "ASSIGNED_TO_ME") { + data.body.inbox.moduleSearchCriteria.assignee = Digit.UserService.getUser().info.uuid; + } + + //cloning locality and workflow states to format them + // let locality = _.clone(data.body.inbox.moduleSearchCriteria.locality ? data.body.inbox.moduleSearchCriteria.locality : []); + + let selectedOrg = _.clone(data.body.inbox.moduleSearchCriteria.orgId ? data.body.inbox.moduleSearchCriteria.orgId : null); + delete data.body.inbox.moduleSearchCriteria.orgId; + if(selectedOrg) { + data.body.inbox.moduleSearchCriteria.orgId = selectedOrg?.[0]?.applicationNumber; + } + + // let selectedWard = _.clone(data.body.inbox.moduleSearchCriteria.ward ? data.body.inbox.moduleSearchCriteria.ward : null); + // delete data.body.inbox.moduleSearchCriteria.ward; + // if(selectedWard) { + // data.body.inbox.moduleSearchCriteria.ward = selectedWard?.[0]?.code; + // } + + let states = _.clone(data.body.inbox.moduleSearchCriteria.state ? data.body.inbox.moduleSearchCriteria.state : []); + let ward = _.clone(data.body.inbox.moduleSearchCriteria.ward ? data.body.inbox.moduleSearchCriteria.ward : []); + // delete data.body.inbox.moduleSearchCriteria.locality; + delete data.body.inbox.moduleSearchCriteria.state; + delete data.body.inbox.moduleSearchCriteria.ward; + + // locality = locality?.map((row) => row?.code); + states = Object.keys(states)?.filter((key) => states[key]); + ward = ward?.map((row) => row?.code); + + + // //adding formatted data to these keys + // if (locality.length > 0) data.body.inbox.moduleSearchCriteria.locality = locality; + if (states.length > 0) data.body.inbox.moduleSearchCriteria.status = states; + if (ward.length > 0) data.body.inbox.moduleSearchCriteria.ward = ward; + const projectType = _.clone(data.body.inbox.moduleSearchCriteria.projectType ? data.body.inbox.moduleSearchCriteria.projectType : {}); + if (projectType?.code) data.body.inbox.moduleSearchCriteria.projectType = projectType.code; + + //adding tenantId to moduleSearchCriteria + data.body.inbox.moduleSearchCriteria.tenantId = Digit.ULBService.getCurrentTenantId(); + + //setting limit and offset becoz somehow they are not getting set in muster inbox + data.body.inbox .limit = data.state.tableForm.limit + data.body.inbox.offset = data.state.tableForm.offset + delete data.state + return data; + }, + postProcess: (responseArray, uiConfig) => { + const statusOptions = responseArray?.statusMap + ?.filter((item) => item.applicationstatus) + ?.map((item) => ({ code: item.applicationstatus, i18nKey: `COMMON_MASTERS_${item.applicationstatus}` })); + if (uiConfig?.type === "filter") { + let fieldConfig = uiConfig?.fields?.filter((item) => item.type === "dropdown" && item.populators.name === "musterRollStatus"); + if (fieldConfig.length) { + fieldConfig[0].populators.options = statusOptions; + } + } + }, + additionalCustomizations: (row, key, column, value, t, searchResult) => { + if (key === "ATM_MUSTER_ROLL_ID") { + return ( + + + {String(value ? (column.translate ? t(column.prefix ? `${column.prefix}${value}` : value) : value) : t("ES_COMMON_NA"))} + + + ); + } + if (key === "ATM_ATTENDANCE_WEEK") { + const week = `${Digit.DateUtils.ConvertTimestampToDate(value?.startDate, "dd/MM/yyyy")}-${Digit.DateUtils.ConvertTimestampToDate( + value?.endDate, + "dd/MM/yyyy" + )}`; + return
{week}
; + } + if (key === "ATM_NO_OF_INDIVIDUALS") { + return
{value?.length}
; + } + if(key === "ATM_AMOUNT_IN_RS"){ + return {value ? Digit.Utils.dss.formatterWithoutRound(value, "number") : t("ES_COMMON_NA")}; + } + if (key === "ATM_SLA") { + return parseInt(value) > 0 ? ( + {t(value) || ""} + ) : ( + {t(value) || ""} + ); + } + if (key === "COMMON_WORKFLOW_STATES") { + return {t(`WF_MUSTOR_${value}`)} + } + //added this in case we change the key and not updated here , it'll throw that nothing was returned from cell error if that case is not handled here. To prevent that error putting this default + return {t(`CASE_NOT_HANDLED`)} + }, + MobileDetailsOnClick: (row, tenantId) => { + let link; + Object.keys(row).map((key) => { + if (key === "ATM_MUSTER_ROLL_ID") + link = `/${window.contextPath}/employee/attendencemgmt/view-attendance?tenantId=${tenantId}&musterRollNumber=${row[key]}`; + }); + return link; + }, + populateReqCriteria: () => { + const tenantId = Digit.ULBService.getCurrentTenantId(); + return { + url: "/org-services/organisation/v1/_search", + params: { limit: 50, offset: 0 }, + body: { + SearchCriteria: { + tenantId: tenantId, + functions : { + type : "CBO" + } + }, + }, + config: { + enabled: true, + select: (data) => { + return data?.organisations; + }, + }, + }; + }, + }, + SearchWageSeekerConfig: { + customValidationCheck: (data) => { + //checking both to and from date are present + const { createdFrom, createdTo } = data; + if ((createdFrom === "" && createdTo !== "") || (createdFrom !== "" && createdTo === "")) + return { warning: true, label: "ES_COMMON_ENTER_DATE_RANGE" }; + + return false; + }, + preProcess: (data) => { + data.params = { ...data.params, tenantId: Digit.ULBService.getCurrentTenantId() }; + + let requestBody = { ...data.body.Individual }; + const pathConfig = { + name: "name.givenName", + }; + const dateConfig = { + createdFrom: "daystart", + createdTo: "dayend", + }; + const selectConfig = { + wardCode: "wardCode[0].code", + socialCategory: "socialCategory.code", + }; + const textConfig = ["name", "individualId"] + let Individual = Object.keys(requestBody) + .map((key) => { + if (selectConfig[key]) { + requestBody[key] = _.get(requestBody, selectConfig[key], null); + } else if (typeof requestBody[key] == "object") { + requestBody[key] = requestBody[key]?.code; + } else if (textConfig?.includes(key)) { + requestBody[key] = requestBody[key]?.trim() + } + return key; + }) + .filter((key) => requestBody[key]) + .reduce((acc, curr) => { + if (pathConfig[curr]) { + _.set(acc, pathConfig[curr], requestBody[curr]); + } else if (dateConfig[curr] && dateConfig[curr]?.includes("day")) { + _.set(acc, curr, Digit.Utils.date.convertDateToEpoch(requestBody[curr], dateConfig[curr])); + } else { + _.set(acc, curr, requestBody[curr]); + } + return acc; + }, {}); + + data.body.Individual = { ...Individual }; + return data; + }, + additionalCustomizations: (row, key, column, value, t, searchResult) => { + //here we can add multiple conditions + //like if a cell is link then we return link + //first we can identify which column it belongs to then we can return relevant result + switch (key) { + case "MASTERS_WAGESEEKER_ID": + return ( + + + {String(value ? (column.translate ? t(column.prefix ? `${column.prefix}${value}` : value) : value) : t("ES_COMMON_NA"))} + + + ); + + case "MASTERS_SOCIAL_CATEGORY": + return value ? {String(t(`MASTERS_${value}`))} : t("ES_COMMON_NA"); + + case "CORE_COMMON_PROFILE_CITY": + return value ? {String(t(Digit.Utils.locale.getCityLocale(value)))} : t("ES_COMMON_NA"); + + case "MASTERS_WARD": + return value ? ( + {String(t(Digit.Utils.locale.getMohallaLocale(value, row?.tenantId)))} + ) : ( + t("ES_COMMON_NA") + ); + + case "MASTERS_LOCALITY": + return value ? ( + {String(t(Digit.Utils.locale.getMohallaLocale(value, row?.tenantId)))} + ) : ( + t("ES_COMMON_NA") + ); + default: + return t("ES_COMMON_NA"); + } + }, + MobileDetailsOnClick: (row, tenantId) => { + let link; + Object.keys(row).map((key) => { + if (key === "MASTERS_WAGESEEKER_ID") + link = `/${window.contextPath}/employee/masters/view-wageseeker?tenantId=${tenantId}&wageseekerId=${row[key]}`; + }); + return link; + }, + additionalValidations: (type, data, keys) => { + if (type === "date") { + return data[keys.start] && data[keys.end] ? () => new Date(data[keys.start]).getTime() <= new Date(data[keys.end]).getTime() : true; + } + } + }, +}; diff --git a/micro-ui/web/src/Customisations/index.js b/micro-ui/web/src/Customisations/index.js new file mode 100644 index 00000000000..803b1e8763e --- /dev/null +++ b/micro-ui/web/src/Customisations/index.js @@ -0,0 +1,19 @@ +import { ptComponents } from "./pt"; +import { tlComponents } from "./tl"; + +var Digit = window.Digit || {}; + +const customisedComponent = { + ...ptComponents, + ...tlComponents +} + + + +export const initCustomisationComponents = () => { + Object.entries(customisedComponent).forEach(([key, value]) => { + Digit.ComponentRegistryService.setComponent(key, value); + }); +}; + + diff --git a/micro-ui/web/src/Customisations/pt/index.js b/micro-ui/web/src/Customisations/pt/index.js new file mode 100644 index 00000000000..0063fcd4774 --- /dev/null +++ b/micro-ui/web/src/Customisations/pt/index.js @@ -0,0 +1,13 @@ +import PropertyUsageType from "./pageComponents/PropertyUsageType"; +import PTVasikaDetails from "./pageComponents/PTVasikaDetails"; +import PTAllotmentDetails from "./pageComponents/PTAllotmentDetails"; +import PTBusinessDetails from "./pageComponents/PTBusinessDetails"; + + + +export const ptComponents = { + PropertyUsageType: PropertyUsageType, + PTVasikaDetail:PTVasikaDetails, + PTAllotmentDetails:PTAllotmentDetails, + PTBusinessDetails:PTBusinessDetails +}; diff --git a/micro-ui/web/src/Customisations/pt/pageComponents/PTAllotmentDetails.js b/micro-ui/web/src/Customisations/pt/pageComponents/PTAllotmentDetails.js new file mode 100644 index 00000000000..569aa45e409 --- /dev/null +++ b/micro-ui/web/src/Customisations/pt/pageComponents/PTAllotmentDetails.js @@ -0,0 +1,64 @@ +import { CardLabel, CitizenInfoLabel, FormStep, LabelFieldPair, TextInput,CardLabelError } from "@egovernments/digit-ui-react-components"; +import React, { useState } from "react"; +var validation ={}; +const PTAllotmentDetails = ({ t, config, onSelect, value, userType, formData }) => { + + const [ + val, setValue + ] = useState(formData?.[config.key]?.alotmentDetails||""); + + const goNext = () => { + onSelect(config.key, {alotmentDetails:val}); + }; + + + if (userType === "employee") { + return ( + + + {t("PT_VASIKA_NO_LABEL") } +
+ setValue(e?.target?.value)} + // autoFocus={presentInModifyApplication} + /> +
+
+
+ ); + } + return ( + + +
+ {`${t("PT_VASIKA_ALLOTMENT_LABEL")}`} + setValue(e?.target?.value)} + + /> +
+
+ {} +
+ ); +}; + +export default PTAllotmentDetails; diff --git a/micro-ui/web/src/Customisations/pt/pageComponents/PTBusinessDetails.js b/micro-ui/web/src/Customisations/pt/pageComponents/PTBusinessDetails.js new file mode 100644 index 00000000000..3d28785e7e5 --- /dev/null +++ b/micro-ui/web/src/Customisations/pt/pageComponents/PTBusinessDetails.js @@ -0,0 +1,68 @@ +import { CardLabel, CitizenInfoLabel, FormStep, LabelFieldPair, TextInput,CardLabelError } from "@egovernments/digit-ui-react-components"; +import React, { useState } from "react"; +var validation ={}; +const PTBusinessDetails = ({ t, config, onSelect, value, userType, formData }) => { + + + const [ + val, setValue + ] = useState(formData?.[config.key]?.businessDetails||""); + + const goNext = () => { + onSelect(config.key, {businessDetails:val}); + }; + + + if (userType === "employee") { + return ( + + + {t("PT_VASIKA_NO_LABEL") } +
+ setValue(e?.target?.value)} + // autoFocus={presentInModifyApplication} + /> +
+
+ +
+ ); + } + return ( + + + +
+ {`${t("PT_VASIKA_BUS_DETAILS_LABEL")}`} + setValue(e?.target?.value)} + + /> +
+ +
+ {} +
+ ); +}; + +export default PTBusinessDetails; diff --git a/micro-ui/web/src/Customisations/pt/pageComponents/PTVasikaDetails.js b/micro-ui/web/src/Customisations/pt/pageComponents/PTVasikaDetails.js new file mode 100644 index 00000000000..0e4b6895745 --- /dev/null +++ b/micro-ui/web/src/Customisations/pt/pageComponents/PTVasikaDetails.js @@ -0,0 +1,79 @@ +import { CardLabel, CitizenInfoLabel, FormStep, LabelFieldPair, TextInput,CardLabelError } from "@egovernments/digit-ui-react-components"; +import React, { useState } from "react"; +var validation ={}; +const PTVasikaDetails = ({ t, config, onSelect, value, userType, formData }) => { + + + const [ + val, setValue + ] = useState(formData?.[config.key]?.vasikaNo||""); + const [ + other, setOther + ] = useState(formData?.[config.key]?.vasikaArea||""); + const goNext = () => { + onSelect(config.key, {vasikaNo:val,vasikaArea:other}); + }; + + + if (userType === "employee") { + return ( + + + {t("PT_VASIKA_NO_LABEL") } +
+ setValue(e?.target?.value)} + // autoFocus={presentInModifyApplication} + /> +
+
+ +
+ ); + } + return ( + + + +
+ {`${t("PT_VASIKA_NO_LABEL")}`} + setValue(e?.target?.value)} + + /> +
+ {`${t("PT_VASIKA_AREA_LABEL")}`} + setOther(e?.target?.value)} + /> +
+ {} +
+ ); +}; + +export default PTVasikaDetails; diff --git a/micro-ui/web/src/Customisations/pt/pageComponents/PropertyUsageType.js b/micro-ui/web/src/Customisations/pt/pageComponents/PropertyUsageType.js new file mode 100644 index 00000000000..deade4fc2ad --- /dev/null +++ b/micro-ui/web/src/Customisations/pt/pageComponents/PropertyUsageType.js @@ -0,0 +1,134 @@ +import { + CardLabel, CardLabelError, CitizenInfoLabel, Dropdown, FormStep, LabelFieldPair, RadioButtons +} from "@egovernments/digit-ui-react-components"; +import React, { useEffect, useState } from "react"; +import { useLocation } from "react-router-dom"; + +var Digit = window.Digit || {}; + +const PropertyUsageType = ({ t, config, onSelect, userType, formData, formState, setError, clearErrors, onBlur }) => { + const [usageCategoryMajor, setPropertyPurpose] = useState( + formData?.usageCategoryMajor && formData?.usageCategoryMajor?.code === "NONRESIDENTIAL.OTHERS" + ? { code: `${formData?.usageCategoryMajor?.code}`, i18nKey: `PROPERTYTAX_BILLING_SLAB_OTHERS` } + : formData?.usageCategoryMajor + ); + + const tenantId = Digit.ULBService.getCurrentTenantId(); + const stateId = tenantId.split(".")[0]; + const { data: Menu = { }, isLoading: menuLoading } = Digit.Hooks.pt.usePropertyMDMS(stateId, "PropertyTax", "UsageCategory") || { }; + let usagecat = []; + usagecat = Menu?.PropertyTax?.UsageCategory || []; + let i; + let menu = []; + + const { pathname } = useLocation(); + const presentInModifyApplication = pathname.includes("modify"); + + function usageCategoryMajorMenu(usagecat) { + if (userType === "employee") { + const catMenu = usagecat + ?.filter((e) => e?.code.split(".").length <= 2 && e.code !== "NONRESIDENTIAL") + ?.map((item) => { + const arr = item?.code.split("."); + if (arr.length == 2) return { i18nKey: "PROPERTYTAX_BILLING_SLAB_" + arr[1], code: item?.code }; + else return { i18nKey: "PROPERTYTAX_BILLING_SLAB_" + item?.code, code: item?.code }; + }); + return catMenu; + } else { + for (i = 0; i < 10; i++) { + if ( + Array.isArray(usagecat) && + usagecat.length > 0 && + usagecat[i].code.split(".")[0] == "NONRESIDENTIAL" && + usagecat[i].code.split(".").length == 2 + ) { + menu.push({ i18nKey: "PROPERTYTAX_BILLING_SLAB_" + usagecat[i].code.split(".")[1], code: usagecat[i].code }); + } + } + return menu; + } + } + + useEffect(() => { + if (!menuLoading && presentInModifyApplication && userType === "employee") { + const original = formData?.originalData?.usageCategory; + const selectedOption = usageCategoryMajorMenu(usagecat).filter((e) => e.code === original)[0]; + setPropertyPurpose(selectedOption); + } + }, [menuLoading]); + + const onSkip = () => onSelect(); + + + function selectPropertyPurpose(value) { + setPropertyPurpose(value); + } + + function goNext() { + if (usageCategoryMajor?.i18nKey === "PROPERTYTAX_BILLING_SLAB_OTHERS") { + usageCategoryMajor.i18nKey = "PROPERTYTAX_BILLING_SLAB_NONRESIDENTIAL"; + onSelect(config.key, usageCategoryMajor); + } else { + onSelect(config.key, usageCategoryMajor); + } + } + + useEffect(() => { + if (userType === "employee") { + if (!usageCategoryMajor) { + setError(config.key, { type: "required", message: t(`CORE_COMMON_REQUIRED_ERRMSG`) }); + } else { + clearErrors(config.key); + } + goNext(); + } + }, [usageCategoryMajor]); + + if (userType === "employee") { + return ( + + + {t("PT_ASSESMENT_INFO_USAGE_TYPE") + " *"} + { + selectPropertyPurpose(e); + }} + optionKey="i18nKey" + onBlur={onBlur} + t={t} + /> + + {formState.touched[config.key] ? ( + + {formState.errors?.[config.key]?.message} + + ) : null} + + ); + } + + return ( + + +
+ +
+
+ {} +
+ ); +}; + +export default PropertyUsageType; diff --git a/micro-ui/web/src/Customisations/tl/TLCustomisation.js b/micro-ui/web/src/Customisations/tl/TLCustomisation.js new file mode 100644 index 00000000000..642acc52090 --- /dev/null +++ b/micro-ui/web/src/Customisations/tl/TLCustomisation.js @@ -0,0 +1,5 @@ +export const TLCustomisations = { + customiseCreateFormData: (formData, licenceObject) => licenceObject, + customiseRenewalCreateFormData: (formData, licenceObject) => licenceObject, + customiseSendbackFormData: (formData, licenceObject) => licenceObject +} \ No newline at end of file diff --git a/micro-ui/web/src/Customisations/tl/index.js b/micro-ui/web/src/Customisations/tl/index.js new file mode 100644 index 00000000000..fe2ae4f4e6a --- /dev/null +++ b/micro-ui/web/src/Customisations/tl/index.js @@ -0,0 +1,7 @@ +import TLUsageType from "./pageComponents/PropertyUsageType"; + + + +export const tlComponents = { + TLPropertyUsageType: TLUsageType, +}; diff --git a/micro-ui/web/src/Customisations/tl/pageComponents/PropertyUsageType.js b/micro-ui/web/src/Customisations/tl/pageComponents/PropertyUsageType.js new file mode 100644 index 00000000000..5520a66fc5a --- /dev/null +++ b/micro-ui/web/src/Customisations/tl/pageComponents/PropertyUsageType.js @@ -0,0 +1,136 @@ +import { + CardLabel, CardLabelError, CitizenInfoLabel, Dropdown, FormStep, LabelFieldPair, RadioButtons +} from "@egovernments/digit-ui-react-components"; +import React, { useEffect, useState } from "react"; +import { useLocation } from "react-router-dom"; + +var Digit = window.Digit || {}; + +const TLUsageType = ({ t, config, onSelect, userType, formData, formState, setError, clearErrors, onBlur }) => { + const [usageCategoryMajor, setPropertyPurpose] = useState( + formData?.usageCategoryMajor && formData?.usageCategoryMajor?.code === "NONRESIDENTIAL.OTHERS" + ? { code: `${formData?.usageCategoryMajor?.code}`, i18nKey: `PROPERTYTAX_BILLING_SLAB_OTHERS` } + : formData?.usageCategoryMajor + ); + + const tenantId = Digit.ULBService.getCurrentTenantId(); + const stateId = tenantId.split(".")[0]; + const { data: Menu = { }, isLoading: menuLoading } = Digit.Hooks.pt.usePropertyMDMS(stateId, "PropertyTax", "UsageCategory") || { }; + let usagecat = []; + usagecat = Menu?.PropertyTax?.UsageCategory || []; + let i; + let menu = []; + + const { pathname } = useLocation(); + const presentInModifyApplication = pathname.includes("modify"); + + function usageCategoryMajorMenu(usagecat) { + if (userType === "employee") { + const catMenu = usagecat + ?.filter((e) => e?.code.split(".").length <= 2 && e.code !== "NONRESIDENTIAL") + ?.map((item) => { + const arr = item?.code.split("."); + if (arr.length == 2) return { i18nKey: "PROPERTYTAX_BILLING_SLAB_" + arr[1], code: item?.code }; + else return { i18nKey: "PROPERTYTAX_BILLING_SLAB_" + item?.code, code: item?.code }; + }); + return catMenu; + } else { + for (i = 0; i < 10; i++) { + if ( + Array.isArray(usagecat) && + usagecat.length > 0 && + usagecat[i].code.split(".")[0] == "NONRESIDENTIAL" && + usagecat[i].code.split(".").length == 2 + ) { + menu.push({ i18nKey: "PROPERTYTAX_BILLING_SLAB_" + usagecat[i].code.split(".")[1], code: usagecat[i].code }); + } + } + return menu; + } + } + + useEffect(() => { + if (!menuLoading && presentInModifyApplication && userType === "employee") { + const original = formData?.originalData?.usageCategory; + const selectedOption = usageCategoryMajorMenu(usagecat).filter((e) => e.code === original)[0]; + setPropertyPurpose(selectedOption); + } + }, [menuLoading]); + + const onSkip = () => onSelect(); + + + function selectPropertyPurpose(value) { + setPropertyPurpose(value); + } + + function goNext() { + if (usageCategoryMajor?.i18nKey === "PROPERTYTAX_BILLING_SLAB_OTHERS") { + usageCategoryMajor.i18nKey = "PROPERTYTAX_BILLING_SLAB_NONRESIDENTIAL"; + onSelect(config.key, usageCategoryMajor); + } else { + onSelect(config.key, usageCategoryMajor); + } + } + + useEffect(() => { + if (userType === "employee") { + if (!usageCategoryMajor) { + setError(config.key, { type: "required", message: t(`CORE_COMMON_REQUIRED_ERRMSG`) }); + } else { + clearErrors(config.key); + } + goNext(); + } + }, [usageCategoryMajor]); + + if (userType === "employee") { + return ( + + + {t("PT_ASSESMENT_INFO_USAGE_TYPE") + " *"} + { + selectPropertyPurpose(e); + }} + optionKey="i18nKey" + onBlur={onBlur} + t={t} + /> + + {formState.touched[config.key] ? ( + + {formState.errors?.[config.key]?.message} + + ) : null} + + ); + } + + return ( + + +
+ + + +
+
+ {} +
+ ); +}; + +export default TLUsageType; diff --git a/micro-ui/web/src/index.css b/micro-ui/web/src/index.css new file mode 100644 index 00000000000..e69de29bb2d diff --git a/micro-ui/web/src/index.js b/micro-ui/web/src/index.js new file mode 100644 index 00000000000..9f20bf1b506 --- /dev/null +++ b/micro-ui/web/src/index.js @@ -0,0 +1,62 @@ +import React from 'react'; +import ReactDOM from 'react-dom'; +import { initLibraries } from "@egovernments/digit-ui-libraries"; +import "./index.css"; +import App from './App'; +import { TLCustomisations } from './Customisations/tl/TLCustomisation'; + + +initLibraries(); + + +window.Digit.Customizations = { PGR: {} ,TL:TLCustomisations}; + +const user = window.Digit.SessionStorage.get("User"); + +if (!user || !user.access_token || !user.info) { + // login detection + + const parseValue = (value) => { + try { + return JSON.parse(value) + } catch (e) { + return value + } + } + + const getFromStorage = (key) => { + const value = window.localStorage.getItem(key); + return value && value !== "undefined" ? parseValue(value) : null; + } + + const token = getFromStorage("token") + + const citizenToken = getFromStorage("Citizen.token") + const citizenInfo = getFromStorage("Citizen.user-info") + const citizenTenantId = getFromStorage("Citizen.tenant-id") + + const employeeToken = getFromStorage("Employee.token") + const employeeInfo = getFromStorage("Employee.user-info") + const employeeTenantId = getFromStorage("Employee.tenant-id") + const userType = token === citizenToken ? "citizen" : "employee"; + + window.Digit.SessionStorage.set("user_type", userType); + window.Digit.SessionStorage.set("userType", userType); + + const getUserDetails = (access_token, info) => ({ token: access_token, access_token, info }) + + const userDetails = userType === "citizen" ? getUserDetails(citizenToken, citizenInfo) : getUserDetails(employeeToken, employeeInfo) + + window.Digit.SessionStorage.set("User", userDetails); + window.Digit.SessionStorage.set("Citizen.tenantId", citizenTenantId); + window.Digit.SessionStorage.set("Employee.tenantId", employeeTenantId); + // end +} + +ReactDOM.render( + + + , + document.getElementById('root') +); + diff --git a/micro-ui/web/src/setupProxy.js b/micro-ui/web/src/setupProxy.js new file mode 100644 index 00000000000..1b8eda94a19 --- /dev/null +++ b/micro-ui/web/src/setupProxy.js @@ -0,0 +1,30 @@ +const { createProxyMiddleware } = require("http-proxy-middleware"); +const createProxy = createProxyMiddleware({ + target: process.env.REACT_APP_PROXY_URL, + changeOrigin: true, +}); +module.exports = function (app) { + [ + "/egov-mdms-service", + "/egov-location", + "/localization", + "/egov-workflow-v2", + "/pgr-services", + "/filestore", + "/egov-hrms", + "/user-otp", + "/user", + "/fsm", + "/billing-service", + "/collection-services", + "/pdf-service", + "/pg-service", + "/vehicle", + "/vendor", + "/property-services", + "/fsm-calculator/v1/billingSlab/_search", + "/muster-roll" + ].forEach((location) => + app.use(location, createProxy) + ); +}; diff --git a/micro-ui/web/webpack.config.js b/micro-ui/web/webpack.config.js new file mode 100644 index 00000000000..5f3dc46967a --- /dev/null +++ b/micro-ui/web/webpack.config.js @@ -0,0 +1,43 @@ +const path = require("path"); +const HtmlWebpackPlugin = require("html-webpack-plugin"); +const { CleanWebpackPlugin } = require("clean-webpack-plugin"); +// const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin; + +module.exports = { + // mode: 'development', + entry: "./src/index.js", + devtool: "none", + module: { + rules: [ + { + test: /\.(js)$/, + use: ["babel-loader"], + }, + { + test: /\.css$/i, + use: ["style-loader", "css-loader"], + } + ], + }, + output: { + filename: "[name].bundle.js", + path: path.resolve(__dirname, "build"), + publicPath: "/digit-ui/", + }, + optimization: { + splitChunks: { + chunks: 'all', + minSize:20000, + maxSize:50000, + enforceSizeThreshold:50000, + minChunks:1, + maxAsyncRequests:30, + maxInitialRequests:30 + }, + }, + plugins: [ + new CleanWebpackPlugin(), + // new BundleAnalyzerPlugin(), + new HtmlWebpackPlugin({ inject: true, template: "public/index.html" }), + ], +}; \ No newline at end of file diff --git a/micro-ui/web/workbench/App.js b/micro-ui/web/workbench/App.js new file mode 100644 index 00000000000..df80394a05f --- /dev/null +++ b/micro-ui/web/workbench/App.js @@ -0,0 +1,63 @@ +import React from "react"; +import { initLibraries } from "@egovernments/digit-ui-libraries"; +import { DigitUI } from "@egovernments/digit-ui-module-core"; +// import { initHRMSComponents } from "@egovernments/digit-ui-module-hrms"; +import { UICustomizations } from "./Customisations/UICustomizations"; +import { initWorkbenchComponents } from "@egovernments/digit-ui-module-workbench"; +import { initUtilitiesComponents } from "@egovernments/digit-ui-module-utilities"; +import { initWorkbenchHCMComponents } from "@egovernments/digit-ui-module-hcmworkbench"; +//import {initSampleComponents} from "@egovernments/digit-ui-module-sample"; +window.contextPath = window?.globalConfigs?.getConfig("CONTEXT_PATH"); + +const enabledModules = [ + "DSS", + "NDSS", + "Utilities", + // "HRMS", + "Engagement", + "Workbench", + "HCMWORKBENCH", + "sample" +]; + +const moduleReducers = (initData) => ({ + initData, +}); + +const initDigitUI = () => { + window.Digit.ComponentRegistryService.setupRegistry({}); + window.Digit.Customizations = { + PGR: {}, + commonUiConfig: UICustomizations, + }; + // initHRMSComponents(); + initUtilitiesComponents(); + initWorkbenchComponents(); + initWorkbenchHCMComponents(); + initSampleComponents(); + +}; + +initLibraries().then(() => { + initDigitUI(); +}); + +function App() { + window.contextPath = window?.globalConfigs?.getConfig("CONTEXT_PATH"); + const stateCode = + window.globalConfigs?.getConfig("STATE_LEVEL_TENANT_ID") || + process.env.REACT_APP_STATE_LEVEL_TENANT_ID; + if (!stateCode) { + return

stateCode is not defined

; + } + return ( + + ); +} + +export default App; diff --git a/micro-ui/web/workbench/Dockerfile b/micro-ui/web/workbench/Dockerfile new file mode 100644 index 00000000000..31b3912759b --- /dev/null +++ b/micro-ui/web/workbench/Dockerfile @@ -0,0 +1,29 @@ +FROM egovio/alpine-node-builder-14:yarn AS build +#FROM ghcr.io/egovernments/alpine-node-builder-14:yarn AS build +RUN apk update && apk upgrade +RUN apk add --no-cache git>2.30.0 +ARG WORK_DIR +WORKDIR /app +ENV NODE_OPTIONS "--max-old-space-size=4792" + +COPY ${WORK_DIR} . +RUN ls -lah + +#RUN node web/envs.js +RUN cd web/ \ + && node -e 'console.log(v8.getHeapStatistics().heap_size_limit/(1024*1024))' \ + && node -e 'console.log("core only")' \ + && cd workbench/ \ + && ./install-deps.sh \ + && cd ../ \ + && yarn install \ + && yarn build:webpack + +FROM nginx:mainline-alpine +#FROM ghcr.io/egovernments/nginx:mainline-alpine +ENV WORK_DIR=/var/web/workbench-ui + +RUN mkdir -p ${WORK_DIR} + +COPY --from=build /app/web/build ${WORK_DIR}/ +COPY --from=build /app/web/workbench/nginx.conf /etc/nginx/conf.d/default.conf diff --git a/micro-ui/web/workbench/install-deps.sh b/micro-ui/web/workbench/install-deps.sh new file mode 100755 index 00000000000..54b8a4c3d7f --- /dev/null +++ b/micro-ui/web/workbench/install-deps.sh @@ -0,0 +1,18 @@ +#!/bin/sh + +BRANCH="$(git branch --show-current)" + +echo "Main Branch: $BRANCH" + +INTERNALS="micro-ui-internals" +cd .. + +cp workbench/App.js src +cp workbench/package.json package.json +cp workbench/webpack.config.js webpack.config.js +cp workbench/inter-package.json $INTERNALS/package.json + +cp $INTERNALS/example/src/UICustomizations.js src/Customisations + +echo "UI :: workbench " && echo "Branch: $(git branch --show-current)" && echo "$(git log -1 --pretty=%B)" && echo "installing packages" + diff --git a/micro-ui/web/workbench/inter-package.json b/micro-ui/web/workbench/inter-package.json new file mode 100644 index 00000000000..896c31ba294 --- /dev/null +++ b/micro-ui/web/workbench/inter-package.json @@ -0,0 +1,55 @@ +{ + "name": "egovernments", + "version": "1.0.0", + "main": "index.js", + "workspaces": [ + "example", + "packages/css", + "packages/modules/*" + ], + "author": "JaganKumar ", + "license": "MIT", + "private": true, + "engines": { + "node": ">=14" + }, + "scripts": { + "start": "SKIP_PREFLIGHT_CHECK=true run-s build start:dev", + "sprint": "SKIP_PREFLIGHT_CHECK=true run-s start:script", + "start:dev": "run-p dev:**", + "start:script": "./scripts/create.sh", + "dev:css": "cd packages/css && yarn start", + "publish:css": "cd packages/css && yarn publish --access public", + "dev:example": "cd example && yarn start", + "dev:sample": "cd packages/modules/sample && yarn start", + "build": "run-p build:**", + "build:sample": "cd packages/modules/sample && yarn build", + "deploy:jenkins": "./scripts/jenkins.sh", + "clean": "rm -rf node_modules" + }, + "resolutions": { + "**/@babel/runtime": "7.20.1", + "**/babel-preset-react-app": "10.0.0" + }, + "devDependencies": { + "husky": "7.0.4", + "lint-staged": "12.3.7", + "npm-run-all": "4.1.5", + "prettier": "2.1.2" + }, + "husky": {}, + "lint-staged": { + "*.{js,css,md}": "prettier --write" + }, + "dependencies": { + "lodash": "4.17.21", + "microbundle-crl": "0.13.11", + "@egovernments/digit-ui-react-components": "1.8.1-beta.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-router-dom": "5.3.0" + } +} diff --git a/micro-ui/web/workbench/nginx.conf b/micro-ui/web/workbench/nginx.conf new file mode 100644 index 00000000000..9c84c01c4be --- /dev/null +++ b/micro-ui/web/workbench/nginx.conf @@ -0,0 +1,12 @@ +server +{ + listen 80; + underscores_in_headers on; + + location /microplan-ui + { + root /var/web; + index index.html index.htm; + try_files $uri $uri/ /microplan-ui/index.html; + } +} \ No newline at end of file diff --git a/micro-ui/web/workbench/package.json b/micro-ui/web/workbench/package.json new file mode 100644 index 00000000000..035e899ab10 --- /dev/null +++ b/micro-ui/web/workbench/package.json @@ -0,0 +1,80 @@ +{ + "name": "micro-ui", + "version": "1.0.0", + "author": "Jagankumar ", + "license": "MIT", + "private": true, + "engines": { + "node": ">=14" + }, + "workspaces": [ + "micro-ui-internals/packages/modules/*" + ], + "homepage": "/workbench-ui", + "dependencies": { + "@egovernments/digit-ui-libraries": "1.8.1-beta.1", + "@egovernments/digit-ui-module-core": "1.8.2-beta.6", + "@egovernments/digit-ui-module-utilities": "1.0.1-beta.1", + "@egovernments/digit-ui-react-components": "1.8.1-beta.2", + "@egovernments/digit-ui-module-workbench": "1.0.1-beta.1", + "@egovernments/digit-ui-module-hcmworkbench":"0.0.38", + "@egovernments/digit-ui-module-sample": "0.0.1", + "babel-loader": "8.1.0", + "clean-webpack-plugin": "4.0.0", + "react": "17.0.2", + "react-dom": "17.0.2", + "jsonpath": "^1.1.1", + "react-router-dom": "5.3.0", + "react-scripts": "4.0.1", + "web-vitals": "1.1.2", + "terser-brunch": "^4.1.0", + "react-hook-form": "6.15.8", + "react-i18next": "11.16.2", + "react-query": "3.6.1", + "css-loader": "5.2.6", + "style-loader": "2.0.0", + "webpack-cli": "4.10.0" + }, + "devDependencies": { + "@babel/plugin-proposal-private-property-in-object": "7.21.0", + "http-proxy-middleware": "1.3.1", + "lodash": "4.17.21", + "microbundle-crl": "0.13.11", + "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", + "husky": "7.0.4", + "lint-staged": "12.3.7", + "npm-run-all": "4.1.5", + "prettier": "2.1.2" + }, + "scripts": { + "start": "react-scripts start", + "build": "GENERATE_SOURCEMAP=false SKIP_PREFLIGHT_CHECK=true react-scripts build", + "build:prepare": "./build.sh", + "build:libraries": "cd micro-ui-internals && yarn build", + "build:prod": "webpack --mode production", + "build:webpack": "yarn build:libraries &&cd .. && ls && cd ./web && ls && yarn build:prod", + "clean": "rm -rf node_modules" + }, + "eslintConfig": { + "extends": [ + "react-app" + ] + }, + "browserslist": { + "production": [ + ">0.2%", + "not dead", + "not op_mini all" + ], + "development": [ + "last 1 chrome version", + "last 1 firefox version", + "last 1 safari version" + ] + } +} \ No newline at end of file diff --git a/micro-ui/web/workbench/webpack.config.js b/micro-ui/web/workbench/webpack.config.js new file mode 100644 index 00000000000..c19e631fe01 --- /dev/null +++ b/micro-ui/web/workbench/webpack.config.js @@ -0,0 +1,44 @@ +const path = require("path"); +const HtmlWebpackPlugin = require("html-webpack-plugin"); +const { CleanWebpackPlugin } = require("clean-webpack-plugin"); +// const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin; + +module.exports = { + // mode: 'development', + entry: "./src/index.js", + devtool: "none", + module: { + rules: [ + { + test: /\.(js)$/, + exclude: /node_modules/, + use: ["babel-loader"], + }, + { + test: /\.css$/i, + use: ["style-loader", "css-loader"], + } + ], + }, + output: { + filename: "[name].bundle.js", + path: path.resolve(__dirname, "build"), + publicPath: "/workbench-ui/", + }, + optimization: { + splitChunks: { + chunks: 'all', + minSize:20000, + maxSize:50000, + enforceSizeThreshold:50000, + minChunks:1, + maxAsyncRequests:30, + maxInitialRequests:30 + }, + }, + plugins: [ + new CleanWebpackPlugin(), + // new BundleAnalyzerPlugin(), + new HtmlWebpackPlugin({ inject: true, template: "public/index.html" }), + ], +}; \ No newline at end of file