@extends('base.base')
@section('base')

    <button type="button" class="btn btn-sm btn-gradient-success btn-icon-text" onclick="add()">
        <i class="mdi mdi-plus btn-icon-prepend"></i>
        {{ __('auto.增加档位配置') }}
    </button>
    <table class="table table-striped">
        @foreach($list as $key=>$val)
            <tr>
                <td>{{ __('auto.档位名称：') }}{{$val->Name}}</td>
                <td>
                    <button class="btn btn-sm btn-gradient-dark" onclick="update({{$val->ID}})">{{ __('auto.修改') }}</button>
                </td>
            </tr>
        @endforeach

    </table>

@endsection

<script>
    function updateStatus(id, status) {

        myConfirm("{{ __('auto.是否继续') }}?", function () {
            myRequest("/admin/group_control/control_updateStatus/" + id, "post", {status}, function (res) {
                if (res.code == '200') {
                    layer.msg(res.msg)
                    setTimeout(function () {
                        window.location.reload();
                    }, 1500)
                } else {
                    layer.msg(res.msg)
                }
            });
        });

    }

    function update(ID) {
        var page = layer.open({
            type: 2,
            title: '{{ __('auto.修改配置') }}',
            shadeClose: true,
            offset: 't',
            shade: 0.8,
            area: ['80%', '90%'],
            content: '/admin/Control/ControlConfig_update/'+ ID
        });
    }

    function add(GameID, SortID) {
        var page = layer.open({
            type: 2,
            title: '{{ __('auto.添加配置') }}',
            shadeClose: true,
            offset: 't',
            shade: 0.8,
            area: ['80%', '90%'],
            content: '/admin/Control/ControlConfig_add'
        });
    }
</script>
