<Window x:Class="XLAB2.PrfrEditWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="{Binding Title}"
        Height="620"
        Width="860"
        MinHeight="560"
        MinWidth="780"
        WindowStartupLocation="CenterOwner">
    <Grid Margin="16">
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>

        <ScrollViewer Grid.Row="0"
                      VerticalScrollBarVisibility="Auto">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="220" />
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="220" />
                    <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>

                <TextBlock Grid.Row="0" Grid.Column="0" Margin="0,0,12,8" VerticalAlignment="Center" Text="Организация/подразделение" />
                <ComboBox Grid.Row="0" Grid.Column="1" Margin="0,0,16,8" ItemsSource="{Binding OrganizationItems}" SelectedValue="{Binding OrganizationId}" SelectedValuePath="Id" DisplayMemberPath="Name" IsTextSearchEnabled="True" />

                <TextBlock Grid.Row="0" Grid.Column="2" Margin="0,0,12,8" VerticalAlignment="Center" Text="Должность" />
                <ComboBox Grid.Row="0" Grid.Column="3" Margin="0,0,0,8" ItemsSource="{Binding PositionItems}" SelectedValue="{Binding PositionId}" SelectedValuePath="Id" DisplayMemberPath="Name" IsTextSearchEnabled="True" />

                <TextBlock Grid.Row="1" Grid.Column="0" Margin="0,0,12,8" VerticalAlignment="Center" Text="Дата приёма" />
                <DatePicker Grid.Row="1" Grid.Column="1" Margin="0,0,16,8" SelectedDate="{Binding HireDate, Mode=TwoWay}" SelectedDateFormat="Short" />

                <TextBlock Grid.Row="1" Grid.Column="2" Margin="0,0,12,8" VerticalAlignment="Center" Text="Дата увольнения" />
                <DatePicker Grid.Row="1" Grid.Column="3" Margin="0,0,0,8" SelectedDate="{Binding DismissalDate, Mode=TwoWay}" SelectedDateFormat="Short" />

                <TextBlock Grid.Row="2" Grid.Column="0" Margin="0,0,12,8" VerticalAlignment="Center" Text="Дата вступления в должность" />
                <DatePicker Grid.Row="2" Grid.Column="1" Margin="0,0,16,8" SelectedDate="{Binding PositionStartDate, Mode=TwoWay}" SelectedDateFormat="Short" />

                <TextBlock Grid.Row="2" Grid.Column="2" Margin="0,0,12,8" VerticalAlignment="Center" Text="План повышения квалификации" />
                <DatePicker Grid.Row="2" Grid.Column="3" Margin="0,0,0,8" SelectedDate="{Binding QualificationPlanDate, Mode=TwoWay}" SelectedDateFormat="Short" />

                <TextBlock Grid.Row="3" Grid.Column="0" Margin="0,0,12,8" VerticalAlignment="Center" Text="Начало последнего отпуска" />
                <DatePicker Grid.Row="3" Grid.Column="1" Margin="0,0,16,8" SelectedDate="{Binding LastVacationStartDate, Mode=TwoWay}" SelectedDateFormat="Short" />

                <TextBlock Grid.Row="3" Grid.Column="2" Margin="0,0,12,8" VerticalAlignment="Center" Text="Окончание последнего отпуска" />
                <DatePicker Grid.Row="3" Grid.Column="3" Margin="0,0,0,8" SelectedDate="{Binding LastVacationEndDate, Mode=TwoWay}" SelectedDateFormat="Short" />

                <TextBlock Grid.Row="4" Grid.Column="0" Margin="0,0,12,8" VerticalAlignment="Center" Text="Начало будущего отпуска" />
                <DatePicker Grid.Row="4" Grid.Column="1" Margin="0,0,16,8" SelectedDate="{Binding NextVacationStartDate, Mode=TwoWay}" SelectedDateFormat="Short" />

                <TextBlock Grid.Row="4" Grid.Column="2" Margin="0,0,12,8" VerticalAlignment="Center" Text="Окончание будущего отпуска" />
                <DatePicker Grid.Row="4" Grid.Column="3" Margin="0,0,0,8" SelectedDate="{Binding NextVacationEndDate, Mode=TwoWay}" SelectedDateFormat="Short" />

                <TextBlock Grid.Row="5" Grid.Column="0" Margin="0,0,12,8" VerticalAlignment="Center" Text="Табельный номер" />
                <TextBox Grid.Row="5" Grid.Column="1" Margin="0,0,16,8" Text="{Binding PersonnelNumber, UpdateSourceTrigger=PropertyChanged}" />

                <TextBlock Grid.Row="5" Grid.Column="2" Margin="0,0,12,8" VerticalAlignment="Center" Text="GUID сотрудника" />
                <TextBox Grid.Row="5" Grid.Column="3" Margin="0,0,0,8" Text="{Binding Guid, UpdateSourceTrigger=PropertyChanged}" />

                <TextBlock Grid.Row="6" Grid.Column="0" Margin="0,0,12,8" VerticalAlignment="Center" Text="PIN сотрудника (хэш)" />
                <TextBox Grid.Row="6" Grid.Column="1" Margin="0,0,16,8" Text="{Binding PinHash, UpdateSourceTrigger=PropertyChanged}" />

                <TextBlock Grid.Row="6" Grid.Column="2" Margin="0,0,12,8" VerticalAlignment="Center" Text="Дата изменения PIN" />
                <TextBox Grid.Row="6" Grid.Column="3" Margin="0,0,0,8" Text="{Binding PinChangedAtText, UpdateSourceTrigger=PropertyChanged}" />

                <TextBlock Grid.Row="7" Grid.Column="0" Margin="0,0,12,0" VerticalAlignment="Center" Text="Аутентификация PIN" />
                <CheckBox Grid.Row="7" Grid.Column="1" IsThreeState="True" IsChecked="{Binding IsPinAuth}" VerticalAlignment="Center" />
            </Grid>
        </ScrollViewer>

        <TextBlock Grid.Row="1" Margin="0,12,0,0" Foreground="Firebrick" Text="{Binding ValidationMessage}" />

        <StackPanel Grid.Row="2" Margin="0,12,0,0" Orientation="Horizontal" HorizontalAlignment="Right">
            <Button Width="100" Margin="0,0,8,0" IsDefault="True" Command="{Binding ConfirmCommand}" Content="Сохранить" />
            <Button Width="90" Command="{Binding CancelCommand}" Content="Отмена" />
        </StackPanel>
    </Grid>
</Window>
