@openmrs/esm-patient-programs-app 3.0.3-pre.982 → 3.0.3-pre.989

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.
@@ -1,31 +1,5 @@
1
1
  {
2
2
  "chunks": [
3
- {
4
- "rendered": true,
5
- "initial": false,
6
- "entry": false,
7
- "recorded": false,
8
- "reason": "split chunk (cache group: defaultVendors)",
9
- "size": 522814,
10
- "sizes": {
11
- "javascript": 522814
12
- },
13
- "names": [],
14
- "idHints": [
15
- "vendors"
16
- ],
17
- "runtime": [
18
- "@openmrs/esm-patient-programs-app"
19
- ],
20
- "files": [
21
- "7.js"
22
- ],
23
- "auxiliaryFiles": [
24
- "7.js.map"
25
- ],
26
- "hash": "896356fc82fcbdfee79d",
27
- "childrenByOrder": {}
28
- },
29
3
  {
30
4
  "rendered": true,
31
5
  "initial": false,
@@ -174,6 +148,32 @@
174
148
  "hash": "84ba0c225e2af33c6f0e",
175
149
  "childrenByOrder": {}
176
150
  },
151
+ {
152
+ "rendered": true,
153
+ "initial": false,
154
+ "entry": false,
155
+ "recorded": false,
156
+ "reason": "split chunk (cache group: defaultVendors)",
157
+ "size": 524360,
158
+ "sizes": {
159
+ "javascript": 524360
160
+ },
161
+ "names": [],
162
+ "idHints": [
163
+ "vendors"
164
+ ],
165
+ "runtime": [
166
+ "@openmrs/esm-patient-programs-app"
167
+ ],
168
+ "files": [
169
+ "364.js"
170
+ ],
171
+ "auxiliaryFiles": [
172
+ "364.js.map"
173
+ ],
174
+ "hash": "8dad4aae8fbb88c63be9",
175
+ "childrenByOrder": {}
176
+ },
177
177
  {
178
178
  "rendered": true,
179
179
  "initial": false,
@@ -276,9 +276,9 @@
276
276
  "initial": false,
277
277
  "entry": false,
278
278
  "recorded": false,
279
- "size": 899,
279
+ "size": 913,
280
280
  "sizes": {
281
- "javascript": 899
281
+ "javascript": 913
282
282
  },
283
283
  "names": [],
284
284
  "idHints": [],
@@ -289,7 +289,7 @@
289
289
  "574.js"
290
290
  ],
291
291
  "auxiliaryFiles": [],
292
- "hash": "f395bedd5fb4a16d6410",
292
+ "hash": "cb2ae0c9c8c513441c4a",
293
293
  "childrenByOrder": {}
294
294
  },
295
295
  {
@@ -313,7 +313,7 @@
313
313
  "auxiliaryFiles": [
314
314
  "600.js.map"
315
315
  ],
316
- "hash": "4910dbcf375981ca621f",
316
+ "hash": "f68d891ae55afc20fdac",
317
317
  "childrenByOrder": {}
318
318
  },
319
319
  {
@@ -602,10 +602,10 @@
602
602
  "initial": false,
603
603
  "entry": false,
604
604
  "recorded": false,
605
- "size": 143859,
605
+ "size": 145286,
606
606
  "sizes": {
607
607
  "consume-shared": 42,
608
- "javascript": 143817
608
+ "javascript": 145244
609
609
  },
610
610
  "names": [],
611
611
  "idHints": [],
@@ -618,7 +618,7 @@
618
618
  "auxiliaryFiles": [
619
619
  "968.js.map"
620
620
  ],
621
- "hash": "49354f89d484f59f9d3b",
621
+ "hash": "44de75c3dae4aff71545",
622
622
  "childrenByOrder": {}
623
623
  },
624
624
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openmrs/esm-patient-programs-app",
3
- "version": "3.0.3-pre.982",
3
+ "version": "3.0.3-pre.989",
4
4
  "license": "MPL-2.0",
5
5
  "description": "Patient programs microfrontend for the OpenMRS SPA",
6
6
  "browser": "dist/openmrs-esm-patient-programs-app.js",
@@ -36,7 +36,7 @@
36
36
  "dependencies": {
37
37
  "@carbon/charts-react": "^0.49.4",
38
38
  "@carbon/icons-react": "^10.18.0",
39
- "@openmrs/esm-patient-common-lib": "^3.0.3-pre.982",
39
+ "@openmrs/esm-patient-common-lib": "^3.0.3-pre.989",
40
40
  "carbon-components-react": "^7.25.0",
41
41
  "d3": "^7.0.3",
42
42
  "lodash-es": "^4.17.15"
@@ -52,5 +52,5 @@
52
52
  "react-router-dom": "5.x",
53
53
  "rxjs": "6.x"
54
54
  },
55
- "gitHead": "0ce05b8a3305a2db0e83781c08ec3693fc3d7401"
55
+ "gitHead": "ce549812ba62659696377942550648b4cded915e"
56
56
  }
@@ -14,7 +14,16 @@ import {
14
14
  useSessionUser,
15
15
  useLocations,
16
16
  } from '@openmrs/esm-framework';
17
- import { Button, DatePicker, DatePickerInput, Select, SelectItem, Form, FormGroup } from 'carbon-components-react';
17
+ import {
18
+ Button,
19
+ DatePicker,
20
+ DatePickerInput,
21
+ Select,
22
+ SelectItem,
23
+ Form,
24
+ FormGroup,
25
+ ButtonSet,
26
+ } from 'carbon-components-react';
18
27
  import { createProgramEnrollment, useAvailablePrograms, useEnrollments } from './programs.resource';
19
28
 
20
29
  interface ProgramsFormProps {
@@ -95,81 +104,83 @@ const ProgramsForm: React.FC<ProgramsFormProps> = ({ patientUuid, isTablet }) =>
95
104
  );
96
105
 
97
106
  return (
98
- <Form style={{ margin: '2rem' }} onSubmit={handleSubmit}>
99
- <FormGroup style={{ width: '50%' }} legendText={t('program', 'Program')}>
100
- <div className={styles.selectContainer}>
107
+ <Form className={styles.form} onSubmit={handleSubmit}>
108
+ <div className={styles.formContainer}>
109
+ <FormGroup style={{ width: '50%' }} legendText={t('program', 'Program')}>
110
+ <div className={styles.selectContainer}>
111
+ <Select
112
+ id="program"
113
+ invalidText={t('required', 'Required')}
114
+ labelText=""
115
+ light={isTablet}
116
+ onChange={(event) => setSelectedProgram(event.target.value)}
117
+ >
118
+ {!selectedProgram ? <SelectItem text={t('chooseProgram', 'Choose a program')} value="" /> : null}
119
+ {eligiblePrograms?.length > 0 &&
120
+ eligiblePrograms.map((program) => (
121
+ <SelectItem key={program.uuid} text={program.display} value={program.uuid}>
122
+ {program.display}
123
+ </SelectItem>
124
+ ))}
125
+ </Select>
126
+ </div>
127
+ </FormGroup>
128
+ <FormGroup legendText={t('dateEnrolled', 'Date enrolled')}>
129
+ <DatePicker
130
+ id="enrollmentDate"
131
+ datePickerType="single"
132
+ dateFormat="d/m/Y"
133
+ light={isTablet}
134
+ maxDate={new Date().toISOString()}
135
+ placeholder="dd/mm/yyyy"
136
+ onChange={([date]) => setEnrollmentDate(date)}
137
+ value={enrollmentDate}
138
+ >
139
+ <DatePickerInput id="enrollmentDateInput" labelText="" />
140
+ </DatePicker>
141
+ </FormGroup>
142
+ <FormGroup legendText={t('dateCompleted', 'Date completed')}>
143
+ <DatePicker
144
+ id="completionDate"
145
+ datePickerType="single"
146
+ dateFormat="d/m/Y"
147
+ light={isTablet}
148
+ minDate={new Date(enrollmentDate).toISOString()}
149
+ maxDate={new Date().toISOString()}
150
+ placeholder="dd/mm/yyyy"
151
+ onChange={([date]) => setCompletionDate(date)}
152
+ value={completionDate}
153
+ >
154
+ <DatePickerInput id="completionDateInput" labelText="" />
155
+ </DatePicker>
156
+ </FormGroup>
157
+ <FormGroup style={{ width: '50%' }} legendText={t('enrollmentLocation', 'Enrollment location')}>
101
158
  <Select
102
- id="program"
103
- invalidText={t('required', 'Required')}
159
+ id="location"
160
+ invalidText="Required"
104
161
  labelText=""
105
162
  light={isTablet}
106
- onChange={(event) => setSelectedProgram(event.target.value)}
163
+ onChange={(event) => setUserLocation(event.target.value)}
164
+ value={userLocation}
107
165
  >
108
- {!selectedProgram ? <SelectItem text={t('chooseProgram', 'Choose a program')} value="" /> : null}
109
- {eligiblePrograms?.length > 0 &&
110
- eligiblePrograms.map((program) => (
111
- <SelectItem key={program.uuid} text={program.display} value={program.uuid}>
112
- {program.display}
166
+ {!userLocation ? <SelectItem text={t('chooseLocation', 'Choose a location')} value="" /> : null}
167
+ {availableLocations?.length > 0 &&
168
+ availableLocations.map((location) => (
169
+ <SelectItem key={location.uuid} text={location.display} value={location.uuid}>
170
+ {location.display}
113
171
  </SelectItem>
114
172
  ))}
115
173
  </Select>
116
- </div>
117
- </FormGroup>
118
- <FormGroup legendText={t('dateEnrolled', 'Date enrolled')}>
119
- <DatePicker
120
- id="enrollmentDate"
121
- datePickerType="single"
122
- dateFormat="d/m/Y"
123
- light={isTablet}
124
- maxDate={new Date().toISOString()}
125
- placeholder="dd/mm/yyyy"
126
- onChange={([date]) => setEnrollmentDate(date)}
127
- value={enrollmentDate}
128
- >
129
- <DatePickerInput id="enrollmentDateInput" labelText="" />
130
- </DatePicker>
131
- </FormGroup>
132
- <FormGroup legendText={t('dateCompleted', 'Date completed')}>
133
- <DatePicker
134
- id="completionDate"
135
- datePickerType="single"
136
- dateFormat="d/m/Y"
137
- light={isTablet}
138
- minDate={new Date(enrollmentDate).toISOString()}
139
- maxDate={new Date().toISOString()}
140
- placeholder="dd/mm/yyyy"
141
- onChange={([date]) => setCompletionDate(date)}
142
- value={completionDate}
143
- >
144
- <DatePickerInput id="completionDateInput" labelText="" />
145
- </DatePicker>
146
- </FormGroup>
147
- <FormGroup style={{ width: '50%' }} legendText={t('enrollmentLocation', 'Enrollment location')}>
148
- <Select
149
- id="location"
150
- invalidText="Required"
151
- labelText=""
152
- light={isTablet}
153
- onChange={(event) => setUserLocation(event.target.value)}
154
- value={userLocation}
155
- >
156
- {!userLocation ? <SelectItem text={t('chooseLocation', 'Choose a location')} value="" /> : null}
157
- {availableLocations?.length > 0 &&
158
- availableLocations.map((location) => (
159
- <SelectItem key={location.uuid} text={location.display} value={location.uuid}>
160
- {location.display}
161
- </SelectItem>
162
- ))}
163
- </Select>
164
- </FormGroup>
165
- <div style={{ marginTop: '1.625rem' }}>
166
- <Button style={{ width: '50%' }} kind="secondary" type="button" onClick={closeWorkspace}>
174
+ </FormGroup>
175
+ </div>
176
+ <ButtonSet className={isTablet ? styles.tablet : styles.desktop}>
177
+ <Button className={styles.button} kind="secondary" onClick={closeWorkspace}>
167
178
  {t('cancel', 'Cancel')}
168
179
  </Button>
169
- <Button style={{ width: '50%' }} kind="primary" type="submit" disabled={!selectedProgram}>
170
- {t('enroll', 'Enroll')}
180
+ <Button className={styles.button} kind="primary" disabled={!selectedProgram} type="submit">
181
+ {t('saveAndClose', 'Save and close')}
171
182
  </Button>
172
- </div>
183
+ </ButtonSet>
173
184
  </Form>
174
185
  );
175
186
  };
@@ -2,12 +2,6 @@
2
2
  @import "~carbon-components/src/globals/scss/vars";
3
3
  @import "~carbon-components/src/globals/scss/mixins";
4
4
 
5
- .alreadyEnrolledText {
6
- @include carbon--type-style("body-short-01");
7
- color: $text-02;
8
- min-height: 1rem;
9
- }
10
-
11
5
  .selectContainer {
12
6
  display: flex;
13
7
  align-items: center;
@@ -17,4 +11,46 @@
17
11
  margin-left: 1rem;
18
12
  width: 2rem;
19
13
  min-height: 2.5rem;
14
+ }
15
+
16
+
17
+ .button {
18
+ height: 4rem;
19
+ display: flex;
20
+ align-content: flex-start;
21
+ align-items: baseline;
22
+ min-width: 50%;
23
+ }
24
+
25
+ .tablet {
26
+ padding: 1.5rem 1rem;
27
+ background-color: $ui-02;
28
+ }
29
+
30
+ .desktop {
31
+ padding: 0rem;
32
+ }
33
+
34
+ .formContainer {
35
+ margin: 1rem;
36
+ }
37
+
38
+ .form {
39
+ display: flex;
40
+ flex-direction: column;
41
+ justify-content: space-between;
42
+ }
43
+
44
+ /* Desktop */
45
+ :global(.omrs-breakpoint-gt-tablet) {
46
+ .form {
47
+ height: calc(100vh - 6rem);
48
+ }
49
+ }
50
+
51
+ /* Tablet */
52
+ :global(.omrs-breakpoint-lt-desktop) {
53
+ .form {
54
+ height: calc(100vh - 3rem);
55
+ }
20
56
  }
@@ -78,7 +78,7 @@ describe('ProgramsForm: ', () => {
78
78
  expect(screen.getByRole('option', { name: /Laboratory/i })).toBeInTheDocument();
79
79
 
80
80
  const cancelButton = screen.getByRole('button', { name: /cancel/i });
81
- const enrollButton = screen.getByRole('button', { name: /enroll/i });
81
+ const enrollButton = screen.getByRole('button', { name: /save and close/i });
82
82
  expect(cancelButton).toBeInTheDocument();
83
83
  expect(enrollButton).toBeInTheDocument();
84
84
  expect(enrollButton).toBeDisabled();
@@ -116,7 +116,7 @@ describe('ProgramsForm: ', () => {
116
116
  renderProgramsForm();
117
117
 
118
118
  cancelButton = screen.getByRole('button', { name: /cancel/i });
119
- enrollButton = screen.getByRole('button', { name: /enroll/i });
119
+ enrollButton = screen.getByRole('button', { name: /save and close/i });
120
120
  enrollmentDateInput = screen.getAllByRole('textbox', { name: '' })[0];
121
121
  selectLocationInput = screen.getAllByRole('combobox', { name: '' })[1];
122
122
  selectProgramInput = screen.getAllByRole('combobox', { name: '' })[0];
@@ -10,7 +10,6 @@
10
10
  "dateCompleted": "Date completed",
11
11
  "dateEnrolled": "Date enrolled",
12
12
  "editProgram": "Edit program",
13
- "enroll": "Enroll",
14
13
  "enrolledAt": "Enrolled at",
15
14
  "enrolledOn": "Enrolled on",
16
15
  "enrollmentLocation": "Enrollment location",
@@ -24,6 +23,7 @@
24
23
  "programEnrollmentSaveError": "Error saving program enrollment",
25
24
  "programs": "programs",
26
25
  "required": "Required",
26
+ "saveAndClose": "Save and close",
27
27
  "seeAll": "See all",
28
28
  "status": "Status"
29
29
  }