@using ZelWiki.Models
@model ZelWiki.Models.ViewModels.Page.PageRevertViewModel
@{
    Layout = "/Views/Shared/_Layout.cshtml";
    var sessionState = ViewData["SessionState"] as ZelWiki.SessionState ?? throw new Exception("Wiki State Context cannot be null.");
}

@if (!string.IsNullOrEmpty(Model.ErrorMessage))
{
    <div class="alert alert-danger">@Html.Raw(Model.ErrorMessage)</div>
}
@if (!string.IsNullOrEmpty(Model.SuccessMessage))
{
    <div class="alert alert-success">@Html.Raw(Model.SuccessMessage)</div>
}

<div class="card border-warning mb-3">
    <div class="card-header bg-warning">
        <strong>Revert to revision @sessionState.Page.Revision?</strong>
    </div>
    <div class="card-body">
        Reverting "@Model.PageName" from revision @sessionState.Page.MostCurrentRevision to @sessionState.Page.Revision will rollback @Model.HigherRevisionCount changes.</><br />
        Reverting does not mean that changes will be lost however, the revert process will create a new revision with the reverted changes.<br /><br />
        Are you sure you want to continue?<br /><br />

        @using (Html.BeginForm(null, null, FormMethod.Post, new { action = $"{GlobalConfiguration.BasePath}{Context.Request.Path}" }))
        {
            <div class="form-group"><button type="submit" class="btn btn-warning rounded-0" name="IsActionConfirmed" value="true">是</button>&nbsp;&nbsp;<button type="submit" class="btn btn-success rounded-0" name="IsActionConfirmed" value="false">否</button></div>
        }
    </div>
</div>
