diff --git a/process-app/src/main/kotlin/com/alfresco/content/process/ui/components/FloatingActionButton.kt b/process-app/src/main/kotlin/com/alfresco/content/process/ui/components/FloatingActionButton.kt index 98381f12..40364e05 100644 --- a/process-app/src/main/kotlin/com/alfresco/content/process/ui/components/FloatingActionButton.kt +++ b/process-app/src/main/kotlin/com/alfresco/content/process/ui/components/FloatingActionButton.kt @@ -3,6 +3,7 @@ package com.alfresco.content.process.ui.components import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.PlaylistAdd import androidx.compose.material3.ExtendedFloatingActionButton +import androidx.compose.material3.FloatingActionButtonDefaults import androidx.compose.material3.Icon import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text @@ -11,6 +12,7 @@ import androidx.compose.runtime.getValue import androidx.compose.ui.graphics.Color import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.stringResource +import androidx.compose.ui.unit.dp import com.airbnb.mvrx.compose.collectAsState import com.alfresco.content.component.ComponentBuilder import com.alfresco.content.component.ComponentData @@ -57,8 +59,14 @@ fun FloatingActionButton(outcomes: List, fragment: ProcessFragment .show() } }, - containerColor = MaterialTheme.colorScheme.primary, + containerColor = if (state.enabledOutcomes) MaterialTheme.colorScheme.primary else MaterialTheme.colorScheme.onSurfaceVariant, icon = { Icon(Icons.Filled.PlaylistAdd, stringResource(id = R.string.accessibility_process_actions), tint = Color.White) }, text = { Text(text = stringResource(id = R.string.title_actions), color = Color.White) }, + elevation = FloatingActionButtonDefaults.elevation( + defaultElevation = 0.dp, + pressedElevation = 0.dp, + focusedElevation = 0.dp, + hoveredElevation = 0.dp, + ), ) } diff --git a/process-app/src/main/kotlin/com/alfresco/content/process/ui/fragments/FormViewModel.kt b/process-app/src/main/kotlin/com/alfresco/content/process/ui/fragments/FormViewModel.kt index e39a5b52..95630372 100644 --- a/process-app/src/main/kotlin/com/alfresco/content/process/ui/fragments/FormViewModel.kt +++ b/process-app/src/main/kotlin/com/alfresco/content/process/ui/fragments/FormViewModel.kt @@ -462,11 +462,12 @@ class FormViewModel( requireNotNull(state.parent) viewModelScope.launch { repository::actionOutcomes.asFlow( - outcome, state.parent.taskEntry, + outcome, + state.parent.taskEntry, convertFieldsToValues( state.formFields .filter { it.type !in listOf(FieldType.READONLY.value(), FieldType.READONLY_TEXT.value()) }, - ) + ), ).execute { when (it) { is Loading -> copy(requestOutcomes = Loading()) @@ -542,8 +543,10 @@ class FormViewModel( private fun hasFieldValidData(fields: List): Boolean { val hasValidDataInRequiredFields = !fields.filter { it.required }.any { (it.value == null || it.errorData.first) } + val hasValidDataInDropDownRequiredFields = fields.filter { it.required && it.options.isNotEmpty() } + .any { field -> (field.options.find { option -> option.name == field.value }?.id != "empty") } val hasValidDataInOtherFields = !fields.filter { !it.required }.any { it.errorData.first } - return (hasValidDataInRequiredFields && hasValidDataInOtherFields) + return (hasValidDataInRequiredFields && hasValidDataInOtherFields && hasValidDataInDropDownRequiredFields) } fun setListener(listener: EntryListener) {