{{-- resources/views/components/allegati/index.blade.php --}}
@props(['allegati' => []])

@php
    $hasVisibleAllegati = false;
    foreach ($allegati as $allegato) {
        if ($allegato->is_visible && $allegato->files && $allegato->gallery_type == 1 && $allegato->is_visible == true) {
            $hasVisibleAllegati = true;
            break;
        }
    }
@endphp

@if($hasVisibleAllegati)
    <table width="100%">
        <tr>
            <td width="100%" valign="top" align="center">
                <h2>ALLEGATI</h2>
            </td>
        </tr>
    </table>

    @foreach($allegati as $allegato)
        @if($allegato->is_visible && $allegato->files && $allegato->gallery_type == 1 && $allegato->is_visible == true)
            <x-verbale.allegati.file-display :files="explode('|', $allegato->files)" />
        @endif
    @endforeach
@endif
