<div class="form-group<?php echo e($errors->has('role') ? ' has-error' : ''); ?>">
	<?php echo Form::label('role', 'Role'); ?>

	<?php echo Form::text('role', null, ['class' => 'form-control']); ?>

	<?php if($errors->has('role')): ?>
		<span class="help-block">
			<strong><?php echo e($errors->first('role')); ?></strong>
		</span>
	<?php endif; ?>
</div>
<div class="row">
	<?php foreach($permissions as $permission): ?>
	<div class="col-md-6">
		<div class="row">
			<div class="col-md-6">
				<?php echo Form::hidden($permission->permission, '0'); ?>

				<?php echo Form::checkbox($permission->permission, '1', isset($role) ? $permission->role_permission($role) : false); ?>

				<?php echo Form::label($permission->permission, $permission->label); ?>

			</div>
			<?php if($permission->level): ?>
			<div class="col-md-6">
				<?php echo Form::select('level-'.$permission->id, ['all' => 'All', 'team' => 'Team', 'self' => 'Individual'], isset($role) && $permission->role_permission($role) ? $permission->role_permission($role)->level : null, ['class' => 'form-control input-sm']); ?>

			</div>
			<?php endif; ?>
		</div>
	</div>
	<?php endforeach; ?>
</div>
<div class="pull-right">
	<?php echo Form::submit('Save', ['class' => 'btn btn-success btn-flat']); ?>

	<a href="<?php echo e(asset('/roles')); ?>" type="button" class="btn btn-default btn-flat">Cancel</a>
</div>