@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,491 @@
|
|
1
|
+
import React, { useState } from "react";
|
2
|
+
import { useTranslation } from "react-i18next";
|
3
|
+
import { TabItem } from "../../core/components/tabs/types";
|
4
|
+
import VerticalTabs from "../../core/components/tabs/vertical-tabs.component";
|
5
|
+
import BaseOperationDetails from "./base-operation-details.component";
|
6
|
+
import StockItemsAddition from "./stock-items-addition.component";
|
7
|
+
import StockOperationSubmission from "./stock-operation-submission.component";
|
8
|
+
import { AddStockOperationProps } from "./types";
|
9
|
+
import { useInitializeStockOperations } from "./add-stock-operation.resource";
|
10
|
+
import { AccordionSkeleton } from "@carbon/react";
|
11
|
+
import { closeOverlay } from "../../core/components/overlay/hook";
|
12
|
+
import {
|
13
|
+
addOrEditStockOperation,
|
14
|
+
showActionDialogButton,
|
15
|
+
} from "../stock-operation.utils";
|
16
|
+
import StockOperationApprovalButton from "../stock-operations-dialog/stock-operations-approve-button.component";
|
17
|
+
import StockOperationRejectButton from "../stock-operations-dialog/stock-operations-reject-button.component";
|
18
|
+
import StockOperationReturnButton from "../stock-operations-dialog/stock-operations-return-button.component";
|
19
|
+
import StockOperationCancelButton from "../stock-operations-dialog/stock-operations-cancel-button.component";
|
20
|
+
import StockOperationPrintButton from "../stock-operations-dialog/stock-operations-print-button.component";
|
21
|
+
import StockOperationApproveDispatchButton from "../stock-operations-dialog/stock-operations-approve-dispatch-button.component";
|
22
|
+
import StockOperationCompleteDispatchButton from "../stock-operations-dialog/stock-operations-completed-dispatch-button.component";
|
23
|
+
import StockOperationIssueStockButton from "../stock-operations-dialog/stock-operations-issue-stock-button.component";
|
24
|
+
import { StockOperation } from "./stock-operation-context/useStockOperationContext";
|
25
|
+
import { formatDate, parseDate, showToast } from "@openmrs/esm-framework";
|
26
|
+
import {
|
27
|
+
OperationType,
|
28
|
+
StockOperationType,
|
29
|
+
} from "../../core/api/types/stockOperation/StockOperationType";
|
30
|
+
import { operationStatusColor } from "../stock-operations.resource";
|
31
|
+
import styles from "./add-stock-operation.scss";
|
32
|
+
|
33
|
+
const AddStockOperation: React.FC<AddStockOperationProps> = (props) => {
|
34
|
+
const { t } = useTranslation();
|
35
|
+
const { isEditing, canEdit, canPrint } = props;
|
36
|
+
const { isLoading, isError, result } = useInitializeStockOperations(props);
|
37
|
+
const [manageStockItems, setManageStockItems] = useState(props?.isEditing);
|
38
|
+
const [manageSubmitOrComplete, setManageSubmitOrComplete] = useState(
|
39
|
+
props?.isEditing
|
40
|
+
);
|
41
|
+
const [selectedIndex, setSelectedIndex] = useState(0);
|
42
|
+
|
43
|
+
if (isLoading) return <AccordionSkeleton />;
|
44
|
+
if (isError) {
|
45
|
+
closeOverlay();
|
46
|
+
showToast({
|
47
|
+
kind: "error",
|
48
|
+
title: t("error", "Error"),
|
49
|
+
description: t("errorLoadingStockOperation", "Error loading stock item"),
|
50
|
+
millis: 5000,
|
51
|
+
critical: true,
|
52
|
+
});
|
53
|
+
return;
|
54
|
+
}
|
55
|
+
|
56
|
+
let operations: StockOperationType[] | null | undefined;
|
57
|
+
|
58
|
+
const tabs: TabItem[] = [
|
59
|
+
{
|
60
|
+
name: isEditing
|
61
|
+
? `${props?.model?.operationTypeName} Details`
|
62
|
+
: `${props?.operation?.name} Details`,
|
63
|
+
component: (
|
64
|
+
<BaseOperationDetails
|
65
|
+
{...props}
|
66
|
+
isEditing={
|
67
|
+
props?.operation?.name === "Stock Issue" ? !isEditing : isEditing
|
68
|
+
}
|
69
|
+
setup={result}
|
70
|
+
canEdit={
|
71
|
+
props?.operation?.name === "Stock Issue" ? !canEdit : canEdit
|
72
|
+
}
|
73
|
+
model={
|
74
|
+
isEditing
|
75
|
+
? props?.model
|
76
|
+
: props?.operation?.name === "Stock Issue"
|
77
|
+
? props?.model
|
78
|
+
: result?.dto
|
79
|
+
} // check if type is stockIssue and pass requistion data
|
80
|
+
onSave={async () => {
|
81
|
+
setManageStockItems(true);
|
82
|
+
setSelectedIndex(1);
|
83
|
+
}}
|
84
|
+
operation={props.operation}
|
85
|
+
/>
|
86
|
+
),
|
87
|
+
},
|
88
|
+
{
|
89
|
+
name: t("stockItems", "Stock Items"),
|
90
|
+
component: (
|
91
|
+
<StockItemsAddition
|
92
|
+
{...props}
|
93
|
+
isEditing={isEditing}
|
94
|
+
setup={result}
|
95
|
+
canEdit={canEdit}
|
96
|
+
model={
|
97
|
+
isEditing
|
98
|
+
? props?.model
|
99
|
+
: props?.operation?.name === "Stock Issue"
|
100
|
+
? props?.model
|
101
|
+
: result?.dto
|
102
|
+
} // check if type is stockIssue and pass requistion data
|
103
|
+
onSave={async () => {
|
104
|
+
setManageSubmitOrComplete(true);
|
105
|
+
setSelectedIndex(2);
|
106
|
+
}}
|
107
|
+
/>
|
108
|
+
),
|
109
|
+
disabled: !(isEditing || manageStockItems),
|
110
|
+
},
|
111
|
+
{
|
112
|
+
name: result?.requiresDispatchAcknowledgement
|
113
|
+
? "Submit/Dispatch"
|
114
|
+
: "Submit/Complete",
|
115
|
+
component: (
|
116
|
+
<StockOperationSubmission
|
117
|
+
{...props}
|
118
|
+
isEditing={isEditing}
|
119
|
+
setup={result}
|
120
|
+
canEdit={canEdit}
|
121
|
+
locked={false}
|
122
|
+
model={isEditing ? props?.model : result?.dto}
|
123
|
+
requiresDispatchAcknowledgement={
|
124
|
+
isEditing
|
125
|
+
? props?.model?.operationType === "return" ||
|
126
|
+
props?.model?.operationType === "issuestock"
|
127
|
+
: result.requiresDispatchAcknowledgement
|
128
|
+
}
|
129
|
+
actions={{
|
130
|
+
onSave: async (model) => {
|
131
|
+
// TODO: Update
|
132
|
+
await addOrEditStockOperation(
|
133
|
+
model,
|
134
|
+
props.isEditing,
|
135
|
+
props.operation,
|
136
|
+
props.operations,
|
137
|
+
props.canPrint
|
138
|
+
);
|
139
|
+
},
|
140
|
+
onGoBack: () => {
|
141
|
+
setSelectedIndex(1);
|
142
|
+
},
|
143
|
+
onComplete: async () => {
|
144
|
+
await showActionDialogButton("Complete", true, props?.model);
|
145
|
+
},
|
146
|
+
onSubmit: async () => {
|
147
|
+
await showActionDialogButton("Submit", true, props?.model);
|
148
|
+
},
|
149
|
+
onDispatch: async () => {
|
150
|
+
await showActionDialogButton("Dispatch", true, props?.model);
|
151
|
+
},
|
152
|
+
}}
|
153
|
+
/>
|
154
|
+
),
|
155
|
+
disabled: !(props.isEditing || manageSubmitOrComplete),
|
156
|
+
},
|
157
|
+
];
|
158
|
+
|
159
|
+
return (
|
160
|
+
<>
|
161
|
+
{!isEditing && props.operation.name === "Stock Issue" ? (
|
162
|
+
<></>
|
163
|
+
) : (
|
164
|
+
<div
|
165
|
+
style={{
|
166
|
+
display: "flex",
|
167
|
+
justifyContent: "space-between",
|
168
|
+
margin: "5px",
|
169
|
+
}}
|
170
|
+
>
|
171
|
+
<div style={{ margin: "10px" }}>
|
172
|
+
{isEditing && (
|
173
|
+
<div style={{ display: "flex", flexDirection: "row" }}>
|
174
|
+
<span className={styles.textHeading}>
|
175
|
+
{t("status", "Status ")}:
|
176
|
+
</span>
|
177
|
+
<span
|
178
|
+
style={{
|
179
|
+
marginLeft: "2px",
|
180
|
+
color: `${operationStatusColor(props?.model?.status)}`,
|
181
|
+
}}
|
182
|
+
>
|
183
|
+
{props?.model?.status}
|
184
|
+
</span>
|
185
|
+
</div>
|
186
|
+
)}
|
187
|
+
<div className={styles.statusContainer}>
|
188
|
+
{props?.model?.dateCreated && (
|
189
|
+
<div>
|
190
|
+
<span className={styles.textHeading}>
|
191
|
+
{t("started", "Started")}:
|
192
|
+
</span>
|
193
|
+
<div className={styles.statusDescriptions}>
|
194
|
+
<span className={styles.text}>
|
195
|
+
{formatDate(
|
196
|
+
parseDate(props?.model?.dateCreated.toString()),
|
197
|
+
{
|
198
|
+
time: true,
|
199
|
+
mode: "standard",
|
200
|
+
}
|
201
|
+
)}
|
202
|
+
</span>
|
203
|
+
|
204
|
+
<span className={styles.text}>By</span>
|
205
|
+
|
206
|
+
<span className={styles.text}>
|
207
|
+
{props?.model?.creatorFamilyName}
|
208
|
+
{props?.model?.creatorGivenName}
|
209
|
+
</span>
|
210
|
+
</div>
|
211
|
+
</div>
|
212
|
+
)}
|
213
|
+
|
214
|
+
{props?.model?.submittedDate && (
|
215
|
+
<div>
|
216
|
+
<span className={styles.textHeading}>
|
217
|
+
{t("submitted", "Submitted")}:
|
218
|
+
</span>
|
219
|
+
<div className={styles.statusDescriptions}>
|
220
|
+
<span className={styles.text}>
|
221
|
+
{formatDate(
|
222
|
+
parseDate(props?.model?.submittedDate.toString()),
|
223
|
+
{
|
224
|
+
time: true,
|
225
|
+
mode: "standard",
|
226
|
+
}
|
227
|
+
)}
|
228
|
+
</span>
|
229
|
+
|
230
|
+
<span className={styles.text}>By</span>
|
231
|
+
|
232
|
+
<span className={styles.text}>
|
233
|
+
{props?.model?.submittedByFamilyName}
|
234
|
+
{props?.model?.submittedByGivenName}
|
235
|
+
</span>
|
236
|
+
</div>
|
237
|
+
</div>
|
238
|
+
)}
|
239
|
+
|
240
|
+
{props?.model?.dispatchedDate && (
|
241
|
+
<div>
|
242
|
+
<span className={styles.textHeading}>
|
243
|
+
{t("dispatched", "Dispatched")}:
|
244
|
+
</span>
|
245
|
+
<div className={styles.statusDescriptions}>
|
246
|
+
<span className={styles.text}>
|
247
|
+
{formatDate(
|
248
|
+
parseDate(props?.model?.dispatchedDate.toString()),
|
249
|
+
{
|
250
|
+
time: true,
|
251
|
+
mode: "standard",
|
252
|
+
}
|
253
|
+
)}
|
254
|
+
</span>
|
255
|
+
|
256
|
+
<span className={styles.text}>By</span>
|
257
|
+
|
258
|
+
<span className={styles.text}>
|
259
|
+
{props?.model?.dispatchedByFamilyName}
|
260
|
+
{props?.model?.dispatchedByGivenName}
|
261
|
+
</span>
|
262
|
+
</div>
|
263
|
+
</div>
|
264
|
+
)}
|
265
|
+
|
266
|
+
{props?.model?.returnedDate && (
|
267
|
+
<div>
|
268
|
+
<span className={styles.textHeading}>
|
269
|
+
{t("returned", "Returned")}:
|
270
|
+
</span>
|
271
|
+
<div className={styles.statusDescriptions}>
|
272
|
+
<span className={styles.text}>
|
273
|
+
{formatDate(
|
274
|
+
parseDate(props?.model?.returnedDate.toString()),
|
275
|
+
{
|
276
|
+
time: true,
|
277
|
+
mode: "standard",
|
278
|
+
}
|
279
|
+
)}
|
280
|
+
</span>
|
281
|
+
|
282
|
+
<span className={styles.text}>By</span>
|
283
|
+
|
284
|
+
<span className={styles.text}>
|
285
|
+
{props?.model?.returnedByFamilyName}
|
286
|
+
{props?.model?.returnedByGivenName}
|
287
|
+
</span>
|
288
|
+
<span className={styles.text}>
|
289
|
+
{props?.model?.returnReason}
|
290
|
+
</span>
|
291
|
+
</div>
|
292
|
+
</div>
|
293
|
+
)}
|
294
|
+
|
295
|
+
{props?.model?.completedDate && (
|
296
|
+
<div>
|
297
|
+
<span className={styles.textHeading}>
|
298
|
+
{t("completed", "Completed")}:
|
299
|
+
</span>
|
300
|
+
<div className={styles.statusDescriptions}>
|
301
|
+
<span className={styles.text}>
|
302
|
+
{formatDate(
|
303
|
+
parseDate(props?.model?.completedDate.toString()),
|
304
|
+
{
|
305
|
+
time: true,
|
306
|
+
mode: "standard",
|
307
|
+
}
|
308
|
+
)}
|
309
|
+
</span>
|
310
|
+
|
311
|
+
<span className={styles.text}>By</span>
|
312
|
+
|
313
|
+
<span className={styles.text}>
|
314
|
+
{props?.model?.completedByFamilyName}
|
315
|
+
{props?.model?.completedByGivenName}
|
316
|
+
</span>
|
317
|
+
</div>
|
318
|
+
</div>
|
319
|
+
)}
|
320
|
+
|
321
|
+
{props?.model?.status === "CANCELLED" && (
|
322
|
+
<div>
|
323
|
+
<span className={styles.textHeading}>
|
324
|
+
{t("cancelled", "Cancelled")}:
|
325
|
+
</span>
|
326
|
+
<div className={styles.statusDescriptions}>
|
327
|
+
<span className={styles.text}>
|
328
|
+
{formatDate(
|
329
|
+
parseDate(props?.model?.cancelledDate.toString()),
|
330
|
+
{
|
331
|
+
time: true,
|
332
|
+
mode: "standard",
|
333
|
+
}
|
334
|
+
)}
|
335
|
+
</span>
|
336
|
+
|
337
|
+
<span className={styles.text}>By</span>
|
338
|
+
|
339
|
+
<span className={styles.text}>
|
340
|
+
{props?.model?.cancelledByFamilyName}
|
341
|
+
{props?.model?.cancelledByGivenName}
|
342
|
+
<span className={styles.text}>
|
343
|
+
{props?.model?.cancelReason}
|
344
|
+
</span>
|
345
|
+
</span>
|
346
|
+
</div>
|
347
|
+
</div>
|
348
|
+
)}
|
349
|
+
|
350
|
+
{props?.model?.status === "REJECTED" && (
|
351
|
+
<div>
|
352
|
+
<span className={styles.textHeading}>
|
353
|
+
{t("rejected", "Rejected")}:
|
354
|
+
</span>
|
355
|
+
<div className={styles.statusDescriptions}>
|
356
|
+
<span className={styles.text}>
|
357
|
+
{formatDate(
|
358
|
+
parseDate(props?.model?.rejectedDate.toString()),
|
359
|
+
{
|
360
|
+
time: true,
|
361
|
+
mode: "standard",
|
362
|
+
}
|
363
|
+
)}
|
364
|
+
</span>
|
365
|
+
|
366
|
+
<span className={styles.text}>By</span>
|
367
|
+
|
368
|
+
<span className={styles.text}>
|
369
|
+
{props?.model?.rejectedByFamilyName}
|
370
|
+
{props?.model?.rejectedByGivenName}
|
371
|
+
<span>{props?.model?.rejectionReason}</span>
|
372
|
+
</span>
|
373
|
+
</div>
|
374
|
+
</div>
|
375
|
+
)}
|
376
|
+
</div>
|
377
|
+
</div>
|
378
|
+
|
379
|
+
{((!props?.model?.permission?.canEdit &&
|
380
|
+
(props?.model?.permission?.canApprove ||
|
381
|
+
props?.model?.permission?.canReceiveItems)) ||
|
382
|
+
props?.model?.permission?.canEdit ||
|
383
|
+
canPrint ||
|
384
|
+
props?.model?.permission?.isRequisitionAndCanIssueStock) && (
|
385
|
+
<div
|
386
|
+
style={{
|
387
|
+
margin: "10px",
|
388
|
+
display: "flex",
|
389
|
+
flexDirection: "row",
|
390
|
+
}}
|
391
|
+
>
|
392
|
+
<>
|
393
|
+
{!props?.model?.permission?.canEdit &&
|
394
|
+
props?.model?.permission?.canApprove && (
|
395
|
+
<>
|
396
|
+
{(props?.model
|
397
|
+
? props?.model?.operationTypeName ===
|
398
|
+
OperationType.RETURN_OPERATION_TYPE ||
|
399
|
+
props?.model?.operationTypeName ===
|
400
|
+
OperationType.STOCK_ISSUE_OPERATION_TYPE
|
401
|
+
: true) && (
|
402
|
+
<div style={{ margin: "2px" }}>
|
403
|
+
<StockOperationApprovalButton
|
404
|
+
operation={props?.model}
|
405
|
+
/>
|
406
|
+
</div>
|
407
|
+
)}
|
408
|
+
{!(props?.model
|
409
|
+
? props?.model?.operationTypeName ===
|
410
|
+
OperationType.RETURN_OPERATION_TYPE ||
|
411
|
+
props?.model?.operationTypeName ===
|
412
|
+
OperationType.STOCK_ISSUE_OPERATION_TYPE
|
413
|
+
: true) && (
|
414
|
+
<div style={{ margin: "2px" }}>
|
415
|
+
<StockOperationApproveDispatchButton
|
416
|
+
operation={props?.model}
|
417
|
+
/>
|
418
|
+
</div>
|
419
|
+
)}
|
420
|
+
|
421
|
+
<div style={{ margin: "2px" }}>
|
422
|
+
<StockOperationRejectButton operation={props?.model} />
|
423
|
+
</div>
|
424
|
+
<div style={{ margin: "2px" }}>
|
425
|
+
<StockOperationReturnButton operation={props?.model} />
|
426
|
+
</div>
|
427
|
+
<div style={{ margin: "2px" }}>
|
428
|
+
<StockOperationCancelButton operation={props?.model} />
|
429
|
+
</div>
|
430
|
+
</>
|
431
|
+
)}
|
432
|
+
|
433
|
+
{!props?.model?.permission?.canEdit &&
|
434
|
+
props?.model?.permission?.canReceiveItems && (
|
435
|
+
<>
|
436
|
+
<div style={{ margin: "2px" }}>
|
437
|
+
<StockOperationCompleteDispatchButton
|
438
|
+
operation={props?.model}
|
439
|
+
/>
|
440
|
+
</div>
|
441
|
+
<div style={{ margin: "2px" }}>
|
442
|
+
<StockOperationReturnButton operation={props?.model} />
|
443
|
+
</div>
|
444
|
+
</>
|
445
|
+
)}
|
446
|
+
|
447
|
+
{props?.model?.permission?.canEdit && (
|
448
|
+
<div style={{ margin: "2px" }}>
|
449
|
+
<StockOperationCancelButton operation={props?.model} />
|
450
|
+
</div>
|
451
|
+
)}
|
452
|
+
|
453
|
+
{props?.model?.permission?.isRequisitionAndCanIssueStock && (
|
454
|
+
<div style={{ margin: "2px" }}>
|
455
|
+
<StockOperationIssueStockButton
|
456
|
+
operation={props?.model}
|
457
|
+
operations={operations}
|
458
|
+
/>
|
459
|
+
</div>
|
460
|
+
)}
|
461
|
+
{(props?.model?.permission?.isRequisitionAndCanIssueStock ||
|
462
|
+
props?.model?.operationType ===
|
463
|
+
OperationType.STOCK_ISSUE_OPERATION_TYPE ||
|
464
|
+
props?.model?.operationType ===
|
465
|
+
OperationType.REQUISITION_OPERATION_TYPE ||
|
466
|
+
props?.model?.operationType ===
|
467
|
+
OperationType.RECEIPT_OPERATION_TYPE ||
|
468
|
+
props?.model?.operationType ===
|
469
|
+
OperationType.TRANSFER_OUT_OPERATION_TYPE) && (
|
470
|
+
<div style={{ margin: "2px" }}>
|
471
|
+
<StockOperationPrintButton operation={props?.model} />
|
472
|
+
</div>
|
473
|
+
)}
|
474
|
+
</>
|
475
|
+
</div>
|
476
|
+
)}
|
477
|
+
</div>
|
478
|
+
)}
|
479
|
+
|
480
|
+
<StockOperation>
|
481
|
+
<VerticalTabs
|
482
|
+
tabs={tabs}
|
483
|
+
selectedIndex={selectedIndex}
|
484
|
+
onChange={setSelectedIndex}
|
485
|
+
/>
|
486
|
+
</StockOperation>
|
487
|
+
</>
|
488
|
+
);
|
489
|
+
};
|
490
|
+
|
491
|
+
export default AddStockOperation;
|
@@ -0,0 +1,33 @@
|
|
1
|
+
import { useEffect, useState } from "react";
|
2
|
+
import { initializeNewStockOperation } from "./add-stock-operation.utils";
|
3
|
+
import { AddStockOperationProps, InitializeResult } from "./types";
|
4
|
+
|
5
|
+
export const useInitializeStockOperations = (props: AddStockOperationProps) => {
|
6
|
+
const [isLoading, setIsLoading] = useState(true);
|
7
|
+
const [isError, setIsError] = useState(false);
|
8
|
+
const [result, setResult] = useState<InitializeResult>();
|
9
|
+
// const urlQueryParams = useUrlQueryParams();
|
10
|
+
|
11
|
+
useEffect(() => {
|
12
|
+
setIsLoading(true);
|
13
|
+
initializeNewStockOperation(
|
14
|
+
props.operation,
|
15
|
+
// urlQueryParams,
|
16
|
+
props.model,
|
17
|
+
props.operations
|
18
|
+
)
|
19
|
+
.then((data) => {
|
20
|
+
setResult(data);
|
21
|
+
setIsLoading(false);
|
22
|
+
})
|
23
|
+
.catch(() => {
|
24
|
+
setIsError(true);
|
25
|
+
});
|
26
|
+
}, [props.model, props.operation, props.operations]);
|
27
|
+
|
28
|
+
return {
|
29
|
+
isLoading,
|
30
|
+
isError,
|
31
|
+
result,
|
32
|
+
};
|
33
|
+
};
|
@@ -0,0 +1,44 @@
|
|
1
|
+
@use '@carbon/styles/scss/spacing';
|
2
|
+
@use '@carbon/styles/scss/type';
|
3
|
+
@import '~@openmrs/esm-styleguide/src/vars';
|
4
|
+
|
5
|
+
.sectionTitle {
|
6
|
+
@include type.type-style('heading-compact-02');
|
7
|
+
color: $text-02;
|
8
|
+
margin-bottom: spacing.$spacing-04;
|
9
|
+
}
|
10
|
+
|
11
|
+
.modalBody {
|
12
|
+
padding-bottom: spacing.$spacing-05;
|
13
|
+
}
|
14
|
+
|
15
|
+
.actionsContainer {
|
16
|
+
display: "flex";
|
17
|
+
justify-content: space-between;
|
18
|
+
margin: "5px";
|
19
|
+
}
|
20
|
+
|
21
|
+
.statusDescriptions {
|
22
|
+
display: "flex";
|
23
|
+
flex-direction: "row";
|
24
|
+
}
|
25
|
+
|
26
|
+
.statusContainer {
|
27
|
+
display: "flex";
|
28
|
+
flex-direction: "row";
|
29
|
+
margin-top: "4px";
|
30
|
+
}
|
31
|
+
|
32
|
+
.text {
|
33
|
+
font-size: "8px";
|
34
|
+
}
|
35
|
+
.textHeading {
|
36
|
+
font-size: "10px";
|
37
|
+
font-weight: bold;
|
38
|
+
}
|
39
|
+
|
40
|
+
.actionButtons {
|
41
|
+
margin: "10px";
|
42
|
+
display: "flex";
|
43
|
+
flex-direction: "row";
|
44
|
+
}
|