@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">
                                    <label for=""><h4>{{ __('auto.开关设置') }}</h4></label> <br>
                                    <label> <input type="radio" name="State" id="optionsRadios2" value="1" @if ($State == 1)
                                        checked
                                            @endif> {{ __('auto.开启') }}</label>
                                    <label> <input type="radio" name="State" id="optionsRadios2" value="0" @if ($State == 0)
                                        checked
                                            @endif> {{ __('auto.关闭') }}</label>
                                </div>

                                <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/channel/withdrawal_switch", "post", data, function (res) {
                if (res.code == '200') {
                    layer.msg(res.msg)
                    setTimeout(function () {
                        parent.location.reload();
                    }, 1500)
                } else {
                    layer.msg(res.msg)
                }
            });
        }

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