ソースを参照

Added job document set milestone forms

Kenric Nugteren 1 年間 前
コミット
ebc78d79b3

+ 32 - 0
prs.classes/Entities/Job/DocumentSet/JobDocumentSetMileStoneForm.cs

@@ -0,0 +1,32 @@
+using InABox.Core;
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Comal.Classes
+{
+    public class JobDocumentSetMileStoneForm : EntityForm<JobDocumentSetMileStone, JobDocumentSetMileStoneLink, JobDocumentSetMileStoneForm>, IDigitalForm<JobDocumentSetMileStone>
+    {
+        public override string AutoIncrementPrefix() => "JDSMF";
+    }
+    public class JobDocumentSetMileStoneFormLookups : ILookupDefinition<DigitalForm, JobDocumentSetMileStone>, ILookupDefinition<DigitalForm, JobDocumentSetMileStoneForm>
+    {
+        public Filter<DigitalForm> DefineFilter(JobDocumentSetMileStone[] items)
+        {
+            var filter = DefineFilter(Array.Empty<JobDocumentSetMileStoneForm>());
+
+            return filter;
+        }
+
+        Columns<JobDocumentSetMileStone> ILookupDefinition<DigitalForm, JobDocumentSetMileStone>.DefineFilterColumns()
+            => new Columns<JobDocumentSetMileStone>();
+
+        public Filter<DigitalForm> DefineFilter(JobDocumentSetMileStoneForm[] items)
+        {
+            return new Filter<DigitalForm>(x => x.Active).IsEqualTo(true).And(x => x.AppliesTo).IsEqualTo(nameof(JobDocumentSetMileStone));
+        }
+
+        Columns<JobDocumentSetMileStoneForm> ILookupDefinition<DigitalForm, JobDocumentSetMileStoneForm>.DefineFilterColumns()
+            => new Columns<JobDocumentSetMileStoneForm>(x => x.Parent.ID);
+    }
+}

+ 12 - 1
prs.desktop/Panels/Jobs/DocumentSets/JobDocumentSetTree.xaml.cs

@@ -15,6 +15,7 @@ using InABox.Configuration;
 using InABox.Core;
 using InABox.DynamicGrid;
 using InABox.WPF;
+using Microsoft.Exchange.WebServices.Data;
 using Syncfusion.Compression.Zip;
 using Syncfusion.Data.Extensions;
 using Syncfusion.UI.Xaml.Grid;
@@ -690,7 +691,17 @@ namespace PRSDesktop
                 MenuItem export = new MenuItem { Header = "Export Files" };
                 export.Click += (o, args) => ExportFiles(milestones);
                 MileStoneMenu.Items.Add(export);
-                
+
+                if(milestoneids.Length == 1)
+                {
+                    MileStoneMenu.AddSeparatorIfNeeded();
+                    var item = MileStoneMenu.AddItem("Forms", PRSDesktop.Resources.kanban, null);
+                    DynamicGridUtils.PopulateFormMenu<JobDocumentSetMileStoneForm, JobDocumentSetMileStone, JobDocumentSetMileStoneLink>(
+                        item,
+                        milestoneids[0],
+                        () => new Client<JobDocumentSetMileStone>().Load(new Filter<JobDocumentSetMileStone>(x => x.ID).IsEqualTo(milestoneids[0])).First());
+                }
+
                 MileStoneMenu.Items.Add(new Separator());
                 MenuItem delete = new MenuItem { Header = "Delete MileStone" };
                 delete.Click += (o, args) => DeleteMileStone(milestones);

+ 2 - 1
prs.desktop/Panels/Jobs/JobProductMappingsGrid.cs

@@ -88,7 +88,8 @@ public class JobProductMappingsGrid : DynamicDataGrid<JobProductMapping>, IJobCo
     {
         var folder = new MultiSelectDialog<JobDocumentSetFolder>(
             new Filter<JobDocumentSetFolder>(x => x.Job.ID).IsEqualTo(Job.ID),
-            new Columns<JobDocumentSetFolder>(x => x.ID));
+            new Columns<JobDocumentSetFolder>(x => x.ID),
+            multiselect: false);
         if (!folder.ShowDialog())
         {
             MessageWindow.ShowMessage("You need to select a folder to add this document set to.", "Folder required");

+ 2 - 1
prs.desktop/Panels/Jobs/JobProductStylesGrid.cs

@@ -85,7 +85,8 @@ public class JobProductStylesGrid : DynamicDataGrid<JobStyle>, IJobControl, IDat
     {
         var folder = new MultiSelectDialog<JobDocumentSetFolder>(
             new Filter<JobDocumentSetFolder>(x => x.Job.ID).IsEqualTo(Job.ID),
-            new Columns<JobDocumentSetFolder>(x => x.ID));
+            new Columns<JobDocumentSetFolder>(x => x.ID),
+            multiselect: false);
         if (!folder.ShowDialog())
         {
             MessageWindow.ShowMessage("You need to select a folder to add this document set to.", "Folder required");

+ 5 - 0
prs.desktop/Utils/FormUtils.cs

@@ -22,6 +22,7 @@ namespace PRSDesktop
             DFUtils.AddFormUtils<LeaveRequestForm, LeaveRequest, LeaveRequestLink>(CanEditLeaveRequestForm);
             DFUtils.AddFormUtils<PurchaseOrderItemForm, PurchaseOrderItem, PurchaseOrderItemLink>(CanEditPurchaseOrderItemForm);
             DFUtils.AddFormUtils<TimeSheetForm, TimeSheet, TimeSheetLink>(CanEditTimeSheetForm);
+            DFUtils.AddFormUtils<JobDocumentSetMileStoneForm, JobDocumentSetMileStone, JobDocumentSetMileStoneLink>(CanEditJobDocumentSetMileStoneForm);
         }
 
         public static bool CanEditAssignmentForm(AssignmentForm form, Assignment assignment)
@@ -40,6 +41,10 @@ namespace PRSDesktop
         {
             return false;
         }
+        public static bool CanEditJobDocumentSetMileStoneForm(JobDocumentSetMileStoneForm form, JobDocumentSetMileStone assignment)
+        {
+            return true;
+        }
 
         public static bool CanEditKanbanForm(KanbanForm form, Kanban kanban)
         {