<!doctype html>

<html>

    <head>
        <meta charset="utf-8"/>

        <title>{{ metadata_dict['id'] }}</title>
        
        <!-- Web Fonts -->
        <link href="https://fonts.googleapis.com/css?family=Lato:300,400,400i%7CMontserrat:400,700"
            rel="stylesheet">
        <!-- Map -->
        <link rel="stylesheet" href="https://unpkg.com/leaflet@1.5.1/dist/leaflet.css"
            integrity="sha512-xwE/Az9zrjBIphAcBb3F6JVqxf46+CDLwfLMHloNu6KEQCAWi6HcDUbeOfBIptF7tcCzusKFjFw2yuvEpDL9wQ=="
            crossorigin=""/>
        <script src="https://unpkg.com/leaflet@1.5.1/dist/leaflet.js"
            integrity="sha512-GffPMF3RvMeYyc1LWMHtK8EbPv0iNZ8/oTtHPx9/cc2ILxQ+u905qIwdpULaqDkyBKgOaB57QTMg7ztg8Jm2Og=="
            crossorigin=""></script>
    </head>

    <body style="text-align: justify; line-height: 1.6; font-size: 1rem;
        font-family: Lato, sans-serif; margin: 0;">
        <h1 style="background-color: #222324; color: white;">
            <p style="margin-left: 3rem;">
                <img src={{ logo_link }} onerror="this.style.display='none'">{{ metadata_dict['id'] }}
            </p>
        </h1>
        <!-- Metadata -->
        <div id="mapid" style="margin-left: 5rem; height: 400px; width:1000px;"></div>
    
        <table style="margin-left: 5rem;">
        {% for key, value in metadata_dict.items() %}
            <tr>
                <th>{{ key }}</th>
                <td>{{ value }}</td>
            </tr>
        {% endfor %}
        </table>

        <footer style="background-color: #222324; color: white;">
            <p style="margin: 3rem">
                <strong>
                    {{ footer_text }}
                </strong>
            </p>
        </footer>

        <script>
            var mymap = L.map('mapid').setView([{{ metadata_dict['geospatial_lat_min'] }}, {{ metadata_dict['geospatial_lon_min']}}], 6);
            L.tileLayer(
                'https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw',
                {       
                    maxZoom: 14,
                    attribution: 'Map data &copy; <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, ' +
                        '<a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, ' +
                        'Imagery <a href="https://www.mapbox.com/">Mapbox</a>',
                    id: 'mapbox.satellite'
                }
            ).addTo(mymap);
            L.marker([ {{ metadata_dict['geospatial_lat_min'] }}, {{ metadata_dict['geospatial_lon_min'] }}]).addTo(mymap)
                .bindPopup("<b>{{ metadata_dict['platform_code'] }}</b>").openPopup();
            var popup = L.popup();
        </script>

    </body>

</html>