{template "header.html"}

<link href="{THEME_PATH}assets/global/plugins/bootstrap-daterangepicker/daterangepicker.min.css" rel="stylesheet" type="text/css" />
<link href="{THEME_PATH}assets/global/plugins/bootstrap-datepicker/css/bootstrap-datepicker3.min.css" rel="stylesheet" type="text/css" />
<link href="{THEME_PATH}assets/global/plugins/bootstrap-timepicker/css/bootstrap-timepicker.min.css" rel="stylesheet" type="text/css" />
<link href="{THEME_PATH}assets/global/plugins/bootstrap-datetimepicker/css/bootstrap-datetimepicker.min.css" rel="stylesheet" type="text/css" />
<script src="{THEME_PATH}assets/global/plugins/bootstrap-datepicker/js/bootstrap-datepicker.finecms.js" type="text/javascript"></script>

<script type="text/javascript">
    if (App.isAngularJsApp() === false) {
        jQuery(document).ready(function() {
            if (jQuery().datepicker) {
                $('.date-picker').datepicker({
                    rtl: App.isRTL(),
                    orientation: "left",
                    autoclose: true
                });
            }
        });
    }
</script>

<div class="note note-danger">
    <p>
        {if $run_time}
        <font color="green">{dr_lang('最近自动执行时间为：%s', $run_time)}</font>
        {else}
        <font color="red">{dr_lang('当前服务器没有设置自动任务脚本')}</font>
        {/if}
    </p>
</div>
<div class="right-card-box">

    <div class="row table-search-tool">
        <form action="{SELF}" method="get">
            {dr_form_search_hidden(['field' => 'type'])}
            <div class="col-md-12 col-sm-12">
                <label><select name="keyword" class="form-control">
                    <option value="">--</option>
                    {loop $type $i $t}
                    <option value="{$i}" {if $param.keyword == $i} selected{/if}>{$t}</option>
                    {/loop}
                </select></label>
            </div>
            <div class="col-md-12 col-sm-12">
                <label>
                    <div class="input-group input-medium date-picker input-daterange" data-date="" data-date-format="yyyy-mm-dd">
                        <input type="text" class="form-control" value="{$param.date_form}" name="date_form">
                        <span class="input-group-addon"> {dr_lang('到')} </span>
                        <input type="text" class="form-control" value="{$param.date_to}" name="date_to">
                    </div>
                </label>
            </div>


            <div class="col-md-12 col-sm-12">
                <label><button type="submit" class="btn green btn-sm onloading" name="submit" > <i class="fa fa-search"></i> {dr_lang('搜索')}</button></label>
            </div>
        </form>
    </div>


    <form class="form-horizontal" role="form" id="myform">
        {dr_form_hidden()}
        <div class="table-scrollable">
            <table class="table table-striped table-bordered table-hover table-checkable dataTable">
                <thead>
                <tr class="heading">
                    <th class="myselect">
                        <label class="mt-table mt-checkbox mt-checkbox-single mt-checkbox-outline">
                            <input type="checkbox" class="group-checkable" data-set=".checkboxes" />
                            <span></span>
                        </label>
                    </th>
                    <th width="110" class="{dr_sorting('type')}" name="type">{dr_lang('类型')}</th>
                    <th class="{dr_sorting('inputtime')}" name="inputtime" width="170">{dr_lang('录入时间')}</th>
                    <th class="{dr_sorting('updatetime')}" name="updatetime" width="170">{dr_lang('执行时间')}</th>
                    <th style="text-align:center" width="100" class="{dr_sorting('status')}" name="status">{dr_lang('状态')}</th>
                    <th></th>
                </tr>
                </thead>
                <tbody>
                {loop $list $t}
                <tr class="odd gradeX" id="dr_row_{$t.id}">
                    <td class="myselect">
                        <label class="mt-table mt-checkbox mt-checkbox-single mt-checkbox-outline">
                            <input type="checkbox" class="checkboxes" name="ids[]" value="{$t.id}" />
                            <span></span>
                        </label>
                    </td>
                    <td>{$type[$t.type]}</td>
                    <td>{dr_date($t.inputtime, null, 'red')}</td>
                    <td>{dr_date($t.updatetime, null, 'red')}</td>
                    <td style="text-align:center">
                        <label>{if $t.status}<a href="javascript:;" onclick="dr_iframe_show('{dr_lang('执行情况')}', '{dr_url($uriprefix.'/show')}&id={$t.id}')" class="label label-sm label-danger">{dr_lang('查看错误')}</a>{else}<span class="label label-sm label-warning">{dr_lang('待执行')}</span>{/if}</label>
                    </td>
                    <td>
                        <label><a href="javascript:;" class="btn blue btn-xs" onclick="dr_ajax_option('{dr_url($uriprefix.'/do_add')}&id={$t.id}', '{dr_lang('你确定要立即执行它吗？')}', 1)"> <i class="fa fa-refresh"></i> {dr_lang('立即执行')}</a> </label>
                        <label><a href="javascript:;" class="btn green btn-xs" onclick="dr_iframe_show('{dr_lang('执行情况')}', '{dr_url($uriprefix.'/show')}&id={$t.id}')">{dr_lang('查看参数')}</a></label>
                        {if $t.error}
                        <label><a href="javascript:;" class="btn red btn-xs" onclick="dr_iframe_show('{dr_lang('执行情况')}', '{dr_url($uriprefix.'/show')}&id={$t.id}')">{dr_lang('已经执行%s次', $t.status)}</a></label>
                        {/if}
                    </td>
                </tr>
                {/loop}
                </tbody>
            </table>
        </div>

        <div class="row fc-list-footer table-checkable ">
            <div class="col-md-5 fc-list-select">
                <label class="mt-table mt-checkbox mt-checkbox-single mt-checkbox-outline">
                    <input type="checkbox" class="group-checkable" data-set=".checkboxes" />
                    <span></span>
                </label>
                {if $ci->_is_admin_auth('del')}
                <button type="button" onclick="dr_ajax_option('{dr_url($uriprefix.'/del')}', '{dr_lang('你确定要删除它们吗？')}', 1)" class="btn red btn-sm"> <i class="fa fa-trash"></i> {dr_lang('删除')}</button>
                {/if}
                <button type="button" onclick="dr_ajax_option('{dr_url($uriprefix.'/post_add')}', '{dr_lang('你确定要批量执行它们吗？')}', 1)" class="btn blue btn-sm"> <i class="fa fa-refresh"></i> {dr_lang('批量执行')}</button>
            </div>
            <div class="col-md-7 fc-list-page">
                {$mypages}
            </div>
        </div>
    </form>
</div>

{template "footer.html"}