async void GetUserRoutineProgress()
        {
            try
            {
                var client    = new HttpClient();
                var startDate = DateTime.Now;
                var endDate   = DateTime.Now;
                for (int i = 6; i > 0; i--)
                {
                    startDate = startDate.AddDays(-1);
                }
                Debug.WriteLine("START: " + startDate);
                Debug.WriteLine("END: " + endDate);

                //dates.Add(new HeaderInfo() { name = "Goals", date = "" });
                //for (int i = 0; i < 7; i++)
                //{
                //    var temp = startDate.AddDays(i);

                //    dates.Add(new HeaderInfo() { name = temp.ToString("ddd"), date = temp.ToString("MM/dd") });
                //}


                client.DefaultRequestHeaders.Add("start-date", startDate.ToString("yyyy-MM-dd"));
                client.DefaultRequestHeaders.Add("end-date", endDate.ToString("yyyy-MM-dd"));

                var response = await client.GetAsync(AppConstants.BaseUrl + AppConstants.routineHistory + MainPage.account.userID);

                if (response.IsSuccessStatusCode)
                {
                    var data = await response.Content.ReadAsStringAsync();

                    Debug.WriteLine("HISTORY DATA: " + data);
                    var user = JsonConvert.DeserializeObject <History>(data);
                    Debug.WriteLine("HISTORY DATA: " + user.result);
                    var dates = JsonConvert.DeserializeObject <IDictionary <string, object> >(user.result.ToString());



                    var dateItems  = new List <string>();
                    var goalsItems = new List <string>();


                    foreach (string key in dates.Keys)
                    {
                        dateItems.Add(key);
                    }

                    var height = 0;

                    foreach (string key in dates.Keys)
                    {
                        var subSet = JsonConvert.DeserializeObject <IDictionary <string, object> >(dates[key].ToString());

                        foreach (string subKey in subSet.Keys)
                        {
                            if (!goalsItems.Contains(subKey))
                            {
                                goalsItems.Add(subKey);
                                height = height + 40;
                            }
                        }
                    }

                    RoutinesStatusList.HeightRequest = height;

                    var grid = new List <List <int> >();
                    foreach (string key in dates.Keys)
                    {
                        var item = JsonConvert.DeserializeObject <IDictionary <string, object> >(dates[key].ToString());
                        var row  = new List <int>();
                        foreach (string subKey in goalsItems)
                        {
                            var value = 0;
                            if (item.ContainsKey(subKey))
                            {
                                if (item[subKey].ToString() == "not started")
                                {
                                    value = -1;
                                }
                                else if (item[subKey].ToString() == "in_progress")
                                {
                                    value = 0;
                                }
                                else if (item[subKey].ToString() == "completed")
                                {
                                    value = 1;
                                }
                            }
                            else
                            {
                                value = -1;
                            }
                            row.Add(value);
                        }
                        grid.Add(row);
                    }

                    //Debug.WriteLine("ELEMENTS IN GRID: " + grid.Count);
                    //Debug.WriteLine("ELEMENTS IN GRID: " + grid[0].Count);

                    int j = 0;

                    foreach (string key in goalsItems)
                    {
                        var element = new ProgressRow();
                        element.name = key;

                        if (0 < grid.Count)
                        {
                            element.strokeColorA = StrokeFill(grid[0][j]);
                            element.fillA        = Fill(grid[0][j]);
                        }

                        if (1 < grid.Count)
                        {
                            element.strokeColorB = StrokeFill(grid[1][j]);
                            element.fillB        = Fill(grid[1][j]);
                        }

                        if (2 < grid.Count)
                        {
                            element.strokeColorC = StrokeFill(grid[2][j]);
                            element.fillC        = Fill(grid[2][j]);
                        }

                        if (3 < grid.Count)
                        {
                            element.strokeColorD = StrokeFill(grid[3][j]);
                            element.fillD        = Fill(grid[3][j]);
                        }

                        if (4 < grid.Count)
                        {
                            element.strokeColorE = StrokeFill(grid[4][j]);
                            element.fillE        = Fill(grid[4][j]);
                        }

                        if (5 < grid.Count)
                        {
                            element.strokeColorF = StrokeFill(grid[5][j]);
                            element.fillF        = Fill(grid[5][j]);
                        }

                        if (6 < grid.Count)
                        {
                            element.strokeColorG = StrokeFill(grid[6][j]);
                            element.fillG        = Fill(grid[6][j]);
                        }

                        routinesRow.Add(element);
                        j++;
                    }

                    RoutinesStatusList.ItemsSource = routinesRow;
                }
                else
                {
                    await DisplayAlert("Oops", "We weren't able to fulfill your request. Please try again later", "OK");
                }
            }
            catch (Exception progress)
            {
                await DisplayAlert("Oops", progress.Message, "OK");
            }
        }
        async void GetUserProgress()
        {
            try
            {
                var client    = new HttpClient();
                var startDate = DateTime.Now;
                var endDate   = DateTime.Now;
                for (int i = 6; i > 0; i--)
                {
                    startDate = startDate.AddDays(-1);
                }
                Debug.WriteLine("START: " + startDate);
                Debug.WriteLine("END: " + endDate);
                //dates.Clear();
                //dates.Add(new HeaderInfo() { name = "Goals", date = "" });
                for (int i = 0; i < 7; i++)
                {
                    var temp = startDate.AddDays(i);
                    if (i != 6)
                    {
                        //dates.Add(new HeaderInfo() { name = temp.ToString("ddd"), date = temp.ToString("MM/dd") });
                        var myStack = new StackLayout();
                        if (Device.RuntimePlatform == Device.iOS)
                        {
                            myStack.WidthRequest = 24;
                        }
                        else
                        {
                            myStack.WidthRequest = 30;
                        }
                        myStack.Children.Add(new CustomizeFontLabel()
                        {
                            Text = temp.ToString("ddd"), Margin = new Thickness(0, 5, 0, 0), TextColor = Color.Black, FontSize = 9, WidthRequest = 30
                        });
                        DatesList.Children.Add(myStack);
                    }
                    else
                    {
                        //dates.Add(new HeaderInfo() { name = "Today", date = temp.ToString("MM/dd") });
                        //DatesList.Children.Add(new CustomizeFontLabel() { Text = "Today", TextColor = Color.Black, FontSize = 10, WidthRequest=30 });
                        var myStack = new StackLayout();
                        myStack.WidthRequest = 30;
                        myStack.Children.Add(new CustomizeFontLabel()
                        {
                            Text = "Today", Margin = new Thickness(0, 6, 0, 0), TextColor = Color.Black, FontSize = 8, WidthRequest = 30
                        });
                        DatesList.Children.Add(myStack);
                    }
                }

                //DatesList.ItemsSource = dates;

                client.DefaultRequestHeaders.Add("start_date", startDate.ToString("yyyy-MM-dd"));
                client.DefaultRequestHeaders.Add("end_date", endDate.ToString("yyyy-MM-dd"));

                var response = await client.GetAsync(AppConstants.BaseUrl + AppConstants.goalsHistory + MainPage.account.userID);

                if (response.IsSuccessStatusCode)
                {
                    var data = await response.Content.ReadAsStringAsync();

                    Debug.WriteLine("HISTORY DATA: " + data);
                    var user = JsonConvert.DeserializeObject <History>(data);
                    Debug.WriteLine("HISTORY DATA: " + user.result);
                    var dates = JsonConvert.DeserializeObject <IDictionary <string, object> >(user.result.ToString());

                    var dateItems  = new List <string>();
                    var goalsItems = new List <string>();

                    goalsItems.Clear();
                    foreach (string key in dates.Keys)
                    {
                        dateItems.Add(key);
                    }

                    var height = 0;

                    foreach (string key in dates.Keys)
                    {
                        var subSet = JsonConvert.DeserializeObject <IDictionary <string, object> >(dates[key].ToString());

                        foreach (string subKey in subSet.Keys)
                        {
                            if (!goalsItems.Contains(subKey))
                            {
                                goalsItems.Add(subKey);
                                height = height + 40;
                            }
                        }
                    }
                    GoalsStatusList.HeightRequest = height;

                    var grid = new List <List <int> >();
                    foreach (string key in dates.Keys)
                    {
                        var item = JsonConvert.DeserializeObject <IDictionary <string, object> >(dates[key].ToString());
                        var row  = new List <int>();
                        foreach (string subKey in goalsItems)
                        {
                            var value = 0;
                            if (item.ContainsKey(subKey))
                            {
                                if (item[subKey].ToString() == "not started")
                                {
                                    value = -1;
                                }
                                else if (item[subKey].ToString() == "in_progress")
                                {
                                    value = 0;
                                }
                                else if (item[subKey].ToString() == "completed")
                                {
                                    value = 1;
                                }
                            }
                            else
                            {
                                value = -1;
                            }
                            row.Add(value);
                        }
                        grid.Add(row);
                    }

                    //Debug.WriteLine("ELEMENTS IN GRID: " + grid.Count);
                    //Debug.WriteLine("ELEMENTS IN GRID: " + grid[0].Count);

                    int j = 0;
                    rows.Clear();
                    foreach (string key in goalsItems)
                    {
                        var element = new ProgressRow();
                        element.name = key;

                        if (0 < grid.Count)
                        {
                            element.strokeColorA = StrokeFill(grid[0][j]);
                            element.fillA        = Fill(grid[0][j]);
                        }

                        if (1 < grid.Count)
                        {
                            element.strokeColorB = StrokeFill(grid[1][j]);
                            element.fillB        = Fill(grid[1][j]);
                        }

                        if (2 < grid.Count)
                        {
                            element.strokeColorC = StrokeFill(grid[2][j]);
                            element.fillC        = Fill(grid[2][j]);
                        }

                        if (3 < grid.Count)
                        {
                            element.strokeColorD = StrokeFill(grid[3][j]);
                            element.fillD        = Fill(grid[3][j]);
                        }

                        if (4 < grid.Count)
                        {
                            element.strokeColorE = StrokeFill(grid[4][j]);
                            element.fillE        = Fill(grid[4][j]);
                        }

                        if (5 < grid.Count)
                        {
                            element.strokeColorF = StrokeFill(grid[5][j]);
                            element.fillF        = Fill(grid[5][j]);
                        }

                        if (6 < grid.Count)
                        {
                            element.strokeColorG = StrokeFill(grid[6][j]);
                            element.fillG        = Fill(grid[6][j]);
                        }

                        rows.Add(element);
                        j++;
                    }

                    GoalsStatusList.ItemsSource = rows;
                }
                else
                {
                    await DisplayAlert("Oops", "We weren't able to fulfill your request. Please try again later", "OK");
                }
            }
            catch (Exception progress)
            {
                await DisplayAlert("Oops", progress.Message, "OK");
            }
        }