commit ee514f4b1ecc25cf03fd3a205e5480f9ef076b24 Author: Safgerd Date: Mon Dec 4 21:04:57 2023 +0400 Лаб 2 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..aa724b7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,15 @@ +*.iml +.gradle +/local.properties +/.idea/caches +/.idea/libraries +/.idea/modules.xml +/.idea/workspace.xml +/.idea/navEditor.xml +/.idea/assetWizardSettings.xml +.DS_Store +/build +/captures +.externalNativeBuild +.cxx +local.properties diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..b589d56 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml new file mode 100644 index 0000000..ae388c2 --- /dev/null +++ b/.idea/gradle.xml @@ -0,0 +1,20 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..44ca2d9 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,41 @@ + + + + \ No newline at end of file diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml new file mode 100644 index 0000000..0fc3113 --- /dev/null +++ b/.idea/kotlinc.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..8978d23 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,9 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/app/.gitignore b/app/.gitignore new file mode 100644 index 0000000..42afabf --- /dev/null +++ b/app/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/app/build.gradle.kts b/app/build.gradle.kts new file mode 100644 index 0000000..e6bf623 --- /dev/null +++ b/app/build.gradle.kts @@ -0,0 +1,71 @@ +plugins { + id("com.android.application") + id("org.jetbrains.kotlin.android") +} + +android { + namespace = "com.example.mobileapp" + compileSdk = 34 + + defaultConfig { + applicationId = "com.example.mobileapp" + minSdk = 24 + targetSdk = 34 + versionCode = 1 + versionName = "1.0" + + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + vectorDrawables { + useSupportLibrary = true + } + } + + buildTypes { + release { + isMinifyEnabled = false + proguardFiles( + getDefaultProguardFile("proguard-android-optimize.txt"), + "proguard-rules.pro" + ) + } + } + compileOptions { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + } + kotlinOptions { + jvmTarget = "1.8" + } + buildFeatures { + compose = true + } + composeOptions { + kotlinCompilerExtensionVersion = "1.4.3" + } + packaging { + resources { + excludes += "/META-INF/{AL2.0,LGPL2.1}" + } + } +} + +dependencies { + + implementation("androidx.core:core-ktx:1.9.0") + implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.6.2") + implementation("androidx.activity:activity-compose:1.8.0") + implementation(platform("androidx.compose:compose-bom:2023.03.00")) + implementation("androidx.compose.ui:ui") + implementation("androidx.compose.ui:ui-graphics") + implementation("androidx.compose.ui:ui-tooling-preview") + implementation("androidx.compose.material3:material3") + testImplementation("junit:junit:4.13.2") + androidTestImplementation("androidx.test.ext:junit:1.1.5") + androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1") + androidTestImplementation(platform("androidx.compose:compose-bom:2023.03.00")) + androidTestImplementation("androidx.compose.ui:ui-test-junit4") + debugImplementation("androidx.compose.ui:ui-tooling") + debugImplementation("androidx.compose.ui:ui-test-manifest") + + implementation("androidx.navigation:navigation-compose:2.7.3") +} \ No newline at end of file diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro new file mode 100644 index 0000000..481bb43 --- /dev/null +++ b/app/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/app/src/androidTest/java/com/example/mobileapp/ExampleInstrumentedTest.kt b/app/src/androidTest/java/com/example/mobileapp/ExampleInstrumentedTest.kt new file mode 100644 index 0000000..7b84cb2 --- /dev/null +++ b/app/src/androidTest/java/com/example/mobileapp/ExampleInstrumentedTest.kt @@ -0,0 +1,24 @@ +package com.example.mobileapp + +import androidx.test.platform.app.InstrumentationRegistry +import androidx.test.ext.junit.runners.AndroidJUnit4 + +import org.junit.Test +import org.junit.runner.RunWith + +import org.junit.Assert.* + +/** + * Instrumented test, which will execute on an Android device. + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +@RunWith(AndroidJUnit4::class) +class ExampleInstrumentedTest { + @Test + fun useAppContext() { + // Context of the app under test. + val appContext = InstrumentationRegistry.getInstrumentation().targetContext + assertEquals("com.example.mobileapp", appContext.packageName) + } +} \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..0e06458 --- /dev/null +++ b/app/src/main/AndroidManifest.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/java/com/example/mobileapp/MainActivity.kt b/app/src/main/java/com/example/mobileapp/MainActivity.kt new file mode 100644 index 0000000..3643abc --- /dev/null +++ b/app/src/main/java/com/example/mobileapp/MainActivity.kt @@ -0,0 +1,16 @@ +package com.example.mobileapp + +import android.os.Bundle +import androidx.activity.ComponentActivity +import androidx.activity.compose.setContent +import com.example.mobileapp.navigation.AppNavigation + +class MainActivity : ComponentActivity() { + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContent { + AppNavigation() + } + } +} + diff --git a/app/src/main/java/com/example/mobileapp/models/Cart.kt b/app/src/main/java/com/example/mobileapp/models/Cart.kt new file mode 100644 index 0000000..295f348 --- /dev/null +++ b/app/src/main/java/com/example/mobileapp/models/Cart.kt @@ -0,0 +1,17 @@ +package com.example.mobileapp.models + +data class Cart( + val id: Int, + val userId: Int, + val price: Int?, +) + +fun getCarts(): List { + return listOf( + Cart(1,1, getCartProductsByCartId(1).sumOf { getProductById(it.productId).price * it.amount }), + ) +} + +fun getCartByUserId(id: Int): Cart{ + return getCarts().find { it.userId == id }!! +} \ No newline at end of file diff --git a/app/src/main/java/com/example/mobileapp/models/CartProduct.kt b/app/src/main/java/com/example/mobileapp/models/CartProduct.kt new file mode 100644 index 0000000..0819663 --- /dev/null +++ b/app/src/main/java/com/example/mobileapp/models/CartProduct.kt @@ -0,0 +1,19 @@ +package com.example.mobileapp.models + +data class CartProduct( + val cartId: Int, + val productId: Int, + val amount: Int, +) + +fun getAllCartProducts(): List { + return listOf( + CartProduct(1, 1, 2), + CartProduct(1, 4, 1), + CartProduct(1, 7, 1), + ) +} + +fun getCartProductsByCartId(id: Int): List { + return getAllCartProducts().filter { it.cartId == id } +} \ No newline at end of file diff --git a/app/src/main/java/com/example/mobileapp/models/Category.kt b/app/src/main/java/com/example/mobileapp/models/Category.kt new file mode 100644 index 0000000..af73c9b --- /dev/null +++ b/app/src/main/java/com/example/mobileapp/models/Category.kt @@ -0,0 +1,18 @@ +package com.example.mobileapp.models + +data class Category( + val id: Int, + val title: String, +) + +fun getCategories():List{ + return listOf( + Category(1, "Бургеры"), + Category(2, "Картошка"), + Category(3, "Напитки"), + ) +} + +fun getCategoryById(id: Int):String{ + return getCategories().find{ it.id == id }!!.title +} \ No newline at end of file diff --git a/app/src/main/java/com/example/mobileapp/models/Order.kt b/app/src/main/java/com/example/mobileapp/models/Order.kt new file mode 100644 index 0000000..6195f7d --- /dev/null +++ b/app/src/main/java/com/example/mobileapp/models/Order.kt @@ -0,0 +1,21 @@ +package com.example.mobileapp.models + +data class Order( + val id: Int, + val userId: Int, + val price: Int, + val status: String + +) + +fun getOrders(): List { + return listOf( + Order(1,1, getOrderProductsByOrderId(1).sumOf { getProductById(it.productId).price * it.amount }, "Принят"), + Order(2,1, getOrderProductsByOrderId(2).sumOf { getProductById(it.productId).price * it.amount }, "Принят"), + ) +} + + +fun getOrdersByUserId(id: Int): List{ + return getOrders().filter { it.userId == id } +} \ No newline at end of file diff --git a/app/src/main/java/com/example/mobileapp/models/OrderProduct.kt b/app/src/main/java/com/example/mobileapp/models/OrderProduct.kt new file mode 100644 index 0000000..f333573 --- /dev/null +++ b/app/src/main/java/com/example/mobileapp/models/OrderProduct.kt @@ -0,0 +1,22 @@ +package com.example.mobileapp.models + +data class OrderProduct( + val orderId: Int, + val productId: Int, + val amount: Int, +) + +fun getAllOrderProducts(): List { + return listOf( + OrderProduct(1, 1, 2), + OrderProduct(1, 4, 1), + OrderProduct(1, 7, 1), + OrderProduct(2, 1, 2), + OrderProduct(2, 4, 1), + OrderProduct(2, 7, 1), + ) +} + +fun getOrderProductsByOrderId(id: Int): List { + return getAllOrderProducts().filter { it.orderId == id } +} \ No newline at end of file diff --git a/app/src/main/java/com/example/mobileapp/models/Product.kt b/app/src/main/java/com/example/mobileapp/models/Product.kt new file mode 100644 index 0000000..297e895 --- /dev/null +++ b/app/src/main/java/com/example/mobileapp/models/Product.kt @@ -0,0 +1,32 @@ +package com.example.mobileapp.models + +data class Product( + val id: Int, + val picture: String, + val title: String, + val category: Int, + val price: Int, +) + + +fun getProducts() :List { + return listOf( + Product(1, "Бургер", "Бургер1", 1,150), + Product(2, "Бургер", "Бургер2", 1,300), + Product(3, "Бургер", "Бургер3", 1,450), + Product(4, "Картошка", "Картошка1", 2,100), + Product(5, "Картошка", "Картошка2", 2,200), + Product(6, "Картошка", "Картошка3", 2,300), + Product(7, "Пепси", "Пепси1", 3,50), + Product(8, "Пепси", "Пепси2", 3,100), + Product(9, "Пепси", "Пепси3", 3,150), + ) +} + +fun getProductsByCategoryId(id: Int) :List { + return getProducts().filter { it.category == id } +} + +fun getProductById(id: Int) : Product { + return getProducts().find{ it.id == id }!! +} \ No newline at end of file diff --git a/app/src/main/java/com/example/mobileapp/models/Roles.kt b/app/src/main/java/com/example/mobileapp/models/Roles.kt new file mode 100644 index 0000000..13277b1 --- /dev/null +++ b/app/src/main/java/com/example/mobileapp/models/Roles.kt @@ -0,0 +1,30 @@ +package com.example.mobileapp.models + +enum class Roles(val roleId: Int) { + admin(0), + worker(1), + user(2); + + companion object{ + fun fromId(id: Int): Roles? { + return values().find { it.roleId == id } + } + } +} + +data class Role( + val id: Int, + val title: String, +) + +fun getRoles():List{ + return listOf( + Role(1, "admin"), + Role(2, "worker"), + Role(3, "user"), + ) +} + +fun getRoleById(id: Int):String{ + return getRoles().find{ it.id == id }!!.title +} \ No newline at end of file diff --git a/app/src/main/java/com/example/mobileapp/models/User.kt b/app/src/main/java/com/example/mobileapp/models/User.kt new file mode 100644 index 0000000..160e638 --- /dev/null +++ b/app/src/main/java/com/example/mobileapp/models/User.kt @@ -0,0 +1,20 @@ +package com.example.mobileapp.models + +data class User( + val id: Int, + val login: String, + val password: String, + val role: Roles +) + +fun getAllUsers():List{ + return listOf( + User(1, "admin", "admin", Roles.admin), + User(2, "worker", "worker", Roles.worker), + User(3, "user", "user", Roles.user), + ) +} + +fun currentUser():User{ + return getAllUsers()[0] +} \ No newline at end of file diff --git a/app/src/main/java/com/example/mobileapp/navigation/AppNavigation.kt b/app/src/main/java/com/example/mobileapp/navigation/AppNavigation.kt new file mode 100644 index 0000000..1dd832c --- /dev/null +++ b/app/src/main/java/com/example/mobileapp/navigation/AppNavigation.kt @@ -0,0 +1,121 @@ +package com.example.mobileapp.navigation + +import androidx.compose.foundation.BorderStroke +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.fillMaxHeight +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.material3.ButtonDefaults +import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.material3.Icon +import androidx.compose.material3.OutlinedButton +import androidx.compose.material3.Scaffold +import androidx.compose.runtime.Composable +import androidx.compose.runtime.getValue +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.res.painterResource +import androidx.compose.ui.unit.dp +import androidx.navigation.NavController +import androidx.navigation.compose.NavHost +import androidx.navigation.compose.composable +import androidx.navigation.compose.currentBackStackEntryAsState +import androidx.navigation.compose.rememberNavController +import com.example.mobileapp.models.Roles +import com.example.mobileapp.models.currentUser +import com.example.mobileapp.screens.AuthorizationScreen +import com.example.mobileapp.screens.CartScreen +import com.example.mobileapp.screens.CreateProductScreen +import com.example.mobileapp.screens.EditMenuScreen +import com.example.mobileapp.screens.EditProductScreen +import com.example.mobileapp.screens.ManagmentScreen +import com.example.mobileapp.screens.MenuScreen +import com.example.mobileapp.screens.OrderScreen +import com.example.mobileapp.screens.ProfileScreen +import com.example.mobileapp.screens.RegistrationScreen +import com.example.mobileapp.screens.UsersScreen + +@OptIn(ExperimentalMaterial3Api::class) +@Composable +fun AppNavigation(){ + val navController = rememberNavController() + Scaffold( + bottomBar = { + val navBackStackEntry by navController.currentBackStackEntryAsState() + val currentRoute = navBackStackEntry?.destination?.route + if (currentRoute != Screens.AuthorizationScreen.name && currentRoute != Screens.RegistrationScreen.name) { + CustomNavigationBar(navController) + } + } + ){ + paddingValues -> + NavHost( + navController = navController, + startDestination = Screens.AuthorizationScreen.name, + modifier = Modifier.padding(paddingValues) + ){ + composable(route = Screens.MenuScreen.name){ MenuScreen() } + composable(route = Screens.ProfileScreen.name){ ProfileScreen(navController) } + composable(route = Screens.CartScreen.name){ CartScreen() } + composable(route = Screens.ManagmentScreen.name){ ManagmentScreen(navController) } + composable(route = Screens.OrderScreen.name){ OrderScreen() } + + composable(route = Screens.AuthorizationScreen.name){ AuthorizationScreen(navController) } + composable(route = Screens.CreateProductScreen.name){ CreateProductScreen() } + composable(route = Screens.EditMenuScreen.name){ EditMenuScreen(navController) } + composable(route = Screens.RegistrationScreen.name){ RegistrationScreen(navController) } + composable(route = Screens.UsersScreen.name){ UsersScreen() } + composable(route = Screens.EditProductScreen.name + "/{productId}"){ backStackEntry -> + val productId = backStackEntry.arguments?.getString("productId") + EditProductScreen(productId.toString().toInt()) + } + } + } +} + +@Composable +fun CustomNavigationBar(navController: NavController) { + Row( + modifier = Modifier + .fillMaxWidth() + .fillMaxHeight(0.1f) + .background(Color(212, 206, 203)) + ) { + var listOfNavItems : List? = null + + when (currentUser().role.name) { + Roles.admin.name -> listOfNavItems = listOfAdminNavItems + Roles.worker.name -> listOfNavItems = listOfWorkerNavItems + Roles.user.name -> listOfNavItems = listOfUserNavItems + } + + listOfNavItems?.forEachIndexed { index, navItem -> + OutlinedButton( + modifier = Modifier + .fillMaxHeight() + .weight(1f), + onClick = { + navController.navigate(navItem.route) { + popUpTo(navController.graph.startDestinationId) + launchSingleTop = true + } + }, + border = BorderStroke(4.dp, Color(222,161,69)), + shape = RoundedCornerShape( + topStart = if (index == 0) 30.dp else 0.dp, + topEnd = if (index == listOfNavItems.size - 1) 30.dp else 0.dp + ), + colors = ButtonDefaults.outlinedButtonColors(Color(255,186,83)), + + ){ + Icon( + painterResource(id = navItem.icon), + contentDescription = null, + tint = Color.Black + ) + } + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/example/mobileapp/navigation/NavItems.kt b/app/src/main/java/com/example/mobileapp/navigation/NavItems.kt new file mode 100644 index 0000000..8d70c4a --- /dev/null +++ b/app/src/main/java/com/example/mobileapp/navigation/NavItems.kt @@ -0,0 +1,78 @@ +package com.example.mobileapp.navigation + +import com.example.mobileapp.R + +data class NavItem( + val label: String, + val icon: Int, + val route: String +) + +val listOfAdminNavItems = listOf( + NavItem( + label = "Order", + icon = R.drawable.icon_order, + route = Screens.OrderScreen.name + ), + NavItem( + label = "Profile", + icon = R.drawable.icon_profile, + route = Screens.ProfileScreen.name + ), + NavItem( + label = "Menu", + icon = R.drawable.icon_menu, + route = Screens.MenuScreen.name + ), + NavItem( + label = "Cart", + icon = R.drawable.icon_cart, + route = Screens.CartScreen.name + ), + NavItem( + label = "Managment", + icon = R.drawable.icon_managment, + route = Screens.ManagmentScreen.name + ), +) + +val listOfUserNavItems = listOf( + NavItem( + label = "Profile", + icon = R.drawable.icon_profile, + route = Screens.ProfileScreen.name + ), + NavItem( + label = "Menu", + icon = R.drawable.icon_menu, + route = Screens.MenuScreen.name + ), + NavItem( + label = "Cart", + icon = R.drawable.icon_cart, + route = Screens.CartScreen.name + ), +) + +val listOfWorkerNavItems = listOf( + NavItem( + label = "Order", + icon = R.drawable.icon_order, + route = Screens.OrderScreen.name + ), + NavItem( + label = "Profile", + icon = R.drawable.icon_profile, + route = Screens.ProfileScreen.name + ), + NavItem( + label = "Menu", + icon = R.drawable.icon_menu, + route = Screens.MenuScreen.name + ), + NavItem( + label = "Cart", + icon = R.drawable.icon_cart, + route = Screens.CartScreen.name + ), +) \ No newline at end of file diff --git a/app/src/main/java/com/example/mobileapp/navigation/Screens.kt b/app/src/main/java/com/example/mobileapp/navigation/Screens.kt new file mode 100644 index 0000000..e11781f --- /dev/null +++ b/app/src/main/java/com/example/mobileapp/navigation/Screens.kt @@ -0,0 +1,15 @@ +package com.example.mobileapp.navigation + +enum class Screens { + CartScreen, + ManagmentScreen, + MenuScreen, + OrderScreen, + ProfileScreen, + AuthorizationScreen, + CreateProductScreen, + EditMenuScreen, + EditProductScreen, + RegistrationScreen, + UsersScreen, +} \ No newline at end of file diff --git a/app/src/main/java/com/example/mobileapp/screens/AuthorizationScreen.kt b/app/src/main/java/com/example/mobileapp/screens/AuthorizationScreen.kt new file mode 100644 index 0000000..5442dd2 --- /dev/null +++ b/app/src/main/java/com/example/mobileapp/screens/AuthorizationScreen.kt @@ -0,0 +1,171 @@ +package com.example.mobileapp.screens + +import androidx.compose.foundation.BorderStroke +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.material3.Button +import androidx.compose.material3.ButtonDefaults +import androidx.compose.material3.Card +import androidx.compose.material3.ExperimentalMaterial3Api +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.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.text.TextStyle +import androidx.compose.ui.text.font.Font +import androidx.compose.ui.text.font.FontFamily +import androidx.compose.ui.text.input.TextFieldValue +import androidx.compose.ui.text.style.TextAlign +import androidx.compose.ui.unit.dp +import androidx.compose.ui.unit.sp +import androidx.navigation.NavController +import com.example.mobileapp.R +import com.example.mobileapp.navigation.Screens +import com.example.mobileapp.widgets.Header + +@Composable +fun AuthorizationScreen(navController: NavController) { + Column ( + modifier = Modifier.fillMaxSize(), + horizontalAlignment = Alignment.CenterHorizontally, + ) { + Header(Color.White) + AuthorizationCard(navController) + } +} + +@OptIn(ExperimentalMaterial3Api::class) +@Composable +fun AuthorizationCard(navController: NavController){ + val login = remember { mutableStateOf(TextFieldValue("")) } + val password = remember { mutableStateOf(TextFieldValue("")) } + + Column( + horizontalAlignment = Alignment.CenterHorizontally, + ) { + Card( + shape = RoundedCornerShape(30.dp), + modifier = Modifier.padding(top = 30.dp) + ) { + + Column ( + horizontalAlignment = Alignment.CenterHorizontally, + modifier = Modifier + .background(Color(212, 206, 203)) + .fillMaxWidth(0.9f) + ) { + Card( + shape = RoundedCornerShape(90.dp, 90.dp, 30.dp, 30.dp), + border = BorderStroke(4.dp, Color(222,161,69)), + modifier = Modifier + .fillMaxWidth() + .padding(top = 30.dp, start = 20.dp, end = 20.dp) + ){ + Text( + text = "Авторизация", + color = Color.White, + fontFamily = FontFamily(Font(R.font.nunito_bold)), + fontSize = 30.sp, + modifier = Modifier + .fillMaxWidth() + .background(Color(255, 186, 83)) + .padding(top = 20.dp, bottom = 20.dp), + textAlign = TextAlign.Center, + ) + } + + OutlinedTextField( + value = login.value, + onValueChange = {login.value = it}, + placeholder = { Text(text = "Логин", fontSize = 20.sp, color = Color.LightGray) }, + singleLine = true, + + shape = RoundedCornerShape(30.dp, 30.dp, 30.dp, 30.dp), + textStyle = TextStyle(fontSize = 20.sp), + colors = TextFieldDefaults.outlinedTextFieldColors( + textColor = Color.Black, + disabledTextColor = Color.Transparent, + containerColor = Color.White, + focusedBorderColor = Color.Yellow, + unfocusedBorderColor = Color.Yellow, + ), + modifier = Modifier + .fillMaxWidth() + .padding(top = 20.dp, start = 20.dp, end = 20.dp), + ) + + OutlinedTextField( + value = password.value, + onValueChange = {password.value = it}, + placeholder = { Text(text = "Пароль", fontSize = 20.sp, color = Color.LightGray) }, + singleLine = true, + shape = RoundedCornerShape(30.dp, 30.dp, 30.dp, 30.dp), + textStyle = TextStyle(fontSize = 20.sp), + colors = TextFieldDefaults.outlinedTextFieldColors( + textColor = Color.Black, + disabledTextColor = Color.Transparent, + containerColor = Color.White, + focusedBorderColor = Color(183,97,48), + unfocusedBorderColor = Color(183,97,48), + ), + modifier = Modifier + .fillMaxWidth() + .padding(top = 20.dp, start = 20.dp, end = 20.dp), + ) + + Button( + onClick = { + navController.navigate(Screens.MenuScreen.name) { + popUpTo(navController.graph.startDestinationId) + launchSingleTop = true + } + }, + colors = ButtonDefaults.buttonColors(Color(255,186,83), Color.White), + shape = RoundedCornerShape(30.dp, 30.dp, 30.dp, 30.dp), + border = BorderStroke(4.dp, Color(222,161,69)), + modifier = Modifier + .fillMaxWidth() + .padding(top = 20.dp, start = 20.dp, end = 20.dp) + ) { + Text( + text = "Войти", + color = Color.White, + fontFamily = FontFamily(Font(R.font.nunito_bold)), + fontSize = 30.sp, + textAlign = TextAlign.Center, + ) + } + + Button( + onClick = { + navController.navigate(Screens.RegistrationScreen.name) { + popUpTo(navController.graph.startDestinationId) + launchSingleTop = true + } + }, + colors = ButtonDefaults.buttonColors(Color(212,206,203)), + modifier = Modifier + .fillMaxWidth() + .padding(top = 10.dp, start = 20.dp, end = 20.dp) + ) { + Text( + text = "Создать аккаунт", + color = Color.White, + fontFamily = FontFamily(Font(R.font.nunito_bold)), + fontSize = 20.sp, + textAlign = TextAlign.Center, + ) + } + } + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/example/mobileapp/screens/CartScreen.kt b/app/src/main/java/com/example/mobileapp/screens/CartScreen.kt new file mode 100644 index 0000000..e7888f1 --- /dev/null +++ b/app/src/main/java/com/example/mobileapp/screens/CartScreen.kt @@ -0,0 +1,247 @@ +package com.example.mobileapp.screens + +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.Column +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.fillMaxHeight +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.size +import androidx.compose.foundation.lazy.LazyColumn +import androidx.compose.foundation.lazy.items +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.material3.ButtonDefaults +import androidx.compose.material3.Card +import androidx.compose.material3.OutlinedButton +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.res.painterResource +import androidx.compose.ui.text.font.Font +import androidx.compose.ui.text.font.FontFamily +import androidx.compose.ui.text.input.TextFieldValue +import androidx.compose.ui.text.style.TextAlign +import androidx.compose.ui.unit.dp +import androidx.compose.ui.unit.sp +import com.example.mobileapp.R +import com.example.mobileapp.models.currentUser +import com.example.mobileapp.models.getCartByUserId +import com.example.mobileapp.models.getCartProductsByCartId +import com.example.mobileapp.models.getProductById +import com.example.mobileapp.widgets.Header + +@Composable +fun CartScreen(){ + Column ( + modifier = Modifier.fillMaxSize(), + horizontalAlignment = Alignment.CenterHorizontally, + ) { + Header(Color(212, 206, 203)) + CartCard() + } +} + +@Composable +fun CartCard(){ + Column( + modifier = Modifier + .fillMaxSize() + .background(Color(212, 206, 203)), + horizontalAlignment = Alignment.CenterHorizontally, + + ) { + Column( + modifier = Modifier + .fillMaxHeight() + .fillMaxWidth(0.9f) + .background(Color.White), + + horizontalAlignment = Alignment.CenterHorizontally, + ) { + Text( + text = "Корзина", + color = Color.Black, + fontFamily = FontFamily(Font(R.font.nunito_extrabold_italic)), + fontSize = 34.sp, + modifier = Modifier + .fillMaxWidth() + .padding(top = 10.dp), + textAlign = TextAlign.Center, + ) + val cart = getCartByUserId(currentUser().id) + val cartProducts = getCartProductsByCartId(cart.id) + + LazyColumn( + modifier = Modifier + .fillMaxWidth() + ) { + items(cartProducts){ cartProduct -> + val amount = remember { mutableStateOf(TextFieldValue(cartProduct.amount.toString())) } + Card( + shape = RoundedCornerShape(20.dp), + border = BorderStroke(3.dp, Color(222,161,69)), + modifier = Modifier + .fillMaxSize() + .padding(top = 15.dp, start = 5.dp, end = 5.dp) + ){ + Row( + modifier = Modifier + .fillMaxSize() + .background(Color.White), + verticalAlignment = Alignment.CenterVertically, + horizontalArrangement = Arrangement.SpaceEvenly, + ){ + if (getProductById(cartProduct.productId).picture == "Бургер"){ + Image( + painterResource( + id = R.drawable.burger + ), + contentDescription = null, + modifier = Modifier + .size(100.dp, 100.dp) + .padding(5.dp), + ) + } + if (getProductById(cartProduct.productId).picture == "Картошка"){ + Image( + painterResource( + id = R.drawable.potato + ), + contentDescription = null, + modifier = Modifier + .size(100.dp, 100.dp) + .padding(5.dp), + ) + } + if (getProductById(cartProduct.productId).picture == "Пепси"){ + Image( + painterResource( + id = R.drawable.pepsi + ), + contentDescription = null, + modifier = Modifier + .size(100.dp, 100.dp) + .padding(5.dp), + ) + } + + Column ( + horizontalAlignment = Alignment.CenterHorizontally, + verticalArrangement = Arrangement.SpaceAround + ) { + Text( + text = getProductById(cartProduct.productId).title, + color = Color.Black, + fontFamily = FontFamily(Font(R.font.nunito_extrabold_italic)), + fontSize = 17.sp, + textAlign = TextAlign.Center, + ) + Text( + text = getProductById(cartProduct.productId).price.toString() + " р.", + color = Color.Black, + fontFamily = FontFamily(Font(R.font.nunito_extrabold_italic)), + fontSize = 17.sp, + textAlign = TextAlign.Center, + ) + Row( + verticalAlignment = Alignment.CenterVertically, + horizontalArrangement = Arrangement.Center, + modifier = Modifier + .fillMaxWidth(0.8f) + ){ + OutlinedButton( + modifier = Modifier + .fillMaxHeight(), + onClick = { + /*TODO*/ + }, + border = BorderStroke(4.dp, Color(222,161,69)), + shape = RoundedCornerShape(topStart = 30.dp, bottomStart = 30.dp), + colors = ButtonDefaults.outlinedButtonColors(Color(255,186,83)), + ) { + Text(text = "-", fontSize = 20.sp, color = Color.Black) + } + + Card( + modifier = Modifier + .fillMaxHeight(), + border = BorderStroke(3.dp, Color(222,161,69)), + shape = RoundedCornerShape(0.dp), + ){ + Text( + modifier = Modifier + .background(Color.White) + .fillMaxHeight() + .padding(start = 20.dp, end = 20.dp, top = 7.dp, bottom = 7.dp), + text = amount.value.text, + color = Color.Black, + fontFamily = FontFamily(Font(R.font.nunito_bold)), + fontSize = 20.sp, + textAlign = TextAlign.Center, + ) + } + + OutlinedButton( + modifier = Modifier + .fillMaxHeight(), + onClick = { + /*TODO*/ + }, + border = BorderStroke(4.dp, Color(222,161,69)), + shape = RoundedCornerShape(topEnd = 30.dp, bottomEnd = 30.dp), + colors = ButtonDefaults.outlinedButtonColors(Color(255,186,83)), + ) { + Text(text = "+", fontSize = 20.sp, color = Color.Black) + } + } + } + } + } + } + } + Card( + shape = RoundedCornerShape(20.dp), + border = BorderStroke(3.dp, Color(222,161,69)), + modifier = Modifier + .padding(top = 15.dp, start = 5.dp, end = 5.dp) + ){ + Row( + modifier = Modifier + .fillMaxWidth() + .background(Color.White), + horizontalArrangement = Arrangement.SpaceBetween, + verticalAlignment = Alignment.CenterVertically, + ){ + Text( + text = "Итого: " + cart.price.toString() + " р.", + color = Color.Black, + fontFamily = FontFamily(Font(R.font.nunito_extrabold_italic)), + fontSize = 20.sp, + textAlign = TextAlign.Center, + modifier = Modifier.padding(start = 5.dp), + ) + + OutlinedButton( + onClick = { + /*TODO*/ + }, + border = BorderStroke(4.dp, Color(222,161,69)), + shape = RoundedCornerShape(20.dp), + colors = ButtonDefaults.outlinedButtonColors(Color(255,186,83)), + modifier = Modifier.padding(5.dp) + ) { + Text(text = "Заказать", fontSize = 20.sp, color = Color.White) + } + } + } + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/example/mobileapp/screens/CreateProductScreen.kt b/app/src/main/java/com/example/mobileapp/screens/CreateProductScreen.kt new file mode 100644 index 0000000..f28d581 --- /dev/null +++ b/app/src/main/java/com/example/mobileapp/screens/CreateProductScreen.kt @@ -0,0 +1,230 @@ +package com.example.mobileapp.screens + +import androidx.compose.foundation.BorderStroke +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.Row +import androidx.compose.foundation.layout.fillMaxHeight +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.material3.ButtonDefaults +import androidx.compose.material3.Card +import androidx.compose.material3.DropdownMenuItem +import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.material3.ExposedDropdownMenuBox +import androidx.compose.material3.ExposedDropdownMenuDefaults +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.OutlinedButton +import androidx.compose.material3.OutlinedTextField +import androidx.compose.material3.Text +import androidx.compose.material3.TextField +import androidx.compose.material3.TextFieldDefaults +import androidx.compose.material3.lightColorScheme +import androidx.compose.runtime.Composable +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember +import androidx.compose.runtime.setValue +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.text.TextStyle +import androidx.compose.ui.text.font.Font +import androidx.compose.ui.text.font.FontFamily +import androidx.compose.ui.text.input.TextFieldValue +import androidx.compose.ui.text.style.TextAlign +import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.dp +import androidx.compose.ui.unit.sp +import com.example.mobileapp.R +import com.example.mobileapp.models.getCategories +import com.example.mobileapp.widgets.Header + +@Composable +fun CreateProductScreen(){ + Column ( + modifier = Modifier.fillMaxSize(), + horizontalAlignment = Alignment.CenterHorizontally, + ) { + Header(Color(212, 206, 203)) + CreateProductCard() + } +} + +@OptIn(ExperimentalMaterial3Api::class) +@Composable +fun CreateProductCard(){ + Column( + modifier = Modifier + .fillMaxSize() + .background(Color(212, 206, 203)), + horizontalAlignment = Alignment.CenterHorizontally, + + ) { + Column( + modifier = Modifier + .fillMaxHeight() + .fillMaxWidth(0.9f) + .background(Color.White), + + horizontalAlignment = Alignment.CenterHorizontally, + ) { + Text( + text = "Создание блюда", + color = Color.Black, + fontFamily = FontFamily(Font(R.font.nunito_extrabold_italic)), + fontSize = 34.sp, + modifier = Modifier + .fillMaxWidth() + .padding(top = 10.dp), + textAlign = TextAlign.Center, + ) + val picture = remember { mutableStateOf(TextFieldValue("")) } + val title = remember { mutableStateOf(TextFieldValue("")) } + val price = remember { mutableStateOf(TextFieldValue("")) } + + Card( + shape = RoundedCornerShape(20.dp), + border = BorderStroke(3.dp, Color(222,161,69)), + modifier = Modifier + .padding(top = 15.dp, start = 5.dp, end = 5.dp) + ){ + Column ( + modifier = Modifier.background(Color.White) + ) { + OutlinedTextField( + value = picture.value, + onValueChange = {picture.value = it}, + placeholder = { Text(text = "Фото", fontSize = 20.sp, color = Color.LightGray) }, + singleLine = true, + + shape = RoundedCornerShape(20.dp), + textStyle = TextStyle(fontSize = 20.sp), + colors = TextFieldDefaults.outlinedTextFieldColors( + textColor = Color.Black, + disabledTextColor = Color.Transparent, + containerColor = Color.White, + focusedBorderColor = Color(222,161,69), + unfocusedBorderColor = Color(222,161,69), + ), + modifier = Modifier + .fillMaxWidth() + .padding(top = 20.dp, start = 20.dp, end = 20.dp), + ) + OutlinedTextField( + value = title.value, + onValueChange = {title.value = it}, + placeholder = { Text(text = "Название", fontSize = 20.sp, color = Color.LightGray) }, + singleLine = true, + + shape = RoundedCornerShape(20.dp), + textStyle = TextStyle(fontSize = 20.sp), + colors = TextFieldDefaults.outlinedTextFieldColors( + textColor = Color.Black, + disabledTextColor = Color.Transparent, + containerColor = Color.White, + focusedBorderColor = Color(222,161,69), + unfocusedBorderColor = Color(222,161,69), + ), + modifier = Modifier + .fillMaxWidth() + .padding(top = 20.dp, start = 20.dp, end = 20.dp), + ) + Card( + shape = RoundedCornerShape(20.dp), + border = BorderStroke(1.dp, Color(222,161,69)), + modifier = Modifier.fillMaxWidth().padding(top = 20.dp, start = 20.dp, end = 20.dp), + ){ + val dataList = getCategories().map { it.title } + var expanded by remember { mutableStateOf(false) } + var selectedItem by remember { mutableStateOf(dataList[0]) } + MaterialTheme( + colorScheme = lightColorScheme( + surfaceVariant= Color.White, + surface = Color.White, + onSurface = Color.Gray + ) + ){ + ExposedDropdownMenuBox( + expanded = expanded, + onExpandedChange = { + expanded = !expanded + }, + ) { + TextField( + modifier = Modifier + .menuAnchor().fillMaxWidth(), + readOnly = true, + value = selectedItem, + onValueChange = {}, + label = { Text("Категория") }, + trailingIcon = { ExposedDropdownMenuDefaults.TrailingIcon(expanded = expanded) }, + ) + + ExposedDropdownMenu( + expanded = expanded, + onDismissRequest = { + expanded = false + }, + ) { + dataList.forEach { selectionOption -> + DropdownMenuItem( + text = { Text(selectionOption) }, + onClick = { + selectedItem = selectionOption + expanded = false + }, + contentPadding = ExposedDropdownMenuDefaults.ItemContentPadding, + ) + } + } + } + } + } + OutlinedTextField( + value = price.value, + onValueChange = {price.value = it}, + placeholder = { Text(text = "Цена", fontSize = 20.sp, color = Color.LightGray) }, + singleLine = true, + + shape = RoundedCornerShape(20.dp), + textStyle = TextStyle(fontSize = 20.sp), + colors = TextFieldDefaults.outlinedTextFieldColors( + textColor = Color.Black, + disabledTextColor = Color.Transparent, + containerColor = Color.White, + focusedBorderColor = Color(222,161,69), + unfocusedBorderColor = Color(222,161,69), + ), + modifier = Modifier + .fillMaxWidth() + .padding(top = 20.dp, start = 20.dp, end = 20.dp), + ) + + OutlinedButton( + onClick = { + /*TODO*/ + }, + border = BorderStroke(4.dp, Color(222,161,69)), + shape = RoundedCornerShape(20.dp), + colors = ButtonDefaults.outlinedButtonColors(Color(255,186,83)), + modifier = Modifier + .fillMaxWidth() + .padding(20.dp), + ) { + Text( + text = "Сохранить", + fontFamily = FontFamily(Font(R.font.nunito_extrabold_italic)), + fontSize = 30.sp, + color = Color.White + ) + } + } + } + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/example/mobileapp/screens/EditMenuScreen.kt b/app/src/main/java/com/example/mobileapp/screens/EditMenuScreen.kt new file mode 100644 index 0000000..671cbff --- /dev/null +++ b/app/src/main/java/com/example/mobileapp/screens/EditMenuScreen.kt @@ -0,0 +1,200 @@ +package com.example.mobileapp.screens + +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.Column +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.fillMaxHeight +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.size +import androidx.compose.foundation.lazy.LazyColumn +import androidx.compose.foundation.lazy.items +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.material3.ButtonDefaults +import androidx.compose.material3.Card +import androidx.compose.material3.Icon +import androidx.compose.material3.OutlinedButton +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.res.painterResource +import androidx.compose.ui.text.font.Font +import androidx.compose.ui.text.font.FontFamily +import androidx.compose.ui.text.style.TextAlign +import androidx.compose.ui.unit.dp +import androidx.compose.ui.unit.sp +import androidx.navigation.NavController +import com.example.mobileapp.R +import com.example.mobileapp.models.getCategories +import com.example.mobileapp.models.getProductsByCategoryId +import com.example.mobileapp.navigation.Screens +import com.example.mobileapp.widgets.Header + +@Composable +fun EditMenuScreen(navController: NavController){ + Column ( + modifier = Modifier.fillMaxSize(), + horizontalAlignment = Alignment.CenterHorizontally, + ) { + Header(Color(212, 206, 203)) + EditMenuCard(navController) + } +} + +@Composable +fun EditMenuCard(navController: NavController){ + Column( + modifier = Modifier + .fillMaxSize() + .background(Color(212, 206, 203)), + horizontalAlignment = Alignment.CenterHorizontally, + + ) { + Column( + modifier = Modifier + .fillMaxHeight() + .fillMaxWidth(0.9f) + .background(Color.White), + + horizontalAlignment = Alignment.CenterHorizontally, + ) { + val categories = getCategories() + LazyColumn( + modifier = Modifier + .fillMaxSize() + ) { + items(categories){ category -> + Text( + text = category.title, + color = Color.Black, + fontFamily = FontFamily(Font(R.font.nunito_extrabold_italic)), + fontSize = 34.sp, + modifier = Modifier + .fillMaxWidth() + .padding(top = 10.dp), + textAlign = TextAlign.Center, + ) + + val products = getProductsByCategoryId(category.id) + + products.forEach{ product -> + Card( + shape = RoundedCornerShape(20.dp), + border = BorderStroke(3.dp, Color(222,161,69)), + modifier = Modifier + .fillMaxSize() + .padding(top = 15.dp, start = 5.dp, end = 5.dp) + ){ + Row( + modifier = Modifier + .fillMaxSize() + .background(Color.White), + verticalAlignment = Alignment.CenterVertically, + horizontalArrangement = Arrangement.SpaceEvenly, + ){ + if (product.picture == "Бургер"){ + Image( + painterResource( + id = R.drawable.burger + ), + contentDescription = null, + modifier = Modifier + .size(100.dp, 100.dp) + .padding(5.dp), + ) + } + if (product.picture == "Картошка"){ + Image( + painterResource( + id = R.drawable.potato + ), + contentDescription = null, + modifier = Modifier + .size(100.dp, 100.dp) + .padding(5.dp), + ) + } + if (product.picture == "Пепси"){ + Image( + painterResource( + id = R.drawable.pepsi + ), + contentDescription = null, + modifier = Modifier + .size(100.dp, 100.dp) + .padding(5.dp), + ) + } + + Column ( + horizontalAlignment = Alignment.CenterHorizontally, + verticalArrangement = Arrangement.SpaceAround + ) { + Text( + text = product.title, + color = Color.Black, + fontFamily = FontFamily(Font(R.font.nunito_extrabold_italic)), + fontSize = 17.sp, + textAlign = TextAlign.Center, + ) + Row( + verticalAlignment = Alignment.CenterVertically, + horizontalArrangement = Arrangement.spacedBy(10.dp), + ){ + Text( + text = product.price.toString() + " р.", + color = Color.Black, + fontFamily = FontFamily(Font(R.font.nunito_extrabold_italic)), + fontSize = 17.sp, + textAlign = TextAlign.Center, + ) + OutlinedButton( + onClick = { + navController.navigate(Screens.EditProductScreen.name + "/${product.id}") { + popUpTo(navController.graph.startDestinationId) + launchSingleTop = true + } + }, + border = BorderStroke(4.dp, Color(222,161,69)), + shape = RoundedCornerShape(10.dp), + colors = ButtonDefaults.outlinedButtonColors(Color(255,186,83)), + + ){ + Icon( + painterResource(id = R.drawable.icon_settings), + contentDescription = null, + Modifier.size(30.dp), + tint = Color.Black + ) + } + + OutlinedButton( + onClick = { /*TODO*/}, + border = BorderStroke(4.dp, Color(222,161,69)), + shape = RoundedCornerShape(10.dp), + colors = ButtonDefaults.outlinedButtonColors(Color(255,186,83)), + + ){ + Icon( + painterResource(id = R.drawable.icon_trash), + contentDescription = null, + Modifier.size(30.dp), + tint = Color.Black + ) + } + } + } + } + } + } + } + } + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/example/mobileapp/screens/EditProductScreen.kt b/app/src/main/java/com/example/mobileapp/screens/EditProductScreen.kt new file mode 100644 index 0000000..2cee94c --- /dev/null +++ b/app/src/main/java/com/example/mobileapp/screens/EditProductScreen.kt @@ -0,0 +1,230 @@ +package com.example.mobileapp.screens + +import androidx.compose.foundation.BorderStroke +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.fillMaxHeight +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.material3.ButtonDefaults +import androidx.compose.material3.Card +import androidx.compose.material3.DropdownMenuItem +import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.material3.ExposedDropdownMenuBox +import androidx.compose.material3.ExposedDropdownMenuDefaults +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.OutlinedButton +import androidx.compose.material3.OutlinedTextField +import androidx.compose.material3.Text +import androidx.compose.material3.TextField +import androidx.compose.material3.TextFieldDefaults +import androidx.compose.material3.lightColorScheme +import androidx.compose.runtime.Composable +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember +import androidx.compose.runtime.setValue +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.text.TextStyle +import androidx.compose.ui.text.font.Font +import androidx.compose.ui.text.font.FontFamily +import androidx.compose.ui.text.input.TextFieldValue +import androidx.compose.ui.text.style.TextAlign +import androidx.compose.ui.unit.dp +import androidx.compose.ui.unit.sp +import com.example.mobileapp.R +import com.example.mobileapp.models.getCategories +import com.example.mobileapp.models.getCategoryById +import com.example.mobileapp.models.getProductById +import com.example.mobileapp.widgets.Header + +@Composable +fun EditProductScreen(id: Int){ + Column ( + modifier = Modifier.fillMaxSize(), + horizontalAlignment = Alignment.CenterHorizontally, + ) { + Header(Color(212, 206, 203)) + EditProductCard(id) + } +} + +@OptIn(ExperimentalMaterial3Api::class) +@Composable +fun EditProductCard(id: Int){ + Column( + modifier = Modifier + .fillMaxSize() + .background(Color(212, 206, 203)), + horizontalAlignment = Alignment.CenterHorizontally, + + ) { + Column( + modifier = Modifier + .fillMaxHeight() + .fillMaxWidth(0.9f) + .background(Color.White), + + horizontalAlignment = Alignment.CenterHorizontally, + ) { + Text( + text = "Редактирование блюда", + color = Color.Black, + fontFamily = FontFamily(Font(R.font.nunito_extrabold_italic)), + fontSize = 34.sp, + modifier = Modifier + .fillMaxWidth() + .padding(top = 10.dp), + textAlign = TextAlign.Center, + ) + val product = getProductById(id) + + val picture = remember { mutableStateOf(TextFieldValue(product.picture)) } + val title = remember { mutableStateOf(TextFieldValue(product.title)) } + val price = remember { mutableStateOf(TextFieldValue(product.price.toString())) } + + Card( + shape = RoundedCornerShape(20.dp), + border = BorderStroke(3.dp, Color(222,161,69)), + modifier = Modifier + .padding(top = 15.dp, start = 5.dp, end = 5.dp) + ){ + Column ( + modifier = Modifier.background(Color.White) + ) { + OutlinedTextField( + value = picture.value, + onValueChange = {picture.value = it}, + placeholder = { Text(text = "Фото", fontSize = 20.sp, color = Color.LightGray) }, + singleLine = true, + + shape = RoundedCornerShape(20.dp), + textStyle = TextStyle(fontSize = 20.sp), + colors = TextFieldDefaults.outlinedTextFieldColors( + textColor = Color.Black, + disabledTextColor = Color.Transparent, + containerColor = Color.White, + focusedBorderColor = Color(222,161,69), + unfocusedBorderColor = Color(222,161,69), + ), + modifier = Modifier + .fillMaxWidth() + .padding(top = 20.dp, start = 20.dp, end = 20.dp), + ) + OutlinedTextField( + value = title.value, + onValueChange = {title.value = it}, + placeholder = { Text(text = "Название", fontSize = 20.sp, color = Color.LightGray) }, + singleLine = true, + + shape = RoundedCornerShape(20.dp), + textStyle = TextStyle(fontSize = 20.sp), + colors = TextFieldDefaults.outlinedTextFieldColors( + textColor = Color.Black, + disabledTextColor = Color.Transparent, + containerColor = Color.White, + focusedBorderColor = Color(222,161,69), + unfocusedBorderColor = Color(222,161,69), + ), + modifier = Modifier + .fillMaxWidth() + .padding(top = 20.dp, start = 20.dp, end = 20.dp), + ) + Card( + shape = RoundedCornerShape(20.dp), + border = BorderStroke(1.dp, Color(222,161,69)), + modifier = Modifier.fillMaxWidth().padding(top = 20.dp, start = 20.dp, end = 20.dp), + ){ + val dataList = getCategories().map { it.title } + var expanded by remember { mutableStateOf(false) } + var selectedItem by remember { mutableStateOf(getCategoryById(product.category)) } + MaterialTheme( + colorScheme = lightColorScheme( + surfaceVariant= Color.White, + surface = Color.White, + onSurface = Color.Gray + ) + ){ + ExposedDropdownMenuBox( + expanded = expanded, + onExpandedChange = { + expanded = !expanded + }, + ) { + TextField( + modifier = Modifier + .menuAnchor().fillMaxWidth(), + readOnly = true, + value = selectedItem, + onValueChange = {}, + label = { Text("Категория") }, + trailingIcon = { ExposedDropdownMenuDefaults.TrailingIcon(expanded = expanded) }, + ) + + ExposedDropdownMenu( + expanded = expanded, + onDismissRequest = { + expanded = false + }, + ) { + dataList.forEach { selectionOption -> + DropdownMenuItem( + text = { Text(selectionOption) }, + onClick = { + selectedItem = selectionOption + expanded = false + }, + contentPadding = ExposedDropdownMenuDefaults.ItemContentPadding, + ) + } + } + } + } + } + OutlinedTextField( + value = price.value, + onValueChange = {price.value = it}, + placeholder = { Text(text = "Цена", fontSize = 20.sp, color = Color.LightGray) }, + singleLine = true, + + shape = RoundedCornerShape(20.dp), + textStyle = TextStyle(fontSize = 20.sp), + colors = TextFieldDefaults.outlinedTextFieldColors( + textColor = Color.Black, + disabledTextColor = Color.Transparent, + containerColor = Color.White, + focusedBorderColor = Color(222,161,69), + unfocusedBorderColor = Color(222,161,69), + ), + modifier = Modifier + .fillMaxWidth() + .padding(top = 20.dp, start = 20.dp, end = 20.dp), + ) + + OutlinedButton( + onClick = { + /*TODO*/ + }, + border = BorderStroke(4.dp, Color(222,161,69)), + shape = RoundedCornerShape(20.dp), + colors = ButtonDefaults.outlinedButtonColors(Color(255,186,83)), + modifier = Modifier + .fillMaxWidth() + .padding(20.dp), + ) { + Text( + text = "Сохранить", + fontFamily = FontFamily(Font(R.font.nunito_extrabold_italic)), + fontSize = 30.sp, + color = Color.White + ) + } + } + } + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/example/mobileapp/screens/ManagmentScreen.kt b/app/src/main/java/com/example/mobileapp/screens/ManagmentScreen.kt new file mode 100644 index 0000000..9c59938 --- /dev/null +++ b/app/src/main/java/com/example/mobileapp/screens/ManagmentScreen.kt @@ -0,0 +1,158 @@ +package com.example.mobileapp.screens + +import androidx.compose.foundation.BorderStroke +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.fillMaxHeight +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.size +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.material3.ButtonDefaults +import androidx.compose.material3.Icon +import androidx.compose.material3.OutlinedButton +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.res.painterResource +import androidx.compose.ui.text.font.Font +import androidx.compose.ui.text.font.FontFamily +import androidx.compose.ui.text.style.TextAlign +import androidx.compose.ui.unit.dp +import androidx.compose.ui.unit.sp +import androidx.navigation.NavController +import com.example.mobileapp.R +import com.example.mobileapp.navigation.Screens +import com.example.mobileapp.widgets.Header + +@Composable +fun ManagmentScreen(navController: NavController){ + Column ( + modifier = Modifier.fillMaxSize(), + horizontalAlignment = Alignment.CenterHorizontally, + ) { + Header(Color(212, 206, 203)) + ManagmentCard(navController) + } +} + +@Composable +fun ManagmentCard(navController: NavController){ + Column( + modifier = Modifier + .fillMaxSize() + .background(Color(212, 206, 203)), + horizontalAlignment = Alignment.CenterHorizontally, + + ) { + Column( + modifier = Modifier + .fillMaxHeight() + .fillMaxWidth(0.9f) + .background(Color.White), + + horizontalAlignment = Alignment.CenterHorizontally, + ) { + Text( + text = "Блюда", + color = Color.Black, + fontFamily = FontFamily(Font(R.font.nunito_extrabold_italic)), + fontSize = 34.sp, + modifier = Modifier + .fillMaxWidth() + .padding(top = 10.dp), + textAlign = TextAlign.Center, + ) + Row( + horizontalArrangement = Arrangement.spacedBy(5.dp), + modifier = Modifier.padding(top = 10.dp), + ){ + OutlinedButton( + onClick = { + navController.navigate(Screens.CreateProductScreen.name) { + popUpTo(navController.graph.startDestinationId) + launchSingleTop = true + } + }, + border = BorderStroke(4.dp, Color(222,161,69)), + shape = RoundedCornerShape(20.dp), + colors = ButtonDefaults.outlinedButtonColors(Color(255,186,83)), + + ){ + Icon( + painterResource(id = R.drawable.icon_add), + contentDescription = null, + Modifier.size(50.dp), + tint = Color.Black + ) + } + + OutlinedButton( + onClick = { + navController.navigate(Screens.EditMenuScreen.name) { + popUpTo(navController.graph.startDestinationId) + launchSingleTop = true + } + }, + border = BorderStroke(4.dp, Color(222,161,69)), + shape = RoundedCornerShape(20.dp), + colors = ButtonDefaults.outlinedButtonColors(Color(255,186,83)), + + ){ + Icon( + painterResource(id = R.drawable.icon_settings), + contentDescription = null, + Modifier.size(50.dp), + tint = Color.Black + ) + } + } + Text( + text = "Пользователи", + color = Color.Black, + fontFamily = FontFamily(Font(R.font.nunito_extrabold_italic)), + fontSize = 34.sp, + modifier = Modifier + .fillMaxWidth() + .padding(top = 10.dp), + textAlign = TextAlign.Center, + ) + OutlinedButton( + onClick = { + navController.navigate(Screens.UsersScreen.name) { + popUpTo(navController.graph.startDestinationId) + launchSingleTop = true + } + }, + border = BorderStroke(4.dp, Color(222,161,69)), + shape = RoundedCornerShape(20.dp), + colors = ButtonDefaults.outlinedButtonColors(Color(255,186,83)), + modifier = Modifier.padding(top = 10.dp) + ){ + Icon( + painterResource(id = R.drawable.icon_profile), + contentDescription = null, + Modifier.size(50.dp), + tint = Color.Black + ) + Icon( + painterResource(id = R.drawable.icon_order), + contentDescription = null, + Modifier.size(50.dp), + tint = Color.Black + ) + Icon( + painterResource(id = R.drawable.icon_managment), + contentDescription = null, + Modifier.size(50.dp), + tint = Color.Black + ) + } + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/example/mobileapp/screens/MenuScreen.kt b/app/src/main/java/com/example/mobileapp/screens/MenuScreen.kt new file mode 100644 index 0000000..5360f24 --- /dev/null +++ b/app/src/main/java/com/example/mobileapp/screens/MenuScreen.kt @@ -0,0 +1,171 @@ +package com.example.mobileapp.screens + +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.Column +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.fillMaxHeight +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.size +import androidx.compose.foundation.lazy.LazyColumn +import androidx.compose.foundation.lazy.items +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.material3.ButtonDefaults +import androidx.compose.material3.Card +import androidx.compose.material3.OutlinedButton +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.res.painterResource +import androidx.compose.ui.text.font.Font +import androidx.compose.ui.text.font.FontFamily +import androidx.compose.ui.text.style.TextAlign +import androidx.compose.ui.unit.dp +import androidx.compose.ui.unit.sp +import com.example.mobileapp.R +import com.example.mobileapp.models.getCategories +import com.example.mobileapp.models.getProductsByCategoryId +import com.example.mobileapp.widgets.Header + +@Composable +fun MenuScreen(){ + Column ( + modifier = Modifier.fillMaxSize(), + horizontalAlignment = Alignment.CenterHorizontally, + ) { + Header(Color(212, 206, 203)) + MenuCard() + } +} + +@Composable +fun MenuCard(){ + Column( + modifier = Modifier + .fillMaxSize() + .background(Color(212, 206, 203)), + horizontalAlignment = Alignment.CenterHorizontally, + + ) { + Column( + modifier = Modifier + .fillMaxHeight() + .fillMaxWidth(0.9f) + .background(Color.White), + + horizontalAlignment = Alignment.CenterHorizontally, + ) { + val categories = getCategories() + LazyColumn( + modifier = Modifier + .fillMaxSize() + ) { + items(categories){ category -> + Text( + text = category.title, + color = Color.Black, + fontFamily = FontFamily(Font(R.font.nunito_extrabold_italic)), + fontSize = 34.sp, + modifier = Modifier + .fillMaxWidth() + .padding(top = 10.dp), + textAlign = TextAlign.Center, + ) + + val products = getProductsByCategoryId(category.id) + + products.forEach{ product -> + Card( + shape = RoundedCornerShape(20.dp), + border = BorderStroke(3.dp, Color(222,161,69)), + modifier = Modifier + .fillMaxSize() + .padding(top = 15.dp, start = 5.dp, end = 5.dp) + ){ + Row( + modifier = Modifier + .fillMaxSize() + .background(Color.White), + verticalAlignment = Alignment.CenterVertically, + horizontalArrangement = Arrangement.SpaceEvenly, + ){ + if (product.picture == "Бургер"){ + Image( + painterResource( + id = R.drawable.burger + ), + contentDescription = null, + modifier = Modifier + .size(100.dp, 100.dp) + .padding(5.dp), + ) + } + if (product.picture == "Картошка"){ + Image( + painterResource( + id = R.drawable.potato + ), + contentDescription = null, + modifier = Modifier + .size(100.dp, 100.dp) + .padding(5.dp), + ) + } + if (product.picture == "Пепси"){ + Image( + painterResource( + id = R.drawable.pepsi + ), + contentDescription = null, + modifier = Modifier + .size(100.dp, 100.dp) + .padding(5.dp), + ) + } + + Column ( + horizontalAlignment = Alignment.CenterHorizontally, + verticalArrangement = Arrangement.SpaceAround + ) { + Text( + text = product.title, + color = Color.Black, + fontFamily = FontFamily(Font(R.font.nunito_extrabold_italic)), + fontSize = 17.sp, + textAlign = TextAlign.Center, + ) + Row( + verticalAlignment = Alignment.CenterVertically, + horizontalArrangement = Arrangement.spacedBy(10.dp), + ){ + Text( + text = product.price.toString() + " р.", + color = Color.Black, + fontFamily = FontFamily(Font(R.font.nunito_extrabold_italic)), + fontSize = 17.sp, + textAlign = TextAlign.Center, + ) + OutlinedButton( + onClick = {/*TODO*/}, + border = BorderStroke(4.dp, Color(222,161,69)), + shape = RoundedCornerShape(30.dp), + colors = ButtonDefaults.outlinedButtonColors(Color(255,186,83)), + ) { + Text(text = "+", fontSize = 20.sp, color = Color.Black) + } + } + } + } + } + } + } + } + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/example/mobileapp/screens/OrderScreen.kt b/app/src/main/java/com/example/mobileapp/screens/OrderScreen.kt new file mode 100644 index 0000000..c322761 --- /dev/null +++ b/app/src/main/java/com/example/mobileapp/screens/OrderScreen.kt @@ -0,0 +1,159 @@ +package com.example.mobileapp.screens + +import androidx.compose.foundation.BorderStroke +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.fillMaxHeight +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.lazy.LazyColumn +import androidx.compose.foundation.lazy.items +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.material3.ButtonDefaults +import androidx.compose.material3.Card +import androidx.compose.material3.OutlinedButton +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.text.font.Font +import androidx.compose.ui.text.font.FontFamily +import androidx.compose.ui.text.style.TextAlign +import androidx.compose.ui.unit.dp +import androidx.compose.ui.unit.sp +import com.example.mobileapp.R +import com.example.mobileapp.models.currentUser +import com.example.mobileapp.models.getOrderProductsByOrderId +import com.example.mobileapp.models.getOrdersByUserId +import com.example.mobileapp.models.getProductById +import com.example.mobileapp.widgets.Header + +@Composable +fun OrderScreen(){ + Column ( + modifier = Modifier.fillMaxSize(), + horizontalAlignment = Alignment.CenterHorizontally, + ) { + Header(Color(212, 206, 203)) + OrderCard() + } +} + +@Composable +fun OrderCard(){ + Column( + modifier = Modifier + .fillMaxSize() + .background(Color(212, 206, 203)), + horizontalAlignment = Alignment.CenterHorizontally, + + ) { + Column( + modifier = Modifier + .fillMaxHeight() + .fillMaxWidth(0.9f) + .background(Color.White), + + horizontalAlignment = Alignment.CenterHorizontally, + ) { + Text( + text = "Заказы", + color = Color.Black, + fontFamily = FontFamily(Font(R.font.nunito_extrabold_italic)), + fontSize = 34.sp, + modifier = Modifier + .fillMaxWidth() + .padding(top = 10.dp), + textAlign = TextAlign.Center, + ) + + val orders = getOrdersByUserId(currentUser().id) + + LazyColumn( + modifier = Modifier + .fillMaxWidth() + ) { + items(orders){ order -> + val orderProducts = getOrderProductsByOrderId(order.id) + Card( + shape = RoundedCornerShape(20.dp), + border = BorderStroke(3.dp, Color(222,161,69)), + modifier = Modifier + .padding(top = 15.dp, start = 5.dp, end = 5.dp) + ){ + Row( + modifier = Modifier + .fillMaxWidth() + .background(Color.White), + verticalAlignment = Alignment.CenterVertically, + horizontalArrangement = Arrangement.SpaceEvenly, + ){ + Text( + text = "№" + order.id.toString(), + color = Color.Black, + fontFamily = FontFamily(Font(R.font.nunito_extrabold_italic)), + fontSize = 34.sp, + textAlign = TextAlign.Center, + ) + + Text( + text = "Статус: " + order.status, + color = Color.Black, + fontFamily = FontFamily(Font(R.font.nunito_extrabold_italic)), + fontSize = 20.sp, + textAlign = TextAlign.Center, + ) + } + + Row( + modifier = Modifier + .fillMaxWidth() + .background(Color.White), + verticalAlignment = Alignment.CenterVertically, + horizontalArrangement = Arrangement.SpaceAround, + ){ + Column { + orderProducts.forEach{ orderProduct -> + Row( + modifier = Modifier + .background(Color.White), + verticalAlignment = Alignment.CenterVertically, + horizontalArrangement = Arrangement.Center, + ){ + Text( + text = getProductById(orderProduct.productId).title + " x" + orderProduct.amount.toString(), + color = Color.Gray, + fontFamily = FontFamily(Font(R.font.nunito_bold)), + fontSize = 20.sp, + textAlign = TextAlign.Center, + ) + } + } + } + + OutlinedButton( + onClick = { + /*TODO*/ + }, + border = BorderStroke(4.dp, Color(222,161,69)), + shape = RoundedCornerShape(20.dp), + colors = ButtonDefaults.outlinedButtonColors(Color(255,186,83)), + ) { + Text( + text = "Готов", + fontFamily = FontFamily(Font(R.font.nunito_extrabold_italic)), + fontSize = 30.sp, + color = Color.White + ) + } + } + } + } + } + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/example/mobileapp/screens/ProfileScreen.kt b/app/src/main/java/com/example/mobileapp/screens/ProfileScreen.kt new file mode 100644 index 0000000..bbe96a9 --- /dev/null +++ b/app/src/main/java/com/example/mobileapp/screens/ProfileScreen.kt @@ -0,0 +1,173 @@ +package com.example.mobileapp.screens + +import androidx.compose.foundation.BorderStroke +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.fillMaxHeight +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.lazy.LazyColumn +import androidx.compose.foundation.lazy.items +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.material3.ButtonDefaults +import androidx.compose.material3.Card +import androidx.compose.material3.OutlinedButton +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.text.font.Font +import androidx.compose.ui.text.font.FontFamily +import androidx.compose.ui.text.style.TextAlign +import androidx.compose.ui.unit.dp +import androidx.compose.ui.unit.sp +import androidx.navigation.NavController +import com.example.mobileapp.R +import com.example.mobileapp.models.currentUser +import com.example.mobileapp.models.getOrderProductsByOrderId +import com.example.mobileapp.models.getOrdersByUserId +import com.example.mobileapp.models.getProductById +import com.example.mobileapp.navigation.Screens +import com.example.mobileapp.widgets.Header + +@Composable +fun ProfileScreen(navController: NavController){ + Column ( + modifier = Modifier.fillMaxSize(), + horizontalAlignment = Alignment.CenterHorizontally, + ) { + Header(Color(212, 206, 203)) + ProfileCard(navController) + } +} + +@Composable +fun ProfileCard(navController: NavController){ + Column( + modifier = Modifier + .fillMaxSize() + .background(Color(212, 206, 203)), + horizontalAlignment = Alignment.CenterHorizontally, + + ) { + Column( + modifier = Modifier + .fillMaxHeight() + .fillMaxWidth(0.9f) + .background(Color.White), + + horizontalAlignment = Alignment.CenterHorizontally, + ) { + OutlinedButton( + modifier = Modifier + .fillMaxWidth() + .padding(top = 15.dp, start = 5.dp, end = 5.dp), + onClick = { + navController.navigate(Screens.AuthorizationScreen.name) { + popUpTo(navController.graph.startDestinationId) + launchSingleTop = true + } + }, + border = BorderStroke(4.dp, Color(255,86,86)), + shape = RoundedCornerShape(20.dp), + colors = ButtonDefaults.outlinedButtonColors(Color(255,86,86)), + ) { + Text( + text = "Выйти из аккаунта", + fontFamily = FontFamily(Font(R.font.nunito_extrabold_italic)), + fontSize = 30.sp, + color = Color.White + ) + } + + Text( + text = "Активные заказы", + color = Color.Black, + fontFamily = FontFamily(Font(R.font.nunito_extrabold_italic)), + fontSize = 34.sp, + modifier = Modifier + .fillMaxWidth() + .padding(top = 10.dp), + textAlign = TextAlign.Center, + ) + + val orders = getOrdersByUserId(currentUser().id) + + LazyColumn( + modifier = Modifier + .fillMaxWidth() + ) { + items(orders){ order -> + val orderProducts = getOrderProductsByOrderId(order.id) + Card( + shape = RoundedCornerShape(20.dp), + border = BorderStroke(3.dp, Color(222,161,69)), + modifier = Modifier + .padding(top = 15.dp, start = 5.dp, end = 5.dp) + ){ + Row( + modifier = Modifier + .fillMaxWidth() + .background(Color.White), + verticalAlignment = Alignment.CenterVertically, + horizontalArrangement = Arrangement.SpaceEvenly, + ){ + Text( + text = "№" + order.id.toString(), + color = Color.Black, + fontFamily = FontFamily(Font(R.font.nunito_extrabold_italic)), + fontSize = 34.sp, + textAlign = TextAlign.Center, + ) + + Text( + text = "Статус: " + order.status, + color = Color.Black, + fontFamily = FontFamily(Font(R.font.nunito_extrabold_italic)), + fontSize = 20.sp, + textAlign = TextAlign.Center, + ) + } + orderProducts.forEach{ orderProduct -> + Row( + modifier = Modifier + .fillMaxWidth() + .background(Color.White), + verticalAlignment = Alignment.CenterVertically, + horizontalArrangement = Arrangement.Center, + ){ + Text( + text = getProductById(orderProduct.productId).title + " " + getProductById(orderProduct.productId).price.toString() + "р. x" + orderProduct.amount.toString(), + color = Color.Gray, + fontFamily = FontFamily(Font(R.font.nunito_bold)), + fontSize = 20.sp, + textAlign = TextAlign.Center, + ) + } + } + Row( + modifier = Modifier + .fillMaxWidth() + .background(Color.White), + verticalAlignment = Alignment.CenterVertically, + horizontalArrangement = Arrangement.Start, + ){ + Text( + text = "К оплате: " + order.price.toString() + " р.", + modifier = Modifier.padding(start = 20.dp), + color = Color.Black, + fontFamily = FontFamily(Font(R.font.nunito_extrabold_italic)), + fontSize = 20.sp, + textAlign = TextAlign.Center, + ) + } + } + } + } + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/example/mobileapp/screens/RegistrationScreen.kt b/app/src/main/java/com/example/mobileapp/screens/RegistrationScreen.kt new file mode 100644 index 0000000..70c947e --- /dev/null +++ b/app/src/main/java/com/example/mobileapp/screens/RegistrationScreen.kt @@ -0,0 +1,193 @@ +package com.example.mobileapp.screens + +import androidx.compose.foundation.BorderStroke +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.material3.Button +import androidx.compose.material3.ButtonDefaults +import androidx.compose.material3.Card +import androidx.compose.material3.ExperimentalMaterial3Api +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.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.text.TextStyle +import androidx.compose.ui.text.font.Font +import androidx.compose.ui.text.font.FontFamily +import androidx.compose.ui.text.input.TextFieldValue +import androidx.compose.ui.text.style.TextAlign +import androidx.compose.ui.unit.dp +import androidx.compose.ui.unit.sp +import androidx.navigation.NavController +import com.example.mobileapp.R +import com.example.mobileapp.navigation.Screens +import com.example.mobileapp.widgets.Header + +@Composable +fun RegistrationScreen(navController: NavController) { + Column ( + modifier = Modifier.fillMaxSize(), + horizontalAlignment = Alignment.CenterHorizontally, + ) { + Header(Color.White) + RegistrationCard(navController) + } +} + +@OptIn(ExperimentalMaterial3Api::class) +@Composable +fun RegistrationCard(navController: NavController){ + val login = remember { mutableStateOf(TextFieldValue("")) } + val password = remember { mutableStateOf(TextFieldValue("")) } + val passwordRepeat = remember { mutableStateOf(TextFieldValue("")) } + + Column( + horizontalAlignment = Alignment.CenterHorizontally, + ) { + Card( + shape = RoundedCornerShape(30.dp), + modifier = Modifier.padding(top = 30.dp) + ) { + + Column ( + horizontalAlignment = Alignment.CenterHorizontally, + modifier = Modifier + .background(Color(212, 206, 203)) + .fillMaxWidth(0.9f) + ) { + Card( + shape = RoundedCornerShape(90.dp, 90.dp, 30.dp, 30.dp), + border = BorderStroke(4.dp, Color(222,161,69)), + modifier = Modifier + .fillMaxWidth() + .padding(top = 30.dp, start = 20.dp, end = 20.dp) + ){ + Text( + text = "Регистрация", + color = Color.White, + fontFamily = FontFamily(Font(R.font.nunito_bold)), + fontSize = 30.sp, + modifier = Modifier + .fillMaxWidth() + .background(Color(255, 186, 83)) + .padding(top = 20.dp, bottom = 20.dp), + textAlign = TextAlign.Center, + ) + } + + OutlinedTextField( + value = login.value, + onValueChange = {login.value = it}, + placeholder = { Text(text = "Логин", fontSize = 20.sp, color = Color.LightGray) }, + singleLine = true, + + shape = RoundedCornerShape(30.dp, 30.dp, 30.dp, 30.dp), + textStyle = TextStyle(fontSize = 20.sp), + colors = TextFieldDefaults.outlinedTextFieldColors( + textColor = Color.Black, + disabledTextColor = Color.Transparent, + containerColor = Color.White, + focusedBorderColor = Color.Yellow, + unfocusedBorderColor = Color.Yellow, + ), + modifier = Modifier + .fillMaxWidth() + .padding(top = 20.dp, start = 20.dp, end = 20.dp), + ) + + OutlinedTextField( + value = password.value, + onValueChange = {password.value = it}, + placeholder = { Text(text = "Пароль", fontSize = 20.sp, color = Color.LightGray) }, + singleLine = true, + + shape = RoundedCornerShape(30.dp, 30.dp, 30.dp, 30.dp), + textStyle = TextStyle(fontSize = 20.sp), + colors = TextFieldDefaults.outlinedTextFieldColors( + textColor = Color.Black, + disabledTextColor = Color.Transparent, + containerColor = Color.White, + focusedBorderColor = Color(183,97,48), + unfocusedBorderColor = Color(183,97,48), + ), + modifier = Modifier + .fillMaxWidth() + .padding(top = 20.dp, start = 20.dp, end = 20.dp), + ) + + OutlinedTextField( + value = passwordRepeat.value, + onValueChange = {passwordRepeat.value = it}, + placeholder = { Text(text = "Логин повторно", fontSize = 20.sp, color = Color.LightGray) }, + singleLine = true, + + shape = RoundedCornerShape(30.dp, 30.dp, 30.dp, 30.dp), + textStyle = TextStyle(fontSize = 20.sp), + colors = TextFieldDefaults.outlinedTextFieldColors( + textColor = Color.Black, + disabledTextColor = Color.Transparent, + containerColor = Color.White, + focusedBorderColor = Color.Red, + unfocusedBorderColor = Color.Red, + ), + modifier = Modifier + .fillMaxWidth() + .padding(top = 20.dp, start = 20.dp, end = 20.dp), + ) + + Button( + onClick = { + navController.navigate(Screens.MenuScreen.name) { + popUpTo(navController.graph.startDestinationId) + launchSingleTop = true + } + }, + colors = ButtonDefaults.buttonColors(Color(255,186,83), Color.White), + shape = RoundedCornerShape(30.dp, 30.dp, 30.dp, 30.dp), + border = BorderStroke(4.dp, Color(222,161,69)), + modifier = Modifier + .fillMaxWidth() + .padding(top = 20.dp, start = 20.dp, end = 20.dp) + ) { + Text( + text = "Продолжить", + color = Color.White, + fontFamily = FontFamily(Font(R.font.nunito_bold)), + fontSize = 30.sp, + textAlign = TextAlign.Center, + ) + } + + Button( + onClick = { + navController.navigate(Screens.AuthorizationScreen.name) { + popUpTo(navController.graph.startDestinationId) + launchSingleTop = true + } + }, + colors = ButtonDefaults.buttonColors(Color(212,206,203)), + modifier = Modifier + .fillMaxWidth() + .padding(top = 10.dp, start = 20.dp, end = 20.dp) + ) { + Text( + text = "Есть аккаунт", + color = Color.White, + fontFamily = FontFamily(Font(R.font.nunito_bold)), + fontSize = 20.sp, + textAlign = TextAlign.Center, + ) + } + } + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/example/mobileapp/screens/UsersScreen.kt b/app/src/main/java/com/example/mobileapp/screens/UsersScreen.kt new file mode 100644 index 0000000..f2dae83 --- /dev/null +++ b/app/src/main/java/com/example/mobileapp/screens/UsersScreen.kt @@ -0,0 +1,213 @@ +package com.example.mobileapp.screens + +import androidx.compose.foundation.BorderStroke +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.fillMaxHeight +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.size +import androidx.compose.foundation.lazy.LazyColumn +import androidx.compose.foundation.lazy.items +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.material3.ButtonDefaults +import androidx.compose.material3.Card +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.OutlinedButton +import androidx.compose.material3.OutlinedTextField +import androidx.compose.material3.Text +import androidx.compose.material3.TextField +import androidx.compose.material3.TextFieldDefaults +import androidx.compose.material3.lightColorScheme +import androidx.compose.runtime.Composable +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember +import androidx.compose.runtime.setValue +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.res.painterResource +import androidx.compose.ui.text.TextStyle +import androidx.compose.ui.text.font.Font +import androidx.compose.ui.text.font.FontFamily +import androidx.compose.ui.text.input.TextFieldValue +import androidx.compose.ui.text.style.TextAlign +import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.dp +import androidx.compose.ui.unit.sp +import com.example.mobileapp.R +import com.example.mobileapp.models.currentUser +import com.example.mobileapp.models.getAllUsers +import com.example.mobileapp.models.getCategories +import com.example.mobileapp.models.getRoleById +import com.example.mobileapp.models.getRoles +import com.example.mobileapp.widgets.Header + +@Composable +fun UsersScreen() { + Column ( + modifier = Modifier.fillMaxSize(), + horizontalAlignment = Alignment.CenterHorizontally, + ) { + Header(Color(212, 206, 203)) + UsersCard() + } +} + +@Preview +@OptIn(ExperimentalMaterial3Api::class) +@Composable +fun UsersCard(){ + Column( + modifier = Modifier + .fillMaxSize() + .background(Color(212, 206, 203)), + horizontalAlignment = Alignment.CenterHorizontally, + + ) { + Column( + modifier = Modifier + .fillMaxHeight() + .fillMaxWidth(0.9f) + .background(Color.White), + + horizontalAlignment = Alignment.CenterHorizontally, + ) { + Text( + text = "Редактирование пользователей", + color = Color.Black, + fontFamily = FontFamily(Font(R.font.nunito_extrabold_italic)), + fontSize = 34.sp, + modifier = Modifier + .fillMaxWidth() + .padding(top = 10.dp), + textAlign = TextAlign.Center, + ) + val users = getAllUsers() + LazyColumn( + modifier = Modifier + .fillMaxSize() + ) { + items(users){ user -> + Card( + shape = RoundedCornerShape(20.dp), + border = BorderStroke(3.dp, Color(222,161,69)), + modifier = Modifier + .fillMaxSize() + .padding(top = 15.dp, start = 5.dp, end = 5.dp) + ){ + Row( + modifier = Modifier + .fillMaxSize() + .background(Color.White), + verticalAlignment = Alignment.CenterVertically, + horizontalArrangement = Arrangement.SpaceEvenly, + ){ + Column ( + horizontalAlignment = Alignment.CenterHorizontally, + verticalArrangement = Arrangement.SpaceAround, + modifier = Modifier.fillMaxWidth(0.4f) + ) { + Text( + text = "Логин: " + user.login, + color = Color.Black, + fontFamily = FontFamily(Font(R.font.nunito_extrabold_italic)), + fontSize = 17.sp, + textAlign = TextAlign.Center, + modifier = Modifier.padding(top = 5.dp) + ) + Card( + shape = RoundedCornerShape(20.dp), + border = BorderStroke(1.dp, Color(222,161,69)), + modifier = Modifier.fillMaxWidth().padding(bottom = 10.dp), + ){ + val dataList = getRoles().map { it.title } + var expanded by remember { mutableStateOf(false) } + var selectedItem by remember { mutableStateOf (dataList[0]) } + MaterialTheme( + colorScheme = lightColorScheme( + surfaceVariant= Color.White, + surface = Color.White, + onSurface = Color.Gray + ) + ){ + ExposedDropdownMenuBox( + expanded = expanded, + onExpandedChange = { + expanded = !expanded + }, + ) { + TextField( + modifier = Modifier + .menuAnchor().fillMaxWidth(), + readOnly = true, + value = selectedItem, + onValueChange = {}, + trailingIcon = { ExposedDropdownMenuDefaults.TrailingIcon(expanded = expanded) }, + ) + + ExposedDropdownMenu( + expanded = expanded, + onDismissRequest = { + expanded = false + }, + ) { + dataList.forEach { selectionOption -> + DropdownMenuItem( + text = { Text(selectionOption) }, + onClick = { + selectedItem = selectionOption + expanded = false + }, + contentPadding = ExposedDropdownMenuDefaults.ItemContentPadding, + ) + } + } + } + } + } + } + OutlinedButton( + onClick = { /*TODO*/}, + border = BorderStroke(4.dp, Color(222,161,69)), + shape = RoundedCornerShape(10.dp), + colors = ButtonDefaults.outlinedButtonColors(Color(255,186,83)), + + ){ + Icon( + painterResource(id = R.drawable.icon_settings), + contentDescription = null, + Modifier.size(30.dp), + tint = Color.Black + ) + } + OutlinedButton( + onClick = { /*TODO*/}, + border = BorderStroke(4.dp, Color(222,161,69)), + shape = RoundedCornerShape(10.dp), + colors = ButtonDefaults.outlinedButtonColors(Color(255,186,83)), + + ){ + Icon( + painterResource(id = R.drawable.icon_trash), + contentDescription = null, + Modifier.size(30.dp), + tint = Color.Black + ) + } + } + } + } + } + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/example/mobileapp/ui/theme/Color.kt b/app/src/main/java/com/example/mobileapp/ui/theme/Color.kt new file mode 100644 index 0000000..c414575 --- /dev/null +++ b/app/src/main/java/com/example/mobileapp/ui/theme/Color.kt @@ -0,0 +1,11 @@ +package com.example.mobileapp.ui.theme + +import androidx.compose.ui.graphics.Color + +val Purple80 = Color(0xFFD0BCFF) +val PurpleGrey80 = Color(0xFFCCC2DC) +val Pink80 = Color(0xFFEFB8C8) + +val Purple40 = Color(0xFF6650a4) +val PurpleGrey40 = Color(0xFF625b71) +val Pink40 = Color(0xFF7D5260) \ No newline at end of file diff --git a/app/src/main/java/com/example/mobileapp/ui/theme/Theme.kt b/app/src/main/java/com/example/mobileapp/ui/theme/Theme.kt new file mode 100644 index 0000000..d2edb8f --- /dev/null +++ b/app/src/main/java/com/example/mobileapp/ui/theme/Theme.kt @@ -0,0 +1,70 @@ +package com.example.mobileapp.ui.theme + +import android.app.Activity +import android.os.Build +import androidx.compose.foundation.isSystemInDarkTheme +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.darkColorScheme +import androidx.compose.material3.dynamicDarkColorScheme +import androidx.compose.material3.dynamicLightColorScheme +import androidx.compose.material3.lightColorScheme +import androidx.compose.runtime.Composable +import androidx.compose.runtime.SideEffect +import androidx.compose.ui.graphics.toArgb +import androidx.compose.ui.platform.LocalContext +import androidx.compose.ui.platform.LocalView +import androidx.core.view.WindowCompat + +private val DarkColorScheme = darkColorScheme( + primary = Purple80, + secondary = PurpleGrey80, + tertiary = Pink80 +) + +private val LightColorScheme = lightColorScheme( + primary = Purple40, + secondary = PurpleGrey40, + tertiary = Pink40 + + /* Other default colors to override + background = Color(0xFFFFFBFE), + surface = Color(0xFFFFFBFE), + onPrimary = Color.White, + onSecondary = Color.White, + onTertiary = Color.White, + onBackground = Color(0xFF1C1B1F), + onSurface = Color(0xFF1C1B1F), + */ +) + +@Composable +fun MobileAppTheme( + darkTheme: Boolean = isSystemInDarkTheme(), + // Dynamic color is available on Android 12+ + dynamicColor: Boolean = true, + content: @Composable () -> Unit +) { + val colorScheme = when { + dynamicColor && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> { + val context = LocalContext.current + if (darkTheme) dynamicDarkColorScheme(context) else dynamicLightColorScheme(context) + } + + darkTheme -> DarkColorScheme + else -> LightColorScheme + } + val view = LocalView.current + if (!view.isInEditMode) { + SideEffect { + val window = (view.context as Activity).window + window.statusBarColor = colorScheme.primary.toArgb() + WindowCompat.getInsetsController(window, view).isAppearanceLightStatusBars = darkTheme + } + } + + MaterialTheme( + colorScheme = colorScheme, + typography = Typography, + content = content + ) +} \ No newline at end of file diff --git a/app/src/main/java/com/example/mobileapp/ui/theme/Type.kt b/app/src/main/java/com/example/mobileapp/ui/theme/Type.kt new file mode 100644 index 0000000..03e1cb3 --- /dev/null +++ b/app/src/main/java/com/example/mobileapp/ui/theme/Type.kt @@ -0,0 +1,34 @@ +package com.example.mobileapp.ui.theme + +import androidx.compose.material3.Typography +import androidx.compose.ui.text.TextStyle +import androidx.compose.ui.text.font.FontFamily +import androidx.compose.ui.text.font.FontWeight +import androidx.compose.ui.unit.sp + +// Set of Material typography styles to start with +val Typography = Typography( + bodyLarge = TextStyle( + fontFamily = FontFamily.Default, + fontWeight = FontWeight.Normal, + fontSize = 16.sp, + lineHeight = 24.sp, + letterSpacing = 0.5.sp + ) + /* Other default text styles to override + titleLarge = TextStyle( + fontFamily = FontFamily.Default, + fontWeight = FontWeight.Normal, + fontSize = 22.sp, + lineHeight = 28.sp, + letterSpacing = 0.sp + ), + labelSmall = TextStyle( + fontFamily = FontFamily.Default, + fontWeight = FontWeight.Medium, + fontSize = 11.sp, + lineHeight = 16.sp, + letterSpacing = 0.5.sp + ) + */ +) \ No newline at end of file diff --git a/app/src/main/java/com/example/mobileapp/widgets/header.kt b/app/src/main/java/com/example/mobileapp/widgets/header.kt new file mode 100644 index 0000000..fcbe991 --- /dev/null +++ b/app/src/main/java/com/example/mobileapp/widgets/header.kt @@ -0,0 +1,77 @@ +package com.example.mobileapp.widgets + +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.Column +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.size +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.material3.Card +import androidx.compose.material3.CardDefaults +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.res.painterResource +import androidx.compose.ui.text.font.Font +import androidx.compose.ui.text.font.FontFamily +import androidx.compose.ui.text.style.TextAlign +import androidx.compose.ui.unit.dp +import androidx.compose.ui.unit.sp +import com.example.mobileapp.R + + +@Composable +fun Header(backColor: Color){ + Column { + Card( + shape = RoundedCornerShape(bottomStart = 30.dp, bottomEnd = 30.dp), + border = BorderStroke(4.dp, Color(222,161,69)), + modifier = Modifier + .fillMaxWidth() + .background(backColor), + colors = CardDefaults.cardColors( + containerColor = Color(255, 186, 83) + ) + ) { + Row ( + verticalAlignment = Alignment.CenterVertically, + modifier = Modifier + .fillMaxWidth(), + horizontalArrangement = Arrangement.Center, + ) { + Text( + text = "Вкусно", + color = Color.Black, + fontFamily = FontFamily(Font(R.font.nunito_extrabold_italic)), + fontSize = 34.sp, + modifier = Modifier + .padding(top = 20.dp, bottom = 20.dp), + textAlign = TextAlign.Center, + ) + Image( + painterResource( + id = R.drawable.icon + ), + contentDescription = "Logo", + modifier = Modifier + .size(60.dp, 60.dp), + ) + Text( + text = "ладно", + color = Color.Black, + fontFamily = FontFamily(Font(R.font.nunito_extrabold_italic)), + fontSize = 34.sp, + modifier = Modifier + .padding(top = 20.dp, bottom = 20.dp), + textAlign = TextAlign.Center, + ) + } + } + } +} \ No newline at end of file diff --git a/app/src/main/res/drawable/burger.png b/app/src/main/res/drawable/burger.png new file mode 100644 index 0000000..e1dba6a Binary files /dev/null and b/app/src/main/res/drawable/burger.png differ diff --git a/app/src/main/res/drawable/ic_launcher_background.xml b/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000..07d5da9 --- /dev/null +++ b/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/ic_launcher_foreground.xml b/app/src/main/res/drawable/ic_launcher_foreground.xml new file mode 100644 index 0000000..2b068d1 --- /dev/null +++ b/app/src/main/res/drawable/ic_launcher_foreground.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/icon.png b/app/src/main/res/drawable/icon.png new file mode 100644 index 0000000..4ab8276 Binary files /dev/null and b/app/src/main/res/drawable/icon.png differ diff --git a/app/src/main/res/drawable/icon_add.png b/app/src/main/res/drawable/icon_add.png new file mode 100644 index 0000000..515d45e Binary files /dev/null and b/app/src/main/res/drawable/icon_add.png differ diff --git a/app/src/main/res/drawable/icon_cart.png b/app/src/main/res/drawable/icon_cart.png new file mode 100644 index 0000000..7954e57 Binary files /dev/null and b/app/src/main/res/drawable/icon_cart.png differ diff --git a/app/src/main/res/drawable/icon_managment.png b/app/src/main/res/drawable/icon_managment.png new file mode 100644 index 0000000..cbf1ac2 Binary files /dev/null and b/app/src/main/res/drawable/icon_managment.png differ diff --git a/app/src/main/res/drawable/icon_menu.png b/app/src/main/res/drawable/icon_menu.png new file mode 100644 index 0000000..0c19b29 Binary files /dev/null and b/app/src/main/res/drawable/icon_menu.png differ diff --git a/app/src/main/res/drawable/icon_order.png b/app/src/main/res/drawable/icon_order.png new file mode 100644 index 0000000..9a617f2 Binary files /dev/null and b/app/src/main/res/drawable/icon_order.png differ diff --git a/app/src/main/res/drawable/icon_profile.png b/app/src/main/res/drawable/icon_profile.png new file mode 100644 index 0000000..ca700f9 Binary files /dev/null and b/app/src/main/res/drawable/icon_profile.png differ diff --git a/app/src/main/res/drawable/icon_settings.png b/app/src/main/res/drawable/icon_settings.png new file mode 100644 index 0000000..21dd605 Binary files /dev/null and b/app/src/main/res/drawable/icon_settings.png differ diff --git a/app/src/main/res/drawable/icon_trash.png b/app/src/main/res/drawable/icon_trash.png new file mode 100644 index 0000000..8bb661e Binary files /dev/null and b/app/src/main/res/drawable/icon_trash.png differ diff --git a/app/src/main/res/drawable/pepsi.png b/app/src/main/res/drawable/pepsi.png new file mode 100644 index 0000000..ee035e7 Binary files /dev/null and b/app/src/main/res/drawable/pepsi.png differ diff --git a/app/src/main/res/drawable/potato.png b/app/src/main/res/drawable/potato.png new file mode 100644 index 0000000..50b31ac Binary files /dev/null and b/app/src/main/res/drawable/potato.png differ diff --git a/app/src/main/res/font/nunito_bold.ttf b/app/src/main/res/font/nunito_bold.ttf new file mode 100644 index 0000000..886134d Binary files /dev/null and b/app/src/main/res/font/nunito_bold.ttf differ diff --git a/app/src/main/res/font/nunito_extrabold_italic.ttf b/app/src/main/res/font/nunito_extrabold_italic.ttf new file mode 100644 index 0000000..bffce10 Binary files /dev/null and b/app/src/main/res/font/nunito_extrabold_italic.ttf differ diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 0000000..6f3b755 --- /dev/null +++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml new file mode 100644 index 0000000..6f3b755 --- /dev/null +++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.webp b/app/src/main/res/mipmap-hdpi/ic_launcher.webp new file mode 100644 index 0000000..c209e78 Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher.webp differ diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp new file mode 100644 index 0000000..b2dfe3d Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.webp b/app/src/main/res/mipmap-mdpi/ic_launcher.webp new file mode 100644 index 0000000..4f0f1d6 Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher.webp differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp new file mode 100644 index 0000000..62b611d Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.webp b/app/src/main/res/mipmap-xhdpi/ic_launcher.webp new file mode 100644 index 0000000..948a307 Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher.webp differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp new file mode 100644 index 0000000..1b9a695 Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp b/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp new file mode 100644 index 0000000..28d4b77 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp new file mode 100644 index 0000000..9287f50 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp new file mode 100644 index 0000000..aa7d642 Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp new file mode 100644 index 0000000..9126ae3 Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp differ diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml new file mode 100644 index 0000000..f8c6127 --- /dev/null +++ b/app/src/main/res/values/colors.xml @@ -0,0 +1,10 @@ + + + #FFBB86FC + #FF6200EE + #FF3700B3 + #FF03DAC5 + #FF018786 + #FF000000 + #FFFFFFFF + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml new file mode 100644 index 0000000..11c1d66 --- /dev/null +++ b/app/src/main/res/values/strings.xml @@ -0,0 +1,3 @@ + + MobileApp + \ No newline at end of file diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml new file mode 100644 index 0000000..4785f95 --- /dev/null +++ b/app/src/main/res/values/themes.xml @@ -0,0 +1,5 @@ + + + +