@kenyaemr/esm-service-queues-app 7.0.2-pre.65
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 +40 -0
- package/README.md +20 -0
- package/dist/130.js +2 -0
- package/dist/130.js.LICENSE.txt +3 -0
- package/dist/130.js.map +1 -0
- package/dist/152.js +1 -0
- package/dist/152.js.map +1 -0
- package/dist/169.js +1 -0
- package/dist/169.js.map +1 -0
- package/dist/185.js +1 -0
- package/dist/185.js.map +1 -0
- package/dist/233.js +1 -0
- package/dist/233.js.map +1 -0
- package/dist/237.js +1 -0
- package/dist/237.js.map +1 -0
- package/dist/255.js +2 -0
- package/dist/255.js.LICENSE.txt +9 -0
- package/dist/255.js.map +1 -0
- package/dist/271.js +1 -0
- package/dist/276.js +1 -0
- package/dist/276.js.map +1 -0
- package/dist/303.js +1 -0
- package/dist/303.js.map +1 -0
- package/dist/319.js +1 -0
- package/dist/401.js +1 -0
- package/dist/401.js.map +1 -0
- package/dist/430.js +2 -0
- package/dist/430.js.LICENSE.txt +50 -0
- package/dist/430.js.map +1 -0
- package/dist/460.js +1 -0
- package/dist/501.js +1 -0
- package/dist/501.js.map +1 -0
- package/dist/574.js +1 -0
- package/dist/591.js +2 -0
- package/dist/591.js.LICENSE.txt +32 -0
- package/dist/591.js.map +1 -0
- package/dist/644.js +1 -0
- package/dist/647.js +1 -0
- package/dist/647.js.map +1 -0
- package/dist/650.js +1 -0
- package/dist/650.js.map +1 -0
- package/dist/669.js +1 -0
- package/dist/669.js.map +1 -0
- package/dist/696.js +1 -0
- package/dist/696.js.map +1 -0
- package/dist/703.js +1 -0
- package/dist/703.js.map +1 -0
- package/dist/729.js +1 -0
- package/dist/729.js.map +1 -0
- package/dist/738.js +1 -0
- package/dist/738.js.map +1 -0
- package/dist/757.js +1 -0
- package/dist/764.js +1 -0
- package/dist/764.js.map +1 -0
- package/dist/784.js +2 -0
- package/dist/784.js.LICENSE.txt +9 -0
- package/dist/784.js.map +1 -0
- package/dist/788.js +1 -0
- package/dist/806.js +1 -0
- package/dist/806.js.map +1 -0
- package/dist/807.js +1 -0
- package/dist/833.js +1 -0
- package/dist/877.js +1 -0
- package/dist/877.js.map +1 -0
- package/dist/917.js +1 -0
- package/dist/917.js.map +1 -0
- package/dist/940.js +1 -0
- package/dist/940.js.map +1 -0
- package/dist/981.js +1 -0
- package/dist/981.js.map +1 -0
- package/dist/kenyaemr-esm-service-queues-app.js +1 -0
- package/dist/kenyaemr-esm-service-queues-app.js.buildmanifest.json +965 -0
- package/dist/kenyaemr-esm-service-queues-app.js.map +1 -0
- package/dist/main.js +2 -0
- package/dist/main.js.LICENSE.txt +60 -0
- package/dist/main.js.map +1 -0
- package/dist/routes.json +1 -0
- package/jest.config.js +3 -0
- package/package.json +54 -0
- package/src/active-visits/active-visits-row-actions.component.tsx +25 -0
- package/src/active-visits/active-visits-row-actions.scss +4 -0
- package/src/active-visits/active-visits-table.resource.ts +273 -0
- package/src/active-visits/change-status-dialog.component.tsx +272 -0
- package/src/active-visits/change-status-dialog.scss +47 -0
- package/src/active-visits/change-status-dialog.test.tsx +154 -0
- package/src/add-patient-toqueue/add-patient-toqueue-dialog.component.tsx +228 -0
- package/src/add-patient-toqueue/add-patient-toqueue-dialog.scss +32 -0
- package/src/add-provider-queue-room/add-provider-queue-room.component.tsx +238 -0
- package/src/add-provider-queue-room/add-provider-queue-room.resource.ts +76 -0
- package/src/add-provider-queue-room/add-provider-queue-room.scss +17 -0
- package/src/add-provider-queue-room/add-provider-queue-room.test.tsx +105 -0
- package/src/clear-queue-entries-dialog/clear-queue-entries-dialog.component.tsx +76 -0
- package/src/clear-queue-entries-dialog/clear-queue-entries-dialog.resource.ts +7 -0
- package/src/clear-queue-entries-dialog/clear-queue-entries-dialog.scss +8 -0
- package/src/clear-queue-entries-dialog/clear-queue-entries-dialog.test.tsx +43 -0
- package/src/clear-queue-entries-dialog/clear-queue-entries.component.tsx +43 -0
- package/src/config-schema.ts +465 -0
- package/src/constants.ts +10 -0
- package/src/createDashboardLink.component.tsx +39 -0
- package/src/current-visit/current-visit-summary.component.tsx +38 -0
- package/src/current-visit/current-visit-summary.test.tsx +43 -0
- package/src/current-visit/current-visit.resource.ts +84 -0
- package/src/current-visit/current-visit.scss +34 -0
- package/src/current-visit/hooks/useVitalsConceptMetadata.tsx +101 -0
- package/src/current-visit/visit-details/biometrics-config-schema.ts +14 -0
- package/src/current-visit/visit-details/current-visit-details.component.tsx +96 -0
- package/src/current-visit/visit-details/triage-note.component.tsx +53 -0
- package/src/current-visit/visit-details/triage-note.scss +89 -0
- package/src/current-visit/visit-details/vitals-config-schema.ts +17 -0
- package/src/current-visit/visit-details/vitals.component.tsx +165 -0
- package/src/dashboard.meta.ts +5 -0
- package/src/declarations.d.ts +4 -0
- package/src/helpers/functions.ts +28 -0
- package/src/helpers/helpers.ts +177 -0
- package/src/helpers/time-helpers.ts +15 -0
- package/src/home.component.tsx +16 -0
- package/src/home.test.tsx +48 -0
- package/src/hooks/useConcept.ts +13 -0
- package/src/hooks/useQueue.ts +10 -0
- package/src/hooks/useQueueEntries.ts +187 -0
- package/src/hooks/useQueues.ts +22 -0
- package/src/hooks/useSystemSetting.ts +18 -0
- package/src/index.ts +172 -0
- package/src/past-visit/past-visit-details/encounter-list.component.tsx +54 -0
- package/src/past-visit/past-visit-details/medications-list.component.tsx +98 -0
- package/src/past-visit/past-visit-details/notes-list.component.tsx +41 -0
- package/src/past-visit/past-visit-details/past-visit-summary.component.tsx +181 -0
- package/src/past-visit/past-visit-details/past-visit-summary.scss +58 -0
- package/src/past-visit/past-visit.component.tsx +37 -0
- package/src/past-visit/past-visit.resource.ts +83 -0
- package/src/past-visit/past-visit.scss +126 -0
- package/src/past-visit/past-visit.test.tsx +41 -0
- package/src/patient-info/appointment-details.component.tsx +98 -0
- package/src/patient-info/appointment-details.scss +34 -0
- package/src/patient-info/appointment-details.test.tsx +36 -0
- package/src/patient-info/appointments.resource.ts +43 -0
- package/src/patient-info/hooks/usePatientAttributes.tsx +42 -0
- package/src/patient-info/patient-info.component.tsx +82 -0
- package/src/patient-info/patient-info.scss +60 -0
- package/src/patient-info/patient-info.test.tsx +43 -0
- package/src/patient-queue-header/patient-queue-header.component.tsx +99 -0
- package/src/patient-queue-header/patient-queue-header.scss +90 -0
- package/src/patient-queue-header/patient-queue-illustration.component.tsx +22 -0
- package/src/patient-queue-metrics/clinic-metrics.component.tsx +98 -0
- package/src/patient-queue-metrics/clinic-metrics.resource.ts +58 -0
- package/src/patient-queue-metrics/clinic-metrics.scss +11 -0
- package/src/patient-queue-metrics/clinic-metrics.test.tsx +76 -0
- package/src/patient-queue-metrics/metrics-card.component.tsx +68 -0
- package/src/patient-queue-metrics/metrics-card.scss +80 -0
- package/src/patient-queue-metrics/metrics-header.component.tsx +61 -0
- package/src/patient-queue-metrics/metrics-header.scss +26 -0
- package/src/patient-queue-metrics/queue-metrics.resource.ts +42 -0
- package/src/patient-search/advanced-search.component.tsx +191 -0
- package/src/patient-search/advanced-search.scss +154 -0
- package/src/patient-search/advanced-search.test.tsx +29 -0
- package/src/patient-search/basic-search.component.tsx +112 -0
- package/src/patient-search/basic-search.scss +139 -0
- package/src/patient-search/basic-search.test.tsx +23 -0
- package/src/patient-search/empty-data-illustration.component.tsx +41 -0
- package/src/patient-search/hooks/useActivePatientEnrollment.tsx +29 -0
- package/src/patient-search/hooks/useDefaultLocation.ts +14 -0
- package/src/patient-search/hooks/usePatients.tsx +25 -0
- package/src/patient-search/hooks/useQueueLocations.tsx +23 -0
- package/src/patient-search/hooks/useRecommendedVisitTypes.tsx +35 -0
- package/src/patient-search/hooks/useScheduledVisits.ts +52 -0
- package/src/patient-search/patient-scheduled-visits.component.tsx +324 -0
- package/src/patient-search/patient-scheduled-visits.scss +131 -0
- package/src/patient-search/patient-scheduled-visits.test.tsx +44 -0
- package/src/patient-search/patient-search.scss +43 -0
- package/src/patient-search/patient-search.workspace.tsx +135 -0
- package/src/patient-search/search-illustration.component.tsx +27 -0
- package/src/patient-search/search-results.component.tsx +75 -0
- package/src/patient-search/search-results.scss +80 -0
- package/src/patient-search/search-results.test.tsx +77 -0
- package/src/patient-search/search.resource.ts +10 -0
- package/src/patient-search/visit-form/existing-visit-form.component.tsx +112 -0
- package/src/patient-search/visit-form/queue.resource.ts +64 -0
- package/src/patient-search/visit-form/visit-form.component.tsx +344 -0
- package/src/patient-search/visit-form/visit-form.scss +73 -0
- package/src/patient-search/visit-form/visit-type-selector.component.tsx +155 -0
- package/src/patient-search/visit-form/visit-type-selector.scss +100 -0
- package/src/patient-search/visit-form/visit-type-selector.test.tsx +83 -0
- package/src/patient-search/visit-form-queue-fields/visit-form-queue-fields.component.tsx +178 -0
- package/src/patient-search/visit-form-queue-fields/visit-form-queue-fields.scss +19 -0
- package/src/patient-search/visit-form-queue-fields/visit-form-queue-fields.test.tsx +63 -0
- package/src/queue-entry-table-components/edit-entry.scss +14 -0
- package/src/queue-entry-table-components/queue-duration.component.tsx +41 -0
- package/src/queue-entry-table-components/queue-priority.component.tsx +38 -0
- package/src/queue-entry-table-components/queue-priority.scss +12 -0
- package/src/queue-entry-table-components/queue-status.component.tsx +39 -0
- package/src/queue-entry-table-components/transition-entry.component.tsx +55 -0
- package/src/queue-entry-table-components/transition-entry.scss +22 -0
- package/src/queue-patient-linelists/queue-linelist-base-table.component.tsx +241 -0
- package/src/queue-patient-linelists/queue-linelist-base-table.scss +110 -0
- package/src/queue-patient-linelists/queue-linelist-base-table.test.tsx +93 -0
- package/src/queue-patient-linelists/queue-linelist-filter.scss +63 -0
- package/src/queue-patient-linelists/queue-linelist-filter.test.tsx +94 -0
- package/src/queue-patient-linelists/queue-linelist-filter.workspace.tsx +185 -0
- package/src/queue-patient-linelists/queue-linelist.resource.ts +84 -0
- package/src/queue-patient-linelists/queue-services-table.component.tsx +63 -0
- package/src/queue-patient-linelists/scheduled-appointments-table.component.tsx +305 -0
- package/src/queue-patient-linelists/scheduled-appointments-table.test.tsx +41 -0
- package/src/queue-rooms/queue-room-form.scss +56 -0
- package/src/queue-rooms/queue-room-form.test.tsx +80 -0
- package/src/queue-rooms/queue-room-form.workspace.tsx +169 -0
- package/src/queue-rooms/queue-room.resource.ts +20 -0
- package/src/queue-screen/queue-screen.component.tsx +47 -0
- package/src/queue-screen/queue-screen.scss +39 -0
- package/src/queue-screen/queue-screen.test.tsx +51 -0
- package/src/queue-screen/useActiveTickets.tsx +13 -0
- package/src/queue-services/queue-service-form.scss +61 -0
- package/src/queue-services/queue-service-form.test.tsx +60 -0
- package/src/queue-services/queue-service-form.workspace.tsx +179 -0
- package/src/queue-services/queue-service.resource.ts +33 -0
- package/src/queue-table/cells/columns.resource.ts +135 -0
- package/src/queue-table/cells/queue-table-action-cell.component.tsx +88 -0
- package/src/queue-table/cells/queue-table-action-cell.scss +7 -0
- package/src/queue-table/cells/queue-table-coming-from-cell.component.tsx +13 -0
- package/src/queue-table/cells/queue-table-extension-cell.component.tsx +16 -0
- package/src/queue-table/cells/queue-table-name-cell.component.tsx +20 -0
- package/src/queue-table/cells/queue-table-patient-age-cell.component.tsx +18 -0
- package/src/queue-table/cells/queue-table-patient-identifier-cell.component.tsx +25 -0
- package/src/queue-table/cells/queue-table-priority-cell.component.tsx +23 -0
- package/src/queue-table/cells/queue-table-queue-name-cell.component.tsx +14 -0
- package/src/queue-table/cells/queue-table-status-cell.component.tsx +18 -0
- package/src/queue-table/cells/queue-table-visit-attribute-queue-number-cell.component.tsx +37 -0
- package/src/queue-table/cells/queue-table-visit-start-time-cell.component.tsx +20 -0
- package/src/queue-table/cells/queue-table-wait-time-cell.component.tsx +17 -0
- package/src/queue-table/default-queue-table.component.tsx +174 -0
- package/src/queue-table/default-queue-table.test.tsx +131 -0
- package/src/queue-table/queue-entry-actions/edit-queue-entry-modal.component.tsx +52 -0
- package/src/queue-table/queue-entry-actions/end-queue-entry-modal.component.tsx +39 -0
- package/src/queue-table/queue-entry-actions/queue-entry-actions-modal.component.tsx +362 -0
- package/src/queue-table/queue-entry-actions/queue-entry-actions-modal.test.tsx +152 -0
- package/src/queue-table/queue-entry-actions/queue-entry-actions.resource.ts +83 -0
- package/src/queue-table/queue-entry-actions/queue-entry-actons-modal.scss +36 -0
- package/src/queue-table/queue-entry-actions/queue-entry-confirm-action-modal.component.tsx +97 -0
- package/src/queue-table/queue-entry-actions/queue-entry-confirm-action-modal.test.tsx +106 -0
- package/src/queue-table/queue-entry-actions/queue-entry-undo-actions-modal.test.tsx +76 -0
- package/src/queue-table/queue-entry-actions/transition-queue-entry-modal.component.tsx +51 -0
- package/src/queue-table/queue-entry-actions/undo-transition-queue-entry-modal.component.tsx +58 -0
- package/src/queue-table/queue-entry-actions/void-queue-entry-modal.component.tsx +34 -0
- package/src/queue-table/queue-table-by-status-menu.component.tsx +42 -0
- package/src/queue-table/queue-table-by-status-menu.scss +11 -0
- package/src/queue-table/queue-table-by-status-skeleton.component.tsx +32 -0
- package/src/queue-table/queue-table-by-status.component.tsx +96 -0
- package/src/queue-table/queue-table-expanded-row.component.tsx +29 -0
- package/src/queue-table/queue-table-metrics-card.component.tsx +50 -0
- package/src/queue-table/queue-table-metrics-card.scss +48 -0
- package/src/queue-table/queue-table-metrics.component.tsx +30 -0
- package/src/queue-table/queue-table-metrics.scss +11 -0
- package/src/queue-table/queue-table.component.tsx +179 -0
- package/src/queue-table/queue-table.scss +192 -0
- package/src/queue-table/queue-table.test.tsx +210 -0
- package/src/remove-queue-entry-dialog/remove-queue-entry.component.tsx +87 -0
- package/src/remove-queue-entry-dialog/remove-queue-entry.resource.ts +93 -0
- package/src/remove-queue-entry-dialog/remove-queue-entry.scss +7 -0
- package/src/remove-queue-entry-dialog/remove-queue-entry.test.tsx +45 -0
- package/src/root.component.tsx +28 -0
- package/src/root.scss +15 -0
- package/src/root.test.tsx +24 -0
- package/src/routes.json +133 -0
- package/src/side-menu/nav-group/createNavGroup.tsx +17 -0
- package/src/side-menu/nav-group/nav-group.component.tsx +24 -0
- package/src/side-menu/nav-group/nav-group.test.tsx +32 -0
- package/src/side-menu/nav-group/nav-group.ts +10 -0
- package/src/side-menu/side-menu.component.tsx +6 -0
- package/src/side-menu/side-menu.test.tsx +17 -0
- package/src/transition-queue-entry/transition-queue-entry-dialog.component.tsx +134 -0
- package/src/transition-queue-entry/transition-queue-entry-dialog.scss +12 -0
- package/src/transition-queue-entry/transition-queue-entry-dialog.test.tsx +102 -0
- package/src/transition-queue-entry/transition-queue-entry.resource.ts +16 -0
- package/src/types/index.ts +494 -0
- package/src/views/queue-table-by-status-view.component.tsx +25 -0
- package/src/views/queue-tables-for-all-statuses.component.tsx +150 -0
- package/src/visits-missing-inqueue/visits-missing-inqueue.component.tsx +277 -0
- package/src/visits-missing-inqueue/visits-missing-inqueue.resource.ts +93 -0
- package/src/visits-missing-inqueue/visits-missing-inqueue.scss +108 -0
- package/translations/am.json +295 -0
- package/translations/ar.json +295 -0
- package/translations/en.json +305 -0
- package/translations/es.json +295 -0
- package/translations/fr.json +295 -0
- package/translations/he.json +295 -0
- package/translations/km.json +295 -0
- package/translations/zh.json +295 -0
- package/translations/zh_CN.json +295 -0
- package/tsconfig.json +5 -0
- package/webpack.config.js +1 -0
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
import React, { useMemo, useState } from 'react';
|
|
2
|
+
import { useTranslation } from 'react-i18next';
|
|
3
|
+
import {
|
|
4
|
+
Button,
|
|
5
|
+
DataTable,
|
|
6
|
+
type DataTableHeader,
|
|
7
|
+
Layer,
|
|
8
|
+
Table,
|
|
9
|
+
TableBody,
|
|
10
|
+
TableCell,
|
|
11
|
+
TableContainer,
|
|
12
|
+
TableHead,
|
|
13
|
+
TableHeader,
|
|
14
|
+
TableRow,
|
|
15
|
+
TableToolbar,
|
|
16
|
+
TableToolbarContent,
|
|
17
|
+
TableToolbarSearch,
|
|
18
|
+
Tag,
|
|
19
|
+
Tile,
|
|
20
|
+
DataTableSkeleton,
|
|
21
|
+
Pagination,
|
|
22
|
+
} from '@carbon/react';
|
|
23
|
+
import { Filter, OverflowMenuVertical } from '@carbon/react/icons';
|
|
24
|
+
import {
|
|
25
|
+
ConfigurableLink,
|
|
26
|
+
ExtensionSlot,
|
|
27
|
+
formatDatetime,
|
|
28
|
+
launchWorkspace,
|
|
29
|
+
parseDate,
|
|
30
|
+
usePagination,
|
|
31
|
+
} from '@openmrs/esm-framework';
|
|
32
|
+
import styles from './queue-linelist-base-table.scss';
|
|
33
|
+
import { type FilterTypes } from '../types';
|
|
34
|
+
import { getGender } from '../helpers/functions';
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* FIXME Temporarily moved here
|
|
38
|
+
*/
|
|
39
|
+
interface DataTableHeader {
|
|
40
|
+
key: string;
|
|
41
|
+
header: React.ReactNode;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
type FilterProps = {
|
|
45
|
+
rowIds: Array<string>;
|
|
46
|
+
headers: Array<DataTableHeader>;
|
|
47
|
+
cellsById: any;
|
|
48
|
+
inputValue: string;
|
|
49
|
+
getCellId: (row, key) => string;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
interface QueuePatientTableProps {
|
|
53
|
+
title: string;
|
|
54
|
+
patientData: Array<any>;
|
|
55
|
+
headers: Array<any>;
|
|
56
|
+
serviceType: string;
|
|
57
|
+
isLoading: boolean;
|
|
58
|
+
toggleFilter?: (filterMode: FilterTypes) => void;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const QueuePatientBaseTable: React.FC<QueuePatientTableProps> = ({
|
|
62
|
+
title,
|
|
63
|
+
patientData,
|
|
64
|
+
headers,
|
|
65
|
+
serviceType,
|
|
66
|
+
isLoading,
|
|
67
|
+
}) => {
|
|
68
|
+
const { t } = useTranslation();
|
|
69
|
+
const { results, currentPage, goTo } = usePagination(patientData ?? [], 100);
|
|
70
|
+
|
|
71
|
+
const handleFilter = ({ rowIds, headers, cellsById, inputValue, getCellId }: FilterProps): Array<string> => {
|
|
72
|
+
return rowIds.filter((rowId) =>
|
|
73
|
+
headers.some(({ key }) => {
|
|
74
|
+
const cellId = getCellId(rowId, key);
|
|
75
|
+
const filterableValue = cellsById[cellId].value;
|
|
76
|
+
const filterTerm = inputValue.toLowerCase();
|
|
77
|
+
|
|
78
|
+
if (typeof filterableValue === 'boolean') {
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
if (filterableValue.hasOwnProperty('content')) {
|
|
82
|
+
if (Array.isArray(filterableValue.content.props.children)) {
|
|
83
|
+
return ('' + filterableValue.content.props.children[1].props.children).toLowerCase().includes(filterTerm);
|
|
84
|
+
}
|
|
85
|
+
if (typeof filterableValue.content.props.children === 'object') {
|
|
86
|
+
return ('' + filterableValue.content.props.children.props.children.props.children)
|
|
87
|
+
.toLowerCase()
|
|
88
|
+
.includes(filterTerm);
|
|
89
|
+
}
|
|
90
|
+
return ('' + filterableValue.content.props.children).toLowerCase().includes(filterTerm);
|
|
91
|
+
}
|
|
92
|
+
return ('' + filterableValue).toLowerCase().includes(filterTerm);
|
|
93
|
+
}),
|
|
94
|
+
);
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
const pageSizes = useMemo(() => {
|
|
98
|
+
const numberOfPages = Math.ceil(patientData?.length / 100);
|
|
99
|
+
return [...Array(numberOfPages).keys()].map((x) => {
|
|
100
|
+
return (x + 1) * 100;
|
|
101
|
+
});
|
|
102
|
+
}, [patientData]);
|
|
103
|
+
|
|
104
|
+
const tableRows = useMemo(
|
|
105
|
+
() =>
|
|
106
|
+
results?.map((entry) => {
|
|
107
|
+
return {
|
|
108
|
+
id: entry.id,
|
|
109
|
+
name: {
|
|
110
|
+
content: (
|
|
111
|
+
<ConfigurableLink to={`\${openmrsSpaBase}/patient/${entry.patientUuid}/chart`}>
|
|
112
|
+
{entry.name}
|
|
113
|
+
</ConfigurableLink>
|
|
114
|
+
),
|
|
115
|
+
},
|
|
116
|
+
returnDate: formatDatetime(parseDate(entry.returnDate), { mode: 'wide' }),
|
|
117
|
+
gender: getGender(entry.gender, t),
|
|
118
|
+
age: entry.age,
|
|
119
|
+
visitType: entry.visitType,
|
|
120
|
+
phoneNumber: entry.phoneNumber,
|
|
121
|
+
};
|
|
122
|
+
}),
|
|
123
|
+
[results, t],
|
|
124
|
+
);
|
|
125
|
+
|
|
126
|
+
if (isLoading) {
|
|
127
|
+
return <DataTableSkeleton role="progressbar" />;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
return (
|
|
131
|
+
<div className={styles.container}>
|
|
132
|
+
<ExtensionSlot name="breadcrumbs-slot" />
|
|
133
|
+
|
|
134
|
+
<div className={styles.headerContainer}>
|
|
135
|
+
<div>
|
|
136
|
+
<p className={styles.title}>
|
|
137
|
+
{title} {serviceType}
|
|
138
|
+
</p>
|
|
139
|
+
<p className={styles.subTitle}>
|
|
140
|
+
{patientData?.length} · Last Updated: {formatDatetime(new Date(), { mode: 'standard' })}
|
|
141
|
+
</p>
|
|
142
|
+
</div>
|
|
143
|
+
|
|
144
|
+
<Button kind="ghost" size="sm" renderIcon={(props) => <OverflowMenuVertical size={16} {...props} />}>
|
|
145
|
+
{t('actions', 'Actions')}
|
|
146
|
+
</Button>
|
|
147
|
+
</div>
|
|
148
|
+
|
|
149
|
+
<Layer>
|
|
150
|
+
<Tile className={styles.filterTile}>
|
|
151
|
+
<Tag size="md" title="Clear Filter" type="blue">
|
|
152
|
+
{t('today', 'Today')}
|
|
153
|
+
</Tag>
|
|
154
|
+
|
|
155
|
+
<div className={styles.actionsBtn}>
|
|
156
|
+
<Button
|
|
157
|
+
kind="ghost"
|
|
158
|
+
renderIcon={(props) => <Filter size={16} {...props} />}
|
|
159
|
+
iconDescription={t('filter', 'Filter')}
|
|
160
|
+
onClick={() => launchWorkspace('service-queues-linelist-filter')}
|
|
161
|
+
size="sm">
|
|
162
|
+
{t('filter', 'Filter')}
|
|
163
|
+
</Button>
|
|
164
|
+
</div>
|
|
165
|
+
</Tile>
|
|
166
|
+
</Layer>
|
|
167
|
+
|
|
168
|
+
<DataTable
|
|
169
|
+
data-floating-menu-container
|
|
170
|
+
filterRows={handleFilter}
|
|
171
|
+
headers={headers}
|
|
172
|
+
overflowMenuOnHover={false}
|
|
173
|
+
rows={tableRows}
|
|
174
|
+
size="md"
|
|
175
|
+
useZebraStyles>
|
|
176
|
+
{({ rows, headers, getHeaderProps, getTableProps, getRowProps, onInputChange }) => (
|
|
177
|
+
<TableContainer className={styles.tableContainer}>
|
|
178
|
+
<TableToolbar style={{ position: 'static', height: '3rem', overflow: 'visible', backgroundColor: 'color' }}>
|
|
179
|
+
<TableToolbarContent className={styles.toolbarContent}>
|
|
180
|
+
<TableToolbarSearch
|
|
181
|
+
className={styles.search}
|
|
182
|
+
expanded
|
|
183
|
+
onChange={onInputChange}
|
|
184
|
+
placeholder={t('searchThisList', 'Search this list')}
|
|
185
|
+
size="sm"
|
|
186
|
+
/>
|
|
187
|
+
</TableToolbarContent>
|
|
188
|
+
</TableToolbar>
|
|
189
|
+
<Table {...getTableProps()} className={styles.queueTable}>
|
|
190
|
+
<TableHead>
|
|
191
|
+
<TableRow>
|
|
192
|
+
{headers.map((header) => (
|
|
193
|
+
<TableHeader {...getHeaderProps({ header })}>{header.header}</TableHeader>
|
|
194
|
+
))}
|
|
195
|
+
</TableRow>
|
|
196
|
+
</TableHead>
|
|
197
|
+
<TableBody>
|
|
198
|
+
{rows.map((row, index) => {
|
|
199
|
+
return (
|
|
200
|
+
<React.Fragment key={row.id}>
|
|
201
|
+
<TableRow {...getRowProps({ row })}>
|
|
202
|
+
{row.cells.map((cell) => (
|
|
203
|
+
<TableCell key={cell.id}>{cell.value?.content ?? cell.value}</TableCell>
|
|
204
|
+
))}
|
|
205
|
+
</TableRow>
|
|
206
|
+
</React.Fragment>
|
|
207
|
+
);
|
|
208
|
+
})}
|
|
209
|
+
</TableBody>
|
|
210
|
+
</Table>
|
|
211
|
+
{rows.length === 0 ? (
|
|
212
|
+
<div className={styles.tileContainer}>
|
|
213
|
+
<Layer>
|
|
214
|
+
<Tile className={styles.tile}>
|
|
215
|
+
<div className={styles.tileContent}>
|
|
216
|
+
<p className={styles.content}>{t('noPatientsToDisplay', 'No patients to display')}</p>
|
|
217
|
+
<p className={styles.helper}>{t('checkFilters', 'Check the filters above')}</p>
|
|
218
|
+
</div>
|
|
219
|
+
</Tile>
|
|
220
|
+
</Layer>
|
|
221
|
+
</div>
|
|
222
|
+
) : null}
|
|
223
|
+
</TableContainer>
|
|
224
|
+
)}
|
|
225
|
+
</DataTable>
|
|
226
|
+
|
|
227
|
+
<Pagination
|
|
228
|
+
backwardText="Previous page"
|
|
229
|
+
forwardText="Next page"
|
|
230
|
+
page={currentPage}
|
|
231
|
+
pageNumberText="Page Number"
|
|
232
|
+
pageSize={100}
|
|
233
|
+
onChange={({ page }) => goTo(page)}
|
|
234
|
+
pageSizes={pageSizes?.length > 0 ? pageSizes : [100]}
|
|
235
|
+
totalItems={patientData?.length ?? 0}
|
|
236
|
+
/>
|
|
237
|
+
</div>
|
|
238
|
+
);
|
|
239
|
+
};
|
|
240
|
+
|
|
241
|
+
export default QueuePatientBaseTable;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
@use '@carbon/styles/scss/colors';
|
|
2
|
+
@use '@carbon/styles/scss/spacing';
|
|
3
|
+
@use '@carbon/styles/scss/type';
|
|
4
|
+
@import '~@openmrs/esm-styleguide/src/vars';
|
|
5
|
+
|
|
6
|
+
.container {
|
|
7
|
+
padding-bottom: spacing.$spacing-07;
|
|
8
|
+
background-color: $ui-01;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.menuItem {
|
|
12
|
+
max-width: none;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.headerContainer {
|
|
16
|
+
display: flex;
|
|
17
|
+
justify-content: space-between;
|
|
18
|
+
align-items: center;
|
|
19
|
+
padding: spacing.$spacing-05;
|
|
20
|
+
margin: spacing.$spacing-03;
|
|
21
|
+
border-top: 1px solid $text-03;
|
|
22
|
+
border-bottom: 1px solid $text-03;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.title {
|
|
26
|
+
@include type.type-style('body-compact-02');
|
|
27
|
+
|
|
28
|
+
margin: 0 spacing.$spacing-04 spacing.$spacing-04;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.subTitle {
|
|
32
|
+
@include type.type-style('label-01');
|
|
33
|
+
color: $text-02;
|
|
34
|
+
margin: spacing.$spacing-01;
|
|
35
|
+
margin-left: spacing.$spacing-04;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.filterTile {
|
|
39
|
+
border-bottom: 1px solid $text-03;
|
|
40
|
+
margin-bottom: spacing.$spacing-04;
|
|
41
|
+
background-color: $ui-01;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.actionsBtn {
|
|
45
|
+
float: right;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.tableContainer {
|
|
49
|
+
margin: 0 spacing.$spacing-05;
|
|
50
|
+
padding: 0;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.search {
|
|
54
|
+
max-width: 16rem;
|
|
55
|
+
|
|
56
|
+
input {
|
|
57
|
+
background-color: $ui-02 !important;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.tableContainer {
|
|
62
|
+
background-color: $ui-01;
|
|
63
|
+
|
|
64
|
+
a {
|
|
65
|
+
text-decoration: none;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
tr {
|
|
69
|
+
width: spacing.$spacing-01;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.toolbarContent {
|
|
73
|
+
height: spacing.$spacing-07;
|
|
74
|
+
margin-bottom: spacing.$spacing-02;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.queueTable tr:last-of-type {
|
|
79
|
+
td {
|
|
80
|
+
border-bottom: none;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.tileContainer {
|
|
85
|
+
background-color: $ui-02;
|
|
86
|
+
border-top: 1px solid $ui-03;
|
|
87
|
+
padding: spacing.$spacing-11 0;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.tile {
|
|
91
|
+
margin: auto;
|
|
92
|
+
width: fit-content;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.tileContent {
|
|
96
|
+
display: flex;
|
|
97
|
+
flex-direction: column;
|
|
98
|
+
align-items: center;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.content {
|
|
102
|
+
@include type.type-style('heading-compact-02');
|
|
103
|
+
color: $text-02;
|
|
104
|
+
margin-bottom: spacing.$spacing-03;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.helper {
|
|
108
|
+
@include type.type-style('body-compact-01');
|
|
109
|
+
color: $text-02;
|
|
110
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { screen } from '@testing-library/react';
|
|
3
|
+
import userEvent from '@testing-library/user-event';
|
|
4
|
+
import { mockMappedAppointmentsData } from '__mocks__';
|
|
5
|
+
import { renderWithSwr } from 'tools';
|
|
6
|
+
import QueuePatientBaseTable from './queue-linelist-base-table.component';
|
|
7
|
+
|
|
8
|
+
const tableHeaders = [
|
|
9
|
+
{
|
|
10
|
+
id: 0,
|
|
11
|
+
header: 'Name',
|
|
12
|
+
key: 'name',
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
id: 1,
|
|
16
|
+
header: 'Return Date',
|
|
17
|
+
key: 'returnDate',
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
id: 2,
|
|
21
|
+
header: 'Gender',
|
|
22
|
+
key: 'gender',
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
id: 3,
|
|
26
|
+
header: 'Age',
|
|
27
|
+
key: 'age',
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
id: 4,
|
|
31
|
+
header: 'Visit Type',
|
|
32
|
+
key: 'visitType',
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
id: 5,
|
|
36
|
+
header: 'Phone Number',
|
|
37
|
+
key: 'phoneNumber',
|
|
38
|
+
},
|
|
39
|
+
];
|
|
40
|
+
|
|
41
|
+
const testProps = {
|
|
42
|
+
title: 'Scheduled appointments',
|
|
43
|
+
patientData: mockMappedAppointmentsData.data,
|
|
44
|
+
headers: tableHeaders,
|
|
45
|
+
serviceType: '',
|
|
46
|
+
isLoading: false,
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
describe('QueuePatientBaseTable: ', () => {
|
|
50
|
+
it('renders a tabular overview of appointments data when available', async () => {
|
|
51
|
+
const user = userEvent.setup();
|
|
52
|
+
|
|
53
|
+
renderQueueBaseTable();
|
|
54
|
+
|
|
55
|
+
expect(screen.queryByText(/scheduled appointments/i)).toBeInTheDocument();
|
|
56
|
+
const expectedColumnHeaders = [/name/, /return date/, /gender/, /age/, /visit type/, /phone number/];
|
|
57
|
+
expectedColumnHeaders.forEach((header) => {
|
|
58
|
+
expect(screen.getByRole('columnheader', { name: new RegExp(header, 'i') })).toBeInTheDocument();
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
const expectedTableRows = [
|
|
62
|
+
/John Wilson Today, 02:08 PM Male 45 HIV Clinic 0700123456/,
|
|
63
|
+
/Eric Test Ric Today, 02:08 PM Male 32 TB Clinic 0700987654/,
|
|
64
|
+
];
|
|
65
|
+
|
|
66
|
+
expectedTableRows.forEach((row) => {
|
|
67
|
+
expect(screen.queryByRole('row', { name: new RegExp(row, 'i') })).not.toBeInTheDocument();
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
const searchBox = screen.getByRole('searchbox');
|
|
71
|
+
await user.type(searchBox, 'John');
|
|
72
|
+
|
|
73
|
+
expect(screen.queryByText(/john wilson/i)).toBeInTheDocument();
|
|
74
|
+
expect(screen.queryByText(/eric test ric/i)).not.toBeInTheDocument();
|
|
75
|
+
|
|
76
|
+
await user.clear(searchBox);
|
|
77
|
+
await user.type(searchBox, 'gibberish');
|
|
78
|
+
expect(screen.queryByText(/john wilson/i)).not.toBeInTheDocument();
|
|
79
|
+
expect(screen.queryByText(/eric test ric/i)).not.toBeInTheDocument();
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
it('renders an empty state view if data is unavailable', async () => {
|
|
83
|
+
testProps.patientData = [];
|
|
84
|
+
renderQueueBaseTable();
|
|
85
|
+
|
|
86
|
+
expect(screen.getByText(/scheduled appointments/i)).toBeInTheDocument();
|
|
87
|
+
expect(screen.getByText(/no patients to display/i)).toBeInTheDocument();
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
function renderQueueBaseTable() {
|
|
92
|
+
renderWithSwr(<QueuePatientBaseTable {...testProps} />);
|
|
93
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
@use '@carbon/styles/scss/type';
|
|
2
|
+
@use '@carbon/styles/scss/spacing';
|
|
3
|
+
@import '~@openmrs/esm-styleguide/src/vars';
|
|
4
|
+
|
|
5
|
+
.wrapper {
|
|
6
|
+
background-color: $ui-02;
|
|
7
|
+
padding: spacing.$spacing-06;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.grid {
|
|
11
|
+
padding: 0 spacing.$spacing-06 spacing.$spacing-03;
|
|
12
|
+
background-color: $ui-01;
|
|
13
|
+
margin-bottom: spacing.$spacing-05;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.heading {
|
|
17
|
+
color: $text-02;
|
|
18
|
+
@include type.type-style('heading-compact-02');
|
|
19
|
+
margin: spacing.$spacing-04 0 spacing.$spacing-04;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.radioButton {
|
|
23
|
+
margin-top: spacing.$spacing-03;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.button {
|
|
27
|
+
height: spacing.$spacing-10;
|
|
28
|
+
display: flex;
|
|
29
|
+
align-content: flex-start;
|
|
30
|
+
align-items: baseline;
|
|
31
|
+
min-width: 50%;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.numberInputs {
|
|
35
|
+
margin-top: spacing.$spacing-02;
|
|
36
|
+
display: flex;
|
|
37
|
+
flex-direction: row;
|
|
38
|
+
justify-content: space-between;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.tablet {
|
|
42
|
+
padding: spacing.$spacing-06 spacing.$spacing-05;
|
|
43
|
+
background-color: $ui-02;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.desktop {
|
|
47
|
+
padding: 0rem;
|
|
48
|
+
margin-top: spacing.$spacing-05;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/* Desktop */
|
|
52
|
+
:global(.omrs-breakpoint-gt-tablet) {
|
|
53
|
+
.form {
|
|
54
|
+
height: calc(100vh - 6rem);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/* Tablet */
|
|
59
|
+
:global(.omrs-breakpoint-lt-desktop) {
|
|
60
|
+
.form {
|
|
61
|
+
height: calc(100vh - 3rem);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import userEvent from '@testing-library/user-event';
|
|
3
|
+
import { render, screen } from '@testing-library/react';
|
|
4
|
+
import { mockVisitTypes } from '__mocks__';
|
|
5
|
+
import QueueLinelistFilter from './queue-linelist-filter.workspace';
|
|
6
|
+
|
|
7
|
+
jest.mock('@openmrs/esm-framework', () => ({
|
|
8
|
+
...jest.requireActual('@openmrs/esm-framework'),
|
|
9
|
+
useLayoutType: jest.fn(() => 'tablet'),
|
|
10
|
+
useVisitTypes: jest.fn(() => mockVisitTypes),
|
|
11
|
+
toOpemrsIsoString: jest.fn(),
|
|
12
|
+
}));
|
|
13
|
+
|
|
14
|
+
const workspaceProps = {
|
|
15
|
+
closeWorkspace: jest.fn(),
|
|
16
|
+
promptBeforeClosing: jest.fn(),
|
|
17
|
+
closeWorkspaceWithSavedChanges: jest.fn(),
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
describe('QueueLinelistFilter', () => {
|
|
21
|
+
it('renders the form with filter elements', () => {
|
|
22
|
+
render(<QueueLinelistFilter {...workspaceProps} />);
|
|
23
|
+
|
|
24
|
+
expect(screen.getByText('Gender')).toBeInTheDocument();
|
|
25
|
+
expect(screen.getByLabelText('Age')).toBeInTheDocument();
|
|
26
|
+
expect(screen.getByLabelText('Between')).toBeInTheDocument();
|
|
27
|
+
expect(screen.getByLabelText('And')).toBeInTheDocument();
|
|
28
|
+
expect(screen.getByLabelText('Date')).toBeInTheDocument();
|
|
29
|
+
expect(screen.getByText("Use today's date")).toBeInTheDocument();
|
|
30
|
+
expect(screen.getByRole('combobox', { name: /Select visit type/i })).toBeInTheDocument();
|
|
31
|
+
expect(screen.getByText('Cancel')).toBeInTheDocument();
|
|
32
|
+
expect(screen.getByText('Apply filters')).toBeInTheDocument();
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it('calls closePanel function when cancel button is clicked', async () => {
|
|
36
|
+
const user = userEvent.setup();
|
|
37
|
+
const closeWorkspace = jest.fn();
|
|
38
|
+
|
|
39
|
+
render(<QueueLinelistFilter {...{ ...workspaceProps, closeWorkspace }} />);
|
|
40
|
+
|
|
41
|
+
const cancelButton = screen.getByText('Cancel');
|
|
42
|
+
await user.click(cancelButton);
|
|
43
|
+
|
|
44
|
+
expect(closeWorkspace).toHaveBeenCalledTimes(1);
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it('updates gender state when a radio button is selected', async () => {
|
|
48
|
+
const user = userEvent.setup();
|
|
49
|
+
|
|
50
|
+
render(<QueueLinelistFilter {...workspaceProps} />);
|
|
51
|
+
|
|
52
|
+
const maleRadioButton = screen.getByLabelText('Male');
|
|
53
|
+
await user.click(maleRadioButton);
|
|
54
|
+
|
|
55
|
+
expect(maleRadioButton).toBeChecked();
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it('updates startAge state when a number is entered', async () => {
|
|
59
|
+
const user = userEvent.setup();
|
|
60
|
+
render(<QueueLinelistFilter {...workspaceProps} />);
|
|
61
|
+
|
|
62
|
+
const startAgeInput = screen.getByLabelText('Between');
|
|
63
|
+
await user.type(startAgeInput, '10');
|
|
64
|
+
|
|
65
|
+
expect(startAgeInput).toHaveValue(10);
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
it('updates returnDate state when date input changes', async () => {
|
|
69
|
+
const user = userEvent.setup();
|
|
70
|
+
|
|
71
|
+
render(<QueueLinelistFilter {...workspaceProps} />);
|
|
72
|
+
|
|
73
|
+
const returnDateInput = screen.getByLabelText('Date');
|
|
74
|
+
|
|
75
|
+
await user.clear(returnDateInput);
|
|
76
|
+
await user.type(returnDateInput, '2023-08-20');
|
|
77
|
+
|
|
78
|
+
expect(returnDateInput).toHaveValue('2023-08-20');
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
it('should open the visit type dropdown and close after selection', async () => {
|
|
82
|
+
const user = userEvent.setup();
|
|
83
|
+
|
|
84
|
+
render(<QueueLinelistFilter {...workspaceProps} />);
|
|
85
|
+
|
|
86
|
+
const visitTypeDropdown = screen.getByRole('combobox', { name: /Select visit type/i });
|
|
87
|
+
await user.click(visitTypeDropdown);
|
|
88
|
+
|
|
89
|
+
const type1Option = screen.getByText('Outpatient Visit');
|
|
90
|
+
await user.click(type1Option);
|
|
91
|
+
|
|
92
|
+
expect(visitTypeDropdown).toHaveTextContent('Open menu');
|
|
93
|
+
});
|
|
94
|
+
});
|