<localView:BeWoView x:Class="BeWo.View.Detail.AdditionalServiceGroupOfPeopleView"
                    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:val="clr-namespace:BeWo.Validation" 
                    xmlns:sys="clr-namespace:System;assembly=mscorlib"
                    xmlns:shared="clr-namespace:BS.Shared;assembly=BS.Shared"
                    Height="Auto" Width="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Focusable="True" >
    <localView:BeWoView.Resources>
        <ObjectDataProvider MethodName="GetValues"
                        ObjectType="{x:Type sys:Enum}"
                        x:Key="AppointmentDayOfWeeks">
            <ObjectDataProvider.MethodParameters>
                <x:Type TypeName="shared:AppointmentDayOfWeek" />
            </ObjectDataProvider.MethodParameters>
        </ObjectDataProvider>
    </localView:BeWoView.Resources>
  <Grid>
    <GroupBox Style="{StaticResource PopUpWindowStyle}">
      <GroupBox.Header>
        <StackPanel Orientation="Horizontal" VerticalAlignment="Center" Margin="0">
          <Image Source="..\..\Ressources\Icons\UserGroupBusinessDisabled.png" RenderTransformOrigin="0.5,0.5" Width="Auto" Height="28" Margin="0,0,0,0">
            <Image.RenderTransform>
              <TransformGroup>
                <ScaleTransform ScaleX="1" ScaleY="1" />
                <SkewTransform AngleX="0" AngleY="0" />
                <RotateTransform Angle="0" />
                <TranslateTransform X="0" Y="0" />
              </TransformGroup>
            </Image.RenderTransform>
          </Image>
          <TextBlock Text="Gruppe bearbeiten" Margin="10,4,0,0" Background="{x:Null}" Foreground="#FFFFFFFF" FontSize="20"  VerticalAlignment="Stretch" Padding="0,0,0,0" />
        </StackPanel>
      </GroupBox.Header>
      <Grid Margin="0,0,0,0" Background="{DynamicResource ObjectEditBackgroundBrush}">
        <Grid.RowDefinitions>
          <RowDefinition Height="Auto" />
          <RowDefinition Height="*" />
          <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <Rectangle Fill="{DynamicResource TeamContentBrush}" Height="6" />
        <Grid Grid.Row="1" Name="grid_root" Margin="10,10,10,0">
          <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="*" />
          </Grid.ColumnDefinitions>
          <Grid.RowDefinitions>
            <RowDefinition Height="*" />
          </Grid.RowDefinitions>

          <GroupBox Width="200" Header="Alle Gruppen" Style="{StaticResource ObjectEditGroupBox}">
            <Grid >
              <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" />
              </Grid.ColumnDefinitions>
              <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="*" />
              </Grid.RowDefinitions>
              <StackPanel Orientation="Horizontal">
                <Button HorizontalAlignment="Right" Click="btnAddGroup_Click" Height="21"  Margin="0,0,0,3" ToolTip="Neue Gruppe hinzufügen">
                  <Grid>
                    <Grid.ColumnDefinitions>
                      <ColumnDefinition Width="Auto" />
                      <ColumnDefinition Width="*" />
                    </Grid.ColumnDefinitions>
                    <Grid Width="18" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,-2,0,0">
                      <Line X1="4" X2="12" Y1="8" Y2="8" Fill="{x:Null}" Stroke="#FFFFFFFF" StrokeStartLineCap="Round" StrokeEndLineCap="Round" StrokeThickness="2" HorizontalAlignment="Center" VerticalAlignment="Center" Width="16" Height="16" />
                      <Line X1="8" X2="8" Y1="4" Y2="12" Fill="{x:Null}" Stroke="#FFFFFFFF" StrokeStartLineCap="Round" StrokeEndLineCap="Round" StrokeThickness="2" HorizontalAlignment="Center" VerticalAlignment="Center" Width="16" Height="16" />
                    </Grid>
                    <TextBlock Grid.Column="1" Text="Neue Gruppe"></TextBlock>
                  </Grid>

                </Button>
              </StackPanel>
              <ListBox Grid.Row="1" ItemsSource="{Binding VMList}" SelectedItem="{Binding EditVM}" SelectionChanged="groupListBox_SelectionChanged">
                <ListBox.ItemTemplate>
                  <DataTemplate>
                    <StackPanel Orientation="Horizontal">
                      <Button Style="{StaticResource {x:Type Button}}" HorizontalAlignment="Center" VerticalAlignment="Center" Height="18" Padding="0" Width="{Binding RelativeSource={RelativeSource Self}, Path=ActualHeight}" Margin="3 0 0 0" Click="button_removegroup_Click" Tag="{Binding}" ToolTip="Entfernen">
                        <Canvas HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                          <Path Stroke="White" StrokeThickness="1.5" Data="M -3,-3 L 3, 3" StrokeStartLineCap="Round" StrokeEndLineCap="Round" />
                          <Path Stroke="White" StrokeThickness="1.5" Data="M 3,-3 L -3, 3" StrokeStartLineCap="Round" StrokeEndLineCap="Round" />
                        </Canvas>
                      </Button>
                      <Label Margin="3 0 0 3" Padding="0" Content="{Binding Path=Name}" />
                    </StackPanel>
                  </DataTemplate>
                </ListBox.ItemTemplate>
              </ListBox>
            </Grid>
          </GroupBox>

          <Grid Margin="10,0,0,0" Grid.Column="1" DataContext="{Binding EditVM}">
            <Grid.ColumnDefinitions>
              <ColumnDefinition Width="Auto" />
              <ColumnDefinition Width="*" />
              <ColumnDefinition Width="Auto" />
              <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
              <RowDefinition Height="Auto" />
              <RowDefinition Height="Auto" />
              <RowDefinition Height="Auto" />
              <RowDefinition Height="*" />
              <RowDefinition Height="0" />
            </Grid.RowDefinitions>
            <Grid Grid.Column="1" Grid.ColumnSpan="3">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>
                <Label Grid.Column="0" Grid.ColumnSpan="1">Name der Gruppe</Label>
                            <TextBox Grid.Column="1" Grid.ColumnSpan="3" VerticalContentAlignment="Center" Height="23" Margin="3,0,3,0" Text="{val:ValidationBinding Path=Name, UpdateSourceTrigger=PropertyChanged}" />
                <Label Visibility="Collapsed" Grid.Column="2">Intervall</Label>
                <ComboBox Visibility="Collapsed" VerticalContentAlignment="Center" ItemsSource="{Binding Source={StaticResource AppointmentDayOfWeeks}}" SelectedItem="{Binding Path=AppointmentDayOfWeek}" Grid.Column="3"/>
            </Grid>
            <GroupBox Grid.Row="3" Grid.ColumnSpan="4" Header="Mitglieder hinzufügen" Margin="3,15,0,0" Style="{DynamicResource ObjectEditGroupBox}">
              <Grid>
                <Grid.ColumnDefinitions>
                  <ColumnDefinition Width="*" />
                  <ColumnDefinition Width="Auto" />
                  <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                  <RowDefinition Height="Auto" />
                  <RowDefinition Height="*" />
                </Grid.RowDefinitions>

                <Label VerticalAlignment="Bottom">Zugeordnete Klienten</Label>

                <ListBox Name="listbox_teamMember" Grid.Row="1" ItemsSource="{Binding Path=CustomerList}">
                  <ListBox.ItemTemplate>
                    <DataTemplate>
                      <StackPanel Orientation="Horizontal">
                        <Button Style="{StaticResource {x:Type Button}}" HorizontalAlignment="Center" VerticalAlignment="Center" Height="18" Padding="0" Width="{Binding RelativeSource={RelativeSource Self}, Path=ActualHeight}" Margin="3 0 0 0" Click="button_remove_Click" Tag="{Binding}" ToolTip="Entfernen">
                          <Canvas HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                            <Path Stroke="White" StrokeThickness="1.5" Data="M -3,-3 L 3, 3" StrokeStartLineCap="Round" StrokeEndLineCap="Round" />
                            <Path Stroke="White" StrokeThickness="1.5" Data="M 3,-3 L -3, 3" StrokeStartLineCap="Round" StrokeEndLineCap="Round" />
                          </Canvas>
                        </Button>
                        <Label Margin="3 0 0 3" Padding="0" Content="{Binding Path=LastName}" />
                        <Label Margin="0" Padding="0" Content=", " />
                        <Label Margin="0" Padding="0" Content="{Binding Path=FirstName}" />
                      </StackPanel>
                    </DataTemplate>
                  </ListBox.ItemTemplate>
                </ListBox>
                <Button Name="button_add" Grid.Row="2" Grid.Column="1" VerticalAlignment="Center" Height="25" MinWidth="30" Margin="3" ToolTip="Neues Gruppenmitglied hinzufügen" Click="button_add_Click">&lt;-</Button>
                <Label VerticalAlignment="Bottom" Grid.Column="2">Verfügbare Klienten</Label>
                <localSearchView:CustomerSearchView x:Name="CustomerSearchView" IsMultiSelect="True" Grid.Column="2" Grid.Row="1" />
              </Grid>
            </GroupBox>
          </Grid>
        </Grid>

        <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 und schließen" 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>
  </Grid>
</localView:BeWoView>
