<%@ page language="java" pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%>
<%@ page import="com.lightinit.hsdataplatform.dictionary.DicLeaveMessageState"%>
<%@ 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 " id="tablesOrder"  >
        <thead>
        <tr>
            <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="${outputModel!=null}">
                <c:forEach items="${outputModel}" var="item" varStatus="status">
                    <tr>
                        <td>${(pager.pageNo-1)*pager.pageSize+status.count}</td>
                        <td><fmt:formatDate value="${item.createdAt}" pattern="yyyy-MM-dd"></fmt:formatDate></td>
                        <td>${item.publishByString}</td>
                        <td>${item.msgContent}</td>
                        <td>${item.phone}</td>
                        <td>${item.msgState}</td>
                        <td>
                            <c:if test="${item.msgState==DicLeaveMessageState.WATING}"><a href="javascript:void(0);"  onclick="fnEdit(this)">编辑</a></c:if>
                            <c:if test="${item.msgState==DicLeaveMessageState.DONE}"><a href="javascript:void(0);"  onclick="fnShowDetail(this)">查看</a></c:if>
                            &nbsp;&nbsp;|&nbsp;&nbsp;<a href="javascript:void(0);"  onclick="fnDel(this)">删除</a>
                        </td>
                        <input  type="hidden" id="id" 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/leavemessage_mgr/edit.htm/"+ $(tr).parent().next().val()});
    }

    //删除
    function fnDel(tr){
        $.delWithConfirm({ func: $.ajaxGetRefresh, funcArgs: { ajaxGetOptions: { url: "<%=basePath%>/admin/leavemessage_mgr/delete.action/" + $(tr).parent().next().val() } } });
    }

  //显示详情
    function fnShowDetail(tr){
        $.popBsPartial({ url: "<%=basePath%>/admin/leavemessage_mgr/detail.htm/" + $(tr).parent().next().val() });
    }

</script>
