<localView:BeWoView 
    x:Class="BeWo.View.Detail.CustomerView2" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:uc="clr-namespace:BeWo.Controls;assembly=BeWo.Controls" 
    xmlns:val="clr-namespace:BeWo.Validation" 
    xmlns:localView="clr-namespace:BeWo.View" 
    xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid" 
    xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors" 
	xmlns:localSearchView="clr-namespace:BeWo.View.Search" 
	xmlns:r="clr-namespace:BeWo.Security" 
	Height="Auto" Width="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Focusable="True" GotFocus="UserControl_GotFocus">
	<localView:BeWoView.Triggers>
		<EventTrigger RoutedEvent="FrameworkElement.Loaded" />
	</localView:BeWoView.Triggers>
	<Grid x:Name="root">
		<Grid.Resources>
			<dxg:GridControl x:Key="grid_costBearer" VerticalAlignment="Stretch" DataSource="{Binding Path=CostBearers.VMList}" HorizontalAlignment="Stretch">
				<dxg:GridControl.Columns>
					<dxg:GridColumn FieldName="Notice" Header="" FixedWidth="True" Width="24" ReadOnly="True">
						<dxg:GridColumn.CellTemplate>
							<DataTemplate>
								<Button Content="r" FontFamily="Webdings" Click="Button_deleteCostBearerClick" Width="18" Height="18" VerticalAlignment="Center" />
							</DataTemplate>
						</dxg:GridColumn.CellTemplate>
					</dxg:GridColumn>
					<dxg:GridColumn x:Name="gridcolumn_costbearer" AllowEditing="False" FieldName="CostBearer" Header="Kostenträger" Width="150" />
					<dxg:GridColumn FieldName="ReferenceNumber" Header="Aktenzeichen des Klienten" Width="200" />
					<dxg:GridColumn FieldName="Notice" Header="Notiz" Width="250" />
				</dxg:GridControl.Columns>
				<dxg:GridControl.View>
					<dxg:TableView AutoWidth="true" ShowGroupPanel="False" ShowGroupedColumns="false" ShowTotalSummary="False" NavigationStyle="Cell" />
				</dxg:GridControl.View>
			</dxg:GridControl>

			<dxg:GridControl VerticalAlignment="Stretch" DataSource="{Binding Path=EmployeeRelations.VMList}" HorizontalAlignment="Stretch" x:Key="datagrid_EmployeeRelation">
				<dxg:GridControl.Columns>
					<dxg:GridColumn FieldName="Notice" Header="" FixedWidth="True" Width="24" ReadOnly="True">
						<dxg:GridColumn.CellTemplate>
							<DataTemplate>
								<Button Content="r" FontFamily="Webdings" Click="button_removeEmployeeRelation_Click" Width="18" Height="18" VerticalAlignment="Center" />
							</DataTemplate>
						</dxg:GridColumn.CellTemplate>
					</dxg:GridColumn>
					<dxg:GridColumn AllowEditing="False" FieldName="Employee" Header="Betreuer(in)" Width="150" />
					<dxg:GridColumn x:Name="gridcolumn_employeerole" FieldName="Role" Header="Rolle" Width="200" />
					<dxg:GridColumn FieldName="Notice" Header="Erläuterung" Width="250" />
				</dxg:GridControl.Columns>
				<dxg:GridControl.View>
					<dxg:TableView AutoWidth="true" ShowGroupPanel="False" ShowGroupedColumns="false" ShowTotalSummary="False" NavigationStyle="Cell" />
				</dxg:GridControl.View>
			</dxg:GridControl>

      <dxg:GridControl VerticalAlignment="Stretch" DataSource="{Binding Path=TeamRelations.VMList}" HorizontalAlignment="Stretch" x:Key="datagrid_TeamRelation" >
          <dxg:GridControl.Columns>
              <dxg:GridColumn FieldName="Notice" Header="" FixedWidth="True" Width="24" ReadOnly="True" >
                  <dxg:GridColumn.CellTemplate>
                      <DataTemplate>
                          <Button Content="r"  FontFamily="Webdings" Click="button_removeTeamRelation_Click" Width="18" Height="18" VerticalAlignment="Center"/>
                      </DataTemplate>
                  </dxg:GridColumn.CellTemplate>
              </dxg:GridColumn>
              <dxg:GridColumn AllowEditing="False" FieldName="Team" Header="Team" Width="150" />
          </dxg:GridControl.Columns>
          <dxg:GridControl.View>
              <dxg:TableView AutoWidth="true" ShowGroupPanel="False"  ShowGroupedColumns="false" ShowTotalSummary="False" NavigationStyle="Cell"   />
          </dxg:GridControl.View>
      </dxg:GridControl>
            
			<dxg:GridControl VerticalAlignment="Stretch" Grid.Column="0" Grid.Row="1" Grid.ColumnSpan="7" DataSource="{Binding Path=AbsenceTimes.VMList}" HorizontalAlignment="Stretch" x:Key="datagrid_absences">
				<dxg:GridControl.Columns>
					<dxg:GridColumn FieldName="Notice" Header="" FixedWidth="True" Width="24" ReadOnly="True">
						<dxg:GridColumn.CellTemplate>
							<DataTemplate>
								<Button Content="r" Click="button_removeAbsence_Click" FontFamily="Webdings" Width="18" Height="18" VerticalAlignment="Center" />
							</DataTemplate>
						</dxg:GridColumn.CellTemplate>
					</dxg:GridColumn>
					<dxg:GridColumn FieldName="Start" Header="von" Width="150" EditSettings="{dxe:DateSettings DisplayFormat=d}" />
					<dxg:GridColumn FieldName="End" Header="bis" Width="150">
                        <dxg:GridColumn.EditSettings>
                            <dxe:DateSettings AllowNullInput="True" >
                                
                            </dxe:DateSettings>
                        </dxg:GridColumn.EditSettings>
                    </dxg:GridColumn>
					<!--<dxg:GridColumn x:Name="gridcolumn_absencereason" FieldName="Reason" Header="Kategorie" Width="150" />-->
					<dxg:GridColumn FieldName="Notice" Header="Erläuterung" Width="250" />
				</dxg:GridControl.Columns>
				<dxg:GridControl.View>
					<dxg:TableView AutoWidth="true" ShowGroupPanel="False" ShowGroupedColumns="false" ShowTotalSummary="False" NavigationStyle="Cell" />
				</dxg:GridControl.View>
			</dxg:GridControl>

			<dxg:GridControl VerticalAlignment="Stretch" DataSource="{Binding Path=EnvironmentPersons.VMList}" HorizontalAlignment="Stretch" x:Key="grid_PersonRelations">

				<dxg:GridControl.Columns>
					<dxg:GridColumn FieldName="Notice" Header="" FixedWidth="True" Width="24" ReadOnly="True">
						<dxg:GridColumn.CellTemplate>
							<DataTemplate>
								<Button Content="r" Click="button_environmentPersonDeleteClick" FontFamily="Webdings" Width="18" Height="18" VerticalAlignment="Center" />
							</DataTemplate>
						</dxg:GridColumn.CellTemplate>
					</dxg:GridColumn>
					<dxg:GridColumn FieldName="PersonString" Header="Person" Width="150" AllowEditing="False" />
					<dxg:GridColumn x:Name="gridcolumn_evironmentroleperson" FieldName="Role" Header="Rolle" Width="150" />
                    <dxg:GridColumn FieldName="AddressSummaryInfo" Header="Adresse" Width="150" />
                    <dxg:GridColumn FieldName="ContactSummaryInfo" Header="Kontaktdaten" Width="150" />
					<dxg:GridColumn FieldName="Notice" Header="Notiz" Width="250" />
				</dxg:GridControl.Columns>
				<dxg:GridControl.View>
					<dxg:TableView AutoWidth="true" ShowGroupPanel="False" ShowGroupedColumns="false" ShowTotalSummary="False" NavigationStyle="Cell" />
				</dxg:GridControl.View>
			</dxg:GridControl>

      <dxg:GridControl VerticalAlignment="Stretch" DataSource="{Binding Path=EnvironmentOrganisations.VMList}" HorizontalAlignment="Stretch" x:Key="grid_OrganisationRelations">

          <dxg:GridControl.Columns>
              <dxg:GridColumn FieldName="Notice" Header="" FixedWidth="True" Width="24" ReadOnly="True">
                  <dxg:GridColumn.CellTemplate>
                      <DataTemplate>
                          <Button Content="r" Click="button_environmentOrganisationDeleteClick" FontFamily="Webdings" Width="18" Height="18" VerticalAlignment="Center" />
                      </DataTemplate>
                  </dxg:GridColumn.CellTemplate>
              </dxg:GridColumn>
              <dxg:GridColumn FieldName="OrganisationString" Header="Organisation" Width="150" AllowEditing="False" />
              <dxg:GridColumn x:Name="gridcolumn_evironmentroleorganisation" FieldName="Role" Header="Rolle" Width="150" />
              <dxg:GridColumn FieldName="AddressSummaryInfo" Header="Adresse" Width="150" />
              <dxg:GridColumn FieldName="ContactSummaryInfo" Header="Kontaktdaten" Width="150" />
              <dxg:GridColumn FieldName="Info1" Header="Info" Width="200" />
              <dxg:GridColumn FieldName="Notice" Header="Notiz" Width="250" />
          </dxg:GridControl.Columns>
          <dxg:GridControl.View>
              <dxg:TableView AutoWidth="true" ShowGroupPanel="False" ShowGroupedColumns="false" ShowTotalSummary="False" NavigationStyle="Cell" />
          </dxg:GridControl.View>
      </dxg:GridControl>

    </Grid.Resources>
		<uc:ShadowChrome>
			<GroupBox Style="{DynamicResource MainContentGroupBoxStyle}">
				<GroupBox.Header>
					<StackPanel Orientation="Horizontal" VerticalAlignment="Bottom">
						<Image Source="..\..\Ressources\Icons\UserHomeMaleDisabled.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 FirstName}" Margin="10,0,0,0" Background="{x:Null}" Foreground="#FFFFFFFF" FontSize="22" BorderBrush="{x:Null}" VerticalAlignment="Bottom" Padding="0,0,0,0" />
						<TextBox Text="{Binding LastName}" Margin="3,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="Auto" />
						<RowDefinition Height="*" />
            <RowDefinition Height="Auto" />
					</Grid.RowDefinitions>
					<Rectangle Fill="{StaticResource CustomerContentBrush}" Height="6" />
					<TabControl x:Name="tabroot" Grid.Row="1" Style="{StaticResource ObjectEditTabControl}" BorderThickness="0,0,0,0" Padding="4,4,4,4">
						<TabItem Header="Details" IsSelected="True" Name="tabitem_details">
							<ScrollViewer VerticalScrollBarVisibility="Auto">
								<Grid x:Name="grid_details">
									<Grid.ColumnDefinitions>
										<ColumnDefinition Width="*" />
										<ColumnDefinition Width="*" />
										<ColumnDefinition Width="*" />
									</Grid.ColumnDefinitions>
									<Grid.RowDefinitions>
										<RowDefinition Height="Auto" MinHeight="136" />
										<RowDefinition Height="*" MinHeight="165" />
										<RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="*" />
									</Grid.RowDefinitions>

									<GroupBox Grid.ColumnSpan="3" Header="Eigenschaften" Style="{StaticResource ObjectEditGroupBox}">
										<Grid>

											<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="Auto" />
												<RowDefinition Height="Auto" />
												<RowDefinition Height="*" />
											</Grid.RowDefinitions>

											<Label Grid.Column="0" Grid.Row="0" Content="Vorname" />
											<Label Grid.Column="0" Grid.Row="1" Content="Nachname" />
											<!--<Label x:Name="lblAktenzeichen" Grid.Column="0" Grid.Row="2" Content="Aktenzeichen" />-->
                                            <Grid x:Name="panelDebitor" Grid.Column="0" Grid.Row="4" Grid.ColumnSpan="2" >
                                                <Grid.ColumnDefinitions>
                                                    <ColumnDefinition Width="Auto" />
                                                    <ColumnDefinition Width="*" />
                                                    <ColumnDefinition Width="Auto" />
                                                    <ColumnDefinition Width="*" />
                                                </Grid.ColumnDefinitions>
                                                <Label x:Name="lblDebitorNumber" Content="Debitor Nr." />
                                                <TextBox x:Name="txtDebitorNumber" Grid.Column="1" Margin="7,3,3,3" Height="23" Text="{val:ValidationBinding Path=DebitorNumber, UpdateSourceTrigger=PropertyChanged}" />
                                                <Label x:Name="lblCostCenter" Grid.Column="2" Content="Kostenstelle" />
                                                <TextBox x:Name="txtCostCenter" Grid.Column="3" Margin="7,3,3,3" Height="23" Text="{val:ValidationBinding Path=CostCenter, UpdateSourceTrigger=PropertyChanged}" />
                                            </Grid>
											
											<Label Grid.Column="0" Grid.Row="2" Content="Geburtstag" />
											<Label Grid.Column="0" Grid.Row="3" Content="Geschlecht" />
											<Label Grid.Column="2" Grid.Row="0" Content="Kinder" />
											<Label x:Name="lblArchiviert" Grid.Column="2" Grid.Row="1" Content="Archiviert" />
											<Label Grid.Column="0" Grid.Row="5" Content="Kommentar" />

											<TextBox x:Name="textbox_first" Grid.Column="1" Grid.Row="0" Margin="3" Height="23" Text="{val:ValidationBinding Path=FirstName, UpdateSourceTrigger=PropertyChanged}" />
											<TextBox Grid.Column="1" Grid.Row="1" Margin="3" Height="23" Text="{val:ValidationBinding Path=LastName, UpdateSourceTrigger=PropertyChanged}" />
                      <dxe:DateEdit AllowNullInput="True" Grid.Column="1" Grid.Row="2" Height="23" Margin="3" EditValue="{Binding Path=DateOfBirth, UpdateSourceTrigger=PropertyChanged}" Width="100" HorizontalAlignment="Left"/>
											<Grid Grid.Column="1" Grid.Row="3" Height="23" Margin="0,3,0,3">
												<Grid.ColumnDefinitions>
													<ColumnDefinition Width="Auto" SharedSizeGroup="RB1" />
													<ColumnDefinition Width="*" />
												</Grid.ColumnDefinitions>
												<RadioButton Grid.Column="0" Margin="3" VerticalAlignment="Center" HorizontalAlignment="Left" IsChecked="{Binding Path=IsMale, UpdateSourceTrigger=PropertyChanged}" Content="männlich" />
												<RadioButton Grid.Column="1" Margin="3" VerticalAlignment="Center" HorizontalAlignment="Left" IsChecked="{Binding Path=IsFemale, UpdateSourceTrigger=PropertyChanged}" Content="weiblich" />
											</Grid>
											<TextBox Grid.Column="3" Grid.Row="0" Margin="3" Height="23" Text="{Binding Path=Childs, UpdateSourceTrigger=PropertyChanged}" />
                      <CheckBox x:Name="chkArchiviert" Grid.Column="3" Grid.Row="1" Margin="3" Height="23" IsChecked="{Binding Path=IsArchived, UpdateSourceTrigger=PropertyChanged}" />
											<TextBox Margin="3" Grid.Column="1" Grid.ColumnSpan="3" Grid.Row="5" Text="{Binding Path=Notice, UpdateSourceTrigger=PropertyChanged}" Height="60" VerticalAlignment="Stretch" VerticalContentAlignment="Stretch" HorizontalContentAlignment="Left" ScrollViewer.CanContentScroll="False" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Hidden" TextWrapping="Wrap" AcceptsReturn="True" AutoWordSelection="True" />
										</Grid>
									</GroupBox>

                  <Grid Grid.Column="0" Grid.Row="1" Grid.ColumnSpan="3">
                    <Grid.ColumnDefinitions>
                      <ColumnDefinition Width="*" />
                      <ColumnDefinition Width="*" />
                    </Grid.ColumnDefinitions>
                    <GroupBox Grid.Column="0" Margin="0 8 0 0" Header="Adresse" Style="{StaticResource ObjectEditGroupBox}">
                      <Grid>
                        <Grid.RowDefinitions>
                          <RowDefinition Height="Auto" />
                          <RowDefinition Height="Auto" />
                          <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                          <ColumnDefinition Width="80" />
                          <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>

                        <Label Grid.Column="0" Grid.Row="0" VerticalAlignment="Center" Content="Strasse" />
                        <Label Grid.Column="0" Grid.Row="1" VerticalAlignment="Center" Content="Postleitzahl" />
                        <Label Grid.Column="0" Grid.Row="2" VerticalAlignment="Center" Content="Ort" />

                        <TextBox Grid.Column="1" Grid.Row="0" Margin="3" Height="23" Text="{Binding Path=Street, UpdateSourceTrigger=PropertyChanged}" />
                        <TextBox Grid.Column="1" Grid.Row="1" Margin="3" Height="23" Text="{Binding Path=PostalCode, UpdateSourceTrigger=PropertyChanged}" />
                        <TextBox Grid.Column="1" Grid.Row="2" Margin="3" Height="23" Text="{Binding Path=Town, UpdateSourceTrigger=PropertyChanged}" />
                      </Grid>
                    </GroupBox>

                    <GroupBox Grid.Column="1" Header="Kontakt" Grid.ColumnSpan="2" Style="{StaticResource ObjectEditGroupBox}" Margin="8,8,0,0">
                      <Grid>
                        <Grid.RowDefinitions>
                          <RowDefinition Height="Auto" />
                          <RowDefinition Height="Auto" />
                          <RowDefinition Height="Auto" />
                          <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                          <ColumnDefinition Width="80" />
                          <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>

                        <Label Grid.Column="0" Grid.Row="0" VerticalAlignment="Center" Content="Handy" />
                        <Label Grid.Column="0" Grid.Row="1" VerticalAlignment="Center" Content="Telefon" />
                        <Label Grid.Column="0" Grid.Row="2" VerticalAlignment="Center" Content="Fax" />
                        <Label Grid.Column="0" Grid.Row="3" VerticalAlignment="Center" Content="Mail" />

                        <TextBox Grid.Column="1" Grid.Row="0" Margin="3" Height="23" Text="{Binding Path=MobilePhone, UpdateSourceTrigger=PropertyChanged}" />
                        <TextBox Grid.Column="1" Grid.Row="1" Margin="3" Height="23" Text="{Binding Path=Phone, UpdateSourceTrigger=PropertyChanged}" />
                        <TextBox Grid.Column="1" Grid.Row="2" Margin="3" Height="23" Text="{Binding Path=Fax, UpdateSourceTrigger=PropertyChanged}" />
                        <TextBox Grid.Column="1" Grid.Row="3" Margin="3" Height="23" Text="{Binding Path=EMail, UpdateSourceTrigger=PropertyChanged}" />
                      </Grid>
                    </GroupBox>
                  </Grid>
                  <GroupBox Grid.Column="0" Grid.Row="2" Grid.ColumnSpan="3" Header="Familie" Style="{StaticResource ObjectEditGroupBox}">
                    <Grid>
                      <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="*" />
                      </Grid.ColumnDefinitions>
                      <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="*" />
                      </Grid.RowDefinitions>
                      <Label Grid.Column="0" Grid.Row="0" Content="Kindesmutter" />
                      <Label Grid.Column="1" Grid.Row="0" Content="Kindesvater" />
                      <Label Grid.Column="2" Grid.Row="0" Content="Geschwister" />
                      <Label Grid.Column="3" Grid.Row="0" Content="Vormund" />

                      <TextBox Grid.Column="0" Grid.Row="1" Margin="3" Height="80" Text="{Binding Path=Kindesmutter, UpdateSourceTrigger=PropertyChanged}" TextWrapping="Wrap" AcceptsReturn="True" AutoWordSelection="True" />
                      <TextBox Grid.Column="1" Grid.Row="1" Margin="3" Height="80" Text="{Binding Path=Kindesvater, UpdateSourceTrigger=PropertyChanged}" TextWrapping="Wrap" AcceptsReturn="True" AutoWordSelection="True" />
                      <TextBox Grid.Column="2" Grid.Row="1" Margin="3" Height="80" Text="{Binding Path=Geschwister, UpdateSourceTrigger=PropertyChanged}" TextWrapping="Wrap" AcceptsReturn="True" AutoWordSelection="True" />
                      <TextBox Grid.Column="3" Grid.Row="1" Margin="3" Height="80" Text="{Binding Path=Vormund, UpdateSourceTrigger=PropertyChanged}" TextWrapping="Wrap" AcceptsReturn="True" AutoWordSelection="True" />
                    </Grid>
                  </GroupBox>
                  <Grid x:Name="grid_jugendamt" Grid.Row="3" Grid.ColumnSpan="3">
                    <Grid.RowDefinitions>
                      <RowDefinition Height="Auto" />
                      <RowDefinition Height="*" />
                    </Grid.RowDefinitions>
                    <GroupBox x:Name="groupbox_newJugendamt" Grid.Row="3" Grid.ColumnSpan="3" Header="Neue Organisation hinzufügen" Style="{DynamicResource ObjectEditGroupBox}" Margin="0,10,0,0">
                      <Grid>
                        <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="Auto" />
                        </Grid.RowDefinitions>
                        <Label Grid.Column="0" Grid.Row="0" Content="Jugendamt" />
                        <uc:PopUpEdit IsReadOnly="True"
                                      x:Name="popupedit_OrganisationSearch"
                                      Grid.Column="1" Margin="3" Height="23" Grid.Row="0"
                                      DeleteButtonVisibility="Collapsed"
                                      PopUpClick="popupedit_OrganisationSearch_PopUpClick" />

                        <Label Grid.Column="2" Grid.Row="0" Content="Ansprechpartner" />
                        <uc:PopUpEdit IsReadOnly="True"
                                      x:Name="popupedit_PersonSearch"
                                      Grid.Column="3" Margin="3" Height="23" Grid.Row="0"
                                      DeleteButtonVisibility="Collapsed"
                                      PopUpClick="popupedit_PersonSearch_PopUpClick" />
                      </Grid>
                    </GroupBox>
                  </Grid>
                </Grid>
							</ScrollViewer>
						</TabItem>
            <TabItem Header="Dokumentation" Name="tabitem_notice">
                <GroupBox Header="Dokumentation" Style="{StaticResource ObjectEditGroupBox}">
                    <TextBox Margin="3" Text="{Binding Path=Notice, UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Stretch" VerticalContentAlignment="Stretch" HorizontalContentAlignment="Left" ScrollViewer.CanContentScroll="False" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Hidden" TextWrapping="Wrap" AcceptsReturn="True" AutoWordSelection="True" />
                </GroupBox>
            </TabItem>
						<TabItem Header="Weitere Eigenschaften" Name="tabitem_varFields">
							<ScrollViewer VerticalScrollBarVisibility="Auto">
								<localView:VarFieldView VarFieldList="{Binding VarFields}" />
							</ScrollViewer>
						</TabItem>
            <TabItem Header="Aktenzeichen" Selector.Selected="TabItemCostBearer_Selected">
							<Grid x:Name="grid_costBearerRel">
								<Grid.RowDefinitions>
									<RowDefinition Height="Auto" />
									<RowDefinition Height="*" />
								</Grid.RowDefinitions>
								<GroupBox Style="{StaticResource ObjectEditGroupBox}" x:Name="groupBox_newCostBearer" Header="Neues Aktenzeichen für Kostenträger vergeben">
									<Grid>
										<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="0" />
										</Grid.RowDefinitions>
										<Label Content="Kostenträger" />
										<uc:PopUpEdit Margin="3" Height="23" IsReadOnly="True" DeleteButtonVisibility="Collapsed" Name="popupedit_costBearer" PopUpClick="popupedit_costBearer_PopUpClick" Text="{val:ValidationBinding Path=CostBearers.NewVM.CostBearerString}" Grid.Column="1" />
										<Label Content="Aktenzeichen des Klienten" Grid.Column="2" />
										<TextBox Grid.Column="3" Margin="3" Height="23" Text="{Binding Path=CostBearers.NewVM.ReferenceNumber}" />
										<Label Content="Notiz" Grid.Row="1" />
										<TextBox Grid.Column="1" Grid.Row="1" Grid.ColumnSpan="3" Margin="3" Height="23" Text="{Binding Path=CostBearers.NewVM.Notice}" />
										<Button Margin="3" Grid.Row="2" Height="25" Content="Hinzufügen" Grid.ColumnSpan="4" HorizontalAlignment="Right" x:Name="button_addCostBearer" Click="button_addCostBearer_Click" />
									</Grid>
								</GroupBox>
								<GroupBox x:Name="GroupBoxCostBearerGrid" Style="{StaticResource ObjectEditGroupBox}" Grid.Row="1" Margin=" 0 20 0 0" Header="Zugeordnete Aktenzeichen pro Kostenträger">
							    </GroupBox>
							</Grid>
						</TabItem>					
						<TabItem Header="Abwesenheiten" Selector.Selected="TabItemAbsenceTimes_Selected">
							<Grid x:Name="grid_absenceTimes">
								<Grid.Resources>
									<DataTemplate x:Key="DropDownItemTemplate">
										<Grid>
											<Grid.ColumnDefinitions>
												<ColumnDefinition Width="*" />
												<ColumnDefinition Width="Auto" SharedSizeGroup="combo1" />
												<ColumnDefinition Width="Auto" SharedSizeGroup="combo2" />
												<ColumnDefinition Width="Auto" SharedSizeGroup="combo3" />
											</Grid.ColumnDefinitions>
											<Label Content="{Binding Path=Description}" />
											<Label VerticalAlignment="Center" Content="max. abrechenbar:" Grid.Column="1" IsEnabled="False" Padding="0" />
											<Label VerticalAlignment="Center" HorizontalAlignment="Right" Grid.Column="2" IsEnabled="False" Margin="3 0" Content="{Binding Path=Hours}" Padding="0" />
											<Label VerticalAlignment="Center" Grid.Column="3" IsEnabled="False" Margin="0" Content="h" Padding="0" />
										</Grid>
									</DataTemplate>
									<DataTemplate x:Key="SelectedItemTemplate">
										<Label Content="{Binding Path=Description}" Margin="3 0" Padding="0" />
									</DataTemplate>

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

								<GroupBox Grid.Column="0" x:Name="groupbox_newAbsenceTime" Grid.Row="1" Grid.ColumnSpan="2" Header="Abwesenheit hinzufügen" Style="{StaticResource ObjectEditGroupBox}">
									<Grid Grid.IsSharedSizeScope="True">
										<Grid.ColumnDefinitions>
											<ColumnDefinition Width="Auto" />
											<ColumnDefinition Width="*" />
											<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="*" />
										</Grid.RowDefinitions>
										<Label Grid.Column="0" Grid.Row="0">Startdatum</Label>
										<Label Grid.Column="2" Grid.Row="0">Enddatum</Label>
										<!--<Label Grid.Column="0" Grid.Row="1">Kategorie</Label>-->
										<Label Grid.Column="4" Grid.Row="0">Erläuterung</Label>
										<Button Grid.Row="1" Grid.ColumnSpan="6" HorizontalAlignment="Right" Height="25" Margin="1,10,0,3" Name="button_addAbsence" Click="button_addAbsence_Click" Style="{DynamicResource {x:Type Button}}">
											Abwesenheit hinzufügen
										</Button>

                    <dxe:DateEdit Grid.Column="1" Grid.Row="0" Height="23" Margin="3" EditValue="{val:ValidationBinding Path=AbsenceTimes.NewVM.Start, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}" />
                    <dxe:DateEdit Grid.Column="3" Grid.Row="0" Height="23" Margin="3" EditValue="{val:ValidationBinding Path=AbsenceTimes.NewVM.End, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}" />

										<!--<ComboBox Name="combox_reasons" Grid.Column="1" Grid.Row="1" Height="23" Margin="3" ItemsSource="{Binding Path=AbsenceTimes.PossibleReasons}" SelectedItem="{val:ValidationBinding Path=AbsenceTimes.NewVM.Reason}">
											<ComboBox.ItemContainerStyle>
												<Style>
													<Setter Property="Control.HorizontalContentAlignment" Value="Stretch" />
												</Style>
											</ComboBox.ItemContainerStyle>
										</ComboBox>-->
										<TextBox Grid.Column="5" Grid.Row="0" Height="23" Margin="3" Text="{Binding Path=AbsenceTimes.NewVM.Notice, UpdateSourceTrigger=PropertyChanged}" />

									</Grid>
								</GroupBox>

								<GroupBox x:Name="GroupBoxAbsenceTimes" Grid.Column="0" Grid.Row="2" Grid.ColumnSpan="2" Header="Erfasste Abwesenheiten" Style="{StaticResource ObjectEditGroupBox}"></GroupBox>
							</Grid>
						</TabItem>				
						<TabItem r:DemandUserRight.VisibleDemands="AssessmentSheet_View" Header="Punktebogen Kategorien">
							<ScrollViewer VerticalScrollBarVisibility="Auto">
								<GroupBox Style="{StaticResource ObjectEditGroupBox}" Header="Punktebogen Kategorien">
									<Grid>
										<ListView Grid.Column="1" Grid.ColumnSpan="3" Grid.Row="1" Margin="3" Background="Transparent" BorderBrush="Transparent" HorizontalAlignment="Stretch" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ItemsSource="{Binding AssessmentSheetCategories}">
                                            <ListView.ItemsPanel>
                                                <ItemsPanelTemplate>
                                                    <WrapPanel />
                                                </ItemsPanelTemplate>
                                            </ListView.ItemsPanel>
                                            <ListView.ItemTemplate>
												<DataTemplate>
													<Grid>
														<Grid.ColumnDefinitions>
															<ColumnDefinition Width="Auto" />
															<ColumnDefinition Width="Auto" SharedSizeGroup="a" />
														</Grid.ColumnDefinitions>
														<CheckBox Margin="3" IsChecked="{Binding IsSelected, UpdateSourceTrigger=PropertyChanged}" />
														<TextBlock Margin="3" Grid.Column="1" Text="{Binding Description, Mode=OneWay}" />
													</Grid>
												</DataTemplate>
											</ListView.ItemTemplate>
											<ListView.Resources>
												<SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Transparent" />
												<SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="Transparent" />
											</ListView.Resources>
											<!--<ListView.ItemsPanel>
                                                <ItemsPanelTemplate>
                                                    <WrapPanel />
                                                </ItemsPanelTemplate>
                                            </ListView.ItemsPanel>-->
										</ListView>
									</Grid>
								</GroupBox>
							</ScrollViewer>
						</TabItem>
						<TabItem Header="Dokumente" Name="tabitem_documents" Selector.Selected="tabitem_documents_Selected" />
            <TabItem Header="Log" Name="tabitem_log" Selector.Selected="tabitem_log_Selected" />
					</TabControl>
					<Border Grid.Row="3" 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="3" Orientation="Horizontal" VerticalAlignment="Center" Height="Auto" Margin="5,10,0,0" HorizontalAlignment="Right">
						<Button r:DemandUserRight.VisibleDemands="EditAll, CustomerView_Edit" 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>
		<Popup Margin="10" Name="popup_employee" StaysOpen="False" Placement="MousePoint" Width="370" Height="250" Closed="popup_Closed" Opened="popup_Opened">
			<localSearchView:EmployeeSearchView ItemSelected="EmployeeSearchView_ItemSelected_1" />
		</Popup>
    <Popup Margin="10" Name="popup_team" StaysOpen="False" Placement="MousePoint" Width="370" Height="250" Closed="popup_Closed" Opened="popup_Opened" >
        <localSearchView:TeamSearchView ItemSelected="TeamSearchView_ItemSelected_1" />
    </Popup>
		<Popup Margin="10" x:Name="popup_person" StaysOpen="False" Placement="MousePoint" Width="370" Height="250" Closed="popup_Closed" Opened="popup_Opened">
			<localSearchView:PersonSearchView SearchMode="OnlyToOrganisationRelatedPersons" x:Name="personsearchview" />
		</Popup>
    <Popup Margin="10" x:Name="popup_organisation" StaysOpen="False" Placement="MousePoint" Width="370" Height="250" Closed="popup_Closed" Opened="popup_Opened">
        <localSearchView:OrganisationSearchView SearchMode="All" x:Name="jugendamtsearchview" />
    </Popup>
    <Popup Margin="10" x:Name="popup_costBearer" StaysOpen="False" Placement="MousePoint" Width="370" Height="250" Closed="popup_Closed" Opened="popup_Opened">
			<localSearchView:OrganisationSearchView SearchMode="CostBearer" x:Name="costbearersearchview" ItemSelected="costbearersearchview_ItemSelected" />
		</Popup>
	</Grid>

</localView:BeWoView>
