<!DOCTYPE html>
<html lang="zh-CN">
<head>
    {{template "widgets/head.html" .}}
</head>
<body>
<div class="manual-reader">
    {{template "widgets/header.html" .}}
    <div class="container manual-body">
        <div class="row">
            <div class="page-left">
                {{template "manager/menu.html" .}}
            </div>
            <div class="page-right">
                <div class="m-box">
                    <div class="box-head">
                        <strong class="box-title"> 编辑用户</strong>
                    </div>
                </div>
                <div class="box-body col-lg-6 col-sm-12">
                    <form method="post" id="saveMemberInfoForm">
                        <div class="form-group">
                            <label>用户账号</label>
                            <input type="text" class="form-control" name="account" disabled placeholder="用户账号" value="{{.Model.Account}}">
                        </div>
                        <div class="form-group">
                            <label>用户昵称</label>
                            <input type="text" class="form-control" disabled placeholder="用户昵称" value="{{.Model.Nickname}}">
                        </div>
                        <div class="form-group">
                            <label>用户密码</label>
                            <input type="password" class="form-control" name="password1" placeholder="用户密码" maxlength="50">
                            <p style="color: #999;font-size: 12px;">不修改密码请留空,只支持本地用户修改密码</p>
                        </div>
                        <div class="form-group">
                            <label>确认密码</label>
                            <input type="password" class="form-control" name="password2" placeholder="确认密码" maxlength="50">
                        </div>
                        <div class="form-group">
                            <label>用户邮箱 <strong class="text-danger">*</strong></label>
                            <input type="email" class="form-control" name="email" placeholder="用户邮箱" value="{{.Model.Email}}" maxlength="50">
                        </div>
                        <div class="form-group">
                            <label>手机号码</label>
                            <input type="text" class="form-control" name="phone" placeholder="手机号码" maxlength="50" value="{{.Model.Phone}}">
                        </div>
                        <div class="form-group">
                            <label class="description">描述</label>
                            <textarea class="form-control" rows="3" title="描述" name="description" id="description" maxlength="500" >{{.Model.Description}}</textarea>
                            <p style="color: #999;font-size: 12px;">描述不能超过500字</p>
                        </div>
                        <div class="form-group">
                            <button type="submit" id="btnMemberInfo" class="btn btn-success" data-loading-text="保存中...">保存修改</button>
                            <span id="form-error-message" class="error-message"></span>
                        </div>
                    </form>

                    <div class="clearfix"></div>

                </div>
            </div>
        </div>
    </div>
    {{template "widgets/footer.html" .}}
</div>



{{/*<script src="/static/jquery/1.12.4/jquery.min.js" type="text/javascript"></script>*/}}
<script src="//apps.bdimg.com/libs/jquery/1.11.3/jquery.min.js" type="text/javascript"></script>
{{/*<script src="/static/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>*/}}
<script src="//apps.bdimg.com/libs/bootstrap/3.3.4/js/bootstrap.min.js" type="text/javascript"></script>

<script src="{{$.StaticDomain}}/static/js/jquery.form.js" type="text/javascript"></script>
<script src="/static/js/main.js" type="text/javascript"></script>
<script type="text/javascript">
    $(function () {
        $("#saveMemberInfoForm").ajaxForm({
            beforeSubmit : function () {
                var $then = $("#saveMemberInfoForm");

                var email = $.trim($then.find("input[name='email']").val());
                var password1 = $.trim($then.find("input[name='password1']").val());
                var password2 = $.trim($then.find("input[name='password2']").val());
                if (email === ""){
                    return showError("用户邮箱不能为空!");
                }
                if (password1 !== "" && password1 !== password2){
                    return showError("确认密码不正确!");
                }
                $("#btnMemberInfo").button("loading");
            },success : function (res) {
                if(res.errcode === 0) {
                    showSuccess("保存成功")
                }else{
                    showError(res.message);
                }
                $("#btnMemberInfo").button("reset");
            }
        });
    });
</script>
</body>
</html>