@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,161 @@
|
|
1
|
+
import {
|
2
|
+
CLOSE_PRINT_AFTER_PRINT,
|
3
|
+
STOCK_OPERATION_PRINT_DISABLE_COSTS,
|
4
|
+
} from "../../constants";
|
5
|
+
import {
|
6
|
+
GetHeaderSection,
|
7
|
+
GetPrintTemplate,
|
8
|
+
} from "../../core/print/PrintTemplate";
|
9
|
+
import { printDocument } from "../../core/print/printUtils";
|
10
|
+
import { formatDisplayDate } from "../../core/utils/datetimeUtils";
|
11
|
+
import { StockOperationPrintData } from "./StockOperationReport";
|
12
|
+
|
13
|
+
export const FormatTransferDocument = async (
|
14
|
+
data: StockOperationPrintData
|
15
|
+
): Promise<string> => {
|
16
|
+
const emptyRowCount: number = Math.max(0, 25 - (data?.items?.length ?? 0));
|
17
|
+
const headerSection = await GetHeaderSection();
|
18
|
+
return `
|
19
|
+
<div>
|
20
|
+
${headerSection}
|
21
|
+
<div class="heading text center" style="text-transform: uppercase;font-size: 20pt;">
|
22
|
+
<b>Inventory Transfer</b>
|
23
|
+
</div>
|
24
|
+
<div class="heading-row text">
|
25
|
+
<span>Name of Health Unit: </span>
|
26
|
+
<b><span>${data?.organizationName ?? ""}</span></b>
|
27
|
+
</div>
|
28
|
+
<div class="heading-row text">
|
29
|
+
<table style="width:99%" border="0" cellspacing="0" cellpadding="0">
|
30
|
+
<tr>
|
31
|
+
<td style="text-align: left;">
|
32
|
+
<span>Transfer From: </span>
|
33
|
+
<b><span>${data?.location ?? ""}</span></b>
|
34
|
+
</td>
|
35
|
+
<td style="text-align: right;">
|
36
|
+
<span>Transfer#: </span>
|
37
|
+
<b><span>${data?.operationNumber}</span></b>
|
38
|
+
</td>
|
39
|
+
</tr>
|
40
|
+
</table>
|
41
|
+
</div>
|
42
|
+
<div class="heading-row text">
|
43
|
+
<table style="width:99%" border="0" cellspacing="0" cellpadding="0">
|
44
|
+
<tr>
|
45
|
+
<td style="text-align: left;">
|
46
|
+
<span>Transfer To: </span>
|
47
|
+
<b><span>${data?.destination ?? ""}</span></b>
|
48
|
+
</td>
|
49
|
+
<td style="text-align: right;">
|
50
|
+
<span>Date: </span>
|
51
|
+
<b><span>${formatDisplayDate(
|
52
|
+
data?.operationDate
|
53
|
+
)}</span></b>
|
54
|
+
</td>
|
55
|
+
</tr>
|
56
|
+
</table>
|
57
|
+
</div>
|
58
|
+
<table class="table-data" border="0" cellspacing="0" cellpadding="0">
|
59
|
+
<tr>
|
60
|
+
<th valign="middle" class="left" style="border-top:solid black 1.0pt;"><b>Item Code No.</b></th>
|
61
|
+
<th valign="middle" class="left" style="border-top:solid black 1.0pt;"><b>Item Description (name, formulation, strength)</b></th>
|
62
|
+
<th valign="middle" style="border-top:solid black 1.0pt;"><b>Batch No.</b></th>
|
63
|
+
<th valign="middle" style="border-top:solid black 1.0pt;"><b>Expiry</b></th>
|
64
|
+
<th valign="middle" style="border-top:solid black 1.0pt;"><b>Quantity</b></th>
|
65
|
+
<th valign="middle" style="border-top:solid black 1.0pt;"><b>Unit Cost</b></th>
|
66
|
+
<th valign="middle" style="border-top:solid black 1.0pt;"><b>Total Cost</b></th>
|
67
|
+
</tr>
|
68
|
+
${
|
69
|
+
data?.items
|
70
|
+
? data?.items
|
71
|
+
.map((p) => {
|
72
|
+
return `
|
73
|
+
<tr class="data-row">
|
74
|
+
<td valign="middle">${p.itemCode ?? ""}</td>
|
75
|
+
<td valign="middle">${
|
76
|
+
p.itemDescription ?? ""
|
77
|
+
}</td>
|
78
|
+
<td valign="middle" class="center">${
|
79
|
+
p.batchNumber ?? ""
|
80
|
+
}</td>
|
81
|
+
<td valign="middle" class="center">${formatDisplayDate(
|
82
|
+
p.expiryDate
|
83
|
+
)}</td>
|
84
|
+
<td valign="middle" class="center">${
|
85
|
+
p.quantityRequired?.toLocaleString() ?? ""
|
86
|
+
} ${p.quantityRequiredUoM ?? ""}</td>
|
87
|
+
<td valign="middle" class="center">${
|
88
|
+
STOCK_OPERATION_PRINT_DISABLE_COSTS
|
89
|
+
? ""
|
90
|
+
: `${p.unitCost?.toLocaleString() ?? ""}${
|
91
|
+
p.unitCostUoM ? `/${p.unitCostUoM}` : ""
|
92
|
+
}`
|
93
|
+
}</td>
|
94
|
+
<td valign="middle" class="center">${
|
95
|
+
STOCK_OPERATION_PRINT_DISABLE_COSTS
|
96
|
+
? ""
|
97
|
+
: `${p.totalCost?.toLocaleString() ?? ""}`
|
98
|
+
}</td>
|
99
|
+
</tr>
|
100
|
+
`;
|
101
|
+
})
|
102
|
+
.join("")
|
103
|
+
: ""
|
104
|
+
}
|
105
|
+
${
|
106
|
+
emptyRowCount > 0
|
107
|
+
? Array(emptyRowCount)
|
108
|
+
.fill(0)
|
109
|
+
.map(
|
110
|
+
(p) => `
|
111
|
+
<tr class="data-row">
|
112
|
+
<td valign="middle"> </td>
|
113
|
+
<td valign="middle"> </td>
|
114
|
+
<td valign="middle" class="center"> </td>
|
115
|
+
<td valign="middle" class="center"> </td>
|
116
|
+
<td valign="middle" class="center"> </td>
|
117
|
+
<td valign="middle" class="center"> </td>
|
118
|
+
<td valign="middle" class="center"> </td>
|
119
|
+
</tr>`
|
120
|
+
)
|
121
|
+
.join("")
|
122
|
+
: ""
|
123
|
+
}
|
124
|
+
<tr class="footer-field">
|
125
|
+
<td valign="middle" colspan="7" style="border:0;padding-top: 15pt;">
|
126
|
+
Remarks:<br/>
|
127
|
+
${data?.remarks ?? ""}
|
128
|
+
</td>
|
129
|
+
</tr>
|
130
|
+
<tr class="footer-field">
|
131
|
+
<td valign="middle" colspan="4" style="border:0;padding-top: 15pt;">
|
132
|
+
Prepared By:<br/>
|
133
|
+
<b>${data?.responsiblePerson ?? ""}</b>
|
134
|
+
</td>
|
135
|
+
<td valign="middle" colspan="3" style="border:0;padding-top: 15pt;">
|
136
|
+
Authorized By:<br/>
|
137
|
+
|
138
|
+
</td>
|
139
|
+
</tr>
|
140
|
+
<tr class="footer-field">
|
141
|
+
<td valign="middle" colspan="4" style="border:0;"><br/><br/>Signature</td>
|
142
|
+
<td valign="middle" colspan="3" style="border:0;"><br/><br/>Signature</td>
|
143
|
+
</tr>
|
144
|
+
</table>
|
145
|
+
</div>
|
146
|
+
`;
|
147
|
+
};
|
148
|
+
|
149
|
+
export const PrintTransferOutStockOperation = async (
|
150
|
+
data: StockOperationPrintData
|
151
|
+
) => {
|
152
|
+
const printData = await FormatTransferDocument(data);
|
153
|
+
printDocument(
|
154
|
+
GetPrintTemplate(
|
155
|
+
printData,
|
156
|
+
data?.documentTitle,
|
157
|
+
true,
|
158
|
+
CLOSE_PRINT_AFTER_PRINT
|
159
|
+
)
|
160
|
+
);
|
161
|
+
};
|
@@ -0,0 +1,77 @@
|
|
1
|
+
import React, { ReactNode } from "react";
|
2
|
+
import { Control, Controller, FieldValues } from "react-hook-form";
|
3
|
+
import { User } from "../../core/api/types/identity/User";
|
4
|
+
import { ComboBox, InlineLoading } from "@carbon/react";
|
5
|
+
import { useUsersHook } from "./users-selector.resource";
|
6
|
+
import { useDebounce } from "../../core/hooks/debounce-hook";
|
7
|
+
import { otherUser } from "../../core/utils/utils";
|
8
|
+
|
9
|
+
interface UsersSelectorProps<T> {
|
10
|
+
placeholder?: string;
|
11
|
+
userUuid?: string;
|
12
|
+
onUserChanged?: (user: User) => void;
|
13
|
+
title?: string;
|
14
|
+
invalid?: boolean;
|
15
|
+
invalidText?: ReactNode;
|
16
|
+
|
17
|
+
// Control
|
18
|
+
controllerName: string;
|
19
|
+
name: string;
|
20
|
+
control: Control<FieldValues, T>;
|
21
|
+
}
|
22
|
+
|
23
|
+
const UsersSelector = <T,>(props: UsersSelectorProps<T>) => {
|
24
|
+
const { isLoading, userList, setSearchString } = useUsersHook();
|
25
|
+
|
26
|
+
const debouncedSearch = useDebounce((query: string) => {
|
27
|
+
setSearchString(query);
|
28
|
+
}, 1000);
|
29
|
+
|
30
|
+
if (userList) userList.push(otherUser);
|
31
|
+
|
32
|
+
return (
|
33
|
+
<div>
|
34
|
+
<Controller
|
35
|
+
name={props.controllerName}
|
36
|
+
control={props.control}
|
37
|
+
render={({ field: { onChange, ref } }) => (
|
38
|
+
<ComboBox
|
39
|
+
titleText={props.title}
|
40
|
+
name={props.name}
|
41
|
+
control={props.control}
|
42
|
+
controllerName={props.controllerName}
|
43
|
+
id={props.name}
|
44
|
+
size={"md"}
|
45
|
+
items={userList || []}
|
46
|
+
onChange={(data: { selectedItem: User }) => {
|
47
|
+
props.onUserChanged?.(data.selectedItem);
|
48
|
+
onChange(data.selectedItem?.uuid);
|
49
|
+
}}
|
50
|
+
initialSelectedItem={
|
51
|
+
userList?.find((p) => p.uuid === props.userUuid) ?? ""
|
52
|
+
}
|
53
|
+
itemToString={userName}
|
54
|
+
onInputChange={debouncedSearch}
|
55
|
+
placeholder={props.placeholder}
|
56
|
+
invalid={props.invalid}
|
57
|
+
invalidText={props.invalidText}
|
58
|
+
ref={ref}
|
59
|
+
/>
|
60
|
+
)}
|
61
|
+
/>
|
62
|
+
{isLoading && (
|
63
|
+
<InlineLoading
|
64
|
+
status="active"
|
65
|
+
iconDescription="Searching"
|
66
|
+
description="Searching..."
|
67
|
+
/>
|
68
|
+
)}
|
69
|
+
</div>
|
70
|
+
);
|
71
|
+
};
|
72
|
+
|
73
|
+
function userName(item: User): string {
|
74
|
+
return item?.person?.display || "";
|
75
|
+
}
|
76
|
+
|
77
|
+
export default UsersSelector;
|
@@ -0,0 +1,47 @@
|
|
1
|
+
import {
|
2
|
+
ConceptFilterCriteria,
|
3
|
+
UserFilterCriteria,
|
4
|
+
useUsers,
|
5
|
+
} from "../../stock-lookups/stock-lookups.resource";
|
6
|
+
import { useEffect, useState } from "react";
|
7
|
+
import { ResourceRepresentation } from "../../core/api/api";
|
8
|
+
|
9
|
+
export function useUsersHook(filter?: ConceptFilterCriteria) {
|
10
|
+
const [conceptFilter, setConceptFilter] = useState<UserFilterCriteria>(
|
11
|
+
filter || {
|
12
|
+
v: ResourceRepresentation.Default,
|
13
|
+
limit: 10,
|
14
|
+
startIndex: 0,
|
15
|
+
}
|
16
|
+
);
|
17
|
+
|
18
|
+
const {
|
19
|
+
items: { results: userList },
|
20
|
+
isLoading,
|
21
|
+
} = useUsers(conceptFilter);
|
22
|
+
|
23
|
+
const [searchString, setSearchString] = useState(null);
|
24
|
+
|
25
|
+
// Drug filter type
|
26
|
+
const [limit, setLimit] = useState(filter?.limit || 10);
|
27
|
+
const [representation, setRepresentation] = useState(
|
28
|
+
filter?.v || ResourceRepresentation.Default
|
29
|
+
);
|
30
|
+
|
31
|
+
useEffect(() => {
|
32
|
+
setConceptFilter({
|
33
|
+
startIndex: 0,
|
34
|
+
v: representation,
|
35
|
+
limit: limit,
|
36
|
+
q: searchString,
|
37
|
+
});
|
38
|
+
}, [searchString, limit, representation]);
|
39
|
+
|
40
|
+
return {
|
41
|
+
userList,
|
42
|
+
setLimit,
|
43
|
+
setRepresentation,
|
44
|
+
setSearchString,
|
45
|
+
isLoading,
|
46
|
+
};
|
47
|
+
}
|
@@ -0,0 +1,195 @@
|
|
1
|
+
import { z } from "zod";
|
2
|
+
import { StockOperationStatusTypes } from "../core/api/types/stockOperation/StockOperationStatus";
|
3
|
+
import { OperationType } from "../core/api/types/stockOperation/StockOperationType";
|
4
|
+
|
5
|
+
export const stockItemPackagingUOMDTOSchema = z.object({
|
6
|
+
id: z.string().nullish(),
|
7
|
+
uuid: z.string().nullish(),
|
8
|
+
stockItemUuid: z.string().nullish(),
|
9
|
+
packagingUomName: z.string().nullish(),
|
10
|
+
packagingUomUuid: z.string().nullish(),
|
11
|
+
factor: z.number().nullish(),
|
12
|
+
isDefaultStockOperationsUoM: z.boolean().nullish(),
|
13
|
+
isDispensingUnit: z.boolean().nullish(),
|
14
|
+
});
|
15
|
+
|
16
|
+
export type StockItemPackagingUOMDTOFormData = z.infer<
|
17
|
+
typeof stockItemPackagingUOMDTOSchema
|
18
|
+
>;
|
19
|
+
|
20
|
+
export const recordPermissionSchema = z.object({
|
21
|
+
canView: z.boolean(),
|
22
|
+
canEdit: z.boolean(),
|
23
|
+
canApprove: z.boolean().nullish(),
|
24
|
+
canReceiveItems: z.boolean().nullish(),
|
25
|
+
canDisplayReceivedItems: z.boolean().nullish(),
|
26
|
+
isRequisitionAndCanIssueStock: z.boolean().nullish(),
|
27
|
+
canUpdateBatchInformation: z.boolean().nullish(),
|
28
|
+
});
|
29
|
+
|
30
|
+
export type RecordPermissionFormData = z.infer<typeof recordPermissionSchema>;
|
31
|
+
|
32
|
+
export const stockOperationItemSchema = z.object({
|
33
|
+
itemIndex: z.number().nullish(),
|
34
|
+
id: z.string().nullish(),
|
35
|
+
uuid: z.string().nullish(),
|
36
|
+
stockItemUuid: z.string().nullish(),
|
37
|
+
stockItemName: z.string().nullish(),
|
38
|
+
stockItemPackagingUOMUuid: z.string().nullish(),
|
39
|
+
stockItemPackagingUOMName: z.string().nullish(),
|
40
|
+
stockBatchUuid: z.string().nullish(),
|
41
|
+
batchNo: z.string().nullish(),
|
42
|
+
expiration: z.coerce.date().nullish(),
|
43
|
+
quantity: z.number().nullish(),
|
44
|
+
purchasePrice: z.number().nullish(),
|
45
|
+
permission: recordPermissionSchema.nullish(),
|
46
|
+
edit: z.boolean().nullish(),
|
47
|
+
hasExpiration: z.boolean().nullish(),
|
48
|
+
packagingUnits: stockItemPackagingUOMDTOSchema.array(),
|
49
|
+
quantityReceived: z.number().nullish(),
|
50
|
+
quantityReceivedPackagingUOMName: z.string().nullish(),
|
51
|
+
quantityReceivedPackagingUOMUuid: z.string().nullish(),
|
52
|
+
quantityRequested: z.number().nullish(),
|
53
|
+
quantityRequestedPackagingUOMUuid: z.string().nullish(),
|
54
|
+
quantityRequestedPackagingUOMName: z.string().nullish(),
|
55
|
+
commonName: z.string().nullish(),
|
56
|
+
acronym: z.string().nullish(),
|
57
|
+
});
|
58
|
+
|
59
|
+
export type StockOperationItemFormData = z.infer<
|
60
|
+
typeof stockOperationItemSchema
|
61
|
+
>;
|
62
|
+
|
63
|
+
export const stockOperationSchema = z.object({
|
64
|
+
uuid: z.string().nullish(),
|
65
|
+
cancelReason: z.string().nullish(),
|
66
|
+
cancelledBy: z.coerce.number(),
|
67
|
+
cancelledByGivenName: z.string().nullish(),
|
68
|
+
cancelledByFamilyName: z.string().nullish(),
|
69
|
+
cancelledDate: z.coerce.date(),
|
70
|
+
completedBy: z.coerce.number(),
|
71
|
+
completedByGivenName: z.string().nullish(),
|
72
|
+
completedByFamilyName: z.string().nullish(),
|
73
|
+
completedDate: z.coerce.date(),
|
74
|
+
destinationUuid: z.string().nullish(),
|
75
|
+
destinationName: z.string().nullish(),
|
76
|
+
externalReference: z.string().nullish(),
|
77
|
+
atLocationUuid: z.string().nullish(),
|
78
|
+
atLocationName: z.string().nullish(),
|
79
|
+
operationDate: z.coerce.date(),
|
80
|
+
submitted: z.boolean(),
|
81
|
+
submittedBy: z.string().nullish(),
|
82
|
+
submittedByGivenName: z.string().nullish(),
|
83
|
+
submittedByFamilyName: z.string().nullish(),
|
84
|
+
locked: z.boolean(),
|
85
|
+
operationNumber: z.string().nullish(),
|
86
|
+
operationOrder: z.coerce.number(),
|
87
|
+
remarks: z.string().nullish(),
|
88
|
+
sourceUuid: z.string().nullish(),
|
89
|
+
sourceName: z.string().nullish(),
|
90
|
+
status: z.enum(StockOperationStatusTypes),
|
91
|
+
returnReason: z.string().nullish(),
|
92
|
+
rejectionReason: z.string().nullish(),
|
93
|
+
operationTypeUuid: z.string().nullish(),
|
94
|
+
operationType: z.string().nullish(),
|
95
|
+
operationTypeName: z.string().nullish(),
|
96
|
+
responsiblePerson: z.coerce.number(),
|
97
|
+
responsiblePersonUuid: z.string().nullish(),
|
98
|
+
responsiblePersonGivenName: z.string().nullish(),
|
99
|
+
responsiblePersonFamilyName: z.string().nullish(),
|
100
|
+
responsiblePersonOther: z.string().nullish(),
|
101
|
+
creator: z.coerce.number(),
|
102
|
+
dateCreated: z.coerce.date(),
|
103
|
+
creatorGivenName: z.string().nullish(),
|
104
|
+
creatorFamilyName: z.string().nullish(),
|
105
|
+
permission: recordPermissionSchema.nullish(),
|
106
|
+
reasonUuid: z.string().nullish(),
|
107
|
+
reasonName: z.string().nullish(),
|
108
|
+
approvalRequired: z.boolean().nullish(),
|
109
|
+
stockOperationItems: stockOperationItemSchema.array(),
|
110
|
+
|
111
|
+
submittedDate: z.coerce.date(),
|
112
|
+
returnedByGivenName: z.string().nullish(),
|
113
|
+
returnedByFamilyName: z.string().nullish(),
|
114
|
+
returnedDate: z.coerce.date(),
|
115
|
+
rejectedByGivenName: z.string().nullish(),
|
116
|
+
rejectedByFamilyName: z.string().nullish(),
|
117
|
+
rejectedDate: z.coerce.date(),
|
118
|
+
dispatchedByGivenName: z.string().nullish(),
|
119
|
+
dispatchedByFamilyName: z.string().nullish(),
|
120
|
+
dispatchedDate: z.coerce.date(),
|
121
|
+
requisitionStockOperationUuid: z.string(),
|
122
|
+
});
|
123
|
+
|
124
|
+
export const stockOperationItemDtoSchema = z.object({
|
125
|
+
operationDate: z.coerce.date(),
|
126
|
+
sourceUuid: z.string({ required_error: "Location Required" }).min(1, {
|
127
|
+
message: "Location Required",
|
128
|
+
}),
|
129
|
+
destinationUuid: z.string({ required_error: "Location Required" }).min(1, {
|
130
|
+
message: "Location Required",
|
131
|
+
}),
|
132
|
+
reasonUuid: z.string({ required_error: "Reason Required" }).min(1, {
|
133
|
+
message: "Reason Required",
|
134
|
+
}),
|
135
|
+
responsiblePersonUuid: z
|
136
|
+
.string({
|
137
|
+
required_error: "Responsible Person Required",
|
138
|
+
})
|
139
|
+
.min(1, {
|
140
|
+
message: "Responsible Person Required",
|
141
|
+
}),
|
142
|
+
responsiblePersonOther: z.string().nullish(),
|
143
|
+
remarks: z.string().nullish(),
|
144
|
+
});
|
145
|
+
|
146
|
+
export type StockOperationItemDtoSchema = z.infer<
|
147
|
+
typeof stockOperationItemDtoSchema
|
148
|
+
>;
|
149
|
+
|
150
|
+
export type StockOperationFormData = z.infer<typeof stockOperationSchema>;
|
151
|
+
|
152
|
+
export const operationSchema = (operation: OperationType): z.Schema => {
|
153
|
+
switch (operation) {
|
154
|
+
case OperationType.OPENING_STOCK_OPERATION_TYPE:
|
155
|
+
return stockOperationItemDtoSchema.omit({
|
156
|
+
destinationUuid: true,
|
157
|
+
reasonUuid: true,
|
158
|
+
});
|
159
|
+
case OperationType.STOCK_TAKE_OPERATION_TYPE:
|
160
|
+
case OperationType.ADJUSTMENT_OPERATION_TYPE:
|
161
|
+
case OperationType.DISPOSED_OPERATION_TYPE:
|
162
|
+
return stockOperationItemDtoSchema.omit({ destinationUuid: true });
|
163
|
+
case OperationType.TRANSFER_OUT_OPERATION_TYPE:
|
164
|
+
case OperationType.STOCK_ISSUE_OPERATION_TYPE:
|
165
|
+
return stockOperationItemDtoSchema.omit({ reasonUuid: true }).merge(
|
166
|
+
z.object({
|
167
|
+
destinationUuid: z
|
168
|
+
.string({ required_error: "Destination Required" })
|
169
|
+
.min(1, {
|
170
|
+
message: "Destination Required",
|
171
|
+
}),
|
172
|
+
requisitionStockOperationUuid: z.string({
|
173
|
+
required_error: "Requisition stock uuid required",
|
174
|
+
}),
|
175
|
+
})
|
176
|
+
);
|
177
|
+
case OperationType.RETURN_OPERATION_TYPE:
|
178
|
+
case OperationType.REQUISITION_OPERATION_TYPE:
|
179
|
+
return stockOperationItemDtoSchema.omit({ reasonUuid: true }).merge(
|
180
|
+
z.object({
|
181
|
+
sourceUuid: z.string({ required_error: "Source Required" }).min(1, {
|
182
|
+
message: "Source Required",
|
183
|
+
}),
|
184
|
+
})
|
185
|
+
);
|
186
|
+
case OperationType.RECEIPT_OPERATION_TYPE:
|
187
|
+
return stockOperationItemDtoSchema.omit({ reasonUuid: true }).merge(
|
188
|
+
z.object({
|
189
|
+
sourceUuid: z.string({ required_error: "Source Required" }).min(1, {
|
190
|
+
message: "Source Required",
|
191
|
+
}),
|
192
|
+
})
|
193
|
+
);
|
194
|
+
}
|
195
|
+
};
|
@@ -0,0 +1,63 @@
|
|
1
|
+
export enum ReportParameter {
|
2
|
+
Date = "Date",
|
3
|
+
StartDate = "StartDate",
|
4
|
+
EndDate = "EndDate",
|
5
|
+
StockItemCategory = "StockItemCategory",
|
6
|
+
Location = "Location",
|
7
|
+
ChildLocations = "ChildLocations",
|
8
|
+
StockSource = "StockSource",
|
9
|
+
StockSourceDestination = "StockSourceDestination",
|
10
|
+
InventoryGroupBy = "InventoryGroupBy",
|
11
|
+
MaxReorderLevelRatio = "MaxReorderLevelRatio",
|
12
|
+
Patient = "Patient",
|
13
|
+
StockItem = "StockItem",
|
14
|
+
Limit = "Limit",
|
15
|
+
MostLeastMoving = "MostLeastMoving",
|
16
|
+
Fullfillment = "Fullfillment",
|
17
|
+
}
|
18
|
+
|
19
|
+
export const getParamDefaultLimit = (
|
20
|
+
reportSystemName: string | undefined | null
|
21
|
+
) => {
|
22
|
+
return isForecastReport(reportSystemName) ? 4 : reportSystemName ? 20 : null;
|
23
|
+
};
|
24
|
+
|
25
|
+
export const isForecastReport = (
|
26
|
+
reportSystemName: string | undefined | null
|
27
|
+
) => {
|
28
|
+
return (
|
29
|
+
reportSystemName === "STOCK_FORECAST_REPORT" ||
|
30
|
+
reportSystemName === "STOCK_EXPIRY_FORECAST_REPORT"
|
31
|
+
);
|
32
|
+
};
|
33
|
+
|
34
|
+
export const getReportLimitLabel = (
|
35
|
+
reportSystemName: string | undefined | null
|
36
|
+
) => {
|
37
|
+
return isForecastReport(reportSystemName)
|
38
|
+
? "stockmanagement.report.edit.months"
|
39
|
+
: "stockmanagement.report.edit.limit";
|
40
|
+
};
|
41
|
+
|
42
|
+
export const getReportStartDateLabel = (
|
43
|
+
reportSystemName: string | undefined | null
|
44
|
+
) => {
|
45
|
+
return isForecastReport(reportSystemName)
|
46
|
+
? "stockmanagement.report.edit.historicalstartdate"
|
47
|
+
: "stockmanagement.report.edit.startdate";
|
48
|
+
};
|
49
|
+
|
50
|
+
export const getReportEndDateLabel = (
|
51
|
+
reportSystemName: string | undefined | null
|
52
|
+
) => {
|
53
|
+
return isForecastReport(reportSystemName)
|
54
|
+
? "stockmanagement.report.edit.historicalenddate"
|
55
|
+
: "stockmanagement.report.edit.enddate";
|
56
|
+
};
|
57
|
+
|
58
|
+
export interface ReportType {
|
59
|
+
order: number;
|
60
|
+
name: string;
|
61
|
+
systemName: string;
|
62
|
+
parameters: ReportParameter[];
|
63
|
+
}
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,21 @@
|
|
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 StockSourcesAddOrUpdate from "./add-stock-sources/add-stock-sources.component";
|
6
|
+
|
7
|
+
const AddStockSourceActionButton: React.FC = () => {
|
8
|
+
const { t } = useTranslation();
|
9
|
+
|
10
|
+
const handleClick = useCallback(() => {
|
11
|
+
launchOverlay("Add Stock Source", <StockSourcesAddOrUpdate />);
|
12
|
+
}, []);
|
13
|
+
|
14
|
+
return (
|
15
|
+
<Button onClick={handleClick} size="md" kind="primary">
|
16
|
+
{t("stockmanagement.addnewsource", "Add New Source")}
|
17
|
+
</Button>
|
18
|
+
);
|
19
|
+
};
|
20
|
+
|
21
|
+
export default AddStockSourceActionButton;
|