@php
    $user = auth()->user();
@endphp

<div class="d-inline-flex gap-1">
    @if ($user?->can('languages.update', $language))
        @unless ($language->is_default)
            <form method="POST" action="{{ route('settings.languages.set-default', $language) }}" class="d-inline">
                @csrf
                <x-ui.buttons.secondary type="submit" size="sm" icon="fe fe-star">
                    {{ __('languages.actions.set_default') }}
                </x-ui.buttons.secondary>
            </form>
        @endunless

        <form method="POST" action="{{ route('settings.languages.toggle-active', $language) }}" class="d-inline">
            @csrf
            <x-ui.buttons.secondary type="submit" size="sm"
                :icon="$language->is_active ? 'fe fe-eye-off' : 'fe fe-eye'">
                {{ $language->is_active ? __('languages.actions.deactivate') : __('languages.actions.activate') }}
            </x-ui.buttons.secondary>
        </form>

        <x-ui.buttons.secondary :href="route('settings.languages.edit', $language)" size="sm" icon="fe fe-edit-2">
            {{ __('common.edit') }}
        </x-ui.buttons.secondary>
    @endif

    @if ($user?->can('languages.delete', $language))
        <form method="POST" action="{{ route('settings.languages.destroy', $language) }}" class="d-inline"
              onsubmit="return confirm('{{ __('languages.confirm_delete') }}');">
            @csrf
            @method('DELETE')
            <x-ui.buttons.danger type="submit" size="sm" outline icon="fe fe-trash-2">
                {{ __('common.delete') }}
            </x-ui.buttons.danger>
        </form>
    @endif
</div>
