From b84392d6aac24a2efe6fbec35f44262dd235d05a Mon Sep 17 00:00:00 2001 From: Shraddha Date: Mon, 17 Jun 2024 10:29:01 +0530 Subject: [PATCH] #1219|DEA fails if no options provided for Duration --- .../components/FormElementDetails.js | 427 +-- src/formDesigner/views/FormDetails.js | 9 + yarn.lock | 2730 ++++++++++++++++- 3 files changed, 2739 insertions(+), 427 deletions(-) diff --git a/src/formDesigner/components/FormElementDetails.js b/src/formDesigner/components/FormElementDetails.js index b083a407c..2f1734e2b 100644 --- a/src/formDesigner/components/FormElementDetails.js +++ b/src/formDesigner/components/FormElementDetails.js @@ -1,15 +1,5 @@ import React, { Fragment } from "react"; -import { - Button, - Checkbox, - FormControlLabel, - FormGroup, - FormLabel, - Input, - InputLabel, - Paper, - Select -} from "@material-ui/core"; +import { Button, Checkbox, FormControlLabel, FormGroup, FormLabel, Input, InputLabel, Paper, Select } from "@material-ui/core"; import Grid from "@material-ui/core/Grid"; import { makeStyles, withStyles } from "@material-ui/core/styles"; import MuiFormControl from "@material-ui/core/FormControl"; @@ -51,14 +41,7 @@ const showPicker = (pickerType, cssClasses, props, disableFormElement) => { const picker = pickers.find(picker => picker.type === pickerType); const pickerModes = []; _.forEach(picker.modes, mode => { - pickerModes.push( - } - label={mode.name} - disabled={disableFormElement} - /> - ); + pickerModes.push(} label={mode.name} disabled={disableFormElement} />); }); return ( @@ -69,14 +52,7 @@ const showPicker = (pickerType, cssClasses, props, disableFormElement) => { aria-label={picker.label} name={picker.key} value={props.formElementData.keyValues[picker.key]} - onChange={event => - props.handleGroupElementKeyValueChange( - props.groupIndex, - picker.key, - event.target.value, - props.index - ) - } + onChange={event => props.handleGroupElementKeyValueChange(props.groupIndex, picker.key, event.target.value, props.index)} row > {pickerModes} @@ -140,9 +116,7 @@ function FormElementDetails({ userInfo, ...props }) { } function groupSubjectTypeList() { - return _.map(props.groupSubjectTypes, ({ name, uuid }) => ( - {name} - )); + return _.map(props.groupSubjectTypes, ({ name, uuid }) => {name}); } function groupRoleList() { @@ -150,9 +124,7 @@ function FormElementDetails({ userInfo, ...props }) { props.groupSubjectTypes, ({ uuid }) => uuid === props.formElementData.keyValues.groupSubjectTypeUUID ); - return _.map(selectedGroupSubjectType.groupRoles, ({ role, uuid }) => ( - {role} - )); + return _.map(selectedGroupSubjectType.groupRoles, ({ role, uuid }) => {role}); } const renderDurationOptions = () => { @@ -164,19 +136,10 @@ function FormElementDetails({ userInfo, ...props }) { control={ - props.handleGroupElementKeyValueChange( - props.groupIndex, - `${duration}`, - event.target.value, - props.index - ) - } + onChange={event => props.handleGroupElementKeyValueChange(props.groupIndex, `${duration}`, event.target.value, props.index)} /> } label={capitalize(duration)} @@ -199,25 +162,13 @@ function FormElementDetails({ userInfo, ...props }) { - props.handleGroupElementChange( - props.groupIndex, - "name", - replace(event.target.value, "|", ""), - props.index - ) - } + onChange={event => props.handleGroupElementChange(props.groupIndex, "name", replace(event.target.value, "|", ""), props.index)} disabled={disableFormElement} /> -
- - CONCEPT - +
+ CONCEPT
{props.formElementData.showConceptLibrary === "" && (
- props.handleConceptFormLibrary(props.groupIndex, "chooseFromLibrary", props.index) - } + onClick={event => props.handleConceptFormLibrary(props.groupIndex, "chooseFromLibrary", props.index)} disabled={disableFormElement} > Select from library @@ -245,9 +194,7 @@ function FormElementDetails({ userInfo, ...props }) {
)} - {includes( - ["Coded", "Subject", "Image", "Video", "File", "Encounter"], - props.formElementData.concept.dataType - ) && ( + {includes(["Coded", "Subject", "Image", "Video", "File", "Encounter"], props.formElementData.concept.dataType) && ( <> {props.formElementData.errorMessage && props.formElementData.errorMessage.type && ( @@ -483,14 +381,7 @@ function FormElementDetails({ userInfo, ...props }) { - props.handleGroupElementKeyValueChange( - props.groupIndex, - "videoQuality", - event.target.value, - props.index - ) + props.handleGroupElementKeyValueChange(props.groupIndex, "videoQuality", event.target.value, props.index) } > Low @@ -630,21 +488,15 @@ function FormElementDetails({ userInfo, ...props }) { placeholder="960" value={props.formElementData.keyValues.maxHeight} onChange={event => - props.handleGroupElementKeyValueChange( - props.groupIndex, - "maxHeight", - toNumber(event.target.value), - props.index - ) + props.handleGroupElementKeyValueChange(props.groupIndex, "maxHeight", toNumber(event.target.value), props.index) } margin="normal" InputProps={{ inputProps: { min: 0 } }} disabled={disableFormElement} /> - {props.formElementData.errorMessage && - props.formElementData.errorMessage.maxHeight && ( -
Please enter positive number
- )} + {props.formElementData.errorMessage && props.formElementData.errorMessage.maxHeight && ( +
Please enter positive number
+ )}
@@ -655,43 +507,25 @@ function FormElementDetails({ userInfo, ...props }) { placeholder="1280" value={props.formElementData.keyValues.maxWidth} onChange={event => - props.handleGroupElementKeyValueChange( - props.groupIndex, - "maxWidth", - toNumber(event.target.value), - props.index - ) + props.handleGroupElementKeyValueChange(props.groupIndex, "maxWidth", toNumber(event.target.value), props.index) } margin="normal" InputProps={{ inputProps: { min: 0 } }} disabled={disableFormElement} /> - {props.formElementData.errorMessage && - props.formElementData.errorMessage.maxWidth && ( -
Please enter positive number
- )} + {props.formElementData.errorMessage && props.formElementData.errorMessage.maxWidth && ( +
Please enter positive number
+ )}
- + - props.handleGroupElementKeyValueChange( - props.groupIndex, - "regex", - event.target.value, - props.index - ) - } + onChange={event => props.handleGroupElementKeyValueChange(props.groupIndex, "regex", event.target.value, props.index)} /> - + - props.handleGroupElementKeyValueChange( - props.groupIndex, - "descriptionKey", - event.target.value, - props.index - ) + props.handleGroupElementKeyValueChange(props.groupIndex, "descriptionKey", event.target.value, props.index) } /> @@ -775,10 +584,7 @@ function FormElementDetails({ userInfo, ...props }) { {props.formElementData.concept.dataType !== "QuestionGroup" && ( - + )} - {props.formElementData.concept.dataType === "Subject" && ( - - )} + {props.formElementData.concept.dataType === "Subject" && } - {["Numeric", "Text", "Date", "DateTime", "Time", "Coded"].includes( - props.formElementData.concept.dataType - ) && ( - + {["Numeric", "Text", "Date", "DateTime", "Time", "Coded"].includes(props.formElementData.concept.dataType) && ( + props.handleGroupElementKeyValueChange( props.groupIndex, @@ -837,22 +632,14 @@ function FormElementDetails({ userInfo, ...props }) { {["Numeric", "Text", "PhoneNumber"].includes(props.formElementData.concept.dataType) && ( - + - props.handleGroupElementKeyValueChange( - props.groupIndex, - "unique", - event.target.checked, - props.index - ) + props.handleGroupElementKeyValueChange(props.groupIndex, "unique", event.target.checked, props.index) } /> } @@ -865,20 +652,12 @@ function FormElementDetails({ userInfo, ...props }) { {props.formElementData.concept.dataType === "Id" && ( - + - props.handleGroupElementKeyValueChange( - props.groupIndex, - "groupSubjectTypeUUID", - event.target.value, - props.index - ) + props.handleGroupElementKeyValueChange(props.groupIndex, "groupSubjectTypeUUID", event.target.value, props.index) } required > @@ -915,20 +686,12 @@ function FormElementDetails({ userInfo, ...props }) { {props.formElementData.keyValues.groupSubjectTypeUUID && ( - +