{layout name="public/layout_main"}

<section class="wrapper">
    <h3><i class="fa fa-angle-right"></i> 日志记录</h3>
    <hr>
    <div class="row margin-bottom">
        <div class="col-md-12">
            <form class="form-inline" method="GET" id="search_from">
                <div class="form-group">
                    <input type="text" class="form-control" name="admin" id="admin" placeholder="管理员" value="<?php echo input('get.admin');?>">
                    <input type="text" class="form-control" name="category" id="category" placeholder="标签" value="<?php echo input('get.category');?>">
                </div>
                <button type="submit" class="btn btn-default margin-left">搜索</button>
            </form>
        </div>
    </div>

    <ul class="nav nav-tabs">
        <li class="<?php if(input('level')=='info'){echo 'active';} ?>">
            <a href="<?php echo url("@admin/Log/index", ['level'=>'info'])?>">信息日志</a>
        </li>
        <li class="<?php if(input('level')=='debug'){echo 'active';} ?>">
            <a href="<?php echo url("@admin/Log/index", ['level'=>'debug'])?>">调试日志</a>
        </li>
        <li class="<?php if(input('level')=='error'){echo 'active';} ?>">
            <a href="<?php echo url("@admin/Log/index", ['level'=>'error'])?>">错误日志</a>
        </li>
    </ul>

    <div class="row">
        <div class="col-md-12">
            <div class="table-responsive">
                <table class="table table-hover table-striped">
                    <thead>
                        <tr>
                            <th>#</th>
                            <th>级别</th>
                            <th>标签</th>
                            <th>内容</th>
                            <th>客户端</th>
                            <th>管理员</th>
                            <th>时间</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php foreach($items as $item):?>
                            <tr id="tr_<?php echo $item->id;?>">
                                <td><?php echo $item->id;?></td>
                                <td>
                                    <?php echo $item->level_text;?>
                                </td>
                                <td>
                                   <?php echo $item->category;?>
                                </td>
                                <td style="max-width:240px;word-break:break-all">
                                    <?php echo $item->message;?>
                                </td>
                                <td style="max-width:240px;word-break:break-all">
                                    <?php echo $item['visitor'];?>
                                </td>
                                <td style="max-width:240px;word-break:break-all">
                                    <?php 
                                        if($item->admin){
                                            echo $item->admin->username;
                                        }else{
                                            echo '来自API';
                                        }
                                    ?>
                                </td>
                                <td><?php echo $item['created_at'];?></td>
                            </tr>
                        <?php endforeach;?>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-md-12">
            {$items->render()}
        </div>
    </div>
</section>

<script type="text/javascript">
$(function(){
    // 右侧详情
    
});
</script>






