{% extends "base.html" %}
{% block container_content %}
<!-- Static navbar -->
<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="#navbar" aria-expanded="false" aria-controls="navbar">
        <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="https://github.com/base4sistemas/sathub"><strong>{{ produto.nome }} {{ produto.versao }}</strong></a>
    </div>
    <div id="navbar" class="navbar-collapse collapse">
      <ul class="nav navbar-nav">
        <li><a href="/">Início</a></li>
        <!-- <li><a href="#">Sobre</a></li> -->
        <li class="dropdown">
          <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Funções SAT <span class="caret"></span></a>
          <ul class="dropdown-menu">
            <li><a href="/exec/consultarsat">ConsultarSAT</a></li>
            <li><a href="/exec/consultarstatusoperacional">ConsultarStatusOperacional</a></li>
            <li><a href="/exec/consultarnumerosessao"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span> ConsultarNumeroSessao</a></li>
            <li><a href="/exec/extrairlogs"><span class="glyphicon glyphicon-lock" aria-hidden="true"></span> ExtrairLogs</a></li>
            <li role="separator" class="divider"></li>
            <li class="dropdown-header">Configuração do Equipamento</li>
            <li><a href="/exec/ativarsat"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span> AtivarSAT</a></li>
            <li><a href="/exec/comunicarcertificadoicpbrasil"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span> ComunicarCertificadoICPBRASIL</a></li>
            <li><a href="/exec/configurarinterfacederede"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span> ConfigurarInterfaceDeRede</a></li>
            <li><a href="/exec/associarassinatura"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span> AssociarAssinatura</a></li>
            <li><a href="/exec/atualizarsoftwaresat"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span> AtualizarSoftwareSAT</a></li>
            <li><a href="/exec/bloquearsat"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span> BloquearSAT</a></li>
            <li><a href="/exec/desbloquearsat"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span> DesbloquearSAT</a></li>
            <li><a href="/exec/trocarcodigodeativacao"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span> TrocarCodigoDeAtivacao</a></li>
          </ul>
        </li>
      </ul>
      <div class="navbar-right">
        {% if current_user.is_authenticated %}
          <button type="button" class="btn btn-danger navbar-btn" id="buttonLogout">Logout</button>
        {% else %}
          <button type="button" class="btn btn-default navbar-btn" id="buttonLogin">Login</button>
        {% endif %}
      </div>
      <ul class="nav navbar-nav navbar-right">
        <li><a href="/exec/consultarsat">Consultar SAT</a></li>
        <li><a href="/exec/consultarstatusoperacional">Status Operacional</a></li>
      </ul>
    </div><!--/.nav-collapse -->
  </div><!--/.container-fluid -->
</nav>
<!-- flash messages -->
{% with messages = get_flashed_messages(with_categories=true) %}
  {% if messages %}
    {% for category, message in messages %}
      <div class="alert alert-{{ category }} sathub-flash-msg" role="alert">{{ message }}</div>
    {% endfor %}
  {% endif %}
{% endwith %}

<!-- base-navbar "content" block -->
{% block content %}{% endblock %}
{% endblock  %}

{% block custom_script %}
<script>
  $(document).ready(function() {
    {% if current_user.is_authenticated %}
      $("#buttonLogout").click(function(event) {
        window.location.assign("{{ url_for('logout') }}");
        event.preventDefault();
      });
    {% else %}
      $("#buttonLogin").click(function(event) {
        window.location.assign("{{ url_for('login') }}");
        event.preventDefault();
      });
    {% endif %}
    setTimeout(function() {
        $('.sathub-flash-msg').fadeOut("slow");
    }, (5 * 1000));
  });
</script>
{% endblock %}
