|  | @@ -8,7 +8,6 @@ using System.Windows.Controls;
 | 
	
		
			
				|  |  |  using System.Windows.Data;
 | 
	
		
			
				|  |  |  using System.Windows.Input;
 | 
	
		
			
				|  |  |  using System.Windows.Media;
 | 
	
		
			
				|  |  | -using com.sun.xml.@internal.ws.client;
 | 
	
		
			
				|  |  |  using Comal.Classes;
 | 
	
		
			
				|  |  |  using InABox.Clients;
 | 
	
		
			
				|  |  |  using InABox.Configuration;
 | 
	
	
		
			
				|  | @@ -170,7 +169,7 @@ namespace PRSDesktop
 | 
	
		
			
				|  |  |      /// <summary>
 | 
	
		
			
				|  |  |      ///     Interaction logic for DailyReport.xaml
 | 
	
		
			
				|  |  |      /// </summary>
 | 
	
		
			
				|  |  | -    public partial class DailyReport : UserControl, IPanel<Assignment>
 | 
	
		
			
				|  |  | +    public partial class DailyReport : UserControl, IPanel<Assignment>, IDynamicEditorHost
 | 
	
		
			
				|  |  |      {
 | 
	
		
			
				|  |  |          private DailyActivityScreenSettings _settings;
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -227,14 +226,67 @@ namespace PRSDesktop
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |              ConfirmTimeSheetImage.Source = PRSDesktop.Resources.tick.AsBitmapImage();
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -        
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        #region IDynamicEditorHost
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        public IEnumerable<DynamicGridColumn> Columns { get; } = InitialiseColumns();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        private static DynamicGridColumns InitialiseColumns()
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            var columns = new DynamicGridColumns();
 | 
	
		
			
				|  |  | +            columns.ExtractColumns(typeof(Assignment));
 | 
	
		
			
				|  |  | +            return columns;
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        public void LoadColumns(string column, Dictionary<string, string> columns)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            columns.Clear();
 | 
	
		
			
				|  |  | +            var comps = column.Split('.').ToList();
 | 
	
		
			
				|  |  | +            comps.RemoveAt(comps.Count - 1);
 | 
	
		
			
				|  |  | +            var prefix = string.Format("{0}.", string.Join(".", comps));
 | 
	
		
			
				|  |  | +            var cols = Columns.Where(x => !x.ColumnName.Equals(column) && x.ColumnName.StartsWith(prefix));
 | 
	
		
			
				|  |  | +            foreach (var col in cols)
 | 
	
		
			
				|  |  | +                columns[col.ColumnName.Replace(prefix, "")] = col.ColumnName;
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        public IFilter? DefineFilter(Type type) => LookupFactory.DefineFilter<Assignment>(new Assignment[] { SelectedAssignment }, type);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        public void LoadLookups(ILookupEditorControl editor)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            if (editor == Activity) Activity_OnDefineLookups(editor);
 | 
	
		
			
				|  |  | +            else if (editor == Kanban) Task_OnDefineLookups(editor);
 | 
	
		
			
				|  |  | +            else if (editor == ITP) ITP_OnDefineLookups(editor);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        public Document? FindDocument(string filename)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            return new Client<Document>().Load(new Filter<Document>(x => x.FileName).IsEqualTo(filename)).FirstOrDefault();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        public Document? GetDocument(Guid id)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            Document? doc = null;
 | 
	
		
			
				|  |  | +            if (id != Guid.Empty)
 | 
	
		
			
				|  |  | +                doc = new Client<Document>().Load(new Filter<Document>(x => x.ID).IsEqualTo(id)).FirstOrDefault();
 | 
	
		
			
				|  |  | +            return doc;
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        public void SaveDocument(Document document)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            new Client<Document>().Save(document, "");
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        object?[] IDynamicEditorHost.GetItems() => new object?[] { SelectedAssignment };
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        public BaseEditor? GetEditor(DynamicGridColumn column) => column.Editor.CloneEditor();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        #endregion
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |          public void Setup()
 | 
	
		
			
				|  |  |          {
 | 
	
		
			
				|  |  |              Calendar.DisableUpdate();
 | 
	
		
			
				|  |  |              try
 | 
	
		
			
				|  |  |              {
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |                  Parallel.ForEach(
 | 
	
		
			
				|  |  |                      new Action[]
 | 
	
		
			
				|  |  |                      {
 | 
	
	
		
			
				|  | @@ -269,25 +321,24 @@ namespace PRSDesktop
 | 
	
		
			
				|  |  |                  ConfigureEditor(Finish, new TimeOfDayEditor());
 | 
	
		
			
				|  |  |                  ConfigureEditor(Notes, new MemoEditor());
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -                Activity.EditorDefinition = DatabaseSchema.Property(typeof(Assignment), CoreUtils.GetFullPropertyName<Assignment,Guid>(c=>c.ActivityLink.ID,".")).Editor;
 | 
	
		
			
				|  |  | +                Activity.EditorDefinition = DatabaseSchema.Property(typeof(Assignment), CoreUtils.GetFullPropertyName<Assignment,Guid>(c=>c.ActivityLink.ID,".")).Editor as ILookupEditor;
 | 
	
		
			
				|  |  |                  Activity.OtherColumns["Color"] = CoreUtils.GetFullPropertyName<Assignment,String>(c=>c.ActivityLink.Color,".");
 | 
	
		
			
				|  |  |                  Activity.OtherColumns["Description"] = CoreUtils.GetFullPropertyName<Assignment,String>(c=>c.ActivityLink.Description,".");
 | 
	
		
			
				|  |  |                  ConfigureEditor(Activity);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -                ITP.EditorDefinition = DatabaseSchema.Property(typeof(Assignment), "ITP.ID").Editor;
 | 
	
		
			
				|  |  | +                ITP.EditorDefinition = DatabaseSchema.Property(typeof(Assignment), "ITP.ID").Editor as ILookupEditor;
 | 
	
		
			
				|  |  |                  ITP.OtherColumns["Code"] = "ITP.Code";
 | 
	
		
			
				|  |  |                  //ConfigureEditor(ITP);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -                Kanban.EditorDefinition = DatabaseSchema.Property(typeof(Assignment), "Task.ID").Editor;
 | 
	
		
			
				|  |  | +                Kanban.EditorDefinition = DatabaseSchema.Property(typeof(Assignment), "Task.ID").Editor as ILookupEditor;
 | 
	
		
			
				|  |  |                  Kanban.OtherColumns["JobLink.ID"] = "JobLink.ID";
 | 
	
		
			
				|  |  |                  Kanban.OtherColumns["JobLink.JobNumber"] = "JobLink.JobNumber";
 | 
	
		
			
				|  |  |                  Kanban.OtherColumns["JobLink.Name"] = "JobLink.Name";
 | 
	
		
			
				|  |  |                  ConfigureEditor(Kanban);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -                Job.EditorDefinition = DatabaseSchema.Property(typeof(Assignment), "JobLink.ID").Editor;
 | 
	
		
			
				|  |  | +                Job.EditorDefinition = DatabaseSchema.Property(typeof(Assignment), "JobLink.ID").Editor as CodePopupEditor;
 | 
	
		
			
				|  |  |                  Job.OtherColumns["JobNumber"] = "JobLink.JobNumber";
 | 
	
		
			
				|  |  |                  Job.OtherColumns["Name"] = "JobLink.Name";
 | 
	
		
			
				|  |  | -                Job.OnDefineFilter += (sender, type) => { return LookupFactory.DefineFilter<Assignment, Job>(new[] { SelectedAssignment }); };
 | 
	
		
			
				|  |  |                  ConfigureEditor(Job);
 | 
	
		
			
				|  |  |                  
 | 
	
		
			
				|  |  |                  GotoCurrentRequiredReport();
 | 
	
	
		
			
				|  | @@ -349,7 +400,7 @@ namespace PRSDesktop
 | 
	
		
			
				|  |  |          
 | 
	
		
			
				|  |  |          public Employee Employee { get; set; }
 | 
	
		
			
				|  |  |          
 | 
	
		
			
				|  |  | -        public event DataModelUpdateEvent OnUpdateDataModel;
 | 
	
		
			
				|  |  | +        public event DataModelUpdateEvent? OnUpdateDataModel;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          public bool IsReady { get; set; }
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -383,7 +434,7 @@ namespace PRSDesktop
 | 
	
		
			
				|  |  |              
 | 
	
		
			
				|  |  |              menu.Items.RemoveAt(0);
 | 
	
		
			
				|  |  |              var create = new MenuItem { Header = "Create New Assignment" };
 | 
	
		
			
				|  |  | -            create.Tag = new Tuple<DateTime, AssignmentFavourite>(time, null);
 | 
	
		
			
				|  |  | +            create.Tag = new Tuple<DateTime, AssignmentFavourite?>(time, null);
 | 
	
		
			
				|  |  |              create.Click += action;
 | 
	
		
			
				|  |  |              menu.Items.Insert(0,create);
 | 
	
		
			
				|  |  |              
 | 
	
	
		
			
				|  | @@ -394,7 +445,7 @@ namespace PRSDesktop
 | 
	
		
			
				|  |  |                  foreach (var favourite in _settings.Favourites)
 | 
	
		
			
				|  |  |                  {
 | 
	
		
			
				|  |  |                      var fav = new MenuItem { Header = favourite.Title };
 | 
	
		
			
				|  |  | -                    fav.Tag = new Tuple<DateTime, AssignmentFavourite>(time, favourite);
 | 
	
		
			
				|  |  | +                    fav.Tag = new Tuple<DateTime, AssignmentFavourite?>(time, favourite);
 | 
	
		
			
				|  |  |                      fav.Click += action;
 | 
	
		
			
				|  |  |                      menu.Items.Insert(i,fav);
 | 
	
		
			
				|  |  |                      i++;
 | 
	
	
		
			
				|  | @@ -430,12 +481,12 @@ namespace PRSDesktop
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        private AssignmentFavourite GetFavourite(AssignmentModel model)
 | 
	
		
			
				|  |  | +        private AssignmentFavourite? GetFavourite(AssignmentModel? model)
 | 
	
		
			
				|  |  |          {
 | 
	
		
			
				|  |  |              return model == null ? null : _settings.Favourites.FirstOrDefault(x => string.Equals(x.Title, model.Subject));
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        private void SetAsFavourite(AssignmentModel model)
 | 
	
		
			
				|  |  | +        private void SetAsFavourite(AssignmentModel? model)
 | 
	
		
			
				|  |  |          {
 | 
	
		
			
				|  |  |              if (model == null)
 | 
	
		
			
				|  |  |              {
 | 
	
	
		
			
				|  | @@ -486,7 +537,7 @@ namespace PRSDesktop
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          private void CreateAssignment_Click(object sender, RoutedEventArgs e)
 | 
	
		
			
				|  |  |          {
 | 
	
		
			
				|  |  | -            var fav = (sender as MenuItem)?.Tag as Tuple<DateTime, AssignmentFavourite>;
 | 
	
		
			
				|  |  | +            var fav = (sender as MenuItem)?.Tag as Tuple<DateTime, AssignmentFavourite?>;
 | 
	
		
			
				|  |  |              var start = fav != null ? fav.Item1.TimeOfDay : Calendar.SelectedDate.TimeOfDay;
 | 
	
		
			
				|  |  |              CreateNewAssignment(start, fav?.Item2);
 | 
	
		
			
				|  |  |          }
 | 
	
	
		
			
				|  | @@ -613,8 +664,9 @@ namespace PRSDesktop
 | 
	
		
			
				|  |  |              Logger.Send(LogType.Information, ClientFactory.UserID, "Out Of Assignment_SelectionChanged()");
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        private void ConfigureEditor(BaseDynamicEditorControl editor, BaseEditor definition = null)
 | 
	
		
			
				|  |  | +        private void ConfigureEditor(BaseDynamicEditorControl editor, BaseEditor? definition = null)
 | 
	
		
			
				|  |  |          {
 | 
	
		
			
				|  |  | +            editor.Host = this;
 | 
	
		
			
				|  |  |              if (definition != null)
 | 
	
		
			
				|  |  |                  editor.EditorDefinition = definition;
 | 
	
		
			
				|  |  |              editor.Configure();
 |