@mbehenri/openmrs-esm-opentms-meet-app 1.0.1 → 1.0.3
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/.eslintrc +1 -1
- package/.husky/pre-commit +2 -2
- package/.husky/pre-push +0 -0
- package/.turbo.json +1 -1
- package/README.md +25 -14
- package/__mocks__/react-i18next.js +9 -14
- package/dist/147.js +1 -0
- package/dist/147.js.map +1 -0
- package/dist/184.js +2 -0
- package/dist/184.js.LICENSE.txt +14 -0
- package/dist/184.js.map +1 -0
- package/dist/197.js +1 -0
- package/dist/23.js +1 -0
- package/dist/23.js.map +1 -0
- package/dist/26.js +1 -0
- package/dist/26.js.map +1 -0
- package/dist/282.js +2 -0
- package/dist/282.js.LICENSE.txt +32 -0
- package/dist/282.js.map +1 -0
- package/dist/300.js +1 -0
- package/dist/335.js +1 -0
- package/dist/353.js +1 -0
- package/dist/353.js.map +1 -0
- package/dist/471.js +1 -0
- package/dist/471.js.map +1 -0
- package/dist/509.js +2 -0
- package/dist/509.js.LICENSE.txt +54 -0
- package/dist/509.js.map +1 -0
- package/dist/51.js +1 -0
- package/dist/51.js.map +1 -0
- package/dist/540.js +2 -0
- package/dist/540.js.LICENSE.txt +9 -0
- package/dist/540.js.map +1 -0
- package/dist/55.js +1 -0
- package/dist/652.js +1 -0
- package/dist/740.js +1 -0
- package/dist/740.js.map +1 -0
- package/dist/852.js +1 -0
- package/dist/852.js.map +1 -0
- package/dist/864.js +1 -0
- package/dist/864.js.map +1 -0
- package/dist/897.js +2 -0
- package/dist/897.js.LICENSE.txt +24 -0
- package/dist/897.js.map +1 -0
- package/dist/91.js +1 -0
- package/dist/91.js.map +1 -0
- package/dist/961.js +2 -0
- package/dist/961.js.LICENSE.txt +19 -0
- package/dist/961.js.map +1 -0
- package/dist/99.js +1 -0
- package/dist/b8b28cec32e885bb.png +0 -0
- package/dist/main.js +1 -0
- package/dist/main.js.map +1 -0
- package/dist/openmrs-esm-opentms-meet-app.js +1 -0
- package/dist/openmrs-esm-opentms-meet-app.js.buildmanifest.json +678 -0
- package/dist/openmrs-esm-opentms-meet-app.js.map +1 -0
- package/dist/routes.json +1 -0
- package/e2e/core/global-setup.ts +8 -8
- package/e2e/core/index.ts +1 -1
- package/e2e/core/test.ts +3 -3
- package/e2e/fixtures/api.ts +2 -9
- package/e2e/fixtures/index.ts +1 -1
- package/e2e/pages/index.ts +1 -1
- package/e2e/pages/root-page.ts +32 -0
- package/e2e/specs/template-app.spec.ts +23 -0
- package/e2e/support/github/Dockerfile +1 -1
- package/e2e/support/github/docker-compose.yml +2 -2
- package/e2e/support/github/run-e2e-docker-env.sh +13 -25
- package/jest.config.js +19 -17
- package/package.json +44 -45
- package/playwright.config.ts +9 -11
- package/prettier.config.js +8 -0
- package/src/components/Appointment/index.scss +1 -1
- package/src/components/Appointment/index.tsx +30 -58
- package/src/components/Demand/tab.scss +1 -1
- package/src/components/Demand/tab.tsx +38 -58
- package/src/components/EmptyLayout/index.scss +1 -1
- package/src/components/MeetIframe/index.tsx +16 -35
- package/src/config-schema.ts +5 -5
- package/src/dashboard.meta.ts +6 -6
- package/src/extensions/AppointmentTabExt.tsx +17 -0
- package/src/{Extensions → extensions}/DemandTabExt.tsx +2 -2
- package/src/{Extensions → extensions}/MeetIframeExt.tsx +2 -2
- package/src/{Extensions → extensions}/ValidateDemandFormExt.tsx +5 -6
- package/src/index.ts +11 -31
- package/src/pages/home/home.component.tsx +2 -2
- package/src/repositories/opentms/index.ts +10 -0
- package/src/repositories/{Opencare → opentms}/prodRepository.ts +36 -65
- package/src/repositories/{Opencare → opentms}/repository.ts +5 -8
- package/src/root.component.tsx +8 -19
- package/src/root.scss +5 -5
- package/src/root.test.tsx +9 -14
- package/src/routes.json +6 -11
- package/src/services/doctor.ts +13 -22
- package/{i18next-parser.config.js → tools/i18next-parser.config.js} +19 -19
- package/tools/setup-tests.ts +1 -0
- package/tools/update-openmrs-deps.mjs +43 -0
- package/translations/am.json +24 -0
- package/translations/en.json +24 -1
- package/tsconfig.json +1 -1
- package/webpack.config.js +1 -1
- package/.yarn/install-state.gz +0 -0
- package/.yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs +0 -541
- package/.yarn/releases/yarn-3.6.1.cjs +0 -874
- package/.yarnrc.yml +0 -9
- package/e2e/pages/home-page.ts +0 -9
- package/e2e/specs/sample-test.spec.ts +0 -11
- package/src/Extensions/AppointmentTabExt.tsx +0 -23
- package/src/repositories/Opencare/index.ts +0 -12
package/src/index.ts
CHANGED
|
@@ -4,22 +4,13 @@
|
|
|
4
4
|
* connects the app shell to the React application(s) that make up this
|
|
5
5
|
* microfrontend.
|
|
6
6
|
*/
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
defineConfigSchema,
|
|
10
|
-
getSyncLifecycle,
|
|
11
|
-
} from "@openmrs/esm-framework";
|
|
12
|
-
import { configSchema } from "./config-schema";
|
|
13
|
-
import Root from "./root.component";
|
|
14
|
-
import DemandTabExt from "./Extensions/DemandTabExt";
|
|
15
|
-
import AppointmentTabExt from "./Extensions/AppointmentTabExt";
|
|
16
|
-
import MeetIframeExt from "./Extensions/MeetIframeExt";
|
|
17
|
-
import { ValidateDemandFormExt } from "./Extensions/ValidateDemandFormExt";
|
|
7
|
+
import { getAsyncLifecycle, defineConfigSchema, getSyncLifecycle } from '@openmrs/esm-framework';
|
|
8
|
+
import { configSchema } from './config-schema';
|
|
18
9
|
|
|
19
|
-
const moduleName =
|
|
10
|
+
const moduleName = '@mbehenri/openmrs-esm-opentms-meet-app';
|
|
20
11
|
|
|
21
12
|
const options = {
|
|
22
|
-
featureName:
|
|
13
|
+
featureName: 'opentms',
|
|
23
14
|
moduleName,
|
|
24
15
|
};
|
|
25
16
|
|
|
@@ -28,12 +19,7 @@ const options = {
|
|
|
28
19
|
* are JSON files in the directory `../translations` (which you should
|
|
29
20
|
* see in the directory structure).
|
|
30
21
|
*/
|
|
31
|
-
export const importTranslation = require.context(
|
|
32
|
-
"../translations",
|
|
33
|
-
false,
|
|
34
|
-
/.json$/,
|
|
35
|
-
"lazy"
|
|
36
|
-
);
|
|
22
|
+
export const importTranslation = require.context('../translations', false, /.json$/, 'lazy');
|
|
37
23
|
|
|
38
24
|
/**
|
|
39
25
|
* This function performs any setup that should happen at microfrontend
|
|
@@ -49,22 +35,16 @@ export function startupApp() {
|
|
|
49
35
|
* This named export tells the app shell that the default export of `root.component.tsx`
|
|
50
36
|
* should be rendered when the route matches `root`. The full route
|
|
51
37
|
* will be `openmrsSpaBase() + 'root'`, which is usually
|
|
52
|
-
* `/openmrs/spa/
|
|
38
|
+
* `/openmrs/spa/opentms`.
|
|
53
39
|
*/
|
|
54
40
|
/* export const root = getSyncLifecycle(
|
|
55
41
|
Root,
|
|
56
42
|
options
|
|
57
43
|
); */
|
|
58
44
|
|
|
59
|
-
export const root =
|
|
45
|
+
export const root = getAsyncLifecycle(() => import('./root.component'), options);
|
|
60
46
|
|
|
61
|
-
export const demandtab =
|
|
62
|
-
|
|
63
|
-
export const
|
|
64
|
-
|
|
65
|
-
export const meetiframe = getSyncLifecycle(MeetIframeExt, options);
|
|
66
|
-
|
|
67
|
-
export const validatedemandform = getSyncLifecycle(
|
|
68
|
-
ValidateDemandFormExt,
|
|
69
|
-
options
|
|
70
|
-
);
|
|
47
|
+
export const demandtab = getAsyncLifecycle(() => import('./extensions/DemandTabExt'), options);
|
|
48
|
+
export const appointmenttab = getAsyncLifecycle(() => import('./extensions/AppointmentTabExt'), options);
|
|
49
|
+
export const meetiframe = getAsyncLifecycle(() => import('./extensions/MeetIframeExt'), options);
|
|
50
|
+
export const validatedemandform = getAsyncLifecycle(() => import('./extensions/ValidateDemandFormExt'), options);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type TypeRepository } from '../TypeRepository';
|
|
2
|
+
import ProdOpentmsRepository from './prodRepository';
|
|
3
|
+
import OpentmsRepository from './repository';
|
|
4
|
+
|
|
5
|
+
export function getOpentmsRepository(t: TypeRepository = 'fake'): OpentmsRepository {
|
|
6
|
+
if (t === 'fake') {
|
|
7
|
+
return new OpentmsRepository();
|
|
8
|
+
}
|
|
9
|
+
return new ProdOpentmsRepository();
|
|
10
|
+
}
|
|
@@ -1,31 +1,25 @@
|
|
|
1
|
-
import { BadResponse } from
|
|
2
|
-
import env from
|
|
3
|
-
import
|
|
1
|
+
import { BadResponse } from '../errors';
|
|
2
|
+
import env from '../env';
|
|
3
|
+
import OpentmsRepository from './repository';
|
|
4
4
|
|
|
5
|
-
class
|
|
5
|
+
class ProdOpentmsRepository extends OpentmsRepository {
|
|
6
6
|
async getDemands(): Promise<Array<any>> {
|
|
7
7
|
let myHeaders = new Headers();
|
|
8
|
-
myHeaders.append(
|
|
9
|
-
myHeaders.append(
|
|
8
|
+
myHeaders.append('Accept', 'application/json,');
|
|
9
|
+
myHeaders.append('Content-Type', 'application/json');
|
|
10
10
|
//myHeaders.append("Authorization", `Basic ${TALK_BASE64}`);
|
|
11
11
|
|
|
12
12
|
let requestOptions = {
|
|
13
|
-
method:
|
|
13
|
+
method: 'GET',
|
|
14
14
|
headers: myHeaders,
|
|
15
15
|
};
|
|
16
|
-
const demandProgressStatus =
|
|
17
|
-
return await fetch(
|
|
18
|
-
`${env.API_BASE_URL}/demand?status=${demandProgressStatus}`,
|
|
19
|
-
requestOptions
|
|
20
|
-
)
|
|
16
|
+
const demandProgressStatus = '2';
|
|
17
|
+
return await fetch(`${env.API_BASE_URL}/demand?status=${demandProgressStatus}`, requestOptions)
|
|
21
18
|
.then((response) => {
|
|
22
19
|
if (response.ok) {
|
|
23
20
|
return response.json();
|
|
24
21
|
}
|
|
25
|
-
throw new BadResponse(
|
|
26
|
-
`Impossible de recupérer les démandes (${response.status})`,
|
|
27
|
-
"Opencare"
|
|
28
|
-
);
|
|
22
|
+
throw new BadResponse(`Impossible de recupérer les démandes (${response.status})`, 'Opentms');
|
|
29
23
|
})
|
|
30
24
|
.then(({ results }) => {
|
|
31
25
|
const res: Array<any> = results;
|
|
@@ -33,34 +27,26 @@ class ProdOpencareRepository extends OpencareRepository {
|
|
|
33
27
|
});
|
|
34
28
|
}
|
|
35
29
|
|
|
36
|
-
async getAppointments(
|
|
37
|
-
patientUuid: string,
|
|
38
|
-
doctor?: string
|
|
39
|
-
): Promise<Array<any>> {
|
|
30
|
+
async getAppointments(patientUuid: string, doctor?: string): Promise<Array<any>> {
|
|
40
31
|
let myHeaders = new Headers();
|
|
41
|
-
myHeaders.append(
|
|
42
|
-
myHeaders.append(
|
|
32
|
+
myHeaders.append('Accept', 'application/json,');
|
|
33
|
+
myHeaders.append('Content-Type', 'application/json');
|
|
43
34
|
//myHeaders.append("Authorization", `Basic ${TALK_BASE64}`);
|
|
44
35
|
|
|
45
36
|
let requestOptions = {
|
|
46
|
-
method:
|
|
37
|
+
method: 'GET',
|
|
47
38
|
headers: myHeaders,
|
|
48
39
|
};
|
|
49
40
|
|
|
50
41
|
return await fetch(
|
|
51
|
-
`${env.API_BASE_URL}/patient/${patientUuid}/appointment${
|
|
52
|
-
|
|
53
|
-
}`,
|
|
54
|
-
requestOptions
|
|
42
|
+
`${env.API_BASE_URL}/patient/${patientUuid}/appointment${doctor ? `?doctor=${doctor}` : ''}`,
|
|
43
|
+
requestOptions,
|
|
55
44
|
)
|
|
56
45
|
.then((response) => {
|
|
57
46
|
if (response.ok) {
|
|
58
47
|
return response.json();
|
|
59
48
|
}
|
|
60
|
-
throw new BadResponse(
|
|
61
|
-
`Impossible de recupérer les rencontres (${response.status})`,
|
|
62
|
-
"Opencare"
|
|
63
|
-
);
|
|
49
|
+
throw new BadResponse(`Impossible de recupérer les rencontres (${response.status})`, 'Opentms');
|
|
64
50
|
})
|
|
65
51
|
.then(({ results }) => {
|
|
66
52
|
const res: Array<any> = results;
|
|
@@ -68,11 +54,11 @@ class ProdOpencareRepository extends OpencareRepository {
|
|
|
68
54
|
return {
|
|
69
55
|
uuid: appointment.uuid,
|
|
70
56
|
startDateTime: appointment.startDateTime,
|
|
71
|
-
location:
|
|
57
|
+
location: '',
|
|
72
58
|
service: appointment.service,
|
|
73
59
|
status: appointment.statusProgress,
|
|
74
|
-
appointmentKind:
|
|
75
|
-
comments:
|
|
60
|
+
appointmentKind: 'Scheduled',
|
|
61
|
+
comments: '',
|
|
76
62
|
linkRoom: appointment.linkRoom,
|
|
77
63
|
patientUuid,
|
|
78
64
|
};
|
|
@@ -82,25 +68,19 @@ class ProdOpencareRepository extends OpencareRepository {
|
|
|
82
68
|
|
|
83
69
|
async rejectDemand(demand_id: string): Promise<void> {
|
|
84
70
|
let myHeaders = new Headers();
|
|
85
|
-
myHeaders.append(
|
|
86
|
-
myHeaders.append(
|
|
71
|
+
myHeaders.append('Accept', 'application/json,');
|
|
72
|
+
myHeaders.append('Content-Type', 'application/json');
|
|
87
73
|
//myHeaders.append("Authorization", `Basic ${TALK_BASE64}`);
|
|
88
74
|
|
|
89
75
|
let requestOptions = {
|
|
90
|
-
method:
|
|
76
|
+
method: 'PUT',
|
|
91
77
|
headers: myHeaders,
|
|
92
78
|
};
|
|
93
|
-
await fetch(
|
|
94
|
-
`${env.API_BASE_URL}/demand/${demand_id}/reject`,
|
|
95
|
-
requestOptions
|
|
96
|
-
).then((response) => {
|
|
79
|
+
await fetch(`${env.API_BASE_URL}/demand/${demand_id}/reject`, requestOptions).then((response) => {
|
|
97
80
|
if (response.ok) {
|
|
98
81
|
return response.json();
|
|
99
82
|
}
|
|
100
|
-
throw new BadResponse(
|
|
101
|
-
`Impossible de rejeter la demande (${response.status})`,
|
|
102
|
-
"Opencare"
|
|
103
|
-
);
|
|
83
|
+
throw new BadResponse(`Impossible de rejeter la demande (${response.status})`, 'Opentms');
|
|
104
84
|
});
|
|
105
85
|
}
|
|
106
86
|
|
|
@@ -108,11 +88,11 @@ class ProdOpencareRepository extends OpencareRepository {
|
|
|
108
88
|
demand_id: string,
|
|
109
89
|
doctor_id: string,
|
|
110
90
|
startDate: Date = new Date(),
|
|
111
|
-
duration = 30
|
|
91
|
+
duration = 30,
|
|
112
92
|
): Promise<void> {
|
|
113
93
|
const myHeaders = new Headers();
|
|
114
|
-
myHeaders.append(
|
|
115
|
-
myHeaders.append(
|
|
94
|
+
myHeaders.append('Accept', 'application/json,');
|
|
95
|
+
myHeaders.append('Content-Type', 'application/json');
|
|
116
96
|
|
|
117
97
|
const raw = JSON.stringify({
|
|
118
98
|
doctor_id: doctor_id,
|
|
@@ -121,33 +101,27 @@ class ProdOpencareRepository extends OpencareRepository {
|
|
|
121
101
|
});
|
|
122
102
|
|
|
123
103
|
const requestOptions = {
|
|
124
|
-
method:
|
|
104
|
+
method: 'POST',
|
|
125
105
|
headers: myHeaders,
|
|
126
106
|
body: raw,
|
|
127
107
|
};
|
|
128
108
|
|
|
129
|
-
await fetch(
|
|
130
|
-
`${env.API_BASE_URL}/demand/${demand_id}/validate`,
|
|
131
|
-
requestOptions
|
|
132
|
-
).then((response) => {
|
|
109
|
+
await fetch(`${env.API_BASE_URL}/demand/${demand_id}/validate`, requestOptions).then((response) => {
|
|
133
110
|
if (response.ok) {
|
|
134
111
|
return response.json();
|
|
135
112
|
}
|
|
136
|
-
throw new BadResponse(
|
|
137
|
-
`Impossible de valider la demande (${response.status})`,
|
|
138
|
-
"Opencare"
|
|
139
|
-
);
|
|
113
|
+
throw new BadResponse(`Impossible de valider la demande (${response.status})`, 'Opentms');
|
|
140
114
|
});
|
|
141
115
|
}
|
|
142
116
|
|
|
143
117
|
async getProviders(): Promise<Array<any>> {
|
|
144
118
|
let myHeaders = new Headers();
|
|
145
|
-
myHeaders.append(
|
|
146
|
-
myHeaders.append(
|
|
119
|
+
myHeaders.append('Accept', 'application/json,');
|
|
120
|
+
myHeaders.append('Content-Type', 'application/json');
|
|
147
121
|
//myHeaders.append("Authorization", `Basic ${TALK_BASE64}`);
|
|
148
122
|
|
|
149
123
|
let requestOptions = {
|
|
150
|
-
method:
|
|
124
|
+
method: 'GET',
|
|
151
125
|
headers: myHeaders,
|
|
152
126
|
};
|
|
153
127
|
|
|
@@ -156,10 +130,7 @@ class ProdOpencareRepository extends OpencareRepository {
|
|
|
156
130
|
if (response.ok) {
|
|
157
131
|
return response.json();
|
|
158
132
|
}
|
|
159
|
-
throw new BadResponse(
|
|
160
|
-
`Impossible de recupérer les rencontres (${response.status})`,
|
|
161
|
-
"Opencare"
|
|
162
|
-
);
|
|
133
|
+
throw new BadResponse(`Impossible de recupérer les rencontres (${response.status})`, 'Opentms');
|
|
163
134
|
})
|
|
164
135
|
.then(({ results }) => {
|
|
165
136
|
const res: Array<any> = results;
|
|
@@ -173,4 +144,4 @@ class ProdOpencareRepository extends OpencareRepository {
|
|
|
173
144
|
}
|
|
174
145
|
}
|
|
175
146
|
|
|
176
|
-
export default
|
|
147
|
+
export default ProdOpentmsRepository;
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
2
2
|
|
|
3
|
-
class
|
|
3
|
+
class OpentmsRepository {
|
|
4
4
|
async getDemands(): Promise<Array<any>> {
|
|
5
5
|
return [];
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
async getAppointments(
|
|
9
|
-
patientUuid: string,
|
|
10
|
-
doctor?: string
|
|
11
|
-
): Promise<Array<any>> {
|
|
8
|
+
async getAppointments(patientUuid: string, doctor?: string): Promise<Array<any>> {
|
|
12
9
|
return [];
|
|
13
10
|
}
|
|
14
11
|
|
|
@@ -18,7 +15,7 @@ class OpencareRepository {
|
|
|
18
15
|
demand_id: string,
|
|
19
16
|
doctor_id: string,
|
|
20
17
|
startDate: Date = new Date(),
|
|
21
|
-
duration = 30
|
|
18
|
+
duration = 30,
|
|
22
19
|
): Promise<void> {}
|
|
23
20
|
|
|
24
21
|
async getProviders(): Promise<Array<any>> {
|
|
@@ -27,8 +24,8 @@ class OpencareRepository {
|
|
|
27
24
|
|
|
28
25
|
// must be different for production for the duration of the appointment
|
|
29
26
|
async getTokenNextcloud(username: string): Promise<any> {
|
|
30
|
-
return
|
|
27
|
+
return 'TALK_PASSWORD';
|
|
31
28
|
}
|
|
32
29
|
}
|
|
33
30
|
|
|
34
|
-
export default
|
|
31
|
+
export default OpentmsRepository;
|
package/src/root.component.tsx
CHANGED
|
@@ -8,38 +8,27 @@
|
|
|
8
8
|
* https://openmrs.github.io/openmrs-esm-core/#/main/config
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import React, { useEffect } from
|
|
12
|
-
import { BrowserRouter, Route, Routes } from
|
|
13
|
-
import { Home } from
|
|
14
|
-
import { useConfig } from
|
|
15
|
-
import env from
|
|
11
|
+
import React, { useEffect } from 'react';
|
|
12
|
+
// import { BrowserRouter, Route, Routes } from 'react-router-dom';
|
|
13
|
+
import { Home } from './pages/home/home.component';
|
|
14
|
+
import { useConfig } from '@openmrs/esm-framework';
|
|
15
|
+
import env from './repositories/env';
|
|
16
16
|
// import { useTranslation } from "react-i18next";
|
|
17
17
|
//import styles from "./root.scss";
|
|
18
18
|
|
|
19
19
|
const Root: React.FC = () => {
|
|
20
|
-
// const { t } = useTranslation();
|
|
21
|
-
//const basename = window.getOpenmrsSpaBase() + "home/opencare";
|
|
22
|
-
const basename = window.getOpenmrsSpaBase() + "opencare";
|
|
23
|
-
|
|
24
20
|
//recupération de la configuration
|
|
25
21
|
const conf = useConfig();
|
|
26
22
|
|
|
27
23
|
// update env variable
|
|
28
24
|
useEffect(() => {
|
|
29
|
-
env.API_SECURE = conf[
|
|
30
|
-
env.API_BASE_URL = conf[
|
|
25
|
+
env.API_SECURE = conf['API_SECURE'];
|
|
26
|
+
env.API_BASE_URL = conf['API_BASE_URL'];
|
|
31
27
|
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
32
28
|
return () => {};
|
|
33
29
|
}, [conf]);
|
|
34
30
|
|
|
35
|
-
return
|
|
36
|
-
<BrowserRouter basename={basename}>
|
|
37
|
-
<Routes>
|
|
38
|
-
{/* Route de la page d'acceuil */}
|
|
39
|
-
<Route path="/home" element={<Home />} />
|
|
40
|
-
</Routes>
|
|
41
|
-
</BrowserRouter>
|
|
42
|
-
);
|
|
31
|
+
return <Home />;
|
|
43
32
|
};
|
|
44
33
|
|
|
45
34
|
export default Root;
|
package/src/root.scss
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
@use '@carbon/
|
|
2
|
-
@use '@carbon/
|
|
1
|
+
@use '@carbon/layout';
|
|
2
|
+
@use '@carbon/type';
|
|
3
3
|
|
|
4
4
|
.container {
|
|
5
|
-
padding:
|
|
5
|
+
padding: layout.$spacing-07;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
.welcome {
|
|
9
9
|
@include type.type-style('heading-04');
|
|
10
|
-
margin:
|
|
10
|
+
margin: layout.$spacing-05 0;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
.explainer {
|
|
14
|
-
margin-bottom:
|
|
14
|
+
margin-bottom: layout.$spacing-07;
|
|
15
15
|
}
|
package/src/root.test.tsx
CHANGED
|
@@ -21,11 +21,11 @@
|
|
|
21
21
|
* Kent C. Dodds is the inventor of `@testing-library`:
|
|
22
22
|
* https://testing-library.com/docs/guiding-principles
|
|
23
23
|
*/
|
|
24
|
-
import React from
|
|
25
|
-
import { render, screen } from
|
|
26
|
-
import { useConfig } from
|
|
27
|
-
import { type Config } from
|
|
28
|
-
import Root from
|
|
24
|
+
import React from 'react';
|
|
25
|
+
import { render, screen } from '@testing-library/react';
|
|
26
|
+
import { useConfig } from '@openmrs/esm-framework';
|
|
27
|
+
import { type Config } from './config-schema';
|
|
28
|
+
import Root from './root.component';
|
|
29
29
|
|
|
30
30
|
/**
|
|
31
31
|
* This is an idiomatic way of dealing with mocked files. Note that
|
|
@@ -34,18 +34,13 @@ import Root from "./root.component";
|
|
|
34
34
|
* mock file. This line just tells TypeScript that the object is, in
|
|
35
35
|
* fact, a mock, and so will have methods like `mockReturnValue`.
|
|
36
36
|
*/
|
|
37
|
-
const mockUseConfig =
|
|
37
|
+
const mockUseConfig = jest.mocked(useConfig<Config>);
|
|
38
38
|
|
|
39
|
-
it(
|
|
40
|
-
const config: Config = {
|
|
41
|
-
API_SECURE: "Admin123",
|
|
42
|
-
API_BASE_URL: "admin",
|
|
43
|
-
};
|
|
39
|
+
it('renders a landing page for the opentms app', () => {
|
|
40
|
+
const config: Config = { API_BASE_URL: 'http://localhost:8080', API_SECURE: '*******************' };
|
|
44
41
|
mockUseConfig.mockReturnValue(config);
|
|
45
42
|
|
|
46
43
|
render(<Root />);
|
|
47
44
|
|
|
48
|
-
expect(
|
|
49
|
-
screen.getByRole("heading", { name: /welcome to the o3 opencare app/i })
|
|
50
|
-
).toBeInTheDocument();
|
|
45
|
+
expect(screen.getByRole('heading', { name: /Welcome to opentms app/i })).toBeInTheDocument();
|
|
51
46
|
});
|
package/src/routes.json
CHANGED
|
@@ -7,22 +7,17 @@
|
|
|
7
7
|
"extensions": [
|
|
8
8
|
{
|
|
9
9
|
"component": "demandtab",
|
|
10
|
-
"name": "
|
|
11
|
-
"slot": "
|
|
10
|
+
"name": "opentms-demand-tab",
|
|
11
|
+
"slot": "service-queues-dashboard-slot"
|
|
12
12
|
},
|
|
13
13
|
{
|
|
14
14
|
"component": "appointmenttab",
|
|
15
|
-
"name": "
|
|
15
|
+
"name": "opentms-appointment-tab",
|
|
16
16
|
"slot": "patient-chart-appointments-dashboard-slot"
|
|
17
17
|
},
|
|
18
|
-
{
|
|
19
|
-
"component": "root",
|
|
20
|
-
"name": "opencare-dashboard",
|
|
21
|
-
"slot": "opencare-dashboard-slot"
|
|
22
|
-
},
|
|
23
18
|
{
|
|
24
19
|
"component": "meetiframe",
|
|
25
|
-
"name": "
|
|
20
|
+
"name": "opentms-meet-iframe",
|
|
26
21
|
"meta": {
|
|
27
22
|
"title": {
|
|
28
23
|
"key": "meetWorkspace",
|
|
@@ -32,13 +27,13 @@
|
|
|
32
27
|
},
|
|
33
28
|
{
|
|
34
29
|
"component": "validatedemandform",
|
|
35
|
-
"name": "
|
|
30
|
+
"name": "opentms-validate-demand-form"
|
|
36
31
|
}
|
|
37
32
|
],
|
|
38
33
|
"pages": [
|
|
39
34
|
{
|
|
40
35
|
"component": "root",
|
|
41
|
-
"route": "
|
|
36
|
+
"route": "root"
|
|
42
37
|
}
|
|
43
38
|
]
|
|
44
39
|
}
|
package/src/services/doctor.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import type OpencareRepository from "../repositories/Opencare/repository";
|
|
1
|
+
import { getOpentmsRepository } from '../repositories/opentms';
|
|
2
|
+
import type OpentmsRepository from '../repositories/opentms/repository';
|
|
4
3
|
|
|
5
4
|
export enum AppointmentTypes {
|
|
6
5
|
UPCOMING = 0,
|
|
@@ -11,10 +10,10 @@ export enum AppointmentTypes {
|
|
|
11
10
|
class DoctorService {
|
|
12
11
|
static instance: DoctorService | null = null;
|
|
13
12
|
|
|
14
|
-
|
|
13
|
+
Opentms_rep: OpentmsRepository;
|
|
15
14
|
|
|
16
15
|
constructor() {
|
|
17
|
-
this.
|
|
16
|
+
this.Opentms_rep = getOpentmsRepository('good');
|
|
18
17
|
}
|
|
19
18
|
|
|
20
19
|
/**
|
|
@@ -37,7 +36,7 @@ class DoctorService {
|
|
|
37
36
|
*/
|
|
38
37
|
async getDemands(istoday = false): Promise<Array<any>> {
|
|
39
38
|
try {
|
|
40
|
-
return await this.
|
|
39
|
+
return await this.Opentms_rep.getDemands();
|
|
41
40
|
} catch (error) {
|
|
42
41
|
/* console.log(error); */
|
|
43
42
|
return null;
|
|
@@ -50,7 +49,7 @@ class DoctorService {
|
|
|
50
49
|
*/
|
|
51
50
|
async rejectDemand(demand_id: string): Promise<any> {
|
|
52
51
|
try {
|
|
53
|
-
await this.
|
|
52
|
+
await this.Opentms_rep.rejectDemand(demand_id);
|
|
54
53
|
return true;
|
|
55
54
|
} catch (error) {
|
|
56
55
|
/* console.log(error); */
|
|
@@ -66,15 +65,10 @@ class DoctorService {
|
|
|
66
65
|
demand_id: string,
|
|
67
66
|
doctor_id: string,
|
|
68
67
|
startDate: Date = new Date(),
|
|
69
|
-
duration = 30
|
|
68
|
+
duration = 30,
|
|
70
69
|
): Promise<any> {
|
|
71
70
|
try {
|
|
72
|
-
await this.
|
|
73
|
-
demand_id,
|
|
74
|
-
doctor_id,
|
|
75
|
-
startDate,
|
|
76
|
-
duration
|
|
77
|
-
);
|
|
71
|
+
await this.Opentms_rep.vaidateDemand(demand_id, doctor_id, startDate, duration);
|
|
78
72
|
return true;
|
|
79
73
|
} catch (error) {
|
|
80
74
|
/* console.log(error); */
|
|
@@ -87,19 +81,16 @@ class DoctorService {
|
|
|
87
81
|
* @param patientUuid patient uuid
|
|
88
82
|
* @returns
|
|
89
83
|
*/
|
|
90
|
-
async getAppointments(
|
|
91
|
-
patientUuid: string,
|
|
92
|
-
doctor?: string
|
|
93
|
-
): Promise<Map<number, Array<any>>> {
|
|
84
|
+
async getAppointments(patientUuid: string, doctor?: string): Promise<Map<number, Array<any>>> {
|
|
94
85
|
try {
|
|
95
86
|
const past = [];
|
|
96
87
|
const today = [];
|
|
97
88
|
const upcoming = [];
|
|
98
89
|
|
|
99
|
-
const res = await this.
|
|
90
|
+
const res = await this.Opentms_rep.getAppointments(patientUuid, doctor);
|
|
100
91
|
let datenow = new Date();
|
|
101
92
|
res.forEach((appointment, i) => {
|
|
102
|
-
if (appointment.status !=
|
|
93
|
+
if (appointment.status != 'Cancelled') {
|
|
103
94
|
const dateappt = new Date(appointment.startDateTime);
|
|
104
95
|
|
|
105
96
|
// eslint-disable-next-line no-console
|
|
@@ -145,7 +136,7 @@ class DoctorService {
|
|
|
145
136
|
|
|
146
137
|
async getProviders(): Promise<Array<any>> {
|
|
147
138
|
try {
|
|
148
|
-
return await this.
|
|
139
|
+
return await this.Opentms_rep.getProviders();
|
|
149
140
|
} catch (error) {
|
|
150
141
|
/* console.log(error); */
|
|
151
142
|
return null;
|
|
@@ -158,7 +149,7 @@ class DoctorService {
|
|
|
158
149
|
* @returns
|
|
159
150
|
*/
|
|
160
151
|
async getTokenNextcloud(username: string): Promise<string> {
|
|
161
|
-
return await this.
|
|
152
|
+
return await this.Opentms_rep.getTokenNextcloud(username);
|
|
162
153
|
}
|
|
163
154
|
}
|
|
164
155
|
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
-
contextSeparator:
|
|
2
|
+
contextSeparator: '_',
|
|
3
3
|
// Key separator used in your translation keys
|
|
4
4
|
|
|
5
5
|
createOldCatalogs: false,
|
|
6
6
|
// Save the \_old files
|
|
7
7
|
|
|
8
|
-
defaultNamespace:
|
|
8
|
+
defaultNamespace: 'translations',
|
|
9
9
|
// Default namespace used in your i18next config
|
|
10
10
|
|
|
11
|
-
defaultValue:
|
|
11
|
+
defaultValue: '',
|
|
12
12
|
// Default value to give to empty keys
|
|
13
13
|
// You may also specify a function accepting the locale, namespace, and key as arguments
|
|
14
14
|
|
|
@@ -18,43 +18,43 @@ module.exports = {
|
|
|
18
18
|
keepRemoved: false,
|
|
19
19
|
// Keep keys from the catalog that are no longer in code
|
|
20
20
|
|
|
21
|
-
keySeparator:
|
|
21
|
+
keySeparator: '.',
|
|
22
22
|
// Key separator used in your translation keys
|
|
23
23
|
// If you want to use plain english keys, separators such as `.` and `:` will conflict. You might want to set `keySeparator: false` and `namespaceSeparator: false`. That way, `t('Status: Loading...')` will not think that there are a namespace and three separator dots for instance.
|
|
24
24
|
|
|
25
25
|
// see below for more details
|
|
26
26
|
lexers: {
|
|
27
|
-
hbs: [
|
|
28
|
-
handlebars: [
|
|
27
|
+
hbs: ['HandlebarsLexer'],
|
|
28
|
+
handlebars: ['HandlebarsLexer'],
|
|
29
29
|
|
|
30
|
-
htm: [
|
|
31
|
-
html: [
|
|
30
|
+
htm: ['HTMLLexer'],
|
|
31
|
+
html: ['HTMLLexer'],
|
|
32
32
|
|
|
33
|
-
mjs: [
|
|
34
|
-
js: [
|
|
35
|
-
ts: [
|
|
36
|
-
jsx: [
|
|
37
|
-
tsx: [
|
|
33
|
+
mjs: ['JavascriptLexer'],
|
|
34
|
+
js: ['JavascriptLexer'], // if you're writing jsx inside .js files, change this to JsxLexer
|
|
35
|
+
ts: ['JavascriptLexer'],
|
|
36
|
+
jsx: ['JsxLexer'],
|
|
37
|
+
tsx: ['JsxLexer'],
|
|
38
38
|
|
|
39
|
-
default: [
|
|
39
|
+
default: ['JavascriptLexer'],
|
|
40
40
|
},
|
|
41
41
|
|
|
42
|
-
lineEnding:
|
|
42
|
+
lineEnding: 'auto',
|
|
43
43
|
// Control the line ending. See options at https://github.com/ryanve/eol
|
|
44
44
|
|
|
45
|
-
locales: [
|
|
45
|
+
locales: ['en'],
|
|
46
46
|
// An array of the locales in your applications
|
|
47
47
|
|
|
48
|
-
namespaceSeparator:
|
|
48
|
+
namespaceSeparator: ':',
|
|
49
49
|
// Namespace separator used in your translation keys
|
|
50
50
|
// If you want to use plain english keys, separators such as `.` and `:` will conflict. You might want to set `keySeparator: false` and `namespaceSeparator: false`. That way, `t('Status: Loading...')` will not think that there are a namespace and three separator dots for instance.
|
|
51
51
|
|
|
52
|
-
output:
|
|
52
|
+
output: '$NAMESPACE/$LOCALE.json',
|
|
53
53
|
// Supports $LOCALE and $NAMESPACE injection
|
|
54
54
|
// Supports JSON (.json) and YAML (.yml) file formats
|
|
55
55
|
// Where to write the locale files relative to process.cwd()
|
|
56
56
|
|
|
57
|
-
pluralSeparator:
|
|
57
|
+
pluralSeparator: '_',
|
|
58
58
|
// Plural separator used in your translation keys
|
|
59
59
|
// If you want to use plain english keys, separators such as `_` might conflict. You might want to set `pluralSeparator` to a different string that does not occur in your keys.
|
|
60
60
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|