<UserControl x:Class="OPSAutoDialer.View.GeneralSettingsUC"
             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:Controls2="clr-namespace:Xceed.Wpf.Toolkit;assembly=Xceed.Wpf.Toolkit"
             mc:Ignorable="d" 
             d:DesignHeight="400" 
             d:DesignWidth="400" Background="WhiteSmoke">
    <UserControl.Resources>
        <Style x:Key="margin" TargetType="{x:Type Control}">
            <Setter Property="Margin" Value="0,0,0,10"/>
        </Style>
    </UserControl.Resources>

    <StackPanel Background="#dceadd">
        <GroupBox>
            <StackPanel>
                <CheckBox Content="Calls can be made on the following times"
                      IsChecked="{Binding AutoDialerConfig.EnabledTimes.TimeIntervalEnabled}"
                      x:Name="chkBoxTimeInterval"
                      Style="{StaticResource margin}"/>
                <GroupBox Header="Time interval"
                      IsEnabled="{Binding ElementName=chkBoxTimeInterval, Path=IsChecked}"
                      Style="{StaticResource margin}">
                    <UniformGrid>
                        <TextBlock Text="Earliest time:"
                               VerticalAlignment="Center"
                               Margin="10"/>
                        <Controls2:DateTimeUpDown Height="20"
                                              Width="100"
                                              Margin="30,0"
                                              Value="{Binding AutoDialerConfig.EnabledTimes.EarliestTime}"
                                              Format="ShortTime"/>
                        <TextBlock VerticalAlignment="Center"
                               Margin="10"
                               Text="Latest time:"/>
                        <Controls2:DateTimeUpDown Height="20"
                               Width="100"
                               Margin="30,0"
                               Value="{Binding AutoDialerConfig.EnabledTimes.LatestTime}"
                               Format="ShortTime"/>
                    </UniformGrid>
                </GroupBox>
                <CheckBox Content="Calls can be made on the following days"
                      IsChecked="{Binding AutoDialerConfig.EnabledDays.DaysIntervalEnabled, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}"
                      x:Name="chkBoxDayInterval"
                      Style="{StaticResource margin}"/>
                <GroupBox Header="Day interval"
                      IsEnabled="{Binding ElementName=chkBoxDayInterval, Path=IsChecked}">
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="*"/>
                        </Grid.ColumnDefinitions>
                        <StackPanel Margin="10,5">
                            <CheckBox Margin="0,10,0,10"
                                  Content="Monday"
                                  IsChecked="{Binding AutoDialerConfig.EnabledDays.MondayEnabled, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}"/>
                            <CheckBox Margin="0,0,0,10"
                                  Content="Thursday"
                                  IsChecked="{Binding AutoDialerConfig.EnabledDays.ThursdayEnabled, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}"/>
                        </StackPanel>
                        <StackPanel Grid.Column="1"
                                Margin="10,5">
                            <CheckBox Margin="0,10,0,10"
                                  Content="Tuesday"
                                  IsChecked="{Binding AutoDialerConfig.EnabledDays.TuesdayEnabled, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}"/>
                            <CheckBox Margin="0,0,0,10"
                                  Content="Friday"
                                  IsChecked="{Binding AutoDialerConfig.EnabledDays.FridayEnabled, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}"/>
                            <CheckBox Margin="0,0,0,10"
                                  Content="Sunday"
                                  IsChecked="{Binding AutoDialerConfig.EnabledDays.SundayEnabled, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}"/>
                        </StackPanel>
                        <StackPanel Grid.Column="2"
                                Margin="10,5">
                            <CheckBox Margin="0,10,0,10"
                                  Content="Wednesday"
                                  IsChecked="{Binding AutoDialerConfig.EnabledDays.WednesdayEnabled, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}"/>
                            <CheckBox Margin="0,0,0,10"
                                  Content="Saturday"
                                  IsChecked="{Binding AutoDialerConfig.EnabledDays.SaturdayEnabled, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}"/>

                        </StackPanel>
                    </Grid>
                </GroupBox>

            </StackPanel>
        </GroupBox>
        <Grid Margin="0,10">
            <Grid.ColumnDefinitions>
                <ColumnDefinition/>
                <ColumnDefinition/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition/>
                <RowDefinition Height="10"/>
                <RowDefinition/>
                <RowDefinition Height="10"/>
                <RowDefinition/>
            </Grid.RowDefinitions>
            <TextBlock Text="Number of concurrent works:"
                                       MaxWidth="200"/>
            <Controls2:IntegerUpDown Grid.Column="1"
                                         Width="97"
                                         Minimum="1"
                                         Increment="1"
                                         Value="{Binding AutoDialerConfig.ConcurrentWorks, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}"
                                         Maximum="1000"
                                         HorizontalAlignment="Center"/>
            <TextBlock Grid.Row="2" Text="Ringing time (s):"
                                       MaxWidth="200"/>
            <Controls2:IntegerUpDown Grid.Row="2" 
                                     Grid.Column="1"
                                     Width="98"
                                     Minimum="30"
                                     Increment="1"
                                     Value="{Binding AutoDialerConfig.RingingTime, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}"
                                     Maximum="600"
                                     HorizontalAlignment="Center">
            </Controls2:IntegerUpDown>
            <TextBlock Text="Extension id:"  Grid.Row="4" 
                                     Grid.Column="0" MaxWidth="200"/>
            <TextBox DockPanel.Dock="Right" Width="98"  Grid.Row="4" Grid.Column="1" Text="{Binding AutoDialerConfig.ExtensionId, UpdateSourceTrigger=PropertyChanged}"/>
        </Grid>
    </StackPanel>

</UserControl>
