@openmrs/esm-stock-management-app 3.0.1-pre.845 → 3.0.1-pre.853
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/.husky/pre-commit +4 -1
- package/__mocks__/react-i18next.js +8 -9
- package/dist/10.js +1 -1
- package/dist/10.js.map +1 -1
- package/dist/119.js +1 -1
- package/dist/119.js.map +1 -1
- package/dist/14.js +1 -1
- package/dist/14.js.map +1 -1
- package/dist/172.js +1 -1
- package/dist/172.js.map +1 -1
- package/dist/20.js +1 -1
- package/dist/20.js.map +1 -1
- package/dist/290.js +1 -1
- package/dist/290.js.map +1 -1
- package/dist/33.js +1 -0
- package/dist/33.js.map +1 -0
- package/dist/467.js +1 -1
- package/dist/467.js.map +1 -1
- package/dist/574.js +1 -1
- package/dist/606.js +1 -1
- package/dist/606.js.map +1 -1
- package/dist/642.js +1 -1
- package/dist/642.js.map +1 -1
- package/dist/675.js +1 -1
- package/dist/675.js.map +1 -1
- package/dist/727.js +1 -1
- package/dist/727.js.map +1 -1
- package/dist/842.js +1 -1
- package/dist/842.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.buildmanifest.json +70 -70
- package/dist/routes.json +1 -1
- package/jest.config.js +6 -3
- package/package.json +1 -1
- package/src/core/components/overlay/overlay.scss +1 -1
- package/src/core/components/privilages-component/privilages.scss +1 -1
- package/src/core/components/table/table.component.tsx +2 -2
- package/src/core/components/table/table.scss +1 -1
- package/src/core/components/tabs/vertical-tabs.scss +1 -1
- package/src/index.ts +5 -5
- package/src/stock-items/add-bulk-stock-item/add-stock-items-bulk-import-action-button.component.tsx +3 -3
- package/src/stock-items/add-bulk-stock-item/{stock-items-bulk-import.component.tsx → stock-items-bulk-import.modal.tsx} +20 -19
- package/src/stock-items/add-bulk-stock-item/stock-items-bulk-import.resource.ts +1 -1
- package/src/stock-items/add-bulk-stock-item/stock-items-bulk-import.test.tsx +59 -59
- package/src/stock-items/add-stock-item/add-stock-action-button.component.tsx +6 -6
- package/src/stock-items/add-stock-item/add-stock-item.component.tsx +6 -4
- package/src/stock-items/add-stock-item/add-stock-item.scss +5 -0
- package/src/stock-items/add-stock-item/add-stock-item.test.tsx +28 -43
- package/src/stock-items/add-stock-item/packaging-units/packaging-units-delete-modal.component.tsx +3 -4
- package/src/stock-items/add-stock-item/packaging-units/packaging-units.component.tsx +9 -10
- package/src/stock-items/add-stock-item/packaging-units/packaging-units.scss +4 -4
- package/src/stock-items/add-stock-item/stock-item-details/stock-item-details.component.tsx +27 -19
- package/src/stock-items/add-stock-item/stock-item-details/stock-item-details.scss +1 -1
- package/src/stock-items/add-stock-item/stock-item-references/stock-item-references.scss +4 -4
- package/src/stock-items/add-stock-item/stock-item-rules/add-stock-rules.component.tsx +15 -9
- package/src/stock-items/add-stock-item/stock-item-rules/add-stock-rules.scss +1 -0
- package/src/stock-items/add-stock-item/stock-item-rules/delete-stock-rule-modal.component.tsx +2 -1
- package/src/stock-items/add-stock-item/stock-item-rules/stock-item-rules.component.tsx +14 -16
- package/src/stock-items/add-stock-item/stock-item-rules/stock-item-rules.scss +7 -3
- package/src/stock-items/add-stock-item/transactions/printout/transactions-print-bincard-preview.modal.tsx +14 -6
- package/src/stock-items/add-stock-item/transactions/printout/transactions-print-stockcard-preview.modal.tsx +14 -8
- package/src/stock-items/edit-stock-item/edit-stock-item-action-menu.component.tsx +2 -2
- package/src/stock-items/stock-item.utils.tsx +3 -5
- package/src/stock-items/stock-items-table.component.tsx +47 -45
- package/src/stock-items/stock-items-table.resource.ts +2 -2
- package/src/stock-items/stock-items-table.scss +9 -8
- package/src/stock-items/stock-items-table.test.tsx +106 -65
- package/src/stock-items/stock-items.component.tsx +1 -1
- package/src/stock-locations/location-admin-form.component.tsx +5 -4
- package/src/stock-locations/stock-locations-table.component.tsx +10 -8
- package/src/stock-locations/stock-locations.component.tsx +1 -1
- package/src/stock-lookups/stock-lookups.resource.ts +3 -2
- package/src/stock-management-header/stock-management-header.scss +1 -1
- package/src/stock-operations/add-stock-operation/stock-operations-expanded-row/stock-operation-expanded-row.scss +1 -1
- package/src/stock-operations/stock-operations-dialog/stock-operations-dialog.component.tsx +2 -2
- package/src/stock-operations/stock-operations-filters.component.tsx +5 -5
- package/src/stock-operations/stock-operations-forms/input-components/batch-no-selector.component.tsx +11 -11
- package/src/stock-operations/stock-operations-forms/input-components/batch-no-selector.test.tsx +115 -25
- package/src/stock-operations/stock-operations-forms/input-components/qty-uim-selector.test.tsx +107 -65
- package/src/stock-operations/stock-operations-forms/input-components/quantity-uom-selector.component.tsx +9 -9
- package/src/stock-operations/stock-operations-forms/input-components/stock-operation-reason-selector.test.tsx +35 -153
- package/src/stock-operations/stock-operations-forms/input-components/user-selector.test.tsx +82 -29
- package/src/stock-operations/stock-operations-forms/step1.test.tsx +204 -69
- package/src/stock-operations/stock-operations-forms/step2.test.tsx +140 -63
- package/src/stock-operations/stock-operations-forms/step3.test.tsx +79 -60
- package/src/stock-operations/stock-operations-forms/steps/stock-operation-items-form-step.component.tsx +6 -5
- package/src/stock-operations/stock-operations-forms/steps/stock-operation-submission-form-step.component.tsx +12 -11
- package/src/stock-operations/stock-operations-forms/stock-item-form/stock-item-form.scss +1 -0
- package/src/stock-operations/stock-operations-forms/stock-item-form/stock-item-form.workspace.tsx +20 -12
- package/src/stock-operations/stock-operations-forms/stock-operation-form.scss +1 -0
- package/src/stock-operations/stock-operations-forms/stock-operation-stepper/stepper.scss +1 -3
- package/src/stock-operations/stock-operations-forms/stock-operation-stepper/stock-operation-stepper.component.tsx +2 -1
- package/src/stock-operations/stock-operations-table.component.tsx +66 -73
- package/src/stock-operations/stock-operations-table.scss +18 -9
- package/src/stock-operations/stock-operations.component.tsx +1 -1
- package/src/stock-reports/generate-report/create-stock-report.scss +3 -2
- package/src/stock-reports/generate-report/create-stock-report.workspace.tsx +32 -25
- package/src/stock-reports/report-list/stock-report-parameters.component.tsx +1 -1
- package/src/stock-reports/report-list/stock-report-status.component.tsx +1 -1
- package/src/stock-reports/report-list/stock-reports.component.tsx +24 -25
- package/src/stock-reports/report-list/stock-reports.scss +11 -3
- package/src/stock-sources/add-stock-sources/add-stock-sources.scss +12 -5
- package/src/stock-sources/add-stock-sources/add-stock-sources.test.tsx +38 -36
- package/src/stock-sources/add-stock-sources/add-stock-sources.workspace.tsx +35 -30
- package/src/stock-sources/delete-stock-modal.component.tsx +2 -1
- package/src/stock-sources/delete-stock-modal.scss +1 -1
- package/src/stock-sources/stock-sources-delete/stock-sources-delete.test.tsx +27 -36
- package/src/stock-sources/stock-sources-filter/stock-sources-filter.component.tsx +33 -21
- package/src/stock-sources/stock-sources-items-table.component.tsx +16 -17
- package/src/stock-sources/stock-sources-items-table.resource.ts +8 -6
- package/src/stock-sources/stock-sources-items-table.test.tsx +60 -37
- package/src/stock-sources/stock-sources.component.tsx +1 -1
- package/src/stock-sources/stock-sources.scss +6 -2
- package/src/stock-user-role-scopes/add-stock-user-scope/add-stock-user-role-scope.scss +5 -13
- package/src/stock-user-role-scopes/add-stock-user-scope/add-stock-user-role-scope.workspace.tsx +2 -2
- package/src/stock-user-role-scopes/delete-stock-user-scope-modal.component.tsx +2 -1
- package/src/stock-user-role-scopes/delete-stock-user-scope-modal.scss +1 -1
- package/src/stock-user-role-scopes/stock-user-role-scopes.component.tsx +1 -1
- package/src/stock-user-role-scopes/stock-user-role-scopes.scss +1 -1
- package/translations/en.json +5 -6
- package/tsconfig.json +4 -0
- package/dist/627.js +0 -1
- package/dist/627.js.map +0 -1
@@ -1,20 +1,20 @@
|
|
1
|
+
import React, { useCallback, useMemo, useState } from 'react';
|
1
2
|
import { Button, Column, InlineLoading, RadioButton, RadioButtonGroup, Stack } from '@carbon/react';
|
2
3
|
import { ArrowLeft, ArrowRight, Departure, ListChecked, Save, SendFilled } from '@carbon/react/icons';
|
3
|
-
import { restBaseUrl, showSnackbar } from '@openmrs/esm-framework';
|
4
|
-
import React, { useCallback, useMemo, useState } from 'react';
|
5
4
|
import { useFormContext } from 'react-hook-form';
|
6
5
|
import { useTranslation } from 'react-i18next';
|
6
|
+
import { restBaseUrl, showSnackbar } from '@openmrs/esm-framework';
|
7
|
+
import { createStockOperation, deleteStockOperationItem, updateStockOperation } from '../../stock-operations.resource';
|
7
8
|
import { extractErrorMessagesFromResponse } from '../../../constants';
|
8
|
-
import {
|
9
|
-
import { type StockOperationItemDTO } from '../../../core/api/types/stockOperation/StockOperationItemDTO';
|
9
|
+
import { handleMutate } from '../../../utils';
|
10
10
|
import { OperationType, type StockOperationType } from '../../../core/api/types/stockOperation/StockOperationType';
|
11
11
|
import { otherUser } from '../../../core/utils/utils';
|
12
|
-
import { handleMutate } from '../../../utils';
|
13
12
|
import { showActionDialogButton } from '../../stock-operation.utils';
|
14
|
-
import {
|
13
|
+
import { type StockOperationDTO } from '../../../core/api/types/stockOperation/StockOperationDTO';
|
14
|
+
import { type StockOperationItemDTO } from '../../../core/api/types/stockOperation/StockOperationItemDTO';
|
15
15
|
import { type StockOperationItemDtoSchema } from '../../validation-schema';
|
16
|
-
import useOperationTypePermisions from '../hooks/useOperationTypePermisions';
|
17
16
|
import styles from '../stock-operation-form.scss';
|
17
|
+
import useOperationTypePermisions from '../hooks/useOperationTypePermisions';
|
18
18
|
|
19
19
|
type StockOperationSubmissionFormStepProps = {
|
20
20
|
onPrevious?: () => void;
|
@@ -23,6 +23,7 @@ type StockOperationSubmissionFormStepProps = {
|
|
23
23
|
onNext?: () => void;
|
24
24
|
dismissWorkspace?: () => void;
|
25
25
|
};
|
26
|
+
|
26
27
|
const StockOperationSubmissionFormStep: React.FC<StockOperationSubmissionFormStepProps> = ({
|
27
28
|
onPrevious,
|
28
29
|
stockOperationType,
|
@@ -152,12 +153,12 @@ const StockOperationSubmissionFormStep: React.FC<StockOperationSubmissionFormSte
|
|
152
153
|
<RadioButtonGroup
|
153
154
|
name="rbgApprovelRequired"
|
154
155
|
legendText={t('doesThisTransactionRequireApproval', 'Does the transaction require approval ?')}
|
155
|
-
onChange={handleRadioButtonChange}
|
156
|
+
onChange={(value) => handleRadioButtonChange(value === 'true')}
|
156
157
|
readOnly={!editable}
|
157
|
-
valueSelected={approvalRequired === true ? true : approvalRequired === false ? false : null}
|
158
|
+
valueSelected={approvalRequired === true ? 'true' : approvalRequired === false ? 'false' : null}
|
158
159
|
>
|
159
|
-
<RadioButton value=
|
160
|
-
<RadioButton value=
|
160
|
+
<RadioButton value="true" id="rbgApprovelRequired-true" labelText={t('yes', 'Yes')} />
|
161
|
+
<RadioButton value="false" id="rbgApprovelRequired-false" labelText={t('no', 'No')} />
|
161
162
|
</RadioButtonGroup>
|
162
163
|
</Column>
|
163
164
|
{editable && (
|
package/src/stock-operations/stock-operations-forms/stock-item-form/stock-item-form.workspace.tsx
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
import React, { useMemo } from 'react';
|
2
|
+
import classNames from 'classnames';
|
1
3
|
import {
|
2
4
|
Button,
|
3
5
|
ButtonSet,
|
@@ -10,8 +12,7 @@ import {
|
|
10
12
|
TextInput,
|
11
13
|
} from '@carbon/react';
|
12
14
|
import { zodResolver } from '@hookform/resolvers/zod';
|
13
|
-
import {
|
14
|
-
import React, { useMemo } from 'react';
|
15
|
+
import { useConfig, useLayoutType } from '@openmrs/esm-framework';
|
15
16
|
import { Controller, useForm } from 'react-hook-form';
|
16
17
|
import { useTranslation } from 'react-i18next';
|
17
18
|
import { type z } from 'zod';
|
@@ -20,14 +21,14 @@ import {
|
|
20
21
|
operationFromString,
|
21
22
|
type StockOperationType,
|
22
23
|
} from '../../../core/api/types/stockOperation/StockOperationType';
|
23
|
-
import { useStockItem } from '../../../stock-items/stock-items.resource';
|
24
24
|
import { type BaseStockOperationItemFormData, getStockOperationItemFormSchema } from '../../validation-schema';
|
25
|
-
import
|
25
|
+
import { type ConfigObject } from '../../../config-schema';
|
26
|
+
import { useStockItem } from '../../../stock-items/stock-items.resource';
|
26
27
|
import BatchNoSelector from '../input-components/batch-no-selector.component';
|
27
28
|
import QtyUomSelector from '../input-components/quantity-uom-selector.component';
|
28
|
-
import styles from './stock-item-form.scss';
|
29
29
|
import UniqueBatchNoEntryInput from '../input-components/unique-batch-no-entry-input.component';
|
30
|
-
import
|
30
|
+
import useOperationTypePermisions from '../hooks/useOperationTypePermisions';
|
31
|
+
import styles from './stock-item-form.scss';
|
31
32
|
|
32
33
|
export interface StockItemFormProps {
|
33
34
|
stockOperationType: StockOperationType;
|
@@ -37,18 +38,19 @@ export interface StockItemFormProps {
|
|
37
38
|
}
|
38
39
|
|
39
40
|
const StockItemForm: React.FC<StockItemFormProps> = ({ stockOperationType, stockOperationItem, onSave, onBack }) => {
|
41
|
+
const isTablet = useLayoutType() === 'tablet';
|
40
42
|
const operationType = useMemo(() => {
|
41
43
|
return operationFromString(stockOperationType.operationType);
|
42
44
|
}, [stockOperationType]);
|
43
|
-
const
|
45
|
+
const formSchema = useMemo(() => {
|
44
46
|
return getStockOperationItemFormSchema(operationType);
|
45
47
|
}, [operationType]);
|
46
48
|
const operationTypePermision = useOperationTypePermisions(stockOperationType);
|
47
49
|
const { useItemCommonNameAsDisplay } = useConfig<ConfigObject>();
|
48
50
|
|
49
|
-
const fields =
|
50
|
-
const form = useForm<z.infer<typeof
|
51
|
-
resolver: zodResolver(
|
51
|
+
const fields = formSchema.keyof().options;
|
52
|
+
const form = useForm<z.infer<typeof formSchema>>({
|
53
|
+
resolver: zodResolver(formSchema),
|
52
54
|
defaultValues: stockOperationItem,
|
53
55
|
mode: 'all',
|
54
56
|
});
|
@@ -66,9 +68,10 @@ const StockItemForm: React.FC<StockItemFormProps> = ({ stockOperationType, stock
|
|
66
68
|
return `${item?.drugName || t('noDrugNameAvailable', 'No drug name available') + (commonName ?? '')}`;
|
67
69
|
}, [item, useItemCommonNameAsDisplay, t]);
|
68
70
|
|
69
|
-
const onSubmit = (data: z.infer<typeof
|
71
|
+
const onSubmit = (data: z.infer<typeof formSchema>) => {
|
70
72
|
onSave?.(data);
|
71
73
|
};
|
74
|
+
|
72
75
|
return (
|
73
76
|
<Form onSubmit={form.handleSubmit(onSubmit)} className={styles.form}>
|
74
77
|
<Stack gap={4} className={styles.grid}>
|
@@ -197,7 +200,12 @@ const StockItemForm: React.FC<StockItemFormProps> = ({ stockOperationType, stock
|
|
197
200
|
)}
|
198
201
|
</Stack>
|
199
202
|
|
200
|
-
<ButtonSet
|
203
|
+
<ButtonSet
|
204
|
+
className={classNames(styles.buttonSet, {
|
205
|
+
[styles.tablet]: isTablet,
|
206
|
+
[styles.desktop]: !isTablet,
|
207
|
+
})}
|
208
|
+
>
|
201
209
|
<Button className={styles.button} kind="secondary" onClick={onBack}>
|
202
210
|
{t('discard', 'Discard')}
|
203
211
|
</Button>
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import { Layer } from '@carbon/react';
|
2
1
|
import React from 'react';
|
2
|
+
import { Layer } from '@carbon/react';
|
3
3
|
import styles from './stepper.scss';
|
4
4
|
|
5
5
|
export type Step = {
|
@@ -17,6 +17,7 @@ type StockOperationStepperProps = {
|
|
17
17
|
selectedIndex?: number;
|
18
18
|
onChange?: (index: number) => void;
|
19
19
|
};
|
20
|
+
|
20
21
|
const StockOperationStepper: React.FC<StockOperationStepperProps> = ({
|
21
22
|
steps,
|
22
23
|
hasContainer,
|
@@ -1,9 +1,11 @@
|
|
1
|
+
import React, { useCallback, useMemo, useState } from 'react';
|
1
2
|
import {
|
2
3
|
DataTable,
|
3
4
|
DataTableSkeleton,
|
4
5
|
DatePicker,
|
5
6
|
DatePickerInput,
|
6
7
|
InlineLoading,
|
8
|
+
Link,
|
7
9
|
Pagination,
|
8
10
|
Table,
|
9
11
|
TableBody,
|
@@ -22,22 +24,18 @@ import {
|
|
22
24
|
TableToolbarSearch,
|
23
25
|
TabPanel,
|
24
26
|
Tile,
|
25
|
-
Link,
|
26
27
|
} from '@carbon/react';
|
27
28
|
import { ArrowRight } from '@carbon/react/icons';
|
28
|
-
import { isDesktop, restBaseUrl } from '@openmrs/esm-framework';
|
29
|
-
import React, { useCallback, useMemo, useState } from 'react';
|
30
29
|
import { useTranslation } from 'react-i18next';
|
30
|
+
import { isDesktop, restBaseUrl } from '@openmrs/esm-framework';
|
31
31
|
import { DATE_PICKER_CONTROL_FORMAT, DATE_PICKER_FORMAT, StockFilters } from '../constants';
|
32
|
-
import { ResourceRepresentation } from '../core/api/api';
|
33
|
-
import { StockOperationType } from '../core/api/types/stockOperation/StockOperationType';
|
34
32
|
import { formatDisplayDate } from '../core/utils/datetimeUtils';
|
35
33
|
import { handleMutate } from '../utils';
|
34
|
+
import { ResourceRepresentation } from '../core/api/api';
|
35
|
+
import { useStockOperationPages } from './stock-operations-table.resource';
|
36
36
|
import EditStockOperationActionMenu from './edit-stock-operation/edit-stock-operation-action-menu.component';
|
37
37
|
import StockOperationTypesSelector from './stock-operation-types-selector/stock-operation-types-selector.component';
|
38
38
|
import StockOperationsFilters from './stock-operations-filters.component';
|
39
|
-
import { useStockOperationPages } from './stock-operations-table.resource';
|
40
|
-
|
41
39
|
import StockOperationExpandedRow from './add-stock-operation/stock-operations-expanded-row/stock-operation-expanded-row.component';
|
42
40
|
import styles from './stock-operations-table.scss';
|
43
41
|
|
@@ -47,6 +45,7 @@ interface StockOperationsTableProps {
|
|
47
45
|
|
48
46
|
const StockOperations: React.FC<StockOperationsTableProps> = () => {
|
49
47
|
const { t } = useTranslation();
|
48
|
+
|
50
49
|
const handleRefresh = () => {
|
51
50
|
handleMutate(`${restBaseUrl}/stockmanagement/stockoperation`);
|
52
51
|
};
|
@@ -96,46 +95,48 @@ const StockOperations: React.FC<StockOperationsTableProps> = () => {
|
|
96
95
|
}
|
97
96
|
};
|
98
97
|
|
99
|
-
const tableRows = useMemo(
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
?.
|
106
|
-
|
107
|
-
|
98
|
+
const tableRows = useMemo(
|
99
|
+
() =>
|
100
|
+
items?.map((stockOperation, index) => {
|
101
|
+
const threshHold = 1;
|
102
|
+
const itemCountGreaterThanThreshhold = (stockOperation?.stockOperationItems?.length ?? 0) > threshHold;
|
103
|
+
const commonNames =
|
104
|
+
stockOperation?.stockOperationItems
|
105
|
+
?.slice(0, itemCountGreaterThanThreshhold ? threshHold : undefined)
|
106
|
+
.map((item) => item.commonName)
|
107
|
+
.join(', ') ?? '';
|
108
108
|
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
109
|
+
return {
|
110
|
+
...stockOperation,
|
111
|
+
id: stockOperation?.uuid,
|
112
|
+
key: `key-${stockOperation?.uuid}`,
|
113
|
+
operationTypeName: `${stockOperation?.operationTypeName}`,
|
114
|
+
operationNumber: (
|
115
|
+
<EditStockOperationActionMenu stockOperation={stockOperation} showIcon={false} showprops={true} />
|
116
|
+
),
|
117
|
+
stockOperationItems: {
|
118
|
+
commonNames,
|
119
|
+
more: itemCountGreaterThanThreshhold ? stockOperation?.stockOperationItems?.length - threshHold : 0,
|
120
|
+
},
|
121
|
+
status: `${stockOperation?.status}`,
|
122
|
+
source: `${stockOperation?.sourceName ?? ''}`,
|
123
|
+
destination: `${stockOperation?.destinationName ?? ''}`,
|
124
|
+
location: (
|
125
|
+
<>
|
126
|
+
{stockOperation?.sourceName ?? ''}
|
127
|
+
{stockOperation?.sourceName && stockOperation?.destinationName ? <ArrowRight size={16} /> : ''}{' '}
|
128
|
+
{stockOperation?.destinationName ?? ''}
|
129
|
+
</>
|
130
|
+
),
|
131
|
+
responsiblePerson: `${
|
132
|
+
stockOperation?.responsiblePersonFamilyName ?? stockOperation?.responsiblePersonOther ?? ''
|
133
|
+
} ${stockOperation?.responsiblePersonGivenName ?? ''}`,
|
134
|
+
operationDate: formatDisplayDate(stockOperation?.operationDate),
|
135
|
+
actions: <EditStockOperationActionMenu stockOperation={stockOperation} showIcon={true} showprops={false} />,
|
136
|
+
};
|
137
|
+
}),
|
138
|
+
[items],
|
139
|
+
);
|
139
140
|
|
140
141
|
if (isLoading && !filterApplied) {
|
141
142
|
return (
|
@@ -144,26 +145,22 @@ const StockOperations: React.FC<StockOperationsTableProps> = () => {
|
|
144
145
|
}
|
145
146
|
|
146
147
|
return (
|
147
|
-
<div
|
148
|
+
<div>
|
148
149
|
<TabPanel>{t('stockOperationTrackMovement', 'Stock operations to track movement of stock.')}</TabPanel>
|
149
|
-
<div id="table-tool-bar">
|
150
|
-
<div></div>
|
151
|
-
<div className="right-filters"></div>
|
152
|
-
</div>
|
153
150
|
<DataTable
|
154
|
-
rows={tableRows}
|
155
151
|
headers={tableHeaders}
|
156
|
-
isSortable
|
157
|
-
|
152
|
+
isSortable
|
153
|
+
rows={tableRows}
|
154
|
+
useZebraStyles
|
158
155
|
render={({
|
159
|
-
|
160
|
-
|
156
|
+
expandRow,
|
157
|
+
getExpandedRowProps,
|
161
158
|
getHeaderProps,
|
162
|
-
getTableProps,
|
163
159
|
getRowProps,
|
160
|
+
getTableProps,
|
161
|
+
headers,
|
164
162
|
onInputChange,
|
165
|
-
|
166
|
-
expandRow,
|
163
|
+
rows,
|
167
164
|
}) => (
|
168
165
|
<TableContainer>
|
169
166
|
<TableToolbar
|
@@ -175,34 +172,30 @@ const StockOperations: React.FC<StockOperationsTableProps> = () => {
|
|
175
172
|
>
|
176
173
|
<TableToolbarContent className={styles.toolbarContent}>
|
177
174
|
<TableToolbarSearch
|
178
|
-
className={styles.patientListSearch}
|
179
175
|
expanded
|
176
|
+
labelText={t('searchStockOperations', 'Search stock operations')}
|
180
177
|
onChange={onInputChange}
|
181
|
-
placeholder=
|
182
|
-
size="sm"
|
178
|
+
placeholder={t('searchStockOperations', 'Search stock operations')}
|
183
179
|
/>
|
184
|
-
<div className={styles.
|
180
|
+
<div className={styles.container}>
|
185
181
|
<DatePicker
|
186
|
-
className={styles.
|
182
|
+
className={styles.datePicker}
|
187
183
|
datePickerType="range"
|
188
184
|
dateFormat={DATE_PICKER_CONTROL_FORMAT}
|
185
|
+
onChange={([startDate, endDate]) => handleDateFilterChange([startDate, endDate])}
|
189
186
|
value={[selectedFromDate, selectedToDate]}
|
190
|
-
onChange={([startDate, endDate]) => {
|
191
|
-
handleDateFilterChange([startDate, endDate]);
|
192
|
-
}}
|
193
187
|
>
|
194
|
-
<DatePickerInput placeholder={DATE_PICKER_FORMAT} />
|
195
|
-
<DatePickerInput placeholder={DATE_PICKER_FORMAT} />
|
188
|
+
<DatePickerInput labelText={t('startDate', 'Start date')} placeholder={DATE_PICKER_FORMAT} />
|
189
|
+
<DatePickerInput labelText={t('endDate', 'End date')} placeholder={DATE_PICKER_FORMAT} />
|
196
190
|
</DatePicker>
|
197
|
-
|
198
191
|
<StockOperationsFilters filterName={StockFilters.SOURCES} onFilterChange={handleOnFilterChange} />
|
199
|
-
|
200
192
|
<StockOperationsFilters filterName={StockFilters.STATUS} onFilterChange={handleOnFilterChange} />
|
201
|
-
|
202
193
|
<StockOperationsFilters filterName={StockFilters.OPERATION} onFilterChange={handleOnFilterChange} />
|
203
194
|
</div>
|
204
195
|
<TableToolbarMenu>
|
205
|
-
<TableToolbarAction onClick={handleRefresh}>
|
196
|
+
<TableToolbarAction className={styles.toolbarMenuAction} onClick={handleRefresh}>
|
197
|
+
{t('refresh', 'Refresh')}
|
198
|
+
</TableToolbarAction>
|
206
199
|
</TableToolbarMenu>
|
207
200
|
|
208
201
|
<StockOperationTypesSelector />
|
@@ -1,7 +1,7 @@
|
|
1
|
+
@use '@carbon/colors';
|
1
2
|
@use '@carbon/layout';
|
2
3
|
@use '@carbon/type';
|
3
|
-
@use '@
|
4
|
-
@use '~@openmrs/esm-styleguide/src/vars' as *;
|
4
|
+
@use '@openmrs/esm-styleguide/src/vars' as *;
|
5
5
|
|
6
6
|
.tileContainer {
|
7
7
|
background-color: $ui-02;
|
@@ -34,23 +34,20 @@
|
|
34
34
|
.toolbarContent {
|
35
35
|
display: flex;
|
36
36
|
align-items: center;
|
37
|
+
height: layout.$spacing-09;
|
38
|
+
margin-top: layout.$spacing-05;
|
37
39
|
}
|
38
40
|
|
39
|
-
.
|
41
|
+
.container {
|
40
42
|
display: flex;
|
41
43
|
align-items: center;
|
42
|
-
|
43
|
-
|
44
|
-
.dateAlign {
|
45
|
-
padding-top: layout.$spacing-03;
|
46
|
-
height: 100%;
|
44
|
+
justify-content: space-between;
|
47
45
|
}
|
48
46
|
|
49
47
|
.filterContainer {
|
50
48
|
display: flex;
|
51
49
|
align-items: center;
|
52
50
|
justify-content: space-between;
|
53
|
-
margin-bottom: layout.$spacing-05;
|
54
51
|
}
|
55
52
|
|
56
53
|
.rowLoadingContainer {
|
@@ -96,3 +93,15 @@
|
|
96
93
|
.relatedTransactionHeader {
|
97
94
|
color: colors.$green-50;
|
98
95
|
}
|
96
|
+
|
97
|
+
.toolbarMenuAction {
|
98
|
+
max-width: none;
|
99
|
+
}
|
100
|
+
|
101
|
+
.dataTableSkeleton {
|
102
|
+
margin-top: layout.$spacing-09;
|
103
|
+
}
|
104
|
+
|
105
|
+
.datePicker {
|
106
|
+
margin-bottom: layout.$spacing-05;
|
107
|
+
}
|
@@ -1,5 +1,5 @@
|
|
1
|
-
@use '@carbon/
|
2
|
-
@use '@carbon/
|
1
|
+
@use '@carbon/layout';
|
2
|
+
@use '@carbon/type';
|
3
3
|
@use '@openmrs/esm-styleguide/src/vars' as *;
|
4
4
|
|
5
5
|
.formContainer {
|
@@ -11,6 +11,7 @@
|
|
11
11
|
}
|
12
12
|
|
13
13
|
.button {
|
14
|
+
height: layout.$spacing-10;
|
14
15
|
display: flex;
|
15
16
|
align-content: flex-start;
|
16
17
|
align-items: baseline;
|
@@ -1,48 +1,48 @@
|
|
1
1
|
import React, { useEffect, useMemo, useState } from 'react';
|
2
|
+
import classNames from 'classnames';
|
3
|
+
import { useTranslation } from 'react-i18next';
|
2
4
|
import {
|
3
5
|
Button,
|
4
|
-
|
6
|
+
ButtonSet,
|
7
|
+
Checkbox,
|
5
8
|
ComboBox,
|
6
|
-
DatePickerInput,
|
7
9
|
DatePicker,
|
10
|
+
DatePickerInput,
|
11
|
+
InlineLoading,
|
12
|
+
NumberInput,
|
13
|
+
RadioButton,
|
14
|
+
RadioButtonGroup,
|
8
15
|
Select,
|
9
16
|
SelectItem,
|
10
|
-
RadioButtonGroup,
|
11
|
-
RadioButton,
|
12
|
-
Form,
|
13
|
-
Checkbox,
|
14
|
-
NumberInput,
|
15
|
-
ButtonSet,
|
16
17
|
} from '@carbon/react';
|
17
|
-
import styles from './create-stock-report.scss';
|
18
|
-
import { useTranslation } from 'react-i18next';
|
19
|
-
import { useReportTypes } from '../stock-reports.resource';
|
20
|
-
import { DATE_PICKER_CONTROL_FORMAT, DATE_PICKER_FORMAT, formatForDatePicker, today } from '../../constants';
|
21
|
-
import { Controller, useForm } from 'react-hook-form';
|
22
|
-
import { zodResolver } from '@hookform/resolvers/zod';
|
23
|
-
import { type StockReportSchema, reportSchema } from '../report-validation-schema';
|
24
|
-
import { useConcept, useStockTagLocations } from '../../stock-lookups/stock-lookups.resource';
|
25
18
|
import {
|
26
19
|
type ConfigObject,
|
27
20
|
type DefaultWorkspaceProps,
|
21
|
+
getCoreTranslation,
|
28
22
|
restBaseUrl,
|
29
23
|
showSnackbar,
|
30
24
|
useConfig,
|
31
|
-
|
25
|
+
useLayoutType,
|
32
26
|
} from '@openmrs/esm-framework';
|
33
|
-
import {
|
34
|
-
import {
|
27
|
+
import { Controller, useForm } from 'react-hook-form';
|
28
|
+
import { zodResolver } from '@hookform/resolvers/zod';
|
35
29
|
import {
|
36
|
-
ReportParameter,
|
37
30
|
getParamDefaultLimit,
|
38
31
|
getReportEndDateLabel,
|
39
32
|
getReportLimitLabel,
|
40
33
|
getReportStartDateLabel,
|
34
|
+
ReportParameter,
|
41
35
|
} from '../ReportType';
|
42
|
-
import {
|
36
|
+
import { DATE_PICKER_CONTROL_FORMAT, DATE_PICKER_FORMAT, formatForDatePicker, today } from '../../constants';
|
43
37
|
import { BatchJobTypeReport } from '../../core/api/types/BatchJob';
|
38
|
+
import { createBatchJob } from '../../stock-batch/stock-batch.resource';
|
39
|
+
import { formatDisplayDate } from '../../core/utils/datetimeUtils';
|
44
40
|
import { handleMutate } from '../../utils';
|
45
|
-
import {
|
41
|
+
import { type Concept } from '../../core/api/types/concept/Concept';
|
42
|
+
import { type StockReportSchema, reportSchema } from '../report-validation-schema';
|
43
|
+
import { useConcept, useStockTagLocations } from '../../stock-lookups/stock-lookups.resource';
|
44
|
+
import { useReportTypes } from '../stock-reports.resource';
|
45
|
+
import styles from './create-stock-report.scss';
|
46
46
|
|
47
47
|
type CreateReportProps = DefaultWorkspaceProps & {
|
48
48
|
model?: ReportModel;
|
@@ -76,9 +76,11 @@ export interface ReportModel {
|
|
76
76
|
mostLeastMovingName?: string;
|
77
77
|
fullFillment?: string[];
|
78
78
|
}
|
79
|
+
|
79
80
|
const CreateReport: React.FC<CreateReportProps> = ({ model, closeWorkspace }) => {
|
80
81
|
const { t } = useTranslation();
|
81
82
|
const { stockItemCategoryUUID } = useConfig<ConfigObject>();
|
83
|
+
const isTablet = useLayoutType() === 'tablet';
|
82
84
|
|
83
85
|
const { reportTypes, isLoading } = useReportTypes();
|
84
86
|
const { stockLocations } = useStockTagLocations();
|
@@ -640,12 +642,17 @@ const CreateReport: React.FC<CreateReportProps> = ({ model, closeWorkspace }) =>
|
|
640
642
|
)}
|
641
643
|
</div>
|
642
644
|
|
643
|
-
<ButtonSet
|
645
|
+
<ButtonSet
|
646
|
+
className={classNames(styles.buttonSet, {
|
647
|
+
[styles.tablet]: isTablet,
|
648
|
+
[styles.desktop]: !isTablet,
|
649
|
+
})}
|
650
|
+
>
|
644
651
|
<Button kind="secondary" onClick={closeWorkspace} className={styles.button}>
|
645
|
-
{getCoreTranslation('cancel'
|
652
|
+
{getCoreTranslation('cancel')}
|
646
653
|
</Button>
|
647
654
|
<Button type="submit" className={styles.button} onClick={handleSave}>
|
648
|
-
{getCoreTranslation('save'
|
655
|
+
{getCoreTranslation('save')}
|
649
656
|
</Button>
|
650
657
|
</ButtonSet>
|
651
658
|
</div>
|
@@ -37,7 +37,7 @@ const StockReportStatus = (props: StockReportStatusProps) => {
|
|
37
37
|
try {
|
38
38
|
executionStateMap = displayParameterMap(props.model?.uuid, parseParametersToMap(props.model?.executionState));
|
39
39
|
} catch (ex) {
|
40
|
-
console.
|
40
|
+
console.error(ex);
|
41
41
|
}
|
42
42
|
return (
|
43
43
|
<div className={styles.statusContainer}>
|