Skip to content

Commit

Permalink
update: [ANDROAPP-4826] visual changes when there is no fields in the…
Browse files Browse the repository at this point in the history
… section
  • Loading branch information
DavidAparicioAlbaAsenjo committed Feb 15, 2024
1 parent 87901ae commit a0e4828
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions form/src/main/java/org/dhis2/form/ui/Form.kt
Original file line number Diff line number Diff line change
Expand Up @@ -109,23 +109,27 @@ fun Form(
focusManager.clearFocus()
}
}

val sectionMessage = if (section.fields.isEmpty()) resources.getString(R.string.form_without_fields) else null

val sectionState = if (section.fields.isEmpty()) SectionState.FIXED else section.state

Section(
title = section.title,
isLastSection = getNextSection(section, sections) == null,
description = if (sections.size >= 2 && section.fields.isNotEmpty()) section.description else null,
completedFields = section.completedFields(),
totalFields = section.fields.size,
state = section.state,
state = sectionState,
errorCount = section.errorCount(),
warningCount = section.warningCount(),
warningMessage = resources.getString(R.string.form_without_fields),
warningMessage = sectionMessage,
onNextSection = onNextSection,
onSectionClick = {
intentHandler.invoke(FormIntent.OnSection(section.uid))
},
content = {
if (sections.size >= 2 && section.fields.isNotEmpty()) {
if (section.fields.isNotEmpty()) {
section.fields.forEachIndexed { index, fieldUiModel ->
fieldUiModel.setCallback(callback)
FieldProvider(
Expand Down

0 comments on commit a0e4828

Please sign in to comment.