@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/dist/979.js
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
(globalThis.webpackChunk_openmrs_esm_stock_management_app=globalThis.webpackChunk_openmrs_esm_stock_management_app||[]).push([[979],{3432:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var o=n(7537),r=n.n(o),a=n(3645),i=n.n(a)()(r());i.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-stock-management__metrics-card__tileContainer___SG_bT{border:.0625rem solid #e0e0e0;flex-grow:1;height:7.875rem;padding:0 .75rem;background-color:#fff;display:flex;flex-direction:column;justify-content:space-between;margin-bottom:20px}.-esm-stock-management__metrics-card__tileHeader___sMfyg{display:flex;justify-content:space-between;align-items:center;margin-bottom:.5rem}.-esm-stock-management__metrics-card__headerLabel___HyNJ3{font-size:var(--cds-label-02-font-size, 0.875rem);font-weight:var(--cds-label-02-font-weight, 400);line-height:var(--cds-label-02-line-height, 1.28572);letter-spacing:var(--cds-label-02-letter-spacing, 0.16px);color:#525252}.-esm-stock-management__metrics-card__totalsLabel___hyLWP{font-size:var(--cds-label-01-font-size, 0.75rem);font-weight:var(--cds-label-01-font-weight, 400);line-height:var(--cds-label-01-line-height, 1.33333);letter-spacing:var(--cds-label-01-letter-spacing, 0.32px);color:#525252}.-esm-stock-management__metrics-card__totalsValue___CCj27{font-size:var(--cds-heading-04-font-size, 1.75rem);font-weight:var(--cds-heading-04-font-weight, 400);line-height:var(--cds-heading-04-line-height, 1.28572);letter-spacing:var(--cds-heading-04-letter-spacing, 0);color:#161616}.-esm-stock-management__metrics-card__headerLabelContainer___bVkOu{display:flex;align-items:center;height:2rem;justify-content:space-between;width:100%}.-esm-stock-management__metrics-card__link___qIBqZ{text-decoration:none;display:flex;align-items:flex-end}.-esm-stock-management__metrics-card__metricsGrid___sM6gq{display:grid;grid-template-columns:1fr 1fr}.-esm-stock-management__metrics-card__countGrid___XC66g{display:grid;grid-template-columns:1fr 1fr;justify-self:flex-end;column-gap:.5rem}.-esm-stock-management__metrics-card__countGrid___XC66g>span{font-size:.625rem !important;margin:0;color:#525252}.-esm-stock-management__metrics-card__countGrid___XC66g>p{margin:0}","",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/core/components/card/metrics-card.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss","webpack://./node_modules/@carbon/type/scss/_styles.scss","webpack://./node_modules/@carbon/colors/index.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CCnDF,4DACE,6BAAA,CACA,WAAA,CACA,eAAA,CACA,gBAAA,CACA,qBAAA,CACA,YAAA,CACA,qBAAA,CACA,6BAAA,CACA,kBAAA,CAGF,yDACE,YAAA,CACA,6BAAA,CACA,kBAAA,CACA,mBCCW,CDCb,0DE40BI,iDAAA,CAAA,gDAAA,CAAA,oDAAA,CAAA,yDAAA,CF10BF,aGwBQ,CHtBV,0DEw0BI,gDAAA,CAAA,gDAAA,CAAA,oDAAA,CAAA,yDAAA,CFt0BF,aDvBQ,CCyBV,0DEo0BI,kDAAA,CAAA,kDAAA,CAAA,sDAAA,CAAA,sDAAA,CFl0BF,aD5BM,CC8BR,mEACE,YAAA,CACA,kBAAA,CACA,WCIW,CDHX,6BAAA,CACA,UAAA,CAEF,mDACE,oBAAA,CACA,YAAA,CACA,oBAAA,CAEF,0DACE,YAAA,CACA,6BAAA,CAEF,wDACE,YAAA,CACA,6BAAA,CACA,qBAAA,CACA,gBCjCW,CDkCX,6DACE,4BAAA,CACA,QAAA,CACA,aGVM,CHYR,0DACE,QAAA",sourceRoot:""}]),i.locals={tileContainer:"-esm-stock-management__metrics-card__tileContainer___SG_bT",tileHeader:"-esm-stock-management__metrics-card__tileHeader___sMfyg",headerLabel:"-esm-stock-management__metrics-card__headerLabel___HyNJ3",totalsLabel:"-esm-stock-management__metrics-card__totalsLabel___hyLWP",totalsValue:"-esm-stock-management__metrics-card__totalsValue___CCj27",headerLabelContainer:"-esm-stock-management__metrics-card__headerLabelContainer___bVkOu",link:"-esm-stock-management__metrics-card__link___qIBqZ",metricsGrid:"-esm-stock-management__metrics-card__metricsGrid___sM6gq",countGrid:"-esm-stock-management__metrics-card__countGrid___XC66g"};const l=i},2296:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var o=n(7537),r=n.n(o),a=n(3645),i=n.n(a)()(r());i.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-stock-management__overlay__desktopOverlay___lvJaK{position:fixed;top:3rem;width:100%;right:0;bottom:0;border-left:1px solid #a8a8a8;background-color:#fff;overflow-y:auto;height:calc(100vh - 3rem)}.-esm-stock-management__overlay__desktopOverlay___lvJaK::after{height:100%;border-left:1px solid #a8a8a8}.-esm-stock-management__overlay__tabletOverlay___ThdtE{position:fixed;top:0;bottom:0;left:0;right:0;z-index:9999;background-color:#f4f4f4;overflow-y:scroll;-ms-overflow-style:none;scrollbar-width:none}.-esm-stock-management__overlay__tabletOverlay___ThdtE::-webkit-scrollbar{width:0}.-esm-stock-management__overlay__tabletOverlay___ThdtE>div{margin-top:3rem}.-esm-stock-management__overlay__tabletOverlayHeader___T3x8O button{background-color:#005d5d;background-color:var(--brand-01)}.-esm-stock-management__overlay__tabletOverlayHeader___T3x8O .-esm-stock-management__overlay__headerContent___YYBKM{color:#fff}.-esm-stock-management__overlay__desktopHeader___Ueq0h{display:flex;justify-content:space-between;align-items:center;background-color:#e0e0e0;border-bottom:1px solid #a8a8a8;position:sticky;position:-webkit-sticky;width:100%;z-index:1000;top:0}.-esm-stock-management__overlay__headerContent___YYBKM{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);padding:0 1rem;color:#161616}.-esm-stock-management__overlay__closeButton___JYFSq{background-color:#fff;color:#161616;fill:#161616}.omrs-breakpoint-gt-tablet .-esm-stock-management__overlay__overlayContent___QyXjy{padding:0 0 0 0;overflow-y:auto}.omrs-breakpoint-lt-desktop .-esm-stock-management__overlay__overlayContent___QyXjy{padding:0 0 0 0;overflow-y:auto}.cds--list-box__menu{z-index:20000}","",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/core/components/overlay/overlay.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss","webpack://./node_modules/@carbon/type/scss/_styles.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CCnDF,wDACE,cAAA,CACA,QC6CW,CD5CX,UAAA,CACA,OAAA,CACA,QAAA,CACA,6BAAA,CACA,qBAAA,CACA,eAAA,CACA,yBAAA,CAGF,+DACE,WAAA,CACA,6BAAA,CAGF,uDACE,cAAA,CACA,KAAA,CACA,QAAA,CACA,MAAA,CACA,OAAA,CACA,YAAA,CACA,wBD5BM,CC6BN,iBAAA,CACA,uBAAA,CACA,oBAAA,CAEA,0EACE,OAAA,CAGF,2DACE,eCaS,CDRX,oEDLA,wBAAA,CACA,gCAAA,CCQA,oHACE,UD/CI,CCmDR,uDACE,YAAA,CACA,6BAAA,CACA,kBAAA,CACA,wBDtDM,CCuDN,+BAAA,CACA,eAAA,CACA,uBAAA,CACA,UAAA,CACA,YAAA,CACA,KAAA,CAGF,uDEiyBI,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CF/xBF,cAAA,CACA,aDhEM,CCmER,qDACE,qBDjEc,CCkEd,aDrEM,CCsEN,YDtEM,CC2EN,mFACE,eAAA,CACA,eAAA,CAMF,oFACE,eAAA,CACA,eAAA,CAKJ,qBACE,aAAA",sourceRoot:""}]),i.locals={desktopOverlay:"-esm-stock-management__overlay__desktopOverlay___lvJaK",tabletOverlay:"-esm-stock-management__overlay__tabletOverlay___ThdtE",tabletOverlayHeader:"-esm-stock-management__overlay__tabletOverlayHeader___T3x8O",headerContent:"-esm-stock-management__overlay__headerContent___YYBKM",desktopHeader:"-esm-stock-management__overlay__desktopHeader___Ueq0h",closeButton:"-esm-stock-management__overlay__closeButton___JYFSq",overlayContent:"-esm-stock-management__overlay__overlayContent___QyXjy"};const l=i},1940:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var o=n(7537),r=n.n(o),a=n(3645),i=n.n(a)()(r());i.push([e.id,':root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-stock-management__side-nav__heading___vgtlj{font-size:var(--cds-productive-heading-02-font-size, 1rem);font-weight:var(--cds-productive-heading-02-font-weight, 600);line-height:var(--cds-productive-heading-02-line-height, 1.375);letter-spacing:var(--cds-productive-heading-02-letter-spacing, 0);color:#525252;margin-bottom:1rem}.-esm-stock-management__side-nav__heading___vgtlj:after{content:"";display:block;width:2rem;padding-top:.188rem;border-bottom:.375rem solid var(--brand-03)}.-esm-stock-management__side-nav__mainContainer___ogiHY{padding-bottom:1.5rem;background:#f4f4f4;display:flex;justify-content:center}.-esm-stock-management__side-nav__title___nb7UC{padding:1rem;font-size:1.2rem}.-esm-stock-management__side-nav__desktopContainer___K7J5p{width:50%}.-esm-stock-management__side-nav__tabletContainer___qoyDq{width:90%}.-esm-stock-management__side-nav__cohortBuilder___abPYF .cds--date-picker.cds--date-picker--single .cds--date-picker__input{width:auto}.-esm-stock-management__side-nav__cohortBuilder___abPYF .cds--tab-content{width:100% !important;overflow-x:hidden;padding:0}.-esm-stock-management__side-nav__cohortBuilder___abPYF .cds--tab--list{flex-direction:column}.-esm-stock-management__side-nav__cohortBuilder___abPYF .cds--tabs{width:auto;max-height:20rem;display:flex;flex-direction:column;flex:1}.-esm-stock-management__side-nav__cohortBuilder___abPYF .cds--tabs__panel{height:100%;overflow-y:auto}.-esm-stock-management__side-nav__cohortBuilder___abPYF .cds--tabs .cds--tabs__nav-link{border-bottom:0;border-left:3px solid #e0e0e0;line-height:3.5}.-esm-stock-management__side-nav__cohortBuilder___abPYF .cds--tabs .cds--tabs__nav-item--selected{border-left:3px solid var(--brand-03);border-bottom:0;font-weight:600}.-esm-stock-management__side-nav__cohortBuilder___abPYF .cds--tabs__nav-link{max-height:4rem}.-esm-stock-management__side-nav__cohortBuilder___abPYF .cds--tabs__nav-link:active,.-esm-stock-management__side-nav__cohortBuilder___abPYF .cds--tabs__nav-link:focus{outline:0 !important;outline-offset:0 !important}.-esm-stock-management__side-nav__cohortBuilder___abPYF .cds--col{padding-left:0;width:100%}.-esm-stock-management__side-nav__tabletTab___yprNw{width:25%}.-esm-stock-management__side-nav__desktopTab___nnk6h{width:20%}.-esm-stock-management__side-nav__tab___LsplX{display:flex}.-esm-stock-management__side-nav__tabContainer___sofYJ{background:#fff;padding-left:1.5rem;padding-right:1rem;padding-top:1rem;margin-bottom:1rem}.-esm-stock-management__side-nav__optionCell___M_ykV{padding:0 !important}.-esm-stock-management__side-nav__optionHeader___KGdwI{width:1.5rem !important}.-esm-stock-management__side-nav__text___Q29fa{font-size:.9rem;padding:.5rem}',"",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/core/components/side-nav/side-nav.scss","webpack://./node_modules/@carbon/type/scss/_styles.scss","webpack://./node_modules/@carbon/colors/index.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CClDF,kDC61BI,0DAAA,CAAA,6DAAA,CAAA,+DAAA,CAAA,iEAAA,CD31BF,aEyCQ,CFxCR,kBGuBW,CHpBb,wDACE,UAAA,CACA,aAAA,CACA,UAAA,CACA,mBAAA,CACA,2CAAA,CAGF,wDACE,qBAAA,CACA,kBDrBM,CCsBN,YAAA,CACA,sBAAA,CAGF,gDACE,YAAA,CACA,gBAAA,CAGF,2DACE,SAAA,CAGF,0DACE,SAAA,CAIA,4HACE,UAAA,CAGF,0EACE,qBAAA,CACA,iBAAA,CACA,SAAA,CAGF,wEACE,qBAAA,CAGF,mEACE,UAAA,CACA,gBAAA,CACA,YAAA,CACA,qBAAA,CACA,MAAA,CAGF,0EACE,WAAA,CACA,eAAA,CAGF,wFACE,eAAA,CACA,6BAAA,CACA,eAAA,CAGF,kGACE,qCAAA,CACA,eAAA,CACA,eAAA,CAGF,6EAME,eAAA,CALA,uKACE,oBAAA,CACA,2BAAA,CAMJ,kEACE,cAAA,CACA,UAAA,CAIJ,oDACE,SAAA,CAGF,qDACE,SAAA,CAGF,8CACE,YAAA,CAGF,uDACE,eAAA,CACA,mBAAA,CACA,kBAAA,CACA,gBAAA,CACA,kBAAA,CAGF,qDACE,oBAAA,CAGF,uDACE,uBAAA,CAGF,+CACE,eAAA,CACA,aAAA",sourceRoot:""}]),i.locals={heading:"-esm-stock-management__side-nav__heading___vgtlj",mainContainer:"-esm-stock-management__side-nav__mainContainer___ogiHY",title:"-esm-stock-management__side-nav__title___nb7UC",desktopContainer:"-esm-stock-management__side-nav__desktopContainer___K7J5p",tabletContainer:"-esm-stock-management__side-nav__tabletContainer___qoyDq",cohortBuilder:"-esm-stock-management__side-nav__cohortBuilder___abPYF",tabletTab:"-esm-stock-management__side-nav__tabletTab___yprNw",desktopTab:"-esm-stock-management__side-nav__desktopTab___nnk6h",tab:"-esm-stock-management__side-nav__tab___LsplX",tabContainer:"-esm-stock-management__side-nav__tabContainer___sofYJ",optionCell:"-esm-stock-management__side-nav__optionCell___M_ykV",optionHeader:"-esm-stock-management__side-nav__optionHeader___KGdwI",text:"-esm-stock-management__side-nav__text___Q29fa"};const l=i},4655:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var o=n(7537),r=n.n(o),a=n(3645),i=n.n(a)()(r());i.push([e.id,':root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-stock-management__table__widgetContainer___cZm_L{background-color:#fff}.-esm-stock-management__table__widgetHeaderContainer___mn6uH{display:flex;justify-content:space-between;align-items:center;padding:.75rem 0 .75rem 1rem}.-esm-stock-management__table__widgetHeaderContainer___mn6uH>h4:after{content:"";display:block;width:2rem;padding-top:.188rem;border-bottom:.375rem solid var(--brand-01)}.-esm-stock-management__table__toggleButtons___cvBSx{width:fit-content;margin:0 .5rem}.-esm-stock-management__table__searchField___XUf8e{width:100%;max-width:250px;border:0px !important}.-esm-stock-management__table__searchBox___pXQzl{width:100%;display:flex;justify-content:right}.-esm-stock-management__table__container___Kypy0{margin-top:16px;margin-left:inherit;width:100%;overflow-y:hidden}.-esm-stock-management__table__tabContainer___E9h5_{margin-top:16px;padding-left:1rem;background-color:#fff}.-esm-stock-management__table__patientListSearch___eGIzx{margin-right:10px;padding-left:20px;max-width:16rem}.-esm-stock-management__table__patientListSearch___eGIzx input{background-color:#fff !important}.-esm-stock-management__table__tabContainer___E9h5_ li button{width:100% !important}.-esm-stock-management__table__tileContainer___ZrvLt{background-color:#fff;border-top:1px solid #e0e0e0;padding:5rem 0}.-esm-stock-management__table__tile___peYeA{margin:auto;width:fit-content}.-esm-stock-management__table__tileContent___WuPqi{display:flex;flex-direction:column;align-items:center}.-esm-stock-management__table__menuItem___Sy4dM{max-width:none}.-esm-stock-management__table__radioButtonGroup___jCXKy{display:flex;flex-direction:column;align-items:flex-start;margin-top:.5rem;min-height:4rem;width:100%;font-size:var(--cds-body-compact-01-font-size, 0.875rem);font-weight:var(--cds-body-compact-01-font-weight, 400);line-height:var(--cds-body-compact-01-line-height, 1.28572);letter-spacing:var(--cds-body-compact-01-letter-spacing, 0.16px)}.-esm-stock-management__table__radioButton____RBAw{padding:.25rem .25rem;margin:.5rem 0}section{margin:.5rem}.-esm-stock-management__table__sectionTitle___UBtqA{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);color:#525252;margin-bottom:.75rem}.-esm-stock-management__table__modalBody___QNIO4{padding-bottom:1rem}.-esm-stock-management__table__tabContainer___E9h5_ div[role=tabpanel]{padding:0 !important}.-esm-stock-management__table__tabContainer___E9h5_ li button{width:100% !important}.-esm-stock-management__table__tableContainer___rZgtk{margin:0;padding:0}.-esm-stock-management__table__search___ybQU1{max-width:16rem}.-esm-stock-management__table__search___ybQU1 input{background-color:#fff !important}.-esm-stock-management__table__tableContainer___rZgtk{background-color:#f4f4f4}.-esm-stock-management__table__tableContainer___rZgtk a{text-decoration:none}.-esm-stock-management__table__tableContainer___rZgtk tr{width:.125rem}.-esm-stock-management__table__tableContainer___rZgtk .-esm-stock-management__table__toolbarContent___XsHBI{height:3rem}.-esm-stock-management__table__cds--table-sort__description___Gup5c{display:none}.-esm-stock-management__table__patientListDownload___J2Ob4{margin-top:10px}.-esm-stock-management__table__content___qLKKH{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);color:#525252;margin-bottom:.5rem}.-esm-stock-management__table__helper___ZKdW1{font-size:var(--cds-body-compact-01-font-size, 0.875rem);font-weight:var(--cds-body-compact-01-font-weight, 400);line-height:var(--cds-body-compact-01-line-height, 1.28572);letter-spacing:var(--cds-body-compact-01-letter-spacing, 0.16px);color:#525252}',"",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/core/components/table/table.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss","webpack://./node_modules/@carbon/type/scss/_styles.scss","webpack://./node_modules/@carbon/colors/index.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CClDF,uDACE,qBDCc,CCEhB,6DACE,YAAA,CACA,6BAAA,CACA,kBAAA,CACA,4BAAA,CAGF,sEACE,UAAA,CACA,aAAA,CACA,UAAA,CACA,mBAAA,CACA,2CAAA,CAGF,qDACE,iBAAA,CACA,cAAA,CAGF,mDACE,UAAA,CACA,eAAA,CACA,qBAAA,CAGF,iDACE,UAAA,CACA,YAAA,CACA,qBAAA,CAGF,iDACE,eAAA,CACA,mBAAA,CACA,UAAA,CACA,iBAAA,CAGF,oDACE,eAAA,CACA,iBAAA,CACA,qBAAA,CAGF,yDACE,iBAAA,CACA,iBAAA,CACA,eAAA,CAEA,+DACE,gCAAA,CAIJ,8DACE,qBAAA,CAGF,qDACE,qBDpEM,CCqEN,4BAAA,CACA,cAAA,CAGF,4CACE,WAAA,CACA,iBAAA,CAGF,mDACE,YAAA,CACA,qBAAA,CACA,kBAAA,CAGF,gDACE,cAAA,CAGF,wDACE,YAAA,CACA,qBAAA,CACA,sBAAA,CACA,gBCxEW,CDyEX,eCtCW,CDuCX,UAAA,CEmwBE,wDAAA,CAAA,uDAAA,CAAA,2DAAA,CAAA,gEAAA,CF/vBJ,mDACE,qBAAA,CACA,cAAA,CAGF,QACE,YCpFW,CDuFb,oDEsvBI,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CFpvBF,aG9DQ,CH+DR,oBCrFW,CDwFb,iDACE,mBCpFW,CDuFb,uEACE,oBAAA,CAGF,8DACE,qBAAA,CAGF,sDACE,QAAA,CACA,SAAA,CAGF,8CACE,eAAA,CAEA,oDACE,gCAAA,CAIJ,sDACE,wBD5IM,CC8IN,wDACE,oBAAA,CAGF,yDACE,aCxIS,CD2IX,4GACE,WCpGS,CDwGb,oEACE,YAAA,CAGF,2DACE,eAAA,CAGF,+CE+rBI,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CF7rBF,aDhKQ,CCiKR,mBAAA,CAGF,8CEyrBI,wDAAA,CAAA,uDAAA,CAAA,2DAAA,CAAA,gEAAA,CFvrBF,aDtKQ",sourceRoot:""}]),i.locals={widgetContainer:"-esm-stock-management__table__widgetContainer___cZm_L",widgetHeaderContainer:"-esm-stock-management__table__widgetHeaderContainer___mn6uH",toggleButtons:"-esm-stock-management__table__toggleButtons___cvBSx",searchField:"-esm-stock-management__table__searchField___XUf8e",searchBox:"-esm-stock-management__table__searchBox___pXQzl",container:"-esm-stock-management__table__container___Kypy0",tabContainer:"-esm-stock-management__table__tabContainer___E9h5_",patientListSearch:"-esm-stock-management__table__patientListSearch___eGIzx",tileContainer:"-esm-stock-management__table__tileContainer___ZrvLt",tile:"-esm-stock-management__table__tile___peYeA",tileContent:"-esm-stock-management__table__tileContent___WuPqi",menuItem:"-esm-stock-management__table__menuItem___Sy4dM",radioButtonGroup:"-esm-stock-management__table__radioButtonGroup___jCXKy",radioButton:"-esm-stock-management__table__radioButton____RBAw",sectionTitle:"-esm-stock-management__table__sectionTitle___UBtqA",modalBody:"-esm-stock-management__table__modalBody___QNIO4",tableContainer:"-esm-stock-management__table__tableContainer___rZgtk",search:"-esm-stock-management__table__search___ybQU1",toolbarContent:"-esm-stock-management__table__toolbarContent___XsHBI","cds--table-sort__description":"-esm-stock-management__table__cds--table-sort__description___Gup5c",patientListDownload:"-esm-stock-management__table__patientListDownload___J2Ob4",content:"-esm-stock-management__table__content___qLKKH",helper:"-esm-stock-management__table__helper___ZKdW1"};const l=i},5260:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var o=n(7537),r=n.n(o),a=n(3645),i=n.n(a)()(r());i.push([e.id,':root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-stock-management__vertical-tabs__heading___dsNAK{font-size:var(--cds-productive-heading-02-font-size, 1rem);font-weight:var(--cds-productive-heading-02-font-weight, 600);line-height:var(--cds-productive-heading-02-line-height, 1.375);letter-spacing:var(--cds-productive-heading-02-letter-spacing, 0);color:#525252;margin-bottom:1rem}.-esm-stock-management__vertical-tabs__heading___dsNAK:after{content:"";display:block;width:2rem;padding-top:.188rem;border-bottom:.375rem solid var(--brand-03)}.-esm-stock-management__vertical-tabs__mainContainer___V_jej{padding-bottom:1.5rem;background:#f4f4f4;display:flex;justify-content:center}.-esm-stock-management__vertical-tabs__title___hZ4AW{padding:1rem;font-size:1.2rem}.-esm-stock-management__vertical-tabs__desktopContainer____twGN{width:50%}.-esm-stock-management__vertical-tabs__tabletContainer___FQsU6{width:90%}.-esm-stock-management__vertical-tabs__cohortBuilder___yGPdy .cds--date-picker.cds--date-picker--single .cds--date-picker__input{width:auto}.-esm-stock-management__vertical-tabs__cohortBuilder___yGPdy .cds--tab-content{width:100% !important;overflow-x:hidden;padding:0}.-esm-stock-management__vertical-tabs__cohortBuilder___yGPdy .cds--tab--list{flex-direction:column}.-esm-stock-management__vertical-tabs__cohortBuilder___yGPdy .cds--tabs{width:auto;max-height:20rem;display:flex;flex-direction:column;flex:1}.-esm-stock-management__vertical-tabs__cohortBuilder___yGPdy .cds--tabs__panel{height:100%;overflow-y:auto}.-esm-stock-management__vertical-tabs__cohortBuilder___yGPdy .cds--tabs .cds--tabs__nav-link{border-bottom:0;border-left:3px solid #e0e0e0;line-height:3.5}.-esm-stock-management__vertical-tabs__cohortBuilder___yGPdy .cds--tabs .cds--tabs__nav-item--selected{border-left:3px solid var(--brand-03);border-bottom:0;font-weight:600}.-esm-stock-management__vertical-tabs__cohortBuilder___yGPdy .cds--tabs__nav-link{max-height:4rem}.-esm-stock-management__vertical-tabs__cohortBuilder___yGPdy .cds--tabs__nav-link:active,.-esm-stock-management__vertical-tabs__cohortBuilder___yGPdy .cds--tabs__nav-link:focus{outline:0 !important;outline-offset:0 !important}.-esm-stock-management__vertical-tabs__cohortBuilder___yGPdy .cds--col{padding-left:0;width:100%}.-esm-stock-management__vertical-tabs__tabletTab___PHxHJ{width:25%}.-esm-stock-management__vertical-tabs__desktopTab___jh9Dp{width:20%}.-esm-stock-management__vertical-tabs__tab___IFWR5{display:flex}.-esm-stock-management__vertical-tabs__tabContainer___hu3KQ{background:#fff;padding-left:1.5rem;padding-right:1rem;padding-top:1rem;margin-bottom:1rem}.-esm-stock-management__vertical-tabs__optionCell___oFvY9{padding:0 !important}.-esm-stock-management__vertical-tabs__optionHeader___avuuO{width:1.5rem !important}.-esm-stock-management__vertical-tabs__text___VSinM{font-size:.9rem;padding:.5rem}',"",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/core/components/tabs/vertical-tabs.scss","webpack://./node_modules/@carbon/type/scss/_styles.scss","webpack://./node_modules/@carbon/colors/index.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CClDF,uDC61BI,0DAAA,CAAA,6DAAA,CAAA,+DAAA,CAAA,iEAAA,CD31BF,aEyCQ,CFxCR,kBGuBW,CHpBb,6DACE,UAAA,CACA,aAAA,CACA,UAAA,CACA,mBAAA,CACA,2CAAA,CAGF,6DACE,qBAAA,CACA,kBDrBM,CCsBN,YAAA,CACA,sBAAA,CAGF,qDACE,YAAA,CACA,gBAAA,CAGF,gEACE,SAAA,CAGF,+DACE,SAAA,CAIA,iIACE,UAAA,CAGF,+EACE,qBAAA,CACA,iBAAA,CACA,SAAA,CAGF,6EACE,qBAAA,CAGF,wEACE,UAAA,CACA,gBAAA,CACA,YAAA,CACA,qBAAA,CACA,MAAA,CAGF,+EACE,WAAA,CACA,eAAA,CAGF,6FACE,eAAA,CACA,6BAAA,CACA,eAAA,CAGF,uGACE,qCAAA,CACA,eAAA,CACA,eAAA,CAGF,kFAME,eAAA,CALA,iLACE,oBAAA,CACA,2BAAA,CAMJ,uEACE,cAAA,CACA,UAAA,CAIJ,yDACE,SAAA,CAGF,0DACE,SAAA,CAGF,mDACE,YAAA,CAGF,4DACE,eAAA,CACA,mBAAA,CACA,kBAAA,CACA,gBAAA,CACA,kBAAA,CAGF,0DACE,oBAAA,CAGF,4DACE,uBAAA,CAGF,oDACE,eAAA,CACA,aAAA",sourceRoot:""}]),i.locals={heading:"-esm-stock-management__vertical-tabs__heading___dsNAK",mainContainer:"-esm-stock-management__vertical-tabs__mainContainer___V_jej",title:"-esm-stock-management__vertical-tabs__title___hZ4AW",desktopContainer:"-esm-stock-management__vertical-tabs__desktopContainer____twGN",tabletContainer:"-esm-stock-management__vertical-tabs__tabletContainer___FQsU6",cohortBuilder:"-esm-stock-management__vertical-tabs__cohortBuilder___yGPdy",tabletTab:"-esm-stock-management__vertical-tabs__tabletTab___PHxHJ",desktopTab:"-esm-stock-management__vertical-tabs__desktopTab___jh9Dp",tab:"-esm-stock-management__vertical-tabs__tab___IFWR5",tabContainer:"-esm-stock-management__vertical-tabs__tabContainer___hu3KQ",optionCell:"-esm-stock-management__vertical-tabs__optionCell___oFvY9",optionHeader:"-esm-stock-management__vertical-tabs__optionHeader___avuuO",text:"-esm-stock-management__vertical-tabs__text___VSinM"};const l=i},6919:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var o=n(7537),r=n.n(o),a=n(3645),i=n.n(a)()(r());i.push([e.id,'.-esm-stock-management__stock-management-dashboard__container___r_M20{display:"grid";grid-template-columns:16rem auto}.-esm-stock-management__stock-management-dashboard__container___r_M20>div{margin-left:16rem}',"",{version:3,sources:["webpack://./src/dashboard/stock-management-dashboard.scss"],names:[],mappings:"AAAA,sEACE,cAAA,CACA,gCAAA,CAEA,0EACE,iBAAA",sourceRoot:""}]),i.locals={container:"-esm-stock-management__stock-management-dashboard__container___r_M20"};const l=i},49:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var o=n(7537),r=n.n(o),a=n(3645),i=n.n(a)()(r());i.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-stock-management__root__productiveHeading01___qz04k{font-size:.875rem;font-weight:600;line-height:1.29;letter-spacing:.16px}.-esm-stock-management__root__productiveHeading02___P86oI{font-size:1rem;font-weight:600;line-height:1.375;letter-spacing:0}.-esm-stock-management__root__productiveHeading03___ad2Jr{font-size:1.25rem;font-weight:400;line-height:1.4;letter-spacing:0}.-esm-stock-management__root__productiveHeading04____lfRk{font-size:1.75rem;font-weight:400;line-height:1.29;letter-spacing:0}.-esm-stock-management__root__productiveHeading05___BiHXj{font-size:2rem;font-weight:400;line-height:1.25;letter-spacing:0}.-esm-stock-management__root__productiveHeading06___fCUbs{font-size:2rem;font-weight:300;line-height:1.199;letter-spacing:0}.-esm-stock-management__root__bodyShort01___qFZKo{font-size:.875rem;font-weight:400;line-height:1.29;letter-spacing:.16px}.-esm-stock-management__root__helperText01___l9eBE{font-size:.75rem;line-height:1.34;letter-spacing:.32px}.-esm-stock-management__root__bodyShort02___e318z{font-size:1rem;font-weight:400;line-height:1.375;letter-spacing:0}.-esm-stock-management__root__bodyLong01___hajrO{font-size:.875rem;font-weight:400;line-height:1.43;letter-spacing:.16px}.-esm-stock-management__root__bodyLong02___rbPh9{font-size:1rem;font-weight:400;line-height:1.5;letter-spacing:0}.-esm-stock-management__root__label01___B9Vra{font-size:.75rem;font-weight:400;line-height:1.34;letter-spacing:.32px}.-esm-stock-management__root__text01___hIiid{color:#161616}.-esm-stock-management__root__text02___HK43C{color:#525252}aside{background-color:#fff !important}div[class*=-esm-login__styles__center]>img{width:140px}.tab-12rem>button{width:12rem !important}.tab-14rem>button{width:14rem !important}.tab-16rem>button{width:16rem !important}.bx--overflow-menu>div{width:15rem !important}nav .bx--accordion__title{color:#525252;font-weight:600 !important}nav .bx--accordion__content{padding-bottom:0 !important;padding-top:0 !important}nav .bx--accordion__content>a{background-color:#cecece !important;color:#161616 !important;border-left-color:var(--brand-01) !important}.-esm-stock-management__root__container___Rf8rX{padding:2rem}.-esm-stock-management__root__welcome___z11zb{font-size:var(--cds-heading-04-font-size, 1.75rem);font-weight:var(--cds-heading-04-font-weight, 400);line-height:var(--cds-heading-04-line-height, 1.28572);letter-spacing:var(--cds-heading-04-letter-spacing, 0);margin:1rem 0}.-esm-stock-management__root__explainer___Iuxmg{margin-bottom:2rem}.-esm-stock-management__root__noMargin___d3uMR{margin:0 !important}.-esm-stock-management__root__noPadding___k8nyn{margin:0 !important}.-esm-stock-management__root__noSpacing___IWb3Y{margin:0 !important;padding:0 !important}.-esm-stock-management__root__section___U2CGA{margin:.5rem}.cds--table-sort__description{display:none}.-esm-stock-management__root__formContainer___YM692{height:calc(100vh - 100px) !important;overflow:scroll;padding:0 1rem}.-esm-stock-management__root__verticalForm___EFCw7{display:flex;grid-row-gap:2em;padding-top:1rem;align-content:space-between;flex-direction:column}.-esm-stock-management__root__verticalForm___EFCw7 .cds--form-item{flex:none !important}","",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/root.scss","webpack://./node_modules/carbon-components/scss/globals/scss/vendor/@carbon/elements/scss/type/_styles.import.scss","webpack://./node_modules/carbon-components/scss/globals/scss/vendor/@carbon/elements/scss/themes/generated/_mixins.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss","webpack://./node_modules/@carbon/type/scss/_styles.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CC/BF,0DCwiBI,iBA0LsB,CA1LtB,eA0LsB,CA1LtB,gBA0LsB,CA1LtB,oBA0LsB,CD9tB1B,0DCoiBI,cA0LsB,CA1LtB,eA0LsB,CA1LtB,iBA0LsB,CA1LtB,gBA0LsB,CD1tB1B,0DCgiBI,iBA0LsB,CA1LtB,eA0LsB,CA1LtB,eA0LsB,CA1LtB,gBA0LsB,CDttB1B,0DC4hBI,iBA0LsB,CA1LtB,eA0LsB,CA1LtB,gBA0LsB,CA1LtB,gBA0LsB,CDltB1B,0DCwhBI,cA0LsB,CA1LtB,eA0LsB,CA1LtB,gBA0LsB,CA1LtB,gBA0LsB,CD9sB1B,0DCohBI,cA0LsB,CA1LtB,eA0LsB,CA1LtB,iBA0LsB,CA1LtB,gBA0LsB,CD1sB1B,kDCghBI,iBA0LsB,CA1LtB,eA0LsB,CA1LtB,gBA0LsB,CA1LtB,oBA0LsB,CDtsB1B,mDC4gBI,gBA0LsB,CA1LtB,gBA0LsB,CA1LtB,oBA0LsB,CDlsB1B,kDCwgBI,cA0LsB,CA1LtB,eA0LsB,CA1LtB,iBA0LsB,CA1LtB,gBA0LsB,CD9rB1B,iDCogBI,iBA0LsB,CA1LtB,eA0LsB,CA1LtB,gBA0LsB,CA1LtB,oBA0LsB,CD1rB1B,iDCggBI,cA0LsB,CA1LtB,eA0LsB,CA1LtB,eA0LsB,CA1LtB,gBA0LsB,CDtrB1B,8CC4fI,gBA0LsB,CA1LtB,eA0LsB,CA1LtB,gBA0LsB,CA1LtB,oBA0LsB,CDlrB1B,6CACE,aEvBU,CF0BZ,6CACE,aDxEQ,CC2EV,MACE,gCAAA,CAKF,2CACE,WAAA,CAGF,kBACE,sBAAA,CAGF,kBACE,sBAAA,CAGF,kBACE,sBAAA,CAGF,uBACE,sBAAA,CAGF,0BACE,aAAA,CACA,0BAAA,CAGF,4BACE,2BAAA,CACA,wBAAA,CAGF,8BACE,mCAAA,CACA,wBAAA,CACA,4CAAA,CAGF,gDACE,YGlFW,CHqFb,8CIouBI,kDAAA,CAAA,kDAAA,CAAA,sDAAA,CAAA,sDAAA,CJluBF,aAAA,CAGF,gDACE,kBAAA,CAGF,+CACE,mBAAA,CAGF,gDACE,mBAAA,CAGF,gDACE,mBAAA,CACA,oBAAA,CAGF,8CACE,YGhIW,CHmIb,8BACE,YAAA,CAGF,oDACE,qCAAA,CACA,eAAA,CACA,cAAA,CAGF,mDACE,YAAA,CACA,gBAAA,CACA,gBAAA,CACA,2BAAA,CACA,qBAAA,CAEA,mEACE,oBAAA",sourceRoot:""}]),i.locals={productiveHeading01:"-esm-stock-management__root__productiveHeading01___qz04k",productiveHeading02:"-esm-stock-management__root__productiveHeading02___P86oI",productiveHeading03:"-esm-stock-management__root__productiveHeading03___ad2Jr",productiveHeading04:"-esm-stock-management__root__productiveHeading04____lfRk",productiveHeading05:"-esm-stock-management__root__productiveHeading05___BiHXj",productiveHeading06:"-esm-stock-management__root__productiveHeading06___fCUbs",bodyShort01:"-esm-stock-management__root__bodyShort01___qFZKo",helperText01:"-esm-stock-management__root__helperText01___l9eBE",bodyShort02:"-esm-stock-management__root__bodyShort02___e318z",bodyLong01:"-esm-stock-management__root__bodyLong01___hajrO",bodyLong02:"-esm-stock-management__root__bodyLong02___rbPh9",label01:"-esm-stock-management__root__label01___B9Vra",text01:"-esm-stock-management__root__text01___hIiid",text02:"-esm-stock-management__root__text02___HK43C",container:"-esm-stock-management__root__container___Rf8rX",welcome:"-esm-stock-management__root__welcome___z11zb",explainer:"-esm-stock-management__root__explainer___Iuxmg",noMargin:"-esm-stock-management__root__noMargin___d3uMR",noPadding:"-esm-stock-management__root__noPadding___k8nyn",noSpacing:"-esm-stock-management__root__noSpacing___IWb3Y",section:"-esm-stock-management__root__section___U2CGA",formContainer:"-esm-stock-management__root__formContainer___YM692",verticalForm:"-esm-stock-management__root__verticalForm___EFCw7"};const l=i},7813:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var o=n(7537),r=n.n(o),a=n(3645),i=n.n(a)()(r());i.push([e.id,".-esm-stock-management__item__customTile___pTLBA{background-color:#f0f0f0;border-radius:4px;padding:20px;width:50px;height:100px;text-align:center;margin:2px}.-esm-stock-management__item__customTileTitle___DoQk8{font-size:14px;color:#333}","",{version:3,sources:["webpack://./src/stock-app-menu-item/item.scss"],names:[],mappings:"AACA,iDACI,wBAAA,CACA,iBAAA,CACA,YAAA,CACA,UAAA,CACA,YAAA,CACA,iBAAA,CACA,UAAA,CAGF,sDACE,cAAA,CACA,UAAA",sourceRoot:""}]),i.locals={customTile:"-esm-stock-management__item__customTile___pTLBA",customTileTitle:"-esm-stock-management__item__customTileTitle___DoQk8"};const l=i},8629:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var o=n(7537),r=n.n(o),a=n(3645),i=n.n(a)()(r());i.push([e.id,':root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-stock-management__stock-home-detail-card__container___mESY0,.-esm-stock-management__stock-home-detail-card__emptyStateContainer___OKbLT,.-esm-stock-management__stock-home-detail-card__loaderContainer___gGPuk{margin:2rem 0}.-esm-stock-management__stock-home-detail-card__tilesContainer___blppR{background-color:#fff;border:1px solid #e0e0e0;border-bottom:none;width:100%;margin:0 auto;max-width:95vw;padding-bottom:0}.-esm-stock-management__stock-home-detail-card__headerContainer___C3_bV{display:flex;justify-content:space-between;align-items:center;padding:.75rem 0 .75rem 1rem;background-color:#fff}.-esm-stock-management__stock-home-detail-card__backgroundDataFetchingIndicator___wrwp_{align-items:center;display:flex;flex:1 1 0%;justify-content:center}.-esm-stock-management__stock-home-detail-card__tableContainer___M8sDL section{position:relative}.-esm-stock-management__stock-home-detail-card__tableContainer___M8sDL a{text-decoration:none}.-esm-stock-management__stock-home-detail-card__pagination___sPPID{overflow:hidden}.-esm-stock-management__stock-home-detail-card__pagination___sPPID.cds--pagination{border-top:none}.-esm-stock-management__stock-home-detail-card__hiddenRow___YoKHa{display:none}.-esm-stock-management__stock-home-detail-card__emptyRow___TLa4s{padding:0 1rem;display:flex;align-items:center}.-esm-stock-management__stock-home-detail-card__visitSummaryContainer___oAlTc{width:100%;max-width:768px;margin:1rem auto}.-esm-stock-management__stock-home-detail-card__expandedActiveVisitRow___xkLH1>td>div{max-height:max-content !important}.-esm-stock-management__stock-home-detail-card__expandedActiveVisitRow___xkLH1 td{padding:0 2rem}.-esm-stock-management__stock-home-detail-card__expandedActiveVisitRow___xkLH1 th[colspan] td[colspan]>div:first-child{padding:0 1rem}.-esm-stock-management__stock-home-detail-card__action___Ul5A5{margin-bottom:.5rem}.-esm-stock-management__stock-home-detail-card__illo___Wm7vk{margin-top:1rem}.-esm-stock-management__stock-home-detail-card__content___Q2X06{font-size:var(--cds-heading-compact-01-font-size, 0.875rem);font-weight:var(--cds-heading-compact-01-font-weight, 600);line-height:var(--cds-heading-compact-01-line-height, 1.28572);letter-spacing:var(--cds-heading-compact-01-letter-spacing, 0.16px);color:#525252;margin-top:1rem;margin-bottom:.5rem}.-esm-stock-management__stock-home-detail-card__desktopHeading___ztNj3,.-esm-stock-management__stock-home-detail-card__tabletHeading___BSZ1h{text-align:left;text-transform:capitalize}.-esm-stock-management__stock-home-detail-card__desktopHeading___ztNj3 h4,.-esm-stock-management__stock-home-detail-card__tabletHeading___BSZ1h h4{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);color:#525252}.-esm-stock-management__stock-home-detail-card__desktopHeading___ztNj3 h4:after,.-esm-stock-management__stock-home-detail-card__tabletHeading___BSZ1h h4:after{content:"";display:block;width:2rem;padding-top:3px;border-bottom:.375rem solid;border-bottom-color:#007d79;border-bottom-color:var(--brand-03)}.-esm-stock-management__stock-home-detail-card__tile___apXYV{text-align:center;border:1px solid #e0e0e0}.-esm-stock-management__stock-home-detail-card__filterEmptyState___xwbLM{display:flex;justify-content:center;align-items:center;padding:1rem;margin:3rem;text-align:center}.-esm-stock-management__stock-home-detail-card__filterEmptyStateTile___PDk6i{margin:auto}.-esm-stock-management__stock-home-detail-card__filterEmptyStateContent___wS8z0{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);color:#525252;margin-bottom:.5rem}.-esm-stock-management__stock-home-detail-card__filterEmptyStateHelper___ircIN{font-size:var(--cds-body-compact-01-font-size, 0.875rem);font-weight:var(--cds-body-compact-01-font-weight, 400);line-height:var(--cds-body-compact-01-line-height, 1.28572);letter-spacing:var(--cds-body-compact-01-letter-spacing, 0.16px);color:#525252}.-esm-stock-management__stock-home-detail-card__cardContainer___L_H7N{display:flex;margin:0 auto}.-esm-stock-management__stock-home-detail-card__cardContainer___L_H7N>*{flex:1;margin:8px 8px}.-esm-stock-management__stock-home-detail-card__cardContainerBig___ddtbm{display:flex;flex-direction:column}.-esm-stock-management__stock-home-detail-card__card___WYEgl{display:flex;border:1px solid #ccc;margin:10px;background-color:#f4f4f4}.-esm-stock-management__stock-home-detail-card__icon___JI7mq{margin-right:23px}.-esm-stock-management__stock-home-detail-card__colorLineYellow___iJnky{width:5px;background-color:#f1c21b;margin-right:10px}.-esm-stock-management__stock-home-detail-card__colorLineBlue___kWxvF{width:5px;background-color:#0f62fe;margin-right:10px}.-esm-stock-management__stock-home-detail-card__colorLineOrange___AtZ7Z{width:5px;background-color:#ff832b;margin-right:10px}.-esm-stock-management__stock-home-detail-card__colorLineGreen___BbRKU{width:5px;background-color:#198038;margin-right:10px}.-esm-stock-management__stock-home-detail-card__colorLineRed___Rr5JB{width:5px;background-color:#da1e28;margin-right:10px}.-esm-stock-management__stock-home-detail-card__cardText____XcXr{margin-top:5px;margin-bottom:5px}.-esm-stock-management__stock-home-detail-card__cardText____XcXr p{font-size:.9em;color:#525252}',"",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/stock-home/stock-home-detail-card.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss","webpack://./node_modules/@carbon/type/scss/_styles.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CCnDF,sNACE,aAAA,CAQF,uEACE,qBDbM,CCcN,wBAAA,CACA,kBAAA,CACA,UAAA,CACA,aAAA,CACA,cAAA,CACA,gBAAA,CAGF,wEACE,YAAA,CACA,6BAAA,CACA,kBAAA,CACA,4BAAA,CACA,qBD3BM,CC8BR,wFACE,kBAAA,CACA,YAAA,CACA,WAAA,CACA,sBAAA,CAGF,+EACE,iBAAA,CAGF,yEACE,oBAAA,CAGF,mEACE,eAAA,CAEA,mFACE,eAAA,CAIJ,kEACE,YAAA,CAGF,iEACE,cAAA,CACA,YAAA,CACA,kBAAA,CAGF,8EACE,UAAA,CACA,eAAA,CACA,gBAAA,CAGF,sFACE,iCAAA,CAGF,kFACE,cAAA,CAGF,uHACE,cAAA,CAGF,+DACE,mBC9DW,CDiEb,6DACE,eCxDW,CD2Db,gEEwwBI,2DAAA,CAAA,0DAAA,CAAA,8DAAA,CAAA,mEAAA,CFtwBF,aDvFQ,CCwFR,eC9DW,CD+DX,mBCzEW,CD4Eb,6IAEE,eAAA,CACA,yBAAA,CAEA,mJE4vBE,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CF1vBA,aDnGM,CCqGN,+JACE,UAAA,CACA,aAAA,CACA,UAAA,CACA,eAAA,CACA,2BAAA,CD/DJ,2BAAA,CACA,mCAAA,CCoEF,6DACE,iBAAA,CACA,wBAAA,CAGF,yEACE,YAAA,CACA,sBAAA,CACA,kBAAA,CACA,YC/FW,CDgGX,WC5EW,CD6EX,iBAAA,CAGF,6EACE,WAAA,CAGF,gFE2tBI,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CFztBF,aDpIQ,CCqIR,mBAAA,CAGF,+EEqtBI,wDAAA,CAAA,uDAAA,CAAA,2DAAA,CAAA,gEAAA,CFntBF,aD1IQ,CC6IV,sEACE,YAAA,CACA,aAAA,CAGF,wEACE,MAAA,CACA,cAAA,CAGF,yEACE,YAAA,CACA,qBAAA,CAGF,6DACE,YAAA,CACA,qBAAA,CACA,WAAA,CACA,wBAAA,CAGF,6DACE,iBAAA,CAGF,wEACE,SAAA,CACA,wBAAA,CACA,iBAAA,CAGF,sEACE,SAAA,CACA,wBAAA,CACA,iBAAA,CAGF,wEACE,SAAA,CACA,wBAAA,CACA,iBAAA,CAGF,uEACE,SAAA,CACA,wBAAA,CACA,iBAAA,CAGF,qEACE,SAAA,CACA,wBAAA,CACA,iBAAA,CAGF,iEACE,cAAA,CACA,iBAAA,CAGF,mEACE,cAAA,CACA,aAAA",sourceRoot:""}]),i.locals={container:"-esm-stock-management__stock-home-detail-card__container___mESY0",emptyStateContainer:"-esm-stock-management__stock-home-detail-card__emptyStateContainer___OKbLT",loaderContainer:"-esm-stock-management__stock-home-detail-card__loaderContainer___gGPuk",tilesContainer:"-esm-stock-management__stock-home-detail-card__tilesContainer___blppR",headerContainer:"-esm-stock-management__stock-home-detail-card__headerContainer___C3_bV",backgroundDataFetchingIndicator:"-esm-stock-management__stock-home-detail-card__backgroundDataFetchingIndicator___wrwp_",tableContainer:"-esm-stock-management__stock-home-detail-card__tableContainer___M8sDL",pagination:"-esm-stock-management__stock-home-detail-card__pagination___sPPID",hiddenRow:"-esm-stock-management__stock-home-detail-card__hiddenRow___YoKHa",emptyRow:"-esm-stock-management__stock-home-detail-card__emptyRow___TLa4s",visitSummaryContainer:"-esm-stock-management__stock-home-detail-card__visitSummaryContainer___oAlTc",expandedActiveVisitRow:"-esm-stock-management__stock-home-detail-card__expandedActiveVisitRow___xkLH1",action:"-esm-stock-management__stock-home-detail-card__action___Ul5A5",illo:"-esm-stock-management__stock-home-detail-card__illo___Wm7vk",content:"-esm-stock-management__stock-home-detail-card__content___Q2X06",desktopHeading:"-esm-stock-management__stock-home-detail-card__desktopHeading___ztNj3",tabletHeading:"-esm-stock-management__stock-home-detail-card__tabletHeading___BSZ1h",tile:"-esm-stock-management__stock-home-detail-card__tile___apXYV",filterEmptyState:"-esm-stock-management__stock-home-detail-card__filterEmptyState___xwbLM",filterEmptyStateTile:"-esm-stock-management__stock-home-detail-card__filterEmptyStateTile___PDk6i",filterEmptyStateContent:"-esm-stock-management__stock-home-detail-card__filterEmptyStateContent___wS8z0",filterEmptyStateHelper:"-esm-stock-management__stock-home-detail-card__filterEmptyStateHelper___ircIN",cardContainer:"-esm-stock-management__stock-home-detail-card__cardContainer___L_H7N",cardContainerBig:"-esm-stock-management__stock-home-detail-card__cardContainerBig___ddtbm",card:"-esm-stock-management__stock-home-detail-card__card___WYEgl",icon:"-esm-stock-management__stock-home-detail-card__icon___JI7mq",colorLineYellow:"-esm-stock-management__stock-home-detail-card__colorLineYellow___iJnky",colorLineBlue:"-esm-stock-management__stock-home-detail-card__colorLineBlue___kWxvF",colorLineOrange:"-esm-stock-management__stock-home-detail-card__colorLineOrange___AtZ7Z",colorLineGreen:"-esm-stock-management__stock-home-detail-card__colorLineGreen___BbRKU",colorLineRed:"-esm-stock-management__stock-home-detail-card__colorLineRed___Rr5JB",cardText:"-esm-stock-management__stock-home-detail-card__cardText____XcXr"};const l=i},2426:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var o=n(7537),r=n.n(o),a=n(3645),i=n.n(a)()(r());i.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-stock-management__stock-home__cardContainer___n7Lxz{background-color:#fff;display:flex;justify-content:space-between;margin:0 1rem 0 1rem;flex-flow:row wrap;column-gap:1rem;row-gap:1rem}","",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/stock-home/stock-home.scss","webpack://./node_modules/@carbon/colors/index.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CCnDF,0DACE,qBCIM,CDHN,YAAA,CACA,6BAAA,CACA,oBAAA,CACA,kBAAA,CACA,eEqBW,CFpBX,YEoBW",sourceRoot:""}]),i.locals={cardContainer:"-esm-stock-management__stock-home__cardContainer___n7Lxz"};const l=i},4158:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var o=n(7537),r=n.n(o),a=n(3645),i=n.n(a)()(r());i.push([e.id,".-esm-stock-management__packaging-units__packingTable___ceosy{min-height:15rem;display:block}.-esm-stock-management__packaging-units__packingTableCell___KYLlI{display:flex;align-items:center}.-esm-stock-management__packaging-units__packagingTableBody___o7eKF{min-height:10rem}.-esm-stock-management__packaging-units__packagingTableContainer___kSbZ6{min-height:15rem;display:block}","",{version:3,sources:["webpack://./src/stock-items/add-stock-item/packaging-units/packaging-units.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss"],names:[],mappings:"AAIA,8DACI,gBAAA,CACA,aAAA,CAGJ,kEACI,YAAA,CACA,kBAAA,CAEJ,oEACI,gBCyDS,CDtDb,yEACI,gBAAA,CACA,aAAA",sourceRoot:""}]),i.locals={packingTable:"-esm-stock-management__packaging-units__packingTable___ceosy",packingTableCell:"-esm-stock-management__packaging-units__packingTableCell___KYLlI",packagingTableBody:"-esm-stock-management__packaging-units__packagingTableBody___o7eKF",packagingTableContainer:"-esm-stock-management__packaging-units__packagingTableContainer___kSbZ6"};const l=i},4563:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var o=n(7537),r=n.n(o),a=n(3645),i=n.n(a)()(r());i.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}section{margin:.5rem}.-esm-stock-management__add-stock-rules__sectionTitle___fsf7E{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);color:#525252;margin-bottom:.75rem}.-esm-stock-management__add-stock-rules__modalBody___DXCqE{padding-bottom:1rem}","",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/stock-items/add-stock-item/stock-item-rules/add-stock-rules.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss","webpack://./node_modules/@carbon/type/scss/_styles.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CCnDF,QACE,YCgBW,CDbb,8DE01BI,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CFx1BF,aDLQ,CCMR,oBCeW,CDZb,2DACE,mBCgBW",sourceRoot:""}]),i.locals={sectionTitle:"-esm-stock-management__add-stock-rules__sectionTitle___fsf7E",modalBody:"-esm-stock-management__add-stock-rules__modalBody___DXCqE"};const l=i},4907:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var o=n(7537),r=n.n(o),a=n(3645),i=n.n(a)()(r());i.push([e.id,".-esm-stock-management__stock-rules-filter__filterContainer___eskQ5 .cds--dropdown__wrapper--inline{gap:0}.-esm-stock-management__stock-rules-filter__filterContainer___eskQ5 .cds--list-box__menu-icon{height:1rem}.-esm-stock-management__stock-rules-filter__filterContainer___eskQ5 .cds--dropdown--inline .cds--list-box__field{min-width:12rem}","",{version:3,sources:["webpack://./src/stock-items/add-stock-item/stock-item-rules/stock-rules-filter.scss"],names:[],mappings:"AACI,oGACE,KAAA,CAGF,8FACE,WAAA,CAGF,iHACE,eAAA",sourceRoot:""}]),i.locals={filterContainer:"-esm-stock-management__stock-rules-filter__filterContainer___eskQ5"};const l=i},1048:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var o=n(7537),r=n.n(o),a=n(3645),i=n.n(a)()(r());i.push([e.id,".-esm-stock-management__filter-stock-items__spacing___pZHZK{margin:0 16px}","",{version:3,sources:["webpack://./src/stock-items/components/filter-stock-items/filter-stock-items.scss"],names:[],mappings:"AAAA,4DACI,aAAA",sourceRoot:""}]),i.locals={spacing:"-esm-stock-management__filter-stock-items__spacing___pZHZK"};const l=i},1535:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var o=n(7537),r=n.n(o),a=n(3645),i=n.n(a)()(r());i.push([e.id,':root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}:root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-stock-management__stock-items-table__productiveHeading01___MPnNp{font-size:.875rem;font-weight:600;line-height:1.29;letter-spacing:.16px}.-esm-stock-management__stock-items-table__productiveHeading02___E1KiC{font-size:1rem;font-weight:600;line-height:1.375;letter-spacing:0}.-esm-stock-management__stock-items-table__productiveHeading03___N33sp{font-size:1.25rem;font-weight:400;line-height:1.4;letter-spacing:0}.-esm-stock-management__stock-items-table__productiveHeading04___lh7n8{font-size:1.75rem;font-weight:400;line-height:1.29;letter-spacing:0}.-esm-stock-management__stock-items-table__productiveHeading05___ieA0n{font-size:2rem;font-weight:400;line-height:1.25;letter-spacing:0}.-esm-stock-management__stock-items-table__productiveHeading06___JPMyX{font-size:2rem;font-weight:300;line-height:1.199;letter-spacing:0}.-esm-stock-management__stock-items-table__bodyShort01___Z8ZwK{font-size:.875rem;font-weight:400;line-height:1.29;letter-spacing:.16px}.-esm-stock-management__stock-items-table__helperText01___uOks4{font-size:.75rem;line-height:1.34;letter-spacing:.32px}.-esm-stock-management__stock-items-table__bodyShort02___d7A67{font-size:1rem;font-weight:400;line-height:1.375;letter-spacing:0}.-esm-stock-management__stock-items-table__bodyLong01____Gl3H{font-size:.875rem;font-weight:400;line-height:1.43;letter-spacing:.16px}.-esm-stock-management__stock-items-table__bodyLong02___Dwoe9{font-size:1rem;font-weight:400;line-height:1.5;letter-spacing:0}.-esm-stock-management__stock-items-table__label01___ANQCM{font-size:.75rem;font-weight:400;line-height:1.34;letter-spacing:.32px}.-esm-stock-management__stock-items-table__text01___ZPeOt{color:#161616}.-esm-stock-management__stock-items-table__text02___ac1IL{color:#525252}aside{background-color:#fff !important}div[class*=-esm-login__styles__center]>img{width:140px}.tab-12rem>button{width:12rem !important}.tab-14rem>button{width:14rem !important}.tab-16rem>button{width:16rem !important}.bx--overflow-menu>div{width:15rem !important}nav .bx--accordion__title{color:#525252;font-weight:600 !important}nav .bx--accordion__content{padding-bottom:0 !important;padding-top:0 !important}nav .bx--accordion__content>a{background-color:#cecece !important;color:#161616 !important;border-left-color:var(--brand-01) !important}.-esm-stock-management__stock-items-table__container___VONiZ{padding:2rem}.-esm-stock-management__stock-items-table__welcome___WGa3N{font-size:var(--cds-heading-04-font-size, 1.75rem);font-weight:var(--cds-heading-04-font-weight, 400);line-height:var(--cds-heading-04-line-height, 1.28572);letter-spacing:var(--cds-heading-04-letter-spacing, 0);margin:1rem 0}.-esm-stock-management__stock-items-table__explainer___DhGUo{margin-bottom:2rem}.-esm-stock-management__stock-items-table__noMargin___KC8ym{margin:0 !important}.-esm-stock-management__stock-items-table__noPadding___N1WX1{margin:0 !important}.-esm-stock-management__stock-items-table__noSpacing___Df9tM{margin:0 !important;padding:0 !important}.-esm-stock-management__stock-items-table__section___EQIFK{margin:.5rem}.cds--table-sort__description{display:none}.-esm-stock-management__stock-items-table__formContainer___o0XL5{height:calc(100vh - 100px) !important;overflow:scroll;padding:0 1rem}.-esm-stock-management__stock-items-table__verticalForm___oOj2I{display:flex;grid-row-gap:2em;padding-top:1rem;align-content:space-between;flex-direction:column}.-esm-stock-management__stock-items-table__verticalForm___oOj2I .cds--form-item{flex:none !important}.-esm-stock-management__stock-items-table__headerBtnContainer___bXD1p{background-color:#fff;padding:1rem;text-align:right}.-esm-stock-management__stock-items-table__tileContainer___N1eHZ{background-color:#fff;border-top:1px solid #e0e0e0;padding:5rem 0}.-esm-stock-management__stock-items-table__tile___ZZNjt{margin:auto;width:fit-content}.-esm-stock-management__stock-items-table__tileContent___SC542{display:flex;flex-direction:column;align-items:center}.-esm-stock-management__stock-items-table__content___zdm4U{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);color:#525252;margin-bottom:.5rem}.-esm-stock-management__stock-items-table__helper___kKhcQ{font-size:var(--cds-body-compact-01-font-size, 0.875rem);font-weight:var(--cds-body-compact-01-font-weight, 400);line-height:var(--cds-body-compact-01-line-height, 1.28572);letter-spacing:var(--cds-body-compact-01-letter-spacing, 0.16px);color:#525252}.-esm-stock-management__stock-items-table__separator___JXP1R{font-size:var(--cds-body-compact-02-font-size, 1rem);font-weight:var(--cds-body-compact-02-font-weight, 400);line-height:var(--cds-body-compact-02-line-height, 1.375);letter-spacing:var(--cds-body-compact-02-letter-spacing, 0);color:#525252;width:80%;margin:1.5rem auto;overflow:hidden;text-align:center}.-esm-stock-management__stock-items-table__separator___JXP1R::before,.-esm-stock-management__stock-items-table__separator___JXP1R::after{background-color:#a8a8a8;content:"";display:inline-block;height:1px;position:relative;vertical-align:middle;width:50%}.-esm-stock-management__stock-items-table__separator___JXP1R::before{right:.5rem;margin-left:-50%}.-esm-stock-management__stock-items-table__separator___JXP1R::after{left:.5rem;margin-right:-50%}',"",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/root.scss","webpack://./node_modules/carbon-components/scss/globals/scss/vendor/@carbon/elements/scss/type/_styles.import.scss","webpack://./node_modules/carbon-components/scss/globals/scss/vendor/@carbon/elements/scss/themes/generated/_mixins.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss","webpack://./node_modules/@carbon/type/scss/_styles.scss","webpack://./src/stock-items/stock-items-table.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CAHF,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CC/BF,uECwiBI,iBA0LsB,CA1LtB,eA0LsB,CA1LtB,gBA0LsB,CA1LtB,oBA0LsB,CD9tB1B,uECoiBI,cA0LsB,CA1LtB,eA0LsB,CA1LtB,iBA0LsB,CA1LtB,gBA0LsB,CD1tB1B,uECgiBI,iBA0LsB,CA1LtB,eA0LsB,CA1LtB,eA0LsB,CA1LtB,gBA0LsB,CDttB1B,uEC4hBI,iBA0LsB,CA1LtB,eA0LsB,CA1LtB,gBA0LsB,CA1LtB,gBA0LsB,CDltB1B,uECwhBI,cA0LsB,CA1LtB,eA0LsB,CA1LtB,gBA0LsB,CA1LtB,gBA0LsB,CD9sB1B,uECohBI,cA0LsB,CA1LtB,eA0LsB,CA1LtB,iBA0LsB,CA1LtB,gBA0LsB,CD1sB1B,+DCghBI,iBA0LsB,CA1LtB,eA0LsB,CA1LtB,gBA0LsB,CA1LtB,oBA0LsB,CDtsB1B,gEC4gBI,gBA0LsB,CA1LtB,gBA0LsB,CA1LtB,oBA0LsB,CDlsB1B,+DCwgBI,cA0LsB,CA1LtB,eA0LsB,CA1LtB,iBA0LsB,CA1LtB,gBA0LsB,CD9rB1B,8DCogBI,iBA0LsB,CA1LtB,eA0LsB,CA1LtB,gBA0LsB,CA1LtB,oBA0LsB,CD1rB1B,8DCggBI,cA0LsB,CA1LtB,eA0LsB,CA1LtB,eA0LsB,CA1LtB,gBA0LsB,CDtrB1B,2DC4fI,gBA0LsB,CA1LtB,eA0LsB,CA1LtB,gBA0LsB,CA1LtB,oBA0LsB,CDlrB1B,0DACE,aEvBU,CF0BZ,0DACE,aDxEQ,CC2EV,MACE,gCAAA,CAKF,2CACE,WAAA,CAGF,kBACE,sBAAA,CAGF,kBACE,sBAAA,CAGF,kBACE,sBAAA,CAGF,uBACE,sBAAA,CAGF,0BACE,aAAA,CACA,0BAAA,CAGF,4BACE,2BAAA,CACA,wBAAA,CAGF,8BACE,mCAAA,CACA,wBAAA,CACA,4CAAA,CAGF,6DACE,YGlFW,CHqFb,2DIouBI,kDAAA,CAAA,kDAAA,CAAA,sDAAA,CAAA,sDAAA,CJluBF,aAAA,CAGF,6DACE,kBAAA,CAGF,4DACE,mBAAA,CAGF,6DACE,mBAAA,CAGF,6DACE,mBAAA,CACA,oBAAA,CAGF,2DACE,YGhIW,CHmIb,8BACE,YAAA,CAGF,iEACE,qCAAA,CACA,eAAA,CACA,cAAA,CAGF,gEACE,YAAA,CACA,gBAAA,CACA,gBAAA,CACA,2BAAA,CACA,qBAAA,CAEA,gFACE,oBAAA,CKtKJ,sEACI,qBLOY,CKNZ,YFyBS,CExBT,gBAAA,CAGF,iEACE,qBLFI,CKGJ,4BAAA,CACA,cAAA,CAGF,wDACE,WAAA,CACA,iBAAA,CAGF,+DACE,YAAA,CACA,qBAAA,CACA,kBAAA,CAEF,2DDw0BE,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CCt0BA,aNvBM,CMwBN,mBAAA,CAGF,0DDk0BE,wDAAA,CAAA,uDAAA,CAAA,2DAAA,CAAA,gEAAA,CCh0BA,aN7BM,CMgCR,6DD6zBE,oDAAA,CAAA,uDAAA,CAAA,yDAAA,CAAA,2DAAA,CC3zBA,aNlCM,CMmCN,SAAA,CACA,kBAAA,CACA,eAAA,CACA,iBAAA,CAEA,yIAEE,wBNzCI,CM0CJ,UAAA,CACA,oBAAA,CACA,UAAA,CACA,iBAAA,CACA,qBAAA,CACA,SAAA,CAGF,qEACE,WAAA,CACA,gBAAA,CAGF,oEACE,UAAA,CACA,iBAAA",sourceRoot:""}]),i.locals={productiveHeading01:"-esm-stock-management__stock-items-table__productiveHeading01___MPnNp",productiveHeading02:"-esm-stock-management__stock-items-table__productiveHeading02___E1KiC",productiveHeading03:"-esm-stock-management__stock-items-table__productiveHeading03___N33sp",productiveHeading04:"-esm-stock-management__stock-items-table__productiveHeading04___lh7n8",productiveHeading05:"-esm-stock-management__stock-items-table__productiveHeading05___ieA0n",productiveHeading06:"-esm-stock-management__stock-items-table__productiveHeading06___JPMyX",bodyShort01:"-esm-stock-management__stock-items-table__bodyShort01___Z8ZwK",helperText01:"-esm-stock-management__stock-items-table__helperText01___uOks4",bodyShort02:"-esm-stock-management__stock-items-table__bodyShort02___d7A67",bodyLong01:"-esm-stock-management__stock-items-table__bodyLong01____Gl3H",bodyLong02:"-esm-stock-management__stock-items-table__bodyLong02___Dwoe9",label01:"-esm-stock-management__stock-items-table__label01___ANQCM",text01:"-esm-stock-management__stock-items-table__text01___ZPeOt",text02:"-esm-stock-management__stock-items-table__text02___ac1IL",container:"-esm-stock-management__stock-items-table__container___VONiZ",welcome:"-esm-stock-management__stock-items-table__welcome___WGa3N",explainer:"-esm-stock-management__stock-items-table__explainer___DhGUo",noMargin:"-esm-stock-management__stock-items-table__noMargin___KC8ym",noPadding:"-esm-stock-management__stock-items-table__noPadding___N1WX1",noSpacing:"-esm-stock-management__stock-items-table__noSpacing___Df9tM",section:"-esm-stock-management__stock-items-table__section___EQIFK",formContainer:"-esm-stock-management__stock-items-table__formContainer___o0XL5",verticalForm:"-esm-stock-management__stock-items-table__verticalForm___oOj2I",headerBtnContainer:"-esm-stock-management__stock-items-table__headerBtnContainer___bXD1p",tileContainer:"-esm-stock-management__stock-items-table__tileContainer___N1eHZ",tile:"-esm-stock-management__stock-items-table__tile___ZZNjt",tileContent:"-esm-stock-management__stock-items-table__tileContent___SC542",content:"-esm-stock-management__stock-items-table__content___zdm4U",helper:"-esm-stock-management__stock-items-table__helper___kKhcQ",separator:"-esm-stock-management__stock-items-table__separator___JXP1R"};const l=i},965:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var o=n(7537),r=n.n(o),a=n(3645),i=n.n(a)()(r());i.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-stock-management__stock-management-header__header___eKmgW{font-size:var(--cds-body-compact-02-font-size, 1rem);font-weight:var(--cds-body-compact-02-font-weight, 400);line-height:var(--cds-body-compact-02-line-height, 1.375);letter-spacing:var(--cds-body-compact-02-letter-spacing, 0);color:#525252;height:6rem;background-color:#fff;display:flex;padding-left:8px;justify-content:space-between}.-esm-stock-management__stock-management-header__left-justified-items___VpNpP{display:flex;flex-direction:row;align-items:center;cursor:pointer}.-esm-stock-management__stock-management-header__right-justified-items___IOVey{font-size:var(--cds-body-compact-02-font-size, 1rem);font-weight:var(--cds-body-compact-02-font-weight, 400);line-height:var(--cds-body-compact-02-line-height, 1.375);letter-spacing:var(--cds-body-compact-02-letter-spacing, 0);color:#525252;margin:.5rem}.-esm-stock-management__stock-management-header__page-name___CPqh1{font-size:var(--cds-heading-04-font-size, 1.75rem);font-weight:var(--cds-heading-04-font-weight, 400);line-height:var(--cds-heading-04-line-height, 1.28572);letter-spacing:var(--cds-heading-04-letter-spacing, 0)}.-esm-stock-management__stock-management-header__page-labels___qR7PY{margin:1rem}.-esm-stock-management__stock-management-header__middot___gwifp{margin:0 .5rem}.-esm-stock-management__stock-management-header__date-and-location___Uxut9{display:flex;justify-content:flex-end;align-items:center;margin-right:1rem}.-esm-stock-management__stock-management-header__value___eLYN8{margin-left:.25rem}.-esm-stock-management__stock-management-header__middot___gwifp{margin:0 .5rem}.-esm-stock-management__stock-management-header__view___f_vFK{font-size:var(--cds-label-01-font-size, 0.75rem);font-weight:var(--cds-label-01-font-weight, 400);line-height:var(--cds-label-01-line-height, 1.33333);letter-spacing:var(--cds-label-01-letter-spacing, 0.32px)}","",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/stock-management-header/stock-management-header.scss","webpack://./node_modules/@carbon/type/scss/_styles.scss","webpack://./node_modules/@carbon/colors/index.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CClDF,gEC61BI,oDAAA,CAAA,uDAAA,CAAA,yDAAA,CAAA,2DAAA,CD31BF,aEyCQ,CFxCR,WG0DW,CHzDX,qBDRM,CCSN,YAAA,CACA,gBAAA,CACA,6BAAA,CAGF,8EACE,YAAA,CACA,kBAAA,CACA,kBAAA,CACA,cAAA,CAGF,+EC40BI,oDAAA,CAAA,uDAAA,CAAA,yDAAA,CAAA,2DAAA,CD10BF,aEwBQ,CFvBR,YAAA,CAGF,mECs0BI,kDAAA,CAAA,kDAAA,CAAA,sDAAA,CAAA,sDAAA,CDl0BJ,qEACE,WAAA,CAGF,gEACE,cAAA,CAGF,2EACE,YAAA,CACA,wBAAA,CACA,kBAAA,CACA,iBAAA,CAGF,+DACE,kBAAA,CAGF,gEACE,cAAA,CAGF,8DC2yBI,gDAAA,CAAA,gDAAA,CAAA,oDAAA,CAAA,yDAAA",sourceRoot:""}]),i.locals={header:"-esm-stock-management__stock-management-header__header___eKmgW","left-justified-items":"-esm-stock-management__stock-management-header__left-justified-items___VpNpP","right-justified-items":"-esm-stock-management__stock-management-header__right-justified-items___IOVey","page-name":"-esm-stock-management__stock-management-header__page-name___CPqh1","page-labels":"-esm-stock-management__stock-management-header__page-labels___qR7PY",middot:"-esm-stock-management__stock-management-header__middot___gwifp","date-and-location":"-esm-stock-management__stock-management-header__date-and-location___Uxut9",value:"-esm-stock-management__stock-management-header__value___eLYN8",view:"-esm-stock-management__stock-management-header__view___f_vFK"};const l=i},2496:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var o=n(7537),r=n.n(o),a=n(3645),i=n.n(a)()(r());i.push([e.id,':root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-stock-management__add-stock-operation__sectionTitle___t2vui{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);color:#525252;margin-bottom:.75rem}.-esm-stock-management__add-stock-operation__modalBody___YyRxm{padding-bottom:1rem}.-esm-stock-management__add-stock-operation__actionsContainer___SDbLm{display:"flex";justify-content:space-between;margin:"5px"}.-esm-stock-management__add-stock-operation__statusDescriptions___fzNKe{display:"flex";flex-direction:"row"}.-esm-stock-management__add-stock-operation__statusContainer___MzxxK{display:"flex";flex-direction:"row";margin-top:"4px"}.-esm-stock-management__add-stock-operation__text___DFlMr{font-size:"8px"}.-esm-stock-management__add-stock-operation__textHeading___eg7oM{font-size:"10px";font-weight:bold}.-esm-stock-management__add-stock-operation__actionButtons___XhL8k{margin:"10px";display:"flex";flex-direction:"row"}',"",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/stock-operations/add-stock-operation/add-stock-operation.scss","webpack://./node_modules/@carbon/type/scss/_styles.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CCnDF,kEC81BI,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CD51BF,aDDQ,CCER,oBEmBW,CFhBb,+DACE,mBEoBW,CFjBb,sEACE,cAAA,CACA,6BAAA,CACA,YAAA,CAGF,wEACE,cAAA,CACA,oBAAA,CAGF,qEACE,cAAA,CACA,oBAAA,CACA,gBAAA,CAGF,0DACE,eAAA,CAEF,iEACE,gBAAA,CACA,gBAAA,CAGF,mEACE,aAAA,CACA,cAAA,CACA,oBAAA",sourceRoot:""}]),i.locals={sectionTitle:"-esm-stock-management__add-stock-operation__sectionTitle___t2vui",modalBody:"-esm-stock-management__add-stock-operation__modalBody___YyRxm",actionsContainer:"-esm-stock-management__add-stock-operation__actionsContainer___SDbLm",statusDescriptions:"-esm-stock-management__add-stock-operation__statusDescriptions___fzNKe",statusContainer:"-esm-stock-management__add-stock-operation__statusContainer___MzxxK",text:"-esm-stock-management__add-stock-operation__text___DFlMr",textHeading:"-esm-stock-management__add-stock-operation__textHeading___eg7oM",actionButtons:"-esm-stock-management__add-stock-operation__actionButtons___XhL8k"};const l=i},6781:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var o=n(7537),r=n.n(o),a=n(3645),i=n.n(a)()(r());i.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]),i.locals={};const l=i},6360:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var o=n(7537),r=n.n(o),a=n(3645),i=n.n(a)()(r());i.push([e.id,".-esm-stock-management__stock-items-addition-component__tableContainer___J5PsN .cds--data-table-content{height:calc(100vh - 150px)}","",{version:3,sources:["webpack://./src/stock-operations/add-stock-operation/stock-items-addition.component.scss"],names:[],mappings:"AACE,wGACE,0BAAA",sourceRoot:""}]),i.locals={tableContainer:"-esm-stock-management__stock-items-addition-component__tableContainer___J5PsN"};const l=i},1256:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var o=n(7537),r=n.n(o),a=n(3645),i=n.n(a)()(r());i.push([e.id,"section{margin:.5rem}.-esm-stock-management__stock-operations-dialog__sectionTitle____y5Vp{margin-bottom:.75rem}.-esm-stock-management__stock-operations-dialog__modalBody___xG3z2{padding-bottom:1rem}","",{version:3,sources:["webpack://./src/stock-operations/stock-operations-dialog/stock-operations-dialog.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss"],names:[],mappings:"AAGA,QACE,YCiBW,CDdb,sEACE,oBCkBW,CDfb,mEACE,mBCmBW",sourceRoot:""}]),i.locals={sectionTitle:"-esm-stock-management__stock-operations-dialog__sectionTitle____y5Vp",modalBody:"-esm-stock-management__stock-operations-dialog__modalBody___xG3z2"};const l=i},8098:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var o=n(7537),r=n.n(o),a=n(3645),i=n.n(a)()(r());i.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}section{margin:.5rem}.-esm-stock-management__add-stock-sources__sectionTitle___mIFZm{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);color:#525252;margin-bottom:.75rem}.-esm-stock-management__add-stock-sources__modalBody___QeuLr{padding-bottom:1rem}","",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/stock-sources/add-stock-sources/add-stock-sources.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss","webpack://./node_modules/@carbon/type/scss/_styles.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CCnDF,QACE,YCgBW,CDbb,gEE01BI,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CFx1BF,aDLQ,CCMR,oBCeW,CDZb,6DACE,mBCgBW",sourceRoot:""}]),i.locals={sectionTitle:"-esm-stock-management__add-stock-sources__sectionTitle___mIFZm",modalBody:"-esm-stock-management__add-stock-sources__modalBody___QeuLr"};const l=i},5551:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var o=n(7537),r=n.n(o),a=n(3645),i=n.n(a)()(r());i.push([e.id,".-esm-stock-management__stock-sources-filter__filterContainer___Bd1E5 .cds--dropdown__wrapper--inline{gap:0}.-esm-stock-management__stock-sources-filter__filterContainer___Bd1E5 .cds--list-box__menu-icon{height:1rem}.-esm-stock-management__stock-sources-filter__filterContainer___Bd1E5 .cds--dropdown--inline .cds--list-box__field{min-width:12rem}","",{version:3,sources:["webpack://./src/stock-sources/stock-sources-filter/stock-sources-filter.scss"],names:[],mappings:"AACI,sGACE,KAAA,CAGF,gGACE,WAAA,CAGF,mHACE,eAAA",sourceRoot:""}]),i.locals={filterContainer:"-esm-stock-management__stock-sources-filter__filterContainer___Bd1E5"};const l=i},6940:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var o=n(7537),r=n.n(o),a=n(3645),i=n.n(a)()(r());i.push([e.id,':root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-stock-management__stock-sources__container___WSslj{background-color:#f4f4f4}.-esm-stock-management__stock-sources__headerContainer___Ze03U{display:flex;justify-content:space-between;align-items:center;padding:1rem;background-color:#fff}.-esm-stock-management__stock-sources__headerButtons___diHXv{display:flex;flex-flow:column}.-esm-stock-management__stock-sources__heading___eDFEL{font-size:20px;font-weight:bold}.-esm-stock-management__stock-sources__filterContainer___SeMsL .cds--dropdown__wrapper--inline{gap:0}.-esm-stock-management__stock-sources__filterContainer___SeMsL .cds--list-box__menu-icon{height:1rem}.-esm-stock-management__stock-sources__filterContainer___SeMsL .cds--dropdown--inline .cds--list-box__field{min-width:12rem}.-esm-stock-management__stock-sources__tooltip___CZOKY .cds--tooltip__trigger.cds--tooltip__trigger--definition{border-bottom:none}.-esm-stock-management__stock-sources__tag___KdICQ{margin:.25rem 0}.-esm-stock-management__stock-sources__backgroundDataFetchingIndicator___FDncZ{align-items:center;display:flex;flex:1 1 0%;justify-content:center}.-esm-stock-management__stock-sources__search___skZQ1{max-width:16rem}.-esm-stock-management__stock-sources__search___skZQ1 input{background-color:#fff !important}.-esm-stock-management__stock-sources__tableContainer___lpDEm{background-color:#f4f4f4;margin:0 1rem;padding:0}.-esm-stock-management__stock-sources__tableContainer___lpDEm a{text-decoration:none}.-esm-stock-management__stock-sources__tableContainer___lpDEm th{color:#525252}.-esm-stock-management__stock-sources__tableContainer___lpDEm .cds--data-table{background-color:#e0e0e0}.-esm-stock-management__stock-sources__tableContainer___lpDEm .-esm-stock-management__stock-sources__toolbarContent___gZ2MJ{height:2rem;margin-bottom:.25rem}.-esm-stock-management__stock-sources__emptyRow___wlFNH{padding:0 1rem;display:flex;align-items:center}.-esm-stock-management__stock-sources__stockSourcesTable___KNEf1 tr:last-of-type td{border-bottom:none}.-esm-stock-management__stock-sources__content___EBUcR{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);color:#525252;margin-bottom:.5rem}.-esm-stock-management__stock-sources__helper___Pxp0P{font-size:var(--cds-body-compact-01-font-size, 0.875rem);font-weight:var(--cds-body-compact-01-font-weight, 400);line-height:var(--cds-body-compact-01-line-height, 1.28572);letter-spacing:var(--cds-body-compact-01-letter-spacing, 0.16px);color:#525252}.-esm-stock-management__stock-sources__separator___NUg2A{font-size:var(--cds-body-compact-02-font-size, 1rem);font-weight:var(--cds-body-compact-02-font-weight, 400);line-height:var(--cds-body-compact-02-line-height, 1.375);letter-spacing:var(--cds-body-compact-02-letter-spacing, 0);color:#525252;width:80%;margin:1.5rem auto;overflow:hidden;text-align:center}.-esm-stock-management__stock-sources__separator___NUg2A::before,.-esm-stock-management__stock-sources__separator___NUg2A::after{background-color:#a8a8a8;content:"";display:inline-block;height:1px;position:relative;vertical-align:middle;width:50%}.-esm-stock-management__stock-sources__separator___NUg2A::before{right:.5rem;margin-left:-50%}.-esm-stock-management__stock-sources__separator___NUg2A::after{left:.5rem;margin-right:-50%}.-esm-stock-management__stock-sources__tileContainer___p2Nnr{background-color:#fff;border-top:1px solid #e0e0e0;padding:5rem 0}.-esm-stock-management__stock-sources__tile___ZRgFn{margin:auto;width:fit-content}.-esm-stock-management__stock-sources__tileContent___dm3Qq{display:flex;flex-direction:column;align-items:center}.-esm-stock-management__stock-sources__menuItem___Brdql{max-width:none}.-esm-stock-management__stock-sources__desktopHeading___tb1eK h4{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);color:#525252}.-esm-stock-management__stock-sources__tabletHeading___rIkv3 h4{font-size:var(--cds-heading-03-font-size, 1.25rem);font-weight:var(--cds-heading-03-font-weight, 400);line-height:var(--cds-heading-03-line-height, 1.4);letter-spacing:var(--cds-heading-03-letter-spacing, 0);color:#525252}.-esm-stock-management__stock-sources__desktopHeading___tb1eK,.-esm-stock-management__stock-sources__tabletHeading___rIkv3{text-align:left;text-transform:capitalize;margin-bottom:1rem}.-esm-stock-management__stock-sources__desktopHeading___tb1eK h4:after,.-esm-stock-management__stock-sources__tabletHeading___rIkv3 h4:after{content:"";display:block;width:2rem;padding-top:3px;border-bottom:.375rem solid var(--brand-03)}.-esm-stock-management__stock-sources__statusContainer___meWIY{display:flex;align-items:center}.-esm-stock-management__stock-sources__statusContainer___meWIY svg{margin-right:.5rem}.-esm-stock-management__stock-sources__visitType___HhWht{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0)}.-esm-stock-management__stock-sources__headerBtnContainer___zSCLg{background-color:#fff;padding:1rem;text-align:right}.-esm-stock-management__stock-sources__addPatientToListBtn___Jo50q{margin-left:1rem;height:3rem}.-esm-stock-management__stock-sources__editIcon___A00kf{color:#0f62fe;margin-top:.5rem;cursor:pointer}',"",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/stock-sources/stock-sources.scss","webpack://./node_modules/@carbon/colors/index.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss","webpack://./node_modules/@carbon/type/scss/_styles.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CClDF,yDACE,wBDNM,CCSR,+DACE,YAAA,CACA,6BAAA,CACA,kBAAA,CACA,YAAA,CACA,qBDPc,CCUhB,6DACE,YAAA,CACA,gBAAA,CAGF,uDACE,cAAA,CACA,gBAAA,CAIA,+FACE,KAAA,CAGF,yFACE,WAAA,CAGF,4GACE,eAAA,CAIJ,gHACE,kBAAA,CAGF,mDACE,eAAA,CAGF,+EACE,kBAAA,CACA,YAAA,CACA,WAAA,CACA,sBAAA,CAGF,sDACE,eAAA,CAEA,4DACE,gCAAA,CAIJ,8DACE,wBDjEM,CCkEN,aAAA,CACA,SAAA,CAEA,gEACE,oBAAA,CAGF,iEACE,aC1BM,CD6BR,+EACE,wBD5EI,CC+EN,4HACE,WEzCS,CF0CT,oBEnES,CFuEb,wDACE,cAAA,CACA,YAAA,CACA,kBAAA,CAIA,oFACE,kBAAA,CAKJ,uDG8vBI,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CH5vBF,aCtDQ,CDuDR,mBAAA,CAGF,sDGwvBI,wDAAA,CAAA,uDAAA,CAAA,2DAAA,CAAA,gEAAA,CHtvBF,aC5DQ,CD+DV,yDGmvBI,oDAAA,CAAA,uDAAA,CAAA,yDAAA,CAAA,2DAAA,CHjvBF,aCjEQ,CDkER,SAAA,CACA,kBAAA,CACA,eAAA,CACA,iBAAA,CAEA,iIAEE,wBDnHM,CCoHN,UAAA,CACA,oBAAA,CACA,UAAA,CACA,iBAAA,CACA,qBAAA,CACA,SAAA,CAGF,iEACE,WAAA,CACA,gBAAA,CAGF,gEACE,UAAA,CACA,iBAAA,CAIJ,6DACE,qBD7IM,CC8IN,4BAAA,CACA,cAAA,CAGF,oDACE,WAAA,CACA,iBAAA,CAGF,2DACE,YAAA,CACA,qBAAA,CACA,kBAAA,CAGF,wDACE,cAAA,CAIA,iEG+rBE,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CH7rBA,aCrHM,CD0HR,gEGwrBE,kDAAA,CAAA,kDAAA,CAAA,kDAAA,CAAA,sDAAA,CHtrBA,aC5HM,CDgIV,2HAEE,eAAA,CACA,yBAAA,CACA,kBErJW,CFuJX,6IACE,UAAA,CACA,aAAA,CACA,UAAA,CACA,eAAA,CACA,2CAAA,CAIJ,+DACE,YAAA,CACA,kBAAA,CAEA,mEACE,kBAAA,CAIJ,yDG0pBI,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CHtpBJ,kEACE,qBDtMc,CCuMd,YE/KW,CFgLX,gBAAA,CAGF,mEACE,gBEpLW,CFqLX,WEjKW,CFoKb,wDACE,aDnMe,CCoMf,gBAAA,CACA,cAAA",sourceRoot:""}]),i.locals={container:"-esm-stock-management__stock-sources__container___WSslj",headerContainer:"-esm-stock-management__stock-sources__headerContainer___Ze03U",headerButtons:"-esm-stock-management__stock-sources__headerButtons___diHXv",heading:"-esm-stock-management__stock-sources__heading___eDFEL",filterContainer:"-esm-stock-management__stock-sources__filterContainer___SeMsL",tooltip:"-esm-stock-management__stock-sources__tooltip___CZOKY",tag:"-esm-stock-management__stock-sources__tag___KdICQ",backgroundDataFetchingIndicator:"-esm-stock-management__stock-sources__backgroundDataFetchingIndicator___FDncZ",search:"-esm-stock-management__stock-sources__search___skZQ1",tableContainer:"-esm-stock-management__stock-sources__tableContainer___lpDEm",toolbarContent:"-esm-stock-management__stock-sources__toolbarContent___gZ2MJ",emptyRow:"-esm-stock-management__stock-sources__emptyRow___wlFNH",stockSourcesTable:"-esm-stock-management__stock-sources__stockSourcesTable___KNEf1",content:"-esm-stock-management__stock-sources__content___EBUcR",helper:"-esm-stock-management__stock-sources__helper___Pxp0P",separator:"-esm-stock-management__stock-sources__separator___NUg2A",tileContainer:"-esm-stock-management__stock-sources__tileContainer___p2Nnr",tile:"-esm-stock-management__stock-sources__tile___ZRgFn",tileContent:"-esm-stock-management__stock-sources__tileContent___dm3Qq",menuItem:"-esm-stock-management__stock-sources__menuItem___Brdql",desktopHeading:"-esm-stock-management__stock-sources__desktopHeading___tb1eK",tabletHeading:"-esm-stock-management__stock-sources__tabletHeading___rIkv3",statusContainer:"-esm-stock-management__stock-sources__statusContainer___meWIY",visitType:"-esm-stock-management__stock-sources__visitType___HhWht",headerBtnContainer:"-esm-stock-management__stock-sources__headerBtnContainer___zSCLg",addPatientToListBtn:"-esm-stock-management__stock-sources__addPatientToListBtn___Jo50q",editIcon:"-esm-stock-management__stock-sources__editIcon___A00kf"};const l=i},4300:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var o=n(7537),r=n.n(o),a=n(3645),i=n.n(a)()(r());i.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}section{margin:.5rem}.-esm-stock-management__add-stock-user-role-scope__sectionTitle___Bb005{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);color:#525252;margin-bottom:.75rem}.-esm-stock-management__add-stock-user-role-scope__subTitle___JC7xq{font-size:14px;margin-bottom:.75rem}.-esm-stock-management__add-stock-user-role-scope__modalBody___uNo7X{padding-bottom:1rem}.-esm-stock-management__add-stock-user-role-scope__checkboxGrid___QNkgg{display:grid;grid-template-columns:repeat(auto-fill, minmax(150px, 1fr));gap:16px}.-esm-stock-management__add-stock-user-role-scope__hr___S9Kir{border:1px solid #000}.-esm-stock-management__add-stock-user-role-scope__toggle___JX5ts{margin:5px}.-esm-stock-management__add-stock-user-role-scope__checkbox___DZHJM{width:100%}","",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/stock-user-role-scopes/add-stock-user-scope/add-stock-user-role-scope.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss","webpack://./node_modules/@carbon/type/scss/_styles.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CCnDF,QACE,YCgBW,CDbb,wEE01BI,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CFx1BF,aDLQ,CCMR,oBCeW,CDZb,oEACE,cAAA,CACA,oBCUW,CDPb,qEACE,mBCWW,CDRb,wEACE,YAAA,CACA,2DAAA,CACA,QAAA,CAEF,8DACE,qBAAA,CAEF,kEACE,UAAA,CAEF,oEACE,UAAA",sourceRoot:""}]),i.locals={sectionTitle:"-esm-stock-management__add-stock-user-role-scope__sectionTitle___Bb005",subTitle:"-esm-stock-management__add-stock-user-role-scope__subTitle___JC7xq",modalBody:"-esm-stock-management__add-stock-user-role-scope__modalBody___uNo7X",checkboxGrid:"-esm-stock-management__add-stock-user-role-scope__checkboxGrid___QNkgg",hr:"-esm-stock-management__add-stock-user-role-scope__hr___S9Kir",toggle:"-esm-stock-management__add-stock-user-role-scope__toggle___JX5ts",checkbox:"-esm-stock-management__add-stock-user-role-scope__checkbox___DZHJM"};const l=i},5104:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var o=n(7537),r=n.n(o),a=n(3645),i=n.n(a)()(r());i.push([e.id,':root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-stock-management__stock-user-role-scopes__content___g06Q8{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);color:#525252;margin-bottom:.5rem}.-esm-stock-management__stock-user-role-scopes__helper___VOKFX{font-size:var(--cds-body-compact-01-font-size, 0.875rem);font-weight:var(--cds-body-compact-01-font-weight, 400);line-height:var(--cds-body-compact-01-line-height, 1.28572);letter-spacing:var(--cds-body-compact-01-letter-spacing, 0.16px);color:#525252}.-esm-stock-management__stock-user-role-scopes__separator___M4cpF{font-size:var(--cds-body-compact-02-font-size, 1rem);font-weight:var(--cds-body-compact-02-font-weight, 400);line-height:var(--cds-body-compact-02-line-height, 1.375);letter-spacing:var(--cds-body-compact-02-letter-spacing, 0);color:#525252;width:80%;margin:1.5rem auto;overflow:hidden;text-align:center}.-esm-stock-management__stock-user-role-scopes__separator___M4cpF::before,.-esm-stock-management__stock-user-role-scopes__separator___M4cpF::after{background-color:#a8a8a8;content:"";display:inline-block;height:1px;position:relative;vertical-align:middle;width:50%}.-esm-stock-management__stock-user-role-scopes__separator___M4cpF::before{right:.5rem;margin-left:-50%}.-esm-stock-management__stock-user-role-scopes__separator___M4cpF::after{left:.5rem;margin-right:-50%}.-esm-stock-management__stock-user-role-scopes__tileContainer___PGoSd{background-color:#fff;border-top:1px solid #e0e0e0;padding:5rem 0}.-esm-stock-management__stock-user-role-scopes__tile___C5KRv{margin:auto;width:fit-content}.-esm-stock-management__stock-user-role-scopes__tileContent___HvcGa{display:flex;flex-direction:column;align-items:center}',"",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/stock-user-role-scopes/stock-user-role-scopes.scss","webpack://./node_modules/@carbon/type/scss/_styles.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CCnDF,gEC81BI,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CD51BF,aDDQ,CCER,mBAAA,CAGF,+DCw1BI,wDAAA,CAAA,uDAAA,CAAA,2DAAA,CAAA,gEAAA,CDt1BF,aDPQ,CCUV,kECm1BI,oDAAA,CAAA,uDAAA,CAAA,yDAAA,CAAA,2DAAA,CDj1BF,aDZQ,CCaR,SAAA,CACA,kBAAA,CACA,eAAA,CACA,iBAAA,CAEA,mJAEE,wBDnBM,CCoBN,UAAA,CACA,oBAAA,CACA,UAAA,CACA,iBAAA,CACA,qBAAA,CACA,SAAA,CAGF,0EACE,WAAA,CACA,gBAAA,CAGF,yEACE,UAAA,CACA,iBAAA,CAIJ,sEACE,qBD7CM,CC8CN,4BAAA,CACA,cAAA,CAGF,6DACE,WAAA,CACA,iBAAA,CAGF,oEACE,YAAA,CACA,qBAAA,CACA,kBAAA",sourceRoot:""}]),i.locals={content:"-esm-stock-management__stock-user-role-scopes__content___g06Q8",helper:"-esm-stock-management__stock-user-role-scopes__helper___VOKFX",separator:"-esm-stock-management__stock-user-role-scopes__separator___M4cpF",tileContainer:"-esm-stock-management__stock-user-role-scopes__tileContainer___PGoSd",tile:"-esm-stock-management__stock-user-role-scopes__tile___C5KRv",tileContent:"-esm-stock-management__stock-user-role-scopes__tileContent___HvcGa"};const l=i},5453:(e,t,n)=>{"use strict";n.r(t),n.d(t,{deleteStockModal:()=>ts,deleteUserScopeModal:()=>ns,importBulkStockItemsDialog:()=>os,importTranslation:()=>Jl,startupApp:()=>as,stockManagement:()=>Xl,stockManagementAdminCardLink:()=>Vl,stockManagementAppMenuItem:()=>rs,stockManagementDashboard:()=>$l,stockOperationDialog:()=>es});var o=n(7248),r={printItemCost:{type:o.Type.Boolean,_default:!1,_description:"Whether to print item costs on the print out"},printBalanceOnHand:{type:o.Type.Boolean,_default:!1,_description:"Whether to print balance on hand on the print out"}},a=n(421),i=n(1672),l=n.n(i),s=n(7410),c=n.n(s),u=n(4766),d=n.n(u),m=n(1991),p=n.n(m),A=n(3702),g=n.n(A),_=n(2434),f=n.n(_),v=n(1422),b=n.n(v),h=n(7813),y={};y.styleTagTransform=b(),y.setAttributes=g(),y.insert=p().bind(null,"head"),y.domAPI=d(),y.insertStyleElement=f(),c()(h.Z,y);const k=h.Z&&h.Z.locals?h.Z.locals:void 0;var C=n(601);var E=n(3397);function w(e,t,n,o,r,a,i){try{var l=e[a](i),s=l.value}catch(e){return void n(e)}l.done?t(s):Promise.resolve(s).then(o,r)}function S(){var e;return e=function(e){var t;return function(e,t){var n,o,r,a,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,o&&(r=2&a[0]?o.return:a[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,a[1])).done)return r;switch(o=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,o=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((r=(r=i.trys).length>0&&r[r.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){i.label=a[1];break}if(6===a[0]&&i.label<r[1]){i.label=r[1],r=a;break}if(r&&i.label<r[2]){i.label=r[2],i.ops.push(a);break}r[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],o=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}(this,(function(n){return t=new AbortController,[2,(0,o.openmrsFetch)("/ws/rest/v1/stockmanagement/stockitemimport",{method:"POST",signal:t.signal,body:e})]}))},S=function(){var t=this,n=arguments;return new Promise((function(o,r){var a=e.apply(t,n);function i(e){w(a,o,r,i,l,"next",e)}function l(e){w(a,o,r,i,l,"throw",e)}i(void 0)}))},S.apply(this,arguments)}function B(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function O(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,r,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(a.push(o.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return B(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?B(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var x=n(49),D={};D.styleTagTransform=b(),D.setAttributes=g(),D.insert=p().bind(null,"head"),D.domAPI=d(),D.insertStyleElement=f(),c()(x.Z,D);const N=x.Z&&x.Z.locals?x.Z.locals:void 0;var I=n(1256),T={};T.styleTagTransform=b(),T.setAttributes=g(),T.insert=p().bind(null,"head"),T.domAPI=d(),T.insertStyleElement=f(),c()(I.Z,T);const P=I.Z&&I.Z.locals?I.Z.locals:void 0;var U,j=n(9820);function F(e){var t,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!e)return"";var o=null===(t=Object.keys(e))||void 0===t?void 0:t.map((function(t){var o=e[t];return n&&(!1===o||!0===o||o)||!n&&(""===o||!1===o||!0===o||o)?"".concat(encodeURIComponent(t),"=").concat(encodeURIComponent(o.toString())):null})).filter((function(e){return null!=e})).join("&");return o.length>0?"?"+o:""}function L(e){var t="ws/rest/v1/stockmanagement/stockoperation".concat(F(e)),n=(0,j.ZP)(t,o.openmrsFetch),r=n.data,a=n.error,i=n.isLoading;return{items:(null==r?void 0:r.data)||{},isLoading:i,isError:a}}function z(e){var t="ws/rest/v1/stockmanagement/stockoperation/".concat(e,"?v=full");return(0,o.openmrsFetch)(t)}function R(e){var t=new AbortController;return(0,o.openmrsFetch)("ws/rest/v1/stockmanagement/stockoperation",{method:"POST",headers:{"Content-Type":"application/json"},signal:t.signal,body:e})}function M(e){var t="ws/rest/v1/stockmanagement/stockoperation/".concat(e.uuid),n=new AbortController;return(0,o.openmrsFetch)(t,{method:"POST",headers:{"Content-Type":"application/json"},signal:n.signal,body:e})}!function(e){e.Default="default",e.Full="full",e.REF="ref"}(U||(U={}));var q=function(e){switch(e){case"NEW":return"#0f62fe";case"SUBMITTED":return"#4589ff";case"DISPATCHED":return"#8a3ffc";case"COMPLETED":return"#24a148";case"CANCELLED":return"#da1e28";case"RETURNED":return"#eb6200"}};function G(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}var H={isOverlayOpen:!1,component:Function,header:""},Z=function(){return(0,o.getGlobalStore)("dispensing-store",H)},Y=function(e,t){Z().setState({isOverlayOpen:!0,component:t,header:e})},Q=function(){Z().setState({component:null,isOverlayOpen:!1})},W=n(2653),K=n.n(W),J=function(e,t){return e?K()(e).format(null!=t?t:"DD-MMM-YYYY"):""},V=("".concat(window.getOpenmrsSpaBase),K()((new Date).setUTCHours(0,0,0,0)).format("YYYY-MM-DDTHH:mm:ss.SSSZZ"),Intl.DateTimeFormat().resolvedOptions().timeZone,"DD/MM/YYYY"),X="d/m/Y",$=function(e){return J(e,V)},ee=function(){var e=new Date;return new Date(e.getFullYear(),e.getMonth(),e.getDate())},te="2e1e8049-9cbe-4a2d-b1e5-8a91e5d7d97d",ne="moduleResources/stockmanagement/assets/print-logo.svg",oe="Ministry of Health",re="Main Store",ae="/openmrs/",ie=!0;function le(e){var t,n,o,r,a,i=null==e||null===(n=e.responseBody)||void 0===n||null===(t=n.error)||void 0===t?void 0:t.fieldErrors;return i?Object.values(i).flatMap((function(e){return e.map((function(e){return e.message}))})):[null!==(a=null==e||null===(r=e.responseBody)||void 0===r||null===(o=r.error)||void 0===o?void 0:o.message)&&void 0!==a?a:null==e?void 0:e.message]}function se(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function ce(e,t,n,o,r,a,i){try{var l=e[a](i),s=l.value}catch(e){return void n(e)}l.done?t(s):Promise.resolve(s).then(o,r)}function ue(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,r,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(a.push(o.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return se(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?se(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}"".concat(ae,"moduleResources/stockmanagement/templates/Import_Stock_Items.xlsx");var de=n(965),me={};me.styleTagTransform=b(),me.setAttributes=g(),me.insert=p().bind(null,"head"),me.domAPI=d(),me.insertStyleElement=f(),c()(de.Z,me);const pe=de.Z&&de.Z.locals?de.Z.locals:void 0,Ae=function(){return l().createElement("svg",{width:"72",height:"72",viewBox:"0 0 62 58",xmlns:"http://www.w3.org/2000/svg"},l().createElement("defs",null,l().createElement("path",{id:"whv9q6f4ta",d:"M0 0h62v30.508H0z"}),l().createElement("path",{id:"hp71ojgcnc",d:"M0 0h24.603v26.571H0z"})),l().createElement("g",{fill:"none"},l().createElement("g",{opacity:".193",transform:"matrix(-1 0 0 1 62 26.571)"},l().createElement("path",{d:"M62 0c0 16.85-13.916 30.508-31.037 30.508S0 16.849 0 0h62z",fill:"var(--brand-03)",mask:"url(#rt0c8mo6eb)"})),l().createElement("g",{opacity:".396",transform:"matrix(-1 0 0 1 60.032 0)"},l().createElement("path",{d:"m24.603 26.571-13.35-23.51C9.592.141 5.884-.869 3.011.817.138 2.503-.855 6.272.804 9.193l9.874 17.378",fill:"var(--brand-03)",mask:"url(#hgianthqwd)"}))))};var ge=n(9375),_e=n(2411),fe=function(){var e,t=(0,E.useTranslation)().t,n=(0,o.useSession)(),r=null==n||null===(e=n.sessionLocation)||void 0===e?void 0:e.display;return l().createElement("div",{className:pe.header},l().createElement("div",{className:pe["left-justified-items"]},l().createElement(Ae,null),l().createElement("div",{className:pe["page-labels"]},l().createElement("p",null,t("home","Home")),l().createElement("p",{className:pe["page-name"]},t("stockManagement","Stock Management")))),l().createElement("div",{className:pe["right-justified-items"]},l().createElement("div",{className:pe["date-and-location"]},l().createElement(ge.Ye,{size:16}),l().createElement("span",{className:pe.value},r),l().createElement("span",{className:pe.middot},"·"),l().createElement(_e.f,{size:16}),l().createElement("span",{className:pe.value},(0,o.formatDate)(new Date,{mode:"standard"})))))},ve=n(6194),be=n(8115),he=n(2296),ye={};ye.styleTagTransform=b(),ye.setAttributes=g(),ye.insert=p().bind(null,"head"),ye.domAPI=d(),ye.insertStyleElement=f(),c()(he.Z,ye);const ke=he.Z&&he.Z.locals?he.Z.locals:void 0,Ce=function(){var e=function(){var e,t,n=(e=(0,i.useState)(),t=2,function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,r,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(a.push(o.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return G(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?G(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),o=n[0],r=n[1];return(0,i.useEffect)((function(){var e=function(e){r(e)};e(Z().getState()),Z().subscribe(e)}),[]),{isOverlayOpen:null==o?void 0:o.isOverlayOpen,component:null==o?void 0:o.component,header:null==o?void 0:o.header}}(),t=e.header,n=e.component,r=e.isOverlayOpen,s=(0,o.useLayoutType)(),c=(0,E.useTranslation)().t;return l().createElement(l().Fragment,null,r&&l().createElement("div",{className:"tablet"!==s?ke.desktopOverlay:ke.tabletOverlay},"tablet"!==s?l().createElement("div",{className:ke.desktopHeader},l().createElement("div",{className:ke.headerContent},t),l().createElement(a.zxk,{className:ke.closePanelButton,onClick:function(){return Q()},kind:"ghost",hasIconOnly:!0},l().createElement(ve.x8,{size:16}))):l().createElement(a.h4i,{onClick:function(){return Q()},"aria-label":c("tabletOverlay","Tablet overlay"),className:ke.tabletOverlayHeader},l().createElement(a.zxk,{hasIconOnly:!0},l().createElement(be.Xd,{size:16})),l().createElement("div",{className:ke.headerContent},t)),l().createElement("div",null,n)))};var Ee=n(6919),we={};we.styleTagTransform=b(),we.setAttributes=g(),we.insert=p().bind(null,"head"),we.domAPI=d(),we.insertStyleElement=f(),c()(Ee.Z,we);const Se=Ee.Z&&Ee.Z.locals?Ee.Z.locals:void 0;var Be=n(1940),Oe={};Oe.styleTagTransform=b(),Oe.setAttributes=g(),Oe.insert=p().bind(null,"head"),Oe.domAPI=d(),Oe.insertStyleElement=f(),c()(Be.Z,Oe);const xe=Be.Z&&Be.Z.locals?Be.Z.locals:void 0,De=function(e){var t=e.tabs,n=e.selectedIndex,r=e.onSelectTab;return l().createElement("div",{className:"\n ".concat(xe.cohortBuilder,"\n ")},l().createElement("div",{className:xe.tab},l().createElement(a.kwZ,{isFixedNav:!0,expanded:!0,isChildOfHeader:!0,"aria-label":"Side navigation"},l().createElement(a.LDp,null,t.map((function(e,i){return l().createElement(a.yTF,{key:i,isActive:i===n,onClick:function(){i===t.length-1?(0,o.navigate)({to:"/openmrs/admin/maintenance/settings.list?show=Stockmanagement"}):(r(i),(0,o.navigate)({to:"".concat(window.getOpenmrsSpaBase(),"stock-management/").concat(e.link)}))}},e.name)}))))))};function Ne(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}const Ie=function(){var e,t,n=(0,E.useTranslation)().t,o=(e=(0,i.useState)(0),t=2,function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,r,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(a.push(o.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Ne(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ne(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),r=o[0],a=o[1],s=[{name:n("stockManagementOverview","Overview"),link:"overview"},{name:n("stockManagementStockItems","Stock Items"),link:"stock-items"},{name:n("stockManagementOperations","Stock Operations"),link:"stock-operations"},{name:n("stockManagementStockUserScopes","Stock User Role Scopes"),link:"stock-user-scopes"},{name:n("stockManagementStockSources","Stock Sources"),link:"stock-sources"},{name:n("stockManagementLocations","Stock Locations"),link:"stock-locations"},{name:n("stockManagementSettings","Stock Settings"),link:"admin/maintenance/settings.list?show=Stockmanagement"}];return l().createElement(De,{tabs:s,selectedIndex:r,onSelectTab:a})};var Te=n(1914),Pe=n(2426),Ue={};Ue.styleTagTransform=b(),Ue.setAttributes=g(),Ue.insert=p().bind(null,"head"),Ue.domAPI=d(),Ue.insertStyleElement=f(),c()(Pe.Z,Ue);const je=Pe.Z&&Pe.Z.locals?Pe.Z.locals:void 0;var Fe=n(3432),Le={};Le.styleTagTransform=b(),Le.setAttributes=g(),Le.insert=p().bind(null,"head"),Le.domAPI=d(),Le.insertStyleElement=f(),c()(Fe.Z,Le);const ze=Fe.Z&&Fe.Z.locals?Fe.Z.locals:void 0;var Re=n(9697),Me=n(7412),qe=n.n(Me);K().extend(qe());const Ge=function(e){var t,n,r,i,s,c,u=e.label,d=e.value,m=e.headerLabel,p=e.children,A=e.view,g=e.count,_=e.outofstockCount,f=e.disposedCount,v=(0,E.useTranslation)().t;return l().createElement(a.n9L,{className:ze.tileContainer},l().createElement("div",{className:ze.tileHeader},l().createElement("div",{className:ze.headerLabelContainer},l().createElement("label",{className:ze.headerLabel},m),p),A&&l().createElement(o.ConfigurableLink,{className:ze.link,to:"${openmrsSpaBase}/stock-management/orders"},l().createElement("span",{style:{fontSize:"0.825rem",marginRight:"0.325rem"}},v("view","View"))," ",l().createElement(be.ol,{size:16,className:ze.viewListBtn}))),l().createElement("div",{className:ze.metricsGrid},l().createElement("div",null,l().createElement("label",{className:ze.totalsLabel},u),l().createElement("p",{className:ze.totalsValue},d)),!(0,Re.Z)(g)&&l().createElement("div",{className:ze.countGrid},l().createElement("span",{style:{color:"#DA1E28"}},v("in7days","In 7 days")),l().createElement("span",{style:{color:" #FABA5F"}},v("in30days","In 30 days")),l().createElement("p",{style:{color:"#DA1E28"}},null===(t=g.expiry7days)||void 0===t?void 0:t.length),l().createElement("p",{style:{color:"#FABA5F"}},null===(n=g.expiry30days)||void 0===n?void 0:n.length)),!(0,Re.Z)(_)&&l().createElement("div",{className:ze.countGrid},l().createElement("span",{style:{color:"#DA1E28"}},v("itemsbelowmin","Items Below Min")),l().createElement("span",{style:{color:"#319227"}},v("itemsabovemax","Items Above Max")),l().createElement("p",{style:{color:"#DA1E28"}},null===(r=_.itemsbelowmin)||void 0===r?void 0:r.length),l().createElement("p",{style:{color:"#319227"}},null===(i=_.itemsabovemax)||void 0===i?void 0:i.length)),!(0,Re.Z)(f)&&l().createElement("div",{className:ze.countGrid},l().createElement("span",{style:{color:"#DA1E28"}},v("expired","Expired")),l().createElement("span",{style:{color:"#FABA5F"}},v("poorquality","Poor Quality")),l().createElement("p",{style:{color:"#DA1E28"}},null===(s=f.expired)||void 0===s?void 0:s.length),l().createElement("p",{style:{color:"#FABA5F"}},null===(c=f.poorquality)||void 0===c?void 0:c.length))))};function He(e){var t="ws/rest/v1/stockmanagement/stockitem".concat(F(e)),n=(0,j.ZP)(t,o.openmrsFetch),r=n.data,a=n.error,i=n.isLoading;return{items:(null==r?void 0:r.data)||{},isLoading:i,isError:a}}function Ze(e){var t="ws/rest/v1/stockmanagement/stockiteminventory".concat(F(e)),n=(0,j.ZP)(t,o.openmrsFetch),r=n.data,a=n.error,i=n.isLoading;return{items:(null==r?void 0:r.data)||{},isLoading:i,isError:a}}function Ye(e){var t="ws/rest/v1/stockmanagement/stockbatch".concat(F(e)),n=(0,j.ZP)(t,o.openmrsFetch),r=n.data,a=n.error,i=n.isLoading;return{items:(null==r?void 0:r.data)||{},isLoading:i,isError:a}}function Qe(e){var t="ws/rest/v1/stockmanagement/stockitempackaginguom".concat(F(e)),n=(0,j.ZP)(t,o.openmrsFetch),r=n.data,a=n.error,i=n.isLoading;return{items:(null==r?void 0:r.data)||{},isLoading:i,isError:a}}function We(e){var t="ws/rest/v1/stockmanagement/stockitem/".concat(e,"?v=full"),n=(0,j.ZP)(t,o.openmrsFetch),r=n.data,a=n.error,i=n.isLoading;return{item:(null==r?void 0:r.data)||{},isLoading:i,isError:a}}function Ke(e){var t=new AbortController;return delete e.isDrug,(0,o.openmrsFetch)("ws/rest/v1/stockmanagement/stockitem",{method:"POST",headers:{"Content-Type":"application/json"},signal:t.signal,body:e})}function Je(e){var t="ws/rest/v1/stockmanagement/stockitem/".concat(e.uuid),n=new AbortController;return delete e.isDrug,delete e.dateCreated,(0,o.openmrsFetch)(t,{method:"POST",headers:{"Content-Type":"application/json"},signal:n.signal,body:e})}function Ve(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function Xe(e){var t,n,o,r=(n=(0,i.useState)({v:e||U.Default,q:null,totalCount:!0}),o=2,function(e){if(Array.isArray(e))return e}(n)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,r,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(a.push(o.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw r}}return a}}(n,o)||function(e,t){if(e){if("string"==typeof e)return Ve(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ve(e,t):void 0}}(n,o)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),a=r[0],l=r[1],s=He(a),c=s.items,u=s.isLoading,d=s.isError;return(0,i.useEffect)((function(){l({v:U.Default,totalCount:!0})}),[]),{items:null!==(t=null==c?void 0:c.results)&&void 0!==t?t:[],isLoading:u,isError:d}}function $e(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function et(){var e,t,n=(e=(0,i.useState)({startIndex:0,v:U.Default,q:null,includeStockItemName:"true"}),t=2,function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,r,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(a.push(o.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return $e(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?$e(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),o=n[0],r=n[1];(0,i.useEffect)((function(){r({v:U.Default,includeStockItemName:"true"})}),[]);var a,l=Ye(o),s=l.items,c=l.isLoading,u=l.isError;return{items:null!==(a=s.results)&&void 0!==a?a:[],isLoading:c,isError:u}}function tt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const nt=function(e){var t=(0,E.useTranslation)().t,n=function(){var e=(0,j.ZP)("/ws/rest/v1/stockmanagement/stockitem",o.openmrsFetch),t=e.data,n=e.error,r=null==t?void 0:t.data.results.map((function(e){return{uuid:e.uuid,hasExpiration:e.hasExpiration,ExpiryNotice:e.ExpiryNotice}}));return{stockList:null!=r?r:[],isLoading:!t&&!n,error:n}}(),r=n.stockList,i=n.isLoading,s=n.error,c=et(),u=c.items,d=(c.isLoading,Xe().items),m=new Date,p=u.map((function(e){var t=null==d?void 0:d.find((function(t){return(null==e?void 0:e.stockItemUuid)===t.uuid}));return function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),o.forEach((function(t){tt(e,t,n[t])}))}return e}({},e,t)}));p=p.filter((function(e){return e.hasExpiration}));var A=p.filter((function(e){var t=e.expiryNotice||0,n=new Date(e.expiration),o=Math.ceil((n-m)/864e5);return o<=t||o<0})),g=function(e){var t,n=L(e),o=n.items,r=n.isLoading,a=n.isError,i=null==o||null===(t=o.results)||void 0===t?void 0:t.filter((function(e){return"disposed"===(null==e?void 0:e.operationType)}));return{items:i,isLoading:r,isError:a}}({v:U.Full,totalCount:!0}).items;if(i)return l().createElement(a.lSo,{role:"progressbar",description:t("loading","Loading...")});if(s)return l().createElement(o.ErrorState,{headerTitle:t("errorStockMetric"),error:s});var _=r.filter((function(e){return e.hasExpiration&&e.ExpiryNotice<=7})),f=r.filter((function(e){return e.hasExpiration&&e.ExpiryNotice<=30})),v=g&&g.filter((function(e){return"Drug not available due to expired medication"===e.reasonName})),b=g&&g.filter((function(e){return"Poor Quality"===e.reasonName}));return l().createElement(l().Fragment,null,l().createElement("div",{className:je.cardContainer},l().createElement(Ge,{label:t("stocks","Expiring stock"),value:(null==A?void 0:A.length)||0,headerLabel:t("expiringStock","Expiring Stock"),view:"items",count:{expiry7days:_,expiry30days:f}}),l().createElement(Ge,{label:t("outofstock","Out of Stock"),value:null==r?void 0:r.length,headerLabel:t("highestServiceVolume","Out of Stock "),view:"items",outofstockCount:{itemsbelowmin:_,itemsabovemax:f}}),l().createElement(Ge,{label:t("disposedstock","Disposed Stock"),value:(null==g?void 0:g.length)||0,headerLabel:t("providersAvailableToday","Disposed Stock "),view:"items",disposedCount:{expired:v,poorquality:b}})))};var ot=n(8629),rt={};rt.styleTagTransform=b(),rt.setAttributes=g(),rt.insert=p().bind(null,"head"),rt.domAPI=d(),rt.insertStyleElement=f(),c()(ot.Z,rt);const at=ot.Z&&ot.Z.locals?ot.Z.locals:void 0;var it=n(4797);function lt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const st=function(){var e=(0,E.useTranslation)().t,t=((0,o.useLayoutType)(),et()),n=t.items,r=(t.isLoading,Xe()),i=r.items;if(r.isLoading)return l().createElement(l().Fragment,null);if(0===(null==i?void 0:i.length))return l().createElement(l().Fragment,null,l().createElement("p",{className:at.content},e("inventoryAlertNull","No inventory alerts to display")));var s=new Date,c=n.map((function(e){var t=null==i?void 0:i.find((function(t){return(null==e?void 0:e.stockItemUuid)===t.uuid}));return function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),o.forEach((function(t){lt(e,t,n[t])}))}return e}({},e,t)}));c=c.filter((function(e){return e.hasExpiration}));var u=c.filter((function(e){var t=e.expiryNotice||0,n=new Date(e.expiration),o=Math.ceil((n-s)/864e5);return o<=t||o<0}));return l().createElement(l().Fragment,null,u.map((function(e,t){return l().createElement("div",{className:at.card,key:t},l().createElement("div",{className:at.colorLineRed}),l().createElement("div",{className:at.icon},l().createElement(it.UI,{size:40,color:"#DA1E28"})),l().createElement("div",{className:at.cardText},l().createElement("p",null,"EXPIRING STOCK"),l().createElement("p",null,l().createElement("strong",null,null==e?void 0:e.drugName)," ",null==e?void 0:e.dispensingUnitName)))})),l().createElement(a.zxk,{onClick:function(){(0,o.navigate)({to:"".concat(window.getOpenmrsSpaBase(),"stock-management/expired-stock")})},kind:"ghost"},"View All"))};var ct=n(8748);const ut=function(){var e=(0,E.useTranslation)().t,t=((0,o.useLayoutType)(),function(e){var t,n=L(e),o=n.items,r=n.isLoading,a=n.isError,i=null==o||null===(t=o.results)||void 0===t?void 0:t.filter((function(e){return"receipt"===(null==e?void 0:e.operationType)&&"COMPLETED"!==(null==e?void 0:e.status)}));return{items:i,isLoading:r,isError:a}}({v:U.Full,totalCount:!0})),n=t.items;return t.isLoading?l().createElement(l().Fragment,null):0===n.length?l().createElement(l().Fragment,null,l().createElement("p",{className:at.content},e("receivedNull","No received to display"))):l().createElement(l().Fragment,null,n.map((function(e,t){return null==e?void 0:e.stockOperationItems.map((function(n){return l().createElement("div",{className:at.card,key:t},l().createElement("div",{className:at.colorLineBlue}),l().createElement("div",{className:at.icon},l().createElement(ct.oq,{size:40,color:"#0F62FE"})),l().createElement("div",{className:at.cardText},l().createElement("p",null,null==e?void 0:e.status," · ",null==e?void 0:e.sourceName," · ",null==e?void 0:e.destinationName),l().createElement("p",null,l().createElement("strong",null,null==n?void 0:n.stockItemName)," ",null==n?void 0:n.stockItemPackagingUOMName,", ",null==n?void 0:n.quantity)))}))})),l().createElement(a.zxk,{onClick:function(){(0,o.navigate)({to:"".concat(window.getOpenmrsSpaBase(),"stock-management/orders")})},kind:"ghost"},e("receivedView","View All")))};var dt=n(2327);const mt=function(){var e=(0,E.useTranslation)().t,t=((0,o.useLayoutType)(),function(e){var t,n=L(e),o=n.items,r=n.isLoading,a=n.isError,i=null==o||null===(t=o.results)||void 0===t?void 0:t.filter((function(e){return"stockissue"===(null==e?void 0:e.operationType)&&"COMPLETED"!==(null==e?void 0:e.status)}));return{items:i,isLoading:r,isError:a}}({v:U.Full,totalCount:!0})),n=t.items;if(t.isLoading)return l().createElement(l().Fragment,null);if(0===n.length)return l().createElement(l().Fragment,null,l().createElement("p",{className:at.content},e("issuingNull","No issued to display")));var r=n.map((function(e,t){return((null==e?void 0:e.stockOperationItems)||[]).map((function(n,o){return{status:null==e?void 0:e.status,sourceName:null==e?void 0:e.sourceName,destinationName:null==e?void 0:e.destinationName,stockItemName:null==n?void 0:n.stockItemName,stockItemPackagingUOMName:null==n?void 0:n.stockItemPackagingUOMName,quantity:null==n?void 0:n.quantity,key:"".concat(t,"-").concat(o)}}))})),i=r.flat().slice(0,10);return l().createElement(l().Fragment,null,i.map((function(e,t){return l().createElement("div",{className:at.card,key:t},l().createElement("div",{className:at.colorLineGreen}),l().createElement("div",{className:at.icon},l().createElement(dt.rs,{size:40,color:"#198038"})),l().createElement("div",{className:at.cardText},l().createElement("p",null,null==e?void 0:e.status," · ",null==e?void 0:e.sourceName," · ",null==e?void 0:e.destinationName),l().createElement("p",null,l().createElement("strong",null,null==e?void 0:e.stockItemName)," ",null==e?void 0:e.stockItemPackagingUOMName,", ",null==e?void 0:e.quantity)))})),l().createElement(a.zxk,{onClick:function(){(0,o.navigate)({to:"".concat(window.getOpenmrsSpaBase(),"stock-management/requisitions")})},kind:"ghost"},"View All"))},pt=function(){var e="tablet"===(0,o.useLayoutType)(),t=(0,E.useTranslation)().t;return l().createElement("div",{className:at.cardContainer},l().createElement("div",{className:at.tilesContainer},l().createElement(a.mh4,null,l().createElement(a.n9L,null,l().createElement("div",{className:e?at.tabletHeading:at.desktopHeading},l().createElement("h4",null,t("Inventory Alerts"))),l().createElement(st,null)))),l().createElement("div",{className:at.tilesContainer},l().createElement(a.mh4,null,l().createElement(a.n9L,null,l().createElement("div",{className:e?at.tabletHeading:at.desktopHeading},l().createElement("h4",null,t("Receiving"))),l().createElement(ut,null)))),l().createElement("div",{className:at.tilesContainer},l().createElement(a.mh4,null,l().createElement(a.n9L,null,l().createElement("div",{className:e?at.tabletHeading:at.desktopHeading},l().createElement("h4",null,t("Issuing"))),l().createElement(mt,null)))))};function At(){return"".concat(window.getOpenmrsSpaBase(),"stock-management"),l().createElement("div",{style:{backgroundColor:"white"}},l().createElement(nt,null),l().createElement(pt,null))}var gt=n(5104),_t={};_t.styleTagTransform=b(),_t.setAttributes=g(),_t.insert=p().bind(null,"head"),_t.domAPI=d(),_t.insertStyleElement=f(),c()(gt.Z,_t);const ft=gt.Z&>.Z.locals?gt.Z.locals:void 0;function vt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function bt(e){var t,n,r=function(e){var t="ws/rest/v1/stockmanagement/userrolescope".concat(F(e)),n=(0,j.ZP)(t,o.openmrsFetch),r=n.data,a=n.error,i=n.isLoading;return{items:(null==r?void 0:r.data)||{},isLoading:i,isError:a}}(e),a=r.items,l=r.isLoading,s=r.isError,c=(t=(0,i.useState)(10),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,r,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(a.push(o.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw r}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return vt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?vt(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),u=c[0],d=c[1],m=(0,o.usePagination)(a.results,u),p=m.goTo,A=m.results,g=m.currentPage;return{items:A,totalItems:null==a?void 0:a.totalCount,currentPage:g,currentPageSize:u,paginatedItems:A,goTo:p,pageSizes:[10,20,30,40,50],isLoading:l,isError:s,setPageSize:d}}var ht=n(4300),yt={};yt.styleTagTransform=b(),yt.setAttributes=g(),yt.insert=p().bind(null,"head"),yt.domAPI=d(),yt.insertStyleElement=f(),c()(ht.Z,yt);const kt=ht.Z&&ht.Z.locals?ht.Z.locals:void 0;var Ct=n(9337);function Et(e){var t="ws/rest/v1/location".concat(F(e,!1)),n=(0,j.ZP)(t,o.openmrsFetch),r=n.data,a=n.error,i=n.isLoading;return{locations:(null==r?void 0:r.data)||{},isErrorLocation:a,isLoadingLocations:i}}function wt(e){var t="ws/rest/v1/role".concat(F(e)),n=(0,j.ZP)(t,o.openmrsFetch),r=n.data,a=n.error,i=n.isLoading;return{items:(null==r?void 0:r.data)||{},isLoading:i,isError:a}}function St(){var e=(0,j.ZP)("ws/rest/v1/stockmanagement/stockoperationtype?v=default",o.openmrsFetch),t=e.data,n=e.isLoading,r=e.error;return{types:(null==t?void 0:t.data)||{},isLoading:n,isError:r}}function Bt(e){var t="ws/rest/v1/user".concat(F(e)),n=(0,j.ZP)(t,o.openmrsFetch),r=n.data,a=n.error,i=n.isLoading;return{items:(null==r?void 0:r.data)||{},isLoading:i,isError:a}}function Ot(e){var t="ws/rest/v1/concept/".concat(e),n=(0,j.ZP)(t,o.openmrsFetch),r=n.data,a=n.error,i=n.isLoading;return{items:(null==r?void 0:r.data)||{},isLoading:i,isError:a}}var xt=n(8891),Dt=function(e){(0,j.JG)((function(t){return"string"==typeof t&&t.startsWith(e)}),void 0,{revalidate:!0})};function Nt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function It(e,t,n,o,r,a,i){try{var l=e[a](i),s=l.value}catch(e){return void n(e)}l.done?t(s):Promise.resolve(s).then(o,r)}function Tt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Pt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),o.forEach((function(t){Tt(e,t,n[t])}))}return e}function Ut(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n.push.apply(n,o)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}function jt(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,r,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(a.push(o.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw r}}return a}}(e,t)||Lt(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ft(e){return function(e){if(Array.isArray(e))return Nt(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Lt(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Lt(e,t){if(e){if("string"==typeof e)return Nt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Nt(e,t):void 0}}var zt=ee();const Rt=function(e){var t,n,r,s,c,u,d=e.model,m=(0,E.useTranslation)().t,p=jt((0,i.useState)(Pt({},d)),2),A=p[0],g=p[1],_=jt((0,i.useState)([]),2),f=_[0],v=_[1],b=function(e){var t="ws/rest/v1/user".concat(e),n=(0,j.ZP)(t,o.openmrsFetch),r=n.data,a=n.error,i=n.isLoading;return{data:(null==r?void 0:r.data)||{},isLoading:i,isError:a}}(null==d?void 0:d.uuid),h=b.data,y=St(),k=y.types.results,C=y.isLoading,w=Bt({v:U.Default}),S=w.items,B=w.isLoading,O=wt({v:U.Default}),x=(O.items,O.isLoading),D=function(){var e,t,n="".concat(o.fhirBaseUrl,"/Location?_summary=data&_tag=main store,main pharmacy,dispensary "),r=(0,j.ZP)(n,o.openmrsFetch),a=r.data,l=r.error,s=r.isLoading,c=(0,i.useMemo)((function(){var e,t,n;return null!==(n=null==a||null===(t=a.data)||void 0===t||null===(e=t.entry)||void 0===e?void 0:e.map((function(e){return e.resource})))&&void 0!==n?n:[]}),[null==a||null===(e=a.data)||void 0===e?void 0:e.entry]);return{stockLocations:null!==(t=(0,Ct.Z)(c,"id"))&&void 0!==t?t:[],isLoading:s,error:l}}().stockLocations,N=(0,i.useMemo)((function(){return(0,xt.Z)((function(e){Bt({v:U.Default,q:e})}),300)}),[]),I=function(e){var t,n;return(null==A||null===(n=A.operationTypes)||void 0===n||null===(t=n.filter((function(t){return t.operationTypeUuid===e.uuid})))||void 0===t?void 0:t.length)>0},T=(r=function(e){return function(e,t){var n,o,r,a,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,o&&(r=2&a[0]?o.return:a[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,a[1])).done)return r;switch(o=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,o=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((r=(r=i.trys).length>0&&r[r.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){i.label=a[1];break}if(6===a[0]&&i.label<r[1]){i.label=r[1],r=a;break}if(r&&i.label<r[2]){i.label=r[2],i.ops.push(a);break}r[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],o=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}(this,(function(t){return e.preventDefault(),function(e){var t=new AbortController,n=null!=e.uuid,r="ws/rest/v1/stockmanagement/userrolescope".concat(n?"/"+e.uuid:"");return(0,o.openmrsFetch)(r,{method:"POST",headers:{"Content-Type":"application/json"},signal:t.signal,body:e})}(A).then((function(e){Dt("ws/rest/v1/stockmanagement/userrolescope"),(0,o.showToast)({critical:!0,title:m("addUserRole","Add User role"),kind:"success",description:m("successfullysaved","You have successfully saved user role scope ")}),Q()}),(function(e){(0,o.showNotification)({title:m("errorSaving user role scope', 'Error Saving user role scope"),kind:"error",critical:!0,description:null==e?void 0:e.message}),Q()})),[2]}))},s=function(){var e=this,t=arguments;return new Promise((function(n,o){var a=r.apply(e,t);function i(e){It(a,n,o,i,l,"next",e)}function l(e){It(a,n,o,i,l,"throw",e)}i(void 0)}))},function(e){return s.apply(this,arguments)});return C||x||B?l().createElement(a.lSo,{status:"active",iconDescription:"Loading",description:"Loading data..."}):l().createElement("div",null,l().createElement(a.l09,null,l().createElement(a.xBx,null),l().createElement(a.fef,null,l().createElement("section",{className:kt.section},l().createElement("div",null,(null==S||null===(t=S.results)||void 0===t?void 0:t.length)>0&&l().createElement(l().Fragment,null,l().createElement("span",{className:kt.subTitle},m("user","User")),l().createElement(a.CtY,{id:"userName",size:"md",labelText:m("user","User"),items:null==S?void 0:S.results,onChange:function(e){var t,n,o=["d210eb66-2188-11ed-9dff-507b9dea1806","cca4be4b-2188-11ed-9dff-507b9dea1806","84bdd876-4694-11ed-8109-00155dcc3fc0","a49be648-6b0a-11ed-93a2-806d973f13a9","2083fd40-3391-11ed-a667-507b9dea1806"],r=null===(t=e.selectedItem)||void 0===t?void 0:t.roles.filter((function(e){return o.includes(e.uuid)}));g(Ut(Pt({},A),{userUuid:null===(n=e.selectedItem)||void 0===n?void 0:n.uuid})),v(null!=r?r:[]),console.info(f)},shouldFilterItem:function(e){return!0},onFocus:function(){return(null==S?void 0:S.results)||N("")},onToggleClick:function(){return(null==S?void 0:S.results)||N("")},itemToString:function(e){var t,n,o;return"".concat(null!==(o=null!==(n=null==e||null===(t=e.person)||void 0===t?void 0:t.display)&&void 0!==n?n:null==e?void 0:e.display)&&void 0!==o?o:"")},placeholder:"Filter..."})))),l().createElement("section",{className:kt.section},l().createElement("div",null,l().createElement(a.PhF,{name:"role",className:"select-field",labelText:m("role","Role"),id:"select-role",value:null!==(c=A.role)&&void 0!==c?c:"placeholder-item",onChange:function(e){var t,n,o,r=null==D||null===(t=D.filter((function(e){return!e.id})))||void 0===t?void 0:t.map((function(e){return e.id})),a=null!==(o=null==A||null===(n=A.locations)||void 0===n?void 0:n.filter((function(e){return!r||0===r.length||!r.some((function(t){return t===e.locationUuid}))})))&&void 0!==o?o:[];g(Ut(Pt({},A),{role:e.target.value,locations:a}))}},l().createElement(a.QlF,{disabled:!0,hidden:!0,value:"placeholder-item",text:m("Choose a role")}),null===(n=null!==(u=null==h?void 0:h.roles)&&void 0!==u?u:f)||void 0===n?void 0:n.map((function(e){return l().createElement(a.QlF,{key:e.display,value:e.display,text:e.display})}))))),l().createElement("section",{className:kt.section},l().createElement(a.cOn,{className:kt.checkboxGrid},l().createElement(a.XZJ,{onChange:function(e,t){var n=!(null==A?void 0:A.enabled);g(Ut(Pt({},A),{enabled:n}))},checked:null==A?void 0:A.enabled,labelText:m("Enabled ?"),value:null==d?void 0:d.enabled,id:"chk-userEnabled"}),l().createElement(a.XZJ,{onChange:function(e,t){var n=!(null==A?void 0:A.permanent);g(Ut(Pt({},A),{permanent:n,activeFrom:void 0,activeTo:void 0}))},name:"isPermanent",checked:null==A?void 0:A.permanent,value:null==d?void 0:d.permanent,labelText:m("Permanent ?"),id:"chk-userPermanent"}),!(null==A?void 0:A.permanent)&&l().createElement(l().Fragment,null,l().createElement(a.Mtg,{datePickerType:"range",light:!0,minDate:$(zt),locale:"en",dateFormat:X,onChange:function(e){g(Ut(Pt({},A),{activeFrom:e[0],activeTo:e[1]}))}},l().createElement(a.aj6,{id:"date-picker-input-id-start",name:"activeFrom",placeholder:V,labelText:m("activeFrom","Active From"),value:$(null==A?void 0:A.activeFrom)}),l().createElement(a.aj6,{id:"date-picker-input-id-finish",name:"activeTo",placeholder:V,labelText:m("activeTo","Active To"),value:$(null==A?void 0:A.activeTo)}))))),l().createElement("br",null),l().createElement("section",{className:kt.section},l().createElement("div",{style:{display:"flex",flexDirection:"column"}},l().createElement("span",{className:kt.sectionTitle}," ",m("stockOperation","Stock Operations")),l().createElement("div",{className:kt.hr}),l().createElement("span",{className:kt.subTitle},m("roleDescription","The role will be applicable to only selected stock operations.")))),l().createElement("section",{className:kt.section},l().createElement(a.cOn,{className:kt.checkboxGrid},k.length>0&&k.map((function(e){return l().createElement("div",{style:{display:"flex",flexDirection:"row"}},l().createElement(a.XZJ,{value:e.uuid,checked:I(e),onChange:function(t){return function(e,t,n){var o,r=null==A||null===(o=A.operationTypes)||void 0===o?void 0:o.find((function(t){var n;return t.operationTypeUuid===(null==e||null===(n=e.target)||void 0===n?void 0:n.value)}));if(r){var a=Ft(A.operationTypes.filter((function(e){return e.operationTypeUuid!==(null==r?void 0:r.operationTypeUuid)})));g(Ut(Pt({},A),{operationTypes:a}))}else{var i,l=null==k?void 0:k.find((function(t){var n;return t.uuid===(null==e||null===(n=e.target)||void 0===n?void 0:n.value)})),s={operationTypeName:null==l?void 0:l.name,operationTypeUuid:null==l?void 0:l.uuid};g(Ut(Pt({},A),{operationTypes:Ft(null!==(i=null==A?void 0:A.operationTypes)&&void 0!==i?i:[]).concat([s])}))}}(t,e.uuid,I(e))},className:kt.checkbox,labelText:e.name,id:e.uuid}))})))),l().createElement("br",null),l().createElement("section",{className:kt.section},l().createElement("div",{style:{display:"flex",flexDirection:"column"}},l().createElement("span",{className:kt.sectionTitle}," ",m("Locations")),l().createElement("div",{className:kt.hr}),l().createElement("span",{className:kt.subTitle},m("Use the toggle to apply this scope to the locations under the selected location.")))),l().createElement("section",{className:kt.section},l().createElement(a.cOn,{className:kt.checkboxGrid},(null==D?void 0:D.length)>0&&D.map((function(e){var t,n,o,r=(t=e,(o=null==A||null===(n=A.locations)||void 0===n?void 0:n.filter((function(e){return e.locationUuid===t.id})))&&o.length>0?o[0]:null);return l().createElement("div",{style:{display:"flex",flexDirection:"row",margin:"4px",padding:"5px"}},l().createElement(a.XZJ,{name:"location",key:"chk-loc-child-key-".concat(e.id),id:"chk-loc-child-".concat(e.id),value:e.id,onChange:function(t){return function(e,t){var n,o=null==A||null===(n=A.locations)||void 0===n?void 0:n.find((function(t){var n;return t.locationUuid===(null==e||null===(n=e.target)||void 0===n?void 0:n.value)}));if(o){var r,a,i=Ft(null!==(a=null==A||null===(r=A.locations)||void 0===r?void 0:r.filter((function(e){return e.locationUuid!==(null==o?void 0:o.locationUuid)})))&&void 0!==a?a:[]);g(Ut(Pt({},A),{locations:i}))}else{var l,s=null==D?void 0:D.find((function(t){var n;return t.id===(null==e||null===(n=e.target)||void 0===n?void 0:n.value)})),c={locationName:null==s?void 0:s.name,locationUuid:null==s?void 0:s.id,enableDescendants:!1},u=Ft(null!==(l=null==A?void 0:A.locations)&&void 0!==l?l:[]).concat([c]);g(Ut(Pt({},A),{locations:u}))}}(t,e.id)},className:kt.checkbox,labelText:e.name,checked:null!=r}),r&&l().createElement(a.ZDl,{value:e.id,hideLabel:!0,className:kt.toggle,size:"sm",onToggleClick:function(e){var t=(null==r?void 0:r.locationUuid)===e?r:null;return!0===(null==t?void 0:t.enableDescendants)}(e.id),key:"tg-loc-child-key-".concat(e.id),id:"tg-loc-child-".concat(e.id)}))}))))),l().createElement(a.mzw,null,l().createElement(a.zxk,{kind:"secondary",onClick:Q},m("cancel","Cancel")),l().createElement(a.zxk,{type:"submit",onClick:T},m("save","Save")))))},Mt=function(){var e=(0,E.useTranslation)().t,t=(0,i.useCallback)((function(){Y("Add Stock User Role Scope",l().createElement(Rt,null))}),[]);return l().createElement(a.zxk,{onClick:t,size:"md",kind:"primary"},e("stockmanagement.addnewuserrolescope","Add New User Role Scope"))};function qt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Gt=function(e){var t=e.data,n=(0,E.useTranslation)().t,o=(0,i.useCallback)((function(){Y("Edit Stock User Role",l().createElement(Rt,{model:t}))}),[t]);return l().createElement(a.zxk,{kind:"ghost",onClick:o,iconDescription:n("editUserScope","Edit UserScope"),renderIcon:function(e){return l().createElement(dt.I8,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),o.forEach((function(t){qt(e,t,n[t])}))}return e}({size:16},e))}})};var Ht=n(1657);function Zt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function Yt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Qt=function(e){var t,n,r=e.uuid,s=(0,E.useTranslation)().t,c=(t=(0,i.useState)(!1),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,r,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(a.push(o.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw r}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return Zt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Zt(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),u=c[0],d=c[1],m=l().useCallback((function(){var e=(0,o.showModal)("delete-stock-user-scope-modal",{close:function(){return e()},uuid:r,onConfirmation:function(){var t=[];t.push(r),function(e){var t=e.reduce((function(e,t,n){return 0===n?e:e+=(e.length>0?",":"")+encodeURIComponent(t)}),"");t.length>0&&(t="?ids="+t);var n="ws/rest/v1/stockmanagement/userrolescope/".concat(e[0]).concat(t),r=new AbortController;return(0,o.openmrsFetch)(n,{method:"DELETE",headers:{"Content-Type":"application/json"},signal:r.signal})}(t).then((function(){Dt("ws/rest/v1/stockmanagement/userrolescope"),d(!1),(0,o.showToast)({critical:!0,title:s("deletingstockUserScope","Delete Stock User Scope"),kind:"success",description:s("stockuserscopedeletedsuccessfully","Stock User Scope Deleted Successfully")})}),(function(e){d(!1),(0,o.showNotification)({title:s("errorDeletingUserScope', 'error deleting a user scope"),kind:"error",critical:!0,description:null==e?void 0:e.message})})).catch(),e()}})}),[s,r]),p=l().createElement(a.zxk,{kind:"ghost",size:"md",onClick:m,iconDescription:s("deleteUserScope","Delete Stock User Scope"),renderIcon:function(e){return l().createElement(Ht.ZN,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),o.forEach((function(t){Yt(e,t,n[t])}))}return e}({size:16},e))}});return u?l().createElement(a.lSo,null):p};function Wt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Kt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),o.forEach((function(t){Wt(e,t,n[t])}))}return e}function Jt(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n.push.apply(n,o)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}const Vt=function(){var e=(0,E.useTranslation)().t,t=(0,o.useSession)(),n=bt({v:U.Default,totalCount:!0}),r=n.items,s=n.totalItems,c=n.currentPage,u=n.pageSizes,d=n.goTo,m=n.currentPageSize,p=n.setPageSize,A=n.isLoading,g=(0,i.useMemo)((function(){return[{id:0,header:e("user","User"),key:"user"},{id:1,header:e("role","Role"),key:"role"},{id:2,header:e("location","Location(s)"),key:"locations"},{id:3,header:e("stockOperations","Stock Operations"),key:"stockOperations"},{id:4,header:e("permanent","Permanent ?"),key:"permanent"},{id:5,header:e("ActiveFrom","Active From "),key:"activeFrom"},{id:6,header:e("activeTo","Active To"),key:"activeTo"},{id:7,header:e("enabled","Enabled ?"),key:"enabled"},{id:8,header:e("actions","Actions"),key:"actions"}]}),[]),_=(0,i.useMemo)((function(){return null==r?void 0:r.map((function(n,o){var i,s,c,u,d,m;return Jt(Kt({},n),{id:null==n?void 0:n.uuid,key:"key-".concat(null==n?void 0:n.uuid),uuid:"".concat(null==n?void 0:n.uuid),user:t.user.uuid===n.userUuid?"".concat(null==n?void 0:n.userFamilyName," ").concat(n.userGivenName):l().createElement(a.rUS,{to:(m=null==n?void 0:n.uuid,"".concat("/user-role-scopes","/").concat(m))},"".concat(null==n?void 0:n.userFamilyName," ").concat(n.userGivenName)),roleName:null==n?void 0:n.role,locations:null==n||null===(i=n.locations)||void 0===i?void 0:i.map((function(e){var t="loc-".concat(null==n?void 0:n.uuid,"-").concat(e.locationUuid);return l().createElement("span",{key:t},null==e?void 0:e.locationName,(null==e?void 0:e.enableDescendants)?l().createElement(be.l2,{key:"".concat(t,"-").concat(o,"-0")}):l().createElement(be.Xd,{key:"".concat(t,"-").concat(o,"-1")})," ")})),stockOperations:null==n||null===(c=n.operationTypes)||void 0===c||null===(s=c.map((function(e){return null==e?void 0:e.operationTypeName})))||void 0===s?void 0:s.join(", "),permanent:(null==n?void 0:n.permanent)?e("stockmanagement.yes","Yes"):e("stockmanagement.no","No"),activeFrom:null!==(u=J(null==n?void 0:n.activeFrom))&&void 0!==u?u:"Not Set",activeTo:null!==(d=J(null==n?void 0:n.activeTo))&&void 0!==d?d:"Not Set",enabled:(null==n?void 0:n.enabled)?e("stockmanagement.yes","Yes"):e("stockmanagement.no","No"),actions:l().createElement("div",{style:{display:"flex"}},l().createElement(Gt,{data:r[o]}),l().createElement(Qt,{uuid:r[o].uuid}))})}))}),[t.user.uuid,r,e]);return A?l().createElement(a.gqd,{role:"progressbar"}):l().createElement("div",{className:ft.tableOverride},l().createElement(a.x45,null,e("panelDescription","To access stock management features, users must have assigned roles specifying location and stock operation type scopes.")),l().createElement("div",{id:"table-tool-bar"},l().createElement("div",null),l().createElement("div",{className:"right-filters"})),l().createElement(a.wQF,{rows:null!=_?_:[],headers:g,isSortable:!0,useZebraStyles:!0,render:function(t){var n=t.rows,r=t.headers,i=t.getHeaderProps,s=t.getTableProps,c=t.getRowProps,u=t.onInputChange;return l().createElement(a.xJi,null,l().createElement(a.fjU,{style:{position:"static",overflow:"visible",backgroundColor:"color"}},l().createElement(a.Vj0,{className:ft.toolbarContent},l().createElement(a.Ys1,{persistent:!0,onChange:u}),l().createElement(Mt,null))),l().createElement(a.iA_,s(),l().createElement(a.ssF,null,l().createElement(a.SCH,null,r.map((function(e){var t,n;return"details"!==e.key&&l().createElement(a.xDH,Jt(Kt({},i({header:e,isSortable:e.isSortable})),{className:o.isDesktop?ft.desktopHeader:ft.tabletHeader,key:"".concat(e.key)}),null!==(n=null===(t=e.header)||void 0===t?void 0:t.content)&&void 0!==n?n:e.header)})),l().createElement(a.xDH,null))),l().createElement(a.RMI,null,n.map((function(e){return l().createElement(l().Fragment,{key:e.id},l().createElement(a.SCH,Kt({className:o.isDesktop?ft.desktopRow:ft.tabletRow},c({row:e})),e.cells.map((function(e){var t;return"details"!==(null==e||null===(t=e.info)||void 0===t?void 0:t.header)&&l().createElement(a.pj1,{key:e.id},e.value)}))))})))),0===n.length?l().createElement("div",{className:ft.tileContainer},l().createElement(a.n9L,{className:ft.tile},l().createElement("div",{className:ft.tileContent},l().createElement("p",{className:ft.content},e("noOperationsToDisplay","No Stock User scopes to display")),l().createElement("p",{className:ft.helper},e("checkFilters","Check the filters above"))))):null)}}),l().createElement(a.tlE,{page:c,pageSize:m,pageSizes:u,totalItems:s,onChange:function(e){var t=e.pageSize,n=e.page;t!==m&&p(t),n!==c&&d(n)},className:ft.paginationOverride}))},Xt=function(){return l().createElement("div",{style:{margin:"5px"}},l().createElement(Vt,null))};function $t(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function en(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),o.forEach((function(t){$t(e,t,n[t])}))}return e}function tn(e){var t="ws/rest/v1/stockmanagement/stocksource".concat(F(e)),n=(0,j.ZP)(t,o.openmrsFetch),r=n.data,a=n.error,i=n.isLoading;return{items:(null==r?void 0:r.data)||{},isLoading:i,isError:a}}function nn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}var on=function(e){(0,j.JG)((function(t){return"string"==typeof t&&t.startsWith(e)}),void 0,{revalidate:!0})},rn=n(8098),an={};an.styleTagTransform=b(),an.setAttributes=g(),an.insert=p().bind(null,"head"),an.domAPI=d(),an.insertStyleElement=f(),c()(rn.Z,an);const ln=rn.Z&&rn.Z.locals?rn.Z.locals:void 0;function sn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function cn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function un(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),o.forEach((function(t){cn(e,t,n[t])}))}return e}function dn(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n.push.apply(n,o)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}const mn=function(e){var t,n,r,s=e.model,c=(0,E.useTranslation)().t,u=Ot(te).items,d=(n=(0,i.useState)(un({},s)),r=2,function(e){if(Array.isArray(e))return e}(n)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,r,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(a.push(o.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw r}}return a}}(n,r)||function(e,t){if(e){if("string"==typeof e)return sn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?sn(e,t):void 0}}(n,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),m=d[0],p=d[1],A=(0,i.useCallback)((function(e){e.preventDefault(),s&&(m.uuid=s.uuid),function(e){var t,n,r,a=null!=e.uuid,i="ws/rest/v1/stockmanagement/stocksource".concat(a?"/"+e.uuid:""),l=new AbortController;return(0,o.openmrsFetch)(i,{method:"POST",headers:{"Content-Type":"application/json"},signal:l.signal,body:(n=en({},e),r={sourceType:null==e||null===(t=e.sourceType)||void 0===t?void 0:t.uuid},r=null!=r?r:{},Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(r)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n.push.apply(n,o)}return n}(Object(r)).forEach((function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(r,e))})),n)})}(m).then((function(){(0,o.showToast)({critical:!0,title:c("addedSource","Add Source"),kind:"success",description:c("stocksourceaddedsuccessfully","Stock Source Added Successfully")}),on("ws/rest/v1/stockmanagement/stocksource"),Q()}),(function(e){(0,o.showNotification)({title:c("errorAddingSource', 'error adding a source"),kind:"error",critical:!0,description:null==e?void 0:e.message})})).catch()}),[m,s,c]);return l().createElement("div",null,l().createElement(a.l09,{onSubmit:A},l().createElement(a.xBx,null),l().createElement(a.fef,null,l().createElement("section",{className:ln.section},l().createElement(a.oil,{id:"fullname",type:"text",labelText:c("fullName","Full Name"),size:"md",onChange:function(e){s&&(s.name=e.target.value),p(dn(un({},m),{name:e.target.value}))},value:null==s?void 0:s.name,placeholder:"e.g National Medical Stores"})),l().createElement("section",{className:ln.section},l().createElement(a.oil,{id:"acronym",type:"text",size:"md",placeholder:"e.g NMS",onChange:function(e){s&&(s.acronym=e.target.value),p(dn(un({},m),{acronym:e.target.value}))},value:null==s?void 0:s.acronym,labelText:c("acronym","Acronym/Code")})),l().createElement("section",{className:ln.section},l().createElement(a.PhF,{name:"sourceType",className:"select-field",labelText:c("sourceType","Source Type"),id:"sourceType",value:(null==m?void 0:m.sourceType)?m.sourceType.uuid:"",onChange:function(e){var t=null==u?void 0:u.answers.find((function(t){return t.uuid===e.target.value}));p(dn(un({},m),{sourceType:t}))}},l().createElement(a.QlF,{disabled:!0,hidden:!0,value:"",text:c("chooseSourceType","Choose a source type")}),null==u||null===(t=u.answers)||void 0===t?void 0:t.map((function(e){return l().createElement(a.QlF,{key:e.uuid,value:e.uuid,text:e.display})}))))),l().createElement(a.mzw,null,l().createElement(a.zxk,{kind:"secondary",onClick:Q},c("cancel","Cancel")),l().createElement(a.zxk,{type:"submit"},c("save","Save")))))},pn=function(){var e=(0,E.useTranslation)().t,t=(0,i.useCallback)((function(){Y("Add Stock Source",l().createElement(mn,null))}),[]);return l().createElement(a.zxk,{onClick:t,size:"md",kind:"primary"},e("stockmanagement.addnewsource","Add New Source"))};var An=n(5551),gn={};gn.styleTagTransform=b(),gn.setAttributes=g(),gn.insert=p().bind(null,"head"),gn.domAPI=d(),gn.insertStyleElement=f(),c()(An.Z,gn);const _n=An.Z&&An.Z.locals?An.Z.locals:void 0;function fn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}const vn=function(e){var t,n=e.onFilterChange,o=Ot(te),r=o.items,i=o.isLoading,s=o.isError;return i||s?l().createElement(a.iTo,null):l().createElement(l().Fragment,null,l().createElement("div",{className:_n.filterContainer},l().createElement(a.Ltx,{id:"stockSourcesFiter",items:(t=r.answers,function(e){if(Array.isArray(e))return fn(e)}(t)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||function(e,t){if(e){if("string"==typeof e)return fn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?fn(e,t):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),initialSelectedItem:r.answers[0],itemToString:function(e){return e?e.display:"Not Set"},titleText:"Filter: ",type:"inline",size:"sm",onChange:function(e){var t=e.selectedItem;return n(null==t?void 0:t.display)}})))};var bn=n(6940),hn={};hn.styleTagTransform=b(),hn.setAttributes=g(),hn.insert=p().bind(null,"head"),hn.domAPI=d(),hn.insertStyleElement=f(),c()(bn.Z,hn);const yn=bn.Z&&bn.Z.locals?bn.Z.locals:void 0;function kn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function Cn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const En=function(e){var t,n,r=e.uuid,s=(0,E.useTranslation)().t,c=(t=(0,i.useState)(!1),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,r,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(a.push(o.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw r}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return kn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?kn(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),u=c[0],d=c[1],m=l().useCallback((function(){var e=(0,o.showModal)("delete-stock-modal",{close:function(){return e()},uuid:r,onConfirmation:function(){var t=[];t.push(r),function(e){var t=e.reduce((function(e,t,n){return 0===n?e:e+=(e.length>0?",":"")+encodeURIComponent(t)}),"");t.length>0&&(t="?ids="+t);var n="ws/rest/v1/stockmanagement/stocksource/".concat(e[0]).concat(t),r=new AbortController;return(0,o.openmrsFetch)(n,{method:"DELETE",headers:{"Content-Type":"application/json"},signal:r.signal})}(t).then((function(){d(!1),on("ws/rest/v1/stockmanagement/stocksource"),(0,o.showToast)({critical:!0,title:s("deletingSource","Delete Source"),kind:"success",description:s("stocksourcedeletedsuccessfully","Stock Source Deleted Successfully")})}),(function(e){d(!1),(0,o.showNotification)({title:s("errorDeletingSource', 'error deleting a source"),kind:"error",critical:!0,description:null==e?void 0:e.message})})).catch(),e()}})}),[s,r]),p=l().createElement(a.zxk,{kind:"ghost",size:"md",onClick:m,iconDescription:s("deleteSource","Delete Source"),renderIcon:function(e){return l().createElement(Ht.ZN,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),o.forEach((function(t){Cn(e,t,n[t])}))}return e}({size:16},e))}});return u?l().createElement(a.lSo,null):p};function wn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Sn=function(e){var t=e.data,n=(0,E.useTranslation)().t,o=(0,i.useCallback)((function(){Y("Edit Stock Source",l().createElement(mn,{model:t}))}),[t]);return l().createElement(a.zxk,{kind:"ghost",size:"md",onClick:function(){return o()},iconDescription:n("editStockItem","Edit Stock Item"),renderIcon:function(e){return l().createElement(dt.I8,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),o.forEach((function(t){wn(e,t,n[t])}))}return e}({size:16},e))}})};function Bn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function On(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function xn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),o.forEach((function(t){On(e,t,n[t])}))}return e}function Dn(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n.push.apply(n,o)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}const Nn=function(){var e,t,n=(0,E.useTranslation)().t,r=(e=l().useState(""),t=2,function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,r,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(a.push(o.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Bn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Bn(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),s=r[0],c=r[1],u=function(e){var t=tn(e),n=t.items,r=t.isLoading,a=t.isError,l=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,r,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(a.push(o.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return nn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?nn(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}((0,i.useState)(10),2),s=l[0],c=l[1],u=(0,o.usePagination)(n.results,s),d=u.goTo,m=u.results,p=u.currentPage,A=(0,i.useMemo)((function(){return[{id:1,header:"Name",key:"name"},{id:2,header:"Acronym",key:"acronym"},{id:3,header:"Source Type",key:"sourceType"},{id:4,header:"actions",key:"actions"}]}),[]);return{items:m,totalItems:null==n?void 0:n.totalCount,currentPage:p,currentPageSize:s,paginatedItems:m,goTo:d,pageSizes:[10,20,30,40,50],isLoading:r,isError:a,setPageSize:c,tableHeaders:A}}({v:U.Default,totalCount:!0}),d=u.items,m=u.totalItems,p=u.tableHeaders,A=u.currentPage,g=u.pageSizes,_=u.goTo,f=u.currentPageSize,v=u.setPageSize,b=u.isLoading,h=(0,i.useMemo)((function(){return null==d?void 0:d.map((function(e,t){var n;return Dn(xn({},e),{id:null==e?void 0:e.uuid,key:"key-".concat(null==e?void 0:e.uuid),uuid:null==e?void 0:e.uuid,name:null==e?void 0:e.name,acronym:null==e?void 0:e.acronym,sourceType:null==e||null===(n=e.sourceType)||void 0===n?void 0:n.display,actions:l().createElement(l().Fragment,null,l().createElement(Sn,{data:d[t]}),l().createElement(En,{uuid:d[t].uuid}))})}))}),[d]),y=function(e){c(e)},k=(0,i.useMemo)((function(){return s?h.filter((function(e){return e.sourceType===s})):h}),[h,s]);return b?l().createElement(a.gqd,{role:"progressbar"}):l().createElement("div",{className:yn.tableOverride},l().createElement(a.x45,null,n("panelDescription","List of partners who provide stock to the facility.")),l().createElement("div",{id:"table-tool-bar"},l().createElement("div",null),l().createElement("div",{className:"right-filters"})),l().createElement(a.wQF,{rows:k,headers:p,isSortable:!0,useZebraStyles:!0,render:function(e){var t=e.rows,r=e.headers,i=e.getHeaderProps,s=e.getTableProps,c=e.getRowProps,u=e.onInputChange;return l().createElement(a.xJi,null,l().createElement(a.fjU,{style:{position:"static",overflow:"visible",backgroundColor:"color"}},l().createElement(a.Vj0,{className:yn.toolbarContent},l().createElement(a.Ys1,{persistent:!0,onChange:u}),l().createElement("div",{style:{display:"flex",alignItems:"center"}},l().createElement(vn,{onFilterChange:y})),l().createElement(pn,null))),l().createElement(a.iA_,s(),l().createElement(a.ssF,null,l().createElement(a.SCH,null,r.map((function(e){var t,n;return"details"!==e.key&&l().createElement(a.xDH,Dn(xn({},i({header:e,isSortable:e.isSortable})),{className:o.isDesktop?yn.desktopHeader:yn.tabletHeader,key:"".concat(e.key)}),null!==(n=null===(t=e.header)||void 0===t?void 0:t.content)&&void 0!==n?n:e.header)})),l().createElement(a.xDH,null))),l().createElement(a.RMI,null,t.map((function(e){return l().createElement(l().Fragment,{key:e.id},l().createElement(a.SCH,xn({className:o.isDesktop?yn.desktopRow:yn.tabletRow},c({row:e})),e.cells.map((function(e){var t;return"details"!==(null==e||null===(t=e.info)||void 0===t?void 0:t.header)&&l().createElement(a.pj1,{key:e.id},e.value)}))))})))),0===t.length?l().createElement("div",{className:yn.tileContainer},l().createElement(a.n9L,{className:yn.tile},l().createElement("div",{className:yn.tileContent},l().createElement("p",{className:yn.content},n("noSourcesToDisplay","No Stock sources to display")),l().createElement("p",{className:yn.helper},n("checkFilters","Check the filters above"))))):null)}}),l().createElement(a.tlE,{page:A,pageSize:f,pageSizes:g,totalItems:m,onChange:function(e){var t=e.pageSize,n=e.page;t!==f&&v(t),n!==A&&_(n)},className:yn.paginationOverride}))},In=function(){return l().createElement("div",{style:{margin:"5px"}},l().createElement(Nn,null))};function Tn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function Pn(e){var t,n,r=L(e),a=r.items,l=r.isLoading,s=r.isError,c=(t=(0,i.useState)(10),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,r,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(a.push(o.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw r}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return Tn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Tn(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),u=c[0],d=c[1],m=(0,o.usePagination)(a.results,u),p=m.goTo,A=m.results,g=m.currentPage,_=(0,E.useTranslation)().t,f=(0,i.useMemo)((function(){return[{id:0,header:_("type","Type"),key:"operationTypeName"},{id:1,header:_("number","Number"),key:"operationNumber"},{id:2,header:_("status","Status"),key:"status"},{id:3,header:_("location","Location"),key:"location"},{id:4,header:_("responsiblePerson","Responsible Person"),key:"responsiblePerson"},{id:5,header:_("date","Date"),key:"operationDate"},{id:6,key:"details"},{key:"actions",header:""}]}),[_]);return{items:A,totalItems:null==a?void 0:a.totalCount,currentPage:g,currentPageSize:u,paginatedItems:A,goTo:p,pageSizes:[10,20,30,40,50],isLoading:l,isError:s,setPageSize:d,tableHeaders:f}}var Un=n(1535),jn={};jn.styleTagTransform=b(),jn.setAttributes=g(),jn.insert=p().bind(null,"head"),jn.domAPI=d(),jn.insertStyleElement=f(),c()(Un.Z,jn);const Fn=Un.Z&&Un.Z.locals?Un.Z.locals:void 0;var Ln="RETURNED",zn="CANCELLED",Rn="REJECTED",Mn=["NEW","SUBMITTED","DISPATCHED","COMPLETED",Ln,zn,Rn],qn=n(6817);function Gn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}const Hn=function(e){var t=e.onOperationTypeSelected,n=e.onOperationLoaded,r=St(),s=r.types.results,c=r.isLoading,u=r.isError,d=function(){var e,t=(0,o.useSession)().user,n=(0,j.ZP)("/ws/rest/v1/stockmanagement/userrolescope",o.openmrsFetch),r=n.data,a=n.isLoading,i=n.error;return{userRoles:null==r||null===(e=r.data)||void 0===e?void 0:e.results.find((function(e){return e.userUuid===t.uuid})),isLoading:a,error:i}}().userRoles,m=(0,i.useMemo)((function(){var e,t,n=(null==d||null===(e=d.operationTypes)||void 0===e?void 0:e.map((function(e){return e.operationTypeUuid})))||[],o=function(e){if(Array.isArray(e))return Gn(e)}(t=new Set(n))||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||function(e,t){if(e){if("string"==typeof e)return Gn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Gn(e,t):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}();return(null==s?void 0:s.filter((function(e){return o.includes(e.uuid)})))||[]}),[s,d]);return(0,i.useEffect)((function(){null==n||n(m)}),[m,n]),c||u?l().createElement(a.Db,null):l().createElement(a.PQB,{renderIcon:function(){return l().createElement(l().Fragment,null,"Start New ",l().createElement(qn.r4,{size:16}))},menuOffset:{right:"-100px"},style:{backgroundColor:"#007d79",backgroundImage:"none",color:"#fff",minHeight:"1rem",padding:".95rem !important",width:"8rem",marginRight:"0.5rem",whiteSpace:"nowrap"}},m.sort((function(e,t){return e.name.localeCompare(t.name)})).map((function(e){return l().createElement(a.laM,{key:e.uuid,itemText:e.name,onClick:function(){null==t||t(e)}})})))};var Zn=n(5260),Yn={};Yn.styleTagTransform=b(),Yn.setAttributes=g(),Yn.insert=p().bind(null,"head"),Yn.domAPI=d(),Yn.insertStyleElement=f(),c()(Zn.Z,Yn);const Qn=Zn.Z&&Zn.Z.locals?Zn.Z.locals:void 0,Wn=function(e){var t=e.tabs,n=e.title,o=e.hasContainer,r=e.selectedIndex,i=e.onChange;return l().createElement("div",{className:"\n ".concat(o?Qn.tabContainer:"","\n ").concat(Qn.cohortBuilder,"\n ")},n&&l().createElement("p",{className:Qn.heading},n),l().createElement("div",{className:Qn.tab},l().createElement(a.mQc,{className:"".concat(Qn.verticalTabs),selectedIndex:r,onChange:function(e){var t=e.selectedIndex;return null==i?void 0:i(t)}},l().createElement(a.tdY,{"aria-label":"navigation"},t.map((function(e,t){return l().createElement(a.OK9,{key:t,disabled:e.disabled},e.name)}))),l().createElement(a.nPR,null,t.map((function(e,t){return l().createElement(a.x45,{key:t},e.component)}))))))};var Kn;function Jn(e){return"transferout"===(e=e.toLowerCase())?"transferout":"disposed"===e?"disposed":"stockissue"===e?"stockissue":"stocktake"===e?"stocktake":"requisition"===e?"requisition":"receipt"===e?"receipt":"return"===e?"return":"adjustment"===e?"adjustment":"initial"===e?"initial":void 0}!function(e){e.TRANSFER_OUT_OPERATION_TYPE="transferout",e.DISPOSED_OPERATION_TYPE="disposed",e.STOCK_ISSUE_OPERATION_TYPE="stockissue",e.STOCK_TAKE_OPERATION_TYPE="stocktake",e.REQUISITION_OPERATION_TYPE="requisition",e.OPENING_STOCK_OPERATION_TYPE="initial",e.RECEIPT_OPERATION_TYPE="receipt",e.RETURN_OPERATION_TYPE="return",e.ADJUSTMENT_OPERATION_TYPE="adjustment"}(Kn||(Kn={}));var Vn=function(e){return"adjustment"===e||"stocktake"===e||"disposed"===e},Xn=function(e){return!$n(e)&&"requisition"!==e},$n=function(e){return"receipt"===e||"initial"===e},eo=function(e){return"requisition"===e},to=function(e){return"receipt"===e||"initial"===e},no=function(e){return"stockissue"===e||"return"===e},oo=function(e){return"stockissue"===e||ro(e)||ao(e)||io(e)},ro=function(e){return"requisition"===e},ao=function(e){return"receipt"===e},io=function(e){return"transferout"===e},lo=n(7536),so=n(6312),co=n(1604),uo=co.z.object({id:co.z.string().nullish(),uuid:co.z.string().nullish(),stockItemUuid:co.z.string().nullish(),packagingUomName:co.z.string().nullish(),packagingUomUuid:co.z.string().nullish(),factor:co.z.number().nullish(),isDefaultStockOperationsUoM:co.z.boolean().nullish(),isDispensingUnit:co.z.boolean().nullish()}),mo=co.z.object({canView:co.z.boolean(),canEdit:co.z.boolean(),canApprove:co.z.boolean().nullish(),canReceiveItems:co.z.boolean().nullish(),canDisplayReceivedItems:co.z.boolean().nullish(),isRequisitionAndCanIssueStock:co.z.boolean().nullish(),canUpdateBatchInformation:co.z.boolean().nullish()}),po=co.z.object({itemIndex:co.z.number().nullish(),id:co.z.string().nullish(),uuid:co.z.string().nullish(),stockItemUuid:co.z.string().nullish(),stockItemName:co.z.string().nullish(),stockItemPackagingUOMUuid:co.z.string().nullish(),stockItemPackagingUOMName:co.z.string().nullish(),stockBatchUuid:co.z.string().nullish(),batchNo:co.z.string().nullish(),expiration:co.z.coerce.date().nullish(),quantity:co.z.number().nullish(),purchasePrice:co.z.number().nullish(),permission:mo.nullish(),edit:co.z.boolean().nullish(),hasExpiration:co.z.boolean().nullish(),packagingUnits:uo.array(),quantityReceived:co.z.number().nullish(),quantityReceivedPackagingUOMName:co.z.string().nullish(),quantityReceivedPackagingUOMUuid:co.z.string().nullish(),quantityRequested:co.z.number().nullish(),quantityRequestedPackagingUOMUuid:co.z.string().nullish(),quantityRequestedPackagingUOMName:co.z.string().nullish(),commonName:co.z.string().nullish(),acronym:co.z.string().nullish()}),Ao=(co.z.object({uuid:co.z.string().nullish(),cancelReason:co.z.string().nullish(),cancelledBy:co.z.coerce.number(),cancelledByGivenName:co.z.string().nullish(),cancelledByFamilyName:co.z.string().nullish(),cancelledDate:co.z.coerce.date(),completedBy:co.z.coerce.number(),completedByGivenName:co.z.string().nullish(),completedByFamilyName:co.z.string().nullish(),completedDate:co.z.coerce.date(),destinationUuid:co.z.string().nullish(),destinationName:co.z.string().nullish(),externalReference:co.z.string().nullish(),atLocationUuid:co.z.string().nullish(),atLocationName:co.z.string().nullish(),operationDate:co.z.coerce.date(),submitted:co.z.boolean(),submittedBy:co.z.string().nullish(),submittedByGivenName:co.z.string().nullish(),submittedByFamilyName:co.z.string().nullish(),locked:co.z.boolean(),operationNumber:co.z.string().nullish(),operationOrder:co.z.coerce.number(),remarks:co.z.string().nullish(),sourceUuid:co.z.string().nullish(),sourceName:co.z.string().nullish(),status:co.z.enum(Mn),returnReason:co.z.string().nullish(),rejectionReason:co.z.string().nullish(),operationTypeUuid:co.z.string().nullish(),operationType:co.z.string().nullish(),operationTypeName:co.z.string().nullish(),responsiblePerson:co.z.coerce.number(),responsiblePersonUuid:co.z.string().nullish(),responsiblePersonGivenName:co.z.string().nullish(),responsiblePersonFamilyName:co.z.string().nullish(),responsiblePersonOther:co.z.string().nullish(),creator:co.z.coerce.number(),dateCreated:co.z.coerce.date(),creatorGivenName:co.z.string().nullish(),creatorFamilyName:co.z.string().nullish(),permission:mo.nullish(),reasonUuid:co.z.string().nullish(),reasonName:co.z.string().nullish(),approvalRequired:co.z.boolean().nullish(),stockOperationItems:po.array(),submittedDate:co.z.coerce.date(),returnedByGivenName:co.z.string().nullish(),returnedByFamilyName:co.z.string().nullish(),returnedDate:co.z.coerce.date(),rejectedByGivenName:co.z.string().nullish(),rejectedByFamilyName:co.z.string().nullish(),rejectedDate:co.z.coerce.date(),dispatchedByGivenName:co.z.string().nullish(),dispatchedByFamilyName:co.z.string().nullish(),dispatchedDate:co.z.coerce.date(),requisitionStockOperationUuid:co.z.string()}),co.z.object({operationDate:co.z.coerce.date(),sourceUuid:co.z.string({required_error:"Location Required"}).min(1,{message:"Location Required"}),destinationUuid:co.z.string({required_error:"Location Required"}).min(1,{message:"Location Required"}),reasonUuid:co.z.string({required_error:"Reason Required"}).min(1,{message:"Reason Required"}),responsiblePersonUuid:co.z.string({required_error:"Responsible Person Required"}).min(1,{message:"Responsible Person Required"}),responsiblePersonOther:co.z.string().nullish(),remarks:co.z.string().nullish()})),go=function(e){switch(e){case Kn.OPENING_STOCK_OPERATION_TYPE:return Ao.omit({destinationUuid:!0,reasonUuid:!0});case Kn.STOCK_TAKE_OPERATION_TYPE:case Kn.ADJUSTMENT_OPERATION_TYPE:case Kn.DISPOSED_OPERATION_TYPE:return Ao.omit({destinationUuid:!0});case Kn.TRANSFER_OUT_OPERATION_TYPE:case Kn.STOCK_ISSUE_OPERATION_TYPE:return Ao.omit({reasonUuid:!0}).merge(co.z.object({destinationUuid:co.z.string({required_error:"Destination Required"}).min(1,{message:"Destination Required"}),requisitionStockOperationUuid:co.z.string({required_error:"Requisition stock uuid required"})}));case Kn.RETURN_OPERATION_TYPE:case Kn.REQUISITION_OPERATION_TYPE:case Kn.RECEIPT_OPERATION_TYPE:return Ao.omit({reasonUuid:!0}).merge(co.z.object({sourceUuid:co.z.string({required_error:"Source Required"}).min(1,{message:"Source Required"})}))}};const _o=function(e){return l().createElement(lo.Qr,{name:e.controllerName,control:e.control,render:function(t){var n,o=t.field,r=o.onChange,i=o.ref;return l().createElement(a.CtY,{titleText:e.title,name:e.name,control:e.control,controllerName:e.controllerName,id:e.name,size:"md",items:e.parties,onChange:function(t){var n,o;null===(n=e.onPartyChange)||void 0===n||n.call(e,t.selectedItem),r(null===(o=t.selectedItem)||void 0===o?void 0:o.uuid)},initialSelectedItem:(null===(n=e.parties)||void 0===n?void 0:n.find((function(t){return t.uuid===e.partyUuid})))||{},itemToString:function(e){return e&&(null==e?void 0:e.name)?"".concat(null==e?void 0:e.name):""},shouldFilterItem:function(){return!0},placeholder:e.placeholder,ref:i,invalid:e.invalid,invalidText:e.invalidText})}})};function fo(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function vo(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,r,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(a.push(o.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return fo(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?fo(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function bo(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function ho(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3,n=(0,i.useRef)();return(0,i.useEffect)((function(){return function(){n.current&&clearTimeout(n.current)}}),[]),function(){for(var o=arguments.length,r=new Array(o),a=0;a<o;a++)r[a]=arguments[a];var i=setTimeout((function(){var t;e.apply(void 0,function(e){if(Array.isArray(e))return bo(e)}(t=r)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||function(e,t){if(e){if("string"==typeof e)return bo(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?bo(e,t):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())}),t);clearTimeout(n.current),n.current=i}}var yo=function(){return{atLocationName:"",atLocationUuid:"",cancelReason:"",cancelledBy:0,cancelledByFamilyName:"",cancelledByGivenName:"",cancelledDate:void 0,completedBy:0,completedByFamilyName:"",completedByGivenName:"",completedDate:void 0,creator:0,creatorFamilyName:"",creatorGivenName:"",dateCreated:void 0,destinationName:"",destinationUuid:"",dispatchedByFamilyName:"",dispatchedByGivenName:"",dispatchedDate:void 0,externalReference:"",locked:!1,operationDate:new Date,operationNumber:"",operationOrder:0,operationType:"",operationTypeName:"",operationTypeUuid:"",permission:void 0,reasonName:"",reasonUuid:"",rejectedByFamilyName:"",rejectedByGivenName:"",rejectedDate:void 0,rejectionReason:"",remarks:"",requisitionStockOperationUuid:"",responsiblePerson:0,responsiblePersonFamilyName:"",responsiblePersonGivenName:"",responsiblePersonOther:"",responsiblePersonUuid:"",returnReason:"",returnedByFamilyName:"",returnedByGivenName:"",returnedDate:void 0,sourceName:"",sourceUuid:"",status:void 0,stockOperationItems:[],submitted:!1,submittedBy:"",submittedByFamilyName:"",submittedByGivenName:"",submittedDate:void 0,uuid:""}},ko={uuid:"Other",display:"Other",person:{display:"Other"}};function Co(e){var t;return(null==e||null===(t=e.person)||void 0===t?void 0:t.display)||""}const Eo=function(e){var t=function(e){var t=vo((0,i.useState)({v:U.Default,limit:10,startIndex:0}),2),n=t[0],o=t[1],r=Bt(n),a=r.items.results,l=r.isLoading,s=vo((0,i.useState)(null),2),c=s[0],u=s[1],d=vo((0,i.useState)(10),2),m=d[0],p=d[1],A=vo((0,i.useState)(U.Default),2),g=A[0],_=A[1];return(0,i.useEffect)((function(){o({startIndex:0,v:g,limit:m,q:c})}),[c,m,g]),{userList:a,setLimit:p,setRepresentation:_,setSearchString:u,isLoading:l}}(),n=t.isLoading,o=t.userList,r=t.setSearchString,s=ho((function(e){r(e)}),1e3);return o&&o.push(ko),l().createElement("div",null,l().createElement(lo.Qr,{name:e.controllerName,control:e.control,render:function(t){var n,r=t.field,i=r.onChange,c=r.ref;return l().createElement(a.CtY,{titleText:e.title,name:e.name,control:e.control,controllerName:e.controllerName,id:e.name,size:"md",items:o||[],onChange:function(t){var n,o;null===(n=e.onUserChanged)||void 0===n||n.call(e,t.selectedItem),i(null===(o=t.selectedItem)||void 0===o?void 0:o.uuid)},initialSelectedItem:null!==(n=null==o?void 0:o.find((function(t){return t.uuid===e.userUuid})))&&void 0!==n?n:"",itemToString:Co,onInputChange:s,placeholder:e.placeholder,invalid:e.invalid,invalidText:e.invalidText,ref:c})}}),n&&l().createElement(a.lSo,{status:"active",iconDescription:"Searching",description:"Searching..."}))};function wo(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const So=function(e){return l().createElement(lo.Qr,{name:e.controllerName,control:e.control,render:function(t){var n,o,r=t.field,i=r.onChange,s=r.value,c=r.ref;return l().createElement(a.oil,(n=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),o.forEach((function(t){wo(e,t,n[t])}))}return e}({},e),o=null!=(o={onChange:function(t){i(t.target.value),e.onChange&&e.onChange(t)},id:e.name,ref:c,value:s})?o:{},Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(o)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n.push.apply(n,o)}return n}(Object(o)).forEach((function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(o,e))})),n))}})},Bo=function(e){var t=Ot("3bbfaa44-d5b8-404d-b4c1-2bf49ad8ce25"),n=t.isLoading,o=t.isError,r=t.items.answers;return n||o?l().createElement(a.xNL,null):l().createElement(lo.Qr,{name:e.controllerName,control:e.control,render:function(t){var n=t.field,o=n.onChange,i=n.ref;return l().createElement(a.CtY,{labelText:e.title,placeholder:e.placeholder,name:e.name,controllerName:e.controllerName,id:e.name,size:"md",items:r,initialSelectedItem:(null==r?void 0:r.find((function(t){return t.uuid===e.reasonUuid})))||{},itemToString:function(e){return e&&(null==e?void 0:e.display)?"".concat(null==e?void 0:e.display):""},onChange:function(t){var n,r;null===(n=e.onReasonChange)||void 0===n||n.call(e,null==t?void 0:t.selectedItem),o(null==t||null===(r=t.selectedItem)||void 0===r?void 0:r.uuid)},ref:i,invalid:e.invalid,invalidText:e.invalidText})}})};function Oo(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const xo=function(e){return l().createElement(lo.Qr,{name:e.controllerName,control:e.control,render:function(t){var n,o,r=t.field,i=r.onChange,s=r.value,c=r.ref;return l().createElement(a.Kx8,(n=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),o.forEach((function(t){Oo(e,t,n[t])}))}return e}({},e),o=null!=(o={onChange:function(t){i(t.target.value),e.onChange&&e.onChange(t)},id:e.name,ref:c,value:s})?o:{},Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(o)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n.push.apply(n,o)}return n}(Object(o)).forEach((function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(o,e))})),n))}})};function Do(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}var No=(0,i.createContext)(null),Io=function(){return(0,i.useContext)(No)},To=function(e){var t,n,o=e.children,r=(t=(0,i.useState)(null),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,r,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(a.push(o.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw r}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return Do(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Do(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),a={formContext:r[0],setFormContext:r[1]};return l().createElement(No.Provider,{value:a},o)},Po=[Kn.ADJUSTMENT_OPERATION_TYPE,Kn.RECEIPT_OPERATION_TYPE,Kn.STOCK_ISSUE_OPERATION_TYPE,Kn.STOCK_TAKE_OPERATION_TYPE,Kn.RETURN_OPERATION_TYPE,Kn.DISPOSED_OPERATION_TYPE,Kn.OPENING_STOCK_OPERATION_TYPE,Kn.TRANSFER_OUT_OPERATION_TYPE],Uo=[Kn.ADJUSTMENT_OPERATION_TYPE,Kn.DISPOSED_OPERATION_TYPE,Kn.STOCK_TAKE_OPERATION_TYPE,Kn.OPENING_STOCK_OPERATION_TYPE];function jo(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function Fo(e,t,n,o,r,a,i){try{var l=e[a](i),s=l.value}catch(e){return void n(e)}l.done?t(s):Promise.resolve(s).then(o,r)}function Lo(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,r,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(a.push(o.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return jo(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?jo(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}const zo=function(e){var t,n,o,r,s,c,u=e.model,d=e.onSave,m=e.operation,p=e.canEdit,A=e.isEditing,g=e.setup,_=g.requiresStockAdjustmentReason,f=g.shouldLockSource,v=g.shouldLockDestination,b=g.sourcePartyList,h=g.destinationPartyList,y=(0,E.useTranslation)().t,k=Io().setFormContext,C=Pn({v:U.Full,totalCount:!0}),w=C.isLoading,S=function(){var e,t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],o=null!==(e=null==n?void 0:n.filter((function(e){return e.operationType===Kn.STOCK_ISSUE_OPERATION_TYPE})).map((function(e){return e.requisitionStockOperationUuid})))&&void 0!==e?e:[],r=null!==(t=null==n?void 0:n.filter((function(e){return e.operationType===Kn.REQUISITION_OPERATION_TYPE&&!o.includes(e.uuid)})))&&void 0!==t?t:[];return r}(C.items),B=Jn(m.operationType),O=(0,lo.cI)({defaultValues:u,mode:"all",resolver:(0,so.F)(go(B))}),x=O.handleSubmit,D=O.control,I=O.formState.errors,T=O.setValue,P=Lo((0,i.useState)(),2),j=P[0],F=P[1],L=Lo((0,i.useState)(!1),2),z=L[0],R=L[1];if(w)return l().createElement(a.lSo,{status:"active",iconDescription:"Loading",description:"Loading data..."});var M,q,G,H,Z,Y,Q=function(){var e,t=(e=function(e){var t;return function(e,t){var n,o,r,a,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,o&&(r=2&a[0]?o.return:a[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,a[1])).done)return r;switch(o=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,o=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((r=(r=i.trys).length>0&&r[r.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){i.label=a[1];break}if(6===a[0]&&i.label<r[1]){i.label=r[1],r=a;break}if(r&&i.label<r[2]){i.label=r[2],i.ops.push(a);break}r[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],o=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,3,4]),R(!0),t=function(e,t,n){var o=Object.assign(e,t);return function(e,t){["submitted","cancelledByFamilyName","atLocationName","completedByGivenName","cancelledBy","submittedByFamilyName","operationOrder","dispatchedByGivenName","submittedByGivenName","returnedByGivenName","operationNumber","responsiblePersonFamilyName","returnReason","atLocationUuid","cancelReason","rejectedByGivenName","reasonName","submittedBy","creator","completedByFamilyName","operationTypeName","rejectedByFamilyName","responsiblePerson","creatorFamilyName","returnedByFamilyName","cancelledByGivenName","operationType","responsiblePersonGivenName","sourceName","rejectionReason","completedBy","creatorGivenName","dispatchedByFamilyName","uuid"].forEach((function(t){delete e[t]}))}(o),function(e){return Po.includes(e)}(n)&&delete o.destinationName,function(e){return Uo.includes(e)}(n)&&delete o.destinationUuid,o}(u,e,B),[4,d(t)];case 1:case 2:return n.sent(),[3,4];case 3:return R(!1),[7];case 4:return[2]}}))},function(){var t=this,n=arguments;return new Promise((function(o,r){var a=e.apply(t,n);function i(e){Fo(a,o,r,i,l,"next",e)}function l(e){Fo(a,o,r,i,l,"throw",e)}i(void 0)}))});return function(e){return t.apply(this,arguments)}}();return l().createElement("div",{style:{margin:"10px"}},l().createElement("form",{className:"".concat(N.formContainer," ").concat(N.verticalForm)},B===Kn.STOCK_ISSUE_OPERATION_TYPE&&l().createElement(lo.Qr,{control:D,name:"requisitionStockOperationUuid",render:function(e){var t,n=e.field;return l().createElement(a.CtY,{id:"requisitionStockOperationUuid",items:S,onChange:function(e){n.onChange(e.selectedItem.uuid),Object.assign(u.stockOperationItems,e.selectedItem.stockOperationItems),k({stockItems:e.selectedItem.stockOperationItems})},itemToString:function(e){var t;return null!==(t="".concat(null==e?void 0:e.operationNumber))&&void 0!==t?t:""},titleText:y("requisitionStockOperation","Requisition"),invalid:!!I.requisitionStockOperationUuid,invalidText:null===(t=I.requisitionStockOperationUuid)||void 0===t?void 0:t.message,placeholder:y("chooseARequisition","Choose a requisition")})}}),p&&l().createElement(lo.Qr,{control:D,render:function(e){var t,n=e.field.onChange;return l().createElement(a.Mtg,{datePickerType:"single",maxDate:$(ee()),locale:"en",dateFormat:X,onChange:n},l().createElement(a.aj6,{invalid:!!I.operationDate,invalidText:null==I||null===(t=I.operationDate)||void 0===t?void 0:t.message,id:"operationDate",name:"operationDate",placeholder:V,labelText:y("operationDate","Operation Date"),value:$(null==u?void 0:u.operationDate)}))},name:"operationDate"}),!p&&l().createElement(l().Fragment,null,l().createElement(a.oil,{id:"operationDateLbl",value:$(null==u?void 0:u.operationDate),readOnly:!0,labelText:"Operation Date"})),A&&(null==u?void 0:u.operationNumber)&&l().createElement(a.oil,{id:"operationNoLbl",value:null==u?void 0:u.operationNumber,readOnly:!0,labelText:"Operation Number:"}),p&&!f&&(null==m?void 0:m.hasSource)&&l().createElement(_o,{controllerName:"sourceUuid",name:"sourceUuid",control:D,title:(null==m?void 0:m.hasDestination)?y("from:","From:"):y("location:","Location:"),placeholder:m.hasDestination?y("chooseASource","Choose a source"):y("chooseALocation","Choose a location"),invalid:!!I.sourceUuid,invalidText:I.sourceUuid&&(null==I||null===(t=I.sourceUuid)||void 0===t?void 0:t.message),parties:b||[]}),(!p||A||f)&&l().createElement(a.oil,{id:"sourceUuidLbl",value:null!==(M=null==u?void 0:u.sourceName)&&void 0!==M?M:"",readOnly:!0,labelText:(null==m||m.hasDestination,"From:")}),p&&!v&&(null==m?void 0:m.hasDestination)&&l().createElement(_o,{controllerName:"destinationUuid",name:"destinationUuid",control:D,title:(null==m?void 0:m.hasSource)?"To:":"Location:",placeholder:(null==m?void 0:m.hasSource)?y("chooseADestination","Choose a destination"):"Location",invalid:!!I.destinationUuid,invalidText:I.destinationUuid&&(null==I||null===(n=I.destinationUuid)||void 0===n?void 0:n.message),parties:h||[]}),(!p||A||v)&&l().createElement(a.oil,{id:"destinationUuidLbl",value:null!==(q=null==u?void 0:u.destinationName)&&void 0!==q?q:"",readOnly:!0,labelText:(null==m||m.hasSource,"To:")}),p&&l().createElement(Eo,{controllerName:"responsiblePersonUuid",name:"responsiblePersonUuid",control:D,title:y("responsiblePerson:","Responsible Person:"),placeholder:y("filter","Filter ..."),invalid:!!I.responsiblePersonUuid,invalidText:I.responsiblePersonUuid&&(null==I||null===(o=I.responsiblePersonUuid)||void 0===o?void 0:o.message),onUserChanged:function(e){(null==e?void 0:e.uuid)===ko.uuid&&F(!0)}}),j&&l().createElement(So,{id:"responsiblePersonOther",name:"responsiblePersonOther",control:D,controllerName:"responsiblePersonOther",maxLength:255,size:"md",value:"".concat(null!==(G=null==u?void 0:u.responsiblePersonOther)&&void 0!==G?G:""),labelText:y("responsiblePerson","Responsible Person:"),placeholder:y("pleaseSpecify","Please Specify:"),invalid:!!I.responsiblePersonOther,invalidText:I.responsiblePersonOther&&(null==I||null===(r=I.responsiblePersonOther)||void 0===r?void 0:r.message)}),!p&&l().createElement(a.oil,{id:"responsiblePersonLbl",value:null!==(H=(null==u?void 0:u.responsiblePersonUuid)&&(null==u?void 0:u.responsiblePersonUuid)!==ko.uuid?"".concat(null==u?void 0:u.responsiblePersonFamilyName," ").concat(null==u?void 0:u.responsiblePersonGivenName):null==u?void 0:u.responsiblePersonOther)&&void 0!==H?H:"",readOnly:!0,labelText:"Responsible Person"}),_&&p&&l().createElement(Bo,{controllerName:"reasonUuid",name:"reasonUuid",control:D,placeholder:y("chooseAReason","Choose a reason"),title:y("reason","Reason:"),invalid:!!I.reasonUuid,invalidText:I.reasonUuid&&(null==I||null===(s=I.reasonUuid)||void 0===s?void 0:s.message),onReasonChange:function(e){T("reasonUuid",e.uuid)}}),_&&!p&&l().createElement(a.oil,{id:"reasonUuidLbl",value:null!==(Z=null==u?void 0:u.reasonName)&&void 0!==Z?Z:"",readOnly:!0,labelText:"Reason:"}),l().createElement(xo,{id:"remarks",name:"remarks",control:D,controllerName:"remarks",maxLength:255,value:"".concat(null!==(Y=null==u?void 0:u.remarks)&&void 0!==Y?Y:""),labelText:y("remarks:","Remarks:"),invalid:!!I.remarks,invalidText:I.remarks&&(null==I||null===(c=I.remarks)||void 0===c?void 0:c.message)}),l().createElement("div",{style:{display:"flex",flexDirection:"row-reverse"}},l().createElement(a.zxk,{name:"save",type:"button",className:"submitButton",onClick:x(Q),kind:"primary",renderIcon:be.ol},z?l().createElement(a.lSo,null):y("next","Next")))))};var Ro={stockItemUuid:co.z.string().min(1,{message:"Required"}),stockItemName:co.z.string().min(1).nullish(),stockItemPackagingUOMUuid:co.z.string().min(1,{message:"Required"}),stockItemPackagingUOMName:co.z.string().min(1).nullish(),batchNo:co.z.string().min(1,{message:"Required"}),stockBatchUuid:co.z.string().optional(),expiration:co.z.coerce.date({required_error:"Required"}),quantity:co.z.coerce.number().min(1,{message:"Required"}),purchasePrice:co.z.coerce.number().nullish(),hasExpiration:co.z.boolean().nullish()},Mo=co.z.object(Ro),qo=(Mo.omit({expiration:!0}),co.z.object({stockItems:co.z.array(Mo)})),Go=n(6781),Ho={};Ho.styleTagTransform=b(),Ho.setAttributes=g(),Ho.insert=p().bind(null,"head"),Ho.domAPI=d(),Ho.insertStyleElement=f(),c()(Go.Z,Ho);const Zo=Go.Z&&Go.Z.locals?Go.Z.locals:void 0;function Yo(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function Qo(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,r,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(a.push(o.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Yo(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Yo(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Wo(e){return e.drugName||e.conceptName}const Ko=function(e){var t=function(e){var t=Qo((0,i.useState)(e||{v:U.Default,limit:10,startIndex:0}),2),n=t[0],o=t[1],r=He(n),a=r.items.results,l=r.isLoading,s=Qo((0,i.useState)(null),2),c=s[0],u=s[1],d=Qo((0,i.useState)((null==e?void 0:e.limit)||10),2),m=d[0],p=d[1],A=Qo((0,i.useState)((null==e?void 0:e.v)||U.Default),2),g=A[0],_=A[1];return(0,i.useEffect)((function(){o({startIndex:0,v:g,limit:m,q:c})}),[c,m,g]),{stockItemsList:a,setLimit:p,setRepresentation:_,setSearchString:u,isLoading:l}}({}),n=t.isLoading,o=t.stockItemsList,r=t.setSearchString,s=ho((function(e){r(e)}),500);return l().createElement("div",null,l().createElement(lo.Qr,{name:e.controllerName,control:e.control,render:function(t){var n,r=t.field,i=r.onChange,c=(r.value,r.ref);return l().createElement(a.CtY,{titleText:e.title,name:e.name,control:e.control,controllerName:e.controllerName,id:e.name,size:"sm",items:o||[],onChange:function(t){var n,o;null===(n=e.onStockItemChanged)||void 0===n||n.call(e,t.selectedItem),i(null===(o=t.selectedItem)||void 0===o?void 0:o.uuid)},initialSelectedItem:null!==(n=null==o?void 0:o.find((function(t){return t.uuid===e.stockItemUuid})))&&void 0!==n?n:"",itemToString:Wo,onInputChange:s,placeholder:e.placeholder,invalid:e.invalid,invalidText:e.invalidText,ref:c})}}),n&&l().createElement(a.lSo,{status:"active",iconDescription:"Searching",description:"Searching..."}))},Jo=function(e){var t,n=We(e.stockItemUuid),o=n.isLoading,r=n.isError,s=n.item,c=(0,i.useMemo)((function(){var e;return(null==s||null===(e=s.packagingUnits)||void 0===e?void 0:e.length)>0?s.packagingUnits[0]:null}),[null==s?void 0:s.packagingUnits]);return o||r?l().createElement(a.N2B,null):l().createElement("div",null,l().createElement(lo.Qr,{name:e.controllerName,control:e.control,defaultValue:null!==(t=c.uuid)&&void 0!==t?t:"",render:function(t){var n,o=t.field,r=o.onChange,i=o.ref;return l().createElement(a.CtY,{titleText:e.title,name:e.name,control:e.control,controllerName:e.controllerName,id:e.name,size:"sm",items:null!==(n=null==s?void 0:s.packagingUnits)&&void 0!==n?n:[],onChange:function(t){var n,o;null===(n=e.onStockPackageChanged)||void 0===n||n.call(e,t.selectedItem),r(null===(o=t.selectedItem)||void 0===o?void 0:o.uuid)},initialSelectedItem:c,itemToString:function(e){var t;return null!==(t=e.packagingUomName)&&void 0!==t?t:""},placeholder:e.placeholder,invalid:e.invalid,invalidText:e.invalidText,ref:i})}}))};function Vo(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function Xo(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,r,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(a.push(o.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Vo(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Vo(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function $o(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function er(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,r,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(a.push(o.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return $o(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?$o(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function tr(e){var t=er((0,i.useState)({startIndex:0,v:e||U.Default,limit:10,q:null,totalCount:!0,includeBatchNo:!0}),2),n=t[0],o=t[1],r=er((0,i.useState)(10),2),a=r[0],l=r[1],s=er((0,i.useState)(null),2),c=s[0],u=s[1],d=er((0,i.useState)(1),2),m=d[0],p=d[1],A=er((0,i.useState)(),2),g=A[0],_=A[1],f=er((0,i.useState)(),2),v=f[0],b=f[1],h=er((0,i.useState)(),2),y=h[0],k=h[1],C=er((0,i.useState)(),2),E=C[0],w=C[1];(0,i.useEffect)((function(){o({startIndex:m-1,v:U.Default,limit:a,q:c,totalCount:!0,stockItemUuid:g,partyUuid:v,locationUuid:y,stockBatchUuid:E,includeBatchNo:!0})}),[c,m,a,g,v,y,E]);var S,B=Ze(n),O=B.items,x=B.isLoading,D=B.isError;return{items:null!==(S=O.results)&&void 0!==S?S:[],totalCount:O.totalCount,currentPage:m,currentPageSize:a,setCurrentPage:p,setPageSize:l,pageSizes:[10,20,30,40,50],isLoading:x,isError:D,setSearchString:u,setStockItemUuid:_,setLocationUuid:k,setPartyUuid:b,setStockBatchUuid:w}}function nr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const or=function(e){var t=function(e){var t=Xo((0,i.useState)({v:U.Default,limit:10,startIndex:0,stockItemUuid:e}),2),n=t[0],o=t[1],r=Ye(n),a=r.items.results,l=r.isLoading,s=Xo((0,i.useState)(null),2),c=s[0],u=s[1],d=Xo((0,i.useState)(10),2),m=d[0],p=d[1],A=Xo((0,i.useState)(U.Default),2),g=A[0],_=A[1];return(0,i.useEffect)((function(){o({startIndex:0,v:g,limit:m,q:c,stockItemUuid:e})}),[c,m,g,e]),{stockItemBatchNos:a,setLimit:p,setRepresentation:_,setSearchString:u,isLoading:l}}(e.stockItemUuid),n=t.isLoading,o=t.stockItemBatchNos,r=(0,i.useMemo)((function(){var t;return null!==(t=null==o?void 0:o.find((function(t){return t.uuid===e.batchUuid})))&&void 0!==t?t:""}),[o,e.batchUuid]),s=tr(U.Default),c=s.items,u=s.setStockItemUuid;(0,i.useEffect)((function(){u(e.stockItemUuid)}),[e.stockItemUuid,u]);var d=null==o?void 0:o.map((function(e){var t,n,o,r=null==c?void 0:c.find((function(t){return t.batchNumber===e.batchNo}));return r?(n=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),o.forEach((function(t){nr(e,t,n[t])}))}return e}({},e),o=null!=(o={quantity:null!==(t=r.quantity)&&void 0!==t?t:""})?o:{},Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(o)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n.push.apply(n,o)}return n}(Object(o)).forEach((function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(o,e))})),n):e}));return n?l().createElement(a.lSo,{status:"active"}):l().createElement("div",{style:{display:"flex",flexDirection:"row"}},l().createElement(lo.Qr,{name:e.controllerName,control:e.control,render:function(t){var n=t.field,o=n.onChange,i=n.ref;return l().createElement(a.CtY,{style:{flexGrow:"1"},titleText:e.title,name:e.name,control:e.control,controllerName:e.controllerName,id:e.name,size:"sm",items:d||[],onChange:function(t){var n,r;null===(n=e.onBatchNoChanged)||void 0===n||n.call(e,t.selectedItem),o(null===(r=t.selectedItem)||void 0===r?void 0:r.uuid)},initialSelectedItem:r,itemToString:function(e){var t;return(null==e?void 0:e.batchNo)?"".concat(null==e?void 0:e.batchNo," | Qty: ").concat(null!==(t=null==e?void 0:e.quantity)&&void 0!==t?t:""):""},placeholder:e.placeholder,invalid:e.invalid,invalidText:e.invalidText,ref:i})}}),n&&l().createElement(a.lSo,{status:"active"}))};function rr(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function ar(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,r,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(a.push(o.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return rr(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?rr(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}const ir=function(e){var t=e.canEdit,n=e.showQuantityRequested,r=e.requiresActualBatchInformation,s=e.requiresBatchUuid,c=e.canUpdateBatchInformation,u=e.canCapturePurchasePrice,d=e.batchBalance,m=e.control,p=e.setValue,A=e.errors,g=e.remove,_=e.fields,f=ar((0,i.useState)(),2),v=(f[0],f[1]),b=ar((0,i.useState)(),2),h=(b[0],b[1]);return l().createElement(l().Fragment,null,null==_?void 0:_.map((function(e,i){var f,b,y,k,C,E,w,S,B,O,x,D,N,I,T,P,U,j,F,L,z,R,M,q,G,H,Z,Y,Q,W,K,J,te,ne,oe="stockItems.".concat(i,".stockItemUuid");return l().createElement(a.SCH,{className:o.isDesktop?Zo.desktopRow:Zo.tabletRow,key:null==e?void 0:e.uuid},l().createElement(a.pj1,null,t&&(null==e?void 0:e.uuid.startsWith("new-item"))&&l().createElement(Ko,{placeholder:"Select an item",controllerName:"stockItems.".concat(i,".stockItemUuid"),name:oe,control:m,invalid:!!(null==A||null===(b=A.stockItems)||void 0===b||null===(f=b[i])||void 0===f?void 0:f.stockItemUuid),onStockItemChanged:function(e){var t;!function(e,t){if(t){var n=_[e];if(n){var o,r,a,i;n.stockItemName=null!==(a=(null==t?void 0:t.drugName)?"".concat(null==t?void 0:t.drugName).concat((null!==(o=null==t?void 0:t.commonName)&&void 0!==o?o:null==t?void 0:t.conceptName)?" (".concat(null!==(r=null==t?void 0:t.commonName)&&void 0!==r?r:null==t?void 0:t.conceptName,")"):""):null)&&void 0!==a?a:null==t?void 0:t.conceptName;var l=null===(i=null==t?void 0:t.hasExpiration)||void 0===i||i;n.hasExpiration=l,l||(n.expiration=null),n.stockItemUuid=null==t?void 0:t.uuid,n.stockItemPackagingUOMUuid=null,n.stockItemPackagingUOMName=null,n.stockBatchUuid=null}}}(i,e),p("stockItems.".concat(i,".packagingUnits"),null==e?void 0:e.packagingUnits),v(null!==(t=null==e?void 0:e.uuid)&&void 0!==t?t:"")}}),(!t||!e.uuid.startsWith("new-item"))&&l().createElement(a.rUS,{target:"_blank",to:(ne=null==e?void 0:e.stockItemUuid,"".concat("/stock-items","/").concat(ne).concat(""))},"".concat(null==e?void 0:e.stockItemName))),n&&l().createElement(a.pj1,null,null!==(Y=null==e||null===(y=e.quantityRequested)||void 0===y?void 0:y.toLocaleString())&&void 0!==Y?Y:""," ",null!==(Q=null==e?void 0:e.quantityRequestedPackagingUOMName)&&void 0!==Q?Q:""),(r||s)&&l().createElement(a.pj1,null,r&&(t||c&&(null==e||null===(k=e.permission)||void 0===k?void 0:k.canUpdateBatchInformation))&&l().createElement(a.oil,{size:"sm",maxLength:50,onChange:function(e){return p("stockItems.".concat(i,".batchNo"),e.target.value)},defaultValue:e.batchNo,invalidText:"",invalid:null==A||null===(E=A.stockItems)||void 0===E||null===(C=E[i])||void 0===C?void 0:C.batchNo}),s&&!r&&t&&l().createElement(or,{batchUuid:null==e?void 0:e.stockBatchUuid,onBatchNoChanged:function(e){p("stockItems.".concat(i,".batchNo"),null==e?void 0:e.batchNo),p("stockItems.".concat(i,".expiration"),null==e?void 0:e.expiration),h(null==e?void 0:e.expiration)},placeholder:"Filter...",invalid:!!(null==A||null===(S=A.stockItems)||void 0===S||null===(w=S[i])||void 0===w?void 0:w.stockBatchUuid),control:m,controllerName:"stockItems.".concat(i,".stockBatchUuid"),name:"stockItems.".concat(i,".stockBatchUuid"),stockItemUuid:e.stockItemUuid}),!(c&&(null==e||null===(B=e.permission)||void 0===B?void 0:B.canUpdateBatchInformation))&&!t&&(null==e?void 0:e.batchNo)),(r||s)&&l().createElement(a.pj1,null,(t||c&&(null==e||null===(O=e.permission)||void 0===O?void 0:O.canUpdateBatchInformation))&&r&&l().createElement(a.Mtg,{id:"expiration-".concat(e.uuid),datePickerType:"single",minDate:$(ee()),locale:"en",dateFormat:X,onChange:function(e){var t=ar(e,1)[0];p("stockItems.".concat(i,".expiration"),t)}},l().createElement(a.aj6,{size:"sm",autoComplete:"off",id:"expiration-input-".concat(e.uuid),name:"operationDate",placeholder:V,defaultValue:$(null==e?void 0:e.expiration),invalid:!!(null==A||null===(D=A.stockItems)||void 0===D||null===(x=D[i])||void 0===x?void 0:x.expiration)})),(!(c&&(null==e||null===(N=e.permission)||void 0===N?void 0:N.canUpdateBatchInformation))&&!t||s)&&$(e.expiration)),l().createElement(a.pj1,null,t&&l().createElement(a.Y2U,{className:"small-placeholder-text",size:"sm",id:"qty-".concat(null==e?void 0:e.uuid),allowEmpty:!0,onChange:function(e){var t;return p("stockItems.".concat(i,".quantity"),null==e||null===(t=e.target)||void 0===t?void 0:t.value)},value:null!==(W=null==e?void 0:e.quantity)&&void 0!==W?W:"",invalidText:null==A||null===(P=A.stockItems)||void 0===P||null===(T=P[i])||void 0===T||null===(I=T.quantity)||void 0===I?void 0:I.message,placeholder:s&&!r&&(null==e?void 0:e.stockBatchUuid)in d?"Bal: ".concat(null!==(K=null===(j=d[null==e?void 0:e.stockBatchUuid])||void 0===j||null===(U=j.quantity)||void 0===U?void 0:U.toLocaleString())&&void 0!==K?K:""," ").concat(null!==(J=null===(F=d[null==e?void 0:e.stockBatchUuid])||void 0===F?void 0:F.quantityUoM)&&void 0!==J?J:""):"",invalid:!!(null==A||null===(z=A.stockItems)||void 0===z||null===(L=z[i])||void 0===L?void 0:L.quantity)}),!t&&(null==e||null===(R=e.quantity)||void 0===R?void 0:R.toLocaleString())),l().createElement(a.pj1,null,t&&l().createElement(Jo,{stockItemUuid:e.stockItemUuid,onStockPackageChanged:function(e){p("stockItems.".concat(i,".stockItemPackagingUOMUuid"),null==e?void 0:e.uuid)},placeholder:"Filter...",invalid:!!(null==A||null===(q=A.stockItems)||void 0===q||null===(M=q[i])||void 0===M?void 0:M.stockItemPackagingUOMUuid),control:m,controllerName:"stockItems.".concat(i,".stockItemPackagingUOMUuid"),name:"stockItems.".concat(i,".stockItemPackagingUOMUuid")}),!t&&(null==e?void 0:e.stockItemPackagingUOMName)),u&&l().createElement(a.pj1,null,t&&l().createElement(a.Y2U,{size:"sm",invalid:!!(null==A||null===(H=A.stockItems)||void 0===H||null===(G=H[i])||void 0===G?void 0:G.purchasePrice),invalidText:"",id:"purchaseprice-".concat(e.uuid),allowEmpty:!0,onChange:function(e){var t;return p("stockItems.".concat(i,".purchasePrice"),null==e||null===(t=e.target)||void 0===t?void 0:t.value)},value:null!==(te=null==e?void 0:e.purchasePrice)&&void 0!==te?te:"",title:""}),!t&&(null==e||null===(Z=e.purchasePrice)||void 0===Z?void 0:Z.toLocaleString())),t&&l().createElement(a.pj1,null,l().createElement(a.zxk,{type:"button",size:"sm",className:"submitButton clear-padding-margin",iconDescription:"Delete",kind:"ghost",renderIcon:Ht.ZN,onClick:function(){return g(i)}})))})))};var lr=n(6360),sr={};sr.styleTagTransform=b(),sr.setAttributes=g(),sr.insert=p().bind(null,"head"),sr.domAPI=d(),sr.insertStyleElement=f(),c()(lr.Z,sr);const cr=lr.Z&&lr.Z.locals?lr.Z.locals:void 0;function ur(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function dr(e,t,n,o,r,a,i){try{var l=e[a](i),s=l.value}catch(e){return void n(e)}l.done?t(s):Promise.resolve(s).then(o,r)}function mr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function pr(e){return function(e){if(Array.isArray(e))return ur(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Ar(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ar(e,t){if(e){if("string"==typeof e)return ur(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ur(e,t):void 0}}const gr=function(e){var t,n,r,s,c,u=e.setup,d=u.hasQtyRequested,m=u.requiresBatchUuid,p=u.requiresActualBatchInfo,A=u.canCaptureQuantityPrice,g=u.batchBalance,_=u.batchNos,f=u.canUpdateItemsBatchInformation,v=u.itemUoM,b=e.canEdit,h=void 0===b||b,y=e.model,k=e.onSave,C=e.operation,w=(0,E.useTranslation)().t,S=(null!=C?C:{}).operationType,B=Io().formContext,O=function(e){if("requisition"===e){var t=Mo.omit({batchNo:!0,expiration:!0});return co.z.object({stockItems:co.z.array(t)})}return qo}(S),x=(t=function(e){return function(e,t){var n,o,r,a,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,o&&(r=2&a[0]?o.return:a[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,a[1])).done)return r;switch(o=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,o=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((r=(r=i.trys).length>0&&r[r.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){i.label=a[1];break}if(6===a[0]&&i.label<r[1]){i.label=r[1],r=a;break}if(r&&i.label<r[2]){i.label=r[2],i.ops.push(a);break}r[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],o=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}(this,(function(t){switch(t.label){case 0:return 0==e.stockItems.length?("No stock items","You haven't added any stock items, tap the add button to add some.",(0,o.showToast)({critical:!0,title:"No stock items",kind:"error",description:"You haven't added any stock items, tap the add button to add some."}),[2]):(y.stockOperationItems=null==e?void 0:e.stockItems,[4,null==k?void 0:k(y)]);case 1:return t.sent(),[2]}}))},n=function(){var e=this,n=arguments;return new Promise((function(o,r){var a=t.apply(e,n);function i(e){dr(a,o,r,i,l,"next",e)}function l(e){dr(a,o,r,i,l,"throw",e)}i(void 0)}))},function(e){return n.apply(this,arguments)}),D=(0,lo.cI)({resolver:(0,so.F)(O),defaultValues:{stockItems:null!==(r=null==y?void 0:y.stockOperationItems)&&void 0!==r?r:[{uuid:"new-item-1",id:"new-item-1"}]},mode:"onSubmit"}),N=D.handleSubmit,I=D.control,T=D.setValue,P=D.formState.errors,U=(s=(0,i.useState)(!1),c=1,function(e){if(Array.isArray(e))return e}(s)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,r,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(a.push(o.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw r}}return a}}(s,c)||Ar(s,c)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())[0],j=(0,lo.Dq)({name:"stockItems",control:I}),F=j.fields,L=j.append,z=j.remove;(0,i.useEffect)((function(){if(null==B?void 0:B.stockItems){var e=null==B?void 0:B.stockItems;null==e||e.forEach((function(e){return L(e)}))}}),[L,null==B?void 0:B.stockItems]);var R,M=[{key:"item",header:w("item","Item"),styles:{width:"40% !important"}}].concat(pr(d?[{key:"quantityrequested",header:w("quantityRequested","Quantity Requested")}]:[]),pr(m||p?[{key:"batch",header:w("batchNo","Batch No"),styles:{width:"15% !important"}}]:[]),pr(p?[{key:"expiry",header:w("expiry","Expiry")}]:[]),pr(m?[{key:"expiry",header:w("expiry","Expiry")}]:[]),[{key:"quantity",header:d?w("qtyIssued","Qty Issued"):w("qty","Qty")},{key:"quantityuom",header:w("quantityUom","Qty UoM")}],pr(A?[{key:"purchaseprice",header:w("purchasePrice","Purchase Price")}]:[])),q=function(){var e="new-item-".concat("".concat((new Date).getTime(),"-").concat(Math.random().toString(36).substring(2,16)));L({uuid:e,id:e})};return l().createElement("div",{style:{margin:"10px"}},l().createElement("div",{className:cr.tableContainer},l().createElement(a.wQF,{rows:null!==(R=null==y?void 0:y.stockOperationItems)&&void 0!==R?R:[{uuid:"new-item-1",id:"new-item-1"}],headers:M,isSortable:!1,useZebraStyles:!0,styles:{width:"100%"},render:function(e){var t,n=e.headers,r=e.getHeaderProps,i=e.getTableProps;return l().createElement(a.xJi,null,l().createElement(a.iA_,i(),l().createElement(a.ssF,null,l().createElement(a.SCH,null,n.map((function(e){var t,n,i,s;return l().createElement(a.xDH,(i=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),o.forEach((function(t){mr(e,t,n[t])}))}return e}({},r({header:e,isSortable:!1})),s=null!=(s={className:o.isDesktop?cr.desktopHeader:cr.tabletHeader,style:null==e?void 0:e.styles,key:"".concat(e.key)})?s:{},Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(s)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n.push.apply(n,o)}return n}(Object(s)).forEach((function(e){Object.defineProperty(i,e,Object.getOwnPropertyDescriptor(s,e))})),i),null!==(n=null===(t=e.header)||void 0===t?void 0:t.content)&&void 0!==n?n:null==e?void 0:e.header)})),h&&l().createElement(a.xDH,{style:{width:"3% !important"}},l().createElement("div",{style:{width:"3% !important",display:"flex",flexDirection:"row",gap:"8px"}},l().createElement(a.zxk,{renderIcon:be.mm,onClick:q,hasIconOnly:!0}),l().createElement(a.zxk,{name:"save",type:"button",className:"submitButton",onClick:function(){return N(x)()},kind:"primary",renderIcon:be.ol},U?l().createElement(a.lSo,null):w("next","Next")))))),l().createElement(a.RMI,null,l().createElement(ir,{rows:null!==(t=null==y?void 0:y.stockOperationItems)&&void 0!==t?t:[{uuid:"new-item-1",id:"new-item-1"}],batchBalance:g,batchNos:_,control:I,setValue:T,errors:P,remove:z,append:L,canEdit:h,showQuantityRequested:d,requiresActualBatchInformation:p,requiresBatchUuid:m,canUpdateBatchInformation:f,canCapturePurchasePrice:A,itemUoM:v,fields:F})," ")))}})))};var _r=n(8808);function fr(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function vr(e,t,n,o,r,a,i){try{var l=e[a](i),s=l.value}catch(e){return void n(e)}l.done?t(s):Promise.resolve(s).then(o,r)}function br(e){return function(){var t=this,n=arguments;return new Promise((function(o,r){var a=e.apply(t,n);function i(e){vr(a,o,r,i,l,"next",e)}function l(e){vr(a,o,r,i,l,"throw",e)}i(void 0)}))}}function hr(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,r,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(a.push(o.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return fr(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?fr(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function yr(e,t){var n,o,r,a,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,o&&(r=2&a[0]?o.return:a[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,a[1])).done)return r;switch(o=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,o=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((r=(r=i.trys).length>0&&r[r.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){i.label=a[1];break}if(6===a[0]&&i.label<r[1]){i.label=r[1],r=a;break}if(r&&i.label<r[2]){i.label=r[2],i.ops.push(a);break}r[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],o=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}const kr=function(e){var t=e.canEdit,n=e.locked,o=e.model,r=e.requiresDispatchAcknowledgement,s=e.actions,c=(0,E.useTranslation)().t,u=hr((0,i.useState)(!1),2),d=u[0],m=u[1],p=hr((0,i.useState)(null),2),A=p[0],g=p[1];return l().createElement("div",{style:{margin:"10px"}},t&&!n&&l().createElement("div",{style:{margin:"10px"}},l().createElement(a.SYO,{name:"rbgApprovelRequired",legendText:c("doesThisTransactionRequireApproval","Does the transaction require approval ?"),onChange:function(e){g(e)},defaultSelected:A},l().createElement(a.EUY,{value:!0,id:"rbgApprovelRequired-true",labelText:c("yes","Yes")}),l().createElement(a.EUY,{value:!1,id:"rbgApprovelRequired-false",labelText:c("no","No")}))),!t&&l().createElement(l().Fragment,null,l().createElement(a.oil,{style:{margin:"5px"},id:"rbgApproveRequiredLbl",value:A?c("yes","Yes"):c("no","No"),readOnly:!0,labelText:c("doesThisTransactionRequireApproval","Does the transaction require approval ?")})),t&&!n&&l().createElement("div",{className:"stkpg-form-buttons",style:{margin:"10px"}},null!=A&&l().createElement(l().Fragment,null,!r&&!A&&l().createElement(a.zxk,{name:"complete",type:"button",style:{margin:"4px"},className:"submitButton",kind:"primary",onClick:br((function(){return yr(this,(function(e){switch(e.label){case 0:return null==o||delete o.dateCreated,o.status="COMPLETED",m(!0),[4,s.onComplete(o)];case 1:return e.sent(),m(!1),[2]}}))})),renderIcon:ge.X4},c("complete","Complete")),r&&!A&&l().createElement(a.zxk,{name:"dispatch",type:"button",style:{margin:"4px"},className:"submitButton",kind:"primary",onClick:s.onDispatch,renderIcon:ct.bS},c("dispatch","Dispatch")),A&&l().createElement(a.zxk,{name:"submit",type:"button",style:{margin:"4px"},className:"submitButton",kind:"primary",onClick:s.onSubmit,renderIcon:_r.f5},c("submit","Submit For Review"))),l().createElement(a.zxk,{name:"save",type:"button",className:"submitButton",style:{margin:"4px"},disabled:d,onClick:br((function(){return yr(this,(function(e){switch(e.label){case 0:return null==o||delete o.dateCreated,null==o||delete o.status,m(!0),[4,s.onSave(o)];case 1:return e.sent(),m(!1),[2]}}))})),kind:"secondary",renderIcon:_r.vc},d?l().createElement(a.lSo,null):c("save","Save")),!d&&l().createElement(a.zxk,{type:"button",style:{margin:"4px"},className:"cancelButton",kind:"tertiary",onClick:s.onGoBack,renderIcon:Ht.WP},c("goBack","Go Back"))))};var Cr="Location",Er="Other";function wr(e,t,n,o,r,a,i){try{var l=e[a](i),s=l.value}catch(e){return void n(e)}l.done?t(s):Promise.resolve(s).then(o,r)}function Sr(){var e;return e=function(e,t,n){var r,a,i,l,s,c,u,d,m,p,A,g,_,f,v,b,h,y,k,C,E,w,S,B,O,x,D,N,I,T,P,U,j,F,L,z,R,M,q,G,H;return function(e,t){var n,o,r,a,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,o&&(r=2&a[0]?o.return:a[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,a[1])).done)return r;switch(o=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,o=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((r=(r=i.trys).length>0&&r[r.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){i.label=a[1];break}if(6===a[0]&&i.label<r[1]){i.label=r[1],r=a;break}if(r&&i.label<r[2]){i.label=r[2],i.ops.push(a);break}r[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],o=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}(this,(function(Z){switch(Z.label){case 0:return A=!!t,g=[],_=!1,f=n,b=null!==(v=null==t||null===(r=t.permission)||void 0===r?void 0:r.isRequisitionAndCanIssueStock)&&void 0!==v&&v,y=null!==(h=null==e||null===(a=e.stockOperationTypeLocationScopes)||void 0===a?void 0:a.filter((function(t){return(null==e?void 0:e.hasSource)&&t.isSource})).map((function(e){return e.locationTag})))&&void 0!==h?h:[],k=1===y.length&&y[0]===re,E=null!==(C=null==e||null===(i=e.stockOperationTypeLocationScopes)||void 0===i?void 0:i.filter((function(t){return(null==e?void 0:e.hasDestination)&&t.isDestination})).map((function(e){return e.locationTag})))&&void 0!==C?C:[],w=1===E.length&&E[0]===re,S=null,A?(p=structuredClone(yo()),p=Object.assign(p,{operationDate:ee(),operationTypeName:null==e?void 0:e.name,operationTypeUuid:null==e?void 0:e.uuid,operationType:null==e?void 0:e.operationType}),e.operationType,Kn.STOCK_ISSUE_OPERATION_TYPE,[4,(0,o.openmrsFetch)("ws/rest/v1/stockmanagement/party?v=default")]):[3,2];case 1:if(!(N=Z.sent()).ok)throw Error("Error loading parties");return B=null==N||null===(D=N.data)||void 0===D||null===(x=D.results)||void 0===x?void 0:x.filter((function(t){return t.locationUuid&&(null==e?void 0:e.sourceType)===Cr&&(0===y.length||t.tags&&y.some((function(e){return t.tags.includes(e)})))||t.stockSourceUuid&&(null==e?void 0:e.sourceType)===Er})),(null==e?void 0:e.hasSource)&&A&&k&&(null==B?void 0:B.length)>0&&(I=B[0],p.sourceUuid=I.uuid,p.sourceName=I.name,S=null==I?void 0:I.locationUuid),(null==e?void 0:e.hasDestination)&&(O=null==N||null===(P=N.data)||void 0===P||null===(T=P.results)||void 0===T?void 0:T.filter((function(t){return t.locationUuid&&(null==e?void 0:e.destinationType)===Cr&&(0===E.length||t.tags&&E.some((function(e){return t.tags.includes(e)})))||t.stockSourceUuid&&(null==e?void 0:e.destinationType)===Er})),A&&w&&(null==O?void 0:O.length)>0&&(U=O[0],p.destinationUuid=U.uuid,p.destinationName=U.name)),[3,4];case 2:return[4,(0,o.openmrsFetch)("ws/rest/v1/stockmanagement/stockoperationtype?v=default")];case 3:if(!(j=Z.sent()).ok)throw Error("Error loading operation types");f=j.data.results,Z.label=4;case 4:return F=Jn(e.operationType),[2,{batchBalance:{},batchNos:{},itemUoM:{},requisition:"",showQuantityRequested:!1,dto:p,stockItems:g,isNegativeQuantityAllowed:(Y=F,"adjustment"===Y),requiresBatchUuid:Xn(F),requiresActualBatchInfo:$n(F),isQuantityOptional:eo(F),canCaptureQuantityPrice:to(F),requiresStockAdjustmentReason:Vn(F),requiresDispatchAcknowledgement:no(F),allowExpiredBatchNumbers:null!==(L=null==e?void 0:e.allowExpiredBatchNumbers)&&void 0!==L&&L,canEditModel:null!==(z=null==t||null===(l=t.permission)||void 0===l?void 0:l.canEdit)&&void 0!==z&&z,canViewModel:null!==(R=null==t||null===(s=t.permission)||void 0===s?void 0:s.canView)&&void 0!==R&&R,canApproveModel:null!==(M=null==t||null===(c=t.permission)||void 0===c?void 0:c.canApprove)&&void 0!==M&&M,canIssueStock:b,canReceiveItems:null!==(q=null==t||null===(u=t.permission)||void 0===u?void 0:u.canReceiveItems)&&void 0!==q&&q,canDisplayReceivedItems:null!==(G=null==t||null===(d=t.permission)||void 0===d?void 0:d.canDisplayReceivedItems)&&void 0!==G&&G,canUpdateItemsBatchInformation:null!==(H=null==t||null===(m=t.permission)||void 0===m?void 0:m.canUpdateBatchInformation)&&void 0!==H&&H,canPrint:b||oo(F),sourceTags:y,destinationTags:E,shouldLockDestination:w,shouldLockSource:k,sourcePartyListFilter:function(t){return t.locationUuid&&(null==e?void 0:e.sourceType)===Cr&&(0===y.length||t.tags&&y.some((function(e){return t.tags.includes(e)})))||t.stockSourceUuid&&(null==e?void 0:e.sourceType)===Er},destinationPartyListFilter:function(t){return t.locationUuid&&(null==e?void 0:e.destinationType)===Cr&&(0===E.length||t.tags&&E.some((function(e){return t.tags.includes(e)})))||t.stockSourceUuid&&(null==e?void 0:e.destinationType)===Er},location:S,sourcePartyList:B,destinationPartyList:O,stockOperationTypes:f,hasQtyRequested:_}]}var Y}))},Sr=function(){var t=this,n=arguments;return new Promise((function(o,r){var a=e.apply(t,n);function i(e){wr(a,o,r,i,l,"next",e)}function l(e){wr(a,o,r,i,l,"throw",e)}i(void 0)}))},Sr.apply(this,arguments)}function Br(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function Or(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,r,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(a.push(o.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Br(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Br(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var xr=n(3133);function Dr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Nr=function(e){var t=e.operation,n=(0,E.useTranslation)().t,r=(0,i.useCallback)((function(){var e=(0,o.showModal)("stock-operation-dialog",{title:"Approve",operation:t,requireReason:!1,closeModal:function(){return e()}})}),[t]);return l().createElement(a.zxk,{onClick:r,renderIcon:function(e){return l().createElement(xr.Wz,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),o.forEach((function(t){Dr(e,t,n[t])}))}return e}({size:16},e))}},n("approve","Approve "))};function Ir(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Tr=function(e){var t=e.operation,n=(0,E.useTranslation)().t,r=(0,i.useCallback)((function(){var e=(0,o.showModal)("stock-operation-dialog",{title:"Reject",operation:t,requireReason:!0,closeModal:function(){return e()}})}),[t]);return l().createElement(a.zxk,{onClick:r,kind:"",renderIcon:function(e){return l().createElement(C.wA,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),o.forEach((function(t){Ir(e,t,n[t])}))}return e}({size:16},e))}},n("reject","Reject "))};function Pr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Ur=function(e){var t=e.operation,n=(0,E.useTranslation)().t,r=(0,i.useCallback)((function(){var e=(0,o.showModal)("stock-operation-dialog",{title:"Return",operation:t,requireReason:!0,closeModal:function(){return e()}})}),[t]);return l().createElement(a.zxk,{onClick:r,kind:"tertiary",renderIcon:function(e){return l().createElement(ve.eL,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),o.forEach((function(t){Pr(e,t,n[t])}))}return e}({size:16},e))}},n("return","Return "))};function jr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Fr=function(e){var t=e.operation,n=(0,E.useTranslation)().t,r=(0,i.useCallback)((function(){var e=(0,o.showModal)("stock-operation-dialog",{title:"Cancel",operation:t,requireReason:!0,closeModal:function(){return e()}})}),[t]);return l().createElement(a.zxk,{onClick:r,kind:"danger--ghost",renderIcon:function(e){return l().createElement(dt.jj,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),o.forEach((function(t){jr(e,t,n[t])}))}return e}({size:16},e))}},n("cancel","Cancel "))};function Lr(e,t,n,o,r,a,i){try{var l=e[a](i),s=l.value}catch(e){return void n(e)}l.done?t(s):Promise.resolve(s).then(o,r)}var zr,Rr,Mr=(zr=function(e,t,n,o,r){var a,i,l,s,c,u,d,m,p,A,g;return function(e,t){var n,o,r,a,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,o&&(r=2&a[0]?o.return:a[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,a[1])).done)return r;switch(o=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,o=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((r=(r=i.trys).length>0&&r[r.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){i.label=a[1];break}if(6===a[0]&&i.label<r[1]){i.label=r[1],r=a;break}if(r&&i.label<r[2]){i.label=r[2],i.ops.push(a);break}r[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],o=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}(this,(function(_){return a={},Kn.REQUISITION_OPERATION_TYPE!==e.operationType&&(a.authorizedBy=(null==e?void 0:e.dispatchedDate)?"".concat(null!==(i=e.dispatchedByFamilyName)&&void 0!==i?i:""," ").concat(null!==(l=e.dispatchedByGivenName)&&void 0!==l?l:""):(null==e?void 0:e.completedDate)?"".concat(null!==(s=e.completedByFamilyName)&&void 0!==s?s:""," ").concat(null!==(c=e.completedByGivenName)&&void 0!==c?c:""):""),a.remarks=e.remarks,a.operationNumber=e.operationNumber,a.operationDate=null!==(u=null==n?void 0:n.operationDate)&&void 0!==u?u:null==e?void 0:e.operationDate,a.location=null!==(d=null==n?void 0:n.atLocationName)&&void 0!==d?d:null==e?void 0:e.atLocationName,a.source=null==e?void 0:e.sourceName,a.destination=null==e?void 0:e.destinationName,a.responsiblePerson=a.orderedBy=(null==n?void 0:n.responsiblePersonFamilyName)?"".concat(null!==(m=n.responsiblePersonFamilyName)&&void 0!==m?m:""," ").concat(null!==(p=null==n?void 0:n.responsiblePersonGivenName)&&void 0!==p?p:""):"".concat(null!==(A=e.responsiblePersonFamilyName)&&void 0!==A?A:""," ").concat(null!==(g=e.responsiblePersonGivenName)&&void 0!==g?g:""),a.organizationName="Health Center",a.documentTitle="".concat(e.operationTypeName," ").concat(e.operationNumber).concat(n?" of ".concat(n.operationTypeName," ").concat(n.operationNumber):""),a.items=t.map((function(t){var a={};if(a.itemCode=null==t?void 0:t.acronym,a.itemDescription=null==t?void 0:t.stockItemName,a.purchasePrice=null==t?void 0:t.purchasePrice,a.batchNumber=null==t?void 0:t.batchNo,a.expiryDate=null==t?void 0:t.expiration,n?(a.quantityRequired=null==t?void 0:t.quantityRequested,a.quantityRequiredUoM=null==t?void 0:t.quantityRequestedPackagingUOMName,a.quantityIssued=null==t?void 0:t.quantity,a.quantityIssuedUoM=null==t?void 0:t.stockItemPackagingUOMName):Kn.STOCK_ISSUE_OPERATION_TYPE===e.operationType?(a.quantityIssued=null==t?void 0:t.quantity,a.quantityIssuedUoM=null==t?void 0:t.stockItemPackagingUOMName):(a.quantityRequired=null==t?void 0:t.quantity,a.quantityRequiredUoM=null==t?void 0:t.stockItemPackagingUOMName),o){var i=o.find((function(e){return e.uuid===t.uuid}));i&&(a.unitCost=i.unitCost,a.unitCostUoM=i.unitCostUOMName,a.totalCost=i.totalCost)}if(r){var l=r.find((function(e){return e.stockItemUuid===t.stockItemUuid}));l&&(a.balanceOnHand=l.quantity,a.balanceOnHandUoM=l.quantityUoM)}return a})),[2,a]}))},Rr=function(){var e=this,t=arguments;return new Promise((function(n,o){var r=zr.apply(e,t);function a(e){Lr(r,n,o,a,i,"next",e)}function i(e){Lr(r,n,o,a,i,"throw",e)}a(void 0)}))},function(e,t,n,o,r){return Rr.apply(this,arguments)});function qr(e,t,n,o,r,a,i){try{var l=e[a](i),s=l.value}catch(e){return void n(e)}l.done?t(s):Promise.resolve(s).then(o,r)}function Gr(e){return function(){var t=this,n=arguments;return new Promise((function(o,r){var a=e.apply(t,n);function i(e){qr(a,o,r,i,l,"next",e)}function l(e){qr(a,o,r,i,l,"throw",e)}i(void 0)}))}}function Hr(e,t){var n,o,r,a,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,o&&(r=2&a[0]?o.return:a[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,a[1])).done)return r;switch(o=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,o=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((r=(r=i.trys).length>0&&r[r.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){i.label=a[1];break}if(6===a[0]&&i.label<r[1]){i.label=r[1],r=a;break}if(r&&i.label<r[2]){i.label=r[2],i.ops.push(a);break}r[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],o=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}var Zr=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];return'<html>\n<head>\n<meta http-equiv=Content-Type content="text/html; charset=utf8">\n<title>'.concat(null!=t?t:"","</title>\n<style>\n").concat('\n/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */\n\n/* Document\n ========================================================================== */\n\n/**\n * 1. Correct the line height in all browsers.\n * 2. Prevent adjustments of font size after orientation changes in iOS.\n */\n\nhtml {\n line-height: 1.15; /* 1 */\n -webkit-text-size-adjust: 100%; /* 2 */\n}\n\n/* Sections\n ========================================================================== */\n\n/**\n * Remove the margin in all browsers.\n */\n\nbody {\n margin: 0;\n}\n\n/**\n * Render the main element consistently in IE.\n */\n\nmain {\n display: block;\n}\n\n/**\n * Correct the font size and margin on h1 elements within section and\n * article contexts in Chrome, Firefox, and Safari.\n */\n\nh1 {\n font-size: 2em;\n margin: 0.67em 0;\n}\n\n/* Grouping content\n ========================================================================== */\n\n/**\n * 1. Add the correct box sizing in Firefox.\n * 2. Show the overflow in Edge and IE.\n */\n\nhr {\n box-sizing: content-box; /* 1 */\n height: 0; /* 1 */\n overflow: visible; /* 2 */\n}\n\n/**\n * 1. Correct the inheritance and scaling of font size in all browsers.\n * 2. Correct the odd em font sizing in all browsers.\n */\n\npre {\n font-family: monospace, monospace; /* 1 */\n font-size: 1em; /* 2 */\n}\n\n/* Text-level semantics\n ========================================================================== */\n\n/**\n * Remove the gray background on active links in IE 10.\n */\n\na {\n background-color: transparent;\n}\n\n/**\n * 1. Remove the bottom border in Chrome 57-\n * 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari.\n */\n\nabbr[title] {\n border-bottom: none; /* 1 */\n text-decoration: underline; /* 2 */\n text-decoration: underline dotted; /* 2 */\n}\n\n/**\n * Add the correct font weight in Chrome, Edge, and Safari.\n */\n\nb,\nstrong {\n font-weight: bold;\n}\n\n/**\n * 1. Correct the inheritance and scaling of font size in all browsers.\n * 2. Correct the odd em font sizing in all browsers.\n */\n\ncode,\nkbd,\nsamp {\n font-family: monospace, monospace; /* 1 */\n font-size: 1em; /* 2 */\n}\n\n/**\n * Add the correct font size in all browsers.\n */\n\nsmall {\n font-size: 80%;\n}\n\n/**\n * Prevent sub and sup elements from affecting the line height in\n * all browsers.\n */\n\nsub,\nsup {\n font-size: 75%;\n line-height: 0;\n position: relative;\n vertical-align: baseline;\n}\n\nsub {\n bottom: -0.25em;\n}\n\nsup {\n top: -0.5em;\n}\n\n/* Embedded content\n ========================================================================== */\n\n/**\n * Remove the border on images inside links in IE 10.\n */\n\nimg {\n border-style: none;\n}\n\n/* Forms\n ========================================================================== */\n\n/**\n * 1. Change the font styles in all browsers.\n * 2. Remove the margin in Firefox and Safari.\n */\n\nbutton,\ninput,\noptgroup,\nselect,\ntextarea {\n font-family: inherit; /* 1 */\n font-size: 100%; /* 1 */\n line-height: 1.15; /* 1 */\n margin: 0; /* 2 */\n}\n\n/**\n * Show the overflow in IE.\n * 1. Show the overflow in Edge.\n */\n\nbutton,\ninput { /* 1 */\n overflow: visible;\n}\n\n/**\n * Remove the inheritance of text transform in Edge, Firefox, and IE.\n * 1. Remove the inheritance of text transform in Firefox.\n */\n\nbutton,\nselect { /* 1 */\n text-transform: none;\n}\n\n/**\n * Correct the inability to style clickable types in iOS and Safari.\n */\n\nbutton,\n[type="button"],\n[type="reset"],\n[type="submit"] {\n -webkit-appearance: button;\n}\n\n/**\n * Remove the inner border and padding in Firefox.\n */\n\nbutton::-moz-focus-inner,\n[type="button"]::-moz-focus-inner,\n[type="reset"]::-moz-focus-inner,\n[type="submit"]::-moz-focus-inner {\n border-style: none;\n padding: 0;\n}\n\n/**\n * Restore the focus styles unset by the previous rule.\n */\n\nbutton:-moz-focusring,\n[type="button"]:-moz-focusring,\n[type="reset"]:-moz-focusring,\n[type="submit"]:-moz-focusring {\n outline: 1px dotted ButtonText;\n}\n\n/**\n * Correct the padding in Firefox.\n */\n\nfieldset {\n padding: 0.35em 0.75em 0.625em;\n}\n\n/**\n * 1. Correct the text wrapping in Edge and IE.\n * 2. Correct the color inheritance from fieldset elements in IE.\n * 3. Remove the padding so developers are not caught out when they zero out\n * fieldset elements in all browsers.\n */\n\nlegend {\n box-sizing: border-box; /* 1 */\n color: inherit; /* 2 */\n display: table; /* 1 */\n max-width: 100%; /* 1 */\n padding: 0; /* 3 */\n white-space: normal; /* 1 */\n}\n\n/**\n * Add the correct vertical alignment in Chrome, Firefox, and Opera.\n */\n\nprogress {\n vertical-align: baseline;\n}\n\n/**\n * Remove the default vertical scrollbar in IE 10+.\n */\n\ntextarea {\n overflow: auto;\n}\n\n/**\n * 1. Add the correct box sizing in IE 10.\n * 2. Remove the padding in IE 10.\n */\n\n[type="checkbox"],\n[type="radio"] {\n box-sizing: border-box; /* 1 */\n padding: 0; /* 2 */\n}\n\n/**\n * Correct the cursor style of increment and decrement buttons in Chrome.\n */\n\n[type="number"]::-webkit-inner-spin-button,\n[type="number"]::-webkit-outer-spin-button {\n height: auto;\n}\n\n/**\n * 1. Correct the odd appearance in Chrome and Safari.\n * 2. Correct the outline style in Safari.\n */\n\n[type="search"] {\n -webkit-appearance: textfield; /* 1 */\n outline-offset: -2px; /* 2 */\n}\n\n/**\n * Remove the inner padding in Chrome and Safari on macOS.\n */\n\n[type="search"]::-webkit-search-decoration {\n -webkit-appearance: none;\n}\n\n/**\n * 1. Correct the inability to style clickable types in iOS and Safari.\n * 2. Change font properties to inherit in Safari.\n */\n\n::-webkit-file-upload-button {\n -webkit-appearance: button; /* 1 */\n font: inherit; /* 2 */\n}\n\n/* Interactive\n ========================================================================== */\n\n/*\n * Add the correct display in Edge, IE 10+, and Firefox.\n */\n\ndetails {\n display: block;\n}\n\n/*\n * Add the correct display in all browsers.\n */\n\nsummary {\n display: list-item;\n}\n\n/* Misc\n ========================================================================== */\n\n/**\n * Add the correct display in IE 10+.\n */\n\ntemplate {\n display: none;\n}\n\n/**\n * Add the correct display in IE 10.\n */\n\n[hidden] {\n display: none;\n}\n/*!\n * Gutenberg\n *\n * MIT Fabien Sa\n * https://github.com/BafS/Gutenberg\n */\n\n* {\n -moz-box-sizing: border-box;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n }\n \n *,\n *:before,\n *:after,\n p:first-letter,\n div:first-letter,\n blockquote:first-letter,\n li:first-letter,\n p:first-line,\n div:first-line,\n blockquote:first-line,\n li:first-line {\n background: transparent !important;\n box-shadow: none !important;\n text-shadow: none !important;\n }\n \n html {\n font-size: 16px;\n margin: 0;\n padding: 0;\n }\n \n body {\n -moz-osx-font-smoothing: grayscale;\n -webkit-font-smoothing: antialiased;\n background: #fff !important;\n color: #000 !important;\n font-family: Arial, sans-serif, "Helvetica Neue", Helvetica;\n font-size: 1rem;\n line-height: 1.5;\n margin: 0 auto;\n text-rendering: optimizeLegibility;\n }\n \n p,\n blockquote,\n table,\n ul,\n ol,\n dl {\n margin-bottom: 1.5rem;\n margin-top: 0;\n }\n \n p:last-child,\n ul:last-child,\n ol:last-child {\n margin-bottom: 0;\n }\n \n h1,\n h2,\n h3,\n h4,\n h5,\n h6 {\n color: #000;\n font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;\n line-height: 1.2;\n margin-bottom: 0.75rem;\n margin-top: 0;\n }\n \n h1 {\n font-size: 2.5rem;\n }\n \n h2 {\n font-size: 2rem;\n }\n \n h3 {\n font-size: 1.75rem;\n }\n \n h4 {\n font-size: 1.5rem;\n }\n \n h5 {\n font-size: 1.25rem;\n }\n \n h6 {\n font-size: 1rem;\n }\n \n a,\n a:visited {\n color: #000;\n text-decoration: underline;\n word-wrap: break-word;\n }\n \n table {\n border-collapse: collapse;\n }\n \n thead {\n display: table-header-group;\n }\n \n table,\n th,\n td {\n border-bottom: 1px solid #000;\n }\n \n td,\n th {\n padding: 0px;\n page-break-inside: avoid;\n }\n \n code,\n pre,\n kbd {\n border: 1px solid #bbb;\n font-family: Menlo, Monaco, Consolas, "Courier New", monospace;\n font-size: 85%;\n }\n \n code,\n kbd {\n padding: 3px;\n }\n \n pre {\n margin-bottom: 1.5rem;\n padding: 10px 12px;\n }\n \n pre code,\n pre kbd {\n border: 0;\n }\n \n ::-webkit-input-placeholder {\n color: transparent;\n }\n \n :-moz-placeholder {\n color: transparent;\n }\n \n ::-moz-placeholder {\n color: transparent;\n }\n \n :-ms-input-placeholder {\n color: transparent;\n }\n \n blockquote {\n border: 0;\n border-left: 5px solid #bbb;\n margin-left: 1px;\n padding: 12px 1.5rem;\n }\n \n [dir=\'rtl\'] blockquote {\n border-left: 0;\n border-right: 5px solid #bbb;\n margin-left: 0;\n margin-right: 1px;\n }\n \n blockquote:first-child {\n margin-top: 0;\n }\n \n blockquote p:last-child,\n blockquote ul:last-child,\n blockquote ol:last-child {\n margin-bottom: 0;\n }\n \n blockquote footer {\n display: block;\n font-size: 80%;\n }\n \n img {\n border: 0;\n display: block;\n max-width: 100% !important;\n vertical-align: middle;\n }\n \n hr {\n border: 0;\n border-bottom: 2px solid #bbb;\n height: 0;\n margin: 2.25rem 0;\n padding: 0;\n }\n \n dt {\n font-weight: bold;\n }\n \n dd {\n margin: 0;\n margin-bottom: 0.75rem;\n }\n \n abbr[title],\n acronym[title] {\n border: 0;\n text-decoration: none;\n }\n \n table,\n blockquote,\n pre,\n code,\n figure,\n li,\n hr,\n ul,\n ol,\n a,\n tr {\n page-break-inside: avoid;\n }\n \n h2,\n h3,\n h4,\n p,\n a {\n orphans: 3;\n widows: 3;\n }\n \n h1,\n h2,\n h3,\n h4,\n h5,\n h6 {\n page-break-after: avoid;\n page-break-inside: avoid;\n }\n \n h1+p,\n h2+p,\n h3+p {\n page-break-before: avoid;\n }\n \n img {\n page-break-after: auto;\n page-break-before: auto;\n page-break-inside: avoid;\n }\n \n pre {\n white-space: pre-wrap !important;\n word-wrap: break-word;\n }\n \n body {\n padding-bottom: 1cm;\n padding-left: 1cm;\n padding-right: 1cm;\n padding-top: 0.5cm;\n }\n \n a[href^=\'http\']:after,\n a[href^=\'ftp\']:after {\n content: " (" attr(href) ")";\n font-size: 80%;\n }\n \n a[href$=\'.jpg\']:after,\n a[href$=\'.jpeg\']:after,\n a[href$=\'.gif\']:after,\n a[href$=\'.png\']:after {\n display: none;\n }\n \n abbr[title]:after,\n acronym[title]:after {\n content: " (" attr(title) ")";\n }\n \n .page-break,\n .break-before,\n .page-break-before {\n page-break-before: always;\n }\n \n .break-after,\n .page-break-after {\n page-break-after: always;\n }\n \n .avoid-break-inside {\n page-break-inside: avoid;\n }\n \n .no-print {\n display: none;\n }\n \n a.no-reformat:after {\n content: \'\';\n }\n \n abbr[title].no-reformat:after,\n acronym[title].no-reformat:after {\n content: \'\';\n }\n \n .no-reformat abbr:after,\n .no-reformat acronym:after,\n .no-reformat a:after {\n content: \'\';\n }\n /*Custom CSS*/\n .right {\n display: flex;\n justify-content: flex-end;\n margin-left: auto;\n margin-right: 0;\n } \n .text {\n margin-top:0in;\n margin-right:0in;\n margin-bottom:3.0pt;\n margin-left:0in;\n line-height:106%;\n font-size:12.5pt;\n } \n .logo-row {\n width: 99%;\n }\n .logo {\n width: 120; \n line-height:110%;\n text-align: center;\n margin-top: 4pt;\n }\n .logo img, .logo svg {\n width: 52;\n height: auto;\n }\n span.logo-text {\n font-size:8.0pt;\n display: block;\n white-space:nowrap;\n line-height: 110%;\n margin-top: 4pt;\n } \n .heading, .heading-row {\n margin-left:12.75pt;\n clear: both;\n }\n .heading {\n font-size:14.5pt;\n line-height:102%;\n }\n .heading-row, .heading-row table { \n font-size: 13.5pt;\n }\n .heading-row {\n margin-top: 14pt;\n }\n .heading table, .heading-row table, .heading-row td {\n border: 0;\n }\n .table-data {\n border: 0;\n border-collapse:collapse;\n margin-left:6.95pt;\n font-size:12.5pt;\n width: 99%;\n page-break-inside: auto;\n }\n .table-data td, .table-data th {\n padding:0 5.75pt 0 5.15pt;\n }\n .table-data td, .table-data th {\n border-top:none;\n border-left:none;\n border-right:solid black 1.0pt;\n vertical-align: middle;\n height: 30pt;\n }\n .table-data th {\n border-bottom:double black 1.5pt;\n } \n .table-data td {\n border-bottom:solid black 1.0pt;\n }\n .table-data th:first-child, .table-data td:first-child {\n border-left:solid black 1.0pt;\n } \n .center {\n text-align: center;\n } \n .left {\n text-align: left;\n }\n .table-data tr.footer-field td {\n height:32pt;\n vertical-align: middle;\n }\n @page { size: auto; margin: 0mm; }\n','\n</style>\n</head>\n<body onload="').concat(n?"window.print()":"","\" style='word-wrap:break-word' ").concat(o?'onafterprint="self.close()"':"",">\n ").concat(e,"\n</body>\n</html>")},Yr=function(){var e=Gr((function(){var e,t;return Hr(this,(function(n){switch(n.label){case 0:e=null,n.label=1;case 1:return n.trys.push([1,3,,4]),[4,(o=ne?"".concat(ae).concat(ne):"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",new Promise((function(e,t){var n;if(o){var r=document.getElementById("hdnTxtPrintLogo");if(r&&(null===(n=r.value)||void 0===n?void 0:n.length)>0){var a=r.getAttribute("isSvg");e({image:r.value,isSvg:"1"===a})}else if(o.toLowerCase().endsWith(".svg"))fetch(o,{headers:{"Disable-WWW-Authenticate":"true"}}).then((function(e){if(!e.ok)throw new Error("Print logo fetch network response was not OK");return e.text()})).then((function(t){r&&(r.value=t,r.setAttribute("isSvg","1")),e({image:t,isSvg:!0})})).catch((function(e){console.error("Error fetching print logo: ",e),t("Error fetching print logo")}));else{var i=new Image;i.addEventListener("load",(function(){try{var n=document.createElement("canvas");n.width=i.width,n.height=i.height;var o=n.getContext("2d");if(o){o.drawImage(i,0,0);var a=n.toDataURL("image/png");r&&(r.value=a,r.setAttribute("isSvg","0")),e({image:a,isSvg:!1})}else t("Failed to allocate canvas context for print logo")}catch(e){t(e)}})),i.addEventListener("error",(function(e){t(e)})),i.src=o}}else e(null)})))];case 2:return e=n.sent(),[3,4];case 3:return t=n.sent(),console.info(t),[3,4];case 4:return[2,e||oe?'\n<div class="logo" >\n '.concat(e?e.isSvg?e.image:"<img alt='' src='".concat(e.image,"' />"):"","\n ").concat(oe?"<span class='logo-text text'>".concat(oe,"</span>"):"","\n</div> \n "):""]}var o}))}));return function(){return e.apply(this,arguments)}}(),Qr=function(){var e=Gr((function(){var e;return Hr(this,(function(t){switch(t.label){case 0:return[4,Yr()];case 1:return e=t.sent(),[2,'\n<div class="logo-row right">\n'.concat(e,"\n</div> \n ")]}}))}));return function(){return e.apply(this,arguments)}}(),Wr=function(e){setTimeout((function(){!function(e){var t=window.open("","Print-Window");t&&(t.document.open(),t.document.write(e),t.document.close())}(e)}),300)};function Kr(e,t,n,o,r,a,i){try{var l=e[a](i),s=l.value}catch(e){return void n(e)}l.done?t(s):Promise.resolve(s).then(o,r)}function Jr(e){return function(){var t=this,n=arguments;return new Promise((function(o,r){var a=e.apply(t,n);function i(e){Kr(a,o,r,i,l,"next",e)}function l(e){Kr(a,o,r,i,l,"throw",e)}i(void 0)}))}}function Vr(e,t){var n,o,r,a,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,o&&(r=2&a[0]?o.return:a[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,a[1])).done)return r;switch(o=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,o=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((r=(r=i.trys).length>0&&r[r.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){i.label=a[1];break}if(6===a[0]&&i.label<r[1]){i.label=r[1],r=a;break}if(r&&i.label<r[2]){i.label=r[2],i.ops.push(a);break}r[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],o=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}var Xr=function(){var e=Jr((function(e){var t,n,o,r,a,i,l,s,c;return Vr(this,(function(u){switch(u.label){case 0:return o=Math.max(0,25-(null!==(n=null==e||null===(t=e.items)||void 0===t?void 0:t.length)&&void 0!==n?n:0)),[4,Qr()];case 1:return r=u.sent(),[2,"\n <div>\n ".concat(r,'\n <div class="heading text center" style="text-transform: uppercase;font-size: 20pt;">\n <b>Goods Received Note</b>\n </div>\n <div class="heading-row text">\n <span>Name of Health Unit: </span>\n <b><span>').concat(null!==(a=null==e?void 0:e.organizationName)&&void 0!==a?a:"",'</span></b>\n </div>\n <div class="heading-row text">\n <table style="width:99%" border="0" cellspacing="0" cellpadding="0">\n <tr>\n <td style="text-align: left;">\n <span>Delivered To: </span>\n <b><span>').concat(null!==(i=null==e?void 0:e.location)&&void 0!==i?i:"",'</span></b>\n </td>\n <td style="text-align: right;">\n <span>GRN#: </span>\n <b><span>').concat(null==e?void 0:e.operationNumber,'</span></b>\n </td>\n </tr>\n </table>\n </div>\n <div class="heading-row text">\n <table style="width:99%" border="0" cellspacing="0" cellpadding="0">\n <tr>\n <td style="text-align: left;">\n <span>Received From: </span>\n <b><span>').concat(null!==(l=null==e?void 0:e.source)&&void 0!==l?l:"",'</span></b>\n </td>\n <td style="text-align: right;"> \n <span>Date: </span>\n <b><span>').concat(J(null==e?void 0:e.operationDate),'</span></b>\n </td>\n </tr>\n </table>\n </div>\n <table class="table-data" border="0" cellspacing="0" cellpadding="0"> \n <tr>\n <th valign="middle" class="left" style="border-top:solid black 1.0pt;"><b>Item Code No.</b></th>\n <th valign="middle" class="left" style="border-top:solid black 1.0pt;"><b>Item Description (name, formulation, strength)</b></th>\n <th valign="middle" style="border-top:solid black 1.0pt;"><b>Batch No.</b></th>\n <th valign="middle" style="border-top:solid black 1.0pt;"><b>Expiry</b></th>\n <th valign="middle" style="border-top:solid black 1.0pt;"><b>Quantity</b></th> \n <th valign="middle" style="border-top:solid black 1.0pt;"><b>Purchase Price</b></th>\n </tr> \n ').concat((null==e?void 0:e.items)?null==e?void 0:e.items.map((function(e){var t,n,o,r,a,i,l,s;return'\n <tr class="data-row">\n <td valign="middle">'.concat(null!==(o=e.itemCode)&&void 0!==o?o:"",'</td>\n <td valign="middle">').concat(null!==(r=e.itemDescription)&&void 0!==r?r:"",'</td> \n <td valign="middle" class="center">').concat(null!==(a=e.batchNumber)&&void 0!==a?a:"",'</td> \n <td valign="middle" class="center">').concat(J(e.expiryDate),'</td> \n <td valign="middle" class="center">').concat(null!==(i=null===(t=e.quantityRequired)||void 0===t?void 0:t.toLocaleString())&&void 0!==i?i:""," ").concat(null!==(l=e.quantityRequiredUoM)&&void 0!==l?l:"",'</td>\n <td valign="middle" class="center">').concat(null!==(s=null===(n=e.purchasePrice)||void 0===n?void 0:n.toLocaleString())&&void 0!==s?s:"","</td>\n </tr> \n ")})).join(""):"","\n ").concat(o>0?Array(o).fill(0).map((function(e){return'\n <tr class="data-row">\n <td valign="middle"> </td>\n <td valign="middle"> </td>\n <td valign="middle" class="center"> </td>\n <td valign="middle" class="center"> </td>\n <td valign="middle" class="center"> </td>\n <td valign="middle" class="center"> </td>\n </tr>'})).join(""):"",' \n <tr class="footer-field">\n <td valign="middle" colspan="6" style="border:0;padding-top: 15pt;">\n Remarks:<br/>\n ').concat(null!==(s=null==e?void 0:e.remarks)&&void 0!==s?s:"",'\n </td> \n </tr> \n <tr class="footer-field">\n <td valign="middle" colspan="3" style="border:0;padding-top: 15pt;">\n Received By:<br/>\n <b>').concat(null!==(c=null==e?void 0:e.responsiblePerson)&&void 0!==c?c:"",'</b>\n </td>\n <td valign="middle" colspan="3" style="border:0;padding-top: 15pt;">\n Checked By:<br/>\n \n </td>\n </tr>\n <tr class="footer-field">\n <td valign="middle" colspan="3" style="border:0;"><br/><br/>Signature</td>\n <td valign="middle" colspan="3" style="border:0;"><br/><br/>Signature</td>\n </tr> \n </table> \n </div>\n ')]}}))}));return function(t){return e.apply(this,arguments)}}(),$r=function(){var e=Jr((function(e){var t;return Vr(this,(function(n){switch(n.label){case 0:return[4,Xr(e)];case 1:return t=n.sent(),Wr(Zr(t,null==e?void 0:e.documentTitle,!0,ie)),[2]}}))}));return function(t){return e.apply(this,arguments)}}();function ea(e,t,n,o,r,a,i){try{var l=e[a](i),s=l.value}catch(e){return void n(e)}l.done?t(s):Promise.resolve(s).then(o,r)}function ta(e){return function(){var t=this,n=arguments;return new Promise((function(o,r){var a=e.apply(t,n);function i(e){ea(a,o,r,i,l,"next",e)}function l(e){ea(a,o,r,i,l,"throw",e)}i(void 0)}))}}function na(e,t){var n,o,r,a,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,o&&(r=2&a[0]?o.return:a[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,a[1])).done)return r;switch(o=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,o=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((r=(r=i.trys).length>0&&r[r.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){i.label=a[1];break}if(6===a[0]&&i.label<r[1]){i.label=r[1],r=a;break}if(r&&i.label<r[2]){i.label=r[2],i.ops.push(a);break}r[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],o=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}var oa=function(){var e=ta((function(e){var t,n,o,r,a,i,l,s,c;return na(this,(function(u){switch(u.label){case 0:return o=Math.max(0,25-(null!==(n=null==e||null===(t=e.items)||void 0===t?void 0:t.length)&&void 0!==n?n:0)),[4,Qr()];case 1:return r=u.sent(),[2,"\n <div>\n ".concat(r,'\n <div class="heading text center" style="text-transform: uppercase;font-size: 20pt;">\n <b>Inventory Transfer</b>\n </div>\n <div class="heading-row text">\n <span>Name of Health Unit: </span>\n <b><span>').concat(null!==(a=null==e?void 0:e.organizationName)&&void 0!==a?a:"",'</span></b>\n </div>\n <div class="heading-row text">\n <table style="width:99%" border="0" cellspacing="0" cellpadding="0">\n <tr>\n <td style="text-align: left;">\n <span>Transfer From: </span>\n <b><span>').concat(null!==(i=null==e?void 0:e.location)&&void 0!==i?i:"",'</span></b>\n </td>\n <td style="text-align: right;">\n <span>Transfer#: </span>\n <b><span>').concat(null==e?void 0:e.operationNumber,'</span></b>\n </td>\n </tr>\n </table>\n </div>\n <div class="heading-row text">\n <table style="width:99%" border="0" cellspacing="0" cellpadding="0">\n <tr>\n <td style="text-align: left;">\n <span>Transfer To: </span>\n <b><span>').concat(null!==(l=null==e?void 0:e.destination)&&void 0!==l?l:"",'</span></b>\n </td>\n <td style="text-align: right;"> \n <span>Date: </span>\n <b><span>').concat(J(null==e?void 0:e.operationDate),'</span></b>\n </td>\n </tr>\n </table>\n </div>\n <table class="table-data" border="0" cellspacing="0" cellpadding="0"> \n <tr>\n <th valign="middle" class="left" style="border-top:solid black 1.0pt;"><b>Item Code No.</b></th>\n <th valign="middle" class="left" style="border-top:solid black 1.0pt;"><b>Item Description (name, formulation, strength)</b></th>\n <th valign="middle" style="border-top:solid black 1.0pt;"><b>Batch No.</b></th>\n <th valign="middle" style="border-top:solid black 1.0pt;"><b>Expiry</b></th>\n <th valign="middle" style="border-top:solid black 1.0pt;"><b>Quantity</b></th>\n <th valign="middle" style="border-top:solid black 1.0pt;"><b>Unit Cost</b></th>\n <th valign="middle" style="border-top:solid black 1.0pt;"><b>Total Cost</b></th>\n </tr> \n ').concat((null==e?void 0:e.items)?null==e?void 0:e.items.map((function(e){var t,n,o,r,a,i;return'\n <tr class="data-row">\n <td valign="middle">'.concat(null!==(n=e.itemCode)&&void 0!==n?n:"",'</td>\n <td valign="middle">').concat(null!==(o=e.itemDescription)&&void 0!==o?o:"",'</td> \n <td valign="middle" class="center">').concat(null!==(r=e.batchNumber)&&void 0!==r?r:"",'</td> \n <td valign="middle" class="center">').concat(J(e.expiryDate),'</td> \n <td valign="middle" class="center">').concat(null!==(a=null===(t=e.quantityRequired)||void 0===t?void 0:t.toLocaleString())&&void 0!==a?a:""," ").concat(null!==(i=e.quantityRequiredUoM)&&void 0!==i?i:"",'</td>\n <td valign="middle" class="center">').concat("",'</td>\n <td valign="middle" class="center">').concat("","</td>\n </tr> \n ")})).join(""):"","\n ").concat(o>0?Array(o).fill(0).map((function(e){return'\n <tr class="data-row">\n <td valign="middle"> </td>\n <td valign="middle"> </td>\n <td valign="middle" class="center"> </td>\n <td valign="middle" class="center"> </td>\n <td valign="middle" class="center"> </td>\n <td valign="middle" class="center"> </td>\n <td valign="middle" class="center"> </td>\n </tr>'})).join(""):"",' \n <tr class="footer-field">\n <td valign="middle" colspan="7" style="border:0;padding-top: 15pt;">\n Remarks:<br/>\n ').concat(null!==(s=null==e?void 0:e.remarks)&&void 0!==s?s:"",'\n </td> \n </tr> \n <tr class="footer-field">\n <td valign="middle" colspan="4" style="border:0;padding-top: 15pt;">\n Prepared By:<br/>\n <b>').concat(null!==(c=null==e?void 0:e.responsiblePerson)&&void 0!==c?c:"",'</b>\n </td>\n <td valign="middle" colspan="3" style="border:0;padding-top: 15pt;">\n Authorized By:<br/>\n \n </td>\n </tr>\n <tr class="footer-field">\n <td valign="middle" colspan="4" style="border:0;"><br/><br/>Signature</td>\n <td valign="middle" colspan="3" style="border:0;"><br/><br/>Signature</td>\n </tr> \n </table> \n </div>\n ')]}}))}));return function(t){return e.apply(this,arguments)}}(),ra=function(){var e=ta((function(e){var t;return na(this,(function(n){switch(n.label){case 0:return[4,oa(e)];case 1:return t=n.sent(),Wr(Zr(t,null==e?void 0:e.documentTitle,!0,ie)),[2]}}))}));return function(t){return e.apply(this,arguments)}}();function aa(e,t,n,o,r,a,i){try{var l=e[a](i),s=l.value}catch(e){return void n(e)}l.done?t(s):Promise.resolve(s).then(o,r)}function ia(e){return function(){var t=this,n=arguments;return new Promise((function(o,r){var a=e.apply(t,n);function i(e){aa(a,o,r,i,l,"next",e)}function l(e){aa(a,o,r,i,l,"throw",e)}i(void 0)}))}}function la(e,t){var n,o,r,a,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,o&&(r=2&a[0]?o.return:a[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,a[1])).done)return r;switch(o=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,o=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((r=(r=i.trys).length>0&&r[r.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){i.label=a[1];break}if(6===a[0]&&i.label<r[1]){i.label=r[1],r=a;break}if(r&&i.label<r[2]){i.label=r[2],i.ops.push(a);break}r[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],o=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}var sa=function(){var e=ia((function(e){var t,n,o,r,a,i,l,s;return la(this,(function(c){switch(c.label){case 0:return o=Math.max(0,28-(null!==(n=null==e||null===(t=e.items)||void 0===t?void 0:t.length)&&void 0!==n?n:0)),[4,Qr()];case 1:return r=c.sent(),[2,"\n <div>\n ".concat(r,'\n <div class="heading text">\n <b>HMIS FORM 017: REQUISITION AND ISSUE VOUCHER</b>\n </div>\n <div class="heading-row text">\n <span>Name of Health Unit: </span>\n <b><span>').concat(null!==(a=null==e?void 0:e.organizationName)&&void 0!==a?a:"",'</span></b>\n </div>\n <div class="heading-row text">\n <table style="width:99%" border="0" cellspacing="0" cellpadding="0">\n <tr>\n <td style="text-align: left;">\n <span>Dept/section/ward/dispensary: </span>\n <b><span>').concat(null!==(i=null==e?void 0:e.location)&&void 0!==i?i:"",'</span></b>\n </td>\n <td style="text-align: right;"> \n <span>Date: </span>\n <b><span>').concat(J(null==e?void 0:e.operationDate),'</span></b>\n </td>\n </tr>\n </table>\n </div>\n <table class="table-data" border="0" cellspacing="0" cellpadding="0">\n <tr>\n <td colspan="4" valign="top" style=\'border:solid black 1.0pt;height:40pt\'>\n <div class=\'text\'><b>Ordered by (Name and signature):</b></div>\n <p class=\'text\' style=\'margin-top: 1pt;\'>').concat(null!==(l=e.orderedBy)&&void 0!==l?l:" ","</p>\n </td>\n <td colspan=\"4\" valign=\"top\" style='border:solid black 1.0pt;border-left:none;height:40pt'>\n <div class='text'><b>Authorized by (Name and Signature):</b></div>\n <p class='text' style='margin-top: 1pt;'>").concat(null!==(s=e.authorizedBy)&&void 0!==s?s:" ",'</p>\n </td>\n </tr> \n <tr>\n <th valign="middle" class="left"><b>Item Code No.</b></th>\n <th valign="middle" class="left"><b>Item Description (name, formulation, strength)</b></th>\n <th valign="middle"><b>Balance on Hand</b></th>\n <th valign="middle"><b>Quantity Required</b></th>\n <th valign="middle"><b>Quantity Issued</b></th>\n <th valign="middle"><b>Unit Cost</b></th>\n <th valign="middle"><b>Total Cost</b></th>\n </tr> \n ').concat((null==e?void 0:e.items)?null==e?void 0:e.items.map((function(e){var t,n,o,r,a,i,l,s;return'\n <tr class="data-row">\n <td valign="middle">'.concat(null!==(o=e.itemCode)&&void 0!==o?o:"",'</td>\n <td valign="middle">').concat(null!==(r=e.itemDescription)&&void 0!==r?r:"",'</td>\n <td valign="middle" class="center">').concat("",'</td>\n <td valign="middle" class="center">').concat(null!==(a=null===(t=e.quantityRequired)||void 0===t?void 0:t.toLocaleString())&&void 0!==a?a:""," ").concat(null!==(i=e.quantityRequiredUoM)&&void 0!==i?i:"",'</td>\n <td valign="middle" class="center">').concat(null!==(l=null===(n=e.quantityIssued)||void 0===n?void 0:n.toLocaleString())&&void 0!==l?l:""," ").concat(null!==(s=e.quantityIssuedUoM)&&void 0!==s?s:"",'</td>\n <td valign="middle" class="center">').concat("",'</td>\n <td valign="middle" class="center">').concat("","</td>\n </tr> \n ")})).join(""):"","\n ").concat(o>0?Array(o).fill(0).map((function(e){return'\n <tr class="data-row">\n <td valign="middle"> </td>\n <td valign="middle"> </td>\n <td valign="middle" class="center"> </td>\n <td valign="middle" class="center"> </td>\n <td valign="middle" class="center"> </td>\n <td valign="middle" class="center"> </td>\n <td valign="middle" class="center"> </td>\n </tr>'})).join(""):"",'\n <tr class="footer-field">\n <td valign="middle" colspan="3">Issue date:</td>\n <td valign="middle" colspan="4">Receipt date:</td>\n </tr>\n <tr class="footer-field">\n <td valign="middle" colspan="3">Name & Signature receiver:</td>\n <td valign="middle" colspan="4">Name & Signature issuer:</td>\n </tr>\n </table>\n </div>\n ')]}}))}));return function(t){return e.apply(this,arguments)}}(),ca=function(){var e=ia((function(e){var t;return la(this,(function(n){switch(n.label){case 0:return[4,sa(e)];case 1:return t=n.sent(),Wr(Zr(t,null==e?void 0:e.documentTitle,!0,ie)),[2]}}))}));return function(t){return e.apply(this,arguments)}}();function ua(e,t,n,o,r,a,i){try{var l=e[a](i),s=l.value}catch(e){return void n(e)}l.done?t(s):Promise.resolve(s).then(o,r)}function da(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const ma=function(e){var t=e.operation,n=(0,E.useTranslation)().t,r=((0,o.useConfig)().config,function(){var e=function(e){return function(){var t=this,n=arguments;return new Promise((function(o,r){var a=e.apply(t,n);function i(e){ua(a,o,r,i,l,"next",e)}function l(e){ua(a,o,r,i,l,"throw",e)}i(void 0)}))}}((function(){var e,n,r,a,i,l,s,c;return function(e,t){var n,o,r,a,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,o&&(r=2&a[0]?o.return:a[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,a[1])).done)return r;switch(o=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,o=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((r=(r=i.trys).length>0&&r[r.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){i.label=a[1];break}if(6===a[0]&&i.label<r[1]){i.label=r[1],r=a;break}if(r&&i.label<r[2]){i.label=r[2],i.ops.push(a);break}r[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],o=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}(this,(function(u){switch(u.label){case 0:return u.trys.push([0,10,,11]),n=null,r=null,t.requisitionStockOperationUuid&&(z(t.requisitionStockOperationUuid).then((function(t){t.error||(e=t)})).catch((function(e){e.error})),!e)?[2,null]:((e||"stockissue"===(null==e?void 0:e.operationType)||"transferout"===(null==e?void 0:e.operationType))&&(a={},(null==t?void 0:t.uuid)&&(a.stockOperationUuid=t.uuid),(d=a,m="ws/rest/v1/stockmanagement/stockoperationitemcost?v=default&stockOperationUuid=".concat(d),p=new AbortController,(0,o.openmrsFetch)(m,{method:"GET",headers:{"Content-Type":"application/json"},signal:p.signal})).then((function(e){e.error||(n=null==e?void 0:e.results)})).catch((function(e){e.error}))),(e||"requisition"===(null==e?void 0:e.operationType))&&(i={},null==t||t.uuid,i.locationUuid=t.atLocationUuid,i.stockOperationUuid=t.uuid,i.v=U.Default,i.groupBy="LocationStockItem",i.includeStockItemName="true",i.date=JSON.stringify(null!==(l=null==e?void 0:e.dateCreated)&&void 0!==l?l:null==t?void 0:t.dateCreated),function(e){var t="ws/rest/v1/stockmanagement/stockiteminventory".concat(F(e)),n=new AbortController;return(0,o.openmrsFetch)(t,{method:"GET",headers:{"Content-Type":"application/json"},signal:n.signal})}(i).then((function(e){e.error||(r=null==e?void 0:e.results)})).catch((function(e){e.error}))),[4,Mr(t,t.stockOperationItems,e,n,r)]);case 1:return(s=u.sent())?"receipt"!==(null==t?void 0:t.operationType)?[3,3]:[4,$r(s)]:[3,8];case 2:return u.sent(),[3,7];case 3:return"transferout"!==(null==t?void 0:t.operationType)?[3,5]:[4,ra(s)];case 4:return u.sent(),[3,7];case 5:return[4,ca(s)];case 6:u.sent(),u.label=7;case 7:return[3,9];case 8:console.info(s),u.label=9;case 9:return[3,11];case 10:return c=u.sent(),console.info(c),[3,11];case 11:return[2]}var d,m,p}))}));return function(){return e.apply(this,arguments)}}());return l().createElement(a.zxk,{onClick:r,kind:"tertiary",renderIcon:function(e){return l().createElement(C.FB,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),o.forEach((function(t){da(e,t,n[t])}))}return e}({size:16},e))}},n("print","Print "))};function pa(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Aa=function(e){var t=e.operation,n=(0,E.useTranslation)().t,r=(0,i.useCallback)((function(){var e=(0,o.showModal)("stock-operation-dialog",{title:"Dispatch",operation:t,requireReason:!0,closeModal:function(){return e()}})}),[t]);return l().createElement(a.zxk,{onClick:r,renderIcon:function(e){return l().createElement(ct.bS,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),o.forEach((function(t){pa(e,t,n[t])}))}return e}({size:16},e))}},n("approve","Dispatch"))};function ga(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const _a=function(e){var t=e.operation,n=(0,E.useTranslation)().t,r=(0,i.useCallback)((function(){var e=(0,o.showModal)("stock-operation-dialog",{title:"Complete Dispatch",operation:t,requireReason:!1,closeModal:function(){return e()}})}),[t]);return l().createElement(a.zxk,{onClick:r,renderIcon:function(e){return l().createElement(be.aP,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),o.forEach((function(t){ga(e,t,n[t])}))}return e}({size:16},e))}},n("complete","Complete Dispatch "))};function fa(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const va=function(e){var t=e.operation,n=e.operations,o=(0,E.useTranslation)().t,r={uuid:"",name:"Stock Issue",description:"",operationType:"",hasSource:!1,sourceType:"Location",hasDestination:!1,destinationType:"Location",hasRecipient:!1,recipientRequired:!1,availableWhenReserved:!1,allowExpiredBatchNumbers:!1,stockOperationTypeLocationScopes:[],creator:void 0,dateCreated:void 0,changedBy:void 0,dateChanged:void 0,dateVoided:void 0,voidedBy:void 0,voidReason:"",voided:!1};return l().createElement(a.zxk,{onClick:function(){ja(t,!1,r,n,!1)},kind:"tertiary",renderIcon:function(e){return l().createElement(ct.ei,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),o.forEach((function(t){fa(e,t,n[t])}))}return e}({size:16},e))}},o("issueStock","Issue Stock "))};var ba=n(2496),ha={};ha.styleTagTransform=b(),ha.setAttributes=g(),ha.insert=p().bind(null,"head"),ha.domAPI=d(),ha.insertStyleElement=f(),c()(ba.Z,ha);const ya=ba.Z&&ba.Z.locals?ba.Z.locals:void 0;function ka(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function Ca(e,t,n,o,r,a,i){try{var l=e[a](i),s=l.value}catch(e){return void n(e)}l.done?t(s):Promise.resolve(s).then(o,r)}function Ea(e){return function(){var t=this,n=arguments;return new Promise((function(o,r){var a=e.apply(t,n);function i(e){Ca(a,o,r,i,l,"next",e)}function l(e){Ca(a,o,r,i,l,"throw",e)}i(void 0)}))}}function wa(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Sa(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),o.forEach((function(t){wa(e,t,n[t])}))}return e}function Ba(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n.push.apply(n,o)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}function Oa(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,r,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(a.push(o.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return ka(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ka(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function xa(e,t){var n,o,r,a,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,o&&(r=2&a[0]?o.return:a[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,a[1])).done)return r;switch(o=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,o=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((r=(r=i.trys).length>0&&r[r.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){i.label=a[1];break}if(6===a[0]&&i.label<r[1]){i.label=r[1],r=a;break}if(r&&i.label<r[2]){i.label=r[2],i.ops.push(a);break}r[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],o=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}const Da=function(e){var t,n,r,s,c,u,d,m,p,A,g,_,f,v,b,h,y,k,C,w,S,B,O,x,D,N,I,T,P,U,j,F,L,z,R,M,G,H,Z,Y,W,K,J,V,X,$,ee,te,ne,oe,re,ae,ie,le,se,ce,ue,de,me,pe,Ae,ge,_e,fe,ve,be,he,ye,ke,Ce,Ee,we,Se,Be=(0,E.useTranslation)().t,Oe=e.isEditing,xe=e.canEdit,De=e.canPrint,Ne=function(e){var t=Or((0,i.useState)(!0),2),n=t[0],o=t[1],r=Or((0,i.useState)(!1),2),a=r[0],l=r[1],s=Or((0,i.useState)(),2),c=s[0],u=s[1];return(0,i.useEffect)((function(){o(!0),function(e,t,n){return Sr.apply(this,arguments)}(e.operation,e.model,e.operations).then((function(e){u(e),o(!1)})).catch((function(){l(!0)}))}),[e.model,e.operation,e.operations]),{isLoading:n,isError:a,result:c}}(e),Ie=Ne.isLoading,Te=Ne.isError,Pe=Ne.result,Ue=Oa((0,i.useState)(null==e?void 0:e.isEditing),2),je=Ue[0],Fe=Ue[1],Le=Oa((0,i.useState)(null==e?void 0:e.isEditing),2),ze=Le[0],Re=Le[1],Me=Oa((0,i.useState)(0),2),qe=Me[0],Ge=Me[1];if(Ie)return l().createElement(a.MHR,null);if(Te)return Q(),void(0,o.showToast)({kind:"error",title:Be("error","Error"),description:Be("errorLoadingStockOperation","Error loading stock item"),millis:5e3,critical:!0});var He=[{name:"".concat(Oe?null==e||null===(t=e.model)||void 0===t?void 0:t.operationTypeName:null==e||null===(n=e.operation)||void 0===n?void 0:n.name," Details"),component:l().createElement(zo,Ba(Sa({},e),{isEditing:"Stock Issue"===(null==e||null===(r=e.operation)||void 0===r?void 0:r.name)?!Oe:Oe,setup:Pe,canEdit:"Stock Issue"===(null==e||null===(s=e.operation)||void 0===s?void 0:s.name)?!xe:xe,model:Oe||"Stock Issue"===(null==e||null===(c=e.operation)||void 0===c?void 0:c.name)?null==e?void 0:e.model:null==Pe?void 0:Pe.dto,onSave:Ea((function(){return xa(this,(function(e){return Fe(!0),Ge(1),[2]}))})),operation:e.operation}))},{name:Be("stockItems","Stock Items"),component:l().createElement(gr,Ba(Sa({},e),{isEditing:Oe,setup:Pe,canEdit:xe,model:Oe||"Stock Issue"===(null==e||null===(u=e.operation)||void 0===u?void 0:u.name)?null==e?void 0:e.model:null==Pe?void 0:Pe.dto,onSave:Ea((function(){return xa(this,(function(e){return Re(!0),Ge(2),[2]}))}))})),disabled:!(Oe||je)},{name:(null==Pe?void 0:Pe.requiresDispatchAcknowledgement)?"Submit/Dispatch":"Submit/Complete",component:l().createElement(kr,Ba(Sa({},e),{isEditing:Oe,setup:Pe,canEdit:xe,locked:!1,model:Oe?null==e?void 0:e.model:null==Pe?void 0:Pe.dto,requiresDispatchAcknowledgement:Oe?"return"===(null==e||null===(d=e.model)||void 0===d?void 0:d.operationType)||"issuestock"===(null==e||null===(m=e.model)||void 0===m?void 0:m.operationType):Pe.requiresDispatchAcknowledgement,actions:{onSave:function(){var t=Ea((function(t){return xa(this,(function(n){switch(n.label){case 0:return[4,Ua(t,e.isEditing,e.operation,e.operations,e.canPrint)];case 1:return n.sent(),[2]}}))}));return function(e){return t.apply(this,arguments)}}(),onGoBack:function(){Ge(1)},onComplete:Ea((function(){return xa(this,(function(t){switch(t.label){case 0:return[4,Fa("Complete",!0,null==e?void 0:e.model)];case 1:return t.sent(),[2]}}))})),onSubmit:Ea((function(){return xa(this,(function(t){switch(t.label){case 0:return[4,Fa("Submit",!0,null==e?void 0:e.model)];case 1:return t.sent(),[2]}}))})),onDispatch:Ea((function(){return xa(this,(function(t){switch(t.label){case 0:return[4,Fa("Dispatch",!0,null==e?void 0:e.model)];case 1:return t.sent(),[2]}}))}))}})),disabled:!(e.isEditing||ze)}];return l().createElement(l().Fragment,null,Oe||"Stock Issue"!==e.operation.name?l().createElement("div",{style:{display:"flex",justifyContent:"space-between",margin:"5px"}},l().createElement("div",{style:{margin:"10px"}},Oe&&l().createElement("div",{style:{display:"flex",flexDirection:"row"}},l().createElement("span",{className:ya.textHeading},Be("status","Status "),":"),l().createElement("span",{style:{marginLeft:"2px",color:"".concat(q(null==e||null===(p=e.model)||void 0===p?void 0:p.status))}},null==e||null===(A=e.model)||void 0===A?void 0:A.status)),l().createElement("div",{className:ya.statusContainer},(null==e||null===(g=e.model)||void 0===g?void 0:g.dateCreated)&&l().createElement("div",null,l().createElement("span",{className:ya.textHeading},Be("started","Started"),":"),l().createElement("div",{className:ya.statusDescriptions},l().createElement("span",{className:ya.text},(0,o.formatDate)((0,o.parseDate)(null==e||null===(_=e.model)||void 0===_?void 0:_.dateCreated.toString()),{time:!0,mode:"standard"})),l().createElement("span",{className:ya.text},"By"),l().createElement("span",{className:ya.text},null==e||null===(f=e.model)||void 0===f?void 0:f.creatorFamilyName," ",null==e||null===(v=e.model)||void 0===v?void 0:v.creatorGivenName))),(null==e||null===(b=e.model)||void 0===b?void 0:b.submittedDate)&&l().createElement("div",null,l().createElement("span",{className:ya.textHeading},Be("submitted","Submitted"),":"),l().createElement("div",{className:ya.statusDescriptions},l().createElement("span",{className:ya.text},(0,o.formatDate)((0,o.parseDate)(null==e||null===(h=e.model)||void 0===h?void 0:h.submittedDate.toString()),{time:!0,mode:"standard"})),l().createElement("span",{className:ya.text},"By"),l().createElement("span",{className:ya.text},null==e||null===(y=e.model)||void 0===y?void 0:y.submittedByFamilyName," ",null==e||null===(k=e.model)||void 0===k?void 0:k.submittedByGivenName))),(null==e||null===(C=e.model)||void 0===C?void 0:C.dispatchedDate)&&l().createElement("div",null,l().createElement("span",{className:ya.textHeading},Be("dispatched","Dispatched"),":"),l().createElement("div",{className:ya.statusDescriptions},l().createElement("span",{className:ya.text},(0,o.formatDate)((0,o.parseDate)(null==e||null===(w=e.model)||void 0===w?void 0:w.dispatchedDate.toString()),{time:!0,mode:"standard"})),l().createElement("span",{className:ya.text},"By"),l().createElement("span",{className:ya.text},null==e||null===(S=e.model)||void 0===S?void 0:S.dispatchedByFamilyName," ",null==e||null===(B=e.model)||void 0===B?void 0:B.dispatchedByGivenName))),(null==e||null===(O=e.model)||void 0===O?void 0:O.returnedDate)&&l().createElement("div",null,l().createElement("span",{className:ya.textHeading},Be("returned","Returned"),":"),l().createElement("div",{className:ya.statusDescriptions},l().createElement("span",{className:ya.text},(0,o.formatDate)((0,o.parseDate)(null==e||null===(x=e.model)||void 0===x?void 0:x.returnedDate.toString()),{time:!0,mode:"standard"})),l().createElement("span",{className:ya.text},"By"),l().createElement("span",{className:ya.text},null==e||null===(D=e.model)||void 0===D?void 0:D.returnedByFamilyName," ",null==e||null===(N=e.model)||void 0===N?void 0:N.returnedByGivenName),l().createElement("span",{className:ya.text},null==e||null===(I=e.model)||void 0===I?void 0:I.returnReason))),(null==e||null===(T=e.model)||void 0===T?void 0:T.completedDate)&&l().createElement("div",null,l().createElement("span",{className:ya.textHeading},Be("completed","Completed"),":"),l().createElement("div",{className:ya.statusDescriptions},l().createElement("span",{className:ya.text},(0,o.formatDate)((0,o.parseDate)(null==e||null===(P=e.model)||void 0===P?void 0:P.completedDate.toString()),{time:!0,mode:"standard"})),l().createElement("span",{className:ya.text},"By"),l().createElement("span",{className:ya.text},null==e||null===(U=e.model)||void 0===U?void 0:U.completedByFamilyName," ",null==e||null===(j=e.model)||void 0===j?void 0:j.completedByGivenName))),"CANCELLED"===(null==e||null===(F=e.model)||void 0===F?void 0:F.status)&&l().createElement("div",null,l().createElement("span",{className:ya.textHeading},Be("cancelled","Cancelled"),":"),l().createElement("div",{className:ya.statusDescriptions},l().createElement("span",{className:ya.text},(0,o.formatDate)((0,o.parseDate)(null==e||null===(L=e.model)||void 0===L?void 0:L.cancelledDate.toString()),{time:!0,mode:"standard"})),l().createElement("span",{className:ya.text},"By"),l().createElement("span",{className:ya.text},null==e||null===(z=e.model)||void 0===z?void 0:z.cancelledByFamilyName," ",null==e||null===(R=e.model)||void 0===R?void 0:R.cancelledByGivenName,l().createElement("span",{className:ya.text},null==e||null===(M=e.model)||void 0===M?void 0:M.cancelReason)))),"REJECTED"===(null==e||null===(G=e.model)||void 0===G?void 0:G.status)&&l().createElement("div",null,l().createElement("span",{className:ya.textHeading},Be("rejected","Rejected"),":"),l().createElement("div",{className:ya.statusDescriptions},l().createElement("span",{className:ya.text},(0,o.formatDate)((0,o.parseDate)(null==e||null===(H=e.model)||void 0===H?void 0:H.rejectedDate.toString()),{time:!0,mode:"standard"})),l().createElement("span",{className:ya.text},"By"),l().createElement("span",{className:ya.text},null==e||null===(Z=e.model)||void 0===Z?void 0:Z.rejectedByFamilyName," ",null==e||null===(Y=e.model)||void 0===Y?void 0:Y.rejectedByGivenName,l().createElement("span",null,null==e||null===(W=e.model)||void 0===W?void 0:W.rejectionReason)))))),(!(null==e||null===(J=e.model)||void 0===J||null===(K=J.permission)||void 0===K?void 0:K.canEdit)&&((null==e||null===(X=e.model)||void 0===X||null===(V=X.permission)||void 0===V?void 0:V.canApprove)||(null==e||null===(ee=e.model)||void 0===ee||null===($=ee.permission)||void 0===$?void 0:$.canReceiveItems))||(null==e||null===(ne=e.model)||void 0===ne||null===(te=ne.permission)||void 0===te?void 0:te.canEdit)||De||(null==e||null===(re=e.model)||void 0===re||null===(oe=re.permission)||void 0===oe?void 0:oe.isRequisitionAndCanIssueStock))&&l().createElement("div",{style:{margin:"10px",display:"flex",flexDirection:"row"}},l().createElement(l().Fragment,null,!(null==e||null===(ie=e.model)||void 0===ie||null===(ae=ie.permission)||void 0===ae?void 0:ae.canEdit)&&(null==e||null===(se=e.model)||void 0===se||null===(le=se.permission)||void 0===le?void 0:le.canApprove)&&l().createElement(l().Fragment,null,(!(null==e?void 0:e.model)||(null==e||null===(ce=e.model)||void 0===ce?void 0:ce.operationTypeName)===Kn.RETURN_OPERATION_TYPE||(null==e||null===(ue=e.model)||void 0===ue?void 0:ue.operationTypeName)===Kn.STOCK_ISSUE_OPERATION_TYPE)&&l().createElement("div",{style:{margin:"2px"}},l().createElement(Nr,{operation:null==e?void 0:e.model})),!(!(null==e?void 0:e.model)||(null==e||null===(de=e.model)||void 0===de?void 0:de.operationTypeName)===Kn.RETURN_OPERATION_TYPE||(null==e||null===(me=e.model)||void 0===me?void 0:me.operationTypeName)===Kn.STOCK_ISSUE_OPERATION_TYPE)&&l().createElement("div",{style:{margin:"2px"}},l().createElement(Aa,{operation:null==e?void 0:e.model})),l().createElement("div",{style:{margin:"2px"}},l().createElement(Tr,{operation:null==e?void 0:e.model})),l().createElement("div",{style:{margin:"2px"}},l().createElement(Ur,{operation:null==e?void 0:e.model})),l().createElement("div",{style:{margin:"2px"}},l().createElement(Fr,{operation:null==e?void 0:e.model}))),!(null==e||null===(Ae=e.model)||void 0===Ae||null===(pe=Ae.permission)||void 0===pe?void 0:pe.canEdit)&&(null==e||null===(_e=e.model)||void 0===_e||null===(ge=_e.permission)||void 0===ge?void 0:ge.canReceiveItems)&&l().createElement(l().Fragment,null,l().createElement("div",{style:{margin:"2px"}},l().createElement(_a,{operation:null==e?void 0:e.model})),l().createElement("div",{style:{margin:"2px"}},l().createElement(Ur,{operation:null==e?void 0:e.model}))),(null==e||null===(ve=e.model)||void 0===ve||null===(fe=ve.permission)||void 0===fe?void 0:fe.canEdit)&&l().createElement("div",{style:{margin:"2px"}},l().createElement(Fr,{operation:null==e?void 0:e.model})),(null==e||null===(he=e.model)||void 0===he||null===(be=he.permission)||void 0===be?void 0:be.isRequisitionAndCanIssueStock)&&l().createElement("div",{style:{margin:"2px"}},l().createElement(va,{operation:null==e?void 0:e.model,operations:void 0})),((null==e||null===(ke=e.model)||void 0===ke||null===(ye=ke.permission)||void 0===ye?void 0:ye.isRequisitionAndCanIssueStock)||(null==e||null===(Ce=e.model)||void 0===Ce?void 0:Ce.operationType)===Kn.STOCK_ISSUE_OPERATION_TYPE||(null==e||null===(Ee=e.model)||void 0===Ee?void 0:Ee.operationType)===Kn.REQUISITION_OPERATION_TYPE||(null==e||null===(we=e.model)||void 0===we?void 0:we.operationType)===Kn.RECEIPT_OPERATION_TYPE||(null==e||null===(Se=e.model)||void 0===Se?void 0:Se.operationType)===Kn.TRANSFER_OUT_OPERATION_TYPE)&&l().createElement("div",{style:{margin:"2px"}},l().createElement(ma,{operation:null==e?void 0:e.model}))))):l().createElement(l().Fragment,null),l().createElement(To,null,l().createElement(Wn,{tabs:He,selectedIndex:qe,onChange:Ge})))};var Na=function(e){(0,j.JG)((function(t){return"string"==typeof t&&t.startsWith(e)}),void 0,{revalidate:!0})};function Ia(e,t,n,o,r,a,i){try{var l=e[a](i),s=l.value}catch(e){return void n(e)}l.done?t(s):Promise.resolve(s).then(o,r)}function Ta(e){return function(){var t=this,n=arguments;return new Promise((function(o,r){var a=e.apply(t,n);function i(e){Ia(a,o,r,i,l,"next",e)}function l(e){Ia(a,o,r,i,l,"throw",e)}i(void 0)}))}}function Pa(e,t){var n,o,r,a,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,o&&(r=2&a[0]?o.return:a[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,a[1])).done)return r;switch(o=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,o=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((r=(r=i.trys).length>0&&r[r.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){i.label=a[1];break}if(6===a[0]&&i.label<r[1]){i.label=r[1],r=a;break}if(r&&i.label<r[2]){i.label=r[2],i.ops.push(a);break}r[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],o=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}var Ua=function(){var e=Ta((function(e,t,n,r,a){var i,l,s,c;return Pa(this,(function(r){switch(r.label){case 0:i=e,r.label=1;case 1:return r.trys.push([1,3,,4]),"requisition"===n.operationType&&delete i.destinationName,[4,(t?M:R)(i)];case 2:return(null==(l=r.sent())?void 0:l.data)&&(Na("ws/rest/v1/stockmanagement/stockoperation"),(0,o.showToast)({critical:!0,title:"".concat(t?"Edit":"Add"," Stock Operation"),kind:"success",description:"Stock Operation ".concat(t?"Edited":"Added"," Successfully")}),Q()),[3,4];case 3:return s=r.sent(),c=le(s),(0,o.showNotification)({description:c.join(", "),title:"Error on saving form",kind:"error",critical:!0}),[3,4];case 4:return[2]}}))}));return function(t,n,o,r,a){return e.apply(this,arguments)}}(),ja=function(e,t,n,o,r){Y("".concat(t?"Edit":"New: "," ").concat(t?null==e?void 0:e.operationTypeName:null==n?void 0:n.name),l().createElement(Da,{model:e,onSave:function(e){return Ua(e,t,n,o,r)},isEditing:t,operation:n,canEdit:!t||"NEW"===(null==e?void 0:e.status)}))},Fa=function(){var e=Ta((function(e,t,n){var r;return Pa(this,(function(a){return r=(0,o.showModal)("stock-operation-dialog",{title:e,operation:n,requireReason:t,closeModal:function(){return r()}}),[2]}))}));return function(t,n,o){return e.apply(this,arguments)}}();function La(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}const za=function(e){var t,n,o=e.operationUuid,r=e.operationNumber,s=e.model,c=e.operations,u=(t=(0,i.useState)(null),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,r,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(a.push(o.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw r}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return La(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?La(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),d=u[0],m=u[1];o&&!d&&z(o).then((function(e){return m(e.data)})).catch((function(e){return console.error("Error fetching stock operation:",e)}));var p={uuid:"",name:"",description:"",operationType:"",hasSource:!1,sourceType:"Location",hasDestination:!1,destinationType:"Location",hasRecipient:!1,recipientRequired:!1,availableWhenReserved:!1,allowExpiredBatchNumbers:!1,stockOperationTypeLocationScopes:[],creator:void 0,dateCreated:void 0,changedBy:void 0,dateChanged:void 0,dateVoided:void 0,voidedBy:void 0,voidReason:"",voided:!1};return l().createElement(l().Fragment,null,l().createElement(a.zxk,{type:"button",size:"sm",className:"submitButton clear-padding-margin",iconDescription:"View",kind:"ghost",onClick:function(){ja(null!=s?s:d,!0,p,c,!1)}},r||"".concat(null==s?void 0:s.operationNumber)))};function Ra(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ma(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),o.forEach((function(t){Ra(e,t,n[t])}))}return e}function qa(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n.push.apply(n,o)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}const Ga=function(){var e,t=(0,E.useTranslation)().t,n=(0,i.useMemo)((function(){return{uuid:"",name:"",description:"",operationType:"",hasSource:!1,sourceType:"Location",hasDestination:!1,destinationType:"Location",hasRecipient:!1,recipientRequired:!1,availableWhenReserved:!1,allowExpiredBatchNumbers:!1,stockOperationTypeLocationScopes:[],creator:void 0,dateCreated:void 0,changedBy:void 0,dateChanged:void 0,dateVoided:void 0,voidedBy:void 0,voidReason:"",voided:!1}}),[]),r=Pn({v:U.Full,totalCount:!0}),s=r.items,c=r.tableHeaders,u=r.currentPage,d=r.pageSizes,m=r.totalItems,p=r.goTo,A=r.currentPageSize,g=r.setPageSize,_=r.isLoading,f=function(){var e=(0,o.showModal)("stock-operation-dialog",{title:"complete",operation:n,requireReason:"",closeModal:function(){return e()}});Na("ws/rest/v1/stockmanagement/stockoperation")},v=(0,i.useMemo)((function(){return null==s?void 0:s.map((function(t,o){var r,i,c,u,d,m,p,A,g,_,v,b,h,y,k,C,E,w,S;return qa(Ma({},t),{id:null==t?void 0:t.uuid,key:"key-".concat(null==t?void 0:t.uuid),operationTypeName:"".concat(null==t?void 0:t.operationTypeName),operationNumber:l().createElement(za,{model:s[o],operations:e}),status:"".concat(null==t?void 0:t.status),source:"".concat(null!==(r=null==t?void 0:t.sourceName)&&void 0!==r?r:""),destination:"".concat(null!==(i=null==t?void 0:t.destinationName)&&void 0!==i?i:""),location:l().createElement(l().Fragment,null," ",null!==(c=null==t?void 0:t.sourceName)&&void 0!==c?c:""," ",(null==t?void 0:t.sourceName)&&(null==t?void 0:t.destinationName)?l().createElement(be.ol,{size:16}):""," ",null!==(u=null==t?void 0:t.destinationName)&&void 0!==u?u:""," "),responsiblePerson:"".concat(null!==(m=null!==(d=null==t?void 0:t.responsiblePersonFamilyName)&&void 0!==d?d:null==t?void 0:t.responsiblePersonOther)&&void 0!==m?m:""," ").concat(null!==(p=null==t?void 0:t.responsiblePersonGivenName)&&void 0!==p?p:""),operationDate:J(null==t?void 0:t.operationDate),details:l().createElement("div",{className:"tbl-expand-display-fields"},l().createElement("div",{className:"field-label"},l().createElement("span",{className:"field-title"},"Created"),l().createElement("span",{className:"field-desc"},l().createElement("span",{className:"action-date"},J(null==t?void 0:t.dateCreated))," ","By",l().createElement("span",{className:"action-by"},null!==(A=t.creatorFamilyName)&&void 0!==A?A:""," ",null!==(g=t.creatorGivenName)&&void 0!==g?g:""))),"NEW"!==(null==t?void 0:t.status)&&(null==t?void 0:t.status)!==Ln&&(null==t?void 0:t.submittedDate)&&l().createElement("div",{className:"field-label"},l().createElement("span",{className:"field-title"},"Submitted"),l().createElement("span",{className:"field-desc"},l().createElement("span",{className:"action-date"},J(null==t?void 0:t.submittedDate))," ","By",l().createElement("span",{className:"action-by"},null!==(_=t.submittedByFamilyName)&&void 0!==_?_:""," ",null!==(v=t.submittedByGivenName)&&void 0!==v?v:""))),(null==t?void 0:t.completedDate)&&l().createElement("div",{className:"field-label"},l().createElement("span",{className:"field-title"},"Completed"),l().createElement("span",{className:"field-desc"},l().createElement("span",{className:"action-date"},J(null==t?void 0:t.completedDate))," ","By",l().createElement("span",{className:"action-by"},null!==(b=t.completedByFamilyName)&&void 0!==b?b:""," ",null!==(h=t.completedByGivenName)&&void 0!==h?h:""))),(null==t?void 0:t.status)===zn&&l().createElement("div",{className:"field-label"},l().createElement("span",{className:"field-title"},"Cancelled"),l().createElement("span",{className:"field-desc"},l().createElement("span",{className:"action-date"},J(null==t?void 0:t.cancelledDate))," ","By",l().createElement("span",{className:"action-by"},null!==(y=t.cancelledByFamilyName)&&void 0!==y?y:""," ",null!==(k=t.cancelledByGivenName)&&void 0!==k?k:""),l().createElement("p",null,t.cancelReason))),(null==t?void 0:t.status)===Rn&&l().createElement("div",{className:"field-label"},l().createElement("span",{className:"field-title"},"Rejected"),l().createElement("span",{className:"field-desc"},l().createElement("span",{className:"action-date"},J(null==t?void 0:t.rejectedDate))," ","By",l().createElement("span",{className:"action-by"},null!==(C=t.rejectedByFamilyName)&&void 0!==C?C:""," ",null!==(E=t.rejectedByGivenName)&&void 0!==E?E:""),l().createElement("p",null,t.rejectionReason))),(null==t?void 0:t.status)===Ln&&l().createElement("div",{className:"field-label"},l().createElement("span",{className:"field-title"},"Returned"),l().createElement("span",{className:"field-desc"},l().createElement("span",{className:"action-date"},J(null==t?void 0:t.returnedDate))," ","By",l().createElement("span",{className:"action-by"},null!==(w=t.returnedByFamilyName)&&void 0!==w?w:""," ",null!==(S=t.returnedByGivenName)&&void 0!==S?S:""),l().createElement("p",null,t.returnReason)))),actions:l().createElement(a.PQB,{flipped:"true","aria-label":"overflow-menu"},l().createElement(a.laM,{itemText:"Complete",onClick:f}),l().createElement(a.laM,{itemText:"Edit",onClick:function(){ja(s[o],!0,n,e,!1)}}))})}))}),[f,s,n,e]);return _?l().createElement(a.gqd,{className:Fn.dataTableSkeleton,showHeader:!1,rowCount:5,columnCount:5,zebra:!0}):l().createElement("div",{className:Fn.tableOverride},l().createElement(a.x45,null,t("Stock operations to track movement of stock.")),l().createElement("div",{id:"table-tool-bar"},l().createElement("div",null),l().createElement("div",{className:"right-filters"})),l().createElement(a.wQF,{rows:v,headers:c,isSortable:!0,useZebraStyles:!0,render:function(n){var r=n.rows,i=n.headers,c=n.getHeaderProps,u=n.getTableProps,d=n.getRowProps,m=n.onInputChange;return l().createElement(a.xJi,null,l().createElement(a.fjU,{style:{position:"static",overflow:"visible",backgroundColor:"color"}},l().createElement(a.Vj0,{className:Fn.toolbarContent},l().createElement(a.Ys1,{className:Fn.patientListSearch,expanded:!0,onChange:m,placeholder:"Filter Table",size:"sm"}),l().createElement(Hn,{onOperationTypeSelected:function(t){ja(yo(),!1,t,e,!1)},onOperationLoaded:function(t){e=t}}))),l().createElement(a.iA_,u(),l().createElement(a.ssF,null,l().createElement(a.SCH,null,l().createElement(a.MOD,null),i.map((function(e){var t,n;return"details"!==e.key&&l().createElement(a.xDH,qa(Ma({},c({header:e,isSortable:e.isSortable})),{className:o.isDesktop?Fn.desktopHeader:Fn.tabletHeader,key:"".concat(e.key)}),null!==(n=null===(t=e.header)||void 0===t?void 0:t.content)&&void 0!==n?n:e.header)})),l().createElement(a.xDH,null))),l().createElement(a.RMI,null,r.map((function(e,n){var r,c,u,m,p,A,g,_,f,v,b,h,y,k,C,E,w,S,B,O,x,D,N,I,T,P,U,j,F,L;return l().createElement(l().Fragment,{key:e.id},l().createElement(a.RcE,Ma({className:o.isDesktop?Fn.desktopRow:Fn.tabletRow},d({row:e})),e.cells.map((function(e){var t;return"details"!==(null==e||null===(t=e.info)||void 0===t?void 0:t.header)&&l().createElement(a.pj1,{key:e.id},e.value)}))),l().createElement(a.WdL,{colSpan:i.length+2},l().createElement(l().Fragment,null,l().createElement(a.SmK,null,l().createElement(a.s1N,{head:!0},l().createElement(a.agF,{head:!0},t("dateCreated","Date Created")),l().createElement(a.agF,{head:!0},t("dateCompleted","Date Completed")),l().createElement(a.agF,{head:!0},t("batchNumber","Batch Number")),l().createElement(a.agF,{head:!0},"Qty"))),l().createElement(a.FxI,null,l().createElement(a.s1N,null,l().createElement(a.agF,{noWrap:!0},(null===(r=s[n])||void 0===r?void 0:r.dateCreated)?J(null===(c=s[n])||void 0===c?void 0:c.dateCreated):""," ",(null===(u=s[n])||void 0===u?void 0:u.dateCreated)?"By":""," ",(null===(m=s[n])||void 0===m?void 0:m.dateCreated)?null===(p=s[n])||void 0===p?void 0:p.creatorFamilyName:""),l().createElement(a.agF,null,(null===(A=s[n])||void 0===A?void 0:A.completedDate)?J(null===(g=s[n])||void 0===g?void 0:g.completedDate):""," ",(null===(_=s[n])||void 0===_?void 0:_.completedDate)?"By":""," ",(null===(f=s[n])||void 0===f?void 0:f.completedDate)?null===(v=s[n])||void 0===v?void 0:v.creatorFamilyName:""),l().createElement(a.agF,null,(null===(b=s[n])||void 0===b?void 0:b.stockOperationItems)?null===(h=s[n].stockOperationItems)||void 0===h?void 0:h.map((function(e){return e.batchNo}))[0]:""),l().createElement(a.agF,null,(null===(y=s[n])||void 0===y?void 0:y.stockOperationItems)?null===(k=s[n].stockOperationItems)||void 0===k?void 0:k.map((function(e){return e.quantity}))[0]:"")),l().createElement(a.s1N,null,l().createElement(a.agF,{noWrap:!0},(null===(C=s[n])||void 0===C?void 0:C.stockOperationItems.map((function(e){return e.quantity}))[1])?J(null===(E=s[n])||void 0===E?void 0:E.dateCreated):""," ",(null===(w=s[n])||void 0===w?void 0:w.stockOperationItems.map((function(e){return e.quantity}))[1])?"By":""," ",(null===(S=s[n])||void 0===S?void 0:S.stockOperationItems.map((function(e){return e.quantity}))[1])?null===(B=s[n])||void 0===B?void 0:B.creatorFamilyName:""),l().createElement(a.agF,null,(null===(O=s[n])||void 0===O?void 0:O.stockOperationItems.map((function(e){return e.quantity}))[1])?J(null===(x=s[n])||void 0===x?void 0:x.completedDate):""," ",(null===(D=s[n])||void 0===D?void 0:D.stockOperationItems.map((function(e){return e.quantity}))[1])&&(null===(N=s[n])||void 0===N?void 0:N.completedDate)?"By":""," ",(null===(I=s[n])||void 0===I?void 0:I.stockOperationItems.map((function(e){return e.quantity}))[1])&&(null===(T=s[n])||void 0===T?void 0:T.completedDate)?null===(P=s[n])||void 0===P?void 0:P.creatorFamilyName:""),l().createElement(a.agF,null,(null===(U=s[n])||void 0===U?void 0:U.stockOperationItems)?null===(j=s[n].stockOperationItems)||void 0===j?void 0:j.map((function(e){return e.batchNo}))[1]:""),l().createElement(a.agF,null,(null===(F=s[n])||void 0===F?void 0:F.stockOperationItems)?null===(L=s[n].stockOperationItems)||void 0===L?void 0:L.map((function(e){return e.quantity}))[1]:""))))))})))),0===r.length?l().createElement("div",{className:Fn.tileContainer},l().createElement(a.n9L,{className:Fn.tile},l().createElement("div",{className:Fn.tileContent},l().createElement("p",{className:Fn.content},t("noOperationsToDisplay","No Stock Items to display")),l().createElement("p",{className:Fn.helper},t("checkFilters","Check the filters above"))))):null)}}),l().createElement(a.tlE,{page:u,pageSize:A,pageSizes:d,totalItems:m,onChange:function(e){var t=e.pageSize,n=e.page;t!==A&&g(t),n!==u&&p(n)},className:Fn.paginationOverride}))},Ha=function(){return l().createElement("div",{style:{margin:"5px"}},l().createElement(Ga,null))};var Za={uuid:void 0,isDrug:void 0,drugUuid:void 0,drugName:void 0,conceptUuid:void 0,commonName:void 0,acronym:void 0,conceptName:void 0,hasExpiration:void 0,preferredVendorUuid:void 0,preferredVendorName:void 0,purchasePrice:void 0,purchasePriceUoMUuid:void 0,purchasePriceUoMName:void 0,dispensingUnitName:void 0,dispensingUnitUuid:void 0,dispensingUnitPackagingUoMUuid:void 0,dispensingUnitPackagingUoMName:void 0,defaultStockOperationsUoMUuid:void 0,defaultStockOperationsUoMName:void 0,reorderLevel:void 0,reorderLevelUoMUuid:void 0,reorderLevelUoMName:void 0,dateCreated:void 0,creatorGivenName:void 0,creatorFamilyName:void 0,voided:void 0,packagingUnits:void 0,permission:void 0,categoryUuid:void 0,categoryName:void 0,expiryNotice:void 0};function Ya(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function Qa(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,r,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(a.push(o.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Ya(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ya(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Wa(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function Ka(e){return e?"".concat(e.name).concat(e.concept?" (".concat(e.concept.display,")"):""):""}const Ja=function(e){var t,n,r=function(e){var t=Qa((0,i.useState)(e||{v:U.Default,startIndex:0}),2),n=t[0],r=(t[1],function(e){var t="ws/rest/v1/drug".concat(F(e)),n=(0,j.ZP)(t,o.openmrsFetch),r=n.data,a=n.error,i=n.isLoading;return{items:(null==r?void 0:r.data)||{},isLoading:i,isError:a}}(n)),a=r.items.results,l=r.isLoading,s=Qa((0,i.useState)(""),2),c=s[0],u=s[1],d=Qa((0,i.useState)((null==e?void 0:e.limit)||10),2),m=d[0],p=d[1],A=Qa((0,i.useState)((null==e?void 0:e.v)||U.Default),2),g=A[0],_=A[1];return(0,i.useEffect)((function(){}),[c,m,g]),{drugList:a,setLimit:p,setRepresentation:_,setSearchString:u,isLoading:l}}(),s=r.isLoading,c=r.drugList,u=(t=(0,i.useState)(""),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,r,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(a.push(o.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw r}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return Wa(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Wa(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),d=u[0],m=u[1],p=(0,i.useMemo)((function(){return""===d.trim()?c:c.filter((function(e){return e.name.toLowerCase().includes(d.trim().toLowerCase())}))}),[d,c]);return l().createElement("div",null,l().createElement(lo.Qr,{name:e.controllerName,control:e.control,render:function(t){var n,o=t.field,r=o.onChange,i=o.ref;return l().createElement(a.CtY,{titleText:e.title,name:e.name,control:e.control,controllerName:e.controllerName,id:e.name,size:"md",items:p||[],initialSelectedItem:null!==(n=null==c?void 0:c.find((function(t){return t.uuid===e.drugUuid})))&&void 0!==n?n:"",itemToString:Ka,onChange:function(t){var n;null===(n=e.onDrugChanged)||void 0===n||n.call(e,t.selectedItem),r(t.selectedItem.uuid)},onInputChange:function(e){m(e)},inputValue:d,placeholder:e.placeholder,invalid:e.invalid,invalidText:e.invalidText,ref:i})}}),s&&l().createElement(a.lSo,{status:"active",iconDescription:"Searching",description:"Searching..."}))};var Va=co.z.string().max(255).nullish(),Xa=co.z.object({isDrug:co.z.boolean(),drugUuid:co.z.string().nullish(),drugName:co.z.string().nullish(),commonName:Va,acronym:Va,hasExpiration:co.z.boolean(),expiryNotice:co.z.coerce.number().nullish(),uuid:co.z.string().nullish(),conceptUuid:co.z.string().nullish(),conceptName:co.z.string().nullish(),preferredVendorUuid:co.z.string().nullish(),preferredVendorName:co.z.string().nullish(),purchasePrice:co.z.number().nullish(),purchasePriceUoMUuid:co.z.string().nullish(),purchasePriceUoMName:co.z.string().nullish(),categoryUuid:co.z.string().nullish(),categoryName:co.z.string().nullish(),dispensingUnitUuid:co.z.string().nullish(),dispensingUnitName:co.z.string().nullish(),dispensingUnitPackagingUoMUuid:co.z.string().nullish(),dispensingUnitPackagingUoMName:co.z.string().nullish(),defaultStockOperationsUoMUuid:co.z.string().nullish(),defaultStockOperationsUoMName:co.z.string().nullish(),reorderLevel:co.z.number().nullish(),reorderLevelUoMUuid:co.z.string().nullish(),reorderLevelUoMName:co.z.string().nullish(),dateCreated:co.z.coerce.date().nullish(),creatorGivenName:co.z.string().nullish(),creatorFamilyName:co.z.string().nullish(),voided:co.z.boolean().nullish()}).refine((function(e){var t=e.isDrug,n=e.drugUuid;return!t||!!n}),{message:"Drug required",path:["drugUuid"]}).refine((function(e){var t=e.isDrug,n=e.dispensingUnitUuid;return!t||!!n}),{message:"Dispensing Unit required",path:["dispensingUnitUuid"]}).refine((function(e){var t=e.hasExpiration,n=e.expiryNotice;return!t||!!n}),{message:"Expiry Notice required",path:["expiryNotice"]});function $a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const ei=function(e){return l().createElement(lo.Qr,{name:e.controllerName,control:e.control,render:function(t){var n,o,r=t.field,i=r.onChange,s=r.value,c=r.ref;return l().createElement(a.SYO,(n=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),o.forEach((function(t){$a(e,t,n[t])}))}return e}({},e),o=null!=(o={onChange:function(t,n,o){i(t,n,o),e.onChange&&e.onChange(t,n,o)},id:e.name,ref:c,defaultSelected:e.id,value:s})?o:{},Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(o)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n.push.apply(n,o)}return n}(Object(o)).forEach((function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(o,e))})),n),e.options.map((function(t,n){return l().createElement(a.EUY,{key:"".concat(n,"-").concat(e.name,"-").concat(t.value),id:"".concat(e.name,"-").concat(t.value),labelText:t.label,value:t.value,checked:s===t.value,onChange:function(){return i(t.value)},ref:c})})))}})},ti=function(e){return l().createElement(lo.Qr,{name:e.controllerName,control:e.control,render:function(t){var n,o,r,i,s=t.field,c=s.onChange,u=s.value,d=s.ref;return l().createElement(a.Y2U,{id:"".concat(e.name,"-").concat(null===(n=e.row)||void 0===n?void 0:n.id,"-").concat(null===(o=e.row)||void 0===o?void 0:o.uuid),value:null!==(i=null===(r=e.row)||void 0===r?void 0:r.factor)&&void 0!==i?i:u,ref:d,onChange:function(t,n){c(t,n),e.onChange&&e.onChange(t,n)}})}})},ni=function(e){var t=Ot("162402AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"),n=t.items.setMembers;return t.isLoading?l().createElement(a.znL,null):l().createElement(lo.Qr,{name:e.controllerName,control:e.control,render:function(t){var o,r,i=t.field,s=i.onChange,c=i.value,u=i.ref;return l().createElement(a.CtY,{titleText:e.title,name:e.name,control:e.control,controllerName:e.controllerName,id:e.name,size:"md",items:n||[],onChange:function(t){var n;null===(n=e.onDispensingUnitChange)||void 0===n||n.call(e,t.selectedItem),s(t.selectedItem.uuid)},initialSelectedItem:(null==n?void 0:n.find((function(t){return t.uuid===e.dispensingUnitUuid})))||{},itemToString:function(e){return e&&(null==e?void 0:e.display)?"".concat(null==e?void 0:e.display):""},shouldFilterItem:function(){return!0},value:null!==(r=null==n||null===(o=n.find((function(e){return e.uuid===c})))||void 0===o?void 0:o.display)&&void 0!==r?r:"",placeholder:e.placeholder,ref:u,invalid:e.invalid,invalidText:e.invalidText})}})},oi=function(e){var t=tn({v:U.Default}),n=t.items.results;return t.isLoading?l().createElement(a.znL,null):l().createElement(lo.Qr,{name:e.controllerName,control:e.control,render:function(t){var o,r,i=t.field,s=i.onChange,c=i.value,u=i.ref;return l().createElement(a.CtY,{titleText:e.title,name:e.name,control:e.control,controllerName:e.controllerName,id:e.name,size:"md",items:n||[],onChange:function(t){var n,o;null===(n=e.onPreferredVendorChange)||void 0===n||n.call(e,t.selectedItem),s(null===(o=t.selectedItem)||void 0===o?void 0:o.uuid)},initialSelectedItem:(null==n?void 0:n.find((function(t){return t.uuid===e.preferredVendorUuid})))||{},itemToString:function(e){return e&&(null==e?void 0:e.name)?"".concat(null==e?void 0:e.name):""},shouldFilterItem:function(){return!0},value:null!==(r=null==n||null===(o=n.find((function(e){return e.uuid===c})))||void 0===o?void 0:o.name)&&void 0!==r?r:"",placeholder:e.placeholder,ref:u,invalid:e.invalid,invalidText:e.invalidText})}})},ri=function(e){var t=Ot("6d24eb6e-b42f-4706-ab2d-ae4472161f6a"),n=t.items.answers;return t.isLoading?l().createElement(a.znL,null):l().createElement(lo.Qr,{name:e.controllerName,control:e.control,render:function(t){var o,r,i=t.field,s=i.onChange,c=i.value,u=i.ref;return l().createElement(a.CtY,{titleText:e.title,name:e.name,control:e.control,controllerName:e.controllerName,id:e.name,size:"md",items:n||[],onChange:function(t){var n,o;null===(n=e.onCategoryUuidChange)||void 0===n||n.call(e,t.selectedItem),s(null===(o=t.selectedItem)||void 0===o?void 0:o.uuid)},initialSelectedItem:(null==n?void 0:n.find((function(t){return t.uuid===e.categoryUuid})))||{},itemToString:function(e){return e&&(null==e?void 0:e.display)?"".concat(null==e?void 0:e.display):""},shouldFilterItem:function(){return!0},value:null!==(r=null==n||null===(o=n.find((function(e){return e.uuid===c})))||void 0===o?void 0:o.display)&&void 0!==r?r:"",placeholder:e.placeholder,ref:u,invalid:e.invalid,invalidText:e.invalidText})}})};function ai(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}const ii=function(e){var t,n,o=(t=(0,i.useState)(""),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,r,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(a.push(o.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw r}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return ai(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ai(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),r=o[0],s=o[1];return e.isLoading?l().createElement(a.xNL,null):e.packagingUnits&&e.packagingUnits.length>0?l().createElement(lo.Qr,{name:e.controllerName,control:e.control,render:function(t){var n,o=t.field,i=o.onChange,c=(o.value,o.ref);return l().createElement(a.PhF,{labelText:e.title,name:e.name,control:e.control,controllerName:e.controllerName,id:e.name,size:"md",onChange:function(t){var n,o,r;null===(n=e.onDispensingUnitPackagingUoMUuidChange)||void 0===n||n.call(e,null==t?void 0:t.selectedItem),i(null==t||null===(o=t.selectedItem)||void 0===o?void 0:o.uuid),s(null==t||null===(r=t.selectedItem)||void 0===r?void 0:r.uuid)},ref:c,value:r,invalid:e.invalid,invalidText:e.invalidText},r?"":l().createElement(a.QlF,{disabled:!0,hidden:!0,value:null,text:e.placeholder}),null===(n=e.packagingUnits)||void 0===n?void 0:n.map((function(e,t){return l().createElement(a.QlF,{key:"".concat(t,"-").concat(e.uuid),value:e.uuid,text:e.packagingUomName},null==e?void 0:e.packagingUomName)})))}}):l().createElement(l().Fragment,null)},li=function(e){var t,n,o,r,i,s,c,u,d=e.stockItemUuid,m=e.control,p=e.formState.errors,A=(0,E.useTranslation)().t,g=We(d),_=g.item,f=g.isLoading;return _&&_.packagingUnits&&_.packagingUnits.length>0?l().createElement(l().Fragment,null,l().createElement(ii,{name:"dispensingUnitPackagingUoMUuid",controllerName:"dispensingUnitPackagingUoMUuid",control:m,title:A("dispensingUnitOfMeasurement","Dispensing packaging unit of measurement:"),placeholder:A("chooseAPackagingUoM","Choose a packaging UoM"),isLoading:f,packagingUnits:_.packagingUnits,invalid:!!p.dispensingUnitPackagingUoMUuid,invalidText:p.dispensingUnitPackagingUoMUuid&&(null==p||null===(t=p.dispensingUnitPackagingUoMUuid)||void 0===t?void 0:t.message)}),l().createElement(ii,{name:"defaultStockOperationsUoMUuid",controllerName:"defaultStockOperationsUoMUuid",control:m,title:A("defaultStockOperationsPackagingUnit:","Default stock operations packaging unit:"),placeholder:A("chooseAPackagingUoM","Choose a packaging UoM"),isLoading:f,packagingUnits:_.packagingUnits,invalid:!!p.defaultStockOperationsUoMUuid,invalidText:p.defaultStockOperationsUoMUuid&&(null==p||null===(n=p.defaultStockOperationsUoMUuid)||void 0===n?void 0:n.message)}),f?l().createElement(a.iJ5,null):l().createElement(ti,{id:"reorderLevel",name:"reorderLevel",control:m,controllerName:"reorderLevel",size:"md",allowEmpty:!0,label:A("orderLevel","Reorder level:"),invalid:!!p.reorderLevel,value:null!==(c=_.reorderLevel)&&void 0!==c?c:"",invalidText:p.reorderLevel&&(null==p||null===(o=p.reorderLevel)||void 0===o?void 0:o.message)}),l().createElement(ii,{name:"reorderLevelUoMUuid",controllerName:"reorderLevelUoMUuid",control:m,title:A("reorderLevelPackagingUnit:","Reorder level packaging unit:"),placeholder:A("notSet","Not Set"),isLoading:f,packagingUnits:_.packagingUnits,invalid:!!p.reorderLevelUoMUuid,invalidText:p.reorderLevelUoMUuid&&(null==p||null===(r=p.reorderLevelUoMUuid)||void 0===r?void 0:r.message)}),f?l().createElement(a.iJ5,null):l().createElement(ti,{id:"purchasePrice",name:"purchasePrice",control:m,controllerName:"purchasePrice",size:"md",allowEmpty:!0,label:A("purchasePrice","Purchase Price"),value:null!==(u=_.purchasePrice)&&void 0!==u?u:"",invalid:!!p.purchasePrice,invalidText:p.purchasePrice&&(null==p||null===(i=p.purchasePrice)||void 0===i?void 0:i.message)}),l().createElement(ii,{name:"purchasePriceUoMUuid",controllerName:"purchasePriceUoMUuid",control:m,title:A("purchasePricePackagingUnit","Purchase price packaging unit"),placeholder:A("notSet","Not Set"),isLoading:f,packagingUnits:_.packagingUnits,invalid:!!p.purchasePriceUoMUuid,invalidText:p.purchasePriceUoMUuid&&(null==p||null===(s=p.purchasePriceUoMUuid)||void 0===s?void 0:s.message)})):l().createElement(l().Fragment,null)};function si(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}const ci=function(e){var t,n,r=function(e){var t="ws/rest/v1/concept".concat(F({})),n=(0,j.ZP)(t,o.openmrsFetch),r=n.data,a=n.error,i=n.isLoading;return{items:(null==r?void 0:r.data)||{},isLoading:i,isError:a}}(),s=r.items.results,c=r.isLoading,u=(t=(0,i.useState)(""),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,r,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(a.push(o.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw r}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return si(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?si(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),d=u[0],m=u[1],p=(0,i.useMemo)((function(){return""===d.trim()?s:s.filter((function(e){return e.display.toLowerCase().includes(d.trim().toLowerCase())}))}),[d,s]);return c?l().createElement(a.znL,null):l().createElement(lo.Qr,{name:e.controllerName,control:e.control,render:function(t){var n=t.field,o=n.onChange,r=n.ref;return l().createElement(a.CtY,{titleText:e.title,name:e.name,control:e.control,controllerName:e.controllerName,id:e.name,size:"md",items:p,onChange:function(t){var n;null===(n=e.onConceptUuidChange)||void 0===n||n.call(e,t.selectedItem),o(t.selectedItem.uuid)},initialSelectedItem:(null==s?void 0:s.find((function(t){return t.uuid===e.conceptUuid})))||{},itemToString:function(e){return e&&(null==e?void 0:e.display)?"".concat(null==e?void 0:e.display):""},shouldFilterItem:function(){return!0},onInputChange:function(e){m(e)},inputValue:d,placeholder:e.placeholder,ref:r,invalid:e.invalid,invalidText:e.invalidText})}})};var ui=[{label:"Drug",value:!0},{label:"Other",value:!1}],di=[{label:"Yes",value:!0},{label:"No",value:!1}];function mi(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function pi(e,t,n,o,r,a,i){try{var l=e[a](i),s=l.value}catch(e){return void n(e)}l.done?t(s):Promise.resolve(s).then(o,r)}function Ai(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,r,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(a.push(o.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return mi(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?mi(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var gi=(0,i.forwardRef)((function(e){var t,n,o,r,s,c,u,d,m,p,A,g=e.model,_=e.onSave,f=e.isEditing,v=e.handleTabChange,b=(0,E.useTranslation)().t,h=(0,lo.cI)({defaultValues:g,mode:"all",resolver:(0,so.F)(Xa)}),y=h.handleSubmit,k=h.control,C=h.formState,w=C.errors,S=function(){var e=function(e){return function(){var t=this,n=arguments;return new Promise((function(o,r){var a=e.apply(t,n);function i(e){pi(a,o,r,i,l,"next",e)}function l(e){pi(a,o,r,i,l,"throw",e)}i(void 0)}))}}((function(e){return function(e,t){var n,o,r,a,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,o&&(r=2&a[0]?o.return:a[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,a[1])).done)return r;switch(o=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,o=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((r=(r=i.trys).length>0&&r[r.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){i.label=a[1];break}if(6===a[0]&&i.label<r[1]){i.label=r[1],r=a;break}if(r&&i.label<r[2]){i.label=r[2],i.ops.push(a);break}r[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],o=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,3,4]),x(!0),e.uuid=g.uuid,[4,_(e)];case 1:return t.sent(),v(1),Na("ws/rest/v1/stockmanagement/stockitem"),[3,4];case 2:return t.sent(),[3,4];case 3:return x(!1),[7];case 4:return[2]}}))}));return function(t){return e.apply(this,arguments)}}(),B=Ai((0,i.useState)(!1),2),O=B[0],x=B[1],D=Ai((0,i.useState)(!1),2),I=D[0],T=D[1],P=Ai((0,i.useState)(!1),2),U=P[0],j=P[1];return(0,i.useEffect)((function(){var e,t;T(null!==(e=g.isDrug)&&void 0!==e&&e),j(null!==(t=g.hasExpiration)&&void 0!==t&&t)}),[g.hasExpiration,g.isDrug]),l().createElement("form",{className:"".concat(N.formContainer," ").concat(N.verticalForm)},l().createElement(a.cwH,{className:"clear-margin-bottom",legendText:b("itemType","Item Type"),title:b("itemType","Item Type")},l().createElement(ei,{control:k,name:"isDrug",controllerName:"isDrug",legendText:"",invalid:!!w.isDrug,invalidText:w.isDrug&&(null==w||null===(t=w.isDrug)||void 0===t?void 0:t.message),onChange:function(e){T(e)},options:ui})),I&&l().createElement(Ja,{name:"drugUuid",controllerName:"drugUuid",control:k,title:b("pleaseSpecify","Please specify:"),invalid:!!w.drugUuid,invalidText:w.drugUuid&&(null==w||null===(n=w.drugUuid)||void 0===n?void 0:n.message)}),null!=I&&!I&&l().createElement(ci,{name:"conceptUuid",controllerName:"conceptUuid",control:k,title:b("pleaseSpecify","Please specify:"),placeholder:b("chooseAnItem","Choose an item"),invalid:!!w.drugUuid,invalidText:w.drugUuid&&(null==w||null===(o=w.drugUuid)||void 0===o?void 0:o.message)}),l().createElement(So,{id:"commonName",name:"commonName",control:k,controllerName:"commonName",maxLength:255,size:"md",value:"".concat(null!==(A=null==g?void 0:g.commonName)&&void 0!==A?A:""),labelText:b("commonName","Common name:"),invalid:!!w.commonName,invalidText:w.commonName&&(null==w||null===(r=w.commonName)||void 0===r?void 0:r.message)}),l().createElement(So,{id:"acronym",maxLength:255,name:"acronym",control:k,controllerName:"acronym",size:"md",labelText:b("abbreviation","Abbreviation:"),invalid:!!w.acronym,invalidText:w.acronym&&(null==w||null===(s=w.acronym)||void 0===s?void 0:s.message)}),l().createElement("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",justifyContent:"center"}},l().createElement(a.cwH,{className:"clear-margin-bottom",legendText:b("hasExpiration","Does the item expire?"),title:b("hasExpiration","Does the item expire?")},l().createElement(ei,{name:"hasExpiration",controllerName:"hasExpiration",control:k,legendText:"",invalid:!!w.hasExpiration,invalidText:w.hasExpiration&&(null==w||null===(c=w.hasExpiration)||void 0===c?void 0:c.message),onChange:function(e){j(e)},options:di})),U&&l().createElement(ti,{id:"expiryNotice",name:"expiryNotice",control:k,controllerName:"expiryNotice",size:"md",allowEmpty:!0,label:b("expiryNoticeDays","Expiration Notice (days)"),invalid:!!w.expiryNotice,invalidText:w.expiryNotice&&(null==w||null===(u=w.expiryNotice)||void 0===u?void 0:u.message)})),l().createElement(oi,{name:"preferredVendorUuid",controllerName:"preferredVendorUuid",control:k,title:b("whoIsThePreferredVendor","Who is the preferred vendor?"),placeholder:b("chooseVendor","Choose vendor"),invalid:!!w.preferredVendorUuid,invalidText:w.preferredVendorUuid&&(null==w||null===(d=w.preferredVendorUuid)||void 0===d?void 0:d.message)}),l().createElement(ri,{name:"categoryUuid",controllerName:"categoryUuid",control:k,title:b("category:","Category:"),placeholder:b("chooseACategory","Choose a category"),invalid:!!w.categoryUuid,invalidText:w.categoryUuid&&(null==w||null===(m=w.categoryUuid)||void 0===m?void 0:m.message)}),I&&l().createElement(ni,{name:"dispensingUnitUuid",controllerName:"dispensingUnitUuid",control:k,title:b("dispensingUnit","Dispensing Unit:"),placeholder:b("dispensingUnitHolder","Choose a dispensing unit"),invalid:!!w.dispensingUnitUuid,invalidText:w.dispensingUnitUuid&&(null==w||null===(p=w.dispensingUnitUuid)||void 0===p?void 0:p.message)}),I&&f&&l().createElement(li,{control:k,formState:C,stockItemUuid:g.uuid}),l().createElement("div",{style:{display:"flex",flexDirection:"row-reverse"}},l().createElement(a.zxk,{name:"save",type:"button",className:"submitButton",onClick:y(S),kind:"primary",renderIcon:_r.vc},O?l().createElement(a.lSo,null):b("save","Save")),l().createElement(a.zxk,{kind:"secondary",onClick:Q},b("cancel","Cancel"))))}));const _i=gi;function fi(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function vi(e){var t,n,r=function(e){console.warn("Rules filter: "+JSON.stringify(e));var t="ws/rest/v1/stockmanagement/stockrule".concat(F(e)),n=(0,j.ZP)(t,o.openmrsFetch),r=n.data,a=n.error,i=n.isLoading;return{items:(null==r?void 0:r.data)||{},isLoading:i,isError:a}}(e),a=r.items,l=r.isLoading,s=r.isError,c=(t=(0,i.useState)(10),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,r,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(a.push(o.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw r}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return fi(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?fi(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),u=c[0],d=c[1],m=(0,o.usePagination)(a.results,u),p=m.goTo,A=m.results,g=m.currentPage,_=(0,i.useMemo)((function(){return[{key:"location",header:"Location"},{key:"name",header:"Name"},{key:"quantity",header:"Quantity Threshold"},{key:"evaluationFrequency",header:"Frequency Check"},{key:"actionFrequency",header:"Notification Frequency"},{key:"alertRole",header:"Alert Role"},{key:"mailRole",header:"Mail Role"},{key:"enabled",header:"Enabled?"},{header:"actions",key:"actions"}]}),[]);return{items:A,totalItems:null==a?void 0:a.totalCount,currentPage:g,currentPageSize:u,paginatedItems:A,goTo:p,pageSizes:[10,20,30,40,50],isLoading:l,isError:s,setPageSize:d,tableHeaders:_}}var bi=n(4563),hi={};hi.styleTagTransform=b(),hi.setAttributes=g(),hi.insert=p().bind(null,"head"),hi.domAPI=d(),hi.insertStyleElement=f(),c()(bi.Z,hi);const yi=bi.Z&&bi.Z.locals?bi.Z.locals:void 0;function ki(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ci(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),o.forEach((function(t){ki(e,t,n[t])}))}return e}function Ei(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function wi(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Si(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),o.forEach((function(t){wi(e,t,n[t])}))}return e}function Bi(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n.push.apply(n,o)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}function Oi(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,r,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(a.push(o.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Ei(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ei(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}const xi=function(e){var t,n,r=e.model,s=e.stockItemUuid,c=(0,E.useTranslation)().t;console.warn("Got stock id: ",s);var u=Oi((0,i.useState)({startIndex:0,v:U.Default,q:null,totalCount:!0}),2),d=u[0],m=u[1];(0,i.useEffect)((function(){m({startIndex:0,v:U.Default,totalCount:!0,stockItemUuid:s})}),[s]);var p=Qe(d).items,A=Et({v:U.Default}).locations.results,g=wt({v:U.Default}),_=g.items,f=(g.isError,g.isLoading,Oi((0,i.useState)(),2)),v=f[0],b=f[1];(0,i.useEffect)((function(){if(null!=r&&0!=Object.keys(r).length){r.dateCreated,r.creatorGivenName,r.creatorFamilyName;var e=Si({},function(e,t){if(null==e)return{};var n,o,r=function(e,t){if(null==e)return{};var n,o,r={},a=Object.keys(e);for(o=0;o<a.length;o++)n=a[o],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}(r,["dateCreated","creatorGivenName","creatorFamilyName"]));b(e)}}),[r]);var h=(0,i.useCallback)((function(e){e.preventDefault(),r&&(v.uuid=r.uuid),s&&(v.stockItemUuid=s),function(e){var t=null!=e.uuid,n="ws/rest/v1/stockmanagement/stockrule".concat(t?"/"+e.uuid:""),r=new AbortController;return(0,o.openmrsFetch)(n,{method:"POST",headers:{"Content-Type":"application/json"},signal:r.signal,body:Ci({},e)})}(v).then((function(){(0,o.showToast)({critical:!0,title:c("addedRule","Add Rule"),kind:"success",description:c("stockruleaddedsuccessfully","Stock Rule Added Successfully")}),Q()}),(function(e){(0,o.showNotification)({title:c("errorAddingRule', 'error adding a rule"),kind:"error",critical:!0,description:null==e?void 0:e.message})})).catch()}),[v,r,c]);return l().createElement("div",null,l().createElement(a.l09,{onSubmit:h},l().createElement(a.xBx,null),l().createElement(a.fef,null,l().createElement(a.cwH,null,l().createElement("section",{className:yi.section},l().createElement("section",{className:yi.section},l().createElement(a.PhF,{name:"location",className:"select-field",labelText:c("location","Location"),id:"location",value:(null==v?void 0:v.locationUuid)?v.locationUuid:"",onChange:function(e){var t=A.find((function(t){return t.uuid===e.target.value}));b(Bi(Si({},v),{locationUuid:t.uuid}))}},l().createElement(a.QlF,{disabled:!0,hidden:!0,value:"",text:c("chooseLocation","Choose the location")}),null==A?void 0:A.map((function(e){return l().createElement(a.QlF,{key:e.uuid,value:e.uuid,text:e.display})})))),l().createElement("section",{className:yi.section},l().createElement(a.oil,{id:"name",type:"text",labelText:c("name","Rule Name"),size:"md",onChange:function(e){r&&(r.name=e.target.value),b(Bi(Si({},v),{name:e.target.value}))},value:null==r?void 0:r.name,placeholder:"e.g Panado Alert"})),l().createElement("section",{className:yi.section},l().createElement(a.PhF,{name:"quantityUnit",className:"select-field",labelText:c("quantityUnit","Quantity Unit"),id:"quantityUnit",value:(null==v?void 0:v.stockItemPackagingUOMUuid)?v.stockItemPackagingUOMUuid:"",onChange:function(e){var t=null==p?void 0:p.results.find((function(t){return t.uuid===e.target.value}));b(Bi(Si({},v),{stockItemPackagingUOMUuid:t.uuid}))}},l().createElement(a.QlF,{disabled:!0,hidden:!0,value:"",text:c("chooseQuantityUnit","Choose the Unit of Quantity")}),null==p?void 0:p.results.map((function(e){return l().createElement(a.QlF,{key:e.uuid,value:e.uuid,text:e.packagingUomName})})))),l().createElement("section",{className:yi.section},l().createElement(a.oil,{id:"quantity",type:"number",labelText:c("quantity","Quantity Threshold"),size:"md",onChange:function(e){r&&(r.quantity=Number(e.target.value)),b(Bi(Si({},v),{quantity:Number(e.target.value)}))},value:null==r?void 0:r.quantity,placeholder:"e.g 30 Boxes"})))),l().createElement(a.cwH,null,l().createElement("section",{className:yi.section},l().createElement(a.PhF,{name:"alertRole",className:"select-field",labelText:c("alertRole","Alert Role"),id:"alertRole",value:(null==v?void 0:v.alertRole)?v.alertRole:"",onChange:function(e){var t=null==_?void 0:_.results.find((function(t){return t.display===e.target.value}));b(Bi(Si({},v),{alertRole:t.display}))}},l().createElement(a.QlF,{disabled:!0,hidden:!0,value:"",text:c("chooseAlertRole","Choose an Alert Role")}),null==_||null===(t=_.results)||void 0===t?void 0:t.map((function(e){return l().createElement(a.QlF,{key:e.display,value:e.display,text:e.display})})))),l().createElement("section",{className:yi.section},l().createElement(a.PhF,{name:"mailRole",className:"select-field",labelText:c("mailRole","Mail Role"),id:"mailRole",value:(null==v?void 0:v.mailRole)?v.mailRole:"",onChange:function(e){var t=null==_?void 0:_.results.find((function(t){return t.display===e.target.value}));console.warn("Setting mail role to: ",t),b(Bi(Si({},v),{mailRole:t.display}))}},l().createElement(a.QlF,{disabled:!0,hidden:!0,value:"",text:c("chooseMailRole","Choose a Mail Role")}),null==_||null===(n=_.results)||void 0===n?void 0:n.map((function(e){return l().createElement(a.QlF,{key:e.display,value:e.display,text:e.display})})))),l().createElement("section",{className:yi.section},l().createElement(a.oil,{id:"evaluationFrequency",type:"number",labelText:c("evaluationFrequency","Frequency Check (Minutes)"),size:"md",onChange:function(e){r&&(r.evaluationFrequency=Number(e.target.value)),b(Bi(Si({},v),{evaluationFrequency:Number(e.target.value)}))},value:null==r?void 0:r.evaluationFrequency,placeholder:"e.g 30 Minutes"}),l().createElement(a.oil,{id:"actionFrequency",type:"number",labelText:c("actionFrequency","Notification Frequency (Minutes)"),size:"md",onChange:function(e){r&&(r.actionFrequency=Number(e.target.value)),b(Bi(Si({},v),{actionFrequency:Number(e.target.value)}))},value:null==r?void 0:r.actionFrequency,placeholder:"e.g 3600 Minutes"}))),l().createElement("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",justifyContent:"center"}},l().createElement(a.cwH,{className:"clear-margin-bottom"},l().createElement(a.cOn,{className:yi.checkboxGrid},l().createElement(a.XZJ,{onChange:function(e,t){var n=!(null==v?void 0:v.enabled);b(Bi(Si({},v),{enabled:n}))},checked:null==v?void 0:v.enabled,labelText:"Enabled ?",value:null==r?void 0:r.enabled,id:"chk-ruleEnabled"}))),l().createElement(a.cwH,{className:"clear-margin-bottom"},l().createElement(a.cOn,{className:yi.checkboxGrid},l().createElement(a.XZJ,{onChange:function(e,t){var n=!(null==v?void 0:v.enableDescendants);b(Bi(Si({},v),{enableDescendants:n}))},name:"appliesToChildren",checked:null==v?void 0:v.enableDescendants,value:null==r?void 0:r.enableDescendants,labelText:"Applies to child locations?",id:"chk-ruleAppliesToChildren"})))),l().createElement("div",null,"This stock rule will be evaluated by checking if the stock quantities have lowered to the threshold or below and a notification will be sent to the personnel with the specified role in the given location. The notification will only be sent once per specified notification frequency.")),l().createElement(a.mzw,null,l().createElement(a.zxk,{kind:"secondary",onClick:Q},c("cancel","Cancel")),l().createElement(a.zxk,{type:"submit"},c("save","Save")))))},Di=function(e){var t=e.stockItemUuid,n=(0,E.useTranslation)().t,o=(0,i.useCallback)((function(){Y("Add Stock Rule",l().createElement(xi,{stockItemUuid:t}))}),[]);return l().createElement(a.zxk,{onClick:o,size:"md",kind:"primary"},n("stockmanagement.addnewrule","Add New Rule"))};var Ni=n(4907),Ii={};Ii.styleTagTransform=b(),Ii.setAttributes=g(),Ii.insert=p().bind(null,"head"),Ii.domAPI=d(),Ii.insertStyleElement=f(),c()(Ni.Z,Ii);const Ti=Ni.Z&&Ni.Z.locals?Ni.Z.locals:void 0;function Pi(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}const Ui=function(e){var t,n=e.stockItemUuid,r=function(e){var t="ws/rest/v1/stockmanagement/stockrule".concat(F(e)),n=(0,j.ZP)(t,o.openmrsFetch),r=n.data,a=n.error,i=n.isLoading;return{items:(null==r?void 0:r.data)||{},isLoading:i,isError:a}}({v:U.Default,totalCount:!0,stockItemUuid:n}),i=r.items,s=r.isLoading,c=r.isError;return s||c?l().createElement(a.iTo,null):l().createElement(l().Fragment,null,l().createElement("div",{className:Ti.filterContainer},l().createElement(a.Ltx,{id:"stockRulesFiter",items:(t=i.results,function(e){if(Array.isArray(e))return Pi(e)}(t)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||function(e,t){if(e){if("string"==typeof e)return Pi(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Pi(e,t):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),itemToString:function(e){return e?e.display:"Not Set"},type:"inline",size:"sm"})))};function ji(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function Fi(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Li=function(e){var t,n,r=e.uuid,s=(0,E.useTranslation)().t,c=(t=(0,i.useState)(!1),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,r,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(a.push(o.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw r}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return ji(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ji(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),u=c[0],d=c[1],m=l().useCallback((function(){var e=(0,o.showModal)("delete-stock-rule-modal",{close:function(){return e()},uuid:r,onConfirmation:function(){var t,n,a;(t=r,n="ws/rest/v1/stockmanagement/stockrule/".concat(t),a=new AbortController,(0,o.openmrsFetch)(n,{method:"DELETE",headers:{"Content-Type":"application/json"},signal:a.signal})).then((function(){d(!1),(0,o.showToast)({critical:!0,title:s("deletingRule","Delete Rule"),kind:"success",description:s("stockruledeletedsuccessfully","Stock Rule Deleted Successfully")})}),(function(e){d(!1),(0,o.showNotification)({title:s("errorDeletingRule', 'error deleting a rule"),kind:"error",critical:!0,description:null==e?void 0:e.message})})).catch(),e()}})}),[s,r]),p=l().createElement(a.zxk,{kind:"ghost",size:"md",onClick:m,iconDescription:s("deleteRule","Delete Rule"),renderIcon:function(e){return l().createElement(Ht.ZN,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),o.forEach((function(t){Fi(e,t,n[t])}))}return e}({size:16},e))}});return u?l().createElement(a.lSo,null):p};function zi(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Ri=function(e){var t=e.data,n=(e.stockItemUuid,(0,E.useTranslation)().t),o=(0,i.useCallback)((function(){Y("Edit Stock Rule",l().createElement(xi,{model:t,stockItemUuid:t.stockItemUuid}))}),[t]);return l().createElement(a.zxk,{kind:"ghost",size:"md",onClick:function(){return o()},iconDescription:n("editStockRule","Edit Stock Rule"),renderIcon:function(e){return l().createElement(dt.I8,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),o.forEach((function(t){zi(e,t,n[t])}))}return e}({size:16},e))}})};function Mi(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function qi(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),o.forEach((function(t){Mi(e,t,n[t])}))}return e}function Gi(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n.push.apply(n,o)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}const Hi=function(e){var t=e.stockItemUuid,n=(e.model,e.canEdit,(0,E.useTranslation)().t);console.warn("Found stock uuid: "+t);var r=vi({v:U.Default,totalCount:!0,stockItemUuid:t}),s=r.isLoading,c=r.items,u=r.tableHeaders,d=r.currentPage,m=r.currentPageSize,p=r.pageSizes,A=r.totalItems,g=r.setPageSize,_=r.goTo,f=(0,i.useMemo)((function(){return null==c?void 0:c.map((function(e,t){var n,o;return Gi(qi({},e),{id:"".concat(null==e?void 0:e.id,"-").concat(t),key:"key-".concat(null==e?void 0:e.uuid),uuid:"".concat(null==e?void 0:e.uuid),dateCreated:J(null==e?void 0:e.dateCreated),location:null==e?void 0:e.locationName,quantity:"".concat(null==e||null===(n=e.quantity)||void 0===n?void 0:n.toLocaleString()," ").concat(null!==(o=null==e?void 0:e.packagingUomName)&&void 0!==o?o:""),name:"".concat(null==e?void 0:e.name),description:"".concat(null==e?void 0:e.description),evaluationFrequency:"".concat(null==e?void 0:e.evaluationFrequency),actionFrequency:"".concat(null==e?void 0:e.actionFrequency),lastActionDate:J(null==e?void 0:e.lastActionDate),nextActionDate:J(null==e?void 0:e.nextActionDate),enabled:e.enabled?"Yes":"No",actions:l().createElement(l().Fragment,null,l().createElement(Ri,{data:c[t],stockItemUuid:c[t].stockItemUuid}),l().createElement(Li,{uuid:c[t].uuid}))})}))}),[c]);return s?l().createElement(a.gqd,{role:"progressbar"}):l().createElement("div",{className:Fn.tableOverride},l().createElement("div",{id:"table-tool-bar"},l().createElement("div",null),l().createElement("div",{className:"right-filters"})),l().createElement(a.wQF,{rows:f,headers:u,isSortable:!0,useZebraStyles:!0,render:function(e){var r=e.rows,i=e.headers,s=e.getHeaderProps,c=e.getTableProps,u=e.getRowProps,d=e.onInputChange;return l().createElement(a.xJi,null,l().createElement(a.fjU,{style:{position:"static",overflow:"visible",backgroundColor:"color"}},l().createElement(a.Vj0,{className:Fn.toolbarContent},l().createElement(a.Ys1,{persistent:!0,onChange:d}),l().createElement("div",{style:{display:"flex",alignItems:"center"}},l().createElement(Ui,{stockItemUuid:t})),l().createElement(a.Voz,null,l().createElement(a.VjL,{onClick:""},"Refresh")),l().createElement(Di,{stockItemUuid:t}))),l().createElement(a.iA_,c(),l().createElement(a.ssF,null,l().createElement(a.SCH,null,i.map((function(e){var t,n;return"details"!==e.key&&l().createElement(a.xDH,Gi(qi({},s({header:e,isSortable:e.isSortable})),{className:o.isDesktop?Fn.desktopHeader:Fn.tabletHeader,key:"".concat(e.key)}),null!==(n=null===(t=e.header)||void 0===t?void 0:t.content)&&void 0!==n?n:e.header)})),l().createElement(a.xDH,null))),l().createElement(a.RMI,null,r.map((function(e){return l().createElement(l().Fragment,{key:e.id},l().createElement(a.SCH,qi({className:o.isDesktop?Fn.desktopRow:Fn.tabletRow},u({row:e})),e.cells.map((function(e){var t;return"details"!==(null==e||null===(t=e.info)||void 0===t?void 0:t.header)&&l().createElement(a.pj1,{key:e.id},e.value)}))))})))),0===r.length?l().createElement("div",{className:Fn.tileContainer},l().createElement(a.n9L,{className:Fn.tile},l().createElement("div",{className:Fn.tileContent},l().createElement("p",{className:Fn.content},n("noRulesToDisplay","No Stock rules to display")),l().createElement("p",{className:Fn.helper},n("checkFilters","Check the filters above"))))):null)}}),l().createElement(a.tlE,{page:d,pageSize:m,pageSizes:p,totalItems:A,onChange:function(e){var t=e.pageSize,n=e.page;t!==m&&g(t),n!==d&&_(n)},className:Fn.paginationOverride}))};function Zi(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function Yi(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,r,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(a.push(o.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Zi(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Zi(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Qi(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function Wi(e){return function(e){if(Array.isArray(e))return Qi(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return Qi(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Qi(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}const Ki=function(e){var t=Ot("bce2b1af-98b1-48a2-98a2-3e4ffb3c79c2"),n=t.items.answers;return t.isLoading?l().createElement(a.znL,null):l().createElement(lo.Qr,{name:e.controllerName,control:e.control,render:function(t){var o,r,i,s,c,u,d,m,p,A=t.field,g=A.onChange;return A.value,A.ref,l().createElement(a.CtY,{titleText:e.title,name:e.name,control:e.control,controllerName:e.controllerName,id:"".concat(e.name,"-").concat(e.row.id,"-").concat(e.row.uuid),size:"md",items:void 0!==(null===(o=e.row)||void 0===o?void 0:o.packagingUomUuid)?Wi(n.some((function(t){var n;return t.uuid===(null===(n=e.row)||void 0===n?void 0:n.packagingUomUuid)}))?[]:[{uuid:null===(r=e.row)||void 0===r?void 0:r.packagingUomUuid,display:null===(i=e.row)||void 0===i?void 0:i.packagingUomName}]).concat(Wi(null!=n?n:[])):n||[],onChange:function(t){var n,o;null===(n=e.onPackageUnitChange)||void 0===n||n.call(e,null==t?void 0:t.selectedItem),g((null==t||null===(o=t.selectedItem)||void 0===o?void 0:o.uuid)||"")},initialSelectedItem:void 0!==(null===(s=e.row)||void 0===s?void 0:s.packagingUomUuid)?{uuid:null===(c=e.row)||void 0===c?void 0:c.packagingUomUuid,display:null===(u=e.row)||void 0===u?void 0:u.packagingUomName}:null,selectedItem:void 0!==(null===(d=e.row)||void 0===d?void 0:d.packagingUomUuid)?{uuid:null===(m=e.row)||void 0===m?void 0:m.packagingUomUuid,display:null===(p=e.row)||void 0===p?void 0:p.packagingUomName}:null,itemToString:function(e){return e&&(null==e?void 0:e.display)?"".concat(null==e?void 0:e.display):""},shouldFilterItem:function(){return!0},placeholder:e.placeholder,invalid:e.invalid,invalidText:e.invalidText})}})};var Ji=co.z.object({id:co.z.string().nullish(),uuid:co.z.string().nullish(),stockItemUuid:co.z.string().nullish(),packagingUomName:co.z.string().nullish(),packagingUomUuid:co.z.string().nullish(),factor:co.z.coerce.number().nullish(),isDefaultStockOperationsUoM:co.z.boolean().nullish(),isDispensingUnit:co.z.boolean().nullish()}),Vi=n(4158),Xi={};Xi.styleTagTransform=b(),Xi.setAttributes=g(),Xi.insert=p().bind(null,"head"),Xi.domAPI=d(),Xi.insertStyleElement=f(),c()(Vi.Z,Xi);const $i=Vi.Z&&Vi.Z.locals?Vi.Z.locals:void 0;function el(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function tl(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function nl(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),o.forEach((function(t){tl(e,t,n[t])}))}return e}function ol(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n.push.apply(n,o)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}const rl=function(e){e.isEditing;var t=e.stockItemUuid,n=e.handleTabChange,r=function(e){var t=Yi((0,i.useState)({startIndex:0,v:U.Default,q:null,totalCount:!0}),2),n=t[0],o=t[1],r=Yi((0,i.useState)(),2),a=r[0],l=r[1];(0,i.useEffect)((function(){o({startIndex:0,v:U.Default,totalCount:!0,stockItemUuid:a})}),[a]);var s=Qe(n),c=s.items,u=s.isLoading,d=s.isError;return{items:c.results,totalCount:c.totalCount,isLoading:u,isError:d,setStockItemUuid:l}}(),s=r.items,c=r.isLoading,u=r.setStockItemUuid;(0,i.useEffect)((function(){u(t)}),[t,u]);var d,m=(0,E.useTranslation)().t,p=(0,i.useMemo)((function(){return[{key:"packaging",header:m("packagingUnit","Packaging Unit"),styles:{width:"50%"}},{key:"quantity",header:m("quantity","Quantity"),styles:{width:"50%"}},{key:"action",header:m("action","Actions"),styles:{width:"50%"}}]}),[]),A=(0,lo.cI)({defaultValues:{},mode:"all",resolver:(0,so.F)(Ji)});return c?l().createElement(a.gqd,{showHeader:!1,rowCount:5,columnCount:5,zebra:!0}):l().createElement(lo.RV,A,l().createElement(a.wQF,{rows:(d=s,function(e){if(Array.isArray(e))return el(e)}(d)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(d)||function(e,t){if(e){if("string"==typeof e)return el(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?el(e,t):void 0}}(d)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()).concat([{}]),headers:p,isSortable:!1,useZebraStyles:!0,render:function(e){var t=e.headers,n=e.getHeaderProps,o=e.getTableProps;return l().createElement(a.xJi,{className:$i.packagingTableContainer},l().createElement(a.iA_,ol(nl({},o()),{className:$i.packingTable}),l().createElement(a.ssF,null,l().createElement(a.SCH,null,t.map((function(e){var t,o;return l().createElement(a.xDH,ol(nl({},n({header:e,isSortable:!1})),{style:e.styles,key:e.key}),null!==(o=null===(t=e.header)||void 0===t?void 0:t.content)&&void 0!==o?o:e.header)})),l().createElement(a.xDH,{style:{width:"70%"}}))),l().createElement(a.RMI,{className:$i.packingTableBody},null==s?void 0:s.map((function(e,t){return l().createElement(al,{row:e,key:"".concat(t,"-").concat(null==e?void 0:e.uuid)})})),l().createElement(al,{row:{},key:"bottom-row",isEditing:!0}))))}}),l().createElement(a.zxk,{name:"save",type:"submit",className:"submitButton",onClick:function(){var e=(0,A.getValues)();(function(e){var t=new AbortController;return(0,o.openmrsFetch)("ws/rest/v1/stockmanagement/stockitempackaginguom",{method:"POST",headers:{"Content-Type":"application/json"},signal:t.signal,body:e})})({factor:e.factor,packagingUomUuid:e.packagingUomUuid,stockItemUuid:t}).then((function(){return(0,o.showSnackbar)({title:m("savePackingUnitTitle","Package Unit"),subtitle:m("savePackingUnitMessage","Package Unit saved successfully"),kind:"success"})}),(function(){(0,o.showSnackbar)({title:m("savePackagingUnitErrorTitle","Package Unit"),subtitle:m("savePackagingUnitErrorMessage","Error saving package unit"),kind:"error"})})),n(0)},kind:"primary",renderIcon:_r.vc},m("save","Save")))};var al=function(e){var t=e.isEditing,n=e.row,r=e.key,i=(0,E.useTranslation)().t,s=(0,lo.Gc)(),c=s.control,u=s.formState.errors;return l().createElement(a.SCH,null,l().createElement(a.pj1,null,t?l().createElement(Ki,{row:n,controllerName:"packagingUomUuid",name:"packagingUomUuid",control:c,invalid:!!u.packagingUomUuid}):(!t||!n.uuid.startsWith("new-item"))&&(null==n?void 0:n.packagingUomName)),l().createElement(a.pj1,null,l().createElement("div",{className:$i.packingTableCell},l().createElement(ti,{row:n,controllerName:"factor",name:"factor",control:c,id:"".concat(n.uuid,"-").concat(r),invalid:!!u.factor}),l().createElement(a.zxk,{type:"button",size:"sm",className:"submitButton clear-padding-margin",iconDescription:"Delete",kind:"ghost",renderIcon:Ht.ZN,onClick:function(e){return function(e){var t,r,a;e.preventDefault(),(t=n.uuid,r="ws/rest/v1/stockmanagement/stockitempackaginguom/".concat(t),a=new AbortController,(0,o.openmrsFetch)(r,{method:"DELETE",headers:{"Content-Type":"application/json"},signal:a.signal})).then((function(){(0,o.showToast)({critical:!0,title:i("deletePackagingUnitTitle","Delete packing item "),kind:"success",description:i("deletePackagingUnitMesaage","Stock Item packing unit deleted Successfully")})}),(function(e){(0,o.showNotification)({title:i("deletePackingUnitErrorTitle","Error Deleting a stock item packing unit"),kind:"error",critical:!0,description:null==e?void 0:e.message})}))}(e)}}))))};function il(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function ll(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,r,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(a.push(o.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return il(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?il(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var sl=n(3162),cl=n(4655),ul={};ul.styleTagTransform=b(),ul.setAttributes=g(),ul.insert=p().bind(null,"head"),ul.domAPI=d(),ul.insertStyleElement=f(),c()(cl.Z,ul);const dl=cl.Z&&cl.Z.locals?cl.Z.locals:void 0;function ml(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function pl(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Al(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,r,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(a.push(o.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw r}}return a}}(e,t)||gl(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function gl(e,t){if(e){if("string"==typeof e)return ml(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ml(e,t):void 0}}const _l=function(e){var t=e.columns,n=e.data,r=e.children,s=e.totalItems,c=e.goToPage,u=e.hasToolbar,d=void 0===u||u,m=(0,E.useTranslation)().t,p=(0,o.useLayoutType)(),A=Al((0,i.useState)([]),2),g=A[0],_=A[1],f="tablet"===(0,o.useLayoutType)(),v=Al((0,i.useState)(n),1)[0],b=[10,20,30,40,50],h=Al((0,i.useState)(10),2),y=h[0],k=h[1],C=(0,o.usePagination)(v,y),w=C.goTo,S=C.results,B=C.currentPage;(0,i.useEffect)((function(){var e=[];S.map((function(t,n){return e.push((o=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),o.forEach((function(t){pl(e,t,n[t])}))}return e}({},t),r=null!=(r={id:n++})?r:{},Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(r)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n.push.apply(n,o)}return n}(Object(r)).forEach((function(e){Object.defineProperty(o,e,Object.getOwnPropertyDescriptor(r,e))})),o));var o,r})),_(e)}),[S,g]);var O=function(e){var n=x(v,t);if("Download As CSV"==e.currentTarget.innerText){var o=new Blob([n],{type:"text/csv;charset=utf-8"});(0,sl.saveAs)(o,"data.csv")}else if("Download As Json"==e.currentTarget.innerText){var r=new Blob([n],{type:"application/json"});(0,sl.saveAs)(r,"data.json")}},x=function(e,t){var n,o=t.map((function(e){return e.header})).join(","),r=e.map((function(e){return t.map((function(t){return JSON.stringify(e[t.key])})).join(",")}));return[o].concat((n=r,function(e){if(Array.isArray(e))return ml(e)}(n)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(n)||gl(n)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())).join("\n")};return l().createElement(l().Fragment,null,l().createElement(a.wQF,{"data-floating-menu-container":!0,rows:g,headers:t,filterRows:function(e){var t=e.rowIds,n=e.headers,o=e.cellsById,r=e.inputValue,a=e.getCellId;return t.filter((function(e){return n.some((function(t){var n=t.key,i=a(e,n),l=o[i].value,s=r.toLowerCase();return"boolean"!=typeof l&&(""+l).toLowerCase().includes(s)}))}))},overflowMenuOnHover:(0,o.isDesktop)(p),size:f?"lg":"md",useZebraStyles:!0},(function(e){var t=e.rows,n=e.headers,o=e.getHeaderProps,i=e.getTableProps,u=e.onInputChange;return l().createElement("div",null,l().createElement(a.xJi,{className:dl.tableContainer},d&&l().createElement(a.fjU,{style:{position:"static",overflow:"visible",backgroundColor:"color"}},l().createElement(a.Vj0,{className:dl.toolbarContent},r?r({onInputChange:u}):l().createElement(l().Fragment,null,l().createElement(a.PQB,{size:"sm",kind:"tertiary",renderIcon:dt.rT,iconDescription:"Download As",focusTrap:!1},l().createElement(a.laM,{itemText:"Download As CSV",onClick:O}),l().createElement(a.laM,{itemText:"Download As PDF",onClick:O}),l().createElement(a.laM,{itemText:"Download As Json",onClick:O})),l().createElement(a.Ys1,{className:dl.patientListSearch,expanded:!0,onChange:u,placeholder:m("searchThisList","Search this list"),size:"sm"})))),l().createElement(a.iA_,i(),l().createElement(a.ssF,null,l().createElement(a.SCH,null,n.map((function(e){return l().createElement(a.xDH,o({header:e}),e.header)})))),l().createElement(a.RMI,null,t.map((function(e){return l().createElement(a.SCH,{key:e.id},e.cells.map((function(e){return l().createElement(a.pj1,{key:e.id},e.value)})))})))),0===t.length?l().createElement("div",{className:dl.tileContainer},l().createElement(a.n9L,{className:dl.tile},l().createElement("div",{className:dl.tileContent},l().createElement("p",{className:dl.content},m("No data","No data to display")),l().createElement("p",{className:dl.helper},m("checkFilters","Check the filters above"))))):null,l().createElement(a.tlE,{forwardText:"Next page",backwardText:"Previous page",page:B,pageSize:y,pageSizes:b,totalItems:s||(null==v?void 0:v.length),className:dl.pagination,onChange:function(e){var t=e.pageSize,n=e.page;if(t!==y&&k(t),n!==B){if(c)return void c(n);w(n)}}})))})))};function fl(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const vl=function(e){var t,n=e.stockItemUuid,r=function(e){var t=ll((0,i.useState)({startIndex:0,v:e||U.Default,limit:10,q:null,totalCount:!0}),2),n=t[0],r=t[1],a=ll((0,i.useState)(10),2),l=a[0],s=a[1],c=ll((0,i.useState)(null),2),u=c[0],d=c[1],m=ll((0,i.useState)(1),2),p=m[0],A=m[1],g=ll((0,i.useState)(),2),_=g[0],f=g[1],v=ll((0,i.useState)(),2),b=v[0],h=v[1],y=ll((0,i.useState)(),2),k=y[0],C=y[1],E=ll((0,i.useState)(),2),w=E[0],S=E[1];(0,i.useEffect)((function(){r({startIndex:p-1,v:U.Default,limit:l,q:u,totalCount:!0,stockItemUuid:_,partyUuid:b,locationUuid:k,stockBatchUuid:w})}),[u,p,l,_,b,k,w]);var B=function(e){var t="ws/rest/v1/stockmanagement/stockitemtransaction".concat(F(e)),n=(0,j.ZP)(t,o.openmrsFetch),r=n.data,a=n.error,i=n.isLoading;return{items:(null==r?void 0:r.data)||{},isLoading:i,isError:a}}(n),O=B.items,x=B.isLoading,D=B.isError,N=(0,i.useMemo)((function(){return[{key:"date",header:"Date"},{key:"location",header:"Location"},{key:"transaction",header:"Transaction"},{key:"in",header:"IN"},{key:"out",header:"OUT"},{key:"batch",header:"Batch"},{key:"reference",header:"Reference"},{key:"status",header:"Status"}]}),[]);return{items:O.results,totalCount:O.totalCount,currentPage:p,currentPageSize:l,setCurrentPage:A,setPageSize:s,pageSizes:[10,20,30,40,50],isLoading:x,isError:D,setSearchString:d,tableHeaders:N,setStockItemUuid:f,setLocationUuid:C,setPartyUuid:h,setStockBatchUuid:S}}(U.Default),s=r.isLoading,c=r.items,u=r.tableHeaders,d=r.totalCount,m=r.setCurrentPage,p=r.setStockItemUuid;(0,i.useEffect)((function(){p(n)}),[n,p]);var A=(0,i.useMemo)((function(){return null==c?void 0:c.map((function(e){var n,o,r,a,i,s,c,u,d;return u=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),o.forEach((function(t){fl(e,t,n[t])}))}return e}({},e),d=null!=(d={id:null==e?void 0:e.uuid,key:"key-".concat(null==e?void 0:e.uuid),uuid:"".concat(null==e?void 0:e.uuid),date:J(null==e?void 0:e.dateCreated),location:e.operationSourcePartyName&&e.operationDestinationPartyName?e.operationSourcePartyName===(null==e?void 0:e.partyName)?(e.quantity,l().createElement(l().Fragment,null,l().createElement("span",{className:"transaction-location"},e.operationSourcePartyName),l().createElement(be.Xd,{size:16})," ",e.operationDestinationPartyName)):e.operationDestinationPartyName===(null==e?void 0:e.partyName)?(e.quantity,l().createElement(l().Fragment,null,l().createElement("span",{className:"transaction-location"},e.operationDestinationPartyName),l().createElement(be.Xd,{size:16})," ",e.operationSourcePartyName)):null==e?void 0:e.partyName:null==e?void 0:e.partyName,transaction:(null==e?void 0:e.isPatientTransaction)?"Patient Dispense":e.stockOperationTypeName,quantity:"".concat(null==e||null===(n=e.quantity)||void 0===n?void 0:n.toLocaleString()," ").concat(null!==(a=null==e?void 0:e.packagingUomName)&&void 0!==a?a:""),batch:e.stockBatchNo?"".concat(e.stockBatchNo).concat(e.expiration?" (".concat(J(e.expiration),")"):""):"",reference:(null==e?void 0:e.stockOperationUuid)?l().createElement(za,{operationUuid:null==e?void 0:e.stockOperationUuid,operationNumber:null==e?void 0:e.stockOperationNumber,operations:t}):l().createElement(l().Fragment,null),status:null!==(i=null==e?void 0:e.stockOperationStatus)&&void 0!==i?i:"",in:(null==e?void 0:e.quantity)>=0?"".concat(null==e||null===(o=e.quantity)||void 0===o?void 0:o.toLocaleString()," ").concat(null!==(s=null==e?void 0:e.packagingUomName)&&void 0!==s?s:""):"",out:(null==e?void 0:e.quantity)<0?"".concat(null===(r=-1*(null==e?void 0:e.quantity))||void 0===r?void 0:r.toLocaleString()," ").concat(null!==(c=null==e?void 0:e.packagingUomName)&&void 0!==c?c:""):""})?d:{},Object.getOwnPropertyDescriptors?Object.defineProperties(u,Object.getOwnPropertyDescriptors(d)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n.push.apply(n,o)}return n}(Object(d)).forEach((function(e){Object.defineProperty(u,e,Object.getOwnPropertyDescriptor(d,e))})),u}))}),[c,t]);return s?l().createElement(a.gqd,{role:"progressbar"}):null!=(null==c?void 0:c.length)?l().createElement(_l,{columns:u,data:A,totalItems:d,goToPage:m,hasToolbar:!1}):l().createElement("div",{className:Fn.tileContainer},l().createElement(a.n9L,{className:Fn.tile},l().createElement("p",{className:Fn.content},"No transactions to display")))};function bl(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const hl=function(e){var t=e.stockItemUuid,n=tr(U.Default),o=n.isLoading,r=n.items,s=n.totalCount,c=n.setCurrentPage,u=n.setStockItemUuid,d=(0,E.useTranslation)().t;(0,i.useEffect)((function(){u(t)}),[t,u]);var m=(0,i.useMemo)((function(){return[{key:"location",header:d("location","Location")},{key:"batch",header:d("batchNumber","Batch Number")},{key:"quantity",header:d("quantity","Quantity")},{key:"packaging",header:d("packagingUnit","Packaging Unit")},{key:"expires",header:d("expires","Expires")}]}),[]),p=(0,i.useMemo)((function(){return null==r?void 0:r.map((function(e,t){var n,o,r,a,i,l;return i=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),o.forEach((function(t){bl(e,t,n[t])}))}return e}({},e),l=null!=(l={id:"".concat(e.partyUuid).concat(e.stockBatchUuid).concat(t),key:"".concat(e.partyUuid).concat(e.stockBatchUuid).concat(t),uuid:"".concat(e.partyUuid).concat(e.stockBatchUuid).concat(t),expires:J(null==e?void 0:e.expiration),location:null==e?void 0:e.partyName,quantity:null!==(o=null==e||null===(n=e.quantity)||void 0===n?void 0:n.toLocaleString())&&void 0!==o?o:"",batch:null!==(r=e.batchNumber)&&void 0!==r?r:"",packaging:null!==(a=e.quantityUoM)&&void 0!==a?a:""})?l:{},Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(l)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n.push.apply(n,o)}return n}(Object(l)).forEach((function(e){Object.defineProperty(i,e,Object.getOwnPropertyDescriptor(l,e))})),i}))}),[r]);return o?l().createElement(a.gqd,{role:"progressbar"}):(null==r?void 0:r.length)>0?l().createElement(_l,{columns:m,data:p,totalItems:s,goToPage:c,hasToolbar:!1}):l().createElement("div",{className:Fn.tileContainer},l().createElement(a.n9L,{className:Fn.tile},l().createElement("p",{className:Fn.content},d("batchInfoToDisplay","No batch information to display"))))};function yl(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function kl(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,r,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(a.push(o.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return yl(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?yl(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Cl(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const El=function(e){var t=e.stockItemUuid,n=function(e){var t=kl((0,i.useState)({startIndex:0,v:e||U.Default,limit:10,q:null,totalCount:!0}),2),n=t[0],o=t[1],r=kl((0,i.useState)(10),2),a=r[0],l=r[1],s=kl((0,i.useState)(null),2),c=s[0],u=s[1],d=kl((0,i.useState)(1),2),m=d[0],p=d[1],A=kl((0,i.useState)(),2),g=A[0],_=A[1],f=kl((0,i.useState)(),2),v=f[0],b=f[1],h=kl((0,i.useState)(),2),y=h[0],k=h[1],C=kl((0,i.useState)(),2),E=C[0],w=C[1];(0,i.useEffect)((function(){o({startIndex:m-1,v:U.Default,limit:a,q:c,totalCount:!0,stockItemUuid:g,partyUuid:v,locationUuid:y,stockBatchUuid:E})}),[c,m,a,g,v,y,E]);var S,B=Ze(n),O=B.items,x=B.isLoading,D=B.isError;return{items:null!==(S=O.results)&&void 0!==S?S:[],totalCount:O.totalCount,currentPage:m,currentPageSize:a,setCurrentPage:p,setPageSize:l,pageSizes:[10,20,30,40,50],isLoading:x,isError:D,setSearchString:u,setStockItemUuid:_,setLocationUuid:k,setPartyUuid:b,setStockBatchUuid:w}}(U.Default),o=n.isLoading,r=n.items,s=n.totalCount,c=n.setCurrentPage,u=n.setStockItemUuid,d=(0,E.useTranslation)().t;(0,i.useEffect)((function(){u(t)}),[t,u]);var m=(0,i.useMemo)((function(){return[{key:"location",header:d("location","Location")},{key:"quantity",header:d("quantity","Quantity")},{key:"packaging",header:d("packagingUnit","Packaging Unit")}]}),[]),p=(0,i.useMemo)((function(){return null==r?void 0:r.map((function(e,t){var n,o,r,a,i,l;return i=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),o.forEach((function(t){Cl(e,t,n[t])}))}return e}({},e),l=null!=(l={id:"".concat(e.partyUuid).concat(e.stockBatchUuid).concat(t),key:"".concat(e.partyUuid).concat(e.stockBatchUuid).concat(t),uuid:"".concat(e.partyUuid).concat(e.stockBatchUuid).concat(t),expires:J(null==e?void 0:e.expiration),location:null==e?void 0:e.partyName,quantity:null!==(o=null==e||null===(n=e.quantity)||void 0===n?void 0:n.toLocaleString())&&void 0!==o?o:"",batch:null!==(r=e.batchNumber)&&void 0!==r?r:"",packaging:null!==(a=e.quantityUoM)&&void 0!==a?a:""})?l:{},Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(l)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n.push.apply(n,o)}return n}(Object(l)).forEach((function(e){Object.defineProperty(i,e,Object.getOwnPropertyDescriptor(l,e))})),i}))}),[r]);return o?l().createElement(a.gqd,{role:"progressbar"}):(null==r?void 0:r.length)>0?l().createElement(_l,{columns:m,data:p,totalItems:s,goToPage:c,hasToolbar:!1}):l().createElement("div",{className:Fn.tileContainer},l().createElement(a.n9L,{className:Fn.tile},l().createElement("p",{className:Fn.content},d("quantityToDisplay","No quantity to display"))))};function wl(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}const Sl=function(e){var t,n,o=e.isEditing,r=e.model,a=e.onSave,s=(0,E.useTranslation)().t,c=(t=(0,i.useState)(0),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,r,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(a.push(o.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw r}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return wl(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?wl(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),u=c[0],d=c[1],m=function(e){d(e)},p=[{name:s("stockItemDetails","Stock Item Details"),component:l().createElement(_i,{handleTabChange:m,model:r,onSave:a,isEditing:o})},{name:s("packagingUnits","Packaging Units"),component:l().createElement(rl,{isEditing:!0,handleTabChange:m,stockItemUuid:r.uuid}),disabled:!o},{name:s("transactions","Transactions"),component:l().createElement(vl,{stockItemUuid:r.uuid}),disabled:!o},{name:s("batchInformation","Batch Information"),component:l().createElement(hl,{stockItemUuid:r.uuid}),disabled:!o},{name:s("quantities","Quantities"),component:l().createElement(El,{stockItemUuid:r.uuid}),disabled:!o},{name:s("stockRules","Stock Rules"),component:l().createElement(Hi,{stockItemUuid:r.uuid}),disabled:!o}];return l().createElement(Wn,{onChange:m,tabs:p,selectedIndex:u})};function Bl(e,t,n,o,r,a,i){try{var l=e[a](i),s=l.value}catch(e){return void n(e)}l.done?t(s):Promise.resolve(s).then(o,r)}var Ol=function(){var e=function(e){return function(){var t=this,n=arguments;return new Promise((function(o,r){var a=e.apply(t,n);function i(e){Bl(a,o,r,i,l,"next",e)}function l(e){Bl(a,o,r,i,l,"throw",e)}i(void 0)}))}}((function(e){var t,n,r,a,i,l,s=arguments;return function(e,t){var n,o,r,a,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,o&&(r=2&a[0]?o.return:a[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,a[1])).done)return r;switch(o=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,o=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((r=(r=i.trys).length>0&&r[r.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){i.label=a[1];break}if(6===a[0]&&i.label<r[1]){i.label=r[1],r=a;break}if(r&&i.label<r[2]){i.label=r[2],i.ops.push(a);break}r[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],o=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}(this,(function(c){switch(c.label){case 0:t=s.length>1&&void 0!==s[1]&&s[1],c.label=1;case 1:return c.trys.push([1,3,,4]),[4,(t?Je:Ke)(e)];case 2:return(null==(n=c.sent())?void 0:n.data)&&((0,o.showToast)({critical:!0,title:"".concat(t?"Edit":"Add"," Stock Item"),kind:"success",description:"Stock Item ".concat(t?"Edited":"Added"," Successfully")}),t||(Q(),(r=n.data).isDrug=!!r.drugUuid,xl(r,!0))),[3,4];case 3:return a=c.sent(),(0,o.showNotification)({title:"Error ".concat(t?"edit":"add","ing a stock item"),kind:"error",critical:!0,description:null==a||null===(l=a.responseBody)||void 0===l||null===(i=l.error)||void 0===i?void 0:i.message}),[3,4];case 4:return[2]}}))}));return function(t){return e.apply(this,arguments)}}(),xl=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];Y("".concat(t?"Edit":"Add"," ").concat((null==e?void 0:e.drugName)||""),l().createElement(Sl,{model:e,onSave:function(e){return Ol(e,t)},isEditing:t}))};const Dl=function(){var e=(0,E.useTranslation)().t,t=(0,i.useCallback)((function(){xl(Za,!1)}),[]);return l().createElement(a.zxk,{onClick:t,size:"md",kind:"primary"},e("stockmanagement.addnew","Add New"))};var Nl=n(1048),Il={};Il.styleTagTransform=b(),Il.setAttributes=g(),Il.insert=p().bind(null,"head"),Il.domAPI=d(),Il.insertStyleElement=f(),c()(Nl.Z,Il);const Tl=Nl.Z&&Nl.Z.locals?Nl.Z.locals:void 0,Pl=function(e){var t=e.filterType,n=e.changeFilterType;return l().createElement(a.SYO,{name:"is-drug",defaultSelected:t,onChange:n,className:Tl.spacing},l().createElement(a.EUY,{labelText:"All",value:"",id:"is-drug-all"}),l().createElement(a.EUY,{labelText:"Drugs",value:"true",id:"is-drug-drug"}),l().createElement(a.EUY,{labelText:"Other",value:"false",id:"is-drug-other"}))};function Ul(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function jl(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,r,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(a.push(o.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Ul(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ul(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}const Fl=function(){var e=(0,E.useTranslation)().t,t=(0,i.useCallback)((function(){var e=(0,o.showModal)("import-bulk-stock-items",{closeModal:function(){return e()}})}),[]);return l().createElement(a.zxk,{kind:"ghost",onClick:t,iconDescription:e("import","Import")},e("import","Import"))},Ll=function(e){var t,n=e.data,o=(0,E.useTranslation)().t;return l().createElement(a.zxk,{kind:"ghost",size:"md",onClick:function(){n.isDrug=!!n.drugUuid,xl(n,!0)},iconDescription:o("editStockItem","Edit Stock Item")},"".concat(null!==(t=null==n?void 0:n.drugName)&&void 0!==t?t:n.conceptName))};function zl(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Rl(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),o.forEach((function(t){zl(e,t,n[t])}))}return e}function Ml(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n.push.apply(n,o)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}const ql=function(){var e=(0,E.useTranslation)().t,t=function(e){(0,E.useTranslation)().t;var t=jl((0,i.useState)(1),2),n=t[0],r=t[1],a=jl((0,i.useState)(10),2),l=a[0],s=a[1],c=jl((0,i.useState)(null),2),u=c[0],d=c[1],m=jl((0,i.useState)(""),2),p=m[0],A=m[1],g=jl((0,i.useState)({startIndex:n-1,v:e||U.Default,limit:10,q:null,totalCount:!0}),2),_=g[0],f=g[1],v=He(_),b=v.items,h=v.isLoading,y=v.isError,k=(0,o.usePagination)(b.results,l);return(0,i.useEffect)((function(){f({startIndex:n-1,v:U.Default,limit:l,q:u,totalCount:!0,isDrug:p})}),[u,n,l,p]),{items:k.results,pagination:k,totalCount:b.totalCount,currentPageSize:l,currentPage:n,setCurrentPage:r,setPageSize:s,pageSizes:[10,20,30,40,50],isLoading:h,isError:y,isDrug:p,setDrug:function(e){r(1),A(e)},setSearchString:d}}(U.Full),n=t.isLoading,r=t.items,s=t.totalCount,c=t.currentPageSize,u=t.pageSizes,d=t.currentPage,m=t.setCurrentPage,p=t.isDrug,A=t.setDrug,g=(0,i.useMemo)((function(){return[{id:0,header:e("type","Type"),key:"type"},{id:1,header:e("genericName","Generic Name"),key:"genericName"},{id:2,header:e("commonName","Common Name"),key:"commonName"},{id:3,header:e("tradeName","Trade Name"),key:"tradeName"},{id:4,header:e("dispensingUnitName","Dispensing UoM"),key:"dispensingUnitName"},{id:5,header:e("defaultStockOperationsUoMName","Bulk Packaging"),key:"defaultStockOperationsUoMName"},{id:6,header:e("reorderLevel","Reorder Level"),key:"reorderLevel"},{id:7,key:"actions",header:"Actions"}]}),[e]),_=(0,i.useMemo)((function(){return null==r?void 0:r.map((function(t,n){var o;return Ml(Rl({},t),{id:null==t?void 0:t.uuid,key:"key-".concat(null==t?void 0:t.uuid),uuid:"".concat(null==t?void 0:t.uuid),type:(null==t?void 0:t.drugUuid)?e("drug","Drug"):e("other","Other"),genericName:l().createElement(Ll,{data:r[n]}),commonName:null==t?void 0:t.commonName,tradeName:(null==t?void 0:t.drugUuid)?null==t?void 0:t.conceptName:"",preferredVendorName:null==t?void 0:t.preferredVendorName,dispensingUoM:null==t?void 0:t.defaultStockOperationsUoMName,dispensingUnitName:null==t?void 0:t.dispensingUnitName,defaultStockOperationsUoMName:null==t?void 0:t.defaultStockOperationsUoMName,reorderLevel:(null==t?void 0:t.reorderLevelUoMName)&&(null==t?void 0:t.reorderLevel)?"".concat(null==t||null===(o=t.reorderLevel)||void 0===o?void 0:o.toLocaleString()," ").concat(null==t?void 0:t.reorderLevelUoMName):"",actions:l().createElement(a.ua7,{align:"bottom",label:"Edit Stock Item"},l().createElement(a.zxk,{kind:"ghost",size:"md",onClick:function(){t.isDrug=!!t.drugUuid,xl(t,!0)},iconDescription:e("editStockItem","Edit Stock Item"),renderIcon:function(e){return l().createElement(dt.I8,Rl({size:16},e))}}))})}))}),[r,e]);return n?l().createElement(a.gqd,{role:"progressbar"}):l().createElement(l().Fragment,null,l().createElement(a.x45,null,e("panelDescription","Drugs and other stock items managed by the system.")),l().createElement(a.wQF,{rows:_,headers:g,isSortable:!0,useZebraStyles:!0,render:function(t){var n=t.rows,r=t.headers,i=t.getHeaderProps,s=t.getTableProps,c=t.getRowProps,u=t.getBatchActionProps,d=t.onInputChange;return l().createElement(a.xJi,null,l().createElement(a.fjU,{style:{position:"static",overflow:"visible",backgroundColor:"color"}},l().createElement(a.iG6,u()),l().createElement(a.Vj0,{style:{display:"flex",alignItems:"center"}},l().createElement(a.Ys1,{persistent:!0,onChange:d}),l().createElement(Pl,{filterType:p,changeFilterType:A}),l().createElement(Fl,null),l().createElement(Dl,null))),l().createElement(a.iA_,s(),l().createElement(a.ssF,null,l().createElement(a.SCH,null,r.map((function(e){var t,n;return"details"!==e.key&&l().createElement(a.xDH,Ml(Rl({},i({header:e,isSortable:e.isSortable})),{className:o.isDesktop?Fn.desktopHeader:Fn.tabletHeader,key:"".concat(e.key),isSortable:"name"!==e.key}),null!==(n=null===(t=e.header)||void 0===t?void 0:t.content)&&void 0!==n?n:e.header)})),l().createElement(a.xDH,null))),l().createElement(a.RMI,null,n.map((function(e){return l().createElement(l().Fragment,{key:e.id},l().createElement(a.SCH,Ml(Rl({className:o.isDesktop?Fn.desktopRow:Fn.tabletRow},c({row:e})),{key:e.id}),e.cells.map((function(e){var t;return"details"!==(null==e||null===(t=e.info)||void 0===t?void 0:t.header)&&l().createElement(a.pj1,{key:e.id},e.value)}))))})))),0===n.length?l().createElement("div",{className:Fn.tileContainer},l().createElement(a.n9L,{className:Fn.tile},l().createElement("div",{className:Fn.tileContent},l().createElement("p",{className:Fn.content},e("noItemsToDisplay","No Stock Items to display")),l().createElement("p",{className:Fn.helper},e("checkFilters","Check the filters above"))))):null)}}),l().createElement(a.tlE,{page:d,pageSize:c,pageSizes:u,totalItems:s,onChange:function(e){var t=e.page;return m(t)},className:Fn.paginationOverride}))},Gl=function(){return l().createElement("div",{style:{margin:"5px"}},l().createElement(ql,null))},Hl=function(){return l().createElement("div",{style:{margin:"5px"}},l().createElement("span",null,"Coming Soon..."))};function Zl(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}const Yl=function(){var e=(0,E.useTranslation)().t,t=function(e){var t,n,r=Et(e),a=r.locations,l=r.isErrorLocation,s=r.isLoadingLocations,c=(t=(0,i.useState)(10),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,r,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(a.push(o.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw r}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return Zl(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Zl(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),u=c[0],d=c[1],m=(0,o.usePagination)(a.results,u),p=m.goTo,A=m.results,g=m.currentPage,_=(0,E.useTranslation)().t,f=(0,i.useMemo)((function(){return[{id:0,header:_("name","Name"),key:"name"},{id:1,header:_("tags","Tags"),key:"tags"},{id:2,header:_("childLocations","Child Locations"),key:"childLocations"},{id:3,header:_("actions","Actions"),key:"actions"}]}),[_]),v=(0,i.useMemo)((function(){var e;return null==a||null===(e=a.results)||void 0===e?void 0:e.map((function(e){var t,n,o,r,a,i;return{id:null==e?void 0:e.uuid,key:"key-".concat(null==e?void 0:e.uuid),uuid:"".concat(null==e?void 0:e.uuid),name:"".concat(null==e?void 0:e.name),tags:null!==(a=null==e||null===(n=e.tags)||void 0===n||null===(t=n.map((function(e){return e.display})))||void 0===t?void 0:t.join(", "))&&void 0!==a?a:"",childLocations:null!==(i=null==e||null===(r=e.childLocations)||void 0===r||null===(o=r.map((function(e){return e.display})))||void 0===o?void 0:o.join(", "))&&void 0!==i?i:""}}))}),[null==a?void 0:a.results]);return{items:a.results,currentPage:g,currentPageSize:u,paginatedQueueEntries:A,goTo:p,pageSizes:[10,20,30,40,50],isLoadingLocations:s,isErrorLocation:l,setPageSize:d,tableHeaders:f,tableRows:v}}({v:U.Full}),n=t.tableHeaders,r=t.tableRows,s=t.items,c=t.isLoadingLocations,u=function(){},d=function(){};return c?l().createElement(a.gqd,{role:"progressbar"}):(null==s?void 0:s.length)?l().createElement(_l,{columns:n,data:r},(function(t){var n=t.onInputChange;return l().createElement(l().Fragment,null,l().createElement(a.Ys1,{persistent:!0,onChange:n}),l().createElement(a.Voz,null,l().createElement(a.VjL,{onClick:u},"Refresh")),l().createElement(a.zxk,{onClick:d,size:"md",kind:"primary"},e("stockmanagement.addnewlocation","Add Location")))})):l().createElement("div",{className:Fn.tileContainer},l().createElement(a.n9L,{className:Fn.tile},l().createElement("p",{className:Fn.content},"No stock items to display")))},Ql=function(){return l().createElement("div",{style:{margin:"5px"}},l().createElement(Yl,null))};var Wl="@openmrs/esm-stock-management-app",Kl={featureName:"stock-management",moduleName:Wl},Jl=n(3979),Vl=(0,o.getSyncLifecycle)((function(){var e=(0,E.useTranslation)().t,t=e("manageStock","Manage Stock");return l().createElement(a.mh4,null,l().createElement(a.Ohc,{href:window.getOpenmrsSpaBase()+"stock-management",rel:"noopener noreferrer"},l().createElement("div",null,l().createElement("div",{className:"heading"},t),l().createElement("div",{className:"content"},e("stockManagement","Stock Management"))),l().createElement("div",{className:"iconWrapper"},l().createElement(be.ol,{size:16}))))}),Kl),Xl=(0,o.getSyncLifecycle)((function(){return l().createElement(o.ExtensionSlot,{name:"stock-management-dashboard-slot"})}),Kl),$l=(0,o.getSyncLifecycle)((function(){var e="".concat(window.getOpenmrsSpaBase(),"stock-management");return l().createElement(Te.BrowserRouter,{basename:e},l().createElement("div",{className:Se.container},l().createElement(Ie,null),l().createElement("div",null,l().createElement(fe,null),l().createElement(Te.Routes,null,l().createElement(Te.Route,{path:"overview",element:l().createElement(At,null)}),l().createElement(Te.Route,{path:"",element:l().createElement(At,null)}),l().createElement(Te.Route,{path:"stock-items",element:l().createElement(Gl,null)}),l().createElement(Te.Route,{path:"stock-operations",element:l().createElement(Ha,null)}),l().createElement(Te.Route,{path:"stock-user-scopes",element:l().createElement(Xt,null)}),l().createElement(Te.Route,{path:"stock-sources",element:l().createElement(In,null)}),l().createElement(Te.Route,{path:"stock-locations",element:l().createElement(Ql,null)}),l().createElement(Te.Route,{path:"stock-settings",element:l().createElement(Hl,null)}))),l().createElement(Ce,null)))}),Kl),es=(0,o.getSyncLifecycle)((function(e){var t,n,r=e.title,s=e.requireReason,c=e.operation,u=e.closeModal,d=r.toLocaleLowerCase().trim(),m=(0,E.useTranslation)().t,p=ue((0,i.useState)(""),2),A=p[0],g=p[1],_=ue((0,i.useState)(!1),2),f=_[0],v=_[1],b=(t=function(e){var t;return function(e,t){var n,o,r,a,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,o&&(r=2&a[0]?o.return:a[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,a[1])).done)return r;switch(o=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,o=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((r=(r=i.trys).length>0&&r[r.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){i.label=a[1];break}if(6===a[0]&&i.label<r[1]){i.label=r[1],r=a;break}if(r&&i.label<r[2]){i.label=r[2],i.ops.push(a);break}r[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],o=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}(this,(function(n){switch(e.preventDefault(),v(!0),t=null,d){case"submit":t="SUBMIT";break;case"dispatch":case"dispatchapproval":t="DISPATCH";break;case"complete":case"completedispatch":t="COMPLETE";break;case"cancel":t="CANCEL";break;case"reject":t="REJECT";break;case"return":t="RETURN";break;case"approve":t="APPROVE"}return t?(function(e){var t=new AbortController;return(0,o.openmrsFetch)("ws/rest/v1/stockmanagement/stockoperationaction",{method:"POST",headers:{"Content-Type":"application/json"},signal:t.signal,body:e})}({name:t,uuid:null==c?void 0:c.uuid,reason:A}).then((function(){v(!1),(0,o.showToast)({critical:!0,title:m("title","".concat(r," Operation")),kind:"success",description:m("successMessage","You have successfully ".concat(r," operation "))}),u(),Q()}),(function(e){v(!1);var t=le(e);(0,o.showNotification)({description:m("errorDescription",t.join(", ")),title:m("errorDescriptionTitle","Error on saving form"),kind:"error",critical:!0}),u(),Q()})),[2]):[2]}))},n=function(){var e=this,n=arguments;return new Promise((function(o,r){var a=t.apply(e,n);function i(e){ce(a,o,r,i,l,"next",e)}function l(e){ce(a,o,r,i,l,"throw",e)}i(void 0)}))},function(e){return n.apply(this,arguments)});return l().createElement("div",null,l().createElement(a.l09,{onSubmit:b},l().createElement(a.xBx,{closeModal:u,title:m("title","".concat(r," Operation"))}),l().createElement(a.fef,null,l().createElement("div",{className:P.modalBody},l().createElement("section",{className:P.section},l().createElement("h5",{className:P.section},"Would you really like to ",r," the operation ?")),l().createElement("br",null),s&&l().createElement("section",{className:P.section},l().createElement(a.Kx8,{labelText:m("notes","Please explain the reason:"),id:"nextNotes",name:"nextNotes",invalidText:"Required",maxCount:500,enableCounter:!0,onChange:function(e){return g(e.target.value)}})))),l().createElement(a.mzw,null,l().createElement(a.zxk,{kind:"secondary",onClick:u},m("cancel","Cancel")),f?l().createElement(a.lSo,null):l().createElement(a.zxk,{type:"submit"},m("submit","Submit")))))}),Kl),ts=(0,o.getSyncLifecycle)((function(e){var t=e.close,n=e.onConfirmation,o=e.uuid,r=(0,E.useTranslation)().t;return l().createElement(l().Fragment,null,l().createElement(a.xBx,{closeModal:t,className:N.productiveHeading03},r("deleteStock","Delete Stock source"),"?"),l().createElement(a.fef,null,l().createElement("p",{className:N.bodyLong01},r("deleteConfirmationText","Are you sure you want to delete this source? This action can't be undone.",{encounter:o}))),l().createElement(a.mzw,null,l().createElement(a.zxk,{size:"lg",kind:"secondary",onClick:function(){return t()}},r("cancel","Cancel")),l().createElement(a.zxk,{autoFocus:!0,kind:"danger",onClick:function(){return null==n?void 0:n()},size:"lg"},r("delete","Delete"))))}),{featureName:"delete-stock-modal",moduleName:Wl}),ns=(0,o.getSyncLifecycle)((function(e){var t=e.close,n=e.onConfirmation,o=e.uuid,r=(0,E.useTranslation)().t;return l().createElement(l().Fragment,null,l().createElement(a.xBx,{closeModal:t,className:N.productiveHeading03},r("deleteStockUserScope","Delete Stock User Scope"),"?"),l().createElement(a.fef,null,l().createElement("p",{className:N.bodyLong01},r("deleteConfirmationText","Are you sure you want to delete this User Scope? This action can't be undone.",{encounter:o}))),l().createElement(a.mzw,null,l().createElement(a.zxk,{size:"lg",kind:"secondary",onClick:function(){return t()}},r("cancel","Cancel")),l().createElement(a.zxk,{autoFocus:!0,kind:"danger",onClick:function(){return null==n?void 0:n()},size:"lg"},r("delete","Delete"))))}),{featureName:"delete-stock-user-scope-modal",moduleName:Wl}),os=(0,o.getSyncLifecycle)((function(e){var t=e.closeModal,n=(0,E.useTranslation)().t,r=O((0,i.useState)(),2),s=r[0],c=r[1],u=O((0,i.useState)(!0),2),d=u[0],m=(u[1],O((0,i.useState)(!0),2)),p=(m[0],m[1]);return l().createElement("div",null,l().createElement(a.l09,null,l().createElement(a.xBx,{closeModal:t,title:n("importStockItems","Import Stock Items")}),l().createElement(a.fef,null,l().createElement(a.bAu,{accept:[".csv"],multiple:!1,name:"file",buttonLabel:"Select file",labelDescription:"Only .csv files at 2mb or less",filenameStatus:"edit",labelTitle:"",size:"small",onChange:function(e){var t,n,o=null==e||null===(n=e.target)||void 0===n||null===(t=n.files)||void 0===t?void 0:t[0];o?(c(o),p(!1)):e.preventDefault()},onDelete:function(){p(!0)}})),l().createElement(a.mzw,null,l().createElement(a.zxk,{kind:"secondary",onClick:t},n("cancel","Cancel")),l().createElement(a.zxk,{type:"button",onClick:function(){if(s){var e=new FormData;s&&(e.append("file",s,"Import_Stock_Items.csv"),e.append("hasHeader",d?"true":"false")),function(e){return S.apply(this,arguments)}(e).then((function(e){(0,o.showToast)({critical:!0,title:n("rejectOrder","Uploaded Order"),kind:"success",description:n("Successfully uploaded","You have successfully uploaded stock items")}),t()}),(function(e){(0,o.showNotification)({title:n("errorUploadingItems', 'An error occurred uploading stock items"),kind:"error",critical:!0,description:null==e?void 0:e.message})}))}}},n("uploadStockItems","Upload StockItems")))))}),Kl),rs=(0,o.getSyncLifecycle)((function(){var e=window.getOpenmrsSpaBase();return l().createElement(a.Ohc,{className:k.customTile,id:"menu-item",href:"".concat(e,"stock-management")},l().createElement("div",{className:"customTileTitle"},l().createElement(C.yG,{size:24})),l().createElement("div",null,"Stock Management"))}),Kl);function as(){(0,o.defineConfigSchema)(Wl,r)}},3979:(e,t,n)=>{var o={"./en.json":[3574,574]};function r(e){if(!n.o(o,e))return Promise.resolve().then((()=>{var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}));var t=o[e],r=t[0];return n.e(t[1]).then((()=>n(r)))}r.keys=()=>Object.keys(o),r.id=3979,e.exports=r}}]);
|