@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.请编辑游戏配置：') }}{{$config->KindName}} {{$config->GameLevelName}}</h4>
                            {{--<p class="card-email">--}}
                            {{--Basic form elements--}}
                            {{--</p>--}}
                            <form class="forms-sample" id="form">
                                <div class="form-group" style="width: 50%;float: left">
                                    <label >* 基准库存</label>
                                    <input type="hidden" name="GameLevel" value="{{$config->GameLevel}}">
                                    <input type="text"  class="form-control required" name="BaseStock" placeholder="{{ __('auto.基准库存') }}" value="{{ $config->BaseStock }}">
                                </div>
                                <div class="form-group" style="width: 50%;float: left">
                                    <label >* 初始概率</label>
                                    <input type="text"  class="form-control required" name="BaseProbability" placeholder="{{ __('auto.初始概率') }}" value="{{ $config->BaseProbability }}">
                                </div>
                                <div class="form-group" style="width: 50%;float: left">
                                    <label >* 基数</label>
                                    <input type="text"  class="form-control required" name="BaseValue" placeholder="{{ __('auto.基数') }}" value="{{ $config->BaseValue }}">
                                </div>
                                <div class="form-group" style="width: 50%;float: left">
                                    <label >* 阀值</label>
                                    <input type="text"  class="form-control required" name="Threshold" placeholder="{{ __('auto.阀值') }}" value="{{ $config->Threshold }}">
                                </div>
                                <div class="form-group" style="width: 50%;float: left">
                                    <label >* 人数</label>
                                    <input type="text"  class="form-control required" name="TopNum" placeholder="{{ __('auto.人数') }}" value="{{ $config->TopNum }}">
                                </div>
                                <div class="form-group" style="width: 50%;float: left">
                                    <label >* 控制最小分</label>
                                    <input type="text"  class="form-control required" name="MinControlScore" placeholder="{{ __('auto.控制最小分') }}" value="{{ $config->MinControlScore }}">
                                </div>
                                <div class="form-group" style="width: 50%;float: left">
                                    <label >* 控制最大分</label>
                                    <input type="text"  class="form-control required" name="MaxControlScore" placeholder="{{ __('auto.控制最大分') }}" value="{{ $config->MaxControlScore }}">
                                </div>
                                <div class="form-group" style="width: 50%;float: left">
                                    <label >* 机器人buff</label>
                                    <input type="text"  class="form-control required" name="AndroidBuff" placeholder="{{ __('auto.控制最大分') }}" value="{{ $config->AndroidBuff }}">
                                </div>
                                <div class="form-group" style="width: 50%;">
                                    <label >* 玩家buff</label>
                                    <input type="text"  class="form-control required" name="PlayerBuff" placeholder="{{ __('auto.玩家') }}buff" value="{{ $config->PlayerBuff }}">
                                </div>
                                <button type="button" onclick="commit({{ $config->KindID }})" 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/gold/gameconfig/update/"+id,"post",data,function(res){
                layer.msg(res.msg)
                setTimeout(function(){
                    parent.location.reload();
                },1500)
            });
        }
        function cancel() {
            parent.location.reload();
        }
    </script>
@endsection
