Skip to content

Commit

Permalink
(fix) unkown patient name and estimated dob config fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Jexsie committed May 15, 2023
1 parent 3ea2167 commit 14d22a7
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ export const DobField: React.FC = () => {
const { t } = useTranslation();
const {
fieldConfigurations: { dateOfBirth },
} = useConfig() as RegistrationConfig;
} = useConfig<RegistrationConfig>();
const allowEstimatedBirthDate = dateOfBirth?.useEstimatedDateOfBirth?.enabled;
const [dobUnknown] = useField('birthdateEstimated');
const dobKnown = !dobUnknown.value;
const [birthdate, birthdateMeta] = useField('birthdate');
Expand Down Expand Up @@ -75,15 +76,17 @@ export const DobField: React.FC = () => {
return (
<div className={styles.halfWidthInDesktopView}>
<h4 className={styles.productiveHeading02Light}>{t('birthFieldLabelText', 'Birth')}</h4>
<div className={styles.dobField}>
<div className={styles.dobContentSwitcherLabel}>
<span className={styles.label01}>{t('dobToggleLabelText', 'Date of Birth Known?')}</span>
{allowEstimatedBirthDate && (
<div className={styles.dobField}>
<div className={styles.dobContentSwitcherLabel}>
<span className={styles.label01}>{t('dobToggleLabelText', 'Date of Birth Known?')}</span>
</div>
<ContentSwitcher onChange={onToggle}>
<Switch name="known" text={t('yes', 'Yes')} />
<Switch name="unknown" text={t('no', 'No')} />
</ContentSwitcher>
</div>
<ContentSwitcher onChange={onToggle}>
<Switch name="known" text={t('yes', 'Yes')} />
<Switch name="unknown" text={t('no', 'No')} />
</ContentSwitcher>
</div>
)}
<Layer>
{dobKnown ? (
<div className={styles.dobField}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ export const NameField = () => {
} = useConfig() as RegistrationConfig;
const { t } = useTranslation();
const { setCapturePhotoProps, currentPhoto, setFieldValue } = useContext(PatientRegistrationContext);
const { fieldConfigurations } = useConfig();
const { fieldConfigurations } = useConfig<RegistrationConfig>();
const fieldConfigs = fieldConfigurations?.name;
const allowUnknownName = fieldConfigs?.unidentifiedPatient;
const [{ value: unidentified }] = useField('unidentifiedPatient');
const nameKnown = !unidentified;

Expand Down Expand Up @@ -68,13 +69,17 @@ export const NameField = () => {
)}

<div className={styles.nameField}>
<div className={styles.dobContentSwitcherLabel}>
<span className={styles.label01}>{t('patientNameKnown', "Patient's Name is Known?")}</span>
</div>
<ContentSwitcher className={styles.contentSwitcher} onChange={toggleNameKnown}>
<Switch name="known" text={t('yes', 'Yes')} />
<Switch name="unknown" text={t('no', 'No')} />
</ContentSwitcher>
{allowUnknownName && (
<>
<div className={styles.dobContentSwitcherLabel}>
<span className={styles.label01}>{t('patientNameKnown', "Patient's Name is Known?")}</span>
</div>
<ContentSwitcher className={styles.contentSwitcher} onChange={toggleNameKnown}>
<Switch name="known" text={t('yes', 'Yes')} />
<Switch name="unknown" text={t('no', 'No')} />
</ContentSwitcher>
</>
)}
{nameKnown && (
<>
<Input
Expand Down

0 comments on commit 14d22a7

Please sign in to comment.