@ampath/esm-dha-workflow-app 4.0.0-next.4 → 4.0.0-next.40
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/dist/104.js +2 -0
- package/dist/104.js.LICENSE.txt +9 -0
- package/dist/104.js.map +1 -0
- package/dist/15.js +1 -0
- package/dist/15.js.map +1 -0
- package/dist/246.js +2 -0
- package/dist/246.js.LICENSE.txt +54 -0
- package/dist/246.js.map +1 -0
- package/dist/327.js +1 -0
- package/dist/327.js.map +1 -0
- package/dist/339.js +1 -0
- package/dist/339.js.map +1 -0
- package/dist/701.js +1 -0
- package/dist/701.js.map +1 -0
- package/dist/709.js +1 -0
- package/dist/709.js.map +1 -0
- package/dist/710.js +2 -0
- package/dist/710.js.map +1 -0
- package/dist/729.js +1 -0
- package/dist/729.js.map +1 -0
- package/dist/752.js +1 -0
- package/dist/752.js.map +1 -0
- package/dist/833.js +1 -0
- package/dist/833.js.map +1 -0
- package/dist/91.js +1 -1
- package/dist/91.js.map +1 -1
- package/dist/93.js +1 -0
- package/dist/93.js.map +1 -0
- package/dist/esm-dha-workflow-app.js +1 -0
- package/dist/{openmrs-esm-home-app.js.buildmanifest.json → esm-dha-workflow-app.js.buildmanifest.json} +293 -54
- package/dist/{openmrs-esm-home-app.js.map → esm-dha-workflow-app.js.map} +1 -1
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/routes.json +1 -1
- package/package.json +3 -3
- package/src/accounting/accounting.component.tsx +13 -0
- package/src/appointments/appointments.component.tsx +13 -0
- package/src/bookings/daily/daily-bookings.component.scss +38 -0
- package/src/bookings/daily/daily-bookings.component.tsx +138 -0
- package/src/bookings/daily/daily-bookings.resource.ts +27 -0
- package/src/bookings/daily/filters/daily-bookings-filter.component.scss +15 -0
- package/src/bookings/daily/filters/daily-bookings-filter.component.tsx +80 -0
- package/src/bookings/daily/patient-list/daily-bookings-patient-list.component.tsx +97 -0
- package/src/bookings/types/index.ts +68 -0
- package/src/config-schema.ts +132 -32
- package/src/dashboard/dashboard.component.scss +7 -0
- package/src/dashboard/dashboard.component.tsx +63 -0
- package/src/dashboard/overview/overview.component.scss +70 -0
- package/src/dashboard/overview/overview.component.tsx +107 -0
- package/src/dashboard/patient-list/patient-list.component.tsx +41 -0
- package/src/hooks/useActions.ts +165 -0
- package/src/index.ts +23 -2
- package/src/laboratory/laboratory.component.tsx +13 -0
- package/src/left-panel/left-panel.component.tsx +20 -0
- package/src/left-panel/left-panel.scss +42 -0
- package/src/mch/queues/consultation/mch-consultation.tsx +18 -0
- package/src/mch/queues/triage/mch-triage.tsx +15 -0
- package/src/modals/sign-off-modal.scss +7 -0
- package/src/modals/sign-off-modal.tsx +52 -0
- package/src/pharmacy/pharmacy.component.tsx +13 -0
- package/src/registry/client-details/client-details.tsx +40 -0
- package/src/registry/modal/client-details-modal/client-details-modal.scss +28 -0
- package/src/registry/modal/client-details-modal/client-details-modal.tsx +81 -0
- package/src/registry/modal/otp-verification-modal/otp-verification-modal.scss +31 -0
- package/src/registry/modal/otp-verification-modal/otp-verification-modal.tsx +186 -0
- package/src/registry/modal/send-to-triage/send-to-triage.modal.scss +34 -0
- package/src/registry/modal/send-to-triage/send-to-triage.modal.tsx +302 -0
- package/src/registry/payment-details/payment-options/payment-options.tsx +21 -0
- package/src/registry/registry.component.scss +83 -0
- package/src/registry/registry.component.tsx +397 -2
- package/src/registry/registry.resource.ts +60 -0
- package/src/registry/types/index.ts +309 -0
- package/src/registry/utils/error-handler.ts +37 -0
- package/src/registry/utils/format-dependant-display-data.ts +8 -0
- package/src/registry/utils/hie-adapter.ts +56 -0
- package/src/registry/utils/hie-client-adapter.ts +309 -0
- package/src/registry/utils/mask-data.ts +21 -0
- package/src/resources/hie-amrs-automatic-registration.service.ts +16 -0
- package/src/resources/identifier-types.ts +27 -0
- package/src/resources/patient-resource.ts +62 -0
- package/src/resources/patient-search.resource.ts +22 -0
- package/src/resources/queue.resource.ts +60 -0
- package/src/resources/visit.resource.ts +38 -0
- package/src/root.component.tsx +40 -30
- package/src/root.scss +5 -9
- package/src/routes.json +43 -4
- package/src/service-queues/action-button.component.tsx +34 -0
- package/src/service-queues/action-overflow-menu-item.component.tsx +34 -0
- package/src/service-queues/consultation/consultation.component.scss +7 -0
- package/src/service-queues/consultation/consultation.component.tsx +15 -0
- package/src/service-queues/metrics/metrics-cards/attended-patients.extension.tsx +38 -0
- package/src/service-queues/metrics/metrics-cards/metrics-card.component.tsx +86 -0
- package/src/service-queues/metrics/metrics-cards/metrics-card.scss +106 -0
- package/src/service-queues/metrics/metrics-cards/waiting-patients.extension.tsx +34 -0
- package/src/service-queues/metrics/metrics-container.component.tsx +23 -0
- package/src/service-queues/metrics/metrics-container.scss +36 -0
- package/src/service-queues/metrics/metrics.resource.ts +65 -0
- package/src/service-queues/modals/move/move-patient.component.scss +35 -0
- package/src/service-queues/modals/move/move-patient.component.tsx +138 -0
- package/src/service-queues/modals/serve/serve-patient.comppnent.scss +0 -0
- package/src/service-queues/modals/serve/serve-patient.comppnent.tsx +80 -0
- package/src/service-queues/modals/sign-off/sign-off.modal.scss +0 -0
- package/src/service-queues/modals/sign-off/sign-off.modal.tsx +79 -0
- package/src/service-queues/modals/transition/transition-patient.component.scss +0 -0
- package/src/service-queues/modals/transition/transition-patient.component.tsx +122 -0
- package/src/service-queues/queue-list/queue-list.component.scss +19 -0
- package/src/service-queues/queue-list/queue-list.component.tsx +169 -0
- package/src/service-queues/queue-room.component.tsx +39 -0
- package/src/service-queues/room/room.component.tsx +58 -0
- package/src/service-queues/service-queue/service-queue.component.scss +14 -0
- package/src/service-queues/service-queue/service-queue.component.tsx +245 -0
- package/src/service-queues/service-queue/stats/stat-card/stat-card.component.scss +10 -0
- package/src/service-queues/service-queue/stats/stat-card/stat-card.component.tsx +23 -0
- package/src/service-queues/service-queue/stats/stat-details/stat-details.component.scss +7 -0
- package/src/service-queues/service-queue/stats/stat-details/stat-details.component.tsx +34 -0
- package/src/service-queues/service-queue.scss +27 -0
- package/src/service-queues/service-queue.tsx +31 -0
- package/src/service-queues/service-queues.resource.ts +177 -0
- package/src/service-queues/service.resource.ts +28 -0
- package/src/shared/constants/civil-status.ts +29 -0
- package/src/shared/constants/concepts.ts +30 -0
- package/src/shared/constants/index.ts +1 -0
- package/src/shared/constants/person-attributes.ts +33 -0
- package/src/shared/services/location.resource.ts +9 -0
- package/src/shared/ui/otp-input/otp-input.component.scss +14 -0
- package/src/shared/ui/otp-input/otp-input.component.tsx +90 -0
- package/src/shared/ui/timer/timer.component.scss +5 -0
- package/src/shared/ui/timer/timer.component.tsx +40 -0
- package/src/shared/utils/get-base-url.ts +17 -0
- package/src/side-nav-menu/nav-link-config.ts +82 -0
- package/src/side-nav-menu/nav-links.tsx +31 -11
- package/src/triage/metrics/attended-patients.extension.tsx +42 -0
- package/src/triage/metrics/metrics.scss +36 -0
- package/src/triage/metrics/triage-metrics.component.tsx +21 -0
- package/src/triage/metrics/waiting-patients.extension.tsx +39 -0
- package/src/triage/room/room.scss +29 -0
- package/src/triage/triage.component.tsx +15 -0
- package/src/triage/triage.resource.ts +19 -0
- package/src/triage/types.ts +16 -0
- package/src/types/types.ts +128 -0
- package/dist/561.js +0 -2
- package/dist/561.js.map +0 -1
- package/dist/70.js +0 -1
- package/dist/70.js.map +0 -1
- package/dist/731.js +0 -2
- package/dist/731.js.LICENSE.txt +0 -39
- package/dist/731.js.map +0 -1
- package/dist/819.js +0 -1
- package/dist/819.js.map +0 -1
- package/dist/openmrs-esm-home-app.js +0 -1
- package/src/boxes/extensions/blue-box.component.tsx +0 -15
- package/src/boxes/extensions/box.scss +0 -23
- package/src/boxes/extensions/brand-box.component.tsx +0 -15
- package/src/boxes/extensions/red-box.component.tsx +0 -15
- package/src/boxes/slot/boxes.component.tsx +0 -25
- package/src/boxes/slot/boxes.scss +0 -29
- package/src/greeter/greeter.component.tsx +0 -42
- package/src/greeter/greeter.scss +0 -20
- package/src/greeter/greeter.test.tsx +0 -28
- package/src/patient-getter/patient-getter.component.tsx +0 -40
- package/src/patient-getter/patient-getter.resource.ts +0 -39
- package/src/patient-getter/patient-getter.scss +0 -16
- package/src/patient-getter/patient-getter.test.tsx +0 -40
- package/src/resources/resources.component.tsx +0 -56
- package/src/resources/resources.scss +0 -68
- /package/dist/{561.js.LICENSE.txt → 710.js.LICENSE.txt} +0 -0
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/* Extensions should supply the minimum amount of styling
|
|
2
|
-
* necessary. Here, the extensions set only their colors.
|
|
3
|
-
* Their sizes and other general features of their display
|
|
4
|
-
* is controlled by the slot. */
|
|
5
|
-
@use "@carbon/layout";
|
|
6
|
-
@use '@openmrs/esm-styleguide/src/vars' as *;
|
|
7
|
-
|
|
8
|
-
.blue {
|
|
9
|
-
background-color: darkblue;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
.red {
|
|
13
|
-
background-color: darkred;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
/* Brand colors are special. They must be included using a
|
|
17
|
-
* SASS mix-in (shown here) or using a CSS variable like
|
|
18
|
-
* `var(--brand-01)`. */
|
|
19
|
-
.brand {
|
|
20
|
-
@include brand-01(background-color);
|
|
21
|
-
color: white;
|
|
22
|
-
padding: layout.$spacing-03;
|
|
23
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This component demonstrates the creation of an extension.
|
|
3
|
-
*
|
|
4
|
-
* Check out the Extension System docs:
|
|
5
|
-
* https://o3-docs.vercel.app/docs/extension-system
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import React from 'react';
|
|
9
|
-
import styles from './box.scss';
|
|
10
|
-
|
|
11
|
-
const RedBox: React.FC = () => {
|
|
12
|
-
return <div className={styles.brand}></div>;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export default RedBox;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This component demonstrates the creation of an extension.
|
|
3
|
-
*
|
|
4
|
-
* Check out the Extension System docs:
|
|
5
|
-
* https://o3-docs.vercel.app/docs/extension-system
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import React from 'react';
|
|
9
|
-
import styles from './box.scss';
|
|
10
|
-
|
|
11
|
-
const RedBox: React.FC = () => {
|
|
12
|
-
return <div className={styles.red}></div>;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export default RedBox;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { useTranslation } from 'react-i18next';
|
|
3
|
-
import { Extension, ExtensionSlot } from '@openmrs/esm-framework';
|
|
4
|
-
import styles from './boxes.scss';
|
|
5
|
-
|
|
6
|
-
export const Boxes: React.FC = () => {
|
|
7
|
-
const { t } = useTranslation();
|
|
8
|
-
|
|
9
|
-
return (
|
|
10
|
-
<div className={styles.container}>
|
|
11
|
-
<h5>{t('extensionSystem', 'Extension system')}</h5>
|
|
12
|
-
<p>
|
|
13
|
-
{t(
|
|
14
|
-
'extensionExplainer',
|
|
15
|
-
'Here are some colored boxes. Because they are attached as extensions within a slot, an admin can change what boxes are shown using configuration. These boxes happen to be defined in this module, but they could attach to this slot even if they were in a different module.',
|
|
16
|
-
)}
|
|
17
|
-
</p>
|
|
18
|
-
<ExtensionSlot name="Boxes" className={styles.boxes}>
|
|
19
|
-
<div className={styles.box}>
|
|
20
|
-
<Extension />
|
|
21
|
-
</div>
|
|
22
|
-
</ExtensionSlot>
|
|
23
|
-
</div>
|
|
24
|
-
);
|
|
25
|
-
};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/* General features of extension styling are controlled
|
|
2
|
-
* at the slot level. The boxes should know as little as
|
|
3
|
-
* possible about the context where they are used, so
|
|
4
|
-
* they do not set their own sizes.
|
|
5
|
-
*
|
|
6
|
-
* `> * > *` is used to target the outermost DOM node of
|
|
7
|
-
* the extension.
|
|
8
|
-
*/
|
|
9
|
-
@use '@carbon/layout';
|
|
10
|
-
|
|
11
|
-
.box > * > * {
|
|
12
|
-
height: layout.$spacing-10;
|
|
13
|
-
width: layout.$spacing-10;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
.boxes {
|
|
17
|
-
margin: layout.$spacing-07 0;
|
|
18
|
-
display: flex;
|
|
19
|
-
gap: layout.$spacing-05;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
.container {
|
|
23
|
-
max-width: 50rem;
|
|
24
|
-
margin-top: layout.$spacing-09;
|
|
25
|
-
|
|
26
|
-
> * + * {
|
|
27
|
-
margin-top: layout.$spacing-06;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This component demonstrates usage of the config object. Its structure
|
|
3
|
-
* comes from `../config-schema.ts`. For more information about the
|
|
4
|
-
* configuration system, read the docs: https://o3-docs.vercel.app/docs/configuration-system
|
|
5
|
-
*/
|
|
6
|
-
import React from 'react';
|
|
7
|
-
import { Tile } from '@carbon/react';
|
|
8
|
-
import { Trans, useTranslation } from 'react-i18next';
|
|
9
|
-
import { useConfig } from '@openmrs/esm-framework';
|
|
10
|
-
import { type Config } from '../config-schema';
|
|
11
|
-
import styles from './greeter.scss';
|
|
12
|
-
|
|
13
|
-
const Greeter: React.FC = () => {
|
|
14
|
-
const { t } = useTranslation();
|
|
15
|
-
const config: Config = useConfig();
|
|
16
|
-
|
|
17
|
-
return (
|
|
18
|
-
<div className={styles.container}>
|
|
19
|
-
<h5>{t('configSystem', 'Configuration system')}</h5>
|
|
20
|
-
<p>
|
|
21
|
-
<Trans key="configSystemExplainer">
|
|
22
|
-
The greeting shown below is driven by the configuration system. To change the configuration properties, click
|
|
23
|
-
the spanner icon in the navbar to pull up the Implementer Tools panel. Then, type <em>template</em> into the{' '}
|
|
24
|
-
<em>Search configuration</em> input. This should filter the configuration properties to show only those that
|
|
25
|
-
are relevant to this module. You can change the values of these properties and click <em>Save</em> to see the
|
|
26
|
-
changes reflected in the UI
|
|
27
|
-
</Trans>
|
|
28
|
-
.
|
|
29
|
-
</p>
|
|
30
|
-
<div className={styles.greeting}>
|
|
31
|
-
<Tile className={styles.tile}>
|
|
32
|
-
{config.casualGreeting ? <Trans key="casualGreeting">hey</Trans> : <Trans key="formalGreeting">hello</Trans>}{' '}
|
|
33
|
-
{/* t('world') */}
|
|
34
|
-
{config.whoToGreet.join(', ')}!
|
|
35
|
-
</Tile>
|
|
36
|
-
</div>
|
|
37
|
-
<br />
|
|
38
|
-
</div>
|
|
39
|
-
);
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
export default Greeter;
|
package/src/greeter/greeter.scss
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
@use '@carbon/layout';
|
|
2
|
-
@use '@carbon/type';
|
|
3
|
-
|
|
4
|
-
.container {
|
|
5
|
-
max-width: 50rem;
|
|
6
|
-
|
|
7
|
-
> * + * {
|
|
8
|
-
margin-top: layout.$spacing-05;
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
.greeting {
|
|
13
|
-
text-transform: capitalize;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
.tile {
|
|
17
|
-
border: 1px solid lightgray;
|
|
18
|
-
max-width: 15rem;
|
|
19
|
-
@include type.type-style('heading-compact-01');
|
|
20
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { render, screen } from '@testing-library/react';
|
|
3
|
-
import { useConfig } from '@openmrs/esm-framework';
|
|
4
|
-
import { Config } from '../config-schema';
|
|
5
|
-
import Greeter from './greeter.component';
|
|
6
|
-
|
|
7
|
-
const mockUseConfig = jest.mocked(useConfig<Config>);
|
|
8
|
-
|
|
9
|
-
it('displays the expected default text', () => {
|
|
10
|
-
const config: Config = { casualGreeting: false, whoToGreet: ['World'] };
|
|
11
|
-
mockUseConfig.mockReturnValue(config);
|
|
12
|
-
|
|
13
|
-
render(<Greeter />);
|
|
14
|
-
|
|
15
|
-
expect(screen.getByText(/world/i)).toHaveTextContent('hello World!');
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
it('casually greets my friends', () => {
|
|
19
|
-
const config: Config = {
|
|
20
|
-
casualGreeting: true,
|
|
21
|
-
whoToGreet: ['Ariel', 'Barak', 'Callum'],
|
|
22
|
-
};
|
|
23
|
-
mockUseConfig.mockReturnValue(config);
|
|
24
|
-
|
|
25
|
-
render(<Greeter />);
|
|
26
|
-
|
|
27
|
-
expect(screen.getByText(/ariel/i)).toHaveTextContent('hey Ariel, Barak, Callum!');
|
|
28
|
-
});
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Components that make queries delegate the query-making logic to a
|
|
3
|
-
* `.resource.ts` function. This component leverages the`usePatient`
|
|
4
|
-
* hook to fetch a patient from the backend. When the button is clicked,
|
|
5
|
-
* the `patientName` variable is set to "test", which triggers the hook
|
|
6
|
-
* to make a request to the backend. The hook returns patient data from the
|
|
7
|
-
* request, which is then rendered in the UI. The hook also returns a boolean
|
|
8
|
-
* property called `isLoading` that is set to true while the request is being
|
|
9
|
-
* made. This component renders a loading indicator while `isLoading` is true.
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
import React, { useState } from 'react';
|
|
13
|
-
import { Button, InlineLoading, Tile } from '@carbon/react';
|
|
14
|
-
import { useTranslation } from 'react-i18next';
|
|
15
|
-
import { usePatient } from './patient-getter.resource';
|
|
16
|
-
import styles from './patient-getter.scss';
|
|
17
|
-
|
|
18
|
-
function PatientGetter() {
|
|
19
|
-
const { t } = useTranslation();
|
|
20
|
-
const [patientName, setPatientName] = useState(null);
|
|
21
|
-
const { patient, isLoading } = usePatient(patientName);
|
|
22
|
-
|
|
23
|
-
return (
|
|
24
|
-
<div className={styles.container}>
|
|
25
|
-
<h5>{t('dataFetching', 'Data fetching')}</h5>
|
|
26
|
-
<p>{t('patientGetterExplainer', 'Try clicking the button below to fetch a patient from the backend')}:</p>
|
|
27
|
-
<Button onClick={() => setPatientName('test')}>{t('getPatient', 'Get a patient named')} 'test'</Button>
|
|
28
|
-
{isLoading ? <InlineLoading description={t('loading', 'Loading') + '...'} role="progressbar" /> : null}
|
|
29
|
-
{patient ? (
|
|
30
|
-
<Tile className={styles.tile}>
|
|
31
|
-
{patient
|
|
32
|
-
? `${patient.name[0].given} ${patient.name[0].family} / ${patient.gender} / ${patient.birthDate}`
|
|
33
|
-
: null}
|
|
34
|
-
</Tile>
|
|
35
|
-
) : null}
|
|
36
|
-
</div>
|
|
37
|
-
);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export default PatientGetter;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import useSWR from 'swr';
|
|
2
|
-
import { fhirBaseUrl, openmrsFetch } from '@openmrs/esm-framework';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* This hook searches for a patient using the provided search term from the
|
|
6
|
-
* OpenMRS FHIR API.It leverages the useSWR hook from the SWR library
|
|
7
|
-
* https://swr.vercel.app/docs/data-fetching to fetch data. SWR provides a
|
|
8
|
-
* number of benefits over the standard React useEffect hook, including:
|
|
9
|
-
*
|
|
10
|
-
* - Fast, lightweight and reusable data fetching
|
|
11
|
-
* - Built-in cache and request deduplication
|
|
12
|
-
* - Real-time updates
|
|
13
|
-
* - Simplified error and loading state handling, and more.
|
|
14
|
-
*
|
|
15
|
-
* We recommend using SWR for data fetching in your OpenMRS frontend modules.
|
|
16
|
-
*
|
|
17
|
-
* See the docs for the underlying fhir.js Client object: https://github.com/FHIR/fhir.js#api
|
|
18
|
-
* See the OpenMRS FHIR Module docs: https://wiki.openmrs.org/display/projects/OpenMRS+FHIR+Module
|
|
19
|
-
* See the OpenMRS REST API docs: https://rest.openmrs.org/#openmrs-rest-api
|
|
20
|
-
*
|
|
21
|
-
* @param query A patient name or ID
|
|
22
|
-
* @returns The first matching patient
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
export function usePatient(query: string) {
|
|
26
|
-
const url = `${fhirBaseUrl}/Patient?name=${query}&_summary=data`;
|
|
27
|
-
const { data, error, isLoading } = useSWR<
|
|
28
|
-
{
|
|
29
|
-
data: { entry: Array<{ resource: fhir.Patient }> };
|
|
30
|
-
},
|
|
31
|
-
Error
|
|
32
|
-
>(query ? url : null, openmrsFetch);
|
|
33
|
-
|
|
34
|
-
return {
|
|
35
|
-
patient: data ? data?.data?.entry[0].resource : null,
|
|
36
|
-
error: error,
|
|
37
|
-
isLoading,
|
|
38
|
-
};
|
|
39
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
@use '@carbon/layout';
|
|
2
|
-
@use '@carbon/type';
|
|
3
|
-
|
|
4
|
-
.container {
|
|
5
|
-
margin-top: layout.$spacing-09;
|
|
6
|
-
|
|
7
|
-
> * + * {
|
|
8
|
-
margin-top: layout.$spacing-06;
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
.tile {
|
|
13
|
-
border: 1px solid lightgray;
|
|
14
|
-
max-width: 20rem;
|
|
15
|
-
@include type.type-style('heading-compact-01');
|
|
16
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { render, screen, waitFor } from '@testing-library/react';
|
|
3
|
-
import userEvent from '@testing-library/user-event';
|
|
4
|
-
import PatientGetter from './patient-getter.component';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* This is an idiomatic mock of a backend resource. We generally mock resource fetching functions like `usePatient`, rather than mocking `fetch` or anything lower-level.
|
|
8
|
-
*/
|
|
9
|
-
jest.mock('./patient-getter.resource.ts', () => ({
|
|
10
|
-
usePatient: jest.fn(() => ({
|
|
11
|
-
patient: {
|
|
12
|
-
birthDate: '1997-05-21',
|
|
13
|
-
gender: 'male',
|
|
14
|
-
name: [
|
|
15
|
-
{
|
|
16
|
-
family: 'Testguy',
|
|
17
|
-
given: 'Joeboy',
|
|
18
|
-
id: 'abc123',
|
|
19
|
-
},
|
|
20
|
-
],
|
|
21
|
-
},
|
|
22
|
-
})),
|
|
23
|
-
}));
|
|
24
|
-
|
|
25
|
-
it('gets a patient when the button is clicked', async () => {
|
|
26
|
-
render(<PatientGetter />);
|
|
27
|
-
|
|
28
|
-
const user = userEvent.setup();
|
|
29
|
-
const heading = screen.getByRole('heading', { name: /data fetching/i });
|
|
30
|
-
const button = screen.getByRole('button', {
|
|
31
|
-
name: /get a patient named 'test'/i,
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
expect(heading).toBeInTheDocument();
|
|
35
|
-
expect(button).toBeInTheDocument();
|
|
36
|
-
|
|
37
|
-
await waitFor(() => user.click(button));
|
|
38
|
-
|
|
39
|
-
expect(screen.getByText(/Joeboy Testguy \/ male \/ 1997-05-21/)).toBeInTheDocument();
|
|
40
|
-
});
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { ClickableTile } from '@carbon/react';
|
|
3
|
-
import { ChevronRight } from '@carbon/react/icons';
|
|
4
|
-
import { useTranslation } from 'react-i18next';
|
|
5
|
-
import styles from './resources.scss';
|
|
6
|
-
|
|
7
|
-
function Resources() {
|
|
8
|
-
const { t } = useTranslation();
|
|
9
|
-
|
|
10
|
-
return (
|
|
11
|
-
<div className={styles.resources}>
|
|
12
|
-
<h4 className={styles.heading}>{t('resources', 'Resources')}</h4>
|
|
13
|
-
<span className={styles.explainer}>{t('usefulLinks', 'Below are some links to useful resources')}:</span>
|
|
14
|
-
<div className={styles.cardsContainer}>
|
|
15
|
-
<Card
|
|
16
|
-
title={t('getStarted', 'Get started')}
|
|
17
|
-
subtitle={t('getStartedExplainer', 'Create a frontend module from this template') + '.'}
|
|
18
|
-
link="https://github.com/openmrs/openmrs-esm-home-app/generate"
|
|
19
|
-
/>
|
|
20
|
-
<Card
|
|
21
|
-
title={t('frontendDocs', 'Frontend docs')}
|
|
22
|
-
subtitle={t('learnExplainer', 'Learn how to use the O3 framework') + '.'}
|
|
23
|
-
link="https://openmrs.atlassian.net/wiki/spaces/docs/pages/151093495/Introduction+to+O3+for+Developers"
|
|
24
|
-
/>
|
|
25
|
-
<Card
|
|
26
|
-
title={t('designDocs', 'Design docs')}
|
|
27
|
-
subtitle={t('designDocsExplainer', 'Read the O3 design documentation') + '.'}
|
|
28
|
-
link="https://zeroheight.com/23a080e38/p/880723-introduction"
|
|
29
|
-
/>
|
|
30
|
-
<Card
|
|
31
|
-
title={t('connect', 'Connect')}
|
|
32
|
-
subtitle={t('connectExplainer', 'Get in touch with the community') + '.'}
|
|
33
|
-
link="https://slack.openmrs.org/"
|
|
34
|
-
/>
|
|
35
|
-
</div>
|
|
36
|
-
</div>
|
|
37
|
-
);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
function Card({ title, subtitle, link }: { title: string; subtitle: string; link: string }) {
|
|
41
|
-
return (
|
|
42
|
-
<a href={link} target="_blank" rel="noopener noreferrer" className={styles.cardLink}>
|
|
43
|
-
<ClickableTile className={styles.card}>
|
|
44
|
-
<div className={styles.cardContent}>
|
|
45
|
-
<div className={styles.title}>
|
|
46
|
-
<h4>{title}</h4>
|
|
47
|
-
<ChevronRight />
|
|
48
|
-
</div>
|
|
49
|
-
<span className={styles.subtitle}>{subtitle}</span>
|
|
50
|
-
</div>
|
|
51
|
-
</ClickableTile>
|
|
52
|
-
</a>
|
|
53
|
-
);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export default Resources;
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
@use '@carbon/layout';
|
|
2
|
-
@use '@carbon/type';
|
|
3
|
-
|
|
4
|
-
.container {
|
|
5
|
-
padding: layout.$spacing-07;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
.heading {
|
|
9
|
-
@include type.type-style('heading-04');
|
|
10
|
-
margin: layout.$spacing-05 0;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
.explainer {
|
|
14
|
-
display: block;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
.resources {
|
|
18
|
-
margin-top: layout.$spacing-10;
|
|
19
|
-
margin-bottom: layout.$spacing-09;
|
|
20
|
-
|
|
21
|
-
> * + * {
|
|
22
|
-
margin-right: layout.$spacing-05;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.cardsContainer {
|
|
27
|
-
display: grid;
|
|
28
|
-
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
|
29
|
-
column-gap: layout.$spacing-06;
|
|
30
|
-
margin-top: layout.$spacing-07;
|
|
31
|
-
max-width: 75%;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
.card {
|
|
35
|
-
margin: layout.$spacing-03 0;
|
|
36
|
-
display: flex;
|
|
37
|
-
align-items: center;
|
|
38
|
-
|
|
39
|
-
&:hover {
|
|
40
|
-
border: 1px solid lightgray;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
svg {
|
|
44
|
-
margin-left: layout.$spacing-02;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
.cardLink {
|
|
49
|
-
text-decoration: none;
|
|
50
|
-
color: inherit;
|
|
51
|
-
display: block;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
.cardContent {
|
|
55
|
-
display: flex;
|
|
56
|
-
flex-direction: column;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
.title {
|
|
60
|
-
display: flex;
|
|
61
|
-
align-items: center;
|
|
62
|
-
margin-bottom: layout.$spacing-05;
|
|
63
|
-
|
|
64
|
-
h4 {
|
|
65
|
-
@include type.type-style('heading-02');
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
File without changes
|