aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Views/UserManagementView.xaml
blob: ccb38b198ae65080afd7730ba327b60850c77595 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
pre { line-height: 125%; }
td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
.highlight .hll { background-color: #ffffcc }
.highlight .c { color: #888888 } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { color: #008800; font-weight: bold } /* Keyword */
.highlight .ch { color: #888888 } /* Comment.Hashbang */
.highlight .cm { color: #888888 } /* Comment.Multiline */
.highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */
.highlight .cpf { color: #888888 } /* Comment.PreprocFile */
.highlight .c1 { color: #888888 } /* Comment.Single */
.highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .ges { font-weight: bold; font-style: italic } /* Generic.EmphStrong */
.highlight .gr { color: #aa0000 } /* Generic.Error */
.highlight .gh { color: #333333 } /* Generic.Heading */
.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
.highlight .go { color: #888888 } /* Generic.Output */
.highlight .gp { color: #555555 } /* Generic.Prompt */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #666666 } /* Generic.Subheading */
.highlight .gt { color: #aa0000 } /* Generic.Traceback */
.highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */
.highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */
.highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */
.highlight .kp { color: #008800 } /* Keyword.Pseudo */
.highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */
.highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */
.highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */
.highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */
.highlight .na { color: #336699 } /* Name.Attribute */
.highlight .nb { color: #003388 } /* Name.Builtin */
.highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */
.highlight .no { color: #003366; font-weight: bold } /* Name.Constant */
.highlight .nd { color: #555555 } /* Name.Decorator */
.highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */
.highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */
.highlight .nl { color: #336699; font-style: italic } /* Name.Label */
.highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */
.highlight .py { color: #336699; font-weight: bold } /* Name.Property */
.highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */
.highlight .nv { color: #336699 } /* Name.Variable */
.highlight .ow { color: #008800 } /* Operator.Word */
.highlight .w { color: #bbbbbb } /* Text.Whitespace */
.highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */
.highlight .mf { color: #0000DD; font-weight: bold } /* 
<UserControl x:Class="Tango.MachineStudio.UsersAndRoles.Views.UserManagementView"
             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:global="clr-namespace:Tango.MachineStudio.UsersAndRoles"
             xmlns:vm="clr-namespace:Tango.MachineStudio.UsersAndRoles.ViewModels"
             xmlns:providers="clr-namespace:Tango.MachineStudio.UsersAndRoles.Providers"
             xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
             xmlns:dragAndDrop="clr-namespace:Tango.DragAndDrop;assembly=Tango.DragAndDrop"
             xmlns:autoComplete="clr-namespace:Tango.AutoComplete.Editors;assembly=Tango.AutoComplete"
             xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI"
             xmlns:mahApps="http://metro.mahapps.com/winfx/xaml/controls"
             xmlns:entities="clr-namespace:Tango.BL.Entities;assembly=Tango.BL"
             xmlns:local="clr-namespace:Tango.MachineStudio.UsersAndRoles.Views"
             xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI"
             mc:Ignorable="d" 
             d:DesignHeight="1080" d:DesignWidth="1920" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}">

    <UserControl.Resources>
        <providers:PlacesProvider x:Key="PlacesProvider" />
    </UserControl.Resources>
    
    <Grid>
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="1*"/>
                <ColumnDefinition Width="400"/>
            </Grid.ColumnDefinitions>

            <Grid Margin="10">
                <DockPanel Margin="100" MaxWidth="1200">
                    <Grid DockPanel.Dock="Top">
                        <Grid>
                            <StackPanel>
                                <StackPanel Orientation="Horizontal">
                                    <Button MinWidth="160" Height="50" Command="{Binding BackToManagedOrganizationCommand}" HorizontalAlignment="Left">
                                        <StackPanel Orientation="Horizontal">
                                            <materialDesign:PackIcon Kind="KeyboardBackspace" Width="20" Height="20" />
                                            <TextBlock Margin="5 0 0 0" FontSize="16">BACK</TextBlock>
                                        </StackPanel>
                                    </Button>
                                    <Image Source="../Images/user.png" Width="100" RenderOptions.BitmapScalingMode="Fant" Margin="130 0 0 0"></Image>
                                    <TextBlock Text="{Binding ManagedUser.Contact.FullName,FallbackValue='Roy Ben Shabat'}" VerticalAlignment="Center" FontSize="25" Margin="10 0 0 0"></TextBlock>
                                </StackPanel>

                                <StackPanel Orientation="Horizontal" Margin="0 20 0 0" HorizontalAlignment="Right">
                                    <StackPanel>
                                        <TextBlock FontSize="16" FontWeight="SemiBold">LOGIN</TextBlock>
                                        <Border Width="300" BorderThickness="1" BorderBrush="Gray" Margin="0 5 0 0" Padding="15 5" Height="150" Background="#8EFFFFFF">
                                            <local:UserView FontSize="10" DataContext="{Binding ManagedUser}" />
                                        </Border>
                                    </StackPanel>
                                    <StackPanel Margin="10 0 0 0">
                                        <TextBlock FontSize="16" FontWeight="SemiBold">CONTACT</TextBlock>
                                        <Border Width="300" BorderThickness="1" BorderBrush="Gray" Margin="0 5 0 0" Padding="15 5" Height="250" Background="#8EFFFFFF">
                                            <local:ContactView FontSize="10" DataContext="{Binding ManagedUser.Contact}" />
                                        </Border>
                                    </StackPanel>
                                    <StackPanel Margin="10 0 0 0">
                                        <TextBlock FontSize="16" FontWeight="SemiBold">ADDRESS</TextBlock>
                                        <Border Width="300" BorderThickness="1" BorderBrush="Gray" Margin="0 5 0 0" Padding="15 5" Height="300" Background="#8EFFFFFF">
                                            <DockPanel>
                                                <DockPanel DockPanel.Dock="Top">
                                                    <materialDesign:PackIcon Kind="Magnify" DockPanel.Dock="Left" Width="24" Height="24" />
                                                    <autoComplete:AutoCompleteTextBox x:Name="address_auto" Margin="5 0 0 0" Delay="500" DisplayMember="DisplayName" SelectedItem="{Binding SelectedUserPlace,Mode=OneWayToSource}" Provider="{StaticResource PlacesProvider}" materialDesign:HintAssist.Hint="Find address" />
                                                </DockPanel>
                                                <local:AddressView FontSize="10" DataContext="{Binding ManagedUser.Address}" />
                                            </DockPanel>
                                        </Border>
                                    </StackPanel>
                                </StackPanel>
                            </StackPanel>
                        </Grid>
                    </Grid>
                    <Grid DockPanel.Dock="Bottom">
                        <Button Margin="0 10 0 0" MinWidth="200" Height="60" Command="{Binding SaveManagedUserCommand}" HorizontalAlignment="Right">
                            <StackPanel Orientation="Horizontal">
                                <TextBlock FontSize="18" VerticalAlignment="Center">SAVE</TextBlock>
                                <materialDesign:PackIcon Margin="5 0 0 0" Kind="ContentSave" Width="30" Height="30" />
                            </StackPanel>
                        </Button>
                    </Grid>
                    <Grid>
                        <DockPanel Margin="0 20 0 0">
                            <TextBlock DockPanel.Dock="Top" FontSize="16" FontWeight="SemiBold">ROLES</TextBlock>
                            <Grid Margin="0 5 0 0" Style="{StaticResource droppableGrid}" dragAndDrop:DragAndDropService.Drop="OnDropRole" Background="#7BFFFFFF">
                                <TextBlock HorizontalAlignment="Center" VerticalAlignment="Top" Foreground="Silver" FontSize="20">DRAG &amp; DROP ROLES</TextBlock>
                                <Border BorderBrush="Gray" BorderThickness="1" Padding="10">
                                    <ListBox ItemsSource="{Binding ManagedUserRoles}" ItemContainerStyle="{StaticResource basicListBoxItem}" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Disabled">
                                        <ListBox.ItemsPanel>
                                            <ItemsPanelTemplate>
                                                <WrapPanel Orientation="Horizontal" />
                                            </ItemsPanelTemplate>
                                        </ListBox.ItemsPanel>
                                        <ListBox.ItemTemplate>
                                            <DataTemplate DataType="{x:Type entities:Role}">
                                                <Grid>
                                                    <Grid.ToolTip>
                                                        <StackPanel>
                                                            <TextBlock Text="{Binding Description}" FontSize="10" Margin="0 0 0 10"></TextBlock>
                                                            <ItemsControl ItemsSource="{Binding RolesPermissions}">
                                                                <ItemsControl.ItemTemplate>
                                                                    <DataTemplate>
                                                                        <Grid>
                                                                            <StackPanel Orientation="Horizontal">
                                                                                <materialDesign:PackIcon Kind="Security" Width="12" />
                                                                                <TextBlock Margin="5 0 0 0" FontSize="10" Text="{Binding Permission.Name}"></TextBlock>
                                                                            </StackPanel>
                                                                        </Grid>
                                                                    </DataTemplate>
                                                                </ItemsControl.ItemTemplate>
                                                            </ItemsControl>
                                                        </StackPanel>
                                                    </Grid.ToolTip>
                                                    <Border Margin="5" CornerRadius="5" Width="100" Height="100" BorderThickness="1" Padding="2">
                                                        <Border.Style>
                                                            <Style TargetType="Border">
                                                                <Setter Property="BorderBrush" Value="Silver"></Setter>
                                                                <Style.Triggers>
                                                                    <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=ListBoxItem},Path=IsSelected}" Value="True">
                                                                        <Setter Property="BorderBrush" Value="{StaticResource AccentColorBrush}"></Setter>
                                                                    </DataTrigger>
                                                                </Style.Triggers>
                                                            </Style>
                                                        </Border.Style>
                                                        <Border.Background>
                                                            <LinearGradientBrush>
                                                                <GradientStop Color="White"/>
                                                                <GradientStop Color="#FFD6D6D6" Offset="1"/>
                                                            </LinearGradientBrush>
                                                        </Border.Background>
                                                        <Grid>
                                                            <StackPanel VerticalAlignment="Center" HorizontalAlignment="Center">
                                                                <Image Source="../Images/roles.png" Width="32" RenderOptions.BitmapScalingMode="Fant"></Image>
                                                                <TextBlock Text="{Binding Name}" TextWrapping="Wrap" HorizontalAlignment="Center" TextAlignment="Center" FontSize="13" Margin="5"></TextBlock>
                                                            </StackPanel>
                                                        </Grid>
                                                    </Border>

                                                    <Button HorizontalAlignment="Right" VerticalAlignment="Top" Margin="10" Cursor="Hand" ToolTip="Remove Role" Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.RemoveRoleCommand}" CommandParameter="{Binding}">
                                                        <Button.Style>
                                                            <Style TargetType="Button" BasedOn="{StaticResource emptyButton}">
                                                                <Setter Property="Visibility" Value="Hidden"></Setter>
                                                                <Style.Triggers>
                                                                    <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=Grid},Path=IsMouseOver}" Value="True">
                                                                        <Setter Property="Visibility" Value="Visible"></Setter>
                                                                    </DataTrigger>
                                                                </Style.Triggers>
                                                            </Style>
                                                        </Button.Style>
                                                        <materialDesign:PackIcon Kind="Delete" Foreground="#FF5C5C" Width="16" Height="16" />
                                                    </Button>
                                                </Grid>
                                            </DataTemplate>
                                        </ListBox.ItemTemplate>
                                    </ListBox>
                                </Border>
                            </Grid>
                        </DockPanel>
                    </Grid>
                </DockPanel>
            </Grid>

            <Grid Grid.Column="1" Background="White">
                <DockPanel Margin="10">
                    <StackPanel Orientation="Horizontal" DockPanel.Dock="Top">
                        <Image Source="../Images/roles.png" Width="70" RenderOptions.BitmapScalingMode="Fant"></Image>
                        <TextBlock FontSize="16" FontWeight="SemiBold" VerticalAlignment="Center" Margin="10 0 0 0">AVAILABLE ROLES</TextBlock>
                    </StackPanel>

                    <Grid>
                        <ListBox ItemsSource="{Binding Roles}" ItemContainerStyle="{StaticResource basicListBoxItem}" HorizontalContentAlignment="Stretch" Background="Transparent">
                            <ListBox.ItemTemplate>
                                <DataTemplate>
                                    <Grid Background="Transparent" IsHitTestVisible="True" Style="{StaticResource draggableGrid}" dragAndDrop:DragAndDropService.DraggableBorderBrush="{StaticResource AccentColorBrush}" dragAndDrop:DragAndDropService.Draggable="True" dragAndDrop:DragAndDropService.DraggingSurface="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DraggingSurface}">
                                        <Grid.ToolTip>
                                            <StackPanel>
                                                <TextBlock Text="{Binding Description}" FontSize="10" Margin="0 0 0 10"></TextBlock>
                                                <ItemsControl ItemsSource="{Binding RolesPermissions}">
                                                    <ItemsControl.ItemTemplate>
                                                        <DataTemplate>
                                                            <StackPanel Orientation="Horizontal">
                                                                <materialDesign:PackIcon Kind="Security" Width="12" />
                                                                <TextBlock Margin="5 0 0 0" FontSize="10" Text="{Binding Permission.Name}"></TextBlock>
                                                            </StackPanel>
                                                        </DataTemplate>
                                                    </ItemsControl.ItemTemplate>
                                                </ItemsControl>
                                            </StackPanel>
                                        </Grid.ToolTip>
                                        <DockPanel>
                                            <Border DockPanel.Dock="Left" Width="100" Height="100" IsHitTestVisible="False" BorderBrush="Silver" BorderThickness="1" CornerRadius="5" Margin="5" Padding="2">
                                                <Border.Background>
                                                    <LinearGradientBrush>
                                                        <GradientStop Color="White"/>
                                                        <GradientStop Color="#FFD6D6D6" Offset="1"/>
                                                    </LinearGradientBrush>
                                                </Border.Background>
                                                <Grid>
                                                    <StackPanel VerticalAlignment="Center" HorizontalAlignment="Center">
                                                        <Image Source="../Images/roles.png" Width="32" RenderOptions.BitmapScalingMode="Fant"></Image>
                                                        <TextBlock Text="{Binding Name}" TextWrapping="Wrap" HorizontalAlignment="Center" TextAlignment="Center" FontSize="13" Margin="5"></TextBlock>
                                                    </StackPanel>
                                                </Grid>
                                            </Border>

                                            <Grid MaxHeight="85" HorizontalAlignment="Left" Margin="20 0 0 0">
                                                <ItemsControl ItemsSource="{Binding RolesPermissions}">
                                                    <ItemsControl.ItemTemplate>
                                                        <DataTemplate>
                                                            <StackPanel Orientation="Horizontal">
                                                                <materialDesign:PackIcon Kind="Security" Width="12" />
                                                                <TextBlock Margin="5 0 0 0" FontSize="10" TextTrimming="CharacterEllipsis" MaxWidth="150" Text="{Binding Permission.Name}"></TextBlock>
                                                            </StackPanel>
                                                        </DataTemplate>
                                                    </ItemsControl.ItemTemplate>
                                                </ItemsControl>

                                                <Grid>
                                                    <Grid.Background>
                                                        <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
                                                            <GradientStop/>
                                                            <GradientStop Color="White" Offset="1"/>
                                                        </LinearGradientBrush>
                                                    </Grid.Background>
                                                </Grid>
                                            </Grid>
                                        </DockPanel>
                                    </Grid>
                                </DataTemplate>
                            </ListBox.ItemTemplate>
                        </ListBox>
                    </Grid>
                </DockPanel>

                <Rectangle HorizontalAlignment="Left" Stroke="#BBBBBB" StrokeThickness="1"></Rectangle>
            </Grid>
        </Grid>

        <dragAndDrop:DraggingSurface x:Name="dragSurface" />
    </Grid>
</UserControl>