<%@include file="/WEB-INF/common/layouts/common.jsp" %>
<%@ page language="java" pageEncoding="UTF-8" %>
<html>
<head>
    <title>ProjectSaler列表</title>
</head>
<body>
<%-- <div class="row${fluid}">
    <div class="span6">
        <h2 class="page-title">ProjectSaler列表</h2>
    </div>
    <div class="span6 header_buttons">
        <a href="${ctx}/projectsaler?action=create" class="btn blue pull-right"><i class="icon-plus"></i></a>
    </div>
</div> --%>

<!-- 面包屑 begin -->
<div class="row-fluid">
	<div class="span12">
		<ul class="breadcrumb">
			<!-- <li><a href="/house365-hmc-web/">首页</a> <span class="divider"></span></li> -->
			<li class="active" ><span class="divider" style="color:#26a0da;font-weight:bold;">/</span>ProjectSaler列表</li>
		</ul>
	</div>
</div>
<!-- 面包屑 begin -->

<div class="page-container">
    <div class="row${fluid}">
        <div class="span12">
            <form id="filterForm" class="form-inline filterForm" action="${ctx}/projectsaler" method="get">
				<input type="text" name="search_LIKE_id" value="${param['search_LIKE_id']}" 
					class="m-wrap small" placeholder="Id">
				<input type="text" name="search_LIKE_projectId" value="${param['search_LIKE_projectId']}" 
					class="m-wrap small" placeholder="项目ID">
				<input type="text" name="search_LIKE_projectCode" value="${param['search_LIKE_projectCode']}" 
					class="m-wrap small" placeholder="项目编号">
				<input type="text" name="search_LIKE_projectName" value="${param['search_LIKE_projectName']}" 
					class="m-wrap small" placeholder="项目名称">
				<div class="buttons pull-right"  style="margin-left:15px;">
                    <a href="${ctx}/projectsaler?action=create" class="btn blue pull-right" title="新增"><i class="icon-plus"></i></a>
                </div>
				<div class="buttons pull-right" >
                    <a href="javascript:void(0);" onclick="deleteById('')" class="btn blue pull-right" title="删除"><i class="icon-minus"></i></a>
                </div>
                <div class="buttons pull-right" style="margin:3px 30px 0 0;">
                    <i class="icon-search icon-2x pointer" onclick="$('#filterForm').submit();" title="搜索"></i>
                </div>
	            </form>
        </div>
    </div>
    <table class="table table-striped table-advance table-hover">
        <thead>
        	<tr>
        		<th width="40" style="text-align:center"><input id="memberCheckAll" type="checkbox" onclick="checkAll(this)" /></th>
				<th width="100">Id</th>
				<th width="100">项目ID</th>
				<th width="100">项目编号</th>
				<th width="100">项目名称</th>
				<th width="100">直销人员ID</th>
				<th width="100">直销人员名称</th>
				<th width="100">创建人用户ID</th>
				<th width="100">创建人用户名</th>
				<th width="100">创建时间</th>
				<th width="100">创建人电脑IP</th>
				<th width="100">最后一次修改人用户ID</th>
				<th width="100">最后一次修改人用户名</th>
				<th width="100">最后一次修改时间</th>
				<th width="100">最后一次修改人电脑IP</th>
				<th width="150">操作</th>
			</tr>
        </thead>
        <c:forEach items="${projectSalers}" var="projectSaler">
            <tr>
            	<td nowrap="nowrap" style="text-align:center">
				    <input type="checkbox" name="memberCheck" value="${projectSaler.id}" onclick="checkMember(this)"/>
				</td>
				<td nowrap="nowrap">
				    <a href="${ctx}/projectsaler/${projectSaler.id}">						<c:if test="${null ne projectSaler.id && '' ne projectSaler.id}">
							<c:out value="${projectSaler.id}" />
						</c:if>
						<c:if test="${null eq projectSaler.id || '' eq projectSaler.id}">
							&nbsp;
						</c:if>
</a>
				</td>
				<td nowrap="nowrap">
						<c:if test="${null ne projectSaler.projectId && '' ne projectSaler.projectId}">
							<c:out value="${projectSaler.projectId}" />
						</c:if>
						<c:if test="${null eq projectSaler.projectId || '' eq projectSaler.projectId}">
							&nbsp;
						</c:if>
				</td>
				<td nowrap="nowrap">
						<c:if test="${null ne projectSaler.projectCode && '' ne projectSaler.projectCode}">
							<c:out value="${projectSaler.projectCode}" />
						</c:if>
						<c:if test="${null eq projectSaler.projectCode || '' eq projectSaler.projectCode}">
							&nbsp;
						</c:if>
				</td>
				<td nowrap="nowrap">
						<c:if test="${null ne projectSaler.projectName && '' ne projectSaler.projectName}">
							<c:out value="${projectSaler.projectName}" />
						</c:if>
						<c:if test="${null eq projectSaler.projectName || '' eq projectSaler.projectName}">
							&nbsp;
						</c:if>
				</td>
				<td nowrap="nowrap">
						<c:if test="${null ne projectSaler.userId && '' ne projectSaler.userId}">
							<c:out value="${projectSaler.userId}" />
						</c:if>
						<c:if test="${null eq projectSaler.userId || '' eq projectSaler.userId}">
							&nbsp;
						</c:if>
				</td>
				<td nowrap="nowrap">
						<c:if test="${null ne projectSaler.userName && '' ne projectSaler.userName}">
							<c:out value="${projectSaler.userName}" />
						</c:if>
						<c:if test="${null eq projectSaler.userName || '' eq projectSaler.userName}">
							&nbsp;
						</c:if>
				</td>
				<td nowrap="nowrap">
						<c:if test="${null ne projectSaler.createUserid && '' ne projectSaler.createUserid}">
							<c:out value="${projectSaler.createUserid}" />
						</c:if>
						<c:if test="${null eq projectSaler.createUserid || '' eq projectSaler.createUserid}">
							&nbsp;
						</c:if>
				</td>
				<td nowrap="nowrap">
						<c:if test="${null ne projectSaler.createUsername && '' ne projectSaler.createUsername}">
							<c:out value="${projectSaler.createUsername}" />
						</c:if>
						<c:if test="${null eq projectSaler.createUsername || '' eq projectSaler.createUsername}">
							&nbsp;
						</c:if>
				</td>
				<td nowrap="nowrap">
						<c:if test="${null ne projectSaler.createTime && '' ne projectSaler.createTime}">
							<f:formatDate value='${projectSaler.createTime}' pattern='yyyy-MM-dd HH:mm:ss' />
						</c:if>
						<c:if test="${null eq projectSaler.createTime || '' eq projectSaler.createTime}">
							&nbsp;
						</c:if>
				</td>
				<td nowrap="nowrap">
						<c:if test="${null ne projectSaler.createIp && '' ne projectSaler.createIp}">
							<c:out value="${projectSaler.createIp}" />
						</c:if>
						<c:if test="${null eq projectSaler.createIp || '' eq projectSaler.createIp}">
							&nbsp;
						</c:if>
				</td>
				<td nowrap="nowrap">
						<c:if test="${null ne projectSaler.updateUserid && '' ne projectSaler.updateUserid}">
							<c:out value="${projectSaler.updateUserid}" />
						</c:if>
						<c:if test="${null eq projectSaler.updateUserid || '' eq projectSaler.updateUserid}">
							&nbsp;
						</c:if>
				</td>
				<td nowrap="nowrap">
						<c:if test="${null ne projectSaler.updateUsername && '' ne projectSaler.updateUsername}">
							<c:out value="${projectSaler.updateUsername}" />
						</c:if>
						<c:if test="${null eq projectSaler.updateUsername || '' eq projectSaler.updateUsername}">
							&nbsp;
						</c:if>
				</td>
				<td nowrap="nowrap">
						<c:if test="${null ne projectSaler.updateTime && '' ne projectSaler.updateTime}">
							<f:formatDate value='${projectSaler.updateTime}' pattern='yyyy-MM-dd HH:mm:ss' />
						</c:if>
						<c:if test="${null eq projectSaler.updateTime || '' eq projectSaler.updateTime}">
							&nbsp;
						</c:if>
				</td>
				<td nowrap="nowrap">
						<c:if test="${null ne projectSaler.updateIp && '' ne projectSaler.updateIp}">
							<c:out value="${projectSaler.updateIp}" />
						</c:if>
						<c:if test="${null eq projectSaler.updateIp || '' eq projectSaler.updateIp}">
							&nbsp;
						</c:if>
				</td>
				<td nowrap="nowrap">
                    <i class="icon-edit pointer icon-large"
						onclick="window.location='${ctx}/projectsaler/${projectSaler.id}?action=edit'"></i>
						&nbsp;&nbsp; <i
						title="删除"
						class="icon-minus pointer icon-large"
						onclick="deleteById('${projectSaler.id}')"> </i>
					</td>
			</tr>
        </c:forEach>
    </table>
    <div class="row${fluid}">
        <house365:pagination page="${page}"/>
    </div>
</div>
<script type="text/javascript">
	
	//全选
	function checkAll(btn)       
	{       
		if(btn.checked)
		{
			for(i=0;i<document.all("memberCheck").length;i++)       
			{       
				document.all("memberCheck")[i].checked = "checked";
			}     
		}
		else
		{
			for(i=0;i<document.all("memberCheck").length;i++)       
			{       
				document.all("memberCheck")[i].checked = "";
			}     
		}
	}       
	
	//单选
	function checkMember(btn)
	{
		if(btn.checked)
		{
			var checkAll = true;
			for(i=0;i<document.all("memberCheck").length;i++)       
			{       
				if(document.all("memberCheck")[i].checked == false)
				{
					checkAll = false;
				}
			}     
			
			if(checkAll)
			{
				document.getElementById("memberCheckAll").checked = true;   
			}
		}
		else
		{
			document.getElementById("memberCheckAll").checked = false;   
		}
	}

	var deleteById = function (selectedId) {
		/*
		id为空则是多选  判断是否为空
		为空 提示选择
		不为空 确认后删除
		不为空单选确认后删除
		*/
			if(selectedId == "")
			{
				for(i=0;i<document.getElementsByName('memberCheck').length;i++)       
	    		{       
	    			if(document.getElementsByName('memberCheck')[i].checked)
	    			{
	    				selectedId += document.getElementsByName('memberCheck')[i].value + ",";
	    			}
	    		}     
	    		
	    		var str = "";
	    		if(selectedId != "")
	    		{
	    			str = selectedId.split(",");
	    			
	    			if(str[str.length-1] == "")
	    			{
	    				selectedId = selectedId.substring(0,selectedId.length-1);
	    			}
	    		}
			}
			
			if(selectedId == "")
			{
				House365Util.createModal("删除公告", "请至少选择一条公告!", function () {
			    });
			}
			else
				{
				House365Util.createModal("删除公告", "确定要删除该公告？", function () {
			        $.ajax({
			            url: '${ctx}/projectsaler/' + selectedId,
			            type: "DELETE",
			            success: function () {
			                window.location.reload();
			            }
			        });
			    });
			}

	};
    
</script>
</body>
</html>
