@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>
                            {{--<p class="card-description">--}}
                            {{--Basic form elements--}}
                            {{--</p>--}}
                            <form class="forms-sample" id="form">
                                <div class="form-group">
                                    <label for="exampleInputName1">*版本号</label>
                                    <input type="text"  class="form-control required" name="version_number" placeholder="{{ __('auto.版本号') }}" value="{{ $version->version_number }}">
                                </div>
                                <div class="form-group">
                                    <label for="exampleInputName1">*更新时间</label>
                                    <input type="date" name="add_time" class="form-control required" value="{{ $version->add_time }}"/>
                                </div>
                                <div class="form-group">
                                    <label >*版本更新内容</label>
                                    <textarea class="form-control" name="content" rows="4">{{ $version->content }}</textarea>
                                </div>
                                <button type="button" onclick="commit({{ $version->id }})" 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/version/update/"+id,"post",data,function(res){
                layer.msg(res.msg)
                setTimeout(function(){
                    parent.location.reload();
                },1500)
            });
        }
        function cancel() {
            parent.location.reload();
        }
    </script>
@endsection
