<Page
      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:System="clr-namespace:System;assembly=mscorlib" x:Class="JAMM.Kasse.Pages.EditUsers" 
      mc:Ignorable="d" 
       d:DesignHeight="786" d:DesignWidth="1024"
	Title="Staff">
    <ScrollViewer>
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="42"/>
                <RowDefinition Height="42"/>
                <RowDefinition />
            </Grid.RowDefinitions>
            <Border Grid.Row="0" Background="White"/>
            <Border Grid.Row="1" Background="White"/>
            <Border BorderBrush="LightGray" BorderThickness="0, 0, 0, 1" Grid.Row="0">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition />
                        <ColumnDefinition />
                        <ColumnDefinition />
                        <ColumnDefinition />
                        <ColumnDefinition />
                    </Grid.ColumnDefinitions>
                    <Label Grid.Column="0" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="18" Content="Name"/>
                    <Label Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="18" Content="Passwort"/>
                    <Label Grid.Column="2" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="18" Content="Passwort"/>
                    <Label Grid.Column="3" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="18" Content="Rolle"/>
                    <Label Grid.Column="4" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="18" Content="Aktionen"/>
                </Grid>
            </Border>
            <Border Grid.Row="1">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition />
                        <ColumnDefinition />
                        <ColumnDefinition />
                        <ColumnDefinition />
                        <ColumnDefinition />
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"></RowDefinition>
                        <RowDefinition></RowDefinition>
                    </Grid.RowDefinitions>
                    <TextBox x:Name="userNameEdit" Grid.Column="0" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="18" Width="200" GotKeyboardFocus="TextBoxGotKeyboardFocus" />
                    <PasswordBox x:Name="userPasswordOneEdit" Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="18" Width="200" GotKeyboardFocus="PasswordBoxGotKeyboardFocus" />
                    <PasswordBox x:Name="userPasswordTwoEdit" Grid.Column="2" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="18" Width="200" GotKeyboardFocus="PasswordBoxGotKeyboardFocus1" />
                    <ComboBox x:Name="userRoleBox" Grid.Column="3" HorizontalAlignment="Left" VerticalAlignment="Center" VerticalContentAlignment="Center" IsReadOnly="True"  Width="200" Height="30" Margin="0,0,0,0" GotKeyboardFocus="ComboBoxGotKeyboardFocus"/>
                    <Button Grid.Column="4" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="18" Width="150" Click="addUser" Content="hinzufügen" />
                    <Label x:Name="wrongUserName" Grid.Column="0" Grid.Row="0" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="14" Content="Username schon vergeben!" Visibility="Hidden"></Label>
                    <Label x:Name="wrongUserPW" Grid.Column="1" Grid.Row="0" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="14" Content="Passwörter nicht identisch!" Visibility="Hidden"></Label>
                    <Label x:Name="wrongUserFields" Grid.Column="2" Grid.Row="0" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="14" Content="Bitte alle Felder ausfüllen!" Visibility="Hidden"></Label>
                </Grid>
            </Border>
            <ItemsControl x:Name="UserView" Grid.Row="2">
                <ItemsControl.ItemTemplate>
                    <DataTemplate>
                        <Border BorderBrush="LightGray" BorderThickness="0, 1, 0, 1">
                            <Grid Margin="10">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition />
                                    <ColumnDefinition />
                                    <ColumnDefinition />
                                    <ColumnDefinition />
                                    <ColumnDefinition />
                                </Grid.ColumnDefinitions>
                                <TextBlock Text="{Binding UserName}" Grid.Column="0" VerticalAlignment="Center" Width="200" FontSize="18"/>
                                <TextBlock Text="" Grid.Column="1" VerticalAlignment="Center" FontSize="18" Width="200"/>
                                <TextBlock Text="" Grid.Column="2" VerticalAlignment="Center" FontSize="18" Width="200"/>
                                <TextBlock Text="{Binding RoleToString}" Grid.Column="3" VerticalAlignment="Center" Width="200" FontSize="18"/>
                                <Button Content="löschen" Grid.Column="5" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="18"  Width="150" Click="deleteUser" x:Name="deleteUserButton" Margin="5,0,0,0"/>
                            </Grid>
                        </Border>
                    </DataTemplate>
                </ItemsControl.ItemTemplate>
            </ItemsControl>
        </Grid>
    </ScrollViewer>
</Page>