@openmrs/esm-stock-management-app 1.0.1-pre.327
Sign up to get free protection for your applications and to get access to all the features.
- package/.editorconfig +12 -0
- package/.eslintignore +2 -0
- package/.eslintrc +39 -0
- package/.husky/pre-commit +4 -0
- package/.husky/pre-push +6 -0
- package/.prettierignore +14 -0
- package/.turbo.json +18 -0
- package/.yarn/plugins/@yarnpkg/plugin-outdated.cjs +35 -0
- package/LICENSE +401 -0
- package/README.md +3 -0
- package/__mocks__/react-i18next.js +55 -0
- package/dist/26.js +2 -0
- package/dist/26.js.LICENSE.txt +32 -0
- package/dist/26.js.map +1 -0
- package/dist/294.js +2 -0
- package/dist/294.js.LICENSE.txt +9 -0
- package/dist/294.js.map +1 -0
- package/dist/375.js +2 -0
- package/dist/375.js.LICENSE.txt +40 -0
- package/dist/375.js.map +1 -0
- package/dist/46.js +1 -0
- package/dist/46.js.map +1 -0
- package/dist/484.js +1 -0
- package/dist/484.js.map +1 -0
- package/dist/574.js +1 -0
- package/dist/629.js +1 -0
- package/dist/629.js.map +1 -0
- package/dist/707.js +1 -0
- package/dist/707.js.map +1 -0
- package/dist/800.js +2 -0
- package/dist/800.js.LICENSE.txt +3 -0
- package/dist/800.js.map +1 -0
- package/dist/935.js +2 -0
- package/dist/935.js.LICENSE.txt +19 -0
- package/dist/935.js.map +1 -0
- package/dist/979.js +1 -0
- package/dist/979.js.map +1 -0
- package/dist/main.js +2 -0
- package/dist/main.js.LICENSE.txt +60 -0
- package/dist/main.js.map +1 -0
- package/dist/openmrs-esm-stock-management-app.js +1 -0
- package/dist/openmrs-esm-stock-management-app.js.buildmanifest.json +356 -0
- package/dist/openmrs-esm-stock-management-app.js.map +1 -0
- package/dist/routes.json +1 -0
- package/i18next-parser.config.js +89 -0
- package/jest.config.js +25 -0
- package/package.json +116 -0
- package/src/config-schema.ts +18 -0
- package/src/constants.ts +214 -0
- package/src/core/api/api.ts +34 -0
- package/src/core/api/types/Auditable.ts +9 -0
- package/src/core/api/types/BaseOpenmrsData.ts +4 -0
- package/src/core/api/types/BaseOpenmrsMetadata.ts +6 -0
- package/src/core/api/types/BaseOpenmrsObject.ts +3 -0
- package/src/core/api/types/BatchJob.ts +121 -0
- package/src/core/api/types/DashboardExtension.ts +8 -0
- package/src/core/api/types/Location.ts +16 -0
- package/src/core/api/types/LocationTree.ts +7 -0
- package/src/core/api/types/OpenmrsData.ts +5 -0
- package/src/core/api/types/OpenmrsMetadata.ts +8 -0
- package/src/core/api/types/OpenmrsObject.ts +3 -0
- package/src/core/api/types/PageableResult.ts +15 -0
- package/src/core/api/types/Party.ts +8 -0
- package/src/core/api/types/RecordPermission.ts +9 -0
- package/src/core/api/types/Retireable.ts +9 -0
- package/src/core/api/types/Voidable.ts +9 -0
- package/src/core/api/types/concept/Concept.ts +24 -0
- package/src/core/api/types/concept/ConceptName.ts +14 -0
- package/src/core/api/types/concept/Drug.ts +14 -0
- package/src/core/api/types/identity/Credentials.ts +4 -0
- package/src/core/api/types/identity/Patient.ts +3 -0
- package/src/core/api/types/identity/Person.ts +4 -0
- package/src/core/api/types/identity/PriviledgeScope.ts +9 -0
- package/src/core/api/types/identity/Privilege.ts +5 -0
- package/src/core/api/types/identity/Role.ts +5 -0
- package/src/core/api/types/identity/Session.ts +16 -0
- package/src/core/api/types/identity/User.ts +19 -0
- package/src/core/api/types/identity/UserRoleScope.ts +17 -0
- package/src/core/api/types/identity/UserRoleScopeLocation.ts +7 -0
- package/src/core/api/types/identity/UserRoleScopeOperationType.ts +6 -0
- package/src/core/api/types/stockItem/ImportResult.ts +9 -0
- package/src/core/api/types/stockItem/StockBatch.ts +8 -0
- package/src/core/api/types/stockItem/StockBatchDTO.ts +8 -0
- package/src/core/api/types/stockItem/StockItem.ts +63 -0
- package/src/core/api/types/stockItem/StockItemInventory.ts +10 -0
- package/src/core/api/types/stockItem/StockItemPackagingUOM.ts +20 -0
- package/src/core/api/types/stockItem/StockItemTransaction.ts +22 -0
- package/src/core/api/types/stockItem/StockRule.ts +28 -0
- package/src/core/api/types/stockOperation/LocationType.ts +4 -0
- package/src/core/api/types/stockOperation/StockOperation.ts +36 -0
- package/src/core/api/types/stockOperation/StockOperationAction.ts +24 -0
- package/src/core/api/types/stockOperation/StockOperationDTO.ts +64 -0
- package/src/core/api/types/stockOperation/StockOperationItem.ts +13 -0
- package/src/core/api/types/stockOperation/StockOperationItemCost.ts +14 -0
- package/src/core/api/types/stockOperation/StockOperationItemDTO.ts +29 -0
- package/src/core/api/types/stockOperation/StockOperationLinkDTO.ts +13 -0
- package/src/core/api/types/stockOperation/StockOperationStatus.ts +18 -0
- package/src/core/api/types/stockOperation/StockOperationType.ts +162 -0
- package/src/core/api/types/stockOperation/StockSource.ts +8 -0
- package/src/core/components/carbon/controlled-combo-box/controlled-combo-box.component.tsx +37 -0
- package/src/core/components/carbon/controlled-combo-box/controlled-combo-box.resource.tsx +0 -0
- package/src/core/components/carbon/controlled-combo-box/controlled-combo-box.scss +0 -0
- package/src/core/components/carbon/controlled-combo-box/controlled-combo-box.test.tsx +8 -0
- package/src/core/components/carbon/controlled-dropdown/controlled-dropdown.component.tsx +40 -0
- package/src/core/components/carbon/controlled-dropdown/controlled-dropdown.resource.tsx +0 -0
- package/src/core/components/carbon/controlled-dropdown/controlled-dropdown.scss +0 -0
- package/src/core/components/carbon/controlled-dropdown/controlled-dropdown.test.tsx +8 -0
- package/src/core/components/carbon/controlled-number-input/controlled-number-input.component.tsx +44 -0
- package/src/core/components/carbon/controlled-number-input/controlled-number-input.resource.tsx +0 -0
- package/src/core/components/carbon/controlled-number-input/controlled-number-input.scss +0 -0
- package/src/core/components/carbon/controlled-number-input/controlled-number-input.test.tsx +8 -0
- package/src/core/components/carbon/controlled-radio-button-group/controlled-radio-button-group.component.tsx +54 -0
- package/src/core/components/carbon/controlled-radio-button-group/controlled-radio-button-group.resource.tsx +0 -0
- package/src/core/components/carbon/controlled-radio-button-group/controlled-radio-button-group.scss +0 -0
- package/src/core/components/carbon/controlled-radio-button-group/controlled-radio-button-group.test.tsx +8 -0
- package/src/core/components/carbon/controlled-text-area/controlled-text-area.component.tsx +37 -0
- package/src/core/components/carbon/controlled-text-area/controlled-text-area.resource.tsx +0 -0
- package/src/core/components/carbon/controlled-text-area/controlled-text-area.scss +0 -0
- package/src/core/components/carbon/controlled-text-area/controlled-text-area.test.tsx +11 -0
- package/src/core/components/carbon/controlled-text-input/controlled-text-input.component.tsx +37 -0
- package/src/core/components/carbon/controlled-text-input/controlled-text-input.resource.tsx +0 -0
- package/src/core/components/carbon/controlled-text-input/controlled-text-input.scss +0 -0
- package/src/core/components/carbon/controlled-text-input/controlled-text-input.test.tsx +8 -0
- package/src/core/components/carbon/types.ts +7 -0
- package/src/core/components/card/metrics-card-component.tsx +102 -0
- package/src/core/components/card/metrics-card.scss +78 -0
- package/src/core/components/overlay/hook.ts +47 -0
- package/src/core/components/overlay/overlay.component.tsx +52 -0
- package/src/core/components/overlay/overlay.scss +97 -0
- package/src/core/components/side-nav/side-nav.component.tsx +62 -0
- package/src/core/components/side-nav/side-nav.scss +126 -0
- package/src/core/components/side-nav/types.ts +6 -0
- package/src/core/components/table/table.component.tsx +239 -0
- package/src/core/components/table/table.scss +173 -0
- package/src/core/components/table/types.ts +8 -0
- package/src/core/components/tabs/types.ts +7 -0
- package/src/core/components/tabs/vertical-tabs.component.tsx +53 -0
- package/src/core/components/tabs/vertical-tabs.scss +126 -0
- package/src/core/hooks/debounce-hook.ts +35 -0
- package/src/core/print/PrintStyles.ts +774 -0
- package/src/core/print/PrintTemplate.ts +65 -0
- package/src/core/print/printUtils.ts +19 -0
- package/src/core/utils/alert.ts +10 -0
- package/src/core/utils/datetimeUtils.ts +84 -0
- package/src/core/utils/debounce.ts +21 -0
- package/src/core/utils/imageUtils.ts +82 -0
- package/src/core/utils/stringUtils.ts +27 -0
- package/src/core/utils/utils.ts +70 -0
- package/src/createDashboardLink.tsx +43 -0
- package/src/dashboard/stock-management-dashboard-side-nav.component.tsx +50 -0
- package/src/dashboard/stock-management-dashboard.component.tsx +41 -0
- package/src/dashboard/stock-management-dashboard.scss +8 -0
- package/src/dashboard.meta.ts +5 -0
- package/src/declarations.d.ts +6 -0
- package/src/index.ts +64 -0
- package/src/root.component.tsx +12 -0
- package/src/root.scss +174 -0
- package/src/routes.json +53 -0
- package/src/setup-tests.ts +1 -0
- package/src/stock-app-menu-item/item.component.tsx +21 -0
- package/src/stock-app-menu-item/item.resource.ts +0 -0
- package/src/stock-app-menu-item/item.scss +17 -0
- package/src/stock-batch/stock-batch.resource.ts +79 -0
- package/src/stock-home/stock-home-detail-card.scss +211 -0
- package/src/stock-home/stock-home-detail-cards.component.tsx +62 -0
- package/src/stock-home/stock-home-inventory-card.component.tsx +80 -0
- package/src/stock-home/stock-home-inventory-expiry.resource.tsx +32 -0
- package/src/stock-home/stock-home-inventory-items.resource.tsx +28 -0
- package/src/stock-home/stock-home-issuing-card.component.tsx +84 -0
- package/src/stock-home/stock-home-issuing.resource.tsx +18 -0
- package/src/stock-home/stock-home-landing-page-component.tsx +14 -0
- package/src/stock-home/stock-home-metrics.tsx +112 -0
- package/src/stock-home/stock-home-receiving-card.component.tsx +66 -0
- package/src/stock-home/stock-home-receiving.resource.tsx +17 -0
- package/src/stock-home/stock-home.scss +13 -0
- package/src/stock-home/useDisposalList.tsx +18 -0
- package/src/stock-home/useStockList.tsx +36 -0
- package/src/stock-items/add-bulk-stock-item/add-stock-items-bulk-import-action-button.component.tsx +26 -0
- package/src/stock-items/add-bulk-stock-item/stock-items-bulk-import.component.tsx +109 -0
- package/src/stock-items/add-bulk-stock-item/stock-items-bulk-import.resource.ts +14 -0
- package/src/stock-items/add-bulk-stock-item/stock-items-bulk-import.scss +0 -0
- package/src/stock-items/add-stock-item/add-stock-action-button.component.tsx +21 -0
- package/src/stock-items/add-stock-item/add-stock-item.component.tsx +84 -0
- package/src/stock-items/add-stock-item/add-stock-item.resource.tsx +36 -0
- package/src/stock-items/add-stock-item/add-stock-item.scss +5 -0
- package/src/stock-items/add-stock-item/batch-information/batch-information.component.tsx +98 -0
- package/src/stock-items/add-stock-item/batch-information/batch-information.resource.tsx +71 -0
- package/src/stock-items/add-stock-item/batch-information/batch-information.scss +0 -0
- package/src/stock-items/add-stock-item/concepts-selector/concepts-selector.component.tsx +79 -0
- package/src/stock-items/add-stock-item/concepts-selector/concepts-selector.resource.tsx +0 -0
- package/src/stock-items/add-stock-item/concepts-selector/concepts-selector.scss +0 -0
- package/src/stock-items/add-stock-item/concepts-selector/concepts-selector.test.tsx +8 -0
- package/src/stock-items/add-stock-item/dispensing-package-measurement/dispensing-package-measurement.component.tsx +76 -0
- package/src/stock-items/add-stock-item/dispensing-unit-selector/dispensing-unit-selector.component.tsx +66 -0
- package/src/stock-items/add-stock-item/dispensing-unit-selector/dispensing-unit-selector.resource.tsx +0 -0
- package/src/stock-items/add-stock-item/dispensing-unit-selector/dispensing-unit-selector.scss +0 -0
- package/src/stock-items/add-stock-item/dispensing-unit-selector/dispensing-unit-selector.test.tsx +8 -0
- package/src/stock-items/add-stock-item/drug-selector/drug-selector.component.tsx +83 -0
- package/src/stock-items/add-stock-item/drug-selector/drug-selector.resource.tsx +50 -0
- package/src/stock-items/add-stock-item/drug-selector/drug-selector.scss +0 -0
- package/src/stock-items/add-stock-item/packaging-units/packaging-units.component.tsx +255 -0
- package/src/stock-items/add-stock-item/packaging-units/packaging-units.resource.tsx +38 -0
- package/src/stock-items/add-stock-item/packaging-units/packaging-units.scss +21 -0
- package/src/stock-items/add-stock-item/packaging-units/validationSchema.ts +14 -0
- package/src/stock-items/add-stock-item/packaging-units-concept-selector/packaging-units-concept-selector.component.tsx +95 -0
- package/src/stock-items/add-stock-item/preferred-vendor-selector/preferred-vendor-selector.component.tsx +70 -0
- package/src/stock-items/add-stock-item/preferred-vendor-selector/preferred-vendor-selector.resource.tsx +0 -0
- package/src/stock-items/add-stock-item/preferred-vendor-selector/preferred-vendor-selector.scss +0 -0
- package/src/stock-items/add-stock-item/preferred-vendor-selector/preferred-vendor-selector.test.tsx +8 -0
- package/src/stock-items/add-stock-item/quantities/quantities.component.tsx +83 -0
- package/src/stock-items/add-stock-item/quantities/quantities.resource.tsx +69 -0
- package/src/stock-items/add-stock-item/quantities/quantities.scss +0 -0
- package/src/stock-items/add-stock-item/stock-item-category-selector/stock-item-category-selector.component.tsx +67 -0
- package/src/stock-items/add-stock-item/stock-item-category-selector/stock-item-category-selector.resource.tsx +0 -0
- package/src/stock-items/add-stock-item/stock-item-category-selector/stock-item-category-selector.scss +0 -0
- package/src/stock-items/add-stock-item/stock-item-category-selector/stock-item-category-selector.test.tsx +8 -0
- package/src/stock-items/add-stock-item/stock-item-details/stock-item-details.component.tsx +239 -0
- package/src/stock-items/add-stock-item/stock-item-details/stock-item-details.resource.tsx +14 -0
- package/src/stock-items/add-stock-item/stock-item-details/stock-item-details.scss +13 -0
- package/src/stock-items/add-stock-item/stock-item-rules/add-stock-rule-button.component.tsx +30 -0
- package/src/stock-items/add-stock-item/stock-item-rules/add-stock-rules.component.tsx +424 -0
- package/src/stock-items/add-stock-item/stock-item-rules/add-stock-rules.scss +18 -0
- package/src/stock-items/add-stock-item/stock-item-rules/delete-stock-rule-modal.component.tsx +47 -0
- package/src/stock-items/add-stock-item/stock-item-rules/edit-stock-rule.component.tsx +37 -0
- package/src/stock-items/add-stock-item/stock-item-rules/edit-stock-rule.scss +0 -0
- package/src/stock-items/add-stock-item/stock-item-rules/stock-item-rules.component.tsx +222 -0
- package/src/stock-items/add-stock-item/stock-item-rules/stock-item-rules.resource.tsx +72 -0
- package/src/stock-items/add-stock-item/stock-item-rules/stock-item-rules.scss +13 -0
- package/src/stock-items/add-stock-item/stock-item-rules/stock-rules-delete.component.tsx +67 -0
- package/src/stock-items/add-stock-item/stock-item-rules/stock-rules-delete.scss +0 -0
- package/src/stock-items/add-stock-item/stock-item-rules/stock-rules-filter.component.tsx +38 -0
- package/src/stock-items/add-stock-item/stock-item-rules/stock-rules-filter.scss +13 -0
- package/src/stock-items/add-stock-item/stock-item-rules/stock-rules.resource.ts +79 -0
- package/src/stock-items/add-stock-item/stock-item-units-edit/stock-item-units-edit.component.tsx +132 -0
- package/src/stock-items/add-stock-item/stock-rules/stock-rules.component.tsx +16 -0
- package/src/stock-items/add-stock-item/stock-rules/stock-rules.resource.tsx +0 -0
- package/src/stock-items/add-stock-item/stock-rules/stock-rules.scss +0 -0
- package/src/stock-items/add-stock-item/transactions/transactions.component.tsx +151 -0
- package/src/stock-items/add-stock-item/transactions/transactions.resource.tsx +109 -0
- package/src/stock-items/add-stock-item/transactions/transactions.scss +0 -0
- package/src/stock-items/components/filter-stock-items/filter-stock-items.component.tsx +28 -0
- package/src/stock-items/components/filter-stock-items/filter-stock-items.resource.tsx +0 -0
- package/src/stock-items/components/filter-stock-items/filter-stock-items.scss +3 -0
- package/src/stock-items/edit-stock-item/edit-stock-item-action-menu.component.tsx +30 -0
- package/src/stock-items/stock-item.utils.tsx +62 -0
- package/src/stock-items/stock-items-table.component.tsx +266 -0
- package/src/stock-items/stock-items-table.resource.ts +58 -0
- package/src/stock-items/stock-items-table.scss +66 -0
- package/src/stock-items/stock-items.component.tsx +12 -0
- package/src/stock-items/stock-items.resource.ts +365 -0
- package/src/stock-items/types.ts +8 -0
- package/src/stock-items/validationSchema.ts +67 -0
- package/src/stock-locations/stock-locations-table.component.tsx +69 -0
- package/src/stock-locations/stock-locations-table.resource.tsx +73 -0
- package/src/stock-locations/stock-locations-table.scss +0 -0
- package/src/stock-locations/stock-locations.component.tsx +12 -0
- package/src/stock-locations/stock-locations.resource.ts +0 -0
- package/src/stock-lookups/stock-lookups.resource.ts +306 -0
- package/src/stock-management-admin-card-link.component.tsx +29 -0
- package/src/stock-management-header/stock-management-Illustration.tsx +35 -0
- package/src/stock-management-header/stock-management-header.component.tsx +37 -0
- package/src/stock-management-header/stock-management-header.scss +58 -0
- package/src/stock-management.component.tsx +6 -0
- package/src/stock-operations/add-stock-operation/add-stock-operation.component.tsx +491 -0
- package/src/stock-operations/add-stock-operation/add-stock-operation.resource.tsx +33 -0
- package/src/stock-operations/add-stock-operation/add-stock-operation.scss +44 -0
- package/src/stock-operations/add-stock-operation/add-stock-operation.utils.tsx +241 -0
- package/src/stock-operations/add-stock-operation/add-stock-utils.ts +110 -0
- package/src/stock-operations/add-stock-operation/base-operation-details.component.tsx +352 -0
- package/src/stock-operations/add-stock-operation/stock-items-addition-row.component.tsx +347 -0
- package/src/stock-operations/add-stock-operation/stock-items-addition-row.resource.tsx +0 -0
- package/src/stock-operations/add-stock-operation/stock-items-addition-row.scss +0 -0
- package/src/stock-operations/add-stock-operation/stock-items-addition-row.test.tsx +11 -0
- package/src/stock-operations/add-stock-operation/stock-items-addition.component.scss +5 -0
- package/src/stock-operations/add-stock-operation/stock-items-addition.component.tsx +272 -0
- package/src/stock-operations/add-stock-operation/stock-operation-context/useStockOperationContext.tsx +22 -0
- package/src/stock-operations/add-stock-operation/stock-operation-submission.component.tsx +188 -0
- package/src/stock-operations/add-stock-operation/types.ts +55 -0
- package/src/stock-operations/add-stock-operation/validationSchema.ts +45 -0
- package/src/stock-operations/batch-no-selector/batch-no-selector.component.tsx +100 -0
- package/src/stock-operations/batch-no-selector/batch-no-selector.resource.tsx +46 -0
- package/src/stock-operations/batch-no-selector/batch-no-selector.scss +0 -0
- package/src/stock-operations/batch-no-selector/batch-no-selector.test.tsx +11 -0
- package/src/stock-operations/edit-stock-operation/edit-stock-operation-action-menu.component.tsx +73 -0
- package/src/stock-operations/party-selector/party-selector.component.tsx +58 -0
- package/src/stock-operations/qty-uom-selector/qty-uom-selector.component.tsx +65 -0
- package/src/stock-operations/qty-uom-selector/qty-uom-selector.resource.tsx +0 -0
- package/src/stock-operations/qty-uom-selector/qty-uom-selector.scss +0 -0
- package/src/stock-operations/qty-uom-selector/qty-uom-selector.test.tsx +11 -0
- package/src/stock-operations/stock-item-selector/stock-item-selector.component.tsx +74 -0
- package/src/stock-operations/stock-item-selector/stock-item-selector.resource.tsx +47 -0
- package/src/stock-operations/stock-item-selector/stock-item-selector.scss +0 -0
- package/src/stock-operations/stock-item-selector/stock-item-selector.test.tsx +11 -0
- package/src/stock-operations/stock-operation-operations-filter/stock-operation-operations-filter.component.tsx +27 -0
- package/src/stock-operations/stock-operation-operations-filter/stock-operation-operations-filter.scss +13 -0
- package/src/stock-operations/stock-operation-reason-selector/stock-operation-reason-selector.component.tsx +65 -0
- package/src/stock-operations/stock-operation-sources-filter/stock-operation-sources-filter.component.tsx +30 -0
- package/src/stock-operations/stock-operation-sources-filter/stock-operation-sources-filter.scss +13 -0
- package/src/stock-operations/stock-operation-statuses-filter/stock-operation-statuses-filter.component.tsx +32 -0
- package/src/stock-operations/stock-operation-statuses-filter/stock-operation-statuses-filter.scss +13 -0
- package/src/stock-operations/stock-operation-types-selector/stock-operation-types-selector.component.tsx +80 -0
- package/src/stock-operations/stock-operation.utils.tsx +106 -0
- package/src/stock-operations/stock-operations-dialog/stock-operations-approve-button.component.tsx +36 -0
- package/src/stock-operations/stock-operations-dialog/stock-operations-approve-dispatch-button.component.tsx +36 -0
- package/src/stock-operations/stock-operations-dialog/stock-operations-cancel-button.component.tsx +37 -0
- package/src/stock-operations/stock-operations-dialog/stock-operations-complete-button.component.tsx +36 -0
- package/src/stock-operations/stock-operations-dialog/stock-operations-completed-dispatch-button.component.tsx +36 -0
- package/src/stock-operations/stock-operations-dialog/stock-operations-dialog.component.tsx +167 -0
- package/src/stock-operations/stock-operations-dialog/stock-operations-dialog.scss +14 -0
- package/src/stock-operations/stock-operations-dialog/stock-operations-issue-stock-button.component.tsx +58 -0
- package/src/stock-operations/stock-operations-dialog/stock-operations-print-button.component.tsx +160 -0
- package/src/stock-operations/stock-operations-dialog/stock-operations-reject-button.component.tsx +37 -0
- package/src/stock-operations/stock-operations-dialog/stock-operations-return-button.component.tsx +37 -0
- package/src/stock-operations/stock-operations-table.component.tsx +524 -0
- package/src/stock-operations/stock-operations-table.resource.tsx +77 -0
- package/src/stock-operations/stock-operations-table.scss +0 -0
- package/src/stock-operations/stock-operations.component.tsx +12 -0
- package/src/stock-operations/stock-operations.resource.ts +238 -0
- package/src/stock-operations/stock-print-reports/GoodsReceivedNote.tsx +147 -0
- package/src/stock-operations/stock-print-reports/RequisitionDocument.tsx +153 -0
- package/src/stock-operations/stock-print-reports/StockOperationReport.tsx +133 -0
- package/src/stock-operations/stock-print-reports/StockTransferDocument.tsx +161 -0
- package/src/stock-operations/swr-revalidation.ts +7 -0
- package/src/stock-operations/users-selector/users-selector.component.tsx +77 -0
- package/src/stock-operations/users-selector/users-selector.resource.tsx +47 -0
- package/src/stock-operations/validation-schema.ts +195 -0
- package/src/stock-reports/ReportType.ts +63 -0
- package/src/stock-reports/stock-reports.component.tsx +0 -0
- package/src/stock-reports/stock-reports.resource.ts +0 -0
- package/src/stock-settings/stock-settings.component.tsx +11 -0
- package/src/stock-settings/stock-settings.resource.ts +0 -0
- package/src/stock-sources/add-stock-source-button.component.tsx +21 -0
- package/src/stock-sources/add-stock-sources/add-stock-sources.component.tsx +152 -0
- package/src/stock-sources/add-stock-sources/add-stock-sources.scss +18 -0
- package/src/stock-sources/delete-stock-modal.component.tsx +47 -0
- package/src/stock-sources/edit-stock-source/edit-stock-source.component.tsx +35 -0
- package/src/stock-sources/edit-stock-source/edit-stock-source.scss +0 -0
- package/src/stock-sources/stock-sources-delete/stock-sources-delate.scss +0 -0
- package/src/stock-sources/stock-sources-delete/stock-sources-delete.component.tsx +72 -0
- package/src/stock-sources/stock-sources-filter/stock-sources-filter.component.tsx +35 -0
- package/src/stock-sources/stock-sources-filter/stock-sources-filter.scss +13 -0
- package/src/stock-sources/stock-sources-items-table.component.tsx +213 -0
- package/src/stock-sources/stock-sources-items-table.resource.ts +56 -0
- package/src/stock-sources/stock-sources.component.tsx +12 -0
- package/src/stock-sources/stock-sources.resource.ts +80 -0
- package/src/stock-sources/stock-sources.scss +220 -0
- package/src/stock-sources/swr-revalidation.ts +7 -0
- package/src/stock-tabs/commodity-tabs.component.tsx +43 -0
- package/src/stock-tabs/commodity-tabs.scss +0 -0
- package/src/stock-user-role-scopes/add-stock-user-role-scope-button.component.tsx +21 -0
- package/src/stock-user-role-scopes/add-stock-user-scope/add-stock-user-role-scope.component.tsx +525 -0
- package/src/stock-user-role-scopes/add-stock-user-scope/add-stock-user-role-scope.scss +37 -0
- package/src/stock-user-role-scopes/delete-stock-user-scope/delete-stock-user-scope.component.tsx +73 -0
- package/src/stock-user-role-scopes/delete-stock-user-scope/delete-stock-user-scope.scss +0 -0
- package/src/stock-user-role-scopes/delete-stock-user-scope-modal.component.tsx +47 -0
- package/src/stock-user-role-scopes/edit-stock-user-scope/edit-stock-user-scope-action-menu.component.tsx +35 -0
- package/src/stock-user-role-scopes/stock-user-role-scopes-items-table.component.tsx +284 -0
- package/src/stock-user-role-scopes/stock-user-role-scopes-items-table.resource.ts +31 -0
- package/src/stock-user-role-scopes/stock-user-role-scopes.component.tsx +12 -0
- package/src/stock-user-role-scopes/stock-user-role-scopes.resource.ts +76 -0
- package/src/stock-user-role-scopes/stock-user-role-scopes.scss +61 -0
- package/src/stock-user-role-scopes/swr-revalidation.ts +7 -0
- package/src/utils.ts +10 -0
- package/translations/en.json +24 -0
- package/tsconfig.json +23 -0
- package/webpack.config.js +1 -0
@@ -0,0 +1,40 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import { Control, Controller, FieldValues } from "react-hook-form";
|
3
|
+
import {
|
4
|
+
DropdownProps,
|
5
|
+
OnChangeData,
|
6
|
+
} from "@carbon/react/lib/components/Dropdown/Dropdown";
|
7
|
+
import { TextInput } from "@carbon/react";
|
8
|
+
|
9
|
+
interface ControlledDropdownProps<T, K> extends DropdownProps<K> {
|
10
|
+
controllerName: string;
|
11
|
+
name: string;
|
12
|
+
control: Control<FieldValues, T>;
|
13
|
+
}
|
14
|
+
|
15
|
+
const ControlledDropdown = <T, K>(props: ControlledDropdownProps<T, K>) => {
|
16
|
+
return (
|
17
|
+
<Controller
|
18
|
+
name={props.controllerName}
|
19
|
+
control={props.control}
|
20
|
+
render={({ field: { onChange, value, ref } }) => (
|
21
|
+
<TextInput
|
22
|
+
{...props}
|
23
|
+
onChange={(e: OnChangeData<K>) => {
|
24
|
+
onChange(e);
|
25
|
+
|
26
|
+
// Fire prop change
|
27
|
+
if (props.onChange) {
|
28
|
+
props.onChange(e);
|
29
|
+
}
|
30
|
+
}}
|
31
|
+
id={props.name}
|
32
|
+
ref={ref}
|
33
|
+
value={value}
|
34
|
+
/>
|
35
|
+
)}
|
36
|
+
/>
|
37
|
+
);
|
38
|
+
};
|
39
|
+
|
40
|
+
export default ControlledDropdown;
|
File without changes
|
File without changes
|
package/src/core/components/carbon/controlled-number-input/controlled-number-input.component.tsx
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import { Control, Controller, FieldValues } from "react-hook-form";
|
3
|
+
import { NumberInputProps } from "@carbon/react/lib/components/NumberInput/NumberInput";
|
4
|
+
import { NumberInput } from "@carbon/react";
|
5
|
+
import { StockItemPackagingUOMDTO } from "../../../api/types/stockItem/StockItemPackagingUOM";
|
6
|
+
|
7
|
+
interface ControlledNumberInputProps<T> extends NumberInputProps {
|
8
|
+
row?: StockItemPackagingUOMDTO;
|
9
|
+
controllerName: string;
|
10
|
+
name: string;
|
11
|
+
control: Control<FieldValues, T>;
|
12
|
+
}
|
13
|
+
|
14
|
+
const ControlledNumberInput = <T,>(props: ControlledNumberInputProps<T>) => {
|
15
|
+
return (
|
16
|
+
<Controller
|
17
|
+
name={props.controllerName}
|
18
|
+
control={props.control}
|
19
|
+
render={({ field: { onChange, value, ref } }) => (
|
20
|
+
<NumberInput
|
21
|
+
id={`${props.name}-${props.row?.id}-${props.row?.uuid}`}
|
22
|
+
value={props.row?.factor ?? value}
|
23
|
+
ref={ref}
|
24
|
+
onChange={(
|
25
|
+
event: React.MouseEvent<HTMLButtonElement>,
|
26
|
+
state: {
|
27
|
+
value: number | string;
|
28
|
+
direction: string;
|
29
|
+
}
|
30
|
+
) => {
|
31
|
+
onChange(event, state);
|
32
|
+
|
33
|
+
// Fire prop change if props.onChange is defined
|
34
|
+
if (props.onChange) {
|
35
|
+
props.onChange(event, state);
|
36
|
+
}
|
37
|
+
}}
|
38
|
+
/>
|
39
|
+
)}
|
40
|
+
/>
|
41
|
+
);
|
42
|
+
};
|
43
|
+
|
44
|
+
export default ControlledNumberInput;
|
package/src/core/components/carbon/controlled-number-input/controlled-number-input.resource.tsx
ADDED
File without changes
|
File without changes
|
@@ -0,0 +1,54 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import { RadioButtonGroupProps } from "@carbon/react/lib/components/RadioButtonGroup/RadioButtonGroup";
|
3
|
+
import { Control, Controller, FieldValues } from "react-hook-form";
|
4
|
+
import { RadioButtonGroup, RadioButton } from "@carbon/react";
|
5
|
+
import { RadioOption } from "../../../../stock-items/add-stock-item/stock-item-details/stock-item-details.resource";
|
6
|
+
|
7
|
+
interface ControlledRadioButtonGroupProps<T> extends RadioButtonGroupProps {
|
8
|
+
controllerName: string;
|
9
|
+
name: string;
|
10
|
+
control: Control<FieldValues, T>;
|
11
|
+
options: RadioOption[]; // Change the type to RadioOption[]
|
12
|
+
}
|
13
|
+
|
14
|
+
const ControlledRadioButtonGroup = <T,>(
|
15
|
+
props: ControlledRadioButtonGroupProps<T>
|
16
|
+
) => {
|
17
|
+
return (
|
18
|
+
<Controller
|
19
|
+
name={props.controllerName}
|
20
|
+
control={props.control}
|
21
|
+
render={({ field: { onChange, value, ref } }) => (
|
22
|
+
<RadioButtonGroup
|
23
|
+
{...props}
|
24
|
+
onChange={(selection: boolean, name: string, event: unknown) => {
|
25
|
+
onChange(selection, name, event);
|
26
|
+
|
27
|
+
// Fire prop change
|
28
|
+
if (props.onChange) {
|
29
|
+
props.onChange(selection, name, event);
|
30
|
+
}
|
31
|
+
}}
|
32
|
+
id={props.name}
|
33
|
+
ref={ref}
|
34
|
+
defaultSelected={props.id}
|
35
|
+
value={value}
|
36
|
+
>
|
37
|
+
{props.options.map((option, index) => (
|
38
|
+
<RadioButton
|
39
|
+
key={`${index}-${props.name}-${option.value}`}
|
40
|
+
id={`${props.name}-${option.value}`}
|
41
|
+
labelText={option.label}
|
42
|
+
value={option.value}
|
43
|
+
checked={value === option.value}
|
44
|
+
onChange={() => onChange(option.value)}
|
45
|
+
ref={ref}
|
46
|
+
/>
|
47
|
+
))}
|
48
|
+
</RadioButtonGroup>
|
49
|
+
)}
|
50
|
+
/>
|
51
|
+
);
|
52
|
+
};
|
53
|
+
|
54
|
+
export default ControlledRadioButtonGroup;
|
File without changes
|
package/src/core/components/carbon/controlled-radio-button-group/controlled-radio-button-group.scss
ADDED
File without changes
|
@@ -0,0 +1,37 @@
|
|
1
|
+
import React, { ChangeEvent } from "react";
|
2
|
+
import { Control, Controller, FieldValues } from "react-hook-form";
|
3
|
+
import { TextAreaProps } from "@carbon/react/lib/components/TextArea/TextArea";
|
4
|
+
import { TextArea } from "@carbon/react";
|
5
|
+
|
6
|
+
interface ControlledTextAreaProps<T> extends TextAreaProps {
|
7
|
+
controllerName: string;
|
8
|
+
name: string;
|
9
|
+
control: Control<FieldValues, T>;
|
10
|
+
}
|
11
|
+
|
12
|
+
const ControlledTextArea = <T,>(props: ControlledTextAreaProps<T>) => {
|
13
|
+
return (
|
14
|
+
<Controller
|
15
|
+
name={props.controllerName}
|
16
|
+
control={props.control}
|
17
|
+
render={({ field: { onChange, value, ref } }) => (
|
18
|
+
<TextArea
|
19
|
+
{...props}
|
20
|
+
onChange={(e: ChangeEvent<HTMLTextAreaElement>) => {
|
21
|
+
onChange(e.target.value);
|
22
|
+
|
23
|
+
// Fire prop change
|
24
|
+
if (props.onChange) {
|
25
|
+
props.onChange(e);
|
26
|
+
}
|
27
|
+
}}
|
28
|
+
id={props.name}
|
29
|
+
ref={ref}
|
30
|
+
value={value}
|
31
|
+
/>
|
32
|
+
)}
|
33
|
+
/>
|
34
|
+
);
|
35
|
+
};
|
36
|
+
|
37
|
+
export default ControlledTextArea;
|
File without changes
|
File without changes
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import React from "react";
|
2
|
+
|
3
|
+
import { render, cleanup } from "@testing-library/react";
|
4
|
+
import ControlledTextArea from "./controlled-text-area.component";
|
5
|
+
|
6
|
+
describe("Test the controlled text area", () => {
|
7
|
+
afterEach(cleanup);
|
8
|
+
it(`renders without dying`, () => {
|
9
|
+
// render(<ControlledTextArea />);
|
10
|
+
});
|
11
|
+
});
|
@@ -0,0 +1,37 @@
|
|
1
|
+
import React, { ChangeEvent } from "react";
|
2
|
+
import { Control, Controller, FieldValues } from "react-hook-form";
|
3
|
+
import { TextInput } from "@carbon/react";
|
4
|
+
import { TextInputProps } from "@carbon/react/lib/components/TextInput/TextInput";
|
5
|
+
|
6
|
+
interface ControlledTextInputProps<T> extends TextInputProps {
|
7
|
+
controllerName: string;
|
8
|
+
name: string;
|
9
|
+
control: Control<FieldValues, T>;
|
10
|
+
}
|
11
|
+
|
12
|
+
const ControlledTextInput = <T,>(props: ControlledTextInputProps<T>) => {
|
13
|
+
return (
|
14
|
+
<Controller
|
15
|
+
name={props.controllerName}
|
16
|
+
control={props.control}
|
17
|
+
render={({ field: { onChange, value, ref } }) => (
|
18
|
+
<TextInput
|
19
|
+
{...props}
|
20
|
+
onChange={(e: ChangeEvent<HTMLInputElement>) => {
|
21
|
+
onChange(e.target.value);
|
22
|
+
|
23
|
+
// Fire prop change
|
24
|
+
if (props.onChange) {
|
25
|
+
props.onChange(e);
|
26
|
+
}
|
27
|
+
}}
|
28
|
+
id={props.name}
|
29
|
+
ref={ref}
|
30
|
+
value={value}
|
31
|
+
/>
|
32
|
+
)}
|
33
|
+
/>
|
34
|
+
);
|
35
|
+
};
|
36
|
+
|
37
|
+
export default ControlledTextInput;
|
File without changes
|
File without changes
|
@@ -0,0 +1,102 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import { useTranslation } from "react-i18next";
|
3
|
+
import { Tile } from "@carbon/react";
|
4
|
+
import { ArrowRight } from "@carbon/react/icons";
|
5
|
+
import styles from "./metrics-card.scss";
|
6
|
+
import { ConfigurableLink } from "@openmrs/esm-framework";
|
7
|
+
import isEmpty from "lodash-es/isEmpty";
|
8
|
+
import dayjs from "dayjs";
|
9
|
+
import isSameOrBefore from "dayjs/plugin/isSameOrBefore";
|
10
|
+
dayjs.extend(isSameOrBefore);
|
11
|
+
|
12
|
+
interface MetricsCardProps {
|
13
|
+
label: string;
|
14
|
+
value: number;
|
15
|
+
headerLabel: string;
|
16
|
+
children?: React.ReactNode;
|
17
|
+
view: string;
|
18
|
+
count?: { expiry7days: Array<any>; expiry30days: Array<any> };
|
19
|
+
outofstockCount?: { itemsbelowmin: Array<any>; itemsabovemax: Array<any> };
|
20
|
+
disposedCount?: { expired: Array<any>; poorquality: Array<any> };
|
21
|
+
}
|
22
|
+
const MetricsCard: React.FC<MetricsCardProps> = ({
|
23
|
+
label,
|
24
|
+
value,
|
25
|
+
headerLabel,
|
26
|
+
children,
|
27
|
+
view,
|
28
|
+
count,
|
29
|
+
outofstockCount,
|
30
|
+
disposedCount,
|
31
|
+
}) => {
|
32
|
+
const { t } = useTranslation();
|
33
|
+
|
34
|
+
return (
|
35
|
+
<Tile className={styles.tileContainer}>
|
36
|
+
<div className={styles.tileHeader}>
|
37
|
+
<div className={styles.headerLabelContainer}>
|
38
|
+
<label className={styles.headerLabel}>{headerLabel}</label>
|
39
|
+
{children}
|
40
|
+
</div>
|
41
|
+
{view && (
|
42
|
+
<ConfigurableLink
|
43
|
+
className={styles.link}
|
44
|
+
to={`\${openmrsSpaBase}/stock-management/orders`}
|
45
|
+
>
|
46
|
+
<span style={{ fontSize: "0.825rem", marginRight: "0.325rem" }}>
|
47
|
+
{t("view", "View")}
|
48
|
+
</span>{" "}
|
49
|
+
<ArrowRight size={16} className={styles.viewListBtn} />
|
50
|
+
</ConfigurableLink>
|
51
|
+
)}
|
52
|
+
</div>
|
53
|
+
<div className={styles.metricsGrid}>
|
54
|
+
<div>
|
55
|
+
<label className={styles.totalsLabel}>{label}</label>
|
56
|
+
<p className={styles.totalsValue}>{value}</p>
|
57
|
+
</div>
|
58
|
+
{!isEmpty(count) && (
|
59
|
+
<div className={styles.countGrid}>
|
60
|
+
<span style={{ color: "#DA1E28" }}>
|
61
|
+
{t("in7days", "In 7 days")}
|
62
|
+
</span>
|
63
|
+
<span style={{ color: " #FABA5F" }}>
|
64
|
+
{t("in30days", "In 30 days")}
|
65
|
+
</span>
|
66
|
+
<p style={{ color: "#DA1E28" }}>{count.expiry7days?.length}</p>
|
67
|
+
<p style={{ color: "#FABA5F" }}>{count.expiry30days?.length}</p>
|
68
|
+
</div>
|
69
|
+
)}
|
70
|
+
{!isEmpty(outofstockCount) && (
|
71
|
+
<div className={styles.countGrid}>
|
72
|
+
<span style={{ color: "#DA1E28" }}>
|
73
|
+
{t("itemsbelowmin", "Items Below Min")}
|
74
|
+
</span>
|
75
|
+
<span style={{ color: "#319227" }}>
|
76
|
+
{t("itemsabovemax", "Items Above Max")}
|
77
|
+
</span>
|
78
|
+
<p style={{ color: "#DA1E28" }}>
|
79
|
+
{outofstockCount.itemsbelowmin?.length}
|
80
|
+
</p>
|
81
|
+
<p style={{ color: "#319227" }}>
|
82
|
+
{outofstockCount.itemsabovemax?.length}
|
83
|
+
</p>
|
84
|
+
</div>
|
85
|
+
)}
|
86
|
+
{!isEmpty(disposedCount) && (
|
87
|
+
<div className={styles.countGrid}>
|
88
|
+
<span style={{ color: "#DA1E28" }}>{t("expired", "Expired")}</span>
|
89
|
+
<span style={{ color: "#FABA5F" }}>
|
90
|
+
{t("poorquality", "Poor Quality")}
|
91
|
+
</span>
|
92
|
+
<p style={{ color: "#DA1E28" }}>{disposedCount.expired?.length}</p>
|
93
|
+
<p style={{ color: "#FABA5F" }}>
|
94
|
+
{disposedCount.poorquality?.length}
|
95
|
+
</p>
|
96
|
+
</div>
|
97
|
+
)}
|
98
|
+
</div>
|
99
|
+
</Tile>
|
100
|
+
);
|
101
|
+
};
|
102
|
+
export default MetricsCard;
|
@@ -0,0 +1,78 @@
|
|
1
|
+
@use '@carbon/styles/scss/spacing';
|
2
|
+
@use '@carbon/styles/scss/type';
|
3
|
+
@use '@carbon/colors';
|
4
|
+
@import '~@openmrs/esm-styleguide/src/vars';
|
5
|
+
.tileContainer {
|
6
|
+
border: 0.0625rem solid $ui-03;
|
7
|
+
flex-grow: 1;
|
8
|
+
height: 7.875rem;
|
9
|
+
padding: 0 spacing.$spacing-04;
|
10
|
+
background-color: colors.$white;
|
11
|
+
display: flex;
|
12
|
+
flex-direction: column;
|
13
|
+
justify-content: space-between;
|
14
|
+
margin-bottom: 20px;
|
15
|
+
|
16
|
+
}
|
17
|
+
.tileHeader {
|
18
|
+
display: flex;
|
19
|
+
justify-content: space-between;
|
20
|
+
align-items: center;
|
21
|
+
margin-bottom: spacing.$spacing-03;
|
22
|
+
}
|
23
|
+
.headerLabel {
|
24
|
+
@include type.type-style('label-02');
|
25
|
+
color: colors.$gray-70;
|
26
|
+
}
|
27
|
+
.totalsLabel {
|
28
|
+
@include type.type-style('label-01');
|
29
|
+
color: $text-02;
|
30
|
+
}
|
31
|
+
.totalsValue {
|
32
|
+
@include type.type-style('heading-04');
|
33
|
+
color: $ui-05;
|
34
|
+
}
|
35
|
+
.headerLabelContainer {
|
36
|
+
display: flex;
|
37
|
+
align-items: center;
|
38
|
+
height: spacing.$spacing-07;
|
39
|
+
justify-content: space-between;
|
40
|
+
width: 100%;
|
41
|
+
}
|
42
|
+
.link {
|
43
|
+
text-decoration: none;
|
44
|
+
display: flex;
|
45
|
+
align-items: flex-end;
|
46
|
+
}
|
47
|
+
.metricsGrid {
|
48
|
+
display: grid;
|
49
|
+
grid-template-columns: 1fr 1fr;
|
50
|
+
}
|
51
|
+
.countGrid {
|
52
|
+
display: grid;
|
53
|
+
grid-template-columns: 1fr 1fr;
|
54
|
+
justify-self: flex-end;
|
55
|
+
column-gap: spacing.$spacing-03;
|
56
|
+
& > span {
|
57
|
+
font-size: 0.625rem !important;
|
58
|
+
margin: 0;
|
59
|
+
color: colors.$gray-70;
|
60
|
+
}
|
61
|
+
& > p {
|
62
|
+
margin: 0;
|
63
|
+
}
|
64
|
+
}
|
65
|
+
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
|
@@ -0,0 +1,47 @@
|
|
1
|
+
import { getGlobalStore } from "@openmrs/esm-framework";
|
2
|
+
import { useEffect, useState } from "react";
|
3
|
+
|
4
|
+
interface OverlayStore {
|
5
|
+
isOverlayOpen: boolean;
|
6
|
+
component?: any;
|
7
|
+
header: string;
|
8
|
+
}
|
9
|
+
|
10
|
+
const initialState = { isOverlayOpen: false, component: Function, header: "" };
|
11
|
+
|
12
|
+
const getOverlayStore = () => {
|
13
|
+
return getGlobalStore("dispensing-store", initialState);
|
14
|
+
};
|
15
|
+
|
16
|
+
export const launchOverlay = (headerTitle: string, componentToRender) => {
|
17
|
+
const store = getOverlayStore();
|
18
|
+
store.setState({
|
19
|
+
isOverlayOpen: true,
|
20
|
+
component: componentToRender,
|
21
|
+
header: headerTitle,
|
22
|
+
});
|
23
|
+
};
|
24
|
+
|
25
|
+
export const closeOverlay = () => {
|
26
|
+
const store = getOverlayStore();
|
27
|
+
store.setState({ component: null, isOverlayOpen: false });
|
28
|
+
};
|
29
|
+
|
30
|
+
export const useOverlay = () => {
|
31
|
+
const [overlay, setOverlay] = useState<OverlayStore>();
|
32
|
+
|
33
|
+
useEffect(() => {
|
34
|
+
function update(state: OverlayStore) {
|
35
|
+
setOverlay(state);
|
36
|
+
}
|
37
|
+
|
38
|
+
update(getOverlayStore().getState());
|
39
|
+
getOverlayStore().subscribe(update);
|
40
|
+
}, []);
|
41
|
+
|
42
|
+
return {
|
43
|
+
isOverlayOpen: overlay?.isOverlayOpen,
|
44
|
+
component: overlay?.component,
|
45
|
+
header: overlay?.header,
|
46
|
+
};
|
47
|
+
};
|
@@ -0,0 +1,52 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import { Button, Header } from "@carbon/react";
|
3
|
+
import { ArrowLeft, Close } from "@carbon/react/icons";
|
4
|
+
import { useLayoutType } from "@openmrs/esm-framework";
|
5
|
+
import styles from "./overlay.scss";
|
6
|
+
import { useTranslation } from "react-i18next";
|
7
|
+
import { closeOverlay, useOverlay } from "./hook";
|
8
|
+
|
9
|
+
const Overlay: React.FC = () => {
|
10
|
+
const { header, component, isOverlayOpen } = useOverlay();
|
11
|
+
const layout = useLayoutType();
|
12
|
+
const { t } = useTranslation();
|
13
|
+
return (
|
14
|
+
<>
|
15
|
+
{isOverlayOpen && (
|
16
|
+
<div
|
17
|
+
className={
|
18
|
+
layout !== "tablet" ? styles.desktopOverlay : styles.tabletOverlay
|
19
|
+
}
|
20
|
+
>
|
21
|
+
{layout !== "tablet" ? (
|
22
|
+
<div className={styles.desktopHeader}>
|
23
|
+
<div className={styles.headerContent}>{header}</div>
|
24
|
+
<Button
|
25
|
+
className={styles.closePanelButton}
|
26
|
+
onClick={() => closeOverlay()}
|
27
|
+
kind="ghost"
|
28
|
+
hasIconOnly
|
29
|
+
>
|
30
|
+
<Close size={16} />
|
31
|
+
</Button>
|
32
|
+
</div>
|
33
|
+
) : (
|
34
|
+
<Header
|
35
|
+
onClick={() => closeOverlay()}
|
36
|
+
aria-label={t("tabletOverlay", "Tablet overlay")}
|
37
|
+
className={styles.tabletOverlayHeader}
|
38
|
+
>
|
39
|
+
<Button hasIconOnly>
|
40
|
+
<ArrowLeft size={16} />
|
41
|
+
</Button>
|
42
|
+
<div className={styles.headerContent}>{header}</div>
|
43
|
+
</Header>
|
44
|
+
)}
|
45
|
+
<div>{component}</div>
|
46
|
+
</div>
|
47
|
+
)}
|
48
|
+
</>
|
49
|
+
);
|
50
|
+
};
|
51
|
+
|
52
|
+
export default Overlay;
|
@@ -0,0 +1,97 @@
|
|
1
|
+
@use '@carbon/styles/scss/spacing';
|
2
|
+
@use '@carbon/styles/scss/type';
|
3
|
+
@import '~@openmrs/esm-styleguide/src/vars';
|
4
|
+
|
5
|
+
.desktopOverlay {
|
6
|
+
position: fixed;
|
7
|
+
top: spacing.$spacing-09;
|
8
|
+
width: 100%;
|
9
|
+
right: 0;
|
10
|
+
bottom: 0;
|
11
|
+
border-left: 1px solid $text-03;
|
12
|
+
background-color: white;
|
13
|
+
overflow-y: auto;
|
14
|
+
height: calc(100vh - 3rem);
|
15
|
+
}
|
16
|
+
|
17
|
+
.desktopOverlay::after {
|
18
|
+
height: 100%;
|
19
|
+
border-left: 1px solid $text-03;
|
20
|
+
}
|
21
|
+
|
22
|
+
.tabletOverlay {
|
23
|
+
position: fixed;
|
24
|
+
top: 0;
|
25
|
+
bottom: 0;
|
26
|
+
left: 0;
|
27
|
+
right: 0;
|
28
|
+
z-index: 9999;
|
29
|
+
background-color: $ui-01;
|
30
|
+
overflow-y: scroll;
|
31
|
+
-ms-overflow-style: none;
|
32
|
+
scrollbar-width: none;
|
33
|
+
|
34
|
+
&::-webkit-scrollbar {
|
35
|
+
width: 0;
|
36
|
+
}
|
37
|
+
|
38
|
+
& > div {
|
39
|
+
margin-top: spacing.$spacing-09;
|
40
|
+
}
|
41
|
+
}
|
42
|
+
|
43
|
+
.tabletOverlayHeader {
|
44
|
+
button {
|
45
|
+
@include brand-01(background-color);
|
46
|
+
}
|
47
|
+
|
48
|
+
.headerContent {
|
49
|
+
color: $ui-02;
|
50
|
+
}
|
51
|
+
}
|
52
|
+
|
53
|
+
.desktopHeader {
|
54
|
+
display: flex;
|
55
|
+
justify-content: space-between;
|
56
|
+
align-items: center;
|
57
|
+
background-color: $ui-03;
|
58
|
+
border-bottom: 1px solid $text-03;
|
59
|
+
position: sticky;
|
60
|
+
position: -webkit-sticky;
|
61
|
+
width: 100%;
|
62
|
+
z-index: 1000;
|
63
|
+
top: 0;
|
64
|
+
}
|
65
|
+
|
66
|
+
.headerContent {
|
67
|
+
@include type.type-style('heading-compact-02');
|
68
|
+
padding: 0 spacing.$spacing-05;
|
69
|
+
color: $ui-05;
|
70
|
+
}
|
71
|
+
|
72
|
+
.closeButton {
|
73
|
+
background-color: $ui-background;
|
74
|
+
color: $ui-05;
|
75
|
+
fill: $ui-05;
|
76
|
+
}
|
77
|
+
|
78
|
+
/* Desktop */
|
79
|
+
:global(.omrs-breakpoint-gt-tablet) {
|
80
|
+
.overlayContent {
|
81
|
+
padding: 0 0 0 0;
|
82
|
+
overflow-y: auto;
|
83
|
+
}
|
84
|
+
}
|
85
|
+
|
86
|
+
/* Tablet */
|
87
|
+
:global(.omrs-breakpoint-lt-desktop) {
|
88
|
+
.overlayContent {
|
89
|
+
padding: 0 0 0 0;
|
90
|
+
overflow-y: auto;
|
91
|
+
}
|
92
|
+
}
|
93
|
+
|
94
|
+
/* Combo */
|
95
|
+
:global(.cds--list-box__menu) {
|
96
|
+
z-index: 20000;
|
97
|
+
}
|