<%@include file="/WEB-INF/common/layouts/common.jsp" %>
<%@ page language="java" pageEncoding="UTF-8" %>
<html>
<head>
    <title>CmExchangeCodeBatch列表</title>
</head>
<body>
<%-- <div class="row${fluid}">
    <div class="span6">
        <h2 class="page-title">CmExchangeCodeBatch列表</h2>
    </div>
    <div class="span6 header_buttons">
        <a href="${ctx}/cmexchangecodebatch?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>CmExchangeCodeBatch列表</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}/cmexchangecodebatch" 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_goodId" value="${param['search_LIKE_goodId']}" 
					class="m-wrap small" placeholder="商品id">
				<input type="text" name="search_LIKE_fileName" value="${param['search_LIKE_fileName']}" 
					class="m-wrap small" placeholder="文件名">
				<input type="text" name="search_LIKE_createrId" value="${param['search_LIKE_createrId']}" 
					class="m-wrap small" placeholder="创建人ID">
				<div class="buttons pull-right"  style="margin-left:15px;">
                    <a href="${ctx}/cmexchangecodebatch?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">创建人ID</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="150">操作</th>
			</tr>
        </thead>
        <c:forEach items="${cmExchangeCodeBatchs}" var="cmExchangeCodeBatch">
            <tr>
            	<td nowrap="nowrap" style="text-align:center">
				    <input type="checkbox" name="memberCheck" value="${cmExchangeCodeBatch.id}" onclick="checkMember(this)"/>
				</td>
				<td nowrap="nowrap">
				    <a href="${ctx}/cmexchangecodebatch/${cmExchangeCodeBatch.id}">						<c:if test="${null ne cmExchangeCodeBatch.id && '' ne cmExchangeCodeBatch.id}">
							<c:out value="${cmExchangeCodeBatch.id}" />
						</c:if>
						<c:if test="${null eq cmExchangeCodeBatch.id || '' eq cmExchangeCodeBatch.id}">
							&nbsp;
						</c:if>
</a>
				</td>
				<td nowrap="nowrap">
						<c:if test="${null ne cmExchangeCodeBatch.goodId && '' ne cmExchangeCodeBatch.goodId}">
							<c:out value="${cmExchangeCodeBatch.goodId}" />
						</c:if>
						<c:if test="${null eq cmExchangeCodeBatch.goodId || '' eq cmExchangeCodeBatch.goodId}">
							&nbsp;
						</c:if>
				</td>
				<td nowrap="nowrap">
						<c:if test="${null ne cmExchangeCodeBatch.fileName && '' ne cmExchangeCodeBatch.fileName}">
							<c:out value="${cmExchangeCodeBatch.fileName}" />
						</c:if>
						<c:if test="${null eq cmExchangeCodeBatch.fileName || '' eq cmExchangeCodeBatch.fileName}">
							&nbsp;
						</c:if>
				</td>
				<td nowrap="nowrap">
						<c:if test="${null ne cmExchangeCodeBatch.createrId && '' ne cmExchangeCodeBatch.createrId}">
							<c:out value="${cmExchangeCodeBatch.createrId}" />
						</c:if>
						<c:if test="${null eq cmExchangeCodeBatch.createrId || '' eq cmExchangeCodeBatch.createrId}">
							&nbsp;
						</c:if>
				</td>
				<td nowrap="nowrap">
						<c:if test="${null ne cmExchangeCodeBatch.createrName && '' ne cmExchangeCodeBatch.createrName}">
							<c:out value="${cmExchangeCodeBatch.createrName}" />
						</c:if>
						<c:if test="${null eq cmExchangeCodeBatch.createrName || '' eq cmExchangeCodeBatch.createrName}">
							&nbsp;
						</c:if>
				</td>
				<td nowrap="nowrap">
						<c:if test="${null ne cmExchangeCodeBatch.startTime && '' ne cmExchangeCodeBatch.startTime}">
							<f:formatDate value='${cmExchangeCodeBatch.startTime}' pattern='yyyy-MM-dd HH:mm:ss' />
						</c:if>
						<c:if test="${null eq cmExchangeCodeBatch.startTime || '' eq cmExchangeCodeBatch.startTime}">
							&nbsp;
						</c:if>
				</td>
				<td nowrap="nowrap">
						<c:if test="${null ne cmExchangeCodeBatch.endTime && '' ne cmExchangeCodeBatch.endTime}">
							<f:formatDate value='${cmExchangeCodeBatch.endTime}' pattern='yyyy-MM-dd HH:mm:ss' />
						</c:if>
						<c:if test="${null eq cmExchangeCodeBatch.endTime || '' eq cmExchangeCodeBatch.endTime}">
							&nbsp;
						</c:if>
				</td>
				<td nowrap="nowrap">
						<c:if test="${null ne cmExchangeCodeBatch.createTime && '' ne cmExchangeCodeBatch.createTime}">
							<f:formatDate value='${cmExchangeCodeBatch.createTime}' pattern='yyyy-MM-dd HH:mm:ss' />
						</c:if>
						<c:if test="${null eq cmExchangeCodeBatch.createTime || '' eq cmExchangeCodeBatch.createTime}">
							&nbsp;
						</c:if>
				</td>
				<td nowrap="nowrap">
						<c:if test="${null ne cmExchangeCodeBatch.cityId && '' ne cmExchangeCodeBatch.cityId}">
							<c:out value="${cmExchangeCodeBatch.cityId}" />
						</c:if>
						<c:if test="${null eq cmExchangeCodeBatch.cityId || '' eq cmExchangeCodeBatch.cityId}">
							&nbsp;
						</c:if>
				</td>
				<td nowrap="nowrap">
						<c:if test="${null ne cmExchangeCodeBatch.cityKey && '' ne cmExchangeCodeBatch.cityKey}">
							<c:out value="${cmExchangeCodeBatch.cityKey}" />
						</c:if>
						<c:if test="${null eq cmExchangeCodeBatch.cityKey || '' eq cmExchangeCodeBatch.cityKey}">
							&nbsp;
						</c:if>
				</td>
				<td nowrap="nowrap">
						<c:if test="${null ne cmExchangeCodeBatch.cityName && '' ne cmExchangeCodeBatch.cityName}">
							<c:out value="${cmExchangeCodeBatch.cityName}" />
						</c:if>
						<c:if test="${null eq cmExchangeCodeBatch.cityName || '' eq cmExchangeCodeBatch.cityName}">
							&nbsp;
						</c:if>
				</td>
				<td nowrap="nowrap">
						<c:if test="${null ne cmExchangeCodeBatch.isDeleted && '' ne cmExchangeCodeBatch.isDeleted}">
							<c:out value="${cmExchangeCodeBatch.isDeleted}" />
						</c:if>
						<c:if test="${null eq cmExchangeCodeBatch.isDeleted || '' eq cmExchangeCodeBatch.isDeleted}">
							&nbsp;
						</c:if>
				</td>
				<td nowrap="nowrap">
                    <i class="icon-edit pointer icon-large"
						onclick="window.location='${ctx}/cmexchangecodebatch/${cmExchangeCodeBatch.id}?action=edit'"></i>
						&nbsp;&nbsp; <i
						title="删除"
						class="icon-minus pointer icon-large"
						onclick="deleteById('${cmExchangeCodeBatch.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}/cmexchangecodebatch/' + selectedId,
			            type: "DELETE",
			            success: function () {
			                window.location.reload();
			            }
			        });
			    });
			}

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