<%@ page import="com.jeeplus.modules.sys.utils.UserUtils" %>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/webpage/include/taglib.jsp"%>
<html>
<head>
	<title>选择项目</title>
	<meta name="decorator" content="default"/>
	<style>
		.widthClass{
			display: inline-block;
		}
		.shows .input-group{
			width: 48%!important;
		}
	</style>
	<style>
		body{
			background-color:transparent;
			filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#26FFFFFF, endColorstr=#26FFFFFF);
			color:#ffffff;
			background-color:rgba(255,255,255,0);
			height:100%;
		}
	</style>
	<script type="text/javascript">
		$(document).ready(function() {

            //搜索框收放
            $('#moresee').click(function(){
                if($('#moresees').is(':visible'))
                {
                    $('#moresees').slideUp(0,resizeListWindow1);
                    $('#moresee i').removeClass("glyphicon glyphicon-menu-up").addClass("glyphicon glyphicon-menu-down");
                }else{
                    $('#moresees').slideDown(0,resizeListWindow1);
                    $('#moresee i').removeClass("glyphicon glyphicon-menu-down").addClass("glyphicon glyphicon-menu-up");
                }
            });

            $('#contentTable thead tr th input.i-checks').on('ifChecked', function(event){ //ifCreated 事件应该在插件初始化之前绑定
			    	  $('#contentTable tbody tr td input.i-checks').iCheck('check');
			    	});

			    $('#contentTable thead tr th input.i-checks').on('ifUnchecked', function(event){ //ifCreated 事件应该在插件初始化之前绑定 
			    	  $('#contentTable tbody tr td input.i-checks').iCheck('uncheck');
			    	});
		});

		function getSelectedItem(){
            var isSingle=${isSingle};
			var size = $("#contentTable tbody tr td input.i-checks:checked").size();
			  if(size == 0 ){
					top.layer.alert('请至少选择一条数据!', {icon: 0, title:'警告'});
					return "-1";
				  }
            if(isSingle){//单选
			  if(size > 1 ){
					top.layer.alert('只能选择一条数据!', {icon: 0, title:'警告'});
					return "-1";
				  }
			    var id =  $("#contentTable tbody tr td input.i-checks:checkbox:checked").attr("id");
			    
				var label = $("#contentTable tbody tr td input.i-checks:checkbox:checked").parent().parent().parent().find(".codelabel").html();
			  	var data = {'id':id};
				return data;
            }else{
                var arr=new Array();
                $("#contentTable tbody tr td input.i-checks:checked").each(function () {
                    var id =  $(this).attr("id");
                    var data = {'id':id};
                    arr.push(data);
                })
                return arr;
            }
		}
		function page(n,s){
			if(n) $("#pageNo").val(n);
			if(s) $("#pageSize").val(s);
			$("#searchForm").attr("action","${url}");
			$("#searchForm").submit();
	    	return false;
	    }
	</script>
</head>
<body>
<div class="wrapper wrapper-content">
	<sys:message content="${message}"/>
	<div class="layui-row">
		<div class="full-width fl">
			<div class="layui-row" id="queryDiv">
				<form:form id="searchForm" modelAttribute="obj" action="${url}" method="post" class="form-inline">
					<input type="hidden" name="url" value="${url}"/>
					<input type="hidden" name="type" value="${type}"/>
					<input type="hidden" name="isAll" value="${isAll}"/>
					<input type="hidden" name="isSingle" value="${isSingle}"/>
					<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
					<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
					<table:sortColumn id="orderBy" name="orderBy" value="${page.orderBy}" callback="sortOrRefresh();"/><!-- 支持排序 -->

					<div class="commonQuery ">
						<div class="layui-item query athird">
							<label class="layui-form-label">项目名称:</label>
							<div class="layui-input-block">
								<form:input path="projectName" htmlEscape="false" maxlength="20"  class=" form-control layui-input"/>
							</div>
						</div>
						<div class="layui-item query athird">
							<label class="layui-form-label">项目编号:</label>
							<div class="layui-input-block">
								<form:input path="projectId" htmlEscape="false" maxlength="20"  class=" form-control layui-input"/>
							</div>
						</div>
						<div class="layui-item athird">
							<div class="input-group">
								<a href="#" id="moresee"><i class="glyphicon glyphicon-menu-down"></i></a>
								<button id="searchReset" class="fixed-btn searchReset fr" onclick="resetSearch()">重置</button>
								<button id="searchQuery" class="fixed-btn searchQuery fr" onclick="search()">查询</button>
							</div>
						</div>
						<div style="    clear:both;"></div>
					</div>
					<div id="moresees" style="clear:both;display:none;">

						<div style="clear:both;"></div>
					</div>
				</form:form>
			</div>
		</div>

		<div class="full-width fl">
			<div class="contentShadow layui-form contentDetails">

				<table class="oa-table layui-table" id="contentTable">
					<thead>
					<tr>
						<th width="40" style="text-align: center"><input type="checkbox" class="i-checks"></th>
						<th width="15%" style="text-align: center">项目名称</th>
						<th style="text-align: center">项目编号</th>
						<th style="text-align: center">负责人</th>
						<th width="30%" style="text-align: center">主委托方</th>
					</tr>
					</thead>
					<tbody>
					<c:forEach items="${page.list}" var="obj" varStatus="index">
						<tr id="t${index.index}">
							<td style="text-align:center;"> <input type="checkbox" id="${obj.id}" class="i-checks"></td>
							<td class="codelabel">${obj.projectName}</td>
							<td class="codelabel">${obj.projectId}</td>
							<td class="codelabel">${obj.leaderNameStr}</td>
							<td class="codelabel">${obj.workContractInfo.client.name}</td>
						</tr>
					</c:forEach>

					</tbody>
				</table>

				<!-- 分页代码 -->
				<table:page page="${page}"></table:page>
				<div style="clear: both;"></div>
			</div>
		</div>
	</div>
</div>
</body>
</html>