<!DOCTYPE html>
<html class="" lang="en">
<head>

    {% include 'twig/common/header/include.twig' %}
    <script src="/dev/lib/handlebars-v4.0.10.js" type="text/javascript" charset="utf-8"></script>
</head>
<body class="" data-group="" data-page="projects:issues:index" data-project="xphp">
{% include 'twig/common/body/script.twig' %}
<script src="/dev/lib/bootstrap-colorpicker/dist/js/bootstrap-colorpicker.min.js"></script>

<section class="has-sidebar page-layout max-sidebar">
    {% include 'twig/common/body/page-left.twig' %}

    <div class="page-layout page-content-body system-page">
        {% include 'twig/common/body/header-content.twig' %}


        <div class="page-with-sidebar">

            {% include 'twig/admin/common-page-nav-admin.twig' %}


            <div class="content-wrapper page-with-layout-nav page-with-sub-nav">
                <div class="alert-wrapper">

                    <div class="flash-container flash-container-page">
                    </div>

                </div>
                <div class="container-fluid ">

                    <div class="content" id="content-body">

                        {% include 'twig/admin/common_system_left_nav.twig' %}

                        <div class="row has-side-margin-left">
                            <div class="col-lg-12">
                                <div class="top-area">
                                    <ul class="nav-links">
                                        <li class="active">
                                            <a href="#">API设置</a>
                                        </li>
                                        <li>
                                            <span class="hint">提供API接口方便进行插件和二次开发</span>
                                        </li>
                                    </ul>
                                    <div class="nav-controls">

                                    </div>
                                </div>
                                <div class="content-list prepend-top-default">
                                    <form class="form-horizontal" id="form-api" action="#" accept-charset="UTF-8"  method="post">

                                        <div class="form-group">
                                            <label class="control-label col-sm-3">是否启用: </label>
                                            <div class="col-sm-8">
                                                <div class="form-group">
                                                    <div class="radio prepend-left-10">
                                                        <label>
                                                            <input type="radio" value="1"  checked="checked"  name="enable_api">
                                                            启用
                                                        </label>
                                                    </div>
                                                    <div class="radio prepend-left-10">
                                                        <label>
                                                            <input type="radio" value="0"   name="enable_api">
                                                            关闭
                                                        </label>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="control-label col-sm-3">APP KEY: </label>
                                            <div class="col-sm-8">
                                                <div class="form-group">
                                                    <input type="text" class="form-control" name="app_key" value="<?=app_key?>" />
                                                </div>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="control-label col-sm-3">APP SECRET: </label>
                                            <div class="col-sm-8">
                                                <div class="form-group">
                                                    <input type="text" class="form-control" name="app_secret" value="<?=app_secret?>" />
                                                </div>
                                            </div>
                                        </div>

                                        <div class="form-actions text-right">
                                            <input type="button" id="btn-submit" name="btn-submit" value="保 存" class="btn btn-save js-key-enter">
                                        </div>

                                    </form>
                                </div>
                            </div>

                        </div>

                    </div>

                </div>
            </div>
        </div>

    </div>
</section>





<link href="/dev/lib/laydate/theme/default/laydate.css" rel="stylesheet">
<script src="/dev/lib/laydate/laydate.js"></script>

<script>
    $(function () {

        $("#btn-submit").click(function () {
            var method = 'post';
            var url = '/admin/system/saveApi';
            $.ajax({
                type: method,
                dataType: "json",
                async: true,
                url: url,
                data: $('#form-api').serialize(),
                success: function (resp) {
                    auth_check(resp);
                    if (resp.ret == "200") {
                        notify_success(resp.msg);
                        setTimeout("window.location.reload();", 1000)
                    } else {
                        notify_error(resp.msg, resp.data);
                    }
                },
                error: function (resp) {
                    // alert("请求数据错误" + res);
                    notify_error('请求数据错误: ' + resp);
                }
            });

        });
    });



</script>


</body>
</html>
