{% extends "base.html" %}
{% block head %}
        {{ super() }}
        <!-- BEGIN PAGE LEVEL PLUGIN STYLES -->
        <link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='global/plugins/select2/select2.css') }}"/>
        <link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='global/plugins/datatables/plugins/bootstrap/dataTables.bootstrap.css') }}"/>
        <!-- END PAGE LEVEL PLUGIN STYLES -->

        <!-- BEGIN THEME STYLES -->
        <!-- DOC: To use 'rounded corners' style just load 'components-rounded.css' stylesheet instead of 'components.css' in the below style tag -->
        <link href="{{ url_for('static', filename='global/css/components-md.css') }}" id="style_components" rel="stylesheet" type="text/css"/>
        <link href="{{ url_for('static', filename='global/css/plugins-md.css') }}" rel="stylesheet" type="text/css"/>
        <link href="{{ url_for('static', filename='admin/layout2/css/layout.css') }}" rel="stylesheet" type="text/css"/>
        <link href="{{ url_for('static', filename='admin/layout2/css/themes/grey.css') }}" rel="stylesheet" type="text/css" id="style_color"/>
        <link href="{{ url_for('static', filename='admin/layout2/css/custom.css') }}" rel="stylesheet" type="text/css"/>
        <!-- END THEME STYLES -->
{% endblock %}
{% block title %}<title>DNS Control Panel - HOME</title>{% endblock %}

{% block dashboard_stat %}
                <!-- BEGIN PAGE HEADER-->
                <h3 class="page-title">
                Dashboard</h3>
                <div class="page-bar">
                    <ul class="page-breadcrumb">
                        <li>
                            <i class="fa fa-home"></i>
                            <a href="/">Home</a>
                            <i class="fa fa-angle-right"></i>
                        </li>
                        <li>
                            <a href="#">Dashboard</a>
                        </li>
                    </ul>
                </div>
                <!-- END PAGE HEADER-->
{% endblock %}

{% block content %}
                 <div class="clearfix">
                </div>

                <div class="row">
                    <div class="col-md-12">
                        <!-- BEGIN DOMAIN TABLE-->
                        <div class="portlet box grey-cascade">
                            <div class="portlet-title">
                                <div class="caption">
                                    <i class="fa fa-globe"></i>DOMAINS
                                </div>
                                <div class="tools">
                                    <a href="javascript:;" class="reload">
                                    </a>
                                    <a href="javascript:;" class="collapse">
                                    </a>
                                </div>
                            </div>
                            <div class="portlet-body">
                                {% if current_user.role.name == 'Administrator' %}
                                <div class="table-toolbar">
                                    <div class="row">
                                        <div class="col-md-6">
                                            <div class="btn-group">
                                                <button id="btn_new_domain" class="btn green" onclick="window.location.href='{{ url_for('domain_add') }}'">
                                                New Domain <i class="fa fa-plus"></i>
                                                </button>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                {% endif %}
                                <table class="table table-striped table-bordered table-hover" id="tb_vps_list">
                                <thead>
                                <tr>
                                    <th>
                                         Name
                                    </th>
                                    <th>
                                         Kind
                                    </th>
                                    <th>
                                         Serial
                                    </th>
                                    <th>
                                         Master
                                    </th>
                                    <th>
                                         Action
                                    </th>
                                </tr>
                                </thead>
                                <tbody>
                                {% for domain in domains %}
                                <tr class="odd gradeX">
                                    <td>
                                        <a href="{{ url_for('domain', domain_name=domain.name) }}"><strong>{{ domain.name }}</strong></a>
                                    </td>
                                    <td>
                                        {{ domain.type }}
                                    </td>
                                    <td>
                                         {{ domain.serial }}
                                    </td>
                                    <td>
                                         {% if domain.master == '[]'%}N/A {% else %}{{ domain.master|display_master_name }}{% endif %}
                                    </td>
                                    {% if current_user.role.name !='Administrator' %}
                                    <td width="6%">
                                        <a href="{{ url_for('domain', domain_name=domain.name) }}" class="btn default btn-xs green">Manage
                                        <i class="fa fa-cog"></i></a>
                                    </td>
                                    {% else %}
                                    <td width="18%">
                                        <a href="{{ url_for('domain', domain_name=domain.name) }}" class="btn default btn-xs green">Manage
                                        <a href="{{ url_for('domain_management', domain_name=domain.name)}}" class="btn default btn-xs red">Admin</a>
                                    </td>
                                    {% endif %}
                                </tr>
                                {% endfor %}
                                </tbody>
                                </table>
                              </div>
                        </div>
                        <!-- END DOMAIN TABLE-->
                    </div>
                </div>
                <div class="row">
                    <!-- MORE CONTENT GO HERE -->
                </div>

{% endblock %}

{% block scripts %}
{{ super() }}
<!-- BEGIN PAGE LEVEL SCRIPTS -->
<script src="{{ url_for('static', filename='global/scripts/metronic.js') }}" type="text/javascript"></script>
<script src="{{ url_for('static', filename='admin/layout2/scripts/layout.js') }}" type="text/javascript"></script>
<!-- END PAGE LEVEL SCRIPTS -->
<!-- TABLE PLUGINS -->
<script type="text/javascript" src="{{ url_for('static', filename='global/plugins/select2/select2.min.js') }}"></script>
<script type="text/javascript" src="{{ url_for('static', filename='global/plugins/datatables/media/js/jquery.dataTables.min.js') }}"></script>
<script type="text/javascript" src="{{ url_for('static', filename='global/plugins/datatables/plugins/bootstrap/dataTables.bootstrap.js') }}"></script>
<script src="{{ url_for('static', filename='admin/pages/scripts/table-managed.js') }}"></script>
<!-- END TABLE PLUGINS -->
<script>
jQuery(document).ready(function() {    
   Metronic.init(); // init metronic core componets
   Layout.init(); // init layout
   TableManaged.init(); // manage table columns
});
</script>
<!-- END JAVASCRIPTS -->
{% endblock %}
