diff --git a/app/src/main/java/org/dhis2/usescases/searchTrackEntity/SearchTEIViewModel.kt b/app/src/main/java/org/dhis2/usescases/searchTrackEntity/SearchTEIViewModel.kt index 5d3f03c54b..8d7d84451a 100644 --- a/app/src/main/java/org/dhis2/usescases/searchTrackEntity/SearchTEIViewModel.kt +++ b/app/src/main/java/org/dhis2/usescases/searchTrackEntity/SearchTEIViewModel.kt @@ -269,6 +269,7 @@ class SearchTEIViewModel( ), ) } + uiState = uiState.copy(searchEnabled = queryData.isNotEmpty()) } fun fetchListResults(onPagedListReady: (Flow>?) -> Unit) { diff --git a/app/src/main/java/org/dhis2/usescases/searchTrackEntity/searchparameters/SearchParametersScreen.kt b/app/src/main/java/org/dhis2/usescases/searchTrackEntity/searchparameters/SearchParametersScreen.kt index bdbc4aaf64..2ad3b9241e 100644 --- a/app/src/main/java/org/dhis2/usescases/searchTrackEntity/searchparameters/SearchParametersScreen.kt +++ b/app/src/main/java/org/dhis2/usescases/searchTrackEntity/searchparameters/SearchParametersScreen.kt @@ -201,6 +201,7 @@ fun SearchParametersScreen( } Button( + enabled = uiState.searchEnabled, modifier = Modifier .fillMaxWidth() .padding(16.dp, 8.dp, 16.dp, 8.dp) diff --git a/app/src/main/java/org/dhis2/usescases/searchTrackEntity/searchparameters/model/SearchParametersUiState.kt b/app/src/main/java/org/dhis2/usescases/searchTrackEntity/searchparameters/model/SearchParametersUiState.kt index 9e12fee398..1798f5fab7 100644 --- a/app/src/main/java/org/dhis2/usescases/searchTrackEntity/searchparameters/model/SearchParametersUiState.kt +++ b/app/src/main/java/org/dhis2/usescases/searchTrackEntity/searchparameters/model/SearchParametersUiState.kt @@ -8,6 +8,7 @@ data class SearchParametersUiState( val items: List = listOf(), val minAttributesMessage: String? = null, private val _shouldShowMinAttributeWarning: MutableSharedFlow = MutableSharedFlow(), + val searchEnabled: Boolean = false, ) { val shouldShowMinAttributeWarning: SharedFlow = _shouldShowMinAttributeWarning