<%@ 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"%>

<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="inType" value="${reportVO.inType}"/>
	<form:hidden path="inAgencyCode" value="${reportVO.inAgencyCode}"/>
	<form:hidden path="inPlaceCode" value="${reportVO.inPlaceCode}"/>
	<form:hidden path="inPlaceName" value="${reportVO.inPlaceName}"/>
	<form:hidden path="inPlaceNum" value="${reportVO.inPlaceNum}"/>
		
	<c:if test="${reportVO.inType eq '1'}">
		<c:set var="userType" value="외사" />
	</c:if>
	<c:if test="${reportVO.inType eq '2'}">
		<c:set var="userType" value="일반" />
	</c:if>	
	<div id="table">
		<table class="tbl_add" width="100%" border="0" cellpadding="0" cellspacing="0">
			<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.name" /></th>
				<td colspan="3">
					<c:out value="${userType}" /> <c:out value="${userVO.positionStr}" /> <c:out value="${userVO.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">
						<form:options items="${category2}" />
					</form:select>
				</td>
				<th><spring:message code="report.view.category3" /></th>
				<td class="form_select">
					<form:select path="inCategory3">
						<form:options items="${category3}" />
					</form:select>
				</td>
				<th><spring:message code="report.view.category4" /></th>
				<td class="form_select">
					<form:select path="inCategory4">
						<form:options items="${category4}" />
					</form:select>
				</td>
			</tr>
			<tr>
				<th><spring:message code="report.view.memo" /></th>
				<td colspan="7">
					<form:input path="inMemo" cssClass="txt" />
				</td>
			</tr>	
	   		<tr>
	   			<th>
	   				<label for="title"><spring:message code="board.view.title" /></label>
	   			</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>
	   				<label for="contents"><spring:message code="board.view.content" /></label>
	   			</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>
	   				<label for="contents"><spring:message code="board.view.attach" /></label>
	   			</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>
					<label><spring:message code="report.view.infodate" /> </label>
				</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>
	    <li>
	    	<a href="javascript:fn_save();"><spring:message code="button.goSaveTemp" /></a>
	    </li>
	    <li>	
			<a href="javascript:history.back();"><spring:message code="button.goBack" /></a>
	    </li>
	</ul>
</div>

<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">

	$(function(){
	$('#strInfodate').datepicker({ dateFormat: 'yy-mm-dd' });
	
	var result = "<c:out value="${submitResultMsg}"/>";
	var seq = "<c:out value="${submitResultSeq}"/>";
	if (result != "" && seq != "") {
		alert(result);
		location.href = "/report/update.do?inSeq=" + seq;
	}
});
$('#strInfodate').val($.datepicker.formatDate('yy-mm-dd', new Date()));
$('#inInfodate').val($.datepicker.formatDate('yy-mm-dd', new Date()));

//제출하기
function fn_submit() {
	frm = document.formReprotInfo;
	frm.inStateCode.value = "${myGroupCode}" + "1";
	frm.inContent.value = encodeURIComponent(CKEDITOR.instances.inContent.getData());
	
	if(!validateReportVO(frm)){
        return;
    }else{
       	frm.submit();
    }
}

//임시저장
function fn_save() {
	frm = document.formReprotInfo;
	frm.inStateCode.value = "99";
	frm.inContent.value = encodeURIComponent(CKEDITOR.instances.inContent.getData());
	
	if(!validateReportVO(frm)){
        return;
    }else{
       	frm.submit();
    }
}
-->
</script>