{{ header }}
<header class="background-white bottom-margin-large">
  <div class="container-fluid">
    <div class="row no-space-xs">
      <div class="col-xs-12">
        <div class="content-box vertical-padding-large flex between-xs middle-xs">
          <div>
            <span class="text-x-large text-dark">{{ heading_title }}</span>
            <div class="adm-breadcrumb">
              {% for breadcrumb in breadcrumbs %}
              <i class="fas fa-angle-right text-x-small text-gray horizontal-padding-small"></i>
              <a class="text-x-small text-gray text-decoration-none"
                href="{{ breadcrumb.href }}">{{ breadcrumb.text }}</a>
              {% endfor %}
            </div>
          </div>
          <div>
            <a onclick="errorLog('clear')" class="btn-default btn-medium btn-primary">
              <span>{{ button_clear }}</span>
            </a>
          </div>
          {% if error_warning %}
            <div class="warning full-width top-margin-medium">{{ error_warning }}</div>
          {% endif %}
          {% if success %}
            <div class="success full-width top-margin-medium">{{ success }}</div>
          {% endif %}
        </div>
      </div>
    </div>
  </div>
</header>
  <div class="container-fluid">
    <div class="col-xs-12">
      <div class="row x-small-space-xs middle-xs bottom-margin-large">
        <div class="col-xs-2">
          <label class="field field-medium">
            <input type="text" name="data_inicial" title="data do evento" value="{{ data_log_inicio }}" class="date field-entry" />
          </label>
        </div>
        <div class="col-xs-2">
          <label class="field field-medium">
            <input type="text" name="data_final" value="{{ data_log_fim }}" class="date field-entry" />
          </label>
        </div>
        <div class="col-xs-2">
          <a onclick="errorLog('listlogs')" class="btn-default btn-medium btn-primary">
            <span>{{ button_listlog }}</span>
          </a>
        </div>
      </div>
    </div>
  </div>
  <div class="container-fluid visible-block text-decoration-none background-white shadow-small bottom-margin-small">
    <div class="col-xs-12">
      <textarea wrap="off" style="width: 100%; max-width: 100%; height: 300px; padding: 5px; border: 1px solid #CCCCCC; background: #FFFFFF; overflow: scroll; margin-top: 5px;">{{ log }}</textarea>
    </div>
  </div>
{{ footer }}

<script type="text/javascript">
  function errorLog(funcao) {
    var token = document.querySelector('body').getAttribute('data-token');
    url = 'index.php?route=tool/error_log/' + funcao + '&token=' + token;

    var data_log_inicio = $('input[name=\'data_inicial\']').attr('value');

    if (data_log_inicio) {
      url += '&data_log_inicio=' + encodeURIComponent(data_log_inicio);
    }

    var data_log_fim = $('input[name=\'data_final\']').attr('value');

    if (data_log_fim) {
      url += '&data_log_fim=' + encodeURIComponent(data_log_fim);
    }

    location = url;
  }

  $(document).ready(function () {
    $(".date").datepicker({
      changeMonth: true,
      changeYear: true,

      closeText: 'Fechar',
      prevText: '&#x3c;Anterior',
      nextText: 'Pr&oacute;ximo&#x3e;',
      currentText: 'Hoje',
      monthNames: ['Janeiro', 'Fevereiro', 'Mar&ccedil;o', 'Abril', 'Maio', 'Junho',
        'Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro'],
      monthNamesShort: ['Jan', 'Fev', 'Mar', 'Abr', 'Mai', 'Jun',
        'Jul', 'Ago', 'Set', 'Out', 'Nov', 'Dez'],
      dayNames: ['Domingo', 'Segunda-feira', 'Ter&ccedil;a-feira', 'Quarta-feira',
        'Quinta-feira', 'Sexta-feira', 'Sabado'],
      dayNamesShort: ['Dom', 'Seg', 'Ter', 'Qua', 'Qui', 'Sex', 'Sab'],
      dayNamesMin: ['Dom', 'Seg', 'Ter', 'Qua', 'Qui', 'Sex', 'Sab'],
      weekHeader: 'Sm',
      firstDay: 0,
      isRTL: false,
      showMonthAfterYear: false,
      yearSuffix: '',

      dateFormat: "dd/mm/yy",
      minDate: new Date(1990, 1 - 1, 1),
    });
  });
</script>