{% extends 'base.twig' %}

{% block content %}
<div class="row">
  <div class="col-md-12">
    <div class="card card-xs-lg">
      <div class="card-header d-flex">
        {{ lang.quarantine.quarantine }} <span class="badge bg-info table-lines"></span>
        <div class="btn-group ms-auto">
          <button class="btn btn-xs btn-xs-lg btn-secondary refresh_table" data-draw="draw_quarantine_table" data-table="quarantinetable">{{ lang.quarantine.refresh }}</button>
        </div>
      </div>
      <div class="card-body">
        <div class="mass-actions-quarantine mb-4">
          <div class="btn-group" data-acl="{{ acl.quarantine }}">
            <a class="btn btn-sm btn-xs-half d-block d-sm-inline btn-secondary" id="toggle_multi_select_all" data-id="qitems" href="#"><i class="bi bi-check-all"></i> {{ lang.quarantine.toggle_all }}</a>
            <a class="btn btn-sm btn-xs-half d-block d-sm-inline btn-secondary dropdown-toggle" data-bs-toggle="dropdown" href="#">{{ lang.quarantine.quick_actions }}</a>
            <ul class="dropdown-menu">
              <li class="table_collapse_option"><a class="dropdown-item" data-datatables-expand="quarantinetable" data-table="quarantinetable" href="#">{{ lang.datatables.expand_all }}</a></li>
              <li class="table_collapse_option"><a class="dropdown-item" data-datatables-collapse="quarantinetable" data-table="quarantinetable" href="#">{{ lang.datatables.collapse_all }}</a></li>
              <li class="table_collapse_option"><hr class="dropdown-divider"></li>
              <li><a class="dropdown-item" data-action="edit_selected" data-id="qitems" data-api-url='edit/qitem' data-api-attr='{"action":"release"}' href="#">{{ lang.quarantine.deliver_inbox }}</a></li>
              <li><hr class="dropdown-divider"></li>
              <li><a class="dropdown-item" data-action="edit_selected" data-id="qitems" data-api-url='edit/qitem' data-api-attr='{"action":"learnspam"}' href="#">{{ lang.quarantine.learn_spam_delete }}</a></li>
              <li><hr class="dropdown-divider"></li>
              <li><a class="dropdown-item" data-action="delete_selected" data-id="qitems" data-api-url='delete/qitem' href="#">{{ lang.quarantine.remove }}</a></li>
            </ul>
          </div>
        </div>
        <p class="text-muted">{{ lang.quarantine.qinfo|raw }}</p>
        <p>
          {% if not quarantine_settings.retention_size or not quarantine_settings.max_size %}
          <div class="alert alert-info">{{ lang.quarantine.disabled_by_config }}</div>
          {% else %}
          <p style="margin:10px" class="text-muted">
            {{ lang.quarantine.settings_info|format(quarantine_settings.retention_size, quarantine_settings.max_size)|raw }}
          </p>
          {% endif %}
        </p>
        <table id="quarantinetable" class="table table-striped w-100"></table>
        <div class="mass-actions-quarantine mt-4">
          <div class="btn-group" data-acl="{{ acl.quarantine }}">
            <a class="btn btn-sm btn-xs-half d-block d-sm-inline btn-secondary" id="toggle_multi_select_all" data-id="qitems" href="#"><i class="bi bi-check-all"></i> {{ lang.quarantine.toggle_all }}</a>
            <a class="btn btn-sm btn-xs-half d-block d-sm-inline btn-secondary dropdown-toggle" data-bs-toggle="dropdown" href="#">{{ lang.quarantine.quick_actions }}</a>
            <ul class="dropdown-menu">
              <li class="table_collapse_option"><a class="dropdown-item" data-datatables-expand="quarantinetable" data-table="quarantinetable" href="#">{{ lang.datatables.expand_all }}</a></li>
              <li class="table_collapse_option"><a class="dropdown-item" data-datatables-collapse="quarantinetable" data-table="quarantinetable" href="#">{{ lang.datatables.collapse_all }}</a></li>
              <li class="table_collapse_option"><hr class="dropdown-divider"></li>
              <li><a class="dropdown-item" data-action="edit_selected" data-id="qitems" data-api-url='edit/qitem' data-api-attr='{"action":"release"}' href="#">{{ lang.quarantine.deliver_inbox }}</a></li>
              <li><hr class="dropdown-divider"></li>
              <li><a class="dropdown-item" data-action="edit_selected" data-id="qitems" data-api-url='edit/qitem' data-api-attr='{"action":"learnspam"}' href="#">{{ lang.quarantine.learn_spam_delete }}</a></li>
              <li><hr class="dropdown-divider"></li>
              <li><a class="dropdown-item" data-action="delete_selected" data-id="qitems" data-api-url='delete/qitem' href="#">{{ lang.quarantine.remove }}</a></li>
            </ul>
          </div>
        </div>
      </div>
    </div>
  </div> <!-- /col-md-12 -->
</div> <!-- /row -->

{% include 'modals/quarantine.twig' %}

<script type='text/javascript'>
var acl = '{{ acl_json|raw }}';
var lang = {{ lang_quarantine|raw }};
var lang_datatables = {{ lang_datatables|raw }};
var csrf_token = '{{ csrf_token }}';
var pagination_size = Math.trunc('{{ pagination_size }}');
var role = '{{ role }}';
</script>
{% endblock %}