<%include ./common.html %>
<div class="panel-content">
    <div class="panel-title">
        <div class="title-main">
            <h2><%= type === 1 ? '用户' : '内部' %>通知
                <a href="/notify/add?type=<%= type %>" class="btn btn-primary btn-sm pull-right">新建通知</a></h2>
        </div>
    </div>
    <div class="content-wrap">
        <div class="c-header">
            <form class="form-inline" method="get" action="">
                <!--变更类型-->
                <div class="btn-group">
                    <button type="button" class="btn btn-default dropdown-toggle btn-sm" data-toggle="dropdown"
                            aria-haspopup="true" aria-expanded="false">
                        <%= filter.status === undefined ? '所有状态' : (filter.status === "1" ? '已发布' : '未发布')%> <span class="caret"></span>
                    </button>
                    <ul class="dropdown-menu selector">
                        <li><a href="javascript:void(0);" data-value="1">已发布</a></li>
                        <li><a href="javascript:void(0);" data-value="0">未发布</a></li>
                    </ul>
                    <input type="hidden" name="status" value="<%= filter.status%>" />
                </div>
                <!--变更类别-->
                <div class="btn-group">
                    <button type="button" class="btn btn-default dropdown-toggle btn-sm" data-toggle="dropdown"
                            aria-haspopup="true" aria-expanded="false">
                        <%= filter.year === undefined ? '所有年' : filter.year %>  <span class="caret"></span>
                    </button>
                    <ul class="dropdown-menu selector">
                        <li><a href="javascript:void(0);" data-value="2015">2015</a></li>
                        <li><a href="javascript:void(0);" data-value="2016">2016</a></li>
                        <li><a href="javascript:void(0);" data-value="2017">2017</a></li>
                    </ul>
                    <input type="hidden" name="year" value="<%= filter.year%>" />
                </div>
                <!--变更性质-->
                <div class="btn-group">
                    <button type="button" class="btn btn-default dropdown-toggle btn-sm" data-toggle="dropdown"
                            aria-haspopup="true" aria-expanded="false">
                        <%= filter.month === undefined ? '所有月' : filter.month %> <span class="caret"></span>
                    </button>
                    <ul class="dropdown-menu selector">
                        <li><a href="javascript:void(0);" data-value="1">1</a></li>
                        <li><a href="javascript:void(0);" data-value="2">2</a></li>
                        <li><a href="javascript:void(0);" data-value="3">3</a></li>
                        <li><a href="javascript:void(0);" data-value="4">4</a></li>
                        <li><a href="javascript:void(0);" data-value="5">5</a></li>
                        <li><a href="javascript:void(0);" data-value="6">6</a></li>
                        <li><a href="javascript:void(0);" data-value="7">7</a></li>
                        <li><a href="javascript:void(0);" data-value="8">8</a></li>
                        <li><a href="javascript:void(0);" data-value="9">9</a></li>
                        <li><a href="javascript:void(0);" data-value="10">10</a></li>
                        <li><a href="javascript:void(0);" data-value="11">11</a></li>
                        <li><a href="javascript:void(0);" data-value="12">12</a></li>
                    </ul>
                    <input type="hidden" name="month" value="<%= filter.month%>" />
                </div>
                <!--搜索-->
                <div class="btn-group">
                    <div class="input-group">
                        <input type="text" class="form-control input-sm" name="keyword" placeholder="输入标题/内容搜索" value="<%= filter.keyword%>">
                        <span class="input-group-btn">
                        <button class="btn btn-default btn-sm" type="submit"><i class="glyphicon glyphicon-search"></i></button>
                    </span>
                    </div>
                </div>
            </form>
        </div>
        <div class="c-body">
            <table class="table">
                <thead>
                <tr>
                    <th>标题</th>
                    <th>创建人</th>
                    <th width="180">发布时间</th>
                    <th width="100">操作</th>
                </tr>
                </thead>
                <tbody>
                <% messageList.forEach(function(message) {%>
                <tr>
                    <td><a href="javascript:void(0)" data-toggle="modal" data-target="#view"><%= message.title %></a></td>
                    <td><%= message.creator %></td>
                    <td><%= message.release_time === 0 ? '未发布' : moment(message.release_time).format('YYYY-MM-DD HH:mm:ss') %></td>
                    <td>
                        <a href="/notify/modify/<%= message._id %>" class="btn btn-xs">编辑</a>
                        <% if(message.status === 0) { %>
                        <a href="/notify/release/<%= message._id %>" class="btn btn-xs">发布</a>
                        <% } %>
                    </td>
                </tr>
                <% }); %>
                </tbody>
            </table>
            <nav aria-label="Page navigation">
                <%include ../layout/page.html %>
            </nav>
        </div>
    </div>
</div>
<script type="text/javascript" src="/web/users/js/message.js"></script>