{% 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="panel-body">
                            <div class="tab-content">
                                <div id="tab-1" class="ibox float-e-margins tab-pane active"></div>
                                    <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 }}

                                        <div class="form-group" id="id_port">
                                            <label class="col-sm-2 control-label">端口</label>
                                            <div class="col-sm-9">
                                                <input type="text" placeholder="" name="port" class="form-control">
                                            </div>
                                        </div>
                                        {{ 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>

                                        <div class="form-group" id="id_manager_user">
                                            <div class="col-sm-offset-2 col-sm-9">
                                                <input type="text" placeholder="请选择管理用户" name="manager_user" class="form-control">
                                            </div>
                                        </div>
                                        <p class="col-sm-offset-2">Tips: 管理用户是服务器存在的root或拥有sudo的用户，用来推送系统用户</p>

                                        <div class="form-group">
                                            <label for="system_user" class="col-sm-2 control-label">系统用户</label>
                                            <div class="col-sm-9">
                                                <input type="text" placeholder="" name="system_user" class="form-control">
                                            </div>
                                        </div>

                                        <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="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>
    </div>
</div>
{% endblock %}

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