@using AppLibs.Libs
@{
    List<NavItem> t = await WSNavigation.GetListMenu();

}

@foreach (var i in t)
{
    if (i.SubItem == null)
    {
        <div class="nav-i">
            <a href="@i.Url" app-nav nav-id="@i.ID" class="nav-item">@i.Name</a>
        </div>
    }
    else
    {
        <div class="nav-i has-sub" data-dropdown>
            <a href="javascript:void(0)" nav-id="@i.ID" class="nav-item">@i.Name<i class="atg a-s6x a-down-thick mt-1 ml-2"></i></a>
            @switch (i.ID)
            {
                case "3000":
                    <div class="sub-item sub-nav-full">
                        <div class="cfull">
                            <div class="r-n-g">
                                @{
                                    string s = "";
                                    string groupHtml = "";
                                    string list = "";
                                    foreach (var j in i.SubItem)
                                    {

                                        if (j.IsGroup)
                                        {

                                            if (groupHtml.Length > 0)
                                            {
                                                s += String.Format(groupHtml, list);
                                                list = "";
                                            }
                                            groupHtml = $"<div class=\"c-l-4 c-x-3\"><div class=\"nav-col d-f f-c\"><h3 class=\"title\">{j.Name}</h3>{{0}}</div></div>";
                                        }
                                        else
                                        {
                                            list += $"<div class=\"nav-i\"><a href=\"{j.Url}\" {j.ToFlexPageAttribute()} app-nav nav-id=\"{j.ID}\" class=\"nav-link\"><span>{j.Name}</span></a></div>";
                                        }
                                       
                                    }
                                    if (groupHtml.Length > 0)
                                    {
                                        s += String.Format(groupHtml, list);
                                    }

                                }
                                @Html.Raw(s)
                                <div class="d-n d-x-b c-x-3">
                                    <img class="w-100" src="~/images/layout/air.png" />
                                </div>
                            </div>
                        </div>
                    </div>
                    break;
                default:
                    <div class="sub-item">
                        @foreach (var j in i.SubItem)
                        {
                            <div class="nav-i"><a href="@j.Url" @j.ToFlexPageAttribute() app-nav nav-id="@j.ID" class="nav-link"><span>@j.Name</span></a></div>
                        }
                    </div>
                    break;
            }
          
        </div>
    }
}