@thrustdevs/esm-procedure-orders-app 1.0.2-pre.6
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 +41 -0
- package/README.md +7 -0
- package/dist/122.js +1 -0
- package/dist/122.js.map +1 -0
- package/dist/144.js +2 -0
- package/dist/144.js.LICENSE.txt +19 -0
- package/dist/144.js.map +1 -0
- package/dist/182.js +1 -0
- package/dist/182.js.map +1 -0
- package/dist/205.js +1 -0
- package/dist/205.js.map +1 -0
- package/dist/216.js +2 -0
- package/dist/216.js.LICENSE.txt +9 -0
- package/dist/216.js.map +1 -0
- package/dist/290.js +2 -0
- package/dist/290.js.LICENSE.txt +5 -0
- package/dist/290.js.map +1 -0
- package/dist/300.js +1 -0
- package/dist/341.js +2 -0
- package/dist/341.js.LICENSE.txt +29 -0
- package/dist/341.js.map +1 -0
- package/dist/41.js +2 -0
- package/dist/41.js.LICENSE.txt +9 -0
- package/dist/41.js.map +1 -0
- package/dist/470.js +1 -0
- package/dist/470.js.map +1 -0
- package/dist/495.js +1 -0
- package/dist/495.js.map +1 -0
- package/dist/506.js +2 -0
- package/dist/506.js.LICENSE.txt +39 -0
- package/dist/506.js.map +1 -0
- package/dist/537.js +1 -0
- package/dist/537.js.map +1 -0
- package/dist/647.js +2 -0
- package/dist/647.js.LICENSE.txt +5 -0
- package/dist/647.js.map +1 -0
- package/dist/7.js +1 -0
- package/dist/7.js.map +1 -0
- package/dist/719.js +2 -0
- package/dist/719.js.LICENSE.txt +5 -0
- package/dist/719.js.map +1 -0
- package/dist/720.js +1 -0
- package/dist/720.js.map +1 -0
- package/dist/876.js +1 -0
- package/dist/876.js.map +1 -0
- package/dist/883.js +1 -0
- package/dist/883.js.map +1 -0
- package/dist/89.js +1 -0
- package/dist/89.js.map +1 -0
- package/dist/892.js +1 -0
- package/dist/892.js.map +1 -0
- package/dist/895.js +1 -0
- package/dist/895.js.map +1 -0
- package/dist/913.js +2 -0
- package/dist/913.js.LICENSE.txt +32 -0
- package/dist/913.js.map +1 -0
- package/dist/924.js +1 -0
- package/dist/924.js.map +1 -0
- package/dist/943.js +1 -0
- package/dist/943.js.map +1 -0
- package/dist/99.js +2 -0
- package/dist/99.js.LICENSE.txt +5 -0
- package/dist/99.js.map +1 -0
- package/dist/kenyaemr-esm-procedure-orders-app.js +1 -0
- package/dist/kenyaemr-esm-procedure-orders-app.js.buildmanifest.json +786 -0
- package/dist/kenyaemr-esm-procedure-orders-app.js.map +1 -0
- package/dist/main.js +2 -0
- package/dist/main.js.LICENSE.txt +35 -0
- package/dist/main.js.map +1 -0
- package/dist/routes.json +1 -0
- package/jest.config.js +8 -0
- package/package.json +55 -0
- package/src/completed-list/completed-list.component.tsx +40 -0
- package/src/completed-list/completed-list.resource.ts +0 -0
- package/src/completed-list/completed-list.scss +223 -0
- package/src/components/create-dashboard-link.component.tsx +35 -0
- package/src/components/overlay/hook.ts +47 -0
- package/src/components/overlay/overlay.component.tsx +42 -0
- package/src/components/overlay/overlay.scss +92 -0
- package/src/config-schema.ts +78 -0
- package/src/constants.ts +5 -0
- package/src/declarations.d.ts +6 -0
- package/src/empty-state/empty-state-component.tsx +21 -0
- package/src/empty-state/empty-state.scss +23 -0
- package/src/form/post-procedures/post-procedure-form.component.tsx +468 -0
- package/src/form/post-procedures/post-procedure-form.scss +189 -0
- package/src/form/post-procedures/post-procedure.resource.tsx +71 -0
- package/src/form/procedures-orders/add-procedures-order/add-procedures-order.scss +44 -0
- package/src/form/procedures-orders/add-procedures-order/add-procedures-order.workspace.tsx +93 -0
- package/src/form/procedures-orders/add-procedures-order/procedures-order-form.component.tsx +476 -0
- package/src/form/procedures-orders/add-procedures-order/procedures-order-form.scss +80 -0
- package/src/form/procedures-orders/add-procedures-order/procedures-order.ts +17 -0
- package/src/form/procedures-orders/add-procedures-order/procedures-type-search.scss +115 -0
- package/src/form/procedures-orders/add-procedures-order/procedures-type-search.tsx +236 -0
- package/src/form/procedures-orders/add-procedures-order/useProceduresTypes.ts +93 -0
- package/src/form/procedures-orders/api.ts +282 -0
- package/src/form/procedures-orders/order-config.ts +48 -0
- package/src/form/procedures-orders/procedures-order-basket-panel/procedures-icon.component.tsx +39 -0
- package/src/form/procedures-orders/procedures-order-basket-panel/procedures-order-basket-item-tile.component.tsx +100 -0
- package/src/form/procedures-orders/procedures-order-basket-panel/procedures-order-basket-item-tile.scss +72 -0
- package/src/form/procedures-orders/procedures-order-basket-panel/procedures-order-basket-panel.extension.tsx +190 -0
- package/src/form/procedures-orders/procedures-order-basket-panel/procedures-order-basket-panel.scss +74 -0
- package/src/form/procedures-orders/procedures-order-basket-panel/procedures-order-basket.scss +55 -0
- package/src/header/procedure-header.component.tsx +32 -0
- package/src/header/procedure-header.scss +70 -0
- package/src/header/procedure-illustration.component.tsx +52 -0
- package/src/hooks/useOrdersWorklist.ts +70 -0
- package/src/hooks/useSearchGroupedResults.ts +22 -0
- package/src/hooks/useSearchResults.ts +39 -0
- package/src/index.ts +59 -0
- package/src/left-panel-link.tsx +40 -0
- package/src/not-done-list/not-done-list.component.tsx +44 -0
- package/src/not-done-list/not-done.scss +207 -0
- package/src/patient-chart/patient-procedure-order-results-table.resource.ts +43 -0
- package/src/patient-chart/patient-procedure-order-results.component.tsx +12 -0
- package/src/patient-chart/patient-procedure-order-results.resource.ts +485 -0
- package/src/patient-chart/patient-procedure-results.component.tsx +30 -0
- package/src/patient-chart/procedure-active-order/procedure-active-order-results.component.tsx +390 -0
- package/src/patient-chart/procedure-active-order/procedure-active-order-results.scss +78 -0
- package/src/patient-chart/procedure-order-referals/procedure-order-referals.component.tsx +394 -0
- package/src/patient-chart/procedure-order-referals/procedure-order-referals.resource.tsx +0 -0
- package/src/patient-chart/procedure-order-referals/procedure-order-referals.scss +78 -0
- package/src/patient-chart/procedure-past-test/laboratory-past-test-order-results.component.tsx +366 -0
- package/src/patient-chart/procedure-past-test/laboratory-past-test-order-results.scss +74 -0
- package/src/patient-chart/procedure-tabs/laboratory-order-tabs.component.tsx +44 -0
- package/src/patient-chart/procedure-tabs/laboratory-order-tabs.scss +7 -0
- package/src/patient-chart/procedure-workspaces/laboratory-referral.workspace.component.tsx +11 -0
- package/src/patient-chart/procedure-workspaces/laboratory-referral.workspace.scss +0 -0
- package/src/patient-chart/results-summary/print-results-summary.component.tsx +152 -0
- package/src/patient-chart/results-summary/print-results-summary.scss +80 -0
- package/src/patient-chart/results-summary/print-results-table.component.tsx +134 -0
- package/src/patient-chart/results-summary/results-summary.resource.tsx +174 -0
- package/src/patient-chart/results-summary/results-summary.scss +158 -0
- package/src/patient-chart/results-summary/send-email-dialog.component.tsx +59 -0
- package/src/patient-chart/results-summary/test-children-results.component.tsx +177 -0
- package/src/patient-chart/results-summary/test-print-results-table.component.tsx +105 -0
- package/src/patient-chart/results-summary/test-results-table.component.tsx +103 -0
- package/src/print/print-procedure-results.component.tsx +49 -0
- package/src/print/print-procedure.component.tsx +105 -0
- package/src/print/print-procedure.scss +98 -0
- package/src/procedure-tabs/completed-tab.component.tsx +12 -0
- package/src/procedure-tabs/not-done-tab.component.tsx +12 -0
- package/src/procedure-tabs/referred-tab.component.tsx +12 -0
- package/src/procedure-tabs/work-list-tab.component.tsx +13 -0
- package/src/procedure.component.tsx +24 -0
- package/src/procedures-ordered/_pick-procedure-request-menu.component.tsx +33 -0
- package/src/procedures-ordered/pick-procedure-order/add-to-worklist-dialog.component.tsx +105 -0
- package/src/procedures-ordered/pick-procedure-order/add-to-worklist-dialog.resource.ts +106 -0
- package/src/procedures-ordered/pick-procedure-order/add-to-worklist-dialog.scss +38 -0
- package/src/procedures-ordered/pick-procedure-request-menu.component.tsx +32 -0
- package/src/procedures-ordered/procedure-dialogs/add-to-worklist-dialog.component.tsx +300 -0
- package/src/procedures-ordered/procedure-dialogs/add-to-worklist-dialog.resource.ts +153 -0
- package/src/procedures-ordered/procedure-dialogs/add-to-worklist-dialog.scss +38 -0
- package/src/procedures-ordered/procedure-instructions/instructions.scss +24 -0
- package/src/procedures-ordered/procedure-instructions/procedure-instructions-menu.component.tsx +32 -0
- package/src/procedures-ordered/procedure-instructions/procedure-instructions.component.tsx +78 -0
- package/src/procedures-ordered/procedure-instructions/procedure-instructions.scss +24 -0
- package/src/procedures-ordered/procedure-queue.scss +211 -0
- package/src/procedures-ordered/procedure-tabs.component.tsx +104 -0
- package/src/procedures-ordered/procedure-tests/procedure-tests.component.tsx +83 -0
- package/src/procedures-ordered/procedure-tests/procedure-tests.resource.ts +14 -0
- package/src/procedures-ordered/procedure-tests/procedure-tests.scss +12 -0
- package/src/procedures-ordered/procedures-ordered-list.component.tsx +38 -0
- package/src/procedures-ordered/reject-order-dialog/reject-order-dialog.scss +14 -0
- package/src/procedures-ordered/reject-order-dialog/reject-procedure-order-dialog.component.tsx +98 -0
- package/src/procedures-ordered/reject-reason/procedure-reject-reason-menu.component.tsx +32 -0
- package/src/procedures-ordered/reject-reason/procedure-reject-reason.component.tsx +40 -0
- package/src/procedures-ordered/transition-patient-new-queue/transition-latest-queue-entry-button.component.tsx +42 -0
- package/src/procedures-ordered/transition-patient-new-queue/transition-latest-queue-entry-button.scss +14 -0
- package/src/procedures-ordered/transition-patient-new-queue/transition-latest-queue-entry-button.test.tsx +67 -0
- package/src/referred-procedures/referred-procedures.component.tsx +37 -0
- package/src/results/result-form-field.component.tsx +141 -0
- package/src/results/result-form.component.tsx +120 -0
- package/src/results/result-form.resource.ts +361 -0
- package/src/results/result-form.scss +22 -0
- package/src/root.component.tsx +16 -0
- package/src/routes.json +152 -0
- package/src/setup-tests.ts +7 -0
- package/src/shared/ui/common/action-button/action-button.component.tsx +68 -0
- package/src/shared/ui/common/action-button/action-button.scss +12 -0
- package/src/shared/ui/common/action-button/order-action-extension.component.tsx +21 -0
- package/src/shared/ui/common/grouped-orders-table.component.tsx +176 -0
- package/src/shared/ui/common/grouped-orders-table.scss +30 -0
- package/src/shared/ui/common/grouped-procedure-types.ts +47 -0
- package/src/shared/ui/common/list-order-details.component.tsx +171 -0
- package/src/shared/ui/common/list-order-details.resource.ts +41 -0
- package/src/shared/ui/common/list-order-details.scss +118 -0
- package/src/shared/ui/common/orders-date-range-picker.scss +15 -0
- package/src/shared/ui/common/orders-date-range-picker.tsx +38 -0
- package/src/summary-tiles/procedure-summary-tiles.component.tsx +36 -0
- package/src/summary-tiles/procedure-summary-tiles.scss +11 -0
- package/src/summary-tiles/procedure-summary.resource.tsx +79 -0
- package/src/summary-tiles/summary-tile.component.tsx +41 -0
- package/src/summary-tiles/summary-tile.scss +53 -0
- package/src/types/index.ts +661 -0
- package/src/types/patient-queue.ts +77 -0
- package/src/ui-components/overflow-menu.component.tsx +74 -0
- package/src/ui-components/overflow-menu.scss +39 -0
- package/src/utils/functions.ts +236 -0
- package/src/utils/orders-table/orders-data-table.component.tsx +129 -0
- package/src/utils/orders-table/orders-data-table.scss +50 -0
- package/src/work-list/work-list.component.tsx +38 -0
- package/src/work-list/work-list.resource.ts +26 -0
- package/src/work-list/work-list.scss +207 -0
- package/translations/en.json +141 -0
- package/tsconfig.json +5 -0
- package/webpack.config.js +1 -0
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import React, { useState, useCallback, useEffect, useRef } from 'react';
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
import { useLayoutType } from '@openmrs/esm-framework';
|
|
4
|
+
import styles from './overflow-menu.scss';
|
|
5
|
+
|
|
6
|
+
interface OrderCustomOverflowMenuComponentProps {
|
|
7
|
+
menuTitle: React.ReactNode;
|
|
8
|
+
children: React.ReactNode;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const OrderCustomOverflowMenuComponent: React.FC<OrderCustomOverflowMenuComponentProps> = ({ children, menuTitle }) => {
|
|
12
|
+
const [showMenu, setShowMenu] = useState(false);
|
|
13
|
+
const isTablet = useLayoutType() === 'tablet';
|
|
14
|
+
const wrapperRef = useRef(null);
|
|
15
|
+
|
|
16
|
+
const toggleShowMenu = useCallback(() => setShowMenu((state) => !state), []);
|
|
17
|
+
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
/**
|
|
20
|
+
* Toggle showMenu if clicked on outside of element
|
|
21
|
+
*/
|
|
22
|
+
function handleClickOutside(event: MouseEvent) {
|
|
23
|
+
if (wrapperRef.current && !wrapperRef.current.contains(event.target)) {
|
|
24
|
+
setShowMenu(false);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// Bind the event listener
|
|
29
|
+
document.addEventListener('mousedown', handleClickOutside);
|
|
30
|
+
return () => {
|
|
31
|
+
// Unbind the event listener on clean up
|
|
32
|
+
document.removeEventListener('mousedown', handleClickOutside);
|
|
33
|
+
};
|
|
34
|
+
}, [wrapperRef]);
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<div data-overflow-menu className={classNames('cds--overflow-menu', styles.container)} ref={wrapperRef}>
|
|
38
|
+
<button
|
|
39
|
+
className={classNames(
|
|
40
|
+
'cds--btn',
|
|
41
|
+
'cds--btn--ghost',
|
|
42
|
+
'cds--overflow-menu__trigger',
|
|
43
|
+
{ 'cds--overflow-menu--open': showMenu },
|
|
44
|
+
styles.overflowMenuButton,
|
|
45
|
+
)}
|
|
46
|
+
aria-haspopup="true"
|
|
47
|
+
aria-expanded={showMenu}
|
|
48
|
+
id="custom-actions-overflow-menu-trigger"
|
|
49
|
+
aria-controls="custom-actions-overflow-menu"
|
|
50
|
+
onClick={toggleShowMenu}>
|
|
51
|
+
{menuTitle}
|
|
52
|
+
</button>
|
|
53
|
+
<div
|
|
54
|
+
className={classNames('cds--overflow-menu-options', 'cds--overflow-menu--flip', styles.menu, {
|
|
55
|
+
[styles.show]: showMenu,
|
|
56
|
+
})}
|
|
57
|
+
tabIndex={0}
|
|
58
|
+
data-floating-menu-direction="bottom"
|
|
59
|
+
role="menu"
|
|
60
|
+
aria-labelledby="custom-actions-overflow-menu-trigger"
|
|
61
|
+
id="custom-actions-overflow-menu">
|
|
62
|
+
<ul
|
|
63
|
+
className={classNames('cds--overflow-menu-options__content', {
|
|
64
|
+
'cds--overflow-menu-options--lg': isTablet,
|
|
65
|
+
})}>
|
|
66
|
+
{children}
|
|
67
|
+
</ul>
|
|
68
|
+
<span />
|
|
69
|
+
</div>
|
|
70
|
+
</div>
|
|
71
|
+
);
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export default OrderCustomOverflowMenuComponent;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
@use '@carbon/colors';
|
|
2
|
+
@use '@openmrs/esm-styleguide/src/vars' as vars;
|
|
3
|
+
|
|
4
|
+
.container {
|
|
5
|
+
position: relative;
|
|
6
|
+
top: 0px;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.menu {
|
|
10
|
+
display: none;
|
|
11
|
+
top: 3.125rem;
|
|
12
|
+
min-width: initial;
|
|
13
|
+
left: auto;
|
|
14
|
+
right: 0;
|
|
15
|
+
background-color: vars.$ui-01;
|
|
16
|
+
margin-right: 0.2rem;
|
|
17
|
+
box-shadow: 0 6px 6px rgb(0 0 0 / 30%);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.show {
|
|
21
|
+
display: block;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.overflowMenuButton {
|
|
25
|
+
width: auto;
|
|
26
|
+
height: auto;
|
|
27
|
+
padding: 0.875rem 1rem;
|
|
28
|
+
color: colors.$blue-60;
|
|
29
|
+
display: flex;
|
|
30
|
+
align-items: center;
|
|
31
|
+
|
|
32
|
+
&:hover {
|
|
33
|
+
background-color: colors.$gray-10-hover;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.deceased {
|
|
38
|
+
color: colors.$blue-40;
|
|
39
|
+
}
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
import { openmrsFetch, restBaseUrl } from '@openmrs/esm-framework';
|
|
2
|
+
import useSWR from 'swr';
|
|
3
|
+
|
|
4
|
+
export const trimVisitNumber = (visitNumber: string) => {
|
|
5
|
+
if (!visitNumber) {
|
|
6
|
+
return;
|
|
7
|
+
}
|
|
8
|
+
return visitNumber.substring(15);
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const formatWaitTime = (waitTime: string, t) => {
|
|
12
|
+
const num = parseInt(waitTime);
|
|
13
|
+
const hours = num / 60;
|
|
14
|
+
const rhours = Math.floor(hours);
|
|
15
|
+
const minutes = (hours - rhours) * 60;
|
|
16
|
+
const rminutes = Math.round(minutes);
|
|
17
|
+
if (rhours > 0) {
|
|
18
|
+
return rhours + ' ' + `${t('hoursAnd', 'hours and ')}` + rminutes + ' ' + `${t('minutes', 'minutes')}`;
|
|
19
|
+
} else {
|
|
20
|
+
return rminutes + ' ' + `${t('minutes', 'minutes')}`;
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export const getTagColor = (waitTime: string) => {
|
|
25
|
+
const num = parseInt(waitTime);
|
|
26
|
+
if (num <= 30) {
|
|
27
|
+
return 'green';
|
|
28
|
+
} else if (num > 30 && num <= 45) {
|
|
29
|
+
return 'orange';
|
|
30
|
+
} else {
|
|
31
|
+
return 'red';
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export const getStatusColor = (fulfillerStatus: string) => {
|
|
36
|
+
if (fulfillerStatus === 'COMPLETED') {
|
|
37
|
+
return 'green';
|
|
38
|
+
} else if (fulfillerStatus === 'IN_PROGRESS') {
|
|
39
|
+
return 'orange';
|
|
40
|
+
} else {
|
|
41
|
+
return 'red';
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
export interface PatientResource {
|
|
45
|
+
uuid: string;
|
|
46
|
+
display: string;
|
|
47
|
+
identifiers: Identifier[];
|
|
48
|
+
person: Person;
|
|
49
|
+
voided: boolean;
|
|
50
|
+
auditInfo: AuditInfo;
|
|
51
|
+
links: Link[];
|
|
52
|
+
resourceVersion: string;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface Identifier {
|
|
56
|
+
display: string;
|
|
57
|
+
uuid: string;
|
|
58
|
+
identifier: string;
|
|
59
|
+
identifierType: IdentifierType;
|
|
60
|
+
location: Location;
|
|
61
|
+
preferred: boolean;
|
|
62
|
+
voided: boolean;
|
|
63
|
+
links: Link[];
|
|
64
|
+
resourceVersion: string;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export interface IdentifierType {
|
|
68
|
+
uuid: string;
|
|
69
|
+
display: string;
|
|
70
|
+
links: Link[];
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export interface Link {
|
|
74
|
+
rel: string;
|
|
75
|
+
uri: string;
|
|
76
|
+
resourceAlias: string;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export interface Location {
|
|
80
|
+
uuid: string;
|
|
81
|
+
display: string;
|
|
82
|
+
links: Link[];
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export interface Person {
|
|
86
|
+
uuid: string;
|
|
87
|
+
display: string;
|
|
88
|
+
gender: string;
|
|
89
|
+
age: number;
|
|
90
|
+
birthdate: string;
|
|
91
|
+
birthdateEstimated: boolean;
|
|
92
|
+
dead: boolean;
|
|
93
|
+
deathDate: any;
|
|
94
|
+
causeOfDeath: any;
|
|
95
|
+
preferredName: PreferredName;
|
|
96
|
+
preferredAddress: PreferredAddress;
|
|
97
|
+
names: Name[];
|
|
98
|
+
addresses: Address[];
|
|
99
|
+
attributes: Attribute[];
|
|
100
|
+
voided: boolean;
|
|
101
|
+
auditInfo: AuditInfo;
|
|
102
|
+
birthtime: any;
|
|
103
|
+
deathdateEstimated: boolean;
|
|
104
|
+
causeOfDeathNonCoded: any;
|
|
105
|
+
links: Link[];
|
|
106
|
+
resourceVersion: string;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export interface PreferredName {
|
|
110
|
+
display: string;
|
|
111
|
+
uuid: string;
|
|
112
|
+
givenName: string;
|
|
113
|
+
middleName: string;
|
|
114
|
+
familyName: string;
|
|
115
|
+
familyName2: any;
|
|
116
|
+
voided: boolean;
|
|
117
|
+
links: Link[];
|
|
118
|
+
resourceVersion: string;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export interface PreferredAddress {
|
|
122
|
+
display: any;
|
|
123
|
+
uuid: string;
|
|
124
|
+
preferred: boolean;
|
|
125
|
+
address1: any;
|
|
126
|
+
address2: any;
|
|
127
|
+
cityVillage: any;
|
|
128
|
+
stateProvince: string;
|
|
129
|
+
country: string;
|
|
130
|
+
postalCode: any;
|
|
131
|
+
countyDistrict: string;
|
|
132
|
+
address3: string;
|
|
133
|
+
address4: string;
|
|
134
|
+
address5: string;
|
|
135
|
+
address6: any;
|
|
136
|
+
startDate: any;
|
|
137
|
+
endDate: any;
|
|
138
|
+
latitude: any;
|
|
139
|
+
longitude: any;
|
|
140
|
+
voided: boolean;
|
|
141
|
+
address7: any;
|
|
142
|
+
address8: any;
|
|
143
|
+
address9: any;
|
|
144
|
+
address10: any;
|
|
145
|
+
address11: any;
|
|
146
|
+
address12: any;
|
|
147
|
+
address13: any;
|
|
148
|
+
address14: any;
|
|
149
|
+
address15: any;
|
|
150
|
+
links: Link[];
|
|
151
|
+
resourceVersion: string;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export interface Name {
|
|
155
|
+
display: string;
|
|
156
|
+
uuid: string;
|
|
157
|
+
givenName: string;
|
|
158
|
+
middleName: string;
|
|
159
|
+
familyName: string;
|
|
160
|
+
familyName2: any;
|
|
161
|
+
voided: boolean;
|
|
162
|
+
links: Link[];
|
|
163
|
+
resourceVersion: string;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
export interface Address {
|
|
167
|
+
display: any;
|
|
168
|
+
uuid: string;
|
|
169
|
+
preferred: boolean;
|
|
170
|
+
address1: any;
|
|
171
|
+
address2: any;
|
|
172
|
+
cityVillage: any;
|
|
173
|
+
stateProvince: string;
|
|
174
|
+
country: string;
|
|
175
|
+
postalCode: any;
|
|
176
|
+
countyDistrict: string;
|
|
177
|
+
address3: string;
|
|
178
|
+
address4: string;
|
|
179
|
+
address5: string;
|
|
180
|
+
address6: any;
|
|
181
|
+
startDate: any;
|
|
182
|
+
endDate: any;
|
|
183
|
+
latitude: any;
|
|
184
|
+
longitude: any;
|
|
185
|
+
voided: boolean;
|
|
186
|
+
address7: any;
|
|
187
|
+
address8: any;
|
|
188
|
+
address9: any;
|
|
189
|
+
address10: any;
|
|
190
|
+
address11: any;
|
|
191
|
+
address12: any;
|
|
192
|
+
address13: any;
|
|
193
|
+
address14: any;
|
|
194
|
+
address15: any;
|
|
195
|
+
links: Link[];
|
|
196
|
+
resourceVersion: string;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
export interface Attribute {
|
|
200
|
+
display: string;
|
|
201
|
+
uuid: string;
|
|
202
|
+
value: string;
|
|
203
|
+
attributeType: AttributeType;
|
|
204
|
+
voided: boolean;
|
|
205
|
+
links: Link[];
|
|
206
|
+
resourceVersion: string;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
export interface AttributeType {
|
|
210
|
+
uuid: string;
|
|
211
|
+
display: string;
|
|
212
|
+
links: Link[];
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
export interface AuditInfo {
|
|
216
|
+
creator: Creator;
|
|
217
|
+
dateCreated: string;
|
|
218
|
+
changedBy: any;
|
|
219
|
+
dateChanged: any;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
export interface Creator {
|
|
223
|
+
uuid: string;
|
|
224
|
+
display: string;
|
|
225
|
+
links: Link[];
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
export function useGetPatientByUuid(uuid: string) {
|
|
229
|
+
const apiUrl = `${restBaseUrl}/patient/${uuid}?v=full`;
|
|
230
|
+
const { data, error, isLoading } = useSWR<{ data: PatientResource }, Error>(apiUrl, openmrsFetch);
|
|
231
|
+
return {
|
|
232
|
+
patient: data?.data,
|
|
233
|
+
isLoading,
|
|
234
|
+
isError: error,
|
|
235
|
+
};
|
|
236
|
+
}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import React, { useState, useMemo } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
DataTable,
|
|
4
|
+
Pagination,
|
|
5
|
+
Table,
|
|
6
|
+
TableBody,
|
|
7
|
+
TableCell,
|
|
8
|
+
TableContainer,
|
|
9
|
+
TableHead,
|
|
10
|
+
TableHeader,
|
|
11
|
+
TableRow,
|
|
12
|
+
Tile,
|
|
13
|
+
TableToolbar,
|
|
14
|
+
TableToolbarContent,
|
|
15
|
+
Layer,
|
|
16
|
+
TableToolbarSearch,
|
|
17
|
+
Dropdown,
|
|
18
|
+
DatePicker,
|
|
19
|
+
DatePickerInput,
|
|
20
|
+
} from '@carbon/react';
|
|
21
|
+
import styles from './orders-data-table.scss';
|
|
22
|
+
import { useTranslation } from 'react-i18next';
|
|
23
|
+
|
|
24
|
+
interface OrdersDataTableProps {
|
|
25
|
+
tabTitle: string;
|
|
26
|
+
currentPage: number;
|
|
27
|
+
currentPageSize: number;
|
|
28
|
+
pageSizes: number[];
|
|
29
|
+
totalItems: number;
|
|
30
|
+
setPageSize: (page: number) => void;
|
|
31
|
+
goTo: (page: number) => void;
|
|
32
|
+
orders: Array<Record<string, any>>;
|
|
33
|
+
rows: Array<Record<string, any>>;
|
|
34
|
+
columns: Array<Record<string, any>>;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const OrdersDataTable: React.FC<OrdersDataTableProps> = ({
|
|
38
|
+
tabTitle,
|
|
39
|
+
currentPage,
|
|
40
|
+
currentPageSize,
|
|
41
|
+
pageSizes,
|
|
42
|
+
totalItems,
|
|
43
|
+
setPageSize,
|
|
44
|
+
goTo,
|
|
45
|
+
rows,
|
|
46
|
+
columns,
|
|
47
|
+
}) => {
|
|
48
|
+
const { t } = useTranslation();
|
|
49
|
+
|
|
50
|
+
const [activatedOnOrAfterDate, setActivatedOnOrAfterDate] = useState('');
|
|
51
|
+
|
|
52
|
+
return (
|
|
53
|
+
<DataTable rows={rows} headers={columns} useZebraStyles>
|
|
54
|
+
{({ rows, headers, getHeaderProps, getTableProps, getRowProps }) => (
|
|
55
|
+
<TableContainer className={styles.tableContainer}>
|
|
56
|
+
<TableToolbar style={{ position: 'static' }}>
|
|
57
|
+
<TableToolbarContent>
|
|
58
|
+
<Layer style={{ margin: '5px' }}>
|
|
59
|
+
<DatePicker dateFormat="Y-m-d" datePickerType="single">
|
|
60
|
+
<DatePickerInput
|
|
61
|
+
labelText={''}
|
|
62
|
+
id="activatedOnOrAfterDate"
|
|
63
|
+
placeholder="YYYY-MM-DD"
|
|
64
|
+
onChange={(event) => {
|
|
65
|
+
setActivatedOnOrAfterDate(event?.target?.value);
|
|
66
|
+
}}
|
|
67
|
+
type="date"
|
|
68
|
+
value={activatedOnOrAfterDate}
|
|
69
|
+
/>
|
|
70
|
+
</DatePicker>
|
|
71
|
+
</Layer>
|
|
72
|
+
<Layer style={{ margin: '5px' }}>
|
|
73
|
+
<TableToolbarSearch persistent placeholder={t('searchThisList', 'Search this list')} size="sm" />
|
|
74
|
+
</Layer>
|
|
75
|
+
</TableToolbarContent>
|
|
76
|
+
</TableToolbar>
|
|
77
|
+
<Table {...getTableProps()} className={styles.activePatientsTable}>
|
|
78
|
+
<TableHead>
|
|
79
|
+
<TableRow>
|
|
80
|
+
{headers.map((header) => (
|
|
81
|
+
<TableHeader {...getHeaderProps({ header })}>{header.header?.content ?? header.header}</TableHeader>
|
|
82
|
+
))}
|
|
83
|
+
</TableRow>
|
|
84
|
+
</TableHead>
|
|
85
|
+
<TableBody>
|
|
86
|
+
{rows.map((row) => (
|
|
87
|
+
<React.Fragment key={row.id}>
|
|
88
|
+
<TableRow {...getRowProps({ row })} key={row.id}>
|
|
89
|
+
{row.cells.map((cell) => (
|
|
90
|
+
<TableCell key={cell.id}>{cell.value?.content ?? cell.value}</TableCell>
|
|
91
|
+
))}
|
|
92
|
+
</TableRow>
|
|
93
|
+
</React.Fragment>
|
|
94
|
+
))}
|
|
95
|
+
</TableBody>
|
|
96
|
+
</Table>
|
|
97
|
+
{rows.length === 0 ? (
|
|
98
|
+
<div className={styles.tileContainer}>
|
|
99
|
+
<Tile className={styles.tile}>
|
|
100
|
+
<div className={styles.tileContent}>
|
|
101
|
+
<p className={styles.content}>{t('noOrdersList', `No ${tabTitle} orders to display`)}</p>
|
|
102
|
+
</div>
|
|
103
|
+
</Tile>
|
|
104
|
+
</div>
|
|
105
|
+
) : null}
|
|
106
|
+
<Pagination
|
|
107
|
+
forwardText="Next page"
|
|
108
|
+
backwardText="Previous page"
|
|
109
|
+
page={currentPage}
|
|
110
|
+
pageSize={currentPageSize}
|
|
111
|
+
pageSizes={pageSizes}
|
|
112
|
+
totalItems={totalItems}
|
|
113
|
+
className={styles.pagination}
|
|
114
|
+
onChange={({ pageSize, page }) => {
|
|
115
|
+
if (pageSize !== currentPageSize) {
|
|
116
|
+
setPageSize(pageSize);
|
|
117
|
+
}
|
|
118
|
+
if (page !== currentPage) {
|
|
119
|
+
goTo(page);
|
|
120
|
+
}
|
|
121
|
+
}}
|
|
122
|
+
/>
|
|
123
|
+
</TableContainer>
|
|
124
|
+
)}
|
|
125
|
+
</DataTable>
|
|
126
|
+
);
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
export default OrdersDataTable;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
@use '@carbon/styles/scss/spacing';
|
|
2
|
+
@use '@carbon/styles/scss/type';
|
|
3
|
+
@use '@openmrs/esm-styleguide/src/vars' as vars;
|
|
4
|
+
@import '../../root.scss';
|
|
5
|
+
|
|
6
|
+
.tableContainer {
|
|
7
|
+
background-color: vars.$ui-01;
|
|
8
|
+
margin: 0 spacing.$spacing-05;
|
|
9
|
+
padding: 0;
|
|
10
|
+
|
|
11
|
+
a {
|
|
12
|
+
text-decoration: none;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
th {
|
|
16
|
+
color: vars.$text-02;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
:global(.cds--data-table) {
|
|
20
|
+
background-color: vars.$ui-03;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.toolbarContent {
|
|
24
|
+
height: spacing.$spacing-07;
|
|
25
|
+
margin-bottom: spacing.$spacing-02;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.tileContainer {
|
|
30
|
+
background-color: vars.$ui-02;
|
|
31
|
+
border-top: 1px solid vars.$ui-03;
|
|
32
|
+
padding: 5rem 0;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.tile {
|
|
36
|
+
margin: auto;
|
|
37
|
+
width: fit-content;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.tileContent {
|
|
41
|
+
display: flex;
|
|
42
|
+
flex-direction: column;
|
|
43
|
+
align-items: center;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.content {
|
|
47
|
+
@include type.type-style('heading-compact-02');
|
|
48
|
+
color: vars.$text-02;
|
|
49
|
+
margin-bottom: 0.5rem;
|
|
50
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React, { useState, useMemo, useCallback } from 'react';
|
|
2
|
+
import { useTranslation } from 'react-i18next';
|
|
3
|
+
import styles from './work-list.scss';
|
|
4
|
+
import Overlay from '../components/overlay/overlay.component';
|
|
5
|
+
import { useOrdersWorklist } from '../hooks/useOrdersWorklist';
|
|
6
|
+
import GroupedOrdersTable from '../shared/ui/common/grouped-orders-table.component';
|
|
7
|
+
import { DataTableSkeleton } from '@carbon/react';
|
|
8
|
+
import { type WorklistProps } from '../types';
|
|
9
|
+
|
|
10
|
+
const WorkList: React.FC<WorklistProps> = ({ fulfillerStatus }) => {
|
|
11
|
+
const { t } = useTranslation();
|
|
12
|
+
|
|
13
|
+
const { workListEntries, isLoading } = useOrdersWorklist('', fulfillerStatus);
|
|
14
|
+
|
|
15
|
+
if (isLoading) {
|
|
16
|
+
return <DataTableSkeleton role="progressbar" />;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<>
|
|
21
|
+
<div>
|
|
22
|
+
<div className={styles.headerBtnContainer}></div>
|
|
23
|
+
<GroupedOrdersTable
|
|
24
|
+
orders={workListEntries}
|
|
25
|
+
showActions={true}
|
|
26
|
+
showStatus={true}
|
|
27
|
+
showOrderType={true}
|
|
28
|
+
showStartButton={false}
|
|
29
|
+
title={t('workList', 'Work List')}
|
|
30
|
+
actions={[{ actionName: 'postProcedureResultForm' }, { actionName: 'reject-procedure-order-dialog' }]}
|
|
31
|
+
/>
|
|
32
|
+
</div>
|
|
33
|
+
<Overlay />
|
|
34
|
+
</>
|
|
35
|
+
);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export default WorkList;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { openmrsFetch, useConfig } from '@openmrs/esm-framework';
|
|
2
|
+
import useSWR from 'swr';
|
|
3
|
+
import { type ConfigObject } from '../config-schema';
|
|
4
|
+
import { type Result } from '../types';
|
|
5
|
+
|
|
6
|
+
export function useGetOrdersWorklist(activatedOnOrAfterDate: string, fulfillerStatus: string) {
|
|
7
|
+
const config = useConfig() as ConfigObject;
|
|
8
|
+
|
|
9
|
+
const apiUrl = `/ws/rest/v1/order?orderTypes=${config.testOrderTypeUuid}&activatedOnOrAfterDate=${activatedOnOrAfterDate}&isStopped=false&fulfillerStatus=${fulfillerStatus}&v=full`;
|
|
10
|
+
|
|
11
|
+
const { data, error, isLoading } = useSWR<{ data: { results: Array<Result> } }, Error>(apiUrl, openmrsFetch);
|
|
12
|
+
|
|
13
|
+
const orders = data?.data?.results?.filter((order) => {
|
|
14
|
+
if (fulfillerStatus === '') {
|
|
15
|
+
return order.fulfillerStatus === null && order.dateStopped === null && order.action === 'NEW';
|
|
16
|
+
} else if (fulfillerStatus === 'IN_PROGRESS') {
|
|
17
|
+
return order.fulfillerStatus === 'IN_PROGRESS' && order.dateStopped === null && order.action !== 'DISCONTINUE';
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
return {
|
|
22
|
+
workListEntries: orders?.length > 0 ? orders : [],
|
|
23
|
+
isLoading,
|
|
24
|
+
isError: error,
|
|
25
|
+
};
|
|
26
|
+
}
|