Skip to content

Commit ff36e1a

Browse files
committed
Updated subform field component for adding summary feature
1 parent 1293754 commit ff36e1a

File tree

1 file changed

+8
-2
lines changed
  • app/javascript/components/record-form/form/subforms/subform-field-array

1 file changed

+8
-2
lines changed

app/javascript/components/record-form/form/subforms/subform-field-array/component.jsx

+8-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { isFamilyDetailSubform, isFamilyMemberSubform, isViolationSubform } from
1616
import { GuidingQuestions } from "../../components";
1717

1818
import { isEmptyOrAllDestroyed, isTracesSubform } from "./utils";
19-
19+
import SubformSummary from "../../../../pages/admin/child-functioning/SubformSummary"
2020
function Component({
2121
arrayHelpers,
2222
field,
@@ -109,9 +109,15 @@ function Component({
109109
<GuidingQuestions label={i18n.t("buttons.guidance")} text={guidingQuestions[i18n.locale]} />
110110
</div>
111111
);
112-
112+
const latestValue = orderedValues === undefined ? null : orderedValues[orderedValues.length - 1]
113113
return (
114114
<div className={css.fieldArray} data-testid="subform-field-array">
115+
116+
{/* Conditionally Render Child Functioning Subform Summary */}
117+
{title === 'Child Functioning Subform' && (
118+
<SubformSummary latestValue={latestValue} />
119+
)}
120+
115121
<div className={cssContainer}>
116122
{!renderAsAccordion && (
117123
<div data-testid="subForm-header">

0 commit comments

Comments
 (0)