<%@ page language="java" pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%>
<%@ page import="com.lightinit.hsdataplatform.dictionary.DicNotificationState" %>
<%@ 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 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>${item.notiTitle}</td>
                       <%-- <td>
                            <a href='javascript:void(0);' onclick='fnShowDetailOrder(this)'>${item.userName}</a>
                            <input type="hidden" name="id" value="${item.id}"/>
                        </td>--%>
                        <%--<td>${item.notiState}</td>
                        <td>${item.orderState=="已付款"? item.orderAmount:"0.00"}</td>--%>
                        <td><fmt:formatDate value="${item.createdAt}" pattern="yyyy-MM-dd"></fmt:formatDate></td>
                        <td>${item.publishByString}</td>
                        <td>${item.notiState}</td>
                        <td>
                            <c:if test="${item.notiState==DicNotificationState.waiting}"><a href="javascript:void(0);"  onclick="fnEdit(this)">编辑</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a href="javascript:void(0);"  onclick="fnDel(this)">删除</a></c:if>
                            <c:if test="${item.notiState==DicNotificationState.sended}"><a href="javascript:void(0);"  onclick="fnShowDetail(this)">查看</a></c:if>
                        </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>
<div class="modal fade bs-example-modal-lg" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel">
    <div class="modal-dialog modal-lg" role="document">
        <div class="modal-content">
            <div class="modal-header" >
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="myModalLabel">支付详情</h4>
            </div>
            <div class="modal-content4"></div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">确定</button>
            </div>
        </div>
    </div>
</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/notification_mgr/edit.htm/"+ $(tr).parent().next().val()});
    }

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

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


    function fnShowDetail11(tr) {
        $('#myModal').modal('show');
        /*var tables="<table id='fixedPriceTable' class='table table-hover  table-condensed table-bordered ' align='center'>"+
            "<thead>"+
            "<tr>"+
            "<td>使用方(付款方)</td>"+
            "<td>金额</td>"+
            "<td>付款时间</td>"+
            "<td>类型</td><td>订单号</td>"+
            "</tr></thead><tbody><tr>"+
            "<td>"+$(tr).parent().parent().children('td:eq(2)').text()+"</td>"+
            "<td>"+$(tr).parent().parent().children('td:eq(3)').text()+"</td>"+
            /!*"<td>"+$(tr).parent().parent().children('td:eq(7)').text()+"</td>"+*!/
            "<td>"+$('#paymentTimeId').val()+"</td>"+
            "<td>"+$(tr).parent().parent().children('td:eq(6)').text()+"</td>"+
            "<td>"+$(tr).parent().parent().children('td:eq(1)').text()+"</td>"+
            "</tr></tbody></table>";*/
        var ep2 = $(tr).parent().parent().children('td:eq(2)').text();
        alert(ep2);
        var tables="<input  value='"+ep2+"' disabled/>"
        $('.modal-content4').html(tables);
    }

    function fnShowDetailOrder(tr){
        var id = $(tr).parent().children("input[type='hidden'][name='id']").val();
        $.popBsPartial({ url: "<%=basePath%>/admin/order_mgr/detail.htm/" + id });
    }
</script>
