@model bitforum.Models.Page.Faq.FaqItem
@{
    ViewData["Title"] = "FAQ 수정";
    var faqCategories = ViewBag.FaqCategory as SelectList;
}

<div class="container">
    <h3>@ViewData["Title"]</h3>
    <hr />

    <partial name="_StatusMessage" />
    <partial name="_Editor" />

    <form name="f_admin_edit" id="fAdminEdit" method="post" accept-charset="utf-8" autocomplete="off" action="/Page/Faq/Item/Update">
        <input type="hidden" asp-for="ID" />

        <div class="row mb-2">
            <label for="CategoryID" class="col-sm-2 col-form-label">분류</label>
            <div class="col-sm-10">
                <select asp-for="CategoryID" asp-items="faqCategories" class="form-select w-auto" required></select>
                <span asp-validation-for="CategoryID" class="text-danger"></span>
            </div>
        </div>
        <div class="row mb-2">
            <label for="Question" class="col-sm-2 col-form-label">질문</label>
            <div class="col-sm-10">
                <input asp-for="Question" class="form-control required" />
                <span asp-validation-for="Question" class="text-danger"></span>
            </div>
        </div>
        <div class="row mb-2">
            <label for="Answer" class="col-sm-2 col-form-label">답변</label>
            <div class="col-sm-10">
                <textarea asp-for="Answer" class="form-control ck-editor"></textarea>
                <span asp-validation-for="Answer" class="text-danger"></span>
            </div>
        </div>
        <div class="row mb-2">
            <label for="Order" class="col-sm-2 col-form-label">순서</label>
            <div class="col-sm-10 align-content-center">
                <div class="form-check-inline">
                    <input type="number" asp-for="Order" class="form-control" min="-999" max="999" required />
                    <span asp-validation-for="Order" class="text-danger"></span>
                </div>
            </div>
        </div>
        <div class="row mb-2">
            <label for="IsActive" class="col-sm-2 col-form-label">사용 여부</label>
            <div class="col-sm-10 align-content-center">
                <div class="form-check-inline">
                    <input type="checkbox" asp-for="IsActive" class="form-check-input" />
                    <label class="form-check-label" for="IsActive">
                        사용합니다.
                    </label>
                    <span asp-validation-for="IsActive" class="text-danger"></span>
                </div>
            </div>
        </div>
        @if (Model.UpdatedAt is not null)
        {
            <div class="row mb-2">
                <label class="col-sm-2 col-form-label">수정일시</label>
                <div class="col-sm-10">
                    <input asp-for="UpdatedAt" class="form-control-plaintext" type="text" readonly />
                </div>
            </div>
        }
        @if (Model.CreatedAt is not null)
        {
            <div class="row mb-2">
                <label class="col-sm-2 col-form-label">등록일시</label>
                <div class="col-sm-10">
                    <input asp-for="CreatedAt" class="form-control-plaintext" type="text" readonly />
                </div>
            </div>
        }
        <hr/>
        <div class="d-grid gap-2 text-center d-md-block">
            <button type="submit" class="btn btn-sm btn-success">저장</button>
            <a href="/Page/Faq/Item" class="btn btn-sm btn-secondary">취소</a>
        </div>
        <br/>
    </form>
</div>