@extends('admin.master')

@section('style')
<link href="{{ asset('data/assets/css/lightbox.css') }}" rel="stylesheet">
@endsection

@section('top')
	<div class="top-breadcrumb pull-left">
        <h5>意见反馈</h5>
    </div>
@endsection

@section('content')
    <div class="tab-content clearfix form-horizontal">
        <div class="form-group">
            <label class="col-sm-2 control-label label-width">意见反馈：</label>
            <div class="col-sm-5">
                <textarea id="content-area" class="form-control" rows="5" name="content" v-model="content" cols="50" placeholder="请输入内容"></textarea>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label label-width"></label>
            <div class="col-sm-5">
                <button type="submit" class="btn btn-primary" @click="send()">提交</button>
            </div>
        </div>
    </div>
@endsection

@section('notice')

@endsection

@section('foot')
<script type="text/javascript">
    var apiUrl  = "{{ config('theme.api_url') }}";
    var video = new Vue({
        el: '#main-view',
        data: {
            content: '',
        },
        methods: {
            send: function() {
                var _this = this;
                $.ajax({
                    type: "POST",
                    url: apiUrl + '/feedback',
                    data: {"content": _this.content},
                    success: function(data) {
                        if (data.status == 'success') {
                            _this.content = '';
                            swal({
                                title: "", 
                                text: "信息提交成功！",
                                type: "success",
                                confirmButtonText: '确定',
                            });
                        } else {
                            swal({
                                title: "", 
                                text: "信息提交失败，请重新提交！",
                                type: "error",
                                confirmButtonText: '确定',
                            });
                        }
                    }
                });
            },
        }
    });
</script>
@endsection
