{% load i18n static compress mc2_tags %}

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>{% block title %}Mission Control{% endblock %}</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="shortcut icon" href="{{STATIC_URL}}img/favicon.ico">

    {% compress css %}
    <link href="{% static 'css/bootstrap.min.css' %}" rel="stylesheet">
    <link href="{% static 'css/AdminLTE.min.css' %}" rel="stylesheet">
    <link href="{% static 'css/font-awesome.min.css' %}" rel="stylesheet">
    <link href="{% static 'css/ionicons.min.css' %}" rel="stylesheet">
    <link href="{% static 'css/skins/skin-black.min.css' %}" rel="stylesheet">
    <link href="{% static 'css/custom.css' %}" rel="stylesheet">
    {% block extra_css %}{% endblock %}
    {% endcompress %}

    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->

    {% compress js %}
    <script src="{% static 'plugins/jQuery/jQuery-2.1.4.min.js' %}"></script>
    <script src="{% static 'js/bootstrap.min.js' %}"></script>
    <script src="{% static 'js/app.js' %}"></script>
    <script src="{% static 'js/jquery.formset.js' %}"></script>
    {% endcompress %}
</head>
{% block body %}
<body class="hold-transition skin-black sidebar-mini">
<div class="wrapper">
  <!-- Main Header -->
<header class="main-header">

  <!-- Logo -->
  <a href="{% url 'home' %}" class="logo">
    <!-- mini logo for sidebar mini 50x50 pixels -->
    <span class="logo-mini"><b>M</b>C</span>
    <!-- logo for regular state and mobile devices -->
    <span class="logo-lg"><b>Mission</b> Control</span>
  </a>

  <!-- Header Navbar -->
  <nav class="navbar navbar-static-top" role="navigation">
    <!-- Sidebar toggle button-->
    <a href="#" class="sidebar-toggle" data-toggle="offcanvas" role="button">
      <span class="sr-only">Toggle navigation</span>
    </a>
    <span class="mc2-version">v{{mc2_version}}</span>
    <!-- Navbar Right Menu -->
    <div class="navbar-custom-menu">
      <ul class="nav navbar-nav">
        <!-- Messages: style can be found in dropdown.less-->
        <li class="dropdown messages-menu">
          <!-- Menu toggle button -->
          <a href="#" class="dropdown-toggle" data-toggle="dropdown">
            {% if active_organization %}
            {{ active_organization.name }}
            {% else %}
            {% trans "Select an organization" %}
            {% endif %}
          </a>
          <ul class="dropdown-menu">
            <li>
              <!-- inner menu: contains the messages -->
              <ul class="menu">

                {% for org in organizations %}
                    {% if org != active_organization %}
                    <li><a href="{% url 'organizations:select-active' org.slug %}?next={{ request.path|urlencode }}">{% blocktrans with org_name=org.name %}{{ org_name }}{% endblocktrans %}</a></li>
                    {% endif %}
                {% endfor %}

                {% if is_active_organization_admin %}
                    <li><a href="{% url 'organizations:edit' active_organization.slug %}"><i class="fa fa-cog"></i> {% blocktrans with org_name=active_organization.name %}Manage {{ org_name }}{% endblocktrans %}</a></li>
                {% endif %}
              </ul>
              <!-- /.menu -->
            </li>
            {% if user.is_superuser and active_organization %}
                <li class="footer"><a href="{% url 'organizations:deselect-active' %}">{% trans "See All" %}</a></li>
            {% endif %}
          </ul>
        </li>
        <!-- /.messages-menu -->

        <!-- User Account Menu -->
        <li class="dropdown user user-menu">
          <!-- Menu Toggle Button -->
          <a href="#" class="dropdown-toggle" data-toggle="dropdown">
            <!-- The user image in the navbar-->
            {% gravatar_url user.email 160 as user_avatar %}
            {% if user_avatar %}
              <img src="{{user_avatar}}" class="user-image" alt="">
            {% else %}
              <img src="{% static 'img/default-profile.png' %}" class="user-image" alt="">
            {% endif %}
            <!-- hidden-xs hides the username on small devices so only the image appears. -->
            <span class="hidden-xs">{% display_name %}</span>
          </a>
          <ul class="dropdown-menu">
            <!-- The user image in the menu -->
            <li class="user-header">
              {% if user_avatar %}
                <img src="{{user_avatar}}" class="img-circle" alt="">
              {% else %}
                <img src="{% static 'img/default-profile.png' %}" class="img-circle" alt="">
              {% endif %}

              <p>
                {% display_name %}
                <small>Member since {{user.date_joined|date:"N Y"}}</small>
              </p>
            </li>
            <!-- Menu Body -->
            <!--
            <li class="user-body">
              <div class="row">
                <div class="col-xs-4 text-center">
                  <a href="#">Followers</a>
                </div>
                <div class="col-xs-4 text-center">
                  <a href="#">Sales</a>
                </div>
                <div class="col-xs-4 text-center">
                  <a href="#">Friends</a>
                </div>
              </div>
              -->
              <!-- /.row -->
            </li>
            <!-- Menu Footer-->
            <li class="user-footer">
              <div class="pull-right">
                <a href="{% url 'logout' %}" class="btn btn-default btn-flat">Sign out</a>
              </div>
            </li>
          </ul>
        </li>
        <!-- Control Sidebar Toggle Button -->
        {% if user.is_superuser %}
        <li>
          <a href="#" data-toggle="control-sidebar"><i class="fa fa-gears"></i></a>
        </li>
        {% endif %}
      </ul>
    </div>
  </nav>
</header>

  <!-- Left side column. contains the logo and sidebar -->
  <aside class="main-sidebar">

    <!-- sidebar: style can be found in sidebar.less -->
    <section class="sidebar">

      <!-- Sidebar user panel (optional) -->
      <div class="user-panel">
        <div class="pull-left image">
        {% gravatar_url user.email 160 as user_avatar %}
        {% if user_avatar %}
          <img src="{{user_avatar}}" class="img-circle" alt="">
        {% else %}
          <img src="{% static 'img/default-profile.png' %}" class="img-circle" alt="">
        {% endif %}
        </div>
        <div class="pull-left info">
          <p>{% display_name %}</p>
          <!-- Status -->
          <a href="#"><i class="fa fa-circle text-success"></i> Online</a>
        </div>
      </div>
      {% block search %}
      <!-- search form (Optional) -->
      <form action="#" method="get" class="sidebar-form">
        <div class="input-group">
          <input id="filter" tabindex="1" type="text" class="form-control" placeholder="Search..." autofocus="true">
              <span class="input-group-btn">
                <button type="submit" name="search" id="search-btn" class="btn btn-flat"><i class="fa fa-search"></i>
                </button>
              </span>
        </div>
      </form>
      <!-- /.search form -->
      {% endblock search %}
      <!-- Sidebar Menu -->
      {% block left-sidebar %}
      <!--
      <ul class="sidebar-menu">
        <li class="header">MENU</li>
        <li><a href="#"><i class="fa fa-users"></i> <span>Helpdesk</span></a></li>
        <li><a href="#"><i class="fa fa-question"></i> <span>FAQs</span></a></li>
      </ul>
      -->
      {% endblock %}
      <!-- /.sidebar-menu -->
    </section>
    <!-- /.sidebar -->
  </aside>


  <!-- Content Wrapper. Contains page content -->
  <div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <section class="content-header">

      {% if messages %}
      <div class="row">
        <div class="col-md-6">
        {% for message in messages %}
          <div class="alert alert-{{message.tags}} alert-dismissible">
            <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
            {{message}}
          </div>
        {% endfor %}
        </div>
      </div>
      {% endif %}

      {% block page_header %}
      {% block page_header_title %}
      <!--
      <h1>
        Page Header
        <small>Optional description</small>
      </h1>
      -->
      {% endblock %}
      {% block breadcrumbs %}
      <!--
      <ol class="breadcrumb">
        <li><a href="#"><i class="fa fa-dashboard"></i> Level</a></li>
        <li class="active">Here</li>
      </ol>
      -->
      {% endblock %}
      {% endblock %}
    </section>

    <!-- Main content -->
    <section class="content">
      {% block content %}
      {% endblock %}
    </section>
    <!-- /.content -->
  </div>
  <!-- /.content-wrapper -->

  <!-- Main Footer -->
<footer class="main-footer">
  <!-- To the right -->
  <div class="pull-right hidden-xs">
    Mission Control
  </div>
  <!-- Default to the left -->
  <strong>Copyright &copy; {% now "Y" %} <a href="http://praekeltfoundation.org">Praekelt Foundation</a>.</strong> All rights reserved.
</footer>

{% block right-sidebar %}
  <!-- Control Sidebar -->
<aside class="control-sidebar control-sidebar-dark">
  <!-- Create the tabs -->
  <ul class="nav nav-tabs nav-justified control-sidebar-tabs">
    <li class="active"><a href="#control-sidebar-settings-tab" data-toggle="tab"><i class="fa fa-gears"></i></a></li>
  </ul>
  <!-- Tab panes -->
  <div class="tab-content">
    <!-- Settings tab content -->
    <div class="tab-pane active" id="control-sidebar-settings-tab">
      <form method="post" action="{% url 'user_settings' %}?next={{request.path}}">
        {% csrf_token %}
        <h3 class="control-sidebar-heading">User Settings</h3>

        <div class="form-group">
            {% include "form.html" with form=user_settings_form %}
            <input type="submit" value="Save" class="btn btn-primary" />
        </div>
        <!-- /.form-group -->
      </form>
    </div>
    <!-- /.tab-pane -->
  </div>
</aside>
{% endblock %}
<!-- /.control-sidebar -->
<!-- Add the sidebar's background. This div must be placed
     immediately after the control sidebar -->
<div class="control-sidebar-bg"></div>

</div>
  <script type="text/javascript">
  $(document).ready(function(){
      //javascript goes here
  });
  </script>
  {% block script %}
  {% endblock %}
</body>
{% endblock %}
</html>
