Skip to content

Commit

Permalink
(feat) Add mode prop to React Form Engine component to handle differe…
Browse files Browse the repository at this point in the history
…nt views (#1678)

(feat) Add mode prop to OHRI for component to handle different views
  • Loading branch information
CynthiaKamau authored Feb 20, 2024
1 parent d2ea508 commit 56e5362
Showing 1 changed file with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { useTranslation } from 'react-i18next';
import { InlineLoading } from '@carbon/react';
import { OHRIForm } from '@openmrs/openmrs-form-engine-lib';
import { OHRIForm, type SessionMode } from '@openmrs/openmrs-form-engine-lib';
import { type Visit } from '@openmrs/esm-framework';
import useFormSchema from '../hooks/useFormSchema';
import FormError from './form-error.component';
Expand All @@ -13,9 +13,17 @@ interface FormRendererProps {
visit?: Visit;
closeWorkspace: () => void;
encounterUuid?: string;
mode?: SessionMode;
}

const FormRenderer: React.FC<FormRendererProps> = ({ formUuid, patientUuid, visit, closeWorkspace, encounterUuid }) => {
const FormRenderer: React.FC<FormRendererProps> = ({
formUuid,
patientUuid,
visit,
closeWorkspace,
encounterUuid,
mode,
}) => {
const { t } = useTranslation();
const { schema, error, isLoading } = useFormSchema(formUuid);

Expand Down Expand Up @@ -45,6 +53,7 @@ const FormRenderer: React.FC<FormRendererProps> = ({ formUuid, patientUuid, visi
formJson={schema}
handleClose={closeWorkspace}
onSubmit={() => closeWorkspace()}
mode={mode}
/>
)}
</>
Expand Down

0 comments on commit 56e5362

Please sign in to comment.