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


                            <form class="forms-sample" id="form">

                                <div class="form-group">
                                    <h4>{{ __('auto.房间名称填写') }}</h4>
                                    <input type="text" class="form-control required" name="RoomName"
                                           placeholder="{{ __('auto.请输入房间名称') }}" value="">
                                </div>
                                <div class="form-group">
                                    <h4>{{ __('auto.房间赢金币上限参数') }}</h4>
                                    <input type="text" class="form-control required" name="WinMax"
                                           placeholder="{{ __('auto.房间赢金币上限参数') }}" value="">
                                </div>
                                <div class="form-group">
                                    <h4>{{ __('auto.房间新手保护') }}</h4>
                                    <input type="text" class="form-control required" name="NewManProt"
                                           placeholder="{{ __('auto.房间新手保护') }}" value="">
                                </div>
                                <div class="form-group">
                                    <h4>{{ __('auto.房间控制上限参数') }}</h4>
                                    <input type="text" class="form-control required" name="ControlMax"
                                           placeholder="{{ __('auto.房间控制上限参数') }}" value="">
                                </div>
                                <div class="form-group">
                                    <h4>{{ __('auto.底分参数') }}</h4>
                                    <input type="text" class="form-control required" name="CellParam"
                                           placeholder="{{ __('auto.底分参数') }}" value="">
                                </div>

                                <label for="">{{ __('auto.选择游戏') }}</label>
                                <select name="GameID" id="" class="form-control">
                                    <option value="">{{ __('auto.请选择') }}</option>
                                    @foreach($gameKind as $val)
                                        <option value="{{$val->KindID}}">{{$val->KindName}}</option>
                                    @endforeach
                                </select>
                                <label for="">{{ __('auto.选择场次') }}</label>
                                <select name="SortID" id="" class="form-control">
                                    <option value="">{{ __('auto.请选择') }}</option>
                                    @foreach($sortID as $val)
                                        <option value="{{$val}}">{{$val}}</option>
                                    @endforeach
                                </select>
                                <button type="button" onclick="commit()"
                                        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/group_control/room_add", "post", data, function (res) {

                layer.msg(res.msg)
                if (res.code == '200') {
                    setTimeout(function () {
                        parent.location.reload();
                    }, 1500)
                }
            });
        }

        function cancel() {
            parent.location.reload();
        }
    </script>
@endsection
