From a5c2fece78ae0bbb17e85a48a2dd05e76d882bef Mon Sep 17 00:00:00 2001 From: FikriMilano Date: Thu, 26 Sep 2024 09:21:35 +0700 Subject: [PATCH] Add summary mode (#3500) Co-authored-by: Elly Kitoto --- .../fhircore/engine/domain/model/QuestionnaireType.kt | 4 ++++ .../fhircore/quest/ui/questionnaire/QuestionnaireActivity.kt | 2 ++ 2 files changed, 6 insertions(+) diff --git a/android/engine/src/main/java/org/smartregister/fhircore/engine/domain/model/QuestionnaireType.kt b/android/engine/src/main/java/org/smartregister/fhircore/engine/domain/model/QuestionnaireType.kt index bf3fce59b7..ba490a4ec7 100644 --- a/android/engine/src/main/java/org/smartregister/fhircore/engine/domain/model/QuestionnaireType.kt +++ b/android/engine/src/main/java/org/smartregister/fhircore/engine/domain/model/QuestionnaireType.kt @@ -22,6 +22,7 @@ enum class QuestionnaireType { DEFAULT, EDIT, READ_ONLY, + SUMMARY, } fun QuestionnaireConfig.isDefault() = @@ -32,3 +33,6 @@ fun QuestionnaireConfig.isEditable() = fun QuestionnaireConfig.isReadOnly() = QuestionnaireType.valueOf(this.type) == QuestionnaireType.READ_ONLY + +fun QuestionnaireConfig.isSummary() = + QuestionnaireType.valueOf(this.type) == QuestionnaireType.SUMMARY diff --git a/android/quest/src/main/java/org/smartregister/fhircore/quest/ui/questionnaire/QuestionnaireActivity.kt b/android/quest/src/main/java/org/smartregister/fhircore/quest/ui/questionnaire/QuestionnaireActivity.kt index 54d7cd8d4b..97e6fd1886 100644 --- a/android/quest/src/main/java/org/smartregister/fhircore/quest/ui/questionnaire/QuestionnaireActivity.kt +++ b/android/quest/src/main/java/org/smartregister/fhircore/quest/ui/questionnaire/QuestionnaireActivity.kt @@ -49,6 +49,7 @@ import org.smartregister.fhircore.engine.configuration.QuestionnaireConfig import org.smartregister.fhircore.engine.configuration.app.LocationLogOptions import org.smartregister.fhircore.engine.domain.model.ActionParameter import org.smartregister.fhircore.engine.domain.model.isReadOnly +import org.smartregister.fhircore.engine.domain.model.isSummary import org.smartregister.fhircore.engine.ui.base.AlertDialogue import org.smartregister.fhircore.engine.ui.base.BaseMultiLanguageActivity import org.smartregister.fhircore.engine.util.DispatcherProvider @@ -282,6 +283,7 @@ class QuestionnaireActivity : BaseMultiLanguageActivity() { ) .showAsterisk(this.questionnaireConfig.showRequiredTextAsterisk) .showRequiredText(this.questionnaireConfig.showRequiredText) + .setIsReadOnly(questionnaireConfig.isSummary()) .apply { if (questionnaireResponse != null) { questionnaireResponse