{% extends '_base_list.html' %}
{#{% load i18n %}#}
{#{% load common_tags %}#}
{#{% block content_left_head %}#}
{#    <a href="{% url 'assets:admin-user-create' %}" class="btn btn-sm btn-primary "> {% trans "Create admin user" %} </a>#}
{#{% endblock %}#}
{##}
{#{% block table_head %}#}
{#    <th class="text-center">{% trans 'ID' %}</th>#}
{#    <th class="text-center"><a href="{% url 'assets:admin-user-list' %}?sort=name">{% trans 'Name' %}</a></th>#}
{#    <th class="text-center"><a href="{% url 'assets:admin-user-list' %}?sort=username">{% trans 'Username' %}</a></th>#}
{#    <th class="text-center">{% trans 'Asset num' %}</th>#}
{#    <th class="text-center">{% trans 'Lost connection' %}</th>#}
{#    <th class="text-center">{% trans 'Comment' %}</th>#}
{#    <th class="text-center"></th>#}
{#{% endblock %}#}
{##}
{#{% block table_body %}#}
{#     {% for admin_user in admin_user_list %}#}
{#         <tr class="gradeX">#}
{#             <td class="text-center">{{ admin_user.id }}</td>#}
{#             <td>#}
{#                 <a href="{% url 'assets:admin-user-detail' pk=admin_user.id %}">#}
{#                     {{ admin_user.name }}#}
{#                 </a>#}
{#             </td>#}
{#             <td class="text-center">{{ admin_user.username }}</td>#}
{#             <td class="text-center">{{ admin_user.assets.count }}</td>#}
{#             <td class="text-center">{{ admin_user.assets.count }}</td>#}
{#             <td class="text-center">{{ admin_user.comment|truncatewords:8 }}</td>#}
{#             <td class="text-center">#}
{#                 <!-- Todo: Click script button will paste a url to clipboard like: curl http://url/admin_user_create.sh | bash -->#}
{#                 <a href="{% url 'assets:admin-user-update' pk=admin_user.id %}" class="btn btn-xs btn-primary">{% trans 'Script' %}</a>#}
{#                 <!-- Todo: Click refresh button will run a task to test admin user could connect asset or not immediately -->#}
{#                 <a href="{% url 'assets:admin-user-update' pk=admin_user.id %}" class="btn btn-xs btn-warning">{% trans 'Refresh' %}</a>#}
{#                 <a href="{% url 'assets:admin-user-update' pk=admin_user.id %}" class="btn btn-xs btn-info">{% trans 'Update' %}</a>#}
{#                 <a onclick="obj_del(this,'{{ admin_user.name }}','{% url 'assets:admin-user-delete' admin_user.id %}')" class="btn btn-xs btn-danger del">{% trans 'Delete' %}</a>#}
{#             </td>#}
{#         </tr>#}
{#     {% endfor %}#}
{#{% endblock %}#}
{% extends '_base_list.html' %}
{% load i18n static %}
{% block custom_head_css_js %}
{{ block.super }}
<style>
div.dataTables_wrapper div.dataTables_filter,
.dataTables_length {
    float: right !important;
}

div.dataTables_wrapper div.dataTables_filter {
  margin-left: 15px;
}
</style>
{% endblock %}
{% block table_search %}{% endblock %}
{% block table_container %}
<div class="uc pull-left m-l-5 m-r-5">
    <a href="{% url "assets:idc-create" %}" class="btn btn-sm btn-primary"> {% trans "Create IDC" %} </a>
</div>
<table class="table table-striped table-bordered table-hover " id="admin_user_list_table" >
    <thead>
    <tr>
        <th class="text-center">
            <input type="checkbox" id="check_all" class="ipt_check_all" >
        </th>
        <th class="text-center">{% trans 'Name' %}</th>
        <th class="text-center">{% trans 'Username' %}</th>
        <th class="text-center">{% trans 'Asset num' %}</th>
        <th class="text-center">{% trans 'Lost connection' %}</th>
        <th class="text-center">{% trans 'Comment' %}</th>
        <th class="text-center"></th>
    </tr>
    </thead>
    <tbody>
    </tbody>
</table>
{% endblock %}
{% block content_bottom_left %}{% endblock %}
{% block custom_foot_js %}
<script>
$(document).ready(function(){
    var options = {
        ele: $('#admin_user_list_table'),
        columnDefs: [
            {targets: 1, createdCell: function (td, cellData, rowData) {
                var detail_btn = '<a href="{% url "assets:admin-user-detail" pk=99991937 %}">' + cellData + '</a>';
                $(td).html(detail_btn.replace('99991937', rowData.id));
             }},
{#            {targets: 4, createdCell: function (td, cellData) {#}
{#                var innerHtml = cellData.length > 8 ? cellData.substring(0, 8) + '...': cellData;#}
{#                $(td).html('<a href="javascript:void(0);" data-toggle="tooltip" title="' + cellData + '">' + innerHtml + '</a>');#}
{#             }},#}
{#            {targets: 6, createdCell: function (td, cellData) {#}
{#                if (!cellData) {#}
{#                    $(td).html('<i class="fa fa-times text-danger"></i>')#}
{#                } else {#}
{#                    $(td).html('<i class="fa fa-check text-navy"></i>')#}
{#                }#}
{#             }},#}
            {targets: 6, createdCell: function (td, cellData, rowData) {
                var update_btn = '<a href="{% url "assets:idc-update" pk=99991937 %}" class="btn btn-xs btn-info">{% trans "Update" %}</a>'.replace('99991937', cellData);
                var del_btn = '<a class="btn btn-xs btn-danger m-l-xs btn_user_delete" data-uid="99991937">{% trans "Delete" %}</a>'.replace('99991937', cellData);
                $(td).html(update_btn + del_btn)
             }}],
        ajax_url: '{% url "assets:idc-list-create-api" %}',
        columns: [{data: function(){return ""}}, {data: "name" }, {data: "assets_amount" }, {data: "contact" }, {data: "phone" },
                  {data: "operator" }, {data: "id" }],
        op_html: $('#actions').html()
    };
    jumpserver.initDataTable(options);
});
</script>
{% endblock %}



