|
@@ -0,0 +1,472 @@
|
|
|
|
+package com.example.triphelper.view.style
|
|
|
|
+
|
|
|
|
+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.Row
|
|
|
|
+import androidx.compose.foundation.layout.fillMaxHeight
|
|
|
|
+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.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.MutableState
|
|
|
|
+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.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.model.Organization_of_tours
|
|
|
|
+import com.example.triphelper.model.Restaurants
|
|
|
|
+import com.example.triphelper.view.RouteScreens.RouteViewModel
|
|
|
|
+import com.example.triphelper.view.theme.Roboto
|
|
|
|
+import com.example.triphelper.view.theme.RobotoB
|
|
|
|
+
|
|
|
|
+@Composable
|
|
|
|
+fun AttractionsLazy(orgTour:List<Organization_of_tours>,viewModel: RouteViewModel = hiltViewModel()){
|
|
|
|
+ LazyColumn(
|
|
|
|
+ modifier = Modifier.fillMaxHeight(0.84f)
|
|
|
|
+ ) {
|
|
|
|
+ items(
|
|
|
|
+ orgTour,
|
|
|
|
+ key = { orgTour -> orgTour.id },
|
|
|
|
+ ) { orgTour ->
|
|
|
|
+ val imageState = rememberAsyncImagePainter(
|
|
|
|
+ model = ImageRequest.Builder(LocalContext.current).data(orgTour.attractions.photo)
|
|
|
|
+ .size(coil.size.Size.ORIGINAL).build()
|
|
|
|
+ ).state
|
|
|
|
+ if (imageState is AsyncImagePainter.State.Error) {
|
|
|
|
+ Box(
|
|
|
|
+ modifier = Modifier
|
|
|
|
+ .fillMaxWidth()
|
|
|
|
+ .height(200.dp),
|
|
|
|
+ contentAlignment = Alignment.Center
|
|
|
|
+ ) {
|
|
|
|
+ CircularProgressIndicator()
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (imageState is AsyncImagePainter.State.Success) {
|
|
|
|
+ Column(
|
|
|
|
+ modifier = Modifier
|
|
|
|
+ .fillMaxWidth(0.8f)
|
|
|
|
+ .padding(top = 10.dp)
|
|
|
|
+ .height(175.dp)
|
|
|
|
+ .padding(bottom = 10.dp)
|
|
|
|
+ .border(
|
|
|
|
+ width = 4.dp,
|
|
|
|
+ color = Color(0xFF510B3C),
|
|
|
|
+ shape = RoundedCornerShape(15.dp)
|
|
|
|
+ ),
|
|
|
|
+ ) {
|
|
|
|
+ Box(
|
|
|
|
+ Modifier
|
|
|
|
+ .fillMaxWidth()
|
|
|
|
+ .fillMaxHeight()
|
|
|
|
+ .clip(RoundedCornerShape(15.dp))
|
|
|
|
+ .background(Color.White)
|
|
|
|
+ ) {
|
|
|
|
+ Row {
|
|
|
|
+ Image(
|
|
|
|
+ modifier = Modifier
|
|
|
|
+ .width(140.dp)
|
|
|
|
+ .fillMaxHeight()
|
|
|
|
+ .clip(RoundedCornerShape(15.dp))
|
|
|
|
+ .clickable {},
|
|
|
|
+ painter = imageState.painter,
|
|
|
|
+ contentDescription = "",
|
|
|
|
+ contentScale = ContentScale.Crop
|
|
|
|
+ )
|
|
|
|
+ Box(
|
|
|
|
+ Modifier
|
|
|
|
+ .fillMaxWidth()
|
|
|
|
+ .fillMaxHeight()
|
|
|
|
+ .size(210.dp)
|
|
|
|
+ .padding(top = 10.dp),
|
|
|
|
+ contentAlignment = Alignment.TopCenter
|
|
|
|
+ ) {
|
|
|
|
+ Text(
|
|
|
|
+ text = orgTour.attractions.name,
|
|
|
|
+ color = Color(0xFF510B3C),
|
|
|
|
+ fontSize = 16.sp,
|
|
|
|
+ fontFamily = RobotoB,
|
|
|
|
+ textAlign = TextAlign.Center
|
|
|
|
+ )
|
|
|
|
+ Box(
|
|
|
|
+ Modifier
|
|
|
|
+ .fillMaxWidth()
|
|
|
|
+ .fillMaxHeight()
|
|
|
|
+ .padding(top = 10.dp, bottom = 20.dp, start = 5.dp),
|
|
|
|
+ contentAlignment = Alignment.BottomStart
|
|
|
|
+ ) {
|
|
|
|
+ Column(
|
|
|
|
+ verticalArrangement = Arrangement.spacedBy(10.dp)
|
|
|
|
+ ) {
|
|
|
|
+ Row {
|
|
|
|
+ Text(
|
|
|
|
+ text = "Посещение: ",
|
|
|
|
+ color = Color(0xFF510B3C),
|
|
|
|
+ fontSize = 14.sp,
|
|
|
|
+ fontFamily = RobotoB,
|
|
|
|
+ textAlign = TextAlign.Center
|
|
|
|
+ )
|
|
|
|
+ Text(
|
|
|
|
+ text = orgTour.attractions.visiting,
|
|
|
|
+ color = Color(0xFF510B3C),
|
|
|
|
+ fontSize = 14.sp,
|
|
|
|
+ fontFamily = Roboto,
|
|
|
|
+ textAlign = TextAlign.Center
|
|
|
|
+ )
|
|
|
|
+ }
|
|
|
|
+ Row {
|
|
|
|
+ Text(
|
|
|
|
+ text = "Время работы: ",
|
|
|
|
+ color = Color(0xFF510B3C),
|
|
|
|
+ fontSize = 14.sp,
|
|
|
|
+ fontFamily = RobotoB,
|
|
|
|
+ textAlign = TextAlign.Center
|
|
|
|
+ )
|
|
|
|
+ Text(
|
|
|
|
+ text = orgTour.attractions.work_schedule,
|
|
|
|
+ color = Color(0xFF510B3C),
|
|
|
|
+ fontSize = 14.sp,
|
|
|
|
+ fontFamily = Roboto,
|
|
|
|
+ textAlign = TextAlign.Center
|
|
|
|
+ )
|
|
|
|
+ }
|
|
|
|
+ Row {
|
|
|
|
+ Text(
|
|
|
|
+ text = "Цена: ",
|
|
|
|
+ color = Color(0xFF510B3C),
|
|
|
|
+ fontSize = 14.sp,
|
|
|
|
+ fontFamily = RobotoB,
|
|
|
|
+ textAlign = TextAlign.Center
|
|
|
|
+ )
|
|
|
|
+ Text(
|
|
|
|
+ text =
|
|
|
|
+ if (orgTour.attractions.price_showing == 0) {
|
|
|
|
+ "Бесплтано"
|
|
|
|
+ } else {
|
|
|
|
+ "${orgTour.attractions.price_showing} ${orgTour.attractions.currency.title}"
|
|
|
|
+ },
|
|
|
|
+ color = Color(0xFF510B3C),
|
|
|
|
+ fontSize = 14.sp,
|
|
|
|
+ fontFamily = Roboto,
|
|
|
|
+ textAlign = TextAlign.Center
|
|
|
|
+ )
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+@Composable
|
|
|
|
+fun HotelsLazy(orgTour:List<Organization_of_tours>,viewModel: RouteViewModel = hiltViewModel()){
|
|
|
|
+ LazyColumn(
|
|
|
|
+ modifier = Modifier.fillMaxHeight(0.84f)
|
|
|
|
+ ) {
|
|
|
|
+ items(
|
|
|
|
+ orgTour,
|
|
|
|
+ key = { orgTour -> orgTour.id },
|
|
|
|
+ ) { orgTour ->
|
|
|
|
+ val imageState = rememberAsyncImagePainter(
|
|
|
|
+ model = ImageRequest.Builder(LocalContext.current).data(orgTour.hotels.photo_hotel)
|
|
|
|
+ .size(coil.size.Size.ORIGINAL).build()
|
|
|
|
+ ).state
|
|
|
|
+ if (imageState is AsyncImagePainter.State.Error) {
|
|
|
|
+ Box(
|
|
|
|
+ modifier = Modifier
|
|
|
|
+ .fillMaxWidth()
|
|
|
|
+ .height(200.dp),
|
|
|
|
+ contentAlignment = Alignment.Center
|
|
|
|
+ ) {
|
|
|
|
+ CircularProgressIndicator()
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (imageState is AsyncImagePainter.State.Success) {
|
|
|
|
+ Column(
|
|
|
|
+ modifier = Modifier
|
|
|
|
+ .fillMaxWidth(0.8f)
|
|
|
|
+ .padding(top = 10.dp)
|
|
|
|
+ .height(175.dp)
|
|
|
|
+ .padding(bottom = 10.dp)
|
|
|
|
+ .border(
|
|
|
|
+ width = 4.dp,
|
|
|
|
+ color = Color(0xFF510B3C),
|
|
|
|
+ shape = RoundedCornerShape(15.dp)
|
|
|
|
+ ),
|
|
|
|
+ ) {
|
|
|
|
+ Box(
|
|
|
|
+ Modifier
|
|
|
|
+ .fillMaxWidth()
|
|
|
|
+ .fillMaxHeight()
|
|
|
|
+ .clip(RoundedCornerShape(15.dp))
|
|
|
|
+ .background(Color.White)
|
|
|
|
+ ) {
|
|
|
|
+ Row {
|
|
|
|
+ Image(
|
|
|
|
+ modifier = Modifier
|
|
|
|
+ .width(140.dp)
|
|
|
|
+ .fillMaxHeight()
|
|
|
|
+ .clip(RoundedCornerShape(15.dp))
|
|
|
|
+ .clickable {},
|
|
|
|
+ painter = imageState.painter,
|
|
|
|
+ contentDescription = "",
|
|
|
|
+ contentScale = ContentScale.Crop
|
|
|
|
+ )
|
|
|
|
+ Box(
|
|
|
|
+ Modifier
|
|
|
|
+ .fillMaxWidth()
|
|
|
|
+ .fillMaxHeight()
|
|
|
|
+ .size(210.dp)
|
|
|
|
+ .padding(top = 10.dp, start = 5.dp),
|
|
|
|
+ contentAlignment = Alignment.TopCenter
|
|
|
|
+ ) {
|
|
|
|
+ Text(
|
|
|
|
+ text = orgTour.hotels.name,
|
|
|
|
+ color = Color(0xFF510B3C),
|
|
|
|
+ fontSize = 16.sp,
|
|
|
|
+ fontFamily = RobotoB,
|
|
|
|
+ textAlign = TextAlign.Center
|
|
|
|
+ )
|
|
|
|
+ Box(
|
|
|
|
+ Modifier
|
|
|
|
+ .fillMaxWidth()
|
|
|
|
+ .fillMaxHeight()
|
|
|
|
+ .padding(top = 10.dp, bottom = 20.dp),
|
|
|
|
+ contentAlignment = Alignment.BottomStart
|
|
|
|
+ ) {
|
|
|
|
+ Column(
|
|
|
|
+ verticalArrangement = Arrangement.spacedBy(10.dp)
|
|
|
|
+ ) {
|
|
|
|
+ Row {
|
|
|
|
+ Text(
|
|
|
|
+ text = "Рейтинг: ",
|
|
|
|
+ color = Color(0xFF510B3C),
|
|
|
|
+ fontSize = 14.sp,
|
|
|
|
+ fontFamily = RobotoB,
|
|
|
|
+ textAlign = TextAlign.Center
|
|
|
|
+ )
|
|
|
|
+ Text(
|
|
|
|
+ text = orgTour.hotels.rating.toString(),
|
|
|
|
+ color = Color(0xFF510B3C),
|
|
|
|
+ fontSize = 14.sp,
|
|
|
|
+ fontFamily = Roboto,
|
|
|
|
+ textAlign = TextAlign.Center
|
|
|
|
+ )
|
|
|
|
+ }
|
|
|
|
+ Row {
|
|
|
|
+ Text(
|
|
|
|
+ text = "Кол-во номеров: ",
|
|
|
|
+ color = Color(0xFF510B3C),
|
|
|
|
+ fontSize = 14.sp,
|
|
|
|
+ fontFamily = RobotoB,
|
|
|
|
+ textAlign = TextAlign.Center
|
|
|
|
+ )
|
|
|
|
+ Text(
|
|
|
|
+ text = orgTour.hotels.quantity_of_rooms.toString(),
|
|
|
|
+ color = Color(0xFF510B3C),
|
|
|
|
+ fontSize = 14.sp,
|
|
|
|
+ fontFamily = Roboto,
|
|
|
|
+ textAlign = TextAlign.Center
|
|
|
|
+ )
|
|
|
|
+ }
|
|
|
|
+ Row {
|
|
|
|
+ Text(
|
|
|
|
+ text = "Этажей: ",
|
|
|
|
+ color = Color(0xFF510B3C),
|
|
|
|
+ fontSize = 14.sp,
|
|
|
|
+ fontFamily = RobotoB,
|
|
|
|
+ textAlign = TextAlign.Center
|
|
|
|
+ )
|
|
|
|
+ Text(
|
|
|
|
+ text = orgTour.hotels.floors.toString(),
|
|
|
|
+ color = Color(0xFF510B3C),
|
|
|
|
+ fontSize = 14.sp,
|
|
|
|
+ fontFamily = Roboto,
|
|
|
|
+ textAlign = TextAlign.Center
|
|
|
|
+ )
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+@Composable
|
|
|
|
+fun RestaurantsLazy(orgTour:List<Organization_of_tours>,viewModel: RouteViewModel = hiltViewModel()){
|
|
|
|
+ LazyColumn(
|
|
|
|
+ modifier = Modifier.fillMaxHeight(0.84f)
|
|
|
|
+ ) {
|
|
|
|
+ items(
|
|
|
|
+ orgTour,
|
|
|
|
+ key = { orgTour -> orgTour.id },
|
|
|
|
+ ) { orgTour ->
|
|
|
|
+ val imageState = rememberAsyncImagePainter(
|
|
|
|
+ model = ImageRequest.Builder(LocalContext.current).data(orgTour.restaurants.photo)
|
|
|
|
+ .size(coil.size.Size.ORIGINAL).build()
|
|
|
|
+ ).state
|
|
|
|
+ if (imageState is AsyncImagePainter.State.Error) {
|
|
|
|
+ Box(
|
|
|
|
+ modifier = Modifier
|
|
|
|
+ .fillMaxWidth()
|
|
|
|
+ .height(200.dp),
|
|
|
|
+ contentAlignment = Alignment.Center
|
|
|
|
+ ) {
|
|
|
|
+ CircularProgressIndicator()
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (imageState is AsyncImagePainter.State.Success) {
|
|
|
|
+ Column(
|
|
|
|
+ modifier = Modifier
|
|
|
|
+ .fillMaxWidth(0.8f)
|
|
|
|
+ .padding(top = 10.dp)
|
|
|
|
+ .height(175.dp)
|
|
|
|
+ .padding(bottom = 10.dp)
|
|
|
|
+ .border(
|
|
|
|
+ width = 4.dp,
|
|
|
|
+ color = Color(0xFF510B3C),
|
|
|
|
+ shape = RoundedCornerShape(15.dp)
|
|
|
|
+ ),
|
|
|
|
+ ) {
|
|
|
|
+ Box(
|
|
|
|
+ Modifier
|
|
|
|
+ .fillMaxWidth()
|
|
|
|
+ .fillMaxHeight()
|
|
|
|
+ .clip(RoundedCornerShape(15.dp))
|
|
|
|
+ .background(Color.White)
|
|
|
|
+ ) {
|
|
|
|
+ Row {
|
|
|
|
+ Image(
|
|
|
|
+ modifier = Modifier
|
|
|
|
+ .width(140.dp)
|
|
|
|
+ .fillMaxHeight()
|
|
|
|
+ .clip(RoundedCornerShape(15.dp))
|
|
|
|
+ .clickable {},
|
|
|
|
+ painter = imageState.painter,
|
|
|
|
+ contentDescription = "",
|
|
|
|
+ contentScale = ContentScale.Crop
|
|
|
|
+ )
|
|
|
|
+ Box(
|
|
|
|
+ Modifier
|
|
|
|
+ .fillMaxWidth()
|
|
|
|
+ .fillMaxHeight()
|
|
|
|
+ .size(210.dp)
|
|
|
|
+ .padding(top = 10.dp, start = 5.dp),
|
|
|
|
+ contentAlignment = Alignment.TopCenter
|
|
|
|
+ ) {
|
|
|
|
+ Text(
|
|
|
|
+ text = orgTour.restaurants.name,
|
|
|
|
+ color = Color(0xFF510B3C),
|
|
|
|
+ fontSize = 16.sp,
|
|
|
|
+ fontFamily = RobotoB,
|
|
|
|
+ textAlign = TextAlign.Center
|
|
|
|
+ )
|
|
|
|
+ Box(
|
|
|
|
+ Modifier
|
|
|
|
+ .fillMaxWidth()
|
|
|
|
+ .fillMaxHeight()
|
|
|
|
+ .padding(top = 10.dp, bottom = 20.dp),
|
|
|
|
+ contentAlignment = Alignment.BottomStart
|
|
|
|
+ ) {
|
|
|
|
+ Column(
|
|
|
|
+ verticalArrangement = Arrangement.spacedBy(10.dp)
|
|
|
|
+ ) {
|
|
|
|
+ Row {
|
|
|
|
+ Text(
|
|
|
|
+ text = "График: ",
|
|
|
|
+ color = Color(0xFF510B3C),
|
|
|
|
+ fontSize = 14.sp,
|
|
|
|
+ fontFamily = RobotoB,
|
|
|
|
+ textAlign = TextAlign.Center
|
|
|
|
+ )
|
|
|
|
+ Text(
|
|
|
|
+ text = orgTour.restaurants.work_schedule,
|
|
|
|
+ color = Color(0xFF510B3C),
|
|
|
|
+ fontSize = 14.sp,
|
|
|
|
+ fontFamily = Roboto,
|
|
|
|
+ textAlign = TextAlign.Center
|
|
|
|
+ )
|
|
|
|
+ }
|
|
|
|
+ Row {
|
|
|
|
+ Text(
|
|
|
|
+ text = "Средний чек: ",
|
|
|
|
+ color = Color(0xFF510B3C),
|
|
|
|
+ fontSize = 14.sp,
|
|
|
|
+ fontFamily = RobotoB,
|
|
|
|
+ textAlign = TextAlign.Center
|
|
|
|
+ )
|
|
|
|
+ Text(
|
|
|
|
+ text = "${orgTour.restaurants.average_check} ${orgTour.restaurants.currency.title}",
|
|
|
|
+ color = Color(0xFF510B3C),
|
|
|
|
+ fontSize = 14.sp,
|
|
|
|
+ fontFamily = Roboto,
|
|
|
|
+ textAlign = TextAlign.Center
|
|
|
|
+ )
|
|
|
|
+ }
|
|
|
|
+ Row {
|
|
|
|
+ Text(
|
|
|
|
+ text = "Телефон: ",
|
|
|
|
+ color = Color(0xFF510B3C),
|
|
|
|
+ fontSize = 14.sp,
|
|
|
|
+ fontFamily = RobotoB,
|
|
|
|
+ textAlign = TextAlign.Center
|
|
|
|
+ )
|
|
|
|
+ Text(
|
|
|
|
+ text = orgTour.restaurants.phone,
|
|
|
|
+ color = Color(0xFF510B3C),
|
|
|
|
+ fontSize = 14.sp,
|
|
|
|
+ fontFamily = Roboto,
|
|
|
|
+ textAlign = TextAlign.Center
|
|
|
|
+ )
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+@Composable
|
|
|
|
+fun MetroLazy(orgTour:List<Organization_of_tours>,viewModel: RouteViewModel = hiltViewModel()){
|
|
|
|
+
|
|
|
|
+}
|