{% extends "pdf/base.html" %}
{% load i18n %}
{% block extra_head %}
<style>
    body {
        margin: 0;
        padding: 0;
    }
    .contacts {
        padding: 0;
        margin: 0;
        display: block;
    }
    .line {
        display: block;
        margin: 0;
        padding: 0;
        height: 0;
        width: 0;
        height: 38.1mm;
        width: 210mm;
    }
    .header, .footer {
        height: 15.15mm;
        width: 210mm;
    }
    .cell {
        display: inline-block;
        width: 63.5mm;
        height: 38.1mm;
        margin: 0;
        text-align: left;
        vertical-align: middle;
        font-family: "Calibri";
        font-size: 9px;
    }
    
    .cell-content {
        margin-top: 10mm;
        margin-left: 0mm;
    }
    
    .line .cell {
        margin-left: 2.5mm
    }
    .line .cell:nth-of-type(1) {
        margin-left: 7.25mm;
    }
    .warning {
        color: red;
    }
</style>
{% endblock %}

{% block content %}
    <div class="contacts">
    {% for c in contacts %}
        {% if forloop.counter0 == 0 %}
            <div class="header">&nbsp;</div>
        {% endif %}
        {% if forloop.counter0 == 0 or forloop.counter0|divisibleby:3 %}
            <div class="line">
        {% endif %}
                <div class="cell"><div class="cell-content">
                    {% block cell_content %}{% include "pdf/_contact_address.html" %}{% endblock %}
                </div></div>
        {% if forloop.counter|divisibleby:3 %}
            </div>
        {% endif %}
        {% if forloop.counter|divisibleby:21 %}
            <div class="footer">&nbsp;</div>
            <div class="header">&nbsp;</div>
        {% endif %}
    {% endfor %}
    </div>
{% endblock %}
