コード例 #1
0
        private void AddTimeSheet(TimeSheet item)
        {
            TimeSheetPeriod timeSheet = new TimeSheetPeriod();

            timeSheet.TimeSheetId         = item.Id;
            timeSheet.StartDate           = item.StartDate.Value;
            timeSheet.EndDate             = item.EndDate.Value;
            timeSheet.ActualHours         = item.ActualHours;
            timeSheet.ActualHoursFormated = item.ActualHoursFormattedString;
            timeSheet.Status      = item.ApprovalStatus;
            timeSheet.TimeEntries = item.TimeEntries;
            timeSheet.User_Id     = item.User_Id;

            if (item.UserApproved != null)
            {
                timeSheet.UserAvatar   = item.UserApproved.AvatarHtml;
                timeSheet.UserPhotoUrl = item.UserApproved.PhotoUrl;
            }
            else if (item.UserRejected != null)
            {
                timeSheet.UserAvatar   = item.UserRejected.AvatarHtml;
                timeSheet.UserPhotoUrl = item.UserRejected.PhotoUrl;
            }
            else if (item.UserApprover != null)
            {
                timeSheet.UserAvatar   = item.UserApprover.AvatarHtml;
                timeSheet.UserPhotoUrl = item.UserApprover.PhotoUrl;
            }

            //timeSheet.Name = item.User.FirstName + " " + item.User.LastName;
            viewModel.PastPeriods.Add(timeSheet);
        }
コード例 #2
0
        public ApproveTimesheetPage(TimeSheetPeriod item, bool isCurrent = false)
        {
            NavigationPage.SetBackButtonTitle(this, "");
            InitializeComponent();
            tsp = item;
            if (isCurrent)
            {
                slButtonsForUnsubmited.IsVisible = true;
            }
            else
            {
                slButtonsForUnsubmited.IsVisible = item.ShowSubmitButton;
                if (item.ShowPendingApprovalIcon && item.User_Id == Common.CurrentWorkspace.UserID)
                {
                    ToolbarItems.Add(new ToolbarItem()
                    {
                        Text = "", Icon = "unsubmit_icon.png", Command = new Command(this.btnDeleteTimesheet_Clicked)
                    });
                }
            }
            viewModel             = new ApproveTimeSheetViewModel();
            viewModel.VisibleLoad = true;
            BindingContext        = viewModel;
            LoadData();

            //HockeyApp.MetricsManager.TrackEvent("MyTimePage Initialize");
        }
コード例 #3
0
        private void AddPreviousTimeSheets(TimeSheetInfo item)
        {
            if (item.ActualHoursNotOnTimeSheet.HasValue && item.ActualHoursNotOnTimeSheet > 0)
            {
                TimeSheetPeriod PastPeriod = new TimeSheetPeriod();
                PastPeriod.StartDate           = item.StartDate;
                PastPeriod.EndDate             = item.EndDate;
                PastPeriod.ActualHours         = (item.ActualHoursNotOnTimeSheet ?? 0);
                PastPeriod.ActualHoursFormated = item.ActualHoursNotOnTimeSheetFormattedString;
                PastPeriod.Status           = item.TimeSheet != null ? item.TimeSheet.ApprovalStatus : 0;
                PastPeriod.ShowSubmitButton = true;

                viewModel.PastPeriods.Add(PastPeriod);

                if (item.AllTimeSheetsForPeriod != null && item.AllTimeSheetsForPeriod.Count > 0)
                {
                    foreach (var ts in item.AllTimeSheetsForPeriod)
                    {
                        AddTimeSheet(ts);
                    }
                }
            }
            else
            {
                if (item.AllTimeSheetsForPeriod != null && item.AllTimeSheetsForPeriod.Count > 0)
                {
                    foreach (var ts in item.AllTimeSheetsForPeriod)
                    {
                        AddTimeSheet(ts);
                    }
                }
            }
        }
コード例 #4
0
        public async Task <UpdateTimeSheetResponse> Handle(UpdateTimeSheetRequest request, CancellationToken cancellationToken)
        {
            var userId = new UserId(1);

            var timePeriod = await _databaseContext.TimeSheetPeriods
                             .Include(p => p.TimeEntries)
                             .Include(p => p.DomainEvents)
                             .SingleOrDefaultAsync(p => p.Year == request.Year && p.Month == request.Month && p.UserId == userId, cancellationToken);

            var timeEntries = request
                              .Entries
                              .Where(e => e.Hours > 0)
                              .Select(e => new TimeEntry
            {
                Year   = request.Year,
                Month  = request.Month,
                Day    = e.Day,
                Hours  = e.Hours,
                UserId = userId
            })
                              .ToList();

            if (timePeriod == null)
            {
                timePeriod = new TimeSheetPeriod(request.Year, request.Month, userId, timeEntries);
                await _databaseContext.TimeSheetPeriods.AddAsync(timePeriod, cancellationToken);
            }

            timePeriod.UpdateHours(timeEntries);

            await _databaseContext.SaveChangesAsync(cancellationToken);

            return(new UpdateTimeSheetResponse());
        }
コード例 #5
0
        public SubmitTimeSheetPage(TimeSheetPeriod timeSheet)
        {
            NavigationPage.SetBackButtonTitle(this, "");
            InitializeComponent();

            //HockeyApp.MetricsManager.TrackEvent("SubmitTimeSheetPage Initialize");

            viewModel = new SubmitTimeSheetViewModel();
            LoadData(timeSheet);

            BindingContext        = viewModel;
            viewModel.VisibleLoad = false;
        }
コード例 #6
0
        private void GetData()
        {
            viewModel.VisibleLoad = true;

            List <TimeSheet> result = TimeSheetService.GetTimesheetsForApproval();

            lstAllPeriod.Children.Clear();
            if (result != null && result.Count > 0)
            {
                int i = 0;
                foreach (var timeSheet in result)
                {
                    i++;
                    TimeSheetPeriod item = new TimeSheetPeriod();
                    item.StartDate           = timeSheet.StartDate.Value;
                    item.EndDate             = timeSheet.EndDate.Value;
                    item.ActualHours         = (timeSheet.ActualHours ?? 0);
                    item.ActualHoursFormated = timeSheet.ActualHoursFormattedString;
                    item.Status = timeSheet.ApprovalStatus ?? 0;
                    item.Name   = timeSheet.User.FirstName + " " + timeSheet.User.LastName;
                    //item.TimeEntries = timeSheet.TimeEntries;
                    item.TimeSheetId = timeSheet.Id;
                    item.User_Id     = timeSheet.User_Id;
                    viewModel.TimeSheets.Add(item);

                    //AddChildTimeSheets(timeSheet);
                    if (i == result.Count)
                    {
                        PreviousPeriods_GeneratedRows(item, true);
                    }
                    else
                    {
                        PreviousPeriods_GeneratedRows(item);
                    }
                }
            }
            else
            {
                lblNoNotif.IsVisible = true;
            }
            viewModel.VisibleLoad = false;
        }
コード例 #7
0
        private async void LoadData(TimeSheetPeriod timeSheet)
        {
            viewModel.VisibleLoad    = true;
            viewModel.LoadingMessage = "";

            viewModel.VisibleLoad = true;
            viewModel.TimeSheet   = timeSheet;

            viewModel.CanSelectTimeSheetApprover = Common.UserGlobalCapability.CanSelectTimeSheetApprover;

            if (Common.UserGlobalCapability.CanSelectTimeSheetApprover)
            {
                viewModel.TimeSheetApprovers = await UsersService.GetMyTimeSheetApprovers();

                if (Common.UserGlobalCapability.UserId_TimeSheetApproverDefault != null)
                {
                    viewModel.SelectedUser = viewModel.TimeSheetApprovers.FirstOrDefault(x => x.Id == Common.UserGlobalCapability.UserId_TimeSheetApproverDefault);
                }
            }
            viewModel.IsBusy      = true;
            viewModel.VisibleLoad = false;
        }
コード例 #8
0
        private void PreviousPeriods_GeneratedRows(TimeSheetPeriod item, bool AddLineAtBottom = false)
        {
            BoxView line = new BoxView();

            line.HeightRequest     = 0.5;
            line.Color             = (Color)Application.Current.Resources["DarkGrayTextColor"];
            line.HorizontalOptions = LayoutOptions.FillAndExpand;
            line.Margin            = 0;
            Label lblId = new Label();

            lblId.IsVisible = false;
            if (item.TimeSheetId != null)
            {
                lblId.Text = "id:" + item.TimeSheetId.ToString();
            }
            else
            {
                lblId.Text = item.PeriodFormated;
            }
            lblId.Margin = 0;

            StackLayout main = new StackLayout();

            main.HorizontalOptions = LayoutOptions.FillAndExpand;
            main.VerticalOptions   = LayoutOptions.CenterAndExpand;
            main.Orientation       = StackOrientation.Vertical;
            main.Padding           = 0;
            main.Margin            = 0;
            main.Spacing           = 0;
            main.BackgroundColor   = (Color)Application.Current.Resources["WhiteTextColor"];
            main.Children.Add(line);
            //main.Children.Add(lblId);

            StackLayout first = new StackLayout();

            first.HorizontalOptions = LayoutOptions.FillAndExpand;
            first.BackgroundColor   = (Color)Application.Current.Resources["WhiteTextColor"];
            first.Padding           = new Thickness(18, 5, 15, 5);
            first.Orientation       = StackOrientation.Horizontal;
            main.Children.Add(first);



            lstAllPeriod.Children.Add(main);


            //< StackLayout HorizontalOptions = "FillAndExpand" VerticalOptions = "StartAndExpand" Orientation = "Horizontal" >


            StackLayout firstFirst = new StackLayout();

            firstFirst.VerticalOptions   = LayoutOptions.Center;
            firstFirst.HorizontalOptions = LayoutOptions.FillAndExpand;
            firstFirst.Orientation       = StackOrientation.Vertical;
            firstFirst.Padding           = 0;
            firstFirst.Spacing           = 0;
            firstFirst.Margin            = 0;
            //firstFirst.BackgroundColor = Color.Blue;

            first.Children.Add(firstFirst);
            firstFirst.Children.Add(lblId);

            if (Common.UserGlobalCapability.IsTimeSheetApprover)
            {
                var tapGestureRecognizer = new TapGestureRecognizer();
                tapGestureRecognizer.Tapped += (s, e) =>
                {
                    StackLayout sl = (StackLayout)s;

                    Label  lbl      = (Label)sl.Children[0];
                    string periodId = lbl.Text;

                    MessagingCenter.Subscribe <ApproveTimesheetPage, bool>(this, "TimeSheetApproved", async(obj, reloadData) =>
                    {
                        if (reloadData)
                        {
                            LoadData();
                        }

                        MessagingCenter.Unsubscribe <ApproveTimesheetPage, bool>(this, "TimeSheetApproved");
                    });

                    MessagingCenter.Subscribe <RejectTimeSheetPage, bool>(this, "TimeSheetRejected", async(obj, reloadData) =>
                    {
                        if (reloadData)
                        {
                            LoadData();
                        }

                        MessagingCenter.Unsubscribe <RejectTimeSheetPage, bool>(this, "TimeSheetRejected");
                    });

                    if (periodId.StartsWith("id:"))
                    {
                        var clickedItem = viewModel.PastPeriods.Where(x => x.TimeSheetId == new Guid(periodId.Substring(3))).FirstOrDefault();
                        Navigation.PushAsync(new ApproveTimesheetPage(clickedItem));
                    }
                    else
                    {
                        var clickedItem = viewModel.PastPeriods.Where(x => x.PeriodFormated == periodId).FirstOrDefault();
                        Navigation.PushAsync(new ApproveTimesheetPage(clickedItem));
                    }
                };
                firstFirst.GestureRecognizers.Add(tapGestureRecognizer);
            }


            Label lbl1 = new Label();

            lbl1.FontSize = 28;
            lbl1.HorizontalTextAlignment = TextAlignment.Start;
            lbl1.HorizontalOptions       = LayoutOptions.FillAndExpand;
            lbl1.VerticalTextAlignment   = TextAlignment.Center;
            lbl1.TextColor = (Color)Application.Current.Resources["BlackTextColor"];
            lbl1.Text      = item.ActualHoursFormated;
            lbl1.Margin    = 0;

            firstFirst.Children.Add(lbl1);

            Label lbl2 = new Label();

            lbl2.FontSize = 16;
            lbl2.HorizontalTextAlignment = TextAlignment.Start;
            lbl2.HorizontalOptions       = LayoutOptions.FillAndExpand;
            lbl2.VerticalTextAlignment   = TextAlignment.Start;
            lbl2.TextColor     = (Color)Application.Current.Resources["BlackTextColor"];
            lbl2.LineBreakMode = LineBreakMode.NoWrap;
            lbl2.Margin        = 0;


            lbl2.Text = item.PeriodFormatedLong;

            firstFirst.Children.Add(lbl2);

            StackLayout firstSecond = new StackLayout();

            firstSecond.VerticalOptions   = LayoutOptions.CenterAndExpand;
            firstSecond.HorizontalOptions = LayoutOptions.End;
            //firstSecond.BackgroundColor = Color.Pink;
            firstSecond.Padding = 0;
            firstSecond.Margin  = 0;
            firstSecond.Spacing = 0;
            first.Children.Add(firstSecond);

            if (item.ShowSubmitButton)
            {
                Label lblId1 = new Label();
                lblId1.IsVisible = false;

                if (item.TimeSheetId != null)
                {
                    lblId1.Text = "id:" + item.TimeSheetId.ToString();
                }
                else
                {
                    lblId1.Text = item.PeriodFormated;
                }
                lblId1.Margin = 0;
                firstSecond.Children.Add(lblId1);

                StackLayout btnSl = new StackLayout();
                btnSl.Padding           = new Thickness(0, 0, 10, 0);
                btnSl.HorizontalOptions = LayoutOptions.EndAndExpand;
                btnSl.VerticalOptions   = LayoutOptions.CenterAndExpand;

                var submitGestureRecognized = new TapGestureRecognizer();
                submitGestureRecognized.Tapped += (s, e) =>
                {
                    StackLayout sl          = (StackLayout)s;
                    Label       lbl         = (Label)sl.Children[0];
                    string      periodId    = lbl.Text;
                    var         clickedItem = viewModel.PastPeriods.Where(x => x.PeriodFormated == periodId).FirstOrDefault();
                    if (clickedItem.ShowSubmitButton)
                    {
                        MessagingCenter.Subscribe <SubmitTimeSheetPage, bool>(this, "TimeSheetSubmited", async(obj, reloadData) =>
                        {
                            if (reloadData)
                            {
                                LoadData();
                            }

                            MessagingCenter.Unsubscribe <SubmitTimeSheetPage, bool>(this, "TimeSheetSubmited");
                        });
                        Navigation.PushAsync(new SubmitTimeSheetPage(clickedItem));
                    }
                };
                firstSecond.GestureRecognizers.Add(submitGestureRecognized);
                firstSecond.Children.Add(btnSl);



                Frame frmSubmit = new Frame();
                frmSubmit.HasShadow       = false;
                frmSubmit.Padding         = new Thickness(10, 7, 10, 7);
                frmSubmit.CornerRadius    = 5;
                frmSubmit.BackgroundColor = (Color)Application.Current.Resources["Primary"];
                frmSubmit.VerticalOptions = LayoutOptions.CenterAndExpand;
                frmSubmit.VerticalOptions = LayoutOptions.End;

                frmSubmit.WidthRequest = 100;
                firstSecond.Children.Add(frmSubmit);


                Label lblSubmit = new Label();
                lblSubmit.FontSize = 22;
                lblSubmit.HorizontalTextAlignment = TextAlignment.Start;
                lblSubmit.HorizontalOptions       = LayoutOptions.CenterAndExpand;
                lblSubmit.VerticalTextAlignment   = TextAlignment.Center;

                lblSubmit.TextColor     = (Color)Application.Current.Resources["WhiteTextColor"];
                lblSubmit.Text          = item.PeriodFormatedLong;
                lblSubmit.HeightRequest = 30;
                lblSubmit.Text          = "Submit";
                frmSubmit.Content       = lblSubmit;
            }
            else
            {
                StackLayout slStatus = new StackLayout();
                slStatus.VerticalOptions   = LayoutOptions.CenterAndExpand;
                slStatus.HorizontalOptions = LayoutOptions.FillAndExpand;
                slStatus.Orientation       = StackOrientation.Horizontal;
                //firstSecond.BackgroundColor = Color.Pink;
                slStatus.Padding = 0;
                slStatus.Margin  = 0;
                slStatus.Spacing = 0;
                firstSecond.Children.Add(slStatus);


                Image img1 = new Image();

                img1.HeightRequest     = 30;
                img1.HorizontalOptions = LayoutOptions.CenterAndExpand;
                if (item.ShowApprovedIcon)
                {
                    img1.Source = "approved"; // "timesheet_approved.png";
                }
                else if (item.ShowRejectedIcon)
                {
                    img1.Source = "rejected";//"timesheet_rejected.png";
                }
                else
                {
                    img1.Source = "pending"; //"timesheet_pending.png";
                }
                slStatus.Children.Add(img1);

                if (string.IsNullOrEmpty(item.UserPhotoUrl))
                {
                    if (!string.IsNullOrEmpty(item.UserAvatar))
                    {
                        string userHTML = item.UserAvatar;
                        //"<div class=\"user-avatar\" title=\"Gjoko Veljanoski\" style=\"background-color:#00bfff\">GV</div>"
                        //<img class="user-avatar" src="/ProjectInsight.WebApp/Sites/Files/a222e57233a14e15ab67d25e6dbab95e/UserPhotos/6fcc5602c49043c3a2d8d39175040e68/tn_avatar.png" alt="Gjoko Veljanoski" title="Gjoko Veljanoski" />
                        string       myDiv = item.UserAvatar;
                        HtmlDocument doc   = new HtmlDocument();
                        doc.LoadHtml(myDiv);
                        HtmlNode node           = doc.DocumentNode.SelectSingleNode("div");
                        string   AvatarInitials = "US";
                        string   AvatarColor    = "#fff";
                        string   PhotoURL       = string.Empty;

                        if (node != null)
                        {
                            AvatarInitials = (node.ChildNodes[0]).OuterHtml;
                            foreach (HtmlAttribute attr in node.Attributes)
                            {
                                if (attr.Name.ToLower() == "style")
                                {
                                    string[] parts = attr.Value.Split('#');
                                    if (parts != null && parts.Length > 1)
                                    {
                                        AvatarColor = parts[1];
                                    }
                                }
                            }
                        }
                        else
                        {
                            HtmlNode node2 = doc.DocumentNode.SelectSingleNode("img");
                            if (node2 != null)
                            {
                                foreach (HtmlAttribute attr in node2.Attributes)
                                {
                                    if (attr.Name.ToLower() == "src")
                                    {
                                        string imageUrl = attr.Value.Replace("/ProjectInsight.WebApp", "");
                                        PhotoURL = Common.CurrentWorkspace.WorkspaceURL + imageUrl;
                                    }
                                }
                            }
                        }

                        StackLayout slAvatar = new StackLayout();
                        slAvatar.HeightRequest     = 50;
                        slAvatar.WidthRequest      = 50;
                        slAvatar.VerticalOptions   = LayoutOptions.StartAndExpand;
                        slAvatar.HorizontalOptions = LayoutOptions.StartAndExpand;

                        slAvatar.Margin = new Thickness(15, 0, 0, 0);

                        if (string.IsNullOrEmpty(PhotoURL))
                        {
                            slAvatar.BackgroundColor = Color.FromHex(AvatarColor);

                            Label lbInitials = new Label();
                            lbInitials.HeightRequest           = 50;
                            lbInitials.WidthRequest            = 50;
                            lbInitials.HorizontalOptions       = LayoutOptions.CenterAndExpand;
                            lbInitials.VerticalOptions         = LayoutOptions.CenterAndExpand;
                            lbInitials.HorizontalTextAlignment = TextAlignment.Center;
                            lbInitials.VerticalTextAlignment   = TextAlignment.Center;
                            lbInitials.TextColor = Color.White;
                            lbInitials.Text      = AvatarInitials;
                            lbInitials.FontSize  = 26;
                            if (Device.RuntimePlatform.ToLower() == "android")
                            {
                                lbInitials.FontFamily = "OpenSans-SemiBold.ttf#Open Sans";
                            }
                            else
                            {
                                lbInitials.FontFamily = "OpenSans-SemiBold";
                            }
                            slAvatar.Children.Add(lbInitials);
                        }
                        else
                        {
                            Image photo = new Image();
                            photo.Source            = ImageSource.FromUri(new Uri(PhotoURL));
                            photo.HeightRequest     = 50;
                            photo.WidthRequest      = 50;
                            photo.HorizontalOptions = LayoutOptions.CenterAndExpand;
                            photo.VerticalOptions   = LayoutOptions.CenterAndExpand;
                            slAvatar.Children.Add(photo);
                        }
                        slStatus.Children.Add(slAvatar);
                    }
                }
                else
                {
                    StackLayout slAvatar = new StackLayout();
                    slAvatar.HeightRequest     = 50;
                    slAvatar.WidthRequest      = 50;
                    slAvatar.VerticalOptions   = LayoutOptions.StartAndExpand;
                    slAvatar.HorizontalOptions = LayoutOptions.StartAndExpand;
                    slAvatar.Margin            = new Thickness(15, 0, 0, 0);

                    Image photo = new Image();
                    photo.Source            = ImageSource.FromUri(new Uri(item.UserPhotoUrl));
                    photo.HeightRequest     = 50;
                    photo.WidthRequest      = 50;
                    photo.HorizontalOptions = LayoutOptions.CenterAndExpand;
                    photo.VerticalOptions   = LayoutOptions.CenterAndExpand;
                    slAvatar.Children.Add(photo);

                    slStatus.Children.Add(slAvatar);
                }
            }

            if (AddLineAtBottom)
            {
                BoxView line1 = new BoxView();
                line1.HeightRequest     = 0.5;
                line1.Color             = (Color)Application.Current.Resources["DarkGrayTextColor"];
                line1.HorizontalOptions = LayoutOptions.FillAndExpand;
                line1.VerticalOptions   = LayoutOptions.End;
                line1.Margin            = 0;
                lstAllPeriod.Children.Add(line1);
            }
        }
コード例 #9
0
        private void PreviousPeriods_GeneratedRows(TimeSheetPeriod item, bool AddLineAtEnd = false)
        {
            BoxView line = new BoxView();

            line.HeightRequest     = 0.5;
            line.Color             = (Color)Application.Current.Resources["DarkGrayTextColor"];
            line.HorizontalOptions = LayoutOptions.FillAndExpand;
            line.Margin            = 0;
            Label lblId = new Label();

            lblId.IsVisible = false;
            lblId.Text      = item.TimeSheetId.ToString();
            lblId.Margin    = 0;

            StackLayout main = new StackLayout();

            main.HorizontalOptions = LayoutOptions.FillAndExpand;
            main.VerticalOptions   = LayoutOptions.StartAndExpand;
            main.Orientation       = StackOrientation.Vertical;
            main.Padding           = 0;
            main.Margin            = 0;
            main.Spacing           = 0;
            main.BackgroundColor   = (Color)Application.Current.Resources["WhiteTextColor"];
            main.HeightRequest     = 80;
            main.Children.Add(line);
            //main.Children.Add(lblId);

            StackLayout first = new StackLayout();

            first.HorizontalOptions = LayoutOptions.FillAndExpand;
            first.BackgroundColor   = (Color)Application.Current.Resources["WhiteTextColor"];
            first.Padding           = new Thickness(15, 5, 15, 5);
            first.Orientation       = StackOrientation.Horizontal;
            main.Children.Add(first);



            var tapGestureRecognizer = new TapGestureRecognizer();

            tapGestureRecognizer.Tapped += (s, e) =>
            {
                StackLayout sl = (StackLayout)s;

                Label  lbl      = (Label)sl.Children[0];
                string periodId = lbl.Text;

                var clickedItem = viewModel.TimeSheets.Where(x => x.TimeSheetId == new Guid(periodId)).FirstOrDefault();
                if (clickedItem.ShowPendingApprovalIcon)
                {
                    Navigation.PushAsync(new ApproveTimesheetPage(clickedItem));
                }
            };
            //main.GestureRecognizers.Add(tapGestureRecognizer);
            lstAllPeriod.Children.Add(main);


            //< StackLayout HorizontalOptions = "FillAndExpand" VerticalOptions = "StartAndExpand" Orientation = "Horizontal" >


            StackLayout firstFirst = new StackLayout();

            firstFirst.VerticalOptions   = LayoutOptions.Center;
            firstFirst.HorizontalOptions = LayoutOptions.FillAndExpand;
            firstFirst.Orientation       = StackOrientation.Vertical;
            //firstFirst.BackgroundColor = Color.Blue;

            first.Children.Add(firstFirst);
            firstFirst.Children.Add(lblId);
            firstFirst.GestureRecognizers.Add(tapGestureRecognizer);

            Label lbl1 = new Label();

            lbl1.FontSize = 26;
            lbl1.HorizontalTextAlignment = TextAlignment.Start;
            lbl1.HorizontalOptions       = LayoutOptions.FillAndExpand;
            lbl1.VerticalTextAlignment   = TextAlignment.Center;
            lbl1.TextColor = (Color)Application.Current.Resources["BlackTextColor"];
            lbl1.Text      = item.Name;
            firstFirst.Children.Add(lbl1);

            Label lbl2 = new Label();

            lbl2.FontSize = 16;
            lbl2.HorizontalTextAlignment = TextAlignment.Start;
            lbl2.HorizontalOptions       = LayoutOptions.FillAndExpand;
            lbl2.VerticalTextAlignment   = TextAlignment.Center;
            lbl2.TextColor     = (Color)Application.Current.Resources["BlackTextColor"];
            lbl2.LineBreakMode = LineBreakMode.NoWrap;
            lbl2.Text          = item.ActualHoursFormated + " | " + item.PeriodFormated;

            firstFirst.Children.Add(lbl2);

            StackLayout firstSecond = new StackLayout();

            firstSecond.VerticalOptions   = LayoutOptions.CenterAndExpand;
            firstSecond.HorizontalOptions = LayoutOptions.End;
            //firstSecond.BackgroundColor = Color.Pink;
            firstSecond.Padding = 0;
            firstSecond.Margin  = 0;
            firstSecond.Spacing = 0;
            first.Children.Add(firstSecond);

            Label lblId1 = new Label();

            lblId1.IsVisible = false;
            lblId1.Text      = item.TimeSheetId.ToString();
            lblId1.Margin    = 0;
            firstSecond.Children.Add(lblId1);

            StackLayout btnSl = new StackLayout();

            btnSl.Padding           = new Thickness(0, 0, 10, 0);
            btnSl.HorizontalOptions = LayoutOptions.EndAndExpand;
            btnSl.VerticalOptions   = LayoutOptions.CenterAndExpand;

            var submitGestureRecognized = new TapGestureRecognizer();

            submitGestureRecognized.Tapped += (s, e) =>
            {
                StackLayout sl          = (StackLayout)s;
                Label       lbl         = (Label)sl.Children[0];
                string      periodId    = lbl.Text;
                var         clickedItem = viewModel.TimeSheets.Where(x => x.TimeSheetId == new Guid(periodId)).FirstOrDefault();
                if (clickedItem.ShowPendingApprovalIcon)
                {
                    Navigation.PushAsync(new ApproveTimesheetPage(clickedItem));
                }
            };
            firstSecond.GestureRecognizers.Add(submitGestureRecognized);
            firstSecond.Children.Add(btnSl);



            Frame frmSubmit = new Frame();

            frmSubmit.HasShadow       = false;
            frmSubmit.Padding         = new Thickness(10, 7, 10, 7);
            frmSubmit.CornerRadius    = 5;
            frmSubmit.BackgroundColor = (Color)Application.Current.Resources["Primary"];
            frmSubmit.VerticalOptions = LayoutOptions.CenterAndExpand;
            frmSubmit.VerticalOptions = LayoutOptions.End;

            frmSubmit.WidthRequest = 100;
            firstSecond.Children.Add(frmSubmit);


            Label lblSubmit = new Label();

            lblSubmit.FontSize = 22;
            lblSubmit.HorizontalTextAlignment = TextAlignment.Start;
            lblSubmit.HorizontalOptions       = LayoutOptions.CenterAndExpand;
            lblSubmit.VerticalTextAlignment   = TextAlignment.Center;

            lblSubmit.TextColor     = (Color)Application.Current.Resources["WhiteTextColor"];
            lblSubmit.Text          = item.PeriodFormatedLong;
            lblSubmit.HeightRequest = 30;
            lblSubmit.Text          = "Approve";
            frmSubmit.Content       = lblSubmit;


            if (AddLineAtEnd)
            {
                BoxView line1 = new BoxView();
                line1.HeightRequest     = 0.5;
                line1.Color             = (Color)Application.Current.Resources["DarkGrayTextColor"];
                line1.HorizontalOptions = LayoutOptions.FillAndExpand;
                line1.VerticalOptions   = LayoutOptions.End;
                line1.Margin            = 0;


                lstAllPeriod.Children.Add(line1);
            }
        }