<%@ page language="java" pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%>
<%@ page isELIgnored="false" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%
    String basePath = request.getContextPath();
%>
<jsp:include page="../../../common/admin/modal_content_pre.jsp"><jsp:param name="modal_title" value="编辑"/></jsp:include>
<form id="formEdit" action="<%=basePath%>/admin/role_mgr/edit.action" method="post" class="form-horizontal">
    <input type="hidden" name="id" value="${busiModel.id}" />
    <div class="form-group">
        <label for="rolecode" class="col-md-3 col-sm-3 control-label"><span style="color: red;">*</span>角色代码：</label>
        <div class="col-md-7 col-sm-7">
            <input type="text" id="rolecode" name="rolecode" class="form-control" value="${busiModel.rolecode}" />
            <span class="help-block"></span>
        </div>
    </div>
    <div class="form-group">
        <label for="rolename" class="col-md-3 col-sm-3 control-label"><span style="color: red;">*</span>角色名称：</label>
        <div class="col-md-7 col-sm-7">
            <input type="text" id="rolename" name="rolename" class="form-control" value="${busiModel.rolename}" />
            <span class="help-block"></span>
        </div>
    </div>
    <div class="form-group">
        <label for="parentid" class="col-md-3 col-sm-3 control-label">上级角色：</label>
        <div class="col-md-7 col-sm-7">
            <input type="hidden" id="parentid" name="parentid" />
            <button type="button" class="btn btn-default dropdown-toggle" style="min-width: 120px; text-align: right;">
                <span class="caret" style="margin-left: 10px;"></span>
            </button>
            <div id="divParentRole"></div>
            <span class="help-block"></span>
        </div>
    </div>
</form>
<jsp:include page="../../../common/admin/modal_content_post.jsp"></jsp:include>
<jsp:include page="../../../common/admin/modal_footer_pre.jsp"></jsp:include>
<button type="button" class="btn btn-default" data-dismiss="modal"><i class="fa fa-close"></i>取消</button>
<button type="button" id="btnSave" class="btn btn-primary"><i class="fa fa-check"></i>保存</button>
<jsp:include page="../../../common/admin/modal_footer_post.jsp"></jsp:include>
<script type="text/javascript">
    $("#btnSave").click(function() {
        $('#formEdit').ajaxSubmitCloseRefresh();
    });

    $("#formEdit").validate({
        rules: {
            rolecode: "required",
            rolename: "required"
        }
    });

    $("#divParentRole").selectTree({url: "<%=basePath%>/admin/common/role_tree_data.action?${busiModel.parentid == null ? "" : "&selectedId="}${busiModel.parentid}"});
</script>