<%@include file="/WEB-INF/common/layouts/common.jsp" %>
<%@ page language="java" pageEncoding="UTF-8" %>
<html>
<head>
    <title>CmBroker列表</title>
</head>
<body>
<%-- <div class="row${fluid}">
    <div class="span6">
        <h2 class="page-title">CmBroker列表</h2>
    </div>
    <div class="span6 header_buttons">
        <a href="${ctx}/cmbroker?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>CmBroker列表</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}/cmbroker" method="get">
				<input type="text" name="search_LIKE_id" value="${param['search_LIKE_id']}" 
					class="m-wrap small" placeholder="编号">
				<input type="text" name="search_LIKE_brokerId" value="${param['search_LIKE_brokerId']}" 
					class="m-wrap small" placeholder="经纪人编号">
				<input type="text" name="search_LIKE_brokerName" value="${param['search_LIKE_brokerName']}" 
					class="m-wrap small" placeholder="经纪人名称">
				<input type="text" name="search_LIKE_brokerPhone" value="${param['search_LIKE_brokerPhone']}" 
					class="m-wrap small" placeholder="经纪人手机号">
				<div class="buttons pull-right"  style="margin-left:15px;">
                    <a href="${ctx}/cmbroker?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">编号</th>
				<th width="100">经纪人编号</th>
				<th width="100">经纪人名称</th>
				<th width="100">经纪人手机号</th>
				<th width="100">经纪人公司名称</th>
				<th width="100">总评论数</th>
				<th width="100">5星星数量</th>
				<th width="100">4星星数量</th>
				<th width="100">3星星数量</th>
				<th width="100">2星星数量</th>
				<th width="100">1星星数量</th>
				<th width="100">最早评论时间</th>
				<th width="100">标签编号-逗号分隔</th>
				<th width="100">城市编号</th>
				<th width="100">城市名称</th>
				<th width="100">是否删除</th>
				<th width="150">操作</th>
			</tr>
        </thead>
        <c:forEach items="${cmBrokers}" var="cmBroker">
            <tr>
            	<td nowrap="nowrap" style="text-align:center">
				    <input type="checkbox" name="memberCheck" value="${cmBroker.id}" onclick="checkMember(this)"/>
				</td>
				<td nowrap="nowrap">
				    <a href="${ctx}/cmbroker/${cmBroker.id}">						<c:if test="${null ne cmBroker.id && '' ne cmBroker.id}">
							<c:out value="${cmBroker.id}" />
						</c:if>
						<c:if test="${null eq cmBroker.id || '' eq cmBroker.id}">
							&nbsp;
						</c:if>
</a>
				</td>
				<td nowrap="nowrap">
						<c:if test="${null ne cmBroker.brokerId && '' ne cmBroker.brokerId}">
							<c:out value="${cmBroker.brokerId}" />
						</c:if>
						<c:if test="${null eq cmBroker.brokerId || '' eq cmBroker.brokerId}">
							&nbsp;
						</c:if>
				</td>
				<td nowrap="nowrap">
						<c:if test="${null ne cmBroker.brokerName && '' ne cmBroker.brokerName}">
							<c:out value="${cmBroker.brokerName}" />
						</c:if>
						<c:if test="${null eq cmBroker.brokerName || '' eq cmBroker.brokerName}">
							&nbsp;
						</c:if>
				</td>
				<td nowrap="nowrap">
						<c:if test="${null ne cmBroker.brokerPhone && '' ne cmBroker.brokerPhone}">
							<c:out value="${cmBroker.brokerPhone}" />
						</c:if>
						<c:if test="${null eq cmBroker.brokerPhone || '' eq cmBroker.brokerPhone}">
							&nbsp;
						</c:if>
				</td>
				<td nowrap="nowrap">
						<c:if test="${null ne cmBroker.brokerCompanyName && '' ne cmBroker.brokerCompanyName}">
							<c:out value="${cmBroker.brokerCompanyName}" />
						</c:if>
						<c:if test="${null eq cmBroker.brokerCompanyName || '' eq cmBroker.brokerCompanyName}">
							&nbsp;
						</c:if>
				</td>
				<td nowrap="nowrap">
						<c:if test="${null ne cmBroker.totalCommetAmount && '' ne cmBroker.totalCommetAmount}">
							<c:out value="${cmBroker.totalCommetAmount}" />
						</c:if>
						<c:if test="${null eq cmBroker.totalCommetAmount || '' eq cmBroker.totalCommetAmount}">
							&nbsp;
						</c:if>
				</td>
				<td nowrap="nowrap">
						<c:if test="${null ne cmBroker.fiveStarAmount && '' ne cmBroker.fiveStarAmount}">
							<c:out value="${cmBroker.fiveStarAmount}" />
						</c:if>
						<c:if test="${null eq cmBroker.fiveStarAmount || '' eq cmBroker.fiveStarAmount}">
							&nbsp;
						</c:if>
				</td>
				<td nowrap="nowrap">
						<c:if test="${null ne cmBroker.fourStarAmount && '' ne cmBroker.fourStarAmount}">
							<c:out value="${cmBroker.fourStarAmount}" />
						</c:if>
						<c:if test="${null eq cmBroker.fourStarAmount || '' eq cmBroker.fourStarAmount}">
							&nbsp;
						</c:if>
				</td>
				<td nowrap="nowrap">
						<c:if test="${null ne cmBroker.threeStarAmount && '' ne cmBroker.threeStarAmount}">
							<c:out value="${cmBroker.threeStarAmount}" />
						</c:if>
						<c:if test="${null eq cmBroker.threeStarAmount || '' eq cmBroker.threeStarAmount}">
							&nbsp;
						</c:if>
				</td>
				<td nowrap="nowrap">
						<c:if test="${null ne cmBroker.twoStarAmount && '' ne cmBroker.twoStarAmount}">
							<c:out value="${cmBroker.twoStarAmount}" />
						</c:if>
						<c:if test="${null eq cmBroker.twoStarAmount || '' eq cmBroker.twoStarAmount}">
							&nbsp;
						</c:if>
				</td>
				<td nowrap="nowrap">
						<c:if test="${null ne cmBroker.oneStarAmount && '' ne cmBroker.oneStarAmount}">
							<c:out value="${cmBroker.oneStarAmount}" />
						</c:if>
						<c:if test="${null eq cmBroker.oneStarAmount || '' eq cmBroker.oneStarAmount}">
							&nbsp;
						</c:if>
				</td>
				<td nowrap="nowrap">
						<c:if test="${null ne cmBroker.earliestCommentTime && '' ne cmBroker.earliestCommentTime}">
							<f:formatDate value='${cmBroker.earliestCommentTime}' pattern='yyyy-MM-dd HH:mm:ss' />
						</c:if>
						<c:if test="${null eq cmBroker.earliestCommentTime || '' eq cmBroker.earliestCommentTime}">
							&nbsp;
						</c:if>
				</td>
				<td nowrap="nowrap">
						<c:if test="${null ne cmBroker.labels && '' ne cmBroker.labels}">
							<c:out value="${cmBroker.labels}" />
						</c:if>
						<c:if test="${null eq cmBroker.labels || '' eq cmBroker.labels}">
							&nbsp;
						</c:if>
				</td>
				<td nowrap="nowrap">
						<c:if test="${null ne cmBroker.cityId && '' ne cmBroker.cityId}">
							<c:out value="${cmBroker.cityId}" />
						</c:if>
						<c:if test="${null eq cmBroker.cityId || '' eq cmBroker.cityId}">
							&nbsp;
						</c:if>
				</td>
				<td nowrap="nowrap">
						<c:if test="${null ne cmBroker.cityName && '' ne cmBroker.cityName}">
							<c:out value="${cmBroker.cityName}" />
						</c:if>
						<c:if test="${null eq cmBroker.cityName || '' eq cmBroker.cityName}">
							&nbsp;
						</c:if>
				</td>
				<td nowrap="nowrap">
						<c:if test="${null ne cmBroker.isDeleted && '' ne cmBroker.isDeleted}">
							<c:out value="${cmBroker.isDeleted}" />
						</c:if>
						<c:if test="${null eq cmBroker.isDeleted || '' eq cmBroker.isDeleted}">
							&nbsp;
						</c:if>
				</td>
				<td nowrap="nowrap">
                    <i class="icon-edit pointer icon-large"
						onclick="window.location='${ctx}/cmbroker/${cmBroker.id}?action=edit'"></i>
						&nbsp;&nbsp; <i
						title="删除"
						class="icon-minus pointer icon-large"
						onclick="deleteById('${cmBroker.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}/cmbroker/' + selectedId,
			            type: "DELETE",
			            success: function () {
			                window.location.reload();
			            }
			        });
			    });
			}

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