|
@@ -26,7 +26,10 @@ import androidx.compose.material3.ButtonDefaults
|
|
|
import androidx.compose.material3.DatePicker
|
|
|
import androidx.compose.material3.DatePickerDefaults
|
|
|
import androidx.compose.material3.DatePickerDialog
|
|
|
+import androidx.compose.material3.DropdownMenuItem
|
|
|
import androidx.compose.material3.ExperimentalMaterial3Api
|
|
|
+import androidx.compose.material3.ExposedDropdownMenuBox
|
|
|
+import androidx.compose.material3.ExposedDropdownMenuDefaults
|
|
|
import androidx.compose.material3.Icon
|
|
|
import androidx.compose.material3.MaterialTheme
|
|
|
import androidx.compose.material3.Text
|
|
@@ -59,6 +62,7 @@ import com.fastest.pass.R
|
|
|
fun AddPassportFormScreen() {
|
|
|
val keyboardController = LocalSoftwareKeyboardController.current
|
|
|
val focusManager = LocalFocusManager.current
|
|
|
+ val gender = listOf("Please Select", "Male", "Female", "Other")
|
|
|
|
|
|
Box(
|
|
|
modifier = Modifier
|
|
@@ -85,12 +89,21 @@ fun AddPassportFormScreen() {
|
|
|
Spacer(modifier = Modifier.height(20.dp))
|
|
|
NameTextFieldAPFS(keyboardController = keyboardController, focusManager = focusManager, labelText = R.string.name)
|
|
|
Spacer(modifier = Modifier.height(20.dp))
|
|
|
- NameTextFieldAPFS(keyboardController = keyboardController, focusManager = focusManager, labelText = R.string.country)
|
|
|
+ SelectCountryInfoPassport(labelText = R.string.country, keyboardController = keyboardController, focusManager = focusManager)
|
|
|
+// NameTextFieldAPFS(keyboardController = keyboardController, focusManager = focusManager, labelText = R.string.country)
|
|
|
+
|
|
|
Spacer(modifier = Modifier.height(20.dp))
|
|
|
TextNumberTextFieldAPFS(keyboardController = keyboardController, focusManager = focusManager, labelText = R.string.number, placeholder = "P12345678")
|
|
|
|
|
|
Spacer(modifier = Modifier.height(20.dp))
|
|
|
- NameTextFieldAPFS(keyboardController = keyboardController, focusManager = focusManager, labelText = R.string.sex)
|
|
|
+ DropDownFieldPassport(
|
|
|
+ keyboardController = keyboardController,
|
|
|
+ focusManager = focusManager,
|
|
|
+ labelText = R.string.gender,
|
|
|
+ titles = gender
|
|
|
+ )
|
|
|
+// NameTextFieldAPFS(keyboardController = keyboardController, focusManager = focusManager, labelText = R.string.sex)
|
|
|
+
|
|
|
Spacer(modifier = Modifier.height(20.dp))
|
|
|
NameTextFieldAPFS(keyboardController = keyboardController, focusManager = focusManager, labelText = R.string.nationality)
|
|
|
Spacer(modifier = Modifier.height(20.dp))
|
|
@@ -236,14 +249,14 @@ fun ColumnScope.TextNumberTextFieldAPFS(
|
|
|
)
|
|
|
.background(color = colorResource(id = R.color.transparent)),
|
|
|
shape = RoundedCornerShape(16.dp),
|
|
|
- placeholder = {
|
|
|
- Text(
|
|
|
- text = placeholder,
|
|
|
- style = MaterialTheme.typography.titleSmall.copy(
|
|
|
- color = colorResource(id = R.color.gray_text)
|
|
|
- )
|
|
|
- )
|
|
|
- },
|
|
|
+// placeholder = {
|
|
|
+// Text(
|
|
|
+// text = placeholder,
|
|
|
+// style = MaterialTheme.typography.titleSmall.copy(
|
|
|
+// color = colorResource(id = R.color.gray_text)
|
|
|
+// )
|
|
|
+// )
|
|
|
+// },
|
|
|
label = {
|
|
|
Text(text = stringResource(id = labelText),
|
|
|
style = MaterialTheme.typography.titleSmall.copy(
|
|
@@ -300,7 +313,7 @@ fun ColumnScope.DatePickerAPFS(
|
|
|
value = selectedDate,
|
|
|
onValueChange = {},
|
|
|
textStyle = MaterialTheme.typography.displayMedium.copy(
|
|
|
- color = colorResource(id = R.color.gray_splash)
|
|
|
+ color = colorResource(id = R.color.gray_text)
|
|
|
),
|
|
|
readOnly = true,
|
|
|
label = { Text(
|
|
@@ -313,7 +326,7 @@ fun ColumnScope.DatePickerAPFS(
|
|
|
Icon(
|
|
|
imageVector = Icons.Default.DateRange,
|
|
|
contentDescription = "Calendar",
|
|
|
- tint = colorResource(id = R.color.gray_splash)
|
|
|
+ tint = colorResource(id = R.color.gray_text)
|
|
|
)
|
|
|
},
|
|
|
modifier = Modifier
|
|
@@ -455,4 +468,173 @@ fun ColumnScope.NotesTextFieldAPFS(
|
|
|
}
|
|
|
),
|
|
|
)
|
|
|
+}
|
|
|
+
|
|
|
+@Composable
|
|
|
+fun ColumnScope.SelectCountryInfoPassport(
|
|
|
+ labelText: Int,
|
|
|
+ keyboardController: SoftwareKeyboardController?,
|
|
|
+ focusManager: FocusManager
|
|
|
+) {
|
|
|
+ var selectedCountry by remember { mutableStateOf("Please Select") }
|
|
|
+ var isSheetOpened by remember { mutableStateOf(false) }
|
|
|
+
|
|
|
+ TextField(
|
|
|
+ value = selectedCountry,
|
|
|
+ onValueChange = {},
|
|
|
+ textStyle = MaterialTheme.typography.displayMedium.copy(
|
|
|
+ color = if (selectedCountry == "Please Select") colorResource(id = R.color.gray_border_textfield)
|
|
|
+ else colorResource(id = R.color.gray_splash)
|
|
|
+ ),
|
|
|
+ readOnly = true,
|
|
|
+ label = {
|
|
|
+ Text(
|
|
|
+ stringResource(id = labelText),
|
|
|
+ style = MaterialTheme.typography.titleSmall.copy(
|
|
|
+ color = colorResource(id = R.color.gray_text)
|
|
|
+ )
|
|
|
+ ) },
|
|
|
+ modifier = Modifier
|
|
|
+ .align(Alignment.Start)
|
|
|
+ .fillMaxWidth()
|
|
|
+ .defaultMinSize(minHeight = 60.dp)
|
|
|
+ .wrapContentHeight()
|
|
|
+ .border(
|
|
|
+ 1.dp,
|
|
|
+ color = colorResource(id = R.color.gray_border_textfield),
|
|
|
+ shape = RoundedCornerShape(16.dp)
|
|
|
+ )
|
|
|
+ .background(color = colorResource(id = R.color.transparent))
|
|
|
+ .clickable {
|
|
|
+ isSheetOpened = true
|
|
|
+ },
|
|
|
+ shape = RoundedCornerShape(16.dp),
|
|
|
+ enabled = false,
|
|
|
+ colors = TextFieldDefaults.colors(
|
|
|
+ disabledContainerColor = colorResource(id = R.color.transparent),
|
|
|
+ focusedLabelColor = colorResource(id = R.color.gray_splash),
|
|
|
+ unfocusedContainerColor = colorResource(id = R.color.transparent),
|
|
|
+ focusedContainerColor = colorResource(id = R.color.transparent),
|
|
|
+ focusedIndicatorColor = colorResource(id = R.color.transparent),
|
|
|
+ disabledIndicatorColor = colorResource(id = R.color.transparent),
|
|
|
+ unfocusedIndicatorColor = colorResource(id = R.color.transparent),
|
|
|
+ cursorColor = colorResource(id = R.color.gray_splash),
|
|
|
+ ),
|
|
|
+ keyboardOptions = KeyboardOptions(
|
|
|
+ keyboardType = KeyboardType.Password
|
|
|
+ )
|
|
|
+ )
|
|
|
+
|
|
|
+ if (isSheetOpened) {
|
|
|
+ OpenModalBottomSheet(
|
|
|
+ keyboardController,
|
|
|
+ focusManager,
|
|
|
+ isSheetOpened = {isSheetOpened = false},
|
|
|
+ onSelectedCountry = { countryName ->
|
|
|
+ selectedCountry = countryName
|
|
|
+ }
|
|
|
+ )
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+@OptIn(ExperimentalMaterial3Api::class)
|
|
|
+@Composable
|
|
|
+fun ColumnScope.DropDownFieldPassport(
|
|
|
+ keyboardController: SoftwareKeyboardController?,
|
|
|
+ focusManager: FocusManager,
|
|
|
+ labelText: Int,
|
|
|
+ titles: List<String>,
|
|
|
+ topPadding: Int = 0
|
|
|
+) {
|
|
|
+ var isExpanded by remember { mutableStateOf(false) }
|
|
|
+ var selectedText by remember { mutableStateOf(titles[0]) }
|
|
|
+
|
|
|
+ Column(
|
|
|
+ modifier = Modifier
|
|
|
+ .fillMaxWidth()
|
|
|
+ .background(color = colorResource(id = R.color.white)),
|
|
|
+ ) {
|
|
|
+ Box(
|
|
|
+ modifier = Modifier
|
|
|
+ .fillMaxWidth()
|
|
|
+ .background(colorResource(id = R.color.white))
|
|
|
+ ) {
|
|
|
+ ExposedDropdownMenuBox(
|
|
|
+ expanded = isExpanded,
|
|
|
+ onExpandedChange = { isExpanded = !isExpanded },
|
|
|
+ modifier = Modifier
|
|
|
+ .fillMaxWidth()
|
|
|
+ .defaultMinSize(60.dp)
|
|
|
+ .wrapContentHeight()
|
|
|
+ .border(
|
|
|
+ 1.dp,
|
|
|
+ color = colorResource(id = R.color.gray_border_textfield),
|
|
|
+ shape = RoundedCornerShape(16.dp)
|
|
|
+ )
|
|
|
+ .background(color = colorResource(id = R.color.white)),
|
|
|
+ ) {
|
|
|
+ TextField(
|
|
|
+ value = selectedText,
|
|
|
+ onValueChange = {},
|
|
|
+ textStyle = MaterialTheme.typography.displayMedium.copy(
|
|
|
+ color = if (selectedText == titles[0]) colorResource(id = R.color.gray_border_textfield)
|
|
|
+ else colorResource(id = R.color.gray_splash)
|
|
|
+ ),
|
|
|
+ readOnly = true,
|
|
|
+ label = { Text(
|
|
|
+ stringResource(id = labelText),
|
|
|
+ style = MaterialTheme.typography.titleSmall.copy(
|
|
|
+ color = colorResource(id = R.color.gray_text)
|
|
|
+ )
|
|
|
+ ) },
|
|
|
+ trailingIcon = { ExposedDropdownMenuDefaults.TrailingIcon(isExpanded) },
|
|
|
+ modifier = Modifier
|
|
|
+ .menuAnchor()
|
|
|
+ .fillMaxWidth()
|
|
|
+ .background(color = colorResource(id = R.color.white)),
|
|
|
+ colors = ExposedDropdownMenuDefaults.textFieldColors(
|
|
|
+ focusedLabelColor = colorResource(id = R.color.gray_splash),
|
|
|
+ unfocusedContainerColor = colorResource(id = R.color.transparent),
|
|
|
+ focusedContainerColor = colorResource(id = R.color.transparent),
|
|
|
+ focusedIndicatorColor = colorResource(id = R.color.transparent),
|
|
|
+ disabledIndicatorColor = colorResource(id = R.color.transparent),
|
|
|
+ unfocusedIndicatorColor = colorResource(id = R.color.transparent),
|
|
|
+ cursorColor = colorResource(id = R.color.gray_splash),
|
|
|
+ ),
|
|
|
+ keyboardOptions = KeyboardOptions(
|
|
|
+ keyboardType = KeyboardType.Password
|
|
|
+ )
|
|
|
+ )
|
|
|
+
|
|
|
+ ExposedDropdownMenu(
|
|
|
+ expanded = isExpanded,
|
|
|
+ onDismissRequest = { isExpanded = !isExpanded },
|
|
|
+ modifier = Modifier
|
|
|
+ .background(colorResource(id = R.color.white))
|
|
|
+ ) {
|
|
|
+ titles.forEachIndexed { _, s ->
|
|
|
+ DropdownMenuItem(
|
|
|
+ text = {
|
|
|
+ Text(
|
|
|
+ text = s,
|
|
|
+ style = MaterialTheme.typography.titleSmall.copy(
|
|
|
+ color = colorResource(id = R.color.gray_splash)
|
|
|
+ ),
|
|
|
+ modifier = Modifier
|
|
|
+ .padding(top = topPadding.dp)
|
|
|
+ )
|
|
|
+ },
|
|
|
+ onClick = {
|
|
|
+ selectedText = s
|
|
|
+ isExpanded = false
|
|
|
+ },
|
|
|
+ modifier = Modifier
|
|
|
+ .background(colorResource(id = R.color.white))
|
|
|
+ .padding(top = 0.dp)
|
|
|
+ )
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|