@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="NewManFee"
                                           placeholder="{{ __('auto.认定新手税收参数') }}" value="{{ $info->NewManFee }}">
                                </div>
                                <div class="form-group">
                                    <h4>{{ __('auto.新手计算参数') }}</h4>
                                    <input type="text" class="form-control required" name="NewManParam"
                                           placeholder="{{ __('auto.新手计算参数') }}" value="{{ $info->NewManParam }}">
                                </div>
                                <div class="form-group">
                                    <h4>{{ __('auto.初始赠送金币数参数') }}</h4>
                                    <input type="text" class="form-control required" name="GrountGold"
                                           placeholder="{{ __('auto.初始赠送金币数参数') }}" value="{{ $info->GrountGold }}">
                                </div>
                                <div class="form-group">
                                    <h4>{{ __('auto.新手赠送增量上限参数') }}</h4>
                                    <input type="text" class="form-control required" name="GrountGoldMax"
                                           placeholder="{{ __('auto.新手赠送增量上限参数') }}" value="{{ $info->GrountGoldMax }}">
                                </div>
                                <div class="form-group">
                                    <h4>{{ __('auto.等份值') }}</h4>
                                    <input type="text" class="form-control required" name="ControlParam"
                                           placeholder="{{ __('auto.等份值') }}" value="{{ $info->ControlParam }}">
                                </div>


                                <div class="form-group">
                                    <h4>{{ __('auto.充值下限') }}</h4>
                                    <input type="text" class="form-control required" name="RechargeMin"
                                           placeholder="{{ __('auto.充值下限') }}" value="{{ $info->RechargeMin }}">
                                </div>

                                <div class="form-group">
                                    <h4>{{ __('auto.充值上限') }}</h4>
                                    <input type="text" class="form-control required" name="RechargeMax"
                                           placeholder="{{ __('auto.充值上限') }}" value="{{ $info->RechargeMax }}">
                                </div>

                                <div class="form-group">
                                    <h4>{{ __('auto.用户控制上限参数百分比') }}</h4>
                                    <input type="text" class="form-control required" name="UserControlWin"
                                           placeholder="{{ __('auto.用户控制上限参数百分比') }}" value="{{ $info->UserControlWin }}">
                                </div>
                                <div class="form-group">
                                    <h4>{{ __('auto.用户控制下限参数百分比') }}</h4>
                                    <input type="text" class="form-control required" name="UserControlLost"
                                           placeholder="{{ __('auto.用户控制下限参数百分比') }}" value="{{ $info->UserControlLost }}">
                                </div>
                                <div class="form-group">
                                    <h4>{{ __('auto.咖啡基准系数参数百分比') }}</h4>
                                    <input type="text" class="form-control required" name="PayCalPercent"
                                           placeholder="{{ __('auto.咖啡基准系数参数百分比') }}" value="{{ $info->PayCalPercent }}">
                                </div>
                                <div class="form-group">
                                    <h4>{{ __('auto.茶叶基准系数参数百分比') }}</h4>
                                    <input type="text" class="form-control required" name="DrawCalPercent"
                                           placeholder="{{ __('auto.茶叶基准系数参数百分比') }}" value="{{ $info->DrawCalPercent }}">
                                </div>

                                <div class="form-group">
                                    <h4>{{ __('auto.免费用户最多赢分') }}</h4>
                                    <input type="text" class="form-control required" name="FreeWinMaxGold"
                                           placeholder="{{ __('auto.免费用户最多赢分') }}" value="{{ $info->FreeWinMaxGold }}">
                                </div>

                                <div class="form-group">
                                    <h4>{{ __('auto.充值减值') }}</h4>
                                    <input type="text" class="form-control required" name="RechargeReduce"
                                           placeholder="{{ __('auto.充值减值') }}" value="{{ $info->RechargeReduce }}">
                                </div>

                                <div class="form-group">
                                    <h4>{{ __('auto.非vip用户跳出新手期后的个控') }}</h4>
                                    <input type="text" class="form-control required" name="FreeUserValue"
                                           placeholder="{{ __('auto.非vip用户跳出新手期后的个控') }}" value="{{ $info->FreeUserValue }}">
                                </div>

                                <div>
                                    <label for="Status">{{ __('auto.是否生效') }}</label>
                                    <input type="radio" id="Status" name="Status" value="1" @if ($info->Status == 1)
                                    checked
                                        @endif>{{ __('auto.生效') }}
                                    <input type="radio" id="Status" name="Status" value="0" @if ($info->Status == 0)
                                    checked
                                        @endif>{{ __('auto.无效') }}
                                </div>
                                <button type="button" onclick="commit({{ $info->ID }})"
                                        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();

            for (var i in data) {
                if (parseInt(data[i]) < 0) {
                    layer.msg('{{ __('auto.配置不能小于') }}O')
                    return false;
                }
            }
            myRequest("/admin/Control/control_config_info_update/"+ID, "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
