<script>
    mapProjects = [
    @foreach($projects as $project)
        @php $sustainabilityTopics = $project->related('sustainability'); @endphp
        {
            markerType: 'project',
            id: {{ $project->id }},
            title: @json($project->title),
            location_lat: {{ $project->location_lat }},
            location_lng: {{ $project->location_lng }},
            country: "{{ $project->country->title }}",
            objective: @json(cut_string(strip_tags($project->objective), 130, "...")),
            link: "{{ lang_url($project->uri) }}",
            detailImage: "{{ $project->overviewImage ? getMediaUrl($project->overviewImage->filename, '600x445') : '' }}",
            @if($project->technologies->count() > 0)
                <?php $technology = $project->technologies->first(); ?>
                technology: {
                    title: "{{ $technology->title }}",
                    @if(!empty($technology->iconLight))
                        icon: '{{ getMediaUrl($technology->iconLight->filename, '80x80') }}',
                    @endif
                },
            @endif
            @if(!$sustainabilityTopics->isEmpty())
                mainTopic: {
                    colorScheme: "{{ $sustainabilityTopics->first()->color_scheme }}"
                }
            @endif
        },
    @endforeach
    ];
</script>
