@openmrs/esm-stock-management-app 1.0.1-pre.783 → 1.0.1-pre.785
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/__mocks__/index.ts +1 -0
- package/__mocks__/operation-type.mock.ts +532 -0
- package/dist/155.js +1 -0
- package/dist/155.js.map +1 -0
- package/dist/172.js +1 -1
- package/dist/20.js +1 -1
- package/dist/290.js +1 -1
- package/dist/493.js +2 -0
- package/dist/493.js.map +1 -0
- package/dist/606.js +1 -1
- package/dist/627.js +1 -1
- package/dist/914.js +1 -0
- package/dist/914.js.map +1 -0
- 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 +75 -51
- 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/utils/utils.ts +29 -0
- package/src/index.ts +4 -0
- package/src/routes.json +9 -0
- package/src/stock-items/add-stock-item/transactions/printout/transactions-stockcard-printout.component.tsx +8 -12
- package/src/stock-items/add-stock-item/transactions/transactions.component.tsx +8 -12
- package/src/stock-items/stock-items.resource.ts +5 -5
- package/src/stock-lookups/stock-lookups.resource.ts +2 -2
- package/src/stock-operations/edit-stock-operation/edit-stock-operation-action-menu.component.tsx +41 -16
- package/src/stock-operations/{add-stock-operation/received-items.component.tsx → received-items.component.tsx} +1 -1
- package/src/stock-operations/stock-operation-reference.component.tsx +64 -0
- package/src/stock-operations/stock-operation-status/stock-operation-status-row.tsx +77 -0
- package/src/stock-operations/stock-operation-status/stock-operation-status.scss +32 -0
- package/src/stock-operations/stock-operation-status/stock-operation-status.tsx +45 -0
- package/src/stock-operations/stock-operation-types-selector/stock-operation-types-selector.component.tsx +30 -29
- package/src/stock-operations/stock-operation.utils.tsx +16 -79
- package/src/stock-operations/stock-operations-dialog/stock-operations-issue-stock-button.component.tsx +27 -39
- package/src/stock-operations/stock-operations-dialog/stock-operations-print-button.component.tsx +51 -59
- package/src/stock-operations/{stock-item-selector/stock-item-selector.resource.tsx → stock-operations-forms/hooks/useFilterableStockItems.ts} +4 -4
- package/src/stock-operations/stock-operations-forms/hooks/useFilteredOperationTypesByRoles.ts +30 -0
- package/src/stock-operations/stock-operations-forms/hooks/useOperationTypePermisions.ts +29 -0
- package/src/stock-operations/stock-operations-forms/hooks/useParties.ts +73 -0
- package/src/stock-operations/{users-selector/users-selector.resource.tsx → stock-operations-forms/hooks/useSearchUser.ts} +9 -7
- package/src/stock-operations/{batch-no-selector/batch-no-selector.resource.tsx → stock-operations-forms/hooks/useStockItemBatchNumbers.ts} +3 -3
- package/src/stock-operations/stock-operations-forms/hooks/useStockOperationLinks.ts +20 -0
- package/src/stock-operations/stock-operations-forms/input-components/batch-no-selector.component.tsx +72 -0
- package/src/stock-operations/stock-operations-forms/input-components/batch-no-selector.test.tsx +90 -0
- package/src/stock-operations/{add-stock-operation/stock-item-search/stock-item-search.scss → stock-operations-forms/input-components/input-components-styles.scss} +2 -2
- package/src/stock-operations/stock-operations-forms/input-components/qty-uim-selector.test.tsx +157 -0
- package/src/stock-operations/stock-operations-forms/input-components/quantity-uom-selector.component.tsx +53 -0
- package/src/stock-operations/stock-operations-forms/input-components/stock-item-search.component.tsx +56 -0
- package/src/stock-operations/stock-operations-forms/input-components/stock-operation-reason-selector.component.tsx +59 -0
- package/src/stock-operations/stock-operations-forms/input-components/stock-operation-reason-selector.test.tsx +216 -0
- package/src/stock-operations/{batch-no-selector → stock-operations-forms/input-components}/unique-batch-no-entry-input.component.tsx +12 -7
- package/src/stock-operations/stock-operations-forms/input-components/user-selector.test.tsx +110 -0
- package/src/stock-operations/stock-operations-forms/input-components/users-selector.component.tsx +111 -0
- package/src/stock-operations/stock-operations-forms/step1.test.tsx +303 -0
- package/src/stock-operations/stock-operations-forms/step2.test.tsx +250 -0
- package/src/stock-operations/stock-operations-forms/step3.test.tsx +223 -0
- package/src/stock-operations/stock-operations-forms/steps/base-operation-details-form-step.tsx +241 -0
- package/src/stock-operations/stock-operations-forms/steps/quantity-uom-cell.component.tsx +33 -0
- package/src/stock-operations/stock-operations-forms/steps/stock-availability-cell.component.tsx +51 -0
- package/src/stock-operations/stock-operations-forms/steps/stock-operation-item-batch-no-cell.component.tsx +40 -0
- package/src/stock-operations/stock-operations-forms/steps/stock-operation-item-cell.component.tsx +38 -0
- package/src/stock-operations/stock-operations-forms/steps/stock-operation-item-expiry-cell.component.tsx +41 -0
- package/src/stock-operations/stock-operations-forms/steps/stock-operation-items-form-step.component.tsx +281 -0
- package/src/stock-operations/stock-operations-forms/steps/stock-operation-items-form-step.scc.scss +64 -0
- package/src/stock-operations/stock-operations-forms/steps/stock-operation-submission-form-step.component.tsx +236 -0
- package/src/stock-operations/stock-operations-forms/stock-issue-form-initializer-with-related-requisition-operation.component.tsx +55 -0
- package/src/stock-operations/stock-operations-forms/stock-item-form/stock-item-form.scss +41 -0
- package/src/stock-operations/stock-operations-forms/stock-item-form/stock-item-form.workspace.tsx +197 -0
- package/src/stock-operations/stock-operations-forms/stock-operation-form-header.component.tsx +166 -0
- package/src/stock-operations/stock-operations-forms/stock-operation-form.component.tsx +200 -0
- package/src/stock-operations/stock-operations-forms/stock-operation-form.scss +111 -0
- package/src/stock-operations/stock-operations-forms/stock-operation-related-link.component.tsx +45 -0
- package/src/stock-operations/stock-operations-forms/stock-operation-stepper/stepper.scss +41 -0
- package/src/stock-operations/stock-operations-forms/stock-operation-stepper/stock-operation-stepper.component.tsx +52 -0
- package/src/stock-operations/stock-operations-forms/stock-operations-form-utils.ts +32 -0
- package/src/stock-operations/stock-operations-table.component.tsx +20 -56
- package/src/stock-operations/stock-operations.resource.ts +16 -13
- package/src/stock-operations/validation-schema.ts +72 -14
- package/dist/766.js +0 -2
- package/dist/766.js.map +0 -1
- package/dist/822.js +0 -1
- package/dist/822.js.map +0 -1
- package/src/stock-operations/add-stock-operation/add-stock-operation.component.tsx +0 -349
- package/src/stock-operations/add-stock-operation/add-stock-operation.resource.tsx +0 -27
- package/src/stock-operations/add-stock-operation/add-stock-operation.scss +0 -60
- package/src/stock-operations/add-stock-operation/add-stock-operation.test.tsx +0 -192
- package/src/stock-operations/add-stock-operation/add-stock-operation.utils.tsx +0 -152
- package/src/stock-operations/add-stock-operation/add-stock-utils.ts +0 -103
- package/src/stock-operations/add-stock-operation/base-operation-details.component.tsx +0 -439
- package/src/stock-operations/add-stock-operation/base-operation-details.scss +0 -30
- package/src/stock-operations/add-stock-operation/stock-item-search/stock-item-search.component.tsx +0 -70
- package/src/stock-operations/add-stock-operation/stock-items-addition-row.component.tsx +0 -357
- 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 -12
- package/src/stock-operations/add-stock-operation/stock-items-addition-row.test.tsx +0 -10
- package/src/stock-operations/add-stock-operation/stock-items-addition.component.scss +0 -17
- package/src/stock-operations/add-stock-operation/stock-items-addition.component.tsx +0 -254
- package/src/stock-operations/add-stock-operation/stock-operation-context/useStockOperationContext.tsx +0 -16
- package/src/stock-operations/add-stock-operation/stock-operation-reference.component.tsx +0 -39
- package/src/stock-operations/add-stock-operation/stock-operation-related-link.component.tsx +0 -38
- package/src/stock-operations/add-stock-operation/stock-operation-status.component.tsx +0 -170
- package/src/stock-operations/add-stock-operation/stock-operation-submission.component.tsx +0 -189
- package/src/stock-operations/add-stock-operation/stock-operation-submission.test.tsx +0 -138
- package/src/stock-operations/add-stock-operation/types.ts +0 -55
- package/src/stock-operations/add-stock-operation/validationSchema.ts +0 -54
- package/src/stock-operations/batch-no-selector/batch-no-selector.component.tsx +0 -114
- 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 +0 -101
- package/src/stock-operations/party-selector/party-selector.component.tsx +0 -59
- package/src/stock-operations/qty-uom-selector/qty-uom-selector.component.tsx +0 -65
- 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 +0 -10
- package/src/stock-operations/stock-item-selector/stock-item-selector.component.tsx +0 -69
- 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 +0 -10
- package/src/stock-operations/stock-operation-reason-selector/stock-operation-reason-selector.component.tsx +0 -62
- package/src/stock-operations/users-selector/users-selector.component.tsx +0 -75
- /package/dist/{766.js.LICENSE.txt → 493.js.LICENSE.txt} +0 -0
@@ -1,30 +0,0 @@
|
|
1
|
-
@use '@carbon/layout';
|
2
|
-
@use '@carbon/type';
|
3
|
-
@use '~@openmrs/esm-styleguide/src/vars' as *;
|
4
|
-
|
5
|
-
.verticalForm {
|
6
|
-
display: flex;
|
7
|
-
grid-row-gap: 2em;
|
8
|
-
padding-top: layout.$spacing-05;
|
9
|
-
align-content: space-between;
|
10
|
-
flex-direction: column;
|
11
|
-
|
12
|
-
:global(.cds--form-item) {
|
13
|
-
flex: none !important;
|
14
|
-
}
|
15
|
-
|
16
|
-
:global(.cds--label) {
|
17
|
-
color: black;
|
18
|
-
display: inline-block;
|
19
|
-
font-size: var(--cds-label-01-font-size);
|
20
|
-
font-weight: bold;
|
21
|
-
letter-spacing: var(--cds-label-01-letter-spacing, 0.32px);
|
22
|
-
line-height: layout.$spacing-05;
|
23
|
-
margin-bottom: layout.$spacing-03;
|
24
|
-
vertical-align: baseline;
|
25
|
-
}
|
26
|
-
}
|
27
|
-
|
28
|
-
.formContainer {
|
29
|
-
margin: layout.$spacing-05;
|
30
|
-
}
|
package/src/stock-operations/add-stock-operation/stock-item-search/stock-item-search.component.tsx
DELETED
@@ -1,70 +0,0 @@
|
|
1
|
-
import React, { useEffect, useState } from 'react';
|
2
|
-
import { Search, ClickableTile } from '@carbon/react';
|
3
|
-
import { useTranslation } from 'react-i18next';
|
4
|
-
import { useDebounce } from '@openmrs/esm-framework';
|
5
|
-
import { useStockItems } from '../../stock-item-selector/stock-item-selector.resource';
|
6
|
-
import { useFormContext, type UseFieldArrayReturn } from 'react-hook-form';
|
7
|
-
import { StockOperationItemDTO } from '../../../core/api/types/stockOperation/StockOperationItemDTO';
|
8
|
-
import { getStockOperationUniqueId } from '../../stock-operation.utils';
|
9
|
-
import styles from './stock-item-search.scss';
|
10
|
-
|
11
|
-
type StockItemSearchProps = UseFieldArrayReturn<
|
12
|
-
{
|
13
|
-
stockItems: StockOperationItemDTO[];
|
14
|
-
},
|
15
|
-
'stockItems',
|
16
|
-
'id'
|
17
|
-
>;
|
18
|
-
|
19
|
-
const StockItemSearch: React.FC<StockItemSearchProps> = ({ append, fields }) => {
|
20
|
-
const { t } = useTranslation();
|
21
|
-
const { isLoading, stockItemsList, setSearchString } = useStockItems({});
|
22
|
-
const [searchTerm, setSearchTerm] = useState('');
|
23
|
-
const { setValue, getValues } = useFormContext();
|
24
|
-
const debouncedSearchTerm = useDebounce(searchTerm);
|
25
|
-
|
26
|
-
useEffect(() => {
|
27
|
-
if (debouncedSearchTerm?.length !== 0) {
|
28
|
-
setSearchString(debouncedSearchTerm);
|
29
|
-
}
|
30
|
-
}, [debouncedSearchTerm, setSearchString]);
|
31
|
-
|
32
|
-
const handleOnSearchResultClick = (stockItem) => {
|
33
|
-
const itemId = `new-item-${getStockOperationUniqueId()}`;
|
34
|
-
append({
|
35
|
-
...stockItem,
|
36
|
-
uuid: itemId,
|
37
|
-
id: itemId,
|
38
|
-
stockItemUuid: stockItem.uuid,
|
39
|
-
stockItemName: stockItem.commonName,
|
40
|
-
});
|
41
|
-
setSearchTerm('');
|
42
|
-
setValue(`stockItems[${fields.length}].stockItemUuid`, stockItem.uuid);
|
43
|
-
};
|
44
|
-
return (
|
45
|
-
<div className={styles.stockItemSearchContainer}>
|
46
|
-
<div style={{ display: 'flex' }}>
|
47
|
-
<Search
|
48
|
-
size="lg"
|
49
|
-
placeholder="Find your items"
|
50
|
-
labelText="Search"
|
51
|
-
closeButtonLabelText="Clear search input"
|
52
|
-
value={searchTerm}
|
53
|
-
id="search-1"
|
54
|
-
onChange={(e) => setSearchTerm(e.target.value)}
|
55
|
-
/>
|
56
|
-
</div>
|
57
|
-
{searchTerm && stockItemsList?.length > 0 && (
|
58
|
-
<div className={styles.searchResults}>
|
59
|
-
{stockItemsList?.slice(0, 5).map((stockItem) => (
|
60
|
-
<ClickableTile onClick={() => handleOnSearchResultClick(stockItem)} key={stockItem?.uuid}>
|
61
|
-
{stockItem?.commonName}
|
62
|
-
</ClickableTile>
|
63
|
-
))}
|
64
|
-
</div>
|
65
|
-
)}
|
66
|
-
</div>
|
67
|
-
);
|
68
|
-
};
|
69
|
-
|
70
|
-
export default StockItemSearch;
|
@@ -1,357 +0,0 @@
|
|
1
|
-
import React, { ChangeEvent, useMemo, useState } from 'react';
|
2
|
-
import { isDesktop } from '@openmrs/esm-framework';
|
3
|
-
import { Button, DatePicker, DatePickerInput, Link, NumberInput, TableCell, TableRow, TextInput } from '@carbon/react';
|
4
|
-
import { TrashCan } from '@carbon/react/icons';
|
5
|
-
import { StockOperationItemFormData } from '../validation-schema';
|
6
|
-
import {
|
7
|
-
Control,
|
8
|
-
FieldArrayWithId,
|
9
|
-
FieldErrors,
|
10
|
-
UseFieldArrayAppend,
|
11
|
-
UseFieldArrayRemove,
|
12
|
-
UseFormSetValue,
|
13
|
-
} from 'react-hook-form';
|
14
|
-
import {
|
15
|
-
DATE_PICKER_CONTROL_FORMAT,
|
16
|
-
DATE_PICKER_FORMAT,
|
17
|
-
URL_STOCK_ITEM,
|
18
|
-
formatForDatePicker,
|
19
|
-
today,
|
20
|
-
} from '../../constants';
|
21
|
-
import { StockBatchDTO } from '../../core/api/types/stockItem/StockBatchDTO';
|
22
|
-
import { StockItemPackagingUOMDTO } from '../../core/api/types/stockItem/StockItemPackagingUOM';
|
23
|
-
import { StockItemInventory } from '../../core/api/types/stockItem/StockItemInventory';
|
24
|
-
import { StockOperationItemDTO } from '../../core/api/types/stockOperation/StockOperationItemDTO';
|
25
|
-
import { StockItemDTO } from '../../core/api/types/stockItem/StockItem';
|
26
|
-
import QtyUomSelector from '../qty-uom-selector/qty-uom-selector.component';
|
27
|
-
import BatchNoSelector from '../batch-no-selector/batch-no-selector.component';
|
28
|
-
|
29
|
-
import styles from './stock-items-addition-row.scss';
|
30
|
-
import { useStockItemBatchInformationHook } from '../../stock-items/add-stock-item/batch-information/batch-information.resource';
|
31
|
-
import UniqueBatchNoEntryInput from '../batch-no-selector/unique-batch-no-entry-input.component';
|
32
|
-
|
33
|
-
interface StockItemsAdditionRowProps {
|
34
|
-
canEdit?: boolean;
|
35
|
-
rows: StockOperationItemFormData[];
|
36
|
-
showQuantityRequested?: boolean;
|
37
|
-
requiresActualBatchInformation?: boolean;
|
38
|
-
requiresBatchUuid?: boolean;
|
39
|
-
canUpdateBatchInformation?: boolean;
|
40
|
-
canCapturePurchasePrice?: boolean;
|
41
|
-
batchNos?: {
|
42
|
-
[key: string]: StockBatchDTO[];
|
43
|
-
};
|
44
|
-
itemUoM?: {
|
45
|
-
[key: string]: StockItemPackagingUOMDTO[];
|
46
|
-
};
|
47
|
-
batchBalance?: {
|
48
|
-
[key: string]: StockItemInventory;
|
49
|
-
};
|
50
|
-
control: Control<{
|
51
|
-
stockItems: StockOperationItemDTO[];
|
52
|
-
}>;
|
53
|
-
setValue: UseFormSetValue<{
|
54
|
-
stockItems: StockOperationItemDTO[];
|
55
|
-
}>;
|
56
|
-
errors: FieldErrors<{
|
57
|
-
stockItems: StockOperationItemDTO[];
|
58
|
-
}>;
|
59
|
-
remove: UseFieldArrayRemove;
|
60
|
-
append: UseFieldArrayAppend<
|
61
|
-
{
|
62
|
-
stockItems: StockOperationItemDTO[];
|
63
|
-
},
|
64
|
-
'stockItems'
|
65
|
-
>;
|
66
|
-
fields: FieldArrayWithId<
|
67
|
-
{
|
68
|
-
stockItems: StockOperationItemDTO[];
|
69
|
-
},
|
70
|
-
'stockItems'
|
71
|
-
>[];
|
72
|
-
}
|
73
|
-
|
74
|
-
const StockItemsAdditionRow: React.FC<StockItemsAdditionRowProps> = ({
|
75
|
-
canEdit,
|
76
|
-
showQuantityRequested,
|
77
|
-
requiresActualBatchInformation,
|
78
|
-
requiresBatchUuid,
|
79
|
-
canUpdateBatchInformation,
|
80
|
-
canCapturePurchasePrice,
|
81
|
-
batchBalance,
|
82
|
-
control,
|
83
|
-
setValue,
|
84
|
-
errors,
|
85
|
-
remove,
|
86
|
-
fields,
|
87
|
-
}) => {
|
88
|
-
const [stockItemUuid, setStockItemUuid] = useState<string | null | undefined>();
|
89
|
-
const [stockItemExpiry, setStockItemExpiy] = useState<Date | null | undefined>();
|
90
|
-
|
91
|
-
const handleStockItemChange = (index: number, data?: StockItemDTO) => {
|
92
|
-
if (!data) return;
|
93
|
-
const item = fields[index];
|
94
|
-
if (item) {
|
95
|
-
item.stockItemName =
|
96
|
-
(data?.drugName
|
97
|
-
? `${data?.drugName}${
|
98
|
-
data?.commonName ?? data?.conceptName ? ` (${data?.commonName ?? data?.conceptName})` : ''
|
99
|
-
}`
|
100
|
-
: null) ?? data?.conceptName;
|
101
|
-
|
102
|
-
const configureExpiration = data?.hasExpiration ?? true;
|
103
|
-
item.hasExpiration = configureExpiration;
|
104
|
-
if (!configureExpiration) {
|
105
|
-
item.expiration = null;
|
106
|
-
}
|
107
|
-
|
108
|
-
item.stockItemUuid = data?.uuid;
|
109
|
-
|
110
|
-
item.stockItemPackagingUOMUuid = null;
|
111
|
-
item.stockItemPackagingUOMName = null;
|
112
|
-
|
113
|
-
item.stockBatchUuid = null;
|
114
|
-
if (requiresBatchUuid) {
|
115
|
-
// handleStockBatchSearch(row, "", data.selectedItem?.uuid);
|
116
|
-
}
|
117
|
-
}
|
118
|
-
};
|
119
|
-
const isStockItem = (obj: any): obj is StockItemDTO => {
|
120
|
-
return typeof obj === 'object' && obj !== null && 'drugName' in obj;
|
121
|
-
};
|
122
|
-
|
123
|
-
const StockAvailability: React.FC<{ stockItemUuid: string }> = ({ stockItemUuid }) => {
|
124
|
-
const { items } = useStockItemBatchInformationHook({
|
125
|
-
stockItemUuid: stockItemUuid,
|
126
|
-
includeBatchNo: true,
|
127
|
-
});
|
128
|
-
|
129
|
-
const totalQuantity = useMemo(() => {
|
130
|
-
if (!items?.length) return 0;
|
131
|
-
return items.reduce((total, batch) => {
|
132
|
-
return total + (Number(batch.quantity) || 0);
|
133
|
-
}, 0);
|
134
|
-
}, [items]);
|
135
|
-
const commonUOM = useMemo(() => {
|
136
|
-
if (!items?.length) return '';
|
137
|
-
return items[0]?.quantityUoM || '';
|
138
|
-
}, [items]);
|
139
|
-
|
140
|
-
return (
|
141
|
-
<div className={styles.availability}>
|
142
|
-
{totalQuantity > 0 ? (
|
143
|
-
<span>
|
144
|
-
Available: {totalQuantity.toLocaleString()} {commonUOM}
|
145
|
-
</span>
|
146
|
-
) : (
|
147
|
-
<span className={styles.outOfStock}>Out of Stock</span>
|
148
|
-
)}
|
149
|
-
</div>
|
150
|
-
);
|
151
|
-
};
|
152
|
-
return (
|
153
|
-
<>
|
154
|
-
{fields?.map((row, index) => {
|
155
|
-
const stockItemId = `stockItems.${index}.stockItemUuid`;
|
156
|
-
return (
|
157
|
-
<TableRow className={isDesktop ? styles.desktopRow : styles.tabletRow} key={row?.uuid}>
|
158
|
-
<TableCell>
|
159
|
-
{row?.stockItemUuid && isStockItem(row?.stockItemUuid) ? (
|
160
|
-
<Link target={'_blank'} to={URL_STOCK_ITEM(row?.stockItemUuid)}>
|
161
|
-
{row?.stockItemUuid.drugName || 'No stock item name'}
|
162
|
-
</Link>
|
163
|
-
) : (
|
164
|
-
<Link target={'_blank'} to={URL_STOCK_ITEM(row?.stockItemUuid)}>
|
165
|
-
{row?.stockItemName || 'No name available'}
|
166
|
-
</Link>
|
167
|
-
)}
|
168
|
-
</TableCell>
|
169
|
-
<TableCell>
|
170
|
-
<div className={styles.cellContent}>
|
171
|
-
{row?.stockItemUuid && <StockAvailability stockItemUuid={row.stockItemUuid} />}
|
172
|
-
</div>
|
173
|
-
</TableCell>
|
174
|
-
{showQuantityRequested && (
|
175
|
-
<TableCell>
|
176
|
-
<div className={styles.cellContent}>
|
177
|
-
{row?.quantityRequested?.toLocaleString() ?? ''} {row?.quantityRequestedPackagingUOMName ?? ''}
|
178
|
-
</div>
|
179
|
-
</TableCell>
|
180
|
-
)}
|
181
|
-
{(requiresActualBatchInformation || requiresBatchUuid) && (
|
182
|
-
<TableCell>
|
183
|
-
<div className={styles.cellContent}>
|
184
|
-
{requiresActualBatchInformation &&
|
185
|
-
(canEdit || (canUpdateBatchInformation && row?.permission?.canUpdateBatchInformation)) && (
|
186
|
-
<UniqueBatchNoEntryInput
|
187
|
-
onValueChange={(val) => setValue(`stockItems.${index}.batchNo`, val)}
|
188
|
-
defaultValue={row.batchNo}
|
189
|
-
error={errors?.stockItems?.[index]?.batchNo?.message}
|
190
|
-
stockItemUuid={row.stockItemUuid}
|
191
|
-
/>
|
192
|
-
)}
|
193
|
-
{requiresBatchUuid && !requiresActualBatchInformation && canEdit && (
|
194
|
-
<BatchNoSelector
|
195
|
-
batchUuid={row?.stockBatchUuid}
|
196
|
-
onBatchNoChanged={(item) => {
|
197
|
-
setValue(`stockItems.${index}.batchNo`, item?.batchNo ?? '');
|
198
|
-
setValue(`stockItems.${index}.expiration`, item?.expiration);
|
199
|
-
setStockItemExpiy(item?.expiration);
|
200
|
-
}}
|
201
|
-
placeholder={'Filter...'}
|
202
|
-
invalid={!!errors?.stockItems?.[index]?.stockBatchUuid}
|
203
|
-
control={control as unknown as Control}
|
204
|
-
controllerName={`stockItems.${index}.stockBatchUuid`}
|
205
|
-
name={`stockItems.${index}.stockBatchUuid`}
|
206
|
-
stockItemUuid={row.stockItemUuid}
|
207
|
-
selectedItem={stockItemUuid}
|
208
|
-
/>
|
209
|
-
)}
|
210
|
-
{!(canUpdateBatchInformation && row?.permission?.canUpdateBatchInformation) &&
|
211
|
-
!canEdit &&
|
212
|
-
row?.batchNo}
|
213
|
-
</div>
|
214
|
-
</TableCell>
|
215
|
-
)}
|
216
|
-
{(requiresActualBatchInformation || requiresBatchUuid) && (
|
217
|
-
<TableCell>
|
218
|
-
<div className={styles.cellContent}>
|
219
|
-
{(canEdit || (canUpdateBatchInformation && row?.permission?.canUpdateBatchInformation)) &&
|
220
|
-
requiresActualBatchInformation && (
|
221
|
-
<DatePicker
|
222
|
-
id={`expiration-${row.uuid}`}
|
223
|
-
datePickerType="single"
|
224
|
-
minDate={formatForDatePicker(today())}
|
225
|
-
locale="en"
|
226
|
-
dateFormat={DATE_PICKER_CONTROL_FORMAT}
|
227
|
-
onChange={([newDate]) => {
|
228
|
-
setValue(`stockItems.${index}.expiration`, newDate);
|
229
|
-
}}
|
230
|
-
>
|
231
|
-
<DatePickerInput
|
232
|
-
size="sm"
|
233
|
-
autoComplete="off"
|
234
|
-
id={`expiration-input-${row.uuid}`}
|
235
|
-
name="operationDate"
|
236
|
-
placeholder={DATE_PICKER_FORMAT}
|
237
|
-
defaultValue={formatForDatePicker(row?.expiration)}
|
238
|
-
invalid={!!errors?.stockItems?.[index]?.expiration}
|
239
|
-
/>
|
240
|
-
</DatePicker>
|
241
|
-
)}
|
242
|
-
{requiresBatchUuid && !requiresActualBatchInformation && canEdit && (
|
243
|
-
<DatePicker
|
244
|
-
id={`expiration-${row.uuid}`}
|
245
|
-
datePickerType="single"
|
246
|
-
minDate={formatForDatePicker(today())}
|
247
|
-
readOnly={true}
|
248
|
-
locale="en"
|
249
|
-
dateFormat={DATE_PICKER_CONTROL_FORMAT}
|
250
|
-
onChange={([newDate]) => {
|
251
|
-
setValue(`stockItems.${index}.expiration`, newDate);
|
252
|
-
}}
|
253
|
-
>
|
254
|
-
<DatePickerInput
|
255
|
-
size="sm"
|
256
|
-
autoComplete="off"
|
257
|
-
id={`expiration-input-${row.uuid}`}
|
258
|
-
name="operationDate"
|
259
|
-
placeholder={DATE_PICKER_FORMAT}
|
260
|
-
value={formatForDatePicker(stockItemExpiry)}
|
261
|
-
defaultValue={formatForDatePicker(stockItemExpiry)}
|
262
|
-
invalid={!!errors?.stockItems?.[index]?.expiration}
|
263
|
-
/>
|
264
|
-
</DatePicker>
|
265
|
-
)}
|
266
|
-
{((!(canUpdateBatchInformation && row?.permission?.canUpdateBatchInformation) && !canEdit) ||
|
267
|
-
requiresBatchUuid) &&
|
268
|
-
formatForDatePicker(row.expiration)}
|
269
|
-
</div>
|
270
|
-
</TableCell>
|
271
|
-
)}
|
272
|
-
<TableCell>
|
273
|
-
<div className={styles.cellContent}>
|
274
|
-
{canEdit && (
|
275
|
-
<NumberInput
|
276
|
-
allowEmpty
|
277
|
-
className="small-placeholder-text"
|
278
|
-
disableWheel
|
279
|
-
hideSteppers
|
280
|
-
size="sm"
|
281
|
-
id={`qty-${row?.uuid}`}
|
282
|
-
onChange={(e: any) => setValue(`stockItems.${index}.quantity`, e?.target?.value)}
|
283
|
-
value={row?.quantity ?? ''}
|
284
|
-
invalidText={errors?.stockItems?.[index]?.quantity?.message}
|
285
|
-
placeholder={
|
286
|
-
requiresBatchUuid && !requiresActualBatchInformation && row?.stockBatchUuid in batchBalance
|
287
|
-
? `Bal: ${batchBalance[row?.stockBatchUuid]?.quantity?.toLocaleString() ?? ''} ${
|
288
|
-
batchBalance[row?.stockBatchUuid]?.quantityUoM ?? ''
|
289
|
-
}`
|
290
|
-
: ''
|
291
|
-
}
|
292
|
-
invalid={!!errors?.stockItems?.[index]?.quantity}
|
293
|
-
/>
|
294
|
-
)}
|
295
|
-
{!canEdit && row?.quantity?.toLocaleString()}
|
296
|
-
</div>
|
297
|
-
</TableCell>
|
298
|
-
<TableCell>
|
299
|
-
<div className={styles.cellContent}>
|
300
|
-
{canEdit && (
|
301
|
-
<QtyUomSelector
|
302
|
-
stockItemUuid={row.stockItemUuid}
|
303
|
-
onStockPackageChanged={(selectedItem) => {
|
304
|
-
setValue(`stockItems.${index}.stockItemPackagingUOMUuid`, selectedItem?.uuid);
|
305
|
-
}}
|
306
|
-
placeholder={'Filter...'}
|
307
|
-
invalid={!!errors?.stockItems?.[index]?.stockItemPackagingUOMUuid}
|
308
|
-
control={control as unknown as Control}
|
309
|
-
controllerName={`stockItems.${index}.stockItemPackagingUOMUuid`}
|
310
|
-
name={`stockItems.${index}.stockItemPackagingUOMUuid`}
|
311
|
-
/>
|
312
|
-
)}
|
313
|
-
{!canEdit && row?.stockItemPackagingUOMName}
|
314
|
-
</div>
|
315
|
-
</TableCell>
|
316
|
-
{canCapturePurchasePrice && (
|
317
|
-
<TableCell>
|
318
|
-
<div className={styles.cellContent}>
|
319
|
-
<div className={styles.cellContent}>
|
320
|
-
{canEdit && (
|
321
|
-
<NumberInput
|
322
|
-
allowEmpty
|
323
|
-
disableWheel
|
324
|
-
size="sm"
|
325
|
-
invalid={!!errors?.stockItems?.[index]?.purchasePrice}
|
326
|
-
invalidText=""
|
327
|
-
id={`purchaseprice-${row.uuid}`}
|
328
|
-
onChange={(e: any) => setValue(`stockItems.${index}.purchasePrice`, e?.target?.value)}
|
329
|
-
value={row?.purchasePrice ?? ''}
|
330
|
-
title=""
|
331
|
-
/>
|
332
|
-
)}
|
333
|
-
{!canEdit && row?.purchasePrice?.toLocaleString()}
|
334
|
-
</div>
|
335
|
-
</div>
|
336
|
-
</TableCell>
|
337
|
-
)}
|
338
|
-
{canEdit && (
|
339
|
-
<TableCell>
|
340
|
-
<Button
|
341
|
-
type="button"
|
342
|
-
size="sm"
|
343
|
-
className="submitButton clear-padding-margin"
|
344
|
-
iconDescription={'Delete'}
|
345
|
-
kind="ghost"
|
346
|
-
renderIcon={TrashCan}
|
347
|
-
onClick={() => remove(index)}
|
348
|
-
/>
|
349
|
-
</TableCell>
|
350
|
-
)}
|
351
|
-
</TableRow>
|
352
|
-
);
|
353
|
-
})}
|
354
|
-
</>
|
355
|
-
);
|
356
|
-
};
|
357
|
-
export default StockItemsAdditionRow;
|
File without changes
|
@@ -1,10 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
|
3
|
-
import { render } from '@testing-library/react';
|
4
|
-
import StockItemsAdditionRow from './stock-items-addition-row.component';
|
5
|
-
|
6
|
-
describe('Test the stock items addition row', () => {
|
7
|
-
it(`renders without dying`, () => {
|
8
|
-
// render(<StockItemsAdditionRow />);
|
9
|
-
});
|
10
|
-
});
|
@@ -1,17 +0,0 @@
|
|
1
|
-
.tableContainer {
|
2
|
-
:global(.cds--data-table-content) {
|
3
|
-
height: calc(100vh - 150px);
|
4
|
-
}
|
5
|
-
}
|
6
|
-
.tableHeader {
|
7
|
-
width: 3% !important;
|
8
|
-
}
|
9
|
-
.tableBody {
|
10
|
-
display: flex;
|
11
|
-
flex-direction: row;
|
12
|
-
width: 3% !important;
|
13
|
-
gap: 8px;
|
14
|
-
}
|
15
|
-
.dataTable {
|
16
|
-
width: 100%;
|
17
|
-
}
|