<localView:BeWoView x:Class="BeWo.View.Detail.UserView" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:localView="clr-namespace:BeWo.View" xmlns:localSearchView="clr-namespace:BeWo.View.Search" xmlns:uc="clr-namespace:BeWo.Controls;assembly=BeWo.Controls" Height="Auto" Width="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Focusable="True">
	<Grid>
		<uc:ShadowChrome>
			<GroupBox Style="{StaticResource MainContentGroupBoxStyle}">
				<GroupBox.Header>
					<StackPanel Orientation="Horizontal" VerticalAlignment="Bottom">
						<Image Source="..\..\Ressources\Icons\UserBusinessMaleDisabled.png" RenderTransformOrigin="0.5,0.5" Stretch="Uniform" Width="32">
							<Image.RenderTransform>
								<TransformGroup>
									<ScaleTransform ScaleX="1" ScaleY="1" />
									<SkewTransform AngleX="0" AngleY="0" />
									<RotateTransform Angle="0" />
									<TranslateTransform X="0" Y="5" />
								</TransformGroup>
							</Image.RenderTransform>
						</Image>
						<TextBox Text="{Binding Path=Employee, Mode=OneWay}" Margin="10,0,0,0" Background="{x:Null}" Foreground="#FFFFFFFF" FontSize="22" BorderBrush="{x:Null}" VerticalAlignment="Bottom" Padding="0,0,0,0" />
					</StackPanel>
				</GroupBox.Header>
				<Grid Margin="0,3,0,0" Background="{DynamicResource ObjectEditBackgroundBrush}">
					<Grid.RowDefinitions>
						<RowDefinition Height="Auto" />
						<RowDefinition Height="*" />
						<RowDefinition Height="Auto" />
					</Grid.RowDefinitions>
					<Rectangle Fill="{DynamicResource UserContentBrush}" Height="6" />
					<TabControl x:Name="root" Grid.Row="1" Style="{StaticResource ObjectEditTabControl}" BorderThickness="0,0,0,0" Padding="4,4,4,4">
						<TabItem Header="Details" IsSelected="True">

							<Grid Name="grid_root" Grid.IsSharedSizeScope="True" Width="Auto">
								<Grid.RowDefinitions>
									<RowDefinition Height="Auto" />
									<RowDefinition Height="Auto" />
									<RowDefinition Height="*" />
								</Grid.RowDefinitions>
								<Grid.ColumnDefinitions>
									<ColumnDefinition Width="450" />
									<ColumnDefinition Width="*" />
								</Grid.ColumnDefinitions>


								<Grid>
									<Grid.ColumnDefinitions>
										<ColumnDefinition Width="Auto" />
										<ColumnDefinition Width="*" />
									</Grid.ColumnDefinitions>
									<Label Content="Mitarbeiter" Grid.Row="0" />
									<uc:PopUpEdit IsReadOnly="True" Grid.Row="0" Grid.Column="1" 
                                                  DeleteButtonVisibility="Visible" Name="popupedit_employee" 
                                                  PopUpClick="popupedit_employee_PopUpClick" DeleteClick="popupedit_employee_DeleteClick" 
                                                  Text="{Binding Path=EmployeeString, Mode=OneWay}" Height="23" Margin="3" Cursor="Arrow" 
                                                  HorizontalAlignment="Stretch" Width="Auto"
                                                  PreviewMouseDoubleClick="Popupedit_employee_OnPreviewMouseDoubleClick"/>
								</Grid>

								<GroupBox Grid.Row="1" Header="Zugangsdaten" Padding="5" Width="Auto" Style="{DynamicResource ObjectEditGroupBox}" Margin="0,15,0,0">
									<Grid>
										<Grid.ColumnDefinitions>
											<ColumnDefinition Width="*" />
											<ColumnDefinition Width="*" />
										</Grid.ColumnDefinitions>
										<Grid.RowDefinitions>
											<RowDefinition Height="Auto" />
										</Grid.RowDefinitions>

										<Grid>

											<Grid.ColumnDefinitions>
												<ColumnDefinition Width="Auto" />
												<ColumnDefinition Width="*" />
											</Grid.ColumnDefinitions>
											<Label Content="Login Name" />
											<TextBox VerticalAlignment="Top" Grid.Column="1" Height="23" Margin="3" Text="{Binding Path=LoginName, UpdateSourceTrigger=PropertyChanged}" />
										</Grid>

										<Grid Name="grid_passworNewUser" Grid.Column="1" Visibility="{Binding Path=IsNew, Converter={StaticResource BoolVisibilityConverter}}">
											<Grid.ColumnDefinitions>
												<ColumnDefinition Width="Auto" />
												<ColumnDefinition Width="*" />
											</Grid.ColumnDefinitions>
											<Grid.RowDefinitions>
												<RowDefinition Height="Auto" />
												<RowDefinition Height="Auto" />
											</Grid.RowDefinitions>
											<Label Content="Passwort" />
											<PasswordBox Name="passwordbox_password" Grid.Column="1" Height="23" Margin="3" />
											<Label Grid.Row="1" Content="Passwort wiederholen" />
											<PasswordBox Name="passwordbox_passwordRepeat" Grid.Column="1" Grid.Row="1" Height="23" Margin="3" />
										</Grid>

										<Grid Grid.Column="1" Name="grid_passwordExistingUser" Visibility="Collapsed">
											<Grid.ColumnDefinitions>
												<ColumnDefinition Width="Auto" />
												<ColumnDefinition Width="*" />
												<ColumnDefinition Width="Auto" />
											</Grid.ColumnDefinitions>
											<Label Content="Passwort" IsEnabled="False" />
											<PasswordBox Grid.Column="1" Height="23" Margin="3" IsEnabled="False" Password="xxxxxxxxxx" />
											<Button Name="button_changePassword" Grid.Column="2" Height="23" HorizontalAlignment="Right" Margin="3" Content="Passwort ändern" Click="button_changePassword_Click" />
										</Grid>


									</Grid>
								</GroupBox>

								<GroupBox Grid.Row="2" Grid.ColumnSpan="2" Header="Benutzergruppen" Padding="5" Style="{DynamicResource ObjectEditGroupBox}" Margin="0,15,0,0">
									<Grid>
										<Grid.ColumnDefinitions>
											<ColumnDefinition Width="*" />
											<ColumnDefinition Width="Auto" />
											<ColumnDefinition Width="*" />
										</Grid.ColumnDefinitions>
										<Grid.RowDefinitions>
											<RowDefinition Height="Auto" />
											<RowDefinition Height="*" />
											<RowDefinition Height="*" />
											<RowDefinition Height="Auto" />
										</Grid.RowDefinitions>
										<Label HorizontalAlignment="Center" Content="gewählte Gruppen" />
										<Label HorizontalAlignment="Center" Grid.Column="3" Content="mögliche Gruppen" />
										<ListBox Name="listbox_groups" Grid.RowSpan="2" Grid.Row="1" ItemsSource="{Binding Path=UserGroups}" IsSynchronizedWithCurrentItem="True" MinHeight="100">
											<ListBox.ItemTemplate>
												<DataTemplate>
													<Grid HorizontalAlignment="Stretch" Margin="3">
														<Grid.ColumnDefinitions>
															<ColumnDefinition Width="*" />
															<ColumnDefinition Width="Auto" />
														</Grid.ColumnDefinitions>
														<Grid.RowDefinitions>
															<RowDefinition Height="Auto" />
															<RowDefinition Height="Auto" />
														</Grid.RowDefinitions>
														<Label VerticalAlignment="Center" Margin="3 0" Padding="0" IsHitTestVisible="False" Content="{Binding Path=Name}" />
														<ToggleButton Grid.Column="1" HorizontalAlignment="Right" Width="14" Height="14" Background="White" Template="{StaticResource ExpanderToggleButton}" IsChecked="{Binding Path=Tag, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Grid}}, Mode=OneWayToSource}" VerticalAlignment="Center" Visibility="{Binding Path=Description, Converter={StaticResource ObjectVisibilityConverter} }" />
														<TextBox HorizontalAlignment="Left" Visibility="{Binding Path=Tag, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Grid}}, Converter={StaticResource BoolVisibilityConverter}}" Grid.Row="1" Grid.ColumnSpan="2" IsHitTestVisible="False" IsReadOnly="True" Cursor="Arrow" TextWrapping="WrapWithOverflow" Margin="10 3" Text="{Binding Path=Description}" BorderThickness="0" Background="Transparent" FontSize="10" />
													</Grid>
												</DataTemplate>
											</ListBox.ItemTemplate>
											<ListBox.ItemContainerStyle>
												<Style>
													<Setter Property="Control.HorizontalContentAlignment" Value="Stretch" />
												</Style>
											</ListBox.ItemContainerStyle>
										</ListBox>
                                        <Button Name="button_addGroup" Grid.Column="1" VerticalAlignment="Bottom" Content="&lt;" FontWeight="Bold" Width="25" Grid.Row="1" Margin="3" Click="button_addGroup_Click" IsEnabled="{Binding Path=SelectedIndex, ElementName=listbox_possibleGroups, Converter={StaticResource IndexBoolConverter}}" Height="25" />
                                        <Button Name="button_removeGroup" Grid.Column="1" Grid.Row="2" VerticalAlignment="Top" Content="&gt;" FontWeight="Bold" Width="25" Margin="3" Click="button_removeGroup_Click" IsEnabled="{Binding Path=SelectedIndex, ElementName=listbox_groups, Converter={StaticResource IndexBoolConverter}}" Height="25" />
                                        <ListBox Name="listbox_possibleGroups" Grid.Row="1" Grid.Column="2" Grid.RowSpan="2" ItemsSource="{Binding Path=PossibleGroups}" IsSynchronizedWithCurrentItem="True" MinHeight="100">
											<ListBox.ItemTemplate>
												<DataTemplate>
													<Grid HorizontalAlignment="Stretch" Margin="3">
														<Grid.ColumnDefinitions>
															<ColumnDefinition Width="*" />
															<ColumnDefinition Width="Auto" />
														</Grid.ColumnDefinitions>
														<Grid.RowDefinitions>
															<RowDefinition Height="Auto" />
															<RowDefinition Height="Auto" />
														</Grid.RowDefinitions>
														<Label VerticalAlignment="Center" Margin="3 0" Padding="0" IsHitTestVisible="False" Content="{Binding Path=Name}" />
														<ToggleButton Grid.Column="1" HorizontalAlignment="Right" Width="14" Height="14" Background="White" Template="{StaticResource ExpanderToggleButton}" IsChecked="{Binding Path=Tag, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Grid}}, Mode=OneWayToSource}" VerticalAlignment="Center" Visibility="{Binding Path=Description, Converter={StaticResource ObjectVisibilityConverter} }" />
														<TextBox HorizontalAlignment="Left" Visibility="{Binding Path=Tag, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Grid}}, Converter={StaticResource BoolVisibilityConverter}}" Grid.Row="1" Grid.ColumnSpan="2" IsHitTestVisible="False" IsReadOnly="True" Cursor="Arrow" TextWrapping="WrapWithOverflow" Margin="10 3" Text="{Binding Path=Description}" BorderThickness="0" Background="Transparent" FontSize="10" />
													</Grid>
												</DataTemplate>
											</ListBox.ItemTemplate>
											<ListBox.ItemContainerStyle>
												<Style>
													<Setter Property="Control.HorizontalContentAlignment" Value="Stretch" />
												</Style>
											</ListBox.ItemContainerStyle>
										</ListBox>
									</Grid>
								</GroupBox>

								<Popup FocusManager.IsFocusScope="True" Grid.Row="3" Margin="10" Grid.ColumnSpan="2" Name="popup_employee" StaysOpen="False" Placement="MousePoint" Width="370" Height="250" Closed="popup_Closed" Opened="popup_Opened">
									<localSearchView:EmployeeSearchView ItemSelected="EmployeeSearchView_EmployeeSelected" x:Name="employeeSearchView" />
								</Popup>

								<Popup FocusManager.IsFocusScope="True" Grid.Row="3" Margin="10" Grid.ColumnSpan="2" Name="popup_changePassword" StaysOpen="False" Placement="MousePoint" Closed="popup_Closed" Opened="popup_Opened">
									<Border Background="{StaticResource ObjectEditBackgroundBrush}" BorderBrush="Black" BorderThickness="1">
										<Grid Name="grid_passworEditExistingUser" Grid.Column="1" Margin="20 3">
											<Grid.ColumnDefinitions>
												<ColumnDefinition Width="Auto" />
												<ColumnDefinition Width="*" />
											</Grid.ColumnDefinitions>
											<Grid.RowDefinitions>
												<RowDefinition Height="Auto" />
												<RowDefinition Height="Auto" />
												<RowDefinition Height="Auto" />
												<RowDefinition Height="Auto" />
												<RowDefinition Height="Auto" />
											</Grid.RowDefinitions>

											<TextBlock Name="textblock_editFailures" Grid.ColumnSpan="2" Foreground="Red" FontSize="12" TextWrapping="Wrap" Margin="3 3 3 10" />

											<Label Name="lblOldPassword" Content="Altes Passwort" Grid.Row="1" />
											<PasswordBox Name="passwordbox_editOldPassword" Grid.Column="1" Grid.Row="1" Height="23" Margin="3" MinWidth="180" />

											<Label Content="Neues Passwort" Grid.Row="2" Margin="0 10 0 0" />
											<PasswordBox Name="passwordbox_editPassword" Grid.Column="1" Grid.Row="2" Height="23" Margin="3 10 3 3" />
											<Label Grid.Row="3" Content="Passwort wiederholen" />
											<PasswordBox Name="passwordbox_editPasswordRepeat" Grid.Column="1" Grid.Row="3" Height="23" Margin="3" />
											<Grid Grid.IsSharedSizeScope="True" Grid.ColumnSpan="2" Grid.Row="4">
												<Grid.ColumnDefinitions>
													<ColumnDefinition Width="Auto" SharedSizeGroup="but" />
													<ColumnDefinition Width="*" />
													<ColumnDefinition Width="Auto" SharedSizeGroup="but" />
												</Grid.ColumnDefinitions>
												<Button Name="button_saveEditPassword" Margin="3 20 3 10" Height="23" HorizontalAlignment="Stretch" Click="button_saveEditPassword_Click" Content="Änderung speichern" Padding="3 0" />
												<Button Name="button_cancelEditPassword" Margin="3 20 3 10" Height="23" Grid.Column="2" HorizontalAlignment="Stretch" Click="button_cancelEditPassword_Click" Content="Abbrechen" Padding="3 0" />
											</Grid>
										</Grid>
									</Border>
								</Popup>

							</Grid>
						</TabItem>
						<TabItem Header="Dokumente" Name="tabitem_documents" Selector.Selected="tabitem_documents_Selected" />

					</TabControl>
					<Border Grid.Row="2" Grid.ColumnSpan="3" Height="40" Margin="0,10,0,0" VerticalAlignment="Stretch" Background="#FF000000">
						<Border.OpacityMask>
							<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
								<GradientStop Color="#19000000" Offset="0" />
								<GradientStop Color="#33FFFFFF" Offset="1" />
							</LinearGradientBrush>
						</Border.OpacityMask>

					</Border>
					<StackPanel Grid.ColumnSpan="3" Grid.Row="2" Orientation="Horizontal" VerticalAlignment="Center" Height="Auto" Margin="5,10,0,0" HorizontalAlignment="Right">
						<Button x:Name="btnSave" Content="Speichern" Margin="0,0,2,0" Command="ApplicationCommands.Save" Height="25" />
						<Button x:Name="btnClose" Content="Schließen" Margin="0,0,3,0" Command="ApplicationCommands.Close" Height="25" />
					</StackPanel>
				</Grid>
			</GroupBox>
		</uc:ShadowChrome>
	</Grid>
</localView:BeWoView>