
<?php
# session
$SES_MEMBER_ID              = $this->session->userdata('C_Member_Id');

?>

<!-- 댓글 신고 -->
<div id="comment_spam_layer" style="display:none;">
	<input type="hidden" name="comment_spam_idx" id="comment_spam_idx">
	<div class="popup_wrap" style="top: 10%;">
		<div class="popupbox trc">
			<div class="popuptop">
				<h3 class="p_title">신고하기 </h3>
				<span class="btn-close"><a href="javascript:commonLayerClose('comment_spam_layer')"><img src="/img/mobile/btn-close.png"></a></span>
			</div>
			<div class="popupbody">
				<dl class="bgb notice pd30 ft16" style="margin:20px 0">
					<dt>신고대상</dt>
					<dd id="comment_write_name_txt"></dd>
					<dt style="padding-top:6px;">내용</dt>
					<dd class="info_forms">
						<div>
							<input type="id" class="form-control"  type="text" name="spam_reason_content" id="spam_reason_content" class="form-control"  placeholder="간략 내용이 들어갑니다.  " style="width:97%;">
						</div>
					</dd>
				</dl>
				<div class="ft18 pd30 beachblue">신고를 원하시는 이유를 선택해 주세요.</div>
				<dl class="bgb notice_list ft16">
					<dt>부적절한 홍보 게시물</dt>
					<dd><input type="radio" name="spam_reason_type" id="spam_reason_type1" value="1" class="current" checked=""></dd>
					<dt>음란성 혹은 청소년에게 유해</dt>
					<dd><input type="radio" name="spam_reason_type" id="spam_reason_type2" value="2"></dd>
					<dt>명예훼손 혹은 저작권 침해</dt>
					<dd><input type="radio" name="spam_reason_type" id="spam_reason_type3" value="3"></dd>
				</dl>
				<div style="margin:30px 0; display:block; text-align:center">
					<button type="button" class="btn btn-default_bb br20" style="padding:10px 40px; font-size:16px; margin:5px 0 " onclick="commonLayerClose('comment_spam_layer')">취소</button>
					<button type="button" class="btn btn-success br20" style="padding:10px 40px; font-size:16px;margin:5px 0" onclick="comment_spam_proc();">확인</button>
				</div>
			</div>
		</div>
	</div>



	<div class="mask"></div>
</div>



<script>
// 댓글 신고
function comment_spam(idx, write_name){
	if("<?=$SES_MEMBER_ID?>"=="") {
        alert("로그인 후에 이용가능합니다.");
        return;
    }

    //$("html, body").scrollTop(0);

	$("#comment_spam_layer").toggle();
	$("#comment_write_name_txt").html(write_name);
	$("#comment_spam_idx").val(idx);
	$("#spam_reason_content").val('');
	$('input:radio[name="spam_reason_type"][value="1"]').prop('checked', true);

}


function comment_spam_proc(){
	var idx = $("#comment_spam_idx").val();
	if(idx == '') {
		alert("신고하기에 실패되었습니다.");
		$("#comment_spam_layer").toggle();
		return false;
	}

	if($("#spam_reason_content").val()== '') {
		alert("신고내용을 입력해주세요.");
		return false;
	}

	var form_data = {
		"comment_idx"			: idx,
		"spam_reason_content"	: $("#spam_reason_content").val(),
		"spam_reason_type"		: $(":input:radio[name=spam_reason_type]:checked").val()

	};
	$.ajax({
        url: '/web/comm/comment_spam_proc',
        async: false,
        type: 'POST',
        dataType: 'JSON',
        data: form_data,
        success: function (rtnJson) {
            if (rtnJson.code == "0000") {
            	alert("신고되었습니다.");
				$("#comment_spam_layer").toggle();
				return false;
            } else {
                alert(rtnJson.msg);
                return false;
            }
        },
        error: function (rtnJson) {
            alert('저장에 실패했습니다.');
            return false;
        }
    });




}




</script>
