@using Zap.BI.Portal.Helpers
@using Zap.BI.Portal.Pages
@using Zap.BI.Portal.Pages.Diagnostics
@using Zap.Text
@model Zap.BI.Portal.Models.TroubleshootViewModel

@{
    Layout = null;
}

<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="X-UA-Compatible" content="IE=100" />
        <meta charset="utf-8" />
        <title>@DiagnosticText.Troubleshoot_aspx_Label_Heading</title>
        <style type="text/css">
            html, body
            {
                margin: 0px;
                padding: 0px;
            }

            .LoadingSplashContainer
            {
                padding: 0;
                margin: 0;
                position: absolute;
                z-index: 65535;
                width: 100%;
            }

            .LoadingSplashContent
            {
                width: 650px;
                margin: 0 auto;
                font-family: "Segoe UI", Verdana, Helvetica, Arial, sans-serif;
                font-size: 14px;
            }

            .headingTable
            {
                text-align: center;
                font-size: 13pt;
                font-weight: bold;
                color: black;
            }

            .quietText
            {
                font-size: 8pt;
                color: #666666;
            }

            .button
            {
                display: inline-block;
                height: 40px;
                width: 140px;
                cursor: default;
                font-family: "Segoe UI", Verdana, Helvetica, Arial, sans-serif;
                font-size: 16px;
                color: #FFFFFF;
                background: #5585b4;
                border: 1px solid hsl(209.7, 38.8%, 56%);
            }

            .button:hover
            {
                background: hsl(209.7, 38.8%, 60%);
            }

            .imageSize
            {
                width: 32px;
                height: 32px;
            }

            .details
            {
                padding-left: 70px;
            }
        </style>
        <script>
            window.addEventListener('load', function () {
                var retryForm = document.getElementById('retryForm');
                var retryButton = document.getElementById('retryButton');

                if (retryForm != null && retryButton != null) {
                    retryForm.addEventListener('submit', function () {
                        retryButton.disabled = true;
                    });
                }
            });
        </script>
    </head>
    <body>
        <div class="LoadingSplashContainer">
            <div class="LoadingSplashContent">
                <div>
                    <table class="headingTable">
                        <tbody>
                            <tr>
                                <td class="headingIcon">
                                    <img id="TitleIcon" class="imageSize" src="@Model.HeadingImage">
                                </td>
                                <td>
                                    <span id="Heading">@Model.Heading</span>
                                </td>
                            </tr>
                        </tbody>
                    </table>

                    <div class="details">
                        <p>
                            <span id="Message">@HtmlSanitizer.Sanitize(Model.Message)</span>
                        </p>
                    </div>
                </div>

                @if (@Model.StepsToResolve.IsNotEmpty())
                {
                    <div id="stepsToResolveDiv">
                        <table class="headingTable">
                            <tbody>
                                <tr>
                                    <td class="headingIcon">
                                        <img id="StepsToResolveIcon" class="imageSize" src="@Model.StepsToResolveImageUrl">
                                    </td>
                                    <td>
                                        <span id="StepsToResolveHeading">@DiagnosticText.Troubleshoot_aspx_Label_StepsToResolve</span>
                                    </td>
                                </tr>
                            </tbody>
                        </table>

                        <div class="details">
                            @if (@Model.ShowRetryButton)
                            {
                                @Html.RawSanitizedHtml(@DiagnosticText.Troubleshoot_aspx_Label_VerifySuggestionsRetry)
                            }
                            else
                            {
                                @Html.RawSanitizedHtml(@DiagnosticText.Troubleshoot_aspx_Label_VerifySuggestions)
                            }
                            <span id="StepsToResolve">
                                @Html.RawSanitizedHtml(Model.StepsToResolve)
                            </span>
                        </div>
                    </div>
                }

                @if (@Model.ShowRetryButton)
                {
                    <div style="text-align: center; padding: 20px;">
                        <form id="retryForm" method="post" action="@Url.Action("Retry", "Error")">
                            <input type="hidden" name="originalUrl" value="@(Model.RetryUrl ?? Request.RawUrl)" />
                            <input id="retryButton" type="submit" class="button" value="@DiagnosticText.Troubleshoot_aspx_ButtonLabel_Retry" />
                        </form>
                    </div>
                }

                @if (@Model.ShowLogOutButton)
                {
                    <div style="text-align: center; padding: 20px;">
                        <form id="logOutForm" method="post" action="@Url.Action("Logout", "User")">
                            <input id="logOutButton" type="submit" class="button" value="@PageText.ButtonLabel_LogOut" />
                        </form>
                    </div>
                }
            </div>
        </div>
    </body>
</html>