{% extends 'base.html' %}
{% load static %}
{% load bootstrap %}
{% block custom_head_css_js %}
    <link href="{% static "css/plugins/select2/select2.min.css" %}" rel="stylesheet">
    <script src="{% static "js/plugins/select2/select2.full.min.js" %}"></script>
{% endblock %}
{% block content %}
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-10">
            <div class="ibox float-e-margins">
                <div id="ibox-content" 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>
                        <a class="close-link">
                            <i class="fa fa-times"></i>
                        </a>
                    </div>
                </div>

                <div class="ibox-content">
                    <div class="panel blank-panel">
                        <div class="tab-content">
                            <form id="assetForm" method="post" class="form-horizontal">
                                {% csrf_token %}
                                <h3 class="widget-head-color-box">基本信息</h3>

                                {{ form.hostname|bootstrap_horizontal }}

                                {{ form.ip|bootstrap_horizontal }}

                                {{ form.port|bootstrap_horizontal }}

                                {{ form.type|bootstrap_horizontal }}

                                {{ form.comment|bootstrap_horizontal }}

                                <div class="hr-line-dashed"></div>
                                <h3>关联资产用户</h3>
                                <div class="form-group">
                                    <label for="j_group" class="col-sm-2 control-label">管理用户</label>
                                    <div class="col-sm-9">
                                        <div class="radio i-checks">
                                           <label><input type="radio" checked="checked" id="id_use_default_auth" name="use_default_auth"><span>使用预定义管理用户</span></label>
                                           <label><input type="radio" id="id_use_default_auth" name="use_default_auth"><span>自定义</span></label>
                                        </div>
                                    </div>
                                </div>

                                {{ form.admin_user|bootstrap_horizontal }}
                                <p class="col-sm-offset-2">Tips: 管理用户是服务器存在的root或拥有sudo的用户，用来推送系统用户</p>

                                <div class="hr-line-dashed"></div>
                                {{ form.system_user|bootstrap_horizontal }}

                                <div class="hr-line-dashed"></div>
                                <h3>所属</h3>
                                {{ form.idc|bootstrap_horizontal }}

                                {{ form.groups|bootstrap_horizontal }}

                                <div class="hr-line-dashed"></div>
                                <h3>标签</h3>
                                <div class="form-group" id="id_label">
                                    <label class="col-sm-2 control-label">Label</label>
                                    <div class="col-sm-4">
                                        <input type="text" placeholder="Key" name="key" class="form-control">
                                    </div>
                                    <div class="col-sm-5">
                                        <input type="text" placeholder="Value" name="value" class="form-control">
                                    </div>
                                </div>
                                <div class="col-sm-offset-2">
                                    <i class="fa fa-plus-circle"></i> <span class="nav-label">添加</span><span class="fa arrow"></span>
                                </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="reset"> 重置 </button>
                                        <button class="btn btn-primary" type="submit"> 提交 </button>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
{% endblock %}

{% block custom_foot_js %}
    <script>
        $(document).ready(function () {
            $('.select2-groups').select2();
            $('.select2-admin-user').select2();
            $('.select2-system-user').select2();
        })
    </script>
{% endblock %}