<div class="card-header bg-primary text-white d-flex flex-wrap justify-content-between align-items-center gap-2 py-2">
    <h3 class="my-1 ms-2 fw-bolder">{!! $headLine !!}</h3>
    <div class="d-flex flex-wrap gap-1">
        @if(isset($routeBack))
        <button class="btn btn-light btn-sm" type="button"
                onclick="window.location.href ='{{ route($routeBack, $routeBackParams ?? []) }}'">
            @if(isset($fontawesomeBack))  {!! $fontawesomeBack !!} @else  <i class="fa-solid fa-arrow-left"></i> @endif {{ $nameBack }}
        </button>
        @endif

        @if (Route::currentRouteName() == 'admin.saude.fibromialgia.index')
        <div class="dropdown">
            <button class="btn btn-light btn-sm dropdown-toggle me-2" type="button" data-bs-toggle="dropdown">
                <i class="fa-solid fa-file"></i> Relatório
            </button>
            <ul class="dropdown-menu">
                @component('components.lists._liLinkDropdown', [
                'links' => [
                ['label' => 'Estado de Cadastro', 'model' => 'cadastro', 'toggle' => '', 'hashData' => ''],
                ['label' => 'Estado da Carteirinha', 'model' => 'carteirinha', 'toggle' => '', 'hashData' => ''],
                ['label' => 'Dados de Cadastrados', 'model' => 'dadosCadastrados', 'toggle' => '', 'hashData' => ''],
                ['label' => 'Gerar todas as carteirinhas', 'model' => '', 'toggle' => 'modal', 'hashData' => 'modalGerarCarteirinha'],
                ]
                ])
                @endcomponent
            </ul>
        </div>
        @endif

        @if(isset($routeAdd) && isset($permission) && auth()->user()->getPermissaoDetalhes($permission)['adicionar'])
        <button class="btn btn-light btn-sm"
                onclick="window.location.href ='{{ route($routeAdd, $routeAddParams ?? []) }}'">
            @if(isset($fontawesomeAdd))  {!! $fontawesomeAdd !!} @else  <i class="fa-solid fa-plus"></i> @endif {{ $nameAdd }}
        </button>
        @endif
        @if(isset($routeOther) && isset($permission) && auth()->user()->getPermissaoDetalhes($permission)['adicionar'])
        <button class="btn btn-light btn-sm"
                onclick="window.location.href ='{{ route($routeOther, $routeOtherParams ?? []) }}'">
            @if(isset($fontawesomeOther))  {!! $fontawesomeOther !!} @else  <i class="fa-solid fa-plus"></i> @endif {{ $nameOther }}
        </button>
        @endif
        @if(isset($routeCSV))
        <button class="btn btn-light btn-sm"
                onclick="window.location.href ='{{ route($routeCSV, $routeCSVParams ?? []) }}'">
            @if(isset($fontawesomeCSV))  {!! $fontawesomeCSV !!} @else  <i class="fa-solid fa-file-csv"></i> @endif {{ $nameCSV }}
        </button>
        @endif
        @if(isset($routeDeleteAll) && isset($permission) && auth()->user()->getPermissaoDetalhes($permission)['excluir'])
        <form class="d-inline" action="{{ route($routeDeleteAll, $routeDeleteAllParameters ?? []) }}" method="post" onsubmit="return confirmDelete(this)">
            @csrf
            @method('delete')
            <input type="hidden" name="page" value="{{ request()->input('page', 1) }}">
            <input type="hidden" name="confirm" value="{{ __($messageDeleteAll) }}">
            <button class="btn btn-light btn-sm" title="{{ $nameDeleteAll }}">
                @if(isset($fontawesomeDeleteAll))  {!! $fontawesomeDeleteAll !!} @else  <i class="fa-solid fa-file-csv"></i> @endif {{ $nameDeleteAll }}
            </button>
        </form>
        @endif

        
        @if(isset($tabs))
            @foreach ($tabs as $tab)
                @php
                    $tabPermCheck = $tab['permission_check'] ?? 'visualizar';
                    $tabVisivel   = !isset($tab['permission'])
                        || auth()->user()->getPermissaoDetalhes($tab['permission'])[$tabPermCheck];
                @endphp
                @if($tabVisivel)
                    <button class="btn btn-light btn-sm"
                            onclick="window.location.href ='{{ route($tab['route']) }}'">
                        <i class="fa-solid {{ $tab['class'] }}"></i> {{ __($tab['label']) }}
                    </button>
                @endif
            @endforeach
        @endif

    </div>
</div>
