<%@include file="/WEB-INF/common/layouts/common.jsp" %>
<%@ page language="java" pageEncoding="UTF-8" %>
<html>
<head>
    <title>驻场日报列表</title>
</head>
<body>
<%-- <div class="row${fluid}">
    <div class="span6">
        <h2 class="page-title">驻场日报列表</h2>
    </div>
    <div class="span6 header_buttons">
        <a href="${ctx}/localreport?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>驻场日报列表</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}/localreport" 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_channelId" value="${param['search_LIKE_channelId']}" 
					class="m-wrap small" placeholder="渠道ID">
				<input type="text" name="search_LIKE_departId" value="${param['search_LIKE_departId']}" 
					class="m-wrap small" placeholder="部门ID">
				<input type="text" name="search_LIKE_name" value="${param['search_LIKE_name']}" 
					class="m-wrap small" placeholder="职员">
				<div class="buttons pull-right"  style="margin-left:15px;">
                    <a href="${ctx}/localreport?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">部门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">city</th>
				<th width="100">预留</th>
				<th width="100">creater</th>
				<th width="100">createTime</th>
				<th width="100">lastModifier</th>
				<th width="100">updateTime</th>
				<th width="100">数据日期</th>
				<th width="100">认筹</th>
				<th width="150">操作</th>
			</tr>
        </thead>
        <c:forEach items="${localReports}" var="localReport">
            <tr>
            	<td nowrap="nowrap" style="text-align:center">
				    <input type="checkbox" name="memberCheck" value="${localReport.id}" onclick="checkMember(this)"/>
				</td>
				<td nowrap="nowrap">
				    <a href="${ctx}/localreport/${localReport.id}">						<c:if test="${null ne localReport.id && '' ne localReport.id}">
							<c:out value="${localReport.id}" />
						</c:if>
						<c:if test="${null eq localReport.id || '' eq localReport.id}">
							&nbsp;
						</c:if>
</a>
				</td>
				<td nowrap="nowrap">
						<c:if test="${null ne localReport.channelId && '' ne localReport.channelId}">
							<c:out value="${localReport.channelId}" />
						</c:if>
						<c:if test="${null eq localReport.channelId || '' eq localReport.channelId}">
							&nbsp;
						</c:if>
				</td>
				<td nowrap="nowrap">
						<c:if test="${null ne localReport.departId && '' ne localReport.departId}">
							<c:out value="${localReport.departId}" />
						</c:if>
						<c:if test="${null eq localReport.departId || '' eq localReport.departId}">
							&nbsp;
						</c:if>
				</td>
				<td nowrap="nowrap">
						<c:if test="${null ne localReport.name && '' ne localReport.name}">
							<c:out value="${localReport.name}" />
						</c:if>
						<c:if test="${null eq localReport.name || '' eq localReport.name}">
							&nbsp;
						</c:if>
				</td>
				<td nowrap="nowrap">
						<c:if test="${null ne localReport.record && '' ne localReport.record}">
							<c:out value="${localReport.record}" />
						</c:if>
						<c:if test="${null eq localReport.record || '' eq localReport.record}">
							&nbsp;
						</c:if>
				</td>
				<td nowrap="nowrap">
						<c:if test="${null ne localReport.visit && '' ne localReport.visit}">
							<c:out value="${localReport.visit}" />
						</c:if>
						<c:if test="${null eq localReport.visit || '' eq localReport.visit}">
							&nbsp;
						</c:if>
				</td>
				<td nowrap="nowrap">
						<c:if test="${null ne localReport.buy && '' ne localReport.buy}">
							<c:out value="${localReport.buy}" />
						</c:if>
						<c:if test="${null eq localReport.buy || '' eq localReport.buy}">
							&nbsp;
						</c:if>
				</td>
				<td nowrap="nowrap">
						<c:if test="${null ne localReport.score && '' ne localReport.score}">
							<c:out value="${localReport.score}" />
						</c:if>
						<c:if test="${null eq localReport.score || '' eq localReport.score}">
							&nbsp;
						</c:if>
				</td>
				<td nowrap="nowrap">
						<c:if test="${null ne localReport.city && '' ne localReport.city}">
							<c:out value="${localReport.city}" />
						</c:if>
						<c:if test="${null eq localReport.city || '' eq localReport.city}">
							&nbsp;
						</c:if>
				</td>
				<td nowrap="nowrap">
						<c:if test="${null ne localReport.status && '' ne localReport.status}">
							<c:out value="${localReport.status}" />
						</c:if>
						<c:if test="${null eq localReport.status || '' eq localReport.status}">
							&nbsp;
						</c:if>
				</td>
				<td nowrap="nowrap">
						<c:if test="${null ne localReport.creater && '' ne localReport.creater}">
							<c:out value="${localReport.creater}" />
						</c:if>
						<c:if test="${null eq localReport.creater || '' eq localReport.creater}">
							&nbsp;
						</c:if>
				</td>
				<td nowrap="nowrap">
						<c:if test="${null ne localReport.createTime && '' ne localReport.createTime}">
							<f:formatDate value='${localReport.createTime}' pattern='yyyy-MM-dd HH:mm:ss' />
						</c:if>
						<c:if test="${null eq localReport.createTime || '' eq localReport.createTime}">
							&nbsp;
						</c:if>
				</td>
				<td nowrap="nowrap">
						<c:if test="${null ne localReport.lastModifier && '' ne localReport.lastModifier}">
							<c:out value="${localReport.lastModifier}" />
						</c:if>
						<c:if test="${null eq localReport.lastModifier || '' eq localReport.lastModifier}">
							&nbsp;
						</c:if>
				</td>
				<td nowrap="nowrap">
						<c:if test="${null ne localReport.updateTime && '' ne localReport.updateTime}">
							<f:formatDate value='${localReport.updateTime}' pattern='yyyy-MM-dd HH:mm:ss' />
						</c:if>
						<c:if test="${null eq localReport.updateTime || '' eq localReport.updateTime}">
							&nbsp;
						</c:if>
				</td>
				<td nowrap="nowrap">
						<c:if test="${null ne localReport.reportDate && '' ne localReport.reportDate}">
							<f:formatDate value='${localReport.reportDate}' pattern='yyyy-MM-dd HH:mm:ss' />
						</c:if>
						<c:if test="${null eq localReport.reportDate || '' eq localReport.reportDate}">
							&nbsp;
						</c:if>
				</td>
				<td nowrap="nowrap">
						<c:if test="${null ne localReport.buyorder && '' ne localReport.buyorder}">
							<c:out value="${localReport.buyorder}" />
						</c:if>
						<c:if test="${null eq localReport.buyorder || '' eq localReport.buyorder}">
							&nbsp;
						</c:if>
				</td>
				<td nowrap="nowrap">
                    <i class="icon-edit pointer icon-large"
						onclick="window.location='${ctx}/localreport/${localReport.id}?action=edit'"></i>
						&nbsp;&nbsp; <i
						title="删除"
						class="icon-minus pointer icon-large"
						onclick="deleteById('${localReport.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}/localreport/' + selectedId,
			            type: "DELETE",
			            success: function () {
			                window.location.reload();
			            }
			        });
			    });
			}

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