<?php
use Illuminate\Support\Facades\Auth;
?>
<div class="dropdown">
    <button type="button" class="btn p-0 dropdown-toggle hide-arrow" data-bs-toggle="dropdown" aria-expanded="false">
        <i class="bx bx-dots-vertical-rounded fs-large"></i>
    </button>
    <div class="dropdown-menu">
        @if(Auth::user()->can('view-piatto'))
        @if(!$dashboard)
        <a href="{{ route('piatto.index', ['cucina_id' => $entity->id]) }}" class="dropdown-item">
            <i class="bx bx-dish me-1"></i> Vedi piatti
        </a>
        @endif
        @if($dashboard)
        <a href="#" class="dropdown-item" onclick="showDataTablePiatto({{ $entity->id }},$(this).data('cucina_name'))" event.preventDefault() data-cucina_name="{{ $entity->nome }}">
            <i class="bx bx-dish me-1"></i> Vedi piatti
        </a>
        @endif
        @endif
        @if(Auth::user()->can('edit-cucina'))
        <a href="#" class="dropdown-item editor_edit">
            <i class="bx bx-edit-alt me-1"></i> Modifica
        </a>
        @endif
        @if(Auth::user()->can('view-punto_operatore'))
        @if(!$dashboard)
        <a href="#" class="dropdown-item toggle_is_attivo" data-punto_operatore_id="{{ $entity->id }}" onclick="toggleIsAttivo({{ $entity->id }})">
            <i class="bx bx-user me-1"></i> {{ $entity->is_attivo ? 'Disattiva' : 'Attiva' }}
        </a>
        @endif
        @endif
        @if(Auth::user()->can('delete-cucina'))
        <a href="#" class="dropdown-item editor_delete">
            <i class="bx bx-trash me-1"></i> Elimina
        </a>
        @endif

    </div>
</div>
