From a42bd28da7438219490deb1079fd23d502776b85 Mon Sep 17 00:00:00 2001 From: Jagankumar <53823168+jagankumar-egov@users.noreply.github.com> Date: Wed, 26 Jun 2024 20:51:17 +0530 Subject: [PATCH] HCM Admin console v0.1 release ui changes (#964) * Updates the delivery rules logic for gender * * info message for status creating (#644) * success message if user cred sheet * send id with key resourceid * Send variant in sku also Co-authored-by: nabeelmd-eGov * Feat : added boundary validation (#643) Co-authored-by: Jagankumar <53823168+jagankumar-egov@users.noreply.github.com> * Update campaignValidators.ts (#645) * added delay in download (#646) * Update campaignValidators.ts (#647) * fixes (#649) Co-authored-by: nabeelmd-eGov * fixed header validation (#648) * change in filter recursive (#650) * Update genericUtils.ts (#652) * fix (#651) Co-authored-by: nabeelmd-eGov * updated lowest level hierarchy validation for target HLM -5948 (#654) * Update campaignValidators.ts (#655) * fixes-> cyclenumber issue, hover issue, dropdown height issue, * css * fixes-> cyclenumber issue, hover issue, dropdown height issue, (#656) * fixes-> cyclenumber issue, hover issue, dropdown height issue, * css --------- Co-authored-by: nabeelmd-eGov * Update campaignUtils.ts * fixed HLM-5970 * Feat : added boundary validation at data level * fixes * local add * Added boundary validation * Refactor * fixed HLM-5935 and HLM-5749 * Refactor * Feat : updated table * change campaignid in payload * Feat : added campaignId * Update campaignApis.ts * Update campaignValidators.ts * refactored * Refactor * assigned campaignId * Refactor * updated createRequest Schema * Feat : invalid Status Persist * status fix * version-fix * Update CODEOWNERS * core version updated and css fix for language dropdown * refactor (#676) * Uat signoff (#678) * change in filter recursive * lowest level * added validation related to target sheet headers * HLM-5916 * download button fixes in summary (#682) Co-authored-by: nabeelmd-eGov * Hlm 5927 (#687) * change in filter recursive * lowest level * added validation for boundary codes to be invalid other than that selected from UI in target upload * Added Delivery and cycle config for LLIN and SMC both (#688) * no of cycle and deivery drafted changes * fixes * add localisation code for boundaries * fixes * fixes * Value localise in summary screen, api error change * fixes * genarate api call fix * font size change for summary * login css change * HLM-5718: SMC delivery config enhancement * config update * added config for in between * fix config for llin * added mdms integration --------- Co-authored-by: nabeelmd-eGov * Fixed HLM-5988_warning message (#689) Co-authored-by: nabeelmd-eGov <94039229+nabeelmd-eGov@users.noreply.github.com> * download filename fixes (#693) * download button fixes in summary * download filename with custom name changes added --------- Co-authored-by: nabeelmd-eGov * download filename fixes (#694) * download button fixes in summary * download filename with custom name changes added * config fix for llin --------- Co-authored-by: nabeelmd-eGov * successful toast message is fixed (#695) * successful toast message is fixed * Update UploadData.js * HLM-5991: Alert Pop UP CR (#696) Co-authored-by: nabeelmd-eGov * HLM-5718 changes (#703) Co-authored-by: nabeelmd-eGov * Localization cache (#706) * change in filter recursive * lowest level * refactored localization cache logic * Update README.md (#707) * Update README.md * Update README.md * Update utilities/project-factory/README.md Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Update README.md --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * HLM-5985_made lowest level changes (#708) * HLM-5985_made lowest level changes * resolved codeRabbit comments * Create LOCALSETUP.md (#709) * Create LOCALSETUP.md * Refactored config * Update LOCALSETUP.md * Update utilities/project-factory/LOCALSETUP.md Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Update utilities/project-factory/LOCALSETUP.md Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Update utilities/project-factory/LOCALSETUP.md Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Update utilities/project-factory/LOCALSETUP.md Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Update LOCALSETUP.md --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * updated the localisation module config * Refactor config (#713) * Refactor config * Update utilities/project-factory/src/server/validators/campaignValidators.ts Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Update utilities/project-factory/src/server/validators/campaignValidators.ts Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Update utilities/project-factory/src/server/validators/campaignValidators.ts Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Update postman_collection.json (#714) * Update postman_collection.json * Update postman_collection.json * Delete utilities/project-factory/project_factory_swagger.yml (#715) * Feat : removed campaignId validation for boundary upload (#718) * updated the delay for boundary relationship * added logger for request TODO TEST will be reverted * Revert "added logger for request TODO TEST" This reverts commit d5c2bf570400ada8183eebfec71f0a3449143117. * Schema validation (#719) * Feat : removed campaignId validation for boundary upload * Feat : added schema validation * Fixed mdms host * updated the logger messages * updated the loggers * delivery new changes, toast fix, error fix (#716) * delivery new changes, toast fix, error fix * new fixes * fixes * change text component to field component * added hierarchy * fix * fix * fix * fix * passing hierarchy from props --------- Co-authored-by: nabeelmd-eGov * Schema validation2 (#721) * Feat : removed campaignId validation for boundary upload * Feat : added schema validation * Fixed mdms host * Feat : added boundary validation * Feat : optimized product search * Fix : project mapping fixed (#722) * Fixed project search (#723) * smc fixes (#724) Co-authored-by: nabeelmd-eGov * Feat : added boundary confirmation (#727) * Fix: fixed processing boundary * Refactor * fixed HLM-6109 (#729) * gate fixes validation, ui ux (#731) Co-authored-by: nabeelmd-eGov * integrated panelcard component (#732) * integrated panelcard component * Update micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/Response.js Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --------- Co-authored-by: Jagankumar <53823168+jagankumar-egov@users.noreply.github.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Update genericUtils.ts (#733) * Create CHANGELOG.md (#717) * Update request.ts (#735) * fixed generate api issue (#734) Co-authored-by: Jagankumar <53823168+jagankumar-egov@users.noreply.github.com> * Create CHANGELOG.md * gate fixes (#736) * gate fixes validation, ui ux * gate fix --------- Co-authored-by: nabeelmd-eGov * added loader in the selecting boundaries (#737) * Update createAndSearch.ts (#738) * fix (#739) * fix * fix --------- Co-authored-by: nabeelmd-eGov * Patch 3 (#740) * change in filter recursive * lowest level * trimmed underscore and empty spaces * boundary fix (#742) Co-authored-by: nabeelmd-eGov * Update genericUtils.ts (#746) * fixed the delivery products issue * Fixed delivery conditions issue * Update campaignApis.ts (#747) * fixed warning toast (#748) * fixed warning toast * Update UploadData.js * fix (#749) * fix * fx * fix --------- Co-authored-by: nabeelmd-eGov * core -update (#751) Co-authored-by: nabeelmd-eGov * fixed stepper issue (#752) * fixed stepper issue * Update index.html * Feat : added user validation via individual (#753) * fixes (#754) Co-authored-by: nabeelmd-eGov * code fix nabeel (#756) * fixes * fix --------- Co-authored-by: nabeelmd-eGov * Updated few loggers (#759) * updated few loggers flow * Update utilities/project-factory/src/server/api/campaignApis.ts Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Update utilities/project-factory/src/server/utils/campaignMappingUtils.ts Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Update utilities/project-factory/src/server/utils/campaignUtils.ts Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Update utilities/project-factory/src/server/validators/campaignValidators.ts Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Update utilities/project-factory/src/server/api/campaignApis.ts Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Update utilities/project-factory/src/server/utils/campaignMappingUtils.ts Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Update utilities/project-factory/src/server/utils/genericUtils.ts Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Updated the user Password generation logic #761 * Update Listener.ts (#730) * Update Listener.ts * added try catch logic in producer * Feat : added parallel batch execution (#767) * Feat : added parallel batch execution * Refactor * Update utilities/project-factory/src/server/validators/campaignValidators.ts Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * fixed the stepper (#765) * changes config (#769) * Project type config and added loggers for process of campaign (#772) * Feat : added themes in generate template (#773) * fixed the ajv package version for build issue * Feat : removed xlsx (#776) * HLM-6177: PARALLEL SEARCH IMPLEMENT, DELIVERY TYPE IMPLEMENT (#778) Co-authored-by: nabeelmd-eGov * css update (#780) Co-authored-by: nabeelmd-eGov * HLM-6179 and HLM-6180 (#777) * HLM-6179 and HLM-6180 * campaign name changes --------- Co-authored-by: Jagankumar <53823168+jagankumar-egov@users.noreply.github.com> * Feat : fixed target generation (#781) * fixed tenantId issue (#784) * fix: resolved AJV-related Jenkins build issue reference #783 #786 (#787) * module ui fix * updated all the package version for build fixes * fixed kafka-error at target generation (#789) * updated core version (#791) * updated core version * updated css also * Update campaignValidators.ts (#794) * Updated the excel generation logic and files * added changes for configurable column in target sheet (#779) * change in filter recursive * lowest level * made target headers genearte through mdms schema * changed config index.ts * changed config index.ts * changes for now * added configurable column logic from schema HLM-6169 * updated validate of target columns through schema * added masterForColumnSchema in index.ts * formatted dataManageService * refactored lock TargetFields func * removed console.log * User creation performance improved (#800) * Feat : Improved user creation performance * Change status color * Update utilities/project-factory/src/server/utils/campaignUtils.ts Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --------- Co-authored-by: Jagankumar <53823168+jagankumar-egov@users.noreply.github.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Update genericUtils.ts (#801) * Hlm 6170 (#802) * change in filter recursive * lowest level * HLM -6170 added logic for only village level data in target sheet and some refactoring * updated css (#804) * fixed button issue (#805) * HLM 6177: Error card implementation in summary screen (#806) * HLM-6177: PARALLEL SEARCH IMPLEMENT, DELIVERY TYPE IMPLEMENT * Added Error Cards in summary screen and redirection --------- Co-authored-by: nabeelmd-eGov * added error button styles (#807) Co-authored-by: nabeelmd-eGov * updated popUp css (#808) * HLM 6178: Implementing New Pop up screen in boundaries (#809) * added error button styles * Implementing New Pop up screen in boundaries --------- Co-authored-by: nabeelmd-eGov * Facility changes (#812) * Feat : changed facility Template * Feat : locked target templates * fixed colour issue (#813) * Updated the project type conversion logic for the "deliveryType" dont1 and n config * Unique field added (#814) * Feat : changed facility Template * Feat : locked target templates * Feat : added unique check logic * Target schema update (#815) * change in filter recursive * lowest level * updated shcema of target columns to be configurable * removed empty spaces from config index.ts * Active mapping (#817) * Feat : changed facility Template * Feat : locked target templates * Feat : added unique check logic * Feat : added mapping via active field * changes in the schema validation (#816) * Updated the workbench and css module version * Feat : added active inactive boundary check (#818) * Update campaignValidators.ts (#819) * added active inactive validation (#820) * changed api call time (#826) * Feat : added target sum mapping (#825) * added campaign type as filter (#827) * Update genericApis.ts (#828) * Update excelUtils.ts (#829) * UI issue fixes, icon fix in summary error (#831) Co-authored-by: nabeelmd-eGov * Target columns (#830) * change in filter recursive * lowest level * commit * Feat : target flow fixed for LLIN-mz * uat to dev --------- Co-authored-by: admin1 * Feat : freezed target columns (#833) * Target mr dn (#834) * change in filter recursive * lowest level * Feat : skipped validation temporarily * changes in the target validation (#835) * fixed error info (#837) * Added roboto font (#840) * Feat : added roboto font * Fixed config * target validation based on diff campaign types (#843) * change in filter recursive * lowest level * updated validation of target based on campaign type * fixed validation issue (#844) * Updated the workbench package version * fixed validation logic (#846) * fixed validation logic * Update micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/UploadData.js Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --------- Co-authored-by: Jagankumar <53823168+jagankumar-egov@users.noreply.github.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Error messages improved (#848) * Feat : imporved error messages and initilised utils for tracking process * Fix ; unused variables fixed * Feat : improved error messages * Fix : download error fix (#850) * Update campaignUtils.ts (#851) * Update campaignUtils.ts * Update utilities/project-factory/src/server/utils/campaignUtils.ts Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Update campaignValidators.ts (#853) * HLM 6210: Toast, error focus fix and project type reset delivery data fix (#854) * HLM-6210: campaign type change reset delivery data fix, summary error focus fix * summary error focus fix --------- Co-authored-by: nabeelmd-eGov * HLM-6225_added time out according to data (#855) * Update campaignValidators.ts (#859) * HLM 6210 (#858) * HLM-6210: campaign type change reset delivery data fix, summary error focus fix * summary error focus fix * parallel search fixes --------- Co-authored-by: nabeelmd-eGov * Remove validation (#852) * change in filter recursive * lowest level * removed unnecessary validation for target * spacing refactor * Update campaignValidators.ts (#863) * Header validation (#861) * change in filter recursive * lowest level * removed unnecessary validation for target * changed the logic of header validation * space refactor * Update campaignUtils.ts (#864) * fixed ui error (#865) * Read me (#867) * change in filter recursive * lowest level * removed unnecessary validation for target * changed the logic of header validation * fixed portugese language error * space refactoring * Update Dockerfile * Update Dockerfile * Update migrate.sh * Update Dockerfile * Update campaignValidators.ts (#868) * HLM 6210:campaign type change reset fix (#869) * HLM-6210: campaign type change reset delivery data fix, summary error focus fix * summary error focus fix * parallel search fixes * campaign type change reset fix --------- Co-authored-by: nabeelmd-eGov * Update excelUtils.ts for sheetHeaders wraping (#870) * Update package.json * updated error messages (#871) * feat : added jaeger-client tracing (#872) * updated the table config * Update campaignApis.ts (#875) * removed the schema and updated the db name * fixing generate API call, file auto delete, date error (#877) Co-authored-by: nabeelmd-eGov * Trim resource (#878) * Feat : trimmed resource persist message * Refactor * Removed reject error in produce message * fixed min time, draft logic (#879) * Update index.ts (#880) * added min ui error and facility usage (#883) * added min ui error and facility usage * changes * Update campaignUtils.ts (#884) * HLM 6007 (#885) * fixing generate API call, file auto delete, date error * generate api fix --------- Co-authored-by: nabeelmd-eGov * Update Dockerfile * Feat : docker config update (#886) * Update Dockerfile (#887) * Create buildWorkbenchUI.yml * Update README.md (#917) * Update buildWorkbenchUI.yml * Update README.md * Updated the DB Schema issue of Project-factory * fixed hierarchy order (#919) * User flag hcm (#920) * Feat : docker config update * Feat : added user create flag * Refactored * Update campaignUtils.ts * Update campaignMappingUtils.ts (#922) * Ashish egov patch 2 (#921) * Update index.ts * Update campaignApis.ts * Fixed the project type conversion and product duplicate issue * Update campaignApis.ts (#924) * Update campaignMappingUtils.ts (#925) * Update campaignMappingUtils.ts * Refactored * Update publishProjectFactory.yml * Update buildWorkbenchUI.yml * Update campaignMappingUtils.ts (#926) * Update request.ts (#928) * Update request.ts * Feat : updated httprequest * Feat : warning response added * Refactor * added start and enddate in cycles * Update campaignApis.ts (#930) * Update request.ts (#932) * fixed generate issue (#933) * Fixed project-type resources duplication * updated target error messages (#936) * fixed stepper from draft (#937) * Update Listener.ts * delivery type disable fix, product sku name change (#939) Co-authored-by: nabeelmd-eGov * fixed error message issue (#941) * Redis integration (#940) * Feat : added redis * Feat : added redis retry * removed templates folder * updated the folder structure for health ui and removed utilties * Update publishAllPackages.yml * Update buildWorkbenchUI.yml --------- Co-authored-by: nabeelmd-eGov <94039229+nabeelmd-eGov@users.noreply.github.com> Co-authored-by: nabeelmd-eGov Co-authored-by: ashish-egov <137176738+ashish-egov@users.noreply.github.com> Co-authored-by: Bhavya-egov <137176879+Bhavya-egov@users.noreply.github.com> Co-authored-by: nitish-egov <137176807+nitish-egov@users.noreply.github.com> Co-authored-by: Bhavya-egov Co-authored-by: ashish-egov Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: Swathi-eGov <137176788+Swathi-eGov@users.noreply.github.com> Co-authored-by: admin1 --- .github/workflows/buildWorkbenchUI.yml | 64 + .github/workflows/publishAllPackages.yml | 13 +- .github/workflows/publishProjectFactory.yml | 77 + .gitignore | 4 +- .vscode/launch.json | 17 + .vscode/settings.json | 3 + README.md | 1 + health/micro-ui/.gitignore | 32 + health/micro-ui/Jenkinsfile | 3 + health/micro-ui/README.md | 139 ++ health/micro-ui/package.json | 4 + health/micro-ui/web/.babelrc | 5 + health/micro-ui/web/.env.sample | 3 + health/micro-ui/web/CHANGELOG.md | 7 + health/micro-ui/web/docker/Dockerfile | 25 + health/micro-ui/web/docker/nginx.conf | 12 + health/micro-ui/web/envs.js | 0 health/micro-ui/web/install-deps.sh | 14 + .../web/micro-ui-internals/.gitignore | 143 ++ .../web/micro-ui-internals/.prettierignore | 23 + .../web/micro-ui-internals/.prettierrc.json | 3 + .../micro-ui/web/micro-ui-internals/README.md | 100 ++ .../micro-ui/web/micro-ui-internals/clean.sh | 28 + .../micro-ui-internals/example/.env-health-qa | 7 + .../micro-ui-internals/example/.env-mz-prod | 7 + .../micro-ui-internals/example/.env-mz-uat | 7 + .../example/.env-unifieddev | 9 + .../micro-ui-internals/example/package.json | 39 + .../example/public/index.html | 34 + .../example/src/ComponentRegistry.js | 11 + .../example/src/UICustomizations.js | 663 ++++++++ .../example/src/complaintConfig.js | 31 + .../example/src/components/SelectName.js | 8 + .../web/micro-ui-internals/example/src/fsm.js | 38 + .../micro-ui-internals/example/src/index.js | 84 + .../web/micro-ui-internals/example/src/pgr.js | 15 + .../example/src/setupProxy.js | 100 ++ .../web/micro-ui-internals/package.json | 57 + .../micro-ui-internals/packages/css/README.md | 62 + .../packages/css/gulpfile.js | 71 + .../packages/css/package.json | 65 + .../packages/css/postcss.config.js | 55 + .../css/src/components/microplanning.scss | 363 ++++ .../packages/css/src/index.scss | 13 + .../css/src/pages/employee/campaign.scss | 109 ++ .../css/src/pages/employee/campaignCycle.scss | 331 ++++ .../css/src/pages/employee/coreOverride.scss | 173 ++ .../css/src/pages/employee/index.scss | 481 ++++++ .../packages/css/src/typography.scss | 512 ++++++ .../packages/css/tailwind.config.js | 233 +++ .../modules/campaign-manager/README.md | 159 ++ .../modules/campaign-manager/package.json | 51 + .../modules/campaign-manager/src/Module.js | 141 ++ .../src/components/AddProductField.js | 144 ++ .../src/components/BulkUpload.js | 202 +++ .../src/components/CampaignCard.js | 71 + .../src/components/CampaignDates.js | 122 ++ .../components/CampaignDocumentsPreview.js | 92 + .../src/components/CampaignHeader.js | 32 + .../src/components/CampaignName.js | 66 + .../components/CampaignResourceDocuments.js | 50 + .../src/components/CampaignSummary.js | 484 ++++++ .../src/components/CampaignType.js | 143 ++ .../src/components/CycleDataPreview.js | 186 ++ .../src/components/CycleDetaisPreview.js | 143 ++ .../src/components/DetailsTable.js | 76 + .../src/components/DocumentIcon.js | 29 + .../src/components/PlusMinusInput.js | 47 + .../src/components/RemovableTagNew.js | 16 + .../src/components/SelectingBoundaries.js | 542 ++++++ .../src/components/TimelineCampaign.js | 46 + .../src/components/UploadData.js | 1163 +++++++++++++ .../src/components/XlsPreview.js | 69 + .../src/components/icons/DustbinIcon.js | 10 + .../src/components/icons/XlsxFile.js | 32 + .../src/configs/CampaignConfig.js | 267 +++ .../src/configs/UICustomizations.js | 472 ++++++ .../src/configs/addProductConfig.js | 19 + .../src/configs/attributeConfig.js | 23 + .../src/configs/baseTimeOut.js | 6 + .../src/configs/deliveryConfig.js | 206 +++ .../src/configs/headerConfig.js | 20 + .../src/configs/mailConfig.js | 5 + .../src/configs/myCampaignConfig.js | 667 ++++++++ .../src/configs/operatorConfig.js | 27 + .../src/configs/previewConfig.js | 124 ++ .../src/configs/productType.js | 15 + .../src/configs/schemaConfig.js | 80 + .../campaign-manager/src/hooks/index.js | 47 + .../hooks/services/createCampaignService.js | 19 + .../hooks/services/updateCampaignService.js | 20 + .../src/hooks/services/useSearchCampaign.js | 21 + .../src/hooks/useCreateCampaign.js | 10 + .../src/hooks/useCreateProduct.js | 24 + .../src/hooks/useCreateProductVariant.js | 24 + .../src/hooks/useGenerateIdCampaign.js | 26 + .../src/hooks/useParallelSearch.js | 88 + .../src/hooks/useProductList.js | 53 + .../src/hooks/useResourceData.js | 107 ++ .../src/hooks/useUpdateCampaign.js | 10 + .../src/pages/employee/AddProduct.js | 161 ++ .../src/pages/employee/CycleConfiguration.js | 248 +++ .../src/pages/employee/MyCampaign.js | 80 + .../src/pages/employee/Response.js | 65 + .../src/pages/employee/SetupCampaign.js | 1491 +++++++++++++++++ .../deliveryRule/AddDeliverycontext.js | 813 +++++++++ .../deliveryRule/AddProductscontext.js | 290 ++++ .../employee/deliveryRule/MultiTabcontext.js | 265 +++ .../src/pages/employee/deliveryRule/index.js | 531 ++++++ .../src/pages/employee/index.js | 102 ++ .../campaign-manager/src/utils/TourSteps.js | 144 ++ .../src/utils/downloadExcel.js | 46 + .../campaign-manager/src/utils/index.js | 6 + .../web/micro-ui-internals/publish-develop.sh | 20 + .../web/micro-ui-internals/publish.sh | 20 + .../web/micro-ui-internals/scripts/create.sh | 3 + .../web/micro-ui-internals/scripts/deploy.sh | 8 + .../web/micro-ui-internals/scripts/jenkins.sh | 3 + .../web/micro-ui-internals/scripts/run.sh | 32 + .../micro-ui/web/micro-ui-internals/test.js | 31 + health/micro-ui/web/package.json | 85 + health/micro-ui/web/public/index.html | 37 + health/micro-ui/web/public/robots.txt | 3 + health/micro-ui/web/src/App.js | 74 + health/micro-ui/web/src/ComponentRegistry.js | 11 + .../src/Customisations/UICustomizations.js | 428 +++++ .../micro-ui/web/src/Customisations/index.js | 19 + .../web/src/Customisations/pt/index.js | 13 + .../pt/pageComponents/PTAllotmentDetails.js | 64 + .../pt/pageComponents/PTBusinessDetails.js | 68 + .../pt/pageComponents/PTVasikaDetails.js | 79 + .../pt/pageComponents/PropertyUsageType.js | 134 ++ .../src/Customisations/tl/TLCustomisation.js | 5 + .../web/src/Customisations/tl/index.js | 7 + .../tl/pageComponents/PropertyUsageType.js | 136 ++ health/micro-ui/web/src/index.css | 0 health/micro-ui/web/src/index.js | 62 + health/micro-ui/web/src/setupProxy.js | 30 + health/micro-ui/web/webpack.config.js | 43 + health/micro-ui/web/workbench/App.js | 72 + health/micro-ui/web/workbench/Dockerfile | 29 + health/micro-ui/web/workbench/install-deps.sh | 18 + .../micro-ui/web/workbench/inter-package.json | 58 + health/micro-ui/web/workbench/nginx.conf | 12 + health/micro-ui/web/workbench/package.json | 89 + .../micro-ui/web/workbench/webpack.config.js | 44 + yarn.lock | 4 + 147 files changed, 16772 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/buildWorkbenchUI.yml create mode 100644 .github/workflows/publishProjectFactory.yml create mode 100644 .vscode/launch.json create mode 100644 .vscode/settings.json create mode 100644 health/micro-ui/.gitignore create mode 100644 health/micro-ui/Jenkinsfile create mode 100644 health/micro-ui/README.md create mode 100644 health/micro-ui/package.json create mode 100644 health/micro-ui/web/.babelrc create mode 100644 health/micro-ui/web/.env.sample create mode 100644 health/micro-ui/web/CHANGELOG.md create mode 100644 health/micro-ui/web/docker/Dockerfile create mode 100644 health/micro-ui/web/docker/nginx.conf create mode 100644 health/micro-ui/web/envs.js create mode 100755 health/micro-ui/web/install-deps.sh create mode 100644 health/micro-ui/web/micro-ui-internals/.gitignore create mode 100644 health/micro-ui/web/micro-ui-internals/.prettierignore create mode 100644 health/micro-ui/web/micro-ui-internals/.prettierrc.json create mode 100644 health/micro-ui/web/micro-ui-internals/README.md create mode 100644 health/micro-ui/web/micro-ui-internals/clean.sh create mode 100644 health/micro-ui/web/micro-ui-internals/example/.env-health-qa create mode 100644 health/micro-ui/web/micro-ui-internals/example/.env-mz-prod create mode 100644 health/micro-ui/web/micro-ui-internals/example/.env-mz-uat create mode 100644 health/micro-ui/web/micro-ui-internals/example/.env-unifieddev create mode 100644 health/micro-ui/web/micro-ui-internals/example/package.json create mode 100644 health/micro-ui/web/micro-ui-internals/example/public/index.html create mode 100644 health/micro-ui/web/micro-ui-internals/example/src/ComponentRegistry.js create mode 100644 health/micro-ui/web/micro-ui-internals/example/src/UICustomizations.js create mode 100644 health/micro-ui/web/micro-ui-internals/example/src/complaintConfig.js create mode 100644 health/micro-ui/web/micro-ui-internals/example/src/components/SelectName.js create mode 100644 health/micro-ui/web/micro-ui-internals/example/src/fsm.js create mode 100644 health/micro-ui/web/micro-ui-internals/example/src/index.js create mode 100644 health/micro-ui/web/micro-ui-internals/example/src/pgr.js create mode 100644 health/micro-ui/web/micro-ui-internals/example/src/setupProxy.js create mode 100644 health/micro-ui/web/micro-ui-internals/package.json create mode 100644 health/micro-ui/web/micro-ui-internals/packages/css/README.md create mode 100644 health/micro-ui/web/micro-ui-internals/packages/css/gulpfile.js create mode 100644 health/micro-ui/web/micro-ui-internals/packages/css/package.json create mode 100644 health/micro-ui/web/micro-ui-internals/packages/css/postcss.config.js create mode 100644 health/micro-ui/web/micro-ui-internals/packages/css/src/components/microplanning.scss create mode 100644 health/micro-ui/web/micro-ui-internals/packages/css/src/index.scss create mode 100644 health/micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/campaign.scss create mode 100644 health/micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/campaignCycle.scss create mode 100644 health/micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/coreOverride.scss create mode 100644 health/micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/index.scss create mode 100644 health/micro-ui/web/micro-ui-internals/packages/css/src/typography.scss create mode 100644 health/micro-ui/web/micro-ui-internals/packages/css/tailwind.config.js create mode 100644 health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/README.md create mode 100644 health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/package.json create mode 100644 health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/Module.js create mode 100644 health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/AddProductField.js create mode 100644 health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/BulkUpload.js create mode 100644 health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CampaignCard.js create mode 100644 health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CampaignDates.js create mode 100644 health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CampaignDocumentsPreview.js create mode 100644 health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CampaignHeader.js create mode 100644 health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CampaignName.js create mode 100644 health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CampaignResourceDocuments.js create mode 100644 health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CampaignSummary.js create mode 100644 health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CampaignType.js create mode 100644 health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CycleDataPreview.js create mode 100644 health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CycleDetaisPreview.js create mode 100644 health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/DetailsTable.js create mode 100644 health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/DocumentIcon.js create mode 100644 health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/PlusMinusInput.js create mode 100644 health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/RemovableTagNew.js create mode 100644 health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundaries.js create mode 100644 health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/TimelineCampaign.js create mode 100644 health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/UploadData.js create mode 100644 health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/XlsPreview.js create mode 100644 health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/icons/DustbinIcon.js create mode 100644 health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/icons/XlsxFile.js create mode 100644 health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/configs/CampaignConfig.js create mode 100644 health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/configs/UICustomizations.js create mode 100644 health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/configs/addProductConfig.js create mode 100644 health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/configs/attributeConfig.js create mode 100644 health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/configs/baseTimeOut.js create mode 100644 health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/configs/deliveryConfig.js create mode 100644 health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/configs/headerConfig.js create mode 100644 health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/configs/mailConfig.js create mode 100644 health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/configs/myCampaignConfig.js create mode 100644 health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/configs/operatorConfig.js create mode 100644 health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/configs/previewConfig.js create mode 100644 health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/configs/productType.js create mode 100644 health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/configs/schemaConfig.js create mode 100644 health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/hooks/index.js create mode 100644 health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/hooks/services/createCampaignService.js create mode 100644 health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/hooks/services/updateCampaignService.js create mode 100644 health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/hooks/services/useSearchCampaign.js create mode 100644 health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/hooks/useCreateCampaign.js create mode 100644 health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/hooks/useCreateProduct.js create mode 100644 health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/hooks/useCreateProductVariant.js create mode 100644 health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/hooks/useGenerateIdCampaign.js create mode 100644 health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/hooks/useParallelSearch.js create mode 100644 health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/hooks/useProductList.js create mode 100644 health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/hooks/useResourceData.js create mode 100644 health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/hooks/useUpdateCampaign.js create mode 100644 health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/AddProduct.js create mode 100644 health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/CycleConfiguration.js create mode 100644 health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/MyCampaign.js create mode 100644 health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/Response.js create mode 100644 health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/SetupCampaign.js create mode 100644 health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/deliveryRule/AddDeliverycontext.js create mode 100644 health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/deliveryRule/AddProductscontext.js create mode 100644 health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/deliveryRule/MultiTabcontext.js create mode 100644 health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/deliveryRule/index.js create mode 100644 health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/index.js create mode 100644 health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/TourSteps.js create mode 100644 health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/downloadExcel.js create mode 100644 health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/index.js create mode 100644 health/micro-ui/web/micro-ui-internals/publish-develop.sh create mode 100644 health/micro-ui/web/micro-ui-internals/publish.sh create mode 100755 health/micro-ui/web/micro-ui-internals/scripts/create.sh create mode 100755 health/micro-ui/web/micro-ui-internals/scripts/deploy.sh create mode 100755 health/micro-ui/web/micro-ui-internals/scripts/jenkins.sh create mode 100755 health/micro-ui/web/micro-ui-internals/scripts/run.sh create mode 100644 health/micro-ui/web/micro-ui-internals/test.js create mode 100644 health/micro-ui/web/package.json create mode 100644 health/micro-ui/web/public/index.html create mode 100644 health/micro-ui/web/public/robots.txt create mode 100644 health/micro-ui/web/src/App.js create mode 100644 health/micro-ui/web/src/ComponentRegistry.js create mode 100644 health/micro-ui/web/src/Customisations/UICustomizations.js create mode 100644 health/micro-ui/web/src/Customisations/index.js create mode 100644 health/micro-ui/web/src/Customisations/pt/index.js create mode 100644 health/micro-ui/web/src/Customisations/pt/pageComponents/PTAllotmentDetails.js create mode 100644 health/micro-ui/web/src/Customisations/pt/pageComponents/PTBusinessDetails.js create mode 100644 health/micro-ui/web/src/Customisations/pt/pageComponents/PTVasikaDetails.js create mode 100644 health/micro-ui/web/src/Customisations/pt/pageComponents/PropertyUsageType.js create mode 100644 health/micro-ui/web/src/Customisations/tl/TLCustomisation.js create mode 100644 health/micro-ui/web/src/Customisations/tl/index.js create mode 100644 health/micro-ui/web/src/Customisations/tl/pageComponents/PropertyUsageType.js create mode 100644 health/micro-ui/web/src/index.css create mode 100644 health/micro-ui/web/src/index.js create mode 100644 health/micro-ui/web/src/setupProxy.js create mode 100644 health/micro-ui/web/webpack.config.js create mode 100644 health/micro-ui/web/workbench/App.js create mode 100644 health/micro-ui/web/workbench/Dockerfile create mode 100755 health/micro-ui/web/workbench/install-deps.sh create mode 100644 health/micro-ui/web/workbench/inter-package.json create mode 100644 health/micro-ui/web/workbench/nginx.conf create mode 100644 health/micro-ui/web/workbench/package.json create mode 100644 health/micro-ui/web/workbench/webpack.config.js create mode 100644 yarn.lock diff --git a/.github/workflows/buildWorkbenchUI.yml b/.github/workflows/buildWorkbenchUI.yml new file mode 100644 index 00000000000..53ad39bacf7 --- /dev/null +++ b/.github/workflows/buildWorkbenchUI.yml @@ -0,0 +1,64 @@ +name: Digit Admin Console Build workflow +on: + push: + branches: + - campaign + paths: + - 'health/micro-ui/web/micro-ui-internals/**' + pull_request: + branches: + - campaign + workflow_dispatch: +jobs: + docker_image-build: + outputs: + run_job_digit_ui: ${{ steps.check_files.outputs.run_job_digit_ui }} + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + with: + fetch-depth: 2 + - name: Setup Docker + uses: docker/setup-buildx-action@v1 + - name: check modified files + id: check_files + run: | + echo "=============== list modified files ===============" + git diff --name-only HEAD^ HEAD + + echo "========== check paths of modified files ==========" + git diff --name-only HEAD^ HEAD > files.txt + run_job_digit_ui=false + while IFS= read -r file + do + if [[ $file == health/micro-ui/* ]]; then + echo "This modified file is under the 'digit_ui' folder." + run_job_digit_ui=true + fi + done < files.txt + + # Set the output based on whether the job should run + echo "::set-output name=run_job_digit_ui::$run_job_digit_ui" + echo "ACTION_NUMBER=${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV + echo "COMMIT_ID=${GITHUB_SHA: -8}" >> $GITHUB_ENV # Extract last 8 characters of SHA + echo "BRANCH_NAME=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV + + + + + - name: Login to egovio docker Container Registry + env: + DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} + DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} + run: | + # Authenticate with Docker Hub + echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin + + - name: Build and Push Docker image for digit-ui + if: ${{ steps.check_files.outputs.run_job_digit_ui == 'true' }} + run: | + docker build -t workbench-ui:${{ env.BRANCH_NAME }}-${{ env.COMMIT_ID }}-${{ env.ACTION_NUMBER }} -f web/workbench/Dockerfile . + docker tag workbench-ui:${{ env.BRANCH_NAME }}-${{ env.COMMIT_ID }}-${{ env.ACTION_NUMBER }} egovio/workbench-ui:${{ env.BRANCH_NAME }}-${{ env.COMMIT_ID }}-${{ env.ACTION_NUMBER }} + docker push egovio/workbench-ui:${{ env.BRANCH_NAME }}-${{ env.COMMIT_ID }}-${{ env.ACTION_NUMBER }} + working-directory: micro-ui diff --git a/.github/workflows/publishAllPackages.yml b/.github/workflows/publishAllPackages.yml index ffaa1e6c016..f41ce8f9e72 100644 --- a/.github/workflows/publishAllPackages.yml +++ b/.github/workflows/publishAllPackages.yml @@ -1,10 +1,15 @@ -name: Node.js Publish UI Packages +name: Node.js Publish Health UI Packages on: push: - branches: [ 'develop' ] + branches: [ 'develop','campaign' ] paths: - - 'micro-ui/web/micro-ui-internals/**' + - 'health/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 health/micro-ui/web/micro-ui-internals/ && bash ./publish-develop.sh env: NODE_AUTH_TOKEN: ${{secrets.npm_token}} diff --git a/.github/workflows/publishProjectFactory.yml b/.github/workflows/publishProjectFactory.yml new file mode 100644 index 00000000000..19fde98c7ab --- /dev/null +++ b/.github/workflows/publishProjectFactory.yml @@ -0,0 +1,77 @@ +name: project factory service docker Image CI + +on: + push: + branches: [ "campaign" ] + paths: + - 'utilities/project-factory/**' + pull_request: + branches: [ "campaign" ] + +jobs: + + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 # Fetch all history for tags and branches + + - name: Set up environment variables + id: env + run: | + echo "BRANCH_NAME=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV + echo "ACTION_NUMBER=${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV + echo "COMMIT_ID=${GITHUB_SHA: -8}" >> $GITHUB_ENV # Extract last 8 characters of SHA + + - name: Build the service Docker image + id: docker_build + working-directory: ./utilities/project-factory + run: | + IMAGE_TAG=egovio/project-factory:${{ env.BRANCH_NAME }}-${{ env.COMMIT_ID }}-${{ env.ACTION_NUMBER }} + docker build . \ + --file Dockerfile \ + --tag $IMAGE_TAG + echo "::set-output name=image_name::$IMAGE_TAG" + + + - name: Build the db migration Docker image + id: docker_db_build + working-directory: ./utilities/project-factory/migration + run: | + IMAGE_TAG=egovio/project-factory-db:${{ env.BRANCH_NAME }}-${{ env.COMMIT_ID }}-${{ env.ACTION_NUMBER }} + docker build . \ + --file Dockerfile \ + --tag $IMAGE_TAG + echo "::set-output name=db_image_name::$IMAGE_TAG" + + + - name: Login to Docker Hub and Push Docker Image + working-directory: ./utilities/project-factory + env: + DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} + DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} + IMAGE_NAME: ${{ steps.docker_build.outputs.image_name }} + run: | + # Authenticate with Docker Hub + echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin + + # Push the image to Docker Hub + docker push $IMAGE_NAME + echo "Docker image pushed: $IMAGE_NAME" + + - name: Login to Docker Hub and Push DB Migration Docker Image + working-directory: ./utilities/project-factory/migration + env: + DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} + DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} + DB_IMAGE_NAME: ${{ steps.docker_db_build.outputs.db_image_name }} + run: | + # Authenticate with Docker Hub + echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin + + # Push the image to Docker Hub + docker push $DB_IMAGE_NAME + echo "Docker image pushed: $DB_IMAGE_NAME" diff --git a/.gitignore b/.gitignore index 84763f33d2a..cdb588bba78 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,6 @@ accelerators/frontend/micro-ui-internals/node_modules/* .idea index.lock -utilities/ \ No newline at end of file +utilities/project-factory/node_modules/* +utilities/egov-bff/node_modules/* +utilities/ diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 00000000000..65322fe9f51 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,17 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "node", + "request": "attach", + "name": "Attach to Remote", + "address": "localhost", + "port": 9229, + "localRoot": "${workspaceFolder}", + "remoteRoot": "/app" + } + ] +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000000..14f60307eb1 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "editor.inlineSuggest.showToolbar": "onHover" +} \ No newline at end of file diff --git a/README.md b/README.md index d758d985c9c..b0ad104ede6 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ + # DIGIT UI A React App built on top of DIGIT UI Core. diff --git a/health/micro-ui/.gitignore b/health/micro-ui/.gitignore new file mode 100644 index 00000000000..feb4cac5c94 --- /dev/null +++ b/health/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/health/micro-ui/Jenkinsfile b/health/micro-ui/Jenkinsfile new file mode 100644 index 00000000000..1206b9c141d --- /dev/null +++ b/health/micro-ui/Jenkinsfile @@ -0,0 +1,3 @@ +library 'ci-libs' + +buildPipeline(configFile: './build/build-config.yml') diff --git a/health/micro-ui/README.md b/health/micro-ui/README.md new file mode 100644 index 00000000000..9f559d81783 --- /dev/null +++ b/health/micro-ui/README.md @@ -0,0 +1,139 @@ + +# DIGIT 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/health/micro-ui/package.json b/health/micro-ui/package.json new file mode 100644 index 00000000000..19a3c47d6ee --- /dev/null +++ b/health/micro-ui/package.json @@ -0,0 +1,4 @@ +{ + "name": "workbench-ui", + "version": "1.0.0" +} \ No newline at end of file diff --git a/health/micro-ui/web/.babelrc b/health/micro-ui/web/.babelrc new file mode 100644 index 00000000000..5f90443d15e --- /dev/null +++ b/health/micro-ui/web/.babelrc @@ -0,0 +1,5 @@ +{ + "presets": [ + "@babel/preset-env","@babel/preset-react" + ] + } \ No newline at end of file diff --git a/health/micro-ui/web/.env.sample b/health/micro-ui/web/.env.sample new file mode 100644 index 00000000000..e87c7f586c4 --- /dev/null +++ b/health/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/health/micro-ui/web/CHANGELOG.md b/health/micro-ui/web/CHANGELOG.md new file mode 100644 index 00000000000..826105084e8 --- /dev/null +++ b/health/micro-ui/web/CHANGELOG.md @@ -0,0 +1,7 @@ +# Changelog +All notable changes to this module will be documented in this file. + +## 0.1.0 - 2024-05-28 +#### Base Admin console web + 1. Helps in creating the Campaign and configure delivery rules + 2. Create Data: Validates and creates resource details of type facility,user and boundary. diff --git a/health/micro-ui/web/docker/Dockerfile b/health/micro-ui/web/docker/Dockerfile new file mode 100644 index 00000000000..8e9b173bb85 --- /dev/null +++ b/health/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/health/micro-ui/web/docker/nginx.conf b/health/micro-ui/web/docker/nginx.conf new file mode 100644 index 00000000000..4f532e4a6ed --- /dev/null +++ b/health/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/health/micro-ui/web/envs.js b/health/micro-ui/web/envs.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/health/micro-ui/web/install-deps.sh b/health/micro-ui/web/install-deps.sh new file mode 100755 index 00000000000..efaceaee20d --- /dev/null +++ b/health/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/health/micro-ui/web/micro-ui-internals/.gitignore b/health/micro-ui/web/micro-ui-internals/.gitignore new file mode 100644 index 00000000000..1747c795d6f --- /dev/null +++ b/health/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/health/micro-ui/web/micro-ui-internals/.prettierignore b/health/micro-ui/web/micro-ui-internals/.prettierignore new file mode 100644 index 00000000000..d54de016ef0 --- /dev/null +++ b/health/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/health/micro-ui/web/micro-ui-internals/.prettierrc.json b/health/micro-ui/web/micro-ui-internals/.prettierrc.json new file mode 100644 index 00000000000..b975008d6f8 --- /dev/null +++ b/health/micro-ui/web/micro-ui-internals/.prettierrc.json @@ -0,0 +1,3 @@ +{ + "printWidth": 150 +} diff --git a/health/micro-ui/web/micro-ui-internals/README.md b/health/micro-ui/web/micro-ui-internals/README.md new file mode 100644 index 00000000000..f23a1fcfe9c --- /dev/null +++ b/health/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/health/micro-ui/web/micro-ui-internals/clean.sh b/health/micro-ui/web/micro-ui-internals/clean.sh new file mode 100644 index 00000000000..2235ef1c1d0 --- /dev/null +++ b/health/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/health/micro-ui/web/micro-ui-internals/example/.env-health-qa b/health/micro-ui/web/micro-ui-internals/example/.env-health-qa new file mode 100644 index 00000000000..73b42b7dfad --- /dev/null +++ b/health/micro-ui/web/micro-ui-internals/example/.env-health-qa @@ -0,0 +1,7 @@ +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://health-qa.digit.org +REACT_APP_PROXY_ASSETS=https://health-qa.digit.org +REACT_APP_GLOBAL=https://egov-dev-assets.s3.ap-south-1.amazonaws.com/globalConfigsWorkbenchHCM.js diff --git a/health/micro-ui/web/micro-ui-internals/example/.env-mz-prod b/health/micro-ui/web/micro-ui-internals/example/.env-mz-prod new file mode 100644 index 00000000000..2d02707d7eb --- /dev/null +++ b/health/micro-ui/web/micro-ui-internals/example/.env-mz-prod @@ -0,0 +1,7 @@ +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://salama.digit.org +REACT_APP_PROXY_ASSETS=https://salama.digit.org +REACT_APP_GLOBAL=https://moz-health-prd.s3.af-south-1.amazonaws.com/globalConfig.js diff --git a/health/micro-ui/web/micro-ui-internals/example/.env-mz-uat b/health/micro-ui/web/micro-ui-internals/example/.env-mz-uat new file mode 100644 index 00000000000..bedf28a95b1 --- /dev/null +++ b/health/micro-ui/web/micro-ui-internals/example/.env-mz-uat @@ -0,0 +1,7 @@ +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://moz-health-uat.digit.org +REACT_APP_PROXY_ASSETS=https://moz-health-uat.digit.org +REACT_APP_GLOBAL=https://moz-health-uat.s3.ap-south-1.amazonaws.com/globalConfig.js diff --git a/health/micro-ui/web/micro-ui-internals/example/.env-unifieddev b/health/micro-ui/web/micro-ui-internals/example/.env-unifieddev new file mode 100644 index 00000000000..81fd56e040a --- /dev/null +++ b/health/micro-ui/web/micro-ui-internals/example/.env-unifieddev @@ -0,0 +1,9 @@ +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 +WORKBENCH=https://egov-dev-assets.s3.ap-south-1.amazonaws.com/globalConfigsWorkbenchHCMMZ.js \ No newline at end of file diff --git a/health/micro-ui/web/micro-ui-internals/example/package.json b/health/micro-ui/web/micro-ui-internals/example/package.json new file mode 100644 index 00000000000..7c60f4a1d6c --- /dev/null +++ b/health/micro-ui/web/micro-ui-internals/example/package.json @@ -0,0 +1,39 @@ +{ + "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-module-workbench": "1.0.2-beta.3", + "@egovernments/digit-ui-components": "0.0.2-beta.1", + "@egovernments/digit-ui-module-core": "1.8.2-beta.2", + "@egovernments/digit-ui-module-utilities": "1.0.1-beta.30", + "@egovernments/digit-ui-react-components": "1.8.2-beta.6", + "@egovernments/digit-ui-module-hcmworkbench":"0.0.38", + "@egovernments/digit-ui-module-campaign-manager": "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" + ] + } +} \ No newline at end of file diff --git a/health/micro-ui/web/micro-ui-internals/example/public/index.html b/health/micro-ui/web/micro-ui-internals/example/public/index.html new file mode 100644 index 00000000000..d42798fc275 --- /dev/null +++ b/health/micro-ui/web/micro-ui-internals/example/public/index.html @@ -0,0 +1,34 @@ + + + + + + + + + + DIGIT + + + + + + + + + + + + + + + +
+ + + diff --git a/health/micro-ui/web/micro-ui-internals/example/src/ComponentRegistry.js b/health/micro-ui/web/micro-ui-internals/example/src/ComponentRegistry.js new file mode 100644 index 00000000000..9bafce3dc89 --- /dev/null +++ b/health/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/health/micro-ui/web/micro-ui-internals/example/src/UICustomizations.js b/health/micro-ui/web/micro-ui-internals/example/src/UICustomizations.js new file mode 100644 index 00000000000..d21e82500b7 --- /dev/null +++ b/health/micro-ui/web/micro-ui-internals/example/src/UICustomizations.js @@ -0,0 +1,663 @@ +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", +}; + +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/health/micro-ui/web/micro-ui-internals/example/src/complaintConfig.js b/health/micro-ui/web/micro-ui-internals/example/src/complaintConfig.js new file mode 100644 index 00000000000..28c85515205 --- /dev/null +++ b/health/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/health/micro-ui/web/micro-ui-internals/example/src/components/SelectName.js b/health/micro-ui/web/micro-ui-internals/example/src/components/SelectName.js new file mode 100644 index 00000000000..56d2a195c12 --- /dev/null +++ b/health/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/health/micro-ui/web/micro-ui-internals/example/src/fsm.js b/health/micro-ui/web/micro-ui-internals/example/src/fsm.js new file mode 100644 index 00000000000..271d3ddad56 --- /dev/null +++ b/health/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/health/micro-ui/web/micro-ui-internals/example/src/index.js b/health/micro-ui/web/micro-ui-internals/example/src/index.js new file mode 100644 index 00000000000..2f01957d5b8 --- /dev/null +++ b/health/micro-ui/web/micro-ui-internals/example/src/index.js @@ -0,0 +1,84 @@ +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-css/example/index.css"; + +import { pgrCustomizations } from "./pgr"; +import { UICustomizations } from "./UICustomizations"; +import { initCampaignComponents } from "@egovernments/digit-ui-module-campaign-manager" +import { initWorkbenchComponents } from "@egovernments/digit-ui-module-workbench"; +import { initUtilitiesComponents } from "@egovernments/digit-ui-module-utilities"; +import { initWorkbenchHCMComponents } from "@egovernments/digit-ui-module-hcmworkbench"; + +var Digit = window.Digit || {}; + +const enabledModules = [ + "DSS", + "HRMS", + "Workbench", + "HCMWORKBENCH", + "Campaign", + // "Engagement", "NDSS","QuickPayLinks", "Payment", + "Utilities", + "Microplanning" + //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(); + initWorkbenchComponents(); + initWorkbenchHCMComponents(); + initCampaignComponents(); + + 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/health/micro-ui/web/micro-ui-internals/example/src/pgr.js b/health/micro-ui/web/micro-ui-internals/example/src/pgr.js new file mode 100644 index 00000000000..48a498e4582 --- /dev/null +++ b/health/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/health/micro-ui/web/micro-ui-internals/example/src/setupProxy.js b/health/micro-ui/web/micro-ui-internals/example/src/setupProxy.js new file mode 100644 index 00000000000..fbc52c4a879 --- /dev/null +++ b/health/micro-ui/web/micro-ui-internals/example/src/setupProxy.js @@ -0,0 +1,100 @@ +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", + "/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", + "/project-factory", + "/boundary-service", + "/product", + ].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/health/micro-ui/web/micro-ui-internals/package.json b/health/micro-ui/web/micro-ui-internals/package.json new file mode 100644 index 00000000000..92f1e334d77 --- /dev/null +++ b/health/micro-ui/web/micro-ui-internals/package.json @@ -0,0 +1,57 @@ +{ + "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:campaign": "cd packages/modules/campaign-manager && yarn start", + "build": "run-p build:**", + "build:campaign": "cd packages/modules/campaign-manager && 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": { + "ajv": "8.12.0", + "lodash": "4.17.21", + "microbundle-crl": "0.13.11", + "@egovernments/digit-ui-react-components": "1.8.2-beta.6", + "@egovernments/digit-ui-components": "0.0.2-beta.1", + "react": "17.0.2", + "react-dom": "17.0.2", + "react-hook-form": "6.15.8", + "react-i18next": "11.16.2", + "react-query": "3.6.1", + "react-router-dom": "5.3.0" + } +} diff --git a/health/micro-ui/web/micro-ui-internals/packages/css/README.md b/health/micro-ui/web/micro-ui-internals/packages/css/README.md new file mode 100644 index 00000000000..6efe08ae5c5 --- /dev/null +++ b/health/micro-ui/web/micro-ui-internals/packages/css/README.md @@ -0,0 +1,62 @@ + + +# 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.7-campaign some css fixes in attribute +1.0.5-campaign some css fixes in previous button +1.0.4-campaign updated styling for create campaign screens +1.0.2-campaign update Styling added for delivery rule screen +1.0.1-campaign Styling added for delivery rule screen +1.0.0-campaign 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/health/micro-ui/web/micro-ui-internals/packages/css/gulpfile.js b/health/micro-ui/web/micro-ui-internals/packages/css/gulpfile.js new file mode 100644 index 00000000000..5d1a705494a --- /dev/null +++ b/health/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/health/micro-ui/web/micro-ui-internals/packages/css/package.json b/health/micro-ui/web/micro-ui-internals/packages/css/package.json new file mode 100644 index 00000000000..5f503a9ebf5 --- /dev/null +++ b/health/micro-ui/web/micro-ui-internals/packages/css/package.json @@ -0,0 +1,65 @@ +{ + "name": "@egovernments/digit-ui-css", + "version": "1.0.56-campaign", + "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/health/micro-ui/web/micro-ui-internals/packages/css/postcss.config.js b/health/micro-ui/web/micro-ui-internals/packages/css/postcss.config.js new file mode 100644 index 00000000000..18485de221e --- /dev/null +++ b/health/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/health/micro-ui/web/micro-ui-internals/packages/css/src/components/microplanning.scss b/health/micro-ui/web/micro-ui-internals/packages/css/src/components/microplanning.scss new file mode 100644 index 00000000000..f01756f1e7d --- /dev/null +++ b/health/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/health/micro-ui/web/micro-ui-internals/packages/css/src/index.scss b/health/micro-ui/web/micro-ui-internals/packages/css/src/index.scss new file mode 100644 index 00000000000..ff5ace2af3e --- /dev/null +++ b/health/micro-ui/web/micro-ui-internals/packages/css/src/index.scss @@ -0,0 +1,13 @@ +/*@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"; +@import "./pages/employee/campaign.scss"; diff --git a/health/micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/campaign.scss b/health/micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/campaign.scss new file mode 100644 index 00000000000..5c6b56289d3 --- /dev/null +++ b/health/micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/campaign.scss @@ -0,0 +1,109 @@ +@import url("../../index.scss"); +@import "../../typography.scss"; + +.summary-header { + @extend .typography.text-heading-l; + font-size: 2.25rem; +} +.date-field-container { + display: grid; + grid-template-columns: 20rem 20rem; + grid-gap: 1.5rem; + width: 70%; + padding-top: 0.3rem; + margin-top: 0rem; +} +.date-field { + display: grid; + grid-template-columns: 1fr 2fr; + align-items: start; +} +.campaign-type { + margin-right: 5rem; + padding-bottom: 1.2rem; + font-weight: bold; +} +.name-container { + margin-right: 4rem; + font-weight: bold; + text-wrap: nowrap; +} +.beneficiary-type { + margin-right: 5.4rem; + font-weight: bold; +} +.campaign-dates { + display: flex; + font-weight: bold; +} +.mandatory-date { + margin-top: 0.8rem; + margin-left: 0.5rem; + color: red !important; + font-size: 1rem; + font-weight: 700; +} +.description-type { + margin-top: 2rem; + margin-bottom: 2rem; +} +.name-description { + margin-top: 2rem; + margin-bottom: 2rem; +} +.dates-description { + margin-top: 1rem; + margin-bottom: 1rem; + padding-bottom: 1.2rem; +} +.selecting-boundary-div { + padding-top: 0.5rem; + .label-field-pair { + margin-bottom: 1.5rem; + } +} +.campaign-table { + border-collapse: collapse; + border-color: transparent; + border-width: 0rem 1.5rem; + tbody { + tr:hover { + background: rgba(#f47738, 0.12); + } + } +} +.info-points { + display: flex; + gap: 0.5rem; + margin-bottom: 0.5rem; +} +.infoClass{ + margin-bottom: 1.5rem +} +.headerWrapperClassName{ + display: none +} +.popup-close-svg{ + display: none; +} +.whoLogo{ + margin-top: -1rem; + margin-bottom: -1rem; +} + +.digit-popup-wrapper{ + &.popUpClass{ + width:45rem; + + .popUpFooter{ + .digit-popup-footer-buttons{ + margin-left: 0px; + width: 100%; + + button{ + flex:1; + } + } + } + } +} diff --git a/health/micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/campaignCycle.scss b/health/micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/campaignCycle.scss new file mode 100644 index 00000000000..74296abb568 --- /dev/null +++ b/health/micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/campaignCycle.scss @@ -0,0 +1,331 @@ +@import "../../typography.scss"; + +.campaign-cycle-container { + .campaign-tabs-container { + } + .sub-tab-container { + margin-top: 5px; + padding: 1.5rem; + .card-text { + margin-bottom: 0; + } + } + .add-resource-container { + background-color: #fafafa; + border: 1px solid #d6d5d4; + border-radius: 0.4rem; + padding: 1rem; + margin-right: 1.5rem; + margin-bottom: 1.5rem; + .card-text { + margin: 0; + font-weight: 700; + } + .header-container { + display: flex; + align-items: flex-end; + justify-content: space-between; + } + } + .delete-resource-icon { + cursor: pointer; + font-weight: 600; + font-size: 1rem; + color: theme(digitv2.lightTheme.primary); + display: flex; + gap: 0.5rem; + align-items: center; + } + .add-resource-label-field-container { + display: grid; + grid-template-columns: 2fr 1fr; + grid-gap: 2rem; + .options-card { + max-height: 10rem !important; + } + } + .popup-wrap { + .popup-module-main { + max-height: 707px; + overflow-y: auto; + width: 99%; + &::-webkit-scrollbar { + width: 0.5rem; + background: transparent; + } + &::-webkit-scrollbar-thumb { + background: #d6d5d4; /* Color of the scrollbar thumb */ + border-radius: 5px; /* Adjust the border-radius for rounded corners */ + height: 0.5rem; + } + } + .popup-module-action-bar { + .selector-button-primary { + padding: 0.6rem 2.5rem; + height: unset; + margin: 1.5rem; + background-color: theme(digitv2.lightTheme.primary); + } + } + } +} +.selector-button-primary { + background-color: theme(digitv2.lightTheme.primary); +} +.campaign-breadcrumb { + margin: 0; + margin-bottom: 1.5rem; + color: theme(digitv2.lightTheme.primary) !important; +} +.sc-jlZhew.dVtbRz { + overflow: hidden; +} +.campaign-popup-module { + margin: auto; + width: calc(100% - 5rem); +} +.campaign-bulk-upload { + display: flex; + justify-content: space-between; + margin-bottom: 1.5rem; + .campaign-download-template-btn { + font-weight: 700; + } +} +.bulk-info-text { + margin-bottom: 1.5rem; +} +.delete-and-download-button { + display: flex; + gap: 1.5rem; +} +.bulk-upload-file { + .uploaded-file-container { + margin: 0; + margin-bottom: 1.5rem; + } +} +.uploaded-file-container { + margin-left: 0rem; +} +.upload-drag-drop-container { + background-color: #fafafa; + border: 1.5px dashed #d6d5d4; + border-radius: 5px; + padding: 1rem 1rem 1rem 1rem; + display: flex; + align-items: center; + flex-direction: column; + + .drag-drop-text { + text-decoration: none; + + .browse-text { + text-decoration: none; + color: theme(digitv2.lightTheme.primary); + transition: color 0.3s; + } + + .browse-text:hover { + color: theme(digitv2.lightTheme.primary); + text-decoration: underline; + cursor: pointer; + } + } +} + +.upload-drag-drop-container { + margin-left: 0rem; + .drag-drop { + color: #b1b4b6; + } + .browse-text { + text-decoration: underline; + color: theme(digitv2.lightTheme.primary); + transition: color 0.3s; + } +} + +.campaign-counter-container { + padding: 1.5rem; + padding-bottom: 0.5rem; + .card-text { + margin-top: 0; + } + .label-field-pair { + margin-bottom: 1rem; + .card-label { + font-weight: 700; + } + } + .date-field-container { + display: grid; + grid-template-columns: 18.75rem 18.75rem; + grid-gap: 1.5rem; + width: 100%; + } + .PlusMinus { + width: 30%; + input { + width: 100%; + } + } +} + +.campaign-tab-head { + padding: 1rem; + width: 12.5rem; + height: 3rem; + border-radius: 10px 10px 0px 0px; + background-color: #ffffff; + outline: none; + box-sizing: border-box; + font-weight: 700; + font-size: 1rem; + font-family: "Roboto"; + color: #505a5f; + margin-bottom: -6px; + border: 1px solid #d6d5d4; + background-color: #fafafa; + &.active { + height: 3.375rem; + background-color: #ffffff; + outline: none; + font-weight: bold; + color: theme(digitv2.lightTheme.primary); + border: 1px solid theme(digitv2.lightTheme.primary); + border-bottom: 4px solid theme(digitv2.lightTheme.primary); + box-sizing: border-box; + font-size: 1.5rem; + } + :focus { + outline: none; + } +} +.campaign-sub-tab-head { + outline: none; + background-color: #ffffff; + color: theme(digitv2.lightTheme.primary); + border: 1px solid theme(digitv2.lightTheme.primary); + height: 2rem; + width: 9.188rem; + font-size: 1rem; + font-weight: 400; + &.active { + background-color: theme(digitv2.lightTheme.primary); + color: #ffffff; + font-weight: bold; + outline: none; + height: 2rem; + width: 9.188rem; + font-family: "Roboto"; + font-weight: 700; + font-size: 1rem; + } +} +.tab-content-header { + margin-top: 1.5rem; + margin-bottom: 1.5rem !important; +} + +.delivery-rule-container { + padding-top: 0; + .card-header { + .title { + margin: 0 !important; + } + font-size: 1.5rem !important; + margin: 0; + display: flex; + align-content: center; + justify-content: space-between; + } + .attribute-container { + border: 1px solid #d6d5d4; + background-color: #fafafa; + padding: 1rem; + padding-top: 0; + .add-attribute { + width: 74.5%; + justify-content: center; + h2 { + font-size: 1rem; + font-family: Roboto; + width: unset !important; + font-weight: 600; + } + } + } +} +.attribute-field-wrapper { + display: grid; + grid-template-columns: 1fr 1fr 1fr 1fr; + align-items: center; + gap: 2.5rem; + .label-field-pair { + flex-direction: column; + align-items: flex-start !important; + .card-label.card-label-smaller { + font-weight: 700; + } + .employee-select-wrap.form-field { + width: 100%; + } + .digit-employee-card-input { + margin-bottom: 0; + } + } + .options-card { + max-height: 10rem !important; + } + .card-label { + margin-bottom: 0.5rem; + } +} +.add-rule-btn { + margin: auto; + h2 { + font-family: Roboto; + font-size: 1rem; + font-weight: 600; + } +} +.add-product-btn { + h2 { + font-family: Roboto; + font-size: 1rem; + font-weight: 600; + } +} +.popup-wrap.campaign-product-wrapper { + .popup-module { + width: 70%; + padding-left: 1.5rem; + padding-bottom: 1.5rem; + .header-wrap { + font-size: 1.5rem; + font-weight: 700; + .header-content.popup-header-fix { + margin-top: 1.5rem; + } + } + } + .popup-module-action-bar { + margin-top: 1.5rem; + margin-right: 1.5rem; + } +} +.search-button-wrapper { + grid-column-end: -1 !important; + flex-direction: row !important; +} +.add-resource-modal { +} +.add-resource-wrapper { + .link { + color: theme(digitv2.lightTheme.primary); + } +} +.digit-toast-success { + margin-bottom: -0.5rem; +} diff --git a/health/micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/coreOverride.scss b/health/micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/coreOverride.scss new file mode 100644 index 00000000000..295d90c1264 --- /dev/null +++ b/health/micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/coreOverride.scss @@ -0,0 +1,173 @@ +@import "../../typography.scss"; + +/* language selection issue*/ +.customBtn-selected { + background-color: theme(digitv2.lightTheme.primary); +} + +/* login screen issue*/ + +.primary-label-btn { + color: theme(digitv2.lightTheme.primary); +} + +/* landing screen issue*/ + +.employeeCard { + .complaint-links-container .header .logo { + background-color: theme(digitv2.lightTheme.primary); + } + + .complaint-links-container .body { + &.link { + color: theme(digitv2.lightTheme.primary); + } + .inbox-total { + background-color: theme(digitv2.lightTheme.primary); + } + } +} + +.employee .topbar .right .user-img-txt { + background-color: theme(digitv2.lightTheme.primary); +} +/* button component issue*/ + +.action-bar-wrap { + .submit-bar { + background-color: theme(digitv2.lightTheme.primary); + } +} + +.jk-digit-secondary-btn { + color: theme(digitv2.lightTheme.primary); + border-color: theme(digitv2.lightTheme.primary); + + svg { + fill: theme(digitv2.lightTheme.primary); + + path { + fill: theme(digitv2.lightTheme.primary); + } + } +} +.error-boundary .error-container button { + background-color: theme(digitv2.lightTheme.primary); +} + +/* inbox screen issue*/ + +.inbox-search-wrapper { + .search-tabs-container .search-tab-head-selected { + color: theme(digitv2.lightTheme.primary); + border-color: theme(digitv2.lightTheme.primary); + } + .submit-bar { + background-color: theme(digitv2.lightTheme.primary); + } + .search-component-table .link { + color: theme(digitv2.lightTheme.primary); + } + .link-label { + color: theme(digitv2.lightTheme.primary) !important; + } +} +.drag-drop-container .drag-drop-text .browse-text { + color: theme(digitv2.lightTheme.primary); +} +/* toast new componnet css added */ + +.toast-success { + gap: 0.5rem; + height: 3rem; + padding: 0.75rem 0.5rem 0.75rem 0.75rem !important; + background-color: theme(digitv2.alert.success); + transition: bottom 0.5s ease; + grid-gap: 0.5rem; + &.error { + background-color: theme(digitv2.alert.error) !important; + } + + &.warning { + background-color: #f19100; + + &.warning-buttons { + @apply block; + } + } + + h2 { + @apply text-left overflow-hidden whitespace-no-wrap flex-grow flex items-center h-6; + letter-spacing: 0rem; + color: theme(digitv2.lightTheme.paper); + margin: 0rem; + text-overflow: ellipsis; + font-family: Roboto; + font-weight: 500; + font-size: 1.25rem; + font-style: normal; + } + svg { + @apply flex-shrink-0; + } +} + +@keyframes slideInFromBottom { + from { + bottom: -3rem; + } + to { + bottom: 4rem; + } +} + +.toast-success.animate { + animation: slideInFromBottom 0.5s ease forwards; +} + +@media screen and (max-width: 768px) { + .topbar { + background: #0b4b66 !important; + color: #fff; + } +} +header { + @extend .typography.text-heading-xl; +} +.digit-button-primary{ + background-color: theme(digitv2.lightTheme.primary) !important; +} +.digit-button-secondary{ + .icon-label-container{ + h2{ + color: theme(digitv2.lightTheme.primary) !important; + } + } +} + +/*.digit-popup-wrap { + background: rgba(0, 0, 0, 0.7); + @apply flex fixed w-full h-full overflow-auto top-0 left-0 min-h-screen; + z-index: 10000; + max-width: 100% !important; + max-height: 100% !important; +} + +@screen dt { + .digit-popup-wrap { + background: rgba(0, 0, 0, 0.7); + @apply min-h-screen; + } +} + +.digit-popup-close-icon { + @apply flex justify-end; +}*/ + +.employee{ + .digit-employeeSidebar{ + .sidebar{ + z-index:999 + } + } +} \ No newline at end of file diff --git a/health/micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/index.scss b/health/micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/index.scss new file mode 100644 index 00000000000..2b989e87305 --- /dev/null +++ b/health/micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/index.scss @@ -0,0 +1,481 @@ +@import "./campaignCycle.scss"; +@import "./coreOverride.scss"; +@import "../../typography.scss"; + +.wbh-header-container { + margin-top: 1.5rem; +} +.main.digit-home-main { + margin-left: 92px; + .employee-app-wrapper.digit-home-app-wrapper { + margin-left: 0; + margin-right: 2rem; + .ground-container.digit-home-ground { + padding: 0; + .employee-app-container.digit-home-employee-app { + .ground-container.moduleCardWrapper.gridModuleWrapper.digit-home-moduleCardWrapper { + gap: 2.5rem; + margin-top: 2rem; + padding: 0; + display: grid !important; + grid-template-columns: repeat(auto-fill, minmax(263px, 1fr)); + .employeeCard.customEmployeeCard.card-home.home-action-cards { + margin: 0 !important; + min-width: 263px !important; + width: auto !important; + } + } + } + } + } +} +.campaign-cycle-container { + .popup-header-fix { + margin-top: 1.5rem !important; + } +} + +.tag.inbox-tag { + max-width: fit-content; + background-color: #d6d5d4; + border-radius: 2rem; + padding: 0.5rem; + display: flex; + align-items: center; + height: 2rem; + margin-bottom: 0.7rem; + grid-gap: 0.2rem; + gap: 0.2rem; +} +.mandatory-span { + margin-left: 0.5rem; + color: red !important; + font-size: 1rem; + font-weight: 700; +} + +.digit-employee-card-input.numeric { + margin-bottom: unset; +} + +.actionBarClass { + display: flex; + justify-content: space-between; + flex-direction: row-reverse; + z-index: 0; +} +.previous-button { + margin-left: 4rem; + min-width: 12.5rem; +} +.info-text { + padding-bottom: 1.5rem; +} + +.view-composer-header-section { + display: flex; + justify-content: space-between; + align-items: baseline; +} +.card-with-background { + margin-top: 1rem; + .card-head { + margin-bottom: 1rem; + color: #505a5f; + } +} +.no-data-found { + display: flex; + flex-direction: column; + align-items: center; + .error-msg { + margin-top: 1rem; + } +} +.search-tab-head { + color: #505a5f; +} +.search-tabs-container { + border-bottom: none; + margin-bottom: 0; +} +.delivery-preview-card { + margin-bottom: 1.5rem !important; + background-color: #fafafa; + border: 1px solid #d6d5d4; + width: 70%; + .custom-table-label { + font-size: 1.5rem; + font-weight: 700; + color: #505a5f; + margin-bottom: 1rem; + } + .campaign-attribute-table { + margin-bottom: 1rem; + border: 1px solid #d6d5d4; + overflow: hidden; + border-radius: 4px; + table { + border-width: 0px !important; + background-color: #fafafa; + border: 1px solid #d6d5d4; + border-collapse: collapse; + border-radius: 1rem; + tbody { + tr:nth-child(odd) { + background-color: white; + } + } + th { + border-right: 1px solid #d6d5d4; + } + th:last-child { + border-right: none; + } + td { + padding: 1rem; + border-right: 1px solid #d6d5d4; + } + td:last-child { + padding: 1rem; + border-right: none; + } + } + } + .campaign-product-table { + margin-bottom: 1rem; + border: 1px solid #d6d5d4; + overflow: hidden; + border-radius: 4px; + table { + background-color: #fafafa; + border: 1px solid #d6d5d4; + border-collapse: collapse; + border-radius: 1rem; + border-width: 0px !important; + tbody { + background-color: #fff; + tr:nth-child(odd) { + background-color: white; + } + } + th { + border-right: 1px solid #d6d5d4; + } + th:last-child { + border-right: none; + } + td { + padding: 1rem; + border-right: 1px solid #d6d5d4; + } + td:last-child { + border-right: none; + } + } + } +} +.cycle-paragraph { + font-weight: 700; + font-size: 24px; + color: #505a5f; + margin-top: 0.5rem; +} +.header-end { + margin-right: 1rem; +} +.digit-stepper-container { + margin-bottom: 1.5rem; +} +.employee-app-wrapper { + margin: 0rem 1rem; +} +input[type="date"]::-webkit-calendar-picker-indicator { + position: absolute; + right: 5px; + top: 20%; + transform: translateY(-10%); +} +.campaign-preview-edit-container { + display: flex; + gap: 1rem; + span { + color: theme(digitv2.lightTheme.primary); + } +} +.campaign-attribute-table { + border: 1px solid #d6d5d4; + overflow: hidden; + border-radius: 4px; + tbody { + tr:nth-child(odd) { + background-color: white; + } + } +} +tbody { + tr:nth-child(odd) { + background-color: white; + } +} +.popup-wrap.campaign-data-preview { + flex-direction: column; +} + +.digit-employee-card-input.numeric { + pointer-events: none; +} +.product-tag-container { + display: flex; + flex-wrap: wrap; + gap: 1.5rem; + margin-bottom: 1rem; +} + +.workbench-download-template-btn { + font-weight: 700; +} +.digit-employee-card-input.numeric { + text-align: center; +} +.in-between { + display: grid; + grid-template-columns: 1fr 1fr; + gap: 2rem; + @media screen and (min-width: 1024px) { + grid-gap: 10rem; + } +} +.setup-campaign { + .setup-campaign-card { + padding-bottom: 1.5rem; + } + .digit-dropdown-options-card { + max-height: 10rem !important; + } + .digit-field { + margin-bottom: 0 !important; + } +} +.campaign-summary-container { + .setup-campaign-card { + .employeeCard.employeeCard-override { + padding: 1.5rem; + margin-bottom: 1.5rem !important; + } + } + .row { + justify-content: flex-start; + gap: 5rem; + h2 { + margin: 0; + width: 272px; + } + .value { + width: unset; + p { + margin: 0; + } + } + } + .digit-infobanner-wrap.error { + margin-left: 0; + margin-bottom: 1.5rem; + min-width: 100%; + .digit-button-primary { + height: 1.5rem; + background-color: #d4351c !important; + .icon-label-container.primary.large { + font-size: 14px; + .digit-button-label { + font-size: 14px; + color: #ffffff; + } + } + } + } +} +.view-composer-header-section { + .employee-card-sub-header { + @extend .typography.text-heading-m; + margin-bottom: 1.5rem; + } + .employee-card-sub-header.error { + color: #d4351c; + display: flex; + align-items: center; + gap: 0.5rem; + } +} +.add-new-product-container { + border: 1px solid #d6d5d4; + background-color: #fafafa; + width: 70%; + padding-top: 0; + .heading-bar { + font-weight: 700; + display: flex; + align-items: baseline; + justify-content: space-between; + .card-text { + margin-top: 1rem; + margin-bottom: 1rem; + } + } + .label-field-pair { + gap: 5rem; + align-items: baseline; + .product-label-field { + width: 12rem; + text-wrap: nowrap; + font-weight: 700; + } + } +} +.page-padding-fix { + margin-top: 1.5rem; +} +.addProductActionClass { + display: flex; + flex-direction: row-reverse; + justify-content: space-between; + .submit-bar { + width: max-content; + padding-left: 1.5rem; + padding-right: 1.5rem; + } +} +.loginFormStyleEmployee { + .loginCardClassName { + .digit-header-content { + &:not(label) { + display: flex; + justify-content: center; + } + } + } +} +.selecting-boundaries-dropdown { + .digit-multiselectdropdown-server { + max-height: 15rem; + } +} +.hover { + cursor: pointer; +} +.digit-dropdown-employee-select-wrap { + .digit-dropdown-employee-select-wrap--elipses { + font-size: 1rem !important; + } +} +.digit-dropdown-employee-select-wrap.language-dropdown { + .digit-dropdown-options-card { + min-width: fit-content; + } +} +.digit-popup-wrapper.boundaries-pop-module.default { + width: 36rem; + .digit-popup-footer { + .digit-popup-footer-buttons { + width: 100% !important; + display: grid; + grid-template-columns: 1fr 1fr; + .digit-button-secondary { + width: 100%; + } + .digit-button-primary { + width: 100%; + } + } + } +} +.campaign-type-alert-button { + .digit-button-label { + width: 100% !important; + } +} +.campaign-pop-module { + padding: 1.5rem; + border-radius: 4px; + width: 36rem; +} +.campaign-modal-heading { + font-size: 2rem; + font-weight: 700; + margin: 0 !important; +} +.campaign-pop-main { + font-size: 1.25rem; + padding: 0 !important; + font-size: 400; + .card-text { + margin-bottom: 1.5rem !important; + } + .popup-module-action-bar.campaign-pop-action { + .selector-button-border { + background-color: #ffffff; + border: 1px solid #c84c0e; + h2 { + color: #c84c0e !important; + } + } + } +} + +.digit-toast-success { + max-width: 90%; + margin-left: auto; + margin-right: auto; + height: auto; + .toast-label { + line-height: 1.5; + word-break: break-word; + height: auto; + white-space: unset; + } +} + +.digit-dropdown-select.error { + border: 1px solid #d4351c; +} +.campaign-type-wrapper { + .digit-error-icon-message-wrap { + margin-top: 4px; + font-size: 14px; + } +} +.individualElement { + h2 { + color: theme(digitv2.lightTheme.text-primary); + } +} +.link { + color: #c84c0e !important; +} +.employeeCard.employeeCard-override.card-error { + border: 1px solid #d4351c; +} +.label-field-pair.delivery-type-radio { + gap: 5rem; + .digit-radio-options-wrap { + gap: 2rem; + margin-bottom: 0 !important; + .radio-option-container { + margin-bottom: 0; + align-items: center; + } + } +} +.bold { + font-weight: 700; +} +.summary-doc-error { + p { + margin-top: 0; + margin-bottom: 0; + } + .digit-infobanner-wrap.error { + margin-bottom: 0.5rem; + margin-top: 1.5rem; + } +} diff --git a/health/micro-ui/web/micro-ui-internals/packages/css/src/typography.scss b/health/micro-ui/web/micro-ui-internals/packages/css/src/typography.scss new file mode 100644 index 00000000000..4a50014cf88 --- /dev/null +++ b/health/micro-ui/web/micro-ui-internals/packages/css/src/typography.scss @@ -0,0 +1,512 @@ +.typography { + &.text-heading-xl { + font-family: theme(digitv2.fontFamily.rc); + font-style: theme(digitv2.fontStyle.normal); + font-weight: theme(digitv2.fontWeight.bold); + color: theme(digitv2.lightTheme.text-primary); + line-height: theme(digitv2.lineHeight.normal); + + @media (min-width: theme(digitv2.screens.desktop)) { + font-size: theme(digitv2.fontSize.heading-xl.desktop); + } + + @media (min-width: theme(digitv2.screens.tablet)) { + font-size: theme(digitv2.fontSize.heading-xl.tablet); + } + + @media (min-width: theme(digitv2.screens.mobile)) { + font-size: theme(digitv2.fontSize.heading-xl.mobile); + } + } + + &.text-heading-l { + font-family: theme(digitv2.fontFamily.sans); + font-style: theme(digitv2.fontStyle.normal); + font-weight: theme(digitv2.fontWeight.bold); + color: theme(digitv2.lightTheme.text-primary); + line-height: theme(digitv2.lineHeight.normal); + + @media screen and (min-width: theme(digitv2.screens.desktop)) { + font-size: theme(digitv2.fontSize.heading-l.desktop); + } + + @media screen and (min-width: theme(digitv2.screens.tablet)) { + font-size: theme(digitv2.fontSize.heading-l.tablet); + } + + @media screen and (min-width: theme(digitv2.screens.mobile)) { + font-size: theme(digitv2.fontSize.heading-l.mobile); + } + } + + &.text-heading-m { + font-family: theme(digitv2.fontFamily.sans); + font-style: theme(digitv2.fontStyle.normal); + font-weight: theme(digitv2.fontWeight.bold); + color: theme(digitv2.lightTheme.text-primary); + line-height: theme(digitv2.lineHeight.normal); + + @media screen and (min-width: theme(digitv2.screens.desktop)) { + font-size: theme(digitv2.fontSize.heading-m.desktop); + } + + @media screen and (min-width: theme(digitv2.screens.tablet)) { + font-size: theme(digitv2.fontSize.heading-m.tablet); + } + + @media screen and (min-width: theme(digitv2.screens.mobile)) { + font-size: theme(digitv2.fontSize.heading-m.desktop); + } + } + + &.text-heading-s { + font-family: theme(digitv2.fontFamily.sans); + font-style: theme(digitv2.fontStyle.normal); + font-weight: theme(digitv2.fontWeight.bold); + color: theme(digitv2.lightTheme.text-primary); + line-height: theme(digitv2.lineHeight.normal); + + @media screen and (min-width: theme(digitv2.screens.desktop)) { + font-size: theme(digitv2.fontSize.heading-s.desktop); + } + + @media screen and (min-width: theme(digitv2.screens.tablet)) { + font-size: theme(digitv2.fontSize.heading-s.tablet); + } + + @media screen and (min-width: theme(digitv2.screens.mobile)) { + font-size: theme(digitv2.fontSize.heading-s.mobile); + } + } + + &.text-heading-xs { + @media screen and (min-width: theme(digitv2.screens.mobile)) { + font-size: theme(digitv2.fontSize.heading-xs.mobile); + font-family: theme(digitv2.fontFamily.sans); + font-style: theme(digitv2.fontStyle.normal); + font-weight: theme(digitv2.fontWeight.bold); + color: theme(digitv2.lightTheme.text-primary); + line-height: theme(digitv2.lineHeight.normal); + } + } + + &.text-caption-l { + font-family: theme(digitv2.fontFamily.sans); + font-style: theme(digitv2.fontStyle.italic); + font-weight: theme(digitv2.fontWeight.medium); + color: theme(digitv2.lightTheme.text-primary); + line-height: theme(digitv2.lineHeight.normal); + + @media screen and (min-width: theme(digitv2.screens.desktop)) { + font-size: theme(digitv2.fontSize.caption-l.desktop); + } + + @media screen and (min-width: theme(digitv2.screens.tablet)) { + font-size: theme(digitv2.fontSize.caption-l.tablet); + } + + @media screen and (min-width: theme(digitv2.screens.mobile)) { + font-size: theme(digitv2.fontSize.caption-l.mobile); + } + } + + &.text-caption-m { + font-family: theme(digitv2.fontFamily.sans); + font-style: theme(digitv2.fontStyle.italic); + font-weight: theme(digitv2.fontWeight.medium); + color: theme(digitv2.lightTheme.text-primary); + line-height: theme(digitv2.lineHeight.normal); + + @media screen and (min-width: theme(digitv2.screens.desktop)) { + font-size: theme(digitv2.fontSize.caption-m.desktop); + } + + @media screen and (min-width: theme(digitv2.screens.tablet)) { + font-size: theme(digitv2.fontSize.caption-m.tablet); + } + + @media screen and (min-width: theme(digitv2.screens.mobile)) { + font-size: theme(digitv2.fontSize.caption-m.mobile); + } + } + + &.text-caption-s { + font-family: theme(digitv2.fontFamily.sans); + font-style: theme(digitv2.fontStyle.italic); + font-weight: theme(digitv2.fontWeight.medium); + color: theme(digitv2.lightTheme.text-primary); + line-height: theme(digitv2.lineHeight.normal); + + @media screen and (min-width: theme(digitv2.screens.desktop)) { + font-size: theme(digitv2.fontSize.caption-s.desktop); + } + + @media screen and (min-width: theme(digitv2.screens.tablet)) { + font-size: theme(digitv2.fontSize.caption-s.tablet); + } + + @media screen and (min-width: theme(digitv2.screens.mobile)) { + font-size: theme(digitv2.fontSize.caption-s.desktop); + } + } + + &.text-body-l { + font-family: theme(digitv2.fontFamily.sans); + font-style: theme(digitv2.fontStyle.italic); + font-weight: theme(digitv2.fontWeight.regular); + color: theme(digitv2.lightTheme.text-primary); + + @media screen and (min-width: theme(digitv2.screens.desktop)) { + font-size: theme(digitv2.fontSize.body-l.desktop); + line-height: theme(digitv2.lineHeight.line-height-body-l.desktop); + } + + @media screen and (min-width: theme(digitv2.screens.tablet)) { + font-size: theme(digitv2.fontSize.body-l.tablet); + line-height: theme(digitv2.lineHeight.line-height-body-l.tablet); + } + + @media screen and (min-width: theme(digitv2.screens.mobile)) { + font-size: theme(digitv2.fontSize.body-l.mobile); + line-height: theme(digitv2.lineHeight.line-height-body-l.mobile); + } + } + + &.text-body-s { + font-family: theme(digitv2.fontFamily.sans); + font-style: theme(digitv2.fontStyle.italic); + font-weight: theme(digitv2.fontWeight.regular); + color: theme(digitv2.lightTheme.text-primary); + + @media screen and (min-width: theme(digitv2.screens.desktop)) { + font-size: theme(digitv2.fontSize.body-s.desktop); + line-height: theme(digitv2.lineHeight.line-height-body-s.desktop); + } + + @media screen and (min-width: theme(digitv2.screens.tablet)) { + font-size: theme(digitv2.fontSize.body-s.tablet); + line-height: theme(digitv2.lineHeight.line-height-body-s.tablet); + } + + @media screen and (min-width: theme(digitv2.screens.mobile)) { + font-size: theme(digitv2.fontSize.body-s.mobile); + line-height: theme(digitv2.lineHeight.line-height-body-s.mobile); + } + } + + &.text-body-xs { + font-family: theme(digitv2.fontFamily.sans); + font-style: theme(digitv2.fontStyle.italic); + font-weight: theme(digitv2.fontWeight.regular); + color: theme(digitv2.lightTheme.text-primary); + + @media screen and (min-width: theme(digitv2.screens.desktop)) { + font-size: theme(digitv2.fontSize.body-xs.desktop); + line-height: theme(digitv2.lineHeight.line-height-body-xs.desktop); + } + + @media screen and (min-width: theme(digitv2.screens.tablet)) { + font-size: theme(digitv2.fontSize.body-xs.tablet); + line-height: theme(digitv2.lineHeight.line-height-body-xs.tablet); + } + + @media screen and (min-width: theme(digitv2.screens.mobile)) { + font-size: theme(digitv2.fontSize.body-xs.mobile); + line-height: theme(digitv2.lineHeight.line-height-body-xs.mobile); + } + } + + &.text-label { + font-family: theme(digitv2.fontFamily.sans); + font-style: theme(digitv2.fontStyle.italic); + font-weight: theme(digitv2.fontWeight.regular); + color: theme(digitv2.lightTheme.text-primary); + line-height: theme(digitv2.lineHeight.normal); + + @media screen and (min-width: theme(digitv2.screens.desktop)) { + font-size: theme(digitv2.fontSize.label.desktop); + } + + @media screen and (min-width: theme(digitv2.screens.tablet)) { + font-size: theme(digitv2.fontSize.label.tablet); + } + + @media screen and (min-width: theme(digitv2.screens.mobile)) { + font-size: theme(digitv2.fontSize.label.mobile); + } + } + + &.text-link { + font-family: theme(digitv2.fontFamily.sans); + font-style: theme(digitv2.fontStyle.normal); + font-weight: theme(digitv2.fontWeight.regular); + color: theme(digitv2.lightTheme.text-primary); + line-height: theme(digitv2.lineHeight.normal); + text-decoration: theme(digitv2.textDecorationLine.underline); + + @media screen and (min-width: theme(digitv2.screens.desktop)) { + font-size: theme(digitv2.fontSize.link.desktop); + } + + @media screen and (min-width: theme(digitv2.screens.tablet)) { + font-size: theme(digitv2.fontSize.link.tablet); + } + + @media screen and (min-width: theme(digitv2.screens.mobile)) { + font-size: theme(digitv2.fontSize.link.mobile); + } + } + + &.heading-xl { + font-family: theme(digitv2.fontFamily.rc); + font-style: theme(digitv2.fontStyle.normal); + font-weight: theme(digitv2.fontWeight.bold); + + @media (max-width: 30rem) { + /* Media query for mobile */ + font-size: theme(digitv2.fontSize.heading-xl.mobile); + } + + @media (min-width: 30.063rem) and (max-width: 47.938rem) { + /* Media query for tablets */ + font-size: theme(digitv2.fontSize.heading-xl.tablet); + } + + @media (min-width: 48rem) { + /* Media query for desktop */ + font-size: theme(digitv2.fontSize.heading-xl.desktop); + } + } + + &.heading-l { + font-family: theme(digitv2.fontFamily.sans); + font-style: theme(digitv2.fontStyle.normal); + font-weight: theme(digitv2.fontWeight.bold); + + @media (max-width: 30rem) { + /* Media query for mobile */ + font-size: theme(digitv2.fontSize.heading-l.mobile); + } + + @media (min-width: 30.063rem) and (max-width: 47.938rem) { + /* Media query for tablets */ + font-size: theme(digitv2.fontSize.heading-l.tablet); + } + + @media (min-width: 48rem) { + /* Media query for desktop */ + font-size: theme(digitv2.fontSize.heading-l.desktop); + } + } + + &.heading-m { + font-family: theme(digitv2.fontFamily.sans); + font-style: theme(digitv2.fontStyle.normal); + font-weight: theme(digitv2.fontWeight.bold); + + @media (max-width: 30rem) { + /* Media query for mobile */ + font-size: theme(digitv2.fontSize.heading-m.mobile); + } + + @media (min-width: 30.063rem) and (max-width: 47.938rem) { + /* Media query for tablets */ + font-size: theme(digitv2.fontSize.heading-m.tablet); + } + + @media (min-width: 48rem) { + /* Media query for desktop */ + font-size: theme(digitv2.fontSize.heading-m.desktop); + } + } + + &.heading-s { + font-family: theme(digitv2.fontFamily.sans); + font-style: theme(digitv2.fontStyle.normal); + font-weight: theme(digitv2.fontWeight.bold); + + @media (max-width: 30rem) { + /* Media query for mobile */ + font-size: theme(digitv2.fontSize.heading-s.mobile); + } + + @media (min-width: 30.063rem) and (max-width: 47.938rem) { + /* Media query for tablets */ + font-size: theme(digitv2.fontSize.heading-s.tablet); + } + + @media (min-width: 48rem) { + /* Media query for desktop */ + font-size: theme(digitv2.fontSize.heading-s.desktop); + } + } + + &.heading-xs { + font-size: theme(digitv2.fontSize.heading-xs.mobile); + font-family: theme(digitv2.fontFamily.sans); + font-style: theme(digitv2.fontStyle.normal); + font-weight: theme(digitv2.fontWeight.bold); + } + + &.caption-l { + font-family: theme(digitv2.fontFamily.sans); + font-style: theme(digitv2.fontStyle.italic); + font-weight: theme(digitv2.fontWeight.medium); + + @media (max-width: 30rem) { + /* Media query for mobile */ + font-size: theme(digitv2.fontSize.caption-l.mobile); + } + + @media (min-width: 30.063rem) and (max-width: 47.938rem) { + /* Media query for tablets */ + font-size: theme(digitv2.fontSize.caption-l.tablet); + } + + @media (min-width: 48rem) { + /* Media query for desktop */ + font-size: theme(digitv2.fontSize.caption-l.desktop); + } + } + + &.caption-m { + font-family: theme(digitv2.fontFamily.sans); + font-style: theme(digitv2.fontStyle.italic); + font-weight: theme(digitv2.fontWeight.medium); + + @media (max-width: 30rem) { + /* Media query for mobile */ + font-size: theme(digitv2.fontSize.caption-m.mobile); + } + + @media (min-width: 30.063rem) and (max-width: 47.938rem) { + /* Media query for tablets */ + font-size: theme(digitv2.fontSize.caption-m.tablet); + } + + @media (min-width: 48rem) { + /* Media query for desktop */ + font-size: theme(digitv2.fontSize.caption-m.desktop); + } + } + + &.caption-s { + font-family: theme(digitv2.fontFamily.sans); + font-style: theme(digitv2.fontStyle.italic); + font-weight: theme(digitv2.fontWeight.medium); + + @media (max-width: 30rem) { + /* Media query for mobile */ + font-size: theme(digitv2.fontSize.caption-s.mobile); + } + + @media (min-width: 30.063rem) and (max-width: 47.938rem) { + /* Media query for tablets */ + font-size: theme(digitv2.fontSize.caption-s.tablet); + } + + @media (min-width: 48rem) { + /* Media query for desktop */ + font-size: theme(digitv2.fontSize.caption-s.desktop); + } + } + + &.body-l { + font-family: theme(digitv2.fontFamily.sans); + font-style: theme(digitv2.fontStyle.normal); + font-weight: theme(digitv2.fontWeight.regular); + + @media (max-width: 30rem) { + /* Media query for mobile */ + font-size: theme(digitv2.fontSize.body-l.mobile); + } + + @media (min-width: 30.063rem) and (max-width: 47.938rem) { + /* Media query for tablets */ + font-size: theme(digitv2.fontSize.body-l.tablet); + } + + @media (min-width: 48rem) { + /* Media query for desktop */ + font-size: theme(digitv2.fontSize.body-l.desktop); + } + } + + &.body-s { + font-family: theme(digitv2.fontFamily.sans); + font-style: theme(digitv2.fontStyle.normal); + font-weight: theme(digitv2.fontWeight.regular); + + @media (max-width: 30rem) { + /* Media query for mobile */ + font-size: theme(digitv2.fontSize.body-s.mobile); + } + + @media (min-width: 30.063rem) and (max-width: 47.938rem) { + /* Media query for tablets */ + font-size: theme(digitv2.fontSize.body-s.tablet); + } + + @media (min-width: 48rem) { + /* Media query for desktop */ + font-size: theme(digitv2.fontSize.body-s.desktop); + } + } + + &.body-xs { + font-family: theme(digitv2.fontFamily.sans); + font-style: theme(digitv2.fontStyle.normal); + font-weight: theme(digitv2.fontWeight.regular); + + @media (max-width: 30rem) { + /* Media query for mobile */ + font-size: theme(digitv2.fontSize.body-xs.mobile); + } + + @media (min-width: 30.063rem) and (max-width: 47.938rem) { + /* Media query for tablets */ + font-size: theme(digitv2.fontSize.body-xs.tablet); + } + + @media (min-width: 48rem) { + /* Media query for desktop */ + font-size: theme(digitv2.fontSize.body-xs.desktop); + } + } + + &.label { + font-family: theme(digitv2.fontFamily.sans); + font-style: theme(digitv2.fontStyle.normal); + font-weight: theme(digitv2.fontWeight.regular); + + @media (max-width: 30rem) { + /* Media query for mobile */ + font-size: theme(digitv2.fontSize.label.mobile); + } + + @media (min-width: 30.063rem) and (max-width: 47.938rem) { + /* Media query for tablets */ + font-size: theme(digitv2.fontSize.label.tablet); + } + + @media (min-width: 48rem) { + /* Media query for desktop */ + font-size: theme(digitv2.fontSize.label.desktop); + } + } + + &.link { + font-family: theme(digitv2.fontFamily.sans); + font-style: theme(digitv2.fontStyle.normal); + font-weight: theme(digitv2.fontWeight.regular); + text-decoration: theme(digitv2.textDecorationLine.underline); + font-size: theme(digitv2.fontSize.link.desktop); + } + + &.button { + font-family: theme(digitv2.fontFamily.sans); + font-style: theme(digitv2.fontStyle.normal); + font-weight: theme(digitv2.fontWeight.medium); + font-size: theme(digitv2.fontSize.button.desktop); + } +} diff --git a/health/micro-ui/web/micro-ui-internals/packages/css/tailwind.config.js b/health/micro-ui/web/micro-ui-internals/packages/css/tailwind.config.js new file mode 100644 index 00000000000..c9b2a06dedf --- /dev/null +++ b/health/micro-ui/web/micro-ui-internals/packages/css/tailwind.config.js @@ -0,0 +1,233 @@ +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: "#C84C0E", + "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", + "text-primary": "#363636", + "error-v2": "#D4351C", + }, + alert: { + error: "#b91900", + "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: [], +}; diff --git a/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/README.md b/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/README.md new file mode 100644 index 00000000000..0d206b3021e --- /dev/null +++ b/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/README.md @@ -0,0 +1,159 @@ +# digit-ui-module-workbench + +## Install + +```bash +npm install --save digit-ui-module-workbench +``` + +## Limitation + +```bash +This Package is more specific to DIGIT-UI's can be used across mission's +``` + +## Usage + +After adding the dependency make sure you have this dependency in + +```bash +frontend/micro-ui/web/package.json +``` + +```json +"@egovernments/digit-ui-module-workbench":"1.0.0", +``` + +then navigate to App.js + +```bash + frontend/micro-ui/web/src/App.js +``` + +```jsx +/** add this import **/ + +import { initWorkbenchComponents } from "@egovernments/digit-ui-module-workbench"; + +/** inside enabledModules add this new module key **/ + +const enabledModules = ["workbench"]; + +/** inside init Function call this function **/ + +const initDigitUI = () => { + initWorkbenchComponents(); +}; + +``` + +In MDMS + +_Add this configuration to enable this module [MDMS Enabling Workbench Module](https://github.com/egovernments/works-mdms-data/blob/588d241ba3a9ab30f4d4c2c387a513da811620ca/data/pg/tenant/citymodule.json#L227)_ + +## List of Screens available in this versions were as follows + +1 . Search Master Data + > -Provides a screen based on Schema and renders the search result if data is present + > -It also provides a dynamic filter based on which data can be filtered + + +2 . Add Master Data based on selected schema + > -Provides a screen to add new master data according to the schema + > -Provides a Dropdown if it has any referenced master + +3 . Update Master data for selected data. + > -View the master data from search screen + > -Disable/Enable the master data if required + > -Update the master data value except the unique-identifier field mentioned in the schema + + + +4 . Localisation screens + > -Provides a screen to search the localisation present in the environment + > -Add new localisation + > -Update existing localisation + > -Bulk Upload of Localisation data + +5 . MDMS UI Schema + +6 . Data push for any API based on schema + +### Mandatory changes to use Workbench module + +1 . Assuming core module is already updated with 1.5.38+ and related changes were taken + +2 . add the following hook method in micro-ui-internals/packages/libraries/src/hooks/useCustomAPIMutationHook.js + +reference:: +https://github.com/egovernments/DIGIT-Dev/blob/6e711bdc005c226c7debd533209681fc77078a3e/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/hooks/useCustomAPIMutationHook.js + +3 . add the following utility method in micro-ui-internals/packages/libraries/src/utils/index.js +```jsx +didEmployeeHasAtleastOneRole + +const didEmployeeHasAtleastOneRole = (roles = []) => { + return roles.some((role) => didEmployeeHasRole(role)); +}; + +``` + +4 . stylesheet link has to be added +```jsx + +``` +Reference commit for the enabling workbench +https://github.com/egovernments/DIGIT-OSS/pull/99/commits/6e711bdc005c226c7debd533209681fc77078a3e + + + +### Changelog + +```bash +1.0.1-beta.1 Republished after merging with Master due to version issues. +1.0.0-beta.14 Added info message in localisation search +1.0.0-beta.13 Added new role to support hcm localisation create +1.0.0-beta.13 Added customisable label for custom dropdown through workbench ui schema +1.0.0-beta.11 Added customisable label for custom dropdown through workbench ui schema +1.0.0-beta.10 fixed the dropdown undefined issue +1.0.0-beta.9 Added new role to support hcm manage masters +1.0.0-beta.8 minor fixes +1.0.0-beta.7 Added Bulk Upload Ui for MDMS Add +1.0.0-beta.6 Added Bulk Upload Ui for MDMS Add +1.0.0-beta.5 Fixed some loading issue +1.0.0-beta.2 custom api support added +1.0.0-beta.1 republished due to some version issues +1.0.1 Fixes related to the limits +1.0.0 Workbench v1.0 release +1.0.0-beta workbench base version beta release +0.0.3 readme updated +0.0.2 readme updated +0.0.1 base version +``` + +### Contributors + +- [jagankumar-egov](https://github.com/jagankumar-egov) +- [nipun-egov](https://github.com/nipun-egov) + + +## License + +[MIT](https://choosealicense.com/licenses/mit/) + +## Documentation + +Documentation Site (https://core.digit.org/guides/developer-guide/ui-developer-guide/digit-ui) +Workbench Documentation(https://workbench.digit.org/platform/functional-specifications/workbench-ui) + +## Maintainer + +- [jagankumar-egov](https://www.github.com/jagankumar-egov) + + +### Published from DIGIT Frontend +DIGIT Frontend Repo (https://github.com/egovernments/Digit-Frontend/tree/master) + + +![Logo](https://s3.ap-south-1.amazonaws.com/works-dev-asset/mseva-white-logo.png) + diff --git a/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/package.json b/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/package.json new file mode 100644 index 00000000000..41e43fdb6fd --- /dev/null +++ b/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/package.json @@ -0,0 +1,51 @@ +{ + "name": "@egovernments/digit-ui-module-campaign-manager", + "version": "0.0.1", + "description": "Campaign", + "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.6", + "@egovernments/digit-ui-components": "0.0.2-beta.1", + "@rjsf/core": "5.10.0", + "@rjsf/utils": "5.10.0", + "@rjsf/validator-ajv8": "5.10.0", + "ajv": "8.12.0", + "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", + "react-select": "5.7.4", + "react-table": "7.7.0", + "xlsx": "0.17.5", + "react-drag-drop-files": "^2.3.10", + "@cyntler/react-doc-viewer": "1.10.3" + }, + "author": "JaganKumar ", + "license": "MIT", + "keywords": [ + "digit", + "egov", + "dpg", + "digit-ui", + "workbench", + "campaign", + "Campaign" + ] +} diff --git a/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/Module.js b/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/Module.js new file mode 100644 index 00000000000..cc2f33443d4 --- /dev/null +++ b/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/Module.js @@ -0,0 +1,141 @@ +import { Loader, TourProvider } from "@egovernments/digit-ui-react-components"; +import React from "react"; +import { useRouteMatch } from "react-router-dom"; +import EmployeeApp from "./pages/employee"; +import { CustomisedHooks } from "./hooks"; +import { UICustomizations } from "./configs/UICustomizations"; +import CampaignCard from "./components/CampaignCard"; +import CycleConfiguration from "./pages/employee/CycleConfiguration"; +import DeliverySetup from "./pages/employee/deliveryRule"; +import TimelineCampaign from "./components/TimelineCampaign"; +import CampaignDates from "./components/CampaignDates"; +import CampaignType from "./components/CampaignType"; +import CampaignName from "./components/CampaignName"; +import MyCampaign from "./pages/employee/MyCampaign"; +import CampaignSummary from "./components/CampaignSummary"; +import CycleDetaisPreview from "./components/CycleDetaisPreview"; +import Response from "./pages/employee/Response"; +import SelectingBoundaries from "./components/SelectingBoundaries"; +import UploadData from "./components/UploadData"; +import CampaignSelection from "./components/CampaignType"; +import CampaignDocumentsPreview from "./components/CampaignDocumentsPreview"; +import AddProduct from "./pages/employee/AddProduct"; +import AddProductField from "./components/AddProductField"; +import CycleDataPreview from "./components/CycleDataPreview"; +import { ErrorBoundary } from "@egovernments/digit-ui-components"; +import CampaignResourceDocuments from "./components/CampaignResourceDocuments"; + +/** + * The CampaignModule function fetches store data based on state code, module code, and language, and + * renders the EmployeeApp component within a TourProvider component if the data is not loading. + * @returns The CampaignModule component returns either a Loader component if data is still loading, or + * a TourProvider component wrapping an EmployeeApp component with specific props passed to it. + */ +const CampaignModule = ({ stateCode, userType, tenants }) => { + const tenantId = Digit.ULBService.getCurrentTenantId(); + const { data: BOUNDARY_HIERARCHY_TYPE } = Digit.Hooks.useCustomMDMS(tenantId, "HCM-ADMIN-CONSOLE", [{ name: "hierarchyConfig" }], { + select: (data) => { + return data?.["HCM-ADMIN-CONSOLE"]?.hierarchyConfig?.[0]?.hierarchy; + }, + }); + + const moduleCode = ["campaignmanager", "workbench", "mdms", "schema", "hcm-admin-schemas", `boundary-${BOUNDARY_HIERARCHY_TYPE}`]; + const { path, url } = useRouteMatch(); + const language = Digit.StoreData.getCurrentLanguage(); + const { isLoading, data: store } = Digit.Services.useStore({ + stateCode, + moduleCode, + language, + }); + + if (isLoading) { + return ; + } + + return ( + + + + + + ); +}; + +const componentsToRegister = { + CampaignModule: CampaignModule, + CampaignCard: CampaignCard, + UploadData, + DeliveryRule: DeliverySetup, + CycleConfiguration: CycleConfiguration, + TimelineCampaign, + CampaignDates, + CampaignType, + CampaignName, + MyCampaign, + CampaignSummary, + CycleDetaisPreview, + Response, + SelectingBoundaries, + CampaignSelection, + CampaignDocumentsPreview: CampaignDocumentsPreview, + AddProduct, + AddProductField, + CycleDataPreview, + CampaignResourceDocuments, +}; + +const overrideHooks = () => { + Object.keys(CustomisedHooks).map((ele) => { + if (ele === "Hooks") { + Object.keys(CustomisedHooks[ele]).map((hook) => { + Object.keys(CustomisedHooks[ele][hook]).map((method) => { + setupHooks(hook, method, CustomisedHooks[ele][hook][method]); + }); + }); + } else if (ele === "Utils") { + Object.keys(CustomisedHooks[ele]).map((hook) => { + Object.keys(CustomisedHooks[ele][hook]).map((method) => { + setupHooks(hook, method, CustomisedHooks[ele][hook][method], false); + }); + }); + } else { + Object.keys(CustomisedHooks[ele]).map((method) => { + setupLibraries(ele, method, CustomisedHooks[ele][method]); + }); + } + }); +}; + +/* To Overide any existing hook we need to use similar method */ +const setupHooks = (HookName, HookFunction, method, isHook = true) => { + window.Digit = window.Digit || {}; + window.Digit[isHook ? "Hooks" : "Utils"] = window.Digit[isHook ? "Hooks" : "Utils"] || {}; + window.Digit[isHook ? "Hooks" : "Utils"][HookName] = window.Digit[isHook ? "Hooks" : "Utils"][HookName] || {}; + window.Digit[isHook ? "Hooks" : "Utils"][HookName][HookFunction] = method; +}; +/* To Overide any existing libraries we need to use similar method */ +const setupLibraries = (Library, service, method) => { + window.Digit = window.Digit || {}; + window.Digit[Library] = window.Digit[Library] || {}; + window.Digit[Library][service] = method; +}; + +/* To Overide any existing config/middlewares we need to use similar method */ +const updateCustomConfigs = () => { + setupLibraries("Customizations", "commonUiConfig", { ...window?.Digit?.Customizations?.commonUiConfig, ...UICustomizations }); + // setupLibraries("Utils", "parsingUtils", { ...window?.Digit?.Utils?.parsingUtils, ...parsingUtils }); +}; + +/** + * The `initCampaignComponents` function initializes campaign components by overriding hooks, updating + * custom configurations, and registering components. + */ +const initCampaignComponents = () => { + overrideHooks(); + updateCustomConfigs(); + Object.entries(componentsToRegister).forEach(([key, value]) => { + Digit.ComponentRegistryService.setComponent(key, value); + }); +}; + +export { initCampaignComponents }; diff --git a/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/AddProductField.js b/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/AddProductField.js new file mode 100644 index 00000000000..94a73fd6b24 --- /dev/null +++ b/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/AddProductField.js @@ -0,0 +1,144 @@ +import React, { useState, useEffect } from "react"; +import { AddIcon, Button, Card, CardText, Header, TextInput, Dropdown } from "@egovernments/digit-ui-react-components"; +import { useTranslation } from "react-i18next"; +import { LabelFieldPair } from "@egovernments/digit-ui-react-components"; +import { DustbinIcon } from "./icons/DustbinIcon"; +// import { productType } from "../configs/productType"; +import { PRIMARY_COLOR } from "../utils"; + +const AddProductField = ({ onSelect }) => { + const { t } = useTranslation(); + const tenantId = Digit.ULBService.getCurrentTenantId(); + const { isLoading: productTypeLoading, data: productType } = Digit.Hooks.useCustomMDMS(tenantId, "HCM-ADMIN-CONSOLE", [{ name: "productType" }], { + select: (data) => { + return data?.["HCM-ADMIN-CONSOLE"]?.productType; + }, + }); + const [productFieldData, setProductFieldData] = useState([{ key: 1, name: null, type: null, variant: null }]); + + useEffect(() => { + onSelect("addProduct", productFieldData); + }, [productFieldData]); + + const addMoreField = () => { + setProductFieldData((prev) => [ + ...prev, + { + key: prev.length + 1, + name: null, + type: null, + variant: null, + }, + ]); + }; + + const deleteProductField = (index) => { + setProductFieldData((prev) => { + const temp = prev.filter((i) => i.key !== index); + return temp.map((i, n) => ({ ...i, key: n + 1 })); + }); + }; + + const handleUpdateField = (data, target, index) => { + setProductFieldData((prev) => { + return prev.map((i) => { + if (i.key === index) { + return { + ...i, + [target]: data, + }; + } + return { + ...i, + }; + }); + }); + }; + + return ( + +
{t(`HCM_CAMPAIGN_ADD_NEW_PRODUCT_HEADER`)}
+

+ {t(`HCM_CAMPAIGN_ADD_NEW_PRODUCT_DESCRIPTION_PRE_TEXT`)} {t(`HCM_CAMPAIGN_ADD_NEW_PRODUCT_DESCRIPTION_BOLD_TEXT`)} + {t(`HCM_CAMPAIGN_ADD_NEW_PRODUCT_DESCRIPTION_POST_TEXT`)} +

+ {productFieldData?.map((field, index) => { + return ( + +
+ Product {field?.key} + {productFieldData?.length > 1 && ( +
deleteProductField(field.key)} + style={{ + cursor: "pointer", + fontWeight: "600", + marginLeft: "1rem", + fontSize: "1rem", + color: PRIMARY_COLOR, + display: "flex", + gap: "0.5rem", + alignItems: "center", + marginTop: "1rem", + }} + > + + {t(`CAMPAIGN_DELETE_ROW_TEXT`)} +
+ )} +
+ +
+ {`${t("HCM_PRODUCT_NAME")}`} + * +
+ handleUpdateField(event.target.value, "name", field.key)} + /> +
+ +
+ {`${t("HCM_PRODUCT_TYPE")}`} + * +
+ { + handleUpdateField(value, "type", field.key); + }} + /> +
+ +
+ {`${t("HCM_PRODUCT_VARIANT")}`} + * +
+ handleUpdateField(event.target.value, "variant", field?.key)} + /> +
+
+ ); + })} + + ))} + + ); +}; + +const CycleDataPreview = ({ data, items, index, errors, onErrorClick, cardErrors }) => { + const { t } = useTranslation(); + const [deliveryData, setDeliveryData] = useState(data?.deliveries); + const [activeTab, setActiveTab] = useState(1); + + useEffect(() => { + setDeliveryData(data?.deliveries); + }, [data?.deliveries]); + + const handleTabChange = (tabIndex, index) => { + setDeliveryData((prev) => { + return prev.map((i) => { + if (i.deliveryIndex == tabIndex) { + return { + ...i, + active: true, + }; + } else { + return { + ...i, + active: false, + }; + } + }); + }); + }; + // return null; + return ( + <> + {cardErrors?.map((i) => ( + ]} + /> + ))} + {/* {i.error ? i.error : i.message)} */} +
+ {data?.startDate && ( + + )} + {data?.endDate && ( + + )} +
+ +
+ + + + {deliveryData + .find((i) => i.active === true) + ?.deliveryRules?.map((rules, ruleIndex) => { + return ( + + {rules?.attributes?.length > 0 && ( + + )} + {rules?.products?.length > 0 && ( + + )} + + ); + })} + + {/* + {item?.conditions?.length > 0 && ( + + )} + {item?.products?.length > 0 && ( + + )} + */} + + ); +}; + +export default CycleDataPreview; diff --git a/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CycleDetaisPreview.js b/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CycleDetaisPreview.js new file mode 100644 index 00000000000..515b25191d9 --- /dev/null +++ b/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CycleDetaisPreview.js @@ -0,0 +1,143 @@ +import { Card, LabelFieldPair, Row } from "@egovernments/digit-ui-react-components"; +import React, { Fragment } from "react"; +import { useTranslation } from "react-i18next"; +import DetailsTable from "./DetailsTable"; + +function mergeObjects(item) { + const arr = item?.conditions; + const mergedArr = []; + const mergedAttributes = new Set(); + + arr.forEach((obj) => { + if (!mergedAttributes.has(obj.attribute)) { + const sameAttrObjs = arr.filter((o) => o.attribute === obj.attribute); + + if (sameAttrObjs.length > 1) { + const fromValue = Math.min(...sameAttrObjs.map((o) => o.value)); + const toValue = Math.max(...sameAttrObjs.map((o) => o.value)); + + mergedArr.push({ + fromValue, + toValue, + value: fromValue > 0 && toValue > 0 ? `${fromValue} to ${toValue}` : null, + operator: "IN_BETWEEN", + attribute: obj.attribute, + }); + + mergedAttributes.add(obj.attribute); + } else { + mergedArr.push(obj); + } + } + }); + + return { ...item, conditions: mergedArr }; +} + +const CycleDetaisPreview = ({ data, items, index }) => { + const { t } = useTranslation(); + const item = mergeObjects(items); + + return ( + <> + + + {/* + {`${t("CYCLE_NUMBER")}`} + {item?.cycleNumber} + + + {`${t("DELIVERY_NUMBER")}`} + {item?.deliveryNumber} + */} + {item?.startDate || item?.endDate ? ( + +
+

+ {t(`CYCLE`)} {item?.cycleNumber} +

+
+ {item?.startDate && ( + + )} + {item?.endDate && ( + + )} +
+ ) : null} + + + {item?.conditions?.length > 0 && ( + + )} + {item?.products?.length > 0 && ( + + )} + + + ); +}; + +export default CycleDetaisPreview; diff --git a/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/DetailsTable.js b/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/DetailsTable.js new file mode 100644 index 00000000000..5c6e01fcc22 --- /dev/null +++ b/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/DetailsTable.js @@ -0,0 +1,76 @@ +import React, { Fragment } from "react"; +import { useTable } from "react-table"; +import { useTranslation } from "react-i18next"; +import { CardLabel, CardSubHeader } from "@egovernments/digit-ui-react-components"; + +const DetailsTable = ({ className = "", columnsData, rowsData, summaryRows, cardHeader }) => { + const { t } = useTranslation(); + + const columns = React.useMemo(() => columnsData, [t]); + + const data = React.useMemo(() => { + const temp = rowsData.map((i) => ({ + ...i, + operator: t(i?.operator), + attribute: i?.attribute ? t(`CAMPAIGN_ATTRIBUTE_${i?.attribute?.toUpperCase()}`) : "", + })); + return temp; + }, [rowsData]); + + const { getTableProps, getTableBodyProps, headerGroups, rows, prepareRow } = useTable({ + columns, + data, + }); + + return ( + <> + {cardHeader && ( + + {cardHeader?.value} + + )} +
+ + + {headerGroups.map((headerGroup) => ( + + {headerGroup.headers.map((column) => ( + + ))} + + ))} + + + + {rows.map((row) => { + prepareRow(row); + return ( + + {row.cells.map((cell) => ( + + ))} + + ); + })} + + {summaryRows && ( + + {summaryRows.map((cell, index) => ( + + ))} + + )} + +
+ {column.render("Header")} +
+ {cell.render("Cell")} +
+ {index === 4 ? {cell} : cell} +
+
+ + ); +}; + +export default DetailsTable; diff --git a/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/DocumentIcon.js b/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/DocumentIcon.js new file mode 100644 index 00000000000..9b61bf67136 --- /dev/null +++ b/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/DocumentIcon.js @@ -0,0 +1,29 @@ +import React from "react"; +export const DocumentIcon = ({ styles = {}, className, fill = "#D4351C" }) => ( + + + + + + + + + + + + + + + + + + + + +); diff --git a/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/PlusMinusInput.js b/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/PlusMinusInput.js new file mode 100644 index 00000000000..89d7b574032 --- /dev/null +++ b/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/PlusMinusInput.js @@ -0,0 +1,47 @@ +import React, { useState } from "react"; + +const PlusMinusInput = (props, customProps) => { + let count = props?.defaultValues || 1; + + function incrementCount() { + if (count >= 1) { + count = count + 1; + props.onSelect(count); + } else { + count = 1; + props.onSelect(count); + } + } + function decrementCount() { + if (count > 1) { + count = count - 1; + props.onSelect(count); + } else { + count = 1; + props.onSelect(count); + } + } + + return ( + +
+ + + +
+
+ ); +}; + +export default PlusMinusInput; diff --git a/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/RemovableTagNew.js b/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/RemovableTagNew.js new file mode 100644 index 00000000000..b04159181a6 --- /dev/null +++ b/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/RemovableTagNew.js @@ -0,0 +1,16 @@ +import React from "react"; +import { Close } from "@egovernments/digit-ui-react-components"; + +const RemoveableTagNew = ({ text = {}, onClick, extraStyles, disabled = false }) => ( +
+ {text?.label && {`${text?.label} :`}} + + {text?.value} + + + + +
+); + +export default RemoveableTagNew; diff --git a/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundaries.js b/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundaries.js new file mode 100644 index 00000000000..239cf948ee0 --- /dev/null +++ b/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundaries.js @@ -0,0 +1,542 @@ +import React, { useEffect, useState, Fragment, useMemo } from "react"; +import { CardText, LabelFieldPair, Card, Header, CardLabel, LoaderWithGap } from "@egovernments/digit-ui-react-components"; +import { useTranslation } from "react-i18next"; +import { InfoCard, MultiSelectDropdown, PopUp, Button, Toast } from "@egovernments/digit-ui-components"; +import { mailConfig } from "../configs/mailConfig"; +/** + * The function `SelectingBoundaries` in JavaScript handles the selection of boundaries based on + * hierarchy data and allows users to choose specific boundaries within the hierarchy. + * @returns The `SelectingBoundaries` component is being returned. It consists of JSX elements + * including Cards, Headers, Dropdowns, MultiSelectDropdowns, and InfoCard. The component allows users + * to select hierarchy types and boundaries based on the data fetched from API calls. It also handles + * the selection of boundaries and updates the state accordingly. The component is designed to be + * interactive and user-friendly for selecting boundaries within + */ +function SelectingBoundaries({ onSelect, formData, ...props }) { + const { t } = useTranslation(); + const tenantId = Digit.ULBService.getCurrentTenantId(); + const [params, setParams] = useState(props?.props?.dataParams); + const [hierarchy, setHierarchy] = useState(params?.hierarchyType); + const [boundaryType, setBoundaryType] = useState( + props?.props?.sessionData?.HCM_CAMPAIGN_SELECTING_BOUNDARY_DATA?.boundaryType?.boundaryData ? undefined : null + ); + const [targetedData, setTargetedData] = useState(); + const [boundaryData, setBoundaryData] = useState(props?.props?.sessionData?.HCM_CAMPAIGN_SELECTING_BOUNDARY_DATA?.boundaryType?.boundaryData || {}); + // const [parentArray, setParentArray] = useState(props?.props?.sessionData?.HCM_CAMPAIGN_SELECTING_BOUNDARY_DATA?.boundaryType?.selectedData.filter(item => item.includeAllChildren).map(item => item.code) || null); + const [parentArray, setParentArray] = useState(null); + const [boundaryTypeDataresult, setBoundaryTypeDataresult] = useState(null); + const [selectedData, setSelectedData] = useState(props?.props?.sessionData?.HCM_CAMPAIGN_SELECTING_BOUNDARY_DATA?.boundaryType?.selectedData || []); + const [parentBoundaryTypeRoot, setParentBoundaryTypeRoot] = useState( + (props?.props?.sessionData?.HCM_CAMPAIGN_SELECTING_BOUNDARY_DATA?.boundaryType?.selectedData?.find((item) => item?.isRoot === true) || {}) + ?.boundaryType || null + ); + const [showToast, setShowToast] = useState(null); + const [updatedHierarchy, setUpdatedHierarchy] = useState({}); + const [hierarchyTypeDataresult, setHierarchyTypeDataresult] = useState(params?.hierarchy); + const [executionCount, setExecutionCount] = useState(0); + // State variable to store the lowest hierarchy level + // const [lowestHierarchy, setLowestHierarchy] = useState(null); + const [showPopUp, setShowPopUp] = useState(null); + const [restrictSelection, setRestrictSelection] = useState(null); + const [updateBoundary, setUpdateBoundary] = useState(null); + const [loaderEnabled, setLoaderEnabled] = useState(false); + const { isLoading, data: hierarchyConfig } = Digit.Hooks.useCustomMDMS(tenantId, "HCM-ADMIN-CONSOLE", [{ name: "hierarchyConfig" }]); + + // const lowestHierarchy = hierarchyConfig?.["HCM-ADMIN-CONSOLE"]?.hierarchyConfig?.[0]?.lowestHierarchy; + const lowestHierarchy = useMemo(() => hierarchyConfig?.["HCM-ADMIN-CONSOLE"]?.hierarchyConfig?.[0]?.lowestHierarchy, [hierarchyConfig]); + const lowestChild = hierarchyTypeDataresult?.boundaryHierarchy.filter((item) => item.parentBoundaryType === lowestHierarchy)?.[0]?.boundaryType; + const searchParams = new URLSearchParams(location.search); + const isDraft = searchParams.get("draft"); + + useEffect(() => { + if (!updateBoundary) { + if ( + props?.props?.sessionData?.HCM_CAMPAIGN_UPLOAD_BOUNDARY_DATA?.uploadBoundary?.uploadedFile?.length > 0 || + props?.props?.sessionData?.HCM_CAMPAIGN_UPLOAD_FACILITY_DATA?.uploadFacility?.uploadedFile?.length > 0 || + props?.props?.sessionData?.HCM_CAMPAIGN_UPLOAD_USER_DATA?.uploadUser?.uploadedFile?.length > 0 + ) { + setRestrictSelection(true); + } + } + }, [props?.props?.sessionData, updateBoundary]); + + useEffect(() => { + if (props?.props?.dataParams) { + setParams(props?.props?.dataParams); + } + }, [props?.props?.dataParams]); + + useEffect(() => { + onSelect("boundaryType", { boundaryData: boundaryData, selectedData: selectedData, updateBoundary: updateBoundary }); + }, [boundaryData, selectedData]); + + useEffect(() => { + setHierarchy(params?.hierarchyType); + }, [params?.hierarchyType]); + + useEffect(() => { + if (params?.hierarchy) { + const sortHierarchy = (hierarchy) => { + const boundaryMap = new Map(); + hierarchy.forEach(item => { + boundaryMap.set(item.boundaryType, item); + }); + + const sortedHierarchy = []; + let currentType = null; + + while (sortedHierarchy.length < hierarchy.length) { + for (let i = 0; i < hierarchy.length; i++) { + if (hierarchy[i].parentBoundaryType === currentType) { + sortedHierarchy.push(hierarchy[i]); + currentType = hierarchy[i].boundaryType; + break; + } + } + } + + return sortedHierarchy; + }; + + const sortedHierarchy = sortHierarchy(params.hierarchy.boundaryHierarchy); + setHierarchyTypeDataresult({ + ...params.hierarchy, + boundaryHierarchy: sortedHierarchy + }); + } + }, [params?.hierarchy]); + + useEffect(() => { + if (executionCount < 5) { + onSelect("boundaryType", { boundaryData: boundaryData, selectedData: selectedData, updateBoundary: updateBoundary }); + setExecutionCount((prevCount) => prevCount + 1); + } + }); + + useEffect(() => { + setBoundaryData( + props?.props?.sessionData?.HCM_CAMPAIGN_SELECTING_BOUNDARY_DATA?.boundaryType?.boundaryData + ? props?.props?.sessionData?.HCM_CAMPAIGN_SELECTING_BOUNDARY_DATA?.boundaryType?.boundaryData + : {} + ); + setSelectedData( + props?.props?.sessionData?.HCM_CAMPAIGN_SELECTING_BOUNDARY_DATA?.boundaryType?.selectedData + ? props?.props?.sessionData?.HCM_CAMPAIGN_SELECTING_BOUNDARY_DATA?.boundaryType?.selectedData + : [] + ); + }, [props?.props?.sessionData?.HCM_CAMPAIGN_SELECTING_BOUNDARY_DATA?.boundaryType]); + + const closeToast = () => { + setShowToast(null); + }; + + useEffect(() => { + if (hierarchyTypeDataresult) { + const boundaryDataObj = {}; + hierarchyTypeDataresult?.boundaryHierarchy?.forEach((boundary) => { + boundaryDataObj[boundary?.boundaryType] = []; + }); + if (!props?.props?.sessionData?.HCM_CAMPAIGN_SELECTING_BOUNDARY_DATA?.boundaryType?.boundaryData || Object.keys(boundaryData).length === 0) { + setBoundaryData(boundaryDataObj); + } + const boundaryWithTypeNullParent = hierarchyTypeDataresult?.boundaryHierarchy?.find((boundary) => boundary?.parentBoundaryType === null); + // Set the boundary type with null parentBoundaryType + if (boundaryWithTypeNullParent) { + if (!props?.props?.sessionData?.HCM_CAMPAIGN_SELECTING_BOUNDARY_DATA?.boundaryType?.boundaryData || Object.keys(boundaryData).length === 0) { + setBoundaryType(boundaryWithTypeNullParent?.boundaryType); + } + setParentBoundaryTypeRoot(boundaryWithTypeNullParent?.boundaryType); + } + createHierarchyStructure(hierarchyTypeDataresult); + } + }, [hierarchyTypeDataresult]); + + function createHierarchyStructure(hierarchyTypeDataresult) { + const hierarchyStructure = {}; + + // Recursive function to gather all descendants for a given boundary type + function gatherDescendants(boundaryType) { + const descendants = []; + hierarchyTypeDataresult; + + // Find all children for the current boundary type + const children = hierarchyTypeDataresult?.boundaryHierarchy?.filter((item) => item?.parentBoundaryType === boundaryType); + + // Recursively gather descendants for each child + children.forEach((child) => { + const childBoundaryType = child?.boundaryType; + const childDescendants = gatherDescendants(childBoundaryType); + descendants.push(childBoundaryType, ...childDescendants); + }); + + return descendants; + } + + // Iterate through the boundaryHierarchy array to populate hierarchyStructure + hierarchyTypeDataresult?.boundaryHierarchy?.forEach((item) => { + const boundaryType = item?.boundaryType; + const descendants = gatherDescendants(boundaryType); + + hierarchyStructure[boundaryType] = descendants; + }); + + setUpdatedHierarchy(hierarchyStructure); + } + + const newData = []; + const fetchBoundaryTypeData = async () => { + if (boundaryType === undefined || boundaryType === lowestChild) { + // Do nothing if boundaryType is undefined + return; + } + if (parentArray === null) { + const reqCriteriaBoundaryTypeSearch = Digit.CustomService.getResponse({ + url: "/boundary-service/boundary-relationships/_search", + params: { + tenantId: tenantId, + hierarchyType: hierarchy, + boundaryType: boundaryType, + parent: null, + }, + body: {}, + }); + // setShowToast({ key: "info", label: t("HCM_PLEASE_WAIT_LOADING_BOUNDARY") }); + const boundaryTypeData = await reqCriteriaBoundaryTypeSearch; + setBoundaryTypeDataresult([{ parentCode: null, boundaryTypeData: boundaryTypeData }]); + // closeToast(); + } else { + // for (const parentCode of parentArray) { + // const reqCriteriaBoundaryTypeSearch = Digit.CustomService.getResponse({ + // url: "/boundary-service/boundary-relationships/_search", + // params: { + // tenantId: tenantId, + // hierarchyType: hierarchy, + // boundaryType: boundaryType, + // parent: parentCode, + // }, + // body: {}, + // }); + // // setShowToast({ key: "info", label: t("HCM_PLEASE_WAIT_LOADING_BOUNDARY") }); + // setLoaderEnabled(true); + // const boundaryTypeData = await reqCriteriaBoundaryTypeSearch; + // newData.push({ parentCode, boundaryTypeData }); + // } + setLoaderEnabled(true); + const temp = await Digit.Hooks.campaign.useParallelSearch({ + parentArray: parentArray, + tenantId: tenantId, + boundaryType: boundaryType, + hierarchy: hierarchy, + targetedData: targetedData, + }); + const newDataArray = [...newData, ...temp]; + setBoundaryTypeDataresult(newDataArray); + setTimeout(() => { + setLoaderEnabled(false); + }, 100); + // closeToast(); + } + }; + + useEffect(() => { + fetchBoundaryTypeData(); + }, [boundaryType, parentArray, selectedData]); + + useEffect(() => { + if (boundaryTypeDataresult) { + if (boundaryType !== undefined) { + const updatedBoundaryData = { + ...boundaryData, + [boundaryType]: boundaryTypeDataresult, + }; + setBoundaryData(updatedBoundaryData); + } else { + const updatedBoundaryData = { + ...boundaryData, + [boundaryTypeDataresult?.[0]?.boundaryTypeData?.TenantBoundary?.[0]?.boundary?.[0]?.boundaryType]: boundaryTypeDataresult, + }; + setBoundaryData(updatedBoundaryData); + } + } + }, [boundaryTypeDataresult]); + + const checkDataPresent = ({ action }) => { + if (action === false) { + setShowPopUp(false); + setUpdateBoundary(true); + setRestrictSelection(false); + return; + } + if (action === true) { + setShowPopUp(false); + setUpdateBoundary(false); + return; + } + }; + + const handleBoundaryChange = (data, boundary) => { + setTargetedData(boundary?.boundaryType); + if ( + !updateBoundary && + restrictSelection && + (props?.props?.sessionData?.HCM_CAMPAIGN_UPLOAD_BOUNDARY_DATA?.uploadBoundary?.uploadedFile?.length > 0 || + props?.props?.sessionData?.HCM_CAMPAIGN_UPLOAD_FACILITY_DATA?.uploadFacility?.uploadedFile?.length > 0 || + props?.props?.sessionData?.HCM_CAMPAIGN_UPLOAD_USER_DATA?.uploadUser?.uploadedFile?.length > 0) + ) { + setShowPopUp(true); + return; + } + if (!data || data.length === 0) { + const check = updatedHierarchy[boundary?.boundaryType]; + + if (check) { + const typesToRemove = [boundary?.boundaryType, ...check]; + const updatedSelectedData = selectedData?.filter((item) => !typesToRemove?.includes(item?.type)); + const updatedBoundaryData = { ...boundaryData }; + + typesToRemove.forEach((type) => { + if (type !== boundary?.boundaryType && updatedBoundaryData?.hasOwnProperty(type)) { + updatedBoundaryData[type] = []; + } + }); + if (!_.isEqual(selectedData, updatedSelectedData)) { + setSelectedData(updatedSelectedData); + } + setBoundaryData(updatedBoundaryData); + } + return; + } + + let res = []; + data && + data?.map((ob) => { + res.push(ob?.[1]); + }); + + // const transformedRes = res?.map((item) => ({ + // code: item.code, + // type: item.type || item.boundaryType, + // isRoot: item.boundaryType === parentBoundaryTypeRoot, + // includeAllChildren: item.type === lowestHierarchy || item.boundaryType === lowestHierarchy, + // parent: item?.parent, + // })); + + let transformedRes = []; + if (!isDraft) { + transformedRes = res?.map((item) => ({ + code: item.code, + type: item.type || item.boundaryType, + isRoot: item.boundaryType === parentBoundaryTypeRoot, + includeAllChildren: item.type === lowestHierarchy || item.boundaryType === lowestHierarchy, + parent: item?.parent, + })); + } else { + // transformedRes = selectedData.filter((item) => item?.type === boundary?.boundaryType) + const filteredData = selectedData.filter((item) => item?.type === boundary?.boundaryType); + if (filteredData.length === 0) { + // If no selected data for the particular boundary type, run the transformation logic + transformedRes = res?.map((item) => ({ + code: item.code, + type: item.type || item.boundaryType, + isRoot: item.boundaryType === parentBoundaryTypeRoot, + includeAllChildren: item.type === lowestHierarchy || item.boundaryType === lowestHierarchy, + parent: item?.parent, + })); + } else { + transformedRes = filteredData; + } + } + + const newBoundaryType = transformedRes?.[0]?.type; + const existingBoundaryType = selectedData?.length > 0 ? selectedData?.[0]?.type : null; + if (existingBoundaryType === newBoundaryType) { + // Update only the data for the specific boundaryType + const flattenedRes = transformedRes.flat(); + const updatedSelectedData = selectedData + ?.map((item) => { + if (item.type === newBoundaryType) { + return transformedRes?.flat(); + } else { + return item; + } + }) + .flat(); + if (!_.isEqual(selectedData, updatedSelectedData)) { + setSelectedData(updatedSelectedData); + } + } else { + // Update only the data for the new boundaryType + const mergedData = [...selectedData?.filter((item) => item?.type !== newBoundaryType), ...transformedRes]; + + // Filter out items with undefined type + const filteredData = mergedData?.filter( + (item, index, self) => item?.type !== undefined && index === self?.findIndex((t) => t?.code === item?.code) + ); + + // Filter out items whose parent is not present in the array + + const updatedSelectedData = []; + const addChildren = (item) => { + updatedSelectedData.push(item); + const children = filteredData.filter((child) => child.parent === item.code); + children.forEach((child) => addChildren(child)); + }; + filteredData.filter((item) => item.isRoot).forEach((rootItem) => addChildren(rootItem)); + if (!_.isEqual(selectedData, updatedSelectedData)) { + setSelectedData(updatedSelectedData); + } + } + const parentBoundaryEntry = hierarchyTypeDataresult + ? hierarchyTypeDataresult?.boundaryHierarchy?.find( + (e) => e?.parentBoundaryType === res?.[0]?.boundaryType || e?.parentBoundaryType === res?.[0]?.type + ) + : null; + setBoundaryType(parentBoundaryEntry?.boundaryType); + const codes = res?.map((item) => item?.code); + if (JSON.stringify(codes) !== JSON.stringify(parentArray)) { + setParentArray(codes); + } + }; + + return ( + <> + {loaderEnabled && } + +
+
{t(`CAMPAIGN_SELECT_BOUNDARY`)}
+ {t(`CAMPAIGN_SELECT_BOUNDARIES_DESCRIPTION`)} + {hierarchyTypeDataresult?.boundaryHierarchy + .filter((boundary, index, array) => { + // Find the index of the lowest hierarchy + const lowestIndex = array.findIndex((b) => b.boundaryType === lowestHierarchy); + // Include only those boundaries that are above or equal to the lowest hierarchy + return index <= lowestIndex; + }) + .map((boundary, index) => + boundary?.parentBoundaryType == null ? ( + + + {/* {t(`${hierarchy}_${boundary?.boundaryType}`?.toUpperCase())} */} + {t((hierarchy + "_" + boundary?.boundaryType).toUpperCase())} + + * + +
+ item?.boundaryTypeData?.TenantBoundary?.[0]?.boundary)?.flat() || [] + } + optionsKey={"code"} + selected={selectedData?.filter((item) => item?.type === boundary?.boundaryType) || []} + onSelect={(value) => { + handleBoundaryChange(value, boundary); + }} + /> +
+
+ ) : ( + + + {t((hierarchy + "_" + boundary?.boundaryType).toUpperCase())} + * + +
+ ({ + code: item?.parentCode, + options: + item?.boundaryTypeData?.TenantBoundary?.[0]?.boundary?.map((child) => ({ + code: child?.code, + type: child?.boundaryType, + parent: item?.parentCode, + })) || [], + })) || [] + } + optionsKey={"code"} + onSelect={(value) => { + handleBoundaryChange(value, boundary); + }} + selected={selectedData?.filter((item) => item?.type === boundary?.boundaryType) || []} + addCategorySelectAllCheck={true} + addSelectAllCheck={true} + variant="nestedmultiselect" + /> +
+
+ ) + )} +
+
+ + {t("HCM_BOUNDARY_INFO ")} + + {mailConfig?.mailId} + + , + ]} + label={"Info"} + /> + {showPopUp && ( + + {t("ES_CAMPAIGN_UPDATE_BOUNDARY_MODAL_TEXT") + " "} + , + ]} + onOverlayClick={() => { + setShowPopUp(false); + }} + footerChildren={[ + + ))} + + ); +}; + +const TabContent = ({ activeSubTab, subTabCount = 3, onSubTabChange, project }) => { + const { campaignData, dispatchCampaignData } = useContext(CycleContext); + const { t } = useTranslation(); + + return ( + + +
+ {t(`CAMPAIGN_TAB_TEXT`)} + {t(`CAMPAIGN_TAB_SUB_TEXT_${project?.code ? project?.code?.toUpperCase() : project?.toUpperCase()}`)} +
+ {/* Add content specific to each tab as needed */} + , + + {t(`CAMPAIGN_TAB_INFO_TEXT_${project?.code ? project?.code?.toUpperCase() : project?.toUpperCase()}`)} + + ]} + label={"Info"} + /> +
+ ); +}; + +const SubTabs = ({ onSubTabChange }) => { + const { campaignData, dispatchCampaignData } = useContext(CycleContext); + const { t } = useTranslation(); + + return ( +
+ {campaignData + ?.find((i) => i?.active === true) + ?.deliveries.map((_, index) => ( + + ))} +
+ ); +}; + +const MultiTab = ({ tabCount = 3, subTabCount = 2 }) => { + const [activeTab, setActiveTab] = useState(0); + const [activeSubTab, setActiveSubTab] = useState(0); + const { campaignData, dispatchCampaignData } = useContext(CycleContext); + const { t } = useTranslation(); + const tempSession = Digit.SessionStorage.get("HCM_CAMPAIGN_MANAGER_FORM_DATA"); + const handleTabChange = (tabIndex, index) => { + dispatchCampaignData({ + type: "TAB_CHANGE_UPDATE", + payload: { tabIndex: tabIndex, index: index }, // Your updated campaign data + }); + setActiveTab(index); + setActiveSubTab(0); // Reset sub-tab when changing the main tab + }; + + const handleSubTabChange = (subTabIndex, itemIndex) => { + dispatchCampaignData({ + type: "SUBTAB_CHANGE_UPDATE", + payload: { subTabIndex: subTabIndex }, // Your updated campaign data + }); + }; + + return ( + <> +
+ {t( + `CAMPAIGN_PROJECT_${ + tempSession?.HCM_CAMPAIGN_TYPE?.projectType?.code + ? tempSession?.HCM_CAMPAIGN_TYPE?.projectType?.code?.toUpperCase() + : tempSession?.HCM_CAMPAIGN_TYPE?.projectType?.toUpperCase() + }` + )} +
+ +
+
+ +
+ + +
+ + ); +}; + +export default MultiTab; diff --git a/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/deliveryRule/index.js b/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/deliveryRule/index.js new file mode 100644 index 00000000000..ebdf2c5088f --- /dev/null +++ b/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/deliveryRule/index.js @@ -0,0 +1,531 @@ +import React, { createContext, useContext, useEffect, useReducer, useState } from "react"; +import MultiTab from "./MultiTabcontext"; +import { Loader } from "@egovernments/digit-ui-react-components"; +// import { deliveryConfig } from "../../../configs/deliveryConfig"; + +const CycleContext = createContext(); + +function makeSequential(jsonArray, keyName) { + return jsonArray.map((item, index) => ({ + ...item, + [keyName]: index + 1, + })); +} + +function DeliverySetup({ onSelect, config, formData, control, tabCount = 2, subTabCount = 3, ...props }) { + // Campaign Tab Skeleton function + const [cycleData, setCycleData] = useState(config?.customProps?.sessionData?.["HCM_CAMPAIGN_CYCLE_CONFIGURE"]?.cycleConfigure); + const saved = window.Digit.SessionStorage.get("HCM_CAMPAIGN_MANAGER_FORM_DATA")?.HCM_CAMPAIGN_DELIVERY_DATA?.deliveryRule; + const selectedProjectType = window.Digit.SessionStorage.get("HCM_CAMPAIGN_MANAGER_FORM_DATA")?.HCM_CAMPAIGN_TYPE?.projectType?.code; + const tenantId = Digit.ULBService.getCurrentTenantId(); + const searchParams = new URLSearchParams(location.search); + const activeCycle = searchParams.get("activeCycle"); + const { isLoading: deliveryConfigLoading, data: filteredDeliveryConfig } = Digit.Hooks.useCustomMDMS( + tenantId, + "HCM-ADMIN-CONSOLE", + [{ name: "deliveryConfig" }], + { + select: (data) => { + const temp = data?.["HCM-ADMIN-CONSOLE"]?.deliveryConfig; + return temp?.find((i) => i?.projectType === selectedProjectType); + // return deliveryConfig?.find((i) => i?.projectType === selectedProjectType); + }, + } + ); + // const [filteredDeliveryConfig, setFilteredDeliveryConfig] = useState(deliveryConfig?.find((i) => i?.projectType === selectedProjectType)); + // useEffect(() => { + // if (!deliveryConfigLoading) { + // const temp = deliveryConfig?.find((i) => i?.projectType === selectedProjectType); + // setFilteredDeliveryConfig(temp); + // } + // }, [deliveryConfigLoading, filteredDeliveryConfig]); + // const filteredDeliveryConfig = deliveryConfig.find((i) => i.projectType === selectedProjectType); + useEffect(() => { + setCycleData(config?.customProps?.sessionData?.["HCM_CAMPAIGN_CYCLE_CONFIGURE"]?.cycleConfigure); + }, [config?.customProps?.sessionData?.["HCM_CAMPAIGN_CYCLE_CONFIGURE"]?.cycleConfigure]); + + const generateTabsData = (tabs, subTabs) => { + if (!saved || saved?.length === 0) { + return [...Array(tabs)].map((_, tabIndex) => ({ + cycleIndex: `${tabIndex + 1}`, + active: activeCycle == tabIndex + 1 ? true : tabIndex === 0 ? true : false, + deliveries: [...Array(subTabs || 1)].map((_, subTabIndex) => ({ + deliveryIndex: `${subTabIndex + 1}`, + active: subTabIndex === 0 ? true : false, + deliveryRules: + filteredDeliveryConfig?.projectType === "LLIN-mz" + ? filteredDeliveryConfig?.deliveryConfig?.map((item, index) => { + return { + ruleKey: index + 1, + delivery: {}, + attributes: item?.attributeConfig + ? item?.attributeConfig?.map((i, c) => { + if (i?.operatorValue === "IN_BETWEEN") { + return { + key: c + 1, + attribute: { code: i?.attrValue }, + operator: { code: i?.operatorValue }, + toValue: i?.fromValue, + fromValue: i?.toValue, + }; + } + return { + key: c + 1, + attribute: { code: i?.attrValue }, + operator: { code: i?.operatorValue }, + value: i?.value, + }; + }) + : [{ key: 1, attribute: null, operator: null, value: "" }], + // products: [], + products: item?.productConfig + ? item?.productConfig?.map((i, c) => ({ + ...i, + })) + : [], + }; + }) + : filteredDeliveryConfig && filteredDeliveryConfig?.deliveryConfig?.[subTabIndex] + ? filteredDeliveryConfig?.deliveryConfig?.[subTabIndex]?.conditionConfig?.map((item, index) => { + if (item) { + return { + ruleKey: index + 1, + delivery: {}, + deliveryType: item?.deliveryType, + attributes: item?.attributeConfig + ? item?.attributeConfig?.map((i, c) => { + if (i?.operatorValue === "IN_BETWEEN") { + return { + key: c + 1, + attribute: { code: i?.attrValue }, + operator: { code: i?.operatorValue }, + toValue: i?.fromValue, + fromValue: i?.toValue, + }; + } + return { + key: c + 1, + attribute: { code: i?.attrValue }, + operator: { code: i?.operatorValue }, + value: i?.value, + }; + }) + : [{ key: 1, attribute: null, operator: null, value: "" }], + // products: [], + products: item?.productConfig + ? item?.productConfig?.map((i, c) => ({ + ...i, + })) + : [], + }; + } else { + return { + ruleKey: index + 1, + delivery: {}, + deliveryType: null, + attributes: [{ key: 1, attribute: null, operator: null, value: "" }], + products: [], + }; + } + }) + : [ + { + ruleKey: 1, + delivery: {}, + attributes: + filteredDeliveryConfig && filteredDeliveryConfig?.attributeConfig + ? filteredDeliveryConfig?.attributeConfig?.map((i, c) => ({ + key: c + 1, + attribute: { code: i?.attrValue }, + operator: { code: i?.operatorValue }, + value: i?.value, + })) + : // : filteredDeliveryConfig?.projectType === "LLIN-mz" + // ? filteredDeliveryConfig?.attributeConfig?.map((i, c) => ({ key: c + 1, attribute: i.attrValue, operator: null, value: "" })) + [{ key: 1, attribute: null, operator: null, value: "" }], + products: [], + }, + ], + })), + })); + } + // if no change + if (saved && saved?.length == tabs && saved?.[0]?.deliveries?.length === subTabs) { + return saved.map((i, n) => { + return { + ...i, + active: activeCycle ? (activeCycle == n + 1 ? true : false) : n === 0 ? true : false, + }; + }); + } + // if cycle number decrease + if (saved?.length > tabs) { + // const temp = saved; + saved.splice(tabs); + // return temp; + } + // if cycle number increase + if (tabs > saved?.length) { + // const temp = saved; + for (let i = saved.length + 1; i <= tabs; i++) { + const newIndex = i.toString(); + saved.push({ + cycleIndex: newIndex, + active: false, + deliveries: [...Array(subTabs || 1)].map((_, subTabIndex) => ({ + deliveryIndex: `${subTabIndex + 1}`, + active: subTabIndex === 0, + deliveryRules: + filteredDeliveryConfig?.projectType === "LLIN-mz" + ? filteredDeliveryConfig?.deliveryConfig?.map((item, index) => { + return { + ruleKey: index + 1, + delivery: {}, + attributes: item?.attributeConfig + ? item?.attributeConfig?.map((i, c) => { + if (i?.operatorValue === "IN_BETWEEN") { + return { + key: c + 1, + attribute: { code: i?.attrValue }, + operator: { code: i?.operatorValue }, + toValue: i?.fromValue, + fromValue: i?.toValue, + }; + } + return { + key: c + 1, + attribute: { code: i?.attrValue }, + operator: { code: i?.operatorValue }, + value: i?.value, + }; + }) + : [{ key: 1, attribute: null, operator: null, value: "" }], + // products: [], + products: item?.productConfig + ? item?.productConfig?.map((i, c) => ({ + ...i, + })) + : [], + }; + }) + : filteredDeliveryConfig && filteredDeliveryConfig?.deliveryConfig?.[subTabIndex]?.conditionConfig + ? filteredDeliveryConfig?.deliveryConfig?.[subTabIndex]?.conditionConfig?.map((item, index) => { + if (item) { + return { + ruleKey: index + 1, + delivery: {}, + deliveryType: item?.deliveryType, + attributes: item?.attributeConfig + ? item?.attributeConfig?.map((i, c) => { + if (i?.operatorValue === "IN_BETWEEN") { + return { + key: c + 1, + attribute: { code: i?.attrValue }, + operator: { code: i?.operatorValue }, + toValue: i?.fromValue, + fromValue: i?.toValue, + }; + } + return { + key: c + 1, + attribute: { code: i?.attrValue }, + operator: { code: i?.operatorValue }, + value: i?.value, + }; + }) + : [{ key: 1, attribute: null, operator: null, value: "" }], + // products: [], + products: item?.productConfig + ? item?.productConfig?.map((i, c) => ({ + ...i, + })) + : [], + }; + } else { + return { + ruleKey: index + 1, + delivery: {}, + deliveryType: null, + attributes: [{ key: 1, attribute: null, operator: null, value: "" }], + products: [], + }; + } + }) + : [ + { + ruleKey: 1, + delivery: {}, + deliveryType: null, + attributes: + // filteredDeliveryConfig?.projectType === "MR-DN" + // ? filteredDeliveryConfig?.attributeConfig?.map((i, c) => ({ + // key: c + 1, + // attribute: { code: i?.attrValue }, + // operator: { code: i?.operatorValue }, + // value: i?.value, + // })) + // : filteredDeliveryConfig?.projectType === "LLIN-mz" + // ? filteredDeliveryConfig?.attributeConfig?.map((i, c) => ({ + // key: c + 1, + // attribute: i.attrValue, + // operator: null, + // value: "", + // })) + // : + [{ key: 1, attribute: null, operator: null, value: "" }], + // products: [], + products: [], + }, + ], + })), + }); + } + // return temp; + } + // if delivery number decrease + + saved.forEach((cycle) => { + // Remove deliveries if there are more deliveries than the specified number + if (cycle.deliveries.length > subTabs) { + cycle.deliveries.splice(subTabs); + } + + // Add deliveries if there are fewer deliveries than the specified number + if (subTabs > cycle.deliveries.length) { + for (let i = cycle.deliveries.length + 1; i <= subTabs; i++) { + const newIndex = i.toString(); + cycle.deliveries.push({ + deliveryIndex: newIndex, + active: false, + deliveryRules: + filteredDeliveryConfig?.projectType === "LLIN-mz" + ? filteredDeliveryConfig?.deliveryConfig?.map((item, index) => { + return { + ruleKey: index + 1, + delivery: {}, + attributes: item?.attributeConfig + ? item?.attributeConfig?.map((i, c) => { + if (i?.operatorValue === "IN_BETWEEN") { + return { + key: c + 1, + attribute: { code: i?.attrValue }, + operator: { code: i?.operatorValue }, + toValue: i?.fromValue, + fromValue: i?.toValue, + }; + } + return { + key: c + 1, + attribute: { code: i?.attrValue }, + operator: { code: i?.operatorValue }, + value: i?.value, + }; + }) + : [{ key: 1, attribute: null, operator: null, value: "" }], + // products: [], + products: item?.productConfig + ? item?.productConfig?.map((i, c) => ({ + ...i, + })) + : [], + }; + }) + : [ + { + ruleKey: 1, + delivery: {}, + attributes: [{ key: 1, attribute: null, operator: null, value: "" }], + products: [], + }, + ], + }); + } + } + }); + + return saved; + // if delivery number increase + + //if no above case + }; + + // Reducer function + const campaignDataReducer = (state, action) => { + switch (action.type) { + case "GENERATE_CAMPAIGN_DATA": + return generateTabsData(action.cycle, action.deliveries); + case "UPDATE_CAMPAIGN_DATA": + const changeUpdate = state.map((i) => { + if (i.active) { + const activeDelivery = i.deliveries.find((j) => j.active === true); + if (activeDelivery) { + return { + ...i, + deliveries: i.deliveries.map((j) => ({ + ...j, + deliveryRules: j.active ? action.payload.currentDeliveryRules : j.deliveryRules, + })), + }; + } + } + return i; + }); + return changeUpdate; + case "TAB_CHANGE_UPDATE": + const temp = state.map((i) => ({ + ...i, + active: i.cycleIndex == action.payload.tabIndex ? true : false, + })); + return temp; + // return action.payload; + case "SUBTAB_CHANGE_UPDATE": + const tempSub = state.map((camp, index) => { + if (camp.active === true) { + return { + ...camp, + deliveries: camp.deliveries.map((deliver) => ({ + ...deliver, + active: deliver.deliveryIndex == action.payload.subTabIndex ? true : false, + })), + }; + } + return camp; + }); + return tempSub; + case "ADD_DELIVERY_RULE": + const updatedDeliveryRules = [ + ...action.payload.currentDeliveryRules, + { + ruleKey: action.payload.currentDeliveryRules.length + 1, + delivery: {}, + attributes: [{ key: 1, attribute: null, operator: null, value: "" }], + products: [], + }, + ]; + const updatedData = state.map((i) => { + if (i.active) { + const activeDelivery = i.deliveries.find((j) => j.active); + if (activeDelivery) { + return { + ...i, + deliveries: i.deliveries.map((j) => ({ + ...j, + deliveryRules: j.active ? updatedDeliveryRules : j.deliveryRules, + })), + }; + } + } + return i; + }); + return updatedData; + case "REMOVE_DELIVERY_RULE": + const updatedDeleted = state.map((i) => { + if (i.active) { + const activeDelivery = i.deliveries.find((j) => j.active); + const w = makeSequential( + activeDelivery.deliveryRules.filter((j) => j.ruleKey != action.payload.item.ruleKey), + "ruleKey" + ); + if (activeDelivery) { + return { + ...i, + deliveries: i.deliveries.map((j) => ({ + ...j, + deliveryRules: j.active ? w : j.deliveryRules, + })), + }; + } + } + return i; + }); + return updatedDeleted; + case "UPDATE_DELIVERY_RULE": + return action.payload; + case "ADD_ATTRIBUTE": + return action.payload; + case "REMOVE_ATTRIBUTE": + return action.payload; + case "UPDATE_ATTRIBUTE": + return action.payload; + case "ADD_PRODUCT": + const prodTemp = action.payload.productData.map((i) => ({ ...i, value: i?.value?.id, name: i?.value?.displayName })); + const updatedState = state.map((cycle) => { + if (cycle.active) { + const updatedDeliveries = cycle.deliveries.map((dd) => { + if (dd.active) { + const updatedRules = dd.deliveryRules.map((rule) => { + if (rule.ruleKey === action.payload.delivery.ruleKey) { + return { + ...rule, + products: [...rule.products, ...prodTemp], + }; + } + return rule; + }); + return { + ...dd, + deliveryRules: updatedRules, + }; + } + return dd; + }); + return { + ...cycle, + deliveries: updatedDeliveries, + }; + } + return cycle; + }); + return updatedState; + case "REMOVE_PRODUCT": + return action.payload; + case "UPDATE_PRODUCT": + return action.payload; + default: + return state; + } + }; + + const [campaignData, dispatchCampaignData] = useReducer( + campaignDataReducer, + generateTabsData(cycleData?.cycleConfgureDate?.cycle, cycleData?.cycleConfgureDate?.deliveries) + ); + const [executionCount, setExecutionCount] = useState(0); + + useEffect(() => { + dispatchCampaignData({ + type: "GENERATE_CAMPAIGN_DATA", + cycle: cycleData?.cycleConfgureDate?.cycle, + deliveries: cycleData?.cycleConfgureDate?.deliveries, + }); + }, [cycleData]); + + useEffect(() => { + onSelect("deliveryRule", campaignData); + }, [campaignData]); + + useEffect(() => { + if (executionCount < 5) { + onSelect("deliveryRule", campaignData); + setExecutionCount((prevCount) => prevCount + 1); + } + }); + + if (deliveryConfigLoading) { + return ; + } + return ( + + + + ); +} + +export default DeliverySetup; +export { CycleContext }; diff --git a/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/index.js b/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/index.js new file mode 100644 index 00000000000..2353f85fc50 --- /dev/null +++ b/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/index.js @@ -0,0 +1,102 @@ +import React, { useEffect } from "react"; +import { Switch, useLocation } from "react-router-dom"; +import { useTranslation } from "react-i18next"; +import { PrivateRoute, AppContainer, BreadCrumb } from "@egovernments/digit-ui-react-components"; +// import CampaignHeader from "../../components/CampaignHeader"; +import SetupCampaign from "./SetupCampaign"; +import SelectingBoundaries from "../../components/SelectingBoundaries"; + +/** + * The CampaignBreadCrumb function generates breadcrumb navigation for a campaign setup page in a React + * application. + * @returns The CampaignBreadCrumb component is returning a BreadCrumb component with the specified + * crumbs array and spanStyle prop. The crumbs array contains two objects with path, content, and show + * properties for each breadcrumb item. The spanStyle prop is set to { maxWidth: "min-content" }. + */ +const CampaignBreadCrumb = ({ location, defaultPath }) => { + const { t } = useTranslation(); + const search = useLocation().search; + const pathVar = location.pathname.replace(defaultPath + "/", "").split("?")?.[0]; + + const crumbs = [ + { + path: `/${window?.contextPath}/employee`, + content: t("CAMPAIGN_HOME"), + show: true, + }, + { + path: pathVar === "my-campaign" ? "" : `/${window?.contextPath}/employee/campaign/my-campaign`, + content: t("MY_CAMPAIGN"), + show: pathVar === "my-campaign" ? true : false, + }, + { + path: pathVar === "setup-campaign" ? "" : `/${window?.contextPath}/employee/campaign/setup-campaign`, + content: t("CREATE_NEW_CAMPAIGN"), + show: pathVar === "setup-campaign" ? true : false, + }, + ]; + + return ; +}; + +/** + * The `App` function in JavaScript defines a component that handles different routes and renders + * corresponding components based on the path provided. + * @returns The `App` component is returning a JSX structure that includes a `div` with a className of + * "wbh-header-container" containing a `CampaignBreadCrumb` component and a `Switch` component. Inside + * the `Switch` component, there are several `PrivateRoute` components with different paths and + * corresponding components such as `UploadBoundaryData`, `CycleConfiguration`, `DeliveryRule`, ` + */ +const App = ({ path, BOUNDARY_HIERARCHY_TYPE }) => { + const location = useLocation(); + const UploadBoundaryData = Digit?.ComponentRegistryService?.getComponent("UploadBoundaryData"); + const CycleConfiguration = Digit?.ComponentRegistryService?.getComponent("CycleConfiguration"); + const DeliveryRule = Digit?.ComponentRegistryService?.getComponent("DeliveryRule"); + const MyCampaign = Digit?.ComponentRegistryService?.getComponent("MyCampaign"); + const CampaignSummary = Digit?.ComponentRegistryService?.getComponent("CampaignSummary"); + const Response = Digit?.ComponentRegistryService?.getComponent("Response"); + const AddProduct = Digit?.ComponentRegistryService?.getComponent("AddProduct"); + + useEffect(() => { + if (window.location.pathname !== "/workbench-ui/employee/campaign/setup-campaign") { + window.Digit.SessionStorage.del("HCM_CAMPAIGN_MANAGER_FORM_DATA"); + window.Digit.SessionStorage.del("HCM_CAMPAIGN_MANAGER_UPLOAD_ID"); + } + if (window.location.pathname === "/workbench-ui/employee/campaign/response") { + window.Digit.SessionStorage.del("HCM_CAMPAIGN_MANAGER_FORM_DATA"); + window.Digit.SessionStorage.del("HCM_CAMPAIGN_MANAGER_UPLOAD_ID"); + } + return () => { + if (window.location.pathname !== "/workbench-ui/employee/campaign/setup-campaign") { + window.Digit.SessionStorage.del("HCM_CAMPAIGN_MANAGER_FORM_DATA"); + window.Digit.SessionStorage.del("HCM_CAMPAIGN_MANAGER_UPLOAD_ID"); + } + }; + }, []); + return ( + +
+ {window?.location?.pathname === "/workbench-ui/employee/campaign/add-product" || + window?.location?.pathname === "/workbench-ui/employee/campaign/response" ? null : ( + + )} + {/* */} +
+ + + } /> + } /> + } /> + } /> + } /> + } /> + } /> + } /> + } /> + + +
+ ); +}; + +export default App; diff --git a/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/TourSteps.js b/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/TourSteps.js new file mode 100644 index 00000000000..5ab880c52cf --- /dev/null +++ b/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/TourSteps.js @@ -0,0 +1,144 @@ +export const TourSteps = { + '/workbench-ui/employee/workbench/manage-master-data':[ + { + content: + 'Welcome to Manage Master Data screen. Here you can search and update any master data that is configured for the logged in user tenant', + target: '.manage-master-wrapper', + disableBeacon: true, + placement: 'bottom', + title:"Manage Master Data" + }, + { + content: + 'Select any module name where the master is present', + target: '.wbh-mdms-module-name', + disableBeacon: true, + placement: 'center', + title:"Manage Master Data" + }, + + { + content: + 'Select any master name where the master is present', + target: '.wbh-mdms-master-name', + disableBeacon: true, + placement: 'center', + title:"Manage Master Data" + }, + ], + '/workbench-ui/employee/workbench/mdms-search-v2':[ + { + content: + 'Welcome to the master data search screen. Here you can search the master data added under this master', + target: '.search-wrapper', + disableBeacon: true, + placement: 'bottom', + title:"Manage Master Data" + }, + { + content: + 'Select any field value and enter the text by which data can be filtered', + target: '.label-field-pair', + disableBeacon: true, + placement: 'bottom', + title:"Manage Master Data" + }, + { + content: + 'Filter the master data by clicking on this search by selecting any field and exact value', + target: '.search-button-wrapper', + disableBeacon: true, + placement: 'bottom', + title:"Manage Master Data" + }, + { + content: + 'To add new master data under this master click on the Add Master Data button', + target: '.mdms-add-btn', + disableBeacon: true, + placement: 'auto', + title:"Manage Master Data" + }, + + ], + '/workbench-ui/employee/workbench/mdms-add-v2':[ + { + content: + 'Welcome to the master data search screen. Here you can search the master data added under this master', + target: '.field-string', + disableBeacon: true, + placement: 'bottom', + title:"Manage Master Data" + }, + { + content: + 'select the Reference master data', + target: '.form-select ', + disableBeacon: true, + placement: 'bottom', + title:"Manage Master Data" + }, + { + content: + 'Fill all the details by clicking on the Add Master Data', + target: '.submit-bar', + disableBeacon: true, + placement: 'auto', + title:"Manage Master Data" + }, + + ], + '/workbench-ui/employee/workbench/mdms-view':[ + { + content: + 'Welcome to the master data search screen. Here you can search the master data added under this master', + target: '.action-bar-wrap', + disableBeacon: true, + placement: 'bottom', + title:"Manage Master Data" + }, + { + content: + 'select the Reference master data', + target: '.menu-wrap', + disableBeacon: true, + placement: 'bottom', + title:"Manage Master Data" + } + ], + '/workbench-ui/employee/workbench/localisation-search':[ + { + content: + 'Welcome to the master data search screen. Here you can search the master data added under this master', + target: '.search-wrapper', + disableBeacon: true, + placement: 'bottom', + title:"Manage Master Data" + }, + { + content: + 'Select any field value and enter the text by which data can be filtered', + target: '.label-field-pair', + disableBeacon: true, + placement: 'bottom', + title:"Manage Master Data" + }, + { + content: + 'Filter the master data by clicking on this search by selecting any field and exact value', + target: '.search-button-wrapper', + disableBeacon: true, + placement: 'bottom', + title:"Manage Master Data" + }, + { + content: + 'To add new master data under this master click on the Add Master Data button', + target: '.mdms-add-btn', + disableBeacon: true, + placement: 'auto', + title:"Manage Master Data" + }, + + ], +} diff --git a/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/downloadExcel.js b/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/downloadExcel.js new file mode 100644 index 00000000000..978ea2bfd74 --- /dev/null +++ b/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/downloadExcel.js @@ -0,0 +1,46 @@ +import axios from "axios"; + +/* Fetching sheet as json object from the API , converting them into blob and downloading it. + * Way to use the function. Just import the funtion downloadExcelWithCustomName and pass the filestoreid and customName you want to download the file. + * Rest this function will take care for you and download it in your system. + * + * Eg. -> + * const handleDownload = (id, name) => { + * downloadExcelWithCustomName({fileStoreId: id, customName: name}); + * } + * + */ + +export const downloadExcelWithCustomName = ({ fileStoreId = null, customName = null }) => { + const downloadExcel = (blob, fileName) => { + const link = document.createElement("a"); + link.href = URL.createObjectURL(blob); + link.download = fileName + ".xlsx"; + document.body.append(link); + link.click(); + link.remove(); + setTimeout(() => URL.revokeObjectURL(link.href), 7000); + }; + + if (fileStoreId) { + axios + .get("/filestore/v1/files/id", { + responseType: "arraybuffer", + headers: { + "Content-Type": "application/json", + Accept: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", + "auth-token": Digit.UserService.getUser()?.["access_token"], + }, + params: { + tenantId: Digit.ULBService.getCurrentTenantId(), + fileStoreId: fileStoreId, + }, + }) + .then(async (res) => { + downloadExcel( + new Blob([res.data], { type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" }), + customName ? customName : "download" + ); + }); + } +}; diff --git a/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/index.js b/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/index.js new file mode 100644 index 00000000000..5e308bf82f7 --- /dev/null +++ b/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/utils/index.js @@ -0,0 +1,6 @@ +import _ from "lodash"; +import { downloadExcelWithCustomName } from "./downloadExcel"; + +export default {}; +export { downloadExcelWithCustomName }; +export const PRIMARY_COLOR = "#C84C0E"; diff --git a/health/micro-ui/web/micro-ui-internals/publish-develop.sh b/health/micro-ui/web/micro-ui-internals/publish-develop.sh new file mode 100644 index 00000000000..4909658c697 --- /dev/null +++ b/health/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/health/micro-ui/web/micro-ui-internals/publish.sh b/health/micro-ui/web/micro-ui-internals/publish.sh new file mode 100644 index 00000000000..4909658c697 --- /dev/null +++ b/health/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/health/micro-ui/web/micro-ui-internals/scripts/create.sh b/health/micro-ui/web/micro-ui-internals/scripts/create.sh new file mode 100755 index 00000000000..9de72331774 --- /dev/null +++ b/health/micro-ui/web/micro-ui-internals/scripts/create.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +./scripts/run.sh core utilities diff --git a/health/micro-ui/web/micro-ui-internals/scripts/deploy.sh b/health/micro-ui/web/micro-ui-internals/scripts/deploy.sh new file mode 100755 index 00000000000..5b0c7b831ed --- /dev/null +++ b/health/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/health/micro-ui/web/micro-ui-internals/scripts/jenkins.sh b/health/micro-ui/web/micro-ui-internals/scripts/jenkins.sh new file mode 100755 index 00000000000..a1711fec55b --- /dev/null +++ b/health/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/health/micro-ui/web/micro-ui-internals/scripts/run.sh b/health/micro-ui/web/micro-ui-internals/scripts/run.sh new file mode 100755 index 00000000000..f00c59f13b8 --- /dev/null +++ b/health/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/health/micro-ui/web/micro-ui-internals/test.js b/health/micro-ui/web/micro-ui-internals/test.js new file mode 100644 index 00000000000..60c958d0bac --- /dev/null +++ b/health/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/health/micro-ui/web/package.json b/health/micro-ui/web/package.json new file mode 100644 index 00000000000..59ebb7ece05 --- /dev/null +++ b/health/micro-ui/web/package.json @@ -0,0 +1,85 @@ +{ + "name": "micro-ui", + "version": "1.0.0", + "author": "Jagankumar ", + "license": "MIT", + "private": true, + "engines": { + "node": ">=14" + }, + "workspaces": [ + "micro-ui-internals/packages/libraries", + "micro-ui-internals/packages/react-components", + "micro-ui-internals/packages/modules/*" + ], + "homepage": "/digit-ui", + "dependencies": { + "@egovernments/digit-ui-libraries": "1.8.1-beta.4", + "@egovernments/digit-ui-module-workbench": "1.0.1-beta.16", + "@egovernments/digit-ui-module-core": "1.8.2-beta.2", + "@egovernments/digit-ui-module-hrms": "1.8.0-beta.2", + "@egovernments/digit-ui-react-components": "1.8.2-beta.6", + "@egovernments/digit-ui-components": "0.0.2-beta.1", + "@egovernments/digit-ui-module-dss": "1.8.0-beta", + "@egovernments/digit-ui-module-common": "1.8.0-beta", + "@egovernments/digit-ui-module-utilities": "1.0.0-beta", + "@egovernments/digit-ui-module-engagement": "1.5.20", + "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/health/micro-ui/web/public/index.html b/health/micro-ui/web/public/index.html new file mode 100644 index 00000000000..9da00f7e1de --- /dev/null +++ b/health/micro-ui/web/public/index.html @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + DIGIT + + + + + + +
+ + + + \ No newline at end of file diff --git a/health/micro-ui/web/public/robots.txt b/health/micro-ui/web/public/robots.txt new file mode 100644 index 00000000000..e9e57dc4d41 --- /dev/null +++ b/health/micro-ui/web/public/robots.txt @@ -0,0 +1,3 @@ +# https://www.robotstxt.org/robotstxt.html +User-agent: * +Disallow: diff --git a/health/micro-ui/web/src/App.js b/health/micro-ui/web/src/App.js new file mode 100644 index 00000000000..d871f8e8f4c --- /dev/null +++ b/health/micro-ui/web/src/App.js @@ -0,0 +1,74 @@ +import React from "react"; +import { initLibraries } from "@egovernments/digit-ui-libraries"; +import { + paymentConfigs, + PaymentLinks, + PaymentModule, +} from "@egovernments/digit-ui-module-common"; +import { DigitUI,initCoreComponents } from "@egovernments/digit-ui-module-core"; +import { initDSSComponents } from "@egovernments/digit-ui-module-dss"; +import { initEngagementComponents } from "@egovernments/digit-ui-module-engagement"; +import { initHRMSComponents } from "@egovernments/digit-ui-module-hrms"; +import { initUtilitiesComponents } from "@egovernments/digit-ui-module-utilities"; +import { UICustomizations } from "./Customisations/UICustomizations"; +import { initWorkbenchComponents } from "@egovernments/digit-ui-module-workbench"; +// import { initWorkbenchHCMComponents } from "@egovernments/digit-ui-module-hcmworkbench"; + +window.contextPath = window?.globalConfigs?.getConfig("CONTEXT_PATH"); + +const enabledModules = [ + "DSS", + "NDSS", + "Utilities", + "HRMS", + "Engagement", + "Workbench", + "Microplanning" +]; + +const moduleReducers = (initData) => ({ + initData, +}); + +const initDigitUI = () => { + window.Digit.ComponentRegistryService.setupRegistry({ + PaymentModule, + ...paymentConfigs, + PaymentLinks, + }); + initCoreComponents(); + initDSSComponents(); + initHRMSComponents(); + initEngagementComponents(); + initUtilitiesComponents(); + initWorkbenchComponents(); + + window.Digit.Customizations = { + PGR: {}, + commonUiConfig: UICustomizations, + }; +}; + +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/health/micro-ui/web/src/ComponentRegistry.js b/health/micro-ui/web/src/ComponentRegistry.js new file mode 100644 index 00000000000..9bafce3dc89 --- /dev/null +++ b/health/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/health/micro-ui/web/src/Customisations/UICustomizations.js b/health/micro-ui/web/src/Customisations/UICustomizations.js new file mode 100644 index 00000000000..6d17ab0d51b --- /dev/null +++ b/health/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/health/micro-ui/web/src/Customisations/index.js b/health/micro-ui/web/src/Customisations/index.js new file mode 100644 index 00000000000..803b1e8763e --- /dev/null +++ b/health/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/health/micro-ui/web/src/Customisations/pt/index.js b/health/micro-ui/web/src/Customisations/pt/index.js new file mode 100644 index 00000000000..0063fcd4774 --- /dev/null +++ b/health/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/health/micro-ui/web/src/Customisations/pt/pageComponents/PTAllotmentDetails.js b/health/micro-ui/web/src/Customisations/pt/pageComponents/PTAllotmentDetails.js new file mode 100644 index 00000000000..569aa45e409 --- /dev/null +++ b/health/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/health/micro-ui/web/src/Customisations/pt/pageComponents/PTBusinessDetails.js b/health/micro-ui/web/src/Customisations/pt/pageComponents/PTBusinessDetails.js new file mode 100644 index 00000000000..3d28785e7e5 --- /dev/null +++ b/health/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/health/micro-ui/web/src/Customisations/pt/pageComponents/PTVasikaDetails.js b/health/micro-ui/web/src/Customisations/pt/pageComponents/PTVasikaDetails.js new file mode 100644 index 00000000000..0e4b6895745 --- /dev/null +++ b/health/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/health/micro-ui/web/src/Customisations/pt/pageComponents/PropertyUsageType.js b/health/micro-ui/web/src/Customisations/pt/pageComponents/PropertyUsageType.js new file mode 100644 index 00000000000..deade4fc2ad --- /dev/null +++ b/health/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/health/micro-ui/web/src/Customisations/tl/TLCustomisation.js b/health/micro-ui/web/src/Customisations/tl/TLCustomisation.js new file mode 100644 index 00000000000..642acc52090 --- /dev/null +++ b/health/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/health/micro-ui/web/src/Customisations/tl/index.js b/health/micro-ui/web/src/Customisations/tl/index.js new file mode 100644 index 00000000000..fe2ae4f4e6a --- /dev/null +++ b/health/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/health/micro-ui/web/src/Customisations/tl/pageComponents/PropertyUsageType.js b/health/micro-ui/web/src/Customisations/tl/pageComponents/PropertyUsageType.js new file mode 100644 index 00000000000..5520a66fc5a --- /dev/null +++ b/health/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/health/micro-ui/web/src/index.css b/health/micro-ui/web/src/index.css new file mode 100644 index 00000000000..e69de29bb2d diff --git a/health/micro-ui/web/src/index.js b/health/micro-ui/web/src/index.js new file mode 100644 index 00000000000..9f20bf1b506 --- /dev/null +++ b/health/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/health/micro-ui/web/src/setupProxy.js b/health/micro-ui/web/src/setupProxy.js new file mode 100644 index 00000000000..1b8eda94a19 --- /dev/null +++ b/health/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/health/micro-ui/web/webpack.config.js b/health/micro-ui/web/webpack.config.js new file mode 100644 index 00000000000..5f3dc46967a --- /dev/null +++ b/health/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/health/micro-ui/web/workbench/App.js b/health/micro-ui/web/workbench/App.js new file mode 100644 index 00000000000..93b15440c5e --- /dev/null +++ b/health/micro-ui/web/workbench/App.js @@ -0,0 +1,72 @@ +/** + * The above code initializes various Digit UI modules and components, sets up customizations, and + * renders the DigitUI component based on the enabled modules and state code. + * @returns The `App` component is being returned, which renders the `DigitUI` component with the + * specified props such as `stateCode`, `enabledModules`, `moduleReducers`, and `defaultLanding`. The + * `DigitUI` component is responsible for rendering the UI based on the provided configuration and + * modules. + */ +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 { initCampaignComponents } from "@egovernments/digit-ui-module-campaign-manager" + +window.contextPath = window?.globalConfigs?.getConfig("CONTEXT_PATH"); + +const enabledModules = [ + "DSS", + "NDSS", + "Utilities", + // "HRMS", + "Engagement", + "Workbench", + "HCMWORKBENCH", + "Campaign" +]; + +const moduleReducers = (initData) => ({ + initData, +}); + +const initDigitUI = () => { + window.Digit.ComponentRegistryService.setupRegistry({}); + window.Digit.Customizations = { + PGR: {}, + commonUiConfig: UICustomizations, + }; + // initHRMSComponents(); + initUtilitiesComponents(); + initWorkbenchComponents(); + initWorkbenchHCMComponents(); + initCampaignComponents(); + +}; + +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/health/micro-ui/web/workbench/Dockerfile b/health/micro-ui/web/workbench/Dockerfile new file mode 100644 index 00000000000..31b3912759b --- /dev/null +++ b/health/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/health/micro-ui/web/workbench/install-deps.sh b/health/micro-ui/web/workbench/install-deps.sh new file mode 100755 index 00000000000..54b8a4c3d7f --- /dev/null +++ b/health/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/health/micro-ui/web/workbench/inter-package.json b/health/micro-ui/web/workbench/inter-package.json new file mode 100644 index 00000000000..5216443ec23 --- /dev/null +++ b/health/micro-ui/web/workbench/inter-package.json @@ -0,0 +1,58 @@ +{ + "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:campaign": "cd packages/modules/campaign-manager && yarn start", + "build": "run-p build:**", + "build:campaign": "cd packages/modules/campaign-manager && 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", + "**/ajv": "8.11.2", + "fast-uri":"2.1.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.1", + "@egovernments/digit-ui-components": "0.0.2-beta.1", + "react": "17.0.2", + "react-dom": "17.0.2", + "react-hook-form": "6.15.8", + "react-i18next": "11.16.2", + "react-query": "3.6.1", + "react-router-dom": "5.3.0" + } +} diff --git a/health/micro-ui/web/workbench/nginx.conf b/health/micro-ui/web/workbench/nginx.conf new file mode 100644 index 00000000000..974ef82f241 --- /dev/null +++ b/health/micro-ui/web/workbench/nginx.conf @@ -0,0 +1,12 @@ +server +{ + listen 80; + underscores_in_headers on; + + location /workbench-ui + { + root /var/web; + index index.html index.htm; + try_files $uri $uri/ /workbench-ui/index.html; + } +} \ No newline at end of file diff --git a/health/micro-ui/web/workbench/package.json b/health/micro-ui/web/workbench/package.json new file mode 100644 index 00000000000..7cc60ef7bff --- /dev/null +++ b/health/micro-ui/web/workbench/package.json @@ -0,0 +1,89 @@ +{ + "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.2-beta.1", + "@egovernments/digit-ui-module-workbench": "1.0.2-beta.3", + "@egovernments/digit-ui-components": "0.0.2-beta.1", + "@egovernments/digit-ui-module-core": "1.8.2-beta.2", + "@egovernments/digit-ui-module-utilities": "1.0.1-beta.30", + "@egovernments/digit-ui-react-components": "1.8.2-beta.6", + "@egovernments/digit-ui-module-hcmworkbench":"0.0.38", + "@egovernments/digit-ui-module-campaign-manager": "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" + }, + "resolutions": { + "**/babel-loader": "8.2.2", + "**/@babel/core": "7.14.0", + "**/@babel/preset-env": "7.14.0", + "**/@babel/plugin-transform-modules-commonjs": "7.14.0", + "**/polished":"4.2.2", + "fast-uri":"2.1.0" + }, + "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" + ] + } +} diff --git a/health/micro-ui/web/workbench/webpack.config.js b/health/micro-ui/web/workbench/webpack.config.js new file mode 100644 index 00000000000..c19e631fe01 --- /dev/null +++ b/health/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 diff --git a/yarn.lock b/yarn.lock new file mode 100644 index 00000000000..fb57ccd13af --- /dev/null +++ b/yarn.lock @@ -0,0 +1,4 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + +