{% macro phones(phone, core, locale, rtl = false, abbr = true) %}
{% if phone.details and not rtl and abbr %}<abbr title="{{ phone.details|striptags|raw }} {{ phone.number|striptags|raw }}">{{ phone.details|raw }}:&nbsp;</abbr>{% endif %}
<a href="tel:{{ phone.callto|raw }}" title="{{ phone.number|striptags|raw }}">{{ phone.number|raw }}</a>{% if phone.operator %}<img src="{{ core.operators }}/{{ phone.operator }}.png" width="100" height="50" class="flag" alt="{{ phone.details|striptags|raw }}{{ phone.number|striptags|raw }}{{ locale.operator[phone.operator] }}" title="{{ phone.details|striptags|raw }}{{ phone.number|striptags|raw }} ({{ locale.operator[phone.operator]|raw }})">{% endif %}
{% if phone.details and rtl and abbr %}<abbr title="{{ phone.details|striptags|raw }} {{ phone.number|striptags|raw }}">:&nbsp;{{ phone.details|raw }}</abbr>{% endif %}
{% endmacro %}

{% macro phonesIcons(phone, rounded = false) %}
<a href="tel:{{ phone.callto|raw }}" class="social-icon{% if rounded %}-rounded{% endif %}" title="Ligar para {{ phone.number }}"><i class="fa fa-phone"></i></a>
{% endmacro %}

{% macro emails(email) %}
{% if email.labels %}<abbr title="{{ email.labels|striptags|raw }} {{ email.emails|striptags|raw }}">{{ email.labels|raw }}:&nbsp;</abbr>{% endif %}
<a href="mailto:{{ email.emails|striptags|raw }}" title="{{ email.emails|striptags|raw }}">{{ email.emails|raw }}</a>
{% endmacro %}

{% macro address(address, block = true) %}
{% if address.address %}{{ address.address|raw }}{% endif %}{% if block and address.address %}<br>{% elseif address.address %} - {% endif %}{% if address.district %}{{ address.district|raw }}{% endif %}{% if address.city %}{{ address.city|raw }}{% endif %}{% if address.state %}/{{ address.state|raw }}{% endif %}{% if address.cep %} | CEP: {{ address.cep|raw }}{% endif %}{% if address.postal %}<br>CX POSTAL: {{ address.postal|raw }}{% endif %}
{% endmacro %}

{% macro list(footer, extra) %}
{% import _self as componentInfo %}

{% if footer.phones %}
<h3 class="heading-macro"><i class="fa fa-phone"></i> {{ extra.phones|raw }}</h3>

<ul class="list-unstyled">
    {% for item in footer.phones %}
    <li>{{ componentInfo.phones(item, core, locale, false, false) }}</li>
    {% endfor %}
</ul>
{% endif %}

{% if footer.emails %}
<h3 class="heading-macro"><i class="fa fa-envelope"></i> {{ extra.emails|raw }}</h3>

<ul class="list-unstyled">
    {% for item in footer.emails %}
    <li>{{ componentInfo.emails(item) }}</li>
    {% endfor %}
</ul>
{% endif %}

{% if footer.address %}
<h3 class="heading-macro"><i class="fa fa-map-marker"></i> {{ extra.address|raw }}</h3>
<p>{{ componentInfo.address(footer.address) }}</p>
{% endif %}
{% endmacro %}

{% macro grid(footer, extra) %}
{% import _self as componentInfo %}
<div class="row addressContent">
    {% if footer.address %}
    <div class="grid-control grid-control-noborder col col-md-4">
        <h3 class="heading-macro"><i class="fa fa-map-marker"></i> {{ extra.address|raw }}</h3>

        <p>{{ componentInfo.address(footer.address) }}</p>
    </div>
    {% endif %}

    {% if footer.emails %}
    <div class="grid-control grid-control-noborder col col-md-4">
        <h3 class="heading-macro"><i class="fa fa-envelope"></i> {{ extra.emails|raw }}</h3>

        <ul class="list-unstyled">
            {% for item in footer.emails %}
            <li>{{ componentInfo.emails(item) }}</li>
            {% endfor %}
        </ul>
    </div>
    {% endif %}

    {% if footer.phones %}
    <div class="grid-control grid-control-noborder col col-md-4">
        <h3 class="heading-macro"><i class="fa fa-phone"></i> {{ extra.phones|raw }}</h3>

        <ul class="list-unstyled">
            {% for item in footer.phones %}
            <li>{{ componentInfo.phones(item, core, locale) }}</li>
            {% endfor %}
        </ul>
    </div>
    {% endif %}

    {% if footer.businessHour %}
    <div class="grid-control grid-control-noborder col col-md-12">
        <h3 class="heading-macro"><i class="fa fa-calendar"></i> Horário de Atendimento</h3>

        <ul class="list-unstyled">
            {% for item in footer.businessHour %}
            <li>{{ item|raw }}</li>
            {% endfor %}
        </ul>
    </div>
    {% endif %}
</div>
{% endmacro %}

{% macro phonesOnly(footer, rounded) %}
{% import _self as componentInfo %}
{% for item in footer.phones %}
<li>{{ componentInfo.phonesIcons(item, rounded) }}</li>
{% endfor %}
{% endmacro %}
