<!DOCTYPE HTML>
<html>
<head>
    <title>Distributor</title>
    <link rel="icon" href="data:image/x-icon;base64,AAABAAEAEBAQAAAAAAAoAQAAFgAAACgAAAAQAAAAIAAAAAEABAAAAAAAgAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAA/wA3AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAERERAAARERERAAAAAAAAERAQAAAAAAEBEAEAAAAAEAEQABABEAEAARAAAQEQEAABAAAAAAAAAAAAAAABAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAAQAAAAAAABAAEAAAAAABAAABAAAAAAAQABAAAAAAAAERAAAAADwAAAP/wAAF/6AABv9gAAdm4AAHpeAAD//wAA/v8AAP7/AAD+/wAA/v8AAP9/AAD7vwAA998AAPu/AAD8fwAA" type="image/x-icon">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.3/css/materialize.min.css">
    <style>
        html{font-family:"San Francisco Display","Helvetica Neue",Helvetica,Arial,"Lucida Grande",sans-serif;font-weight:300;}
        .meta { font-size: 50%; font-weight: 100; }
        .side-nav li.active {background-color: #ee6e73;}
        .side-nav li.active a {color: #fff;}
        .side-nav li.active ul a {color: #000;}
        .dropdown-content li>a {font-size: 1rem;}
        .checkboxes {margin-top: 20px;}
    </style>
    <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.3/js/materialize.min.js"></script>
</head>
<body>
    <nav>
      <div class="nav-wrapper">
        <a href="#!" class="brand-logo">Distributor
        <small class="meta">{{ last_sync }}</small></a>
        <a href="#" data-activates="mobile-navbar" class="button-collapse"><i class="material-icons">menu</i></a>
        <ul class="right hide-on-med-and-down">
            {% if "web" in categories %}<li class="active"><a class="waves-effect" href="#" id="web">Web</a></li>{% endif %}
            {% if "promo" in categories %}<li><a class="waves-effect" href="#" id="promo">Promo</a></li>{% endif %}
            {% if "stream" in categories %}<li><a class="waves-effect" href="#" id="stream">Stream</a></li>{% endif %}
            <li><a id="haproxy" class="dropdown-button" href="#" data-activates="haproxy_dropdown" data-constrainwidth="false">HA Proxy</a></li>
            {% if "NIC" in categories %}<li><a class="waves-effect" href="#" id="NIC">NIC</a></li>{% endif %}
            <li><a id="bind" class="dropdown-button" href="#" data-activates="bind_dropdown" data-constrainwidth="false">Bind</a></li>
        </ul>
      </div>
    </nav>
    <ul id="haproxy_dropdown" class="dropdown-content">
        {% if "http" in categories %}<li><a href="#" id="http">HTTP</a></li>{% endif %}
        {% if "ldap" in categories %}<li><a href="#" id="ldap">LDAP</a></li>{% endif %}
        {% if "mail" in categories %}<li><a href="#" id="mail">Mail</a></li>{% endif %}
        {% if "rdp" in categories %}<li><a href="#" id="rdp">RDP</a></li>{% endif %}
        {% if "sql" in categories %}<li><a href="#" id="sql">SQL</a></li>{% endif %}
        {% if "ssh" in categories %}<li><a href="#" id="ssh">SSH</a></li>{% endif %}
        <li class="divider"></li>
        {% if "other" in categories %}<li><a href="#" id="other">Other</a></li>{% endif %}
    </ul>

    <ul id="bind_dropdown" class="dropdown-content">
    {% for zone in bind_zones %}
        <li><a href="#" id="DNS_{{ zone | replace('.', '_') }}">{{ zone }}</a></li>
    {% endfor %}
    </ul>

    <div class="row">
        <div id="content">
          <div class="valign-wrapper" style="height:80vh">
            <div class="preloader-wrapper big active" style="margin-left:auto;margin-right:auto;">
                <div class="spinner-layer spinner-red-only">
                  <div class="circle-clipper left">
                    <div class="circle"></div>
                  </div><div class="gap-patch">
                    <div class="circle"></div>
                  </div><div class="circle-clipper right">
                    <div class="circle"></div>
                  </div>
               </div>
            </div>
          </div>
        </div>
    </div>
</body>
<script type="text/javascript">
    function activateCategory(cat) {
        $("#content").load("./categories/" + cat.target.id + ".html", function(response, status, xhr){
            if (status != "error") {
                $('.active').removeClass("active");
                $(cat.target).parent().addClass("active");
                $(".side-nav #" + cat.target.id).parent().addClass("active");
            }
        });
    }
    function activateHaproxyCategory(cat) {
        $("#content").load("./categories/" + cat.target.id + ".html", function(response, status, xhr){
            if (status != "error") {
                $('.active').removeClass("active");
                $("#haproxy").parent().addClass("active");
                $("#haproxy_side #" + cat.target.id).parent().addClass("active");
            }
        });
    }
    function activateBindCategory(cat) {
        $("#content").load("./categories/" + cat.target.id + ".html", function(response, status, xhr){
            if (status != "error") {
                $('.active').removeClass("active");
                $("#bind").parent().addClass("active");
                $("#bind_side #" + cat.target.id).parent().addClass("active");
            }
        });
    }
    $(document).ready(function() {
        $("#content").load("./categories/web.html");
        $(".button-collapse").sideNav({closeOnClick: true});

        $("nav li .waves-effect").click(activateCategory);
        $(".side-nav .waves-effect").click(activateCategory);
        $("#haproxy_side .collapsible-body a").click(activateHaproxyCategory);
        $("#haproxy_dropdown a").click(activateHaproxyCategory);
        $("#bind_side .collapsible-body a").click(activateBindCategory);
        $("#bind_dropdown a").click(activateBindCategory);
        });
</script>
</html>
