|
@@ -1,6 +1,5 @@
|
|
|
package com.fastest.pass.home.presentation.ui.components
|
|
|
|
|
|
-import android.widget.Toast
|
|
|
import androidx.compose.foundation.background
|
|
|
import androidx.compose.foundation.border
|
|
|
import androidx.compose.foundation.clickable
|
|
@@ -44,7 +43,6 @@ import androidx.compose.ui.Alignment
|
|
|
import androidx.compose.ui.Modifier
|
|
|
import androidx.compose.ui.focus.FocusManager
|
|
|
import androidx.compose.ui.graphics.Color
|
|
|
-import androidx.compose.ui.platform.LocalContext
|
|
|
import androidx.compose.ui.platform.LocalFocusManager
|
|
|
import androidx.compose.ui.platform.LocalSoftwareKeyboardController
|
|
|
import androidx.compose.ui.platform.SoftwareKeyboardController
|
|
@@ -58,7 +56,6 @@ import java.text.SimpleDateFormat
|
|
|
import java.util.Date
|
|
|
import java.util.Locale
|
|
|
import java.util.TimeZone
|
|
|
-import java.util.logging.SimpleFormatter
|
|
|
|
|
|
@Composable
|
|
|
fun AddContactInfoScreen() {
|
|
@@ -117,8 +114,8 @@ fun AddContactInfoScreen() {
|
|
|
|
|
|
Spacer(modifier = Modifier.height(20.dp))
|
|
|
DropDownFieldACIFS(keyboardController = keyboardController, focusManager = focusManager, labelText = R.string.country, countriesList)
|
|
|
- Spacer(modifier = Modifier.height(20.dp))
|
|
|
- DropDownFieldACIFS(keyboardController = keyboardController, focusManager = focusManager, labelText = R.string.time_zone, timezoneList, topPadding = 10)
|
|
|
+// Spacer(modifier = Modifier.height(20.dp))
|
|
|
+// DropDownFieldACIFS(keyboardController = keyboardController, focusManager = focusManager, labelText = R.string.time_zone, timezoneList, topPadding = 10)
|
|
|
|
|
|
Spacer(modifier = Modifier.height(20.dp))
|
|
|
NameTextFieldACIFS(keyboardController = keyboardController, focusManager = focusManager, labelText = R.string.company)
|
|
@@ -126,7 +123,14 @@ fun AddContactInfoScreen() {
|
|
|
DropDownFieldACIFS(keyboardController = keyboardController, focusManager = focusManager, labelText = R.string.gender, gender)
|
|
|
|
|
|
Spacer(modifier = Modifier.height(20.dp))
|
|
|
- DatePickerACIFS(labelText = R.string.birthday)
|
|
|
+ DatePickerACIFS(labelText = R.string.birthday) { selectedDate ->
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ Spacer(modifier = Modifier.height(20.dp))
|
|
|
+ EmailFieldACIFS(keyboardController = keyboardController, focusManager = focusManager, R.string.enter_email_address)
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -305,9 +309,11 @@ fun ColumnScope.DropDownFieldACIFS(
|
|
|
@OptIn(ExperimentalMaterial3Api::class)
|
|
|
@Composable
|
|
|
fun ColumnScope.DatePickerACIFS(
|
|
|
- labelText: Int
|
|
|
+ labelText: Int,
|
|
|
+ onDateSelected: (String) -> Unit
|
|
|
) {
|
|
|
var selectedDate by remember { mutableStateOf("Select Date") }
|
|
|
+ var selectedDateMillis by remember { mutableStateOf<Long?>(null) }
|
|
|
var showDatePicker by remember { mutableStateOf(false) }
|
|
|
|
|
|
Column(
|
|
@@ -367,7 +373,9 @@ fun ColumnScope.DatePickerACIFS(
|
|
|
)
|
|
|
|
|
|
if (showDatePicker) {
|
|
|
- val datePickerState = rememberDatePickerState()
|
|
|
+ val datePickerState = rememberDatePickerState(
|
|
|
+ initialSelectedDateMillis = selectedDateMillis ?: System.currentTimeMillis()
|
|
|
+ )
|
|
|
|
|
|
DatePickerDialog(
|
|
|
onDismissRequest = {
|
|
@@ -379,6 +387,8 @@ fun ColumnScope.DatePickerACIFS(
|
|
|
if (selectedMillis != null) {
|
|
|
val formattedDate = convertMillisToFormattedDate(selectedMillis)
|
|
|
selectedDate = formattedDate
|
|
|
+ onDateSelected(selectedDate)
|
|
|
+ selectedDateMillis = selectedMillis
|
|
|
showDatePicker = false
|
|
|
}
|
|
|
|
|
@@ -402,6 +412,69 @@ fun ColumnScope.DatePickerACIFS(
|
|
|
|
|
|
}
|
|
|
|
|
|
+@Composable
|
|
|
+fun ColumnScope.EmailFieldACIFS(
|
|
|
+ keyboardController: SoftwareKeyboardController?,
|
|
|
+ focusManager: FocusManager,
|
|
|
+ labelText: Int
|
|
|
+) {
|
|
|
+ var emailText by remember { mutableStateOf("") }
|
|
|
+
|
|
|
+ TextField(
|
|
|
+ value = emailText,
|
|
|
+ onValueChange = {
|
|
|
+ emailText = it
|
|
|
+ },
|
|
|
+ textStyle = MaterialTheme.typography.displayMedium,
|
|
|
+ modifier = Modifier
|
|
|
+ .align(Alignment.Start)
|
|
|
+ .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.transparent)),
|
|
|
+ shape = RoundedCornerShape(16.dp),
|
|
|
+// placeholder = {
|
|
|
+// Text(
|
|
|
+// text = stringResource(id = R.string.enter_email_address),
|
|
|
+// color = colorResource(id = R.color.gray_splash),
|
|
|
+// style = MaterialTheme.typography.displayMedium
|
|
|
+// )
|
|
|
+// },
|
|
|
+ label = {
|
|
|
+ Text(text = stringResource(id = labelText),
|
|
|
+ style = MaterialTheme.typography.displayMedium.copy(
|
|
|
+ color = colorResource(id = R.color.gray_text)
|
|
|
+ )
|
|
|
+ )
|
|
|
+ },
|
|
|
+ maxLines = Int.MAX_VALUE,
|
|
|
+ colors = TextFieldDefaults.colors(
|
|
|
+ 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.Email,
|
|
|
+ imeAction = ImeAction.Done
|
|
|
+ ),
|
|
|
+ keyboardActions = KeyboardActions(
|
|
|
+ onDone = {
|
|
|
+ focusManager.clearFocus()
|
|
|
+ keyboardController?.hide()
|
|
|
+ }
|
|
|
+ ),
|
|
|
+ )
|
|
|
+}
|
|
|
+
|
|
|
fun getAllCountriesList() : List<String> {
|
|
|
return Locale.getISOCountries()
|
|
|
.map { countryCode -> Locale("", countryCode).displayCountry }
|