@extends('base.base')
@section('base')
    <!-- 内容区域 -->
    <div class="main-panel">
        <div class="content-wrapper">
            <div class="page-header">
                <h3 class="page-title">
                     <span class="page-title-icon bg-gradient-primary text-white mr-2">
                <i class="mdi mdi-wrench"></i>
              </span>
                    {{ trans('messages.管理员操作记录') }}
                </h3>
                <nav aria-label="breadcrumb">
                    <ol class="breadcrumb">
                        <li class="breadcrumb-item"><a href="#">{{ trans('messages.系统设置') }}</a></li>
                        <li class="breadcrumb-item active" aria-current="page">{{ trans('messages.管理员操作记录') }}</li>
                    </ol>
                </nav>
            </div>
            <div class="row">
                <div class="col-lg-12 grid-margin stretch-card">
                    <div class="card">
                        <div class="card-body">
                            <h4 class="card-title">{{ trans('messages.管理员操作记录') }}</h4>
                            <form class="well form-inline margin-top-20" method="get"
                                  action='/admin/admin_log/list'>
                                <div>
                                    @csrf
                                    <spen style="padding-left: 10px">{{ trans('messages.管理员昵称') }}：</spen>
                                    <input class="form-control" type="text" name="nickname" id="admin_id"
                                           placeholder="{{ trans('messages.请输入管理员昵称') }}" style="width: 40%; " value="{{$nickname}}">

                                    <input type="submit" class="btn btn-sm btn-gradient-primary btn-icon-text"
                                           value="{{ trans('messages.搜索') }}"/>&nbsp;&nbsp;
                                    <a href="/admin/admin_log/list" style="color: white">
                                        <button type="button" class="btn btn-sm btn-gradient-dark btn-icon-text">
                                            {{ trans('messages.重置') }}
                                        </button>
                                    </a>
                                </div>
                            </form>
                            <table class="table table-bordered">
                                <thead>
                                <tr>
                                    <th>{{ trans('messages.编号') }}</th>
                                    <th>{{ trans('messages.管理员昵称') }}</th>
                                    <th>{{ trans('messages.操作内容') }}</th>
                                    <th>{{ trans('messages.查看') }}</th>
                                </tr>
                                </thead>
                                <tbody>
                                @foreach($list as $k=>$v)
                                    <tr>
                                        <td>{{ $v->id }}</td>
                                        <td>{{ $v->nickname }}</td>
                                        <td>{{ $v->content }}</td>

                                        <td>
                                            <button type="button" class="btn btn-sm btn-gradient-info" onclick="show({{$v->id}})">
                                                {{ trans('messages.查看') }}
                                            </button>
                                        </td>
                                    </tr>
                                @endforeach
                                </tbody>
                            </table>
                            <div class="box-footer clearfix">
                                {{ trans('messages.总共') }} <b>{{ $list->appends([
    'nickname' => $nickname
])->total() }}</b> {{ trans('messages.条,分为') }}<b>{{ $list->lastPage() }}</b> {{ trans('messages.页') }}
                                {!! $list->links() !!}
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script>
        function add(){
            var page = layer.open({
                type: 2,
                title: '{{ trans('messages.添加IP白名单') }}',
                shadeClose: true,
                shade: 0.8,
                area: ['70%', '90%'],
                content: '/admin/IpWhiteList/add'
            });
        }
        function show(id){
            var page = layer.open({
                type: 2,
                title: '{{ trans('messages.查看指令') }}',
                shadeClose: true,
                shade: 0.8,
                area: ['30%', '50%'],
                content: '/admin/admin_log/show/'+id
            });
        }
        function del(id){
            myConfirm("{{ trans('messages.删除操作不可逆,是否继续?') }}", function(){
                myRequest("/admin/IpWhiteList/del/"+id, "post", {}, function(res){
                    layer.msg(res.msg)
                    setTimeout(function(){
                        window.location.reload();
                    },1500)
                });
            });
        }
    </script>
@endsection
