@using bitforum.Helpers

@{
    ViewData["Title"] = "기본 설정";
    var config = ViewBag.Config as Dictionary<string, string>;
}

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

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

    <form name="f_admin_write" id="fAdminWrite" method="post" asp-controller="Basic" asp-action="Save" autocomplete="off">
        <div class="row mb-3">
            <label for="siteName" class="col-sm-2 col-form-label">관리자 제목</label>
            <div class="col-sm-10">
                <input type="text" name="site_name" id="siteName" class="form-control" value="@config.GetConfig("site_name")" />
            </div>
        </div>
        <div class="row mb-3">
            <label for="rootID" class="col-sm-2 col-form-label">최고 관리자</label>
            <div class="col-sm-10">
            </div>
        </div>
        <div class="row mb-3">
            <label for="fromEmail" class="col-sm-2 col-form-label">송수신 이메일</label>
            <div class="col-sm-10">
                <input type="text" name="from_email" id="fromEmail" class="form-control" value="@config.GetConfig("from_email")" />
                <div class="form-text text-muted">관리자가 보내고 받는 용도로 사용하는 메일 주소를 입력합니다.</div>
            </div>
        </div>
        <div class="row mb-3">
            <label for="fromEmailName" class="col-sm-2 col-form-label">송수신자 이름</label>
            <div class="col-sm-10">
                <input type="text" name="from_email_name" id="fromEmailName" class="form-control" value="@config.GetConfig("from_email_name")" />
                <div class="form-text text-muted">관리자가 보내고 받는 용도로 사용하는 메일의 발송자 이름을 입력합니다.</div>
            </div>
        </div>
        <hr />
        <div class="row mb-3">
            <label for="smtpServer" class="col-sm-2 col-form-label">SMTP Server</label>
            <div class="col-sm-10">
                <input type="text" name="smtp_server" id="smtpServer" class="form-control" value="@config.GetConfig("smtp_server")" />
            </div>
        </div>
        <div class="row mb-3">
            <label for="smtpPort" class="col-sm-2 col-form-label">SMTP Port</label>
            <div class="col-sm-10">
                <input type="number" name="smtp_port" id="smtpPort" class="form-control d-inline w-auto" value="@config.GetConfig("smtp_port")" />
            </div>
        </div>
        <div class="row mb-3">
            <label for="smtpFromEmail" class="col-sm-2 col-form-label">SMTP From Email</label>
            <div class="col-sm-10">
                <input type="text" name="smtp_from_email" id="smtpFromEmail" class="form-control" value="@config.GetConfig("smtp_from_email")" />
            </div>
        </div>
        <div class="row mb-3">
            <label for="smtpEmailPassword" class="col-sm-2 col-form-label">SMTP Email Password</label>
            <div class="col-sm-10">
                <input type="password" name="smtp_email_password" id="smtpEmailPassword" class="form-control" value="@config.GetConfig("smtp_email_password")" />
            </div>
        </div>
        <hr />
        <div class="row mb-3">
            <label for="adminWhiteIPList" class="col-sm-2 col-form-label">관리자단 접근 가능 IP</label>
            <div class="col-sm-10">
                <div class="form-text text-muted pb-2">
                    해당 IP 에서만 관리자 페이지에 접근이 가능합니다. <br />
                    IP 주소 입력형식 <br />
                    1. 와일드카드 (*) 사용가능(예: 192.168.0.*) <br />
                    2. 하이픈 (-)을 사용하여 대역으로 입력가능 <br />
                    (단, 대역폭으로 입력할 경우 와일드카드 사용불가. 예: 192.168.0.1 ~ 192.168.0.254) <br />
                    3. 여러개의 항목은 줄을 바꾸어 입력하세요.
                </div>

                <textarea name="admin_white_ip_list" id="adminWhiteIPList" class="form-control" rows="2">@config.GetConfig("admin_white_ip_list") </textarea>
                <div class="form-text text-muted">
                    해당 IP 에서만 관리자에 접근이 가능합니다.
                </div>
            </div>
        </div>
        <div class="row mb-3">
            <label for="frontWhiteIPList" class="col-sm-2 col-form-label">사용자단 접근 가능 IP</label>
            <div class="col-sm-10">
                <textarea name="front_white_ip_list" id="frontWhiteIPList" class="form-control" rows="2">@config.GetConfig("front_white_ip_list")</textarea>
                <div class="form-text text-muted">
                    해당 IP 에서만 사이트에 접근이 가능합니다. <br>
                </div>
            </div>
        </div>
        <hr />
        <div class="row mb-3">
            <label for="blockAlertTitle" class="col-sm-2 col-form-label">차단 시 안내문 제목</label>
            <div class="col-sm-10">
                <input type="text" name="block_alert_title" id="blockAlertTitle" class="form-control" value="@config.GetConfig("block_alert_title")" />
            </div>
        </div>
        <div class="row mb-3">
            <label for="blockAlertContent" class="col-sm-2 col-form-label">차단 시 안내문 내용</label>
            <div class="col-sm-10">
                <textarea name="block_alert_content" id="blockAlertContent" class="ck-editor">@config.GetConfig("block_alert_content")</textarea>
            </div>
        </div>
        <hr />
        <div class="row mb-3">
            <label for="isMaintenance" class="col-sm-2 col-form-label">점검 여부</label>
            <div class="col-sm-10 align-content-center">
                <div class="form-check-inline">
                    <input class="form-check-input" type="checkbox" value="1" id="isMaintenance" name="is_maintenance" @(config.GetConfig("is_maintenance") == "1" ? "checked" : "") />
                    <label class="form-check-label" for="isMaintenance">
                        점검을 진행합니다.
                    </label>
                </div>
            </div>
        </div>
        <div class="row mb-3">
            <label for="maintenanceContent" class="col-sm-2 col-form-label">점검 내용</label>
            <div class="col-sm-10">
                <textarea name="maintenance_content" id="maintenanceContent" class="ck-editor">@config.GetConfig("maintenance_content")</textarea>
            </div>
        </div>
        <hr/>
        <div class="row">
            <div class="col text-center p-3">
                <button type="submit" class="btn btn-success">저장하기</button>
            </div>
        </div>

        <br />
    </form>
</div>
