@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">
                                @foreach($list as $val)
                                <div class="form-group">
                                    <label >* {{$val->StatusString}}</label>
                                    <input type="text"  class="form-control required" name="{{$val->StatusName}}" value="{{$val->StatusValue / 100}}">
                                </div>
                                @endforeach

                                <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>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script>

        function commit(){
            if(!checkForm()){
                return false;
            }

            var data = $("#form").serializeObject();

            myRequest("/admin/extension/recharge_rate","post",data,function(res){

                layer.msg(res.msg)
                setTimeout(function () {
                    window.location.reload();

                }, 1500)

            });
        }

    </script>
@endsection
