{% extends "admin/login.html" %}
{% load static %}
{% load sso_tags %}
{% load show_form %}
{% load i18n %}

{% block extrastyle %}
    {{ block.super }}
    {% define_sso_providers as sso_providers %}
    {% for provider in sso_providers %}
        <link rel="stylesheet" href="{{ provider.css_url }}">
    {% endfor %}
{% endblock %}

{# Default Django Admin Block #}
{% block content %}
    {% define_show_form as show_form %}
    {% if show_form %}
        {{ block.super }}
    {% endif %}
    {% include 'microsoft_sso/login_sso.html' %}
{% endblock %}

{# Django Unfold Admin Block #}
{% block base %}
    {{ block.super }}  {# Process HTML login elements from Django Unfold #}
	{% include 'microsoft_sso/login_sso.html' %} {# Add Microsoft SSO HTML elements #}
    <script>
        {% define_show_form as show_form %}
        {% if show_form %}
            $(document).ready(function() {
                $(".login-box").insertAfter("#login-form");
            });
        {% else %}
            $("#login-form").remove();
            $(document).ready(function() {
                $(".login-box").insertAfter(".font-semibold.mb-10");
            });
        {% endif %}
    </script>
{% endblock %}
