<UserControl xmlns="https://github.com/avaloniaui"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
             x:Class="TravelAroundRussia.Views.MainTourPage"
			 xmlns:vm="using:TravelAroundRussia.ViewModels"
			 x:DataType="vm:MainWindowViewModel">

	<UserControl.Resources>
		<Image x:Key="nopic" Source="/Assets/picture.png"/>
	</UserControl.Resources>

	<Grid Margin="5">
		<Grid.RowDefinitions>
			<RowDefinition Height="Auto"></RowDefinition>
			<RowDefinition Height="Auto"></RowDefinition>
			<RowDefinition Height="Auto"></RowDefinition>
			<RowDefinition Height="*"></RowDefinition>
		</Grid.RowDefinitions>
		<TextBlock  Grid.Row="0" Classes="Header" HorizontalAlignment="Center">Туры</TextBlock>

		<Grid Grid.Row="1">
			<Button Command="{Binding TourToHotel}" Classes="Menu">Отели</Button>
			<TextBlock Text="{Binding MainTourPage.SrCount}" HorizontalAlignment="Right">Средняя</TextBlock>
		</Grid>

		<WrapPanel Grid.Row="2" Orientation="Horizontal" Margin="0 5" HorizontalAlignment="Center">
			<StackPanel Orientation="Horizontal" Margin="0 5">
				<TextBlock>Введите текст для поиска</TextBlock>
				<TextBox Text="{Binding MainTourPage.SearchText}"></TextBox>
			</StackPanel>
			<StackPanel Orientation="Horizontal" Margin="0 5">
				<TextBlock>Выберите тип</TextBlock>
				<ComboBox
								ItemsSource="{Binding MainTourPage.TypeList}"
								SelectedValue="{Binding MainTourPage.TypeListSelect}"></ComboBox>
			</StackPanel>
			<StackPanel Orientation="Horizontal" Margin="0 5">
				<TextBlock>Сортировать</TextBlock>
				<ComboBox SelectedIndex="{Binding MainTourPage.SortListSelect}">
					<ComboBoxItem Content="По возрастанию цены"></ComboBoxItem>
					<ComboBoxItem Content="По убыванию цены"></ComboBoxItem>
				</ComboBox>
			</StackPanel>
			<CheckBox IsChecked="{Binding MainTourPage.ActualFlag}" Margin="0 5">только актуальные туры</CheckBox>
		</WrapPanel>

		<ListBox Grid.Row="3" ItemsSource="{Binding MainTourPage.TourList}" Background="White">
			<ListBox.ItemsPanel>
				<ItemsPanelTemplate>
					<WrapPanel ScrollViewer.VerticalScrollBarVisibility="Auto" HorizontalAlignment="Center"></WrapPanel>
				</ItemsPanelTemplate>
			</ListBox.ItemsPanel>
			<ListBox.ItemTemplate>
				<DataTemplate>
					<Border BorderBrush="Black" BorderThickness="1" CornerRadius="5">
						<Grid Height="300" Width="250" Margin="5">
							<Grid.RowDefinitions>
								<RowDefinition Height="Auto"></RowDefinition>
								<RowDefinition Height="Auto"></RowDefinition>
								<RowDefinition Height="Auto"></RowDefinition>
								<RowDefinition Height="Auto"></RowDefinition>
							</Grid.RowDefinitions>

							<Grid.ColumnDefinitions>
								<ColumnDefinition></ColumnDefinition>
								<ColumnDefinition></ColumnDefinition>
							</Grid.ColumnDefinitions>

							<TextBlock Text="{Binding Name}" Grid.Row="0" Grid.ColumnSpan="2" TextWrapping="Wrap" Height="50" TextAlignment="Center" HorizontalAlignment="Center">Наименование тура</TextBlock>
							<Image Source="{Binding Image}" Grid.Row="1" Grid.ColumnSpan="2"  Height="200" Width="200" Stretch="Uniform"></Image>
							<TextBlock Text="{Binding Price, StringFormat={}{0:c0}}" Grid.Row="2" Grid.ColumnSpan="2" HorizontalAlignment="Center">Цена</TextBlock>
							<TextBlock Text="{Binding ActualText}" Foreground="{Binding ActualColor}" Grid.Row="3" Grid.Column="0" >Актуальность</TextBlock>
							<TextBlock Text="{Binding TicketCount, StringFormat=Билетов: {0} }" HorizontalAlignment="Right" Grid.Row="3" Grid.Column="1" >Количество билетов</TextBlock>
						</Grid>
					</Border>
				</DataTemplate>
			</ListBox.ItemTemplate>
		</ListBox>
	</Grid>
</UserControl>
