{% load static from staticfiles %}
{% load helpers %}
<!DOCTYPE html>
<html lang="en">
<head>
	<title>{% block title %}Home{% endblock %} - NetBox</title>
	<link rel="stylesheet" href="{% static 'bootstrap-3.3.7-dist/css/bootstrap.min.css' %}">
    <link rel="stylesheet" href="{% static 'font-awesome-4.7.0/css/font-awesome.min.css' %}">
    <link rel="stylesheet" href="{% static 'jquery-ui-1.12.1/jquery-ui.css' %}">
	<link rel="stylesheet" href="{% static 'css/base.css' %}?v{{ settings.VERSION }}">
    <link rel="icon" type="image/png" href="{% static 'img/netbox.ico' %}" />
    <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
</head>
<body>
    <nav class="navbar navbar-default navbar-fixed-top">
        <div class="container">
            <div class="navbar-header">
                <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <a class="navbar-brand" href="{% url 'home' %}">
                    <img src="{% static 'img/netbox_logo.png' %}" />
                </a>
            </div>
            <div id="navbar" class="navbar-collapse collapse">
                {% if request.user.is_authenticated or not settings.LOGIN_REQUIRED %}
                <ul class="nav navbar-nav">
                    <li class="dropdown{% if request.path|contains:'/dcim/sites/,/dcim/regions/,/tenancy/' %} active{% endif %}">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Organization <span class="caret"></span></a>
                        <ul class="dropdown-menu">
                            <li><a href="{% url 'dcim:site_list' %}"><strong>Sites</strong></a></li>
                            {% if perms.dcim.add_site %}
                                <li class="subnav"><a href="{% url 'dcim:site_add' %}"><i class="fa fa-plus"></i> Add a Site</a></li>
                                <li class="subnav"><a href="{% url 'dcim:site_import' %}"><i class="fa fa-download"></i> Import Sites</a></li>
                            {% endif %}
                            <li class="divider"></li>
                            <li><a href="{% url 'dcim:region_list' %}"><strong>Regions</strong></a></li>
                            {% if perms.dcim.add_region %}
                                <li class="subnav"><a href="{% url 'dcim:region_add' %}"><i class="fa fa-plus"></i> Add a Region</a></li>
                            {% endif %}
                            <li class="divider"></li>
                            <li><a href="{% url 'tenancy:tenant_list' %}"><strong>Tenants</strong></a></li>
                            {% if perms.tenancy.add_tenant %}
                                <li class="subnav"><a href="{% url 'tenancy:tenant_add' %}"><i class="fa fa-plus"></i> Add a Tenant</a></li>
                                <li class="subnav"><a href="{% url 'tenancy:tenant_import' %}"><i class="fa fa-download"></i> Import Tenants</a></li>
                            {% endif %}
                            <li class="divider"></li>
                            <li><a href="{% url 'tenancy:tenantgroup_list' %}"><strong>Tenant Groups</strong></a></li>
                            {% if perms.tenancy.add_tenantgroup %}
                                <li class="subnav"><a href="{% url 'tenancy:tenantgroup_add' %}"><i class="fa fa-plus"></i> Add a Tenant Group</a></li>
                            {% endif %}
                        </ul>
                    </li>
                    <li class="dropdown{% if request.path|contains:'/dcim/rack' %} active{% endif %}">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Racks <span class="caret"></span></a>
                        <ul class="dropdown-menu">
                            <li><a href="{% url 'dcim:rack_list' %}"><strong>Racks</strong></a></li>
                            {% if perms.dcim.add_rack %}
                                <li class="subnav"><a href="{% url 'dcim:rack_add' %}"><i class="fa fa-plus"></i> Add a Rack</a></li>
                                <li class="subnav"><a href="{% url 'dcim:rack_import' %}"><i class="fa fa-download"></i> Import Racks</a></li>
                            {% endif %}
                            <li><a href="{% url 'dcim:rack_elevation_list' %}"><strong>Rack Elevations</strong></a></li>
                            <li class="divider"></li>
                            <li><a href="{% url 'dcim:rackgroup_list' %}"><strong>Rack Groups</strong></a></li>
                            {% if perms.dcim.add_rackgroup %}
                                <li class="subnav"><a href="{% url 'dcim:rackgroup_add' %}"><i class="fa fa-plus"></i> Add a Rack Group</a></li>
                            {% endif %}
                            <li class="divider"></li>
                            <li><a href="{% url 'dcim:rackrole_list' %}"><strong>Rack Roles</strong></a></li>
                            {% if perms.dcim.add_rackrole %}
                                <li class="subnav"><a href="{% url 'dcim:rackrole_add' %}"><i class="fa fa-plus"></i> Add a Rack Role</a></li>
                            {% endif %}
                            <li class="divider"></li>
                            <li><a href="{% url 'dcim:rackreservation_list' %}"><strong>Rack Reservations</strong></a></li>
                        </ul>
                    </li>
                    <li class="dropdown{% if request.path|contains:'/dcim/device,/dcim/manufacturers/,/dcim/platforms/' %} active{% endif %}">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Devices <span class="caret"></span></a>
                        <ul class="dropdown-menu">
                            <li><a href="{% url 'dcim:device_list' %}"><strong>Devices</strong></a></li>
                            {% if perms.dcim.add_device %}
                                <li class="subnav"><a href="{% url 'dcim:device_add' %}"><i class="fa fa-plus"></i> Add a Device</a></li>
                                <li class="subnav"><a href="{% url 'dcim:device_import' %}"><i class="fa fa-download"></i> Import Devices</a></li>
                            {% endif %}
                            {% if perms.ipam.add_device or perms.ipam.add_devicetype %}
                                <li class="divider"></li>
                            {% endif %}
                            <li><a href="{% url 'dcim:devicetype_list' %}"><strong>Device Types</strong></a></li>
                            {% if perms.dcim.add_devicetype %}
                                <li class="subnav"><a href="{% url 'dcim:devicetype_add' %}"><i class="fa fa-plus"></i> Add a Device Type</a></li>
                            {% endif %}
                            <li class="divider"></li>
                            <li><a href="{% url 'dcim:devicerole_list' %}"><strong>Device Roles</strong></a></li>
                            {% if perms.dcim.add_devicerole %}
                                <li class="subnav"><a href="{% url 'dcim:devicerole_add' %}"><i class="fa fa-plus"></i> Add a Device Role</a></li>
                            {% endif %}
                            {% if perms.dcim.add_devicerole or perms.dcim.add_manufacturer %}
                                <li class="divider"></li>
                            {% endif %}
                            <li><a href="{% url 'dcim:manufacturer_list' %}"><strong>Manufacturers</strong></a></li>
                            {% if perms.dcim.add_manufacturer %}
                                <li class="subnav"><a href="{% url 'dcim:manufacturer_add' %}"><i class="fa fa-plus"></i> Add a Manufacturer</a></li>
                            {% endif %}
                            {% if perms.dcim.add_manufacturer or perms.dcim.add_platform %}
                                <li class="divider"></li>
                            {% endif %}
                            <li><a href="{% url 'dcim:platform_list' %}"><strong>Platforms</strong></a></li>
                            {% if perms.dcim.add_platform %}
                                <li class="subnav"><a href="{% url 'dcim:platform_add' %}"><i class="fa fa-plus"></i> Add a Platform</a></li>
                            {% endif %}
                        </ul>
                    </li>
                    <li class="dropdown{% if request.path|contains:'/dcim/console-connections/,/dcim/power-connections/,/dcim/interface-connections/' %} active{% endif %}">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Connections <span class="caret"></span></a>
                        <ul class="dropdown-menu">
                            <li><a href="{% url 'dcim:console_connections_list' %}"><strong>Console Connections</strong></a></li>
                            {% if perms.dcim.change_consoleport %}
                                <li class="subnav"><a href="{% url 'dcim:console_connections_import' %}"><i class="fa fa-download"></i> Import Console Connections</a></li>
                            {% endif %}
                            {% if perms.ipam.change_consoleport or perms.ipam.change_powerport %}
                                <li class="divider"></li>
                            {% endif %}
                            <li><a href="{% url 'dcim:power_connections_list' %}"><strong>Power Connections</strong></a></li>
                            {% if perms.dcim.change_powerport %}
                                <li class="subnav"><a href="{% url 'dcim:power_connections_import' %}"><i class="fa fa-download"></i> Import Power Connections</a></li>
                            {% endif %}
                            {% if perms.ipam.change_powerport or perms.ipam.add_interfaceconnection %}
                                <li class="divider"></li>
                            {% endif %}
                            <li><a href="{% url 'dcim:interface_connections_list' %}"><strong>Interface Connections</strong></a></li>
                            {% if perms.dcim.add_interfaceconnection %}
                                <li class="subnav"><a href="{% url 'dcim:interface_connections_import' %}"><i class="fa fa-download"></i> Import Interface Connections</a></li>
                            {% endif %}
                        </ul>
                    </li>
                    <li class="dropdown{% if request.path|contains:'/ipam/' and not request.path|contains:'/ipam/vlan' %} active{% endif %}">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">IP Space <span class="caret"></span></a>
                        <ul class="dropdown-menu">
                            <li><a href="{% url 'ipam:ipaddress_list' %}"><strong>IP Addresses</strong></a></li>
                            {% if perms.ipam.add_ipaddress %}
                                <li class="subnav"><a href="{% url 'ipam:ipaddress_add' %}"><i class="fa fa-plus"></i> Add an IP</a></li>
                                <li class="subnav"><a href="{% url 'ipam:ipaddress_import' %}"><i class="fa fa-download"></i> Import IPs</a></li>
                            {% endif %}
                            {% if perms.ipam.add_ipaddress or perms.ipam.add_prefix %}
                                <li class="divider"></li>
                            {% endif %}
                            <li><a href="{% url 'ipam:prefix_list' %}"><strong>Prefixes</strong></a></li>
                            {% if perms.ipam.add_prefix %}
                                <li class="subnav"><a href="{% url 'ipam:prefix_add' %}"><i class="fa fa-plus"></i> Add a Prefix</a></li>
                                <li class="subnav"><a href="{% url 'ipam:prefix_import' %}"><i class="fa fa-download"></i> Import Prefixes</a></li>
                            {% endif %}
                            {% if perms.ipam.add_prefix or perms.ipam.add_aggregate %}
                                <li class="divider"></li>
                            {% endif %}
                            <li><a href="{% url 'ipam:aggregate_list' %}"><strong>Aggregates</strong></a></li>
                            {% if perms.ipam.add_aggregate %}
                                <li class="subnav"><a href="{% url 'ipam:aggregate_add' %}"><i class="fa fa-plus"></i> Add an Aggregate</a></li>
                                <li class="subnav"><a href="{% url 'ipam:aggregate_import' %}"><i class="fa fa-download"></i> Import Aggregates</a></li>
                            {% endif %}
                            {% if perms.ipam.add_aggregate or perms.ipam.add_vrf %}
                                <li class="divider"></li>
                            {% endif %}
                            <li><a href="{% url 'ipam:vrf_list' %}"><strong>VRFs</strong></a></li>
                            {% if perms.ipam.add_vrf %}
                                <li class="subnav"><a href="{% url 'ipam:vrf_add' %}"><i class="fa fa-plus"></i> Add a VRF</a></li>
                                <li class="subnav"><a href="{% url 'ipam:vrf_import' %}"><i class="fa fa-download"></i> Import VRFs</a></li>
                            {% endif %}
                            <li class="divider"></li>
                            <li><a href="{% url 'ipam:rir_list' %}"><strong>RIRs</strong></a></li>
                            {% if perms.ipam.add_rir %}
                                <li class="subnav"><a href="{% url 'ipam:rir_add' %}"><i class="fa fa-plus"></i> Add a RIR</a></li>
                            {% endif %}
                            {% if perms.ipam.add_rir or perms.ipam.add_role %}
                                <li class="divider"></li>
                            {% endif %}
                            <li><a href="{% url 'ipam:role_list' %}"><strong>Prefix Roles</strong></a></li>
                            {% if perms.ipam.add_role %}
                                <li class="subnav"><a href="{% url 'ipam:role_add' %}"><i class="fa fa-plus"></i> Add a Role</a></li>
                            {% endif %}
                        </ul>
                    </li>
                    <li class="dropdown{% if request.path|contains:'/ipam/vlan' %} active{% endif %}">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">VLANs <span class="caret"></span></a>
                        <ul class="dropdown-menu">
                            <li><a href="{% url 'ipam:vlan_list' %}"><strong>VLANs</strong></a></li>
                            {% if perms.ipam.add_vlan %}
                                <li class="subnav"><a href="{% url 'ipam:vlan_add' %}"><i class="fa fa-plus"></i> Add a VLAN</a></li>
                                <li class="subnav"><a href="{% url 'ipam:vlan_import' %}"><i class="fa fa-download"></i> Import VLANs</a></li>
                            {% endif %}
                            <li class="divider"></li>
                            <li><a href="{% url 'ipam:vlangroup_list' %}"><strong>VLAN Groups</strong></a></li>
                            {% if perms.ipam.add_vlangroup %}
                                <li class="subnav"><a href="{% url 'ipam:vlangroup_add' %}"><i class="fa fa-plus"></i> Add a VLAN Group</a></li>
                            {% endif %}
                            <li class="divider"></li>
                            <li><a href="{% url 'ipam:role_list' %}"><strong>VLAN Roles</strong></a></li>
                            {% if perms.ipam.add_role %}
                                <li class="subnav"><a href="{% url 'ipam:role_add' %}"><i class="fa fa-plus"></i> Add a Role</a></li>
                            {% endif %}
                        </ul>
                    </li>
                    <li class="dropdown{% if request.path|contains:'/virtualization/' %} active{% endif %}">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Virtualization <span class="caret"></span></a>
                        <ul class="dropdown-menu">
                            <li><a href="{% url 'virtualization:virtualmachine_list' %}"><strong>Virtual Machines</strong></a></li>
                            {% if perms.virtualization.add_virtualmachine %}
                                <li class="subnav"><a href="{% url 'virtualization:virtualmachine_add' %}"><i class="fa fa-plus"></i> Add a Virtual Machine</a></li>
                                <li class="subnav"><a href="{% url 'virtualization:virtualmachine_import' %}"><i class="fa fa-download"></i> Import Virtual Machines</a></li>
                            {% endif %}
                            <li class="divider"></li>
                            <li><a href="{% url 'virtualization:cluster_list' %}"><strong>Clusters</strong></a></li>
                            {% if perms.virtualization.add_cluster %}
                                <li class="subnav"><a href="{% url 'virtualization:cluster_add' %}"><i class="fa fa-plus"></i> Add a Cluster</a></li>
                                <li class="subnav"><a href="{% url 'virtualization:cluster_import' %}"><i class="fa fa-download"></i> Import Clusters</a></li>
                            {% endif %}
                            <li class="divider"></li>
                            <li><a href="{% url 'virtualization:clustertype_list' %}"><strong>Cluster Types</strong></a></li>
                            {% if perms.virtualization.add_clustertype %}
                                <li class="subnav"><a href="{% url 'virtualization:clustertype_add' %}"><i class="fa fa-plus"></i> Add a Cluster Type</a></li>
                            {% endif %}
                            <li class="divider"></li>
                            <li><a href="{% url 'virtualization:clustergroup_list' %}"><strong>Cluster Groups</strong></a></li>
                            {% if perms.virtualization.add_clustergroup %}
                                <li class="subnav"><a href="{% url 'virtualization:clustergroup_add' %}"><i class="fa fa-plus"></i> Add a Cluster Group</a></li>
                            {% endif %}
                        </ul>
                    </li>
                    <li class="dropdown{% if request.path|contains:'/circuits/' %} active{% endif %}">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Circuits <span class="caret"></span></a>
                        <ul class="dropdown-menu">
                            <li><a href="{% url 'circuits:circuit_list' %}"><strong>Circuits</strong></a></li>
                            {% if perms.circuits.add_circuit %}
                                <li class="subnav"><a href="{% url 'circuits:circuit_add' %}"><i class="fa fa-plus"></i> Add a Circuit</a></li>
                                <li class="subnav"><a href="{% url 'circuits:circuit_import' %}"><i class="fa fa-download"></i> Import Circuits</a></li>
                            {% endif %}
                            <li class="divider"></li>
                            <li><a href="{% url 'circuits:provider_list' %}"><strong>Providers</strong></a></li>
                            {% if perms.circuits.add_provider %}
                                <li class="subnav"><a href="{% url 'circuits:provider_add' %}"><i class="fa fa-plus"></i> Add a Provider</a></li>
                                <li class="subnav"><a href="{% url 'circuits:provider_import' %}"><i class="fa fa-download"></i> Import Providers</a></li>
                            {% endif %}
                            <li class="divider"></li>
                            <li><a href="{% url 'circuits:circuittype_list' %}"><strong>Circuit Types</strong></a></li>
                            {% if perms.circuits.add_circuittype %}
                                <li class="subnav"><a href="{% url 'circuits:circuittype_add' %}"><i class="fa fa-plus"></i> Add a Circuit Type</a></li>
                            {% endif %}
                        </ul>
                    </li>
                    {% if request.user.is_authenticated %}
                        <li class="dropdown{% if request.path|contains:'/secrets/' %} active{% endif %}">
                            <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Secrets <span class="caret"></span></a>
                            <ul class="dropdown-menu">
                                <li><a href="{% url 'secrets:secret_list' %}"><strong>Secrets</strong></a></li>
                                {% if perms.secrets.add_secret %}
                                    <li class="subnav"><a href="{% url 'secrets:secret_import' %}"><i class="fa fa-download"></i> Import Secrets</a></li>
                                {% endif %}
                                <li class="divider"></li>
                                <li><a href="{% url 'secrets:secretrole_list' %}"><strong>Secret Roles</strong></a></li>
                                {% if perms.secrets.add_secretrole %}
                                    <li class="subnav"><a href="{% url 'secrets:secretrole_add' %}"><i class="fa fa-plus"></i> Add a Secret Role</a></li>
                                {% endif %}
                            </ul>
                        </li>
                    {% endif %}
                </ul>
                {% endif %}
                <ul class="nav navbar-nav navbar-right">
                    {% if request.user.is_authenticated %}
                        <li class="dropdown">
                            <a href="#" class="dropdown-toggle" data-toggle="dropdown" title="{{ request.user }}" role="button" aria-haspopup="true" aria-expanded="false">
                                {{ request.user|truncatechars:"30" }} <span class="caret"></span>
                            </a>
                            <ul class="dropdown-menu">
                                <li><a href="{% url 'user:profile' %}"><i class="fa fa-user"></i> Profile</a></li>
                                {% if request.user.is_staff %}
                                    <li><a href="{% url 'admin:index' %}"><i class="fa fa-cogs"></i> Admin</a></li>
                                {% endif %}
                                <li class="divider"></li>
                                <li><a href="{% url 'logout' %}"><i class="fa fa-sign-out"></i> Log out</a></li>
                            </ul>
                        </li>
                    {% else %}
                        <li><a href="{% url 'login' %}?next={{ request.path }}"><i class="fa fa-sign-in"></i> Log in</a></li>
                    {% endif %}
                </ul>
                <form action="{% url 'search' %}" method="get" class="navbar-form navbar-right" id="navbar_search" role="search">
                    <div class="input-group">
                        <input type="text" name="q" class="form-control" placeholder="Search">
                        <span class="input-group-btn">
                            <button type="submit" class="btn btn-primary">
                                <i class="fa fa-search"></i>
                            </button>
                        </span>
                    </div>
                </form>
            </div>
        </div>
    </nav>
    <div class="container wrapper">
        {% if settings.BANNER_TOP %}
            <div class="alert alert-info text-center" role="alert">
                {{ settings.BANNER_TOP|safe }}
            </div>
        {% endif %}
        {% if settings.MAINTENANCE_MODE %}
            <div class="alert alert-warning text-center" role="alert">
                <h4><i class="fa fa-exclamation-triangle"></i> Maintenance Mode</h4>
                <p>NetBox is currently in maintenance mode. Functionality may be limited.</p>
            </div>
        {% endif %}
        {% for message in messages %}
            <div class="alert alert-{{ message.tags }} alert-dismissable" role="alert">
                <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                    <span>&times;</span>
                </button>
                {{ message }}
            </div>
        {% endfor %}
        {% block content %}{% endblock %}
        <div class="push"></div>
         {% if settings.BANNER_BOTTOM %}
            <div class="alert alert-info text-center banner-bottom" role="alert">
                 {{ settings.BANNER_BOTTOM|safe }}
            </div>
        {% endif %}
    </div>
    <footer class="footer">
        <div class="container">
            <div class="row">
                <div class="col-xs-4">
                    <p class="text-muted">{{ settings.HOSTNAME }} (v{{ settings.VERSION }})</p>
                </div>
                <div class="col-xs-4 text-center">
                    <p class="text-muted">{% now 'Y-m-d H:i:s T' %}</p>
                </div>
                <div class="col-xs-4 text-right">
                    <p class="text-muted">
                        <i class="fa fa-fw fa-book text-primary"></i> <a href="http://netbox.readthedocs.io/" target="_blank">Docs</a> &middot;
                        <i class="fa fa-fw fa-cloud text-primary"></i> <a href="{% url 'api_docs' %}">API</a> &middot;
                        <i class="fa fa-fw fa-code text-primary"></i> <a href="https://github.com/digitalocean/netbox">Code</a> &middot;
                        <i class="fa fa-fw fa-support text-primary"></i> <a href="https://github.com/digitalocean/netbox/wiki">Help</a>
                    </p>
                </div>
            </div>
        </div>
    </footer>
<script src="{% static 'js/jquery-3.2.1.min.js' %}"></script>
<script src="{% static 'jquery-ui-1.12.1/jquery-ui.min.js' %}"></script>
<script src="{% static 'bootstrap-3.3.7-dist/js/bootstrap.min.js' %}"></script>
<script src="{% static 'js/forms.js' %}?v{{ settings.VERSION }}"></script>
<script type="text/javascript">
    var netbox_api_path = "/{{ settings.BASE_PATH }}api/";
    var loading = $(".loading");
    $(document).ajaxStart(function() {
        loading.show();
    }).ajaxStop(function() {
        loading.hide();
    });
</script>
{% block javascript %}{% endblock %}
</body>
</html>
