<%@ page language="java" pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%>
<%@ page isELIgnored="false" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%
    String basePath = request.getContextPath();
%>
<div class="table-responsive">
    <table class="table table-striped table-bordered table-hover " >
        <thead>
        <tr>
            <th>序号</th>
            <th>发布人</th>
            <th>发布时间</th>
            <th>资讯标题</th>
            <th>副标题</th>
            <th>资讯类别</th>
            <th>资讯状态</th>
           <%-- <th class="hidden-print">操 作</th>--%>
        </tr>
        </thead>
        <tbody>
        <c:choose>
            <c:when test="${list!=null}">
                <c:forEach items="${list}" var="item" varStatus="status">
                    <tr>
                        <td>${(pager.pageNo-1)*pager.pageSize+status.count}</td>
                        <td>${item.showname}</td>
                        <td><fmt:formatDate value="${item.createdAt}"  type="Date" pattern="yyyy-MM-dd"/></td>
                        <td>${item.newsTitle}</td>
                        <td>${item.subTitle}</td>
                        <td>${item.newsCategory}</td>
                        <td>${item.newsState}</td>
                       <%-- <td><a href="javascript:void(0)" onclick="fnEdit(this)">编辑</a>&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;<a href="javascript:void(0)" onclick="fnDel(this)">删除</a></td>
                        <input type="hidden" value="${item.id}"/>--%>
                    </tr>
                </c:forEach>
            </c:when>
            <c:otherwise>
                <tr>
                    <td colspan="4">无数据</td>
                </tr>
            </c:otherwise>
        </c:choose>
        </tbody>
    </table>
</div>
<jsp:include page="../../../common/admin/pager.jsp">
    <jsp:param name="pageNo" value="${pager.pageNo}"/>
    <jsp:param name="pageSize" value="${pager.pageSize}"/>
    <jsp:param name="total" value="${pager.total}"/>
</jsp:include>
<script type="text/javascript">

    //编辑
    function fnEdit(tr){
        $.popBsPartial({ url: "<%=basePath%>/admin/consult_mgr/edit.action/"+$(tr).parent().next().val(), size: WySharpSize.Large });
    }

    //删除
    function fnDel(tr){
        if(confirm("真的要删除该资讯吗？")){
           $.get("<%=basePath%>/admin/consult_mgr/delete.action/"+$(tr).parent().next().val(),function(result){
                if(result.stateCode==200){
                    alert(result.msg);
                    window.location.href="<%=basePath%>/admin/consult_mgr/index.htm";
                }else{
                    alert(result.msg);
                }
            });
        }
    }

</script>