Procházet zdrojové kódy

Overhauled Assignment Screen

Frank van den Bos před 2 roky
rodič
revize
e11c77aa5a

+ 9 - 0
prs.classes/Entities/Employee/EmployeeLink.cs

@@ -43,5 +43,14 @@ namespace Comal.Classes
 
         [CodeEditor(Editable = Editable.Hidden)]
         public string PayrollID { get; set; }
+        
+        [NullEditor]
+        public ImageDocumentLink Thumbnail { get; set; }
+
+        protected override void Init()
+        {
+            base.Init();
+            Thumbnail = new ImageDocumentLink();
+        }
     }
 }

+ 7 - 18
prs.mobile/comal.timesheet.sln

@@ -177,24 +177,14 @@ Global
 		{0E153B89-280B-4485-9FD1-E055B8EDA078}.STATIC_ONLY NO_EXPRESSIONS|iPhone.Build.0 = Release|Any CPU
 		{0E153B89-280B-4485-9FD1-E055B8EDA078}.STATIC_ONLY NO_EXPRESSIONS|iPhoneSimulator.ActiveCfg = Release|Any CPU
 		{0E153B89-280B-4485-9FD1-E055B8EDA078}.STATIC_ONLY NO_EXPRESSIONS|iPhoneSimulator.Build.0 = Release|Any CPU
-		{C94220A8-3034-4CC7-B13D-8551DAACE4C6}.Ad-Hoc|Any CPU.ActiveCfg = Ad-Hoc|iPhoneSimulator
 		{C94220A8-3034-4CC7-B13D-8551DAACE4C6}.Ad-Hoc|iPhone.ActiveCfg = Ad-Hoc|iPhone
 		{C94220A8-3034-4CC7-B13D-8551DAACE4C6}.Ad-Hoc|iPhone.Build.0 = Ad-Hoc|iPhone
-		{C94220A8-3034-4CC7-B13D-8551DAACE4C6}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Ad-Hoc|iPhoneSimulator
-		{C94220A8-3034-4CC7-B13D-8551DAACE4C6}.Ad-Hoc|iPhoneSimulator.Build.0 = Ad-Hoc|iPhoneSimulator
-		{C94220A8-3034-4CC7-B13D-8551DAACE4C6}.AppStore|Any CPU.ActiveCfg = AppStore|iPhoneSimulator
 		{C94220A8-3034-4CC7-B13D-8551DAACE4C6}.AppStore|iPhone.ActiveCfg = AppStore|iPhone
 		{C94220A8-3034-4CC7-B13D-8551DAACE4C6}.AppStore|iPhone.Build.0 = AppStore|iPhone
-		{C94220A8-3034-4CC7-B13D-8551DAACE4C6}.AppStore|iPhoneSimulator.ActiveCfg = AppStore|iPhoneSimulator
-		{C94220A8-3034-4CC7-B13D-8551DAACE4C6}.AppStore|iPhoneSimulator.Build.0 = AppStore|iPhoneSimulator
 		{C94220A8-3034-4CC7-B13D-8551DAACE4C6}.CodeAnalysis|Any CPU.ActiveCfg = Debug|iPhoneSimulator
 		{C94220A8-3034-4CC7-B13D-8551DAACE4C6}.CodeAnalysis|Any CPU.Build.0 = Debug|iPhoneSimulator
 		{C94220A8-3034-4CC7-B13D-8551DAACE4C6}.CodeAnalysis|iPhone.ActiveCfg = Release|iPhone
 		{C94220A8-3034-4CC7-B13D-8551DAACE4C6}.CodeAnalysis|iPhone.Build.0 = Release|iPhone
-		{C94220A8-3034-4CC7-B13D-8551DAACE4C6}.CodeAnalysis|iPhoneSimulator.ActiveCfg = Ad-Hoc|iPhoneSimulator
-		{C94220A8-3034-4CC7-B13D-8551DAACE4C6}.CodeAnalysis|iPhoneSimulator.Build.0 = Ad-Hoc|iPhoneSimulator
-		{C94220A8-3034-4CC7-B13D-8551DAACE4C6}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator
-		{C94220A8-3034-4CC7-B13D-8551DAACE4C6}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator
 		{C94220A8-3034-4CC7-B13D-8551DAACE4C6}.Debug|iPhone.ActiveCfg = Debug|iPhone
 		{C94220A8-3034-4CC7-B13D-8551DAACE4C6}.Debug|iPhone.Build.0 = Debug|iPhone
 		{C94220A8-3034-4CC7-B13D-8551DAACE4C6}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
@@ -203,20 +193,14 @@ Global
 		{C94220A8-3034-4CC7-B13D-8551DAACE4C6}.Instrument|Any CPU.Build.0 = Debug|iPhoneSimulator
 		{C94220A8-3034-4CC7-B13D-8551DAACE4C6}.Instrument|iPhone.ActiveCfg = Release|iPhone
 		{C94220A8-3034-4CC7-B13D-8551DAACE4C6}.Instrument|iPhone.Build.0 = Release|iPhone
-		{C94220A8-3034-4CC7-B13D-8551DAACE4C6}.Instrument|iPhoneSimulator.ActiveCfg = Ad-Hoc|iPhoneSimulator
-		{C94220A8-3034-4CC7-B13D-8551DAACE4C6}.Instrument|iPhoneSimulator.Build.0 = Ad-Hoc|iPhoneSimulator
 		{C94220A8-3034-4CC7-B13D-8551DAACE4C6}.MonoTouch|Any CPU.ActiveCfg = Debug|iPhoneSimulator
 		{C94220A8-3034-4CC7-B13D-8551DAACE4C6}.MonoTouch|Any CPU.Build.0 = Debug|iPhoneSimulator
 		{C94220A8-3034-4CC7-B13D-8551DAACE4C6}.MonoTouch|iPhone.ActiveCfg = Release|iPhone
 		{C94220A8-3034-4CC7-B13D-8551DAACE4C6}.MonoTouch|iPhone.Build.0 = Release|iPhone
-		{C94220A8-3034-4CC7-B13D-8551DAACE4C6}.MonoTouch|iPhoneSimulator.ActiveCfg = Ad-Hoc|iPhoneSimulator
-		{C94220A8-3034-4CC7-B13D-8551DAACE4C6}.MonoTouch|iPhoneSimulator.Build.0 = Ad-Hoc|iPhoneSimulator
 		{C94220A8-3034-4CC7-B13D-8551DAACE4C6}.PerformanceTest|Any CPU.ActiveCfg = Debug|iPhoneSimulator
 		{C94220A8-3034-4CC7-B13D-8551DAACE4C6}.PerformanceTest|Any CPU.Build.0 = Debug|iPhoneSimulator
 		{C94220A8-3034-4CC7-B13D-8551DAACE4C6}.PerformanceTest|iPhone.ActiveCfg = Release|iPhone
 		{C94220A8-3034-4CC7-B13D-8551DAACE4C6}.PerformanceTest|iPhone.Build.0 = Release|iPhone
-		{C94220A8-3034-4CC7-B13D-8551DAACE4C6}.PerformanceTest|iPhoneSimulator.ActiveCfg = Ad-Hoc|iPhoneSimulator
-		{C94220A8-3034-4CC7-B13D-8551DAACE4C6}.PerformanceTest|iPhoneSimulator.Build.0 = Ad-Hoc|iPhoneSimulator
 		{C94220A8-3034-4CC7-B13D-8551DAACE4C6}.Release|Any CPU.ActiveCfg = Release|iPhoneSimulator
 		{C94220A8-3034-4CC7-B13D-8551DAACE4C6}.Release|Any CPU.Build.0 = Release|iPhoneSimulator
 		{C94220A8-3034-4CC7-B13D-8551DAACE4C6}.Release|iPhone.ActiveCfg = Release|iPhone
@@ -227,8 +211,10 @@ Global
 		{C94220A8-3034-4CC7-B13D-8551DAACE4C6}.STATIC_ONLY NO_EXPRESSIONS|Any CPU.Build.0 = Debug|iPhoneSimulator
 		{C94220A8-3034-4CC7-B13D-8551DAACE4C6}.STATIC_ONLY NO_EXPRESSIONS|iPhone.ActiveCfg = Release|iPhone
 		{C94220A8-3034-4CC7-B13D-8551DAACE4C6}.STATIC_ONLY NO_EXPRESSIONS|iPhone.Build.0 = Release|iPhone
-		{C94220A8-3034-4CC7-B13D-8551DAACE4C6}.STATIC_ONLY NO_EXPRESSIONS|iPhoneSimulator.ActiveCfg = Ad-Hoc|iPhoneSimulator
-		{C94220A8-3034-4CC7-B13D-8551DAACE4C6}.STATIC_ONLY NO_EXPRESSIONS|iPhoneSimulator.Build.0 = Ad-Hoc|iPhoneSimulator
+		{C94220A8-3034-4CC7-B13D-8551DAACE4C6}.Debug|Any CPU.ActiveCfg = Debug|iPhone
+		{C94220A8-3034-4CC7-B13D-8551DAACE4C6}.Debug|Any CPU.Build.0 = Debug|iPhone
+		{C94220A8-3034-4CC7-B13D-8551DAACE4C6}.Debug|Any CPU.Deploy.0 = Debug|iPhone
+		{C94220A8-3034-4CC7-B13D-8551DAACE4C6}.Debug|iPhoneSimulator.Deploy.0 = Debug|iPhoneSimulator
 		{DAC39203-29E5-4730-AF8F-8119DE28BDFC}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU
 		{DAC39203-29E5-4730-AF8F-8119DE28BDFC}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU
 		{DAC39203-29E5-4730-AF8F-8119DE28BDFC}.Ad-Hoc|Any CPU.Deploy.0 = Release|Any CPU
@@ -299,6 +285,7 @@ Global
 		{DAC39203-29E5-4730-AF8F-8119DE28BDFC}.STATIC_ONLY NO_EXPRESSIONS|iPhoneSimulator.ActiveCfg = Release|Any CPU
 		{DAC39203-29E5-4730-AF8F-8119DE28BDFC}.STATIC_ONLY NO_EXPRESSIONS|iPhoneSimulator.Build.0 = Release|Any CPU
 		{DAC39203-29E5-4730-AF8F-8119DE28BDFC}.STATIC_ONLY NO_EXPRESSIONS|iPhoneSimulator.Deploy.0 = Release|Any CPU
+		{DAC39203-29E5-4730-AF8F-8119DE28BDFC}.Debug|iPhoneSimulator.Deploy.0 = Debug|Any CPU
 		{6E02A9D5-8DFB-48E6-A585-632AF0B1B5D9}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU
 		{6E02A9D5-8DFB-48E6-A585-632AF0B1B5D9}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU
 		{6E02A9D5-8DFB-48E6-A585-632AF0B1B5D9}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU
@@ -623,6 +610,8 @@ Global
 		{63845795-416F-4848-9DC1-63E992803D29}.STATIC_ONLY NO_EXPRESSIONS|iPhone.Build.0 = Debug|Any CPU
 		{63845795-416F-4848-9DC1-63E992803D29}.STATIC_ONLY NO_EXPRESSIONS|iPhoneSimulator.ActiveCfg = Debug|Any CPU
 		{63845795-416F-4848-9DC1-63E992803D29}.STATIC_ONLY NO_EXPRESSIONS|iPhoneSimulator.Build.0 = Debug|Any CPU
+		{803042CA-E67E-44E6-B73C-244AE5BB2A09}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{803042CA-E67E-44E6-B73C-244AE5BB2A09}.Debug|Any CPU.Build.0 = Debug|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE

+ 0 - 1
prs.mobile/comal.timesheets.Android/Resources/Resource.designer.cs

@@ -2,7 +2,6 @@
 //------------------------------------------------------------------------------
 // <auto-generated>
 //     This code was generated by a tool.
-//     Runtime Version:4.0.30319.42000
 //
 //     Changes to this file may cause incorrect behavior and will be lost if
 //     the code is regenerated.

+ 1 - 0
prs.mobile/comal.timesheets.iOS/AppDelegate.cs

@@ -48,6 +48,7 @@ namespace comal.timesheets.iOS
             Syncfusion.XForms.iOS.MaskedEdit.SfMaskedEditRenderer.Init();
             SfTreeViewRenderer.Init();
             Syncfusion.SfSchedule.XForms.iOS.SfScheduleRenderer.Init();
+            new Syncfusion.SfSchedule.XForms.iOS.SfScheduleRenderer();
             XF.Material.iOS.Material.Init();
             ZXing.Net.Mobile.Forms.iOS.Platform.Init();
             Xamarin.IQKeyboardManager.SharedManager.Enable = true;

+ 2 - 2
prs.mobile/comal.timesheets.iOS/comal.timesheets.iOS.csproj

@@ -59,16 +59,16 @@
     <WarningLevel>4</WarningLevel>
     <ConsolePause>false</ConsolePause>
     <MtouchArch>ARM64</MtouchArch>
-    <CodesignKey>Apple Development: Frank vandenBos (FDHP649PS7)</CodesignKey>
+    <CodesignKey>iPhone Developer</CodesignKey>
     <MtouchDebug>true</MtouchDebug>
     <CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
     <MtouchLink>SdkOnly</MtouchLink>
     <DeviceSpecificBuild>true</DeviceSpecificBuild>
     <MtouchFastDev>true</MtouchFastDev>
     <MtouchInterpreter>-all</MtouchInterpreter>
-    <CodesignProvision>VS: WildCard Development</CodesignProvision>
     <MtouchHttpClientHandler>NSUrlSessionHandler</MtouchHttpClientHandler>
     <LangVersion>8.0</LangVersion>
+    <MtouchExtraArgs>--interpreter</MtouchExtraArgs>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' ">
     <DebugType>none</DebugType>

+ 106 - 7
prs.mobile/comal.timesheets/Assignments/AssignmentList.xaml

@@ -7,6 +7,40 @@
     xmlns:local="clr-namespace:comal.timesheets"
     xmlns:schedule="clr-namespace:Syncfusion.SfSchedule.XForms;assembly=Syncfusion.SfSchedule.XForms"
 >
+    <ContentPage.Resources>
+        <ResourceDictionary>
+            <DataTemplate x:Key="DayViewAppointments">
+                <Grid>
+                    <Grid.ColumnDefinitions>
+                        <ColumnDefinition Width="*"/>
+                        <ColumnDefinition Width="Auto"/>
+                    </Grid.ColumnDefinitions>
+                    <Grid.RowDefinitions>
+                        <RowDefinition Height="Auto"/>
+                        <RowDefinition Height="*"/>
+                    </Grid.RowDefinitions>
+                    <Frame Grid.ColumnSpan="2" Grid.RowSpan="2" BorderColor="Gray" Margin="1" CornerRadius="5" HasShadow="False" Background="{Binding Color}" />
+                    <Label Grid.Row="0" Grid.Column="0" Margin="5,2,0,0" FontAttributes="Bold" FontSize="Small" Text="{Binding Subject}" />
+                    <Image Grid.Row="0" Grid.Column="1" Margin="0,2,5,0" Source="gear" HeightRequest="32" WidthRequest="32" IsVisible="{Binding Completed}"/>
+                    <Label Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Margin="5,0,2,5" FontSize="Small" Text="{Binding Notes}" />
+                </Grid>
+            </DataTemplate>
+    
+            <schedule:ScheduleAppointmentMapping x:Key="AppointmentMapping"
+                IdMapping="Id"
+                SubjectMapping="Subject"
+                ColorMapping="Color"
+                StartTimeMapping="StartTime"
+                EndTimeMapping="EndTime"
+                NotesMapping="Notes"
+                TextColorMapping="TextColor"
+                ResourceIdsMapping="ResourceIds"
+                >
+            </schedule:ScheduleAppointmentMapping>
+    
+        </ResourceDictionary>
+    </ContentPage.Resources>
+    
     <ContentPage.BindingContext>
         <local:AssignmentListDataModel x:Name="DataModel"/>
     </ContentPage.BindingContext>
@@ -83,12 +117,77 @@
     </NavigationPage.TitleView>
     
     <ContentPage.Content>
-        <ScrollView>
-            <Grid x:Name="Grid">
-                <Grid.RowDefinitions>
-                    <RowDefinition Height="1350"/>
-                </Grid.RowDefinitions>
-            </Grid>
-        </ScrollView>
+        <Grid>
+            <Grid.ColumnDefinitions>
+                <ColumnDefinition Width="*" x:Name="DayViewColumn"/>
+                <ColumnDefinition Width="0" x:Name="TimeLineViewColumn"/>
+            </Grid.ColumnDefinitions>
+            <Grid.RowDefinitions>
+                <RowDefinition Height="*"/>
+            </Grid.RowDefinitions>
+
+            <schedule:SfSchedule  x:Name="DayView"
+                Grid.Column="0"
+                ScheduleView="DayView" 
+                HeaderHeight="0"
+                ViewHeaderHeight="0"
+                TimeInterval="60"
+                Background="White"
+                EnableNavigation="False"
+                VerticalOptions="Fill"
+                ShowResourceView="False"
+                ResourceViewMode="Absolute"
+                TimeIntervalHeight="150"
+                AppointmentMapping="{StaticResource AppointmentMapping}"
+                AppointmentTemplate="{StaticResource DayViewAppointments}"
+                CellTapped="Schedule_OnCellTapped"
+                CellLongPressed="Schedule_OnCellLongPressed"
+            >
+                
+                <schedule:SfSchedule.DayViewSettings>
+                    <schedule:DayViewSettings TimeRulerSize="50"/>
+                </schedule:SfSchedule.DayViewSettings>
+                
+            </schedule:SfSchedule>
+            
+            <schedule:SfSchedule x:Name="TimeLineView"
+                Grid.Column="1"
+                ScheduleView="TimelineView" 
+                HeaderHeight="0"
+                ViewHeaderHeight="0"
+                TimeInterval="60"
+                Background="White"
+                ShowResourceView="False"
+                EnableNavigation="False"
+                ResourceViewHeight="50"
+                ResourceViewMode="Absolute"
+                TimeIntervalHeight="150"
+                AppointmentMapping="{StaticResource AppointmentMapping}"
+                AppointmentTemplate="{StaticResource DayViewAppointments}"
+                CellTapped="Schedule_OnCellTapped"
+                CellLongPressed="Schedule_OnCellLongPressed"
+            >
+                
+                <schedule:SfSchedule.TimelineViewSettings>
+                    <schedule:TimelineViewSettings AppointmentHeight="200"/>
+                </schedule:SfSchedule.TimelineViewSettings>
+                
+                <schedule:SfSchedule.ResourceItemTemplate>
+                     <DataTemplate>
+                         <Grid >
+                             <Grid.RowDefinitions>
+                                 <RowDefinition Height="*"/>
+                             </Grid.RowDefinitions>
+                             <Grid.ColumnDefinitions>
+                                 <ColumnDefinition Width="*"/>
+                             </Grid.ColumnDefinitions>
+                             <Label Text="{Binding Name}" Margin="-100,-0,-100,0" FontSize="Micro" HorizontalOptions="CenterAndExpand" VerticalOptions="CenterAndExpand" HorizontalTextAlignment="Center" VerticalTextAlignment="Center" Rotation="-90"/>
+                         </Grid>
+
+                     </DataTemplate>
+                </schedule:SfSchedule.ResourceItemTemplate>
+                
+            </schedule:SfSchedule>
+        </Grid>
     </ContentPage.Content>
 </ContentPage>

+ 145 - 53
prs.mobile/comal.timesheets/Assignments/AssignmentList.xaml.cs

@@ -10,95 +10,118 @@ using System.Threading.Tasks;
 using comal.timesheets.CustomControls;
 using comal.timesheets.iOS.Assignments;
 using InABox.Configuration;
+using Syncfusion.Office;
 using Syncfusion.SfSchedule.XForms;
 using Xamarin.Forms.Xaml;
+using XF.Material.Forms;
 using XF.Material.Forms.UI.Dialogs;
+using XF.Material.Forms.UI.Dialogs.Configurations;
 
 namespace comal.timesheets
 {
+
+    public enum AssignmentView
+    {
+        Day,
+        TimeLine
+    }
+    
     public partial class AssignmentList : ContentPage
     {
 
         private AssignmentEdit _editor = null;
 
-        private Guid[] _employeeids = new Guid[] { App.Data.Employee.ID };
+        private Guid[] _employeeids = new Guid[] { };
+        
+        private AssignmentModuleSettings _settings = null;
 
-        private List<AssignmentColumn> _columns = new List<AssignmentColumn>();
+        private AssignmentView _view = AssignmentView.Day;
 
-        private AssignmentModuleSettings _settings = null;
-        
         public AssignmentList()
         {
             InitializeComponent();
             _settings = new LocalConfiguration<AssignmentModuleSettings>().Load();
-            
+
             DatePicker.Date = _settings.Date.IsEmpty() ? DateTime.Today : _settings.Date;
             
-            if (_settings.Employees != null)
-                _employeeids = _settings.Employees;
+            _view = _settings.View;
+            
+            _employeeids = (_settings.Employees != null)
+                ? _settings.Employees
+                : new Guid[] { App.Data.Employee.ID };
             
-            ReloadColumns();
         }
-
-        private void ReloadColumns()
+        
+        
+        protected override void OnAppearing()
+        {
+            base.OnAppearing();
+            Reload();
+        }
+        
+        private void Reload()
         {
-            _columns.Clear();
-            Grid.Children.Clear();
-            Grid.ColumnDefinitions.Clear();
-            foreach (var empid in _employeeids)
+
+            DayView.DataSource = null;         
+            TimeLineView.DataSource = null;    
+            
+            if (_view == AssignmentView.Day)
             {
-                AssignmentColumn column = new AssignmentColumn();
-                column.OnChanged += (o,e) => Refresh();
-                column.EmployeeID = empid;
-                var empname = GlobalVariables.EmployeeShells.FirstOrDefault(x => x.ID == empid)?.Name;
-                var comps = (empname ?? empid.ToString()).Split(' ');
-                column.EmployeeName = _employeeids.Length == 1 
-                    ? empname
-                    : string.Format("{0}{1}", comps.First().Substring(0, 1), comps.Length > 1 ? comps.Skip(1).First().Substring(0, 1) : "");
-               
-                if (_columns.Count == 0)
+                DayViewColumn.Width = new GridLength(1, GridUnitType.Star);
+                TimeLineViewColumn.Width = new GridLength(0, GridUnitType.Absolute);
+                DayView.DayViewSettings.DayLabelSettings.TimeFormat = "HH:mm";
+            }
+            else
+            {
+                DayViewColumn.Width = new GridLength(0, GridUnitType.Absolute);
+                TimeLineViewColumn.Width = new GridLength(1, GridUnitType.Star);
+
+                TimeLineView.ResourceViewSettings.VisibleResourceCount = Math.Max(1,Math.Min(8, _employeeids.Length));
+                TimeLineView.TimelineViewSettings.AppointmentHeight =
+                    (this.Height / TimeLineView.ResourceViewSettings.VisibleResourceCount) + 100;
+                
+                var resources = new ObservableCollection<object>();
+                foreach (var empid in _employeeids)
                 {
-                    Grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(50,GridUnitType.Absolute)});
-                    column.SetValue(Grid.ColumnProperty,0);
-                    column.SetValue(Grid.ColumnSpanProperty,2);
+                    var empname = GlobalVariables.EmployeeShells.FirstOrDefault(x => x.ID == empid)?.Name ?? empid.ToString();
+                    resources.Add(
+                        new ScheduleResource()
+                        {
+                            Name =  empname, //String.Join("", empname.Split(' ').Select(x=>x.Substring(0,1))),
+                            Id = empid,
+                            Color = Color.Red,
+                            Image = ""
+                        }
+                    );
                 }
-                else
-                    column.SetValue(Grid.ColumnProperty, _columns.Count + 1);
+                TimeLineView.ScheduleResources = resources;
+                TimeLineView.ShowResourceView = true;
 
-                column.ShowTime = _columns.Count == 0;
-                Grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star)});
-                Grid.Children.Add(column);
-                _columns.Add(column);            
             }
+            
+
+
+            Refresh();
         }
         
-        
         private void Refresh()
         {
             Title.Text = $"{DatePicker.Date:dd MMMM yyyy}";
-            
             DataModel.Load(
                 new Filter<Assignment>(x => x.Date).IsEqualTo(DatePicker.Date).And(x => x.EmployeeLink.ID).InList(_employeeids),
                 () =>
                 {
                     Dispatcher.BeginInvokeOnMainThread(() =>{
-                        foreach (var column in _columns)
-                        {
-                            column.Date = DatePicker.Date;
-                            column.Load(DataModel.Items.Where(x => x.EmployeeId == column.EmployeeID).ToArray());
-                        }
+                        if (_view == AssignmentView.Day)
+                            DayView.DataSource = new ObservableCollection<AssignmentListDataModelItem>(DataModel.Items);
+                        else
+                            TimeLineView.DataSource = new ObservableCollection<AssignmentListDataModelItem>(DataModel.Items);
                     });
 
                 }
             );
 
        }
-
-        protected override void OnAppearing()
-        {
-            base.OnAppearing();
-                Refresh();
-        }
         
         private void BackButton_OnClicked(object sender, EventArgs e)
         {
@@ -112,9 +135,17 @@ namespace comal.timesheets
 
         private void DatePicker_OnDateSelected(object sender, DateChangedEventArgs e)
         {
-            _settings.Date = DatePicker.Date;
-            new LocalConfiguration<AssignmentModuleSettings>().Save(_settings);
-            Refresh();
+            if (_employeeids.Any())
+            {
+                _settings.Date = DatePicker.Date;
+                new LocalConfiguration<AssignmentModuleSettings>().Save(_settings);
+            }
+            DayView.MoveToDate = DatePicker.Date;
+            TimeLineView.MoveToDate = DatePicker.Date;
+            Dispatcher.BeginInvokeOnMainThread(()=>
+            {
+                Refresh();
+            });
         }
 
         private async void SelectEmployees_Tapped(object sender, EventArgs e)
@@ -125,22 +156,83 @@ namespace comal.timesheets
             
             var result = await MaterialDialog.Instance.SelectActionAsync(title: "Select a Team", 
                 actions: actions);
-            
+
             if (result == 0)
+            {
+                _view = AssignmentView.Day;
                 _employeeids = new Guid[] { App.Data.Employee.ID };
+            }
             else if (result > 0)
+            {
+                _view = AssignmentView.TimeLine;
                 _employeeids = GlobalVariables.TeamEmployeeShells.Where(x => String.Equals(x.TeamName, actions[result]))
                     .Select(x => x.ID).Distinct().ToArray();
-            
+            }
+
             _settings.Employees = _employeeids;
+            _settings.View = _view;
             new LocalConfiguration<AssignmentModuleSettings>().Save(_settings);
             
             Dispatcher.BeginInvokeOnMainThread(()=>
             {
-                ReloadColumns();
-                Refresh();
+                Reload();
             });
         }
         
+        private async void Schedule_OnCellTapped(object sender, CellTappedEventArgs e)
+        {
+            if (e.Appointment is AssignmentListDataModelItem item)
+            {
+                var editor = new AssignmentEdit(item);
+                Navigation.PushAsync(editor);
+            }
+        }
+        
+        private async void Schedule_OnCellLongPressed(object sender, CellTappedEventArgs e)
+        {
+            if (e.Appointment == null)
+            {
+                if (InABox.Core.Security.CanEdit<Assignment>())
+                {
+                    var assignment = new Assignment()
+                    {
+                        Date = e.Datetime.Date,
+                        Start = new TimeSpan(e.Datetime.TimeOfDay.Hours,0,0),
+                        Finish = e.Datetime.TimeOfDay.Add(new TimeSpan(1, 0, 0)),
+                        Duration = new TimeSpan(1, 0, 0),
+                        Title = "New Assignment"
+                    };
+                    assignment.EmployeeLink.ID = (e.Resource is ScheduleResource sr)
+                        ? (Guid)sr.Id
+                        : App.Data.Employee.ID;
+                    
+                    var editor = new AssignmentEdit(assignment);
+                    Navigation.PushAsync(editor);
+                }
+            }
+            else if (InABox.Core.Security.CanDelete<Assignment>())
+            {
+                var confirm = await MaterialDialog.Instance.ConfirmAsync(
+                    "Are you sure you wish to delete this assignment?",
+                    "Confirm Deletion",
+                    "Yes, Delete", 
+                    "Cancel", 
+                    new MaterialAlertDialogConfiguration()
+                    {
+                        ButtonFontFamily = Material.FontFamily.Body2
+                    }
+                );
+                if (confirm == true)
+                {
+                    using(await MaterialDialog.Instance.LoadingDialogAsync(message: "Deleting Assignment"))
+                    {
+                        var assignment = new Assignment() { ID = (e.Appointment as AssignmentListDataModelItem).Id };
+                        new Client<Assignment>().Delete(assignment, "Deleted on Mobile Device");
+                    }
+                    Refresh();
+                }
+            }
+        }
+        
     }
 }

+ 4 - 0
prs.mobile/comal.timesheets/Assignments/AssignmentListDataModel.cs

@@ -1,5 +1,7 @@
+using System;
 using Comal.Classes;
 using InABox.Core;
+using Xamarin.Forms;
 
 namespace comal.timesheets
 {
@@ -17,5 +19,7 @@ namespace comal.timesheets
             .Add(x=>x.JobLink.ID)
             .Add(x=>x.JobLink.JobNumber)
             .Add(x=>x.Completed);
+
     }
+    
 }

+ 5 - 2
prs.mobile/comal.timesheets/Assignments/AssignmentListDataModelItem.cs

@@ -27,10 +27,10 @@ namespace comal.timesheets
         
         public string Notes => Row.Get<Assignment, String>(c => c.Description);
         
-        public DateTime From =>
+        public DateTime StartTime =>
             Row.Get<Assignment, DateTime>(c => c.Date).Add(Row.Get<Assignment, TimeSpan>(c => c.Start));
 
-        public DateTime To =>
+        public DateTime EndTime =>
             Row.Get<Assignment, DateTime>(c => c.Date).Add(Row.Get<Assignment, TimeSpan>(c => c.Finish));
 
         public bool Completed => !Row.Get<Assignment, DateTime>(c => c.Completed).IsEmpty();
@@ -44,9 +44,12 @@ namespace comal.timesheets
                     ? Color.FromHex(color)
                     : Color.Silver;
             }
+            set { Row.Set<Assignment, String>(c => c.ActivityLink.Color, value.ToHex()); }
         }
 
         public Color TextColor => Color.Black;
 
+        public ObservableCollection<object> ResourceIds => new ObservableCollection<object>() { Row.Get<Assignment, Guid>(c => c.EmployeeLink.ID) };
+
     }
 }

+ 1 - 0
prs.mobile/comal.timesheets/Assignments/AssignmentModuleSettings.cs

@@ -6,6 +6,7 @@ namespace comal.timesheets
     public class AssignmentModuleSettings : LocalConfigurationSettings
     {
         public DateTime Date { get; set; }
+        public AssignmentView View { get; set; }
         public Guid[] Employees { get; set; }
     }
 }

+ 2 - 0
prs.mobile/comal.timesheets/Data Classes/EmployeeShell.cs

@@ -8,6 +8,7 @@ namespace comal.timesheets
     public class EmployeeShell 
     {
         public Guid ID { get; set; }
+        public String Code { get; set; }
         public String Name { get; set; }        
         public String TeamName { get; set; }
         public Color Color { get; set; }
@@ -16,6 +17,7 @@ namespace comal.timesheets
         public EmployeeShell()
         {
             ID = Guid.Empty;
+            Code = "";
             Name = "";
             TeamName = "";
             Color = Color.Default;

+ 10 - 15
prs.mobile/comal.timesheets/Main/MainPage.xaml.cs

@@ -22,6 +22,7 @@ using comal.timesheets.StoreRequis;
 using PRSSecurity = InABox.Core.Security;
 using Plugin.LocalNotification;
 using comal.timesheets.Tasks;
+using RestSharp.Extensions;
 
 namespace comal.timesheets
 {
@@ -1360,7 +1361,9 @@ namespace comal.timesheets
                 
                 query.Add<Employee>(
                     LookupFactory.DefineFilter<Employee>(),
-                    new Columns<Employee>(x => x.ID).Add(x => x.Name),
+                    new Columns<Employee>(x => x.ID)
+                        .Add(x=>x.Code)
+                        .Add(x => x.Name),
                     LookupFactory.DefineSort<Employee>()
                 );
                 
@@ -1372,7 +1375,10 @@ namespace comal.timesheets
                 
                 query.Add<EmployeeTeam>(
                     LookupFactory.DefineFilter<EmployeeTeam>(),
-                    new Columns<EmployeeTeam>(x => x.EmployeeLink.ID, x => x.EmployeeLink.Name, x => x.TeamLink.Name),
+                    new Columns<EmployeeTeam>(x => x.EmployeeLink.ID)
+                        .Add(x=>x.EmployeeLink.Code)
+                        .Add(x => x.EmployeeLink.Name)
+                        .Add(x => x.TeamLink.Name),
                     new SortOrder<EmployeeTeam>(x => x.EmployeeLink.Name)
                 );
                 
@@ -1385,6 +1391,7 @@ namespace comal.timesheets
                         new EmployeeShell()
                         {
                             ID = row.Get<Employee, Guid>(x => x.ID),
+                            Code = row.Get<Employee,String>(x => x.Code),
                             Name = row.Get<Employee, String>(x => x.Name),
                             TeamName = "All Staff"
                         }
@@ -1400,6 +1407,7 @@ namespace comal.timesheets
                         new EmployeeShell()
                         {
                             ID = row.Get<EmployeeTeam, Guid>(x => x.EmployeeLink.ID),
+                            Code = row.Get<EmployeeTeam,String>(x => x.EmployeeLink.Code),
                             Name = row.Get<EmployeeTeam, String>(x => x.EmployeeLink.Name),
                             TeamName = row.Get<EmployeeTeam, String>(x => x.TeamLink.Name)
                         }
@@ -1412,19 +1420,6 @@ namespace comal.timesheets
             
         }
 
-        private string AddTeamName(string s)
-        {
-            if (s.Equals("Factory Staff"))
-                s = "Factory";
-            else if (s.Equals("Office Staff"))
-                s = "Office";
-            else if (s.Equals("All Staff"))
-                s = "All";
-            else if (s.Equals("Site Staff"))
-                s = "Site";
-            return s;
-        }
-
         async void LoadJobShells()
         {
             try