Ver Fonte

Added create product to product mapping grid

Kenric Nugteren há 1 ano atrás
pai
commit
519f2457c9

+ 11 - 0
prs.desktop/Panels/Jobs/ProductMappings/JobProductMappingsGrid.cs

@@ -9,6 +9,7 @@ using System.Collections.Generic;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
+using System.Windows.Controls;
 
 namespace PRSDesktop;
 
@@ -53,6 +54,16 @@ public class JobProductMappingsGrid : DynamicDataGrid<JobProductMapping>, IMaste
         return columns;
     }
 
+    protected override void CustomiseEditor(JobProductMapping[] items, DynamicGridColumn column, BaseEditor editor)
+    {
+        base.CustomiseEditor(items, column, editor);
+
+        if(new Column<JobProductMapping>(x => x.Product.ID).IsEqualTo(column.ColumnName) && editor is CodePopupEditor popup)
+        {
+            popup.CanAdd = Security.CanEdit<Product>();
+        }
+    }
+
     private void BuildMenu(DynamicMenuColumn column, CoreRow? row)
     {
         if (row is not null)