<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width">
        <title>Spinta</title>
        <style>

        body {
            margin: 0;
            padding: 0;
        }

        .container {
            padding: 8px;
        }

        /* Table style generated using https://divtable.com/table-styler/ */
        table.table {
            width: 100%;
            text-align: left;
            border-collapse: collapse;
        }
        table.table td {
            border-bottom: 1px solid #b8b8b8;
        }
        table.table th {
            border-bottom: 3px solid #b8b8b8;
        }
        table.table td, table.table th {
            padding: 5px 4px;
        }
        table.table tbody td {
            font-size: 13px;
        }
        table.table thead {
            background: #E8E8E8;
        }
        table.table thead th {
            font-size: 15px;
            font-weight: bold;
            color: #000000;
            text-align: left;
        }
        table.table tfoot td {
            font-size: 14px;
        }
        div.formats {
            text-align: right;
        }
        .warning {
            background-color: #ffe9ea;
            color: #b42b3f;
            margin: 0;
            padding: 8px 16px;
            font-size: 12px;
        }
        .warning a {
            color: #b42b3f;
        }
        </style>
    </head>
    <body>
        <div class="warning">
            <strong>Warning!</strong> This is a <a
            href="https://en.wikipedia.org/wiki/Software_release_life_cycle"
            target="_blank">PRE-ALPHA</a> release. Things might not work as you
            expect. Use at your own risk. If you found any bugs, please <a
            href="https://gitlab.com/atviriduomenys/spinta/-/issues"
            target="_blank">report</a>.
        </div>

        <div class="container">
            <div class="formats">
                <p>
                    Get this data as:
                    <strong>HTML</strong>,
                    {% for fmt, link in formats %}
                        <a href="{{ link }}">{{ fmt }}</a>{% if not loop.last %}, {% endif %}
                    {% endfor %}
                </p>
            </div>

            <p>
            {% for name, link in location %}
                {% if link %}
                    <a href="{{ link }}">{{ name }}</a>
                {% else %}
                    <strong>{{ name }}</strong>
                {% endif %}
                {% if not loop.last %}/{% endif %}
            {% endfor %}
            </p>

            {% if data %}
                <table class="table">
                    <thead>
                        <tr>
                            {% for column in header %}
                            <th>{{ column }}</th>
                            {% endfor %}
                        </tr>
                    </thead>
                    <tbody>
                        {% for row in data %}
                        <tr>
                            {% for cell in row %}
                            <td{% if cell.color %} style="background-color: {{ cell.color }}"{% endif %}>
                                {% if cell.link %}
                                <a href="{{ cell.link }}">{{ cell.value }}</a>
                                {% else %}
                                {{ cell.value }}
                                {% endif %}
                            </td>
                            {% endfor %}
                        </tr>
                        {% endfor %}
                    </tbody>
                </table>

                {% if limit_enforced and data|length >= 100 %}
                <p>Number of rows is limited up to 100 rows.</p>
                {% endif %}
            {% endif %}

            {% if row %}
                <table class="table">
                    <tbody>
                        {% for column, cell in row %}
                        <tr>
                            <th>{{ column }}</th>
                            <td{% if cell.color %} style="background-color: {{ cell.color }}"{% endif %}>
                                {% if column in ('id', 'type') %}
                                <strong>{{ cell.value }}</strong>
                                {% elif cell.link %}
                                <a href="{{ cell.link }}">{{ cell.value }}</a>
                                {% else %}
                                {{ cell.value }}
                                {% endif %}
                            </td>
                        </tr>
                        {% endfor %}
                    </tbody>
                </table>
            {% endif %}
        </div>
    </body>
</html>
