{% extends 'base.html' %}
{% block content %}
{% include 'nav_cat_bar.html' %}
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-lg-10">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5> 填写主机基本信息 </h5>
                    <div class="ibox-tools">
                        <a class="collapse-link">
                            <i class="fa fa-chevron-up"></i>
                        </a>
                        <a class="dropdown-toggle" data-toggle="dropdown" href="#">
                            <i class="fa fa-wrench"></i>
                        </a>
                        <ul class="dropdown-menu dropdown-user">
                            <li><a href="#">未启用 1</a>
                            </li>
                            <li><a href="#">未启用 2</a>
                            </li>
                        </ul>
                        <a class="close-link">
                            <i class="fa fa-times"></i>
                        </a>
                    </div>
                </div>

                <div class="ibox-content">
                    {% if emg %}
                        <div class="alert alert-warning text-center">{{ emg }}</div>
                    {% endif %}
                    <form method="post" class="form-horizontal">
                        <div class="form-group"><label class="col-sm-2 control-label"> IP地址 </label>
                            <div class="col-sm-8"><input type="text" value="{{ j_ip }}" placeholder="192.168.1.1" name="j_ip" class="form-control"></div>
                        </div>

                        <div class="hr-line-dashed"></div>
                        <div class="form-group"><label class="col-sm-2 control-label"> 端口号 </label>
                            <div class="col-sm-8"><input type="text" value="{{ s_port }}" placeholder="22" name="j_port" class="form-control"></div>
                        </div>

                        <div class="hr-line-dashed"></div>
                        <div class="form-group"><label class="col-sm-2 control-label"> 登录方式 </label>
                            <div class="col-sm-8">
                                <div class="radio i-checks"><label> <input type="radio" checked="" value="LDAP" name="j_type" onclick="show(this)"> <i> LDAP </i></label></div>
                                <div class="radio i-checks"><label> <input type="radio" value="SSH_KEY" name="j_type" onclick="show(this)"> <i> SSH_KEY </i></label></div>
                                <div class="radio i-checks"><label> <input type="radio" value="PASSWORD" name="j_type" onclick="show(this)"> <i> PASSWORD </i></label></div>
                                <div class="radio i-checks"><label> <input type="radio" value="MAP" name="j_type" onclick="show(this)"> <i> MAP </i></label></div>
                            </div>

                            <div name="a1" id=a1 style="display:none;">
                                <div class="form-group"><label class="col-sm-2 col-sm-offset-1 control-label"> 普通用户名 </label>
                                    <div class="col-sm-6"><input type="text" value="{{ j_user }}" name="j_user" placeholder="lilei" class="form-control"></div>
                                </div>

                                <div class="hr-line-dashed"></div>
                                <div class="form-group"><label class="col-sm-2 col-sm-offset-1 control-label"> 普通用户密码 </label>
                                    <div class="col-sm-6"><input type="password" value="{{ j_password }}" name="j_password" placeholder="Password" class="form-control"></div>
                                </div>

                                <div class="hr-line-dashed"></div>
                                <div class="form-group"><label class="col-sm-2 col-sm-offset-1 control-label"> 超管用户名 </label>
                                    <div class="col-sm-6"><input type="text" value="{{ j_root }}" name="j_root" placeholder="root" class="form-control"></div>
                                </div>

                                <div class="hr-line-dashed"></div>
                                <div class="form-group"><label class="col-sm-2 col-sm-offset-1 control-label"> 超管用户密码 </label>
                                    <div class="col-sm-6"><input type="password" value="{{ j_passwd }}" name="j_passwd" placeholder="Password" class="form-control"></div>
                                </div>

                            </div>
                        </div>


                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label for="j_idc"  class="col-lg-2 control-label"> 所属IDC </label>
                            <div class="col-sm-8">
                                <select id="j_idc" name="j_idc" class="form-control m-b">
                                    {% for i in eidc %}
                                        <option> {{ i }} </option>
                                    {% endfor %}
                                </select>
                            </div>
                        </div>

                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label for="j_group" class="col-sm-2 control-label"> 所属业务组 </label>
                            <div class="col-sm-8">
                                {% for g in egroup %}
                                    <label class="checkbox-inline"><input type="checkbox" id="j_group" value="{{ g }}" name="j_group"> {{ g }} </label>
                                {% endfor %}
                            </div>
                        </div>

                        <div class="hr-line-dashed"></div>
                        <div class="form-group"><label class="col-sm-2 control-label"> 是否激活 </label>
                            <div class="col-sm-8">
                                <div class="radio i-checks"><label> <input type="radio" checked="" value="active" name="j_active"> <i> 激活 </i></label></div>
                                <div class="radio i-checks"><label> <input type="radio"  value="no_active" name="j_active"> <i> 禁用 </i></label></div>
                            </div>
                        </div>

                        <div class="hr-line-dashed"></div>
                        <div class="form-group"><label class="col-sm-2 control-label"> 备注 </label>
                            <div class="col-sm-8"><input type="text" placeholder="hadoop01" name="j_comment" class="form-control"></div>
                        </div>

                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <div class="col-sm-4 col-sm-offset-5">
                                <button class="btn btn-white" type="submit"> 重置 </button>
                                <button class="btn btn-primary" type="submit"> 提交 </button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>




<script>
var showFlag={};
    function show(o){
    showFlag[o.name]=o.value;
    if(showFlag.j_type=="MAP"){
        document.getElementById("a1").style.display="";
    }
    else{
        document.getElementById("a1").style.display="none";
    }};

</script>

{% endblock %}