<mah:MetroWindow x:Class="ZKuP.ApproveFzg"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        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"
        xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls"
        xmlns:local="clr-namespace:ZKuP"
        mc:Ignorable="d"
        Title="Fahrzeuge genehmigen" Height="450" Width="900" Closing="MetroWindow_Closing" Loaded="MetroWindow_Loaded" LocationChanged="Window_LocationChanged">
    <mah:MetroWindow.Resources>
        <local:IntToGenehmigungsstatus x:Key="IntToGenehmigungsstatus"></local:IntToGenehmigungsstatus>

        <Storyboard x:Key="popDeleted" RepeatBehavior="1x" Completed="Storyboard_Completed">
            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="popDeleted" Storyboard.TargetProperty="(UIElement.Opacity)">
                <EasingDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
                <EasingDoubleKeyFrame KeyTime="00:00:03" Value="0"/>
                <EasingDoubleKeyFrame KeyTime="00:00:04" Value="1"/>
                <EasingDoubleKeyFrame KeyTime="00:00:06" Value="1"/>
                <EasingDoubleKeyFrame KeyTime="00:00:07" Value="0"/>
            </DoubleAnimationUsingKeyFrames>
        </Storyboard>
    </mah:MetroWindow.Resources>
    <Grid>
        <DataGrid x:Name="dgFzg" DataContext="{Binding}" ItemsSource="{Binding ., Mode=OneWay}" CanUserAddRows="False" CanUserDeleteRows="False" IsReadOnly="True" CanUserReorderColumns="False" AutoGenerateColumns="False">
            <DataGrid.Columns>
                <DataGridTextColumn Header="ID" Binding="{Binding idfzgAnmeldung}">
                    <DataGridTextColumn.ElementStyle>
                        <Style TargetType="{x:Type TextBlock}">
                            <Setter Property="TextAlignment" Value="Center"/>
                        </Style>
                    </DataGridTextColumn.ElementStyle>
                </DataGridTextColumn>
                <DataGridTextColumn Header="ID Firma" Binding="{Binding idFirmen}">
                    <DataGridTextColumn.ElementStyle>
                        <Style TargetType="{x:Type TextBlock}">
                            <Setter Property="TextAlignment" Value="Center"/>
                        </Style>
                    </DataGridTextColumn.ElementStyle>
                </DataGridTextColumn>
                <DataGridTextColumn Header="Wunschanz. Fzg" Binding="{Binding AnzahlFzg}">
                    <DataGridTextColumn.ElementStyle>
                        <Style TargetType="{x:Type TextBlock}">
                            <Setter Property="TextAlignment" Value="Center"/>
                        </Style>
                    </DataGridTextColumn.ElementStyle>
                </DataGridTextColumn>
                <DataGridTextColumn Header="User" Binding="{Binding User}" Width="*"/>
                <DataGridTextColumn Header="Email" Binding="{Binding Email}" Width="*"/>
                <DataGridTextColumn Header="Status" Binding="{Binding Genehmigung, Converter={StaticResource IntToGenehmigungsstatus}}" MinWidth="110" Width="*">
                    <DataGridTextColumn.ElementStyle>
                        <Style TargetType="{x:Type TextBlock}">
                            <Setter Property="TextAlignment" Value="Center"/>
                        </Style>
                    </DataGridTextColumn.ElementStyle>
                </DataGridTextColumn>
                <DataGridTemplateColumn MinWidth="130" Width="130">
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <Button Content="Genehmigen" Foreground="Green" FontWeight="Bold" Width="130" Click="ApproveButton_Click"/>
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>
                <DataGridTemplateColumn MinWidth="130" Width="130">
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <Button Content="Ablehnen" Foreground="Red" FontWeight="Bold" Width="130" Click="DeclineButton_Click"/>
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>
                <DataGridTemplateColumn MinWidth="29" Width="31">
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <Button Content="ⓘ" Padding="0,-3,0,0" ToolTip="Firmenbuchung anzeigen" FontSize="20" FontWeight="Bold" Width="29" Height="29" Click="InfoButton_Click"/>
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>
            </DataGrid.Columns>
        </DataGrid>

        <Popup x:Name="pop" AllowsTransparency="True" Closed="pop_Closed">
            <Border BorderThickness="1" BorderBrush="Gray" Background="{DynamicResource {x:Static SystemColors.WindowFrameBrushKey}}">
                <StackPanel Orientation="Vertical" Background="{DynamicResource {x:Static SystemColors.WindowFrameBrushKey}}" Margin="5">
                    <DataGrid x:Name="dgFirmen" Visibility="Visible" ItemsSource="{Binding .}" Height="60" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" CanUserReorderColumns="False" CanUserResizeRows="False" IsReadOnly="True">
                        <DataGrid.Columns>
                            <DataGridTextColumn Header="Name" Binding="{Binding Name}"/>
                            <DataGridTextColumn Header="Verantwortl. MA" Binding="{Binding Verantwortlicher_MA_Firma}"/>
                            <DataGridTextColumn Header="Tel. Firma" Binding="{Binding Tel_Nr_Verantwortlicher_Firma}"/>
                            <DataGridTextColumn Header="Anz. Begleiter" Binding="{Binding Anzahl_Begleiter}">
                                <DataGridTextColumn.ElementStyle>
                                    <Style TargetType="TextBlock">
                                        <Setter Property="HorizontalAlignment" Value="Center"/>
                                    </Style>
                                </DataGridTextColumn.ElementStyle>
                            </DataGridTextColumn>
                            <DataGridTextColumn Header="Beauftragte Leistung" Binding="{Binding Beauftragte_Leistung}"/>
                            <DataGridTextColumn Header="Arbeitsbeginn" Binding="{Binding Arbeitsbeginn, StringFormat=\{0:dd.MM.yyyy\}}">
                                <DataGridTextColumn.ElementStyle>
                                    <Style TargetType="TextBlock">
                                        <Setter Property="HorizontalAlignment" Value="Center"/>
                                    </Style>
                                </DataGridTextColumn.ElementStyle>
                            </DataGridTextColumn>
                            <DataGridTextColumn Header="Arbeitsende" Binding="{Binding Arbeitsende, StringFormat=\{0:dd.MM.yyyy\}}">
                                <DataGridTextColumn.ElementStyle>
                                    <Style TargetType="TextBlock">
                                        <Setter Property="HorizontalAlignment" Value="Center"/>
                                    </Style>
                                </DataGridTextColumn.ElementStyle>
                            </DataGridTextColumn>
                            <DataGridTextColumn Header="Ansprechpartner intern" Binding="{Binding Ansprechpartner_Intern}"/>
                            <DataGridTextColumn Header="Tel. Ansprechpartner" Binding="{Binding Tel_Nr_Ansprechpartner_Intern}"/>
                            <DataGridTextColumn Header="BE" Binding="{Binding BE}"/>
                        </DataGrid.Columns>
                    </DataGrid>
                </StackPanel>
            </Border>
        </Popup>


        <Border x:Name="popDeleted" Visibility="Collapsed" CornerRadius="10" VerticalAlignment="Bottom" Margin="10" Background="{DynamicResource {x:Static SystemColors.WindowFrameBrushKey}}" Height="40">
            <TextBlock x:Name="tbDeleted" VerticalAlignment="Center" FontSize="16" Foreground="White" Text="xx alte Einträge (älter als 30 Tage) wurden gelöscht" TextAlignment="Center"/>
        </Border>
    </Grid>
</mah:MetroWindow>
