<%@page import="br.com.centralit.citcorpore.bean.UploadDTO"%>
<%@page import="java.util.Iterator"%>
<%@page import="java.util.ArrayList"%>
<%@page import="java.util.Collection"%>
<%@page import="br.com.centralit.citcorpore.util.CitCorporeConstantes"%>
<%@page import="br.com.centralit.citcorpore.util.Enumerados.CampoUpload"%>

<html class="backGroundBranco">
<head>
		<%@include file="/novoLayout/common/include/libCabecalho.jsp" %>
		<%@include file="/novoLayout/common/include/titulo.jsp" %>
		<link type="text/css" rel="stylesheet" href="../../novoLayout/common/include/css/template.css"/>
		<%@include file="/include/internacionalizacao/internacionalizacao.jsp"%>
</head>
<body>
<script>
	function excluirImagemUpload(path){
		if (confirm(i18n_message("citcorpore.comum.confirme.desejaexcluiranexo"))){
			window.location = '${ctx}/pages/uploadExcluirContrato/uploadExcluirContrato.load?path=' + path;
		}
	}
	function obtemArquivoTemporario(path){
		window.location = '${ctx}/pages/visualizarUploadTemp/visualizarUploadTemp.load?path=' + path;
	}
	function excluirAnexo(id, nomeArquivo){
		if(confirm(i18n_message("citcorpore.comum.confirme.exclusaoanexo"))){
			window.location = '${ctx}/pages/upload/excluirAnexo.do?nameFile=' + nomeArquivo + '&id='+id;
		}
	}
	<%
		if(request.getAttribute("acaoRetorno") != null){
	%>
		alert(i18n_message("citcorpore.comum.validacao.anexoexcluido"));
	<%
		}
	%>
</script>
<div class="row-fluid">
	<div class="table-responsive tabela">	
		<table class="table table-bordered table-striped table-condensed table-vertical-center checkboxs js-table-sortable ui-sortable" >
			<thead>
				<tr>
					<th class="left"><fmt:message key="citcorpore.comum.arquivo" /></th>
					<th class="left"><fmt:message key="citcorpore.comum.descricao" /></th>
					<th class="center" style="width: 120px;"><fmt:message key="citcorpore.comum.situacao" /></th>
					<th class="center" style="width: 30px;"><fmt:message key="citcorpore.comum.acoes" /></th>
				</tr>
			</thead>
			<tbody>
		        <%boolean branco = true;%>
		      	<%String cor = "#ffffff";%>
		      	<%
				Collection colUploadsGED = (Collection)request.getSession(true).getAttribute(CampoUpload.UPLOADCONTRATO.getColUploadGED());
				if (colUploadsGED == null){
					colUploadsGED = new ArrayList();
				}
		      	%>
		      	<%for(Iterator it = colUploadsGED.iterator(); it.hasNext();){ %>
		      		<%
		      		UploadDTO uploadDTO = (UploadDTO)it.next();
		      		%>
				<tr>
					<%
					if(branco){
						cor ="#ffffff";
					}else{
						cor="#E5EBF6";
					}
					%>
					<td class="left">
						<a href="#" onclick='obtemArquivoTemporario("<%=uploadDTO.getPath()%>")'><%=uploadDTO.getNameFile()%></a>
					</td>
					
					<td class="left">
						<%=uploadDTO.getDescricao()%>
					</td>
					
					<td style="width: 120px;" class="center" title='<fmt:message key="citcorpore.ged.situacao" />'>
						<%=uploadDTO.getSituacao()%>
					</td>
					
					<%
					if(request.getSession().getAttribute("disable")== null || request.getSession().getAttribute("disable").equals("false")){ %>
						<td class="center" style="width: 30px; cursor: pointer;">
							<a onclick='excluirImagemUpload("<%=uploadDTO.getPath()%>")' class="btn-action glyphicons remove_2 btn-default"><i></i></a>
						</td>
					<%}else{ %>
						<td>&nbsp;</td>
					<%}%>
					
					<%branco=!branco;%>
		        </tr>
				<%}%>
			</tbody>
		</table>
	</div>
</div>
</body>

</html>