<Page x:Class="Hotel_Course_Project.AdminPage"
      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:Hotel_Course_Project"
      mc:Ignorable="d" 
      d:DesignHeight="450" d:DesignWidth="800"
      Title="Страница администратора" Loaded="Page_Loaded" >

    <Grid>
        <TabControl>
            <TabItem Header="Персонал">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="40"></RowDefinition>
                        <RowDefinition></RowDefinition>
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="100"></ColumnDefinition>
                        <ColumnDefinition Width="301*"></ColumnDefinition>
                        <ColumnDefinition Width="46*"/>
                        <ColumnDefinition Width="347*"></ColumnDefinition>
                    </Grid.ColumnDefinitions>

                    <Button x:Name="AddStaffBtn" Click="AddStaffBtn_Click">Добавить</Button>

                    <StackPanel Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Center" Margin="5,0,8.836,0">
                        <TextBlock VerticalAlignment="Center">Сортировка</TextBlock>
                        <ComboBox Margin="10,0,0,0" VerticalAlignment="Center" Name="SortStaffCB" SelectionChanged="SortStaffCB_SelectionChanged">
                            <ComboBoxItem IsSelected="True" Name="activeS">Активные пользователи</ComboBoxItem>
                            <ComboBoxItem Name="nonActiveS">Удалённые пользователи</ComboBoxItem>
                        </ComboBox>
                    </StackPanel>

                    <StackPanel Grid.Column="3" Orientation="Horizontal">
                        <TextBlock VerticalAlignment="Center">Поиск</TextBlock>
                        <TextBox  Name="StaffSeacrhTB" TextChanged="StaffSeacrhTB_TextChanged" VerticalAlignment="Center" Width="100"></TextBox>
                        <Button Name="StaffSrchBtn" Click="StaffSrchBtn_Click">Поиск</Button>
                    </StackPanel>
                    <DataGrid x:Name="StaffList" Grid.Row="1" Grid.ColumnSpan="4" AutoGenerateColumns="False" ColumnWidth="*" IsReadOnly="True" SelectionMode="Single">
                        <!--<DataGrid.ItemContainerStyle>
                            <Style TargetType="DataGridRow">
                                <EventSetter Event="MouseDoubleClick" Handler="Row_DoubleClick"/>
                            </Style>
                        </DataGrid.ItemContainerStyle>-->
                        <DataGrid.Columns>
                            <DataGridTextColumn Header="Фамилия" Binding="{Binding LName}"></DataGridTextColumn>
                            <DataGridTextColumn Header="Имя" Binding="{Binding FName}"></DataGridTextColumn>
                            <DataGridTextColumn Header="Отчество" Binding="{Binding MName}"></DataGridTextColumn>
                            <DataGridTextColumn Header="Логин" Binding="{Binding Login}"></DataGridTextColumn>
                            <DataGridTextColumn Header="Пароль" Binding="{Binding Password}"></DataGridTextColumn>
                            <DataGridTextColumn Header="Должность" Binding="{Binding StaffRole.Name}"></DataGridTextColumn>
                            <DataGridTemplateColumn>
                                <DataGridTemplateColumn.CellTemplate>
                                    <DataTemplate>
                                        <Button x:Name="StaffSelectBtn" Click="StaffSelectBtn_Click">Выбрать</Button>
                                    </DataTemplate>
                                </DataGridTemplateColumn.CellTemplate>
                            </DataGridTemplateColumn>
                        </DataGrid.Columns>
                    </DataGrid>
                </Grid>
            </TabItem>
            <TabItem Header="Клиенты">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="40"></RowDefinition>
                        <RowDefinition></RowDefinition>
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="100"></ColumnDefinition>
                        <ColumnDefinition></ColumnDefinition>
                        <ColumnDefinition></ColumnDefinition>
                    </Grid.ColumnDefinitions>

                    <Button x:Name="AddClientfBtn" Click="AddClientBtn_Click">Добавить</Button>

                    <StackPanel Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Center">
                        <TextBlock VerticalAlignment="Center">Сортировка</TextBlock>
                        <ComboBox VerticalAlignment="Center" Name="SortClientCB" SelectionChanged="SortClientCB_SelectionChanged">
                            <ComboBoxItem IsSelected="True" Name="activeC">Активные клиенты</ComboBoxItem>
                            <ComboBoxItem Name="nonActiveC">Удалённые клиенты</ComboBoxItem>
                        </ComboBox>
                    </StackPanel>

                    <StackPanel Grid.Column="2" Orientation="Horizontal">
                        <TextBlock VerticalAlignment="Center">Поиск</TextBlock>
                        <TextBox  Name="ClientSeacrhTB" TextChanged="ClientSeacrhTB_TextChanged" VerticalAlignment="Center" Width="100"></TextBox>
                        <Button Name="ClientSrchBtn" Click="ClientSrchBtn_Click">Поиск</Button>
                    </StackPanel>


                    <DataGrid x:Name="ClientList" Grid.Row="1" Grid.ColumnSpan="3" AutoGenerateColumns="False" ColumnWidth="*" IsReadOnly="True" >
                        <DataGrid.Columns>
                            <DataGridTextColumn Header="Фамилия" Binding="{Binding LName}"></DataGridTextColumn>
                            <DataGridTextColumn Header="Имя" Binding="{Binding FName}"></DataGridTextColumn>
                            <DataGridTextColumn Header="Отчество" Binding="{Binding MName}"></DataGridTextColumn>
                            <DataGridTemplateColumn>
                                <DataGridTemplateColumn.CellTemplate>
                                    <DataTemplate>
                                        <Button x:Name="ClientSelectBtn" Click="ClientSelectBtn_Click">Выбрать</Button>
                                    </DataTemplate>
                                </DataGridTemplateColumn.CellTemplate>
                            </DataGridTemplateColumn>
                        </DataGrid.Columns>
                    </DataGrid>
                </Grid>
            </TabItem>
            <TabItem Header="Комнаты">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="40"></RowDefinition>
                        <RowDefinition></RowDefinition>
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition></ColumnDefinition>
                        <ColumnDefinition></ColumnDefinition>
                    </Grid.ColumnDefinitions>

                    <Button x:Name="AddRoomBtn" Click="AddRoomBtn_Click">Добавить</Button>

                    <DataGrid x:Name="RoomList" Grid.Row="1" Grid.ColumnSpan="2" AutoGenerateColumns="False" ColumnWidth="*" IsReadOnly="True">
                        <DataGrid.Columns>
                            <DataGridTextColumn Header="Номер Комнаты" Binding="{Binding NumRoom}"></DataGridTextColumn>
                            <DataGridTextColumn Header="Кол-во мест" Binding="{Binding CountOfSeats}"></DataGridTextColumn>
                            <DataGridTextColumn Header="Дневная полата" Binding="{Binding CostPerDay}"></DataGridTextColumn>
                            <DataGridTextColumn Header="Статус комнаты" Binding="{Binding RoomStatus.Name}"></DataGridTextColumn>
                            <DataGridTemplateColumn>
                                <DataGridTemplateColumn.CellTemplate>
                                    <DataTemplate>
                                        <Button x:Name="SelectRoomBtn" Click="SelectRoomBtn_Click">Выбрать</Button>
                                    </DataTemplate>
                                </DataGridTemplateColumn.CellTemplate>
                            </DataGridTemplateColumn>
                        </DataGrid.Columns>
                    </DataGrid>
                </Grid>
            </TabItem>
            <TabItem Header="История Платежей">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="40"></RowDefinition>
                        <RowDefinition></RowDefinition>
                    </Grid.RowDefinitions>

                    <StackPanel Orientation="Horizontal">
                        <TextBlock VerticalAlignment="Center">Поиск</TextBlock>
                        <TextBox  Name="PaySeacrhTB" TextChanged="PaySeacrhTB_TextChanged" VerticalAlignment="Center" Width="100"></TextBox>
                        <Button Name="PaySrchBtn" Click="PaySrchBtn_Click">Поиск</Button>
                    </StackPanel>
                    <DataGrid Grid.Row="1" x:Name="PayList" AutoGenerateColumns="False" ColumnWidth="*" IsReadOnly="True">
                        <DataGrid.Columns>
                            <DataGridTextColumn Header="Дата" Binding="{Binding Pay.PayDate,StringFormat=\{0:dd.MM.yyyy\}}"></DataGridTextColumn>
                            <DataGridTextColumn Header="Номер" Binding="{Binding Room.NumRoom}"></DataGridTextColumn>
                            <DataGridTemplateColumn Header="Хостес">
                                <DataGridTemplateColumn.CellTemplate>
                                    <DataTemplate>
                                        <StackPanel Orientation="Horizontal">
                                            <TextBlock Text="{Binding Staff.LName}"></TextBlock>
                                            <TextBlock Text=" "></TextBlock>
                                            <TextBlock Text="{Binding Staff.FName[0]}"></TextBlock>
                                            <TextBlock Text="."></TextBlock>
                                            <TextBlock Text="{Binding Staff.MName[0]}"></TextBlock>
                                            <TextBlock Text="."></TextBlock>
                                        </StackPanel>
                                    </DataTemplate>
                                </DataGridTemplateColumn.CellTemplate>
                            </DataGridTemplateColumn>
                            <DataGridTemplateColumn Header="Клиент">
                                <DataGridTemplateColumn.CellTemplate>
                                    <DataTemplate>
                                        <StackPanel Orientation="Horizontal">
                                            <TextBlock Text="{Binding Client.LName}"></TextBlock>
                                            <TextBlock Text=" "></TextBlock>
                                            <TextBlock Text="{Binding Client.FName[0]}"></TextBlock>
                                            <TextBlock Text="."></TextBlock>
                                            <TextBlock Text="{Binding Client.MName[0]}"></TextBlock>
                                            <TextBlock Text="."></TextBlock>
                                        </StackPanel>
                                    </DataTemplate>
                                </DataGridTemplateColumn.CellTemplate>
                            </DataGridTemplateColumn>
                            <DataGridTextColumn Header="Стоимость" Binding="{Binding Pay.EndSum}"></DataGridTextColumn>
                            <DataGridTextColumn Header="Вид оплаты" Binding="{Binding Pay.PayType.Name}"></DataGridTextColumn>
                        </DataGrid.Columns>
                    </DataGrid>
                </Grid>
            </TabItem>
            <TabItem Header="Прочее">
                <TabControl TabStripPlacement="Left">
                    <TabItem Header="Должности" IsSelected="True">
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition></ColumnDefinition>
                                <ColumnDefinition></ColumnDefinition>
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="0.5*"></RowDefinition>
                                <RowDefinition Height="40"></RowDefinition>
                                <RowDefinition></RowDefinition>
                                <RowDefinition Height="0.5*"></RowDefinition>
                            </Grid.RowDefinitions>

                            <Button Grid.Row="1" Name="RoleAddBtn" Click="RoleAddBtn_Click">Добавить</Button>
                            <DataGrid x:Name="RoleList" Grid.Row="2" AutoGenerateColumns="False" IsReadOnly="True" ColumnWidth="*">
                                <DataGrid.Columns>
                                    <DataGridTextColumn Header="Название" Binding="{Binding Name}"></DataGridTextColumn>
                                    <DataGridTemplateColumn>
                                        <DataGridTemplateColumn.CellTemplate>
                                            <DataTemplate>
                                                <Button Name="RoleDeleteBtn" Click="RoleDeleteBtn_Click">Удалить</Button>
                                            </DataTemplate>
                                        </DataGridTemplateColumn.CellTemplate>
                                    </DataGridTemplateColumn>
                                </DataGrid.Columns>
                            </DataGrid>
                        </Grid>
                    </TabItem>
                    <TabItem Header="Статусы" >
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition></ColumnDefinition>
                                <ColumnDefinition></ColumnDefinition>
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="0.5*"></RowDefinition>
                                <RowDefinition Height="40"></RowDefinition>
                                <RowDefinition></RowDefinition>
                                <RowDefinition Height="0.5*"></RowDefinition>
                            </Grid.RowDefinitions>

                            <Button Grid.Row="1" Name="StatusRoomAddBtn" Click="StatusRoomAddBtn_Click">Добавить</Button>
                            <DataGrid x:Name="StatusRoomList" Grid.Row="2" AutoGenerateColumns="False" IsReadOnly="True" ColumnWidth="*">
                                <DataGrid.Columns>
                                    <DataGridTextColumn Header="Название" Binding="{Binding Name}"></DataGridTextColumn>
                                    <DataGridTemplateColumn>
                                        <DataGridTemplateColumn.CellTemplate>
                                            <DataTemplate>
                                                <Button Name="DeleteBtn" Click="StatusRoleDeleteBtn_Click">Удалить</Button>
                                            </DataTemplate>
                                        </DataGridTemplateColumn.CellTemplate>
                                    </DataGridTemplateColumn>
                                </DataGrid.Columns>
                            </DataGrid>
                        </Grid>
                    </TabItem>
                    <TabItem Header="Виды платежей">
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition></ColumnDefinition>
                                <ColumnDefinition></ColumnDefinition>
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="0.5*"></RowDefinition>
                                <RowDefinition Height="40"></RowDefinition>
                                <RowDefinition></RowDefinition>
                                <RowDefinition Height="0.5*"></RowDefinition>
                            </Grid.RowDefinitions>

                            <Button Grid.Row="1" Name="PayTypeAddBtn" Click="PayTypeAddBtn_Click">Добавить</Button>
                            <DataGrid x:Name="PayTypeList" Grid.Row="2" AutoGenerateColumns="False" IsReadOnly="True" ColumnWidth="*">
                                <DataGrid.Columns>
                                    <DataGridTextColumn Header="Название" Binding="{Binding Name}"></DataGridTextColumn>
                                    <DataGridTemplateColumn>
                                        <DataGridTemplateColumn.CellTemplate>
                                            <DataTemplate>
                                                <Button Name="DeleteBtn" Click="PayTypeDeleteBtn_Click">Удалить</Button>
                                            </DataTemplate>
                                        </DataGridTemplateColumn.CellTemplate>
                                    </DataGridTemplateColumn>
                                </DataGrid.Columns>
                            </DataGrid>
                        </Grid>
                    </TabItem>
                </TabControl>
            </TabItem>
        </TabControl>
    </Grid>
</Page>
