@openmrs/esm-stock-management-app 1.0.1-pre.785 → 1.0.1-pre.788
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/155.js +1 -1
- package/dist/155.js.map +1 -1
- package/dist/922.js +1 -0
- package/dist/922.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 +12 -12
- package/dist/routes.json +1 -1
- package/package.json +1 -1
- package/src/config-schema.ts +6 -0
- package/src/stock-operations/add-stock-operation/stock-operations-expanded-row/stock-items-table.scss +34 -0
- package/src/stock-operations/add-stock-operation/stock-operations-expanded-row/stock-items-table.tsx +111 -0
- package/src/stock-operations/add-stock-operation/stock-operations-expanded-row/stock-operation-expanded-row.component.tsx +87 -0
- package/src/stock-operations/add-stock-operation/stock-operations-expanded-row/stock-operation-expanded-row.scss +31 -0
- package/src/stock-operations/add-stock-operation/stock-operations-expanded-row/stock-operations-status.tsx +45 -0
- package/src/stock-operations/stock-operations-forms/input-components/stock-item-search.component.tsx +30 -7
- package/src/stock-operations/stock-operations-forms/step2.test.tsx +6 -2
- package/src/stock-operations/stock-operations-forms/steps/received-items.component.tsx +110 -0
- package/src/stock-operations/stock-operations-forms/steps/stock-operation-item-cell.component.tsx +15 -3
- package/src/stock-operations/stock-operations-forms/steps/stock-operation-submission-form-step.component.tsx +7 -0
- package/src/stock-operations/stock-operations-forms/stock-item-form/stock-item-form.workspace.tsx +16 -2
- package/src/stock-operations/stock-operations-forms/stock-operation-form.component.tsx +18 -13
- package/src/stock-operations/stock-operations-table.component.tsx +39 -38
- package/dist/914.js +0 -1
- package/dist/914.js.map +0 -1
- package/src/stock-operations/received-items.component.tsx +0 -93
@@ -1,93 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
import { useTranslation } from 'react-i18next';
|
3
|
-
import { StockOperationDTO } from '../core/api/types/stockOperation/StockOperationDTO';
|
4
|
-
import {
|
5
|
-
DataTable,
|
6
|
-
Table,
|
7
|
-
TableBody,
|
8
|
-
TableContainer,
|
9
|
-
TableHead,
|
10
|
-
TableHeader,
|
11
|
-
TableRow,
|
12
|
-
TableCell,
|
13
|
-
DataTableSkeleton,
|
14
|
-
} from '@carbon/react';
|
15
|
-
|
16
|
-
const formatDate = (date: Date | string | null) => {
|
17
|
-
if (!date) return ' ';
|
18
|
-
const d = new Date(date);
|
19
|
-
const day = String(d.getDate()).padStart(2, '0');
|
20
|
-
const month = String(d.getMonth() + 1).padStart(2, '0');
|
21
|
-
const year = d.getFullYear();
|
22
|
-
return `${month}/${day}/${year}`;
|
23
|
-
};
|
24
|
-
|
25
|
-
interface ReceivedItemsProps {
|
26
|
-
model?: StockOperationDTO;
|
27
|
-
}
|
28
|
-
|
29
|
-
const ReceivedItems: React.FC<ReceivedItemsProps> = ({ model }) => {
|
30
|
-
const { t } = useTranslation();
|
31
|
-
|
32
|
-
const headers = [
|
33
|
-
{ key: 'item', header: t('item', 'Item') },
|
34
|
-
{ key: 'requested', header: t('requested', 'Requested') },
|
35
|
-
{ key: 'batch', header: t('batch', 'Batch No') },
|
36
|
-
{ key: 'expiry', header: t('expiry', 'Expiry Date') },
|
37
|
-
{ key: 'qtySent', header: t('quantitySent', 'Quantity Sent') },
|
38
|
-
{ key: 'qtyReceived', header: t('quantityReceived', 'Quantity Received') },
|
39
|
-
{
|
40
|
-
key: 'qtyUoM',
|
41
|
-
header: t('quantityUoM', 'Quantity Unit of Measurement(UoM)'),
|
42
|
-
},
|
43
|
-
];
|
44
|
-
|
45
|
-
const rows =
|
46
|
-
model?.stockOperationItems?.map((item) => ({
|
47
|
-
id: item.uuid,
|
48
|
-
item: item.stockItemName,
|
49
|
-
requested: item.quantityRequested || ' ',
|
50
|
-
batch: item.batchNo,
|
51
|
-
expiry: formatDate(item.expiration),
|
52
|
-
qtySent: item.quantity || ' ',
|
53
|
-
qtyReceived: item.quantityReceived || ' ',
|
54
|
-
qtyUoM: item.quantityReceivedPackagingUOMName,
|
55
|
-
})) || [];
|
56
|
-
|
57
|
-
if (!model) {
|
58
|
-
return <DataTableSkeleton role="progressbar" />;
|
59
|
-
}
|
60
|
-
|
61
|
-
return (
|
62
|
-
<div style={{ margin: '10px' }}>
|
63
|
-
<DataTable rows={rows} headers={headers}>
|
64
|
-
{({ rows, headers, getHeaderProps, getTableProps, getRowProps }) => (
|
65
|
-
<TableContainer>
|
66
|
-
<Table {...getTableProps()}>
|
67
|
-
<TableHead>
|
68
|
-
<TableRow>
|
69
|
-
{headers.map((header) => (
|
70
|
-
<TableHeader {...getHeaderProps({ header })} key={header.key}>
|
71
|
-
{header.header}
|
72
|
-
</TableHeader>
|
73
|
-
))}
|
74
|
-
</TableRow>
|
75
|
-
</TableHead>
|
76
|
-
<TableBody>
|
77
|
-
{rows.map((row) => (
|
78
|
-
<TableRow {...getRowProps({ row })} key={row.id}>
|
79
|
-
{row.cells.map((cell) => (
|
80
|
-
<TableCell key={cell.id}>{cell.value}</TableCell>
|
81
|
-
))}
|
82
|
-
</TableRow>
|
83
|
-
))}
|
84
|
-
</TableBody>
|
85
|
-
</Table>
|
86
|
-
</TableContainer>
|
87
|
-
)}
|
88
|
-
</DataTable>
|
89
|
-
</div>
|
90
|
-
);
|
91
|
-
};
|
92
|
-
|
93
|
-
export default ReceivedItems;
|