@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">

                            {{--<p class="card-email">--}}
                            {{--Basic form elements--}}
                            {{--</p>--}}
                            <form class="forms-sample" id="form">
                                <div class="form-group" >
                                    <label >* 等级</label>
                                    <input type="number"  class="form-control required" name="CardLevel" placeholder="{{ __('auto.等级') }}" value="">
                                </div>

                                <div class="form-group" >
                                    <label >* 概率</label>
                                    <input type="number"  class="form-control required" name="RewardRate" placeholder="{{ __('auto.概率') }}" value="">
                                </div>
                                <div class="form-group" >
                                    <label >* 金额</label>
                                    <input type="number"  class="form-control required" name="RewardScore" placeholder="{{ __('auto.金额') }}" value="">
                                </div>
                                <div class="form-group" >
                                    <label >* 图片 （输入 0 1 2 数值越大底图越炫）</label>
                                    <input type="number"  class="form-control required" name="ImageID" placeholder="{{ __('auto.图片') }}" value="">
                                </div>
                                <div class="form-group" >
                                    <label >* 特效配置 （1为大奖特效，0为小奖特效）</label>
                                    <input type="number"  class="form-control required" name="RewardType" placeholder="{{ __('auto.特效配置') }}" value="">
                                </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();

            // if (parseInt(data.RewardRate) > 100 || parseInt(data.RewardRate) < 0){
            //     layer.msg('系统赢的初始概率值区间为0-100')
            //     return false;
            // }

            myRequest("/admin/group_control/award_allocation_add","post",data,function(res){
                layer.msg(res.msg)
                setTimeout(function(){
                    parent.location.reload();
                },1500)
            });
        }
        function cancel() {
            parent.location.reload();
        }
    </script>
@endsection
