@extends('layouts.landing')

@section('title',"Crear Rol")

@section('content')

<div class="container-fluid">
    <div class="card shadow mb-4">
        <div class="card-header py-3">
            <div class="d-sm-flex align-items-center justify-content-between">
                <h6 class="m-0 font-weight-bold text-primary">Crear Rol</h6>
                <a href="{{route('role.index')}}" class="d-sm-inline-block btn btn-sm btn-primary shadow-sm"><i class="fas fa-download fa-sm text-white-50"></i> Regresar</a>
            </div>
        </div>
        <div class="card-body">
            <form action="{{route('role.store')}}" method="POST">
                @csrf
                <div class="mb-3">
                    <label class="small mb-1">Nombre</label>
                    <input class="form-control" name="name">

                    @error('name')
                    <div class="alert alert-danger">
                    <strong>{{$message}}</strong>
                    </div>
                    @enderror
                </div>
                <div class="mb-3">
                     @foreach ($permissions as $permission)
                    <div class="form-check">
                        <input type="checkbox" class="form-check-input cb"
                            id="{{ $permission->id }}"
                            name="permissions[]" value="{{ $permission->id }}"
                        >
                        <label class="form-check-label" for="{{ $permission->id }}">
                            {{ $permission->description }}
                        </label>
                    </div>
                @endforeach
                </div>
            <input class="btn btn-primary" type="submit" value="Create">
            </form>
        </div>
    </div>
</div>

@endsection
