@model bitforum.Models.Page.Faq.FaqItem
@{
    ViewData["Title"] = "FAQ 등록";
    var faqCategories = ViewBag.FaqCategory as List<bitforum.Models.Page.Faq.FaqCategory>;
}

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

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

    <form name="f_admin_write" id="fAdminWrite" method="post" accept-charset="utf-8" autocomplete="off" action="/Page/Faq/Item/Create">
        <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" class="form-select w-auto" required>
                    <option value="">선택하세요.</option>
                    @foreach (var row in faqCategories)
                    {
                        <option value="@row.ID">@row.Subject</option>
                    }
                </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>
        <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>