@kenyaemr/esm-pharmacy-app 5.2.1-pre.1001
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 +35 -0
- package/LICENSE.md +401 -0
- package/README.md +5 -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/255.js +2 -0
- package/dist/255.js.LICENSE.txt +9 -0
- package/dist/255.js.map +1 -0
- package/dist/282.js +1 -0
- package/dist/282.js.map +1 -0
- package/dist/303.js +1 -0
- package/dist/303.js.map +1 -0
- package/dist/419.js +1 -0
- package/dist/419.js.map +1 -0
- package/dist/515.js +1 -0
- package/dist/515.js.map +1 -0
- package/dist/548.js +1 -0
- package/dist/548.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/637.js +1 -0
- package/dist/637.js.map +1 -0
- package/dist/661.js +1 -0
- package/dist/661.js.map +1 -0
- package/dist/712.js +1 -0
- package/dist/712.js.map +1 -0
- package/dist/729.js +1 -0
- package/dist/729.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/883.js +1 -0
- package/dist/883.js.map +1 -0
- package/dist/993.js +2 -0
- package/dist/993.js.LICENSE.txt +35 -0
- package/dist/993.js.map +1 -0
- package/dist/kenyaemr-esm-pharmacy-app.js +1 -0
- package/dist/kenyaemr-esm-pharmacy-app.js.buildmanifest.json +556 -0
- package/dist/kenyaemr-esm-pharmacy-app.js.map +1 -0
- package/dist/main.js +1 -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/autosuggest/autosuggest.component.tsx +187 -0
- package/src/autosuggest/autosuggest.scss +62 -0
- package/src/config-schema.ts +49 -0
- package/src/declarations.d.ts +6 -0
- package/src/hooks/index.ts +4 -0
- package/src/hooks/usePharmacies.ts +20 -0
- package/src/hooks/usePharmacy.ts +17 -0
- package/src/hooks/usePharmacyPatients.ts +48 -0
- package/src/hooks/usePharmacyUsers.ts +43 -0
- package/src/hooks/useUserMappedPharmacies.ts +47 -0
- package/src/index.ts +41 -0
- package/src/pharamacy-forms/delete-confirm-dialog.modal.tsx +26 -0
- package/src/pharamacy-forms/pharamacy-assignment-form.workspace.tsx +121 -0
- package/src/pharamacy-forms/pharmacy-assignment-form.scss +125 -0
- package/src/pharmacy-component/pharmacy.component.tsx +14 -0
- package/src/pharmacy-detail/pharmacy-detail.component.tsx +14 -0
- package/src/pharmacy-detail-header/pharmacy-detail-header.component.tsx +41 -0
- package/src/pharmacy-header/pharmacy-header.component.tsx +36 -0
- package/src/pharmacy-header/pharmacy-header.scss +71 -0
- package/src/pharmacy-header/pharmacy-illustration.component.tsx +13 -0
- package/src/pharmacy-left-panel/pharmacy-left-panel-link.component.tsx +40 -0
- package/src/pharmacy-metrics/pharmacy-card.component.tsx +47 -0
- package/src/pharmacy-metrics/pharmacy-card.scss +80 -0
- package/src/pharmacy-metrics/pharmacy-header.scss +22 -0
- package/src/pharmacy-metrics/pharmacy-metrics-header.component.tsx +30 -0
- package/src/pharmacy-metrics/pharmacy-metrics.component.tsx +43 -0
- package/src/pharmacy-metrics/pharmacy-metrics.scss +11 -0
- package/src/pharmacy-tables/pharmacy-patients.component.tsx +228 -0
- package/src/pharmacy-tables/pharmacy-table.component.tsx +164 -0
- package/src/pharmacy-tables/pharmacy-tables.scss +49 -0
- package/src/pharmacy-tables/pharmacy-users.component.tsx +197 -0
- package/src/pharmacy-tabs/pharmacy-tabs-component.tsx +28 -0
- package/src/pharmacy-tabs/pharmacy-tabs.scss +28 -0
- package/src/pharmacy.mock.ts +0 -0
- package/src/pharmacy.resources.ts +55 -0
- package/src/root.component.tsx +19 -0
- package/src/root.scss +15 -0
- package/src/root.test.tsx +5 -0
- package/src/routes.json +38 -0
- package/src/setup-tests.ts +1 -0
- package/src/types/index.ts +67 -0
- package/translations/en.json +28 -0
- package/tsconfig.json +5 -0
- package/webpack.config.js +1 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TabPanels, TabPanel, TabList, Tabs, Tab } from '@carbon/react';
|
|
3
|
+
import { useTranslation } from 'react-i18next';
|
|
4
|
+
import { PharmacyPatients } from '../pharmacy-tables/pharmacy-patients.component';
|
|
5
|
+
import { PharmacyUsers } from '../pharmacy-tables/pharmacy-users.component';
|
|
6
|
+
import styles from './pharmacy-tabs.scss';
|
|
7
|
+
|
|
8
|
+
export const PharmacyTabs: React.FC = () => {
|
|
9
|
+
const { t } = useTranslation();
|
|
10
|
+
return (
|
|
11
|
+
<main>
|
|
12
|
+
<Tabs className={styles.tabs}>
|
|
13
|
+
<TabList className={styles.tablist} aria-label="List tabs" contained>
|
|
14
|
+
<Tab className={styles.tab}>{t('patients', 'Assigned Patients')}</Tab>
|
|
15
|
+
<Tab className={styles.tab}>{t('users', 'Asigned Users')}</Tab>
|
|
16
|
+
</TabList>
|
|
17
|
+
<TabPanels>
|
|
18
|
+
<TabPanel>
|
|
19
|
+
<PharmacyPatients />
|
|
20
|
+
</TabPanel>
|
|
21
|
+
<TabPanel>
|
|
22
|
+
<PharmacyUsers />
|
|
23
|
+
</TabPanel>
|
|
24
|
+
</TabPanels>
|
|
25
|
+
</Tabs>
|
|
26
|
+
</main>
|
|
27
|
+
);
|
|
28
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
@use '@carbon/colors';
|
|
2
|
+
@use '@carbon/styles/scss/spacing';
|
|
3
|
+
@use '@carbon/styles/scss/type';
|
|
4
|
+
@import '~@openmrs/esm-styleguide/src/vars';
|
|
5
|
+
|
|
6
|
+
.tabs {
|
|
7
|
+
grid-column: span 2;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.tablist {
|
|
11
|
+
padding: 0 spacing.$spacing-05;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.tab {
|
|
15
|
+
min-width: 8.875rem;
|
|
16
|
+
|
|
17
|
+
&:active {
|
|
18
|
+
outline: 2px solid var(--brand-03) !important;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
&:focus {
|
|
22
|
+
outline: 2px solid var(--brand-03) !important;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
&[aria-selected='true'] {
|
|
26
|
+
box-shadow: inset 0 2px 0 0 var(--brand-03) !important;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { openmrsFetch, restBaseUrl } from '@openmrs/esm-framework';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
export const pharmacyAssignmentFormSchema = z.object({
|
|
5
|
+
entityIdentifier: z.string().min(1, 'Required'),
|
|
6
|
+
entityType: z.enum(['org.openmrs.User', 'org.openmrs.Patient']),
|
|
7
|
+
basisIdentifier: z.string().min(1, 'Required'),
|
|
8
|
+
basisType: z.enum(['org.openmrs.Location']).optional().default('org.openmrs.Location'),
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
export async function fetchPerson(query: string, abortController: AbortController) {
|
|
12
|
+
const patientsRes = await openmrsFetch(`${restBaseUrl}/patient?q=${query}`, {
|
|
13
|
+
signal: abortController.signal,
|
|
14
|
+
});
|
|
15
|
+
return patientsRes.data.results;
|
|
16
|
+
}
|
|
17
|
+
export async function fetchUser(query: string, abortController: AbortController) {
|
|
18
|
+
const customPresentation = 'custom:(uuid,display,person:(display))';
|
|
19
|
+
const patientsRes = await openmrsFetch(`${restBaseUrl}/user?q=${query}&v=${customPresentation}`, {
|
|
20
|
+
signal: abortController.signal,
|
|
21
|
+
});
|
|
22
|
+
return patientsRes.data.results;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export const saveMapping = async (data: z.infer<typeof pharmacyAssignmentFormSchema>) => {
|
|
26
|
+
const url = `${restBaseUrl}/datafilter/entitybasismap`;
|
|
27
|
+
const response = await openmrsFetch(url, {
|
|
28
|
+
method: 'POST',
|
|
29
|
+
body: JSON.stringify(data),
|
|
30
|
+
headers: {
|
|
31
|
+
'Content-Type': 'application/json',
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
if (response.ok) {
|
|
36
|
+
return await response.text();
|
|
37
|
+
}
|
|
38
|
+
throw new Error(`Error mapping patient`);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export const revokePharamacyAssignment = async (data: z.infer<typeof pharmacyAssignmentFormSchema>) => {
|
|
42
|
+
const url = `${restBaseUrl}/datafilter/revoke`;
|
|
43
|
+
const response = await openmrsFetch(url, {
|
|
44
|
+
method: 'POST',
|
|
45
|
+
body: JSON.stringify(data),
|
|
46
|
+
headers: {
|
|
47
|
+
'Content-Type': 'application/json',
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
if (response.ok) {
|
|
52
|
+
return await response.text();
|
|
53
|
+
}
|
|
54
|
+
throw new Error(`Error revoking mapping`);
|
|
55
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { BrowserRouter, Route, Routes } from 'react-router-dom';
|
|
3
|
+
import PharmacyComponent from './pharmacy-component/pharmacy.component';
|
|
4
|
+
import PharmacyDetail from './pharmacy-detail/pharmacy-detail.component';
|
|
5
|
+
|
|
6
|
+
const Root: React.FC = () => {
|
|
7
|
+
const baseName = window.getOpenmrsSpaBase() + 'home/pharmacy';
|
|
8
|
+
|
|
9
|
+
return (
|
|
10
|
+
<BrowserRouter basename={baseName}>
|
|
11
|
+
<Routes>
|
|
12
|
+
<Route path="/" element={<PharmacyComponent />} />
|
|
13
|
+
<Route path="/:pharmacyUuid" element={<PharmacyDetail />} />
|
|
14
|
+
</Routes>
|
|
15
|
+
</BrowserRouter>
|
|
16
|
+
);
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export default Root;
|
package/src/root.scss
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
@use '@carbon/styles/scss/spacing';
|
|
2
|
+
@use '@carbon/styles/scss/type';
|
|
3
|
+
|
|
4
|
+
.container {
|
|
5
|
+
padding: spacing.$spacing-07;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.welcome {
|
|
9
|
+
@include type.type-style('heading-04');
|
|
10
|
+
margin: spacing.$spacing-05 0;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.explainer {
|
|
14
|
+
margin-bottom: 2rem;
|
|
15
|
+
}
|
package/src/routes.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.openmrs.org/routes.schema.json",
|
|
3
|
+
"backendDependencies": {
|
|
4
|
+
"fhir2": ">=1.2",
|
|
5
|
+
"webservices.rest": "^2.24.0"
|
|
6
|
+
},
|
|
7
|
+
"extensions": [
|
|
8
|
+
{
|
|
9
|
+
"component": "pharmacyDashboardLink",
|
|
10
|
+
"name": "pharmacy-dashboard-link",
|
|
11
|
+
"slot": "homepage-dashboard-slot",
|
|
12
|
+
"meta": {
|
|
13
|
+
"name": "pharmacy",
|
|
14
|
+
"title": "pharmacy",
|
|
15
|
+
"slot": "pharmacy-dashboard-slot"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"component": "root",
|
|
20
|
+
"name": "pharmacy-dashboard-root",
|
|
21
|
+
"slot": "pharmacy-dashboard-slot"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"name": "pharmacy-assignment-form",
|
|
25
|
+
"component": "pharmacyAssignmentForm"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"name": "pharmacy-delete-confirm-dialog",
|
|
29
|
+
"component": "pharmacyDeleteConfirmDialog"
|
|
30
|
+
}
|
|
31
|
+
],
|
|
32
|
+
"pages": [
|
|
33
|
+
{
|
|
34
|
+
"component": "root",
|
|
35
|
+
"route": "pharmacy"
|
|
36
|
+
}
|
|
37
|
+
]
|
|
38
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom/extend-expect';
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { Location, Patient } from '@openmrs/esm-framework';
|
|
2
|
+
|
|
3
|
+
export interface Pharmacy extends Location {
|
|
4
|
+
//Inherits Uuid,display,name
|
|
5
|
+
description?: string;
|
|
6
|
+
cityVillage?: string;
|
|
7
|
+
stateProvince?: string;
|
|
8
|
+
countyDistrict?: string;
|
|
9
|
+
dateMaped: string;
|
|
10
|
+
mflCode: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
interface Basis {
|
|
14
|
+
uuid: string;
|
|
15
|
+
name: string;
|
|
16
|
+
country?: string;
|
|
17
|
+
address3?: string;
|
|
18
|
+
countyDistrict?: string;
|
|
19
|
+
address2?: string;
|
|
20
|
+
address1?: string;
|
|
21
|
+
address6?: string;
|
|
22
|
+
address5?: string;
|
|
23
|
+
cityVillage?: string;
|
|
24
|
+
address4?: string;
|
|
25
|
+
'Master Facility Code'?: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface PhamarcyUserMapping {
|
|
29
|
+
uuid: string;
|
|
30
|
+
dateCreated: number;
|
|
31
|
+
entity: {
|
|
32
|
+
name: string;
|
|
33
|
+
uuid: string;
|
|
34
|
+
};
|
|
35
|
+
basis: Basis;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface PharamacyPatientMapping {
|
|
39
|
+
uuid: string;
|
|
40
|
+
dateCreated: number;
|
|
41
|
+
entity: {
|
|
42
|
+
OpenMRSID?: string;
|
|
43
|
+
identifier?: string;
|
|
44
|
+
gender?: string;
|
|
45
|
+
name: string;
|
|
46
|
+
uuid: string;
|
|
47
|
+
age?: number;
|
|
48
|
+
'Telephone contact'?: string;
|
|
49
|
+
};
|
|
50
|
+
basis: Basis;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface PharmacyPatient {
|
|
54
|
+
uuid: string;
|
|
55
|
+
openmrsId?: string;
|
|
56
|
+
name: string;
|
|
57
|
+
age?: number;
|
|
58
|
+
gender?: string;
|
|
59
|
+
telephoneContact?: string;
|
|
60
|
+
dateMapped: string;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export interface PharmacyUser {
|
|
64
|
+
uuid: string;
|
|
65
|
+
name: string;
|
|
66
|
+
dateMapped: string;
|
|
67
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"actions": "Actions",
|
|
3
|
+
"age": "Age",
|
|
4
|
+
"assignPatient": "Assign Patient",
|
|
5
|
+
"assignUser": "Assign User",
|
|
6
|
+
"cityVillage": "City village",
|
|
7
|
+
"communityPharmacies": "Community pharmacies",
|
|
8
|
+
"contact": "Contact",
|
|
9
|
+
"countyDistrict": "County District",
|
|
10
|
+
"dateMapped": "Date Mapped",
|
|
11
|
+
"name": "NAME",
|
|
12
|
+
"noCommunityPharmacyToList": "No Community Pharmacies to list.",
|
|
13
|
+
"noPharmacyPatients": "No Pharmacy Patients to list.",
|
|
14
|
+
"noPharmacyUsers": "No Pharmacy users to list.",
|
|
15
|
+
"openmrsId": "OpenMRS ID",
|
|
16
|
+
"patient": "Assigned patients",
|
|
17
|
+
"pharmacies": "Phamacies",
|
|
18
|
+
"pharmacy": "Commity pharmacy",
|
|
19
|
+
"pharmacyPatients": "Pharmacy Patients",
|
|
20
|
+
"pharmacySummary": "Pharmacy Summary",
|
|
21
|
+
"pharmacyUsers": "Pharmacy Users",
|
|
22
|
+
"sex": "Sex",
|
|
23
|
+
"stateProvince": "State province",
|
|
24
|
+
"tagged": "Tagged phamacies",
|
|
25
|
+
"tagPharmacy": "Tag pharmacy",
|
|
26
|
+
"users": "Assigned Users",
|
|
27
|
+
"viewReport": "View Report"
|
|
28
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('openmrs/default-webpack-config');
|