@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>
                    IP{{ __('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">IP{{ __('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">IP{{ __('auto.回调白名单') }}</h4>

                                <table class="table table-bordered">
                                    <thead>
                                    <tr>
                                        <th width="8%">{{ __('auto.三方名称') }}</th>
                                        <th width="8%">{{ __('auto.图片') }}</th>
                                        <th width="5%">IP{{ __('auto.白名单') }}</th>

                                        <th width="8%">{{ __('auto.修改时间') }}</th>
                                        <th width="8%">{{ __('auto.上次修改者') }}</th>
                                        <th width="8%">{{ __('auto.备注') }}</th>
                                        <th width="8%">{{ __('auto.操作') }}</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    @foreach($list as $k=>$v)
                                        <tr>
{{--                                            <td contentEditable="true"--}}
{{--                                                onblur="update_sort(this,{{$v->id}})"> {{$v->sort}} </td>--}}

                                            <td>{{$v->name}}</td>
                                            <td><img src="{{ $v->config_value }}" alt="" width="80px"></td>
                                            <td>{{ $v->ip }}</td>
                                            <td>{{$v->last_time}}</td>
                                            <td>{{$v->account}}</td>
                                            <td contenteditable="true" onblur="remarksFunc({{$v->id}})">
                                                {{$v->remarks}}
                                            </td>
                                            <td>
                                                <button class="btn btn-sm btn-gradient-dark" onclick="update({{$v->id}})">{{ __('auto.修改') }}</button>
                                            </td>
                                        </tr>
                                   @endforeach
                                    </tbody>
                                </table>
                            <div class="box-footer clearfix">
                                {{ __('auto.总共') }}
                                <b>{{ $list->appends([


    ])->total() }}</b>
                                {{ __('auto.条,分为') }}<b>{{ $list->lastPage() }}</b>{{ __('auto.页') }}
                                {!! $list->links() !!}
                            </div>

                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script>

        function update(id) {
            var page = layer.open({
                type: 2,
                title: '{{ __('auto.修改') }}',
                shadeClose: true,
                shade: 0.8,
                offset:'auto',
                fixed: false,
                area: ['50%', '40%'],
                content: '/admin/recharge/ip_white_update/' + id
            });
        }
        function remarks(obj, id) {
            remark = $(obj).html();
            myRequest("/admin/recharge/remarks/" + id, "post", {remark}, function (res) {
                layer.msg(res.msg)
                setTimeout(function () {
                    window.location.reload();
                }, 2000)

            });
        }

        function switch_control(id,type){

            myConfirm("{{ __('auto.操作不可逆,是否继续') }}?",function(){
                myRequest("/admin/recharge/switch/"+id,"post",{type},function(res){
                    layer.msg(res.msg)
                    setTimeout(function(){
                        window.location.reload();
                    },1500)
                });
            });
        }

        function update_sort(obj,id) {
            sort = $(obj).html();
            if(sort != ''){
                myRequest("/admin/recharge/update_sort/" + id, "post", {sort}, function (res) {
                    layer.msg(res.msg)
                    setTimeout(function () {
                        window.location.reload();
                    }, 1500)
                });
            }else {
                window.location.reload();
            }

        }

    </script>
@endsection
