<?= view('layout/header')->send(); ?>

<form id="cv-form" method="post" class="cv-mt-15">
    <div class="cv-normal-input-box">
        <input class="easyui-textbox" name="cv[username]" label="账号" prompt="<?= lang('请输入管理员账号'); ?>" missingMessage="管理员账号为必填项" required style="width: 100%;"  />
    </div>
    <div class="cv-normal-input-box">
        <input class="easyui-textbox" name="cv[plain_password]" label="密码" prompt="<?= lang('请输入管理员密码'); ?>" missingMessage="管理员密码为必填项" required style="width: 100%;"  />
    </div>
    <div class="cv-normal-input-box">
        <input class="easyui-textbox" name="cv[true_name]" label="姓名" style="width: 100%;"  />
    </div>
    <div class="cv-normal-input-box">
        <input class="easyui-textbox" name="cv[email]" label="邮箱" style="width: 100%;"  />
    </div>
    <div class="cv-normal-input-box">
        <input class="easyui-textbox" name="cv[remark]" label="备注" prompt="<?= lang('可备注该管理员'); ?>" style="width: 100%;" multiline="true"  />
    </div>
</form>

<div class="cv-submit">
    <a href="javascript:void(0);" class="easyui-linkbutton c8" onclick="saveForm()" style="width:80px">确定</a>
    <a href="javascript:void(0)" class="easyui-linkbutton" onclick="closeSelf()" style="width:80px">取消</a>
</div>
<?= view('layout/footer')->send(); ?>

<script type="text/javascript">
    function saveForm(){
        $("#cv-form").form('submit',{
            onSubmit: function(){
                return $(this).form('validate');
            },
            success: function(result){
                var response = JSON.parse(result);
                parent.message(response.message);
                if (response.success){
                    parent.reloadManagerListData();
                    closeSelf();
                }
            }
        });
    }

    function closeSelf() {
        var index = parent.layer.getFrameIndex(window.name);
        parent.layer.close(index);
    }
</script>
