@openmrs/esm-stock-management-app 3.0.1-pre.891 → 3.0.1-pre.895
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/0.js +1 -0
- package/dist/0.js.map +1 -0
- package/dist/119.js +1 -1
- package/dist/119.js.map +1 -1
- package/dist/152.js +1 -1
- package/dist/152.js.map +1 -1
- package/dist/226.js +1 -0
- package/dist/226.js.map +1 -0
- package/dist/235.js +1 -1
- package/dist/235.js.map +1 -1
- package/dist/27.js +1 -1
- package/dist/27.js.map +1 -1
- package/dist/{172.js → 278.js} +1 -1
- package/dist/{172.js.map → 278.js.map} +1 -1
- package/dist/299.js +1 -1
- package/dist/299.js.map +1 -1
- package/dist/33.js +1 -1
- package/dist/33.js.map +1 -1
- package/dist/339.js +1 -0
- package/dist/339.js.map +1 -0
- package/dist/426.js +2 -0
- package/dist/426.js.map +1 -0
- package/dist/444.js +1 -0
- package/dist/444.js.map +1 -0
- package/dist/467.js +1 -1
- package/dist/467.js.map +1 -1
- package/dist/501.js +1 -0
- package/dist/501.js.map +1 -0
- package/dist/574.js +1 -1
- package/dist/675.js +1 -1
- package/dist/675.js.map +1 -1
- package/dist/703.js +1 -1
- package/dist/703.js.map +1 -1
- package/dist/93.js +1 -1
- package/dist/93.js.map +1 -1
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/openmrs-esm-stock-management-app.js +1 -1
- package/dist/openmrs-esm-stock-management-app.js.buildmanifest.json +137 -137
- package/dist/openmrs-esm-stock-management-app.js.map +1 -1
- package/dist/routes.json +1 -1
- package/package.json +1 -1
- package/src/core/components/carbon/{controlled-number-input/controlled-number-input.component.tsx → controlled-number-input.component.tsx} +1 -1
- package/src/core/components/carbon/{controlled-radio-button-group/controlled-radio-button-group.component.tsx → controlled-radio-button-group.component.tsx} +1 -1
- package/src/core/components/{privilages-component/privilages.component.tsx → privileged-view-component/privileged-view.component.tsx} +4 -5
- package/src/index.ts +4 -4
- package/src/stock-home/stock-home-inventory-card.component.tsx +1 -1
- package/src/stock-items/add-stock-item/batch-information/batch-information.component.tsx +1 -2
- package/src/stock-items/add-stock-item/packaging-units/{packaging-units-delete-modal-button.component.tsx → delete-packaging-unit-action-button.component.tsx} +15 -15
- package/src/stock-items/add-stock-item/packaging-units/{packaging-units-delete-modal.component.tsx → packaging-units-delete.modal.tsx} +4 -4
- package/src/stock-items/add-stock-item/packaging-units/packaging-units.component.tsx +3 -3
- package/src/stock-items/add-stock-item/quantities/quantities.component.tsx +2 -3
- package/src/stock-items/add-stock-item/stock-item-details/stock-item-details.component.tsx +3 -3
- package/src/stock-items/add-stock-item/stock-item-references/stock-item-references.component.tsx +1 -1
- package/src/stock-items/add-stock-item/stock-item-rules/{delete-stock-rule-modal.component.tsx → delete-stock-rule.modal.tsx} +3 -3
- package/src/stock-items/add-stock-item/stock-item-units-edit/stock-item-units-edit.component.tsx +1 -1
- package/src/stock-items/stock-items-table.component.tsx +3 -3
- package/src/stock-items/stock-items-table.scss +5 -0
- package/src/stock-operations/stock-operations-table.component.tsx +4 -3
- package/src/stock-operations/stock-operations-table.scss +5 -0
- package/src/stock-reports/report-list/stock-reports.component.tsx +3 -5
- package/src/stock-reports/report-list/stock-reports.scss +5 -0
- package/src/stock-settings/stock-settings.component.tsx +4 -4
- package/src/stock-settings/stock-settings.scss +2 -2
- package/src/stock-sources/{delete-stock-modal.component.tsx → delete-stock-source.modal.tsx} +3 -3
- package/src/stock-sources/stock-sources-delete/stock-sources-delete.test.tsx +1 -1
- package/src/stock-sources/stock-sources-items-table.component.tsx +5 -4
- package/src/stock-sources/stock-sources-items-table.test.tsx +33 -9
- package/src/stock-sources/stock-sources.scss +5 -0
- package/src/stock-user-role-scopes/add-stock-user-scope/add-stock-user-role-scope.workspace.tsx +1 -1
- package/src/stock-user-role-scopes/{delete-stock-user-scope-modal.component.tsx → delete-stock-user-scope.modal.tsx} +3 -3
- package/src/stock-user-role-scopes/stock-user-role-scopes-items-table.component.tsx +3 -4
- package/src/stock-user-role-scopes/stock-user-role-scopes.scss +5 -0
- package/translations/en.json +13 -16
- package/dist/10.js +0 -1
- package/dist/10.js.map +0 -1
- package/dist/20.js +0 -1
- package/dist/20.js.map +0 -1
- package/dist/290.js +0 -1
- package/dist/290.js.map +0 -1
- package/dist/642.js +0 -1
- package/dist/642.js.map +0 -1
- package/dist/734.js +0 -2
- package/dist/734.js.map +0 -1
- package/dist/744.js +0 -1
- package/dist/744.js.map +0 -1
- 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 +0 -5
- 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 +0 -5
- 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 +0 -5
- 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 +0 -5
- 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 +0 -10
- 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 +0 -5
- package/src/stock-app-menu-item/item.resource.ts +0 -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.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 +0 -5
- 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 +0 -5
- package/src/stock-items/add-stock-item/drug-selector/drug-selector.scss +0 -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/quantities/quantities.scss +0 -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 +0 -5
- package/src/stock-items/components/filter-stock-items/filter-stock-items.resource.tsx +0 -0
- package/src/stock-locations/stock-locations.resource.ts +0 -0
- /package/dist/{734.js.LICENSE.txt → 426.js.LICENSE.txt} +0 -0
- /package/src/core/components/carbon/{controlled-combo-box/controlled-combo-box.component.tsx → controlled-combo-box.component.tsx} +0 -0
- /package/src/core/components/carbon/{controlled-dropdown/controlled-dropdown.component.tsx → controlled-dropdown.component.tsx} +0 -0
- /package/src/core/components/carbon/{controlled-text-area/controlled-text-area.component.tsx → controlled-text-area.component.tsx} +0 -0
- /package/src/core/components/carbon/{controlled-text-input/controlled-text-input.component.tsx → controlled-text-input.component.tsx} +0 -0
- /package/src/core/components/{privilages-component/privilages.scss → privileged-view-component/privileged-view.scss} +0 -0
- /package/src/stock-items/add-stock-item/{add-stock-item.resource.tsx → add-stock-item.resource.ts} +0 -0
- /package/src/stock-items/add-stock-item/batch-information/{batch-information.resource.tsx → batch-information.resource.ts} +0 -0
- /package/src/stock-items/add-stock-item/drug-selector/{drug-selector.resource.tsx → drug-selector.resource.ts} +0 -0
- /package/src/stock-items/add-stock-item/packaging-units/{packaging-units.resource.tsx → packaging-units.resource.ts} +0 -0
- /package/src/stock-items/add-stock-item/quantities/{quantities.resource.tsx → quantities.resource.ts} +0 -0
- /package/src/stock-items/add-stock-item/stock-item-details/{stock-item-details.resource.tsx → stock-item-details.resource.ts} +0 -0
- /package/src/stock-items/add-stock-item/stock-item-rules/{stock-item-rules.resource.tsx → stock-item-rules.resource.ts} +0 -0
- /package/src/stock-items/add-stock-item/transactions/{transactions.resource.tsx → transactions.resource.ts} +0 -0
- /package/src/stock-locations/{stock-locations-table.resource.tsx → stock-locations-table.resource.ts} +0 -0
- /package/src/stock-operations/{stock-operations-table.resource.tsx → stock-operations-table.resource.ts} +0 -0
@@ -2,7 +2,7 @@ import React from 'react';
|
|
2
2
|
import { type RadioButtonGroupProps } from '@carbon/react/lib/components/RadioButtonGroup/RadioButtonGroup';
|
3
3
|
import { type Control, Controller, type FieldValues } from 'react-hook-form';
|
4
4
|
import { RadioButtonGroup, RadioButton } from '@carbon/react';
|
5
|
-
import { type RadioOption } from '
|
5
|
+
import { type RadioOption } from '../../../stock-items/add-stock-item/stock-item-details/stock-item-details.resource';
|
6
6
|
|
7
7
|
interface ControlledRadioButtonGroupProps<T> extends RadioButtonGroupProps {
|
8
8
|
controllerName: string;
|
@@ -2,15 +2,14 @@ import React from 'react';
|
|
2
2
|
import { useTranslation } from 'react-i18next';
|
3
3
|
import { Tile } from '@carbon/react';
|
4
4
|
import { DocumentProtected } from '@carbon/react/icons';
|
5
|
+
import styles from './privileged-view.scss';
|
5
6
|
|
6
|
-
|
7
|
-
|
8
|
-
interface PrivilageComponentProps {
|
7
|
+
interface PrivilegedViewComponentProps {
|
9
8
|
title: string;
|
10
9
|
description?: string;
|
11
10
|
}
|
12
11
|
|
13
|
-
export const
|
12
|
+
export const PrivilegedView: React.FC<PrivilegedViewComponentProps> = ({ title, description }) => {
|
14
13
|
const { t } = useTranslation();
|
15
14
|
|
16
15
|
return (
|
@@ -18,7 +17,7 @@ export const PrivilagedView: React.FC<PrivilageComponentProps> = ({ title, descr
|
|
18
17
|
<Tile className={styles.tile}>
|
19
18
|
<div className={styles.tileContent}>
|
20
19
|
<DocumentProtected size="24" />
|
21
|
-
<p className={styles.content}>{t('
|
20
|
+
<p className={styles.content}>{t('noPrivilegesTitle', `${title}`)}</p>
|
22
21
|
{description && (
|
23
22
|
<p className={styles.helper}>
|
24
23
|
{t('noViewPrivilegesDescription', 'Description: {{description}}', {
|
package/src/index.ts
CHANGED
@@ -2,7 +2,7 @@ import { defineConfigSchema, getAsyncLifecycle, getSyncLifecycle } from '@openmr
|
|
2
2
|
import { configSchema } from './config-schema';
|
3
3
|
import { createDashboardLink } from './createDashboardLink';
|
4
4
|
import appMenu from './stock-app-menu-item/item.component';
|
5
|
-
import deletePackagingUnitModalButtonComponent from './stock-items/add-stock-item/packaging-units/packaging-
|
5
|
+
import deletePackagingUnitModalButtonComponent from './stock-items/add-stock-item/packaging-units/delete-packaging-unit-action-button.component';
|
6
6
|
import Root from './root.component';
|
7
7
|
import SideMenu from './side-menu/side-menu.component';
|
8
8
|
import StockHomeLandingPage from './stock-home/stock-home-landing-page-component';
|
@@ -27,13 +27,13 @@ const options = {
|
|
27
27
|
|
28
28
|
export const importTranslation = require.context('../translations', false, /.json$/, 'lazy');
|
29
29
|
|
30
|
-
export const deleteStockModal = getAsyncLifecycle(() => import('./stock-sources/delete-stock-modal
|
30
|
+
export const deleteStockModal = getAsyncLifecycle(() => import('./stock-sources/delete-stock-source.modal'), {
|
31
31
|
featureName: 'delete-stock-modal',
|
32
32
|
moduleName,
|
33
33
|
});
|
34
34
|
|
35
35
|
export const deleteUserScopeModal = getAsyncLifecycle(
|
36
|
-
() => import('./stock-user-role-scopes/delete-stock-user-scope
|
36
|
+
() => import('./stock-user-role-scopes/delete-stock-user-scope.modal'),
|
37
37
|
{
|
38
38
|
featureName: 'delete-stock-user-scope-modal',
|
39
39
|
moduleName,
|
@@ -41,7 +41,7 @@ export const deleteUserScopeModal = getAsyncLifecycle(
|
|
41
41
|
);
|
42
42
|
|
43
43
|
export const deletePackagingUnitModal = getAsyncLifecycle(
|
44
|
-
() => import('./stock-items/add-stock-item/packaging-units/packaging-units-delete
|
44
|
+
() => import('./stock-items/add-stock-item/packaging-units/packaging-units-delete.modal'),
|
45
45
|
{
|
46
46
|
featureName: 'delete-packaging-unit-modal',
|
47
47
|
moduleName,
|
@@ -17,7 +17,7 @@ const StockHomeInventoryCard = () => {
|
|
17
17
|
}
|
18
18
|
|
19
19
|
if (stockItems?.length === 0) {
|
20
|
-
return <p>{t('noInventoryAlerts', 'No inventory alerts to display')}</p>;
|
20
|
+
return <p className={styles.content}>{t('noInventoryAlerts', 'No inventory alerts to display')}</p>;
|
21
21
|
}
|
22
22
|
|
23
23
|
const currentDate = new Date();
|
@@ -1,9 +1,8 @@
|
|
1
1
|
import React, { useEffect, useMemo, useState } from 'react';
|
2
2
|
import { useTranslation } from 'react-i18next';
|
3
3
|
import { formatDisplayDate } from '../../../core/utils/datetimeUtils';
|
4
|
-
import { DataTableSkeleton
|
4
|
+
import { DataTableSkeleton } from '@carbon/react';
|
5
5
|
import DataList from '../../../core/components/table/table.component';
|
6
|
-
import styles from '../../stock-items-table.scss';
|
7
6
|
import { useStockItemBatchInformationHook } from './batch-information.resource';
|
8
7
|
import BatchInformationLocationsFilter from './batch-information-locations/batch-information-locations-filter.component';
|
9
8
|
import { useForm } from 'react-hook-form';
|
@@ -1,34 +1,34 @@
|
|
1
1
|
import React, { useCallback } from 'react';
|
2
|
+
import { useTranslation } from 'react-i18next';
|
2
3
|
import { Button } from '@carbon/react';
|
3
4
|
import { TrashCan } from '@carbon/react/icons';
|
4
5
|
import { showModal } from '@openmrs/esm-framework';
|
5
6
|
import { type StockItemPackagingUOMDTO } from '../../../core/api/types/stockItem/StockItemPackagingUOM';
|
6
7
|
|
7
|
-
interface
|
8
|
+
interface DeletePackagingUnitActionButtonProps {
|
8
9
|
row?: StockItemPackagingUOMDTO;
|
9
|
-
closeModal: () => void;
|
10
10
|
}
|
11
11
|
|
12
|
-
const
|
12
|
+
const DeletePackagingUnitActionButton: React.FC<DeletePackagingUnitActionButtonProps> = ({ row }) => {
|
13
|
+
const { t } = useTranslation();
|
13
14
|
const launchDeleteModal = useCallback(() => {
|
14
15
|
const dispose = showModal('delete-packaging-unit-modal', {
|
15
16
|
closeModal: () => dispose(),
|
16
17
|
row,
|
17
18
|
});
|
18
19
|
}, [row]);
|
20
|
+
|
19
21
|
return (
|
20
|
-
<
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
/>
|
30
|
-
</div>
|
22
|
+
<Button
|
23
|
+
type="button"
|
24
|
+
size="sm"
|
25
|
+
className="submitButton clear-padding-margin"
|
26
|
+
iconDescription={t('delete', 'Delete')}
|
27
|
+
kind="ghost"
|
28
|
+
renderIcon={TrashCan}
|
29
|
+
onClick={launchDeleteModal}
|
30
|
+
/>
|
31
31
|
);
|
32
32
|
};
|
33
33
|
|
34
|
-
export default
|
34
|
+
export default DeletePackagingUnitActionButton;
|
@@ -1,18 +1,18 @@
|
|
1
1
|
import React, { useState, useEffect } from 'react';
|
2
2
|
import { useTranslation } from 'react-i18next';
|
3
3
|
import { Button, ModalHeader, ModalBody, ModalFooter, TextArea } from '@carbon/react';
|
4
|
-
import { showSnackbar
|
4
|
+
import { showSnackbar } from '@openmrs/esm-framework';
|
5
5
|
import { type StockItemPackagingUOMDTO } from '../../../core/api/types/stockItem/StockItemPackagingUOM';
|
6
6
|
import { deleteStockItemPackagingUnit } from '../../stock-items.resource';
|
7
7
|
import { useStockItemPackageUnitsHook } from './packaging-units.resource';
|
8
8
|
import styles from '../packaging-units/packaging-units.scss';
|
9
9
|
|
10
|
-
interface
|
10
|
+
interface DeletePackagingUnitModalProps {
|
11
11
|
row?: StockItemPackagingUOMDTO;
|
12
12
|
closeModal: () => void;
|
13
13
|
}
|
14
14
|
|
15
|
-
const
|
15
|
+
const DeletePackagingUnitModal: React.FC<DeletePackagingUnitModalProps> = ({ row, closeModal }) => {
|
16
16
|
const { t } = useTranslation();
|
17
17
|
const { mutate, setStockItemUuid } = useStockItemPackageUnitsHook();
|
18
18
|
|
@@ -85,4 +85,4 @@ const DeletePackagingUnit: React.FC<DeletePackagingUnitProps> = ({ row, closeMod
|
|
85
85
|
);
|
86
86
|
};
|
87
87
|
|
88
|
-
export default
|
88
|
+
export default DeletePackagingUnitModal;
|
@@ -21,8 +21,8 @@ import { handleMutate } from '../../../utils';
|
|
21
21
|
import { type PackageUnitFormData, packageUnitSchema } from './validationSchema';
|
22
22
|
import { type StockItemPackagingUOMDTO } from '../../../core/api/types/stockItem/StockItemPackagingUOM';
|
23
23
|
import { useStockItemPackageUnitsHook } from './packaging-units.resource';
|
24
|
-
import ControlledNumberInput from '../../../core/components/carbon/controlled-number-input
|
25
|
-
import
|
24
|
+
import ControlledNumberInput from '../../../core/components/carbon/controlled-number-input.component';
|
25
|
+
import DeletePackagingUnitActionButton from './delete-packaging-unit-action-button.component';
|
26
26
|
import PackagingUnitsConceptSelector from '../packaging-units-concept-selector/packaging-units-concept-selector.component';
|
27
27
|
import styles from './packaging-units.scss';
|
28
28
|
|
@@ -299,7 +299,7 @@ const PackagingUnitRow: React.FC<{
|
|
299
299
|
/>
|
300
300
|
</TableCell>
|
301
301
|
<TableCell>
|
302
|
-
<
|
302
|
+
<DeletePackagingUnitActionButton row={row} />
|
303
303
|
</TableCell>
|
304
304
|
</TableRow>
|
305
305
|
</>
|
@@ -2,10 +2,9 @@ import React, { useEffect, useMemo } from 'react';
|
|
2
2
|
import { useTranslation } from 'react-i18next';
|
3
3
|
import { ResourceRepresentation } from '../../../core/api/api';
|
4
4
|
import { formatDisplayDate } from '../../../core/utils/datetimeUtils';
|
5
|
-
import { DataTableSkeleton
|
6
|
-
import DataList from '../../../core/components/table/table.component';
|
7
|
-
import styles from '../../stock-items-table.scss';
|
5
|
+
import { DataTableSkeleton } from '@carbon/react';
|
8
6
|
import { useStockItemQuantitiesHook } from './quantities.resource';
|
7
|
+
import DataList from '../../../core/components/table/table.component';
|
9
8
|
|
10
9
|
interface StockQuantitiesProps {
|
11
10
|
onSubmit?: () => void;
|
@@ -13,9 +13,9 @@ import { launchAddOrEditStockItemWorkspace } from '../../stock-item.utils';
|
|
13
13
|
import { stockItemDetailsSchema, type StockItemFormData } from '../../validationSchema';
|
14
14
|
import { type StockItemDTO } from '../../../core/api/types/stockItem/StockItem';
|
15
15
|
import ConceptsSelector from '../concepts-selector/concepts-selector.component';
|
16
|
-
import ControlledNumberInput from '../../../core/components/carbon/controlled-number-input
|
17
|
-
import ControlledRadioButtonGroup from '../../../core/components/carbon/controlled-radio-button-group
|
18
|
-
import ControlledTextInput from '../../../core/components/carbon/controlled-text-input
|
16
|
+
import ControlledNumberInput from '../../../core/components/carbon/controlled-number-input.component';
|
17
|
+
import ControlledRadioButtonGroup from '../../../core/components/carbon/controlled-radio-button-group.component';
|
18
|
+
import ControlledTextInput from '../../../core/components/carbon/controlled-text-input.component';
|
19
19
|
import DispensingUnitSelector from '../dispensing-unit-selector/dispensing-unit-selector.component';
|
20
20
|
import DrugSelector from '../drug-selector/drug-selector.component';
|
21
21
|
import PreferredVendorSelector from '../preferred-vendor-selector/preferred-vendor-selector.component';
|
package/src/stock-items/add-stock-item/stock-item-references/stock-item-references.component.tsx
CHANGED
@@ -21,7 +21,7 @@ import { zodResolver } from '@hookform/resolvers/zod';
|
|
21
21
|
import { type StockItemReferenceData } from './validation-schema';
|
22
22
|
import { stockItemDetailsSchema } from '../../validationSchema';
|
23
23
|
import { type StockItemReferenceDTO } from '../../../core/api/types/stockItem/StockItemReference';
|
24
|
-
import ControlledTextInput from '../../../core/components/carbon/controlled-text-input
|
24
|
+
import ControlledTextInput from '../../../core/components/carbon/controlled-text-input.component';
|
25
25
|
import { createStockItemReference, deleteStockItemReference } from '../../stock-items.resource';
|
26
26
|
import { restBaseUrl, showSnackbar } from '@openmrs/esm-framework';
|
27
27
|
import { extractErrorMessagesFromResponse } from '../../../constants';
|
@@ -4,13 +4,13 @@ import { Button, ModalHeader, ModalBody, ModalFooter } from '@carbon/react';
|
|
4
4
|
import { getCoreTranslation } from '@openmrs/esm-framework';
|
5
5
|
import styles from '../../../root.scss';
|
6
6
|
|
7
|
-
interface
|
7
|
+
interface DeleteStockRuleModalProps {
|
8
8
|
uuid?: string;
|
9
9
|
close: () => void;
|
10
10
|
onConfirmation: () => void;
|
11
11
|
}
|
12
12
|
|
13
|
-
const
|
13
|
+
const DeleteStockRuleModal: React.FC<DeleteStockRuleModalProps> = ({ close, onConfirmation, uuid }) => {
|
14
14
|
const { t } = useTranslation();
|
15
15
|
const handleCancel = () => close();
|
16
16
|
const handleDelete = () => onConfirmation?.();
|
@@ -41,4 +41,4 @@ const DeleteConfirmation: React.FC<DeleteConfirmationProps> = ({ close, onConfir
|
|
41
41
|
);
|
42
42
|
};
|
43
43
|
|
44
|
-
export default
|
44
|
+
export default DeleteStockRuleModal;
|
package/src/stock-items/add-stock-item/stock-item-units-edit/stock-item-units-edit.component.tsx
CHANGED
@@ -4,7 +4,7 @@ import { useStockItem } from '../../stock-items.resource';
|
|
4
4
|
import DispensingPackageMeasurement from '../dispensing-package-measurement/dispensing-package-measurement.component';
|
5
5
|
import { type Control, type FormState } from 'react-hook-form';
|
6
6
|
import { type StockItemFormData } from '../../validationSchema';
|
7
|
-
import ControlledNumberInput from '../../../core/components/carbon/controlled-number-input
|
7
|
+
import ControlledNumberInput from '../../../core/components/carbon/controlled-number-input.component';
|
8
8
|
import { NumberInputSkeleton } from '@carbon/react';
|
9
9
|
|
10
10
|
interface StockItemUnitsEditProps {
|
@@ -18,7 +18,6 @@ import {
|
|
18
18
|
TableToolbarContent,
|
19
19
|
TableToolbarMenu,
|
20
20
|
TableToolbarSearch,
|
21
|
-
TabPanel,
|
22
21
|
Tile,
|
23
22
|
} from '@carbon/react';
|
24
23
|
import { Edit } from '@carbon/react/icons';
|
@@ -140,7 +139,6 @@ const StockItemsTableComponent: React.FC<StockItemsTableProps> = () => {
|
|
140
139
|
<IconButton
|
141
140
|
kind="ghost"
|
142
141
|
label={t('editStockItem', 'Edit stock item')}
|
143
|
-
size="md"
|
144
142
|
onClick={() => {
|
145
143
|
stockItem.isDrug = !!stockItem.drugUuid;
|
146
144
|
launchAddOrEditStockItemWorkspace(t, stockItem);
|
@@ -158,7 +156,9 @@ const StockItemsTableComponent: React.FC<StockItemsTableProps> = () => {
|
|
158
156
|
|
159
157
|
return (
|
160
158
|
<>
|
161
|
-
<
|
159
|
+
<h2 className={styles.tableHeader}>
|
160
|
+
{t('stockItemsTableHeader', 'Drugs and other stock items managed by the system.')}
|
161
|
+
</h2>
|
162
162
|
<DataTable
|
163
163
|
rows={tableRows}
|
164
164
|
headers={tableHeaders}
|
@@ -22,7 +22,6 @@ import {
|
|
22
22
|
TableToolbarContent,
|
23
23
|
TableToolbarMenu,
|
24
24
|
TableToolbarSearch,
|
25
|
-
TabPanel,
|
26
25
|
Tile,
|
27
26
|
} from '@carbon/react';
|
28
27
|
import { ArrowRight } from '@carbon/react/icons';
|
@@ -150,7 +149,9 @@ const StockOperations: React.FC<StockOperationsTableProps> = () => {
|
|
150
149
|
|
151
150
|
return (
|
152
151
|
<div>
|
153
|
-
<
|
152
|
+
<h2 className={styles.tableHeader}>
|
153
|
+
{t('stockOperationsTableHeader', 'Stock operations to track movement of stock.')}
|
154
|
+
</h2>
|
154
155
|
<DataTable
|
155
156
|
headers={tableHeaders}
|
156
157
|
isSortable
|
@@ -265,7 +266,7 @@ const StockOperations: React.FC<StockOperationsTableProps> = () => {
|
|
265
266
|
<div className={styles.tileContainer}>
|
266
267
|
<Tile className={styles.tile}>
|
267
268
|
<div className={styles.tileContent}>
|
268
|
-
<p className={styles.content}>{t('noOperationsToDisplay', 'No
|
269
|
+
<p className={styles.content}>{t('noOperationsToDisplay', 'No stock operations to display')}</p>
|
269
270
|
<p className={styles.helper}>{t('checkFilters', 'Check the filters above')}</p>
|
270
271
|
</div>
|
271
272
|
</Tile>
|
@@ -21,7 +21,6 @@ import {
|
|
21
21
|
TableToolbarContent,
|
22
22
|
TableToolbarMenu,
|
23
23
|
TableToolbarSearch,
|
24
|
-
TabPanel,
|
25
24
|
Tile,
|
26
25
|
} from '@carbon/react';
|
27
26
|
import {
|
@@ -49,7 +48,7 @@ import {
|
|
49
48
|
BatchJobStatusPending,
|
50
49
|
} from '../../core/api/types/BatchJob';
|
51
50
|
import { handleMutate } from '../../utils';
|
52
|
-
import {
|
51
|
+
import { PrivilegedView } from '../../core/components/privileged-view-component/privileged-view.component';
|
53
52
|
import NewReportActionButton from './new-report-button.component';
|
54
53
|
import StockReportStatus from './stock-report-status.component';
|
55
54
|
import StockReportParameters from './stock-report-parameters.component';
|
@@ -203,8 +202,7 @@ const StockReports: React.FC = () => {
|
|
203
202
|
|
204
203
|
return (
|
205
204
|
<div className={styles.container}>
|
206
|
-
<
|
207
|
-
|
205
|
+
<h2 className={styles.tableHeader}>{t('stockReportsTableHeader', 'List of reports requested by users.')}</h2>
|
208
206
|
<DataTable
|
209
207
|
rows={tableRows}
|
210
208
|
headers={tableHeaders}
|
@@ -274,7 +272,7 @@ const StockReports: React.FC = () => {
|
|
274
272
|
</TableBody>
|
275
273
|
</Table>
|
276
274
|
{!canViewReports ? (
|
277
|
-
<
|
275
|
+
<PrivilegedView
|
278
276
|
title="Can not view stock reports"
|
279
277
|
description="You have no permissions to view reports"
|
280
278
|
/>
|
@@ -1,15 +1,15 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
import { useTranslation } from 'react-i18next';
|
3
|
-
import styles from './stock-settings.scss';
|
4
|
-
import { navigate } from '@openmrs/esm-framework';
|
5
2
|
import { Button } from '@carbon/react';
|
6
3
|
import { UserSettings } from '@carbon/react/icons';
|
4
|
+
import { useTranslation } from 'react-i18next';
|
5
|
+
import { navigate } from '@openmrs/esm-framework';
|
6
|
+
import styles from './stock-settings.scss';
|
7
7
|
|
8
8
|
function StockSettings() {
|
9
9
|
const { t } = useTranslation();
|
10
10
|
|
11
11
|
return (
|
12
|
-
<div className={styles.
|
12
|
+
<div className={styles.container}>
|
13
13
|
<div className={styles.tableHeader}>
|
14
14
|
{t(
|
15
15
|
'comingSoonUnderDev',
|
@@ -3,14 +3,14 @@
|
|
3
3
|
@use '@carbon/type';
|
4
4
|
@use '@openmrs/esm-styleguide/src/vars' as *;
|
5
5
|
|
6
|
-
.
|
6
|
+
.container {
|
7
7
|
display: flex;
|
8
8
|
justify-content: center;
|
9
9
|
flex-direction: column;
|
10
10
|
justify-content: flex-end;
|
11
11
|
min-height: calc(layout.$layout-07 * 1.25);
|
12
12
|
border: 1px solid colors.$gray-20;
|
13
|
-
margin: layout.$spacing-
|
13
|
+
margin: layout.$spacing-05;
|
14
14
|
align-items: center;
|
15
15
|
background-color: colors.$white-0;
|
16
16
|
|
package/src/stock-sources/{delete-stock-modal.component.tsx → delete-stock-source.modal.tsx}
RENAMED
@@ -4,13 +4,13 @@ import { Button, ModalHeader, ModalBody, ModalFooter } from '@carbon/react';
|
|
4
4
|
import { getCoreTranslation } from '@openmrs/esm-framework';
|
5
5
|
import styles from './delete-stock-modal.scss';
|
6
6
|
|
7
|
-
interface
|
7
|
+
interface DeleteStockSourceModalProps {
|
8
8
|
uuid?: string;
|
9
9
|
close: () => void;
|
10
10
|
onConfirmation: () => void;
|
11
11
|
}
|
12
12
|
|
13
|
-
const
|
13
|
+
const DeleteStockSourceModal: React.FC<DeleteStockSourceModalProps> = ({ close, onConfirmation, uuid }) => {
|
14
14
|
const { t } = useTranslation();
|
15
15
|
const handleCancel = () => close();
|
16
16
|
const handleDelete = () => onConfirmation?.();
|
@@ -39,4 +39,4 @@ const DeleteConfirmation: React.FC<DeleteConfirmationProps> = ({ close, onConfir
|
|
39
39
|
);
|
40
40
|
};
|
41
41
|
|
42
|
-
export default
|
42
|
+
export default DeleteStockSourceModal;
|
@@ -4,7 +4,7 @@ import { render, screen } from '@testing-library/react';
|
|
4
4
|
import { type FetchResponse, showModal, showSnackbar } from '@openmrs/esm-framework';
|
5
5
|
import { deleteStockSource } from '../stock-sources.resource';
|
6
6
|
import { handleMutate } from '../../utils';
|
7
|
-
import DeleteConfirmation from '../../stock-user-role-scopes/delete-stock-user-scope
|
7
|
+
import DeleteConfirmation from '../../stock-user-role-scopes/delete-stock-user-scope.modal';
|
8
8
|
import StockSourcesDeleteActionMenu from './stock-sources-delete.component';
|
9
9
|
|
10
10
|
const mockDeleteStockSource = jest.mocked(deleteStockSource);
|
@@ -15,7 +15,6 @@ import {
|
|
15
15
|
TableToolbarContent,
|
16
16
|
TableToolbarMenu,
|
17
17
|
TableToolbarSearch,
|
18
|
-
TabPanel,
|
19
18
|
Tile,
|
20
19
|
} from '@carbon/react';
|
21
20
|
import { useTranslation } from 'react-i18next';
|
@@ -63,6 +62,7 @@ const StockSourcesItems: React.FC = () => {
|
|
63
62
|
};
|
64
63
|
});
|
65
64
|
}, [items]);
|
65
|
+
|
66
66
|
const handleFilterChange = (selectedSourceType: string) => {
|
67
67
|
setSelectedSourceType(selectedSourceType);
|
68
68
|
};
|
@@ -80,8 +80,9 @@ const StockSourcesItems: React.FC = () => {
|
|
80
80
|
|
81
81
|
return (
|
82
82
|
<div className={styles.tableOverride}>
|
83
|
-
<
|
84
|
-
|
83
|
+
<h2 className={styles.tableHeader}>
|
84
|
+
{t('stockSourcesTableHeader', 'List of partners who provide stock to the facility.')}
|
85
|
+
</h2>
|
85
86
|
<DataTable
|
86
87
|
rows={filteredTableRows}
|
87
88
|
headers={tableHeaders}
|
@@ -155,7 +156,7 @@ const StockSourcesItems: React.FC = () => {
|
|
155
156
|
<div className={styles.tileContainer}>
|
156
157
|
<Tile className={styles.tile}>
|
157
158
|
<div className={styles.tileContent}>
|
158
|
-
<p className={styles.content}>{t('noSourcesToDisplay', 'No
|
159
|
+
<p className={styles.content}>{t('noSourcesToDisplay', 'No stock sources to display')}</p>
|
159
160
|
<p className={styles.helper}>{t('checkFilters', 'Check the filters above')}</p>
|
160
161
|
</div>
|
161
162
|
</Tile>
|
@@ -213,7 +213,10 @@ describe('StockSourcesItems', () => {
|
|
213
213
|
items: mockItems as unknown as StockSource[],
|
214
214
|
isLoading: false,
|
215
215
|
totalItems: 2,
|
216
|
-
tableHeaders: [
|
216
|
+
tableHeaders: [
|
217
|
+
{ id: 0, key: 'name', header: 'Name' },
|
218
|
+
{ id: 1, key: 'sourceType', header: 'Source Type' },
|
219
|
+
],
|
217
220
|
currentPage: 1,
|
218
221
|
pageSizes: [10, 20, 50],
|
219
222
|
goTo: jest.fn(),
|
@@ -223,21 +226,42 @@ describe('StockSourcesItems', () => {
|
|
223
226
|
error: null,
|
224
227
|
});
|
225
228
|
|
229
|
+
// Mock the concept data for the filter
|
230
|
+
mockUseConcept.mockReturnValue({
|
231
|
+
items: {
|
232
|
+
uuid: '1',
|
233
|
+
display: 'Source Types',
|
234
|
+
answers: [
|
235
|
+
{ uuid: '1', display: 'All' },
|
236
|
+
{ uuid: '2', display: 'Internal' },
|
237
|
+
{ uuid: '3', display: 'External' },
|
238
|
+
] as Concept[],
|
239
|
+
} as Concept,
|
240
|
+
isLoading: false,
|
241
|
+
error: null,
|
242
|
+
});
|
243
|
+
|
226
244
|
render(<StockSourcesItems />);
|
227
245
|
|
228
|
-
|
229
|
-
expect(screen.getByText(
|
246
|
+
// Initial state - both sources should be visible
|
247
|
+
expect(screen.getByText(/source a/i)).toBeInTheDocument();
|
248
|
+
expect(screen.getByText(/source b/i)).toBeInTheDocument();
|
230
249
|
|
231
|
-
|
232
|
-
|
250
|
+
// Find and click the source type filter dropdown
|
251
|
+
const filterDropdown = screen.getByRole('combobox', { name: /select source type/i });
|
252
|
+
await user.click(filterDropdown);
|
233
253
|
|
234
|
-
|
235
|
-
|
236
|
-
|
254
|
+
// Select "Internal" from the dropdown
|
255
|
+
const internalOption = screen.getByRole('option', { name: /internal/i });
|
256
|
+
await user.click(internalOption);
|
237
257
|
|
258
|
+
// Wait for Source B to disappear
|
238
259
|
await waitFor(() => {
|
239
|
-
expect(screen.
|
260
|
+
expect(screen.queryByText(/source b/i)).not.toBeInTheDocument();
|
240
261
|
});
|
262
|
+
|
263
|
+
// Verify Source A is still visible
|
264
|
+
expect(screen.getByText(/source a/i)).toBeInTheDocument();
|
241
265
|
});
|
242
266
|
|
243
267
|
test('renders a message when no stock sources are available', () => {
|
package/src/stock-user-role-scopes/add-stock-user-scope/add-stock-user-role-scope.workspace.tsx
CHANGED
@@ -331,7 +331,7 @@ const AddStockUserRoleScope: React.FC<AddStockUserRoleScopeProps> = ({ model, ed
|
|
331
331
|
</>
|
332
332
|
)}
|
333
333
|
</CheckboxGroup>
|
334
|
-
<FormGroup legendText={t('
|
334
|
+
<FormGroup legendText={t('stockOperations', 'Stock operations')}>
|
335
335
|
<span className={styles.subTitle}>
|
336
336
|
{t('roleDescription', 'The role will be applicable to only selected stock operations.')}
|
337
337
|
</span>
|
@@ -4,13 +4,13 @@ import { Button, ModalHeader, ModalBody, ModalFooter } from '@carbon/react';
|
|
4
4
|
import { getCoreTranslation } from '@openmrs/esm-framework';
|
5
5
|
import styles from './delete-stock-user-scope-modal.scss';
|
6
6
|
|
7
|
-
interface
|
7
|
+
interface DeleteStockUserScopeModalProps {
|
8
8
|
uuid?: string;
|
9
9
|
close: () => void;
|
10
10
|
onConfirmation: () => void;
|
11
11
|
}
|
12
12
|
|
13
|
-
const
|
13
|
+
const DeleteStockUserScopeModal: React.FC<DeleteStockUserScopeModalProps> = ({ close, onConfirmation }) => {
|
14
14
|
const { t } = useTranslation();
|
15
15
|
const handleCancel = () => close();
|
16
16
|
const handleDelete = () => onConfirmation?.();
|
@@ -37,4 +37,4 @@ const DeleteConfirmation: React.FC<DeleteConfirmationProps> = ({ close, onConfir
|
|
37
37
|
);
|
38
38
|
};
|
39
39
|
|
40
|
-
export default
|
40
|
+
export default DeleteStockUserScopeModal;
|
@@ -17,7 +17,6 @@ import {
|
|
17
17
|
TableToolbarContent,
|
18
18
|
TableToolbarMenu,
|
19
19
|
TableToolbarSearch,
|
20
|
-
TabPanel,
|
21
20
|
Tile,
|
22
21
|
} from '@carbon/react';
|
23
22
|
import { ArrowDownLeft, ArrowLeft } from '@carbon/react/icons';
|
@@ -159,12 +158,12 @@ function StockUserRoleScopesItems() {
|
|
159
158
|
|
160
159
|
return (
|
161
160
|
<div className={styles.tableOverride}>
|
162
|
-
<
|
161
|
+
<h2 className={styles.tableHeader}>
|
163
162
|
{t(
|
164
|
-
'
|
163
|
+
'stockUserRoleScopesTableHeader',
|
165
164
|
'To access stock management features, users must have assigned roles specifying location and stock operation type scopes.',
|
166
165
|
)}
|
167
|
-
</
|
166
|
+
</h2>
|
168
167
|
<DataTable
|
169
168
|
headers={tableHeaders}
|
170
169
|
isSortable
|