@model bitforum.Models.Page.Popup
@{
    ViewData["Title"] = "팝업 수정";
}

<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" asp-controller="Popup" asp-action="Update">
        <input type="hidden" asp-for="ID" />

        <div class="row mb-2">
            <label for="Subject" class="col-sm-2 col-form-label"><span>*</span> 제목</label>
            <div class="col-sm-10">
                <input type="text" asp-for="Subject" class="form-control" required />
                <span asp-validation-for="Subject" class="text-danger"></span>
            </div>
        </div>
        <div class="row mb-2">
            <label for="Content" class="col-sm-2 col-form-label">내용</label>
            <div class="col-sm-10">
                <textarea asp-for="Content" class="form-control ck-editor"></textarea>
                <span asp-validation-for="Content" class="text-danger"></span>
            </div>
        </div>
        <div class="row mb-2">
            <label for="Link" class="col-sm-2 col-form-label">주소</label>
            <div class="col-sm-10">
                <input type="url" asp-for="Link" class="form-control" />
                <span asp-validation-for="Link" class="text-danger"></span>
                <span class="text-muted form-text">
                    팝업 클릭 시 페이지 이동 주소를 지정합니다.
                </span>
            </div>
        </div>
        <div class="row mb-2">
            <label for="Order" class="col-sm-2 col-form-label"><span>*</span> 순서</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>
        <div class="row mb-2">
            <label class="col-sm-2 col-form-label">사용 기간</label>
            <div class="col-sm-10">
                <div class="row g-2">
                    <div class="col col-md-auto">
                        <input type="date" asp-for="StartAt" class="form-control" />
                        <span asp-validation-for="StartAt" class="text-danger"></span>
                    </div>
                    <div class="col-auto d-none d-md-block align-self-center">~</div>
                    <div class="col col-md-auto">
                        <input type="date" asp-for="EndAt" class="form-control" />
                        <span asp-validation-for="EndAt" class="text-danger"></span>
                    </div>
                </div>
                <span class="text-muted form-text">
                    사용 기간을 설정하지 않으면 무제한으로 사용됩니다.
                </span>
            </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 != DateTime.MinValue)
        {
            <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 asp-action="Index" class="btn btn-sm btn-secondary">취소</a>
        </div>
        <br />
    </form>
</div>