diff --git a/ci-prepush.sh b/ci-prepush.sh old mode 100644 new mode 100755 diff --git a/core/designsystem/src/commonMain/kotlin/com/mifos/core/designsystem/component/MifosOutlinedTextField.kt b/core/designsystem/src/commonMain/kotlin/com/mifos/core/designsystem/component/MifosOutlinedTextField.kt index e4bcf207b4f..0ab8a7f21c8 100644 --- a/core/designsystem/src/commonMain/kotlin/com/mifos/core/designsystem/component/MifosOutlinedTextField.kt +++ b/core/designsystem/src/commonMain/kotlin/com/mifos/core/designsystem/component/MifosOutlinedTextField.kt @@ -208,7 +208,7 @@ fun MifosOutlinedTextField( prefix = prefix, suffix = suffix, supportingText = { - if (errorText != null) { + if (errorText != null && isError) { Text( modifier = Modifier.testTag(errorTextTag), text = errorText, diff --git a/feature/search/src/commonMain/composeResources/values/feature_search_strings.xml b/feature/search/src/commonMain/composeResources/values/feature_search_strings.xml index a545ab7a61b..50c94369dd2 100644 --- a/feature/search/src/commonMain/composeResources/values/feature_search_strings.xml +++ b/feature/search/src/commonMain/composeResources/values/feature_search_strings.xml @@ -15,6 +15,7 @@ No results found for entered query No Search Query Entered! Exact Match + Please enter Name or Account Number or External ID to search Clients clients diff --git a/feature/search/src/commonMain/kotlin/com/mifos/feature/search/SearchViewModel.kt b/feature/search/src/commonMain/kotlin/com/mifos/feature/search/SearchViewModel.kt index 029ff46f09c..6f570bbfd2e 100644 --- a/feature/search/src/commonMain/kotlin/com/mifos/feature/search/SearchViewModel.kt +++ b/feature/search/src/commonMain/kotlin/com/mifos/feature/search/SearchViewModel.kt @@ -93,6 +93,7 @@ class SearchViewModel( searchJob?.cancel() if (state.value.searchText.isNotEmpty()) { + state.value = state.value.copy(showEmptyError = false) searchJob = searchRepository.searchResources( query = state.value.searchText, resources = state.value.selectedFilter?.value, @@ -123,6 +124,9 @@ class SearchViewModel( } } .launchIn(viewModelScope) + } else { + state.value = state.value.copy(showEmptyError = true) + searchResultState.update { SearchResultState.Empty() } } } } @@ -138,6 +142,7 @@ data class SearchScreenState( val searchText: String = "", val selectedFilter: FilterOption? = null, val exactMatch: Boolean? = null, + val showEmptyError: Boolean = false, ) sealed interface SearchScreenEvent { diff --git a/feature/search/src/commonMain/kotlin/com/mifos/feature/search/components/SearchBox.kt b/feature/search/src/commonMain/kotlin/com/mifos/feature/search/components/SearchBox.kt index e69d07d8e2c..88da02d10f2 100644 --- a/feature/search/src/commonMain/kotlin/com/mifos/feature/search/components/SearchBox.kt +++ b/feature/search/src/commonMain/kotlin/com/mifos/feature/search/components/SearchBox.kt @@ -10,6 +10,7 @@ package com.mifos.feature.search.components import androidclient.feature.search.generated.resources.Res +import androidclient.feature.search.generated.resources.feature_search_empty_input_field import androidclient.feature.search.generated.resources.feature_search_exact_match import androidclient.feature.search.generated.resources.feature_search_search_hint import androidclient.feature.search.generated.resources.feature_search_title @@ -117,6 +118,8 @@ internal fun SearchBox( onEvent(SearchScreenEvent.ClearSearchText) }, maxLines = 1, + isError = state.showEmptyError, + errorText = if (state.showEmptyError) stringResource(Res.string.feature_search_empty_input_field) else null, ) // Search Button