Explorar el Código

Made EmployeePanel role tab invisible

Kenric Nugteren hace 1 año
padre
commit
40b966c882

+ 2 - 1
prs.desktop/Panels/Employees/EmployeePanel.xaml

@@ -10,7 +10,8 @@
              d:DesignHeight="800" d:DesignWidth="1100">
 
     <Grid>
-        <dynamicGrid:DynamicTabControl x:Name="Tab" SelectionChanged="Tab_SelectionChanged">
+        <dynamicGrid:DynamicTabControl x:Name="Tab" SelectionChanged="Tab_SelectionChanged"
+                                       TabStripPlacement="Bottom">
             <dynamicGrid:DynamicTabItem Header="Employees" x:Name="EmployeeTab">
                 <dynamicGrid:DynamicSplitPanel x:Name="SplitPanel" View="Combined" Anchor="Detail" AnchorWidth="400" MasterCaption="Employee List"
                                                DetailCaption="Employee Details" OnChanged="SplitPanel_OnChanged">

+ 13 - 0
prs.desktop/Panels/Employees/EmployeePanel.xaml.cs

@@ -101,6 +101,19 @@ namespace PRSDesktop
                 Qualifications.Refresh(true, false);
                 Spreadsheets.Refresh(true, false);
                 Jobs.Refresh(true, false);
+
+                RoleCrossTab.Visibility = Security.CanView<Employee>()
+                    && Security.CanView<Role>()
+                    && Security.CanView<EmployeeRole>() ? Visibility.Visible : Visibility.Collapsed;
+                var visibleTabItems = Tab.Items.OfType<DynamicTabItem>().Where(x => x.Visibility == Visibility.Visible).ToList();
+                if(visibleTabItems.Count <= 1)
+                {
+                    foreach(var tab in visibleTabItems)
+                    {
+                        tab.Visibility = Visibility.Collapsed;
+                        Tab.SelectedItem = tab;
+                    }
+                }
             }
         }