@extends('layout.app')
@section('content')

    <div class="card">
        <div class="card-body">
            <div class="table-responsive">
                <table id="" class="table table-borderdd ">
                    <thead class="bg-gray-50">
                        <tr>
                            <th>SL</th>
                            <th>Role Name</th>
                            <th>Permission List</th>
                            <th>Action</th>
                        </tr>

                    </thead>
                    <tbody>

                        @foreach ($list as $r)

                            <tr>
                                <td>{{ $loop->index + 1 }}</td>
                                <td style="width:150px">{{ $r->name }}</td>
                                <td class="overflow-auto">
                                    <div class="overflow-auto" style="height:200px">
                                        @foreach ($r->permissions as $p)
                                            <span class="btn btn-secondary p-1 mb-1">{{ $p->name }}</span>
                                        @endforeach

                                    </div>
                                </td>
                                <td class="text-center">
                                    <a href="{{ route('assignPermission', $r->id) }}" class="btn btn-primary btn-block">
                                        Assign Permission</a>
                                    <a href="{{ route('roles.edit', $r->id) }}" class="btn btn-info btn-block">
                                        Edit</a>
                                    <a href="{{ route('editLog-history', ['id' => $r->id, 'type' => 'RolePermission']) }}" class="btn btn-success btn-block">
                                        History</a>
                                </td>
                            </tr>

                        @endforeach

                        <!-- More items... -->
                    </tbody>
                </table>
            </div>

        </div>
    </div>




@endsection
