{% extends "admin_base.html" %}

{% import "admin_page.html" as pg %}
{% block content %}
    <div class="wrap js-check-wrap">
        <div class="jumbotron" >
            <div style="text-align: center">
                <h1 class="display-4">小牛定时任务管理系统</h1>
                <p class="lead">&nbsp;&nbsp;方便、统一、自由</p>
            </div>
        </div>

        <ul class="nav nav-tabs">
            <li><a href="{{ url_for('main.cron_list') }}">任务列表</a></li>
            <li><a href="{{ url_for('main.cron_add') }}">任务添加</a></li>
            <li class="active"><a href="{{ url_for('main.job_log_all_list') }}">任务执行记录</a></li>
            <li><a href="{{ url_for('main.api_doc') }}">API文档</a></li>
            <li><a href="{{ url_for('main.logout') }}">退出</a></li>
        </ul>
        <form class="well form-search" method="get" action="{{ url_for('main.job_log_all_list') }}">
            高级查询：
            <input type="text" placeholder="任务名称" name="task_name" value="{{ keywords.get('task_name') or '' }}">
            <input type="text" name="beg_time" class="js-datetime" value="{{ keywords.get('beg_time') or '' }}" placeholder="开始时间"> -- <input type="text" name="end_time" class="js-datetime" value="{{ keywords.get('end_time') or '' }}" placeholder="结束时间">
            <input type="submit" class="btn btn-primary" value="搜索"/> <a href="{{ url_for('main.job_log_all_list') }}" class="btn btn-danger" >重置</a>
        </form>
        <form method="post" class="js-ajax-form" action="{{ url_for('main.job_batch_delete') }}">
            <div class="table-actions">
                <button type="submit" class="btn btn-primary btn-small js-ajax-submit">批量删除</button>
            </div>
            <table class="table table-hover table-bordered">
                <thead>
                <tr>
                    <th width="15"><label><input type="checkbox" class="js-check-all" data-direction="x"
                                                 data-checklist="js-check-x"></label></th>
                    <th>ID</th>
                    <th>任务名称</th>
                    <th>返回的内容</th>
                    <th>执行时间</th>
                    <th>耗时</th>
                    <th>更详细的执行记录</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                    {% for item in page_data.items %}
                    <tr>
                        <td><input class="js-check" data-yid="js-check-y" data-xid="js-check-x" type="checkbox" name="id" value="{{ item[0].id }}"></td>
                        <td>{{ item[0].id }}</td>
                        <td>{{ item[1].task_name }}</td>
                        <td>{{ item[0].content }}</td>
                        <td>{{ item[0].create_time }}</td>
                        <td>{{ item[0].take_time }}</td>
                        <td><a href="javascript:;" onclick="open_iframe_dialog('{{ url_for('main.job_log_item_list',log_id=item.log_id) }}','详细执行记录',{width: '80%',
        height: '80%'})">查看</a></td>
                        <td><a href="{{ url_for('main.job_log_delete',job_log_id=item[0].id) }}" class="js-ajax-delete">删除</a></td>
                    </tr>
                {% endfor %}
                </tbody>
            </table>
        </form>
     <div class="pagination">
            {{ pg.page(page_data,'main.job_log_all_list',keywords) }}
        </div>
    </div>
{% endblock %}