<x-app-layout>
    @section('title')
        Role Create
    @endsection
    <!-- DataTales Example -->
    <div class="row">
        <div class="col-md-12 m-auto">
            <h1 class="h3 mb-2 text-gray-800">
                <a href="{{ route('admin.roles.index') }}" class="btn btn-primary"><i class="fas fa-list"
                        aria-hidden="true"></i> Listing Role
                </a>
            </h1>
            {{-- @include('admin.layouts.partials.validation') --}}
            <div class="card shadow mb-4">
                <div class="card-header py-3">
                    <h6 class="m-0 font-weight-bold text-primary">
                        Listing Role Form
                    </h6>
                </div>
                <div class="card-body">
                    <form id="quickForm" novalidate="novalidate" method="POST"
                        action="{{ route('admin.roles.store') }}">
                        @csrf
                        @method('post')

                        <div class="form-group">
                            <label for="name" class="mb-0">Role Name <span class="text-danger">*</span> </label>
                            <input type="text" id="role_name" name="name"
                                placeholder="Role Name" value="{{ old('name') }}" class="form-control @error('name') is-invalid @enderror" >
                            @error('name')
                                <p class="alert alert-danger">{{ $message }}</p>
                            @enderror
                        </div>


                        {{-- <div class="form-group">
                            @foreach ($permissions as $permission)
                                <div class="form-check mr-1" style="display: inline-block !important">
                                    <input type="checkbox" class="form-check-input" name="permissions[]"
                                        id="checkPermission{{ $permission->id }}" value="{{ $permission->id }}">
                                    <label class="form-check-label"
                                        for="checkPermission{{ $permission->id }}">{{ $permission->name }}</label>
                                </div>
                            @endforeach
                        </div> --}}
                        <div class="container-fluid">
                            <div class="row">
                                @foreach ($permissions as $permission)
                                    <div class="col-lg-3 mb-1">
                                        <input type="checkbox" class="form-check-input" name="permissions[]"
                                            id="checkPermission{{ $permission->id }}" value="{{ $permission->id }}">
                                            <label class="form-check-label"
                                            for="checkPermission{{ $permission->id }}">{{ $permission->name }}</label>
                                    </div>
                                @endforeach
                            </div>
                        </div>


                        <button type="submit" class="btn btn-success">
                            Save
                        </button>
                    </form>
                </div>
            </div>
        </div>
    </div>
</x-app-layout>
