{% extends 'base/base.html' %}
{% load form_helpers %}
{% load static %}

{% block layout %}
  <main class="login-container text-center">

    {# Login banner #}
    {% if settings.BANNER_LOGIN %}
      <div class="alert alert-secondary mw-90 mw-md-75 mw-lg-80 mw-xl-75 mw-xxl-50" role="alert">
        {{ settings.BANNER_LOGIN|safe }}
      </div>
    {% endif %}

    {# Login form #}
    <div>
      {# Logo #}
      <div class="mb-4">
        <img src="{% static 'netbox_logo.svg' %}" height="80" alt="NetBox logo" />
      </div>

      <p class="text-muted">Please pick an authentication method</p>

      <div>
        <a class="btn btn-primary" href="{{ auth_url }}">Azure AD</a>
        <a class="btn btn-primary" href="/admin/login/">Password</a>
      </div>
    </div>

    {# Login form errors #}
    {% if form.non_field_errors %}
      <div class="alert alert-danger" role="alert">
        <h4 class="alert-heading">Errors</h4>
        <p>
          {{ form.non_field_errors }}
        </p>
      </div>
    {% endif %}
  </main>

  {# Page footer #}
  <footer class="footer container-fluid login-footer p-3">
    <div class="row align-items-center w-100">
      <div class="col-2 col-md-1 mb-0">
        <button type="button" class="btn btn-sm color-mode-toggle" title="Toggle Color Mode">
          <i class="color-mode-icon mdi mdi-lightbulb"></i>&nbsp;
        </button>
      </div>
      <div class="col-1 col-md-auto mb-0"></div>
      <div class="col text-end mb-0">
        <small class="text-muted">
          {{ settings.HOSTNAME }} (v{{ settings.VERSION }})
        </small>
      </div>
    </div>
  </footer>

{% endblock layout %}
