@digihmis/esm-administration-app 1.0.0
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/README.md +4 -0
- package/dist/101.js +1 -0
- package/dist/101.js.map +1 -0
- package/dist/117.js +1 -0
- package/dist/117.js.map +1 -0
- package/dist/132.js +1 -0
- package/dist/132.js.map +1 -0
- package/dist/15.js +1 -0
- package/dist/15.js.map +1 -0
- package/dist/152.js +1 -0
- package/dist/152.js.map +1 -0
- package/dist/153.js +1 -0
- package/dist/153.js.map +1 -0
- package/dist/190.js +1 -0
- package/dist/190.js.map +1 -0
- package/dist/209.js +1 -0
- package/dist/209.js.map +1 -0
- package/dist/266.js +1 -0
- package/dist/266.js.map +1 -0
- package/dist/317.js +1 -0
- package/dist/317.js.map +1 -0
- package/dist/349.js +1 -0
- package/dist/349.js.map +1 -0
- package/dist/371.js +1 -0
- package/dist/371.js.map +1 -0
- package/dist/378.js +1 -0
- package/dist/378.js.map +1 -0
- package/dist/394.js +1 -0
- package/dist/394.js.map +1 -0
- package/dist/442.js +1 -0
- package/dist/442.js.map +1 -0
- package/dist/45.js +1 -0
- package/dist/45.js.map +1 -0
- package/dist/454.js +1 -0
- package/dist/454.js.map +1 -0
- package/dist/466.js +1 -0
- package/dist/466.js.map +1 -0
- package/dist/482.js +1 -0
- package/dist/482.js.map +1 -0
- package/dist/501.js +1 -0
- package/dist/501.js.map +1 -0
- package/dist/508.js +1 -0
- package/dist/508.js.map +1 -0
- package/dist/578.js +1 -0
- package/dist/578.js.map +1 -0
- package/dist/598.js +1 -0
- package/dist/598.js.map +1 -0
- package/dist/606.js +1 -0
- package/dist/606.js.map +1 -0
- package/dist/61.js +1 -0
- package/dist/61.js.map +1 -0
- package/dist/640.js +1 -0
- package/dist/640.js.map +1 -0
- package/dist/685.js +1 -0
- package/dist/685.js.map +1 -0
- package/dist/689.js +1 -0
- package/dist/689.js.map +1 -0
- package/dist/709.js +1 -0
- package/dist/709.js.map +1 -0
- package/dist/712.js +1 -0
- package/dist/712.js.map +1 -0
- package/dist/720.js +1 -0
- package/dist/720.js.map +1 -0
- package/dist/737.js +12 -0
- package/dist/737.js.map +1 -0
- package/dist/742.js +1 -0
- package/dist/742.js.map +1 -0
- package/dist/747.js +1 -0
- package/dist/747.js.map +1 -0
- package/dist/771.js +1 -0
- package/dist/771.js.map +1 -0
- package/dist/806.js +1 -0
- package/dist/806.js.map +1 -0
- package/dist/912.js +1 -0
- package/dist/912.js.map +1 -0
- package/dist/913.js +1 -0
- package/dist/913.js.map +1 -0
- package/dist/916.js +15 -0
- package/dist/916.js.map +1 -0
- package/dist/940.js +1 -0
- package/dist/940.js.map +1 -0
- package/dist/digihmis-esm-administration-app.js +6 -0
- package/dist/digihmis-esm-administration-app.js.buildmanifest.json +1100 -0
- package/dist/digihmis-esm-administration-app.js.map +1 -0
- package/dist/main.js +17 -0
- package/dist/main.js.map +1 -0
- package/dist/routes.json +1 -0
- package/increment-version.js +17 -0
- package/jest.config.js +26 -0
- package/package.json +51 -0
- package/release-version.js +16 -0
- package/rspack.config.js +1 -0
- package/src/bed-management/bed-management.component.tsx +19 -0
- package/src/bed-management/bed-management.scss +0 -0
- package/src/billing-management/billing-charge-items/billing-charge-items-modal/billing-charge-items.modal.tsx +79 -0
- package/src/billing-management/billing-charge-items/billing-charge-items-modal/billing-charge-items.resource.ts +11 -0
- package/src/billing-management/billing-charge-items/billing-charge-items-workspace/billing-charge-item.workspace.tsx +212 -0
- package/src/billing-management/billing-charge-items/billing-charge-items-workspace/billing-charge-items.resource.ts +51 -0
- package/src/billing-management/billing-charge-items/billing-charge-items-workspace/billing-charge-service.workspace.tsx +296 -0
- package/src/billing-management/billing-charge-items/billing-charge-items-workspace/components/concept-search.component.tsx +67 -0
- package/src/billing-management/billing-charge-items/billing-charge-items-workspace/components/price.component.tsx +81 -0
- package/src/billing-management/billing-charge-items/billing-charge-items-workspace/components/stock-search.component.tsx +107 -0
- package/src/billing-management/billing-charge-items/billing-charge-items-workspace/global/billing-charge-commodity.scss +61 -0
- package/src/billing-management/billing-charge-items/billing-charge-items-workspace/global/billing-charge-items.scss +59 -0
- package/src/billing-management/billing-charge-items/billing-charge-items-workspace/schemas/form-schemas.ts +33 -0
- package/src/billing-management/billing-charge-items/billing-charge-items.component.tsx +222 -0
- package/src/billing-management/billing-charge-items/billing-charge-items.resource.ts +20 -0
- package/src/billing-management/billing-charge-items/billing-charge-items.scss +84 -0
- package/src/billing-management/billing-charge-items/type/index.ts +88 -0
- package/src/billing-management/billing-charge-items/utils/index.ts +96 -0
- package/src/billing-management/billing-management.component.tsx +21 -0
- package/src/billing-management/billing-management.scss +0 -0
- package/src/billing-management/billing-payment-modes/billing-payment-modes-modal/billing-delete-payment-modes.modal.scss +28 -0
- package/src/billing-management/billing-payment-modes/billing-payment-modes-modal/billing-delete-payment-modes.modal.tsx +67 -0
- package/src/billing-management/billing-payment-modes/billing-payment-modes-modal/delete-payment-mode.test.tsx +56 -0
- package/src/billing-management/billing-payment-modes/billing-payment-modes-workspace/billing-payment-modes-form-schema.ts +52 -0
- package/src/billing-management/billing-payment-modes/billing-payment-modes-workspace/billing-payment-modes.resource.ts +35 -0
- package/src/billing-management/billing-payment-modes/billing-payment-modes-workspace/billing-payment-modes.workspace.scss +33 -0
- package/src/billing-management/billing-payment-modes/billing-payment-modes-workspace/billing-payment-modes.workspace.test.tsx +239 -0
- package/src/billing-management/billing-payment-modes/billing-payment-modes-workspace/billing-payment-modes.workspace.tsx +218 -0
- package/src/billing-management/billing-payment-modes/billing-payment-modes-workspace/payment-attributes/payment-mode-attributes.component.tsx +156 -0
- package/src/billing-management/billing-payment-modes/billing-payment-modes-workspace/payment-attributes/payment-mode-attributes.scss +10 -0
- package/src/billing-management/billing-payment-modes/billing-payment-modes.component.tsx +243 -0
- package/src/billing-management/billing-payment-modes/billing-payment-modes.resource.ts +23 -0
- package/src/billing-management/billing-payment-modes/billing-payment-modes.scss +140 -0
- package/src/billing-management/billing-payment-modes/type/index.ts +42 -0
- package/src/billing-management/billing-payment-points/billing-payment-point-modal/billing-delete-payment-modes.modal.scss +28 -0
- package/src/billing-management/billing-payment-points/billing-payment-point-modal/billing-delete-payment-point.modal.tsx +72 -0
- package/src/billing-management/billing-payment-points/billing-payment-point-modal/delete-payment-point.test.tsx +56 -0
- package/src/billing-management/billing-payment-points/billing-payment-point.component.tsx +202 -0
- package/src/billing-management/billing-payment-points/billing-payment-point.resource.ts +16 -0
- package/src/billing-management/billing-payment-points/billing-payment-point.scss +0 -0
- package/src/billing-management/billing-payment-points/billing-payment-points-workspace/billing-payment-point.resource.ts +39 -0
- package/src/billing-management/billing-payment-points/billing-payment-points-workspace/billing-payment-point.workspace.scss +33 -0
- package/src/billing-management/billing-payment-points/billing-payment-points-workspace/billing-payment-points.workspace.tsx +194 -0
- package/src/billing-management/billing-payment-points/type/index.ts +35 -0
- package/src/billing-management/billing-tabs/billing-tabs.component.scss +15 -0
- package/src/billing-management/billing-tabs/billing-tabs.component.tsx +36 -0
- package/src/components/custom-icon-wrapper/custom-icon-wrapper.component.tsx +17 -0
- package/src/components/custom-page-header/custom-page-header.component.tsx +38 -0
- package/src/components/custom-page-header/custom-page-header.scss +76 -0
- package/src/config-schema.ts +142 -0
- package/src/constant/index.ts +1 -0
- package/src/dashboard.meta.ts +47 -0
- package/src/declarations.d.ts +6 -0
- package/src/form-builder/form-builder.component.tsx +19 -0
- package/src/form-builder/form-builder.scss +0 -0
- package/src/hooks/useConcept.ts +13 -0
- package/src/hooks/useQueues.ts +22 -0
- package/src/hooks/useSystemSetting.ts +18 -0
- package/src/index.ts +133 -0
- package/src/left-panel/left-panel.component.tsx +49 -0
- package/src/left-panel/left-panel.scss +13 -0
- package/src/location-management/components/auto-suggest/autosuggest.component.tsx +149 -0
- package/src/location-management/components/auto-suggest/autosuggest.scss +61 -0
- package/src/location-management/components/auto-suggest/location-autosuggest.component.tsx +97 -0
- package/src/location-management/components/auto-suggest/location-autosuggest.scss +48 -0
- package/src/location-management/components/custom-results-tile/results-tile.component.tsx +43 -0
- package/src/location-management/components/custom-results-tile/results-tile.scss +86 -0
- package/src/location-management/forms/add-location/add-location.workspace.scss +71 -0
- package/src/location-management/forms/add-location/add-location.workspace.tsx +199 -0
- package/src/location-management/forms/search-location/search-location.workspace.scss +71 -0
- package/src/location-management/forms/search-location/search-location.workspace.tsx +214 -0
- package/src/location-management/helpers/index.ts +33 -0
- package/src/location-management/hooks/UseFacilityLocations.ts +12 -0
- package/src/location-management/hooks/useLocation.ts +18 -0
- package/src/location-management/hooks/useLocationTags.ts +15 -0
- package/src/location-management/location-management-dashboard.component.tsx +21 -0
- package/src/location-management/location-management-dashboard.scss +3 -0
- package/src/location-management/tables/locations-table.component.tsx +242 -0
- package/src/location-management/tables/locations-table.resource.ts +26 -0
- package/src/location-management/tables/locations-table.scss +114 -0
- package/src/location-management/types/index.ts +120 -0
- package/src/queue-management/queue-management-dashboard.component.tsx +23 -0
- package/src/queue-management/queue-management-dashboard.scss +8 -0
- package/src/queue-management/queue-management-table/queue-management-table.component.tsx +296 -0
- package/src/queue-management/queue-management-table/queue-management-table.scss +78 -0
- package/src/queue-management/queue-management-table/queue-management.resource.ts +39 -0
- package/src/queue-management/queue-management-workspace/queue-room/queue-room-form.scss +56 -0
- package/src/queue-management/queue-management-workspace/queue-room/queue-room-form.test.tsx +82 -0
- package/src/queue-management/queue-management-workspace/queue-room/queue-room-form.workspace.tsx +169 -0
- package/src/queue-management/queue-management-workspace/queue-room/queue-room.resource.ts +20 -0
- package/src/queue-management/queue-management-workspace/queue-service/queue-service-form.scss +61 -0
- package/src/queue-management/queue-management-workspace/queue-service/queue-service-form.test.tsx +127 -0
- package/src/queue-management/queue-management-workspace/queue-service/queue-service-form.workspace.tsx +178 -0
- package/src/queue-management/queue-management-workspace/queue-service/queue-service.resource.ts +55 -0
- package/src/queue-management/queue-types/index.ts +33 -0
- package/src/routes.json +157 -0
- package/src/setup-tests.ts +1 -0
- package/src/system-info/system-info.component.tsx +338 -0
- package/src/system-info/system-info.resource.ts +40 -0
- package/src/system-info/system-info.scss +622 -0
- package/src/type/index.ts +6 -0
- package/translations/am.json +111 -0
- package/translations/ar.json +115 -0
- package/translations/en.json +111 -0
- package/translations/es.json +112 -0
- package/translations/fr.json +112 -0
- package/translations/he.json +112 -0
- package/translations/km.json +110 -0
- package/translations/pt.json +112 -0
- package/translations/sw.json +111 -0
- package/translations/vi.json +110 -0
- package/translations/zh.json +110 -0
- package/tsconfig.json +5 -0
- package/version.js +27 -0
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
import React, { useMemo, useState } from 'react';
|
|
2
|
+
import { useTranslation } from 'react-i18next';
|
|
3
|
+
import {
|
|
4
|
+
Button,
|
|
5
|
+
DataTable,
|
|
6
|
+
DataTableSkeleton,
|
|
7
|
+
InlineLoading,
|
|
8
|
+
Pagination,
|
|
9
|
+
Search,
|
|
10
|
+
Table,
|
|
11
|
+
TableBody,
|
|
12
|
+
TableCell,
|
|
13
|
+
TableContainer,
|
|
14
|
+
TableHead,
|
|
15
|
+
TableHeader,
|
|
16
|
+
TableRow,
|
|
17
|
+
Tile,
|
|
18
|
+
Tag,
|
|
19
|
+
} from '@carbon/react';
|
|
20
|
+
import { Add } from '@carbon/react/icons';
|
|
21
|
+
import { isDesktop as desktopLayout, launchWorkspace, useLayoutType } from '@openmrs/esm-framework';
|
|
22
|
+
import styles from './locations-table.scss';
|
|
23
|
+
import { CardHeader } from '@openmrs/esm-patient-common-lib';
|
|
24
|
+
import { useFacilitiesTagged } from './locations-table.resource';
|
|
25
|
+
import { useLocationTags } from '../hooks/useLocationTags';
|
|
26
|
+
|
|
27
|
+
const LocationsTable: React.FC = () => {
|
|
28
|
+
const { t } = useTranslation();
|
|
29
|
+
const layout = useLayoutType();
|
|
30
|
+
const isTablet = layout === 'tablet';
|
|
31
|
+
const isDesktop = desktopLayout(layout);
|
|
32
|
+
const [pageSize, setPageSize] = useState(10);
|
|
33
|
+
const [searchTerm, setSearchTerm] = useState('');
|
|
34
|
+
const [currentPage, setCurrentPage] = useState(1);
|
|
35
|
+
|
|
36
|
+
const { locationTagList, isLoading: tagsLoading } = useLocationTags();
|
|
37
|
+
const { facilityList, isLoading: taggedLoading } = useFacilitiesTagged({ results: locationTagList });
|
|
38
|
+
|
|
39
|
+
const handleAddLocationWorkspace = () => {
|
|
40
|
+
launchWorkspace('add-location-workspace', {
|
|
41
|
+
workspaceTitle: t('addLocation', 'Add Location'),
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const handleSearchLocationWorkspace = () => {
|
|
46
|
+
launchWorkspace('search-location-workspace', {
|
|
47
|
+
workspaceTitle: t('tagLocation', 'Tag Location'),
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const tableHeaders = [
|
|
52
|
+
{
|
|
53
|
+
key: 'name',
|
|
54
|
+
header: t('locationName', 'Location Name'),
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
key: 'description',
|
|
58
|
+
header: t('description', 'Description'),
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
key: 'tags',
|
|
62
|
+
header: t('tags', 'Tags'),
|
|
63
|
+
},
|
|
64
|
+
];
|
|
65
|
+
|
|
66
|
+
const getLocationTags = (resource) => {
|
|
67
|
+
if (!resource?.meta?.tag) {
|
|
68
|
+
return [];
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return resource.meta.tag.filter((tag) => tag.system && tag.system.includes('location-tag')).map((tag) => tag.code);
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
const rows = useMemo(() => {
|
|
75
|
+
const uniqueFacilities = new Map();
|
|
76
|
+
|
|
77
|
+
facilityList.forEach((facility) => {
|
|
78
|
+
const resource = facility.resource;
|
|
79
|
+
const uuid = resource?.id;
|
|
80
|
+
|
|
81
|
+
if (uuid && !uniqueFacilities.has(uuid)) {
|
|
82
|
+
uniqueFacilities.set(uuid, facility);
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
return Array.from(uniqueFacilities.values()).map((facility) => {
|
|
87
|
+
const resource = facility.resource;
|
|
88
|
+
const tags = getLocationTags(resource);
|
|
89
|
+
|
|
90
|
+
return {
|
|
91
|
+
id: resource?.id,
|
|
92
|
+
name: resource?.name || resource?.partOf?.display || '--',
|
|
93
|
+
description: resource?.description || '--',
|
|
94
|
+
tags: tags.length > 0 ? tags.join(', ') : '--',
|
|
95
|
+
};
|
|
96
|
+
});
|
|
97
|
+
}, [facilityList]);
|
|
98
|
+
|
|
99
|
+
const filteredRows = useMemo(() => {
|
|
100
|
+
if (!searchTerm) {
|
|
101
|
+
return rows;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
return rows.filter(
|
|
105
|
+
(row) =>
|
|
106
|
+
row.name.toLowerCase().includes(searchTerm.toLowerCase()) ||
|
|
107
|
+
row.description.toLowerCase().includes(searchTerm.toLowerCase()) ||
|
|
108
|
+
row.tags.toLowerCase().includes(searchTerm.toLowerCase()),
|
|
109
|
+
);
|
|
110
|
+
}, [rows, searchTerm]);
|
|
111
|
+
|
|
112
|
+
const paginatedRows = useMemo(() => {
|
|
113
|
+
const startIndex = (currentPage - 1) * pageSize;
|
|
114
|
+
const endIndex = startIndex + pageSize;
|
|
115
|
+
return filteredRows.slice(startIndex, endIndex);
|
|
116
|
+
}, [filteredRows, currentPage, pageSize]);
|
|
117
|
+
|
|
118
|
+
if (tagsLoading || (taggedLoading && !facilityList.length)) {
|
|
119
|
+
return (
|
|
120
|
+
<>
|
|
121
|
+
<div className={styles.widgetCard}>
|
|
122
|
+
<DataTableSkeleton role="progressbar" compact={isDesktop} zebra />
|
|
123
|
+
</div>
|
|
124
|
+
</>
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
return (
|
|
129
|
+
<>
|
|
130
|
+
<div className={styles.widgetCard}>
|
|
131
|
+
<CardHeader title={t('locations', 'Locations')}>
|
|
132
|
+
<span className={styles.backgroundDataFetchingIndicator}>
|
|
133
|
+
<span>{tagsLoading ? <InlineLoading /> : null}</span>
|
|
134
|
+
</span>
|
|
135
|
+
<div className={styles.headerActions}>
|
|
136
|
+
<>
|
|
137
|
+
<div className={styles.filterContainer}>
|
|
138
|
+
<Search
|
|
139
|
+
onChange={(e) => {
|
|
140
|
+
setSearchTerm(e.target.value);
|
|
141
|
+
setCurrentPage(1);
|
|
142
|
+
}}
|
|
143
|
+
placeholder={t('search', 'Search location')}
|
|
144
|
+
value={searchTerm}
|
|
145
|
+
labelText={t('search', 'Search location')}
|
|
146
|
+
/>
|
|
147
|
+
</div>
|
|
148
|
+
<Button
|
|
149
|
+
kind="ghost"
|
|
150
|
+
renderIcon={(props) => <Add size={16} {...props} />}
|
|
151
|
+
onClick={handleAddLocationWorkspace}>
|
|
152
|
+
{t('addLocation', 'Add Location')}
|
|
153
|
+
</Button>
|
|
154
|
+
<Button
|
|
155
|
+
kind="ghost"
|
|
156
|
+
renderIcon={(props) => <Add size={16} {...props} />}
|
|
157
|
+
onClick={handleSearchLocationWorkspace}>
|
|
158
|
+
{t('tagLocation', 'Tag Location')}
|
|
159
|
+
</Button>
|
|
160
|
+
</>
|
|
161
|
+
</div>
|
|
162
|
+
</CardHeader>
|
|
163
|
+
|
|
164
|
+
<DataTable rows={paginatedRows} headers={tableHeaders} isSortable size={isTablet ? 'lg' : 'sm'} useZebraStyles>
|
|
165
|
+
{({ rows, headers, getTableProps }) => {
|
|
166
|
+
return (
|
|
167
|
+
<TableContainer>
|
|
168
|
+
<Table {...getTableProps()}>
|
|
169
|
+
<TableHead>
|
|
170
|
+
<TableRow>
|
|
171
|
+
{headers.map((header) => (
|
|
172
|
+
<TableHeader key={header.key}>{header.header}</TableHeader>
|
|
173
|
+
))}
|
|
174
|
+
</TableRow>
|
|
175
|
+
</TableHead>
|
|
176
|
+
<TableBody>
|
|
177
|
+
{rows.map((row) => (
|
|
178
|
+
<TableRow key={row.id}>
|
|
179
|
+
{row.cells.map((cell) => (
|
|
180
|
+
<TableCell key={cell.id}>
|
|
181
|
+
{cell.id.includes('tags') && cell.value !== 'No tags' ? (
|
|
182
|
+
<div style={{ display: 'flex', flexWrap: 'wrap', gap: '4px' }}>
|
|
183
|
+
{cell.value.split(', ').map((tag, index) => (
|
|
184
|
+
<Tag key={index} type="blue" size="sm">
|
|
185
|
+
{tag}
|
|
186
|
+
</Tag>
|
|
187
|
+
))}
|
|
188
|
+
</div>
|
|
189
|
+
) : (
|
|
190
|
+
cell.value
|
|
191
|
+
)}
|
|
192
|
+
</TableCell>
|
|
193
|
+
))}
|
|
194
|
+
</TableRow>
|
|
195
|
+
))}
|
|
196
|
+
</TableBody>
|
|
197
|
+
</Table>
|
|
198
|
+
{rows.length === 0 ? (
|
|
199
|
+
<div className={styles.tileContainer}>
|
|
200
|
+
<Tile className={styles.tile}>
|
|
201
|
+
<div className={styles.tileContent}>
|
|
202
|
+
<p className={styles.content}>
|
|
203
|
+
{searchTerm
|
|
204
|
+
? t('noSearchResults', `No results found for "${searchTerm}"`)
|
|
205
|
+
: t('noData', 'No data to display')}
|
|
206
|
+
</p>
|
|
207
|
+
<p className={styles.helper}>
|
|
208
|
+
{searchTerm
|
|
209
|
+
? t('tryDifferentSearch', 'Try a different search term')
|
|
210
|
+
: t('checkFilters', 'Check the filters above')}
|
|
211
|
+
</p>
|
|
212
|
+
</div>
|
|
213
|
+
</Tile>
|
|
214
|
+
</div>
|
|
215
|
+
) : null}
|
|
216
|
+
<Pagination
|
|
217
|
+
backwardText="Previous page"
|
|
218
|
+
forwardText="Next page"
|
|
219
|
+
page={currentPage}
|
|
220
|
+
pageSize={pageSize}
|
|
221
|
+
pageSizes={[10, 20, 30, 40, 50]}
|
|
222
|
+
totalItems={filteredRows.length}
|
|
223
|
+
onChange={({ pageSize: newPageSize, page }) => {
|
|
224
|
+
if (newPageSize !== pageSize) {
|
|
225
|
+
setPageSize(newPageSize);
|
|
226
|
+
setCurrentPage(1);
|
|
227
|
+
}
|
|
228
|
+
if (page !== currentPage) {
|
|
229
|
+
setCurrentPage(page);
|
|
230
|
+
}
|
|
231
|
+
}}
|
|
232
|
+
/>
|
|
233
|
+
</TableContainer>
|
|
234
|
+
);
|
|
235
|
+
}}
|
|
236
|
+
</DataTable>
|
|
237
|
+
</div>
|
|
238
|
+
</>
|
|
239
|
+
);
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
export default LocationsTable;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { useFhirFetchAll } from '@openmrs/esm-framework';
|
|
2
|
+
import { type FHIRLocation, type LocationTagsResponse } from '../types';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Custom hook that fetches all facilities with specified location tags.
|
|
6
|
+
* Uses the framework's useFhirFetchAll hook which handles pagination automatically.
|
|
7
|
+
*
|
|
8
|
+
* @param locationTags The location tags response containing tags to filter by
|
|
9
|
+
* @returns Object containing loading state, error, and the list of facilities
|
|
10
|
+
*/
|
|
11
|
+
export const useFacilitiesTagged = (locationTags: LocationTagsResponse) => {
|
|
12
|
+
const tagNames = locationTags?.results
|
|
13
|
+
?.map((tag) => encodeURIComponent(tag.name || tag.display))
|
|
14
|
+
.filter(Boolean)
|
|
15
|
+
.join(',');
|
|
16
|
+
|
|
17
|
+
const url = tagNames ? `ws/fhir2/R4/Location?_summary=data&_tag=${tagNames}` : null;
|
|
18
|
+
|
|
19
|
+
const { data, isLoading, error } = useFhirFetchAll<FHIRLocation>(url);
|
|
20
|
+
|
|
21
|
+
return {
|
|
22
|
+
isLoading,
|
|
23
|
+
error,
|
|
24
|
+
facilityList: data?.map((resource) => ({ resource })) || [],
|
|
25
|
+
};
|
|
26
|
+
};
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
@use '@carbon/colors';
|
|
2
|
+
@use '@carbon/layout';
|
|
3
|
+
@use '@carbon/type';
|
|
4
|
+
|
|
5
|
+
.widgetCard {
|
|
6
|
+
border: 1px solid colors.$gray-20;
|
|
7
|
+
margin-bottom: layout.$spacing-06;
|
|
8
|
+
margin-right: layout.$spacing-03;
|
|
9
|
+
margin-left: layout.$spacing-05;
|
|
10
|
+
margin-top: layout.$spacing-06;
|
|
11
|
+
background: var(--cds-field);
|
|
12
|
+
}
|
|
13
|
+
.expandedRow {
|
|
14
|
+
border: 1px solid colors.$gray-20;
|
|
15
|
+
margin-bottom: layout.$spacing-06;
|
|
16
|
+
margin-right: layout.$spacing-03;
|
|
17
|
+
margin-left: layout.$spacing-05;
|
|
18
|
+
}
|
|
19
|
+
.flexContainer {
|
|
20
|
+
display: flex;
|
|
21
|
+
justify-content: space-between;
|
|
22
|
+
align-items: center;
|
|
23
|
+
padding: layout.$spacing-05;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.filterContainer {
|
|
27
|
+
display: flex;
|
|
28
|
+
align-items: center;
|
|
29
|
+
gap: layout.$spacing-05;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.headerActions {
|
|
33
|
+
display: flex;
|
|
34
|
+
gap: layout.$spacing-03;
|
|
35
|
+
align-items: center;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.filterContainer {
|
|
39
|
+
flex: 1;
|
|
40
|
+
|
|
41
|
+
:global(.cds--dropdown__wrapper--inline) {
|
|
42
|
+
gap: 0;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
:global(.cds--list-box__menu-icon) {
|
|
46
|
+
height: layout.$spacing-05;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.backgroundDataFetchingIndicator {
|
|
51
|
+
align-items: center;
|
|
52
|
+
display: flex;
|
|
53
|
+
justify-content: flex-end;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.tileContainer {
|
|
57
|
+
border-top: 1px solid colors.$gray-20;
|
|
58
|
+
padding: layout.$spacing-09 0;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.tile {
|
|
62
|
+
margin: auto;
|
|
63
|
+
width: fit-content;
|
|
64
|
+
display: flex;
|
|
65
|
+
flex-direction: column;
|
|
66
|
+
align-items: center;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.tileContent {
|
|
70
|
+
display: flex;
|
|
71
|
+
flex-direction: column;
|
|
72
|
+
align-items: center;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.content {
|
|
76
|
+
@include type.type-style('heading-compact-02');
|
|
77
|
+
color: colors.$gray-70;
|
|
78
|
+
margin-bottom: layout.$spacing-03;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.helper {
|
|
82
|
+
@include type.type-style('body-compact-01');
|
|
83
|
+
color: colors.$gray-70;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.separator {
|
|
87
|
+
@include type.type-style('body-compact-02');
|
|
88
|
+
color: colors.$gray-70;
|
|
89
|
+
width: 80%;
|
|
90
|
+
margin: layout.$spacing-06 auto;
|
|
91
|
+
overflow: hidden;
|
|
92
|
+
text-align: center;
|
|
93
|
+
|
|
94
|
+
&::before,
|
|
95
|
+
&::after {
|
|
96
|
+
// background-color: colors.$gray-40;
|
|
97
|
+
content: '';
|
|
98
|
+
display: inline-block;
|
|
99
|
+
height: 1px;
|
|
100
|
+
position: relative;
|
|
101
|
+
vertical-align: middle;
|
|
102
|
+
width: 50%;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
&::before {
|
|
106
|
+
right: layout.$spacing-03;
|
|
107
|
+
margin-left: -50%;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
&::after {
|
|
111
|
+
left: layout.$spacing-03;
|
|
112
|
+
margin-right: -50%;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
export interface AdmissionLocationResponse {
|
|
2
|
+
uuid: string;
|
|
3
|
+
wardName: string;
|
|
4
|
+
totalBeds: number;
|
|
5
|
+
occupiedBeds: number;
|
|
6
|
+
availableBeds: number;
|
|
7
|
+
ward: {
|
|
8
|
+
uuid: string;
|
|
9
|
+
display: string;
|
|
10
|
+
name: string;
|
|
11
|
+
tags: Array<{
|
|
12
|
+
uuid: string;
|
|
13
|
+
display: string;
|
|
14
|
+
}>;
|
|
15
|
+
parentLocation: {
|
|
16
|
+
uuid: string;
|
|
17
|
+
display: string;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface LocationTagsResponse {
|
|
23
|
+
results: Array<{
|
|
24
|
+
uuid: string;
|
|
25
|
+
display: string;
|
|
26
|
+
name: string;
|
|
27
|
+
description: string;
|
|
28
|
+
}>;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// OpenMRS format (legacy)
|
|
32
|
+
export interface LocationResponse {
|
|
33
|
+
uuid: string;
|
|
34
|
+
display: string;
|
|
35
|
+
name: string;
|
|
36
|
+
description: string;
|
|
37
|
+
stateProvince: string;
|
|
38
|
+
country: string;
|
|
39
|
+
countyDistrict: string;
|
|
40
|
+
address5: string;
|
|
41
|
+
address6: string;
|
|
42
|
+
tags: Array<{
|
|
43
|
+
uuid: string;
|
|
44
|
+
display: string;
|
|
45
|
+
name: string;
|
|
46
|
+
description: string;
|
|
47
|
+
}>;
|
|
48
|
+
attributes: Array<{
|
|
49
|
+
display: string;
|
|
50
|
+
uuid: string;
|
|
51
|
+
attributeType: {
|
|
52
|
+
uuid: string;
|
|
53
|
+
display: string;
|
|
54
|
+
};
|
|
55
|
+
value: string;
|
|
56
|
+
}>;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export interface FHIRLocation {
|
|
60
|
+
resourceType: 'Location';
|
|
61
|
+
id: string;
|
|
62
|
+
meta?: {
|
|
63
|
+
versionId?: string;
|
|
64
|
+
lastUpdated?: string;
|
|
65
|
+
tag?: Array<{
|
|
66
|
+
system: string;
|
|
67
|
+
code: string;
|
|
68
|
+
display: string;
|
|
69
|
+
}>;
|
|
70
|
+
};
|
|
71
|
+
status: string;
|
|
72
|
+
name: string;
|
|
73
|
+
description?: string;
|
|
74
|
+
address?: {
|
|
75
|
+
extension?: Array<{
|
|
76
|
+
url: string;
|
|
77
|
+
extension?: Array<{
|
|
78
|
+
url: string;
|
|
79
|
+
valueString: string;
|
|
80
|
+
}>;
|
|
81
|
+
}>;
|
|
82
|
+
line?: string[];
|
|
83
|
+
city?: string;
|
|
84
|
+
district?: string;
|
|
85
|
+
state?: string;
|
|
86
|
+
country?: string;
|
|
87
|
+
};
|
|
88
|
+
identifier?: Array<{
|
|
89
|
+
system: string;
|
|
90
|
+
value: string;
|
|
91
|
+
}>;
|
|
92
|
+
partOf?: {
|
|
93
|
+
reference: string;
|
|
94
|
+
type: string;
|
|
95
|
+
display: string;
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export interface FHIRBundle {
|
|
100
|
+
resourceType: 'Bundle';
|
|
101
|
+
id: string;
|
|
102
|
+
meta?: {
|
|
103
|
+
lastUpdated?: string;
|
|
104
|
+
tag?: Array<{
|
|
105
|
+
system: string;
|
|
106
|
+
code: string;
|
|
107
|
+
display: string;
|
|
108
|
+
}>;
|
|
109
|
+
};
|
|
110
|
+
type: string;
|
|
111
|
+
total?: number;
|
|
112
|
+
link?: Array<{
|
|
113
|
+
relation: string;
|
|
114
|
+
url: string;
|
|
115
|
+
}>;
|
|
116
|
+
entry?: Array<{
|
|
117
|
+
fullUrl: string;
|
|
118
|
+
resource: FHIRLocation;
|
|
119
|
+
}>;
|
|
120
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ExtensionSlot, useConfig } from '@openmrs/esm-framework';
|
|
3
|
+
import styles from './queue-management-dashboard.scss';
|
|
4
|
+
import { CustomPageHeader } from '../components/custom-page-header/custom-page-header.component';
|
|
5
|
+
import { ConfigObject } from '../config-schema';
|
|
6
|
+
import { useTranslation } from 'react-i18next';
|
|
7
|
+
import QueueManagementTable from './queue-management-table/queue-management-table.component';
|
|
8
|
+
|
|
9
|
+
const QueueManagementDashboard: React.FC = () => {
|
|
10
|
+
const { t } = useTranslation();
|
|
11
|
+
const { queueManagementIcon } = useConfig<ConfigObject>();
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<div>
|
|
15
|
+
<div className={styles.dashboardContainer}>
|
|
16
|
+
<CustomPageHeader subTitle={t('manageQueues', 'Manage queues and rooms')} iconSrc={queueManagementIcon.src} />
|
|
17
|
+
</div>
|
|
18
|
+
<QueueManagementTable />
|
|
19
|
+
</div>
|
|
20
|
+
);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export default QueueManagementDashboard;
|