{% 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">
                    <div class="">
                    <a onclick="fnClickAddRow();" href="javascript:void(0);" class="btn btn-primary "> 添加 </a>
                    </div>

                    <table class="table table-striped table-bordered table-hover " id="editable" >
                        <thead>
                            <tr>
                                <th> IP地址 </th>
                                <th> 端口号 </th>
                                <th> 登录方式 </th>
                                <th> 所属IDC </th>
                                <th> 所属业务组 </th>
                                <th> 添加时间 </th>
                                <th> 备注 </th>
                            </tr>
                        </thead>
                        <tbody>
                        {% for post in contacts.object_list %}
                            <tr class="gradeX">
                                <td> {{ post.ip }} </td>
                                <td> {{ post.port }} </td>
                                <td> {{ post.login_type}} </td>
                                <td class="center"> {{ post.idc.name }} </td>
                                <td class="center">
                                    {% for group in post.group.all %}
                                        {{ group }}
                                    {% endfor %}
                                </td>
                                <td class="center"> {{ post.date_added }} </td>
                                <td class="center"> {{ post.comment }} </td>
                            </tr>
                        {% endfor %}
                        </tbody>
                    </table>

                    <ul class="pagination">
                        {% if contacts.has_previous %}
                            <li><a href="?page={{ contacts.previous_page_number }}">&laquo;</a></li>
                        {% endif %}

                        {% for page in p.page_range %}
                            {% ifequal offset1 page %}
                                <li class="active"><a href="?page={{ page }}"  title="第{{ page }}页">{{ page }}</a></li>
                            {% else %}
                              <li><a href="?page={{ page }}"  title="第{{ page }}页">{{ page }}</a></li>
                            {% endifequal %}
                        {% endfor %}
                        {% if contacts.has_next %}
                            <li><a href="?page={{ contacts.next_page_number }}">&raquo;</a></li>
                        {% endif %}
                    </ul>
                </div>
            </div>
        </div>
    </div>
</div>

{% endblock %}