<Page x:Class="esoft.Pages.TaskLists"
      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:local="clr-namespace:esoft.Pages"
      mc:Ignorable="d" 
      d:DesignHeight="1000"
      Title="Список задач" Width="1920" >

    <Grid Width="1920">
        <Grid.RowDefinitions>
            <RowDefinition Height="auto"></RowDefinition>
            <RowDefinition Height="*"></RowDefinition>
        </Grid.RowDefinitions>

        <StackPanel Orientation="Horizontal" HorizontalAlignment="Left" Height="70" Margin="60,0,0,-13">
            <TextBlock Text="Фильтры задач:" VerticalAlignment="Center" FontSize="20" FontWeight="Bold" Width="160"/>
            <ComboBox Margin="5" Width="200" Height="25" Name="cbStatus" FontSize="16" DisplayMemberPath="Name" SelectionChanged="cbStatus_SelectionChanged">
                <ComboBox.ToolTip>
                    <ToolTip>
                        Отбор по статусу
                    </ToolTip>
                </ComboBox.ToolTip>
            </ComboBox>
            <ComboBox Margin="5" Width="200" Height="25" Name="cbManager" DisplayMemberPath="" FontSize="16" SelectionChanged="cbManager_SelectionChanged">
                <ComboBox.ToolTip>
                    <ToolTip>
                        Отбор по менеджеру
                    </ToolTip>
                </ComboBox.ToolTip>
            </ComboBox>
            <ComboBox Margin="5" Width="200" Height="25" Name="cbExecutor" DisplayMemberPath="" FontSize="16" SelectionChanged="cbExecutor_SelectionChanged">
                <ComboBox.ToolTip>
                    <ToolTip>
                        Отбор по исполнителю
                    </ToolTip>
                </ComboBox.ToolTip>
            </ComboBox>
            <TextBox Margin="5" Width="200" Height="25" Name="Search" FontSize="16" TextChanged="Search_TextChanged">
                <TextBox.Resources>
                    <Style TargetType="{x:Type Border}">
                        <Setter Property="CornerRadius" Value="12"/>
                    </Style>
                </TextBox.Resources>
                <TextBox.ToolTip>
                    <ToolTip>
                        Поиск по наименованию
                    </ToolTip>
                </TextBox.ToolTip>
            </TextBox>
            <Button Height="25" Name="btnClearFilter" Content="Очистка фильтра" Width="200" Margin ="5" FontSize="16" Click="btnClearFilter_Click" Style="{StaticResource  StandartButtons}">
                <Button.Resources>
                    <Style TargetType="Border">
                        <Setter Property="CornerRadius" Value="10"/>
                    </Style>
                </Button.Resources>
            </Button>
        </StackPanel>

        <StackPanel Background="#e6e6e6" Margin="0,15,0,0" Grid.Row="1">
            <TextBlock Text="Название задачи" FontSize="26" Margin="60, 15, 0, 0" VerticalAlignment ="Center" FontWeight="Bold"></TextBlock>
            <TextBlock Text="Дата создания задачи" Margin="800, -35, 0, 0" FontSize="26" VerticalAlignment ="Center" FontWeight="Bold"></TextBlock>
            <TextBlock Text="Исполнитель" HorizontalAlignment="Center" Margin="550, -35, 0, 0" VerticalAlignment ="Center" FontSize="26" FontWeight="Bold"></TextBlock>
            <TextBlock Text="Менеджер" HorizontalAlignment="Center" Margin="1065, -35, 0, 0" VerticalAlignment ="Center" FontSize="26" FontWeight="Bold"></TextBlock>
            <TextBlock Text="Статус" HorizontalAlignment="Right" Margin="0, -35, 170, 0" VerticalAlignment ="Center" FontSize="26" FontWeight="Bold"></TextBlock>
        </StackPanel>

        <ListView Grid.Row="1" Name="LViewTask" Height="720" Width="1900" HorizontalAlignment="Center" VerticalAlignment="Top" Background="{x:Null}" BorderBrush="{x:Null}" Margin="0,83,0,0" MouseDoubleClick="LViewTask_MouseDoubleClick" ScrollViewer.VerticalScrollBarVisibility="Hidden" Loaded="LViewTask_Loaded">
            <ListView.ItemContainerStyle>
                <Style TargetType="ListViewItem">
                    <Setter Property="Margin" Value="0,0,0,10"/>
                    <Setter Property="Width" Value="1870"/>
                    <Style.Resources>
                        <Style TargetType="Border">
                            <Setter Property="CornerRadius" Value="30"/>
                        </Style>
                    </Style.Resources>
                    <Style.Triggers>
                        <DataTrigger Binding="{Binding Status}" Value="запланирована">
                            <Setter Property="Background" Value="#73bbff"/>
                        </DataTrigger>
                        <DataTrigger Binding="{Binding Status}" Value="исполняется">
                            <Setter Property="Background" Value="#ffef5e"/>
                        </DataTrigger>
                        <DataTrigger Binding="{Binding Status}" Value="выполнена">
                            <Setter Property="Background" Value="#76cc6e"/>
                        </DataTrigger>
                        <DataTrigger Binding="{Binding Status}" Value="отменена">
                            <Setter Property="Background" Value="#cc6e6e"/>
                        </DataTrigger>
                    </Style.Triggers>
                </Style>
            </ListView.ItemContainerStyle>

            <ListView.ItemTemplate>
                <DataTemplate>
                    <Grid HorizontalAlignment="Center" Width="1900" Height="109">
                        <TextBlock Text="{Binding Title}" FontSize="26" Margin="50, 0, 0, 0" VerticalAlignment="Center" HorizontalAlignment="Left" Width="750" TextWrapping="Wrap"></TextBlock>
                        <TextBlock Text="{Binding CreateDateTime, StringFormat='{}{0:dd MMMM yyyy г.}', ConverterCulture='ru-RU'}" Margin="800, 35, 0, 0"  FontSize="26"></TextBlock>
                        <TextBlock Text="{Binding FioUser}" Margin="1150, 0, 0, 0" VerticalAlignment="Center" FontSize="26"></TextBlock>
                        <TextBlock Text="{Binding FioManager}" Margin="1425, 0, 0, 0" VerticalAlignment="Center" FontSize="26"></TextBlock>
                        <TextBlock Text="{Binding Status}" Margin="1670, 0, 0, 0" VerticalAlignment="Center" FontSize="26"></TextBlock>
                    </Grid>
                </DataTemplate>
            </ListView.ItemTemplate>
        </ListView>

        <Button Grid.Row="3" HorizontalAlignment="Left" Name="BtnDeleteTask" Content="Удалить задачу" Width="196" Height="40" BorderThickness="0" Style="{StaticResource  StandartButtons}" Margin="1650,820,0,15" Click="BtnDeleteTask_Click">
            <Button.Resources>
                <Style TargetType="Border">
                    <Setter Property="CornerRadius" Value="10"/>
                </Style>
            </Button.Resources>
        </Button>

        <Button Grid.Row="3" HorizontalAlignment="Left" Name="BtnAddTask" Content="Добавить задачу" Width="196" Height="40" BorderThickness="0" Style="{StaticResource  StandartButtons}" Margin="1420,820,0,15" Click="BtnAddTask_Click">
            <Button.Resources>
                <Style TargetType="Border">
                    <Setter Property="CornerRadius" Value="10"/>
                </Style>
            </Button.Resources>
        </Button>

        <Button Grid.Row="3" HorizontalAlignment="Left" Name="BtnUpdate" Content="Обновить список" Width="196" Height="40" BorderThickness="0" Style="{StaticResource  StandartButtons}" Margin="1190,820,0,15" Click="BtnUpdate_Click">
            <Button.Resources>
                <Style TargetType="Border">
                    <Setter Property="CornerRadius" Value="10"/>
                </Style>
            </Button.Resources>
        </Button>

        <Button Grid.Row="3" HorizontalAlignment="Left" Name="BtnExecutorList" Content="Список исполнителей" Width="225" Height="40" BorderThickness="0" Style="{StaticResource  StandartButtons}" Margin="60,820,0,15" Click="BtnExecutorList_Click">
            <Button.Resources>
                <Style TargetType="Border">
                    <Setter Property="CornerRadius" Value="10"/>
                </Style>
            </Button.Resources>
        </Button>

    </Grid>
</Page>
