@extends('admin.layouts.app')

@section('content')
<div class="container-fluid">
    <h2>게시판 관리 - 알람</h2>
    <hr/>
    @include('admin.messages')
    @if($boardID)
        @include('admin.board.board.navTabs')
    @endif

    <form name="f_admin_write" id="fAdminWrite" method="post" action="{{ $actionURL }}" enctype="multipart/form-data">
        @csrf
        <input type="hidden" name="board_id" value="{{ $boardID }}" />
        <h4 class="mb-3">이메일 발송</h4>
        <div class="row mb-3">
            <label class="col-sm-2">게시글 작성 시</label>
            <div class="col-sm-8">
                <div class="form-check">
                    <input type="checkbox" name="send_email_post_super_admin" id="sendEmailPostSuperAdmin" class="form-check-input" value="1" @if($boardMetaData->send_email_post_super_admin ?? old('send_email_post_super_admin')) checked @endif />
                    <label for="sendEmailPostSuperAdmin" class="form-check-label">최고 관리자</label>
                </div>
                <div class="form-check">
                    <input type="checkbox" name="send_email_post_post_writer" id="sendEmailPostPostWriter" class="form-check-input" value="1" @if($boardMetaData->send_email_post_post_writer ?? old('send_email_post_post_writer')) checked @endif />
                    <label for="sendEmailPostPostWriter" class="form-check-label">게시글 작성자</label>
                </div>
            </div>
            <div class="col-sm-2">
                <div class="form-check-inline">
                    <input type="checkbox" name="grp[send_email_post]" id="grpSendEmailPost" class="form-check-input" value="1" />
                    <label for="grpSendEmailPost" class="form-check-label">
                        그룹적용
                    </label>
                </div>
                <div class="form-check-inline">
                    <input type="checkbox" name="all[send_email_post]" id="allSendEmailPost" class="form-check-input" value="1" />
                    <label for="allSendEmailPost" class="form-check-label">
                        전체적용
                    </label>
                </div>
            </div>
        </div>
        <div class="row mb-3">
            <label class="col-sm-2">댓글 작성 시</label>
            <div class="col-sm-8">
                <div class="form-check">
                    <input type="checkbox" name="send_email_comment_super_admin" id="sendEmailCommentSuperAdmin" class="form-check-input" value="1" @if($boardMetaData->send_email_comment_super_admin ?? old('send_email_comment_super_admin')) checked @endif />
                    <label for="sendEmailCommentSuperAdmin" class="form-check-label">최고 관리자</label>
                </div>
                <div class="form-check">
                    <input type="checkbox" name="send_email_comment_post_writer" id="sendEmailCommentPostWriter" class="form-check-input" value="1" @if($boardMetaData->send_email_comment_post_writer ?? old('send_email_comment_post_writer')) checked @endif />
                    <label for="sendEmailCommentPostWriter" class="form-check-label">게시글 작성자</label>
                </div>
                <div class="form-check">
                    <input type="checkbox" name="send_email_comment_comment_writer" id="sendEmailCommentCommentWriter" class="form-check-input" value="1" @if($boardMetaData->send_email_comment_comment_writer ?? old('send_email_comment_comment_writer')) checked @endif />
                    <label for="sendEmailCommentCommentWriter" class="form-check-label">댓글 작성자</label>
                </div>
            </div>
            <div class="col-sm-2">
                <div class="form-check-inline">
                    <input type="checkbox" name="grp[send_email_comment]" id="grpSendEmailComment" class="form-check-input" value="1" />
                    <label for="grpSendEmailComment" class="form-check-label">
                        그룹적용
                    </label>
                </div>
                <div class="form-check-inline">
                    <input type="checkbox" name="all[send_email_comment]" id="allSendEmailComment" class="form-check-input" value="1" />
                    <label for="allSendEmailComment" class="form-check-label">
                        전체적용
                    </label>
                </div>
            </div>
        </div>
        <div class="row mb-3">
            <label class="col-sm-2">게시글 신고 발생 시</label>
            <div class="col-sm-8">
                <div class="form-check">
                    <input type="checkbox" name="send_email_post_blame_super_admin" id="sendEmailPostBlameSuperAdmin" class="form-check-input" value="1" @if($boardMetaData->send_email_post_blame_super_admin ?? old('send_email_post_blame_super_admin')) checked @endif />
                    <label for="sendEmailPostBlameSuperAdmin" class="form-check-label">최고 관리자</label>
                </div>
                <div class="form-check">
                    <input type="checkbox" name="send_email_post_blame_post_writer" id="sendEmailPostBlamePostWriter" class="form-check-input" value="1" @if($boardMetaData->send_email_post_blame_post_writer ?? old('send_email_post_blame_post_writer')) checked @endif />
                    <label for="sendEmailPostBlamePostWriter" class="form-check-label">게시글 작성자</label>
                </div>
            </div>
            <div class="col-sm-2">
                <div class="form-check-inline">
                    <input type="checkbox" name="grp[send_email_post_blame]" id="grpSendEmailPostBlame" class="form-check-input" value="1" />
                    <label for="grpSendEmailPostBlame" class="form-check-label">
                        그룹적용
                    </label>
                </div>
                <div class="form-check-inline">
                    <input type="checkbox" name="all[send_email_post_blame]" id="allSendEmailPostBlame" class="form-check-input" value="1" />
                    <label for="allSendEmailPostBlame" class="form-check-label">
                        전체적용
                    </label>
                </div>
            </div>
        </div>
        <div class="row mb-3">
            <label class="col-sm-2">댓글 신고 발생 시</label>
            <div class="col-sm-8">
                <div class="form-check">
                    <input type="checkbox" name="send_email_comment_blame_super_admin" id="sendEmailCommentBlameSuperAdmin" class="form-check-input" value="1" @if($boardMetaData->send_email_comment_blame_super_admin ?? old('send_email_comment_blame_super_admin')) checked @endif />
                    <label for="sendEmailCommentBlameSuperAdmin" class="form-check-label">최고 관리자</label>
                </div>
                <div class="form-check">
                    <input type="checkbox" name="send_email_comment_blame_post_writer" id="sendEmailCommentBlamePostWriter" class="form-check-input" value="1" @if($boardMetaData->send_email_comment_blame_post_writer ?? old('send_email_comment_blame_post_writer')) checked @endif />
                    <label for="sendEmailCommentBlamePostWriter" class="form-check-label">게시글 작성자</label>
                </div>
                <div class="form-check">
                    <input type="checkbox" name="send_email_comment_blame_comment_writer" id="sendEmailCommentBlameCommentWriter" class="form-check-input" value="1" @if($boardMetaData->send_email_comment_blame_comment_writer ?? old('send_email_comment_blame_comment_writer')) checked @endif />
                    <label for="sendEmailCommentBlameCommentWriter" class="form-check-label">댓글 작성자</label>
                </div>
            </div>
            <div class="col-sm-2">
                <div class="form-check-inline">
                    <input type="checkbox" name="grp[send_email_comment_blame]" id="grpSendEmailCommentBlame" class="form-check-input" value="1" />
                    <label for="grpSendEmailCommentBlame" class="form-check-label">
                        그룹적용
                    </label>
                </div>
                <div class="form-check-inline">
                    <input type="checkbox" name="all[send_email_comment_blame]" id="allSendEmailCommentBlame" class="form-check-input" value="1" />
                    <label for="allSendEmailCommentBlame" class="form-check-label">
                        전체적용
                    </label>
                </div>
            </div>
        </div>
        <div class="row mb-3">
            <label class="col-sm-2">1:1 문의 접수 시</label>
            <div class="col-sm-8">
                <div class="form-check">
                    <input type="checkbox" name="send_email_post_personal_super_admin" id="sendEmailPostPersonalSuperAdmin" class="form-check-input" value="1" @if($boardMetaData->send_email_post_personal_super_admin ?? old('send_email_post_personal_super_admin')) checked @endif />
                    <label for="sendEmailPostPersonalSuperAdmin" class="form-check-label">최고 관리자</label>
                </div>
                <div class="form-check">
                    <input type="checkbox" name="send_email_post_personal_post_writer" id="sendEmailPostPersonalPostWriter" class="form-check-input" value="1" @if($boardMetaData->send_email_post_personal_post_writer ?? old('send_email_post_personal_post_writer')) checked @endif />
                    <label for="sendEmailPostPersonalPostWriter" class="form-check-label">게시글 작성자</label>
                </div>
            </div>
            <div class="col-sm-2">
                <div class="form-check-inline">
                    <input type="checkbox" name="grp[send_email_post_personal]" id="grpSendEmailPostPersonal" class="form-check-input" value="1" />
                    <label for="grpSendEmailPostPersonal" class="form-check-label">
                        그룹적용
                    </label>
                </div>
                <div class="form-check-inline">
                    <input type="checkbox" name="all[send_email_post_personal]" id="allSendEmailPostPersonal" class="form-check-input" value="1" />
                    <label for="allSendEmailPostPersonal" class="form-check-label">
                        전체적용
                    </label>
                </div>
            </div>
        </div>
        <div class="row mb-3">
            <label class="col-sm-2">1:1 문의 답변 시</label>
            <div class="col-sm-8">
                <div class="form-check">
                    <input type="checkbox" name="send_email_post_personal_reply_super_admin" id="sendEmailPostPersonalReplySuperAdmin" class="form-check-input" value="1" @if($boardMetaData->send_email_post_personal_reply_super_admin ?? old('send_email_post_personal_reply_super_admin')) checked @endif />
                    <label for="sendEmailPostPersonalReplySuperAdmin" class="form-check-label">최고 관리자</label>
                </div>
                <div class="form-check">
                    <input type="checkbox" name="send_email_post_personal_reply_post_writer" id="sendEmailPostPersonalReplyPostWriter" class="form-check-input" value="1" @if($boardMetaData->send_email_post_personal_reply_post_writer ?? old('send_email_post_personal_reply_post_writer')) checked @endif />
                    <label for="sendEmailPostPersonalReplyPostWriter" class="form-check-label">게시글 작성자</label>
                </div>
                <div class="form-check">
                    <input type="checkbox" name="send_email_post_personal_reply_comment_writer" id="sendEmailPostPersonalReplyCommentWriter" class="form-check-input" value="1" @if($boardMetaData->send_email_post_personal_reply_comment_writer ?? old('send_email_post_personal_reply_comment_writer')) checked @endif />
                    <label for="sendEmailPostPersonalReplyCommentWriter" class="form-check-label">댓글 작성자</label>
                </div>
            </div>
            <div class="col-sm-2">
                <div class="form-check-inline">
                    <input type="checkbox" name="grp[send_email_post_personal_reply]" id="grpSendEmailPostPersonalReply" class="form-check-input" value="1" />
                    <label for="grpSendEmailPostPersonalReply" class="form-check-label">
                        그룹적용
                    </label>
                </div>
                <div class="form-check-inline">
                    <input type="checkbox" name="all[send_email_post_personal_reply]" id="allSendEmailPostPersonalReply" class="form-check-input" value="1" />
                    <label for="allSendEmailPostPersonalReply" class="form-check-label">
                        전체적용
                    </label>
                </div>
            </div>
        </div>
        <hr/>
        <h4 class="mb-3">텔레그램</h4>
        <div class="row mb-3">
            <label class="col-sm-2">게시글 작성 시</label>
            <div class="col-sm-8">
                <div class="form-check">
                    <input type="checkbox" name="send_telegram_post_super_admin" id="sendTelegramPostSuperAdmin" class="form-check-input" value="1" @if($boardMetaData->send_telegram_post_super_admin ?? old('send_telegram_post_super_admin')) checked @endif />
                    <label for="sendTelegramPostSuperAdmin" class="form-check-label">최고 관리자</label>
                </div>
            </div>
            <div class="col-sm-2">
                <div class="form-check-inline">
                    <input type="checkbox" name="grp[send_telegram_post]" id="grpSendTelegramPost" class="form-check-input" value="1" />
                    <label for="grpSendTelegramPost" class="form-check-label">
                        그룹적용
                    </label>
                </div>
                <div class="form-check-inline">
                    <input type="checkbox" name="all[send_telegram_post]" id="allSendTelegramPost" class="form-check-input" value="1" />
                    <label for="allSendTelegramPost" class="form-check-label">
                        전체적용
                    </label>
                </div>
            </div>
        </div>
        <div class="row mb-3">
            <label class="col-sm-2">댓글 작성 시</label>
            <div class="col-sm-8">
                <div class="form-check">
                    <input type="checkbox" name="send_telegram_comment_super_admin" id="sendTelegramCommentSuperAdmin" class="form-check-input" value="1" @if($boardMetaData->send_telegram_comment_super_admin ?? old('send_telegram_comment_super_admin')) checked @endif />
                    <label for="sendTelegramCommentSuperAdmin" class="form-check-label">최고 관리자</label>
                </div>
            </div>
            <div class="col-sm-2">
                <div class="form-check-inline">
                    <input type="checkbox" name="grp[send_telegram_comment]" id="grpSendTelegramComment" class="form-check-input" value="1" />
                    <label for="grpSendTelegramComment" class="form-check-label">
                        그룹적용
                    </label>
                </div>
                <div class="form-check-inline">
                    <input type="checkbox" name="all[send_telegram_comment]" id="allSendTelegramComment" class="form-check-input" value="1" />
                    <label for="allSendTelegramComment" class="form-check-label">
                        전체적용
                    </label>
                </div>
            </div>
        </div>
        <div class="row mb-3">
            <label class="col-sm-2">게시글 신고 발생 시</label>
            <div class="col-sm-8">
                <div class="form-check">
                    <input type="checkbox" name="send_telegram_blame_super_admin" id="sendTelegramBlameSuperAdmin" class="form-check-input" value="1" @if($boardMetaData->send_telegram_blame_super_admin ?? old('send_telegram_blame_super_admin')) checked @endif />
                    <label for="sendTelegramBlameSuperAdmin" class="form-check-label">최고 관리자</label>
                </div>
            </div>
            <div class="col-sm-2">
                <div class="form-check-inline">
                    <input type="checkbox" name="grp[send_telegram_blame]" id="grpSendTelegramBlame" class="form-check-input" value="1" />
                    <label for="grpSendTelegramBlame" class="form-check-label">
                        그룹적용
                    </label>
                </div>
                <div class="form-check-inline">
                    <input type="checkbox" name="all[send_telegram_blame]" id="allSendTelegramBlame" class="form-check-input" value="1" />
                    <label for="allSendTelegramBlame" class="form-check-label">
                        전체적용
                    </label>
                </div>
            </div>
        </div>
        <div class="row mb-3">
            <label class="col-sm-2">댓글 신고 발생 시</label>
            <div class="col-sm-8">
                <div class="form-check">
                    <input type="checkbox" name="send_telegram_comment_blame_super_admin" id="sendTelegramCommentBlameSuperAdmin" class="form-check-input" value="1" @if($boardMetaData->send_telegram_comment_blame_super_admin ?? old('send_telegram_comment_blame_super_admin')) checked @endif />
                    <label for="sendTelegramCommentBlameSuperAdmin" class="form-check-label">최고 관리자</label>
                </div>
            </div>
            <div class="col-sm-2">
                <div class="form-check-inline">
                    <input type="checkbox" name="grp[send_telegram_comment_blame]" id="grpSendEmailPost" class="form-check-input" value="1" />
                    <label for="grpSendEmailPost" class="form-check-label">
                        그룹적용
                    </label>
                </div>
                <div class="form-check-inline">
                    <input type="checkbox" name="all[send_telegram_comment_blame]" id="allSendEmailPost" class="form-check-input" value="1" />
                    <label for="allSendEmailPost" class="form-check-label">
                        전체적용
                    </label>
                </div>
            </div>
        </div>
        <hr/>
        <div class="text-end">
            <button type="submit" class="btn btn-success">저장하기</button>
            <button type="button" class="btn btn-light btn-write-cancel" value="{{ route('admin.board.board.list.index') }}">취소하기</button>
        </div>
    </form>
</div>

<script type="module">
$("#fAdminWrite").validate({
    rules: {
        /*
         * 이메일
         */
        // 게시글 작성 시
        send_email_post_super_admin: {required: false, number: true},
        send_email_post_post_writer: {required: false, number: true},

        // 댓글 작성 시
        send_email_comment_super_admin: {required: false, number: true},
        send_email_comment_post_writer: {required: false, number: true},
        send_email_comment_comment_writer: {required: false, number: true},

        // 게시글 신고 시
        send_email_post_blame_super_admin: {required: false, number: true},
        send_email_post_blame_post_writer: {required: false, number: true},

        // 댓글 신고 시
        send_email_comment_blame_super_admin: {required: false, number: true},
        send_email_comment_blame_post_writer: {required: false, number: true},
        send_email_comment_blame_comment_writer: {required: false, number: true},

        // 1:1 문의 접수 시
        send_email_post_personal_super_admin: {required: false, number: true},
        send_email_post_personal_post_writer: {required: false, number: true},
        send_email_post_personal_comment_writer: {required: false, number: true},

        // 1:1 문의 답변시 시
        send_email_post_personal_reply_super_admin: {required: false, number: true},
        send_email_post_personal_reply_post_writer: {required: false, number: true},
        send_email_post_personal_reply_comment_writer: {required: false, number: true},

        /*
         * 텔레그램
         */
        send_telegram_post_super_admin: {required: false, number: true},
        send_telegram_comment_super_admin: {required: false, number: true},
        send_telegram_blame_super_admin: {required: false, number: true},
        send_telegram_comment_blame_super_admin: {required: false, number: true},
    }
});
</script>
@endsection
