<%--
  Class Name : PerList.jsp
  Description : 정기점검 목록 페이지
  Modification Information
    Copyright (C) 2009 by MOPAS  All right reserved.
--%>
<%@ page contentType="text/html; charset=utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="ui" uri="http://egovframework.gov/ctl/ui"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%   
	response.setHeader("Cache-Control","no-store");   
	response.setHeader("Pragma","no-cache");   
	response.setDateHeader("Expires",0);   
	if (request.getProtocol().equals("HTTP/1.1")) response.setHeader("Cache-Control", "no-cache"); 
%> 
<!DOCTYPE html>
<html lang="ko">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>정기점검</title>
<link rel="stylesheet" href="/direct/css/font.css">
<link rel="stylesheet" href="/direct/css/reset.css">
<link rel="stylesheet" href="/direct/css/enroll_popup.css">
<link rel="stylesheet" href="/direct/css/nice-select.css">
<!--[if IE]>
<link rel="stylesheet" type="text/css" href="/direct/css/ie_popup.css" />
<![endif]-->
<script src="/direct/js/jquery-1.11.3.min.js"></script>
<script src="/direct/js/jquery-ui.min.js"></script>
<script src="/direct/js/jquery.nice-select.js"></script>
<script src="/direct/js/script.js"></script>
<script src="/direct/js/popup_open_2.js"></script>
<script type="text/javascript" src="<c:url value='/js/EgovCalPopup.js' />"></script>
<script type="text/javascript" src="/js/audit/audit.common.js"></script>  
<script>
var close_del = false; //화면 close시 사용변수
var close_reload = false;
<c:if test="${perispVO.pageType eq 'New'}">
	close_del = true;
</c:if>
$(window).bind("beforeunload", function (e){
	if(close_del){
		close_reload =true;
		$("#auth_delete_btn").trigger("click");
	}
});

var periQuCdCn = "<c:out value='${perispVO.periQuCdCn}' escapeXml='true' />"; 
var periMeCdCn = "<c:out value='${perispVO.periMeCdCn}' escapeXml='true' />";
 
var logCmd = ""; //로그 구분
$(document).ready(function() {
	set_count(); //총괄표 카운터 세팅
	setNumberOnly(); //숫자만 입력
	
	if($('input[name="periQuCd"]:checked').val() != '09'){
		$('#periQuCdCn').attr("readonly",true); 
	}
	if($('input[name="periMeCd"]:checked').val() != '09'){
		$('#periMeCdCn').attr("readonly",true); 
	}
	
	$("input:radio[name=periQuCd]").click(function(){  //라디오 이벤트
        if($(this).val() == '09'){
        	$('#periQuCdCn').val(periQuCdCn);
        	$("#periQuCdCn").removeAttr("readonly"); 
        }else{
        	$('#periQuCdCn').val('');
        	$('#periQuCdCn').attr("readonly",true); 
        } 
    });
	$("input:radio[name=periMeCd]").click(function(){  //라디오 이벤트
		if($(this).val() == '09'){
			$('#periMeCdCn').val(periMeCdCn);
			$("#periMeCdCn").removeAttr("readonly"); 
        }else{
        	$('#periMeCdCn').val('');
        	$("#periMeCdCn").attr("readonly",true);
        }
    });
		
    //체크박스 초기 세팅
    <c:if test="${empty perispVO.periQuCd}">
    	$(".periQuCd:radio[value='01']").attr("checked", true) ;
    </c:if>
    <c:if test="${empty perispVO.periMeCd}">
    	$(".periMeCd:radio[value='01']").attr("checked", true) ;
    </c:if>
  	$('select').niceSelect();
  	//$('.td_periItemCd').css("width", "auto");
  	
    /* 임시저장 버튼 클릭시 */
	$("#audit_btn_imsi").click(function (event){ 
		var frm = document.writeForm;
		if(frm.periSj.value ==""){
	    	alert("점검명은 필수 값입니다.");
			return;
		}
		if(!validate_peri('Y')){ return;}
		frm.imsi.value = 'Y' ;
		$("#audit_update_btn").trigger("click") ;	
	});
	
	/* 저장,수정 버튼 클릭시 */
	$("#audit_save_btn").click(function (event){
		var frm = document.writeForm;
		if(frm.periSj.value ==""){
	    	alert("평가명은 필수 값입니다.");
			return;
		}
		if(!validate_peri('Y')){ return;}
		frm.imsi.value = 'N' ;
		$("#audit_update_btn").trigger("click") ;	
	});
	
    /* 화면에는 숨겨져 있으나 실제 임시저장, 저장, 수정 모두 처리된다. 로그저장위해 */
	if($('#pageType').val() == "New"){
		logCmd = "I" ;
	}else if($('#pageType').val() == "Modify"){
		logCmd = "U" ;
	}
	$("#audit_update_btn").click(function (event){
	    var frm = document.writeForm;
	    var data = new FormData(frm);
	    $.ajax({
	        type: "POST",
	        enctype: 'multipart/form-data',
	        url: "/uss/itsm/per/PerMngUpdateAjax.do?logCmd="+logCmd,
	        data: data,
	        dataType:'jsonp',
	        processData: false,
	        contentType: false,
	        cache: false,
	        timeout: 600000,
	        success: function (returnData, status) {
	            if(status == 'success'){
	            	if(returnData.result == 'fail'){
	            		alert("저장에 실패하였습니다.");
	            	}else if(returnData.result == 'auth_fail'){
	            		alert("세션이 종료되었습니다.");
	            		if(opener !=null){
	            			opener.location.reload();	
	            		}
	            		close_del = false;
	            		window.self.close() ;
	            	}else if(returnData.result =='success'){
	            		if(opener !=null){
	            			opener.location.reload();	
	            		}
	            		if($('#imsi').val()=='Y'){
	            			alert("임시 저장되었습니다.");
	            		}else{
	            			alert("저장되었습니다.");
	            			close_del = false;
	            			window.self.close() ;
	            		}
	            	}
	            }else{
	            	alert("저장에 실패하였습니다.");
	            }
	        },
	        error: function (e) {
	            console.log("ERROR : ", e);
	            alert("저장에 실패하였습니다.");
	        }
	    });
	});
    
	/*삭제,취소 버튼 클릭시*/
	$("#auth_delete_btn").click(function (event){
		var frm = document.writeForm;
		var data = new FormData(frm);
	    $.ajax({
	        type: "POST",
	        enctype: 'multipart/form-data',
	        url: "/uss/itsm/itsm/PerViewDeleteAjax.do",
	        data: data,
	        dataType:'jsonp',
	        processData: false,
	        contentType: false,
	        cache: false,
	        timeout: 600000,
	        success: function (returnData, status) {
	            if(status == 'success'){
	            	if(returnData.result == 'fail'){
	            		alert("삭제에 실패하였습니다.");
	            	}else if(returnData.result == 'auth_fail'){
	            		alert("세션이 종료되었습니다.");
	            		close_del = false;
	            		window.self.close() ;
	            	}else if(returnData.result =='success'){
            			close_del = false;
            			if(close_reload){
            			}else{
            				alert("삭제되었습니다.");
            				if(opener !=null){
    	            			opener.location.reload();	
    	            		}
            				window.self.close() ;
            			}
	            	}
	            }else{
	            	alert("저장에 실패하였습니다.");
	            }
	        },
	        error: function (e) {
	            console.log("ERROR : ", e);
	            alert("저장에 실패하였습니다.");
	        }
	    });
	});
});


/* 점검 validate */
function validate_peri(neceFlag){
	if($('.tr_item').length == 0){
		alert("점검내용은 최소한 한개 이상이어야 합니다. 행추가를 클릭해 주세요.");
		return;
	}
	
	var ntceBgndeYYYMMDD = document.getElementById('ntceBgndeYYYMMDD').value;
	var ntceEnddeYYYMMDD = document.getElementById('ntceEnddeYYYMMDD').value;
	
	var frm = document.writeForm;
	if(neceFlag == 'Y'){
		if( ntceBgndeYYYMMDD==""){
			alert("점검시작 일시는 필수 값입니다.");
			return false;
		}
		
		if( ntceEnddeYYYMMDD==""){
			alert("점검종료 일시는 필수 값입니다.");
			return false;
		}
		
		if(document.getElementById('first_time_s').value=="" || document.getElementById('first_time_m').value==""){
			alert("점검시작 시간과 분은 필수 값입니다.");
			return false;
		}
		
		if(document.getElementById('first_time_s').value.length < 2
			|| document.getElementById('first_time_s').value*1 > 23
			|| document.getElementById('last_time_s').value.length < 2 
			|| document.getElementById('last_time_s').value*1 > 23
		){
			alert("시간은 00~23 사이입니다.");
			return false;
		}
		
		if(document.getElementById('first_time_m').value.length < 2 
			|| document.getElementById('first_time_m').value*1 > 59
			|| document.getElementById('last_time_m').value.length < 2 
			|| document.getElementById('last_time_m').value*1 > 59 ){
			alert("분은 00~59 사이입니다.");
			return false;
		}
		
		var iChkBeginDe = Number(ntceBgndeYYYMMDD.replaceAll("-","") + document.getElementById('first_time_s').value+""+document.getElementById('first_time_m').value+"00" );
		var iChkEndDe = Number( ntceEnddeYYYMMDD.replaceAll("-","") +  document.getElementById('last_time_s').value+""+document.getElementById('last_time_m').value+"00" );
		
		if(iChkBeginDe > iChkEndDe || iChkEndDe < iChkBeginDe ){
			alert("점검시작 일시는  점검종료 일시보다 클수 없습니다.");
			return false;
		}

		frm.periStrPnttm.value = iChkBeginDe ;
		frm.periEndPnttm.value = iChkEndDe ;
	}
	return true;
}


//행추가
function add_line(){
	$.ajax({
	    type: "POST",
	    url: "/uss/itsm/per/PerItemInsertRowAjax.do",
	    data:{  "periId": "${perispVO.periId}"},
	    dataType:'jsonp',
	    cache: false,
	    async: false,
	    success: function (returnData, status) {
	    	if(status == 'success'){
	        	if(returnData.result == 'fail'){
	        		alert("생성에 실패하였습니다.");
	        	}else if(returnData.result == 'auth_fail'){
	        		alert("세션이 종료되었습니다.");
	        	}else if(returnData.result =='success'){
	        		tempPeritemVO = returnData.peritemVO;
	        		var eva_temp_tr = $('#temp_tr').clone();
	        		
	        		$('#tbody_periItem').append(eva_temp_tr);
	        		eva_temp_tr.find("input[name*=peritemListVO]").each(function(index, item){
	        			$(this).attr('name' ,  $(this).attr('name').replace('[]' , '['+$('.tr_item').size()+""+']')) ;
	        		});
	        		
	        		eva_temp_tr.find("select[name*=peritemListVO]").attr('name' , eva_temp_tr.find("select[name*=peritemListVO]").attr('name').replace('[]' , '['+$('.tr_item').size()+""+']')) ;
	        		eva_temp_tr.find('#temp_periItemId').removeAttr('id').attr('value', tempPeritemVO.periItemId) ;
	        		eva_temp_tr.find('#temp_add_file').attr('onclick' , 'file_upload(\''+tempPeritemVO.periItemId+'\')').removeAttr('id') ;  
	        		eva_temp_tr.attr('id' , 'tr_'+tempPeritemVO.periItemId).attr('class' , 'tr_item');
	        		eva_temp_tr.find('#temp_check_tr').attr('id', 'check_tr_'+tempPeritemVO.periItemId).attr('value', tempPeritemVO.periItemId).attr('class' , 'check_tr');
	        		eva_temp_tr.find('#temp_label_tr').attr('for', 'check_tr_'+tempPeritemVO.periItemId).removeAttr('id');
	        		set_count(); 
	        	}
	        }else{
	        	alert("생성에 실패하였습니다.");
	        }
	    },
	    error: function (e) {
	        alert("생성에 실패하였습니다.");
	    }
	});
}

var arrDel = new Array; //1차배열
function delete_line(evId, table_index){
	if(!$(".check_tr").is(":checked")){
		alert("선택된 행이  없습니다.");
		return;
	}
	
	$(".check_tr").each(function(index){
		if($(this).is(":checked")){
			arrDel.push($(this).attr('value'));	
		}
	});
	
	$.ajax({
	    type: "POST",
	    url: "/uss/itsm/per/PerItemDeleteRowAjax.do",
	    data:{  "del": arrDel.toString() , "periId": "${perispVO.periId}" },
	    dataType:'jsonp',
	    cache: false,
	    async: false,
	    success: function (returnData, status) {
	    	if(status == 'success'){
	        	if(returnData.result == 'fail'){
	        		alert("삭제에 실패하였습니다.");
	        	}else if(returnData.result == 'auth_fail'){
	        		alert("세션이 종료되었습니다.");
	        	}else if(returnData.result =='success'){
	        		$('.check_tr').each(function(index, item){
	        			if($(this).is(":checked")){
	        				$(this).parents('.tr_item').remove()
	        			}
	        		});
	        		set_count(); 
	        	}
	        }else{
	        	alert("생성에 실패하였습니다.");
	        }
	    },
	    error: function (e) {
	        alert("생성에 실패하였습니다.");
	    }
	});
}

/* 점검내용 체크버튼 클릭시 */
function all_check(object){
	if($(object).is(':checked')){
		$('.check_tr').prop("checked", true);	
	}else{
		$('.check_tr').prop("checked", false);
	}
}

/* 점검결과 체크버튼 클릭시 */
function all_check_rst(object){
	if($(object).is(':checked')){
		$('.check_rst').prop("checked", true);
	}else{
		$('.check_rst').prop("checked", false);
	}
}

/* 첨부파일 등록버튼 클릭시 */
function file_upload(periItemId) { 
	
	var docWidth = screen.availWidth;
	var docHeight = screen.availHeight;

	var popupX = (docWidth/2) - (793/2);
	var popupY = (docHeight/2) - (363/2);
	
	fileupladOpener = window.open('', 'fileupladOpener', "width=793, height=363, left="+popupX+", top="+popupY,"location = no","status= no","toolbars= no");
	document.writeForm.method = "post";
	document.writeForm.periItemId.value=periItemId ;
	document.writeForm.action = "/uss/itsm/per/PerItemFileUpload.do";
	document.writeForm.target = "fileupladOpener" ;
	document.writeForm.submit();
	document.writeForm.periItemId.value="" ;
}

/* ********************************************************
* PROTOTYPE JS FUNCTION
******************************************************** */
String.prototype.trim = function(){
	return this.replace(/^\s+|\s+$/g, "");
}

String.prototype.replaceAll = function(src, repl){
	 var str = this;
	 if(src == repl){return str;}
	 while(str.indexOf(src) != -1) {
	 	str = str.replace(src, repl);
	 }
	 return str;
}

function self_reload(){
	frm = document.writeForm;
	frm.target="_self";
	$('#imsi').val(""); //리로드 변수초기화
	frm.action = "<c:url value='/uss/itsm/per/PerView.do'/>";
    frm.submit();
}

/* 파일 삭제버튼 클릭시 */
function delete_item_file(itemId , delObject){
	if(!confirm("삭제하시겠습니까?")){
		return false;
	}
	$.ajax({
	    type: "POST",
	    url: "/uss/itsm/itsm/PerViewFileDeleteAjax.do",
	    data:{ "atchFileId" : itemId},
	    dataType:'jsonp',
	    //processData: false,
	    //contentType: false,
	    cache: false,
	    timeout: 600000,
	    success: function (returnData, status) {
	    	if(status == 'success'){
	        	if(returnData.result == 'fail'){
	        		alert("삭제에 실패하였습니다.");
	        	}else if(returnData.result == 'auth_fail'){
	        		alert("세션이 종료되었습니다.");
	        		if(opener !=null){
	        			opener.location.reload();	
	        		}
	        	}else if(returnData.result =='success'){
	        		$('.'+delObject+itemId).remove();
	        	}
	        }else{
	        	alert("삭제에 실패하였습니다.");
	        }
	    },
	    error: function (e) {
	        alert("삭제에 실패하였습니다.");
	    }
	});
}

var arrCd = new Array();
function set_count(){  //총괄표 카운터 세팅
	$("#temp_periItemCd").find('option').each(function(index, item){
		arrCd[index] = 0 ;  //배열 초기화 
	});
	$('#tbody_periItem').find("select[name*=peritemListVO]").each(function(index, item){
		//arrCd[$(this).val()*1-1] = arrCd[$(this).val()*1-1]+1 ;	 //배열에 순서에 맞게 +시킴
		arrCd[$(this).children("option:selected").index()] = arrCd[$(this).children("option:selected").index()]+1 ;  //배열에 순서에 맞게 +시킴
	});
	$("#temp_periItemCd").find('option').each(function(index, item){
		$('#periItemCdTot_'+$(this).val()).text(arrCd[index]);  //값 display	
	});
}

/*첨부파일 단일 다운로드  */
function downItsmFile(atchFileId, fileSn){
// 	window.open("/cmm/fms/ItsmFileDown.do?atchFileId="+atchFileId+"&fileSn=0");
	window.open("/cmm/fms/perFileDown.do?atchFileId="+atchFileId+"&fileSn=0");
}

/* 첨부파일 다운로드 버튼 클릭시 */
function file_download(){
	var checkbox_check = false;;
	$('input:checkbox[name="atchFileId"]').each(function(){
		if($(this).is(":checked")){
			checkbox_check = true;
		}
	});
	if(!checkbox_check){
		alert("선택된 항목이 없습니다.");
		return false;
	}
	//다운로드 항목이 1개 일때 기존의 다운로드(알집형식이 아닌)
// 	if($('input:checkbox[name="atchFileId"]:checked').length < 2){
// 	$('input:checkbox[name="atchFileId"]').each(function(){
// 		if($(this).is(":checked")){
// 			window.open("/cmm/fms/perFileDown.do?atchFileId="+$(this).val()+"&fileSn=0");
// 		}
// 	});
// 	}else{
	//다운로드 항목이 2개 이상일때 알집형식으로 다운로드    		
	var checkboxId = Array();
	var checkboxCnt = 0;
	var checkbox = $(".check_rst");
	
	for(i=0; i<checkbox.length; i++){
		if(checkbox[i].checked == true){
			checkboxId[checkboxCnt] = checkbox[i].value;
			checkboxCnt++;
		}}
	
	var frm = document.writeForm
	window.opener.name="parentPage";
	frm.target = "parentPage";
	frm.action="/cmm/fms/perFileDownZip.do?atchFileId="+checkboxId;
	frm.submit();
// 	}
	
	}

function setNumberOnly(){ //숫자만 입력
	$("input:text[numberOnly]").on("keyup", function(){
	    $(this).val($(this).val().replace(/[^0-9]/g,""));
	});
}
</script>
<style type="text/css">
	 _:-ms-input-placeholder, :root .rtest_table table tr td input[type="text"].test_number { width: 145px; }
	 _:-ms-input-placeholder, :root a.date_select_btn img{ top: 8.7px; }
</style>
</head>
<body>
<form name="writeForm" enctype="multipart/form-data" method="post">
<input type="hidden" name="selectedId" />	
<input type="hidden" name="periId" id="periId" value="${perispVO.periId}"/>
<input type="hidden" name="periItemId" id="periItemId" />
<input type="hidden" name="del" value="${perispVO.periId}" />	
<input type="hidden" name="periStrPnttm"  />	
<input type="hidden" name="periEndPnttm"  />	
<input type="hidden" name="pageType" id="pageType" value="${perispVO.pageType}" />
<input type="hidden" name="pageReload" id="pageReload" value="Y" /> <!-- 페이지 리로드를 위한 변수 -->
<input type="hidden" name="imsi" />
<input type="hidden" name="frstRegistPnttm" id="frstRegistPnttm" value="${perispVO.frstRegistPnttm}" />

<div class="enroll_popup" style="height:782px;">
    <div class="enroll_popup_title">
        <img src="/direct/img/enroll_popup_title_bg.png" alt=""> 정기점검
    </div>
    <div class="enroll_wrap">
        <div class="enroll_input_left rtest_left">
            <ul>
                <li>
                    <div class="enroll_input_title required_area"><div class="listTitle">감사구분</div></div>
                    <div class="enroll_sort">
                        <c:forEach var="codeList" items="${periQuCdList}" varStatus="status">
		                	<input type="radio" class="periQuCd" name="periQuCd" id="periQuCd_${codeList.code}" value="${codeList.code}" 
		                	<c:if test="${perispVO.periQuCd eq codeList.code}">
		                		checked="checked"
		                	</c:if>>
                        	<label for="periQuCd_${codeList.code}"></label><label for="periQuCd_${codeList.code}">${codeList.codeNm}</label>
						</c:forEach>
						<input type="text" name="periQuCdCn" id="periQuCdCn" maxlength="30"  value="${perispVO.periQuCdCn}" >
                    </div>
                    <span class="required_text">* 필수입력사항</span>
                </li>
                <li>
                    <div class="enroll_input_title required_area"><div class="listTitle">점검명</div></div>
                    <input type="text" name="periSj" id="periSj" maxlength="30"  value="<c:out value="${perispVO.periSj}" escapeXml="true" />">
                </li>
                <li>
                    <div class="enroll_input_title required_area"><div class="listTitle">점검일시</div></div>
                    <input type="hidden" name="cal_url" id="cal_url" value="<c:url value='/sym/cmm/EgovNormalCalPopup.do'/>" >
                    <input type="text" name="ntceBgndeYYYMMDD" id="ntceBgndeYYYMMDD" readonly="readonly" class="first_date" value="${perispVO.periStrPnttm}" >
                    	<a href="#" onclick="javascript:fn_egov_NormalCalendar(document.forms.writeForm, document.forms.writeForm.ntceBgndeYYYMMDD);" class="date_select_btn">
					    	<img src="/images/egovframework/com/cmm/icon/bu_icon_carlendar.gif" align="middle" style="border:0px;vertical-align: baseline;" alt="달력창팝업버튼이미지">
					    </a>
                    <input type="text" numberOnly maxlength="2" class="last_time" style="width:30px;" name="first_time_s" id="first_time_s" value="${fn:substring(perispVO.periStrPnttmTime, 0, 2)}" >:
                    <input type="text" numberOnly maxlength="2" class="last_time" style="width:30px;" name="first_time_m" id="first_time_m" value="${fn:substring(perispVO.periStrPnttmTime, 3, 5)}" >~<input type="text" class="last_date" name="ntceEnddeYYYMMDD" id="ntceEnddeYYYMMDD" readonly="readonly"  value="${perispVO.periEndPnttm}">
                    	<a href="#" onclick="javascript:fn_egov_NormalCalendar(document.forms.writeForm, document.forms.writeForm.ntceEnddeYYYMMDD);" class="date_select_btn">
					    	<img src="/images/egovframework/com/cmm/icon/bu_icon_carlendar.gif" align="middle" style="border:0px;vertical-align: baseline;" alt="달력창팝업버튼이미지">
					    </a>
					<input type="text" numberOnly maxlength="2" class="last_time" style="width:30px;" name="last_time_s" id="last_time_s" value="${fn:substring(perispVO.periEndPnttmTime, 0, 2)}"/>:
					<input type="text" numberOnly maxlength="2" class="last_time" style="width:30px;" name="last_time_m" id="last_time_m" value="${fn:substring(perispVO.periEndPnttmTime, 3, 5)}"/>
                </li>
                <li>
                    <div class="enroll_input_title"><div class="listTitle">점검장소</div></div>
                    <input type="text" name="periStat" id="periStat" maxlength="20" placeholder="점검장소를 입력하세요" value="<c:out value="${perispVO.periStat}" escapeXml="true" />">
                </li>
                <li>
                    <div class="enroll_input_title required_area"><div class="listTitle">점검방법</div></div>
                    <div class="enroll_sort">
                        <c:forEach var="codeList" items="${periMeCdList}" varStatus="status">
		                	<input type="radio" class="periMeCd" name="periMeCd" id="periMeCd_${codeList.code}" value="${codeList.code}" 
		                	<c:if test="${perispVO.periMeCd eq codeList.code}">
		                		checked="checked"
		                	</c:if>>
                        	<label for="periMeCd_${codeList.code}"></label><label for="periMeCd_${codeList.code}">${codeList.codeNm}</label>
						</c:forEach>
						<input type="text" name="periMeCdCn" id="periMeCdCn" maxlength="20" value="${perispVO.periMeCdCn}" >
                    </div>
                </li>
            </ul>
        </div>
        <div class="rtest_right_wrap">
            <div class="enroll_file_title">
                <img src="/direct/img/enroll_file_title_bg.png" alt=""> 점검결과
            </div>
            <textarea name="periRst" id="periRst" cols="30" rows="10" maxlength="500" >${perispVO.periRst}</textarea>
        </div>
        <div class="enroll_popup_bottom">
            <div class="enroll_popup_bottom_title"><img src="/direct/img/bottom_title_all.png" alt="">총괄표</div>
            <div class="enroll_popup_bottom_table rtest_table_all">
                <table>
                    <tr>
                        <th>구분</th>
                        <c:forEach var="codeList" items="${periItemCdList}" varStatus="status">
                        	<th>${codeList.text}</th>	
                        </c:forEach>
                    </tr>
                    <tr>
                        <th>식</th>
                        <c:forEach var="codeList" items="${periItemCdList}" varStatus="status">
                        	<td id="periItemCdTot_${codeList.id}">0</td>
                        </c:forEach>
                    </tr>
                </table>
            </div>
            <div class="enroll_popup_bottom_title" style="margin-bottom: 20px;"><img src="/direct/img/bottom_title_Evaluation.png" alt="">점검내용
            <input type="button" value="점검결과 다운로드" class="resultDown" onclick="file_download(this); return false;"></div>
            <div class="enroll_popup_bottom_table rtest_table">
                <table>
                    <thead>
                        <tr>
                            <th><input type="checkbox" id="all" onclick="all_check(this);">
                            	<label for="all"></label>
                            </th>
                            <th>구분</th>
                            <th>점검대상</th>
                            <th style="position:relative">점검업체 <div class="line_btn" style="position: absolute;right: 19px; top: 9px;">
                                    <div class="add_line"><input type="button" value="행추가" onclick="add_line();" ></div>
                                    <div class="delect_line"><input type="button" value="행삭제" onclick="delete_line();" ></div>
                                </div>
                            </th>
                            <th><input type="checkbox" id="all_rst" onclick="all_check_rst(this);">
                            	<label for="all_rst"></label>점검결과
                            </th>
                            <th>요청사항</th>
                            <th>보완사항</th>
                        </tr>
                    </thead>
                    <tbody id="tbody_periItem">
                    	<c:forEach var="result" items="${peritemList}" varStatus="status">
                    	 <tr class="tr_item"  id="tr_${result.periItemId}">
                            <td>
                            	<input type="checkbox" id="check_tr_${result.periItemId}" value="${result.periItemId}" class="check_tr">
                            		<label for="check_tr_${result.periItemId}"></label>
                            	<input type="hidden" name="peritemListVO[${status.index}].periItemId" value="${result.periItemId}">
                            </td>
                            <td>
                            	<select class="td_periItemCd" id="td_periItemCd" name="peritemListVO[${status.index}].periItemCd" onchange="set_count();" >
                            	<c:forEach var="codeList" items="${periItemCdList}" varStatus="status_itemcode">
                            		<option value="${codeList.id}"
                            		<c:if test="${result.periItemCd eq codeList.id}">selected</c:if>
                            		>${codeList.text}</option>
                            	</c:forEach>
                                </select>
                            </td>
                            <td>
                            	<input type="text" name="peritemListVO[${status.index}].periTagert" class="test_who"  maxlength="20"  value="${result.periTagert}">
                            </td>
                            <td class="test_enterprise">
                            	<input type="text" maxlength="20"  name="peritemListVO[${status.index}].periBelong" placeholder="소속" class="test_enterprise_Aff" value="${result.periBelong}" >
	                            <input type="text" maxlength="20"  name="peritemListVO[${status.index}].periName" placeholder="점검자명" class="test_name" value="${result.periName}" >
	                            <input type="text" maxlength="20"  name="peritemListVO[${status.index}].periSpot" placeholder="직위" class="test_position" value="${result.periSpot}" >
	                            <input type="text" maxlength="20"  name="peritemListVO[${status.index}].periTel" placeholder="연락처" class="test_number" value="${result.periTel}" >
                            </td>
                            <td class="test_result">
                            	<c:forEach var="fileResult" items="${periFileList}" varStatus="status_itemcode">
                            	<c:if test="${fileResult.refId eq result.periItemId}">
                            	<div class="eva_file eva_file_${fileResult.atchFileId}" style="text-align:left">	
                            		<input type="checkbox" name="atchFileId" id="check_rst_${fileResult.atchFileId}" class="check_rst" value="${fileResult.atchFileId}">
                                	<label for="check_rst_${fileResult.atchFileId}"></label>
                                	<img src="/direct/img/enroll_zip_file.png" alt="">
                                	<div class="eva_file_name">
                                		<a href="javascript:downItsmFile('<c:out value="${fileResult.atchFileId}"/>','0')">
                                			${fileResult.orignlFileNm}
                                		</a>
                                	</div>
                                	<img src="/direct/img/add_enroll_popup_delect.png" alt="" onclick="delete_item_file('${fileResult.atchFileId}' , 'eva_file_');"></br>
                                </div>
                                </c:if>
                            	</c:forEach>
                                <div class="eva_file"><img class="temp_evitIds_imgs" id="temp_evitIds_img_01" src="/direct/img/add_eva_file.png" alt="" onclick="file_upload('${result.periItemId}');" style="cursor:pointer"></div>	
                            </td>
                            <td><input type="text" maxlength="20" name="peritemListVO[${status.index}].periReq" class="test_request" value="${result.periReq}" ></td>
                            <td><input type="text" maxlength="20" name="peritemListVO[${status.index}].periAct" class="test_request" value="${result.periAct}" ></td>
                        </tr>
                    	</c:forEach>
                    </tbody>
                </table>
            </div>
        </div>
        <div class="main1_btn_div">
            <!-- <button class="main1_btn" onclick="fn_mainzone_link_page(); return false;">목 록</button> -->
            <c:if test="${perispVO.pageType eq 'New'}">
				<input type="button" class="main1_btn main1_save_imsi_btn" id="audit_btn_imsi" value="임시저장" />
				<input type="button" class="main1_btn main1_save_btn" buttonType="${perispVO.pageType}" id="audit_save_btn" value="저 장" />
				<input type="button" class="main1_btn main1_delete_btn" buttonType="Cancel" id="auth_delete_btn" value="취 소" />
			</c:if>
			<c:if test="${perispVO.pageType eq 'Imsi'}">
				<input type="button" class="main1_btn main1_save_imsi_btn" id="audit_btn_imsi" value="임시저장" />
				<input type="button" class="main1_btn main1_save_btn" buttonType="${perispVO.pageType}" id="audit_save_btn" value="저 장" />
				<input type="button" class="main1_btn main1_delete_btn" buttonType="Cancel" id="auth_delete_btn" value="취 소" />
			</c:if>
			<c:if test="${perispVO.pageType eq 'Modify'}">
				<input type="button" class="main1_btn main1_save_btn" buttonType="${perispVO.pageType}" id="audit_save_btn" value="수 정" />
				<input type="button" class="main1_btn main1_delete_btn" buttonType="Delete" id="auth_delete_btn" value="삭 제">
				<!-- <input type="button" class="main1_btn main1_list_btn" buttonType="Cancel" id="auth_list_btn" value="목 록" /> -->
				<input type="button" class="main1_btn main1_print_btn" buttonType="Print" id="auth_print_btn" value="인 쇄" onclick="window.print();"/>
			</c:if>
			<input type="button" class="main1_btn main1_save_imsi_btn" id="audit_update_btn" style="display:none;" />
        </div>
        <!-- <div class="view_info" style="margin-top:0;">
			<div class="enroll_date">
					등록일시&emsp;2019.09.09&ensp;18:18:18</div>
				<div class="list_view_btns">
					<input type="button" value="이전글" class="before_list">&ensp;&ensp;｜&ensp;&ensp;
					<input type="button" value="다음글" class="next_list">
				</div>
		</div> -->
    </div>
    
</div>
</form>

<table id="eva_temp_table" style="display:none">
<tr id="temp_tr">
	<td>
		<input type="checkbox" id="temp_check_tr">
		<label for="" id="temp_label_tr"></label>
		<input type="hidden" name="peritemListVO[].periItemId" id="temp_periItemId" value="000000000000000000">
	</td>
	<td>
		<select name="peritemListVO[].periItemCd" id="temp_periItemCd" onchange="set_count();">
	 	<c:forEach var="codeList" items="${periItemCdList}" varStatus="status">
	 		<option value="${codeList.id}">${codeList.text}</option>
	 	</c:forEach>
        </select>
    </td>
    <td>
    	<input type="text" name="peritemListVO[].periTagert" class="test_who" maxlength="20" >
    </td>
    <td class="test_enterprise">
    	<input type="text" maxlength="20"  name="peritemListVO[].periBelong" placeholder="소속" class="test_enterprise_Aff">
    	<input type="text" maxlength="20"  name="peritemListVO[].periName" placeholder="점검자명" class="test_name">
    	<input type="text" maxlength="20"  name="peritemListVO[].periSpot" placeholder="직위" class="test_position">
    	<input type="text" maxlength="20"  name="peritemListVO[].periTel" placeholder="연락처" class="test_number">
    </td>
    <td class="test_result">
    <div class="eva_file"><img id="temp_add_file" class="temp_evitIds_imgs" id="temp_evitIds_img_01" src="/direct/img/add_enroll_popup_person.png" alt="" onclick="file_upload('[]');" style="cursor:pointer"></div>
     </td>
    <td>
    	<input type="text" maxlength="20" name="peritemListVO[].periReq" class="test_request">
    </td>
    <td>
    	<input type="text" maxlength="20"  name="peritemListVO[].periAct" class="test_request">
    </td>
</tr>
</table>                        
   
</body>

</html>