AutoCatUwp/AutoCat/Pages/SearchPage.xaml

108 lines
5.1 KiB
XML

<Page
x:Class="AutoCat.Pages.SearchPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:AutoCat.Pages"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls"
xmlns:model="using:AutoCatCore.Model"
xmlns:converters="using:AutoCatCore.Converters"
xmlns:custom="using:AutoCat.Controls"
mc:Ignorable="d"
d:Width="600"
d:Height="400"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Page.Resources>
<converters:SteeringWheelPositionConverter x:Key="SWToStringConverter"/>
<DataTemplate x:Key="VehicleTemplate" x:DataType="model:Vehicle">
<StackPanel Orientation="Vertical" Margin="0,8" Spacing="4">
<TextBlock Text="{x:Bind Brand.Name.Original}"/>
<custom:PlateView Number="{x:Bind Number}" Height="40"/>
</StackPanel>
</DataTemplate>
<DataTemplate x:Key="VehicleDetailTemplateNew" x:DataType="model:Vehicle">
<Grid Margin="16" RowSpacing="16" ColumnSpacing="16">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<StackPanel Grid.ColumnSpan="2" Orientation="Horizontal" Spacing="8">
<Image Source="{x:Bind Brand.Logo}" Height="50"/>
<TextBlock Text="{x:Bind Brand.Name.Original}" FontSize="24" VerticalAlignment="Center"/>
</StackPanel>
<StackPanel Grid.Row="1" Grid.Column="0" Padding="8" Orientation="Vertical" Spacing="8" Background="#222">
<TextBlock FontSize="18" FontWeight="SemiBold" Text="General"/>
<Line Stroke="#444" StrokeThickness="1" Stretch="Fill" X1="0" X2="1"/>
<custom:TextCell Title="Year" Value="{x:Bind Year}"/>
<custom:TextCell Title="Color" Value="{x:Bind Color}"/>
<custom:TextCell Title="Category" Value="{x:Bind Category}"/>
<custom:TextCell Title="Steering wheel position" Value="{x:Bind IsRightWheel, Converter={StaticResource SWToStringConverter}}"/>
</StackPanel>
<StackPanel Grid.Row="1" Grid.Column="1" Orientation="Vertical" Spacing="8" Padding="8" Background="#222">
<TextBlock FontSize="18" FontWeight="SemiBold" Text="Identifiers"/>
<Line Stroke="#444" StrokeThickness="1" Stretch="Fill" X1="0" X2="1"/>
<custom:TextCell Title="Plate number" Value="{x:Bind Number}"/>
<custom:TextCell Title="VIN" Value="{x:Bind Vin1}"/>
<custom:TextCell Title="STS" Value="{x:Bind Sts}"/>
<custom:TextCell Title="PTS" Value="{x:Bind Pts}"/>
</StackPanel>
<StackPanel Grid.Row="2" Grid.Column="0" Orientation="Vertical" Spacing="8" Padding="8" Background="#222">
<TextBlock FontSize="18" FontWeight="SemiBold" Text="Engine"/>
<Line Stroke="#444" StrokeThickness="1" Stretch="Fill" X1="0" X2="1"/>
<custom:TextCell Title="Number" Value="{x:Bind Engine.Number}"/>
<custom:TextCell Title="Fuel type" Value="{x:Bind Engine.FuelType}"/>
<custom:TextCell Title="Volume (cm3)" Value="{x:Bind Engine.Volume}"/>
<custom:TextCell Title="Power (HP)" Value="{x:Bind Engine.PowerHp}"/>
<custom:TextCell Title="Power (Kw)" Value="{x:Bind Engine.PowerKw}"/>
</StackPanel>
<StackPanel Grid.Row="2" Grid.Column="1" Orientation="Vertical" Spacing="8" Padding="8" Background="#222">
<TextBlock FontSize="18" FontWeight="SemiBold" Text="History"/>
<Line Stroke="#444" StrokeThickness="1" Stretch="Fill" X1="0" X2="1"/>
<custom:ButtonCell Title="Events" Value="{x:Bind Events.Count}"/>
<custom:ButtonCell Title="OSAGO" Value="{x:Bind OsagoContracts.Count}"/>
<custom:ButtonCell Title="Owners" Value="{x:Bind OwnershipPeriods.Count}"/>
<custom:ButtonCell Title="Photos" Value="{x:Bind Photos.Count}"/>
<custom:ButtonCell Title="Ads" Value="{x:Bind Ads.Count}"/>
</StackPanel>
</Grid>
</DataTemplate>
</Page.Resources>
<controls:MasterDetailsView Name="MasterDetail" Loaded="MasterDetail_Loaded" ItemsSource="{x:Bind viewModel.Vehicles}"
ItemTemplate="{StaticResource VehicleTemplate}" DetailsTemplate="{StaticResource VehicleDetailTemplateNew}">
<controls:MasterDetailsView.MasterHeader>
<Grid>
<AutoSuggestBox PlaceholderText="Search plate numbers" Margin="6"/>
</Grid>
</controls:MasterDetailsView.MasterHeader>
<controls:MasterDetailsView.MasterCommandBar>
<CommandBar>
<AppBarButton Label="Filters" Icon="Filter"/>
<AppBarButton Label="Map" Icon="Map"/>
</CommandBar>
</controls:MasterDetailsView.MasterCommandBar>
<controls:MasterDetailsView.DetailsCommandBar>
<CommandBar>
<AppBarButton Label="asdf" Icon="Add"/>
</CommandBar>
</controls:MasterDetailsView.DetailsCommandBar>
</controls:MasterDetailsView>
</Page>