@using Zap.BI.Portal.Controls.Settings
@using Zap.BI.Portal.Models.Admin
@model AdministrationTokenModel
<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 { }


<div class="l-admin">
    <div class="l-admin-header">@Html.Partial("AdminHeader", Model.HeaderModel)</div>
    <div class="l-admin-body">
        @using (Html.BeginForm("Validate", "AdministrationToken", new { returnUrl = Model.ReturnUrl }, FormMethod.Post))
        {
            <div class="ui-fixed-width-wide admin-form">
                <span class="ui-text">@SettingsText.Message_AdministrationTokenDescription</span>
                <label class="ui-field">
                    <span class="ui-field-label">@SettingsText.Message_EnterAdministrationToken</span>
                    <input type="text" name="token" value="@Model.Token" class="ui-input-box ui-field-input" autocomplete="off" size="40">
                    <span class="ui-indicator-medium @(Model.Token != null
                                                           ? "ui-indicator-error"
                                                           : string.Empty)" title="@InitializationText.Validation_InvalidAdministrationToken"></span>
                </label>
            </div>

            <div class="admin-form buttonContainer">
                <span id="spinner" hidden>@Html.Partial("Spinner", "small")</span>
                <button type="submit" class="button-raised button-primary" id="submit">@InitializationText.Label_Next</button>
            </div>
        }
    </div>
    <script>
        document.getElementsByTagName('form')[0].addEventListener('submit', function () {
            document.getElementById('spinner').hidden = false;
            document.getElementById('submit').disabled = true;
        });
    </script>
</div>
