Explorar o código

feat: change navigation, add function check password

chern hai 1 semana
pai
achega
8e2da43c8d

+ 66 - 1
Development/app/src/main/java/com/example/development/MainActivity.kt

@@ -1,6 +1,7 @@
 package com.example.development
 
 import android.os.Bundle
+import android.window.SplashScreen
 import androidx.activity.ComponentActivity
 import androidx.activity.compose.setContent
 import androidx.activity.enableEdgeToEdge
@@ -15,6 +16,18 @@ import androidx.navigation.compose.NavHost
 import androidx.navigation.compose.composable
 import androidx.navigation.compose.rememberNavController
 import com.example.development.mainActivity.components.AuthorizationScreen
+import com.example.development.mainActivity.components.CreateReviews
+import com.example.development.mainActivity.components.MainPage
+import com.example.development.mainActivity.components.MenuPage
+import com.example.development.mainActivity.components.PasswordRecovery
+import com.example.development.mainActivity.components.PasswordRecovery2
+import com.example.development.mainActivity.components.PasswordRecovery3
+import com.example.development.mainActivity.components.RegistrationScreen2
+import com.example.development.mainActivity.components.Reviews
+import com.example.development.mainActivity.components.TableReserve
+import com.example.development.mainActivity.components.TableReserve2
+import com.example.development.mainActivity.components.UserProfile
+import com.example.development.mainActivity.components.UserProfile2
 import com.example.development.mainActivity.components.UserProfileForUnauthorizedUser
 
 class MainActivity : ComponentActivity() {
@@ -34,10 +47,62 @@ class MainActivity : ComponentActivity() {
                         {
                             RegistrationScreen(navController, viewModel)
                         }
+                        composable("RegistrationScreen2")
+                        {
+                            RegistrationScreen2(navController, viewModel)
+                        }
                         composable("AuthorizationScreen")
                         {
                             AuthorizationScreen(navController, viewModel)
                         }
+                        composable("MenuPage")
+                        {
+                            MenuPage(navController, viewModel)
+                        }
+                        composable("MainPage")
+                        {
+                            MainPage(navController, viewModel)
+                        }
+                        composable("Reviews")
+                        {
+                            Reviews(navController, viewModel)
+                        }
+                        composable("CreateReview")
+                        {
+                            CreateReviews(navController, viewModel)
+                        }
+                        composable("PasswordRecovery")
+                        {
+                            PasswordRecovery(navController, viewModel)
+                        }
+                        composable("PasswordRecovery2")
+                        {
+                            PasswordRecovery2(navController, viewModel)
+                        }
+                        composable("PasswordRecovery3")
+                        {
+                            PasswordRecovery3(navController, viewModel)
+                        }
+                        composable("TableReserve")
+                        {
+                            TableReserve(navController, viewModel)
+                        }
+                        composable("TableReserve2")
+                        {
+                            TableReserve2(navController, viewModel)
+                        }
+                        composable("UserProfile")
+                        {
+                            UserProfile(navController, viewModel)
+                        }
+                        composable("UserProfile2")
+                        {
+                            UserProfile2(navController, viewModel)
+                        }
+                        composable("UserProfileForUnauthorizedUser")
+                        {
+                            UserProfileForUnauthorizedUser(navController)
+                        }
                     }
                 }
             }
@@ -49,6 +114,6 @@ class MainActivity : ComponentActivity() {
 @Composable
 fun GreetingPreview() {
     DevelopmentTheme {
-        UserProfileForUnauthorizedUser()
+
     }
 }

+ 70 - 0
Development/app/src/main/java/com/example/development/domain/utils/CustomEmaill.kt

@@ -0,0 +1,70 @@
+package com.example.development.domain.utils
+
+import androidx.compose.foundation.background
+import androidx.compose.foundation.layout.Box
+import androidx.compose.foundation.layout.fillMaxWidth
+import androidx.compose.foundation.layout.height
+import androidx.compose.foundation.layout.width
+import androidx.compose.foundation.shape.RoundedCornerShape
+import androidx.compose.foundation.text.KeyboardOptions
+import androidx.compose.material3.OutlinedTextField
+import androidx.compose.material3.Text
+import androidx.compose.material3.TextFieldDefaults
+import androidx.compose.runtime.Composable
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.draw.clip
+import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.text.TextStyle
+import androidx.compose.ui.text.input.KeyboardType
+import androidx.compose.ui.unit.dp
+import androidx.compose.ui.unit.sp
+
+@Composable
+fun CustomEmail(
+    search: String,
+    onValueChange: (String) -> Unit
+
+
+) {
+    Box(
+        modifier = Modifier
+            .clip(RoundedCornerShape(10.dp))
+            .background(Color(0XFFE8EFFF))
+
+    ) {
+        OutlinedTextField(
+            keyboardOptions = KeyboardOptions(
+                keyboardType = KeyboardType.Email
+            ),
+            value = search,
+            onValueChange = onValueChange,
+            textStyle = TextStyle(
+                color = Color.Black,
+                fontSize = 15.sp
+            ),
+            colors = TextFieldDefaults.colors(
+                focusedContainerColor = Color(0XFFF5F5F9),
+                focusedIndicatorColor = Color(0xFFEBEBEB),
+                focusedTextColor = Color(0XFF578FFF),
+                disabledIndicatorColor = Color.Transparent,
+                unfocusedIndicatorColor = Color.Transparent,
+                cursorColor = Color(0XFF578FFF),
+                focusedSupportingTextColor = Color(0xFF00000)
+            ),
+            modifier = Modifier
+                .fillMaxWidth(1f)
+                .background(Color(0XFFF5F5F9))
+                .height(height = 50.dp)
+                .width(width = 316.dp),
+            placeholder = {
+                Text(
+                    modifier = Modifier.fillMaxWidth(),
+                    text = "Введите e-mail",
+                    fontSize = 15.sp,
+                    color = Color(0XFF939396)
+                )
+            }
+        )
+
+    }
+}

+ 96 - 0
Development/app/src/main/java/com/example/development/domain/utils/CustomPassword.kt

@@ -0,0 +1,96 @@
+package com.example.development.domain.utils
+
+import androidx.compose.foundation.background
+import androidx.compose.foundation.layout.Box
+import androidx.compose.foundation.layout.fillMaxWidth
+import androidx.compose.foundation.layout.height
+import androidx.compose.foundation.layout.width
+import androidx.compose.foundation.shape.RoundedCornerShape
+import androidx.compose.foundation.text.KeyboardOptions
+import androidx.compose.material3.Icon
+import androidx.compose.material3.IconToggleButton
+import androidx.compose.material3.OutlinedTextField
+import androidx.compose.material3.Text
+import androidx.compose.material3.TextFieldDefaults
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.remember
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.draw.clip
+import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.res.painterResource
+import androidx.compose.ui.text.TextStyle
+import androidx.compose.ui.text.input.KeyboardType
+import androidx.compose.ui.text.input.PasswordVisualTransformation
+import androidx.compose.ui.text.input.VisualTransformation
+import androidx.compose.ui.unit.dp
+import androidx.compose.ui.unit.sp
+import com.example.development.R
+
+@Composable
+fun CustomPassword(
+    text: String,
+    search: String,
+    onValueChange: (String) -> Unit
+
+) {
+    val checked = remember { mutableStateOf(false) }
+    Box(
+        modifier = Modifier
+            .clip(RoundedCornerShape(10.dp))
+            .background(Color(0XFFE8EFFF))
+
+    ) {
+        OutlinedTextField(
+            keyboardOptions = KeyboardOptions(
+                keyboardType = KeyboardType.Password
+            ),
+            trailingIcon = {
+                IconToggleButton(
+                    checked = checked.value,
+                    onCheckedChange = { checked.value = it }) {
+                    Icon(
+                        if (checked.value) {
+                            painterResource(id = R.drawable.eye_open)
+                        } else {
+                            painterResource(id = R.drawable.eye_close)
+                        },
+                        contentDescription = "Скрыть пароль",
+                        tint = Color(0XFF939396),
+                        modifier = Modifier.width(20.dp)
+                    )
+                }
+            },
+            visualTransformation = if (checked.value) VisualTransformation.None else PasswordVisualTransformation(),
+            value = search,
+            onValueChange = onValueChange,
+            textStyle = TextStyle(
+                color = Color.Black,
+                fontSize = 15.sp
+            ),
+            colors = TextFieldDefaults.colors(
+                focusedContainerColor  = Color(0XFFF5F5F9),
+                focusedIndicatorColor = Color(0xFFEBEBEB),
+                focusedTextColor = Color(0XFF578FFF),
+                disabledIndicatorColor = Color.White,
+                unfocusedIndicatorColor = Color.White,
+                cursorColor = Color(0XFF578FFF),
+                focusedSupportingTextColor = Color(0xFF00000)
+            ),
+            modifier = Modifier
+                .fillMaxWidth(1f)
+                .background(Color(0XFFF5F5F9))
+                .height(height = 50.dp)
+                .width(width = 316.dp),
+            placeholder = {
+                Text(
+                    modifier = Modifier.fillMaxWidth(),
+                    text = text,
+                    fontSize = 15.sp,
+                    color = Color(0XFF939396)
+                )
+            }
+        )
+
+    }
+}

+ 26 - 0
Development/app/src/main/java/com/example/development/domain/utils/SharedPreferenceHelper.kt

@@ -0,0 +1,26 @@
+package com.example.development.domain.utils
+
+import android.content.Context
+
+class SharedPreferenceHelper(private val context: Context) {
+
+    companion object{
+        private const val MY_PREF_KEY = "MY_PREF"
+    }
+
+    fun saveStringData(key:String,data:String?)
+    {
+        val sharedPreferences = context.getSharedPreferences(MY_PREF_KEY, Context.MODE_PRIVATE)
+        sharedPreferences.edit().putString(key,data).apply()
+    }
+    fun getStringData(key:String):String?
+    {
+        val sharedPreferences = context.getSharedPreferences(MY_PREF_KEY, Context.MODE_PRIVATE)
+        return sharedPreferences.getString(key,null)
+    }
+    fun clearPreferences()
+    {
+        val sharedPreferences = context.getSharedPreferences(MY_PREF_KEY, Context.MODE_PRIVATE)
+        sharedPreferences.edit().clear().apply()
+    }
+}

+ 26 - 4
Development/app/src/main/java/com/example/development/mainActivity/MainViewModel.kt

@@ -1,5 +1,6 @@
 package com.example.development.mainActivity
 
+import android.content.Context
 import android.util.Log
 import androidx.compose.runtime.State
 import androidx.compose.runtime.getValue
@@ -18,7 +19,7 @@ import kotlinx.coroutines.launch
 
 class MainViewModel():ViewModel() {
     private val _users = mutableStateOf(listOf<User>())
-    val users: State<List<User>> = _users
+    var users = listOf<User>()
 
     fun onSignInEmailCode(emailUser: String) {
         viewModelScope.launch {
@@ -78,7 +79,8 @@ class MainViewModel():ViewModel() {
                         User::UID eq Constants.supabase.auth.currentUserOrNull()!!.id
                     }
                 }.decodeList<User>()
-                println("Пользователь найден")
+                var result = "Пользователь найден"
+                println(result)
             }
             catch (e:Exception){
                 println("Пользователь не найден")
@@ -89,7 +91,6 @@ class MainViewModel():ViewModel() {
 
     fun CreateUser(firstName: String,
                    secondName: String,
-                   email: String,
                    phoneNumber: Int
                    )
     {
@@ -100,7 +101,7 @@ class MainViewModel():ViewModel() {
                         role = 1,
                         firstName = firstName,
                         secondName = secondName,
-                        email = email,
+                        email = Constants.supabase.auth.currentUserOrNull()!!.email.toString(),
                         phoneNumber = phoneNumber,
                         image = "",
                         UID = Constants.supabase.auth.currentUserOrNull()!!.id
@@ -143,4 +144,25 @@ class MainViewModel():ViewModel() {
             }
         }
     }
+
+    fun checkForRegistration()
+    {
+        viewModelScope.launch {
+            try{
+                var flag = false
+                users = Constants.supabase.from("Users")
+                    .select(){
+                        filter{
+                            User::UID eq Constants.supabase.auth.currentUserOrNull()!!.id
+                        }
+                    }.decodeList<User>()
+                flag = true
+                println("Пользователь найден")
+            } catch (e: Exception) {
+                var flag = false
+                println("Error")
+                println(e.message.toString())
+            }
+        }
+    }
 }

+ 1 - 1
Development/app/src/main/java/com/example/development/mainActivity/components/PasswordRecovery.kt

@@ -173,7 +173,7 @@ fun PasswordRecovery2(navController: NavHostController, viewModel: MainViewModel
 }
 
 @Composable
-fun PasswordRecovery3()
+fun PasswordRecovery3(navController: NavHostController, viewModel: MainViewModel)
 {
     Box(
         contentAlignment = Alignment.TopCenter,

+ 159 - 73
Development/app/src/main/java/com/example/development/mainActivity/components/RegistrationScreen.kt

@@ -1,10 +1,13 @@
 package com.example.development.mainActivity.components
 
+import android.widget.Toast
 import androidx.compose.foundation.BorderStroke
 import androidx.compose.foundation.Image
+import androidx.compose.foundation.background
 import androidx.compose.foundation.layout.Arrangement
 import androidx.compose.foundation.layout.Box
 import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.layout.Spacer
 import androidx.compose.foundation.layout.fillMaxHeight
 import androidx.compose.foundation.layout.fillMaxSize
 import androidx.compose.foundation.layout.fillMaxWidth
@@ -12,12 +15,16 @@ import androidx.compose.foundation.layout.height
 import androidx.compose.foundation.layout.padding
 import androidx.compose.foundation.layout.width
 import androidx.compose.foundation.shape.RoundedCornerShape
+import androidx.compose.material.icons.Icons
+import androidx.compose.material.icons.filled.Person
 import androidx.compose.material3.Button
 import androidx.compose.material3.ButtonDefaults
 import androidx.compose.material3.Icon
 import androidx.compose.material3.IconButton
+import androidx.compose.material3.OutlinedTextField
 import androidx.compose.material3.Text
 import androidx.compose.material3.TextField
+import androidx.compose.material3.TextFieldDefaults
 import androidx.compose.runtime.Composable
 import androidx.compose.runtime.getValue
 import androidx.compose.runtime.mutableStateOf
@@ -27,6 +34,7 @@ import androidx.compose.ui.Alignment
 import androidx.compose.ui.Modifier
 import androidx.compose.ui.graphics.Color
 import androidx.compose.ui.layout.ContentScale
+import androidx.compose.ui.platform.LocalContext
 import androidx.compose.ui.res.painterResource
 import androidx.compose.ui.text.font.FontWeight
 import androidx.compose.ui.text.input.PasswordVisualTransformation
@@ -35,14 +43,19 @@ import androidx.compose.ui.unit.dp
 import androidx.compose.ui.unit.sp
 import androidx.navigation.NavHostController
 import com.example.development.R
+import com.example.development.domain.utils.CustomEmail
+import com.example.development.domain.utils.CustomPassword
 import com.example.development.ui.theme.OldStandart
 import com.example.development.mainActivity.MainViewModel
+import io.ktor.http.ContentType
 
 @Composable
 fun RegistrationScreen(navController: NavHostController, viewModel: MainViewModel) {
-    val viewModel = MainViewModel()
+    val context = LocalContext.current
     val email = remember { mutableStateOf("") }
     val password = remember { mutableStateOf("") }
+    val checkPassword = remember { mutableStateOf("") }
+    val flag = remember { mutableStateOf(false) }
     Box(contentAlignment = Alignment.TopCenter,
         modifier = Modifier
             .fillMaxSize()
@@ -82,70 +95,29 @@ fun RegistrationScreen(navController: NavHostController, viewModel: MainViewMode
                     horizontalAlignment = Alignment.CenterHorizontally
                 )
                 {
-                    TextField(
-                        value = "Логин",
-                        onValueChange = {},
-                        Modifier.padding(bottom = 5.dp).width(280.dp)
-                    )
+                    CustomEmail(search = email.value, onValueChange = {email.value = it })
                     Column(
                         modifier = Modifier
                             .padding(top = 0.dp)
                     )
                     {
-                        var passwordVisibility: Boolean by remember { mutableStateOf(false) }
-                        TextField(value = "Пароль",
-                            visualTransformation = if (passwordVisibility) VisualTransformation.None else PasswordVisualTransformation(),
-                            leadingIcon = {
-                                IconButton(onClick = {
-                                    passwordVisibility = !passwordVisibility
-                                }) {
-                                    if (passwordVisibility) {
-                                        Icon(
-                                            painter = painterResource(id = R.drawable.eye_close),
-                                            contentDescription = ""
-                                        )
-                                    } else {
-                                        Icon(
-                                            painter = painterResource(id = R.drawable.eye_open),
-                                            contentDescription = ""
-                                        )
-                                    }
-                                }
-                            },
-                            onValueChange = {})
-                        Column(
-                            modifier = Modifier
-                                .padding(top = 5.dp)
-                        )
+                        CustomPassword("Введите пароль", search = password.value, onValueChange = {password.value = it})
+                        CustomPassword("Повторите пароль", search = checkPassword.value, onValueChange = {checkPassword.value = it})
+                        if (password.value == checkPassword.value)
+                        {
+                            flag.value = true
+                        }
+                        else
                         {
-                            TextField(
-                                value = "Повторите пароль",
-                                visualTransformation = if (passwordVisibility) VisualTransformation.None else PasswordVisualTransformation(),
-                                leadingIcon = {
-                                    IconButton(onClick = {
-                                        passwordVisibility = !passwordVisibility
-                                    }) {
-                                        if (passwordVisibility) {
-                                            Icon(
-                                                painter = painterResource(id = R.drawable.eye_close),
-                                                contentDescription = ""
-                                            )
-                                        } else {
-                                            Icon(
-                                                painter = painterResource(id = R.drawable.eye_open),
-                                                contentDescription = ""
-                                            )
-                                        }
-                                    }
-                                },
-                                onValueChange = {},
-                            )
+                            flag.value = false
                         }
                     }
                     Button(
                         modifier = Modifier.padding(top = 15.dp).height(50.dp),
                         onClick = {
-                            viewModel.onSignUpEmail(email.value,password.value)
+                            if (flag.value) { viewModel.onSignUpEmail(email.value,password.value) }
+                            else { Toast.makeText(context, "Пароли не совпадают", Toast.LENGTH_SHORT).show() }
+                            navController.navigate("RegistrationScreen2")
                         },
                         shape = RoundedCornerShape(23.dp),
                         border = BorderStroke(1.dp, Color(255,215,0)),
@@ -162,7 +134,7 @@ fun RegistrationScreen(navController: NavHostController, viewModel: MainViewMode
                     }
                     Button(
                         modifier = Modifier.padding(top = 5.dp).height(50.dp).width(280.dp),
-                        onClick = {},
+                        onClick = {navController.navigate("MainPage")},
                         shape = RoundedCornerShape(23.dp),
                         border = BorderStroke(1.dp, Color(255,215,0, 0)),
                         colors = ButtonDefaults.buttonColors(
@@ -214,7 +186,7 @@ fun RegistrationScreen(navController: NavHostController, viewModel: MainViewMode
                 Button(
                     modifier = Modifier
                         .padding(top = 10.dp),
-                    onClick = {},
+                    onClick = {navController.navigate("AuthorizationScreen")},
                     colors = ButtonDefaults.buttonColors(
                         containerColor = Color(230, 235, 239,0),
                         contentColor = Color.Gray
@@ -236,7 +208,15 @@ fun RegistrationScreen(navController: NavHostController, viewModel: MainViewMode
 }
 
 @Composable
-fun RegistarationScreen2(navController: NavHostController, viewModel: MainViewModel) {
+fun RegistrationScreen2(navController: NavHostController, viewModel: MainViewModel) {
+    val flag = remember {mutableStateOf(false)}
+    val surnameFlag = remember { mutableStateOf(false) }
+    val nameFlag = remember {mutableStateOf(false)}
+    val phoneFlag = remember { mutableStateOf(false) }
+    val name = remember { mutableStateOf("") }
+    val surname = remember { mutableStateOf("") }
+    val phoneNumber = remember { mutableStateOf("") }
+
     Box(
         contentAlignment = Alignment.TopCenter,
         modifier = Modifier
@@ -258,26 +238,132 @@ fun RegistarationScreen2(navController: NavHostController, viewModel: MainViewMo
                 fontWeight = FontWeight.Bold,
                 fontFamily = OldStandart
             )
-            TextField(
-                value = "Фамилия",
-                onValueChange = {},
-                Modifier.padding(bottom = 10.dp).width(280.dp)
-            )
-            TextField(
-                value = "Имя",
-                onValueChange = {},
-                Modifier.padding(bottom = 10.dp).width(280.dp)
-            )
-            TextField(
-                value = "Номер телефона",
-                onValueChange = {},
-                Modifier.padding(bottom = 30.dp).width(280.dp)
-            )
+            Column()
+            {
+                OutlinedTextField(value = surname.value,
+                    onValueChange = { it -> surname.value = it },
+                    leadingIcon = { Icon(Icons.Filled.Person, contentDescription = "Фамилия") },
+                    colors = TextFieldDefaults.colors(
+                        focusedContainerColor = Color(0XFFF5F5F9),
+                        focusedIndicatorColor = Color(0xFFEBEBEB),
+                        focusedTextColor = Color.Black,
+                        disabledIndicatorColor = Color.Transparent,
+                        unfocusedIndicatorColor = Color.Transparent,
+                        cursorColor = Color(0XFF578FFF),
+                        focusedSupportingTextColor = Color(0xFF00000)
+                    ),
+                    modifier = Modifier
+                        .fillMaxWidth(1f)
+                        .background(Color(0XFFF5F5F9))
+                        .height(height = 56.dp)
+                        .width(width = 320.dp),
+                    isError = surnameFlag.value,
+                    placeholder = {
+                        Text(
+                            modifier = Modifier.fillMaxWidth(),
+                            text = "Фамилия",
+                            fontWeight = FontWeight.Normal,
+                            fontSize = 15.sp,
+                            color = Color(0XFF939396)
+                        )
+                    }
+                )
+
+                if (surname.value.isEmpty()) {
+                    surnameFlag.value = true
+                    Text("Введите фамилию", color = Color.Red, fontSize = 10.sp)
+                } else {
+                    surnameFlag.value = false
+                }
+            }
+            Spacer(modifier = Modifier.height(20.dp))
+            Column {
+                OutlinedTextField(value = name.value, onValueChange = { it -> name.value = it },
+                    leadingIcon = { Icon(Icons.Filled.Person, contentDescription = "Имя") },
+                    colors = TextFieldDefaults.colors(
+                        focusedContainerColor = Color(0XFFF5F5F9),
+                        focusedIndicatorColor = Color(0xFFEBEBEB),
+                        focusedTextColor = Color.Black,
+                        disabledIndicatorColor = Color.Transparent,
+                        unfocusedIndicatorColor = Color.Transparent,
+                        cursorColor = Color(0XFF578FFF),
+                        focusedSupportingTextColor = Color(0xFF00000)
+                    ),
+                    modifier = Modifier
+                        .fillMaxWidth(1f)
+                        .background(Color(0XFFF5F5F9))
+                        .height(height = 56.dp)
+                        .width(width = 320.dp),
+                    isError = nameFlag.value,
+
+                    placeholder = {
+                        Text(
+                            modifier = Modifier.fillMaxWidth(),
+                            text = "Имя",
+                            fontWeight = FontWeight.Normal,
+                            fontSize = 15.sp,
+                            color = Color(0XFF939396)
+                        )
+                    }
+                )
+
+                if (name.value.isEmpty()) {
+                    nameFlag.value = true
+                    Text("Введите имя", color = Color.Red, fontSize = 10.sp)
+                } else {
+                    nameFlag.value = false
+                }
+
+            }
+            Column {
+                OutlinedTextField(value = phoneNumber.value, onValueChange = { it -> name.value = it },
+                    leadingIcon = { Icon(Icons.Filled.Person, contentDescription = "Имя") },
+                    colors = TextFieldDefaults.colors(
+                        focusedContainerColor = Color(0XFFF5F5F9),
+                        focusedIndicatorColor = Color(0xFFEBEBEB),
+                        focusedTextColor = Color.Black,
+                        disabledIndicatorColor = Color.Transparent,
+                        unfocusedIndicatorColor = Color.Transparent,
+                        cursorColor = Color(0XFF578FFF),
+                        focusedSupportingTextColor = Color(0xFF00000)
+                    ),
+                    modifier = Modifier
+                        .fillMaxWidth(1f)
+                        .background(Color(0XFFF5F5F9))
+                        .height(height = 56.dp)
+                        .width(width = 320.dp),
+                    isError = nameFlag.value,
+
+                    placeholder = {
+                        Text(
+                            modifier = Modifier.fillMaxWidth(),
+                            text = "Номер телефона",
+                            fontWeight = FontWeight.Normal,
+                            fontSize = 15.sp,
+                            color = Color(0XFF939396)
+                        )
+                    }
+                )
+
+                if (name.value.isEmpty()) {
+                    nameFlag.value = true
+                    Text("Введите номер телефона", color = Color.Red, fontSize = 10.sp)
+                } else {
+                    nameFlag.value = false
+                }
+
+            }
+
             Button(modifier = Modifier
                 .width(width = 270.dp)
                 .height(height = 40.dp)
                 .padding(),
-                onClick = {},
+                onClick = {
+                    viewModel.CreateUser(secondName = surname.value,
+                        firstName = name.value,
+                        phoneNumber = phoneNumber.value.toInt())
+                    navController.navigate("UserProfile")
+                },
                 shape = RoundedCornerShape(23.dp),
                 border = BorderStroke(0.dp, Color(0xFFEBEBEB)),
                 colors = ButtonDefaults.buttonColors(

+ 1 - 1
Development/app/src/main/java/com/example/development/mainActivity/components/UserProfile.kt

@@ -323,7 +323,7 @@ fun UserProfile2(navController: NavHostController, viewModel: MainViewModel)
 }
 
 @Composable
-fun UserProfileForUnauthorizedUser()
+fun UserProfileForUnauthorizedUser(navController: NavHostController)
 {
     Box(contentAlignment = Alignment.TopCenter,
         modifier = Modifier

+ 7 - 0
Development/app/src/main/java/com/example/development/model/UserState.kt

@@ -0,0 +1,7 @@
+package com.example.development.model
+
+sealed class UserState {
+    object Loading: UserState()
+    data class Success(val message:String):UserState()
+    data class Error(val message:String):UserState()
+}