<Page x:Class="SkyTeam.BuchungenPage"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:iconPacks="http://metro.mahapps.com/winfx/xaml/iconpacks"
      xmlns:properties="clr-namespace:SkyTeam"
      Title="BuchungenPage"
      Background="{DynamicResource PageBackground}">

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="180"/>
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>

        <Border Grid.Row="0" Grid.ColumnSpan="2" Background="#FF1E88E5" Padding="15">
            <StackPanel Orientation="Horizontal">
                <Ellipse Width="36" Height="36" Fill="White" Margin="0,0,10,0"/>
                <StackPanel>
                    <TextBlock Text="{x:Static properties:Resources.HeaderTitle}" FontSize="20" FontWeight="Bold" Foreground="White"/>
                    <TextBlock Text="{x:Static properties:Resources.HeaderSubtitle}" FontSize="12" Foreground="White"/>
                </StackPanel>
            </StackPanel>
        </Border>

        <StackPanel Grid.Row="1" Grid.Column="0" Background="{DynamicResource SidebarBackground}">

            <Button Height="50" Margin="5" Click="HomeButton_Click" Background="Transparent" BorderThickness="0">
                <StackPanel Orientation="Horizontal">
                    <iconPacks:PackIconMaterial Kind="Home" Width="20" Margin="0,0,10,0" Foreground="{DynamicResource PrimaryText}"/>
                    <TextBlock Text="{x:Static properties:Resources.SidebarHome}" Foreground="{DynamicResource PrimaryText}"/>
                </StackPanel>
            </Button>

            <Button Height="50" Margin="5" Click="BookingsButton_Click" Background="{DynamicResource CardBackground}" BorderThickness="0">
                <StackPanel Orientation="Horizontal">
                    <iconPacks:PackIconMaterial Kind="Airplane" Width="20" Margin="0,0,10,0" Foreground="{DynamicResource PrimaryText}"/>
                    <TextBlock Text="{x:Static properties:Resources.SidebarBookings}" FontWeight="Bold" Foreground="{DynamicResource PrimaryText}"/>
                </StackPanel>
            </Button>

            <Button Height="50" Margin="5" Click="SettingsButton_Click" Background="Transparent" BorderThickness="0">
                <StackPanel Orientation="Horizontal">
                    <iconPacks:PackIconMaterial Kind="Cog" Width="20" Margin="0,0,10,0" Foreground="{DynamicResource PrimaryText}"/>
                    <TextBlock Text="{x:Static properties:Resources.SidebarSettings}" Foreground="{DynamicResource PrimaryText}"/>
                </StackPanel>
            </Button>

            <Button Height="50" Margin="5" Background="#FFEBEB" BorderBrush="#FFB71C1C" Foreground="#D32F2F" FontWeight="Bold" Click="LogoutButton_Click">
                <StackPanel Orientation="Horizontal">
                    <iconPacks:PackIconMaterial Kind="Logout" Width="20" Margin="0,0,10,0"/>
                    <TextBlock Text="{x:Static properties:Resources.SidebarLogout}"/>
                </StackPanel>
            </Button>
        </StackPanel>

        <Grid Grid.Row="1" Grid.Column="1" Margin="30">
            <StackPanel>
                <TextBlock Text="{x:Static properties:Resources.SidebarBookings}" FontSize="28" FontWeight="Bold" Foreground="{DynamicResource PrimaryText}"/>
                <TextBlock Text="{x:Static properties:Resources.FlightOverviewTitle}" FontSize="16" Foreground="{DynamicResource SecondaryText}" Margin="0,0,0,20"/>

                <Border x:Name="NoBookingsView" Visibility="Visible" Background="{DynamicResource CardBackground}" CornerRadius="12" Padding="40">
                    <StackPanel HorizontalAlignment="Center">
                        <iconPacks:PackIconMaterial Kind="AirplaneOff" Width="50" Height="50" Foreground="#888"/>
                        <TextBlock Text="{x:Static properties:Resources.NoFlightReserved}" FontSize="18" Margin="0,15,0,5" TextAlignment="Center" Foreground="{DynamicResource PrimaryText}"/>
                        <Button Content="{x:Static properties:Resources.ReserveNow}" Width="180" Height="45" Background="#FF1E88E5" Foreground="White" FontWeight="Bold" Margin="0,20,0,0" Click="OpenReservierungSuche_Click"/>
                    </StackPanel>
                </Border>

                <DataGrid x:Name="BookingsGrid" 
                          Visibility="Collapsed" 
                          AutoGenerateColumns="False" 
                          CanUserAddRows="False" 
                          IsReadOnly="True" 
                          Height="400" 
                          Background="{DynamicResource CardBackground}"
                          SelectionMode="Single">
                    <DataGrid.Columns>
                        <DataGridTextColumn Header="{x:Static properties:Resources.BookingIdLabel}" Binding="{Binding BuchungId}" Width="100"/>
                        <DataGridTextColumn Header="{x:Static properties:Resources.FlightNumberShortLabel}" Binding="{Binding Flugnummer}" Width="*"/>
                        <DataGridTextColumn Header="{x:Static properties:Resources.PrepositionVon}" Binding="{Binding Abflugort}" Width="*"/>
                        <DataGridTextColumn Header="{x:Static properties:Resources.To}" Binding="{Binding Zielort}" Width="*"/>
                        <DataGridTextColumn Header="{x:Static properties:Resources.DateLabel}" Binding="{Binding Abflugdatum}" Width="*"/>
                        <DataGridTextColumn Header="{x:Static properties:Resources.StatusLabel}" Binding="{Binding Status}" Width="100"/>
                    </DataGrid.Columns>
                </DataGrid>

                <Button x:Name="CancelBtn" Visibility="Collapsed" Content="{x:Static properties:Resources.CancelFlightButton}" Background="#D32F2F" Foreground="White" FontWeight="Bold" Width="150" Height="40" HorizontalAlignment="Right" Margin="0,15,0,0" Click="CancelBooking_Click"/>
                <Button x:Name="CreatePdfBtn" Visibility="Collapsed" Content="{x:Static properties:Resources.CreatePdfButton}" Background="#FF1E88E5" Foreground="White" FontWeight="Bold" Width="150" Height="40" HorizontalAlignment="Right" Margin="0,15,0,0" Click="CreatePdf_Click"/>
            </StackPanel>
        </Grid>
    </Grid>
</Page>