@using Zap.BI.Portal.Helpers
@using Zap.JsonSerialization
@model Zap.BI.Portal.Models.Admin.AdminViewModel

<script>
    if (!Object.create)
        location.href = '@Url.Action("UnsupportedDocumentMode", "Error", new { originalUrl = Request.RawUrl }, Request.Url.Scheme)';
</script>

@section Css
{
    <link href="@Url.Action("Admin", "Css", new { hash = Model.AllCssHash })" rel="stylesheet" type="text/css" />
}

@section Scripts
{
    <script defer src="@Url.Action("ClientObjects", "Admin", new { hash = Model.ClientObjectsScriptsHash })" type="text/javascript"></script>
    <script defer src="@Url.Action("File", "Content", new { path = "BI/Portal/dist/admin.js" })" type="text/javascript"></script>
    <script defer>
        var baseUri = document.baseURI || document.getElementsByTagName('base')[0].href;
        window.addEventListener('load', function () { window.startApp(@Html.RawSanitizedScript(Model.ClientModel.ZapToCleanJson()), baseUri) });
    </script>
}

@Html.AntiForgeryToken()

<div id="appRoot" class="l-admin" ng-class="::'is-scriptsLoaded'">
    <admin-header class="l-admin-header"></admin-header>
    <admin-error-ribbon class="l-admin-errorRibbon"></admin-error-ribbon>
    <div ui-view view-inject class="l-admin-body"></div>
</div>

@*Note: The loading overlay is outside the angular application so that it appears as soon as possible*@
<div class="adminLoadingOverlay loadingOverlay-spinner">@Html.Partial("Spinner", "large")</div>
