<view:BeWoView x:Class="BeWo.View.Detail.MedRecordEditView"
      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:view="clr-namespace:BeWo.View"
      xmlns:search="clr-namespace:BeWo.View.Search"
      xmlns:controls="clr-namespace:BeWo.View.Controls"
      xmlns:controls1="clr-namespace:BeWo.Controls;assembly=BeWo.Controls"
      xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
      xmlns:val="clr-namespace:BeWo.Validation"
      xmlns:lVM="clr-namespace:BeWo.ViewModel.ListViewModel"
      mc:Ignorable="d" 
      Height="Auto" Width="Auto" VerticalAlignment="Stretch" Focusable="True">
    <Grid Height="Auto" Width="Auto">
        <GroupBox x:Name="rootGroupBox" Style="{StaticResource PopUpWindowStyle}">
            <GroupBox.Header>
                <TextBox Text="Dokumentation bearbeiten" Margin="10,4,0,0" Background="{x:Null}" 
                             Foreground="{DynamicResource MainGroupBoxForegroundBrush}" FontSize="20" 
                             BorderBrush="{x:Null}" VerticalAlignment="Stretch" BorderThickness="0,0,0,0" Padding="0,0,0,0" />
            </GroupBox.Header>
            <Grid Margin="0,3,0,0" Background="{StaticResource ObjectEditBackgroundBrush}" x:Name="RootGrid">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="*" />
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                <Grid Margin="10,10,10,0">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="*" />
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="*" />
                    </Grid.ColumnDefinitions>

                    <controls:CustomerSelectionControl Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Grid.RowSpan="2"
                                                       x:Name="CustomerSelectionControl" Width="246" Margin="0,0,0,3"
                                                       ItemSelected="CustomerSelectionControl_ItemSelected" Height="62" VerticalAlignment="Top"
                                                       HorizontalContentAlignment="Stretch" />

                    <Label Grid.Column="0" Grid.Row="2" Content="Mitarbeiter" />
                    <controls1:PopUpEdit Grid.Column="1" Grid.Row="2" IsReadOnly="True" x:Name="PopupeditEmployee"
                                         DeleteButtonVisibility="Collapsed" PopUpClick="Popupedit_employee_OnPopUpClick"
                                         HorizontalContentAlignment="Stretch" Height="23"
                                         Margin="3,0,3,3" Cursor="Arrow" Width="150" HorizontalAlignment="Right"/>

                    <Label   Grid.Column="0" Grid.Row="3" Content="Bezeichnung" />
                    <TextBox Grid.Column="1" Grid.Row="3" Margin="3,0,3,3" Height="23" Width="150" HorizontalAlignment="Right"
                             VerticalContentAlignment="Center"
                             Text="{val:ValidationBinding Path=MedName, UpdateSourceTrigger=PropertyChanged}"/>

                    <Label            Grid.Column="0" Grid.Row="4" Content="Darreichungsform" />
                    <dxe:ComboBoxEdit Grid.Column="1" Grid.Row="4" Margin="3,0,3,3" Height="23" IsTextEditable="False"
                                      ItemsSource="{x:Static lVM:ServiceRecordListVM.AllDosageForms}"
                                      EditValue="{Binding Path=DosageForm, UpdateSourceTrigger=PropertyChanged}"/>

                    <Label        Grid.Column="0" Grid.Row="5" Content="Datum" />
                    <dxe:DateEdit Grid.Column="1" Grid.Row="5" Height="23" Margin="3,0,3,3" MaskType="DateTimeAdvancingCaret" 
                                  EditValue="{val:ValidationBinding Path=MedDate, UpdateSourceTrigger=PropertyChanged}"
                                  Mask="dd.MM.yyyy HH:mm" MaskUseAsDisplayFormat="True" />

                    <Label   Grid.Column="2" Grid.Row="0" Content="Notiz" />
                    <TextBox Grid.Column="2" Grid.Row="1" Margin="3,0,3,3" VerticalAlignment="Stretch" AutoWordSelection="True" 
                             Grid.RowSpan="5" Text="{Binding Path=Notice, UpdateSourceTrigger=PropertyChanged}" 
                             Language="de-DE" SpellCheck.IsEnabled="true" TextWrapping="Wrap" AcceptsReturn="True"/>
                </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,3,0" Command="ApplicationCommands.Save" Height="25" />
                    <Button x:Name="BtnClose" Content="Abbrechen" Margin="0,0,3,0" Command="ApplicationCommands.Close" Height="25" />
                </StackPanel>
                <Popup Margin="10" x:Name="PopupEmployee" StaysOpen="False" Placement="MousePoint" Width="400" Height="400">
                    <search:EmployeeSearchView x:Name="EmployeeSearchView" ItemSelected="EmployeeSearchView_ItemSelected" />
                </Popup>
            </Grid>
        </GroupBox>
    </Grid>
</view:BeWoView>
