<UserControl x:Class="TSManagementApp.Views.TimeStampDetailsView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:local="clr-namespace:TSManagementApp.Views"
             xmlns:props="clr-namespace:TSManagementApp.Properties"
             mc:Ignorable="d" 
             d:DesignHeight="450" d:DesignWidth="800" Background="White">
    <ScrollViewer VerticalScrollBarVisibility="Auto">
        <Grid>
            <Grid.Resources>
                <Style TargetType="TextBlock" x:Key="Title">
                    <Setter Property="Background" Value="{StaticResource LightBlue}"/>
                    <Setter Property="FontSize" Value="16"/>
                    <Setter Property="FontWeight" Value="Bold"/>
                </Style>
                <Style TargetType="DataGrid">
                    <Setter Property="BorderThickness" Value="1.5"/>
                    <Setter Property="BorderBrush" Value="{StaticResource MyWhite}"/>
                    <Setter Property="HeadersVisibility" Value="None"/>
                    <Setter Property="AutoGenerateColumns" Value="False"/>
                    <Setter Property="HorizontalGridLinesBrush" Value="{StaticResource MyWhite}"/>
                    <Setter Property="VerticalGridLinesBrush" Value="{StaticResource MyWhite}"/>
                    <Setter Property="HorizontalScrollBarVisibility" Value="Hidden"/>
                    <Setter Property="IsReadOnly" Value="True"/>
                </Style>
                <Style TargetType="Button" BasedOn="{StaticResource ButtonBlue}">

                </Style>
                <Style TargetType="TextBox" x:Key="DataGridLeftColumn">
                    <Setter Property="TextWrapping" Value="Wrap"/>
                    <Setter Property="FontSize" Value="13"/>
                    <Setter Property="IsReadOnly" Value="True"/>
                    <Setter Property="Background" Value="{StaticResource LightBlueOpacity}"/>
                    <Setter Property="VerticalContentAlignment" Value="Center"/>
                    <Setter Property="BorderThickness" Value="0"/>
                </Style>
                <Style TargetType="TextBox" x:Key="DataGridRightColumn">
                    <Setter Property="TextWrapping" Value="Wrap"/>
                    <Setter Property="FontSize" Value="13"/>
                    <Setter Property="IsReadOnly" Value="True"/>
                    <Setter Property="BorderThickness" Value="0"/>
                    <Setter Property="BorderBrush" Value="Transparent"/>
                    <Setter Property="VerticalContentAlignment" Value="Center"/>
                    <Style.Triggers>
                        <Trigger Property="Text" Value="Chyba kvalifikovaného časového razítka">
                            <Setter Property="Background" Value="{StaticResource MyRed}"/>
                            <Setter Property="Foreground" Value="White"/>
                            <Setter Property="FontWeight" Value="DemiBold"/>
                        </Trigger>
                    </Style.Triggers>
                </Style>
            </Grid.Resources>
            <StackPanel Margin="5">
                <TextBlock Text="{x:Static props:Resources.TsDetailsV_GeneralDetails}" Style="{StaticResource Title}"/>
                <DataGrid ItemsSource="{Binding GeneralDetails}">
                    <DataGrid.Columns>
                        <DataGridTemplateColumn Width="0.4*">
                            <DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <TextBox Text="{Binding Item1, Mode=OneWay}" Style="{StaticResource DataGridLeftColumn}"/>
                                </DataTemplate>
                            </DataGridTemplateColumn.CellTemplate>
                        </DataGridTemplateColumn>
                        <DataGridTemplateColumn Width="1*">
                            <DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <TextBox Text="{Binding Item2, Mode=OneWay}" Style="{StaticResource DataGridRightColumn}"/>
                                </DataTemplate>
                            </DataGridTemplateColumn.CellTemplate>
                        </DataGridTemplateColumn>
                    </DataGrid.Columns>
                </DataGrid>
                <Separator/>
                <TextBlock Style="{StaticResource Title}" Text="{x:Static props:Resources.CreateTsV_TsDetails}" Visibility="{Binding TimeStampDetailsIsVisible, Converter={StaticResource ConverterBool2Visibility}}"/>
                <DataGrid ItemsSource="{Binding TimeStampDetails}" Visibility="{Binding TimeStampDetailsIsVisible, Converter={StaticResource ConverterBool2Visibility}}">
                    <DataGrid.Columns>
                        <DataGridTemplateColumn Width="0.4*">
                            <DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <TextBox Text="{Binding Item1, Mode=OneWay}" Style="{StaticResource DataGridLeftColumn}"/>
                                </DataTemplate>
                            </DataGridTemplateColumn.CellTemplate>
                        </DataGridTemplateColumn>
                        <DataGridTemplateColumn Width="1*">
                            <DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <TextBox Text="{Binding Item2, Mode=OneWay}" Style="{StaticResource DataGridRightColumn}"/>
                                </DataTemplate>
                            </DataGridTemplateColumn.CellTemplate>
                        </DataGridTemplateColumn>
                    </DataGrid.Columns>
                </DataGrid>
                <Separator Visibility="{Binding TimeStampDetailsIsVisible, Converter={StaticResource ConverterBool2Visibility}}" />
                <DockPanel HorizontalAlignment="Center">
                    <Button Content="{x:Static props:Resources.TsDetailsV_ViewTsaCert}" Width="149" Command="{Binding CommandShowTsaCert}"
                            Visibility="{Binding TimeStampDetailsIsVisible, Converter={StaticResource ConverterBool2Visibility}}"/>
                    <Button Content="{x:Static props:Resources.TsDetailsV_SaveReq}" Width="201" Command="{Binding CommandSaveTimeStampRequest}"/>
                    <Button Content="{x:Static props:Resources.TsDetailsV_SaveTsr}" Width="145" Command="{Binding CommandSaveTimeStamp}"/>
                    <Button Content="{x:Static props:Resources.TsDetailsV_SaveTst}" Width="199" Command="{Binding CommandSaveTimeStampToken}"
                            Visibility="{Binding TimeStampDetailsIsVisible, Converter={StaticResource ConverterBool2Visibility}}"/>
                </DockPanel>
            </StackPanel>
        </Grid>
    </ScrollViewer>
</UserControl>
