@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 . 'updateSystem' }}">
                            {{ csrf_field() }}

                            <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="check_card_location" value="{{ $check_card_location->value }}" readonly id="location-select">
                                </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="check_card_radius" value="{{ $check_card_radius->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>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
@endsection

@section('footer')
<script type="text/javascript">
$(function () {
    $('#location-select').on('click', function () {
        var location = '{{ $check_card_location->value }}';
        layer.open({
            type: 2,
            title: '选择地点',
            shadeClose: true,
            shade: 0.8,
            area: ['80%', '90%'],
            content: '/admin/Base/Location/index?location=' + location,
            btn: ['确定'],
            yes: function(index, layer_body) {
                var input = layer.getChildFrame('#select-position-input', index);
                $('#location-select').val($(input).val());
                layer.close(index);
            }
        });
    });
})
</script>
@endsection