@using PantheonRA.WebApi.Contracts.Enums
@using PantheonRA.BackOffice.Enums
@{ 
    bool isSvc = ViewBag.ProdType == "SVC";
    string manufacturingSelections = @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");

    string active = isSvc ? string.Empty : manufacturingSelections;
    string activeSvc = isSvc ? manufacturingSelections : string.Empty;
}

@if (!PantheonRA.BackOffice.CurrentUser.HasGranules() && PantheonRA.BackOffice.CurrentUser.CanAccess(Permissions.PRODUCTION))
{
    <li data-list-item-id="@Loc.Manufacturing"
        class="dropdown @active">
        <a href="@Url.Action((PantheonRA.BackOffice.CurrentUser.ManufacturingType == DocTypeWorkOrderType.Both || 
                             PantheonRA.BackOffice.CurrentUser.ManufacturingType == DocTypeWorkOrderType.MF ? "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 (PantheonRA.BackOffice.CurrentUser.ManufacturingType == DocTypeWorkOrderType.Both || PantheonRA.BackOffice.CurrentUser.ManufacturingType == DocTypeWorkOrderType.MF)
            {
                <li><a href="@Url.Action("IndexMF", "Manufacturing")">@Loc.WorkOrdersMF.SetMenuNameLength()</a></li>
            }
            @if (PantheonRA.BackOffice.CurrentUser.ManufacturingType == DocTypeWorkOrderType.Both || PantheonRA.BackOffice.CurrentUser.ManufacturingType == DocTypeWorkOrderType.SE)
            {
                <li><a href="@Url.Action("IndexSE", "Manufacturing")">@Loc.WorkOrdersSE.SetMenuNameLength()</a></li>
            }
        </ul>
    </li>
        
    if (PantheonRA.BackOffice.CurrentUser.ManufacturingType == DocTypeWorkOrderType.Both || PantheonRA.BackOffice.CurrentUser.ManufacturingType == DocTypeWorkOrderType.SE)
    {
        <li data-list-item-id="@Loc.WorkOrderServices"
            class="@activeSvc">
            <a href="@Url.Action("Services", "Manufacturing")">
                <i class="fas fa-wrench"></i>
                <span class="nav-label">
                    @Loc.WorkOrderServices.SetMenuNameLength()
                </span>
            </a>
        </li>
    }
} 
