<local:ContextWindow
        x:Class="Elwig.Windows.PaymentVariantsWindow"
        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:local="clr-namespace:Elwig.Windows"
        xmlns:ctrl="clr-namespace:Elwig.Controls"
        mc:Ignorable="d"
        Title="Auszahlungsvarianten - Elwig" Height="510" Width="820" MinHeight="500" MinWidth="820">
    <Window.Resources>
        <Style TargetType="Label">
            <Setter Property="HorizontalAlignment" Value="Left"/>
            <Setter Property="VerticalAlignment" Value="Top"/>
            <Setter Property="Padding" Value="2,4,2,4"/>
            <Setter Property="Height" Value="25"/>
        </Style>
        <Style TargetType="TextBox">
            <Setter Property="HorizontalAlignment" Value="Stretch"/>
            <Setter Property="VerticalAlignment" Value="Top"/>
            <Setter Property="FontSize" Value="14"/>
            <Setter Property="Padding" Value="2"/>
            <Setter Property="Height" Value="25"/>
            <Setter Property="TextWrapping" Value="NoWrap"/>
        </Style>
        <Style TargetType="ComboBox">
            <Setter Property="Height" Value="25"/>
            <Setter Property="FontSize" Value="14"/>
            <Setter Property="HorizontalAlignment" Value="Stretch"/>
            <Setter Property="VerticalAlignment" Value="Top"/>
        </Style>
        <Style TargetType="Button">
            <Setter Property="FontSize" Value="14"/>
            <Setter Property="Padding" Value="9,3"/>
            <Setter Property="Height" Value="27"/>
        </Style>
    </Window.Resources>
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="320"/>
            <ColumnDefinition Width="100"/>
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
            <RowDefinition Height="220"/>
        </Grid.RowDefinitions>

        <ListBox x:Name="PaymentVariantList" Margin="10,10,35,10" Grid.RowSpan="2" SelectionChanged="PaymentVariantList_SelectionChanged">
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text="{Binding Name}" Width="200"/>
                        <TextBlock Text="{Binding Date}" Width="60"/>
                    </StackPanel>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
        <Button x:Name="AddButton" Content="&#xF8AA;" FontFamily="Segoe MDL2 Assets" FontSize="11" Padding="0,1.5,0,0" ToolTip="Neue Auszahlungsvariante hinzufügen"
                VerticalAlignment="Center" HorizontalAlignment="Right" Width="25" Height="25" Margin="5,0,5,60" Grid.RowSpan="2"
                Click="AddButton_Click"/>
        <Button x:Name="CopyButton" Content="&#xE8C8;" FontFamily="Segoe MDL2 Assets" FontSize="12" Padding="0,0,0,0" IsEnabled="False" ToolTip="Ausgewählte Auszahlungsvariante duplizieren"
                VerticalAlignment="Center" HorizontalAlignment="Right" Width="25" Height="25" Margin="5,0,5,0" Grid.RowSpan="2"
                Click="CopyButton_Click"/>
        <Button x:Name="DeleteButton" Content="&#xF8AB;" FontFamily="Segoe MDL2 Assets" FontSize="11" Padding="0,1.5,0,0" IsEnabled="False" ToolTip="Ausgewählte Auszahlungsvariante löschen"
                VerticalAlignment="Center" HorizontalAlignment="Right" Width="25" Height="25" Margin="5,60,5,0" Grid.RowSpan="2"
                Click="DeleteButton_Click"/>

        <TextBox x:Name="DataInput" Margin="10,200,35,10" Grid.Column="0" Grid.RowSpan="2"
                 HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Height="auto"
                 AcceptsReturn="True" VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Auto"
                 FontFamily="Cascadia Code Light" FontSize="13"
                 TextChanged="DataInput_TextChanged"/>

        <Label Content="Name:" Margin="10,10,0,0" Grid.Column="1"/>
        <TextBox x:Name="NameInput" Width="200" Grid.Column="2" HorizontalAlignment="Left" Margin="0,10,0,0"
                 TextChanged="NameInput_TextChanged"/>

        <Label Content="Beschreibung:" Margin="10,40,0,0" Grid.Column="1"/>
        <TextBox x:Name="CommentInput" Grid.Column="2" HorizontalAlignment="Stretch" Margin="0,40,10,0"
                 TextChanged="CommentInput_TextChanged"/>

        <Label Content="Erstellt am:" Margin="10,70,0,0" Grid.Column="1"/>
        <TextBox x:Name="DateInput" Grid.Column="2" Width="77" HorizontalAlignment="Left" Margin="0,70,10,0" IsReadOnly="True"/>

        <Label Content="Überwiesen am:" Margin="10,100,0,0" Grid.Column="1"/>
        <TextBox x:Name="TransferDateInput" Grid.Column="2" Width="77" HorizontalAlignment="Left" Margin="0,100,10,0"
                 TextChanged="TransferDateInput_TextChanged"/>

        <Label Content="Rebelzuschlag:" Margin="10,130,0,0" Grid.Column="1"/>
        <ctrl:UnitTextBox x:Name="WeightModifierInput" Grid.Column="2" Width="60" Margin="0,130,10,0" Unit="%"
                          HorizontalAlignment="Left" VerticalAlignment="Top"
                          TextChanged="WeightModifierInput_TextChanged" LostFocus="WeightModifierInput_LostFocus"/>

        <Label Content="Berücksichtigen:" Margin="90,70,10,10" Grid.Column="2"/>
        <CheckBox x:Name="ConsiderModifiersInput" Content="Zu-/Abschläge bei Lieferungen"
                  Margin="110,95,10,10" Grid.Column="2" HorizontalAlignment="Left" VerticalAlignment="Top"
                  Checked="ConsiderModifiersInput_Changed" Unchecked="ConsiderModifiersInput_Changed"/>
        <CheckBox x:Name="ConsiderPenaltiesInput" Content="Pönalen bei Unterlieferungen (FB)"
                  Margin="110,115,10,10" Grid.Column="2" HorizontalAlignment="Left" VerticalAlignment="Top"
                  Checked="ConsiderPenaltiesInput_Changed" Unchecked="ConsiderPenaltiesInput_Changed"/>
        <CheckBox x:Name="ConsiderPenaltyInput" Content="Strafen bei Unterlieferungen (GA)"
                  Margin="110,135,10,10" Grid.Column="2" HorizontalAlignment="Left" VerticalAlignment="Top"
                  Checked="ConsiderPenaltyInput_Changed" Unchecked="ConsiderPenaltyInput_Changed"/>
        <CheckBox x:Name="ConsiderAutoInput" Content="Automatische Nachzeichnungen der GA"
                  Margin="110,155,10,10" Grid.Column="2" HorizontalAlignment="Left" VerticalAlignment="Top"
                  Checked="ConsiderAutoInput_Changed" Unchecked="ConsiderAutoInput_Changed"/>
        <Label Content="&#xF0AE;" FontFamily="Segoe MDL2 Assets" FontSize="16" Grid.Row="0" Grid.Column="2" Margin="108,175,10,10"/>

        <Grid Grid.Column="1" Grid.ColumnSpan="2" VerticalAlignment="Bottom" HorizontalAlignment="Center" Margin="10,10,10,10">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="110"/>
                <ColumnDefinition Width="27"/>
                <ColumnDefinition Width="110"/>
                <ColumnDefinition Width="27"/>
                <ColumnDefinition Width="110"/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="27"/>
                <RowDefinition Height="5"/>
                <RowDefinition Height="27"/>
            </Grid.RowDefinitions>

            <Grid.Resources>
                <Style TargetType="Label">
                    <Setter Property="HorizontalAlignment" Value="Center"/>
                    <Setter Property="VerticalAlignment" Value="Center"/>
                    <Setter Property="Padding" Value="0"/>
                    <Setter Property="Height" Value="auto"/>
                </Style>
                <Style TargetType="Button">
                    <Setter Property="HorizontalAlignment" Value="Stretch"/>
                    <Setter Property="FontSize" Value="14"/>
                </Style>
            </Grid.Resources>

            <Button x:Name="ModifierButton" Content="Zu-/Abschläge" Grid.Column="0" Grid.Row="0"
                    Click="ModifierButton_Click"/>
            <Label Content="&#xF0AF;" FontFamily="Segoe MDL2 Assets" FontSize="16" Grid.Row="0" Grid.Column="1" RenderTransformOrigin="0.5,0.5" >
                <Label.RenderTransform>
                    <TransformGroup>
                        <RotateTransform Angle="45"/>
                        <TranslateTransform Y="5"/>
                    </TransformGroup>
                </Label.RenderTransform>
            </Label>
            <Button x:Name="EditButton" Content="Bearbeiten" Grid.Column="0" Grid.Row="2"
                    Click="EditButton_Click"/>
            <Label Content="&#xF0AF;" FontFamily="Segoe MDL2 Assets" FontSize="16" Grid.Row="2" Grid.Column="1"/>
            <Button x:Name="CalculateButton" Content="Berechnen" Grid.Column="2" Grid.Row="2"
                    Click="CalculateButton_Click"/>
            <Label Content="&#xF0AF;" FontFamily="Segoe MDL2 Assets" FontSize="16" Grid.Row="2" Grid.Column="3" x:Name="Arrow3"/>
            <Button x:Name="CommitButton" Content="Festsetzen" Grid.Column="4" Grid.Row="2"
                    Click="CommitButton_Click"/>
            <Button x:Name="RevertButton" Content="Freigeben" Grid.Column="4" Grid.Row="2"
                    Click="RevertButton_Click"/>
            <Button x:Name="SaveButton" Content="Speichern" Grid.Column="4" Grid.Row="0"
                    Click="SaveButton_Click"/>
        </Grid>

        <Grid Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="2">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="250"/>
            </Grid.ColumnDefinitions>

            <GroupBox Header="Abschluss" Margin="10,0,5,10">
                <Grid>
                    <Button x:Name="ExportButton" Content="Exportieren" FontSize="14" Width="180" Margin="10,10,10,10" Height="27" IsEnabled="False"
                            Click="ExportButton_Click"
                            VerticalAlignment="Top" HorizontalAlignment="Left"/>
                    <Button x:Name="TransactionButton" Content="Buchungsliste" FontSize="14" Width="180" Margin="10,42,10,10" Height="27" IsEnabled="False"
                            Click="TransactionButton_Click"
                            VerticalAlignment="Top" HorizontalAlignment="Left"/>
                    <Button x:Name="MailButton" Content="Traubengutschriften" FontSize="14" Width="180" Margin="10,74,10,10" Height="27" IsEnabled="False"
                            Click="MailButton_Click"
                            VerticalAlignment="Top" HorizontalAlignment="Left"/>
                </Grid>
            </GroupBox>

            <GroupBox Header="Ergebnis" Margin="5,0,10,10" Grid.Column="1">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="100"/>
                        <ColumnDefinition Width="*"/>
                    </Grid.ColumnDefinitions>
                    <Grid.Resources>
                        <Style TargetType="TextBlock">
                            <Setter Property="Grid.Column" Value="1"/>
                            <Setter Property="VerticalAlignment" Value="Top"/>
                            <Setter Property="FontSize" Value="14"/>
                            <Setter Property="TextAlignment" Value="Right"/>
                        </Style>
                    </Grid.Resources>

                    <Label Content="Zu-/Abschläge:" Margin="10,10,0,0"/>
                    <TextBlock x:Name="ModifierSum" Margin="0,12,10,0"/>

                    <Label Content="Gesamtbeträge:" Margin="10,40,0,0"/>
                    <TextBlock x:Name="TotalSum" Margin="0,42,10,0"/>

                    <Label Content="Mehrwertsteuer:" Margin="10,70,0,0"/>
                    <TextBlock x:Name="VatSum" Margin="0,72,10,0"/>

                    <Label Content="Abzüge:" Margin="10,100,0,0"/>
                    <TextBlock x:Name="DeductionSum" Margin="0,102,10,0"/>

                    <Label Content="Auszuzahlen:" Margin="10,130,0,0"/>
                    <TextBlock x:Name="PaymentSum" Margin="0,132,10,0"/>
                </Grid>
            </GroupBox>
        </Grid>
    </Grid>
</local:ContextWindow>
