<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>{{ user_manager.USER_APP_NAME }}</title>

  <!-- Bootstrap -->
  <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
  <link rel="stylesheet" href="https://unpkg.com/bootstrap-table@1.15.5/dist/bootstrap-table.min.css">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.5.0/font/bootstrap-icons.css">
<!-- Markdown editor -->
<link rel="stylesheet" href="https://unpkg.com/easymde/dist/easymde.min.css">
<script src="https://unpkg.com/easymde/dist/easymde.min.js"></script> 

<!--Bootstrap select-->
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-select@1.14.0-beta3/dist/css/bootstrap-select.min.css">


    <!-- In-lining styles to avoid needing a separate .css file -->
    <style>
        hr { border-color: #cccccc; margin: 0; }
        .no-margins { margin: 0px; }
        .with-margins { margin: 10px; }
        .col-centered { float: none; margin: 0 auto; }
    </style>

    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
      <script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7/html5shiv.js"></script>
      <script src="//cdnjs.cloudflare.com/ajax/libs/respond.js/1.4.2/respond.js"></script>
    <![endif]-->

    {# *** Allow sub-templates to insert extra html to the head section *** #}
    {% block extra_css %}{% endblock %}
  </head>


<body>

<p><img class="img-responsive" style="display: block; margin-left: auto; margin-right: auto;" src="{{ url_for('static', filename='HBnet.png') }}" alt="Logo" /></p>
    <h2 class="card-body" style="text-align: center;">{{ user_manager.USER_APP_NAME }}</h2>
<hr />

 <!-- A grey horizontal navbar that becomes vertical on small screens -->
<nav class="navbar navbar-expand-sm bg-light">

  <div class="container-fluid">

    <!-- Links -->
    <ul class="navbar-nav">
      <li class="nav-item">
        <a class="nav-link" href="{{url}}/"><i class="bi bi-house-fill"></i> Home </a>
      </li>
      <li class="nav-item">
        <a class="nav-link" href="{{url}}/pages"><i class="bi bi-file-earmark-break-fill"></i> Pages </a>
      </li>
      <li class="nav-item">
        <a class="nav-link" href="{{url}}/news"><i class="bi bi-newspaper"></i> News </a>
      </li>
    {% if global_config['mode'] == 'FULL' or global_config['mode'] == 'DMR_ONLY' %}
      <li class="nav-item">
        <a class="nav-link" href="{{url}}/talkgroups"><i class="bi bi-card-list"></i> Talkgroups </a>
    {% endif %}
    <li class="nav-item">
        <a class="nav-link" href="{{url}}/map"><i class="bi bi-map"></i> Map </a>
      </li>
    {% if global_config['mode'] == 'FULL' or global_config['mode'] == 'DASH_ONLY' %}
    <li class="nav-item dropdown">
          <a class="nav-link dropdown-toggle" href="#" id="aprs_menu" role="button" data-bs-toggle="dropdown" aria-expanded="false">
           <i class="bi bi-window"></i> Data 
          </a>
          <ul class="dropdown-menu" aria-labelledby="aprs_menu">
            <li><a class="dropdown-item" href="{{url}}/data_overview"><i class="bi bi-border-all"></i> Overview </a></li>
            <li><a class="dropdown-item" href="{{url}}/aprs"><i class="bi bi-geo"></i> Last Known Location </a></li>
            <li><a class="dropdown-item" href="{{url}}/sms"><i class="bi bi-chat-right-text"></i> SMS Log </a></li>
            <li><a class="dropdown-item" href="{{url}}/external_services"><i class="bi bi-hdd-stack"></i> External Services </a></li>
            <li><a class="dropdown-item" href="{{url}}/bb"><i class="bi bi-clipboard"></i> Bulletin Board </a></li>
            <!-- <li><a class="dropdown-item" href="{{url}}/ss"><i class="bi bi-people"></i> Social Status </a></li> -->
            <li><a class="dropdown-item" href="{{url}}/tp"><i class="bi bi-file-earmark-break"></i> Tiny Pages </a></li>
            <!-- <li><a class="dropdown-item" href="{{url}}/tags"><i class="bi bi-hash"></i> Tags </a></li> -->
          </ul>
        </li>
    {% endif %}

        <li class="nav-item dropdown">
          <a class="nav-link dropdown-toggle" href="#" id="help_menu" role="button" data-bs-toggle="dropdown" aria-expanded="false">
           <i class="bi bi-question-square"></i> Help 
          </a>
          <ul class="dropdown-menu" aria-labelledby="help_menu">
    {% if global_config['mode'] == 'FULL' or global_config['mode'] == 'DMR_ONLY' %}
            <li><a class="dropdown-item" href="{{url}}/help"><i class="bi bi-question-diamond"></i> General Help </a></li>
    {% endif %}
    {% if global_config['mode'] == 'FULL' or global_config['mode'] == 'DASH_ONLY' %}
            <li><a class="dropdown-item" href="{{url}}/data_help"><i class="bi bi-file-bar-graph"></i> Data Help </a></li>
    {% endif %}
          </ul>
        </li>

    <!--
    <li class="nav-item">
        <a class="nav-link" href="{{url}}/help"><i class="bi bi-question-square"></i> Help </a>
      </li>
      -->

    </ul>

        <ul class="navbar-nav">
    {% if not call_or_get(current_user.is_authenticated) %}
        <li class="nav-item">
        <a class="nav-link" href="{{ url_for('user.login') }}"><i class="bi bi-door-open"></i> Sign In </a>
      </li>
    {% if global_config['registration_enabled'] == True %}
    <li class="nav-item">
        <a class="nav-link" href="{{ url_for('user.register') }}"><i class="bi bi-person-plus"></i> Register </a>
      </li>
    {% endif %}
      {% endif %}
    
    {% if call_or_get(current_user.is_authenticated) %}
        <!--Admin Menu -->
            {% if call_or_get(current_user.has_roles('Admin')) %}
    <li class="nav-item dropdown">
          <a class="nav-link dropdown-toggle" href="#" id="aprs_menu" role="button" data-bs-toggle="dropdown" aria-expanded="false">
            <i class="bi bi-tools"></i> Admin
          </a>
          <ul class="dropdown-menu" aria-labelledby="mmdvm_admin">
            <li><a class="dropdown-item" href="{{url}}/manage_servers">Manage Servers</a></li>
            <li><a class="dropdown-item" href="{{url}}/manage_peers">Manage Peers</a></li>
            <li><a class="dropdown-item" href="{{url}}/manage_masters">Manage Masters</a></li>
            {% if global_config['mode'] == 'FULL' or global_config['mode'] == 'DMR_ONLY' %}

            <li><a class="dropdown-item" href="{{url}}/manage_rules">Manage Rules</a></li>
    {% endif %}
      <li><hr class="dropdown-divider"></li>

            <li><a class="dropdown-item" href="{{url}}/add_user">Add User</a></li>
            <li><a class="dropdown-item" href="{{url}}/list_users">Manage Users</a></li>
            <li><a class="dropdown-item" href="{{url}}/approve_users">Waiting Approval</a></li>
      <li><hr class="dropdown-divider"></li>
            <li><a class="dropdown-item" href="{{url}}/manage_news">Manage News</a></li>
    <li><a class="dropdown-item" href="/manage_page"> Manage Pages </a></li>
            <li><a class="dropdown-item" href="{{url}}/misc_settings">Misc Options</a></li>
    {% if global_config['mode'] == 'FULL' or global_config['mode'] == 'DMR_ONLY' %}
            <li><a class="dropdown-item" href="{{url}}/auth_log">Authorization Log</a></li>
    {% endif %}
            <a class="dropdown-item" href="{{url}}/all_mail/{{ current_user.username or current_user.email }}">Manage Mail</a>


          </ul>
        </li>
        {% endif %}
<!--
            <li class="nav-item">
        <a class="nav-link" href="{{url}}/mail/{{ current_user.username or current_user.email }}"><i class="bi bi-mailbox"></i> <strong>Mailbox</strong> </a>
      </li>
-->
{% if global_config['mode'] == 'FULL' or global_config['mode'] == 'DMR_ONLY' %}
<li class="nav-item">
  <a class="nav-link" href="{{url}}/generate_passphrase"><i class="bi bi-info-square"></i> Server(s) </a>
</li>
{% endif %}
            <li class="nav-item dropdown">
          <a class="nav-link dropdown-toggle" href="#" id="features_menu" role="button" data-bs-toggle="dropdown" aria-expanded="false">
           <i class="bi bi-arrow-down-square"></i> Features 
          </a>
          <ul class="dropdown-menu" aria-labelledby="features_menu">
    {% if global_config['messages'] > 0 %}
            <li><a class="dropdown-item" href="{{url}}/mail/{{ current_user.username or current_user.email }}"><i class="bi bi-mailbox"></i> <strong>Mailbox - {{global_config['messages']}}</strong></a></li>
    {% else %}
            <li><a class="dropdown-item" href="{{url}}/mail/{{ current_user.username or current_user.email }}"><i class="bi bi-mailbox"></i> Mailbox </a></li>
    {% endif %}
            <li><a class="dropdown-item" href="{{url}}/discussion"><i class="bi bi-chat-right-quote"></i> Discussion </a></li>
          </ul>
        </li>

        <li class="nav-item dropdown">
          <a class="nav-link dropdown-toggle" href="#" id="settings_menu" role="button" data-bs-toggle="dropdown" aria-expanded="false">
           <i class="bi bi-toggles"></i> Settings 
          </a>
          <ul class="dropdown-menu" aria-labelledby="settings_menu">

            <li><a class="dropdown-item" href="{{ url_for('user.edit_user_profile') }}"><i class="bi bi-file-person"></i> Edit Profile </a></li>
    {% if global_config['mode'] == 'FULL' or global_config['mode'] == 'DASH_ONLY' %}
            <li><a class="dropdown-item" href="{{url}}/aprs_settings"><i class="bi bi-geo"></i> APRS Configuration </a></li>
    {% endif %}
          </ul>
        </li>
    
    <!--
            <li class="nav-item">
        <a class="nav-link" href="{{url}}/generate_passphrase"><i class="bi bi-info-square"></i> Passphrase(s) </a>
      </li>
                <li class="nav-item">
        <a class="nav-link" href="{{ url_for('user.edit_user_profile') }}"><i class="bi bi-file-person"></i> Change {{ current_user.username or current_user.email }} </a>
      </li>
    -->
           <li class="nav-item">
        <a class="nav-link" href="{{ url_for('user.logout') }}"><i class="bi bi-door-closed"></i> Sign Out </a>
      </li>
          {% endif %}

    </ul>
    
  </div>

</nav> 

   
    {% block body %}

    <hr class="no-margins"/>

    <div id="main-div" class="with-margins">
    {# One-time system messages called Flash messages #}
    {% block flash_messages %}
        {%- with messages = get_flashed_messages(with_categories=true) -%}
            {% if messages %}
                {% for category, message in messages %}
                    {% if category=='error' %}
                        {% set category='danger' %}
                    {% endif %}
                    <div class="alert alert-{{category}}">{{ message|safe }}</div>
                {% endfor %}
            {% endif %}
        {%- endwith %}
    {% endblock %}
    {% block main %}
        {% block content %}

                {{markup_content}}

    {% endblock %}
    {% endblock %}
    </div>

    <br/>
    <hr class="no-margins"/>
    <div id="footer-div" class="clearfix with-margins">
    <p style="text-align: center;"><strong>{{ user_manager.USER_APP_NAME }}<br /></strong><a href="https://hbnet.xyz">HBNet Project</a><br /><strong>{{global_config['hbnet_version']}}</strong>&nbsp;</p>

    </div>
    {% endblock %}

    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <!-- Bootstrap -->

    <script src="https://cdn.jsdelivr.net/npm/jquery/dist/jquery.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>
    <script src="https://unpkg.com/bootstrap-table@1.18.3/dist/bootstrap-table.min.js"></script>
    <!-- Latest compiled and minified JavaScript -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap-select@1.14.0-beta3/dist/js/bootstrap-select.min.js"></script>


    {# *** Allow sub-templates to insert extra html to the bottom of the body *** #}
    {% block extra_js %}{% endblock %}

  </body>
</html>
