@extends('adminlte::page')

@section('content_header')
<h1>Assegnazione permessi</h1>
@endsection

@section('content')

<div class="container">
    <div class="row">
         <div class="col-lg-12">
            <div class="panel panel-default">
                <div class="panel-heading">
                    Nuova assegnazione permessi
                </div>
                <div class="panel-body">
                    <!-- Form -->
                    <form action="" method="POST">
                        <select name="user" class="form-control">
                            @foreach($users as $user)
                            <option value="{{$user->id}}"> {{$user->name}}</option>
                            @endforeach
                        </select>
                        <table width="100%" class="table table-striped table-bordered table-hover">
                            <tr>
                                <th>Permesso</th>
                                <th colspan="2">Azione</th>
                            </tr>
                        @foreach($permissions as $perm)
                            <tr>
                                <td>{{$perm->name}}</td>
                                <td>
                                    <input type="radio" class="form-check-input" name="permesso['{{$perm->name}}']" value="true">
                                    <label class="form-check-label">Attiva</label>
                                </td>
                                <td>
                                    <input type="radio" class="form-check-input" name="permesso['{{$perm->name}}']" value="false" checked>
                                    <label class="form-check-label">Disattiva</label>
                                </td>
                            </tr>
                        @endforeach
                        </table>
                        @csrf
                        <input type="Submit" name="submit" class="form-control" value="associa">
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
@endsection
