<h2 id="{{ reportId }}" style="color: rgb({{ reportTitleTextColor }}); font-size: {{ reportTitleTextSize }}pt;">
    {{ reportName }}
</h2>

{% if reportRows is empty %}
    {{ 'CoreHome_ThereIsNoDataForThisReport'|translate }}
{% else %}
    {% if displayGraph %}
        <img alt=""
                {% if renderImageInline %}
                    src="data:image/png;base64,{{ generatedImageGraph }}"
                {% else %}
                    src="cid:{{ reportId }}"
                {% endif %}
                height="{{ graphHeight }}"
                width="{{ graphWidth }}"/>
    {% endif %}

    {% if displayGraph and displayTable %}
        <br/>
        <br/>
    {% endif %}

    {% if displayTable %}
        <table style="border-collapse:collapse; margin-left: 5px;">
            <thead style="background-color: rgb({{ tableHeaderBgColor }}); color: rgb({{ tableHeaderTextColor }}); font-size: {{ reportTableHeaderTextSize }}pt;">
            {% for columnName in reportColumns %}
                <th style="padding: 6px 0;">
                    &nbsp;{{ columnName }}&nbsp;&nbsp;
                </th>
            {% endfor %}
            </thead>
            <tbody>
            {% set cycleValues=['','background-color: rgb('~tableBgColor~')'] %}
            {% set cycleIndex=0 %}
            {% for rowId,row in reportRows %}
                {% set rowMetrics=row.columns %}

                {% if reportRowsMetadata[rowId] is defined %}
                    {% set rowMetadata=reportRowsMetadata[rowId].columns %}
                {% else %}
                    {% set rowMetadata=null %}
                {% endif %}
                <tr style="{{ cycle(cycleValues, cycleIndex) }}">
                    {% set cycleIndex=cycleIndex+1 %}
                    {% for columnId, columnName in reportColumns %}
                        <td style="font-size: {{ reportTableRowTextSize }}pt; border-bottom: 1px solid rgb({{ tableCellBorderColor }}); padding: 5px 0 5px 5px;">
                            {% if columnId == 'label' %}
                                {% if rowMetrics[columnId] is defined %}
                                    {% if rowMetadata.logo is defined %}
                                        <img src='{{ currentPath }}{{ rowMetadata.logo }}'>
                                        &nbsp;
                                    {% endif %}
                                    {% if rowMetadata.url is defined %}
                                        <a style="color: rgb({{ reportTextColor }});" href='{% if rowMetadata.url|slice(0,4) not in ['http','ftp:'] %}http://{% endif %}{{ rowMetadata.url }}'>
                                    {% endif %}
                                    {{ rowMetrics[columnId] | raw }}{# labels are escaped by SafeDecodeLabel filter in core/API/Response.php #}
                                    {% if rowMetadata.url is defined %}
                                        </a>
                                    {% endif %}
                                {% endif %}
                            {% else %}
                                {% if rowMetrics[columnId] is empty %}
                                    0
                                {% else %}
                                    {{ rowMetrics[columnId] }}
                                {% endif %}
                            {% endif %}
                        </td>
                    {% endfor %}
                </tr>
            {% endfor %}
            </tbody>
        </table>
    {% endif %}
    <br/>
    <a style="text-decoration:none; color: rgb({{ reportTitleTextColor }}); font-size: {{ reportBackToTopTextSize }}pt;" href="#reportTop">
        {{ 'ScheduledReports_TopOfReport'|translate }}
    </a>
{% endif %}
