<h4>Permissions sur les indicateurs</h4>
<form method="POST" action="{{ route('structure.update', $structure->id) }}">
    @csrf
    {{ method_field('PUT') }}

    <input name="type_permission" type="hidden" value="indicateurs">
    <table class="table table-striped table-bordered">
        <thead>
        <tr>
            <th scope="col">Rôle</th>
            <th scope="col">Voir perf. économique</th>
            <th scope="col">Voir achats mutualisés</th>
            <th scope="col">Voir RSE</th>
            <th scope="col">Voir gestion PAAT</th>
            <th scope="col">Exporter</th>
        </tr>
        </thead>
        <tbody>
        @foreach($roles as $r)
            {{-- On n'affiche pas le role responsable ARS car il n'entre pas dans ces permissions --}}
            @if(!str_contains($r, ROLE::RESPONSABLE_PERFORMANCE_ARS))
            <tr>
                <td scope="row">{{ ROLE::ROLES_FORMATTED[$r->name] }}</td>
                <td><input type="checkbox" id="{{ $r->id }}-see_performance_economique" name="{{ $r->id }}-see_performance_economique" @if($r->hasPermissionTo('see_performance_economique')) checked @endif></td>
                <td><input type="checkbox" id="{{ $r->id }}-see_achats_mutualises" name="{{ $r->id }}-see_achats_mutualises" @if($r->hasPermissionTo('see_achats_mutualises')) checked @endif></td>
                <td><input type="checkbox" id="{{ $r->id }}-see_rse" name="{{ $r->id }}-see_rse" @if($r->hasPermissionTo('see_rse')) checked @endif></td>
                <td><input type="checkbox" id="{{ $r->id }}-see_gestion_paat" name="{{ $r->id }}-see_gestion_paat" @if($r->hasPermissionTo('see_gestion_paat')) checked @endif></td>
                <td><input type="checkbox" id="{{ $r->id }}-export_indicateurs" name="{{ $r->id }}-export_indicateurs" @if($r->hasPermissionTo('export_indicateurs')) checked @endif></td>
            </tr>
            @endif
        @endforeach
        </tbody>
    </table>

    <div class="form-group row mb-0 float-right">
        <div class="col-md-8">
            <button type="submit" class="btn btn-outline-success">
                Sauvegarder
            </button>
        </div>
    </div>
</form>
