@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>

                                <table class="table table-bordered">
                                    <thead>
                                    <tr>
                                        <th >{{ __('auto.名称') }}</th>
                                        <th >{{ __('auto.操作') }}</th>
                                        <th >{{ __('auto.操作人') }}</th>
                                        <th >{{ __('auto.操作时间') }}</th>

                                    </tr>
                                    </thead>
                                    <tbody>
                                    @foreach($list as $k=>$v)
                                        <tr>
                                            <td>{{ $v->StatusString }}</td>
                                            <td>
                                                @if ($v->StatusValue == 1)
                                                    <button type="button" class="btn btn-sm btn-danger" onclick="switch_control('0')">{{ __('auto.关闭') }}</button>
                                                @elseif ($v->StatusValue == 0)
                                                    <button type="button" class="btn btn-sm btn-primary" onclick="switch_control('1')">{{ __('auto.开启') }}</button>
                                                @endif
                                            </td>
                                            <td>{{ $v->account }}</td>
                                            <td>{{ $v->create_at }}</td>

                                        </tr>
                                   @endforeach
                                    </tbody>
                                </table>

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

        function switch_control(StatusValue){

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



    </script>
@endsection
