diff --git a/src/views/Questionnaire/QuestionnaireForm.css b/src/views/Questionnaire/QuestionnaireForm.css index 899d6d0..11b1fe3 100644 --- a/src/views/Questionnaire/QuestionnaireForm.css +++ b/src/views/Questionnaire/QuestionnaireForm.css @@ -51,10 +51,6 @@ margin-bottom: 10px; } - .btn-row { - display: flex; - } - .error-text { text-align: end; font-style: italic; @@ -82,11 +78,6 @@ color: white; } - .status-panel { - margin-left: 10px; - margin-bottom: 10px; - } - .filled { color:white; diff --git a/src/views/Questionnaire/QuestionnaireForm.tsx b/src/views/Questionnaire/QuestionnaireForm.tsx index 8990b30..8ac815d 100644 --- a/src/views/Questionnaire/QuestionnaireForm.tsx +++ b/src/views/Questionnaire/QuestionnaireForm.tsx @@ -28,7 +28,16 @@ import { getDrugCodeableConceptFromMedicationRequest } from './questionnaireUtil'; import './QuestionnaireForm.css'; -import { Button, Typography } from '@mui/material'; +import { + Accordion, + AccordionDetails, + AccordionSummary, + Button, + Chip, + Stack, + Typography +} from '@mui/material'; +import ExpandMoreIcon from '@mui/icons-material/ExpandMore'; import Tooltip from '@mui/material/Tooltip'; import Client from 'fhirclient/lib/Client'; @@ -40,6 +49,7 @@ import { PrepopulationResults } from './SmartApp'; import { v4 as uuid } from 'uuid'; import axios, { AxiosResponse } from 'axios'; import { createRoot } from 'react-dom/client'; +import { red } from '@mui/material/colors'; declare global { interface Window { LForms: any; @@ -109,6 +119,7 @@ export function QuestionnaireForm(props: QuestionnaireProps) { const partialForms: PartialForms = {}; const LForms = window.LForms; const questionnaireFormId = `formContainer-${props.qform.id}-${props.tabIndex}`; + useEffect(() => { // search for any partially completed QuestionnaireResponses if (props.response) { @@ -1038,7 +1049,7 @@ export function QuestionnaireForm(props: QuestionnaireProps) { }; // Get missing fields to display - const getMissingFields = () => { + const getMissingFields = (): JSX.Element => { const fields: string[] = []; const requiredFieldErrors = formValidationErrors ? formValidationErrors.filter(error => { @@ -1051,14 +1062,45 @@ export function QuestionnaireForm(props: QuestionnaireProps) { fields.push(name); }); } - return fields.join(', '); + return ( + + + }> + + You must include a value for the following missing fields (click to expand): + + + + {fields.map((field, index) => ( + + ))} + + + + ); }; const getDisplayButtons = () => { if (!isAdaptiveForm()) { return ( -
-
+ <> + @@ -1083,18 +1125,14 @@ export function QuestionnaireForm(props: QuestionnaireProps) { -
- {!isFilledOut() ? ( -

You must include a value for {getMissingFields()}

- ) : ( - <> - )} -
+ + {!isFilledOut() && getMissingFields()} + ); } else { if (props.adFormCompleted) { return ( -
+
+ ); } else { return ( -
- {isAdaptiveFormWithoutItem() ? ( + + {isAdaptiveFormWithoutItem() && ( - ) : null} - {isAdaptiveFormWithItem() ? ( + )} + {isAdaptiveFormWithItem() && ( - ) : null} -
+ )} + ); } } @@ -1645,15 +1683,15 @@ export function QuestionnaireForm(props: QuestionnaireProps) { return (
- {!isAdaptive && props.formFilled ? ( + {!isAdaptive && props.formFilled && (

All fields have been filled. Continue or uncheck "Only Show Unfilled Fields" to review and modify the form.

- ) : null} - {showPopup ? ( + )} + {showPopup && ( - ) : null} + )} - {isAdaptive ? ( + {isAdaptive && (
- {isAdaptiveFormWithoutItem() && !props.adFormCompleted ? ( + {isAdaptiveFormWithoutItem() && !props.adFormCompleted && (

Click Next Question button to proceed.

- ) : null} - {!props.adFormCompleted ? ( + )} + {!props.adFormCompleted && (
{' '}
- ) : null} + )}
- ) : null} -
- {!isAdaptive ?
Form Loaded: {formLoaded}
:
} + )} + + {!isAdaptive && Form Loaded: {formLoaded}} {getDisplayButtons()} -
+
); }