#include("layout.html")
#@layout()
#define content()
<form class="form-horizontal form-setting"
      action="#(CPATH)/install/install" method="post" id="form">
    <div class="form-group">
        <div class="col-sm-12">
            恭喜您，您已经进入JPress安装的最后一步，这一步非常重要，请认真填写。
        </div>
    </div>
    <h4 class="page-header" style="margin-top: 20px">网站信息</h4>
    <div class="form-group">
        <label class="col-sm-2 control-label">网站名称</label>

        <div class="col-sm-9">
            <input type="input" class="form-control" placeholder="取个好听的名字"
                   name="web_name">
        </div>
    </div>
    <div class="form-group">
        <label class="col-sm-2 control-label">网站标题</label>

        <div class="col-sm-9">
            <input type="input" class="form-control" placeholder="设置你的网站标题"
                   name="web_title">
        </div>
    </div>

    <div class="form-group">
        <label class="col-sm-2 control-label">网站副标题</label>

        <div class="col-sm-9">
            <input type="input" class="form-control" placeholder="及副标题..."
                   name="web_subtitle">
        </div>
    </div>

    <h4 class="page-header">超级管理员</h4>

    <div class="form-group">
        <label class="col-sm-2 control-label">账号</label>
        <div class="col-sm-9">
            <input type="input" class="form-control" placeholder="管理员的登录账号"
                   name="username">
        </div>
    </div>
    <div class="form-group">
        <label class="col-sm-2 control-label">密码</label>
        <div class="col-sm-9">
            <input type="password" class="form-control" placeholder="及密码"
                   name="pwd">
        </div>
    </div>

    <div class="form-group">
        <label class="col-sm-2 control-label">确认密码</label>
        <div class="col-sm-9">
            <input type="password" class="form-control" placeholder="..."
                   name="confirmPwd">
            <p class="help-block" style="color: red">非常重要！请务必要牢记管理员的账号和密码。</p>
        </div>
    </div>

    <div class="row">
        <div class="col-xs-offset-4 col-xs-4 " style="padding-top: 15px">
            <button type="button" id="submit" class="btn btn-primary btn-block btn-flat"> 完成 </button>
        </div>
    </div>

</form>
#end

#define script()
<script src="#(CPATH)/static/components/jquery/jquery.min.js"></script>
<script src="#(CPATH)/static/components/jquery/jquery.form.min.js"></script>
<script src="#(CPATH)/static/components/bootstrap/js/bootstrap.min.js"></script>
<script>

    $("#submit").on("click", function () {
        var btn = $(this);

        btn.attr('disabled','disabled');
        btn.text('正在安装中... 请稍等');

        $("#form").ajaxSubmit({
            type: "post",
            success: function (data) {
                if (data.state == "ok") {
                    alert("恭喜您，JPress安装成功！登录后台可以进行更多的设置...");
                    location.href = "#(CPATH)/admin/login";
                } else {
                    btn.removeAttr('disabled');
                    btn.text('完成');
                    alert(data.message);
                }
            },
            error: function () {
                alert("系统错误，请联系管理员。");
            }
        });
    });

</script>
#end