using System; using Comal.Classes; using InABox.Core; using InABox.Mobile; using Xamarin.Forms; using Xamarin.Forms.Xaml; namespace PRS.Mobile { public class TimeSheetShell : Shell { public static Filter UnprocessedTimeSheets => new Filter(x => x.EmployeeLink.ID) .IsEqualTo(App.Data.Me.ID) .And(x => x.Processed).IsEqualTo(DateTime.MinValue); protected override void ConfigureColumns(ShellColumns columns) { columns .Map(nameof(Date), x => x.Date) .Map(nameof(_actualstart), x => x.Start) .Map(nameof(_actualfinish), x => x.Finish) .Map(nameof(_approvedstart), x => x.ApprovedStart) .Map(nameof(_approvedfinish), x => x.ApprovedFinish) .Map(nameof(_approved), x => x.Approved) .Map(nameof(StartLongitude), x => x.StartLocation.Longitude) .Map(nameof(StartLatitude), x => x.StartLocation.Latitude) .Map(nameof(StartAddress), x => x.StartLocation.Address) .Map(nameof(StartTimeStamp), x => x.StartLocation.Timestamp) .Map(nameof(FinishLongitude), x => x.FinishLocation.Longitude) .Map(nameof(FinishLatitude), x => x.FinishLocation.Latitude) .Map(nameof(FinishAddress), x => x.FinishLocation.Address) .Map(nameof(FinishTimeStamp), x => x.FinishLocation.Timestamp) .Map(nameof(JobID), x => x.JobLink.ID) .Map(nameof(JobNumber), x => x.JobLink.JobNumber) .Map(nameof(JobName), x => x.JobLink.Name) .Map(nameof(Notes), x => x.Notes); } public DateTime Date { get => Get(); set => Set(value); } private TimeSpan _actualstart { get => Get(); set => Set(value); } private TimeSpan _actualfinish { get => Get(); set => Set(value); } private TimeSpan _approvedstart { get => Get(); set => Set(value); } private TimeSpan _approvedfinish { get => Get(); set => Set(value); } private DateTime _approved { get => Get(); set => Set(value); } public TimeSpan Start => _approved.IsEmpty() ? _actualstart : _approvedstart; public TimeSpan Finish => _approved.IsEmpty() ? _actualfinish : _approvedfinish; public ImageSource? Approved => _approved.IsEmpty() ? null : ImageSource.FromFile("tick"); public double StartLongitude { get => Get(); set => Set(value); } public double StartLatitude { get => Get(); set => Set(value); } public string StartAddress { get => Get(); set => Set(value); } public DateTime StartTimeStamp { get => Get(); set => Set(value); } public double FinishLongitude { get => Get(); set => Set(value); } public double FinishLatitude { get => Get(); set => Set(value); } public string FinishAddress { get => Get(); set => Set(value); } public DateTime FinishTimeStamp { get => Get(); set => Set(value); } public Guid JobID { get => Get(); set => Set(value); } public string JobNumber { get => Get(); set => Set(value); } public string JobName { get => Get(); set => Set(value); } public string Notes { get => Get(); set => Set(value); } } }