@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,67 @@
|
|
1
|
+
import React, { ReactNode } from "react";
|
2
|
+
import { Control, Controller, FieldValues } from "react-hook-form";
|
3
|
+
import { Concept } from "../../../core/api/types/concept/Concept";
|
4
|
+
import { ComboBox, TextInputSkeleton } from "@carbon/react";
|
5
|
+
import { useConceptById } from "../../../stock-lookups/stock-lookups.resource";
|
6
|
+
import { STOCK_ITEM_CATEGORY_CONCEPT_ID } from "../../../constants";
|
7
|
+
|
8
|
+
interface StockItemCategorySelectorProps<T> {
|
9
|
+
categoryUuid?: string;
|
10
|
+
onCategoryUuidChange?: (unit: Concept) => void;
|
11
|
+
title?: string;
|
12
|
+
placeholder?: string;
|
13
|
+
invalid?: boolean;
|
14
|
+
invalidText?: ReactNode;
|
15
|
+
|
16
|
+
// Control
|
17
|
+
controllerName: string;
|
18
|
+
name: string;
|
19
|
+
control: Control<FieldValues, T>;
|
20
|
+
}
|
21
|
+
|
22
|
+
const StockItemCategorySelector = <T,>(
|
23
|
+
props: StockItemCategorySelectorProps<T>
|
24
|
+
) => {
|
25
|
+
const {
|
26
|
+
items: { answers: categories },
|
27
|
+
isLoading,
|
28
|
+
} = useConceptById(STOCK_ITEM_CATEGORY_CONCEPT_ID);
|
29
|
+
|
30
|
+
if (isLoading) return <TextInputSkeleton />;
|
31
|
+
|
32
|
+
return (
|
33
|
+
<Controller
|
34
|
+
name={props.controllerName}
|
35
|
+
control={props.control}
|
36
|
+
render={({ field: { onChange, value, ref } }) => (
|
37
|
+
<ComboBox
|
38
|
+
titleText={props.title}
|
39
|
+
name={props.name}
|
40
|
+
control={props.control}
|
41
|
+
controllerName={props.controllerName}
|
42
|
+
id={props.name}
|
43
|
+
size={"md"}
|
44
|
+
items={categories || []}
|
45
|
+
onChange={(data: { selectedItem: Concept }) => {
|
46
|
+
props.onCategoryUuidChange?.(data.selectedItem);
|
47
|
+
onChange(data.selectedItem?.uuid);
|
48
|
+
}}
|
49
|
+
initialSelectedItem={
|
50
|
+
categories?.find((p) => p.uuid === props.categoryUuid) || {}
|
51
|
+
}
|
52
|
+
itemToString={(item?: Concept) =>
|
53
|
+
item && item?.display ? `${item?.display}` : ""
|
54
|
+
}
|
55
|
+
shouldFilterItem={() => true}
|
56
|
+
value={categories?.find((p) => p.uuid === value)?.display ?? ""}
|
57
|
+
placeholder={props.placeholder}
|
58
|
+
ref={ref}
|
59
|
+
invalid={props.invalid}
|
60
|
+
invalidText={props.invalidText}
|
61
|
+
/>
|
62
|
+
)}
|
63
|
+
/>
|
64
|
+
);
|
65
|
+
};
|
66
|
+
|
67
|
+
export default StockItemCategorySelector;
|
File without changes
|
File without changes
|
@@ -0,0 +1,239 @@
|
|
1
|
+
import React, { forwardRef, useEffect, useState } from "react";
|
2
|
+
import { useTranslation } from "react-i18next";
|
3
|
+
import { Save } from "@carbon/react/icons";
|
4
|
+
|
5
|
+
import { Button, FormGroup, InlineLoading } from "@carbon/react";
|
6
|
+
import { StockItemDTO } from "../../../core/api/types/stockItem/StockItem";
|
7
|
+
import DrugSelector from "../drug-selector/drug-selector.component";
|
8
|
+
import { useForm } from "react-hook-form";
|
9
|
+
import { zodResolver } from "@hookform/resolvers/zod";
|
10
|
+
import {
|
11
|
+
stockItemDetailsSchema,
|
12
|
+
StockItemFormData,
|
13
|
+
} from "../../validationSchema";
|
14
|
+
import ControlledRadioButtonGroup from "../../../core/components/carbon/controlled-radio-button-group/controlled-radio-button-group.component";
|
15
|
+
import ControlledNumberInput from "../../../core/components/carbon/controlled-number-input/controlled-number-input.component";
|
16
|
+
import ControlledTextInput from "../../../core/components/carbon/controlled-text-input/controlled-text-input.component";
|
17
|
+
import DispensingUnitSelector from "../dispensing-unit-selector/dispensing-unit-selector.component";
|
18
|
+
import PreferredVendorSelector from "../preferred-vendor-selector/preferred-vendor-selector.component";
|
19
|
+
import StockItemCategorySelector from "../stock-item-category-selector/stock-item-category-selector.component";
|
20
|
+
import StockItemUnitsEdit from "../stock-item-units-edit/stock-item-units-edit.component";
|
21
|
+
import { SaveStockItem } from "../../types";
|
22
|
+
import ConceptsSelector from "../concepts-selector/concepts-selector.component";
|
23
|
+
import rootStyles from "../../../root.scss";
|
24
|
+
import { closeOverlay } from "../../../core/components/overlay/hook";
|
25
|
+
import { expirationOptions, radioOptions } from "./stock-item-details.resource";
|
26
|
+
import { handleMutate } from "../../../stock-operations/swr-revalidation";
|
27
|
+
|
28
|
+
interface StockItemDetailsProps {
|
29
|
+
model: StockItemDTO;
|
30
|
+
onSave: SaveStockItem;
|
31
|
+
isEditing?: boolean;
|
32
|
+
handleTabChange: (index) => void;
|
33
|
+
}
|
34
|
+
|
35
|
+
const StockItemDetails = forwardRef<never, StockItemDetailsProps>(
|
36
|
+
({ model, onSave, isEditing, handleTabChange }) => {
|
37
|
+
const { t } = useTranslation();
|
38
|
+
const { handleSubmit, control, formState } = useForm<StockItemFormData>({
|
39
|
+
defaultValues: model,
|
40
|
+
mode: "all",
|
41
|
+
resolver: zodResolver(stockItemDetailsSchema),
|
42
|
+
});
|
43
|
+
|
44
|
+
const { errors } = formState;
|
45
|
+
const handleSave = async (item: StockItemDTO) => {
|
46
|
+
try {
|
47
|
+
setIsSaving(true);
|
48
|
+
|
49
|
+
// Restore uuid
|
50
|
+
item.uuid = model.uuid;
|
51
|
+
await onSave(item);
|
52
|
+
handleTabChange(1);
|
53
|
+
handleMutate("ws/rest/v1/stockmanagement/stockitem");
|
54
|
+
} catch (e) {
|
55
|
+
// Show notification
|
56
|
+
} finally {
|
57
|
+
setIsSaving(false);
|
58
|
+
}
|
59
|
+
};
|
60
|
+
|
61
|
+
const [isSaving, setIsSaving] = useState(false);
|
62
|
+
const [isDrug, setIsDrug] = useState(false);
|
63
|
+
const [hasExpiration, setHasExpiration] = useState(false);
|
64
|
+
|
65
|
+
useEffect(() => {
|
66
|
+
setIsDrug(model.isDrug ?? false);
|
67
|
+
setHasExpiration(model.hasExpiration ?? false);
|
68
|
+
}, [model.hasExpiration, model.isDrug]);
|
69
|
+
|
70
|
+
return (
|
71
|
+
<form
|
72
|
+
className={`${rootStyles.formContainer} ${rootStyles.verticalForm}`}
|
73
|
+
>
|
74
|
+
<FormGroup
|
75
|
+
className="clear-margin-bottom"
|
76
|
+
legendText={t("itemType", "Item Type")}
|
77
|
+
title={t("itemType", "Item Type")}
|
78
|
+
>
|
79
|
+
<ControlledRadioButtonGroup
|
80
|
+
control={control}
|
81
|
+
name="isDrug"
|
82
|
+
controllerName="isDrug"
|
83
|
+
legendText=""
|
84
|
+
invalid={!!errors.isDrug}
|
85
|
+
invalidText={errors.isDrug && errors?.isDrug?.message}
|
86
|
+
onChange={(selection: boolean) => {
|
87
|
+
setIsDrug(selection);
|
88
|
+
}}
|
89
|
+
options={radioOptions} // Pass radioOptions directly
|
90
|
+
/>
|
91
|
+
</FormGroup>
|
92
|
+
{isDrug && (
|
93
|
+
<DrugSelector
|
94
|
+
name="drugUuid"
|
95
|
+
controllerName="drugUuid"
|
96
|
+
control={control}
|
97
|
+
title={t("pleaseSpecify", "Please specify:")}
|
98
|
+
invalid={!!errors.drugUuid}
|
99
|
+
invalidText={errors.drugUuid && errors?.drugUuid?.message}
|
100
|
+
/>
|
101
|
+
)}
|
102
|
+
{isDrug != undefined && !isDrug && (
|
103
|
+
<ConceptsSelector
|
104
|
+
name="conceptUuid"
|
105
|
+
controllerName="conceptUuid"
|
106
|
+
control={control}
|
107
|
+
title={t("pleaseSpecify", "Please specify:")}
|
108
|
+
placeholder={t("chooseAnItem", "Choose an item")}
|
109
|
+
invalid={!!errors.drugUuid}
|
110
|
+
invalidText={errors.drugUuid && errors?.drugUuid?.message}
|
111
|
+
/>
|
112
|
+
)}
|
113
|
+
<ControlledTextInput
|
114
|
+
id="commonName"
|
115
|
+
name="commonName"
|
116
|
+
control={control}
|
117
|
+
controllerName="commonName"
|
118
|
+
maxLength={255}
|
119
|
+
size={"md"}
|
120
|
+
value={`${model?.commonName ?? ""}`}
|
121
|
+
labelText={t("commonName", "Common name:")}
|
122
|
+
invalid={!!errors.commonName}
|
123
|
+
invalidText={errors.commonName && errors?.commonName?.message}
|
124
|
+
/>
|
125
|
+
<ControlledTextInput
|
126
|
+
id="acronym"
|
127
|
+
maxLength={255}
|
128
|
+
name="acronym"
|
129
|
+
control={control}
|
130
|
+
controllerName="acronym"
|
131
|
+
size={"md"}
|
132
|
+
labelText={t("abbreviation", "Abbreviation:")}
|
133
|
+
invalid={!!errors.acronym}
|
134
|
+
invalidText={errors.acronym && errors?.acronym?.message}
|
135
|
+
/>
|
136
|
+
<div
|
137
|
+
style={{
|
138
|
+
display: "grid",
|
139
|
+
gridTemplateColumns: "1fr 1fr",
|
140
|
+
justifyContent: "center",
|
141
|
+
}}
|
142
|
+
>
|
143
|
+
<FormGroup
|
144
|
+
className="clear-margin-bottom"
|
145
|
+
legendText={t("hasExpiration", "Does the item expire?")}
|
146
|
+
title={t("hasExpiration", "Does the item expire?")}
|
147
|
+
>
|
148
|
+
<ControlledRadioButtonGroup
|
149
|
+
name="hasExpiration"
|
150
|
+
controllerName="hasExpiration"
|
151
|
+
control={control}
|
152
|
+
legendText=""
|
153
|
+
invalid={!!errors.hasExpiration}
|
154
|
+
invalidText={
|
155
|
+
errors.hasExpiration && errors?.hasExpiration?.message
|
156
|
+
}
|
157
|
+
onChange={(selection: boolean) => {
|
158
|
+
setHasExpiration(selection);
|
159
|
+
}}
|
160
|
+
options={expirationOptions} // Pass expirationOptions directly
|
161
|
+
/>
|
162
|
+
</FormGroup>
|
163
|
+
|
164
|
+
{hasExpiration && (
|
165
|
+
<ControlledNumberInput
|
166
|
+
id="expiryNotice"
|
167
|
+
name="expiryNotice"
|
168
|
+
control={control}
|
169
|
+
controllerName="expiryNotice"
|
170
|
+
size={"md"}
|
171
|
+
allowEmpty={true}
|
172
|
+
label={t("expiryNoticeDays", "Expiration Notice (days)")}
|
173
|
+
invalid={!!errors.expiryNotice}
|
174
|
+
invalidText={errors.expiryNotice && errors?.expiryNotice?.message}
|
175
|
+
/>
|
176
|
+
)}
|
177
|
+
</div>
|
178
|
+
<PreferredVendorSelector
|
179
|
+
name="preferredVendorUuid"
|
180
|
+
controllerName="preferredVendorUuid"
|
181
|
+
control={control}
|
182
|
+
title={t("whoIsThePreferredVendor", "Who is the preferred vendor?")}
|
183
|
+
placeholder={t("chooseVendor", "Choose vendor")}
|
184
|
+
invalid={!!errors.preferredVendorUuid}
|
185
|
+
invalidText={
|
186
|
+
errors.preferredVendorUuid && errors?.preferredVendorUuid?.message
|
187
|
+
}
|
188
|
+
/>
|
189
|
+
<StockItemCategorySelector
|
190
|
+
name="categoryUuid"
|
191
|
+
controllerName="categoryUuid"
|
192
|
+
control={control}
|
193
|
+
title={t("category:", "Category:")}
|
194
|
+
placeholder={t("chooseACategory", "Choose a category")}
|
195
|
+
invalid={!!errors.categoryUuid}
|
196
|
+
invalidText={errors.categoryUuid && errors?.categoryUuid?.message}
|
197
|
+
/>
|
198
|
+
{isDrug && (
|
199
|
+
<DispensingUnitSelector
|
200
|
+
name="dispensingUnitUuid"
|
201
|
+
controllerName="dispensingUnitUuid"
|
202
|
+
control={control}
|
203
|
+
title={t("dispensingUnit", "Dispensing Unit:")}
|
204
|
+
placeholder={t("dispensingUnitHolder", "Choose a dispensing unit")}
|
205
|
+
invalid={!!errors.dispensingUnitUuid}
|
206
|
+
invalidText={
|
207
|
+
errors.dispensingUnitUuid && errors?.dispensingUnitUuid?.message
|
208
|
+
}
|
209
|
+
/>
|
210
|
+
)}
|
211
|
+
{isDrug && isEditing && (
|
212
|
+
<StockItemUnitsEdit
|
213
|
+
control={control}
|
214
|
+
formState={formState}
|
215
|
+
stockItemUuid={model.uuid}
|
216
|
+
/>
|
217
|
+
)}
|
218
|
+
|
219
|
+
<div style={{ display: "flex", flexDirection: "row-reverse" }}>
|
220
|
+
<Button
|
221
|
+
name="save"
|
222
|
+
type="button"
|
223
|
+
className="submitButton"
|
224
|
+
onClick={handleSubmit(handleSave)}
|
225
|
+
kind="primary"
|
226
|
+
renderIcon={Save}
|
227
|
+
>
|
228
|
+
{isSaving ? <InlineLoading /> : t("save", "Save")}
|
229
|
+
</Button>
|
230
|
+
<Button kind="secondary" onClick={closeOverlay}>
|
231
|
+
{t("cancel", "Cancel")}
|
232
|
+
</Button>
|
233
|
+
</div>
|
234
|
+
</form>
|
235
|
+
);
|
236
|
+
}
|
237
|
+
);
|
238
|
+
|
239
|
+
export default StockItemDetails;
|
@@ -0,0 +1,14 @@
|
|
1
|
+
export interface RadioOption {
|
2
|
+
label: string;
|
3
|
+
value: boolean;
|
4
|
+
}
|
5
|
+
|
6
|
+
export const radioOptions: RadioOption[] = [
|
7
|
+
{ label: "Drug", value: true },
|
8
|
+
{ label: "Other", value: false },
|
9
|
+
];
|
10
|
+
|
11
|
+
export const expirationOptions: RadioOption[] = [
|
12
|
+
{ label: "Yes", value: true },
|
13
|
+
{ label: "No", value: false },
|
14
|
+
];
|
@@ -0,0 +1,30 @@
|
|
1
|
+
import { Button } from "@carbon/react";
|
2
|
+
import React, { useCallback } from "react";
|
3
|
+
import { useTranslation } from "react-i18next";
|
4
|
+
import { launchOverlay } from "../../../core/components/overlay/hook";
|
5
|
+
import StockRulesAddOrUpdate from "./add-stock-rules.component";
|
6
|
+
|
7
|
+
interface AddStockRuleActionButtonProps {
|
8
|
+
stockItemUuid: string;
|
9
|
+
}
|
10
|
+
|
11
|
+
const AddStockRuleActionButton: React.FC<AddStockRuleActionButtonProps> = ({
|
12
|
+
stockItemUuid,
|
13
|
+
}) => {
|
14
|
+
const { t } = useTranslation();
|
15
|
+
|
16
|
+
const handleClick = useCallback(() => {
|
17
|
+
launchOverlay(
|
18
|
+
"Add Stock Rule",
|
19
|
+
<StockRulesAddOrUpdate stockItemUuid={stockItemUuid} />
|
20
|
+
);
|
21
|
+
}, []);
|
22
|
+
|
23
|
+
return (
|
24
|
+
<Button onClick={handleClick} size="md" kind="primary">
|
25
|
+
{t("stockmanagement.addnewrule", "Add New Rule")}
|
26
|
+
</Button>
|
27
|
+
);
|
28
|
+
};
|
29
|
+
|
30
|
+
export default AddStockRuleActionButton;
|