@kenyaemr/esm-lab-manifest-app 5.4.2-pre.2248 → 5.4.2-pre.2255
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/.turbo/turbo-build.log +10 -10
- package/dist/129.js +1 -0
- package/dist/129.js.map +1 -0
- package/dist/300.js +1 -1
- package/dist/376.js +1 -1
- package/dist/376.js.map +1 -1
- package/dist/449.js +1 -1
- package/dist/449.js.map +1 -1
- package/dist/496.js +1 -1
- package/dist/496.js.map +1 -1
- package/dist/62.js +1 -1
- package/dist/62.js.map +1 -1
- package/dist/741.js +1 -1
- package/dist/741.js.map +1 -1
- package/dist/746.js +1 -0
- package/dist/746.js.map +1 -0
- package/dist/787.js +2 -0
- package/dist/787.js.map +1 -0
- package/dist/795.js +1 -0
- package/dist/795.js.map +1 -0
- package/dist/kenyaemr-esm-lab-manifest-app.js +1 -1
- package/dist/kenyaemr-esm-lab-manifest-app.js.buildmanifest.json +104 -77
- package/dist/kenyaemr-esm-lab-manifest-app.js.map +1 -1
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/routes.json +1 -1
- package/package.json +1 -1
- package/src/forms/sample-delete-confirm-dialog.modal.tsx +2 -3
- package/src/header/lab-manifest-detail-header.component.tsx +37 -8
- package/src/header/lab-manifest-header.scss +24 -24
- package/src/header/lab-manifest-table-filters-header.component.tsx +36 -0
- package/src/hooks/useLabManifest.tsx +2 -1
- package/src/hooks/useLabManifestOrders.ts +64 -0
- package/src/tables/lab-manifest-samples.component.tsx +23 -26
- package/src/tables/lab-manifest-table.component.tsx +13 -38
- package/src/tables/patient-name-cell.component.tsx +6 -13
- package/translations/en.json +0 -1
- package/dist/922.js +0 -2
- package/dist/922.js.map +0 -1
- package/dist/94.js +0 -1
- package/dist/94.js.map +0 -1
- package/dist/97.js +0 -1
- package/dist/97.js.map +0 -1
- /package/dist/{922.js.LICENSE.txt → 787.js.LICENSE.txt} +0 -0
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
DataTable,
|
|
5
5
|
DataTableSkeleton,
|
|
6
6
|
Pagination,
|
|
7
|
+
Search,
|
|
7
8
|
Table,
|
|
8
9
|
TableBody,
|
|
9
10
|
TableCell,
|
|
@@ -15,29 +16,21 @@ import {
|
|
|
15
16
|
TableSelectRow,
|
|
16
17
|
} from '@carbon/react';
|
|
17
18
|
import { ArrowRight, Printer, TrashCan } from '@carbon/react/icons';
|
|
18
|
-
import {
|
|
19
|
-
ConfigurableLink,
|
|
20
|
-
ErrorState,
|
|
21
|
-
formatDate,
|
|
22
|
-
parseDate,
|
|
23
|
-
showModal,
|
|
24
|
-
showSnackbar,
|
|
25
|
-
usePagination,
|
|
26
|
-
} from '@openmrs/esm-framework';
|
|
19
|
+
import { ErrorState, formatDate, parseDate, showModal, showSnackbar, usePagination } from '@openmrs/esm-framework';
|
|
27
20
|
import { CardHeader, EmptyState, usePaginationInfo } from '@openmrs/esm-patient-common-lib';
|
|
28
21
|
import React, { useState } from 'react';
|
|
29
22
|
import { useTranslation } from 'react-i18next';
|
|
30
23
|
import { useLabManifest } from '../hooks';
|
|
24
|
+
import useLabManifestOrders, { LabManifestSample } from '../hooks/useLabManifestOrders';
|
|
31
25
|
import {
|
|
32
26
|
mutateManifestLinks,
|
|
33
27
|
printSpecimentLabel,
|
|
34
28
|
removeSampleFromTheManifest,
|
|
35
29
|
sampleRemovableManifestStatus,
|
|
36
30
|
} from '../lab-manifest.resources';
|
|
37
|
-
import { LabManifestSample } from '../types';
|
|
38
31
|
import styles from './lab-manifest-table.scss';
|
|
39
|
-
import PatientNameCell from './patient-name-cell.component';
|
|
40
32
|
import PatientCCCNumbercell from './patient-ccc-no-cell.component';
|
|
33
|
+
import PatientNameCell from './patient-name-cell.component';
|
|
41
34
|
|
|
42
35
|
interface LabManifestSamplesProps {
|
|
43
36
|
manifestUuid: string;
|
|
@@ -45,11 +38,17 @@ interface LabManifestSamplesProps {
|
|
|
45
38
|
|
|
46
39
|
const LabManifestSamples: React.FC<LabManifestSamplesProps> = ({ manifestUuid }) => {
|
|
47
40
|
const { error, isLoading, manifest } = useLabManifest(manifestUuid);
|
|
48
|
-
const
|
|
41
|
+
const {
|
|
42
|
+
labmanifestOrders,
|
|
43
|
+
setSearchvalue,
|
|
44
|
+
searchValue,
|
|
45
|
+
isLoading: isLoadingLabOrders,
|
|
46
|
+
error: labOrderErrors,
|
|
47
|
+
} = useLabManifestOrders(manifestUuid);
|
|
49
48
|
const { t } = useTranslation();
|
|
50
49
|
const [pageSize, setPageSize] = useState(10);
|
|
51
50
|
const headerTitle = t('labManifestSamples', 'Lab Manifest Samples');
|
|
52
|
-
const { results, totalPages, currentPage, goTo } = usePagination(
|
|
51
|
+
const { results, totalPages, currentPage, goTo } = usePagination(labmanifestOrders, pageSize);
|
|
53
52
|
const { pageSizes } = usePaginationInfo(pageSize, totalPages, currentPage, results.length);
|
|
54
53
|
|
|
55
54
|
const headers = [
|
|
@@ -96,7 +95,7 @@ const LabManifestSamples: React.FC<LabManifestSamplesProps> = ({ manifestUuid })
|
|
|
96
95
|
const handleDeleteManifestSample = (sampleUUid: string) => {
|
|
97
96
|
const dispose = showModal('sample-delete-confirm-dialog', {
|
|
98
97
|
onClose: () => dispose(),
|
|
99
|
-
samples:
|
|
98
|
+
samples: labmanifestOrders.filter((s) => s.uuid === sampleUUid),
|
|
100
99
|
onDelete: async () => {
|
|
101
100
|
try {
|
|
102
101
|
await removeSampleFromTheManifest(sampleUUid);
|
|
@@ -108,7 +107,7 @@ const LabManifestSamples: React.FC<LabManifestSamplesProps> = ({ manifestUuid })
|
|
|
108
107
|
subtitle: t('sampleRemoveSuccess', 'Sample removed from manifest successfully!'),
|
|
109
108
|
});
|
|
110
109
|
} catch (e: any) {
|
|
111
|
-
const _sample =
|
|
110
|
+
const _sample = labmanifestOrders.find((sample) => sample.uuid === sampleUUid);
|
|
112
111
|
showSnackbar({
|
|
113
112
|
title: t('errorRemovingSample', 'Error removing sample {{sample}} from the manifest', {
|
|
114
113
|
sample: _sample.id ?? _sample?.uuid,
|
|
@@ -169,17 +168,13 @@ const LabManifestSamples: React.FC<LabManifestSamplesProps> = ({ manifestUuid })
|
|
|
169
168
|
}
|
|
170
169
|
|
|
171
170
|
const tableRows =
|
|
172
|
-
|
|
171
|
+
results?.map((sample) => {
|
|
173
172
|
return {
|
|
174
173
|
id: `${sample.uuid}`,
|
|
175
174
|
sampleType: sample.sampleType ?? '--',
|
|
176
175
|
status: sample.status,
|
|
177
176
|
batchNumber: sample.batchNumber ?? '--',
|
|
178
|
-
patientName: sample?.order?.patient
|
|
179
|
-
<PatientNameCell patientUuid={sample?.order?.patient?.uuid} />
|
|
180
|
-
) : (
|
|
181
|
-
'--'
|
|
182
|
-
),
|
|
177
|
+
patientName: <PatientNameCell patient={sample?.order?.patient} />,
|
|
183
178
|
cccKDODNumber: sample?.order?.patient ? (
|
|
184
179
|
<PatientCCCNumbercell patientUuid={sample?.order?.patient?.uuid} />
|
|
185
180
|
) : (
|
|
@@ -213,14 +208,14 @@ const LabManifestSamples: React.FC<LabManifestSamplesProps> = ({ manifestUuid })
|
|
|
213
208
|
};
|
|
214
209
|
}) ?? [];
|
|
215
210
|
|
|
216
|
-
if (isLoading) {
|
|
211
|
+
if (isLoading || isLoadingLabOrders) {
|
|
217
212
|
return <DataTableSkeleton rowCount={5} />;
|
|
218
213
|
}
|
|
219
|
-
if (error) {
|
|
214
|
+
if (error || labOrderErrors) {
|
|
220
215
|
return <ErrorState headerTitle={headerTitle} error={error} />;
|
|
221
216
|
}
|
|
222
217
|
|
|
223
|
-
if (
|
|
218
|
+
if (labmanifestOrders.length === 0) {
|
|
224
219
|
return (
|
|
225
220
|
<EmptyState
|
|
226
221
|
headerTitle={t('manifestSamples', 'Manifest Samples')}
|
|
@@ -228,6 +223,7 @@ const LabManifestSamples: React.FC<LabManifestSamplesProps> = ({ manifestUuid })
|
|
|
228
223
|
/>
|
|
229
224
|
);
|
|
230
225
|
}
|
|
226
|
+
|
|
231
227
|
return (
|
|
232
228
|
<div className={styles.widgetContainer}>
|
|
233
229
|
<DataTable
|
|
@@ -249,7 +245,7 @@ const LabManifestSamples: React.FC<LabManifestSamplesProps> = ({ manifestUuid })
|
|
|
249
245
|
<CardHeader title={headerTitle}>
|
|
250
246
|
<Button
|
|
251
247
|
onClick={() => {
|
|
252
|
-
const data = selectedRows.map(({ id }) =>
|
|
248
|
+
const data = selectedRows.map(({ id }) => labmanifestOrders.find((s) => s.uuid === id));
|
|
253
249
|
handleDeleteSelectedSamples(data);
|
|
254
250
|
}}
|
|
255
251
|
renderIcon={ArrowRight}
|
|
@@ -257,6 +253,7 @@ const LabManifestSamples: React.FC<LabManifestSamplesProps> = ({ manifestUuid })
|
|
|
257
253
|
{t('deleteSelectedSamples', 'Remove Selected Samples')}
|
|
258
254
|
</Button>
|
|
259
255
|
</CardHeader>
|
|
256
|
+
<Search labelText={''} value={searchValue} onChange={({ target: { value } }) => setSearchvalue(value)} />
|
|
260
257
|
<TableContainer {...getTableContainerProps()}>
|
|
261
258
|
<Table {...getTableProps()}>
|
|
262
259
|
<TableHead>
|
|
@@ -289,7 +286,7 @@ const LabManifestSamples: React.FC<LabManifestSamplesProps> = ({ manifestUuid })
|
|
|
289
286
|
page={currentPage}
|
|
290
287
|
pageSize={pageSize}
|
|
291
288
|
pageSizes={pageSizes}
|
|
292
|
-
totalItems={
|
|
289
|
+
totalItems={labmanifestOrders.length}
|
|
293
290
|
onChange={({ page, pageSize }) => {
|
|
294
291
|
goTo(page);
|
|
295
292
|
setPageSize(pageSize);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DataTable,
|
|
3
3
|
DataTableSkeleton,
|
|
4
|
-
Dropdown,
|
|
5
4
|
Layer,
|
|
6
5
|
OverflowMenu,
|
|
7
6
|
OverflowMenuItem,
|
|
@@ -13,6 +12,7 @@ import {
|
|
|
13
12
|
TableHead,
|
|
14
13
|
TableHeader,
|
|
15
14
|
TableRow,
|
|
15
|
+
Tile,
|
|
16
16
|
} from '@carbon/react';
|
|
17
17
|
import {
|
|
18
18
|
ErrorState,
|
|
@@ -26,10 +26,11 @@ import {
|
|
|
26
26
|
useLayoutType,
|
|
27
27
|
usePagination,
|
|
28
28
|
} from '@openmrs/esm-framework';
|
|
29
|
-
import {
|
|
29
|
+
import { EmptyDataIllustration, usePaginationInfo } from '@openmrs/esm-patient-common-lib';
|
|
30
30
|
import React, { useCallback, useMemo, useState } from 'react';
|
|
31
31
|
import { useTranslation } from 'react-i18next';
|
|
32
32
|
import { LabManifestConfig } from '../config-schema';
|
|
33
|
+
import LabManifestTableFilterHeader from '../header/lab-manifest-table-filters-header.component';
|
|
33
34
|
import { useLabManifests } from '../hooks';
|
|
34
35
|
import {
|
|
35
36
|
editableManifestStatus,
|
|
@@ -206,47 +207,21 @@ const LabManifestsTable = () => {
|
|
|
206
207
|
if (manifests.length === 0) {
|
|
207
208
|
return (
|
|
208
209
|
<Layer className={styles.tile}>
|
|
209
|
-
<
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
label={t('selectManifestStatus', 'Select manifest status')}
|
|
219
|
-
items={LabManifestFilters.map((mn) => mn.value)}
|
|
220
|
-
itemToString={(item) => LabManifestFilters.find((lm) => lm.value === item)?.label ?? ''}
|
|
221
|
-
/>
|
|
222
|
-
</CardHeader>
|
|
223
|
-
<EmptyDataIllustration />
|
|
224
|
-
<p className={styles.content}>
|
|
225
|
-
{t('notLabManifetToDisplay', 'There are no {{status}} lab manifets data to display.', {
|
|
226
|
-
status: LabManifestFilters.find((lm) => lm.params === currFilter)?.label ?? '',
|
|
227
|
-
})}
|
|
228
|
-
</p>
|
|
210
|
+
<LabManifestTableFilterHeader filter={currFilter} onFilterChange={setCurrFilter} title={headerTitle} />
|
|
211
|
+
<Tile>
|
|
212
|
+
<EmptyDataIllustration />
|
|
213
|
+
<p className={styles.content}>
|
|
214
|
+
{t('notLabManifetToDisplay', 'There are no {{status}} lab manifets data to display.', {
|
|
215
|
+
status: LabManifestFilters.find((lm) => lm.params === currFilter)?.label ?? '',
|
|
216
|
+
})}
|
|
217
|
+
</p>
|
|
218
|
+
</Tile>
|
|
229
219
|
</Layer>
|
|
230
220
|
);
|
|
231
221
|
}
|
|
232
222
|
return (
|
|
233
223
|
<div className={styles.widgetContainer}>
|
|
234
|
-
<
|
|
235
|
-
<div style={{ padding: '10px' }}>
|
|
236
|
-
<Dropdown
|
|
237
|
-
titleText={t('manifestStatus', 'Manifest status')}
|
|
238
|
-
style={{ minWidth: '300px' }}
|
|
239
|
-
id="manifestStatus"
|
|
240
|
-
onChange={({ selectedItem }) => {
|
|
241
|
-
setCurrFilter(LabManifestFilters.find((lb) => lb.value === selectedItem).params);
|
|
242
|
-
}}
|
|
243
|
-
initialSelectedItem={LabManifestFilters.find((lb) => lb.params === currFilter).value}
|
|
244
|
-
label={t('selectManifestStatus', 'Select manifest status')}
|
|
245
|
-
items={LabManifestFilters.map((mn) => mn.value)}
|
|
246
|
-
itemToString={(item) => LabManifestFilters.find((lm) => lm.value === item)?.label ?? ''}
|
|
247
|
-
/>
|
|
248
|
-
</div>
|
|
249
|
-
</CardHeader>
|
|
224
|
+
<LabManifestTableFilterHeader filter={currFilter} onFilterChange={setCurrFilter} title={headerTitle} />
|
|
250
225
|
<DataTable
|
|
251
226
|
useZebraStyles
|
|
252
227
|
size="sm"
|
|
@@ -1,27 +1,20 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Order } from '../types';
|
|
3
1
|
import { ConfigurableLink } from '@openmrs/esm-framework';
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { Patient } from '../hooks/useLabManifestOrders';
|
|
6
4
|
|
|
7
5
|
type Props = {
|
|
8
|
-
|
|
6
|
+
patient?: Patient;
|
|
9
7
|
};
|
|
10
8
|
|
|
11
|
-
const PatientNameCell: React.FC<Props> = ({
|
|
12
|
-
const { isLoading, patient } = usePatient(patientUuid);
|
|
9
|
+
const PatientNameCell: React.FC<Props> = ({ patient }) => {
|
|
13
10
|
const patientChartUrl = '${openmrsSpaBase}/patient/${patientUuid}/chart/Patient Summary';
|
|
14
|
-
|
|
15
|
-
if (isLoading) {
|
|
16
|
-
return <InlineLoading status="active" iconDescription="Loading" />;
|
|
17
|
-
}
|
|
18
|
-
|
|
11
|
+
const { display, uuid: patientUuid } = patient ?? {};
|
|
19
12
|
return (
|
|
20
13
|
<ConfigurableLink
|
|
21
14
|
to={patientChartUrl}
|
|
22
15
|
templateParams={{ patientUuid: patientUuid }}
|
|
23
16
|
style={{ textDecoration: 'none' }}>
|
|
24
|
-
{
|
|
17
|
+
{display}
|
|
25
18
|
</ConfigurableLink>
|
|
26
19
|
);
|
|
27
20
|
};
|
package/translations/en.json
CHANGED
|
@@ -22,7 +22,6 @@
|
|
|
22
22
|
"labPersonContact": "Lab person Contact",
|
|
23
23
|
"manifestId": "Manifest Id",
|
|
24
24
|
"manifestSamples": "Manifest samples",
|
|
25
|
-
"manifestStatus": "Manifest status",
|
|
26
25
|
"notLabManifetToDisplay": "There are no {{status}} lab manifets data to display.",
|
|
27
26
|
"patient": "Patient",
|
|
28
27
|
"patientName": "Patient name",
|