@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,65 @@
|
|
1
|
+
import { PrintCss } from "./PrintStyles";
|
2
|
+
import { PRINT_LOGO_TEXT, PRINT_LOGO } from "../../constants";
|
3
|
+
import { GetPrintLogo, PrintLogoData } from "../utils/imageUtils";
|
4
|
+
|
5
|
+
export const GetPrintTemplate = (
|
6
|
+
body: string,
|
7
|
+
title: string | null | undefined,
|
8
|
+
printOnLoad = false,
|
9
|
+
closeAfterPrint = true
|
10
|
+
) => {
|
11
|
+
return `<html>
|
12
|
+
<head>
|
13
|
+
<meta http-equiv=Content-Type content="text/html; charset=utf8">
|
14
|
+
<title>${title ?? ""}</title>
|
15
|
+
<style>
|
16
|
+
${PrintCss}
|
17
|
+
</style>
|
18
|
+
</head>
|
19
|
+
<body onload="${
|
20
|
+
printOnLoad ? "window.print()" : ""
|
21
|
+
}" style='word-wrap:break-word' ${
|
22
|
+
closeAfterPrint ? 'onafterprint="self.close()"' : ""
|
23
|
+
}>
|
24
|
+
${body}
|
25
|
+
</body>
|
26
|
+
</html>`;
|
27
|
+
};
|
28
|
+
|
29
|
+
export const GetLogoSection = async () => {
|
30
|
+
let printLogoData: PrintLogoData | null = null;
|
31
|
+
if (PRINT_LOGO) {
|
32
|
+
try {
|
33
|
+
printLogoData = await GetPrintLogo();
|
34
|
+
} catch (e) {
|
35
|
+
console.info(e);
|
36
|
+
}
|
37
|
+
}
|
38
|
+
return printLogoData || PRINT_LOGO_TEXT
|
39
|
+
? `
|
40
|
+
<div class="logo" >
|
41
|
+
${
|
42
|
+
printLogoData
|
43
|
+
? printLogoData.isSvg
|
44
|
+
? printLogoData.image
|
45
|
+
: `<img alt='' src='${printLogoData.image}' />`
|
46
|
+
: ""
|
47
|
+
}
|
48
|
+
${
|
49
|
+
PRINT_LOGO_TEXT
|
50
|
+
? `<span class='logo-text text'>${PRINT_LOGO_TEXT}</span>`
|
51
|
+
: ""
|
52
|
+
}
|
53
|
+
</div>
|
54
|
+
`
|
55
|
+
: "";
|
56
|
+
};
|
57
|
+
|
58
|
+
export const GetHeaderSection = async () => {
|
59
|
+
const logoSection = await GetLogoSection();
|
60
|
+
return `
|
61
|
+
<div class="logo-row right">
|
62
|
+
${logoSection}
|
63
|
+
</div>
|
64
|
+
`;
|
65
|
+
};
|
@@ -0,0 +1,19 @@
|
|
1
|
+
const printDocumentInternal = (content: string) => {
|
2
|
+
const newWin = window.open("", "Print-Window");
|
3
|
+
if (newWin) {
|
4
|
+
newWin.document.open();
|
5
|
+
newWin.document.write(content);
|
6
|
+
newWin.document.close();
|
7
|
+
// setTimeout(function () {
|
8
|
+
// if (newWin) {
|
9
|
+
// newWin.close();
|
10
|
+
// }
|
11
|
+
// }, 10);
|
12
|
+
}
|
13
|
+
};
|
14
|
+
|
15
|
+
export const printDocument = (content: string) => {
|
16
|
+
setTimeout(() => {
|
17
|
+
printDocumentInternal(content);
|
18
|
+
}, 300);
|
19
|
+
};
|
@@ -0,0 +1,84 @@
|
|
1
|
+
import dayjs from "dayjs";
|
2
|
+
|
3
|
+
export const formatDisplayDate = (
|
4
|
+
date: Date | null | undefined,
|
5
|
+
format?: string
|
6
|
+
) => {
|
7
|
+
return date ? dayjs(date).format(format ?? "DD-MMM-YYYY") : "";
|
8
|
+
};
|
9
|
+
|
10
|
+
export const formatBatchExpiryDate = (
|
11
|
+
date: Date | null | undefined,
|
12
|
+
format?: string
|
13
|
+
) => {
|
14
|
+
return date ? dayjs(date).format(format ?? "YYYY-MMM") : "";
|
15
|
+
};
|
16
|
+
|
17
|
+
export const formatDisplayDateTime = (
|
18
|
+
date: Date | null | undefined,
|
19
|
+
format?: string
|
20
|
+
) => {
|
21
|
+
return date ? dayjs(date).format(format ?? "DD-MMM-YYYY HH:mm") : "";
|
22
|
+
};
|
23
|
+
|
24
|
+
export const DATE_PICKER_FORMAT = "DD/MM/YYYY";
|
25
|
+
export const formatForDatePicker = (date: Date | null | undefined) => {
|
26
|
+
return formatDisplayDate(date, DATE_PICKER_FORMAT);
|
27
|
+
};
|
28
|
+
|
29
|
+
export const today = () => {
|
30
|
+
const date = new Date();
|
31
|
+
return new Date(date.getFullYear(), date.getMonth(), date.getDate());
|
32
|
+
};
|
33
|
+
|
34
|
+
export const DATE_PICKER_CONTROL_FORMAT = "d/m/Y";
|
35
|
+
|
36
|
+
export const isDateAfterToday = (date: Date | null | undefined) => {
|
37
|
+
if (date) {
|
38
|
+
if (typeof date === "string" || date instanceof String) {
|
39
|
+
date = new Date(date);
|
40
|
+
}
|
41
|
+
|
42
|
+
return date.getTime() > today().getTime();
|
43
|
+
}
|
44
|
+
return false;
|
45
|
+
};
|
46
|
+
|
47
|
+
export const ParseDate = (value: string | null | undefined) => {
|
48
|
+
let date = null;
|
49
|
+
try {
|
50
|
+
if (!value) return date;
|
51
|
+
value = value.toLowerCase();
|
52
|
+
if (value.includes("jan")) value = value.replace("jan", "01");
|
53
|
+
else if (value.includes("feb")) value = value.replace("feb", "02");
|
54
|
+
else if (value.includes("mar")) value = value.replace("mar", "03");
|
55
|
+
else if (value.includes("apr")) value = value.replace("apr", "04");
|
56
|
+
else if (value.includes("may")) value = value.replace("may", "05");
|
57
|
+
else if (value.includes("jun")) value = value.replace("jun", "06");
|
58
|
+
else if (value.includes("jul")) value = value.replace("jul", "07");
|
59
|
+
else if (value.includes("aug")) value = value.replace("aug", "08");
|
60
|
+
else if (value.includes("sep")) value = value.replace("sep", "09");
|
61
|
+
else if (value.includes("oct")) value = value.replace("oct", "10");
|
62
|
+
else if (value.includes("nov")) value = value.replace("nov", "11");
|
63
|
+
else if (value.includes("dec")) value = value.replace("dec", "12");
|
64
|
+
value = value.replace(/-/g, "/");
|
65
|
+
let strMonth;
|
66
|
+
if (value!.substring(3, 5).indexOf("0") === 0)
|
67
|
+
strMonth = value!.substring(4, 5);
|
68
|
+
else strMonth = value!.substring(3, 5);
|
69
|
+
const month = parseInt(strMonth) - 1;
|
70
|
+
|
71
|
+
if (value) {
|
72
|
+
date = new Date(
|
73
|
+
parseInt(value!.substring(6, 10)),
|
74
|
+
month,
|
75
|
+
parseInt(value!.substring(0, 2)),
|
76
|
+
0,
|
77
|
+
0
|
78
|
+
);
|
79
|
+
}
|
80
|
+
} catch (e) {
|
81
|
+
// Err
|
82
|
+
}
|
83
|
+
return date;
|
84
|
+
};
|
@@ -0,0 +1,21 @@
|
|
1
|
+
export function debounce<A = unknown, R = void>(
|
2
|
+
fn: (args: A) => R,
|
3
|
+
ms: number
|
4
|
+
): [(args: A) => Promise<R>, () => void] {
|
5
|
+
let timer: NodeJS.Timeout;
|
6
|
+
|
7
|
+
const debouncedFunc = (args: A): Promise<R> =>
|
8
|
+
new Promise((resolve) => {
|
9
|
+
if (timer) {
|
10
|
+
clearTimeout(timer);
|
11
|
+
}
|
12
|
+
|
13
|
+
timer = setTimeout(() => {
|
14
|
+
resolve(fn(args));
|
15
|
+
}, ms);
|
16
|
+
});
|
17
|
+
|
18
|
+
const teardown = () => clearTimeout(timer);
|
19
|
+
|
20
|
+
return [debouncedFunc, teardown];
|
21
|
+
}
|
@@ -0,0 +1,82 @@
|
|
1
|
+
import { URL_PRINT_LOGO } from "../../constants";
|
2
|
+
|
3
|
+
export interface PrintLogoData {
|
4
|
+
image: string;
|
5
|
+
isSvg: boolean;
|
6
|
+
}
|
7
|
+
|
8
|
+
export const GetPrintLogo = (): Promise<PrintLogoData | null> => {
|
9
|
+
const printLogoUrl: string = URL_PRINT_LOGO();
|
10
|
+
return new Promise((resolve, reject) => {
|
11
|
+
if (!printLogoUrl) {
|
12
|
+
resolve(null);
|
13
|
+
return;
|
14
|
+
}
|
15
|
+
|
16
|
+
const hdnTxtPrintLogo = document.getElementById(
|
17
|
+
"hdnTxtPrintLogo"
|
18
|
+
) as HTMLTextAreaElement;
|
19
|
+
if (hdnTxtPrintLogo && hdnTxtPrintLogo.value?.length > 0) {
|
20
|
+
const isSvg = hdnTxtPrintLogo.getAttribute("isSvg");
|
21
|
+
resolve({
|
22
|
+
image: (hdnTxtPrintLogo as HTMLTextAreaElement).value,
|
23
|
+
isSvg: isSvg === "1",
|
24
|
+
});
|
25
|
+
return;
|
26
|
+
}
|
27
|
+
|
28
|
+
if (printLogoUrl.toLowerCase().endsWith(".svg")) {
|
29
|
+
fetch(printLogoUrl, {
|
30
|
+
headers: {
|
31
|
+
"Disable-WWW-Authenticate": "true",
|
32
|
+
},
|
33
|
+
})
|
34
|
+
.then((response) => {
|
35
|
+
if (!response.ok) {
|
36
|
+
throw new Error("Print logo fetch network response was not OK");
|
37
|
+
}
|
38
|
+
return response.text();
|
39
|
+
})
|
40
|
+
.then((svg) => {
|
41
|
+
if (hdnTxtPrintLogo) {
|
42
|
+
hdnTxtPrintLogo.value = svg;
|
43
|
+
hdnTxtPrintLogo.setAttribute("isSvg", "1");
|
44
|
+
}
|
45
|
+
resolve({ image: svg, isSvg: true });
|
46
|
+
})
|
47
|
+
.catch((error) => {
|
48
|
+
console.error("Error fetching print logo: ", error);
|
49
|
+
reject("Error fetching print logo");
|
50
|
+
});
|
51
|
+
} else {
|
52
|
+
const img = new Image();
|
53
|
+
const onImageLoaded = () => {
|
54
|
+
try {
|
55
|
+
const canvas = document.createElement("canvas");
|
56
|
+
canvas.width = img.width;
|
57
|
+
canvas.height = img.height;
|
58
|
+
const ctx = canvas.getContext("2d");
|
59
|
+
if (ctx) {
|
60
|
+
ctx.drawImage(img, 0, 0);
|
61
|
+
const dataURL = canvas.toDataURL("image/png");
|
62
|
+
if (hdnTxtPrintLogo) {
|
63
|
+
hdnTxtPrintLogo.value = dataURL;
|
64
|
+
hdnTxtPrintLogo.setAttribute("isSvg", "0");
|
65
|
+
}
|
66
|
+
resolve({ image: dataURL, isSvg: false });
|
67
|
+
} else {
|
68
|
+
reject("Failed to allocate canvas context for print logo");
|
69
|
+
}
|
70
|
+
} catch (e) {
|
71
|
+
reject(e);
|
72
|
+
}
|
73
|
+
};
|
74
|
+
const onImageLoadError = (ev: ErrorEvent) => {
|
75
|
+
reject(ev);
|
76
|
+
};
|
77
|
+
img.addEventListener("load", onImageLoaded);
|
78
|
+
img.addEventListener("error", onImageLoadError);
|
79
|
+
img.src = printLogoUrl;
|
80
|
+
}
|
81
|
+
});
|
82
|
+
};
|
@@ -0,0 +1,27 @@
|
|
1
|
+
export function toErrorMessage(payload: any) {
|
2
|
+
if (!payload) return payload;
|
3
|
+
const errorMessage =
|
4
|
+
payload?.error?.data?.error?.message ??
|
5
|
+
payload?.data?.error?.message ??
|
6
|
+
payload?.message ??
|
7
|
+
payload?.error ??
|
8
|
+
payload;
|
9
|
+
const fieldErrors =
|
10
|
+
payload?.error?.fieldErrors ?? payload?.data?.error?.fieldErrors;
|
11
|
+
|
12
|
+
if (fieldErrors) {
|
13
|
+
let field: keyof typeof fieldErrors;
|
14
|
+
const errors: any[] = [];
|
15
|
+
for (field in fieldErrors) {
|
16
|
+
errors.push(
|
17
|
+
fieldErrors[field]?.reduce((p: any, c: any, i: number) => {
|
18
|
+
if (i === 0) return c?.message ?? "";
|
19
|
+
p += (p.length > 0 ? " \r\n" : "") + c?.message;
|
20
|
+
return p;
|
21
|
+
}, "")
|
22
|
+
);
|
23
|
+
}
|
24
|
+
return `${errorMessage} ${errors.join(" \r\n")}`;
|
25
|
+
}
|
26
|
+
return errorMessage;
|
27
|
+
}
|
@@ -0,0 +1,70 @@
|
|
1
|
+
import { User } from "../api/types/identity/User";
|
2
|
+
|
3
|
+
export const initialStockOperationValue = () => {
|
4
|
+
return {
|
5
|
+
atLocationName: "",
|
6
|
+
atLocationUuid: "",
|
7
|
+
cancelReason: "",
|
8
|
+
cancelledBy: 0,
|
9
|
+
cancelledByFamilyName: "",
|
10
|
+
cancelledByGivenName: "",
|
11
|
+
cancelledDate: undefined,
|
12
|
+
completedBy: 0,
|
13
|
+
completedByFamilyName: "",
|
14
|
+
completedByGivenName: "",
|
15
|
+
completedDate: undefined,
|
16
|
+
creator: 0,
|
17
|
+
creatorFamilyName: "",
|
18
|
+
creatorGivenName: "",
|
19
|
+
dateCreated: undefined,
|
20
|
+
destinationName: "",
|
21
|
+
destinationUuid: "",
|
22
|
+
dispatchedByFamilyName: "",
|
23
|
+
dispatchedByGivenName: "",
|
24
|
+
dispatchedDate: undefined,
|
25
|
+
externalReference: "",
|
26
|
+
locked: false,
|
27
|
+
operationDate: new Date(),
|
28
|
+
operationNumber: "",
|
29
|
+
operationOrder: 0,
|
30
|
+
operationType: "",
|
31
|
+
operationTypeName: "",
|
32
|
+
operationTypeUuid: "",
|
33
|
+
permission: undefined,
|
34
|
+
reasonName: "",
|
35
|
+
reasonUuid: "",
|
36
|
+
rejectedByFamilyName: "",
|
37
|
+
rejectedByGivenName: "",
|
38
|
+
rejectedDate: undefined,
|
39
|
+
rejectionReason: "",
|
40
|
+
remarks: "",
|
41
|
+
requisitionStockOperationUuid: "",
|
42
|
+
responsiblePerson: 0,
|
43
|
+
responsiblePersonFamilyName: "",
|
44
|
+
responsiblePersonGivenName: "",
|
45
|
+
responsiblePersonOther: "",
|
46
|
+
responsiblePersonUuid: "",
|
47
|
+
returnReason: "",
|
48
|
+
returnedByFamilyName: "",
|
49
|
+
returnedByGivenName: "",
|
50
|
+
returnedDate: undefined,
|
51
|
+
sourceName: "",
|
52
|
+
sourceUuid: "",
|
53
|
+
status: undefined,
|
54
|
+
stockOperationItems: [],
|
55
|
+
submitted: false,
|
56
|
+
submittedBy: "",
|
57
|
+
submittedByFamilyName: "",
|
58
|
+
submittedByGivenName: "",
|
59
|
+
submittedDate: undefined,
|
60
|
+
uuid: "",
|
61
|
+
};
|
62
|
+
};
|
63
|
+
|
64
|
+
export const otherUser: User = {
|
65
|
+
uuid: "Other",
|
66
|
+
display: "Other",
|
67
|
+
person: {
|
68
|
+
display: "Other",
|
69
|
+
},
|
70
|
+
} as unknown as User;
|
@@ -0,0 +1,43 @@
|
|
1
|
+
import React, { useMemo } from "react";
|
2
|
+
import { ConfigurableLink } from "@openmrs/esm-framework";
|
3
|
+
import { BrowserRouter, useLocation } from "react-router-dom";
|
4
|
+
|
5
|
+
export interface DashboardLinkConfig {
|
6
|
+
name: string;
|
7
|
+
title: string;
|
8
|
+
}
|
9
|
+
|
10
|
+
function DashboardExtension({
|
11
|
+
dashboardLinkConfig,
|
12
|
+
}: {
|
13
|
+
dashboardLinkConfig: DashboardLinkConfig;
|
14
|
+
}) {
|
15
|
+
const { name, title } = dashboardLinkConfig;
|
16
|
+
const location = useLocation();
|
17
|
+
const spaBasePath = `${window.spaBase}/home`;
|
18
|
+
|
19
|
+
const navLink = useMemo(() => {
|
20
|
+
const pathArray = location.pathname.split("/home");
|
21
|
+
const lastElement = pathArray[pathArray.length - 1];
|
22
|
+
return decodeURIComponent(lastElement);
|
23
|
+
}, [location.pathname]);
|
24
|
+
|
25
|
+
return (
|
26
|
+
<ConfigurableLink
|
27
|
+
to={`${spaBasePath}/${name}`}
|
28
|
+
className={`cds--side-nav__link ${
|
29
|
+
navLink.match(name) && "active-left-nav-link"
|
30
|
+
}`}
|
31
|
+
>
|
32
|
+
{title}
|
33
|
+
</ConfigurableLink>
|
34
|
+
);
|
35
|
+
}
|
36
|
+
|
37
|
+
export const createDashboardLink =
|
38
|
+
(dashboardLinkConfig: DashboardLinkConfig) => () =>
|
39
|
+
(
|
40
|
+
<BrowserRouter>
|
41
|
+
<DashboardExtension dashboardLinkConfig={dashboardLinkConfig} />
|
42
|
+
</BrowserRouter>
|
43
|
+
);
|
@@ -0,0 +1,50 @@
|
|
1
|
+
import React, { useState } from "react";
|
2
|
+
import { useTranslation } from "react-i18next";
|
3
|
+
import { SideNavItem } from "../core/components/side-nav/types";
|
4
|
+
import SideNavItemsList from "../core/components/side-nav/side-nav.component";
|
5
|
+
|
6
|
+
const StockManagementDashboardSideNav = () => {
|
7
|
+
const { t } = useTranslation();
|
8
|
+
const [selectedTab, setSelectedTab] = useState(0);
|
9
|
+
|
10
|
+
const tabs: SideNavItem[] = [
|
11
|
+
{
|
12
|
+
name: t("stockManagementOverview", "Overview"),
|
13
|
+
link: "overview",
|
14
|
+
},
|
15
|
+
{
|
16
|
+
name: t("stockManagementStockItems", "Stock Items"),
|
17
|
+
link: "stock-items",
|
18
|
+
},
|
19
|
+
{
|
20
|
+
name: t("stockManagementOperations", "Stock Operations"),
|
21
|
+
link: "stock-operations",
|
22
|
+
},
|
23
|
+
{
|
24
|
+
name: t("stockManagementStockUserScopes", "Stock User Role Scopes"),
|
25
|
+
link: "stock-user-scopes",
|
26
|
+
},
|
27
|
+
{
|
28
|
+
name: t("stockManagementStockSources", "Stock Sources"),
|
29
|
+
link: "stock-sources",
|
30
|
+
},
|
31
|
+
{
|
32
|
+
name: t("stockManagementLocations", "Stock Locations"),
|
33
|
+
link: "stock-locations",
|
34
|
+
},
|
35
|
+
{
|
36
|
+
name: t("stockManagementSettings", "Stock Settings"),
|
37
|
+
link: `admin/maintenance/settings.list?show=Stockmanagement`,
|
38
|
+
},
|
39
|
+
];
|
40
|
+
|
41
|
+
return (
|
42
|
+
<SideNavItemsList
|
43
|
+
tabs={tabs}
|
44
|
+
selectedIndex={selectedTab}
|
45
|
+
onSelectTab={setSelectedTab}
|
46
|
+
/>
|
47
|
+
);
|
48
|
+
};
|
49
|
+
|
50
|
+
export default StockManagementDashboardSideNav;
|
@@ -0,0 +1,41 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import { StockManagementHeader } from "../stock-management-header/stock-management-header.component";
|
3
|
+
import Overlay from "../core/components/overlay/overlay.component";
|
4
|
+
import styles from "./stock-management-dashboard.scss";
|
5
|
+
import StockManagementDashboardSideNav from "./stock-management-dashboard-side-nav.component";
|
6
|
+
import { BrowserRouter, Route, Routes } from "react-router-dom";
|
7
|
+
import StockHomeLandingPage from "../stock-home/stock-home-landing-page-component";
|
8
|
+
import StockUserScopes from "../stock-user-role-scopes/stock-user-role-scopes.component";
|
9
|
+
import StockSources from "../stock-sources/stock-sources.component";
|
10
|
+
import StockOperationsComponent from "../stock-operations/stock-operations.component";
|
11
|
+
import StockItems from "../stock-items/stock-items.component";
|
12
|
+
import StockSettings from "../stock-settings/stock-settings.component";
|
13
|
+
import StockLocations from "../stock-locations/stock-locations.component";
|
14
|
+
|
15
|
+
export default function StockManagementDashboard() {
|
16
|
+
const basePath = `${window.getOpenmrsSpaBase()}stock-management`;
|
17
|
+
return (
|
18
|
+
<BrowserRouter basename={basePath}>
|
19
|
+
<div className={styles.container}>
|
20
|
+
<StockManagementDashboardSideNav />
|
21
|
+
<div>
|
22
|
+
<StockManagementHeader />
|
23
|
+
<Routes>
|
24
|
+
<Route path="overview" element={<StockHomeLandingPage />} />
|
25
|
+
<Route path="" element={<StockHomeLandingPage />} />
|
26
|
+
<Route path="stock-items" element={<StockItems />} />
|
27
|
+
<Route
|
28
|
+
path="stock-operations"
|
29
|
+
element={<StockOperationsComponent />}
|
30
|
+
/>
|
31
|
+
<Route path="stock-user-scopes" element={<StockUserScopes />} />
|
32
|
+
<Route path="stock-sources" element={<StockSources />} />
|
33
|
+
<Route path="stock-locations" element={<StockLocations />} />
|
34
|
+
<Route path="stock-settings" element={<StockSettings />} />
|
35
|
+
</Routes>
|
36
|
+
</div>
|
37
|
+
<Overlay />
|
38
|
+
</div>
|
39
|
+
</BrowserRouter>
|
40
|
+
);
|
41
|
+
}
|
package/src/index.ts
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
import { defineConfigSchema, getSyncLifecycle } from "@openmrs/esm-framework";
|
2
|
+
import { configSchema } from "./config-schema";
|
3
|
+
import appMenu from "./stock-app-menu-item/item.component";
|
4
|
+
import bulkImportComponent from "./stock-items/add-bulk-stock-item/stock-items-bulk-import.component";
|
5
|
+
import deleteUserModalComponent from "./stock-user-role-scopes/delete-stock-user-scope-modal.component";
|
6
|
+
import deleteStockModalComponent from "./stock-sources/delete-stock-modal.component";
|
7
|
+
import stockOperationDialogComponent from "./stock-operations/stock-operations-dialog/stock-operations-dialog.component";
|
8
|
+
import stockManagementDashboardComponent from "./dashboard/stock-management-dashboard.component";
|
9
|
+
import stockManagementComponent from "./stock-management.component";
|
10
|
+
import stockManagementAdminCardLinkComponent from "./stock-management-admin-card-link.component";
|
11
|
+
|
12
|
+
const moduleName = "@openmrs/esm-stock-management-app";
|
13
|
+
|
14
|
+
const options = {
|
15
|
+
featureName: "stock-management",
|
16
|
+
moduleName,
|
17
|
+
};
|
18
|
+
|
19
|
+
export const importTranslation = require.context(
|
20
|
+
"../translations",
|
21
|
+
false,
|
22
|
+
/.json$/,
|
23
|
+
"lazy"
|
24
|
+
);
|
25
|
+
|
26
|
+
export const stockManagementAdminCardLink = getSyncLifecycle(
|
27
|
+
stockManagementAdminCardLinkComponent,
|
28
|
+
options
|
29
|
+
);
|
30
|
+
|
31
|
+
export const stockManagement = getSyncLifecycle(
|
32
|
+
stockManagementComponent,
|
33
|
+
options
|
34
|
+
);
|
35
|
+
|
36
|
+
export const stockManagementDashboard = getSyncLifecycle(
|
37
|
+
stockManagementDashboardComponent,
|
38
|
+
options
|
39
|
+
);
|
40
|
+
|
41
|
+
export const stockOperationDialog = getSyncLifecycle(
|
42
|
+
stockOperationDialogComponent,
|
43
|
+
options
|
44
|
+
);
|
45
|
+
export const deleteStockModal = getSyncLifecycle(deleteStockModalComponent, {
|
46
|
+
featureName: "delete-stock-modal",
|
47
|
+
moduleName,
|
48
|
+
});
|
49
|
+
|
50
|
+
export const deleteUserScopeModal = getSyncLifecycle(deleteUserModalComponent, {
|
51
|
+
featureName: "delete-stock-user-scope-modal",
|
52
|
+
moduleName,
|
53
|
+
});
|
54
|
+
|
55
|
+
export const importBulkStockItemsDialog = getSyncLifecycle(
|
56
|
+
bulkImportComponent,
|
57
|
+
options
|
58
|
+
);
|
59
|
+
|
60
|
+
export const stockManagementAppMenuItem = getSyncLifecycle(appMenu, options);
|
61
|
+
|
62
|
+
export function startupApp() {
|
63
|
+
defineConfigSchema(moduleName, configSchema);
|
64
|
+
}
|