@openmrs/esm-service-queues-app 9.2.1-pre.7118 → 9.2.1-pre.7125
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 +9 -9
- package/dist/3386.js +1 -1
- package/dist/3386.js.map +1 -1
- package/dist/3683.js +1 -1
- package/dist/3683.js.map +1 -1
- package/dist/4300.js +1 -1
- package/dist/5228.js +1 -1
- package/dist/5228.js.map +1 -1
- package/dist/5278.js +2 -0
- package/dist/5278.js.map +1 -0
- package/dist/5680.js +1 -1
- package/dist/5680.js.map +1 -1
- package/dist/714.js +1 -1
- package/dist/714.js.map +1 -1
- package/dist/8233.js +1 -0
- package/dist/8233.js.map +1 -0
- package/dist/8844.js +1 -1
- package/dist/8844.js.map +1 -1
- package/dist/9384.js +1 -1
- package/dist/9384.js.map +1 -1
- package/dist/9707.js +1 -1
- package/dist/9707.js.map +1 -1
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/openmrs-esm-service-queues-app.js +1 -1
- package/dist/openmrs-esm-service-queues-app.js.buildmanifest.json +81 -81
- package/dist/routes.json +1 -1
- package/package.json +1 -1
- package/src/admin/admin-page/admin-page.component.tsx +3 -3
- package/src/admin/queue-rooms/queue-room-form.workspace.tsx +88 -85
- package/src/admin/queue-services/queue-service-form.workspace.tsx +85 -83
- package/src/create-queue-entry/create-queue-entry.workspace.tsx +72 -61
- package/src/create-queue-entry/existing-visit-form/existing-visit-form.component.tsx +8 -14
- package/src/index.ts +0 -2
- package/src/queue-patient-linelists/queue-linelist-base-table.component.tsx +3 -21
- package/src/queue-table/components/add-patient-to-queue-button.component.tsx +45 -0
- package/src/queue-table/default-queue-table.component.tsx +4 -52
- package/src/routes.json +33 -15
- package/src/views/queue-tables-for-all-statuses.component.tsx +3 -20
- package/translations/en.json +1 -12
- package/dist/3050.js +0 -1
- package/dist/3050.js.map +0 -1
- package/dist/7706.js +0 -2
- package/dist/7706.js.map +0 -1
- package/src/hooks/usePatientSearchVisibility.tsx +0 -26
- package/src/queue-patient-linelists/queue-linelist-filter.scss +0 -53
- package/src/queue-patient-linelists/queue-linelist-filter.test.tsx +0 -83
- package/src/queue-patient-linelists/queue-linelist-filter.workspace.tsx +0 -180
- /package/dist/{7706.js.LICENSE.txt → 5278.js.LICENSE.txt} +0 -0
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { useCallback, useState } from 'react';
|
|
2
|
-
|
|
3
|
-
const usePatientSearchVisibility = () => {
|
|
4
|
-
const [isOpen, setIsOpen] = useState(false);
|
|
5
|
-
|
|
6
|
-
const showPatientSearch = useCallback(() => {
|
|
7
|
-
setIsOpen(true);
|
|
8
|
-
}, []);
|
|
9
|
-
|
|
10
|
-
const hidePatientSearch = useCallback(() => {
|
|
11
|
-
setIsOpen(false);
|
|
12
|
-
}, []);
|
|
13
|
-
|
|
14
|
-
const togglePatientSearch = useCallback(() => {
|
|
15
|
-
setIsOpen(!isOpen);
|
|
16
|
-
}, [isOpen]);
|
|
17
|
-
|
|
18
|
-
return {
|
|
19
|
-
hidePatientSearch,
|
|
20
|
-
isPatientSearchOpen: isOpen,
|
|
21
|
-
showPatientSearch,
|
|
22
|
-
togglePatientSearch,
|
|
23
|
-
};
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
export default usePatientSearchVisibility;
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
@use '@carbon/layout';
|
|
2
|
-
@use '@carbon/type';
|
|
3
|
-
@use '@openmrs/esm-styleguide/src/vars' as *;
|
|
4
|
-
|
|
5
|
-
.wrapper {
|
|
6
|
-
background-color: $ui-02;
|
|
7
|
-
padding: layout.$spacing-06;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
.grid {
|
|
11
|
-
padding: 0 layout.$spacing-06 layout.$spacing-03;
|
|
12
|
-
background-color: $ui-01;
|
|
13
|
-
margin-bottom: layout.$spacing-05;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
.heading {
|
|
17
|
-
color: $text-02;
|
|
18
|
-
@include type.type-style('heading-compact-02');
|
|
19
|
-
margin: layout.$spacing-04 0 layout.$spacing-04;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
.radioButton {
|
|
23
|
-
margin-top: layout.$spacing-03;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.button {
|
|
27
|
-
height: layout.$spacing-10;
|
|
28
|
-
display: flex;
|
|
29
|
-
align-content: flex-start;
|
|
30
|
-
align-items: baseline;
|
|
31
|
-
min-width: 50%;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
.numberInputs {
|
|
35
|
-
margin-top: layout.$spacing-02;
|
|
36
|
-
display: flex;
|
|
37
|
-
flex-direction: row;
|
|
38
|
-
justify-content: space-between;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
.tablet {
|
|
42
|
-
padding: layout.$spacing-06 layout.$spacing-05;
|
|
43
|
-
background-color: $ui-02;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
.desktop {
|
|
47
|
-
padding: 0;
|
|
48
|
-
margin-top: layout.$spacing-05;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
.form {
|
|
52
|
-
height: 100%;
|
|
53
|
-
}
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import userEvent from '@testing-library/user-event';
|
|
3
|
-
import { render, screen, within } from '@testing-library/react';
|
|
4
|
-
import { useLayoutType, useVisitTypes } from '@openmrs/esm-framework';
|
|
5
|
-
import { mockVisitTypes } from '__mocks__';
|
|
6
|
-
import QueueLinelistFilter from './queue-linelist-filter.workspace';
|
|
7
|
-
|
|
8
|
-
const mockUseLayoutType = jest.mocked(useLayoutType);
|
|
9
|
-
const mockUseVisitTypes = jest.mocked(useVisitTypes);
|
|
10
|
-
|
|
11
|
-
const workspaceProps = {
|
|
12
|
-
closeWorkspace: jest.fn(),
|
|
13
|
-
promptBeforeClosing: jest.fn(),
|
|
14
|
-
closeWorkspaceWithSavedChanges: jest.fn(),
|
|
15
|
-
setTitle: jest.fn(),
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
describe('QueueLinelistFilter', () => {
|
|
19
|
-
beforeEach(() => {
|
|
20
|
-
mockUseLayoutType.mockReturnValue('tablet');
|
|
21
|
-
mockUseVisitTypes.mockReturnValue(mockVisitTypes);
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
it('renders the form with filter elements', () => {
|
|
25
|
-
render(<QueueLinelistFilter {...workspaceProps} />);
|
|
26
|
-
|
|
27
|
-
expect(screen.getByText('Gender')).toBeInTheDocument();
|
|
28
|
-
expect(screen.getByLabelText('Age')).toBeInTheDocument();
|
|
29
|
-
expect(screen.getByLabelText('Between')).toBeInTheDocument();
|
|
30
|
-
expect(screen.getByLabelText('And')).toBeInTheDocument();
|
|
31
|
-
expect(screen.getByText("Use today's date")).toBeInTheDocument();
|
|
32
|
-
expect(screen.getByRole('combobox', { name: /Select visit type/i })).toBeInTheDocument();
|
|
33
|
-
expect(screen.getByText('Cancel')).toBeInTheDocument();
|
|
34
|
-
expect(screen.getByText('Apply filters')).toBeInTheDocument();
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
it('calls closePanel function when cancel button is clicked', async () => {
|
|
38
|
-
const user = userEvent.setup();
|
|
39
|
-
const closeWorkspace = jest.fn();
|
|
40
|
-
|
|
41
|
-
render(<QueueLinelistFilter {...{ ...workspaceProps, closeWorkspace }} />);
|
|
42
|
-
|
|
43
|
-
const cancelButton = screen.getByText('Cancel');
|
|
44
|
-
await user.click(cancelButton);
|
|
45
|
-
|
|
46
|
-
expect(closeWorkspace).toHaveBeenCalledTimes(1);
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
it('updates gender state when a radio button is selected', async () => {
|
|
50
|
-
const user = userEvent.setup();
|
|
51
|
-
|
|
52
|
-
render(<QueueLinelistFilter {...workspaceProps} />);
|
|
53
|
-
|
|
54
|
-
const maleRadioButton = screen.getByLabelText('Male');
|
|
55
|
-
await user.click(maleRadioButton);
|
|
56
|
-
|
|
57
|
-
expect(maleRadioButton).toBeChecked();
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
it('updates startAge state when a number is entered', async () => {
|
|
61
|
-
const user = userEvent.setup();
|
|
62
|
-
render(<QueueLinelistFilter {...workspaceProps} />);
|
|
63
|
-
|
|
64
|
-
const startAgeInput = screen.getByLabelText('Between');
|
|
65
|
-
await user.type(startAgeInput, '10');
|
|
66
|
-
|
|
67
|
-
expect(startAgeInput).toHaveValue(10);
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
it('should open the visit type dropdown and close after selection', async () => {
|
|
71
|
-
const user = userEvent.setup();
|
|
72
|
-
|
|
73
|
-
render(<QueueLinelistFilter {...workspaceProps} />);
|
|
74
|
-
|
|
75
|
-
const visitTypeDropdown = screen.getByRole('combobox', { name: /Select visit type/i });
|
|
76
|
-
await user.click(visitTypeDropdown);
|
|
77
|
-
|
|
78
|
-
const type1Option = screen.getByText('Outpatient Visit');
|
|
79
|
-
await user.click(type1Option);
|
|
80
|
-
|
|
81
|
-
expect(visitTypeDropdown).toHaveTextContent('Open menu');
|
|
82
|
-
});
|
|
83
|
-
});
|
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
import React, { useCallback, useState } from 'react';
|
|
2
|
-
import { useTranslation } from 'react-i18next';
|
|
3
|
-
import {
|
|
4
|
-
Button,
|
|
5
|
-
ButtonSet,
|
|
6
|
-
Column,
|
|
7
|
-
Dropdown,
|
|
8
|
-
Form,
|
|
9
|
-
Layer,
|
|
10
|
-
NumberInput,
|
|
11
|
-
RadioButton,
|
|
12
|
-
RadioButtonGroup,
|
|
13
|
-
Stack,
|
|
14
|
-
Toggle,
|
|
15
|
-
} from '@carbon/react';
|
|
16
|
-
import dayjs from 'dayjs';
|
|
17
|
-
import {
|
|
18
|
-
type DefaultWorkspaceProps,
|
|
19
|
-
OpenmrsDatePicker,
|
|
20
|
-
toDateObjectStrict,
|
|
21
|
-
toOmrsIsoString,
|
|
22
|
-
useLayoutType,
|
|
23
|
-
useVisitTypes,
|
|
24
|
-
} from '@openmrs/esm-framework';
|
|
25
|
-
import { datePickerFormat, datePickerPlaceHolder } from '../constants';
|
|
26
|
-
import styles from './queue-linelist-filter.scss';
|
|
27
|
-
|
|
28
|
-
const QueueLinelistFilter: React.FC<DefaultWorkspaceProps> = ({ closeWorkspace }) => {
|
|
29
|
-
const { t } = useTranslation();
|
|
30
|
-
const allVisitTypes = useVisitTypes();
|
|
31
|
-
const isTablet = useLayoutType() === 'tablet';
|
|
32
|
-
|
|
33
|
-
const [endAge, setEndAge] = useState();
|
|
34
|
-
const [gender, setGender] = useState('');
|
|
35
|
-
const [returnDate, setReturnDate] = useState(new Date());
|
|
36
|
-
const [startAge, setStartAge] = useState();
|
|
37
|
-
const [visitType, setVisitType] = useState('');
|
|
38
|
-
|
|
39
|
-
const handleFilter = useCallback(
|
|
40
|
-
(event) => {
|
|
41
|
-
event.preventDefault();
|
|
42
|
-
|
|
43
|
-
const payload = {
|
|
44
|
-
gender: gender,
|
|
45
|
-
startAge: startAge,
|
|
46
|
-
endAge: endAge,
|
|
47
|
-
returnDate: toDateObjectStrict(
|
|
48
|
-
toOmrsIsoString(new Date(dayjs(returnDate).year(), dayjs(returnDate).month(), dayjs(returnDate).date())),
|
|
49
|
-
),
|
|
50
|
-
visitType: visitType,
|
|
51
|
-
};
|
|
52
|
-
},
|
|
53
|
-
[gender, startAge, endAge, returnDate, visitType],
|
|
54
|
-
);
|
|
55
|
-
|
|
56
|
-
const handleTodaysDate = () => {
|
|
57
|
-
setReturnDate(new Date());
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
return (
|
|
61
|
-
<>
|
|
62
|
-
<Form onSubmit={handleFilter}>
|
|
63
|
-
<div className={styles.wrapper}>
|
|
64
|
-
<Stack gap={4} className={styles.grid}>
|
|
65
|
-
<Column>
|
|
66
|
-
<p className={styles.heading}> {t('gender', 'Gender')}</p>
|
|
67
|
-
<RadioButtonGroup name="gender" orientation="vertical" onChange={(event) => setGender(event.toString())}>
|
|
68
|
-
<RadioButton
|
|
69
|
-
className={styles.radioButton}
|
|
70
|
-
id="male"
|
|
71
|
-
labelText={t('maleLabelText', 'Male')}
|
|
72
|
-
value="Male"
|
|
73
|
-
/>
|
|
74
|
-
<RadioButton
|
|
75
|
-
className={styles.radioButton}
|
|
76
|
-
id="female"
|
|
77
|
-
labelText={t('femaleLabelText', 'Female')}
|
|
78
|
-
value="Female"
|
|
79
|
-
/>
|
|
80
|
-
</RadioButtonGroup>
|
|
81
|
-
</Column>
|
|
82
|
-
</Stack>
|
|
83
|
-
|
|
84
|
-
<Stack gap={4} className={styles.grid}>
|
|
85
|
-
<Column md={2}>
|
|
86
|
-
<p className={styles.heading}> {t('age', 'Age')}</p>
|
|
87
|
-
<Layer>
|
|
88
|
-
<Toggle
|
|
89
|
-
size="sm"
|
|
90
|
-
aria-label={t('age', 'Age')}
|
|
91
|
-
defaultToggled
|
|
92
|
-
id="age"
|
|
93
|
-
labelA={t('off', 'Off')}
|
|
94
|
-
labelB={t('on', 'On')}
|
|
95
|
-
labelText=""
|
|
96
|
-
/>
|
|
97
|
-
</Layer>
|
|
98
|
-
<Layer className={styles.numberInputs}>
|
|
99
|
-
<Layer>
|
|
100
|
-
<NumberInput
|
|
101
|
-
id="startAge"
|
|
102
|
-
invalidText={t('startAgeRangeInvalid', 'Start age range is not valid')}
|
|
103
|
-
label={t('between', 'Between')}
|
|
104
|
-
max={100}
|
|
105
|
-
min={0}
|
|
106
|
-
onChange={(event) => setStartAge(event.target.value)}
|
|
107
|
-
size="md"
|
|
108
|
-
value={startAge}
|
|
109
|
-
/>
|
|
110
|
-
</Layer>
|
|
111
|
-
<Layer>
|
|
112
|
-
<NumberInput
|
|
113
|
-
id="endAge"
|
|
114
|
-
invalidText={t('endAgeRangeInvalid', 'End age range is not valid')}
|
|
115
|
-
label={t('and', 'And')}
|
|
116
|
-
max={100}
|
|
117
|
-
min={0}
|
|
118
|
-
onChange={(event) => setEndAge(event.target.value)}
|
|
119
|
-
size="md"
|
|
120
|
-
value={endAge}
|
|
121
|
-
/>
|
|
122
|
-
</Layer>
|
|
123
|
-
</Layer>
|
|
124
|
-
</Column>
|
|
125
|
-
</Stack>
|
|
126
|
-
|
|
127
|
-
<Stack gap={4} className={styles.grid}>
|
|
128
|
-
<Column md={2}>
|
|
129
|
-
<p className={styles.heading}> {t('returnDate', 'Return Date')}</p>
|
|
130
|
-
<Layer>
|
|
131
|
-
<OpenmrsDatePicker
|
|
132
|
-
data-testid="returnDate"
|
|
133
|
-
id="returnDate"
|
|
134
|
-
labelText={t('date', 'Date')}
|
|
135
|
-
onChange={setReturnDate}
|
|
136
|
-
value={returnDate}
|
|
137
|
-
/>
|
|
138
|
-
</Layer>
|
|
139
|
-
<Button
|
|
140
|
-
kind="ghost"
|
|
141
|
-
onClick={() => {
|
|
142
|
-
handleTodaysDate();
|
|
143
|
-
}}>
|
|
144
|
-
{t('useTodaysDate', "Use today's date")}
|
|
145
|
-
</Button>
|
|
146
|
-
</Column>
|
|
147
|
-
</Stack>
|
|
148
|
-
|
|
149
|
-
<Stack gap={4} className={styles.grid}>
|
|
150
|
-
<Column>
|
|
151
|
-
<p className={styles.heading}>{t('visitType', 'Visit Type')}</p>
|
|
152
|
-
<Layer>
|
|
153
|
-
<Dropdown
|
|
154
|
-
id="visitType"
|
|
155
|
-
label={t('selectAVisitType', 'Select visit type')}
|
|
156
|
-
titleText={t('selectAVisitType', 'Select visit type')}
|
|
157
|
-
items={allVisitTypes}
|
|
158
|
-
onChange={(event) => setVisitType(event.selectedItem.toString)}
|
|
159
|
-
size="sm"
|
|
160
|
-
itemToElement={(item) => (item ? <span>{item.display}</span> : null)}
|
|
161
|
-
/>
|
|
162
|
-
</Layer>
|
|
163
|
-
</Column>
|
|
164
|
-
</Stack>
|
|
165
|
-
</div>
|
|
166
|
-
|
|
167
|
-
<ButtonSet className={isTablet ? styles.tablet : styles.desktop}>
|
|
168
|
-
<Button className={styles.button} kind="secondary" onClick={closeWorkspace}>
|
|
169
|
-
{t('cancel', 'Cancel')}
|
|
170
|
-
</Button>
|
|
171
|
-
<Button className={styles.button} kind="primary" type="submit">
|
|
172
|
-
{t('applyFilters', 'Apply filters')}
|
|
173
|
-
</Button>
|
|
174
|
-
</ButtonSet>
|
|
175
|
-
</Form>
|
|
176
|
-
</>
|
|
177
|
-
);
|
|
178
|
-
};
|
|
179
|
-
|
|
180
|
-
export default QueueLinelistFilter;
|
|
File without changes
|