@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-settings"></i>
                    </span>
                    {{ __('auto.举报') }}
                </h3>
                <nav aria-label="breadcrumb">
                    <ol class="breadcrumb">
                        <li class="breadcrumb-item"><a href="#">{{ __('auto.举报管理') }}</a></li>
                        <li class="breadcrumb-item active" aria-current="page">{{ __('auto.举报列表') }}</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">{{ __('auto.举报列表') }}</h4>
                            <form class="well form-inline margin-top-20" method="get" action='/admin/complaint/accusation'>
                                {{ __('auto.举报人：') }}
                                <input class="form-control" type="text" name="plaintiff_uid" style="width: 8%; " value="{{$plaintiff_uid}}" placeholder="{{ __('auto.请输入举报人') }}">
                                <span style="padding-left: 5px" >{{ __('auto.被举报人：') }}</span >
                                <input class="form-control" type="text" name="defendant_uid" style="width: 8%;" value="{{$defendant_uid}}" placeholder="{{ __('auto.请输入被举报人') }}">
                                <span style="padding-left: 5px" >{{ __('auto.举报位置：') }}</span >
                                <select class="form-control" name="game" value="{{$game}}">
                                    <option value="">{{ __('auto.请选择举报位置') }}</option>
                                    @foreach($game_name as $k=>$v)
                                        <option value="{{$v}}">{{$v}}</option>
                                        @endforeach
                                </select>
                                <span style="padding-left: 5px" >{{ __('auto.举报内容：') }}</span>
                                <select class="form-control" name="content" value="{{$content}}">
                                    <option value="">{{ __('auto.请选择举报内容') }}</option>
                                    <option value="{{ __('auto.游戏通牌/作弊') }}">{{ __('auto.游戏通牌/作弊') }}</option>
                                    <option value="{{ __('auto.不良昵称') }}">{{ __('auto.不良昵称') }}</option>
                                    <option value="{{ __('auto.不良头像') }}">{{ __('auto.不良头像') }}</option>
                                </select>
                                <span style="padding-left: 5px" >{{ __('auto.状态：') }}</span>
                                <select class="form-control" name="status" value="{{$status}}">
                                    <option value="">{{ __('auto.请选择状态') }}</option>
                                    <option value="1">{{ __('auto.已处理') }}</option>
                                    <option value="0">{{ __('auto.未处理') }}</option>
                                </select>
                                <span style="padding-left: 5px;" >{{ __('auto.排序：') }}</span>
                                <input type="radio" name="sort" value="1">&nbsp;
                                <input type="submit" class="btn btn-sm btn-gradient-dark btn-icon-text" value="{{ __('auto.搜索') }}"/>
                                <a href="/admin/complaint/accusation" class="btn btn-sm btn-gradient-warning btn-icon-text">{{ __('auto.清空') }}</a>
                            </form>
                            <table class="table table-bordered">
                                <thead>
                                <tr>
                                    <th width="5%">{{ __('auto.序号') }}</th>
                                    <th width="8%">{{ __('auto.举报时间') }}</th>
                                    <th width="15%">{{ __('auto.举报人') }}/ID</th>
                                    <th width="15%">{{ __('auto.被举报人') }}/ID</th>
                                    <th width="15%">{{ __('auto.举报位置') }}</th>
                                    <th width="10%">{{ __('auto.举报内容') }}</th>
                                    <th width="8%">{{ __('auto.处理人') }}</th>
                                    <th width="8%">{{ __('auto.处理时间') }}</th>
                                    <th width="8%">{{ __('auto.状态') }}</th>
                                    <th width="10%">{{ __('auto.操作') }}</th>
                                </tr>
                                </thead>
                                <tbody>
                                @foreach($list as $k=>$v)
                                    <tr>
                                        <td>{{ $v->id }}</td>
                                        <td>{{ $v->time }}</td>
                                        <td>{{ $v->plaintiff_name }} / {{ $v->plaintiff_uid }}</td>
                                        <td>{{ $v->defendant_name }} / {{ $v->defendant_uid }}</td>
                                        <td>{{ $v->ServerName }}</td>
                                        <td>{{ $v->content }}</td>
                                        <td>{{ $v->executant_name }}</td>
                                        <td>{{ $v->update_time }}</td>
                                        <td>{{ $v->status ?'{{ __('auto.已处理') }}':'{{ __('auto.未处理') }}' }}</td>
                                        <td>
                                            @if($v->status == 0)
                                                <button type="button" class="btn btn-sm btn-gradient-dark btn-icon-text" onclick="update({{ $v->id }})">
                                                    {{ __('auto.处理') }}
                                                </button>
                                            @else
                                                <button type="button" class="btn btn-sm btn-gradient-dark btn-icon-text">
                                                {{ __('auto.已处理') }}
                                            </button>
                                            @endif
                                            <button type="button" class="btn btn-sm btn-gradient-danger btn-icon-text" onclick="del({{ $v->id }})">
                                                {{ __('auto.删除') }}
                                            </button>
                                        </td>
                                    </tr>
                                @endforeach
                                </tbody>
                            </table>
                            @if($sort == 1)
                            @else
                            <div class="box-footer clearfix">
                                {{ __('auto.总共') }} <b>{{ $list->appends(['plaintiff_uid'=>$plaintiff_uid,'defendant_uid'=>$defendant_uid,'game'=>$game,'content'=>$content,'status'=>$status])->total() }}</b> {{ __('auto.条,分为') }}<b>{{ $list->lastPage() }}</b>{{ __('auto.页') }}
                                {!! $list->links() !!}
                            </div>
                            @endif
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script>
        $(function(){
            cutStr(50);
        });
        function update(id){
            myConfirm("{{ __('auto.处理操作不可逆,是否继续') }}?",function(){
                myRequest("/admin/accusation/edit/"+id,"post",{},function(res){
                    layer.msg(res.msg)
                    setTimeout(function(){
                        window.location.reload();
                    },1500)
                });
            });
        }
        function del(id){
            myConfirm("{{ __('auto.删除操作不可逆,是否继续') }}?",function(){
                myRequest("/admin/accusation/del/"+id,"post",{},function(res){
                    layer.msg(res.msg)
                    setTimeout(function(){
                        window.location.reload();
                    },1500)
                });
            });
        }
        
    </script>
@endsection
