@model MultipleChoiceTrainer.Models.QuizViewModel
@{
    ViewData["Title"] = "Quiz";
}

@using (Html.BeginForm("quiz", "quiz", FormMethod.Post))
{
    <input asp-for="QuizType" type="hidden" />
    <input asp-for="CurrentTypeId" type="hidden" />

    <input asp-for="CurrentQuestion.Id" type="hidden" />

    @if (Model.HasPreviousResult)
    {
        <div class="alert alert-@(Model.PassedPreviousQuestion ?  "success" : "danger" )" role="alert">
            <h4 class="alert-heading">@(Model.PassedPreviousQuestion ?  "Gut gemacht!" : "Leider falsch!" )</h4>
            <p class="lead">@Model.PreviousQuestion</p>
            <table class="table table-borderless table-striped table-sm table-dark border border-dark">
                <tr>
                    <th>Frage</th>
                    <th>Soll</th>
                    <th>Ist</th>
                </tr>
                @foreach (var eval in Model.Evaluations)
                {
                    <tr class="table-@(eval.Success ? "success" : "danger")">
                        <td>@eval.Text</td>
                        <td><i class="fa fa-@(eval.RightAnswer ? "check" : "times")"></i></td>
                        <td><i class="fa fa-@(eval.GivenAnswer ? "check" : "times")"></i></td>
                    </tr>
                }
            </table>
        </div>
    }

    <h4>Frage beantworten</h4>
    <p class="text-black-50">aus Lektion <i>@Model.CurrentQuestion.Section.Name</i>, Kurs <i>@Model.CurrentQuestion.Section.Category.Name</i></p>
    <hr />
    <p class="lead">
        @Model.CurrentQuestion.Text <small class="text-black-50"> <i class="fas fa-info-circle" data-toggle="tooltip" title="(@Model.CurrentQuestion.Choices.Count(e => e.IsTrue) von @Model.Choices.Count())"></i></small>
    </p>
    @for (int i = 0; i < Model.Choices.Count(); i++)
    {

        <div class="form-check">
            <input asp-for="@Model.Choices[i].Id" type="hidden" />
            <input asp-for="@Model.Choices[i].Text" type="hidden" />
            <input asp-for="@Model.Choices[i].IsTrue" class="form-check-input" value="true" />
            <label asp-for="@Model.Choices[i].IsTrue" class="form-check-label">@Model.Choices[i].Text</label>
        </div>
    }

    <button type="submit" class="btn btn-outline-warning">Prüfen</button>

}
