<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="ui" uri="http://egovframework.gov/ctl/ui"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ page import="itn.com.cmm.LoginVO" %>

<script type="text/javascript">

var lastfulstday = "";		//전월 시작일
var lastfuledday = "";		//전월 마지막일
var thisfulstlday = "";		//당월 시작일
var thisfuledtlday = "";	//당원 마지막일

$(document).ready(function(){
	
	//초기 전체 리스트 페이지 보여주기
	linkPage($('#searchForm #pageIndex').val());
	
	
	fn_activateTab($('#searchForm #searchCondition01').val())
	fn_setActiveTab($('#searchForm #searchCondition02').val())
	
	
	var date = new Date() ;
	//이전달 첫날/마지막날 조회
	if(date.getMonth()+1 == 1){
		lastfulstday = date.getFullYear()-1 +  "/12" + "/01";
		lastfuledday = date.getFullYear()-1 +  "/12" + "/"+new Date(date.getFullYear()-1, 12, 0).getDate()+"";
	}else{
		lastfulstday = date.getFullYear() + "/" ; 
		lastfulstday += date.getMonth() < 10  ? "0"+ (date.getMonth()) : date.getMonth()+"" ;
		lastfuledday = lastfulstday + "/"+ new Date(date.getFullYear(), date.getMonth(), 0).getDate()+"" ;
		lastfulstday += "/01" ;
	}
	console.log('lastfulstday: ', lastfulstday);
	
	//당월 첫날/마지막날 조회
	thisfulstlday = date.getFullYear() + "/" ;
	thisfulstlday += date.getMonth()+1 < 10  ? "0"+ (date.getMonth()+1) : date.getMonth()+1+"" ;
	thisfuledtlday = thisfulstlday + "/"+ new Date(date.getFullYear(), date.getMonth()+1, 0).getDate()+"";
	thisfulstlday += "/01" ;
	console.log('thisfulstlday: ', thisfulstlday);
	
	//3개월 이전 날짜 구해오기
	
	/* 목록 정렬 항목 아이콘 표시 */ 
	/* var searchSortCnd = $("[name='searchSortCnd']").val();
	var searchSortOrd = $("[name='searchSortOrd']").val();
	
	if (searchSortCnd != "" && searchSortOrd != "" && searchSortCnd  != undefined && searchSortOrd  != undefined) {
		var $sort_div = $("#sort_"+ searchSortCnd);
		var sortClass = 'sortBtn' ;
		
		if (searchSortOrd == "desc") sortClass = "sortBtnDesc";
		
		$sort_div.replaceClass('sortBtn' , sortClass) ;
		$sort_div.attr("sortOrd", searchSortOrd);
	} */

	// 정렬 항목 이벤트
	$(document).on('click', '.sort', function (){
		listSortOrd(this);
	});
	
	
	//  탭 :: 전체 , 즉시, 예약
	$(document).on('click', '.sendKindBtn', function (){

		// 클릭된 버튼의 data-info 값을 전달하여 함수 호출
		fn_activateTab($(this).data('info'));
		
		linkPage(1);
	});
	
	
	

	//목록 정렬 항목 클릭
	function listSortOrd(obj){
		var sortOrd = $(obj).attr("sortOrd");
		var sortCnd = $(obj).attr("id");
		 
		$("[name='searchSortCnd']").val(sortCnd.substring(5)); // 구분자 제거
		if (sortOrd == "desc") $("[name='searchSortOrd']").val("asc");
		else $("[name='searchSortOrd']").val("desc");
		
		linkPage('1');  //각 JSP마다 다를때 메소드 정의해 줘야됨
	}
	
	
	//전체선택 실행
	var allChkSts = false;
	$("#allCheck").click(function(){
		
		if(!allChkSts){// 전체선택이 해제되어 있을 경우
			
			$("input[name=msgSentDel]").prop("checked", true);
			allChkSts = true;
			
		}else{
			
			$("input[name=msgSentDel]").prop("checked", false);
			allChkSts = false;

		}
		
	});
	
	$(document).on('change','#pageUnitS', function(){
		setPageUnit($(this).val()); 
		
		linkPage(1);
		
	});

	subContent();
	
});

function setPageUnit(val){
	$('#pageUnit').val(val); 
}


//탭 활성화 처리 함수
function fn_activateTab(tabInfo) {
	// 1. data-info 값을 가진 버튼 요소 찾기
	var $button = $('.sendKindBtn[data-info="' + tabInfo + '"]');

	// 2. 해당 버튼이 속한 탭 활성화 처리
	$button.closest('ul').find('.tab').removeClass('active');
	$button.closest('.tab').addClass('active');

	// 3. hidden input 요소에 값 설정
	$('#searchCondition01').val(tabInfo);
}


//캘린더에 날짜 입력해 주기
function setCalVal(val,targetObj){
	$('input[name='+targetObj+']').val(val) ;
}


//페이지 이동 실행
function linkPage(pageNo){
	
	var form = document.searchForm;
	form.pageIndex.value = pageNo;
	console.log('form : ', form);

	var sendData =  $(document.searchForm).serializeArray();
	$(".msgSentAllLoad").html('<div class="list_info"><table class="tType4"><tbody><tr><td colspan="12">LOADING...</td></tr></tbody></table></div>');
	$(".msgSentAllLoad").load("/web/mjon/msgsent/selectMsgSentListViewAjax.do", sendData ,function(response, status, xhr){
	});
	
}

//선택 삭제 실행
function fnDelete(){
	
	var msgId = [];
	if($("input:checkbox[name='msgSentDel']").is(":checked")==false){
		alert("한 개 이상의 전송 내역을 선택하세요");
		return;
	}
	
	$("input:checkbox[name='msgSentDel']:checked").each(function(index){
		var disabledChk = $(this).prop('disabled');
		if(!disabledChk){ //checkbox disabled 인 것은 제외하고 아이디 저장
			msgId[index] = $(this).val();
		}
	});
	
	console.log('msgId : ', msgId);
	
	if(msgId.length < 1){
		alert("삭제할 문자를 선택해 주세요.");
		return false;
	}
		
		//22.04.25 구글 독스 alert 기준으로 이지우가 수정
		/* if(confirm("선택한 발송문자를 삭제하시겠습니까? 삭제된 문자는 복구가 불가능 합니다.")) */
		if(confirm("선택한 목록을 삭제하시겠습니까?\n삭제한 목록은 복구가 불가합니다.")){
			
			document.searchForm.msgGroupIdList.value = msgId;
			var sendData =  $(document.searchForm).serializeArray();
			
			$(".msgSentAllLoad").load("/web/mjon/msgsent/deleteMsgSentDataAjax.do", sendData ,function(response, status, xhr){
			});

			alert("삭제되었습니다.");
			var form = document.searchForm;
			form.action="/web/mjon/msgsent/selectMsgSentView.do";
			form.submit();
		}
	
}

// 전체/단문/장문/그림 탭 선택 처리
function fnTabLoad(tabType){
	
	//즉시, 예약 탭은 전체로 바꿔야함
	fn_activateTab('');
	setPageUnit('10');
	
	var form = document.searchForm;

	// 탭 선택 CSS 처리
	fn_setActiveTab(tabType);
	
	linkPage(1);
}

//fnTabLoad 함수에 대한 탭 선택 CSS 처리 함수
function fn_setActiveTab(tabType) {
	var $tabs = $(".list_tab_wrap2 li"); // 전체 탭 리스트
	$tabs.removeClass("active").find("button").removeAttr("title"); // 모든 탭 초기화

	// tabType에 해당하는 탭 찾기
	$tabs.each(function() {
		var buttonText = $(this).find("button").text();
		if ((tabType === '' && buttonText === "전체") ||
			(tabType === 'S' && buttonText === "단문(SMS)") ||
			(tabType === 'L' && buttonText === "장문(LMS)") ||
			(tabType === 'M' && buttonText === "그림(MMS)")) {
			$(this).addClass("active").find("button").attr("title", "선택됨");
		}
	});
	
	$('#searchCondition02').val(tabType);
}


function fnSearch(pageNo){
	/* if(!fn_G_cmndataValueChk("searchStartDate", "searchEndDate", 3)){
		return;
	}; */

	fn_activateTab('')
	fn_setActiveTab('')
	
	console.log('fnSearch')
	var form = document.searchForm;
	form.pageIndex.value = pageNo ;
	
	
	form.action="/web/mjon/msgsent/selectMsgSentView.do";
	form.submit();
	
}


//이전 월 구하기
function prevMonth(month) {
   var d = new Date();
   var monthOfYear = d.getMonth();
   d.setMonth(monthOfYear - month);
   return getDateStr(d);
}

function fnExcelDownLoad(pageType, tabType){
	
	var form = document.searchForm;
	
	// 기간검색 유효성 검사
	
	if(confirm("엑셀 다운로드를 하시겠습니까?")){
		
		form.action="/web/mjon/msgsent/msgSentExcelDownLoadAjax.do";
		form.submit();
	
	}
	
}



function fnDeleteAddrNo(listType){
	
	var msgId = [];
	if($("input:checkbox[name='msgSentDel']").is(":checked")==false){
		alert("한 개 이상의 전송 내역을 선택하세요");
		return;
	}
	
	$("input:checkbox[name='msgSentDel']:checked").each(function(index){
		
		var disabledChk = $(this).prop('disabled');
		if(!disabledChk){ //checkbox disabled 인 것은 제외하고 아이디 저장
			
			msgId[index] = $(this).val();
			
		}
		
	});
	
	if(msgId.length > 0){
		
		//22.04.25 구글 독스 alert 기준으로 이지우가 수정
		/* if(confirm("선택한 수신번호를 주소록에서 삭제하시겠습니까? 삭제된 주소록은 복구가 불가능 합니다.")){ */
		if(confirm("선택하신 번호를 주소록에서 삭제하시겠습니까?")){
			
			var form = document.searchForm;
			
			form.msgGroupIdList.value = msgId;
			form.listType.value = listType;
			
			var data = new FormData(form);
			url = "/web/mjon/msgsent/deleteAddrNoDataAjax.do";
			
			$.ajax({
				type: "POST",
				url: url,
				data: data,
				dataType:'json',
				async: false,
				processData: false,
				contentType: false,
				cache: false,
				success: function (returnData, status) {
					if(status == 'success'){ // status 확인 필요한가. 석세스 안뜨면 에러 가지 않나
						if("fail"==returnData.result){
							
							alert(returnData.message);
							return false;
							
						}else if("loginFail"==returnData.result){
							
							alert(returnData.message);
							return false;
							
						}else if(returnData.resultCnt == '0'){
							
							alert("주소록에 삭제할 연락처가 없습니다.");
							return false;
							
						}else{
							
							alert(returnData.message);
							return false;
							
						}
					
					} else if(status== 'fail'){
						alert(returnData.message);
					}
				},
				error: function (e) { alert("주소록 삭제에 실패하였습니다."); console.log("ERROR : ", e); }
			});
			
		}
		
	}else{
		
		alert("삭제할 문자를 선택해 주세요.");
		return false;
		
	}
	
}

function fnAddBlockNo(listType){
	
	var msgId = [];
	if($("input:checkbox[name='msgSentDel']").is(":checked")==false){
		alert("선택된 항목이 없습니다.");
		return;
	}
	
	$("input:checkbox[name='msgSentDel']:checked").each(function(index){
		
		var disabledChk = $(this).prop('disabled');
		if(!disabledChk){ //checkbox disabled 인 것은 제외하고 아이디 저장
			
			msgId[index] = $(this).val();
			
		}
		
	});
	
	if(msgId.length > 0){
		
		//if(confirm("선택한 수신번호를 주소록에서 삭제하시겠습니까? 삭제된 주소록은 복구가 불가능 합니다.")){
			
			var form = document.searchForm;
			
			form.msgGroupIdList.value = msgId;
			form.listType.value = listType;
			
			var data = new FormData(form);
			url = "/web/mjon/msgsent/insertAddBlockNoDataAjax.do";
			
			$.ajax({
				type: "POST",
				url: url,
				data: data,
				dataType:'json',
				async: false,
				processData: false,
				contentType: false,
				cache: false,
				success: function (returnData, status) {
					if(status == 'success'){ // status 확인 필요한가. 석세스 안뜨면 에러 가지 않나
						if("fail"==returnData.result){
							
							alert(returnData.message);
							return false;
							
						}else if("loginFail"==returnData.result){
							
							alert(returnData.message);
							return false;
							
						}else if(returnData.resultCnt == '0'){
							
							alert("주소록에 삭제할 연락처가 없습니다.");
							return false;
							
						}else{
							
							alert(returnData.message);
							return false;
							
						}
					
					} else if(status== 'fail'){
						alert(returnData.message);
					}
				},
				error: function (e) { alert("수신거부번호 등록에 실패하였습니다."); console.log("ERROR : ", e); }
			});
			
		//}
		
	}else{
		
		alert("수신거부번호를 등록할 문자를 선택해 주세요.");
		return false;
		
	}
	
	
}

function fnReSendMsg(){
	
	var msgSeq = [];
	if($("input:checkbox[name='msgSentDel']").is(":checked")==false){
		alert("선택된 항목이 없습니다.");
		return;
	}
	
	$("input:checkbox[name='msgSentDel']:checked").each(function(index){
		
		var disabledChk = $(this).prop('disabled');
		if(!disabledChk){ //checkbox disabled 인 것은 제외하고 아이디 저장
			
			msgSeq[index] = $(this).val();
		}
		
	});
	
	var form = document.reSendForm;
	form.msgSeqList.value = msgSeq;
	form.msgResendFlag.value = "Y";
	
	form.action="/web/mjon/msgdata/selectMsgDataView.do";
	form.submit();
	
}

function fnMsgSFDetailList(msgGroupId, resultType){
	
	var form = document.resPopForm;
	form.msgGroupId.value = msgGroupId;
	form.resultType.value = resultType;
	
	//만들려는 팝업의 크기
	var popup_wid = '1280';
	var popup_ht = '700';

	var popup_left = (window.screen.width / 2) - (popup_wid / 2);
	var popup_top =(window.screen.height / 2) - (popup_ht / 2);

	$("#resPopForm").attr("target","msgSFDetailPop");
	
	window.open('', 'msgSFDetailPop', 'width='+ popup_wid +', height='+ popup_ht +', left=' + popup_left + ', top='+ popup_top );
	$("#resPopForm").attr({"action":"/web/mjon/msgsent/selectMsgSFDetailListAjax.do", "method":"post"}).submit();
	
}


/* 사용내역서 클릭 시 내역서 새창 팝업 오픈  
function fnShowPrintPopup(tabType, type) { 
	//만들려는 팝업의 크기
	var popup_wid = '840';
	var popup_ht = '900';

	var popup_left = (window.screen.width / 2) - (popup_wid / 2);
	var popup_top =(window.screen.height / 2) - (popup_ht / 2);

	$("#tabType").val(tabType);
	$("#searchForm").attr("target","msgSentPrint");
	
	window.open('', 'msgSentPrint', 'width='+ popup_wid +', height='+ popup_ht +', left=' + popup_left + ', top='+ popup_top +',scrollbars=1');
	$("#searchForm").attr({"action":"/web/mjon/msgsent/printMsgSentDataAjax.do", "method":"post"}).submit();
	
}
*/
function addrGroupDuplCnt() {
	document.searchForm.addrGrpNm.value = $('#grpNm').val();
	
	var data = $('#searchForm').serialize();
	//var data = new FormData(form);
	
	var flag = true;
	var url = "/web/addr/selectDuplAddrGroupNameAjax.do";
	
	$.ajax({
		async: false,
		type: "post",
		url: url,
		data: data,
		dataType:"JSON",
//          contentType: false,
//      	 processData: false,
		cache: false,
		success: function (returnData, status) {
			if("dupl"==returnData.result1) {
				flag = false;
			}
		},
		error: function (e) {
			alert("error");
			console.log("ERROR : ", e); 
		}
	});
	
	return flag;
}

//주소록 그룹 등록 기능
function fnAddAddrNo(){
	
	var addrGrpNm = $('#grpNm').val(); //입력 그룹 이름 불러오기
	
	var msgId = [];
	if($("input:checkbox[name='msgSentDel']").is(":checked")==false){
		alert("한 개 이상의 전송 내역을 선택하세요");
		return;
	}
	
	
	$("input:checkbox[name='msgSentDel']:checked").each(function(index){
		
		var disabledChk = $(this).prop('disabled');
		if(!disabledChk){ //checkbox disabled 인 것은 제외하고 아이디 저장
			
			msgId[index] = $(this).val();
			
		}
		
	});
	
	if(msgId.length > 0 && addrGrpNm != ''){
		

		//주소록 그룹명 중복체크
		if(!addrGroupDuplCnt()) {
			alert("이미 등록되어있는 주소록입니다.");
			return false;
		}
		
		
			var form = document.searchForm;
			
			form.msgGroupIdList.value = msgId;
			form.addrGrpNm.value = addrGrpNm;
			
			var data = new FormData(form);
			url = "/web/mjon/msgsent/insertAddAddrGrpDataAjax.do";
			
			$.ajax({
				type: "POST",
				url: url,
				data: data,
				dataType:'json',
				async: false,
				processData: false,
				contentType: false,
				cache: false,
				success: function (returnData, status) {
					if(status == 'success'){ // status 확인 필요한가. 석세스 안뜨면 에러 가지 않나
						if("fail"==returnData.result){
							
							alert(returnData.message);
							return false;
							
						}else if("loginFail"==returnData.result){
							
							alert(returnData.message);
							return false;
							
						}else if(returnData.resultCnt == '0'){
							
							alert("주소록에 등록할 연락처가 없습니다.");
							return false;
							
						}else{
							
							alert(returnData.message);
							$('#grpNm').val(""); //입력한 그룹명 초기화
							$(".tooltip-close").trigger("click");
							return false;
							
						}
					
					} else if(status== 'fail'){
						alert(returnData.message);
					}
				},
				error: function (e) { alert("주소록 등록에 실패하였습니다."); console.log("ERROR : ", e); }
			});
	}else{
		
		alert("등록할 문자를 선택해 주세요.");
		return false;
		
	}
	
}

/* 윈도우팝업 열기 */
function infoPop(pageUrl){
	document.popForm.pageType.value = pageUrl;
	document.popForm.action = "/web/pop/infoPop.do";
	document.popForm.method = "post"; 
	window.open("about:blank", 'infoPop', 'width=790, height=320, top=100, left=100, fullscreen=no, menubar=no, status=no, toolbar=no, titlebar=yes, location=no, scrollbars=1');
	document.popForm.target = "infoPop";
	document.popForm.submit();
}

//문자 재전송
function fnMjMsgReSendAll(msgGroupId, replaceCnt, electionCnt, advertisementCnt) {
	var form = document.reSendAllForm;
	form.msgResendAllFlag.value = "Y";
	form.msgResendAllGroupId.value = msgGroupId;

	if (replaceCnt > 0) {
		if (confirm("특정문구 일괄변환 문자(치환문자)의 경우 문자내용은 재전송할 수 없고 받는 사람 목록만 불러올 수 있습니다.\n받는사람 목록을 불러올까요?")) {
			// 광고문자
			form.msgResendAllReplaceYn.value = "Y";
			if (electionCnt > 0) {
				form.action="/web/mjon/msgcampain/selectMsgDataView.do";
			}
			else {
				if (advertisementCnt > 0) {
					// 광고문자
					form.msgResendAllAdvertiseYn.value = "Y";
					form.action="/web/mjon/msgdata/excel/selectMsgExcelDataView.do";
				}
				else
				{
					form.action="/web/mjon/msgdata/selectMsgDataView.do";
				}
			}
			form.submit();					
		}
	}
	else {
		var title = "";
		if (electionCnt > 0) {
			title = "선거문자발송";
		}
		else {
			title = "문자발송";
		}
		
	    if (confirm(title + " 화면으로 이동합니다.\n문자내용, 받는 사람 목록 확인후 발송해주세요.")) {
			if (electionCnt > 0) {
				form.action="/web/mjon/msgcampain/selectMsgDataView.do";
			}
			else {
				if (advertisementCnt > 0) {
					// 광고문자
					form.msgResendAllAdvertiseYn.value = "Y";
					form.action="/web/mjon/msgdata/excel/selectMsgExcelDataView.do";
				}
				else
				{
					form.action="/web/mjon/msgdata/selectMsgDataView.do";
				}
			}
			form.submit();		
	    }
	}
}

//발송결과 - 대기/성공/실패
function subContent(){	
	
	var sendData =  $(document.searchForm).serializeArray();
	console.log('sendData :: ', sendData);
	var v_html_pre	=	'<table>'
			+	'<caption>구분, 충전금액, 사용금액, 잔액 등 정보를 제공하는 표</caption>'
			+	'<colgroup>'
			+	'<col style="width: 115px;">'
			+	'<col style="width: calc((100% - 115px)/3);">'
			+	'<col style="width: calc((100% - 115px)/3);">'
			+	'<col style="width: calc((100% - 115px)/3);">'
			+	'</colgroup>'
			+	'<thead>'
			+	'<tr>'
			+	'<th scope="col">구분</th>'
			+	'<th scope="col">충전금액</th>'
			+	'<th scope="col">사용금액</th>'
			+	'<th scope="col">잔액</th>'
			+	'</tr>'
			+	'</thead>'
			+	'<tbody>'
			+	'<tr><td colspan="4">LOADING...</td></tr>'
			+	'</tbody>'
			+	'</table>';

	var v_html_pre	=	''
		+	'<div class="rev_admin_in">'
		+	'<div class="rev_admin_top clearfix">'
		+	'<p>전체</p>'
		+	'<p></p>'
		+	'</div>'
		+	'<div class="rev_admin_btm admin_btm">'
		+	'<table class="tType4"><tbody><tr><td>LOADING...</td></tr></tbody></table>'
		+	'</div>'
		+	'</div>'

		+	'<div class="rev_admin_in">'
		+	'<div class="rev_admin_top clearfix">'
		+	'<p>단문(SMS)</p>'
		+	'<p></p>'
		+	'</div>'
		+	'<div class="rev_admin_btm admin_btm">'
		+	'<table class="tType4"><tbody><tr><td>LOADING...</td></tr></tbody></table>'
		+	'</div>'
		+	'</div>'

		+	'<div class="rev_admin_in">'
		+	'<div class="rev_admin_top clearfix">'
		+	'<p>장문(LMS)</p>'
		+	'<p></p>'
		+	'</div>'
		+	'<div class="rev_admin_btm admin_btm">'
		+	'<table class="tType4"><tbody><tr><td>LOADING...</td></tr></tbody></table>'
		+	'</div>'
		+	'</div>'

		+	'<div class="rev_admin_in">'
		+	'<div class="rev_admin_top clearfix">'
		+	'<p>그림(MMS)</p>'
		+	'<p></p>'
		+	'</div>'
		+	'<div class="rev_admin_btm admin_btm">'
		+	'<table class="tType4"><tbody><tr><td>LOADING...</td></tr></tbody></table>'
		+	'</div>'
		+	'</div>'
		;

						
	//$("#prePaymentYn_Y").html('<div class="list_info"><table class="tType4"><tbody><tr><td colspan="12">LOADING...</td></tr></tbody></table></div>');
	$("#revAdmin").html(v_html_pre);

		
	
	$("#revAdmin").load("/web/msgsent/subcontent/MsgSentView_HA_allSentAjax.do", sendData ,function(response, status, xhr){
	});
	
}

</script>
	<!-- 문자내용 팝업 data-tooltip: rev_popup01 -->
	<div class="tooltip-wrap">
		<div class="popup-com adr_layer rev_popup01" tabindex="0" data-tooltip-con="rev_popup01" data-focus="rev_popup01" data-focus-prev="rev_popup01-close" style="width: 440px;">
			<div class="popup_heading">
				<p>문자내용</p>
				<button type="button" class="tooltip-close" data-focus="rev_popup01-close"><img src="/publish/images/content/layerPopup_close.png" alt="팝업 닫기"></button>
			</div>
			<div class="layer_in" id="msgSentDetailPopLoad" style="padding-bottom: 0px;">
			</div>
			<div class="popup_btn_wrap2" style="justify-content: center; margin-bottom: 30px;">
				<button type="button" class="tooltip-close" data-focus="rev_popup01-close" data-focus-next="rev_popup01">닫기</button>                      
			</div>			
		</div>
	</div><!--// 문자내용 팝업 -->
	<!-- 그룹등록 팝업 data-tooltip:rev_popup02 -->
	<div class="tooltip-wrap">
		<div class="popup-com adr_layer rev_popup02" tabindex="0" data-tooltip-con="rev_popup02" data-focus="rev_popup02" data-focus-prev="rev_popup02-close" style="width: 500px;">
			<div class="popup_heading">
				<p>그룹등록</p>
				<button type="button" class="tooltip-close" data-focus="rev_popup02-close"><img src="/publish/images/content/layerPopup_close.png" alt="팝업 닫기"></button>
			</div>
			<div class="layer_in">
				<div class="gorup_join_cont">
					<p class="adr_pop_title">선택된 발송내역 전화번호를 그룹으로 등록합니다.</p>
					<div class="group_input" style="margin-top: 0;">
						<div class="input_left">그룹이름</div>
						<div class="input_right">
							<label for="grpNm" class="label">새 그룹명 입력</label>
							<input type="text" id="grpNm" name="grpNm" placeholder="새 그룹명 입력" onfocus="this.placeholder=''" onblur="this.placeholder='새 그룹명 입력'" class="inputLight">
						</div>
					</div>
					<div class="popup_btn_wrap2">
						<button type="button" onclick="javascript:fnAddAddrNo(); return false;">저장</button>
						<button type="button" class="tooltip-close" data-focus="rev_popup02-close" data-focus-next="rev_popup02">취소</button>                      
					</div>
				</div>
			</div>
		</div>
	</div>
	<div class="inner">
		<!-- send top -->
		<div class="send_top">
		<!-- 결제관리 - 요금 사용내역 -->
			<div class="rev_admin_cont serv_content current">
				<div class="heading">
					<h2>발송결과</h2>
					<button type="button" class="button info" onclick="infoPop('selectMsgSentView');">사용안내</button>
					<button type="button" class="button junk" data-tooltip="popupJunk">통신사 스팸규격안내</button>
				</div>
					<!-- tab button -->
				<div class="pay_tab_wrap">
					<%@include file="/WEB-INF/jsp/web/kakao/include/KakaoSentTopMentTap.jsp" %>
				</div>
					<!--// tab button -->
				<%--<div class="titBox type1">
					<p>- 보낸결과는 이동통신사의 결과값을 기반으로 표시되며, 최대 6개월간의 발송내역만 확인하실 수 있습니다.</p>
					<p>- 전송내역이 필요한 경우 기간(6개월) 내에 다운로드하여 주시기 바랍니다.</p>
					<p>- 보낸결과는 이동통신사 및 수신자 등의 사정으로 발송이 지연된 경우 결과가 다소 늦게 확인될 수 있습니다.</p>
					<p>- 받는사람 기준으로 전송건별(묶음), 개인별(건) 상세조회가 가능합니다.</p>
					<p>- 단문문자는 최대 24시간, 장문 및 그림문자는 최대 72시간까지 결과값이 수신되지 않은 경우 실패(비과금) 처리됩니다.</p>
					<p>- 정상 수신인데도 불구하고 문자를 받지 못한 경우에는 “이통사별스팸차단서비스(버튼)” 안내를 확인하시기 바랍니다.</p>
					<p>- 발송건 전체가 오류 처리되는 경우 번호도용 차단서비스에 가입되어 있을 수 있습니다. “번호도용 차단서비스(버튼)” 안내를 참고하시기 바랍니다.</p>
					<p>- 보낸결과는 삭제 시 복구가 불가하오니 반드시 유의하시기 바랍니다.</p>
					<div class="btnWrap type1">
						<button type="button" data-tooltip="popupJunk" class="tab1">정상수신인데 못받은 경우<span>(통신사별 스팸차단서비스)</span></button>
						<button type="button" data-tooltip="popupJunk" class="tab2">발송내용이 전체오류가 나는 경우<span>(통신사별 스팸차단서비스)</span></button>
					</div>
				</div>--%>
				<form id="searchForm" name="searchForm" method="post">
<!-- 					<input type="hidden" id="pageIndex" name="pageIndex" value="1"/> -->
					<input type="hidden" id="pageIndex" name="pageIndex" value="<c:out value="${searchVO.pageIndex}" />" />
					<input type="hidden" id="pageUnit" name="pageUnit" value="<c:out value="${searchVO.pageUnit}" />" />
					<input type="hidden" id="msgGroupIdList" name="msgGroupIdList" value=""/>
					<input type="hidden" id="msgGroupId" name="msgGroupId" value=""/>
					<input type="hidden" name="searchSortCnd" value="<c:out value="${searchVO.searchSortCnd}" />" />
					<input type="hidden" name="searchSortOrd" value="<c:out value="${searchVO.searchSortOrd}" />" />
					<input type="hidden" id="tabType" name="tabType" value="all"/><!-- 탭 종류 -->
					<input type="hidden" id="stateType" name="stateType" value="all"/><!-- 발송상태 종류 -->
					<input type="hidden" id="listType" name="listType" value="groupList"/><!-- 리스트 종류 -->
					<input type="hidden" id="addrGrpNm" name="addrGrpNm" value=""/><!-- 주소록 그룹 이름 -->
					<input type="hidden" id="mberId" name="mberId" value="${LoginVO.id}"/>
					<input type="hidden" id="searchCondition01" name="searchCondition01" value="${searchVO.searchCondition01}"/>
					<input type="hidden" id="searchCondition02" name="searchCondition02" value="${searchVO.searchCondition02}"/>
				
				
					<div class="rev_content" id="tab5_1">
					
						<!-- 발송결과 개선 : 문구추가 -->
						<div class="titBox_result">
							<p>- 최대 3개월간의 발송내역만 확인하실 수 있습니다.</p>
							<p>- 전송내역이 필요한 경우 기간 내에 다운로드하여 주시기 바랍니다.</p>
							<p>- 단문문자는 최대 24시간, 장문 및 그림문자는 최대 72시간까지 결과값이 수신되지 않은 경우 실패(비과금) 처리됩니다.</p>
						</div>
						<!--// 발송결과 개선 : 문구추가 -->
						
						<div class="excel_middle">
							<div class="select_btnWrap clearfix">
								<div class="btn_left">
									<span class="cal_label">기간선택</span>
									<div class="calendar_wrap">
										<input type="text" class="searchStartDate inp calendar" title="검색 시작일" id="searchStartDate" name="searchStartDate" value="<c:out value='${mjonMsgSentVO.searchStartDate}'/>" data-datecontrol="true">
										<span class="dateEtc">~</span>
										<input type="text" class="searchEndDate inp calendar" title="검색 종료일" id="searchEndDate" name="searchEndDate" value="<c:out value='${mjonMsgSentVO.searchEndDate}'/>" data-datecontrol="true">
									</div>
									<button type="button" onclick="setCalVal(lastfulstday,'searchStartDate');setCalVal( lastfuledday,'searchEndDate'); return false;"  class="btnType btnType19">전월</button>
									<button type="button" onclick="setCalVal(thisfulstlday,'searchStartDate');setCalVal( thisfuledtlday,'searchEndDate'); return false;"  class="btnType btnType19">당월</button>
									<button type="button" onclick="fn_G_getPrevMonth('searchStartDate', 3);fn_G_getCurrDate('searchEndDate'); return false;"  class="btnType btnType19">3개월</button>
									<button type="button" class="btnType6" onClick="javascript:fnSearch(1); return false;">조회</button>
								</div>
								<div class="btn_right">
									<label for="searchCondition" class="label">검색 조건: ${mjonMsgSentVO.searchCondition == '2' ? '발신번호' : mjonMsgSentVO.searchCondition == '3' ? '문자내용' : '수신번호'}</label>
									<select name="searchCondition" id="searchCondition" class="selType2 select_btn">
										<option value="2" <c:if test="${mjonMsgSentVO.searchCondition == '2'}">selected</c:if> >발신번호</option>
										<option value="3" <c:if test="${mjonMsgSentVO.searchCondition == '3'}">selected</c:if> >문자내용</option>
										<option value="4" <c:if test="${mjonMsgSentVO.searchCondition == '4'}">selected</c:if> >수신번호</option>
									</select>
									<div class="search">
										<label for="id" class="label"></label>
										<input type="text" id="searchKeyword" name="searchKeyword" value="<c:out value='${searchKeyword}'/>" placeholder="검색어를 입력하세요." onfocus="this.placeholder=''" onblur="this.placeholder='검색어를 입력하세요.'">
										<button type="button" class="btnType btnType2" onClick="javascript:fnSearch(1); return false;">검색</button>
									</div>
								</div>
							</div>
						</div>
						<!-- 페이지 로딩 속도를 위해서 ajax 로딩처리 -->
						<div class="rev_admin" id ="revAdmin">
						</div>
						<div class="list_tab_wrap2 type4">
							<!-- tab button -->
							<ul class="list_tab">
								<li class="tab active"><button type="button" onclick="fnTabLoad(''); return false;">전체</button></li>
								<li class="tab"><button type="button" onclick="fnTabLoad('S'); return false;">단문(SMS)</button></li>
								<li class="tab"><button type="button" onclick="fnTabLoad('L'); return false;">장문(LMS)</button></li>
								<li class="tab"><button type="button" onclick="fnTabLoad('M'); return false;">그림(MMS)</button></li>
							</ul><!--// tab button -->
						</div>
						<!-- 예약관리 > 전체 -->
						<div class="price_history_cont current price_wrap" id="listTab_2">
							<!-- tab button -->
							<div class="table_tab_wrap">
								<!--<ul>
									<li class="tab active">
									<button type="button" onclick="fnListLoad('all','0'); return false;">전체</button></li> 
									<li class="tab"><button type="button" onclick="fnListLoad('ready','1'); return false;">결과대기</button></li>
									<li class="tab"><button type="button" onclick="fnListLoad('complete','2'); return false;">정상수신</button></li>
									<li class="tab"><button type="button" onclick="fnListLoad('fail','3'); return false;">수신오류</button></li>
								</ul>// tab button -->
								
								
								<!-- tab button -->
								<ul>
										<li class="tab ${empty searchVO.searchCondition_01 ? 'active' : ''}">
											<button type="button" class="sendKindBtn" data-info="">전체</button>
										</li>
										<li class="tab ${searchVO.searchCondition_01 == '0' ? 'active' : ''}">
											<button type="button" class="sendKindBtn" data-info="N">즉시</button>
										</li>
										<li class="tab ${searchVO.searchCondition_01 == '1' ? 'active' : ''}">
											<button type="button" class="sendKindBtn" data-info="Y">예약</button>
										</li>
								</ul>
								<!--// tab button -->
								
								
								<!-- <div class="tab_depth1">
									<a href="#none" class="on msgGgoupList">받는사람(전송건별)</a>
									<a href="#none" style="display: none;"></a>
									<a href="#none" class="msgPrivateList">받는사람(개인별)</a>
									<div class="on_active">받는사람(전송건별)</div>
								</div> -->
								
								<!-- 발송화면 개선 : 발송결과 추가-->
								<div class="tab_btnbox">
									<button type="button" class="btnType btnType14 check_validity">발송결과<i class="qmMark"></i></button>
									<div class="info_hover_cont send_hover_cont price_hover">
										<dl>
											<dt class="c_222">[<span>대기</span>]</dt>
											<dd>
												발송은 성공하였으며, 수신자측 통신사로부터 수신여부를 확인중인 상태 <br>
												<span>※ 예약문자의 경우 실발송 전까지는 “대기”로 표시</span>
											</dd>
											<dt class="c_002c9a">[<span>성공</span>]</dt>
											<dd>발송 및 수신이 완료된 상태</dd>
											<dt class="c_e40000">[<span>실패</span>]</dt>
											<dd class="last">결번, 일시정지, 전화번호 오류 등의 사유로 발송이
												불가한 상태</dd>
										</dl>
									</div>
								</div>
								<!--// 발송화면 개선 : 발송결과 추가-->
							</div>
							<!-- 발송관리 리스트 -->
							<div class="table_cont current msgSentAllLoad" id="tableCont_1">
							</div><!-- //전체 종료 -->
							<!-- table -->
						</div>
					</div>
				</form>
			</div>
		</div><!--// send top -->
	</div>
	<form id="resPopForm" name="resPopForm" method="post">
		<input type="hidden" id="msgGroupId" name="msgGroupId" value=""/>
		<input type="hidden" id="msgId" name="msgId" value=""/>
		<input type="hidden" id="fileCnt" name="fileCnt" value=""/>
		<input type="hidden" id="resultType" name="resultType" value="S"/>
	</form>
	<form id="reSendForm" name="reSendForm" method="post">
		<input type="hidden" id="msgSeqList" name="msgSeqList" value=""/>
		<input type="hidden" id="msgResendFlag" name="msgResendFlag" value="N"/>
	</form>
	<form name="popForm" id="popForm" method="post">
		<input type="hidden" name="pageType" id="pageType" value=""/> 
	</form>
	<form name="reSendAllForm" method="post">
		<input type="hidden" name="msgResendAllFlag" value="N"/>
		<input type="hidden" name="msgResendAllGroupId" value=""/>
		<input type="hidden" name="msgResendAllAdvertiseYn" value="N"/>		
		<input type="hidden" name="msgResendAllReplaceYn" value="N"/>
	</form>	