using AppLibs.Libs;
using System.Collections.Generic;

namespace TWA_App.Models
{
    public class ServicesModel
    {

        

        public static async Task<string> GetSidebar()
        {
            List<NavItem> wSNavigation = await WSNavigation.GetListMenu();
            var sidebar = wSNavigation[2].SubItem;
            var hContent = "";
            foreach (var item in sidebar)
            {
                if (item.IsGroup)
                {
                    if (hContent != "")
                    {
                        hContent += "</div></div></div>";
                    }
                    hContent += $"<div class=\"nav-i has-sub\" data-dropdown><a class=\"nav-item\">{item.Name}</a><div class=\"sub-item\" ><div class=\"d-f f-c\">";
                }
                else
                {
                    hContent += $"<a class=\"nav-item\" nav-id=\"{item.ID}\">{item.Name}</a>";
                }
            }
            hContent += "</div></div></div>";
            return hContent;
        }
    }

   
}
