<?php
use Illuminate\Support\Facades\Auth;
use Carbon\Carbon;
?>

<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-evento'))
        <a href="{{ route('evento.show', ['evento_id' => $entity->id]) }}" class="dropdown-item">
            <i class="bx bx-show me-1"></i> Vedi evento
        @endif

        @if(Auth::user()->can('view-prenotazione'))
        <a href="{{ route('prenotazione.index.evento', ['evento_id' => $entity->id]) }}" class="dropdown-item">
            <i class="bx bx-calendar-check me-1"></i> Vedi prenotazioni
        </a>
        @endif

        <!-- @if(Auth::user()->can('edit-evento'))
        <a href="#" class="dropdown-item editor_edit">
            <i class="bx bx-edit-alt me-1"></i> Modifica
        </a>
        @endif -->

        @if(Auth::user()->can('edit-evento'))
        <a href="{{ route('evento.edit', ['evento_id' => $entity->id]) }}" class="dropdown-item">
            <i class="bx bx-edit-alt me-1"></i> Modifica
        </a>
        @endif

        @if(Auth::user()->can('edit-evento'))
        <a href="{{ route('evento.gallery.edit', ['evento_id' => $entity->id]) }}" class="dropdown-item">
            <i class="bx bx-image-alt me-1"></i> Galleria
        </a>
        @endif

        <!-- @if(Auth::user()->can('edit-prenotazione') )
        <a href="#" class="dropdown-item editor_edit">
            <i class="bx bx-calendar-check me-1"></i> Apri prenotazioni
        </a> 
        @endif -->
    
        <!-- @if(Auth::user()->can('edit-prenotazione') && Carbon::parse($entity->apertura_prenotazione)->isPast())
        <a href="#" class="dropdown-item editor_edit">
            <i class="bx bx-calendar-check me-1"></i> Chiudi prenotazioni
        </a>
        @endif -->
        @if(Auth::user()->can('delete-evento'))
        <a href="#" class="dropdown-item editor_delete">
            <i class="bx bx-trash me-1"></i> Elimina
        </a>
        @endif
    </div>
</div>
