Навел марафету перед четвертой лабой
This commit is contained in:
parent
7872460be3
commit
e839f69d19
@ -73,13 +73,29 @@ abstract class AppDatabase : RoomDatabase() {
|
||||
// OrderProducts
|
||||
val orderProductDao = database.orderProductDao()
|
||||
val op1 = OrderProductModel(1, 1, 2, 200)
|
||||
val op2 = OrderProductModel(2, 4, 3, 150)
|
||||
val op3 = OrderProductModel(3, 3, 1, 80)
|
||||
val op4 = OrderProductModel(4, 2, 1, 120)
|
||||
val op2 = OrderProductModel(1, 4, 3, 150)
|
||||
val op3 = OrderProductModel(1, 3, 1, 80)
|
||||
val op4 = OrderProductModel(2, 1, 2, 200)
|
||||
val op5 = OrderProductModel(2, 4, 3, 150)
|
||||
val op6 = OrderProductModel(2, 3, 1, 80)
|
||||
val op7 = OrderProductModel(3, 1, 2, 200)
|
||||
val op8 = OrderProductModel(3, 4, 3, 150)
|
||||
val op9 = OrderProductModel(3, 3, 1, 80)
|
||||
val op10 = OrderProductModel(4, 1, 2, 200)
|
||||
val op11 = OrderProductModel(4, 4, 3, 150)
|
||||
val op12 = OrderProductModel(4, 3, 1, 80)
|
||||
orderProductDao.insert(op1)
|
||||
orderProductDao.insert(op2)
|
||||
orderProductDao.insert(op3)
|
||||
orderProductDao.insert(op4)
|
||||
orderProductDao.insert(op5)
|
||||
orderProductDao.insert(op6)
|
||||
orderProductDao.insert(op7)
|
||||
orderProductDao.insert(op8)
|
||||
orderProductDao.insert(op9)
|
||||
orderProductDao.insert(op10)
|
||||
orderProductDao.insert(op11)
|
||||
orderProductDao.insert(op12)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7,5 +7,5 @@ data class OrderProductModelWithProduct(
|
||||
@Embedded
|
||||
val orderProductModel: OrderProductModel,
|
||||
@Relation(entity = ProductModel::class, parentColumn = "product_id", entityColumn = "id")
|
||||
val productList: List<ProductModel>
|
||||
val product: ProductModel
|
||||
)
|
||||
|
@ -24,7 +24,9 @@ import androidx.compose.material.Icon
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.runtime.MutableState
|
||||
import androidx.compose.runtime.mutableStateListOf
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
@ -73,12 +75,12 @@ fun CartWidget(){
|
||||
}
|
||||
}
|
||||
|
||||
val unpaidOrders = mutableListOf<OrderWithProducts>()
|
||||
var unpaidOrder: OrderWithProducts? = null
|
||||
val preparingOrders = mutableListOf<OrderWithProducts>()
|
||||
|
||||
for(order in orders) {
|
||||
if (order.order.status == OrderStatus.Неоплачено.toString()) {
|
||||
unpaidOrders.add(order)
|
||||
unpaidOrder = order
|
||||
}
|
||||
if (order.order.status == OrderStatus.Готовится.toString() || order.order.status == OrderStatus.Готово.toString()) {
|
||||
preparingOrders.add(order)
|
||||
@ -132,14 +134,8 @@ fun CartWidget(){
|
||||
modifier = Modifier.padding(top = 15.dp),
|
||||
fontWeight = FontWeight.Bold
|
||||
)
|
||||
LazyColumn(
|
||||
modifier = Modifier
|
||||
.width(340.dp)
|
||||
.height(200.dp)
|
||||
) {
|
||||
items(unpaidOrders.size) {index ->
|
||||
CartItem(unpaidOrders[index])
|
||||
}
|
||||
if (unpaidOrder != null) {
|
||||
CartItem(order = unpaidOrder)
|
||||
}
|
||||
|
||||
Spacer(modifier = Modifier.height(20.dp))
|
||||
@ -176,41 +172,14 @@ fun PaidItem(order : OrderWithProducts) {
|
||||
backgroundColor = Color.White,
|
||||
modifier = Modifier.size(340.dp, 100.dp)
|
||||
) {
|
||||
Column {
|
||||
LazyColumn {
|
||||
items(order.orderWithProducts.size) { index ->
|
||||
if (index == 0) {
|
||||
Row(
|
||||
horizontalArrangement = Arrangement.SpaceBetween,
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = 20.dp)
|
||||
){
|
||||
Text(
|
||||
text = order.orderWithProducts[0].productList[0].title,
|
||||
fontFamily = NunitoFamily,
|
||||
fontSize = 20.sp,
|
||||
modifier = Modifier.padding(top = 15.dp),
|
||||
fontWeight = FontWeight.Bold
|
||||
)
|
||||
Text(
|
||||
text = "x" + order.orderWithProducts[0].orderProductModel.quantity,
|
||||
fontFamily = NunitoFamily,
|
||||
fontSize = 20.sp,
|
||||
modifier = Modifier.padding(top = 15.dp),
|
||||
fontWeight = FontWeight.Bold
|
||||
)
|
||||
Text(
|
||||
text = order.orderWithProducts[0].orderProductModel.totalPrice.toString() + " руб.",
|
||||
fontFamily = NunitoFamily,
|
||||
fontSize = 20.sp,
|
||||
modifier = Modifier.padding(top = 15.dp),
|
||||
fontWeight = FontWeight.Bold
|
||||
)
|
||||
}
|
||||
|
||||
Row(
|
||||
horizontalArrangement = Arrangement.SpaceBetween,
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = 20.dp)
|
||||
.padding(start = 20.dp, end = 20.dp)
|
||||
){
|
||||
Text(
|
||||
text = "Статус: ",
|
||||
@ -230,6 +199,36 @@ fun PaidItem(order : OrderWithProducts) {
|
||||
)
|
||||
}
|
||||
}
|
||||
Row(
|
||||
horizontalArrangement = Arrangement.SpaceBetween,
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = 20.dp)
|
||||
) {
|
||||
Text(
|
||||
text = order.orderWithProducts[index].product.title,
|
||||
fontFamily = NunitoFamily,
|
||||
fontSize = 20.sp,
|
||||
modifier = Modifier.padding(top = 15.dp),
|
||||
fontWeight = FontWeight.Bold
|
||||
)
|
||||
Text(
|
||||
text = "x" + order.orderWithProducts[index].orderProductModel.quantity,
|
||||
fontFamily = NunitoFamily,
|
||||
fontSize = 20.sp,
|
||||
modifier = Modifier.padding(top = 15.dp),
|
||||
fontWeight = FontWeight.Bold
|
||||
)
|
||||
Text(
|
||||
text = order.orderWithProducts[index].orderProductModel.totalPrice.toString() + " руб.",
|
||||
fontFamily = NunitoFamily,
|
||||
fontSize = 20.sp,
|
||||
modifier = Modifier.padding(top = 15.dp),
|
||||
fontWeight = FontWeight.Bold
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Spacer(modifier = Modifier.height(20.dp))
|
||||
}
|
||||
@ -240,15 +239,18 @@ fun CartItem(order : OrderWithProducts) {
|
||||
border = BorderStroke(width = 2.dp, color = MyOrange),
|
||||
shape = RoundedCornerShape(size = 20.dp),
|
||||
backgroundColor = Color.White,
|
||||
modifier = Modifier.size(340.dp, 100.dp)
|
||||
modifier = Modifier.size(340.dp, 180.dp)
|
||||
) {
|
||||
LazyColumn (
|
||||
horizontalAlignment = Alignment.CenterHorizontally
|
||||
) {
|
||||
items(order.orderWithProducts.size) {index ->
|
||||
Row(
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
horizontalArrangement = Arrangement.SpaceBetween,
|
||||
modifier = Modifier.padding(20.dp)
|
||||
modifier = Modifier.padding(20.dp).size(340.dp, 60.dp)
|
||||
) {
|
||||
Column(
|
||||
|
||||
modifier = Modifier.fillMaxWidth(0.5f)
|
||||
) {
|
||||
Row(
|
||||
@ -256,26 +258,25 @@ fun CartItem(order : OrderWithProducts) {
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
) {
|
||||
Text(
|
||||
text = order.orderWithProducts[0].productList[0].title,
|
||||
text = order.orderWithProducts[index].product.title,
|
||||
fontFamily = NunitoFamily,
|
||||
fontSize = 20.sp,
|
||||
fontWeight = FontWeight.Bold
|
||||
)
|
||||
Text(
|
||||
text = "x" + order.orderWithProducts[0].orderProductModel.quantity,
|
||||
text = "x" + order.orderWithProducts[index].orderProductModel.quantity,
|
||||
fontFamily = NunitoFamily,
|
||||
fontSize = 20.sp,
|
||||
fontWeight = FontWeight.Bold
|
||||
)
|
||||
}
|
||||
Text(
|
||||
text = order.orderWithProducts[0].orderProductModel.totalPrice.toString() + " руб.",
|
||||
text = order.orderWithProducts[index].orderProductModel.totalPrice.toString() + " руб.",
|
||||
fontFamily = NunitoFamily,
|
||||
fontSize = 20.sp,
|
||||
fontWeight = FontWeight.Bold
|
||||
)
|
||||
}
|
||||
|
||||
Button(
|
||||
colors = ButtonDefaults.buttonColors(
|
||||
backgroundColor = MyLightRed
|
||||
@ -295,5 +296,7 @@ fun CartItem(order : OrderWithProducts) {
|
||||
|
||||
}
|
||||
}
|
||||
Spacer(modifier = Modifier.height(20.dp))
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -5,6 +5,8 @@ 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.ExperimentalLayoutApi
|
||||
import androidx.compose.foundation.layout.FlowRow
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
@ -180,15 +182,17 @@ fun PreparingItem(order : OrderWithProducts){
|
||||
border = BorderStroke(width = 2.dp, color = MyOrange),
|
||||
shape = RoundedCornerShape(size = 20.dp),
|
||||
backgroundColor = Color.White,
|
||||
modifier = Modifier.size(340.dp, 100.dp)
|
||||
modifier = Modifier.size(340.dp, 200.dp)
|
||||
){
|
||||
Column(
|
||||
|
||||
) {
|
||||
Row(
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
horizontalArrangement = Arrangement.SpaceBetween,
|
||||
modifier = Modifier.padding(20.dp)
|
||||
modifier = Modifier.padding(20.dp).size(340.dp,60.dp)
|
||||
){
|
||||
Column(
|
||||
|
||||
modifier = Modifier.fillMaxWidth(0.5f)
|
||||
){
|
||||
val localDateFormat = SimpleDateFormat("HH:mm")
|
||||
@ -199,34 +203,16 @@ fun PreparingItem(order : OrderWithProducts){
|
||||
fontSize = 20.sp,
|
||||
fontWeight = FontWeight.Bold
|
||||
)
|
||||
Row(
|
||||
horizontalArrangement = Arrangement.SpaceBetween,
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
){
|
||||
Text(
|
||||
text = order.orderWithProducts[0].productList[0].title,
|
||||
fontFamily = NunitoFamily,
|
||||
fontSize = 20.sp,
|
||||
fontWeight = FontWeight.Bold
|
||||
)
|
||||
Text(
|
||||
text = "x" + order.orderWithProducts[0].orderProductModel.quantity,
|
||||
fontFamily = NunitoFamily,
|
||||
fontSize = 20.sp,
|
||||
fontWeight = FontWeight.Bold
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Button(
|
||||
colors = ButtonDefaults.buttonColors(
|
||||
backgroundColor = MyLightYellow
|
||||
),
|
||||
shape = RoundedCornerShape(size = 10.dp),
|
||||
modifier = Modifier
|
||||
.size(100.dp, 60.dp)
|
||||
.fillMaxSize(0.5f),
|
||||
.size(170.dp, 80.dp)
|
||||
.fillMaxSize(),
|
||||
onClick = { /*TODO*/ }
|
||||
) {
|
||||
Text(
|
||||
@ -236,6 +222,33 @@ fun PreparingItem(order : OrderWithProducts){
|
||||
fontWeight = FontWeight.Bold
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
LazyColumn(
|
||||
modifier = Modifier.fillMaxWidth().padding(horizontal = 20.dp)
|
||||
){
|
||||
items(order.orderWithProducts.size) {index ->
|
||||
Row(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
horizontalArrangement = Arrangement.SpaceBetween,
|
||||
|
||||
) {
|
||||
Text(
|
||||
text = order.orderWithProducts[index].product.title,
|
||||
fontFamily = NunitoFamily,
|
||||
fontSize = 20.sp,
|
||||
fontWeight = FontWeight.Bold
|
||||
)
|
||||
Text(
|
||||
text = "x" + order.orderWithProducts[index].orderProductModel.quantity,
|
||||
fontFamily = NunitoFamily,
|
||||
fontSize = 20.sp,
|
||||
fontWeight = FontWeight.Bold
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -248,15 +261,17 @@ fun PreparedItem(order : OrderWithProducts){
|
||||
border = BorderStroke(width = 2.dp, color = MyOrange),
|
||||
shape = RoundedCornerShape(size = 20.dp),
|
||||
backgroundColor = Color.White,
|
||||
modifier = Modifier.size(340.dp, 100.dp)
|
||||
modifier = Modifier.size(340.dp, 200.dp)
|
||||
){
|
||||
Column(
|
||||
|
||||
) {
|
||||
Row(
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
horizontalArrangement = Arrangement.SpaceBetween,
|
||||
modifier = Modifier.padding(20.dp)
|
||||
modifier = Modifier.padding(20.dp).size(340.dp,60.dp)
|
||||
){
|
||||
Column(
|
||||
|
||||
modifier = Modifier.fillMaxWidth(0.5f)
|
||||
){
|
||||
val localDateFormat = SimpleDateFormat("HH:mm")
|
||||
@ -267,34 +282,16 @@ fun PreparedItem(order : OrderWithProducts){
|
||||
fontSize = 20.sp,
|
||||
fontWeight = FontWeight.Bold
|
||||
)
|
||||
Row(
|
||||
horizontalArrangement = Arrangement.SpaceBetween,
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
){
|
||||
Text(
|
||||
text = order.orderWithProducts[0].productList[0].title,
|
||||
fontFamily = NunitoFamily,
|
||||
fontSize = 20.sp,
|
||||
fontWeight = FontWeight.Bold
|
||||
)
|
||||
Text(
|
||||
text = "x" + order.orderWithProducts[0].orderProductModel.quantity,
|
||||
fontFamily = NunitoFamily,
|
||||
fontSize = 20.sp,
|
||||
fontWeight = FontWeight.Bold
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Button(
|
||||
colors = ButtonDefaults.buttonColors(
|
||||
backgroundColor = MyLightYellow
|
||||
),
|
||||
shape = RoundedCornerShape(size = 10.dp),
|
||||
modifier = Modifier
|
||||
.size(100.dp, 60.dp)
|
||||
.fillMaxSize(0.5f),
|
||||
.size(170.dp, 80.dp)
|
||||
.fillMaxSize(),
|
||||
onClick = { /*TODO*/ }
|
||||
) {
|
||||
Text(
|
||||
@ -304,6 +301,33 @@ fun PreparedItem(order : OrderWithProducts){
|
||||
fontWeight = FontWeight.Bold
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
LazyColumn(
|
||||
modifier = Modifier.fillMaxWidth().padding(horizontal = 20.dp)
|
||||
){
|
||||
items(order.orderWithProducts.size) {index ->
|
||||
Row(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
horizontalArrangement = Arrangement.SpaceBetween,
|
||||
|
||||
) {
|
||||
Text(
|
||||
text = order.orderWithProducts[index].product.title,
|
||||
fontFamily = NunitoFamily,
|
||||
fontSize = 20.sp,
|
||||
fontWeight = FontWeight.Bold
|
||||
)
|
||||
Text(
|
||||
text = "x" + order.orderWithProducts[index].orderProductModel.quantity,
|
||||
fontFamily = NunitoFamily,
|
||||
fontSize = 20.sp,
|
||||
fontWeight = FontWeight.Bold
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -316,15 +340,17 @@ fun ProcessedItem(order : OrderWithProducts){
|
||||
border = BorderStroke(width = 2.dp, color = MyOrange),
|
||||
shape = RoundedCornerShape(size = 20.dp),
|
||||
backgroundColor = Color.White,
|
||||
modifier = Modifier.size(340.dp, 100.dp)
|
||||
modifier = Modifier.size(340.dp, 200.dp)
|
||||
){
|
||||
Column(
|
||||
|
||||
) {
|
||||
Row(
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
horizontalArrangement = Arrangement.SpaceBetween,
|
||||
modifier = Modifier.padding(20.dp)
|
||||
modifier = Modifier.padding(20.dp).size(340.dp,60.dp)
|
||||
){
|
||||
Column(
|
||||
|
||||
modifier = Modifier.fillMaxWidth(0.5f)
|
||||
){
|
||||
val localDateFormat = SimpleDateFormat("HH:mm")
|
||||
@ -335,45 +361,47 @@ fun ProcessedItem(order : OrderWithProducts){
|
||||
fontSize = 20.sp,
|
||||
fontWeight = FontWeight.Bold
|
||||
)
|
||||
Row(
|
||||
horizontalArrangement = Arrangement.SpaceBetween,
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
){
|
||||
Text(
|
||||
text = order.orderWithProducts[0].productList[0].title,
|
||||
fontFamily = NunitoFamily,
|
||||
fontSize = 20.sp,
|
||||
fontWeight = FontWeight.Bold
|
||||
)
|
||||
Text(
|
||||
text = "x" + order.orderWithProducts[0].orderProductModel.quantity,
|
||||
fontFamily = NunitoFamily,
|
||||
fontSize = 20.sp,
|
||||
fontWeight = FontWeight.Bold
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Column(
|
||||
|
||||
modifier = Modifier.fillMaxWidth(0.5f)
|
||||
){
|
||||
Text(
|
||||
text = order.orderWithProducts[0].orderProductModel.totalPrice.toString(),
|
||||
text = order.order.date.toString(),
|
||||
fontFamily = NunitoFamily,
|
||||
fontSize = 14.sp,
|
||||
fontSize = 16.sp,
|
||||
fontWeight = FontWeight.Bold
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
LazyColumn(
|
||||
modifier = Modifier.fillMaxWidth().padding(horizontal = 20.dp)
|
||||
){
|
||||
items(order.orderWithProducts.size) {index ->
|
||||
Row(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
horizontalArrangement = Arrangement.SpaceBetween,
|
||||
|
||||
) {
|
||||
Text(
|
||||
text = order.orderWithProducts[index].product.title,
|
||||
fontFamily = NunitoFamily,
|
||||
fontSize = 20.sp,
|
||||
fontWeight = FontWeight.Bold
|
||||
)
|
||||
Text(
|
||||
text = order.order.date.toString(),
|
||||
text = "x" + order.orderWithProducts[index].orderProductModel.quantity,
|
||||
fontFamily = NunitoFamily,
|
||||
fontSize = 14.sp,
|
||||
fontSize = 20.sp,
|
||||
fontWeight = FontWeight.Bold
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Spacer(modifier = Modifier.height(20.dp))
|
||||
}
|
Loading…
Reference in New Issue
Block a user