{%- macro render_result_asn(geoip_result) %}
                    <div class="card overflow-hidden">
                        <div class="card-header">
                            <h5 class="card-title mb-0">{{ _('ASN lookup') }}</h5>
                        </div>
                        <table class="table">
                            <tbody>
                                {%- if 'asn' in geoip_result['asn'] %}
                                <tr>
                                    <th class="w-25">{{ _('AS number') }}:</th>
                                    <td>{{ geoip_result['asn']['asn'] }}</td>
                                </tr>
                                {%- endif %}
                                {%- if 'org' in geoip_result['asn'] %}
                                <tr>
                                    <th class="w-25">{{ _('Organization') }}:</th>
                                    <td>{{ geoip_result['asn']['org'] }}</td>
                                </tr>
                                {%- endif %}
                            </tbody>
                        </table>
                    </div>
{%- endmacro %}

{%- macro render_result_city(geoip_result) %}
                    <div class="card overflow-hidden">
                        <div class="card-header">
                            <h5 class="card-title mb-0">{{ _('City lookup') }}</h5>
                        </div>
                        <table class="table">
                            <tbody>
                                {%- if 'cnt_name' in geoip_result['city'] and geoip_result['city']['cnt_name'] %}
                                <tr>
                                    <th class="w-25">{{ _('Continent') }}:</th>
                                    <td>{{ geoip_result['city']['cnt_name'] }} ({{ geoip_result['city']['cnt_code'] | upper }})</td>
                                </tr>
                                {%- endif %}
                                {%- if 'ctr_name' in geoip_result['city'] and geoip_result['city']['ctr_name'] %}
                                <tr>
                                    <th class="w-25">{{ _('Country') }}:</th>
                                    <td>{{ geoip_result['city']['ctr_name'] }} ({{ geoip_result['city']['ctr_code'] | upper }}, {{ get_country_flag(geoip_result['city']['ctr_code']) }})</td>
                                </tr>
                                {%- endif %}
                                {%- if 'cty_name' in geoip_result['city'] and geoip_result['city']['cty_name'] %}
                                <tr>
                                    <th class="w-25">{{ _('City') }}:</th>
                                    <td>{{ geoip_result['city']['cty_name'] }}</td>
                                </tr>
                                {%- endif %}
                                {%- if 'timezone' in geoip_result['city'] %}
                                <tr>
                                    <th class="w-25">{{ _('Timezone') }}:</th>
                                    <td>{{ geoip_result['city']['timezone'] }}</td>
                                </tr>
                                {%- endif %}
                                {%- if 'latitude' in geoip_result['city'] and 'longitude' in geoip_result['city'] %}
                                <tr>
                                    <th class="w-25">{{ _('Coordinates') }}:</th>
                                    <td>@{{ geoip_result['city']['latitude'] }},{{ geoip_result['city']['longitude'] }}</td>
                                </tr>
                                {%- endif %}
                            </tbody>
                        </table>
                    </div>
{%- endmacro %}

{%- macro get_asn_title() -%}
    {{ get_icon('module-geoip') }} {{ _('ASN') }}
{%- endmacro %}

{%- macro get_city_title() -%}
    {{ get_icon('module-geoip') }} {{ _('Location') }}
{%- endmacro %}

{%- macro maxmind_attribution() -%}
<p class="mt-1 mb-0">
    <small>
        {{ _('Search powered by GeoLite2 data created by <a href="https://www.maxmind.com/">MaxMind</a>.') | safe }}
    </small>
</p>
{%- endmacro %}
