{% load static %}
{% load solo_tags %}
{% load show_menu %}
{% get_solo 'portal.SiteConfiguration' as site_conf %}

<!doctype html>
<html lang="en" data-bs-theme="auto">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="color-scheme" content="light dark">
    <meta name="description" content="{{ site_conf.about|striptags }}">
    <meta name="author" content="{{ site_conf.site_author }}">
    <meta name="generator" content="Django Framework">
    <title>{% block title %}{{ title }}{% endblock %} - {{ site_conf.site_name }}</title>
    <link rel="icon" href="{% static "favicon.png" %}" sizes="any">
    <link rel="icon" href="{% static "favicon.svg" %}" type="image/svg+xml">
    {% if site_conf.use_cdn %}
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/css/bootstrap.min.css" rel="stylesheet">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.13.1/font/bootstrap-icons.css" rel="stylesheet">
    {% else %}
    <link href="{% static "bootstrap@5.3.8/dist/css/bootstrap.min.css" %}" rel="stylesheet">
    <link href="{% static "bootstrap-icons@1.13.1/font/bootstrap-icons.css" %}" rel="stylesheet">
    {% endif %}
    <link href="{% static "css/main.min.css" %}?v={{ site_conf.version }}" rel="stylesheet">
    <script src="{% static "js/main.min.js" %}?v={{ site_conf.version }}"></script>
    {% block extra_head %}
    {%  if site_conf.extra_html %}{{ site_conf.extra_html | safe }}{% endif %}
    {%  if site_conf.extra_js %}<script src="{% url 'extra_js' %}"></script>{% endif %}
    {% endblock %}
  </head>
  <body>
    <header>
      <nav class="navbar navbar-expand-sm bg-body-tertiary shadow-sm">
        <div class="container d-flex">
          <div class="me-auto">
            <a href="{% url 'index' %}" class="navbar-brand d-flex align-items-center">
              <svg class="me-2" width="32" height="16" version="1.0" viewBox="0 0 24 12" xmlns="http://www.w3.org/2000/svg">
                <g transform="matrix(.0039261 0 0 -.0039261 -1.4249 18.53)">
                  <path d="m813 4723-103-4v-309h-355l14-330h369l6-42c39-273 39-1414 0-1659l-7-39h-368l-14-330h355v-318l41-7c23-4 126-7 229-7s206 3 229 7l41 7v318h670v-318l41-7c23-4 126-7 229-7s206 3 229 7l41 7v318h670v-318l37-7c48-9 432-9 472 0l31 7v318h680v-318l31-7c39-9 423-9 469 0l35 6v314l338 3 337 2v-318l38-7c48-9 416-9 465 0l37 7v318h335v2400h-335v307l-135 6c-74 3-196 3-270 0l-135-6v-307l-337 2-338 3v302l-132 6c-73 3-194 3-268 0l-135-6v-307h-680v307l-135 6c-74 3-196 3-270 0l-135-6v-307h-670v307l-135 6c-74 3-196 3-270 0l-135-6v-307h-670v310h-63c-35 0-111 2-168 4s-150 1-206-1zm1141-666c3-12 11-97 18-187 24-309 11-1402-18-1507l-6-23h-725l-7 32c-39 197-39 1454 0 1676l6 32h726zm1218-42c20-182 30-569 25-940-6-371-21-707-33-727-3-4-169-8-368-8h-363l-7 48c-38 277-38 1365 1 1647l6 45 366-2 366-3zm1203 53c39-103 45-1264 9-1660l-7-68h-735l-6 68c-35 381-35 1263 0 1610l6 62h364c283 0 366-3 369-12zm1219-42c37-316 37-1287 0-1628l-7-58h-734l-6 73c-37 424-31 1544 8 1655 3 9 86 12 368 12h364zm841-1686c-336 0-363 1-370 18-3 9-13 152-22 317-21 431-7 1292 23 1388 5 16 31 17 369 17z"/>
                </g>
              </svg>
              <strong>{{ site_conf.site_name }}</strong>
            </a>
         </div>
         {% include '_includes/login.html' %}
        </div>
      </nav>
    </header>
    <main>
      <div class="container py-2">
        <nav class="navbar navbar-expand-lg">
          <div class="container-fluid g-0">
            <a class="navbar-brand" href="{% url 'index' %}">Home</a>
            <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
            <span class="navbar-toggler-icon"></span>
            </button>
            <div class="collapse navbar-collapse" id="navbarSupportedContent">
              <ul class="navbar-nav me-auto mb-2 mb-lg-0">
                <li class="nav-item">
                  <a class="nav-link" href="{% url 'roster' %}">Roster</a>
                </li>
                <li class="nav-item">
                  <a class="nav-link" href="{% url 'consists' %}">Consists</a>
                </li>
                <li class="nav-item dropdown">
                  <a class="nav-link dropdown-toggle" href="#" id="filterDropdownMenu" role="button" data-bs-toggle="dropdown" aria-expanded="false">
                    Search by
                  </a>
                  <ul class="dropdown-menu" aria-labelledby="filterDropdownMenu">
                    <li class="ps-2 text-secondary">Model</li>
                    <li><a class="dropdown-item" href="{% url 'scales' %}">Scale</a></li>
                    <li><a class="dropdown-item" href="{% url 'manufacturers' category='model' %}">Manufacturer</a></li>
                    <li><hr class="dropdown-divider"></li>
                    <li class="ps-2 text-secondary">Prototype</li>
                    <li><a class="dropdown-item" href="{% url 'rolling_stock_types' %}">Type</a></li>
                    <li><a class="dropdown-item" href="{% url 'companies' %}">Company</a></li>
                    <li><a class="dropdown-item" href="{% url 'manufacturers' category='real' %}">Manufacturer</a></li>
                  </ul>
                </li>
                {% show_bookshelf_menu %}
                {% show_flatpages_menu user %}
              </ul>
              {% include '_includes/search.html' %}
            </div>
          </div>
        </nav>
      </div>
      <section class="py-4 text-center container">
        <div class="row">
          <div class="mx-auto">
            <h1 class="fw-light">{{ title }}</h1>
            {% block header %}
            {% endblock %}
          </div>
        </div>
      </section>
      <div class="album py-4 bg-body-tertiary">
        <div class="container">
          {% block carousel %}
          {% endblock %}
          <a id="main-content"></a>
          {% block cards_layout %}
          {% endblock %}
        </div>
        <div class="container">{% block pagination %}{% endblock %}</div>
      </div>
      {% block extra_content %}{% endblock %}
      {% include '_includes/symbols.html' %}
    </main>
    {% include '_includes/footer.html' %}
    {% if site_conf.use_cdn %}
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/js/bootstrap.bundle.min.js"></script>
    {% else %}
    <script src="{% static "bootstrap@5.3.8/dist/js/bootstrap.bundle.min.js" %}"></script>
    {% endif %}
  </body>
</html>
