@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.请编辑游戏配置：') }}{{$ServerName->ServerName ?? ''}}</h4>

                            <form class="forms-sample" id="form">
                                <div class="form-group" style="width: 55%;float: left">
                                    <label>* 输入增加或减少库存</label>
                                    <input type="text" class="form-control required" name="stock"
                                           placeholder="{{ __('auto.输入增加或减少库存') }}" value="0">
{{--                                    <span>{{ __('auto.注：单次操作增减额度不能超过房间底分的1000倍') }}</span>--}}
                                </div>
                                <div class="form-group btn-move" style="width: 50%;float: left">
                                    <button type="button" onclick="commit({{$GameID}},{{$SortID}})"
                                            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>
                                </div>
                            </form>
                        </div>
                        <div class="forms-sample">
                            <div class="form-group" style="width: 50%;float: left;margin-left: 5px">
                                <label>* 入场下限</label>
                                <input type="text" class="form-control required" name="BaseValue" placeholder="{{ __('auto.入场下限') }}"
                                       value="{{$showConfig->MinEnterScore}}" readonly>
                            </div>
                            <div class="form-group" style="width: 48%;float: left;margin-left: 5px">
                                <label>* 入场上线</label>
                                <input type="text" class="form-control required" name="Threshold" placeholder="{{ __('auto.入场上线') }}"
                                       value="{{$showConfig->MaxEnterScore}}" readonly>
                            </div>
                            <div class="form-group" style="width: 50%;float: left;margin-left: 5px">
                                <label>* 底分</label>
                                <input type="text" class="form-control required" name="TopNum" placeholder="{{ __('auto.底分') }}"
                                       value="{{$showConfig->CellScore}}" readonly>
                            </div>
                        </div>

                    </div>
                </div>
            </div>
        </div>
    </div>
    <script>
        function commit(id,SortID) {
            if (!checkForm()) {
                return false;
            }
            var data = $("#form").serializeObject();
            data.SortID = SortID

            myRequest("/admin/gold/update_stock/" + id, "post", data, function (res) {

                if (res.code != 301){
                    layer.msg(res.msg)
                    setTimeout(function () {
                        parent.location.reload();
                    }, 1500)
                }else {
                    layer.msg(res.msg)
                }



            });
        }

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