@kenyaemr/esm-admin-app 5.4.2-pre.2767 → 5.4.2-pre.2771
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 +2 -2
- package/dist/585.js +1 -1
- package/dist/585.js.map +1 -1
- package/dist/kenyaemr-esm-admin-app.js.buildmanifest.json +6 -6
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/routes.json +1 -1
- package/package.json +1 -1
- package/src/components/locations/tables/locations-table.resource.ts +12 -27
package/dist/routes.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"kenyaemrCharts":"^1.6.7"},"extensions":[{"component":"adminLeftPanelLink","name":"admin-left-panel-link","slot":"admin-left-panel-slot"},{"component":"userManagementLeftPannelLink","name":"user-management-left-panel-link","slot":"admin-left-panel-slot"},{"component":"etlAdministrationLeftPannelLink","name":"etl-administration-left-panel-link","slot":"admin-left-panel-slot"},{"component":"locationsLeftPanelLink","name":"locations-left-panel-link","slot":"admin-left-panel-slot"},{"component":"facilitySetupLeftPanelLink","name":"facility-setup-left-panel-link","slot":"admin-left-panel-slot"},{"component":"providerBanner","name":"provider-banner","slot":"provider-banner-info-slot","order":1}],"workspaces":[{"name":"manage-user-workspace","component":"manageUserWorkspace","title":"Manage User Workspace","type":"other-form","canMaximize":true,"width":"extra-wide"},{"name":"user-role-scope-workspace","component":"userRoleScopeWorkspace","title":"User Rple Scope Workspace","type":"other-form","canMaximize":true,"width":"extra-wide"},{"name":"add-location-workspace","title":"Add Location","component":"addLocation","type":"workspace"},{"name":"search-location-workspace","title":"Search Location","component":"searchLocationWorkspace","type":"workspace"},{"name":"hwr-sync-workspace","title":"HWR Sync Workspace","component":"hwrSyncWorkspace","type":"other-form"},{"name":"hwr-sync-modal","title":"HWR Sync Modal","component":"hwrSyncModal","type":"modal"}],"modals":[{"component":"operationConfirmationModal","name":"operation-confirmation-modal"},{"component":"hwrConfirmationModal","name":"hwr-confirmation-modal"},{"component":"hwrEmptyModal","name":"hwr-empty-modal"},{"component":"hwrSyncModal","name":"hwr-syncing-modal"}],"pages":[{"component":"root","route":"admin"}],"version":"5.4.2-pre.
|
|
1
|
+
{"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"kenyaemrCharts":"^1.6.7"},"extensions":[{"component":"adminLeftPanelLink","name":"admin-left-panel-link","slot":"admin-left-panel-slot"},{"component":"userManagementLeftPannelLink","name":"user-management-left-panel-link","slot":"admin-left-panel-slot"},{"component":"etlAdministrationLeftPannelLink","name":"etl-administration-left-panel-link","slot":"admin-left-panel-slot"},{"component":"locationsLeftPanelLink","name":"locations-left-panel-link","slot":"admin-left-panel-slot"},{"component":"facilitySetupLeftPanelLink","name":"facility-setup-left-panel-link","slot":"admin-left-panel-slot"},{"component":"providerBanner","name":"provider-banner","slot":"provider-banner-info-slot","order":1}],"workspaces":[{"name":"manage-user-workspace","component":"manageUserWorkspace","title":"Manage User Workspace","type":"other-form","canMaximize":true,"width":"extra-wide"},{"name":"user-role-scope-workspace","component":"userRoleScopeWorkspace","title":"User Rple Scope Workspace","type":"other-form","canMaximize":true,"width":"extra-wide"},{"name":"add-location-workspace","title":"Add Location","component":"addLocation","type":"workspace"},{"name":"search-location-workspace","title":"Search Location","component":"searchLocationWorkspace","type":"workspace"},{"name":"hwr-sync-workspace","title":"HWR Sync Workspace","component":"hwrSyncWorkspace","type":"other-form"},{"name":"hwr-sync-modal","title":"HWR Sync Modal","component":"hwrSyncModal","type":"modal"}],"modals":[{"component":"operationConfirmationModal","name":"operation-confirmation-modal"},{"component":"hwrConfirmationModal","name":"hwr-confirmation-modal"},{"component":"hwrEmptyModal","name":"hwr-empty-modal"},{"component":"hwrSyncModal","name":"hwr-syncing-modal"}],"pages":[{"component":"root","route":"admin"}],"version":"5.4.2-pre.2771"}
|
package/package.json
CHANGED
|
@@ -1,41 +1,26 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { type
|
|
3
|
-
import useSWR from 'swr';
|
|
1
|
+
import { useFhirFetchAll } from '@openmrs/esm-framework';
|
|
2
|
+
import { type FHIRLocation, type LocationTagsResponse } from '../types';
|
|
4
3
|
|
|
5
4
|
/**
|
|
6
|
-
*
|
|
5
|
+
* Custom hook that fetches all facilities with specified location tags.
|
|
6
|
+
* Uses the framework's useFhirFetchAll hook which handles pagination automatically.
|
|
7
7
|
*
|
|
8
|
-
* @param locationTags The location tags to filter
|
|
9
|
-
* @returns
|
|
10
|
-
* @throws {Error} If the API request fails
|
|
8
|
+
* @param locationTags The location tags response containing tags to filter by
|
|
9
|
+
* @returns Object containing loading state, error, and the list of facilities
|
|
11
10
|
*/
|
|
12
|
-
export
|
|
13
|
-
locationTags
|
|
14
|
-
)
|
|
15
|
-
const tagNames = locationTags.results
|
|
16
|
-
.map((tag) => encodeURIComponent(tag.name || tag.display))
|
|
11
|
+
export const useFacilitiesTagged = (locationTags: LocationTagsResponse) => {
|
|
12
|
+
const tagNames = locationTags?.results
|
|
13
|
+
?.map((tag) => encodeURIComponent(tag.name || tag.display))
|
|
17
14
|
.filter(Boolean)
|
|
18
15
|
.join(',');
|
|
19
16
|
|
|
20
|
-
const url =
|
|
21
|
-
const response = await openmrsFetch<FHIRBundle>(url);
|
|
22
|
-
|
|
23
|
-
const locations = response.data?.entry?.map((entry) => entry.resource) ?? [];
|
|
24
|
-
|
|
25
|
-
return { results: locations };
|
|
26
|
-
}
|
|
17
|
+
const url = tagNames ? `ws/fhir2/R4/Location?_summary=data&_tag=${tagNames}` : null;
|
|
27
18
|
|
|
28
|
-
|
|
29
|
-
const tagNames = locationTags.results
|
|
30
|
-
.map((tag) => encodeURIComponent(tag.name || tag.display))
|
|
31
|
-
.filter(Boolean)
|
|
32
|
-
.join(',');
|
|
33
|
-
const url = `${fhirBaseUrl}/Location?_summary=data&_tag=${tagNames}`;
|
|
34
|
-
const { isLoading, error, data } = useSWR<FetchResponse<FHIRBundle>>(url, openmrsFetch);
|
|
19
|
+
const { data, isLoading, error } = useFhirFetchAll<FHIRLocation>(url);
|
|
35
20
|
|
|
36
21
|
return {
|
|
37
22
|
isLoading,
|
|
38
23
|
error,
|
|
39
|
-
facilityList: data?.
|
|
24
|
+
facilityList: data?.map((resource) => ({ resource })) || [],
|
|
40
25
|
};
|
|
41
26
|
};
|