{% extends 'base.html.twig' %}

{% block title %}Accueil - Job Portal{% endblock %}

{% block body %}
    <link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY=" crossorigin="anonymous" />
    <script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js" integrity="sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo=" crossorigin="anonymous"></script>
    <script src="https://maps.google.com/maps/api/js?sensor=false"></script>
{#    <script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyBugXaHb_TDr1YhckLB2FrWJpPfnh9SN5g&libraries=geometry">#}
    <section class="bg-cover bg-center py-20" style="background-image: url('{{ asset('images/fond_site.png') }}');">
        <div class="container mx-auto text-center text-white">
            <h1 class="text-4xl md:text-5xl font-bold mb-4">Trouvez votre stage de rêve !</h1>
            <p class="text-lg mb-8">Connectez les talents aux opportunités : votre clé vers le succès professionnel</p>
            <div class="flex justify-center space-x-8 mt-8">
                <div class="text-center">
                    <i class="fas fa-briefcase text-2xl"></i>
                    <p class="mt-2">+850 Stages</p>
                </div>
                <div class="text-center">
                    <i class="fas fa-users text-2xl"></i>
                    <p class="mt-2">1500 Candidats</p>
                </div>
                <div class="text-center">
                    <i class="fas fa-building text-2xl"></i>
                    <p class="mt-2">+500 Entreprises</p>
                </div>
            </div>
        </div>
    </section>
    <section class="flex my-10 justify-center">
        <div id="map" style="width: 1000px; height: 600px;" class="rounded"></div>
    </section>
    <script>

        var map = L.map('map').setView([47.0780463, 2.2424097], 5.5);
        L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png').addTo(map);

        {% for company in companies %}
            var coordX = {{ company["coord"][0] }};
            var coordY = {{ company["coord"][1] }};
            var name = "{{ company["name"] }}";
            var marker = L.marker([coordX,coordY]).addTo(map).bindPopup(name);
        {% endfor %}
    </script>
{% endblock %}
