{% extends 'layouts/print.twig' %}

{% block content %}
  <main class="report-page">
    <header class="report-header">
      <div>
        <img class="report-logo" src="{{ logo_src }}" alt="Company logo">
        <p>{{ company.name }}</p>
      </div>
      <div class="report-title">
        <h1>{{ report_title }}</h1>
        <p>{{ date_from }} to {{ date_to }}</p>
      </div>
    </header>

    {% if subject is defined and subject %}
      <section class="report-subject">
        <strong>{{ subject.title }}</strong>
        <span>{{ subject.detail }}</span>
      </section>
    {% endif %}

    <table class="report-summary">
      <tbody>
        <tr>
          {% for metric in metrics %}
            <td>
              <span>{{ metric.label }}</span>
              <strong>{{ metric.value }}</strong>
            </td>
          {% endfor %}
        </tr>
      </tbody>
    </table>

    {% if sections is defined %}
      {% for section in sections %}
        <section class="report-section">
          <h2>{{ section.title }}</h2>
          {% include 'pdf/report_table.twig' with {columns: section.columns, rows: section.rows, empty_message: section.empty_message} %}
        </section>
      {% endfor %}
    {% else %}
      {% include 'pdf/report_table.twig' with {columns: columns, rows: rows, empty_message: empty_message} %}
    {% endif %}

    <footer class="report-footer">
      <span>{{ company.phone ?: '' }}</span>
      <span>{{ company.email ?: '' }}</span>
      <span>{{ company.address ?: '' }}</span>
    </footer>
  </main>
{% endblock %}
