KanbanShell.cs 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using Comal.Classes;
  5. using Xamarin.Forms;
  6. namespace comal.timesheets
  7. {
  8. public class KanbanShell : Shell<KanbanModel, KanbanSubscriber>
  9. {
  10. static KanbanShell()
  11. {
  12. Columns
  13. .Map(nameof(ID), x => x.Kanban.ID)
  14. .Map(nameof(Number), x => x.Kanban.Number)
  15. .Map(nameof(Title), x => x.Kanban.Title)
  16. .Map(nameof(Type), x => x.Kanban.Type.Code)
  17. .Map(nameof(Category), x => x.Kanban.Category)
  18. .Map(nameof(DueDate), x => x.Kanban.DueDate)
  19. .Map(nameof(Completed), x => x.Kanban.Completed)
  20. .Map(nameof(Summary), x => x.Kanban.Summary)
  21. .Map(nameof(ManagerName), x => x.Kanban.ManagerLink.Name)
  22. .Map(nameof(Attachments), x => x.Kanban.Attachments)
  23. .Map(nameof(Locked), x => x.Kanban.Locked)
  24. .Map(nameof(IsManager), x => x.Manager)
  25. .Map(nameof(IsEmployee), x => x.Assignee);
  26. }
  27. public Guid ID => Get<Guid>();
  28. public int Number => Get<int>();
  29. public string Title => Get<string>();
  30. public String Type => Get<string>();
  31. public string Category => Get<string>();
  32. public DateTime Completed => Get<DateTime>();
  33. public DateTime DueDate => Get<DateTime>();
  34. public String Summary => Get<String>();
  35. public String ManagerName => Get<String>();
  36. public int Attachments => Get<int>();
  37. public String ImagePath =>
  38. Attachments > 0 ? Device.RuntimePlatform.Equals(Device.iOS) ? "attachments.png" : "paperclip.png" : "";
  39. public bool Locked => Get<bool>();
  40. public bool IsManager => Get<bool>();
  41. public bool IsEmployee => Get<bool>();
  42. public bool IsObserver => !IsManager && !IsEmployee;
  43. public Color Color => IsEmployee
  44. ? DueDate > DateTime.Today.AddDays(7)
  45. ? Color.FromHex("#77dd77") //green / pastel green
  46. : DueDate > DateTime.Today
  47. ? Color.FromHex("#fff8dc") //cornsilk / light yellow
  48. : Color.FromHex("#f08080") //light coral / red
  49. : IsManager
  50. ? Color.LightGray
  51. : Color.FromHex("#cb99c9"); //purple / pastel violet
  52. }
  53. }