{% extends "mapit/base.html" %}
{% load i18n %}

{% block title %}{% blocktrans with postcode=postcode.postcode %}Results for “{{ postcode }}”{% endblocktrans %}{% endblock title %}

{% block content %}

<header class="area_info">
    <h2>{{ postcode.postcode }}</h2>
    <ul>
      {% if postcode.coordsyst %}
        <li>{% ifequal postcode.coordsyst "G" %}OSGB{% else %}IRE65{% endifequal %}
        E/N: {{ postcode.easting }}, {{ postcode.northing }}
      {% endif %}
      {% if postcode.wgs84_lat or postcode.wgs84_lon %}
        <li>{% trans "WGS84 lat/lon" %}: <a href="https://tools.wmflabs.org/geohack/geohack.php?params={{ postcode.wgs84_lat|floatformat:-6 }};{{ postcode.wgs84_lon|floatformat:-6 }}">{{ postcode.wgs84_lat|floatformat:-6 }}, {{ postcode.wgs84_lon|floatformat:-6 }}</a>
      {% else %}
        <li>{% blocktrans trimmed %}
    No location information. Note this <em>is</em> a valid postcode (otherwise you would have got a 404), just one for which we don&rsquo;t know the location.
        {% endblocktrans %}</li>
      {% endif %}
        {% url json_view postcode=postcode.postcode as json_url %}
        <li>{% blocktrans %}Get <a href="{{ json_url }}">this data as JSON</a>{% endblocktrans %}</li>
    </ul>

    {% block area_info_extra %}{% endblock %}
</header>

{% if postcode.wgs84_lat or postcode.wgs84_lon %}
{% include "mapit/map/init.html" %}
<script>
    var point = new L.LatLng({{ postcode.wgs84_lat|floatformat:-6 }}, {{ postcode.wgs84_lon|floatformat:-6 }});
    L.Icon.Default.prototype.options.imagePath = '/static/mapit/leaflet/images/';
    var marker = new L.Marker(point);
    map.addLayer(marker);
    map.setView(point, 14);
</script>
{% endif %}

<section class="details">
<h3>{% trans "Areas" %}</h3>
{% include "mapit/areas.html" %}
</section>

{% endblock %}
