{% load static i18n vault_tags %}

<!DOCTYPE html>
<html {% if LANGUAGE_BIDI %}dir="rtl"{% endif %}>
<head>
  <title>{% block title %}Vault Admin - {{ title }}{% endblock %}</title>

  {% block metatags %}{% endblock %}

  <link rel="stylesheet" type="text/css" href="{% static 'vendor/css/bootstrap.min.css' %}" />
  <link rel="stylesheet" type="text/css" href="{% static 'vendor/css/font-awesome-all.min.css' %}" />
  <link rel="stylesheet" type="text/css" href="{% static 'vault/css/base.css' %}" />
  {% block extrastyle %}{% endblock %}

  <!--[if lte IE 7]><link rel="stylesheet" type="text/css" href="{% block stylesheet_ie %}{% static "admin/css/ie.css" %}{% endblock %}" /><![endif]-->
  {% if LANGUAGE_BIDI %}<link rel="stylesheet" type="text/css" href="{% block stylesheet_rtl %}{% static "admin/css/rtl.css" %}{% endblock %}" />{% endif %}

  <script type="text/javascript">window.__admin_media_prefix__ = "{% filter escapejs %}{% static "admin/" %}{% endfilter %}";</script>
  <script type="text/javascript">window.__admin_utc_offset__ = "{% filter escapejs %}{% now "Z" %}{% endfilter %}";</script>

  {% block extrahead %}{% endblock %}
  {% block blockbots %}<meta name="robots" content="NONE,NOARCHIVE" />{% endblock %}

  <script src="{% static 'vendor/js/jquery-2.1.1.min.js' %}"></script>
  <script src="{% static 'vendor/js/bootstrap.bundle.min.js' %}"></script>
  <script src="{% static 'vault/js/base.js' %}"></script>
</head>

<body class="{% if is_popup %}popup {% endif %}{% block bodyclass %}{% endblock %}">

{% include "vault/sidebar.html" %}

<!-- Content -->
<section id="content" class="container-fluid">
  <div class="row">

    <h2 class="content-title col-md-8">
      {% block content_title %}{{ title }}{% endblock %}
      {% block breadcrumbs %}
      {% endblock %}
    </h2>

    <div class="content-top col-md-4">
      {% block pretitle %}{% endblock %}
      {% block content_top %}{% endblock %}
    </div>

    <div class="content-body col-md-12">
      {% block content %}
        {% block object-tools %}{% endblock %}
        {{ content }}
      {% endblock %}
      {% block sidebar %}{% endblock %}
    </div>

  </div>
</section>
<!-- END Content -->

{% block footer %}<div id="footer"></div>{% endblock %}

<!-- messages -->
<ul class="messages"></ul>

<script src="{% static 'vendor/js/tools.bundle.js' %}"></script>
<script src="{% static 'vendor/js/bootbox.all.min.js' %}"></script>
<script>
bootbox.setDefaults({
  locale: 'br',
  backdrop: true,
  centerVertical: true
});
</script>

<script>Base.init();</script>

{% if messages %}
<script>
  let messages = {};
{% for message in messages %}
  if (!messages['{{message|safe|capfirst}}']) {
    messages['{{message|safe|capfirst}}'] = {
      'type': '{% if message.tags %}{{ message.tags }}{% endif %}',
      'count': 1
    };
  } else {
    messages['{{message|safe|capfirst}}'].count += 1;
  }
{% endfor %}
  Object.keys(messages).forEach(m => {
    Base.Messages.setMessage({
      description: messages[m].count == 1 ? m : m + " (" + messages[m].count + ")",
      type: messages[m].type
    });
  });
</script>
{% endif %}

{% block js_bottom %}{% endblock %}
</body>
</html>
