Skip to content

Commit

Permalink
Merge pull request #69 from PiusKariuki/chore/autopopulate-gender-on-…
Browse files Browse the repository at this point in the history
…edit-SJT-75

Gender autopopulation during edit SJT-75
  • Loading branch information
Michaelndula authored Aug 27, 2024
2 parents 7a10a1d + 4c432bb commit f78952b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 21 deletions.
4 changes: 2 additions & 2 deletions packages/esm-patient-registration-app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sjthc/esm-patient-registration-app",
"version": "5.3.6",
"version": "5.4.3",
"description": "Patient registration microfrontend for O3",
"browser": "dist/sjthc-esm-patient-registration-app.js",
"main": "src/index.ts",
Expand Down Expand Up @@ -54,5 +54,5 @@
"devDependencies": {
"webpack": "^5.74.0"
},
"gitHead": "7a9851e74b1c8e8aaf17272d09597748186880ea"
"gitHead": "4f4cdebe35e80399ec4e52fcbe222a1fe383706e"
}
8 changes: 1 addition & 7 deletions packages/esm-patient-registration-app/src/config-schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ export const esmPatientRegistrationSchema = {
_type: Type.String,
_description:
'Value that will be sent to the server. Limited to FHIR-supported values for Administrative Gender',
_validators: [validators.oneOf(['male', 'female', 'other', 'unknown'])],
_validators: [validators.oneOf(['male', 'female'])],
},
label: {
_type: Type.String,
Expand All @@ -248,12 +248,6 @@ export const esmPatientRegistrationSchema = {
{
value: 'female',
},
{
value: 'other',
},
{
value: 'unknown',
},
],
_description:
'The options for sex selection during patient registration. This is Administrative Gender as it is called by FHIR (Possible options are limited to those defined in FHIR Administrative Gender, see https://hl7.org/fhir/R4/valueset-administrative-gender.html).',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, {useContext, useEffect} from 'react';
import React, {useContext} from 'react';
import { RadioButton, RadioButtonGroup } from '@carbon/react';
import { useTranslation } from 'react-i18next';
import { PatientRegistrationContext } from '../../patient-registration-context';
Expand All @@ -25,22 +25,13 @@ export const GenderField: React.FC = () => {
* t('unknown', 'Unknown')
*/

/**
* Initialize the gender field each time the page is loaded
* This is useful for edit scenarios
*
*/
useEffect(() => {
if(field?.value)
setGender(field?.value);
}, [field?.value]);

return (
<div className={styles.halfWidthInDesktopView}>
<h4 className={styles.productiveHeading02Light}>{t('sexFieldLabelText', 'Sex')}</h4>
<div className={styles.sexField}>
<p className="cds--label">{t('genderLabelText', 'Sex')}</p>
<RadioButtonGroup name="gender" orientation="vertical" onChange={setGender} valueSelected={field.value}>
<RadioButtonGroup name="gender" orientation="vertical" onChange={setGender} valueSelected={field.value} defaultSelected={field.value}
>
{fieldConfigs.map((option) => (
<RadioButton
key={option.label ?? option.value}
Expand Down

0 comments on commit f78952b

Please sign in to comment.