@if (!empty($data['parti_coinvolte']))
    @php
        $vehicles = collect($data['parti_coinvolte'])->filter(function ($item) {
            return $item->conducente_o_pedone == 2;
        });
    @endphp

    @if ($vehicles->count() > 0)
        <table width="100%" class="table-title">
            <tr>
                <td align="center">
                    <h2>VEICOLI COINVOLTI</h2>
                </td>
            </tr>
        </table>

        <table class="table-content" width="100%">
            <thead>
                <tr>
                    <th width="30%" align="left">VEICOLO</th>
                    <th width="35%" align="left">TARGA</th>
                    <th width="35%" align="center">CONDUCENTE</th>
                </tr>
            </thead>
            <tbody>
                @foreach ($vehicles as $veicolo)
                    <tr>
                        <td width="30%" align="left">
                            {{ optional(optional($veicolo->veicolo_data)->marca)->name }}
                            {{ optional(optional($veicolo->veicolo_data)->modello)->name }}
                        </td>
                        <td width="35%" align="left">
                            {{ optional($veicolo->veicolo_data)->targa }}
                        </td>
                        <td width="35%" align="center">
                            {{ optional($veicolo->anagrafica_data)->lastname }}
                            {{ optional($veicolo->anagrafica_data)->firstname }}
                        </td>
                    </tr>
                @endforeach
            </tbody>
        </table>
    @endif
@endif
