@foreach($records as $record)
    <tr class="record-level-{{$indentation}}">
        <td>
            <div class="level-wrapper level-{{$indentation}}">
                @for ($i = 0; $i < $indentation; $i++)
                    <span class="level-dot"></span>
                @endfor
                <span class="level-indicator">{{$record->name}}</span>
            </div>
        </td>
        <td>
            <button type="button" class="btn btn-outline-success btn-sm" wire:click="addLevel({{ $record->id }})">Aggiungi livello</button>
            <button type="button" class="btn" wire:click="edit({{ $record->id }})" data-bs-toggle="popover" data-bs-trigger="hover focus" data-bs-placement="bottom" data-bs-content="Modifica"><i class="fa-regular fa-pen-to-square"></i></button>
            <button type="button" class="btn" onclick="confirm('Sei sicuro?') || event.stopImmediatePropagation()" wire:click="delete({{ $record->id }})" data-bs-toggle="popover" data-bs-trigger="hover focus" data-bs-placement="bottom" data-bs-content="Elimina"><i class="fa-regular fa-trash-can"></i></button>
        </td>
    </tr>
    @if(count($record->childs))
        @include('livewire/category_child',['records' => $record->childs, 'indentation' => $indentation + 1])
    @endif
@endforeach
