<%@include file="/WEB-INF/common/layouts/common.jsp" %>
<%@ page language="java" pageEncoding="UTF-8" %>
<html>
<head>
    <title>CmCreditRule列表</title>
</head>
<body>
<%-- <div class="row${fluid}">
    <div class="span6">
        <h2 class="page-title">CmCreditRule列表</h2>
    </div>
    <div class="span6 header_buttons">
        <a href="${ctx}/cmcreditrule?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 class="active" ><span class="divider" style="color:#26a0da;font-weight:bold;">/</span>淘房币规则列表</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}/cmcreditrule" method="get">
				 
				<div class="buttons pull-right" style="margin:3px 30px 0 0;display:none;">
                    <a href="${ctx}/cmcreditrule?action=create" class="btn blue pull-right" title="新增"><i class="icon-plus"></i></a>
                </div>
                
	        </form>
        </div>
    </div>
    <table class="table table-striped table-advance table-hover">
        <thead>
        	<tr>
				<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">所属城市</th>
				<th width="100">所属城市名称</th>
				<th width="100">淘房币规则说明</th>
				<th width="100">创建时间</th>
				<th width="100">更新时间</th>
				<th width="100">有效期限</th> -->
			</tr>
        </thead>
        <c:forEach items="${cmCreditRules}" var="cmCreditRule">
        
        	<c:if test="${cmCreditRule.isShow eq 0}">
        		<tr>
 				<td nowrap="nowrap">
				    <a href="${ctx}/cmcreditrule/${cmCreditRule.id}">						<c:if test="${null ne cmCreditRule.id && '' ne cmCreditRule.id}">
							<c:out value="${cmCreditRule.id}" />
						</c:if>
						<c:if test="${null eq cmCreditRule.id || '' eq cmCreditRule.id}">
							&nbsp;
						</c:if>
</a>
				</td>
				<td nowrap="nowrap">
						<c:if test="${null ne cmCreditRule.creditRuleName && '' ne cmCreditRule.creditRuleName}">
							<c:out value="${cmCreditRule.creditRuleName}" />
						</c:if>
						<c:if test="${null eq cmCreditRule.creditRuleName || '' eq cmCreditRule.creditRuleName}">
							&nbsp;
						</c:if>
				</td>
				<td nowrap="nowrap">
						<c:if test="${null ne cmCreditRule.credits && '' ne cmCreditRule.credits}">
							<c:out value="${cmCreditRule.credits}" />
						</c:if>
						<c:if test="${null eq cmCreditRule.credits || '' eq cmCreditRule.credits}">
							&nbsp;
						</c:if>
				</td>
				<td nowrap="nowrap">
						<c:choose>
                                 <c:when test="${cmCreditRule.id eq 8 || cmCreditRule.id eq 12 || cmCreditRule.id eq 10 || cmCreditRule.id eq 11}">
                                   	不限
                                 </c:when>
                                 <c:when test="${cmCreditRule.id eq 1 || cmCreditRule.id eq 9}">
                                   	一天
                                 </c:when>
                                 <c:otherwise>
							            <c:if test="${null ne cmCreditRule.countCircle && '' ne cmCreditRule.countCircle}">
												<c:choose>
				                                     <c:when test="${cmCreditRule.countCircle == 9999999}">
				                                     	 不限
				                                    </c:when>
				                                     <c:when test="${cmCreditRule.countCircle == 1}">
				                                     	一天
				                                    </c:when>
				                                     <c:when test="${cmCreditRule.countCircle == 7}">
				                                     	 一周
				                                    </c:when>
				                                     <c:when test="${cmCreditRule.countCircle == 30}">
				                                     	 一月
				                                    </c:when>
				                                    <c:otherwise>
														<c:out value="${cmCreditRule.countCircle}" />
				                                    </c:otherwise>
				                                </c:choose>
										</c:if>
										<c:if test="${null eq cmCreditRule.countCircle || '' eq cmCreditRule.countCircle}">
											&nbsp;
										</c:if>
                                 </c:otherwise>
                       </c:choose>
				</td>
				<td nowrap="nowrap">
					<c:choose>
                              <c:when test="${cmCreditRule.id eq 8 || cmCreditRule.id eq 1 || cmCreditRule.id eq 10 || cmCreditRule.id eq 9 || cmCreditRule.id eq 11}">
                                	1 
                              </c:when>
                              <c:when test="${cmCreditRule.id eq 12}">
                                	不限
                              </c:when>
                              <c:otherwise>
				            <c:if test="${null ne cmCreditRule.countLimit && '' ne cmCreditRule.countLimit}">
								<c:out value="${cmCreditRule.countLimit}" />
							</c:if>
							<c:if test="${null eq cmCreditRule.countLimit || '' eq cmCreditRule.countLimit}">
								&nbsp;
							</c:if>
                          </c:otherwise>
                      </c:choose>
				</td>
				<td nowrap="nowrap">
                    <i class="icon-edit pointer icon-large"
						onclick="window.location='${ctx}/cmcreditrule/${cmCreditRule.id}'"></i>
						&nbsp;&nbsp; 
				</td> 
			</tr>
        	</c:if>
        </c:forEach>
    </table>
</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}/cmcreditrule/' + selectedId,
			            type: "DELETE",
			            success: function () {
			                window.location.reload();
			            }
			        });
			    });
			}

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