@page "{id:int}"
@model Admin.Pages.Faq.List.EditModel
@{
    ViewData["Title"] = "FAQ 수정";
}

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

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

    <form id="fAdminWrite" method="post" accept-charset="utf-8" autocomplete="off">
        <input type="hidden" asp-for="Input.ID" />
        <input type="hidden" asp-for="QueryString" />

        <div class="row mb-2">
            <label class="col-sm-2 col-form-label"><span>*</span> PK</label>
            <div class="col-sm-10">
                <input type="text" readonly class="form-control-plaintext" value="@Model.Input.ID" />
            </div>
        </div>
        <div class="row mb-2">
            <label asp-for="Input.CategoryID" class="col-sm-2 col-form-label"><span>*</span> 분류</label>
            <div class="col-sm-10">
                <select asp-for="Input.CategoryID" asp-items="Model.Categories" class="form-select w-auto" required></select>
                <span asp-validation-for="Input.CategoryID" class="text-danger"></span>
            </div>
        </div>
        <div class="row mb-2">
            <label asp-for="Input.Question" class="col-sm-2 col-form-label"><span>*</span> 질문</label>
            <div class="col-sm-10">
                <input asp-for="Input.Question" class="form-control required" />
                <span asp-validation-for="Input.Question" class="text-danger"></span>
            </div>
        </div>
        <div class="row mb-2">
            <label asp-for="Input.Answer" class="col-sm-2 col-form-label">답변</label>
            <div class="col-sm-10">
                <textarea asp-for="Input.Answer" class="form-control ck-editor"></textarea>
                <span asp-validation-for="Input.Answer" class="text-danger"></span>
            </div>
        </div>
        <div class="row mb-2">
            <label asp-for="Input.Order" class="col-sm-2 col-form-label"><span>*</span> 순서</label>
            <div class="col-sm-10">
                <div class="row">
                    <div class="col col-md-auto">
                        <input asp-for="Input.Order" class="form-control" type="number" min="-9999" max="9999" required />
                    </div>
                </div>
                <span asp-validation-for="Input.Order" class="text-danger"></span>
            </div>
        </div>
        <div class="row mb-2">
            <label asp-for="Input.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="Input.IsActive" class="form-check-input" />
                    <label class="form-check-label" asp-for="Input.IsActive">
                        사용합니다.
                    </label>
                    <span asp-validation-for="Input.IsActive" class="text-danger"></span>
                </div>
            </div>
        </div>
        @if (Model.Input.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="Input.UpdatedAt" class="form-control-plaintext" type="text" readonly />
                </div>
            </div>
        }
        @if (Model.Input.CreatedAt != null)
        {
            <div class="row mb-2">
                <label class="col-sm-2 col-form-label">등록일시</label>
                <div class="col-sm-10">
                    <input asp-for="Input.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-success">저장</button>
            <a href="/Faq/List?@Model.QueryString" class="btn btn-secondary">취소</a>
        </div>
        <br/>
    </form>
</div>