From aead314781a3ae81d39c39e1fc4114f7f96cc21d Mon Sep 17 00:00:00 2001 From: himeshr Date: Fri, 3 Feb 2023 18:44:47 +0530 Subject: [PATCH] #736 | Support Subject form elements in repeatable question group --- .../views/form/formElement/QuestionGroup.js | 22 +++++++++++++++++++ .../form/formElement/SubjectFormElement.js | 4 ++++ 2 files changed, 26 insertions(+) diff --git a/packages/openchs-android/src/views/form/formElement/QuestionGroup.js b/packages/openchs-android/src/views/form/formElement/QuestionGroup.js index 18451c868..6a83540d7 100644 --- a/packages/openchs-android/src/views/form/formElement/QuestionGroup.js +++ b/packages/openchs-android/src/views/form/formElement/QuestionGroup.js @@ -30,6 +30,8 @@ import DurationDateFormElement from "./DurationDateFormElement"; import DurationFormElement from "./DurationFormElement"; import MultiSelectMediaFormElement from "./MultiSelectMediaFormElement"; import PhoneNumberFormElement from "./PhoneNumberFormElement"; +import SingleSelectSubjectLandingFormElement from './SingleSelectSubjectLandingFormElement'; +import MultiSelectSubjectLandingFormElement from './MultiSelectSubjectLandingFormElement'; class QuestionGroup extends AbstractFormElement { static propTypes = { @@ -95,6 +97,11 @@ class QuestionGroup extends AbstractFormElement { return _.isNil(observation) ? nullReplacement : observation.getValueWrapper(); } + getSelectedAnswerFromObservationHolder(concept, element, questionGroupIndex, nullReplacement) { + const observation = this.props.observationHolder.findQuestionGroupObservation(concept, element, questionGroupIndex); + return _.isNil(observation) ? nullReplacement : observation.getValueWrapper(); + } + renderTextFormElement(formElement) { return } + if (dataType === dataTypes.Subject && fe.isSingleSelect()) { + return + } + if (dataType === dataTypes.Subject && fe.isMultiSelect()) { + return + } })} ) diff --git a/packages/openchs-android/src/views/form/formElement/SubjectFormElement.js b/packages/openchs-android/src/views/form/formElement/SubjectFormElement.js index 6954d5998..ce501086b 100644 --- a/packages/openchs-android/src/views/form/formElement/SubjectFormElement.js +++ b/packages/openchs-android/src/views/form/formElement/SubjectFormElement.js @@ -57,6 +57,8 @@ class SubjectFormElement extends AbstractFormElement { this.dispatchAction(this.props.actionName, { formElement: this.props.element, answerUUID: subjectUUID, + parentFormElement: this.props.parentElement, + questionGroupIndex: this.props.questionGroupIndex, }); } @@ -80,6 +82,8 @@ class SubjectFormElement extends AbstractFormElement { this.dispatchAction(this.props.actionName, { formElement: this.props.element, answerUUID: individual.uuid, + parentFormElement: this.props.parentElement, + questionGroupIndex: this.props.questionGroupIndex, }); } }).to(IndividualSearchView, true);