<div class="form-group">
    @if( isset($group))
        <span ng-init="data.users = {{ $group->users }}"></span>
    @endif
	<label class="col-sm-3 control-label label-required">Name:</label>
	<div class="col-sm-9">
		<input type="text" name="name" class="form-control" ng-model="data.name" required>
	</div>
</div>
<div class="form-group">
	<label class="col-sm-3 control-label">Users: {[{ data.users.length }]} </label>
	<div class="col-sm-9">
		<select name="users[]" ng-model="selectedUsers" ui-select2 class="form-control" multiple remove-selected="false">
			@foreach(App\Models\User::getActiveList()->pluck('name', 'id') as $id => $name)
				<option value="{{ $id }}">{{ $name }}</option>
			@endforeach
		</select>
                
    </div>
</div>
<div class="form-group">
	<label class="col-sm-3 control-label ">Permission:</label>
	<div class="col-sm-9">
		@foreach ( App\Models\Permission::getPermissions() as $permission)
			<div class="checkbox">
			    <label>
			    	<input type="checkbox" name="permissions[]" value="{{ $permission['id'] }}" ng-checked="permissionChecked( {!! $permission['id'] !!} )" ng-click="togglePermission( {!! $permission['id'] !!})">
			    	<span>{{ Lang::get('permissions.'.$permission['name']) }}</span>
			    </label>
			</div>
		@endforeach
	</div>

</div>
