<UserControl
    x:Class="AppFramework.Views.RoleDetailsView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:extensions="clr-namespace:AppFramework.Extensions"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:sync="http://schemas.syncfusion.com/wpf"
    Width="800"
    Height="580"
    mc:Ignorable="d">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="auto" />
            <RowDefinition />
            <RowDefinition Height="auto" />
        </Grid.RowDefinitions>

        <Border
            Grid.RowSpan="3"
            CornerRadius="0"
            Opacity="1"
            Style="{StaticResource BorderStyle}" />

        <TextBlock
            Margin="15"
            FontSize="18"
            FontWeight="Bold"
            Text="{extensions:Translate AddRole}" />

        <TabControl Grid.Row="1" Margin="10,0">
            <TabItem Background="Transparent" Header="{extensions:Translate RoleName}">
                <StackPanel Margin="0,10">
                    <TextBlock Text="{extensions:Translate RoleName}" />
                    <TextBox Margin="0,10" Text="{Binding Role.DisplayName, Mode=TwoWay}" />
                    <StackPanel Orientation="Horizontal">
                        <CheckBox Content="{extensions:Translate Default}" IsChecked="{Binding Role.IsDefault, Mode=TwoWay}" />
                        <TextBlock Margin="5,0,0,0" Text="{extensions:Translate DefaultRole_Description}" />
                    </StackPanel>
                </StackPanel>
            </TabItem>

            <TabItem Background="Transparent" Header="{extensions:Translate Permissions}">
                <StackPanel Grid.Row="1" Margin="0,10">
                    <TextBlock Text="{extensions:Translate Permission}" />

                    <sync:SfTreeView
                        Margin="0,5"
                        Background="Transparent"
                        ChildPropertyName="Items"
                        ItemsSource="{Binding treesService.Permissions}"
                        SelectionBackgroundColor="Transparent">
                        <sync:SfTreeView.ItemTemplate>
                            <DataTemplate>
                                <StackPanel Orientation="Horizontal">
                                    <CheckBox IsChecked="{Binding IsChecked, Mode=TwoWay}" />
                                    <TextBlock Margin="5,0" Text="{Binding DisplayName}" />
                                </StackPanel>
                            </DataTemplate>
                        </sync:SfTreeView.ItemTemplate>
                    </sync:SfTreeView>
                </StackPanel>
            </TabItem>
        </TabControl>

        <StackPanel
            Grid.Row="2"
            Margin="15"
            HorizontalAlignment="Right"
            Orientation="Horizontal">
            <Button
                Margin="0,0,10,0"
                Padding="10,5"
                Command="{Binding CancelCommand}"
                Content="{extensions:Translate Cancel}" />
            <Button
                Padding="10,5"
                Command="{Binding SaveCommand}"
                Content="{extensions:Translate Save}" />
        </StackPanel>
    </Grid>
</UserControl>
