@extends('admin.layout')
<style type="text/css">

</style>
@section('header')

@endsection

@section('content')
<div id="sg-main-container-sg">
    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>分享设置</h5>
                        <div class="ibox-tools">
                            <a class="collapse-link"> <i class="fa fa-chevron-up"></i>
                            </a>
                        </div>
                    </div>
                    <div class="ibox-content">
                        <form class="form-horizontal" method="POST" action="{{ $pre_uri . 'updateShare' }}">
                            {{ csrf_field() }}

                            <div class="form-group row">
                                <label class="col-sm-2 col-sm-offset-1 control-label">图片</label>
                                <div class="col-sm-8">
                                    {!!  widget('Tools.ImgUpload')->single('share-image', 'share_image', $share_image->value) !!}
                                </div>
                            </div>

                            <div class="form-group row">
                                <label class="col-sm-2 col-sm-offset-1 control-label">图片宽高</label>
                                <div class="col-sm-8">
                                    <input class="form-control" type="text" value="{{ $width . ',' . $height }}" readonly>                                </div>
                            </div>

                            <div class="form-group row">
                                <label class="col-sm-2 col-sm-offset-1 control-label">文本标签</label>
                                <div class="col-sm-8">
                                    <input class="form-control" type="text" name="share_text" value="{{ $share_text->value }}">
                                </div>
                            </div>

                            <div class="form-group row">
                                <label class="col-sm-2 col-sm-offset-1 control-label">文本位置</label>
                                <div class="col-sm-8">
                                    <input class="form-control" type="text" name="share_text_pos" value="{{ $share_text_pos->value }}">
                                </div>
                            </div>

                            <div class="form-group row">
                                <div class="col-sm-8 col-sm-offset-3">
                                    <button type="submit" class="btn btn-sm btn-primary">保存设置</button>
                                    <button type="button" href="{{ $pre_uri . 'generateSharePhoto' }}" class="btn btn-sm btn-success" id="generate-photo-btn">测试生成</button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
@endsection

@section('footer')
<script type="text/javascript">
$(function () {
    $('#generate-photo-btn').on('click', function () {
        layer.open({
            type: 2,
            title: '测试生成的图片',
            shadeClose: true,
            shade: 0.8,
            area: ['80%', '90%'],
            content: "{{ $pre_uri . 'generateSharePhoto' }}",
            btn: ['确定'],
            yes: function(index) {
                layer.close(index);
            }
        });
    });
})
</script>
@endsection