<%@ include file="/init.jsp" %>


<%
	boolean errArquivo = false;
	boolean errVazio = false;
	boolean errDataNula = false;
	boolean errHorarioLimite = false;
	String cssErro = "control-group error";
	
	if(request.getAttribute("erroArquivo") != null){
		errArquivo = (Boolean) request.getAttribute("erroArquivo");
	}
	if(request.getAttribute("erroVazio") != null){
		errVazio = (Boolean) request.getAttribute("erroVazio");
	}
	if(request.getAttribute("erroDataNula") != null){
		errDataNula = (Boolean) request.getAttribute("erroDataNula");
	}
	if(request.getAttribute("erroHorarioLimite") != null){
		errHorarioLimite = (Boolean) request.getAttribute("erroHorarioLimite");
	}
%>


<liferay-theme:defineObjects />
<portlet:defineObjects />
<liferay-ui:error key="erroListagemNula" message="Não existem matérias cadastradas para os parâmetros utilizados." />
<h3><liferay-ui:message key="admin.form.agendamento.titulo"/></h3>
<hr />
<div class="texto-obs"><liferay-ui:message key="admin.form.agendamento.observacao"/></div>




<portlet:renderURL var="viewUrl">
	<portlet:param name="jspPath" value="/view.jsp"/>
</portlet:renderURL>


<portlet:actionURL var="submitActionURL">
	<portlet:param name="<%=ActionRequest.ACTION_NAME%>" value="geraCaderno" />
	<portlet:param name="mvcPath" value="/view.jsp"/>
</portlet:actionURL>



<form id="<portlet:namespace />formDO" name="<portlet:namespace />formDO" 	method="POST" enctype="multipart/form-data" action="<%= submitActionURL%>" >
	
	<div id="campo-situacao" class="campo">
			<label><liferay-ui:message key="admin.form.editar.situacao"/></label>		
			<select class="selectpicker" name="<portlet:namespace/>situacao" id="<portlet:namespace/>situacao" >	  		
			
				    
		        	<option value="4">Validada</option>
		        	<option value="6">Aprovada</option>
		        	<option value="8">Divulgada</option>
		        
		      					      	
		   	</select>
			<liferay-ui:error key="erroTipoMat" message="Uma Situação deve ser selecionada." />
		</div>
	
	
	<div class='campo <%=errDataNula || errHorarioLimite ? cssErro : "" %>' >
		<label><liferay-ui:message key="admin.form.agendamento.data.divulgacao"/></label>
		
		<div class="form-group">
            <div class='input-group date' id='datepickeragendamento'>
            <input class="form-control" name="<portlet:namespace/>dataP" id="<portlet:namespace/>dataP"  onpaste="return false;" ondrop="return false;"/>
                <span class="input-group-addon">
                	<span class="glyphicon glyphicon-calendar"></span>
            	</span>
         	</div>
         </div>
		<liferay-ui:error key="erroDataNula" message="Uma data deve ser selecionada." />
		
	</div>
	
	<button type="submit" id="enviarFormDO" name="enviarFormDO" class="btn btn-primary">Gerar Caderno</button>
	<button type="reset" id="limparFormDO" name="limparFormDO" class="btn btn-cancel">Limpar</button>
	<button type="button" id="jobForm" name="jobForm" class="oculto" style="display: none">não aperte</button>
</form>

<portlet:resourceURL var="ocultoJob"><portlet:param name="parameter" value="jobOculto" /></portlet:resourceURL>


<portlet:resourceURL var="testAjaxResourceUrl"></portlet:resourceURL>


<script type="text/javascript">
	var urlAjax = "<%=testAjaxResourceUrl%>";
	var urlOculto = "<%=ocultoJob%>";
</script>