@model Disco.Web.Areas.Config.Models.Config.IndexModel
@{
    Authorization.Require(Claims.Config.Show);
    ViewBag.Title = "Configuration";
}
<table id="pageMenu">
    <tr>
        @if (Authorization.HasAny(Claims.Config.System.Show, Claims.Config.Organisation.Show, Claims.DiscoAdminAccount, Claims.Config.Logging.Show))
        {
            <td>
                <div class="pageMenuArea">
                    <h2>Hosting</h2>
                    @if (Authorization.Has(Claims.Config.System.Show))
                    {
                        <i class="fa fa-cog"></i>@Html.ActionLinkClass("System", MVC.Config.SystemConfig.Index(), "config")
                        <div class="pageMenuBlurb">
                            Update system configuration, such as the Data Storage Location and Proxy settings.
                        </div>
                    }
                    @if (Authorization.Has(Claims.Config.Organisation.Show))
                    {
                        <i class="fa fa-cog"></i>@Html.ActionLinkClass("Organisation Details", MVC.Config.Organisation.Index(), "config")
                        <div class="pageMenuBlurb">
                            Update the Organisation Name, Logo and Addresses associated with this organisation.
                        </div>
                    }
                    @if (Authorization.Has(Claims.DiscoAdminAccount))
                    {
                        <i class="fa fa-cog"></i>@Html.ActionLinkClass("Authorization Roles", MVC.Config.AuthorizationRole.Index(), "config")
                        <div class="pageMenuBlurb">
                            Configure roles and permissions for users.
                        </div>
                    }
                    @if (Authorization.Has(Claims.Config.Logging.Show))
                    {
                        <i class="fa fa-cog"></i>@Html.ActionLinkClass("Logging", MVC.Config.Logging.Index(), "config")
                        <div class="pageMenuBlurb">
                            Export Log files from various Disco Modules and view Live Logging.
                        </div>
                    }
                </div>
            </td>
        }
        @if (Authorization.HasAny(Claims.Config.DeviceModel.Show, Claims.Config.DeviceBatch.Show, Claims.Config.DeviceProfile.Show, Claims.Config.Enrolment.Show))
        {
            <td>
                <div class="pageMenuArea">
                    <h2>Devices</h2>
                    @if (Authorization.Has(Claims.Config.DeviceModel.Show))
                    {
                        <i class="fa fa-cog"></i>@Html.ActionLinkClass("Models", MVC.Config.DeviceModel.Index(), "config")
                        <div class="pageMenuBlurb">
                            Configure Components, Product Images and default settings for Device Models.
                        </div>
                    }
                    @if (Authorization.Has(Claims.Config.DeviceBatch.Show))
                    {
                        <i class="fa fa-cog"></i>@Html.ActionLinkClass("Batches", MVC.Config.DeviceBatch.Index(), "config")
                        <div class="pageMenuBlurb">
                            Create and Configure Device Batches.
                        </div>
                    }
                    @if (Authorization.Has(Claims.Config.DeviceProfile.Show))
                    {
                        <i class="fa fa-cog"></i>@Html.ActionLinkClass("Profiles", MVC.Config.DeviceProfile.Index(), "config")
                        <div class="pageMenuBlurb">
                            Configure Device Profiles including computer name generation, distribution and Active
                    Directory OU layout.
                        </div>
                    }
                    @if (Authorization.Has(Claims.Config.Enrolment.Show))
                    {
                        <i class="fa fa-cog"></i>@Html.ActionLinkClass("Enrolment", MVC.Config.Enrolment.Index(), "config")
                        <div class="pageMenuBlurb">
                            Configure Enrolment settings including secure credentials.
                        </div>
                    }
                </div>
            </td>
        }
        @if (Authorization.HasAny(Claims.Config.JobPreferences.Show, Claims.Config.JobQueue.Show, Claims.Config.DocumentTemplate.Show, Claims.Config.Plugin.Show))
        {
            <td>
                @if (Authorization.HasAny(Claims.Config.JobPreferences.Show, Claims.Config.JobQueue.Show))
                {
                    <div class="pageMenuArea noSeperator">
                        <h2>Jobs</h2>
                        @if (Authorization.Has(Claims.Config.JobPreferences.Show))
                        {
                            <i class="fa fa-cog"></i>@Html.ActionLinkClass("General Preferences", MVC.Config.JobPreferences.Index(), "config")
                            <div class="pageMenuBlurb">
                                Configure general preferences related to jobs.
                            </div>
                        }
                        @if (Authorization.Has(Claims.Config.JobQueue.Show))
                        {
                            <i class="fa fa-cog"></i>@Html.ActionLinkClass("Job Queues", MVC.Config.JobQueue.Index(), "config")
                            <div class="pageMenuBlurb">
                                Create and manage job queues including priorities and queue members.
                            </div>
                        }
                    </div>
                }

                @if (Authorization.HasAny(Claims.Config.DocumentTemplate.Show, Claims.Config.Plugin.Show))
                {
                    <div class="pageMenuArea">
                        <h2>Features</h2>
                        @if (Authorization.Has(Claims.Config.DocumentTemplate.Show))
                        {
                            <i class="fa fa-cog"></i>@Html.ActionLinkClass("Document Templates", MVC.Config.DocumentTemplate.Index(), "config")
                            <div class="pageMenuBlurb">
                                Create, Update and Bulk Generate documents based on PDF Templates for Jobs, Devices
                    and Users.
                            </div>
                        }
                        @if (Authorization.Has(Claims.Config.Plugin.Show))
                        {
                            <i class="fa fa-cog"></i>@Html.ActionLinkClass("Plugins", MVC.Config.Plugins.Index(), "config")
                            <div class="pageMenuBlurb">
                                Manage extensions to the Disco platform.
                            </div>
                        }
                    </div>
                }
            </td>
        }
    </tr>
</table>
@{
    if (Model.UpdateAvailable)
    {
    <div id="updateAvailableContainer">
        <i class="fa fa-cloud-download info"></i>
        <div>An updated version of Disco is available</div>
        <a href="@Model.UpdateResponse.UrlLink" class="button small alert" target="_blank">Download v@(Model.UpdateResponse.Version)</a>
    </div>
    <script>
        (function () {
            $(function () {
                var layout_PageHeading = $('#layout_PageHeading').height(80);
                var updateAvailableContainer = $('#updateAvailableContainer');
                updateAvailableContainer.appendTo(layout_PageHeading);
                @{
        if (Model.UpdateResponse.VersionReleasedTimestamp < DateTime.Now.AddDays(-14))
        {
                    <text>
                updateAvailableContainer.effect("shake", { times: 3 }, 500);
                </text>
        }
                }
            });
        })();
    </script>
    }
}