@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/root.scss
ADDED
@@ -0,0 +1,174 @@
|
|
1
|
+
@use '@carbon/styles/scss/spacing';
|
2
|
+
@use '@carbon/styles/scss/type';
|
3
|
+
@import "~carbon-components/scss/globals/scss/vendor/@carbon/elements/scss/type/styles";
|
4
|
+
@import "~carbon-components/src/globals/scss/vendor/@carbon/layout/scss/generated/spacing";
|
5
|
+
@import "~carbon-components/src/globals/scss/vendor/@carbon/layout/scss/generated/layout";
|
6
|
+
@import "carbon-components/scss/globals/scss/typography.scss";
|
7
|
+
@import "~@openmrs/esm-styleguide/src/vars";
|
8
|
+
|
9
|
+
$ui-01: #f4f4f4;
|
10
|
+
$ui-02: #ffffff;
|
11
|
+
$ui-03: #e0e0e0;
|
12
|
+
$ui-05: #161616;
|
13
|
+
$ui-background: #ffffff;
|
14
|
+
$color-gray-70: #525252;
|
15
|
+
$color-blue-60-2: #0f62fe;
|
16
|
+
$color-yellow-50: #feecae;
|
17
|
+
$inverse-support-03: #f1c21b;
|
18
|
+
$warning-background: #fff8e1;
|
19
|
+
$openmrs-background-grey: #f4f4f4;
|
20
|
+
$danger: #da1e28;
|
21
|
+
$interactive-01: #0f62fe;
|
22
|
+
$brand-teal-01: #3197D9;
|
23
|
+
$button-primary: #0078A6;
|
24
|
+
|
25
|
+
.productiveHeading01 {
|
26
|
+
@include carbon--type-style("productive-heading-01");
|
27
|
+
}
|
28
|
+
|
29
|
+
.productiveHeading02 {
|
30
|
+
@include carbon--type-style("productive-heading-02");
|
31
|
+
}
|
32
|
+
|
33
|
+
.productiveHeading03 {
|
34
|
+
@include carbon--type-style("productive-heading-03");
|
35
|
+
}
|
36
|
+
|
37
|
+
.productiveHeading04 {
|
38
|
+
@include carbon--type-style("productive-heading-04");
|
39
|
+
}
|
40
|
+
|
41
|
+
.productiveHeading05 {
|
42
|
+
@include carbon--type-style("productive-heading-05");
|
43
|
+
}
|
44
|
+
|
45
|
+
.productiveHeading06 {
|
46
|
+
@include carbon--type-style("productive-heading-06");
|
47
|
+
}
|
48
|
+
|
49
|
+
.bodyShort01 {
|
50
|
+
@include carbon--type-style("body-short-01");
|
51
|
+
}
|
52
|
+
|
53
|
+
.helperText01 {
|
54
|
+
@include carbon--type-style("helper-text-01");
|
55
|
+
}
|
56
|
+
|
57
|
+
.bodyShort02 {
|
58
|
+
@include carbon--type-style("body-short-02");
|
59
|
+
}
|
60
|
+
|
61
|
+
.bodyLong01 {
|
62
|
+
@include carbon--type-style("body-long-01");
|
63
|
+
}
|
64
|
+
|
65
|
+
.bodyLong02 {
|
66
|
+
@include carbon--type-style("body-long-02");
|
67
|
+
}
|
68
|
+
|
69
|
+
.label01 {
|
70
|
+
@include carbon--type-style("label-01");
|
71
|
+
}
|
72
|
+
|
73
|
+
.text01 {
|
74
|
+
color: $text-01;
|
75
|
+
}
|
76
|
+
|
77
|
+
.text02 {
|
78
|
+
color: $text-02;
|
79
|
+
}
|
80
|
+
|
81
|
+
aside {
|
82
|
+
background-color: $ui-02 !important;
|
83
|
+
}
|
84
|
+
|
85
|
+
// Login Overrides
|
86
|
+
|
87
|
+
div[class*='-esm-login__styles__center'] > img {
|
88
|
+
width: 140px; // design has 120px
|
89
|
+
}
|
90
|
+
|
91
|
+
:global(.tab-12rem) > button {
|
92
|
+
width: 12rem !important;
|
93
|
+
}
|
94
|
+
|
95
|
+
:global(.tab-14rem) > button {
|
96
|
+
width: 14rem !important;
|
97
|
+
}
|
98
|
+
|
99
|
+
:global(.tab-16rem) > button {
|
100
|
+
width: 16rem !important;
|
101
|
+
}
|
102
|
+
|
103
|
+
:global(.bx--overflow-menu) > div {
|
104
|
+
width: 15rem !important;
|
105
|
+
}
|
106
|
+
|
107
|
+
nav :global(.bx--accordion__title) {
|
108
|
+
color: #525252;
|
109
|
+
font-weight: 600 !important;
|
110
|
+
}
|
111
|
+
|
112
|
+
nav :global(.bx--accordion__content) {
|
113
|
+
padding-bottom: 0 !important;
|
114
|
+
padding-top: 0 !important;
|
115
|
+
}
|
116
|
+
|
117
|
+
nav :global(.bx--accordion__content) > a {
|
118
|
+
background-color: #cecece !important;
|
119
|
+
color: #161616 !important;
|
120
|
+
border-left-color: var(--brand-01) !important;
|
121
|
+
}
|
122
|
+
|
123
|
+
.container {
|
124
|
+
padding: spacing.$spacing-07;
|
125
|
+
}
|
126
|
+
|
127
|
+
.welcome {
|
128
|
+
@include type.type-style('heading-04');
|
129
|
+
margin: spacing.$spacing-05 0;
|
130
|
+
}
|
131
|
+
|
132
|
+
.explainer {
|
133
|
+
margin-bottom: 2rem;
|
134
|
+
}
|
135
|
+
|
136
|
+
.noMargin {
|
137
|
+
margin: 0 !important;
|
138
|
+
}
|
139
|
+
|
140
|
+
.noPadding {
|
141
|
+
margin: 0 !important;
|
142
|
+
}
|
143
|
+
|
144
|
+
.noSpacing {
|
145
|
+
margin: 0 !important;
|
146
|
+
padding: 0 !important;
|
147
|
+
}
|
148
|
+
|
149
|
+
.section {
|
150
|
+
margin: spacing.$spacing-03;
|
151
|
+
}
|
152
|
+
|
153
|
+
:global(.cds--table-sort__description) {
|
154
|
+
display: none;
|
155
|
+
}
|
156
|
+
|
157
|
+
.formContainer {
|
158
|
+
height: calc(100vh - 100px) !important;
|
159
|
+
overflow: scroll;
|
160
|
+
padding: 0 1rem;
|
161
|
+
}
|
162
|
+
|
163
|
+
.verticalForm {
|
164
|
+
display: flex;
|
165
|
+
grid-row-gap: 2em;
|
166
|
+
padding-top: 1rem;
|
167
|
+
align-content: space-between;
|
168
|
+
flex-direction: column;
|
169
|
+
|
170
|
+
:global(.cds--form-item) {
|
171
|
+
flex: none !important;
|
172
|
+
}
|
173
|
+
}
|
174
|
+
|
package/src/routes.json
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
{
|
2
|
+
"$schema": "https://json.openmrs.org/routes.schema.json",
|
3
|
+
"backendDependencies": {
|
4
|
+
"fhir2": "^1.2.0",
|
5
|
+
"webservices.rest": "^2.24.0"
|
6
|
+
},
|
7
|
+
"extensions": [
|
8
|
+
{
|
9
|
+
"name": "stock-management-dashboard",
|
10
|
+
"slot": "stock-management-dashboard-slot",
|
11
|
+
"component": "stockManagementDashboard"
|
12
|
+
},
|
13
|
+
{
|
14
|
+
"name": "stock-management-admin-card-link",
|
15
|
+
"slot": "system-admin-page-card-link-slot",
|
16
|
+
"component": "stockManagementAdminCardLink"
|
17
|
+
},
|
18
|
+
{
|
19
|
+
"name": "stock-operation-dialog",
|
20
|
+
"component": "stockOperationDialog"
|
21
|
+
},
|
22
|
+
{
|
23
|
+
"name": "import-bulk-stock-items",
|
24
|
+
"component": "importBulkStockItemsDialog"
|
25
|
+
},
|
26
|
+
{
|
27
|
+
"name": "delete-stock-modal",
|
28
|
+
"component": "deleteStockModal"
|
29
|
+
},
|
30
|
+
{
|
31
|
+
"name": "delete-stock-user-scope-modal",
|
32
|
+
"component": "deleteUserScopeModal"
|
33
|
+
},
|
34
|
+
{
|
35
|
+
"name": "stock-management-app-menu-item",
|
36
|
+
"component": "stockManagementAppMenuItem",
|
37
|
+
"slot": "app-menu-item-slot",
|
38
|
+
"meta": {
|
39
|
+
"name": " Stock Management"
|
40
|
+
}
|
41
|
+
},
|
42
|
+
{
|
43
|
+
"name": "delete-stock-rule-modal",
|
44
|
+
"component": "deleteStockRuleModal"
|
45
|
+
}
|
46
|
+
],
|
47
|
+
"pages": [
|
48
|
+
{
|
49
|
+
"component": "stockManagement",
|
50
|
+
"route": "stock-management"
|
51
|
+
}
|
52
|
+
]
|
53
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
import "@testing-library/jest-dom/extend-expect";
|
@@ -0,0 +1,21 @@
|
|
1
|
+
import { ClickableTile } from "@carbon/react";
|
2
|
+
import React from "react";
|
3
|
+
import styles from "./item.scss";
|
4
|
+
import { Report } from "@carbon/react/icons";
|
5
|
+
|
6
|
+
const Item = () => {
|
7
|
+
// items
|
8
|
+
const openmrsSpaBase = window["getOpenmrsSpaBase"]();
|
9
|
+
|
10
|
+
return (
|
11
|
+
<ClickableTile
|
12
|
+
className={styles.customTile}
|
13
|
+
id="menu-item"
|
14
|
+
href={`${openmrsSpaBase}stock-management`}
|
15
|
+
>
|
16
|
+
<div className="customTileTitle">{<Report size={24} />}</div>
|
17
|
+
<div>Stock Management</div>
|
18
|
+
</ClickableTile>
|
19
|
+
);
|
20
|
+
};
|
21
|
+
export default Item;
|
File without changes
|
@@ -0,0 +1,79 @@
|
|
1
|
+
import useSWR from "swr";
|
2
|
+
import { ResourceFilterCriteria, toQueryParams } from "../core/api/api";
|
3
|
+
import { BatchJob, BatchJobType } from "../core/api/types/BatchJob";
|
4
|
+
import { PageableResult } from "../core/api/types/PageableResult";
|
5
|
+
import { openmrsFetch } from "@openmrs/esm-framework";
|
6
|
+
import { ReportType } from "../stock-reports/ReportType";
|
7
|
+
|
8
|
+
export interface BatchJobFilter extends ResourceFilterCriteria {
|
9
|
+
batchJobType?: BatchJobType | null | undefined;
|
10
|
+
status?: string | null;
|
11
|
+
locationScopeUuid?: string | null;
|
12
|
+
dateCreatedMin?: string | null | undefined;
|
13
|
+
dateCreatedMax?: string | null | undefined;
|
14
|
+
completedDateMin?: string | null | undefined;
|
15
|
+
completedDateMax?: string | null | undefined;
|
16
|
+
}
|
17
|
+
|
18
|
+
// getBatchJobs
|
19
|
+
export function useBatchJobs(filter: BatchJobFilter) {
|
20
|
+
const apiUrl = `ws/rest/v1/stockmanagement/batchjob${toQueryParams(filter)}`;
|
21
|
+
const { data, error, isLoading } = useSWR<
|
22
|
+
{ data: PageableResult<BatchJob> },
|
23
|
+
Error
|
24
|
+
>(apiUrl, openmrsFetch);
|
25
|
+
|
26
|
+
return {
|
27
|
+
items: data.data ? data.data : [],
|
28
|
+
isLoading,
|
29
|
+
isError: error,
|
30
|
+
};
|
31
|
+
}
|
32
|
+
|
33
|
+
// cancelBatchJobs
|
34
|
+
export function cancelBatchJobs(ids: string[]) {
|
35
|
+
let otherIds = ids.reduce((p, c, i) => {
|
36
|
+
if (i === 0) return p;
|
37
|
+
p += (p.length > 0 ? "," : "") + encodeURIComponent(c);
|
38
|
+
return p;
|
39
|
+
}, "");
|
40
|
+
if (otherIds.length > 0) {
|
41
|
+
otherIds = "?ids=" + otherIds;
|
42
|
+
}
|
43
|
+
const apiUrl = `ws/rest/v1/stockmanagement/batchjob/${ids[0]}${otherIds}`;
|
44
|
+
const abortController = new AbortController();
|
45
|
+
return openmrsFetch(apiUrl, {
|
46
|
+
method: "DELETE",
|
47
|
+
headers: {
|
48
|
+
"Content-Type": "application/json",
|
49
|
+
},
|
50
|
+
signal: abortController.signal,
|
51
|
+
});
|
52
|
+
}
|
53
|
+
|
54
|
+
// createBatchJob
|
55
|
+
export function createBatchJob(item: BatchJob) {
|
56
|
+
const apiUrl = `ws/rest/v1/stockmanagement/batchjob`;
|
57
|
+
const abortController = new AbortController();
|
58
|
+
return openmrsFetch(apiUrl, {
|
59
|
+
method: "POST",
|
60
|
+
headers: {
|
61
|
+
"Content-Type": "application/json",
|
62
|
+
},
|
63
|
+
signal: abortController.signal,
|
64
|
+
body: item,
|
65
|
+
});
|
66
|
+
}
|
67
|
+
// getReportTypes
|
68
|
+
export function useReportTypes() {
|
69
|
+
const apiUrl = `ws/rest/v1/stockmanagement/report?v=default`;
|
70
|
+
const { data, error, isLoading } = useSWR<
|
71
|
+
{ data: PageableResult<ReportType> },
|
72
|
+
Error
|
73
|
+
>(apiUrl, openmrsFetch);
|
74
|
+
return {
|
75
|
+
items: data.data ? data.data : [],
|
76
|
+
isLoading,
|
77
|
+
isError: error,
|
78
|
+
};
|
79
|
+
}
|
@@ -0,0 +1,211 @@
|
|
1
|
+
@use '@carbon/layout';
|
2
|
+
@use '@carbon/type';
|
3
|
+
@import '~@openmrs/esm-styleguide/src/vars';
|
4
|
+
|
5
|
+
.container {
|
6
|
+
margin: 2rem 0;
|
7
|
+
}
|
8
|
+
|
9
|
+
.emptyStateContainer,
|
10
|
+
.loaderContainer {
|
11
|
+
@extend .container;
|
12
|
+
}
|
13
|
+
|
14
|
+
.tilesContainer {
|
15
|
+
background-color: $ui-02;
|
16
|
+
border: 1px solid $ui-03;
|
17
|
+
border-bottom: none;
|
18
|
+
width: 100%;
|
19
|
+
margin: 0 auto;
|
20
|
+
max-width: 95vw;
|
21
|
+
padding-bottom: 0;
|
22
|
+
}
|
23
|
+
|
24
|
+
.headerContainer {
|
25
|
+
display: flex;
|
26
|
+
justify-content: space-between;
|
27
|
+
align-items: center;
|
28
|
+
padding: layout.$spacing-04 0 layout.$spacing-04 layout.$spacing-05;
|
29
|
+
background-color: $ui-02;
|
30
|
+
}
|
31
|
+
|
32
|
+
.backgroundDataFetchingIndicator {
|
33
|
+
align-items: center;
|
34
|
+
display: flex;
|
35
|
+
flex: 1 1 0%;
|
36
|
+
justify-content: center;
|
37
|
+
}
|
38
|
+
|
39
|
+
.tableContainer section {
|
40
|
+
position: relative;
|
41
|
+
}
|
42
|
+
|
43
|
+
.tableContainer a {
|
44
|
+
text-decoration: none;
|
45
|
+
}
|
46
|
+
|
47
|
+
.pagination {
|
48
|
+
overflow: hidden;
|
49
|
+
|
50
|
+
&:global(.cds--pagination) {
|
51
|
+
border-top: none;
|
52
|
+
}
|
53
|
+
}
|
54
|
+
|
55
|
+
.hiddenRow {
|
56
|
+
display: none;
|
57
|
+
}
|
58
|
+
|
59
|
+
.emptyRow {
|
60
|
+
padding: 0 1rem;
|
61
|
+
display: flex;
|
62
|
+
align-items: center;
|
63
|
+
}
|
64
|
+
|
65
|
+
.visitSummaryContainer {
|
66
|
+
width: 100%;
|
67
|
+
max-width: 768px;
|
68
|
+
margin: 1rem auto;
|
69
|
+
}
|
70
|
+
|
71
|
+
.expandedActiveVisitRow > td > div {
|
72
|
+
max-height: max-content !important;
|
73
|
+
}
|
74
|
+
|
75
|
+
.expandedActiveVisitRow td {
|
76
|
+
padding: 0 2rem;
|
77
|
+
}
|
78
|
+
|
79
|
+
.expandedActiveVisitRow th[colspan] td[colspan] > div:first-child {
|
80
|
+
padding: 0 1rem;
|
81
|
+
}
|
82
|
+
|
83
|
+
.action {
|
84
|
+
margin-bottom: layout.$spacing-03;
|
85
|
+
}
|
86
|
+
|
87
|
+
.illo {
|
88
|
+
margin-top: layout.$spacing-05;
|
89
|
+
}
|
90
|
+
|
91
|
+
.content {
|
92
|
+
@include type.type-style('heading-compact-01');
|
93
|
+
color: $text-02;
|
94
|
+
margin-top: layout.$spacing-05;
|
95
|
+
margin-bottom: layout.$spacing-03;
|
96
|
+
}
|
97
|
+
|
98
|
+
.desktopHeading,
|
99
|
+
.tabletHeading {
|
100
|
+
text-align: left;
|
101
|
+
text-transform: capitalize;
|
102
|
+
|
103
|
+
h4 {
|
104
|
+
@include type.type-style('heading-compact-02');
|
105
|
+
color: $text-02;
|
106
|
+
|
107
|
+
&:after {
|
108
|
+
content: '';
|
109
|
+
display: block;
|
110
|
+
width: 2rem;
|
111
|
+
padding-top: 3px;
|
112
|
+
border-bottom: 0.375rem solid;
|
113
|
+
@include brand-03(border-bottom-color);
|
114
|
+
}
|
115
|
+
}
|
116
|
+
}
|
117
|
+
|
118
|
+
.tile {
|
119
|
+
text-align: center;
|
120
|
+
border: 1px solid $ui-03;
|
121
|
+
}
|
122
|
+
|
123
|
+
.filterEmptyState {
|
124
|
+
display: flex;
|
125
|
+
justify-content: center;
|
126
|
+
align-items: center;
|
127
|
+
padding: layout.$spacing-05;
|
128
|
+
margin: layout.$spacing-09;
|
129
|
+
text-align: center;
|
130
|
+
}
|
131
|
+
|
132
|
+
.filterEmptyStateTile {
|
133
|
+
margin: auto;
|
134
|
+
}
|
135
|
+
|
136
|
+
.filterEmptyStateContent {
|
137
|
+
@include type.type-style('heading-compact-02');
|
138
|
+
color: $text-02;
|
139
|
+
margin-bottom: 0.5rem;
|
140
|
+
}
|
141
|
+
|
142
|
+
.filterEmptyStateHelper {
|
143
|
+
@include type.type-style('body-compact-01');
|
144
|
+
color: $text-02;
|
145
|
+
}
|
146
|
+
|
147
|
+
.cardContainer {
|
148
|
+
display: flex;
|
149
|
+
margin: 0 auto;
|
150
|
+
}
|
151
|
+
|
152
|
+
.cardContainer > * {
|
153
|
+
flex: 1;
|
154
|
+
margin: 8px 8px ;
|
155
|
+
}
|
156
|
+
|
157
|
+
.cardContainerBig {
|
158
|
+
display: flex;
|
159
|
+
flex-direction: column;
|
160
|
+
}
|
161
|
+
|
162
|
+
.card {
|
163
|
+
display: flex;
|
164
|
+
border: 1px solid #ccc;
|
165
|
+
margin: 10px;
|
166
|
+
background-color: #F4F4F4;
|
167
|
+
}
|
168
|
+
|
169
|
+
.icon {
|
170
|
+
margin-right: 23px;
|
171
|
+
}
|
172
|
+
|
173
|
+
.colorLineYellow {
|
174
|
+
width: 5px;
|
175
|
+
background-color: #F1C21B;
|
176
|
+
margin-right: 10px;
|
177
|
+
}
|
178
|
+
|
179
|
+
.colorLineBlue {
|
180
|
+
width: 5px;
|
181
|
+
background-color: #0F62FE;
|
182
|
+
margin-right: 10px;
|
183
|
+
}
|
184
|
+
|
185
|
+
.colorLineOrange {
|
186
|
+
width: 5px;
|
187
|
+
background-color: #FF832B;
|
188
|
+
margin-right: 10px;
|
189
|
+
}
|
190
|
+
|
191
|
+
.colorLineGreen {
|
192
|
+
width: 5px;
|
193
|
+
background-color: #198038;
|
194
|
+
margin-right: 10px;
|
195
|
+
}
|
196
|
+
|
197
|
+
.colorLineRed {
|
198
|
+
width: 5px;
|
199
|
+
background-color: #DA1E28;
|
200
|
+
margin-right: 10px;
|
201
|
+
}
|
202
|
+
|
203
|
+
.cardText {
|
204
|
+
margin-top: 5px;
|
205
|
+
margin-bottom: 5px;
|
206
|
+
}
|
207
|
+
|
208
|
+
.cardText p {
|
209
|
+
font-size: 0.9em;
|
210
|
+
color: #525252;
|
211
|
+
}
|
@@ -0,0 +1,62 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import { useTranslation } from "react-i18next";
|
3
|
+
import { useLayoutType } from "@openmrs/esm-framework";
|
4
|
+
import StockHomeInventoryCard from "./stock-home-inventory-card.component";
|
5
|
+
import StockHomeReceivingCard from "./stock-home-receiving-card.component";
|
6
|
+
import StockHomeIssuingCard from "./stock-home-issuing-card.component";
|
7
|
+
import { Layer, Tile } from "@carbon/react";
|
8
|
+
import styles from "./stock-home-detail-card.scss";
|
9
|
+
|
10
|
+
const StockHomeDetailCards = () => {
|
11
|
+
const isTablet = useLayoutType() === "tablet";
|
12
|
+
const { t } = useTranslation();
|
13
|
+
|
14
|
+
return (
|
15
|
+
<div className={styles.cardContainer}>
|
16
|
+
<div className={styles.tilesContainer}>
|
17
|
+
<Layer>
|
18
|
+
<Tile>
|
19
|
+
<div
|
20
|
+
className={
|
21
|
+
isTablet ? styles.tabletHeading : styles.desktopHeading
|
22
|
+
}
|
23
|
+
>
|
24
|
+
<h4>{t("Inventory Alerts")}</h4>
|
25
|
+
</div>
|
26
|
+
<StockHomeInventoryCard />
|
27
|
+
</Tile>
|
28
|
+
</Layer>
|
29
|
+
</div>
|
30
|
+
<div className={styles.tilesContainer}>
|
31
|
+
<Layer>
|
32
|
+
<Tile>
|
33
|
+
<div
|
34
|
+
className={
|
35
|
+
isTablet ? styles.tabletHeading : styles.desktopHeading
|
36
|
+
}
|
37
|
+
>
|
38
|
+
<h4>{t("Receiving")}</h4>
|
39
|
+
</div>
|
40
|
+
<StockHomeReceivingCard />
|
41
|
+
</Tile>
|
42
|
+
</Layer>
|
43
|
+
</div>
|
44
|
+
<div className={styles.tilesContainer}>
|
45
|
+
<Layer>
|
46
|
+
<Tile>
|
47
|
+
<div
|
48
|
+
className={
|
49
|
+
isTablet ? styles.tabletHeading : styles.desktopHeading
|
50
|
+
}
|
51
|
+
>
|
52
|
+
<h4>{t("Issuing")}</h4>
|
53
|
+
</div>
|
54
|
+
<StockHomeIssuingCard />
|
55
|
+
</Tile>
|
56
|
+
</Layer>
|
57
|
+
</div>
|
58
|
+
</div>
|
59
|
+
);
|
60
|
+
};
|
61
|
+
|
62
|
+
export default StockHomeDetailCards;
|
@@ -0,0 +1,80 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import { useTranslation } from "react-i18next";
|
3
|
+
import { Button } from "@carbon/react";
|
4
|
+
import { navigate, useLayoutType } from "@openmrs/esm-framework";
|
5
|
+
import styles from "./stock-home-detail-card.scss";
|
6
|
+
import { WarningHex } from "@carbon/react/icons";
|
7
|
+
import { useStockInventory } from "./stock-home-inventory-expiry.resource";
|
8
|
+
import { useStockInventoryItems } from "./stock-home-inventory-items.resource";
|
9
|
+
|
10
|
+
const StockHomeInventoryCard = () => {
|
11
|
+
const { t } = useTranslation();
|
12
|
+
const isTablet = useLayoutType() === "tablet";
|
13
|
+
|
14
|
+
// TODO: Pull low on stock
|
15
|
+
const { items: expiryItems, isLoading: inventoryLoading } =
|
16
|
+
useStockInventory();
|
17
|
+
const { items: stockItems, isLoading } = useStockInventoryItems();
|
18
|
+
|
19
|
+
if (isLoading) return <></>;
|
20
|
+
|
21
|
+
if (stockItems?.length === 0) {
|
22
|
+
return (
|
23
|
+
<>
|
24
|
+
<p className={styles.content}>
|
25
|
+
{t("inventoryAlertNull", "No inventory alerts to display")}
|
26
|
+
</p>
|
27
|
+
</>
|
28
|
+
);
|
29
|
+
}
|
30
|
+
|
31
|
+
const currentDate: any = new Date();
|
32
|
+
let mergedArray: any[] = expiryItems.map((batch) => {
|
33
|
+
const matchingItem = stockItems?.find(
|
34
|
+
(item2) => batch?.stockItemUuid === item2.uuid
|
35
|
+
);
|
36
|
+
return { ...batch, ...matchingItem };
|
37
|
+
});
|
38
|
+
mergedArray = mergedArray.filter((item) => item.hasExpiration);
|
39
|
+
const filteredData = mergedArray.filter((item) => {
|
40
|
+
const expiryNotice = item.expiryNotice || 0; // Default to 0 if expiryNotice is undefined or null
|
41
|
+
const expirationDate: any = new Date(item.expiration);
|
42
|
+
const differenceInDays = Math.ceil(
|
43
|
+
(expirationDate - currentDate) / (1000 * 60 * 60 * 24)
|
44
|
+
);
|
45
|
+
|
46
|
+
// Include items that have not expired yet or are within the expiry notice period
|
47
|
+
return differenceInDays <= expiryNotice || differenceInDays < 0;
|
48
|
+
});
|
49
|
+
|
50
|
+
return (
|
51
|
+
<>
|
52
|
+
{filteredData.map((item, index) => (
|
53
|
+
<div className={styles.card} key={index}>
|
54
|
+
<div className={styles.colorLineRed} />
|
55
|
+
<div className={styles.icon}>
|
56
|
+
<WarningHex size={40} color={"#DA1E28"} />
|
57
|
+
</div>
|
58
|
+
<div className={styles.cardText}>
|
59
|
+
<p>EXPIRING STOCK</p>
|
60
|
+
<p>
|
61
|
+
<strong>{item?.drugName}</strong> {item?.dispensingUnitName}
|
62
|
+
</p>
|
63
|
+
</div>
|
64
|
+
</div>
|
65
|
+
))}
|
66
|
+
<Button
|
67
|
+
onClick={() => {
|
68
|
+
navigate({
|
69
|
+
to: `${window.getOpenmrsSpaBase()}stock-management/expired-stock`,
|
70
|
+
});
|
71
|
+
}}
|
72
|
+
kind="ghost"
|
73
|
+
>
|
74
|
+
View All
|
75
|
+
</Button>
|
76
|
+
</>
|
77
|
+
);
|
78
|
+
};
|
79
|
+
|
80
|
+
export default StockHomeInventoryCard;
|