<!DOCTYPE html>
<html>
<head>
    <title>{% block title %}{% endblock %} - PyFarm </title>
    <link href="{{ url_for('static', filename='css/index.css') }}" rel="stylesheet">
    <link href="{{ url_for('static', filename='css/bootstrap.min.css') }}" rel="stylesheet">
    <link href="{{ url_for('static', filename='css/layout.css') }}" rel="stylesheet">
    <link href="{{ url_for('static', filename='css/bootstrap-tree.css') }}" rel="stylesheet">
    {% block additional_styles %}{% endblock %}
    <script src="{{ url_for('static', filename='js/vendor/jquery-2.0.3.min.js') }}" type="text/javascript"></script>
    <script src="{{ url_for('static', filename='js/vendor/bootstrap.min.js') }}" type="text/javascript"></script>
    <script src="{{ url_for('static', filename='js/bootstrap-tree.js') }}" type="text/javascript"></script>
    <script src="{{ url_for('static', filename='js/layout.js') }}" type="text/javascript"></script>
    <script src="{{ url_for('static', filename='js/vendor/moment-2.8.3.min.js') }}" type="text/javascript"></script>
    <script src="{{ url_for('static', filename='js/vendor/moment-tz-2010-2020-0.2.3.js') }}" type="text/javascript"></script>
    <script src="{{ url_for('static', filename='js/vendor/canop-tzdetect-2b2feb6811.js') }}" type="text/javascript"></script>
    {% block additional_scripts %}{% endblock %}
</head>
<body>
    <div class="main-container">
      <nav class="navbar navbar-default">
        <div class="container-fluid">
          <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
              <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="#">PyFarm {{farm_name}}</a>
          </div>
          <div class="collapse navbar-collapse" id="pyfarm-navbar-collapse-1">
            <ul class="nav navbar-nav">
              <li class="{% block agents_nb_class %}{% endblock %}"><a href="{{ url_for('agents_index_ui') }}">Agents</a></li>
              <li class="{% block jobs_nb_class %}{% endblock %}"><a href="{{ url_for('jobs_index_ui') }}">Jobs</a></li>
              <li class="{% block jobgroups_nb_class %}{% endblock %}"><a href="{{ url_for('jobgroups_index_ui') }}">Job Groups</a></li>
              <li class="{% block jobqueues_nb_class %}{% endblock %}"><a href="{{ url_for('jobqueues_index_ui')}}">Queues</a></li>
              <li class="{% block jobtypes_nb_class %}{% endblock %}"><a href="{{ url_for('jobtypes_index_ui')}}">Jobtypes</a></li>
              <li class="{% block software_nb_class %}{% endblock %}"><a href="{{ url_for('software_index_ui')}}">Software</a></li>
            </ul>
            <ul class="nav navbar-nav navbar-right">
              {% if current_user.is_anonymous() %}
              <li><a href="/login">Login</a></li>
              {% else %}
              <li><a href="/logout">Logout</a></li>
              {% endif %}
            </ul>
          </div>
        </div>
      </nav>
      {% with messages = get_flashed_messages() %}
      {% if messages %}
      {% for message in messages %}
      <div class="alert-info flash">
        <a class="close" href="#" onclick="hide_parent(this)">×</a>
        {{ message }}
      </div>
      {% endfor %}
      {% endif %}
      {% endwith %}
      {% block content %}{% endblock %}
    </div>

    <script>
        var timezone = moment.tz(tzdetect.matches()[0]).zoneAbbr();
        $(".timestamp").each(function() {
            var utc  = moment.utc($(this).text() + "Z", moment.ISO_8601);
            if (utc.isValid()) {
                var local = utc.local();
                $(this).html(local.format("{{ timestamp_format }}") + " " + timezone);
            }
        });
    </script>
</body>
</html>
