@kenyaemr/esm-ward-app 8.0.1-pre.99 → 8.0.3-pre.131
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 +20 -24
- package/dist/109.js +1 -0
- package/dist/109.js.map +1 -0
- package/dist/124.js +1 -0
- package/dist/124.js.map +1 -0
- package/dist/125.js +1 -0
- package/dist/125.js.map +1 -0
- package/dist/130.js +1 -1
- package/dist/130.js.LICENSE.txt +2 -0
- package/dist/130.js.map +1 -1
- package/dist/146.js +1 -0
- package/dist/146.js.map +1 -0
- package/dist/15.js +1 -0
- package/dist/15.js.map +1 -0
- package/dist/153.js +1 -0
- package/dist/153.js.map +1 -0
- package/dist/303.js +2 -1
- package/dist/303.js.map +1 -1
- package/dist/325.js +1 -0
- package/dist/325.js.map +1 -0
- package/dist/372.js +2 -0
- package/dist/372.js.map +1 -0
- package/dist/471.js +1 -0
- package/dist/471.js.map +1 -0
- package/dist/481.js +1 -0
- package/dist/481.js.map +1 -0
- package/dist/53.js +1 -0
- package/dist/53.js.map +1 -0
- package/dist/{960.js → 559.js} +1 -1
- package/dist/559.js.map +1 -0
- package/dist/574.js +1 -1
- package/dist/576.js +1 -0
- package/dist/576.js.map +1 -0
- package/dist/577.js +1 -1
- package/dist/577.js.map +1 -1
- package/dist/{255.js → 649.js} +2 -2
- package/dist/649.js.LICENSE.txt +9 -0
- package/dist/649.js.map +1 -0
- package/dist/{659.js → 662.js} +1 -1
- package/dist/662.js.map +1 -0
- package/dist/920.js +1 -0
- package/dist/920.js.map +1 -0
- package/dist/921.js +1 -0
- package/dist/921.js.map +1 -0
- package/dist/922.js +1 -0
- package/dist/922.js.map +1 -0
- package/dist/969.js +1 -0
- package/dist/969.js.map +1 -0
- package/dist/kenyaemr-esm-ward-app.js +1 -1
- package/dist/kenyaemr-esm-ward-app.js.buildmanifest.json +304 -128
- package/dist/kenyaemr-esm-ward-app.js.map +1 -1
- package/dist/main.js +1 -1
- package/dist/main.js.LICENSE.txt +0 -10
- package/dist/main.js.map +1 -1
- package/dist/routes.json +1 -1
- package/mock.tsx +62 -0
- package/package-lock.json +5001 -0
- package/package.json +2 -2
- package/src/action-menu-buttons/clinical-forms-workspace-siderail.component.tsx +37 -0
- package/src/action-menu-buttons/discharge-workspace-siderail.component.tsx +20 -0
- package/src/beds/empty-bed-skeleton.tsx +4 -3
- package/src/beds/empty-bed.component.tsx +3 -3
- package/src/beds/ward-bed.component.tsx +41 -0
- package/src/beds/ward-bed.scss +45 -0
- package/src/beds/{occupied-bed.test.tsx → ward-bed.test.tsx} +42 -20
- package/src/config-schema.ts +203 -84
- package/src/constant.ts +1 -1
- package/src/hooks/useAdmissionLocation.ts +22 -4
- package/src/hooks/useAssignedBedByPatient.ts +9 -0
- package/src/hooks/useBeds.ts +3 -4
- package/src/hooks/useConcept.ts +3 -4
- package/src/hooks/useEmrConfiguration.ts +5 -0
- package/src/hooks/useInpatientAdmission.ts +9 -14
- package/src/hooks/useInpatientRequest.ts +4 -15
- package/src/hooks/useLocations.ts +8 -51
- package/src/hooks/useMotherAndChildren.ts +46 -0
- package/src/hooks/useObs.ts +3 -7
- package/src/hooks/usePatientPendingOrders.ts +16 -0
- package/src/hooks/useWardPatientGrouping.ts +32 -0
- package/src/index.ts +45 -17
- package/src/location-selector/location-selector.component.tsx +18 -21
- package/src/root.component.tsx +3 -0
- package/src/routes.json +41 -3
- package/src/types/index.ts +50 -1
- package/src/ward-patient-card/card-rows/admission-request-note-row.component.tsx +38 -0
- package/src/ward-patient-card/card-rows/coded-obs-tags-row.component.tsx +108 -0
- package/src/ward-patient-card/card-rows/mother-child-row.component.tsx +84 -0
- package/src/ward-patient-card/card-rows/mother-child-row.scss +22 -0
- package/src/ward-patient-card/card-rows/pending-items-row.component.tsx +54 -0
- package/src/ward-patient-card/row-elements/ward-patient-age.tsx +1 -1
- package/src/ward-patient-card/row-elements/ward-patient-coded-obs-tags.tsx +62 -39
- package/src/ward-patient-card/row-elements/ward-patient-header-address.tsx +5 -5
- package/src/ward-patient-card/row-elements/ward-patient-identifier.tsx +18 -41
- package/src/ward-patient-card/row-elements/ward-patient-location.tsx +19 -0
- package/src/ward-patient-card/row-elements/ward-patient-obs.resource.ts +38 -34
- package/src/ward-patient-card/row-elements/ward-patient-obs.tsx +26 -13
- package/src/ward-patient-card/row-elements/ward-patient-pending-order.component.tsx +45 -0
- package/src/ward-patient-card/row-elements/ward-patient-pending-transfer.tsx +38 -0
- package/src/ward-patient-card/row-elements/ward-patient-responsive-tooltip.tsx +32 -0
- package/src/ward-patient-card/row-elements/ward-patient-skeleton-text.tsx +9 -0
- package/src/ward-patient-card/ward-patient-card.component.tsx +14 -45
- package/src/ward-patient-card/ward-patient-card.scss +68 -9
- package/src/ward-view/default-ward/default-ward-beds.component.tsx +42 -0
- package/src/ward-view/default-ward/default-ward-patient-card-header.component.tsx +32 -0
- package/src/ward-view/default-ward/default-ward-patient-card.component.tsx +31 -0
- package/src/ward-view/default-ward/default-ward-pending-patients.component.tsx +52 -0
- package/src/ward-view/default-ward/default-ward-unassigned-patients.component.tsx +32 -0
- package/src/ward-view/default-ward/default-ward-view.component.tsx +31 -0
- package/src/ward-view/materal-ward/maternal-ward-beds.component.tsx +65 -0
- package/src/ward-view/materal-ward/maternal-ward-patient-card-header.component.tsx +30 -0
- package/src/ward-view/materal-ward/maternal-ward-patient-card.component.tsx +93 -0
- package/src/{beds/occupied-bed.scss → ward-view/materal-ward/maternal-ward-patient-card.scss} +4 -9
- package/src/ward-view/materal-ward/maternal-ward-patient-card.test.tsx +58 -0
- package/src/ward-view/materal-ward/maternal-ward-pending-patients.component.tsx +48 -0
- package/src/ward-view/materal-ward/maternal-ward-unassigned-patients.component.tsx +33 -0
- package/src/ward-view/materal-ward/maternal-ward-view.component.tsx +38 -0
- package/src/ward-view/materal-ward/maternal-ward-view.resource.ts +89 -0
- package/src/ward-view/ward-view.component.tsx +15 -163
- package/src/ward-view/ward-view.resource.ts +193 -1
- package/src/ward-view/ward-view.scss +17 -6
- package/src/ward-view/ward-view.test.tsx +43 -48
- package/src/ward-view/ward.component.tsx +106 -0
- package/src/ward-view-header/admission-requests-bar.component.tsx +14 -9
- package/src/ward-view-header/admission-requests-bar.test.tsx +11 -23
- package/src/ward-view-header/admission-requests.scss +1 -1
- package/src/ward-view-header/ward-metric.component.tsx +24 -0
- package/src/ward-view-header/ward-metric.scss +25 -0
- package/src/ward-view-header/ward-metrics.component.tsx +78 -0
- package/src/ward-view-header/ward-metrics.scss +7 -0
- package/src/ward-view-header/ward-metrics.test.tsx +37 -0
- package/src/ward-view-header/ward-view-header.component.tsx +9 -4
- package/src/ward-view-header/ward-view-header.scss +0 -1
- package/src/ward-workspace/admission-request-card/admission-request-card-actions.component.tsx +70 -6
- package/src/ward-workspace/admission-request-card/admission-request-card-header.component.tsx +10 -23
- package/src/ward-workspace/admission-request-card/admission-request-card.component.tsx +9 -3
- package/src/ward-workspace/admission-request-card/admission-request-card.scss +13 -4
- package/src/ward-workspace/admission-request-workspace/admission-requests-workspace.test.tsx +55 -33
- package/src/ward-workspace/admission-request-workspace/admission-requests.workspace.tsx +30 -37
- package/src/ward-workspace/admit-patient-form-workspace/admit-patient-form.test.tsx +98 -203
- package/src/ward-workspace/admit-patient-form-workspace/admit-patient-form.workspace.tsx +116 -180
- package/src/ward-workspace/bed-selector.component.tsx +119 -0
- package/src/ward-workspace/bed-selector.scss +15 -0
- package/src/ward-workspace/patient-banner/patient-banner.component.tsx +7 -14
- package/src/ward-workspace/patient-clinical-forms-workspace/patient-clinical-forms.workspace.tsx +23 -0
- package/src/{ward-patient-workspace → ward-workspace/patient-details}/ward-patient-action-button.extension.tsx +2 -1
- package/src/{ward-patient-workspace → ward-workspace/patient-details}/ward-patient.workspace.tsx +18 -9
- package/src/ward-workspace/patient-discharge/patient-discharge.scss +41 -0
- package/src/ward-workspace/patient-discharge/patient-discharge.workspace.tsx +113 -0
- package/src/ward-workspace/patient-transfer-bed-swap/patient-bed-swap-form.component.tsx +68 -79
- package/src/ward-workspace/patient-transfer-bed-swap/patient-transfer-request-form.component.tsx +24 -24
- package/src/ward-workspace/patient-transfer-bed-swap/patient-transfer-swap.scss +12 -2
- package/src/ward-workspace/patient-transfer-bed-swap/patient-transfer-swap.workspace.tsx +12 -8
- package/src/ward-workspace/patient-transfer-request-workspace/patient-transfer-request.workspace.tsx +11 -0
- package/src/ward-workspace/ward-patient-notes/form/notes-form.component.tsx +1 -1
- package/src/ward-workspace/ward-patient-notes/form/notes-form.test.tsx +1 -1
- package/src/ward-workspace/ward-patient-notes/history/notes-container.component.tsx +2 -2
- package/src/ward-workspace/ward-patient-notes/notes.resource.ts +5 -7
- package/src/ward-workspace/ward-patient-notes/notes.workspace.tsx +1 -1
- package/src/ward-workspace/ward-patient-notes/types.ts +0 -4
- package/src/ward.resource.ts +38 -2
- package/translations/en.json +31 -7
- package/dist/152.js +0 -1
- package/dist/152.js.map +0 -1
- package/dist/255.js.map +0 -1
- package/dist/269.js +0 -1
- package/dist/269.js.map +0 -1
- package/dist/346.js +0 -1
- package/dist/346.js.map +0 -1
- package/dist/466.js +0 -1
- package/dist/466.js.map +0 -1
- package/dist/659.js.map +0 -1
- package/dist/729.js +0 -1
- package/dist/729.js.map +0 -1
- package/dist/749.js +0 -1
- package/dist/749.js.map +0 -1
- package/dist/76.js +0 -1
- package/dist/76.js.map +0 -1
- package/dist/793.js +0 -2
- package/dist/793.js.map +0 -1
- package/dist/803.js +0 -1
- package/dist/803.js.map +0 -1
- package/dist/960.js.map +0 -1
- package/src/beds/empty-bed.scss +0 -28
- package/src/beds/occupied-bed.component.tsx +0 -35
- package/src/beds/unassigned-patient.component.tsx +0 -20
- package/src/beds/unassigned-patient.scss +0 -6
- package/src/config-schema-admission-request-note.ts +0 -9
- package/src/config-schema-extension-colored-obs-tags.ts +0 -91
- package/src/hooks/useCurrentWardCardConfig.ts +0 -32
- package/src/ward-patient-card/card-rows/admission-request-note.extension.tsx +0 -27
- package/src/ward-patient-card/card-rows/colored-obs-tags-card-row.extension.tsx +0 -13
- package/src/ward-patient-card/ward-patient-card-element.component.tsx +0 -65
- package/src/ward-view/ward-bed.component.tsx +0 -14
- /package/dist/{793.js.LICENSE.txt → 303.js.LICENSE.txt} +0 -0
- /package/dist/{255.js.LICENSE.txt → 372.js.LICENSE.txt} +0 -0
- /package/src/{ward-patient-workspace → ward-workspace/patient-details}/ward-patient.style.scss +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kenyaemr/esm-ward-app",
|
|
3
|
-
"version": "8.0.
|
|
3
|
+
"version": "8.0.3-pre.131",
|
|
4
4
|
"description": "Ward and bed management module for O3",
|
|
5
5
|
"browser": "dist/kenyaemr-esm-ward-app.js",
|
|
6
6
|
"main": "src/index.ts",
|
|
@@ -50,5 +50,5 @@
|
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"webpack": "^5.74.0"
|
|
52
52
|
},
|
|
53
|
-
"stableVersion": "8.0.
|
|
53
|
+
"stableVersion": "8.0.2"
|
|
54
54
|
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Document } from '@carbon/react/icons';
|
|
3
|
+
import { useTranslation } from 'react-i18next';
|
|
4
|
+
import { ActionMenuButton, launchWorkspace, useWorkspaces } from '@openmrs/esm-framework';
|
|
5
|
+
import type { WardPatientWorkspaceProps } from '../types';
|
|
6
|
+
|
|
7
|
+
const ClinicalFormsWorkspaceSideRailIcon: React.FC = () => {
|
|
8
|
+
const { t } = useTranslation();
|
|
9
|
+
const { workspaces } = useWorkspaces();
|
|
10
|
+
|
|
11
|
+
const formEntryWorkspaces = workspaces.filter((w) => w.name === 'ward-patient-form-entry-workspace');
|
|
12
|
+
const recentlyOpenedForm = formEntryWorkspaces[0];
|
|
13
|
+
|
|
14
|
+
const isClinicalFormOpen = formEntryWorkspaces?.length >= 1;
|
|
15
|
+
|
|
16
|
+
const launchPatientWorkspaceCb = () => {
|
|
17
|
+
if (isClinicalFormOpen) {
|
|
18
|
+
launchWorkspace('ward-patient-form-entry-workspace', {
|
|
19
|
+
workspaceTitle: recentlyOpenedForm?.additionalProps?.['workspaceTitle'],
|
|
20
|
+
});
|
|
21
|
+
} else {
|
|
22
|
+
launchWorkspace<WardPatientWorkspaceProps>('ward-patient-clinical-forms-workspace');
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<ActionMenuButton
|
|
28
|
+
getIcon={(props) => <Document {...props} />}
|
|
29
|
+
label={t('clinicalForms', 'Clinical forms')}
|
|
30
|
+
iconDescription={t('clinicalForms', 'Clinical forms')}
|
|
31
|
+
handler={launchPatientWorkspaceCb}
|
|
32
|
+
type="ward-patient-clinical-form"
|
|
33
|
+
/>
|
|
34
|
+
);
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export default ClinicalFormsWorkspaceSideRailIcon;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ActionMenuButton, launchWorkspace } from '@openmrs/esm-framework';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { useTranslation } from 'react-i18next';
|
|
4
|
+
import { Exit } from '@carbon/react/icons';
|
|
5
|
+
|
|
6
|
+
export default function PatientDischargeSideRailIcon() {
|
|
7
|
+
const { t } = useTranslation();
|
|
8
|
+
const handler = () => {
|
|
9
|
+
launchWorkspace('patient-discharge-workspace');
|
|
10
|
+
};
|
|
11
|
+
return (
|
|
12
|
+
<ActionMenuButton
|
|
13
|
+
getIcon={(props) => <Exit {...props} />}
|
|
14
|
+
label={t('discharge', 'Discharge')}
|
|
15
|
+
iconDescription={t('discharge', 'Discharge')}
|
|
16
|
+
handler={handler}
|
|
17
|
+
type="patient-discharge-workspace"
|
|
18
|
+
/>
|
|
19
|
+
);
|
|
20
|
+
}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { SkeletonIcon } from '@carbon/react';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import styles from './
|
|
3
|
+
import styles from './ward-bed.scss';
|
|
4
|
+
import WardPatientSkeletonText from '../ward-patient-card/row-elements/ward-patient-skeleton-text';
|
|
4
5
|
|
|
5
6
|
const EmptyBedSkeleton = () => {
|
|
6
7
|
return (
|
|
7
|
-
<div className={styles.
|
|
8
|
+
<div className={styles.emptyBed + ' ' + styles.skeleton}>
|
|
8
9
|
<SkeletonIcon />
|
|
9
|
-
<
|
|
10
|
+
<WardPatientSkeletonText />
|
|
10
11
|
</div>
|
|
11
12
|
);
|
|
12
13
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import styles from './
|
|
2
|
+
import styles from './ward-bed.scss';
|
|
3
3
|
import wardPatientCardStyles from '../ward-patient-card/ward-patient-card.scss';
|
|
4
4
|
import { type Bed } from '../types';
|
|
5
5
|
import { useTranslation } from 'react-i18next';
|
|
@@ -12,11 +12,11 @@ const EmptyBed: React.FC<EmptyBedProps> = ({ bed }) => {
|
|
|
12
12
|
const { t } = useTranslation();
|
|
13
13
|
|
|
14
14
|
return (
|
|
15
|
-
<div className={styles.
|
|
15
|
+
<div className={styles.emptyBed}>
|
|
16
16
|
<span className={`${wardPatientCardStyles.wardPatientBedNumber} ${wardPatientCardStyles.empty}`}>
|
|
17
17
|
{bed.bedNumber}
|
|
18
18
|
</span>
|
|
19
|
-
<p className={styles.
|
|
19
|
+
<p className={styles.emptyBedText}>{t('emptyBed', 'Empty bed')}</p>
|
|
20
20
|
</div>
|
|
21
21
|
);
|
|
22
22
|
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React, { type ReactNode } from 'react';
|
|
2
|
+
import { type Bed } from '../types';
|
|
3
|
+
import EmptyBed from './empty-bed.component';
|
|
4
|
+
import styles from './ward-bed.scss';
|
|
5
|
+
import { useTranslation } from 'react-i18next';
|
|
6
|
+
import { Tag } from '@carbon/react';
|
|
7
|
+
|
|
8
|
+
export interface WardBedProps {
|
|
9
|
+
patientCards: Array<ReactNode>;
|
|
10
|
+
bed: Bed;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const WardBed: React.FC<WardBedProps> = ({ bed, patientCards }) => {
|
|
14
|
+
return patientCards?.length > 0 ? <OccupiedBed bed={bed} patientCards={patientCards} /> : <EmptyBed bed={bed} />;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const OccupiedBed: React.FC<WardBedProps> = ({ patientCards }) => {
|
|
18
|
+
// interlace patient card with bed dividers between each of them
|
|
19
|
+
const patientCardsWithDividers = patientCards.flatMap((patientCard, index) => {
|
|
20
|
+
if (index == 0) {
|
|
21
|
+
return [patientCard];
|
|
22
|
+
} else {
|
|
23
|
+
return [<BedShareDivider key={'divider-' + index} />, patientCard];
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
return <div className={styles.occupiedBed}>{patientCardsWithDividers}</div>;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const BedShareDivider = () => {
|
|
31
|
+
const { t } = useTranslation();
|
|
32
|
+
return (
|
|
33
|
+
<div className={styles.bedDivider}>
|
|
34
|
+
<div className={styles.bedDividerLine}></div>
|
|
35
|
+
<Tag>{t('bedShare', 'Bed share')}</Tag>
|
|
36
|
+
<div className={styles.bedDividerLine}></div>
|
|
37
|
+
</div>
|
|
38
|
+
);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export default WardBed;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
@use '@carbon/layout';
|
|
2
|
+
@use '@openmrs/esm-styleguide/src/vars';
|
|
3
|
+
@use '@carbon/type';
|
|
4
|
+
|
|
5
|
+
.occupiedBed {
|
|
6
|
+
display: flex;
|
|
7
|
+
flex-direction: column;
|
|
8
|
+
background-color: vars.$ui-02;
|
|
9
|
+
height: fit-content;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.bedDivider {
|
|
13
|
+
background-color: vars.$ui-02;
|
|
14
|
+
color: vars.$text-02;
|
|
15
|
+
padding: layout.$spacing-01;
|
|
16
|
+
display: flex;
|
|
17
|
+
align-items: center;
|
|
18
|
+
justify-content: space-between;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.bedDividerLine {
|
|
22
|
+
height: 1px;
|
|
23
|
+
background-color: vars.$ui-05;
|
|
24
|
+
width: 30%;
|
|
25
|
+
}
|
|
26
|
+
.emptyBed {
|
|
27
|
+
display: flex;
|
|
28
|
+
gap: layout.$spacing-04;
|
|
29
|
+
justify-content: center;
|
|
30
|
+
align-items: center;
|
|
31
|
+
border: 1px dashed vars.$ui-04;
|
|
32
|
+
padding: layout.$spacing-03 layout.$spacing-04;
|
|
33
|
+
height: fit-content;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.emptyBed:hover:not(.skeleton) {
|
|
37
|
+
border: 1px solid transparent;
|
|
38
|
+
box-shadow: inset 0px 0px 0px 2px vars.$color-blue-60-2;
|
|
39
|
+
cursor: pointer;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.emptyBedText {
|
|
43
|
+
@include type.type-style('heading-compact-01');
|
|
44
|
+
color: vars.$text-02;
|
|
45
|
+
}
|
|
@@ -1,24 +1,37 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { render, screen } from '@testing-library/react';
|
|
3
1
|
import { getDefaultsFromConfigSchema, useConfig } from '@openmrs/esm-framework';
|
|
4
|
-
import {
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
|
+
import React from 'react';
|
|
5
4
|
import {
|
|
6
5
|
mockAdmissionLocation,
|
|
7
6
|
mockLocationInpatientWard,
|
|
8
7
|
mockPatientAlice,
|
|
9
8
|
mockPatientBrian,
|
|
10
9
|
} from '../../../../__mocks__';
|
|
11
|
-
import {
|
|
10
|
+
import { configSchema, type WardConfigObject } from '../config-schema';
|
|
11
|
+
import { useObs } from '../hooks/useObs';
|
|
12
12
|
import useWardLocation from '../hooks/useWardLocation';
|
|
13
|
-
import
|
|
13
|
+
import { type WardPatient } from '../types';
|
|
14
|
+
import DefaultWardPatientCard from '../ward-view/default-ward/default-ward-patient-card.component';
|
|
15
|
+
import { bedLayoutToBed, filterBeds } from '../ward-view/ward-view.resource';
|
|
16
|
+
import WardBed from './ward-bed.component';
|
|
14
17
|
|
|
15
18
|
const defaultConfig: WardConfigObject = getDefaultsFromConfigSchema(configSchema);
|
|
16
19
|
|
|
17
20
|
jest.mocked(useConfig).mockReturnValue(defaultConfig);
|
|
21
|
+
jest.mock('../hooks/useObs', () => ({
|
|
22
|
+
useObs: jest.fn(),
|
|
23
|
+
}));
|
|
24
|
+
jest.mock('../ward-patient-card/row-elements/ward-patient-obs.resource', () => ({
|
|
25
|
+
useConceptToTagColorMap: jest.fn(),
|
|
26
|
+
}));
|
|
18
27
|
|
|
19
28
|
const mockBedLayouts = filterBeds(mockAdmissionLocation);
|
|
20
29
|
|
|
21
30
|
jest.mock('../hooks/useWardLocation', () => jest.fn());
|
|
31
|
+
//@ts-ignore
|
|
32
|
+
jest.mocked(useObs).mockReturnValue({
|
|
33
|
+
data: [],
|
|
34
|
+
});
|
|
22
35
|
|
|
23
36
|
const mockedUseWardLocation = useWardLocation as jest.Mock;
|
|
24
37
|
mockedUseWardLocation.mockReturnValue({
|
|
@@ -31,34 +44,43 @@ mockedUseWardLocation.mockReturnValue({
|
|
|
31
44
|
const mockBedToUse = mockBedLayouts[0];
|
|
32
45
|
const mockBed = bedLayoutToBed(mockBedToUse);
|
|
33
46
|
|
|
34
|
-
const
|
|
35
|
-
|
|
47
|
+
const mockWardPatientAliceProps: WardPatient = {
|
|
48
|
+
visit: null,
|
|
49
|
+
patient: mockPatientAlice,
|
|
50
|
+
bed: mockBed,
|
|
51
|
+
inpatientAdmission: null,
|
|
52
|
+
inpatientRequest: null,
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const mockWardPatientBrianProps: WardPatient = {
|
|
36
56
|
visit: null,
|
|
37
|
-
|
|
38
|
-
|
|
57
|
+
patient: mockPatientBrian,
|
|
58
|
+
bed: mockBed,
|
|
59
|
+
inpatientAdmission: null,
|
|
60
|
+
inpatientRequest: null,
|
|
39
61
|
};
|
|
40
62
|
|
|
41
|
-
describe('
|
|
63
|
+
describe('Ward bed', () => {
|
|
42
64
|
it('renders a single bed with patient details', () => {
|
|
43
|
-
render(
|
|
65
|
+
render(
|
|
66
|
+
<WardBed
|
|
67
|
+
patientCards={[<DefaultWardPatientCard key={mockPatientAlice.uuid} {...mockWardPatientAliceProps} />]}
|
|
68
|
+
bed={mockBed}
|
|
69
|
+
/>,
|
|
70
|
+
);
|
|
44
71
|
const patientName = screen.getByText('Alice Johnson');
|
|
45
72
|
expect(patientName).toBeInTheDocument();
|
|
46
73
|
const patientAge = `${mockPatientAlice.person.age} yrs`;
|
|
47
74
|
expect(screen.getByText(patientAge)).toBeInTheDocument();
|
|
48
|
-
const defaultAddressFields = ['cityVillage', 'country'];
|
|
49
|
-
defaultAddressFields.forEach((addressField) => {
|
|
50
|
-
const addressFieldValue = mockPatientAlice.person.preferredAddress[addressField] as string;
|
|
51
|
-
expect(screen.getByText(addressFieldValue)).toBeInTheDocument();
|
|
52
|
-
});
|
|
53
75
|
});
|
|
54
76
|
|
|
55
77
|
it('renders a divider for shared patients', () => {
|
|
56
78
|
render(
|
|
57
|
-
<
|
|
79
|
+
<WardBed
|
|
58
80
|
bed={mockBed}
|
|
59
|
-
|
|
60
|
-
{ ...
|
|
61
|
-
{ ...
|
|
81
|
+
patientCards={[
|
|
82
|
+
<DefaultWardPatientCard key={mockPatientAlice.uuid} {...mockWardPatientAliceProps} />,
|
|
83
|
+
<DefaultWardPatientCard key={mockPatientBrian.uuid} {...mockWardPatientBrianProps} />,
|
|
62
84
|
]}
|
|
63
85
|
/>,
|
|
64
86
|
);
|