@extends('base.base')
@section('base')
    <!-- 内容区域 -->
    <div class="main-panel">
        <div class="content-wrapper">
            <div class="row">
                <div class="col-12 grid-margin stretch-card">
                    <div class="card">
                        <div class="card-body">
                            <h4 class="card-title">{{ __('auto.请编辑邮件内容') }}</h4>
                            {{--<p class="card-email">--}}
                            {{--Basic form elements--}}
                            {{--</p>--}}
                            <table class="table table-bordered">
                                <thead>
                                <tr>
                                    <th>{{ __('auto.序号') }}</th>
                                    <th>ID</th>
                                    <th>{{ __('auto.用户名') }}</th>
                                    <th>{{ __('auto.时间') }}</th>
                                    <th>{{ __('auto.内容') }}</th>
                                </tr>
                                </thead>
                                <tbody>
                                @foreach($list as $k=>$v)
                                    <tr>
                                        <td style="width: 5%">{{ $v->ID }}</td>
                                        <td style="width: 7%">{{ $v->GameID }}</td>
                                        <td style="width: 15%">
                                            @if (!empty($v->NickName))
                                                {{ $v->NickName }}
                                            @else
                                                【{{ __('auto.管理员】') }}{{$v->admin_nickname}}
                                            @endif
                                        </td>
                                        <td style="width: 15%">{{ $v->CreateAt }}</td>
                                        <td style="width: 30%">{{ $v->Msg }}</td>
                                    </tr>
                                @endforeach
                                </tbody>
                            </table>
                            <form class="forms-sample" id="form">
                                <div class="form-group">
                                    <h4 class="card-title">{{ __('auto.回复留言') }}</h4>
                                    <input type="hidden" name="uid" value="{{$game_id}}">
                                    <textarea class="form-control" name="message" rows="4"></textarea>
                                </div>
                                <button type="button" onclick="commit({{$id}})" class="btn btn-sm btn-gradient-primary btn-icon-text">
                                    <i class="mdi mdi-file-check btn-icon-prepend"></i>
                                    {{ __('auto.提交') }}
                                </button>
                                <button type="button" onclick="cancel()" class="btn btn-sm btn-gradient-warning btn-icon-text">
                                    <i class="mdi mdi-reload btn-icon-prepend"></i>
                                    {{ __('auto.取消') }}
                                </button>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script>
        function commit(id){
            if(!checkForm()){
                return false;
            }
            var data = $("#form").serializeObject();
            myRequest("/admin/opinion/reply/"+id,"post",data,function(res){
                layer.msg(res.msg)
                setTimeout(function(){
                    parent.location.reload();
                },1500)
            });
        }
        function cancel() {
            parent.location.reload();
        }
    </script>
@endsection
