|
@@ -0,0 +1,284 @@
|
|
|
+package com.example.triphelper.view.RouteScreens
|
|
|
+
|
|
|
+import android.media.audiofx.AudioEffect.Descriptor
|
|
|
+import androidx.compose.foundation.Image
|
|
|
+import androidx.compose.foundation.background
|
|
|
+import androidx.compose.foundation.border
|
|
|
+import androidx.compose.foundation.clickable
|
|
|
+import androidx.compose.foundation.layout.Arrangement
|
|
|
+import androidx.compose.foundation.layout.Box
|
|
|
+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.height
|
|
|
+import androidx.compose.foundation.layout.padding
|
|
|
+import androidx.compose.foundation.layout.size
|
|
|
+import androidx.compose.foundation.layout.width
|
|
|
+import androidx.compose.foundation.layout.wrapContentSize
|
|
|
+import androidx.compose.foundation.lazy.LazyColumn
|
|
|
+import androidx.compose.foundation.lazy.items
|
|
|
+import androidx.compose.foundation.shape.RoundedCornerShape
|
|
|
+import androidx.compose.material3.CircularProgressIndicator
|
|
|
+import androidx.compose.material3.Text
|
|
|
+import androidx.compose.runtime.Composable
|
|
|
+import androidx.compose.runtime.LaunchedEffect
|
|
|
+import androidx.compose.runtime.MutableState
|
|
|
+import androidx.compose.runtime.collectAsState
|
|
|
+import androidx.compose.runtime.getValue
|
|
|
+import androidx.compose.ui.Alignment
|
|
|
+import androidx.compose.ui.Modifier
|
|
|
+import androidx.compose.ui.draw.clip
|
|
|
+import androidx.compose.ui.graphics.Color
|
|
|
+import androidx.compose.ui.layout.ContentScale
|
|
|
+import androidx.compose.ui.platform.LocalContext
|
|
|
+import androidx.compose.ui.text.font.FontWeight
|
|
|
+import androidx.compose.ui.text.style.TextAlign
|
|
|
+import androidx.compose.ui.unit.dp
|
|
|
+import androidx.compose.ui.unit.sp
|
|
|
+import androidx.hilt.navigation.compose.hiltViewModel
|
|
|
+import androidx.navigation.NavController
|
|
|
+import coil.compose.AsyncImagePainter
|
|
|
+import coil.compose.rememberAsyncImagePainter
|
|
|
+import coil.request.ImageRequest
|
|
|
+import com.example.triphelper.model.Attractions
|
|
|
+import com.example.triphelper.view.MainScreen.LawScreenViewModel
|
|
|
+import com.example.triphelper.view.style.StyleMainFone
|
|
|
+import com.example.triphelper.view.theme.Roboto
|
|
|
+import com.example.triphelper.view.theme.RobotoB
|
|
|
+import com.example.triphelper.view.theme.SeoulBold
|
|
|
+
|
|
|
+@Composable
|
|
|
+fun HotelsDesc(navController: NavController, iconsRouteIsActivity: MutableState<Boolean>,idHotel:Int, titleHotel:String, viewModel: RouteViewModel = hiltViewModel()) {
|
|
|
+ iconsRouteIsActivity.value = true
|
|
|
+ val hotels by viewModel.hotels.collectAsState(initial = emptyList())
|
|
|
+
|
|
|
+ LaunchedEffect(key1 = viewModel.navigationTo) {
|
|
|
+ viewModel.navigationTo.collect { destination ->
|
|
|
+ destination?.let {
|
|
|
+ navController.navigate(destination)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Column(
|
|
|
+ modifier = Modifier
|
|
|
+ .fillMaxSize()
|
|
|
+ .background(Color.White),
|
|
|
+ verticalArrangement = Arrangement.Top,
|
|
|
+ horizontalAlignment = Alignment.CenterHorizontally
|
|
|
+ ) {
|
|
|
+ Column {
|
|
|
+ Text(
|
|
|
+ text = titleHotel,
|
|
|
+ color = Color(0xFF510B3C),
|
|
|
+ fontSize = 28.sp,
|
|
|
+ fontFamily = SeoulBold,
|
|
|
+ fontWeight = FontWeight.Bold,
|
|
|
+ textAlign = TextAlign.Center,
|
|
|
+ modifier = Modifier.padding(top = 60.dp)
|
|
|
+ )
|
|
|
+ }
|
|
|
+ LaunchedEffect(Unit) {
|
|
|
+ viewModel.GetHotel(idHotel)
|
|
|
+ }
|
|
|
+ LazyColumn(
|
|
|
+ modifier = Modifier
|
|
|
+ .padding(top = 20.dp, bottom = 60.dp)
|
|
|
+ .fillMaxHeight(0.94f)
|
|
|
+ ) {
|
|
|
+ items(
|
|
|
+ hotels,
|
|
|
+ key = { hotels -> hotels.id },
|
|
|
+ ) { hotels ->
|
|
|
+ val imageStateHotel = rememberAsyncImagePainter(
|
|
|
+ model = ImageRequest.Builder(LocalContext.current).data(hotels.photo_hotel)
|
|
|
+ .size(coil.size.Size.ORIGINAL).build()
|
|
|
+ ).state
|
|
|
+ val imageStateRoom = rememberAsyncImagePainter(
|
|
|
+ model = ImageRequest.Builder(LocalContext.current).data(hotels.photo_room)
|
|
|
+ .size(coil.size.Size.ORIGINAL).build()
|
|
|
+ ).state
|
|
|
+ val imageStateInterior = rememberAsyncImagePainter(
|
|
|
+ model = ImageRequest.Builder(LocalContext.current).data(hotels.photo_interior)
|
|
|
+ .size(coil.size.Size.ORIGINAL).build()
|
|
|
+ ).state
|
|
|
+ if (imageStateHotel is AsyncImagePainter.State.Error || imageStateRoom is AsyncImagePainter.State.Error || imageStateInterior is AsyncImagePainter.State.Error) {
|
|
|
+ Box(
|
|
|
+ modifier = Modifier
|
|
|
+ .fillMaxWidth()
|
|
|
+ .height(200.dp),
|
|
|
+ contentAlignment = Alignment.Center
|
|
|
+ ) {
|
|
|
+ CircularProgressIndicator()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (imageStateHotel is AsyncImagePainter.State.Success && imageStateRoom is AsyncImagePainter.State.Success && imageStateInterior is AsyncImagePainter.State.Success) {
|
|
|
+ Column(
|
|
|
+ modifier = Modifier
|
|
|
+ .fillMaxWidth()
|
|
|
+ ) {
|
|
|
+ Box(
|
|
|
+ contentAlignment = Alignment.Center,
|
|
|
+ modifier = Modifier.padding(bottom = 20.dp).fillMaxWidth()
|
|
|
+ ) {
|
|
|
+ Image(
|
|
|
+ modifier = Modifier
|
|
|
+ .fillMaxWidth(0.9f)
|
|
|
+ .height(190.dp)
|
|
|
+ .clip(RoundedCornerShape(10.dp)),
|
|
|
+ painter = imageStateHotel.painter,
|
|
|
+ contentDescription = "",
|
|
|
+ contentScale = ContentScale.Crop,
|
|
|
+ alignment = Alignment.Center
|
|
|
+ )
|
|
|
+ }
|
|
|
+ Column(
|
|
|
+ horizontalAlignment = Alignment.Start,
|
|
|
+ verticalArrangement = Arrangement.spacedBy(20.dp),
|
|
|
+ modifier = Modifier.padding(start = 20.dp).fillMaxWidth(0.9f)
|
|
|
+ ) {
|
|
|
+ Text(
|
|
|
+ text = "Адрес",
|
|
|
+ color = Color(0xFF510B3C),
|
|
|
+ fontSize = 26.sp,
|
|
|
+ fontFamily = SeoulBold,
|
|
|
+ fontWeight = FontWeight.Bold,
|
|
|
+ textAlign = TextAlign.Start
|
|
|
+ )
|
|
|
+ Text(
|
|
|
+ text = hotels.address,
|
|
|
+ color = Color(0xFF000000),
|
|
|
+ fontSize = 20.sp,
|
|
|
+ fontFamily = Roboto,
|
|
|
+ textAlign = TextAlign.Start,
|
|
|
+ )
|
|
|
+ Text(
|
|
|
+ text = "Основная информация",
|
|
|
+ color = Color(0xFF510B3C),
|
|
|
+ fontSize = 26.sp,
|
|
|
+ fontFamily = SeoulBold,
|
|
|
+ fontWeight = FontWeight.Bold,
|
|
|
+ textAlign = TextAlign.Start
|
|
|
+ )
|
|
|
+ Text(
|
|
|
+ text = hotels.basic_info,
|
|
|
+ color = Color(0xFF000000),
|
|
|
+ fontSize = 20.sp,
|
|
|
+ fontFamily = Roboto,
|
|
|
+ textAlign = TextAlign.Start,
|
|
|
+ )
|
|
|
+ Text(
|
|
|
+ text = "Интерьер",
|
|
|
+ color = Color(0xFF510B3C),
|
|
|
+ fontSize = 26.sp,
|
|
|
+ fontFamily = SeoulBold,
|
|
|
+ fontWeight = FontWeight.Bold,
|
|
|
+ textAlign = TextAlign.Start
|
|
|
+ )
|
|
|
+ Box(
|
|
|
+ contentAlignment = Alignment.Center,
|
|
|
+ modifier = Modifier.fillMaxWidth()
|
|
|
+ ) {
|
|
|
+ Image(
|
|
|
+ modifier = Modifier
|
|
|
+ .fillMaxWidth()
|
|
|
+ .height(190.dp)
|
|
|
+ .clip(RoundedCornerShape(10.dp)),
|
|
|
+ painter = imageStateInterior.painter,
|
|
|
+ contentDescription = "",
|
|
|
+ contentScale = ContentScale.Crop,
|
|
|
+ alignment = Alignment.Center
|
|
|
+ )
|
|
|
+ }
|
|
|
+ Text(
|
|
|
+ text = hotels.interior,
|
|
|
+ color = Color(0xFF000000),
|
|
|
+ fontSize = 20.sp,
|
|
|
+ fontFamily = Roboto,
|
|
|
+ textAlign = TextAlign.Start,
|
|
|
+ )
|
|
|
+ Text(
|
|
|
+ text = "Комнаты",
|
|
|
+ color = Color(0xFF510B3C),
|
|
|
+ fontSize = 26.sp,
|
|
|
+ fontFamily = SeoulBold,
|
|
|
+ fontWeight = FontWeight.Bold,
|
|
|
+ textAlign = TextAlign.Start
|
|
|
+ )
|
|
|
+ Box(
|
|
|
+ contentAlignment = Alignment.Center,
|
|
|
+ modifier = Modifier.fillMaxWidth()
|
|
|
+ ) {
|
|
|
+ Image(
|
|
|
+ modifier = Modifier
|
|
|
+ .fillMaxWidth()
|
|
|
+ .height(190.dp)
|
|
|
+ .clip(RoundedCornerShape(10.dp)),
|
|
|
+ painter = imageStateRoom.painter,
|
|
|
+ contentDescription = "",
|
|
|
+ contentScale = ContentScale.Crop,
|
|
|
+ alignment = Alignment.Center
|
|
|
+ )
|
|
|
+ }
|
|
|
+ Text(
|
|
|
+ text = hotels.rooms,
|
|
|
+ color = Color(0xFF000000),
|
|
|
+ fontSize = 20.sp,
|
|
|
+ fontFamily = Roboto,
|
|
|
+ textAlign = TextAlign.Start,
|
|
|
+ )
|
|
|
+ Text(
|
|
|
+ text = "Цены",
|
|
|
+ color = Color(0xFF510B3C),
|
|
|
+ fontSize = 26.sp,
|
|
|
+ fontFamily = SeoulBold,
|
|
|
+ fontWeight = FontWeight.Bold,
|
|
|
+ textAlign = TextAlign.Start
|
|
|
+ )
|
|
|
+ Text(
|
|
|
+ text = hotels.price,
|
|
|
+ color = Color(0xFF000000),
|
|
|
+ fontSize = 20.sp,
|
|
|
+ fontFamily = Roboto,
|
|
|
+ textAlign = TextAlign.Start
|
|
|
+ )
|
|
|
+ Text(
|
|
|
+ text = "Доп услуги",
|
|
|
+ color = Color(0xFF510B3C),
|
|
|
+ fontSize = 26.sp,
|
|
|
+ fontFamily = SeoulBold,
|
|
|
+ fontWeight = FontWeight.Bold,
|
|
|
+ textAlign = TextAlign.Start
|
|
|
+ )
|
|
|
+ Text(
|
|
|
+ text = hotels.services,
|
|
|
+ color = Color(0xFF000000),
|
|
|
+ fontSize = 20.sp,
|
|
|
+ fontFamily = Roboto,
|
|
|
+ textAlign = TextAlign.Start
|
|
|
+ )
|
|
|
+ Text(
|
|
|
+ text = "Заезд/Выезд",
|
|
|
+ color = Color(0xFF510B3C),
|
|
|
+ fontSize = 26.sp,
|
|
|
+ fontFamily = SeoulBold,
|
|
|
+ fontWeight = FontWeight.Bold,
|
|
|
+ textAlign = TextAlign.Start
|
|
|
+ )
|
|
|
+// Text(
|
|
|
+// text = hotels.,
|
|
|
+// color = Color(0xFF000000),
|
|
|
+// fontSize = 20.sp,
|
|
|
+// fontFamily = Roboto,
|
|
|
+// textAlign = TextAlign.Start,
|
|
|
+// modifier = Modifier
|
|
|
+// .padding(bottom = 40.dp)
|
|
|
+// )
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|