@kenyaemr/esm-ward-app 8.5.3-pre.85 → 8.5.3-pre.89
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 +7 -7
- package/dist/1498.js +1 -1
- package/dist/1498.js.map +1 -1
- package/dist/1917.js +1 -1
- package/dist/2168.js +1 -1
- package/dist/2168.js.map +1 -1
- package/dist/2557.js +1 -1
- package/dist/2932.js +1 -1
- package/dist/3103.js +1 -1
- package/dist/3365.js +1 -1
- package/dist/3737.js +1 -1
- package/dist/4224.js +1 -1
- package/dist/6009.js +1 -1
- package/dist/6009.js.map +1 -1
- package/dist/6871.js +1 -1
- package/dist/7179.js +1 -1
- package/dist/7524.js +1 -1
- package/dist/7661.js +1 -1
- package/dist/8205.js +1 -1
- package/dist/8308.js +1 -1
- package/dist/8411.js +1 -1
- package/dist/9045.js +1 -1
- package/dist/kenyaemr-esm-ward-app.js.buildmanifest.json +25 -25
- 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/config-schema.ts +0 -5
- package/src/in-patient/admission-request.component.tsx +5 -4
- package/src/in-patient/admission-request.test.tsx +0 -39
- package/src/ward-patients/admitted-patients.tsx +56 -47
- package/src/ward-patients/awaiting-admission-patients.tsx +60 -50
- package/src/ward-patients/discharge-in-patients.tsx +55 -47
- package/src/ward-patients/discharge-patients.tsx +105 -95
package/dist/routes.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"webservices.rest":"^2.2.0","emrapi":"^2.0.0 || 2.0.0-SNAPSHOT"},"optionalBackendDependencies":{"bedmanagement":{"version":"^6.0.0 || 6.0.0-SNAPSHOT","feature":{"flagName":"bedmanagement-module","label":"Ward App Patient Service","description":"This module, if installed, provides services for managing patients admitted to the ward."}}},"extensions":[{"name":"ward-dashboard-link","component":"wardDashboardLink","slot":"homepage-dashboard-slot","meta":{"name":"ward","slot":"ward-dashboard-slot","title":"Wards"}},{"component":"root","name":"ward-dashboard","slot":"ward-dashboard-slot"},{"component":"wardView","name":"ward-view","slot":"ward-view-slot"},{"component":"wardPatientActionButtonExtension","name":"ward-patient-action-button","slot":"action-menu-ward-patient-items-slot"},{"component":"wardPatientNotesActionButtonExtension","name":"ward-inpatient-notes-form-action-button","slot":"action-menu-ward-patient-items-slot"},{"component":"coloredObsTagCardRowExtension","name":"colored-obs-tags-card-row","slot":"ward-patient-card-slot"},{"name":"transfer-swap-patient-siderail-button","slot":"action-menu-ward-patient-items-slot","component":"patientTransferAndSwapWorkspaceSiderailIcon"},{"name":"patient-discharge-siderail-button","slot":"action-menu-ward-patient-items-slot","component":"patientDischargeWorkspaceSideRailIcon"},{"name":"clinical-forms-workspace-siderail-button","component":"clinicalFormWorkspaceSideRailIcon","slot":"action-menu-ward-patient-items-slot"},{"name":"admission-requests-workspace-siderail-button","component":"admissionRequestsWorkspaceSideRailIcon","slot":"action-menu-ward-patient-admission-requests-items-slot"},{"name":"create-admission-request-workspace-siderail-button","component":"createAdmissionEncounterWorkspaceSideRailIcon","slot":"action-menu-ward-patient-admission-requests-items-slot"},{"component":"defaultWardView","name":"default-ward","slot":"default-ward"},{"component":"maternalWardView","name":"maternal-ward","slot":"maternal-ward"},{"component":"patientDischargeDocumentPreview","name":"patient-discharge-document-preview-modal"},{"component":"wardPatientWorkspaceBanner","name":"ward-patient-workspace-banner","slot":"ward-workspace-patient-banner-slot"},{"name":"in-patient-dashboard-link","component":"inPatientChartLink","order":7,"meta":{"slot":"patient-chart-in-patient-dashboard-slot","path":"in-patient","layoutMode":"anchored","columns":1,"columnSpan":1}},{"name":"in-patient-dashboard","slot":"patient-chart-in-patient-dashboard-slot","component":"inPatientChartDashboard","meta":{"fullWidth":false}}],"workspaces":[{"name":"admission-requests-workspace","component":"admissionRequestWorkspace","title":"admissionRequests","type":"pending-admission-requests","width":"wider"},{"name":"create-admission-encounter-workspace","component":"createAdmissionEncounterWorkspace","title":"admitPatient","type":"patient-search-workspace","width":"wider"},{"name":"ward-patient-notes-workspace","component":"wardPatientNotesWorkspace","type":"ward-patient-notes","title":"inpatientNotesWorkspaceTitle"},{"name":"admit-patient-form-workspace","component":"admitPatientFormWorkspace","title":"admissionRequests","type":"admission-requests"},{"name":"ward-patient-workspace","component":"wardPatientWorkspace","type":"ward","title":"Ward patient","width":"extra-wide"},{"name":"patient-transfer-swap-workspace","component":"patientTransferAndSwapWorkspace","title":"transfers","type":"transfer-swap-bed-form"},{"name":"patient-transfer-request-workspace","component":"patientTransferRequestWorkspace","title":"transferRequest","type":"transfer-request-form"},{"name":"patient-discharge-workspace","component":"patientDischargeWorkspace","title":"discharge","width":"extra-wide","canMaximize":true,"type":"ward-patient-discharge"},{"name":"ward-patient-clinical-forms-workspace","component":"patientClinicalFormsWorkspace","title":"clinicalForms","type":"ward-patient-clinical-forms","width":"wider"},{"name":"cancel-admission-request-workspace","component":"cancelAdmissionRequestWorkspace","title":"cancelAdmissionRequest","type":"cancel-admission-request"}],"workspaceGroups":[{"name":"ward-patient","members":["ward-patient-workspace","ward-patient-notes-workspace","patient-transfer-swap-workspace","patient-discharge-workspace","ward-patient-clinical-forms-workspace","add-drug-order","order-basket","add-lab-order"]},{"name":"ward-patient-admission-requests","members":["admission-requests-workspace","create-admission-encounter-workspace"]}],"version":"8.5.3-pre.
|
|
1
|
+
{"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"webservices.rest":"^2.2.0","emrapi":"^2.0.0 || 2.0.0-SNAPSHOT"},"optionalBackendDependencies":{"bedmanagement":{"version":"^6.0.0 || 6.0.0-SNAPSHOT","feature":{"flagName":"bedmanagement-module","label":"Ward App Patient Service","description":"This module, if installed, provides services for managing patients admitted to the ward."}}},"extensions":[{"name":"ward-dashboard-link","component":"wardDashboardLink","slot":"homepage-dashboard-slot","meta":{"name":"ward","slot":"ward-dashboard-slot","title":"Wards"}},{"component":"root","name":"ward-dashboard","slot":"ward-dashboard-slot"},{"component":"wardView","name":"ward-view","slot":"ward-view-slot"},{"component":"wardPatientActionButtonExtension","name":"ward-patient-action-button","slot":"action-menu-ward-patient-items-slot"},{"component":"wardPatientNotesActionButtonExtension","name":"ward-inpatient-notes-form-action-button","slot":"action-menu-ward-patient-items-slot"},{"component":"coloredObsTagCardRowExtension","name":"colored-obs-tags-card-row","slot":"ward-patient-card-slot"},{"name":"transfer-swap-patient-siderail-button","slot":"action-menu-ward-patient-items-slot","component":"patientTransferAndSwapWorkspaceSiderailIcon"},{"name":"patient-discharge-siderail-button","slot":"action-menu-ward-patient-items-slot","component":"patientDischargeWorkspaceSideRailIcon"},{"name":"clinical-forms-workspace-siderail-button","component":"clinicalFormWorkspaceSideRailIcon","slot":"action-menu-ward-patient-items-slot"},{"name":"admission-requests-workspace-siderail-button","component":"admissionRequestsWorkspaceSideRailIcon","slot":"action-menu-ward-patient-admission-requests-items-slot"},{"name":"create-admission-request-workspace-siderail-button","component":"createAdmissionEncounterWorkspaceSideRailIcon","slot":"action-menu-ward-patient-admission-requests-items-slot"},{"component":"defaultWardView","name":"default-ward","slot":"default-ward"},{"component":"maternalWardView","name":"maternal-ward","slot":"maternal-ward"},{"component":"patientDischargeDocumentPreview","name":"patient-discharge-document-preview-modal"},{"component":"wardPatientWorkspaceBanner","name":"ward-patient-workspace-banner","slot":"ward-workspace-patient-banner-slot"},{"name":"in-patient-dashboard-link","component":"inPatientChartLink","order":7,"meta":{"slot":"patient-chart-in-patient-dashboard-slot","path":"in-patient","layoutMode":"anchored","columns":1,"columnSpan":1}},{"name":"in-patient-dashboard","slot":"patient-chart-in-patient-dashboard-slot","component":"inPatientChartDashboard","meta":{"fullWidth":false}}],"workspaces":[{"name":"admission-requests-workspace","component":"admissionRequestWorkspace","title":"admissionRequests","type":"pending-admission-requests","width":"wider"},{"name":"create-admission-encounter-workspace","component":"createAdmissionEncounterWorkspace","title":"admitPatient","type":"patient-search-workspace","width":"wider"},{"name":"ward-patient-notes-workspace","component":"wardPatientNotesWorkspace","type":"ward-patient-notes","title":"inpatientNotesWorkspaceTitle"},{"name":"admit-patient-form-workspace","component":"admitPatientFormWorkspace","title":"admissionRequests","type":"admission-requests"},{"name":"ward-patient-workspace","component":"wardPatientWorkspace","type":"ward","title":"Ward patient","width":"extra-wide"},{"name":"patient-transfer-swap-workspace","component":"patientTransferAndSwapWorkspace","title":"transfers","type":"transfer-swap-bed-form"},{"name":"patient-transfer-request-workspace","component":"patientTransferRequestWorkspace","title":"transferRequest","type":"transfer-request-form"},{"name":"patient-discharge-workspace","component":"patientDischargeWorkspace","title":"discharge","width":"extra-wide","canMaximize":true,"type":"ward-patient-discharge"},{"name":"ward-patient-clinical-forms-workspace","component":"patientClinicalFormsWorkspace","title":"clinicalForms","type":"ward-patient-clinical-forms","width":"wider"},{"name":"cancel-admission-request-workspace","component":"cancelAdmissionRequestWorkspace","title":"cancelAdmissionRequest","type":"cancel-admission-request"}],"workspaceGroups":[{"name":"ward-patient","members":["ward-patient-workspace","ward-patient-notes-workspace","patient-transfer-swap-workspace","patient-discharge-workspace","ward-patient-clinical-forms-workspace","add-drug-order","order-basket","add-lab-order"]},{"name":"ward-patient-admission-requests","members":["admission-requests-workspace","create-admission-encounter-workspace"]}],"version":"8.5.3-pre.89"}
|
package/package.json
CHANGED
package/src/config-schema.ts
CHANGED
|
@@ -400,11 +400,6 @@ export const configSchema: ConfigSchema = {
|
|
|
400
400
|
hideExpression: 'ageInDays < 28',
|
|
401
401
|
tags: [],
|
|
402
402
|
},
|
|
403
|
-
{
|
|
404
|
-
label: 'Partograph Form',
|
|
405
|
-
uuid: '3791e5b7-2cdc-44fc-982b-a81135367c96',
|
|
406
|
-
tags: [{ uuid: '7680b7ee-6880-450c-8b7e-2a748b6f9dc7', tag: 'Labour & Delivery Ward' }],
|
|
407
|
-
},
|
|
408
403
|
{
|
|
409
404
|
uuid: '87379b0a-738b-4799-9736-cdac614cee2a',
|
|
410
405
|
label: 'Doctors Note',
|
|
@@ -17,6 +17,7 @@ import { useTranslation } from 'react-i18next';
|
|
|
17
17
|
import { Add } from '@carbon/react/icons';
|
|
18
18
|
import type { WardConfigObject } from '../config-schema';
|
|
19
19
|
import { useAdmissionRequest } from './in-patient.resource';
|
|
20
|
+
import useCurrentPatientAdmissionEncounter from '../hooks/useCurrentPatientAdmissionEncounter';
|
|
20
21
|
|
|
21
22
|
type AdmissionRequestProps = {
|
|
22
23
|
patientUuid: string;
|
|
@@ -28,6 +29,8 @@ const AdmissionRequest: React.FC<AdmissionRequestProps> = ({ patientUuid }) => {
|
|
|
28
29
|
const controlSize = isDesktop(layout) ? 'sm' : 'md';
|
|
29
30
|
const { admissionRequestFormUuid } = useConfig<WardConfigObject>();
|
|
30
31
|
const { admissionRequest, isLoading, error, mutate } = useAdmissionRequest(patientUuid);
|
|
32
|
+
const { isPatientAdmitted } = useCurrentPatientAdmissionEncounter(patientUuid);
|
|
33
|
+
|
|
31
34
|
const rows = useMemo(() => {
|
|
32
35
|
return admissionRequest.map((admissionRequest) => ({
|
|
33
36
|
id: admissionRequest.patient.uuid,
|
|
@@ -73,7 +76,7 @@ const AdmissionRequest: React.FC<AdmissionRequestProps> = ({ patientUuid }) => {
|
|
|
73
76
|
<EmptyState
|
|
74
77
|
displayText={t('admissionRequests', 'admission requests')}
|
|
75
78
|
headerTitle={t('admissionRequest', 'Admission Request')}
|
|
76
|
-
launchForm={handleLaunchAdmissionRequestForm}
|
|
79
|
+
launchForm={isPatientAdmitted ? undefined : handleLaunchAdmissionRequestForm}
|
|
77
80
|
/>
|
|
78
81
|
);
|
|
79
82
|
}
|
|
@@ -81,9 +84,7 @@ const AdmissionRequest: React.FC<AdmissionRequestProps> = ({ patientUuid }) => {
|
|
|
81
84
|
return (
|
|
82
85
|
<div>
|
|
83
86
|
<CardHeader title={t('admissionRequest', 'Admission Request')}>
|
|
84
|
-
|
|
85
|
-
{t('add', 'Add')}
|
|
86
|
-
</Button>
|
|
87
|
+
<></>
|
|
87
88
|
</CardHeader>
|
|
88
89
|
<DataTable size={controlSize} rows={rows} headers={headers}>
|
|
89
90
|
{({ rows, headers, getTableProps, getHeaderProps, getRowProps, getCellProps }) => (
|
|
@@ -309,45 +309,6 @@ describe('AdmissionRequest', () => {
|
|
|
309
309
|
expect(screen.getAllByText('ADMIT')).toHaveLength(2);
|
|
310
310
|
});
|
|
311
311
|
|
|
312
|
-
it('should render Add button in header when data is available', () => {
|
|
313
|
-
mockUseAdmissionRequest.mockReturnValue({
|
|
314
|
-
admissionRequest: mockAdmissionRequestData,
|
|
315
|
-
isLoading: false,
|
|
316
|
-
error: undefined,
|
|
317
|
-
mutate: mockMutate,
|
|
318
|
-
});
|
|
319
|
-
|
|
320
|
-
render(<AdmissionRequest patientUuid={patientUuid} />);
|
|
321
|
-
|
|
322
|
-
const addButton = screen.getByRole('button', { name: /Add/i });
|
|
323
|
-
expect(addButton).toBeInTheDocument();
|
|
324
|
-
});
|
|
325
|
-
|
|
326
|
-
it('should launch admission request form when clicking Add button', async () => {
|
|
327
|
-
const user = userEvent.setup();
|
|
328
|
-
|
|
329
|
-
mockUseAdmissionRequest.mockReturnValue({
|
|
330
|
-
admissionRequest: mockAdmissionRequestData,
|
|
331
|
-
isLoading: false,
|
|
332
|
-
error: undefined,
|
|
333
|
-
mutate: mockMutate,
|
|
334
|
-
});
|
|
335
|
-
|
|
336
|
-
render(<AdmissionRequest patientUuid={patientUuid} />);
|
|
337
|
-
|
|
338
|
-
const addButton = screen.getByRole('button', { name: /Add/i });
|
|
339
|
-
await user.click(addButton);
|
|
340
|
-
|
|
341
|
-
expect(mockLaunchWorkspace).toHaveBeenCalledWith('patient-form-entry-workspace', {
|
|
342
|
-
workspaceTitle: 'Admission Request',
|
|
343
|
-
mutateForm: mockMutate,
|
|
344
|
-
formInfo: {
|
|
345
|
-
formUuid: 'test-admission-form-uuid',
|
|
346
|
-
encounterUuid: '',
|
|
347
|
-
},
|
|
348
|
-
});
|
|
349
|
-
});
|
|
350
|
-
|
|
351
312
|
test('should format dates correctly in the table', () => {
|
|
352
313
|
mockUseAdmissionRequest.mockReturnValue({
|
|
353
314
|
admissionRequest: mockAdmissionRequestData,
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
OverflowMenu,
|
|
5
5
|
OverflowMenuItem,
|
|
6
6
|
Pagination,
|
|
7
|
+
Search,
|
|
7
8
|
Table,
|
|
8
9
|
TableBody,
|
|
9
10
|
TableCell,
|
|
@@ -30,6 +31,8 @@ import { bedLayoutToBed, getOpenmrsId } from '../ward-view/ward-view.resource';
|
|
|
30
31
|
import { HyperLinkPatientCell } from './patient-cells';
|
|
31
32
|
import { EmptyState } from './table-state-components';
|
|
32
33
|
const AdmittedPatients = () => {
|
|
34
|
+
const [search, setSearch] = useState('');
|
|
35
|
+
|
|
33
36
|
const { wardPatientGroupDetails } = useAppContext<WardViewContext>('ward-view-context') ?? {};
|
|
34
37
|
const { bedLayouts, wardAdmittedPatientsWithBed, isLoading } = wardPatientGroupDetails ?? {};
|
|
35
38
|
const { t } = useTranslation();
|
|
@@ -80,7 +83,10 @@ const AdmittedPatients = () => {
|
|
|
80
83
|
}, [bedLayouts, wardAdmittedPatientsWithBed, config]);
|
|
81
84
|
|
|
82
85
|
const [pageSize, setPageSize] = useState(5);
|
|
83
|
-
const
|
|
86
|
+
const searchResults = useMemo(() => {
|
|
87
|
+
return patients?.filter((pat) => pat?.patient?.person?.display?.toLowerCase().includes(search.toLowerCase()));
|
|
88
|
+
}, [patients, search]);
|
|
89
|
+
const { paginated, results, totalPages, currentPage, goTo } = usePagination(searchResults, pageSize);
|
|
84
90
|
const { pageSizes } = usePaginationInfo(pageSize, totalPages, currentPage, results.length);
|
|
85
91
|
const tableRows = useMemo(() => {
|
|
86
92
|
return results.map((patient, index) => {
|
|
@@ -152,52 +158,55 @@ const AdmittedPatients = () => {
|
|
|
152
158
|
return <EmptyState message={t('noAdmittedPatientsinCurrentward', 'No admitted patients in the current ward')} />;
|
|
153
159
|
|
|
154
160
|
return (
|
|
155
|
-
<
|
|
156
|
-
{(
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
header
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
161
|
+
<div>
|
|
162
|
+
<Search value={search} onChange={(e) => setSearch(e.target.value)} />
|
|
163
|
+
<DataTable rows={tableRows} headers={headers} isSortable useZebraStyles>
|
|
164
|
+
{({ rows, headers, getHeaderProps, getRowProps, getTableProps, getCellProps }) => (
|
|
165
|
+
<TableContainer>
|
|
166
|
+
<Table {...getTableProps()} aria-label="sample table">
|
|
167
|
+
<TableHead>
|
|
168
|
+
<TableRow>
|
|
169
|
+
{headers.map((header) => (
|
|
170
|
+
<TableHeader
|
|
171
|
+
key={header.key}
|
|
172
|
+
{...getHeaderProps({
|
|
173
|
+
header,
|
|
174
|
+
})}>
|
|
175
|
+
{header.header}
|
|
176
|
+
</TableHeader>
|
|
177
|
+
))}
|
|
178
|
+
</TableRow>
|
|
179
|
+
</TableHead>
|
|
180
|
+
<TableBody>
|
|
181
|
+
{rows.map((row) => {
|
|
182
|
+
return (
|
|
183
|
+
<TableRow key={row.id} {...getRowProps({ row })}>
|
|
184
|
+
{row.cells.map((cell) => (
|
|
185
|
+
<TableCell key={cell.id} {...getCellProps({ cell })}>
|
|
186
|
+
{cell.value}
|
|
187
|
+
</TableCell>
|
|
188
|
+
))}
|
|
189
|
+
</TableRow>
|
|
190
|
+
);
|
|
191
|
+
})}
|
|
192
|
+
</TableBody>
|
|
193
|
+
</Table>
|
|
194
|
+
{paginated && !isLoading && (
|
|
195
|
+
<Pagination
|
|
196
|
+
page={currentPage}
|
|
197
|
+
pageSize={pageSize}
|
|
198
|
+
pageSizes={pageSizes}
|
|
199
|
+
totalItems={(patients ?? []).length}
|
|
200
|
+
onChange={({ page, pageSize }) => {
|
|
201
|
+
goTo(page);
|
|
202
|
+
setPageSize(pageSize);
|
|
203
|
+
}}
|
|
204
|
+
/>
|
|
205
|
+
)}
|
|
206
|
+
</TableContainer>
|
|
207
|
+
)}
|
|
208
|
+
</DataTable>
|
|
209
|
+
</div>
|
|
201
210
|
);
|
|
202
211
|
};
|
|
203
212
|
|
|
@@ -3,6 +3,8 @@ import {
|
|
|
3
3
|
DataTableSkeleton,
|
|
4
4
|
OverflowMenu,
|
|
5
5
|
OverflowMenuItem,
|
|
6
|
+
Pagination,
|
|
7
|
+
Search,
|
|
6
8
|
Table,
|
|
7
9
|
TableBody,
|
|
8
10
|
TableCell,
|
|
@@ -10,25 +12,30 @@ import {
|
|
|
10
12
|
TableHead,
|
|
11
13
|
TableHeader,
|
|
12
14
|
TableRow,
|
|
13
|
-
Pagination,
|
|
14
15
|
} from '@carbon/react';
|
|
15
16
|
import { formatDatetime, launchWorkspace, parseDate, useAppContext, usePagination } from '@openmrs/esm-framework';
|
|
17
|
+
import { usePaginationInfo } from '@openmrs/esm-patient-common-lib';
|
|
16
18
|
import dayjs from 'dayjs';
|
|
17
19
|
import React, { useMemo, useState } from 'react';
|
|
18
20
|
import { useTranslation } from 'react-i18next';
|
|
19
21
|
import { type WardPatient, type WardPatientWorkspaceProps, type WardViewContext } from '../types';
|
|
20
22
|
import { getOpenmrsId } from '../ward-view/ward-view.resource';
|
|
21
23
|
import AdmitPatientButton from '../ward-workspace/admit-patient-button.component';
|
|
22
|
-
import { EmptyState, ErrorState } from './table-state-components';
|
|
23
|
-
import { usePaginationInfo } from '@openmrs/esm-patient-common-lib';
|
|
24
24
|
import { HyperLinkPatientCell } from './patient-cells';
|
|
25
|
+
import { EmptyState, ErrorState } from './table-state-components';
|
|
25
26
|
|
|
26
27
|
const AwaitingAdmissionPatients = () => {
|
|
27
28
|
const { t } = useTranslation();
|
|
29
|
+
const [search, setSearch] = useState('');
|
|
28
30
|
const { wardPatientGroupDetails } = useAppContext<WardViewContext>('ward-view-context') ?? {};
|
|
29
31
|
const { inpatientRequests, isLoading, error } = wardPatientGroupDetails?.inpatientRequestResponse ?? {};
|
|
30
32
|
const [pageSize, setPageSize] = useState(5);
|
|
31
|
-
const
|
|
33
|
+
const searchResults = useMemo(() => {
|
|
34
|
+
return inpatientRequests?.filter((req) =>
|
|
35
|
+
req.patient?.person?.display.toLowerCase().includes(search.toLowerCase()),
|
|
36
|
+
);
|
|
37
|
+
}, [inpatientRequests, search]);
|
|
38
|
+
const { paginated, results, totalPages, currentPage, goTo } = usePagination(searchResults, pageSize);
|
|
32
39
|
const { pageSizes } = usePaginationInfo(pageSize, totalPages, currentPage, results.length);
|
|
33
40
|
|
|
34
41
|
const headers = [
|
|
@@ -109,52 +116,55 @@ const AwaitingAdmissionPatients = () => {
|
|
|
109
116
|
if (!inpatientRequests || !inpatientRequests.length)
|
|
110
117
|
return <EmptyState message={t('noPatientInAdmisionQueue', 'No patients in admission queue')} />;
|
|
111
118
|
return (
|
|
112
|
-
<
|
|
113
|
-
{(
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
header
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
119
|
+
<div>
|
|
120
|
+
<Search value={search} onChange={(e) => setSearch(e.target.value)} />
|
|
121
|
+
<DataTable rows={tableRows} headers={headers} isSortable useZebraStyles>
|
|
122
|
+
{({ rows, headers, getHeaderProps, getRowProps, getTableProps, getCellProps }) => (
|
|
123
|
+
<TableContainer>
|
|
124
|
+
<Table {...getTableProps()} aria-label="sample table">
|
|
125
|
+
<TableHead>
|
|
126
|
+
<TableRow>
|
|
127
|
+
{headers.map((header) => (
|
|
128
|
+
<TableHeader
|
|
129
|
+
key={header.key}
|
|
130
|
+
{...getHeaderProps({
|
|
131
|
+
header,
|
|
132
|
+
})}>
|
|
133
|
+
{header.header}
|
|
134
|
+
</TableHeader>
|
|
135
|
+
))}
|
|
136
|
+
</TableRow>
|
|
137
|
+
</TableHead>
|
|
138
|
+
<TableBody>
|
|
139
|
+
{rows.map((row) => {
|
|
140
|
+
return (
|
|
141
|
+
<TableRow key={row.id} {...getRowProps({ row })}>
|
|
142
|
+
{row.cells.map((cell) => (
|
|
143
|
+
<TableCell key={cell.id} {...getCellProps({ cell })}>
|
|
144
|
+
{cell.value}
|
|
145
|
+
</TableCell>
|
|
146
|
+
))}
|
|
147
|
+
</TableRow>
|
|
148
|
+
);
|
|
149
|
+
})}
|
|
150
|
+
</TableBody>
|
|
151
|
+
</Table>
|
|
152
|
+
{paginated && !isLoading && (
|
|
153
|
+
<Pagination
|
|
154
|
+
page={currentPage}
|
|
155
|
+
pageSize={pageSize}
|
|
156
|
+
pageSizes={pageSizes}
|
|
157
|
+
totalItems={(inpatientRequests ?? []).length}
|
|
158
|
+
onChange={({ page, pageSize }) => {
|
|
159
|
+
goTo(page);
|
|
160
|
+
setPageSize(pageSize);
|
|
161
|
+
}}
|
|
162
|
+
/>
|
|
163
|
+
)}
|
|
164
|
+
</TableContainer>
|
|
165
|
+
)}
|
|
166
|
+
</DataTable>
|
|
167
|
+
</div>
|
|
158
168
|
);
|
|
159
169
|
};
|
|
160
170
|
|
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
OverflowMenu,
|
|
4
4
|
OverflowMenuItem,
|
|
5
5
|
Pagination,
|
|
6
|
+
Search,
|
|
6
7
|
Table,
|
|
7
8
|
TableBody,
|
|
8
9
|
TableCell,
|
|
@@ -33,6 +34,7 @@ import { EmptyState } from './table-state-components';
|
|
|
33
34
|
|
|
34
35
|
const DischargeInPatients = () => {
|
|
35
36
|
const { t } = useTranslation();
|
|
37
|
+
const [search, setSearch] = useState('');
|
|
36
38
|
const { wardPatientGroupDetails } = useAppContext<WardViewContext>('ward-view-context') ?? {};
|
|
37
39
|
const { bedLayouts, wardAdmittedPatientsWithBed, isLoading } = wardPatientGroupDetails ?? {};
|
|
38
40
|
const { emrConfiguration, isLoadingEmrConfiguration, errorFetchingEmrConfiguration } = useEmrConfiguration();
|
|
@@ -86,7 +88,10 @@ const DischargeInPatients = () => {
|
|
|
86
88
|
}, [bedLayouts, wardAdmittedPatientsWithBed, config]);
|
|
87
89
|
|
|
88
90
|
const [pageSize, setPageSize] = useState(5);
|
|
89
|
-
const
|
|
91
|
+
const searchResults = useMemo(() => {
|
|
92
|
+
return patients?.filter((pat) => pat?.patient?.person?.display?.toLowerCase().includes(search.toLowerCase()));
|
|
93
|
+
}, [patients, search]);
|
|
94
|
+
const { paginated, results, totalPages, currentPage, goTo } = usePagination(searchResults, pageSize);
|
|
90
95
|
const { pageSizes } = usePaginationInfo(pageSize, totalPages, currentPage, results.length);
|
|
91
96
|
|
|
92
97
|
const tableRows = useMemo(() => {
|
|
@@ -147,52 +152,55 @@ const DischargeInPatients = () => {
|
|
|
147
152
|
if (!patients.length) return <EmptyState message={t('noDischargeInpatients', 'No Discharge in patients')} />;
|
|
148
153
|
|
|
149
154
|
return (
|
|
150
|
-
<
|
|
151
|
-
{(
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
header
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
155
|
+
<div>
|
|
156
|
+
<Search value={search} onChange={(e) => setSearch(e.target.value)} />
|
|
157
|
+
<DataTable rows={tableRows} headers={headers} isSortable useZebraStyles>
|
|
158
|
+
{({ rows, headers, getHeaderProps, getRowProps, getTableProps, getCellProps }) => (
|
|
159
|
+
<TableContainer>
|
|
160
|
+
<Table {...getTableProps()} aria-label="sample table">
|
|
161
|
+
<TableHead>
|
|
162
|
+
<TableRow>
|
|
163
|
+
{headers.map((header) => (
|
|
164
|
+
<TableHeader
|
|
165
|
+
key={header.key}
|
|
166
|
+
{...getHeaderProps({
|
|
167
|
+
header,
|
|
168
|
+
})}>
|
|
169
|
+
{header.header}
|
|
170
|
+
</TableHeader>
|
|
171
|
+
))}
|
|
172
|
+
</TableRow>
|
|
173
|
+
</TableHead>
|
|
174
|
+
<TableBody>
|
|
175
|
+
{rows.map((row) => {
|
|
176
|
+
return (
|
|
177
|
+
<TableRow key={row.id} {...getRowProps({ row })}>
|
|
178
|
+
{row.cells.map((cell) => (
|
|
179
|
+
<TableCell key={cell.id} {...getCellProps({ cell })}>
|
|
180
|
+
{cell.value}
|
|
181
|
+
</TableCell>
|
|
182
|
+
))}
|
|
183
|
+
</TableRow>
|
|
184
|
+
);
|
|
185
|
+
})}
|
|
186
|
+
</TableBody>
|
|
187
|
+
</Table>
|
|
188
|
+
{paginated && !isLoading && (
|
|
189
|
+
<Pagination
|
|
190
|
+
page={currentPage}
|
|
191
|
+
pageSize={pageSize}
|
|
192
|
+
pageSizes={pageSizes}
|
|
193
|
+
totalItems={(patients ?? []).length}
|
|
194
|
+
onChange={({ page, pageSize }) => {
|
|
195
|
+
goTo(page);
|
|
196
|
+
setPageSize(pageSize);
|
|
197
|
+
}}
|
|
198
|
+
/>
|
|
199
|
+
)}
|
|
200
|
+
</TableContainer>
|
|
201
|
+
)}
|
|
202
|
+
</DataTable>
|
|
203
|
+
</div>
|
|
196
204
|
);
|
|
197
205
|
};
|
|
198
206
|
|