

@if(sizeof($parametres) > 0)
    <table class="table table-striped table-bordered">
        <thead>
        <tr>
            <th>ID</th>
            <th>Nom</th>
            <th>Description</th>
            @if($has_enfant)
                <th>{{ ucfirst($route_enfant) }}</th>
            @endif
            @canany(array('edit_parametre', 'delete_parametre'))
                <th>Actions</th>
            @endcanany
        </tr>
        </thead>
        <tbody>
            @foreach($parametres as $p)
            <tr>
                <td style="width: 5%">{{ $p->id }}</td>
                <td>{{ $p->nom }}</td>
                <td>
                    @isset($p->description)
                        {{ $p->description }}
                    @else
                        -
                    @endif
                </td>
                @if($has_enfant)
                    <td>
                        <a class="btn btn-outline-info" href="{{ route($route_enfant . '.index', isset($parametres_url) ? array_merge($parametres_url, array($p->id)) : $p->id) }}">{{ ucfirst($route_enfant) }}</a>
                    </td>
                @endif
                @canany(array('edit_parametre', 'delete_parametre'))
                    <td style="width: 10%">
                        @can('edit_parametre')
                            <a class="btn btn-outline-primary" href="{{ route($route . '.edit', 
                                isset($parametres_url) ? array_merge($parametres_url, array($p->id)) : $p->id) }}"
                                data-toggle="tooltip" data-placement="top" title="Editer">
                                <i class="fas fa-pencil-alt"></i>
                            </a>
                        @endcan
                        @can('delete_parametre')
                            <form class="inline-form-table" action="{{ route($route . '.destroy', isset($parametres_url) ? array_merge($parametres_url, array($p->id)) : $p->id) }}" method="POST">
                                @csrf
                                {{ method_field('DELETE') }}
                                <button type="submit" class="btn btn-outline-danger"
                                    data-toggle="tooltip" data-placement="top" title="Supprimer">
                                    <i class="fas fa-trash-alt"></i>
                                </button>
                            </form>
                        @endcan
                    </td>
                @endcanany
            </tr>
            @endforeach
        </tbody>
    </table>

    {{ $parametres->links("pagination::bootstrap-4") }}
@else
    <div class="pt-2">
        <h4>Pas de données disponible.</h4>
    </div>
@endif
