@using PantheonRA.WebApi.Contracts.Enums
@using PantheonRA.BackOffice.Enums
@using PantheonRA.BackOffice

@{
    string active = @Html.IsSelected("Index", "Manufacturing") +
                    @Html.IsSelected("Edit", "Manufacturing") +
                    @Html.IsSelected("WorkOrderMaterials", "Manufacturing") +
                    @Html.IsSelected("IssuingMaterial", "Manufacturing") +
                    @Html.IsSelected("WorkOrderOperations", "Manufacturing") +
                    @Html.IsSelected("Receive", "Manufacturing") +
                    @Html.IsSelected("InputCompletedWork", "Manufacturing") +
                    @Html.IsSelected("ServicesTools", "Manufacturing");

}

@if (!PantheonRA.BackOffice.CurrentUser.HasGranules() && CurrentUser.CanAccess(Permissions.PRODUCTION))
{
    bool isIndexMF = CurrentUser.ManufacturingType == ProdWOType.Both || CurrentUser.ManufacturingType == ProdWOType.MF;
    string manufacturingTopId = isIndexMF ? "NavManufacturingMFTop" : "NavManufacturingSETop";

    <li data-list-item-id="@Loc.Manufacturing"
        class="dropdown @active">
        <a id="@manufacturingTopId" href="@Url.Action((isIndexMF ? "IndexMF" : "IndexSE"), "Manufacturing")">
            <i class="fas fa-industry-alt"></i> <span class="nav-label">@Loc.Manufacturing</span>
        </a>
        <ul class="dropdown-menu dropdown-menu-right">
            @if (CurrentUser.ManufacturingType == ProdWOType.Both || CurrentUser.ManufacturingType == ProdWOType.MF)
            {
                <li><a id="NavManfuacturingMF" href="@Url.Action("IndexMF", "Manufacturing")">@Loc.WorkOrdersMF.SetMenuNameLength()</a></li>
            }
            @if (CurrentUser.ManufacturingType == ProdWOType.Both || CurrentUser.ManufacturingType == ProdWOType.SE)
            {
                <li><a id="NavManfuacturingSE" href="@Url.Action("IndexSE", "Manufacturing")">@Loc.WorkOrdersSE.SetMenuNameLength()</a></li>
            }
        </ul>
    </li>
}
