@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 width="6%">{{ __('auto.游戏在线人数：') }}{{$line}}</th>
                                    <th width="6%">{{ __('auto.大厅在线人数：暂无统计') }}</th>
                                </tr>
                                </thead>
                            </table>
                        </div>
                    </div>
                </div>
            </div>

            <div class="row">
                <div class="col-lg-12 grid-margin stretch-card">
                    <div class="card">
                        <div class="card-body">
                            <table class="table table-bordered">
                                <thead>
                                <tr>
                                    <th width="10%">{{ __('auto.游戏房间名称') }}</th>
                                    <th width="4%">{{ __('auto.状态') }}</th>
                                    <th width="6%">{{ __('auto.当前房间人数') }}</th>
                                    <th width="6%">{{ __('auto.当天房间流水') }}</th>
                                    <th width="6%">{{ __('auto.当天房间输赢') }}</th>
                                    <th width="6%">{{ __('auto.当天房间税收') }}</th>
                                    <th width="6%">{{ __('auto.当天房间胜率') }}</th>

                                    <th width="6%">{{ __('auto.当天输赢人数') }}</th>
                                    <th width="6%">{{ __('auto.房间库存') }}</th>
                                    <th width="8%">{{ __('auto.设置') }}</th>
                                </tr>
                                </thead>
                                <tbody>

                                    @foreach($list as $k=>$v)

                                        <tr>

                                            <td>{{$v->ServerName}}</td>
                                            <td>
                                                @if ($v->Nullity == 1)
                                                    {{ __('auto.关闭') }}
                                                @else
                                                    {{ __('auto.开启') }}
                                                @endif
                                            </td>
                                            <td>{{$v->game_count}}</td>
                                            <td>{{$v->flowing_water}}</td>
                                            <td>
                                                @if ($v->win_lose < 0)
                                                    <span style="color: red">{{ __('auto.系统输') }}</span>
                                                @elseif ($v->win_lose > 0)
                                                    <span style="color: #0b2e13">{{ __('auto.系统赢') }}</span>
                                                @endif
                                                {{$v->win_lose}}
                                            </td>
                                            <td>{{$v->Revenue}}</td>
                                            <td>{{$v->winning_probability . '%'}}</td>

                                            <td>{{ __('auto.输') }}{{$v->LostUserCount}} / {{ __('auto.赢') }}{{$v->WinUserCount}}</td>
                                            <td>{{$v->stock}}</td>
                                            <td>

{{--                                                @if ($role_id == 1)--}}
                                                        @if ($v->Nullity == 1)
                                                            <button type="button" class="btn btn-sm btn-success btn-icon-text" onclick="update({{$v->ServerID}},'on')">
                                                                {{ __('auto.开启') }}
                                                            </button>
                                                        @else
                                                            <button type="button" class="btn btn-sm btn-danger btn-icon-text" onclick="update({{$v->ServerID,'close'}})">
                                                                {{ __('auto.关闭') }}
                                                            </button>

                                                        @endif
{{--                                                @endif--}}

                                                <button type="button" class="btn btn-sm btn-facebook btn-icon-text" onclick="show({{$v->ServerID}})">
                                                    {{ __('auto.查配置') }}
                                                </button>
                                            </td>
                                        </tr>
                                    @endforeach

                                </tbody>
                            </table>
                            @empty($list)
                                <td>{{ __('auto.暂无数据') }}</td>
                            @endempty
                        </div>

                    </div>

                </div>

            </div>
        </div>
    </div>
    <script>
        function del(id){
            myConfirm("{{ __('auto.删除操作不可逆,是否继续') }}?",function(){
                myRequest("/admin/accusation/del/"+id,"post",{},function(res){
                    layer.msg(res.msg)
                    setTimeout(function(){
                        window.location.reload();
                    },1500)
                });
            });
        }

        function update(server_id,type) {
            myConfirm("{{ __('auto.是否继续') }}?",function(){
                myRequest("/admin/global/update","post",{server_id:server_id,type:type},function(res){
                    layer.msg(res.msg)
                    window.location.reload();

                });
            });
        }

        function show(value) {
            var page = layer.open({
                type: 2,
                title: '{{ __('auto.查看配置') }}',
                shadeClose: true,
                shade: 0.8,
                area: ['50%', '60%'],
                content: '/admin/global/show_config/'+value
            });
        }

    </script>
@endsection
