<%@ page contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="validator" uri="http://www.springmodules.org/tags/commons-validator" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="ckeditor" uri="http://ckeditor.com" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="ct" tagdir="/WEB-INF/tags" %>

<form:form commandName="reportVO" id="formReprotInfo" name="formReprotInfo" enctype="multipart/form-data" method="post">
	<form:hidden path="inSeq"/>
	<form:hidden path="inStateCode"/>
	
	<form:hidden path="inUserid"/>
	<form:hidden path="inType"/>
	
	<div id="table">
		<table class="tbl_add">
			<colgroup>
	   			<col width="100"/>
	   			<col width="150"/>
	   			<col width="100"/>
	   			<col width="150"/>
	   			<col width="100"/>
	   			<col width="150"/>
	   			<col width="100"/>
	   			<col width=""/>
	   		</colgroup>
	   		<tr>
   				<th>
   					<spring:message code="report.list.num"/>
   				</th>
   				<td colspan="3">
   					<spring:message code="report.view.num" arguments="${reportVO.inPlaceName},${reportVO.inPlaceNum}"/>
   				</td>
	   			<th>
	   				<spring:message code="report.view.regName" />
	   			</th>
				<td colspan="3">
					<c:out value="${loginUserVO.positionStr} ${loginUserVO.name}"/>
				</td>
			</tr>
			<tr>
				<th>
					<spring:message code="report.view.category1" />
				</th>
				<td class="form_select">
					<form:select path="inCategory1" items="${category1}" />
				</td>
				<th>
					<spring:message code="report.view.category2" />
				</th>
				<td class="form_select">
					<form:select path="inCategory2" items="${category2}" />
				</td>
				<th>
					<spring:message code="report.view.category3" />
				</th>
				<td class="form_select">
					<form:select path="inCategory3" items="${category3}" />
				</td>
				<th>
					<spring:message code="report.view.category4" />
				</th>
				<td class="form_select">
					<form:select path="inCategory4" items="${category4}" />
				</td>
			</tr>
			<tr>
				<th>
					<spring:message code="report.view.memo" />
				</th>
				<td colspan="7">
					<form:input path="inMemo" cssClass="txt" />
				</td>
			</tr>	
	   		<tr>
	   			<th>
	   				<spring:message code="board.view.title" />
	   			</th>
	   			<td colspan="5">
	   				<form:input id="title" path="inSubject" maxlength="150" cssClass="txt"/>	   			
	   			</td>
	   			<th>
	   				<spring:message code="report.view.isAutoRemove"/>
	   			</th>
	   			<td>
	   				<input type="checkbox" name="inAutoRemove" id="chkInAutoRemove" value="1">
	   				<label for="chkInAutoRemove"><spring:message code="report.view.autoRemove"/> (<spring:message code="report.view.autoRemoveTerm"/>)</label>
	   			</td>
	   		</tr>
	   		<tr>
	   			<th>
	   				<spring:message code="report.view.name" />
	   			</th>
				<td colspan="2" id="tdSearchNameResult">
					<span id="selectedName"></span>
					<span id="emptySearchName" style="color: #c8c8c8;"><spring:message code="report.msg.searchName"/></span>
				</td>
				<td class="search" colspan="3">
					<input type="text" id="txtSearchName" />
					<button type="button" id="btnSearchName"><spring:message code="button.search" /></button>
				</td>
				<td colspan="2" class="tbl_list_input2">
					<input type="radio" name="usertype" value="f" id="searchTypeFa" checked="checked"/><label for="searchTypeFa"><spring:message code="report.view.fa"/></label>
					<input type="radio" name="usertype" value="g" id="searchTypeNoFa"/><label for="searchTypeNoFa"><spring:message code="report.view.cm"/></label>
				</td>
			</tr>			
	   		<tr>
	   			<th>
	   				<spring:message code="report.view.appraisal"/>
	   			</th>
	   			<td colspan="5" class="tbl_list_input2">
	   				<spring:message code="report.view.empty" var="emptyTxt" />
	   				<form:radiobutton path="inJudge" value="0" label="${emptyTxt}" />
	   				<c:forEach var="judge" items="${judgeList}">
						<form:radiobutton path="inJudge" value="${judge.code2}" label="${judge.codenm}" />
					</c:forEach>
				</td>
				<th>
	   				<spring:message code="report.type.fullReport"/>
	   			</th>
	   			<td colspan="1">
					<input type="checkbox" name="inReport" id="chkInReport" value="1"/>
					<label for="chkInReport"><spring:message code="report.type.fullReport"/></label>
				</td>
	   		</tr>
	   		<tr>
	   			<th>
	   				<spring:message code="board.view.content" />
	   			</th>
	   			<td colspan="7">
	   				<form:textarea path="inContent" rows="7" cols="58" htmlEscape="false"/>&nbsp;<form:errors path="inContent" />
	   				<ckeditor:replace replace="inContent" basePath="${pageContext.request.contextPath}/ckeditor/" />
	   				<span><spring:message code="etc.editor.descript"/></span>
	            </td>  
	   		</tr>
	   		<tr>
	   			<th>
	   				<spring:message code="board.view.attach" />
	   			</th>
	            <td colspan="7">
					<p><input type="file" name="fileObj1" class="input_file" size="60" /></p>
					<p><input type="file" name="fileObj2" class="input_file" size="60" /></p>
					<p><input type="file" name="fileObj3" class="input_file" size="60" /></p>
					<p><input type="file" name="fileObj4" class="input_file" size="60" /></p>
					<p><input type="file" name="fileObj5" class="input_file" size="60" /></p>
	            </td>
			</tr>
			<tr>
				<th>
					<spring:message code="report.view.infodate" />
				</th>
				<td colspan="7">
	   				<form:input path="strInfodate" cssClass="txt" readonly="true" value="${reportVO.inInfodate}" />
				</td>
			</tr>
	   	</table>
	</div>
</form:form>

<div class="boardviewinfo">
	<ul class="right btn-style">
		<li>
	     	<a href="javascript:fn_submit();"><spring:message code="button.goSubmit" /></a>
	    </li>
	</ul>
</div>

<spring:message code="report.popup.searchReporter" var="searchPopTitle"/>
<ct:memberSelectPop isTypeSearch="true" isIdSearch="true" title="${searchPopTitle}"/>

<script type="text/javascript" src="<c:url value='/validator.do'/>"></script>
<validator:javascript formName="reportVO" staticJavascript="false" xhtml="true" cdata="false"/>
<script type="text/javaScript" defer="defer">
<!--
	$(document).ready(function(){
		$('#strInfodate').datepicker({dateFormat: 'yy-mm-dd'});
		$('#strInfodate').val($.datepicker.formatDate('yy-mm-dd', new Date()));

		$("#btnSearchName").click(function(){
			openMemeberSelectPopup();
		});
		$("#txtSearchName").keydown(function(e){
			if (e.keyCode == 13){
				openMemeberSelectPopup();			
			}
		});
	});
	
	//검색 팝업 열기
	function openMemeberSelectPopup(){
		if ($("#txtSearchName").val().trim().length <= 0){
			alert("<spring:message code="report.msg.writeName"/>");
			$("#txtSearchName").focus();
			return false;
		}
		
		if (MemberSelectPopup)
			MemberSelectPopup.isTypeSearch = true;
			MemberSelectPopup.isIdSearch = true;
			
			var data = {
					name: $("#txtSearchName").val(),
					type: $("input[name=usertype]:checked").val()
				};
			MemberSelectPopup.openAndFill(data, cbOnSelectMemeber);
	}

	// 사용자 선택 후 실행할 콜백함수
	function cbOnSelectMemeber(member) {
		$('form #inUserid').val(member.userid);
		$('form #inType').val(member.usertype != '' ? member.usertype : 'g');
		
		$('#selectedName').text(member.name + " (" + member.userid + ") " + member.place1Str);
		$('#emptySearchName').hide();
	}

	//제출하기
	function fn_submit() {
		if($('#inUserid').val() == '') {
			alert('보고자를 입력하십시오.');
			return;
		}
		
		frm = document.formReprotInfo;
		frm.inStateCode.value = "${myGroupCode}" + "1";
		frm.inContent.value = encodeURIComponent(CKEDITOR.instances.inContent.getData());
		
		if(!validateReportVO(frm)){
	        return;
	    }else{
	       	frm.submit();
	    }
	}
-->
</script>