@ampath/esm-patient-registration-app 6.0.1-pre.184 → 6.0.1-pre.188

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/routes.json CHANGED
@@ -1 +1 @@
1
- {"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"webservices.rest":"^2.24.0"},"pages":[{"component":"root","route":"patient-registration","online":true,"offline":true},{"component":"editPatient","routeRegex":"patient\\/([a-zA-Z0-9\\-]+)\\/edit","online":true,"offline":true}],"extensions":[{"component":"addPatientLink","name":"add-patient-action","slot":"top-nav-actions-slot","online":true,"offline":true},{"component":"cancelPatientEditModal","name":"cancel-patient-edit-modal","online":true,"offline":true},{"component":"patientPhotoExtension","name":"patient-photo-widget","slot":"patient-photo-slot","online":true,"offline":true},{"component":"editPatientDetailsButton","name":"edit-patient-details-button","slot":"patient-actions-slot","online":true,"offline":true},{"component":"editPatientDetailsButton","name":"edit-patient-details-button","slot":"patient-search-actions-slot","online":true,"offline":true},{"component":"deleteIdentifierConfirmationModal","name":"delete-identifier-confirmation-modal","online":true,"offline":true},{"component":"emptyClientRegistryModal","name":"empty-client-registry-modal","online":true,"offline":true},{"component":"confirmClientRegistryModal","name":"confirm-client-registry-modal","online":true,"offline":true}],"version":"6.0.1-pre.184"}
1
+ {"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"webservices.rest":"^2.24.0"},"pages":[{"component":"root","route":"patient-registration","online":true,"offline":true},{"component":"editPatient","routeRegex":"patient\\/([a-zA-Z0-9\\-]+)\\/edit","online":true,"offline":true}],"extensions":[{"component":"addPatientLink","name":"add-patient-action","slot":"top-nav-actions-slot","online":true,"offline":true},{"component":"cancelPatientEditModal","name":"cancel-patient-edit-modal","online":true,"offline":true},{"component":"patientPhotoExtension","name":"patient-photo-widget","slot":"patient-photo-slot","online":true,"offline":true},{"component":"editPatientDetailsButton","name":"edit-patient-details-button","slot":"patient-actions-slot","online":true,"offline":true},{"component":"editPatientDetailsButton","name":"edit-patient-details-button","slot":"patient-search-actions-slot","online":true,"offline":true},{"component":"deleteIdentifierConfirmationModal","name":"delete-identifier-confirmation-modal","online":true,"offline":true},{"component":"emptyClientRegistryModal","name":"empty-client-registry-modal","online":true,"offline":true},{"component":"confirmClientRegistryModal","name":"confirm-client-registry-modal","online":true,"offline":true}],"version":"6.0.1-pre.188"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ampath/esm-patient-registration-app",
3
- "version": "6.0.1-pre.184",
3
+ "version": "6.0.1-pre.188",
4
4
  "description": "Patient registration microfrontend for the OpenMRS SPA",
5
5
  "browser": "dist/ampath-esm-patient-registration-app.js",
6
6
  "main": "src/index.ts",
@@ -1,11 +1,10 @@
1
1
  import React, { type ChangeEvent, useCallback, useContext } from 'react';
2
- import { ContentSwitcher, DatePicker, DatePickerInput, Layer, Switch, TextInput } from '@carbon/react';
2
+ import { ContentSwitcher, Layer, Switch, TextInput } from '@carbon/react';
3
3
  import { useTranslation } from 'react-i18next';
4
4
  import { useField } from 'formik';
5
- import { generateFormatting } from '../../date-util';
5
+ import { type CalendarDate, getLocalTimeZone } from '@internationalized/date';
6
6
  import { PatientRegistrationContext } from '../../patient-registration-context';
7
7
  import { OpenmrsDatePicker, useConfig } from '@openmrs/esm-framework';
8
- import { type CalendarDate } from '@internationalized/date';
9
8
  import { type RegistrationConfig } from '../../../config-schema';
10
9
  import styles from '../field.scss';
11
10
 
@@ -33,7 +32,6 @@ export const DobField: React.FC = () => {
33
32
  const [yearsEstimated, yearsEstimateMeta] = useField('yearsEstimated');
34
33
  const [monthsEstimated, monthsEstimateMeta] = useField('monthsEstimated');
35
34
  const { setFieldValue } = useContext(PatientRegistrationContext);
36
- const { format, placeHolder, dateFormat } = generateFormatting(['d', 'm', 'Y'], '/');
37
35
  const today = new Date();
38
36
 
39
37
  const onToggle = useCallback(
@@ -48,7 +46,7 @@ export const DobField: React.FC = () => {
48
46
 
49
47
  const onDateChange = useCallback(
50
48
  (birthdate: CalendarDate) => {
51
- setFieldValue('birthdate', birthdate);
49
+ setFieldValue('birthdate', birthdate?.toDate(getLocalTimeZone()));
52
50
  },
53
51
  [setFieldValue],
54
52
  );
@@ -105,55 +103,49 @@ export const DobField: React.FC = () => {
105
103
  <OpenmrsDatePicker
106
104
  id="birthdate"
107
105
  {...birthdate}
108
- // dateFormat={dateFormat}
109
106
  onChange={onDateChange}
110
- //maxDate={today}
107
+ maxDate={today}
111
108
  labelText={t('dateOfBirthLabelText', 'Date of Birth')}
112
- // invalid={!!(birthdateMeta.touched && birthdateMeta.error)}
113
- // invalidText={birthdateMeta.error && t(birthdateMeta.error)}
109
+ isInvalid={!!(birthdateMeta.touched && birthdateMeta.error)}
114
110
  value={birthdate.value}
115
- // carbonOptions={{
116
- // placeholder: placeHolder,
117
- // }}
118
111
  />
112
+ {!!(birthdateMeta.touched && birthdateMeta.error) && (
113
+ <div className={styles.radioFieldError}>{birthdateMeta.error && t(birthdateMeta.error)}</div>
114
+ )}
119
115
  </div>
120
116
  ) : (
121
117
  <div className={styles.grid}>
122
118
  <div className={styles.dobField}>
123
- <Layer>
124
- <TextInput
125
- id="yearsEstimated"
126
- type="number"
127
- name={yearsEstimated.name}
128
- onChange={onEstimatedYearsChange}
129
- labelText={t('estimatedAgeInYearsLabelText', 'Estimated age in years')}
130
- invalid={!!(yearsEstimateMeta.touched && yearsEstimateMeta.error)}
131
- invalidText={yearsEstimateMeta.error && t(yearsEstimateMeta.error)}
132
- value={yearsEstimated.value}
133
- min={0}
134
- required
135
- {...yearsEstimated}
136
- onBlur={updateBirthdate}
137
- />
138
- </Layer>
119
+ <TextInput
120
+ id="yearsEstimated"
121
+ type="number"
122
+ name={yearsEstimated.name}
123
+ onChange={onEstimatedYearsChange}
124
+ labelText={t('estimatedAgeInYearsLabelText', 'Estimated age in years')}
125
+ invalid={!!(yearsEstimateMeta.touched && yearsEstimateMeta.error)}
126
+ invalidText={yearsEstimateMeta.error && t(yearsEstimateMeta.error)}
127
+ value={yearsEstimated.value}
128
+ min={0}
129
+ required
130
+ {...yearsEstimated}
131
+ onBlur={updateBirthdate}
132
+ />
139
133
  </div>
140
134
  <div className={styles.dobField}>
141
- <Layer>
142
- <TextInput
143
- id="monthsEstimated"
144
- type="number"
145
- name={monthsEstimated.name}
146
- onChange={onEstimatedMonthsChange}
147
- labelText={t('estimatedAgeInMonthsLabelText', 'Estimated age in months')}
148
- invalid={!!(monthsEstimateMeta.touched && monthsEstimateMeta.error)}
149
- invalidText={monthsEstimateMeta.error && t(monthsEstimateMeta.error)}
150
- value={monthsEstimated.value}
151
- min={0}
152
- {...monthsEstimated}
153
- required={!yearsEstimateMeta.value}
154
- onBlur={updateBirthdate}
155
- />
156
- </Layer>
135
+ <TextInput
136
+ id="monthsEstimated"
137
+ type="number"
138
+ name={monthsEstimated.name}
139
+ onChange={onEstimatedMonthsChange}
140
+ labelText={t('estimatedAgeInMonthsLabelText', 'Estimated age in months')}
141
+ invalid={!!(monthsEstimateMeta.touched && monthsEstimateMeta.error)}
142
+ invalidText={monthsEstimateMeta.error && t(monthsEstimateMeta.error)}
143
+ value={monthsEstimated.value}
144
+ min={0}
145
+ {...monthsEstimated}
146
+ required={!yearsEstimateMeta.value}
147
+ onBlur={updateBirthdate}
148
+ />
157
149
  </div>
158
150
  </div>
159
151
  )}
@@ -79,8 +79,13 @@ export function useConceptAnswers(conceptUuid: string): { data: Array<ConceptAns
79
79
  }
80
80
 
81
81
  const urlencoded = new URLSearchParams();
82
- urlencoded.append('client_id', 'palladium.partner.client');
83
- urlencoded.append('client_secret', '28f95b2a');
82
+ // urlencoded.append('client_id', 'palladium.partner.client');
83
+ // urlencoded.append('client_secret', '28f95b2a');
84
+ // urlencoded.append('grant_type', 'client_credentials');
85
+ // urlencoded.append('scope', 'DHP.Gateway DHP.Partners');
86
+
87
+ urlencoded.append('client_id', 'ampath.partner.client');
88
+ urlencoded.append('client_secret', '3ae8a7f6');
84
89
  urlencoded.append('grant_type', 'client_credentials');
85
90
  urlencoded.append('scope', 'DHP.Gateway DHP.Partners');
86
91
 
@@ -165,7 +170,7 @@ async function postToRegistry(
165
170
  }
166
171
 
167
172
  export const useFacilityName = (facilityCode) => {
168
- const apiUrl = `/ws/rest/v1/kenyaemr/facilityName?facilityCode=${facilityCode}`;
173
+ const apiUrl = `/ws/rest/v1/amrscore/facilityName?facilityCode=${facilityCode}`;
169
174
  const { data, error, isLoading } = useSWRImmutable<FetchResponse>(apiUrl, openmrsFetch);
170
175
 
171
176
  return {