<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.MainHotelPage"
			 xmlns:vm="using:TravelAroundRussia.ViewModels"
			 x:DataType="vm:MainWindowViewModel">
	<Grid Margin="5">
		<Grid.RowDefinitions>
			<RowDefinition Height="Auto"></RowDefinition>
			<RowDefinition Height="Auto"></RowDefinition>
			<RowDefinition Height="*"></RowDefinition>
			<RowDefinition Height="Auto"></RowDefinition>
		</Grid.RowDefinitions>
		<Grid.ColumnDefinitions>
			<ColumnDefinition Width="Auto"></ColumnDefinition>
			<ColumnDefinition Width="Auto"></ColumnDefinition>
			<ColumnDefinition Width="*"></ColumnDefinition>
			<ColumnDefinition Width="Auto"></ColumnDefinition>
			<ColumnDefinition Width="Auto"></ColumnDefinition>
		</Grid.ColumnDefinitions>

		<TextBlock  Grid.Row="0" Grid.ColumnSpan="5" Classes="Header" HorizontalAlignment="Center">Отели</TextBlock>
		
		<Grid Grid.Row="1" Grid.ColumnSpan="5">
			<StackPanel Orientation="Horizontal">
				<Button Command="{Binding HotelToTour}" Classes="Menu">Туры</Button>
				<Button Command="{Binding DeleteHotel}" Classes="Delete">Удалить</Button>
				<Button Command="{Binding editHotel}" Classes="Edit">Добавить</Button>
			</StackPanel>
			
			<StackPanel HorizontalAlignment="Right" Orientation="Horizontal">
				<TextBlock Text="{Binding MainHotelPage.CountAllRecord, StringFormat='Количество записей: {0}    '}"></TextBlock>
				<TextBlock>Количество элементов на странице</TextBlock>
				<TextBox Text="{Binding MainHotelPage.CountRecord}" MaxWidth="50"></TextBox>
			</StackPanel>
		</Grid>
		
		<ListBox Grid.Row="2" MinWidth="990" Grid.ColumnSpan="5" ItemsSource="{Binding MainHotelPage.HotelList}" SelectedItems="{Binding HotelSelected}" SelectionMode="Multiple,Toggle" Margin="0 5" Background="White">
			<ListBox.ItemsPanel>
				<ItemsPanelTemplate>
					<WrapPanel HorizontalAlignment="Center"></WrapPanel>
				</ItemsPanelTemplate>
			</ListBox.ItemsPanel>
			<ListBox.ItemTemplate>
				<DataTemplate>
					<Border BorderBrush="Black" BorderThickness="1" CornerRadius="5" Padding="5">
						<Grid MinWidth="480" MaxWidth="600">
							<Grid.RowDefinitions>
								<RowDefinition Height="Auto"></RowDefinition>
								<RowDefinition Height="Auto"></RowDefinition>
								<RowDefinition Height="Auto"></RowDefinition>
								<RowDefinition Height="Auto"></RowDefinition>
								<RowDefinition Height="Auto"></RowDefinition>
							</Grid.RowDefinitions>
							<Grid.ColumnDefinitions>
								<ColumnDefinition Width="*"></ColumnDefinition>
								<ColumnDefinition Width="Auto"></ColumnDefinition>
							</Grid.ColumnDefinitions>
							
							<TextBlock Grid.Row="0" Grid.Column="0" Text="{Binding Name,StringFormat='Название: {0}'}">название отеля</TextBlock>
							<TextBlock Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Text="{Binding CountryCodeNavigation.Name,StringFormat='Страна: {0}' }">название страны</TextBlock>
							<TextBlock Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" Text="{Binding CountHotel,StringFormat='Количество туров: {0}'}">количество имеющихся туров</TextBlock>
							
							<TextBlock Grid.Row="0" Grid.Column="1" Text="{Binding StarLine}" Foreground="#FAC716" HorizontalAlignment="Right">количество звезд</TextBlock>

							<Grid  Grid.Row="3" Grid.ColumnSpan="3">
								<Button Command="{Binding $parent[Window].((vm:MainWindowViewModel)DataContext).editHotelId}" 
										CommandParameter="{Binding Id}" 
										HorizontalAlignment="Right"
										Classes="Edit"
										Content="Редактировать"/>
							</Grid>
						</Grid>
					</Border>
				</DataTemplate>
			</ListBox.ItemTemplate>
		</ListBox>

		<Button Command="{Binding MainHotelPage.start}" Classes="Navigation" Grid.Row="3" Grid.Column="0" Content="&lt;&lt;"/>
		<Button Command="{Binding MainHotelPage.back}" Classes="Navigation" Grid.Row="3" Grid.Column="1" Content="&lt;"/>
		<TextBlock Text="{Binding MainHotelPage.CountPage}" Grid.Row="3" Grid.Column="2"  HorizontalAlignment="Center"/>
		<Button Command="{Binding MainHotelPage.next}" Classes="Navigation" Grid.Row="3" Grid.Column="3" Content=">"/>
		<Button Command="{Binding MainHotelPage.end}" Classes="Navigation" Grid.Row="3" Grid.Column="4" Content=">>"/>
	</Grid>
</UserControl>
