@{
    Html.BundleDeferred("~/Style/Site");
    Html.BundleDeferred("~/ClientScripts/Core");
}
<!doctype html>
<html>
<head>
    <title>Disco ICT - @CommonHelpers.BreadcrumbsTitle(ViewBag.Title ?? string.Empty)</title>
    <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico?v=20131224c" />
    <meta name="application-name" content="Disco ICT" />
    <meta name="msapplication-starturl" content="/" />
    <meta name="msapplication-tooltip" content="Open Disco ICT" />
    @Html.BundleRenderDeferred()
    @RenderSection("head", false)
</head>
<body class="layout">
    <div class="page">
        <header>
            <div id="heading">
                <a href="@Url.Action(MVC.Job.Index())"><i title="Disco ICT - Jobs"></i></a>
            </div>
            <nav>
                <ul id="menu">
                    <li class="d-sm@((string)ViewContext.ViewData["MenuArea"] == MVC.Job.Name ? " active" : null)">@Html.ActionLink("Jobs", MVC.Job.Index(), accesskey: "1")
                        <ul>
                            @if (Authorization.Has(Claims.Job.Lists.JobQueueLists))
                            {
                                var queues = Disco.Services.Jobs.JobQueues.JobQueueService.GetQueues();
                                if (queues.Count > 0)
                                {
                                <li class="d-sm"><i class="fa fa-caret-right"></i><a>Queues</a>
                                    <ul>
                                        @foreach (var queueToken in queues.OrderBy(q => q.JobQueue.Name))
                                        {
                                            <li><a href="@Url.Action(MVC.Job.Queue(queueToken.JobQueue.Id))"><i class="fa fa-@(queueToken.JobQueue.Icon) fa-fw d-@(queueToken.JobQueue.IconColour)"></i>@(queueToken.JobQueue.Name)</a></li>
                                        }
                                    </ul>
                                </li>
                                }
                            }
                            @if (Authorization.Has(Claims.Job.Lists.AwaitingTechnicianAction))
                            {
                                <li>@Html.ActionLink("Awaiting Technician Action", MVC.Job.AwaitingTechnicianAction())</li>
                            }
                            @if (Authorization.Has(Claims.Job.Lists.LongRunningJobs))
                            {
                                <li>@Html.ActionLink("Long Running Jobs", MVC.Job.LongRunning())</li>
                            }
                            @if (Authorization.Has(Claims.Job.Lists.StaleJobs))
                            {
                                <li>@Html.ActionLink("Stale Jobs", MVC.Job.Stale())</li>
                            }
                            @if (Authorization.Has(Claims.Job.Lists.DevicesReadyForReturn))
                            {
                                <li>@Html.ActionLink("Devices Ready for Return", MVC.Job.DevicesReadyForReturn())</li>
                            }
                            @if (Authorization.Has(Claims.Job.Lists.Locations))
                            {
                                <li>@Html.ActionLink("Device Held Locations", MVC.Job.Locations())</li>
                            }
                            @if (Authorization.Has(Claims.Job.Lists.AwaitingUserAction))
                            {
                                <li>@Html.ActionLink("Awaiting User Action", MVC.Job.AwaitingUserAction())</li>
                            }
                            @if (Authorization.Has(Claims.Job.Lists.AwaitingFinance))
                            {
                                if (Authorization.HasAny(Claims.Job.Lists.AwaitingFinanceCharge, Claims.Job.Lists.AwaitingFinancePayment, Claims.Job.Lists.AwaitingFinanceAgreementBreach, Claims.Job.Lists.AwaitingFinanceInsuranceProcessing))
                                {
                                <li class="d-sm"><i class="fa fa-caret-right"></i>@Html.ActionLink("Awaiting Finance", MVC.Job.AwaitingFinance())
                                    <ul>
                                        @if (Authorization.Has(Claims.Job.Lists.AwaitingFinanceCharge))
                                        {
                                            <li>@Html.ActionLink("Accounting Charge", MVC.Job.AwaitingFinanceCharge())</li>
                                        }
                                        @if (Authorization.Has(Claims.Job.Lists.AwaitingFinancePayment))
                                        {
                                            <li>@Html.ActionLink("Accounting Payment", MVC.Job.AwaitingFinancePayment())</li>
                                        }
                                        @if (Authorization.Has(Claims.Job.Lists.AwaitingFinanceAgreementBreach))
                                        {
                                            <li>@Html.ActionLink("Agreement Breach", MVC.Job.AwaitingFinanceAgreementBreach())</li>
                                        }
                                        @if (Authorization.Has(Claims.Job.Lists.AwaitingFinanceInsuranceProcessing))
                                        {
                                            <li>@Html.ActionLink("Insurance Processing", MVC.Job.AwaitingFinanceInsuranceProcessing())</li>
                                        }
                                    </ul>
                                </li>
                                }
                                else
                                {
                                <li>@Html.ActionLink("Awaiting Finance", MVC.Job.AwaitingFinance())</li>
                                }
                            }
                            @if (Authorization.Has(Claims.Job.Lists.DevicesAwaitingRepair))
                            {
                                <li>@Html.ActionLink("Awaiting Device Repair", MVC.Job.DevicesAwaitingRepair())</li>
                            }
                            @if (Authorization.Has(Claims.Job.Lists.AllOpen))
                            {
                                <li>@Html.ActionLink("All Open", MVC.Job.AllOpen())</li>
                            }
                            @if (Authorization.Has(Claims.Job.Lists.RecentlyClosed))
                            {
                                <li>@Html.ActionLink("Recently Closed", MVC.Job.RecentlyClosed())</li>
                            }
                        </ul>
                    </li>
                    @if (Authorization.HasAny(Claims.Device.Search, Claims.Device.Actions.Import, Claims.Device.Actions.Export, Claims.Device.Actions.EnrolDevices))
                    {
                        <li class="@((string)ViewContext.ViewData["MenuArea"] == MVC.Device.Name ? "active" : null)">@Html.ActionLink("Devices", MVC.Device.Index(), accesskey: "2")</li>
                    }
                    @if (Authorization.HasAny(Claims.User.Search))
                    {
                        <li class="@((string)ViewContext.ViewData["MenuArea"] == MVC.User.Name ? "active" : null)">@Html.ActionLink("Users", MVC.User.Index(), accesskey: "3")</li>
                    }
                    <li class="moveRight@((string)ViewContext.ViewData["MenuArea"] == MVC.Public.Name ? " active" : null)">@Html.ActionLink("Reports", MVC.Public.Public.Index())</li>
                    @if (Authorization.Has(Claims.Config.Show))
                    {
                        <li class="@((string)ViewContext.ViewData["MenuArea"] == MVC.Config.Name ? "active" : null)">@Html.ActionLink("Configuration", MVC.Config.Config.Index(), accesskey: "0")</li>
                    }
                </ul>
            </nav>
            <div id="headerMenu">
                <span>@if (Authorization.Has(Claims.User.Show))
                      { @Html.ActionLink(CurrentUser.ToString(), MVC.User.Show(CurrentUser.UserId))}
                      else
                      {@CurrentUser.ToString()}</span>
                @if (Authorization.HasAny(Claims.Job.Search, Claims.Device.Search, Claims.User.Search))
                {
                    using (Html.BeginForm(MVC.Search.Query(), FormMethod.Get))
                    { @Html.TextBox("term", null, new { id = "SearchQuery", accesskey = "s", placeholder = "Search", data_quicksearchurl = Url.Action(MVC.API.Search.QuickQuery()) }) }
                }
            </div>
        </header>
        <div id="layout_PageHeading">@CommonHelpers.Breadcrumbs(ViewBag.Title ?? string.Empty)</div>
        <section id="layout_Page">
            @RenderBody()
        </section>
        <footer>
            Disco v@(Disco.Web.DiscoApplication.Version) @@ @(Disco.Web.DiscoApplication.OrganisationName) | <a
                href="https://discoict.com.au/" target="_blank">discoict.com.au</a> | @Html.ActionLink("Credits", MVC.Public.Public.Credits()) | @Html.ActionLink("Licence", MVC.Public.Public.Licence())
        </footer>
    </div>
    @{ Disco.Services.Plugins.Features.UIExtension.UIExtensions.ExecuteExtensionResult(this); }
</body>
</html>
