@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
package/src/constants.ts
ADDED
@@ -0,0 +1,214 @@
|
|
1
|
+
import dayjs from "dayjs";
|
2
|
+
import { formatDisplayDate } from "./core/utils/datetimeUtils";
|
3
|
+
|
4
|
+
export const moduleName = "@openmrs/esm-stock-management-app";
|
5
|
+
export const spaRoot = `${window["getOpenmrsSpaBase"]}`;
|
6
|
+
export const omrsDateFormat = "YYYY-MM-DDTHH:mm:ss.SSSZZ";
|
7
|
+
export const startOfDay = dayjs(new Date().setUTCHours(0, 0, 0, 0)).format(
|
8
|
+
omrsDateFormat
|
9
|
+
);
|
10
|
+
export const timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
11
|
+
|
12
|
+
export const DATE_PICKER_FORMAT = "DD/MM/YYYY";
|
13
|
+
|
14
|
+
export const DATE_PICKER_CONTROL_FORMAT = "d/m/Y";
|
15
|
+
|
16
|
+
export const formatForDatePicker = (date: Date | null | undefined) => {
|
17
|
+
return formatDisplayDate(date, DATE_PICKER_FORMAT);
|
18
|
+
};
|
19
|
+
|
20
|
+
export const today = () => {
|
21
|
+
const date = new Date();
|
22
|
+
return new Date(date.getFullYear(), date.getMonth(), date.getDate());
|
23
|
+
};
|
24
|
+
|
25
|
+
// privileges
|
26
|
+
/** @type {string}: App: stockmanagement.dashboard, Able to view stock management application dashboard*/
|
27
|
+
export const APP_STOCKMANAGEMENT_DASHBOARD = "App: stockmanagement.dashboard";
|
28
|
+
|
29
|
+
/** @type {string}: App: stockmanagement.stockItems, Able to view stock items*/
|
30
|
+
export const APP_STOCKMANAGEMENT_STOCKITEMS = "App: stockmanagement.stockItems";
|
31
|
+
|
32
|
+
/** @type {string}: Task: stockmanagement.stockItems.mutate, Able to create and update stock items*/
|
33
|
+
export const TASK_STOCKMANAGEMENT_STOCKITEMS_MUTATE =
|
34
|
+
"Task: stockmanagement.stockItems.mutate";
|
35
|
+
|
36
|
+
/** @type {string}: Task: stockmanagement.stockItems.dispense.qty, Able to view stock item quantities at dispensing locations*/
|
37
|
+
export const TASK_STOCKMANAGEMENT_STOCKITEMS_DISPENSE_QTY =
|
38
|
+
"Task: stockmanagement.stockItems.dispense.qty";
|
39
|
+
|
40
|
+
/** @type {string}: Task: stockmanagement.stockItems.dispense, Able to dispense stock items*/
|
41
|
+
export const TASK_STOCKMANAGEMENT_STOCKITEMS_DISPENSE =
|
42
|
+
"Task: stockmanagement.stockItems.dispense";
|
43
|
+
|
44
|
+
/** @type {string}: App: stockmanagement.userRoleScopes, Able to view stock management user role scope*/
|
45
|
+
export const APP_STOCKMANAGEMENT_USERROLESCOPES =
|
46
|
+
"App: stockmanagement.userRoleScopes";
|
47
|
+
|
48
|
+
/** @type {string}: Task: stockmanagement.userRoleScopes.mutate, Able to create and update user role scopes*/
|
49
|
+
export const TASK_STOCKMANAGEMENT_USERROLESCOPES_MUTATE =
|
50
|
+
"Task: stockmanagement.userRoleScopes.mutate";
|
51
|
+
|
52
|
+
/** @type {string}: App: stockmanagement.stockoperations, Able to view stock operations*/
|
53
|
+
export const APP_STOCKMANAGEMENT_STOCKOPERATIONS =
|
54
|
+
"App: stockmanagement.stockoperations";
|
55
|
+
|
56
|
+
/** @type {string}: Task: stockmanagement.stockoperations.mutate, Able to create and update stock operations*/
|
57
|
+
export const TASK_STOCKMANAGEMENT_STOCKOPERATIONS_MUTATE =
|
58
|
+
"Task: stockmanagement.stockoperations.mutate";
|
59
|
+
|
60
|
+
/** @type {string}: Task: stockmanagement.stockoperations.approve, Able to aprove stock operations*/
|
61
|
+
export const TASK_STOCKMANAGEMENT_STOCKOPERATIONS_APPROVE =
|
62
|
+
"Task: stockmanagement.stockoperations.approve";
|
63
|
+
|
64
|
+
/** @type {string}: Task: stockmanagement.stockoperations.receiveitems, Able to receive dispatched stock items*/
|
65
|
+
export const TASK_STOCKMANAGEMENT_STOCKOPERATIONS_RECEIVEITEMS =
|
66
|
+
"Task: stockmanagement.stockoperations.receiveitems";
|
67
|
+
|
68
|
+
/** @type {string}: App: stockmanagement.stockSources, Able to view stock sources*/
|
69
|
+
export const APP_STOCKMANAGEMENT_STOCKSOURCES =
|
70
|
+
"App: stockmanagement.stockSources";
|
71
|
+
|
72
|
+
/** @type {string}: Task: stockmanagement.stockSources.mutate, Able to create and update stock sources*/
|
73
|
+
export const TASK_STOCKMANAGEMENT_STOCKSOURCES_MUTATE =
|
74
|
+
"Task: stockmanagement.stockSources.mutate";
|
75
|
+
|
76
|
+
/** @type {string}: App: stockmanagement.stockOperationType, Able to view stock operation types*/
|
77
|
+
export const APP_STOCKMANAGEMENT_STOCKOPERATIONTYPE =
|
78
|
+
"App: stockmanagement.stockOperationType";
|
79
|
+
|
80
|
+
/** @type {string}: Task: stockmanagement.party.read, Able to read party information*/
|
81
|
+
export const TASK_STOCKMANAGEMENT_PARTY_READ =
|
82
|
+
"Task: stockmanagement.party.read";
|
83
|
+
|
84
|
+
/** @type {string}: App: stockmanagement.reports, Able to view stock reports*/
|
85
|
+
export const APP_STOCKMANAGEMENT_REPORTS = "App: stockmanagement.reports";
|
86
|
+
|
87
|
+
/** @type {string}: Task: stockmanagement.reports.mutate, Able to create stock reports*/
|
88
|
+
|
89
|
+
// concepts
|
90
|
+
export const STOCK_SOURCE_TYPE_CODED_CONCEPT_ID =
|
91
|
+
"2e1e8049-9cbe-4a2d-b1e5-8a91e5d7d97d";
|
92
|
+
export const STOCK_ADJUSTMENT_REASON_CODED_CONCEPT_ID =
|
93
|
+
"3bbfaa44-d5b8-404d-b4c1-2bf49ad8ce25";
|
94
|
+
export const DISPENSING_UNITS_CONCEPT_ID =
|
95
|
+
"162402AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
|
96
|
+
export const PACKAGING_UNITS_CODED_CONCEPT_ID =
|
97
|
+
"bce2b1af-98b1-48a2-98a2-3e4ffb3c79c2";
|
98
|
+
export const STOCK_ITEM_CATEGORY_CONCEPT_ID =
|
99
|
+
"6d24eb6e-b42f-4706-ab2d-ae4472161f6a";
|
100
|
+
|
101
|
+
export const INVENTORY_CLERK_ROLE_UUID = "d210eb66-2188-11ed-9dff-507b9dea1806";
|
102
|
+
export const INVENTORY_MANAGER_ROLE_UUID =
|
103
|
+
"cca4be4b-2188-11ed-9dff-507b9dea1806";
|
104
|
+
export const INVENTORY_DISPENSING_ROLE_UUID =
|
105
|
+
"84bdd876-4694-11ed-8109-00155dcc3fc0";
|
106
|
+
export const INVENTORY_REPORTING_ROLE_UUID =
|
107
|
+
"a49be648-6b0a-11ed-93a2-806d973f13a9";
|
108
|
+
export const INVENTORY_ADMNISTRATOR_ROLE_UUID =
|
109
|
+
"2083fd40-3391-11ed-a667-507b9dea1806";
|
110
|
+
|
111
|
+
export const STOCK_OPERATION_PRINT_DISABLE_BALANCE_ON_HAND = true;
|
112
|
+
export const STOCK_OPERATION_PRINT_DISABLE_COSTS = true;
|
113
|
+
export const HEALTH_CENTER_NAME = "Health Center";
|
114
|
+
export const PRINT_LOGO =
|
115
|
+
"moduleResources/stockmanagement/assets/print-logo.svg";
|
116
|
+
export const PRINT_LOGO_TEXT = "Ministry of Health";
|
117
|
+
|
118
|
+
export const MAIN_STORE_LOCATION_TAG = "Main Store";
|
119
|
+
|
120
|
+
export const BASE_OPENMRS_APP_URL = "/openmrs/";
|
121
|
+
|
122
|
+
export const STOCKMGMT_RESOURCE_URL = "/openmrs/stockmanagement/spa.page/";
|
123
|
+
export const STOCKMGMT_SPA_PAGE_URL = "/openmrs/stockmanagement/spa.page";
|
124
|
+
export const URL_PRINT_LOGO = () =>
|
125
|
+
PRINT_LOGO
|
126
|
+
? `${BASE_OPENMRS_APP_URL}${PRINT_LOGO}`
|
127
|
+
: "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
|
128
|
+
export const CLOSE_PRINT_AFTER_PRINT = true;
|
129
|
+
export const ALLOW_STOCK_ISSUE_WITHOUT_REQUISITION = false;
|
130
|
+
|
131
|
+
export const BASE_URL_CONFIGURED = BASE_OPENMRS_APP_URL;
|
132
|
+
export const LOGIN_URL = BASE_OPENMRS_APP_URL + "login.htm";
|
133
|
+
|
134
|
+
export const ROUTING_BASE_URL = "/";
|
135
|
+
export const URL_STOCK_HOME = ROUTING_BASE_URL + "home";
|
136
|
+
|
137
|
+
export const URL_STOCK_OPERATIONS = ROUTING_BASE_URL + "stock-operations";
|
138
|
+
export const URL_STOCK_OPERATIONS_ROUTES = URL_STOCK_OPERATIONS + "/*";
|
139
|
+
export const URL_STOCK_OPERATIONS_NEW = URL_STOCK_OPERATIONS + "/new/*";
|
140
|
+
export const URL_STOCK_OPERATIONS_NEW_OPERATION = (
|
141
|
+
name: string,
|
142
|
+
requisitionUuid?: string
|
143
|
+
): string =>
|
144
|
+
`${URL_STOCK_OPERATIONS}/new/${name}${
|
145
|
+
requisitionUuid ? `?requisition=${requisitionUuid}` : ""
|
146
|
+
}`;
|
147
|
+
export const URL_STOCK_OPERATIONS_EDIT = URL_STOCK_OPERATIONS + "/:id";
|
148
|
+
export const URL_STOCK_OPERATIONS_REDIRECT = (
|
149
|
+
uuid: string,
|
150
|
+
tab?: string
|
151
|
+
): string =>
|
152
|
+
`${URL_STOCK_OPERATIONS}/redirect/${uuid}${tab ? `?tab=${tab}` : ""}`;
|
153
|
+
export const URL_STOCK_OPERATION = (uuid: string, tab?: string): string =>
|
154
|
+
`${URL_STOCK_OPERATIONS}/${uuid}${tab ? `?tab=${tab}` : ""}`;
|
155
|
+
|
156
|
+
export const URL_USER_ROLE_SCOPES = ROUTING_BASE_URL + "user-role-scopes";
|
157
|
+
export const URL_USER_ROLE_SCOPES_ROUTES = URL_USER_ROLE_SCOPES + "/*";
|
158
|
+
export const URL_USER_ROLE_SCOPES_NEW = URL_USER_ROLE_SCOPES + "/new";
|
159
|
+
export const URL_USER_ROLE_SCOPES_EDIT = URL_USER_ROLE_SCOPES + "/:id";
|
160
|
+
export const URL_USER_ROLE_SCOPE = (uuid: string): string =>
|
161
|
+
`${URL_USER_ROLE_SCOPES}/${uuid}`;
|
162
|
+
|
163
|
+
export const URL_STOCK_ITEMS = ROUTING_BASE_URL + "stock-items";
|
164
|
+
export const URL_STOCK_ITEMS_ROUTES = ROUTING_BASE_URL + "stock-items/*";
|
165
|
+
export const URL_STOCK_ITEMS_NEW = URL_STOCK_ITEMS + "/new";
|
166
|
+
export const URL_STOCK_ITEMS_EDIT = URL_STOCK_ITEMS + "/:id";
|
167
|
+
export const URL_STOCK_ITEM = (uuid: string, tab?: string): string =>
|
168
|
+
`${URL_STOCK_ITEMS}/${uuid}${tab ? `?tab=${tab}` : ""}`;
|
169
|
+
export const URL_STOCK_ITEMS_REDIRECT = (uuid: string, tab?: string): string =>
|
170
|
+
`${URL_STOCK_ITEMS}/redirect/${uuid}${tab ? `?tab=${tab}` : ""}`;
|
171
|
+
export const URL_IMPORT_ERROR_FILE = (importSessionId: string) =>
|
172
|
+
`${BASE_OPENMRS_APP_URL}ws/rest/v1/stockmanagement/stockitemimport?id=${importSessionId}`;
|
173
|
+
export const URL_IMPORT_TEMPLATE_FILE = `${BASE_OPENMRS_APP_URL}moduleResources/stockmanagement/templates/Import_Stock_Items.xlsx`;
|
174
|
+
|
175
|
+
export const URL_STOCK_SOURCES = ROUTING_BASE_URL + "stock-sources";
|
176
|
+
export const URL_STOCK_SOURCES_ROUTES = URL_STOCK_SOURCES + "/*";
|
177
|
+
|
178
|
+
export const URL_SIGN_IN = ROUTING_BASE_URL + "sign-in";
|
179
|
+
export const URL_SIGN_OUT = ROUTING_BASE_URL + "sign-out";
|
180
|
+
|
181
|
+
export const URL_ACCESS_DENIED = ROUTING_BASE_URL + "access-denied";
|
182
|
+
export const URL_NOT_FOUND = "/*";
|
183
|
+
export const URL_WILDCARD = "*";
|
184
|
+
|
185
|
+
export const REACT_ROUTER_PREFIX = "#";
|
186
|
+
|
187
|
+
export const URL_LOCATIONS = ROUTING_BASE_URL + "locations";
|
188
|
+
export const URL_LOCATIONS_ROUTES = ROUTING_BASE_URL + "locations/*";
|
189
|
+
export const URL_LOCATIONS_NEW = () =>
|
190
|
+
`${BASE_OPENMRS_APP_URL}admin/locations/location.form`;
|
191
|
+
export const URL_LOCATIONS_EDIT = (id: number) =>
|
192
|
+
`${BASE_OPENMRS_APP_URL}admin/locations/location.form?locationId=${id}`;
|
193
|
+
|
194
|
+
export const URL_STOCK_REPORTS = ROUTING_BASE_URL + "stock-reports";
|
195
|
+
export const URL_STOCK_REPORTS_ROUTES = ROUTING_BASE_URL + "stock-reports/*";
|
196
|
+
export const URL_STOCK_REPORT = (uuid: string): string =>
|
197
|
+
`${URL_STOCK_REPORTS}/${uuid}`;
|
198
|
+
export const URL_BATCH_JOB_ARTIFACT = (
|
199
|
+
uuid: string,
|
200
|
+
download: boolean
|
201
|
+
): string =>
|
202
|
+
`${BASE_OPENMRS_APP_URL}ws/rest/v1/stockmanagement/batchjobartifact?id=${uuid}${
|
203
|
+
download ? "&download=1" : ""
|
204
|
+
}`;
|
205
|
+
|
206
|
+
export function extractErrorMessagesFromResponse(errorObject) {
|
207
|
+
const fieldErrors = errorObject?.responseBody?.error?.fieldErrors;
|
208
|
+
if (!fieldErrors) {
|
209
|
+
return [errorObject?.responseBody?.error?.message ?? errorObject?.message];
|
210
|
+
}
|
211
|
+
return Object.values(fieldErrors).flatMap((errors: Array<Error>) =>
|
212
|
+
errors.map((error) => error.message)
|
213
|
+
);
|
214
|
+
}
|
@@ -0,0 +1,34 @@
|
|
1
|
+
import { PagingCriteria } from "./types/PageableResult";
|
2
|
+
|
3
|
+
export enum ResourceRepresentation {
|
4
|
+
Default = "default",
|
5
|
+
Full = "full",
|
6
|
+
REF = "ref",
|
7
|
+
}
|
8
|
+
|
9
|
+
export interface ResourceFilterCriteria extends PagingCriteria {
|
10
|
+
v?: ResourceRepresentation | null;
|
11
|
+
q?: string | null;
|
12
|
+
totalCount?: boolean | null;
|
13
|
+
limit?: number | null;
|
14
|
+
}
|
15
|
+
|
16
|
+
export function toQueryParams<T extends ResourceFilterCriteria>(
|
17
|
+
filterCriteria?: T | null,
|
18
|
+
skipEmptyString = true
|
19
|
+
): string {
|
20
|
+
if (!filterCriteria) return "";
|
21
|
+
const queryParams: string = Object.keys(filterCriteria)
|
22
|
+
?.map((key) => {
|
23
|
+
const value = filterCriteria[key];
|
24
|
+
return (skipEmptyString &&
|
25
|
+
(value === false || value === true ? true : value)) ||
|
26
|
+
(!skipEmptyString &&
|
27
|
+
(value === "" || (value === false || value === true ? true : value)))
|
28
|
+
? `${encodeURIComponent(key)}=${encodeURIComponent(value.toString())}`
|
29
|
+
: null;
|
30
|
+
})
|
31
|
+
.filter((o) => o != null)
|
32
|
+
.join("&");
|
33
|
+
return queryParams.length > 0 ? "?" + queryParams : "";
|
34
|
+
}
|
@@ -0,0 +1,121 @@
|
|
1
|
+
import { RecordPermission } from "./RecordPermission";
|
2
|
+
|
3
|
+
export interface BatchJobOwner {
|
4
|
+
uuid?: string;
|
5
|
+
batchJobUuid?: string;
|
6
|
+
ownerUserUuid?: string;
|
7
|
+
ownerGivenName?: string;
|
8
|
+
ownerFamilyName?: string;
|
9
|
+
dateCreated?: Date;
|
10
|
+
}
|
11
|
+
|
12
|
+
export interface BatchJob {
|
13
|
+
uuid: string;
|
14
|
+
batchJobType?: string;
|
15
|
+
status?: string;
|
16
|
+
description?: string;
|
17
|
+
startTime?: Date;
|
18
|
+
endTime?: Date;
|
19
|
+
expiration?: Date;
|
20
|
+
parameters?: string;
|
21
|
+
privilegeScope?: string;
|
22
|
+
locationScope?: string;
|
23
|
+
locationScopeUuid?: string;
|
24
|
+
executionState?: string;
|
25
|
+
cancelReason?: string;
|
26
|
+
cancelledByUuid?: string;
|
27
|
+
cancelledByGivenName?: string;
|
28
|
+
cancelledByFamilyName?: string;
|
29
|
+
cancelledDate?: Date;
|
30
|
+
exitMessage?: string;
|
31
|
+
completedDate?: Date;
|
32
|
+
dateCreated?: Date;
|
33
|
+
creatorUuid?: string;
|
34
|
+
creatorGivenName?: string;
|
35
|
+
creatorFamilyName?: string;
|
36
|
+
voided?: boolean;
|
37
|
+
outputArtifactSize?: number;
|
38
|
+
outputArtifactFileExt?: string;
|
39
|
+
outputArtifactViewable?: boolean;
|
40
|
+
owners?: BatchJobOwner[];
|
41
|
+
permission: RecordPermission | null | undefined;
|
42
|
+
}
|
43
|
+
|
44
|
+
export const BatchJobTypeReport = "Report";
|
45
|
+
export const BatchJobTypeOther = "Other";
|
46
|
+
|
47
|
+
export const BatchJobTypes = [BatchJobTypeReport, BatchJobTypeOther] as const;
|
48
|
+
export type BatchJobType = (typeof BatchJobTypes)[number];
|
49
|
+
|
50
|
+
export const BatchJobStatusPending = "Pending";
|
51
|
+
export const BatchJobStatusRunning = "Running";
|
52
|
+
export const BatchJobStatusFailed = "Failed";
|
53
|
+
export const BatchJobStatusCompleted = "Completed";
|
54
|
+
export const BatchJobStatusCancelled = "Cancelled";
|
55
|
+
export const BatchJobStatusExpired = "Expired";
|
56
|
+
|
57
|
+
export const BatchJobStatuses = [
|
58
|
+
BatchJobStatusPending,
|
59
|
+
BatchJobStatusRunning,
|
60
|
+
BatchJobStatusFailed,
|
61
|
+
BatchJobStatusCompleted,
|
62
|
+
BatchJobStatusCancelled,
|
63
|
+
BatchJobStatusExpired,
|
64
|
+
] as const;
|
65
|
+
export type BatchJobStatus = (typeof BatchJobStatuses)[number];
|
66
|
+
|
67
|
+
export const isBatchJobStillActive = (
|
68
|
+
status: string | undefined | null
|
69
|
+
): boolean =>
|
70
|
+
status === BatchJobStatusPending || status === BatchJobStatusRunning;
|
71
|
+
|
72
|
+
export const parseParametersToMap = (
|
73
|
+
parameters: string | undefined | null,
|
74
|
+
ignoreLines: string[] = []
|
75
|
+
): { [key: string]: { [key: string]: string } } | null => {
|
76
|
+
if (!parameters) {
|
77
|
+
return null;
|
78
|
+
}
|
79
|
+
const result: { [key: string]: { [key: string]: string } } = {};
|
80
|
+
const re = /\r?\n|\r/;
|
81
|
+
const lines = parameters.split(re);
|
82
|
+
lines.forEach((line) => {
|
83
|
+
if (
|
84
|
+
line.startsWith("#") ||
|
85
|
+
(ignoreLines && ignoreLines.some((p) => line.startsWith(p)))
|
86
|
+
)
|
87
|
+
return;
|
88
|
+
const tokens = line.split("=", 2);
|
89
|
+
if (tokens.length !== 2) return;
|
90
|
+
if (tokens[0].startsWith("param.")) {
|
91
|
+
let nameToken = tokens[0].substring(6);
|
92
|
+
const valueDescIndex = nameToken.lastIndexOf(".value.desc");
|
93
|
+
if (valueDescIndex > 0) {
|
94
|
+
nameToken = nameToken.substring(0, valueDescIndex) + ".display";
|
95
|
+
}
|
96
|
+
if (nameToken) {
|
97
|
+
const nameParts = nameToken.split(".");
|
98
|
+
const name: string =
|
99
|
+
nameParts.length > 1
|
100
|
+
? nameParts.slice(0, nameParts.length - 1).join(".")
|
101
|
+
: nameParts[0];
|
102
|
+
const nameProperty: string =
|
103
|
+
nameParts.length > 1 ? nameParts[nameParts.length - 1] : "value";
|
104
|
+
if (!result[name]) {
|
105
|
+
result[name] = {};
|
106
|
+
}
|
107
|
+
result[name][nameProperty] = tokens[1];
|
108
|
+
}
|
109
|
+
} else {
|
110
|
+
const nameParts = tokens[0].split(".", 2);
|
111
|
+
const name: string = nameParts[0];
|
112
|
+
const nameProperty: string =
|
113
|
+
nameParts.length > 1 ? nameParts[1] : "value";
|
114
|
+
if (!result[name]) {
|
115
|
+
result[name] = {};
|
116
|
+
}
|
117
|
+
result[name][nameProperty] = tokens[1];
|
118
|
+
}
|
119
|
+
});
|
120
|
+
return result;
|
121
|
+
};
|
@@ -0,0 +1,16 @@
|
|
1
|
+
export interface OpenMRSLocation {
|
2
|
+
parentLocation: any;
|
3
|
+
id: number;
|
4
|
+
uuid: string;
|
5
|
+
name: string;
|
6
|
+
display: string;
|
7
|
+
description: string;
|
8
|
+
tags: OpenMRSLocationTag[];
|
9
|
+
childLocations: OpenMRSLocation[];
|
10
|
+
}
|
11
|
+
|
12
|
+
export interface OpenMRSLocationTag {
|
13
|
+
uuid: string;
|
14
|
+
name: string;
|
15
|
+
display: string;
|
16
|
+
}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
export interface PageableResult<ResultType> {
|
2
|
+
results: ResultType[];
|
3
|
+
links: ResultLink[] | null;
|
4
|
+
totalCount: number | null;
|
5
|
+
}
|
6
|
+
|
7
|
+
export interface ResultLink {
|
8
|
+
rel: string;
|
9
|
+
uri: string;
|
10
|
+
}
|
11
|
+
|
12
|
+
export interface PagingCriteria {
|
13
|
+
startIndex?: number | null;
|
14
|
+
limit?: number | null;
|
15
|
+
}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
export interface RecordPermission {
|
2
|
+
canView: boolean;
|
3
|
+
canEdit: boolean;
|
4
|
+
canApprove: boolean | undefined | null;
|
5
|
+
canReceiveItems: boolean | undefined | null;
|
6
|
+
canDisplayReceivedItems: boolean | undefined | null;
|
7
|
+
isRequisitionAndCanIssueStock: boolean | undefined | null;
|
8
|
+
canUpdateBatchInformation: boolean | undefined | null;
|
9
|
+
}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
import { BaseOpenmrsObject } from "../BaseOpenmrsObject";
|
2
|
+
import { Auditable } from "../Auditable";
|
3
|
+
import { Retireable } from "../Retireable";
|
4
|
+
import { ConceptName } from "./ConceptName";
|
5
|
+
|
6
|
+
export interface Concept extends BaseOpenmrsObject, Auditable, Retireable {
|
7
|
+
conceptId: number;
|
8
|
+
display: string;
|
9
|
+
set: boolean;
|
10
|
+
version: string;
|
11
|
+
names: ConceptName[];
|
12
|
+
name: ConceptName;
|
13
|
+
numeric: boolean;
|
14
|
+
complex: boolean;
|
15
|
+
shortNames: ConceptName[];
|
16
|
+
indexTerms: ConceptName[];
|
17
|
+
synonyms: ConceptName[];
|
18
|
+
setMembers: Concept[];
|
19
|
+
possibleValues: Concept[];
|
20
|
+
preferredName: ConceptName;
|
21
|
+
shortName: ConceptName;
|
22
|
+
fullySpecifiedName: ConceptName;
|
23
|
+
answers: Concept[];
|
24
|
+
}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import { BaseOpenmrsObject } from "../BaseOpenmrsObject";
|
2
|
+
import { Concept } from "./Concept";
|
3
|
+
|
4
|
+
export interface ConceptName extends BaseOpenmrsObject {
|
5
|
+
conceptNameId: number;
|
6
|
+
concept: Concept;
|
7
|
+
name: string;
|
8
|
+
localePreferred: boolean;
|
9
|
+
short: boolean;
|
10
|
+
preferred: boolean;
|
11
|
+
indexTerm: boolean;
|
12
|
+
synonym: boolean;
|
13
|
+
fullySpecifiedName: boolean;
|
14
|
+
}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import { BaseOpenmrsMetadata } from "../BaseOpenmrsMetadata";
|
2
|
+
import { Concept } from "./Concept";
|
3
|
+
|
4
|
+
export interface Drug extends BaseOpenmrsMetadata {
|
5
|
+
drugId: number;
|
6
|
+
display: string;
|
7
|
+
combination: boolean;
|
8
|
+
dosageForm: Concept;
|
9
|
+
maximumDailyDose: number;
|
10
|
+
minimumDailyDose: number;
|
11
|
+
strength: string;
|
12
|
+
concept: Concept;
|
13
|
+
displayName: string;
|
14
|
+
}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import { SessionLocation } from "@openmrs/esm-framework";
|
2
|
+
import { PrivilegeScope } from "./PriviledgeScope";
|
3
|
+
import { User } from "./User";
|
4
|
+
|
5
|
+
export interface GetSessionResponse {
|
6
|
+
sessionId: string;
|
7
|
+
authenticated: boolean;
|
8
|
+
user: User;
|
9
|
+
locale: string;
|
10
|
+
allowedLocales: string[];
|
11
|
+
sessionLocation?: SessionLocation;
|
12
|
+
}
|
13
|
+
|
14
|
+
export interface StockManagementSession {
|
15
|
+
privileges: PrivilegeScope[];
|
16
|
+
}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
import { Person } from "./Person";
|
2
|
+
import { Role } from "./Role";
|
3
|
+
|
4
|
+
export interface SessionPriviledge {
|
5
|
+
uuid: string;
|
6
|
+
name: string;
|
7
|
+
}
|
8
|
+
|
9
|
+
export interface User {
|
10
|
+
uuid: string;
|
11
|
+
display: string;
|
12
|
+
givenName: string;
|
13
|
+
familyName: string;
|
14
|
+
firstName: string;
|
15
|
+
lastName: string;
|
16
|
+
person?: Person;
|
17
|
+
roles?: Role[];
|
18
|
+
privileges: SessionPriviledge[];
|
19
|
+
}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import { BaseOpenmrsData } from "../BaseOpenmrsData";
|
2
|
+
import { UserRoleScopeLocation } from "./UserRoleScopeLocation";
|
3
|
+
import { UserRoleScopeOperationType } from "./UserRoleScopeOperationType";
|
4
|
+
|
5
|
+
export interface UserRoleScope extends BaseOpenmrsData {
|
6
|
+
userUuid?: string;
|
7
|
+
role?: string;
|
8
|
+
userName?: string;
|
9
|
+
userGivenName?: string;
|
10
|
+
userFamilyName?: string;
|
11
|
+
permanent: boolean;
|
12
|
+
activeFrom?: Date;
|
13
|
+
activeTo?: Date;
|
14
|
+
enabled: boolean;
|
15
|
+
locations: UserRoleScopeLocation[];
|
16
|
+
operationTypes: UserRoleScopeOperationType[];
|
17
|
+
}
|