{% extends 'admin/change_form.html' %}

{% load i18n admin_urls static admin_modify %}
{% load edc_dashboard_extras edc_admin_modify edc_navbar_extras %}

{% block extrahead %}{{ block.super }}
    <script src="{% static 'fontawesomefree/js/all.min.js' %}"></script>
{% endblock %}

{% block extrastyle %}{{ block.super }}
    <link rel="stylesheet" type="text/css" href="{% static 'edc_dashboard/css/dark_mode.css' %}">
    {%  for css in edc_model_admin_css_theme_path %}
        <link rel='stylesheet' type="text/css" href='{% static css %}'>
    {% endfor %}
{% endblock %}


{% block breadcrumbs %}{% endblock %}

{% block branding %}
  <button type="button" class="btn btn-{% if LIVE_SYSTEM and not DEBUG %}live{% else %}test{% endif %}">
    {% if LIVE_SYSTEM and not DEBUG %}{{ LIVE|title }}{% else %}{{ TEST|title }}{% endif %}
  </button>&nbsp;
  {{ protocol_name |default:project_name }}: {{ request.site.name|title }} ({{ request.site.id }}) &nbsp;
  <a href="/">{% translate 'Home' %}</a> &rsaquo;
    {% if site_url %}
        <a href="{{ site_url }}">{% translate 'Administration' %}</a>
    {% endif %}
&rsaquo; <a href="{% url 'admin:app_list' app_label=opts.app_label %}">{{ opts.app_config.verbose_name }}</a>
&rsaquo; {% if has_view_permission %}<a href="{% url opts|admin_urlname:'changelist' %}">{{ opts.verbose_name_plural|capfirst }}</a>{% else %}{{ opts.verbose_name_plural|capfirst }}{% endif %}
&rsaquo; {% if add %}{% blocktranslate with name=opts.verbose_name %}Add {{ name }}{% endblocktranslate %}{% else %}{{ original|truncatewords:"18" }}{% endif %}

{% endblock %}

{% block welcome-msg %}{% endblock %}

{% block userlinks %}
<A title="Logout" href="{% url 'edc_auth_admin:logout' %}">Logout</A>  | <strong>{{  user.get_username }}</strong>
{% endblock %}

{% block object-tools-items %}
<li>
    {% url opts|admin_urlname:'history' original.pk|admin_urlquote as history_url %}
    <a href="{% add_preserved_filters history_url %}" class="historylink">{% translate history_label|default:"History" %}</a>
</li>
{% if has_absolute_url %}<li><a href="{{ absolute_url }}" class="viewsitelink">{% translate view_on_site_label|default:"View on site" %}</a></li>{% endif %}
{% endblock %}



{% block field_sets %}

    {% instructions %}

    {% additional_instructions %}

    {% for fieldset in adminform %}
        {#  Custom fieldsets template #}
        {% include "edc_model_admin/admin/fieldset.html" with inline_admin_formsets=inline_admin_formsets %}
    {% endfor %}
{% endblock %}


{# Filter inlines that where already rendered to avoid duplication #}
{% block inline_field_sets %}
    {% for inline_admin_formset in inline_admin_formsets %}
        {% if not inline_admin_formset.opts.insert_after %}
            {% include inline_admin_formset.opts.template %}
        {% endif %}
    {% endfor %}
{% endblock %}

{% block submit_buttons_top %}{% edc_submit_row %}{% endblock %}

{% block submit_buttons_bottom %}

  {% edc_submit_row %}

  {% revision_row %}

{% endblock submit_buttons_bottom %}

