@extends('layouts.app') @section('title', trans('user.roles')) @section('content')

@if (Request::get('act') != 'add') {!! link_to_route('roles.index', trans('role.create'), ['act' => 'add'], ['class'=>'btn btn-success pull-right']) !!} @endif {{ trans('role.roles') }}

@if (Request::get('act') == 'add')

{{ trans('role.create') }}

{!! Form::open(['route'=>'roles.store']) !!} {!! FormField::text('name') !!} {!! FormField::text('label') !!} {!! Form::submit(trans('role.create'), ['class' => 'btn btn-success']) !!} {!! link_to_route('roles.index', trans('app.cancel'), [], ['class'=>'btn btn-default pull-right']) !!} {!! Form::close() !!}
@elseif (Request::get('act') == 'edit' && !is_null($role))

{{ trans('role.edit') }}

{!! Form::model($role, ['route'=>['roles.update', $role->id],'method'=>'patch']) !!} {!! FormField::text('name') !!} {!! FormField::text('label') !!} {!! Form::submit(trans('role.update'), ['class' => 'btn btn-warning']) !!} {!! link_to_route('roles.index', trans('app.cancel'), [], ['class'=>'btn btn-default pull-right']) !!} {!! Form::close() !!}
@elseif (Request::get('act') == 'del' && !is_null($role))

{{ trans('role.delete') }}

{{ trans('app.delete_confirm') }}
{{ trans('app.name') }}{{ $role->name }}
{{ trans('app.label') }}{{ $role->label }}
{{ trans('role.users_count') }}{{ $role->users()->count() }}
@elseif (Request::get('act') == 'show' && !is_null($role))

{{ trans('role.show') }}

{{ trans('app.name') }}{{ $role->name }}
{{ trans('app.label') }}{{ $role->label }}
{{ trans('role.users_count') }}{{ $role->users()->count() }}
{!! Form::open(['route'=>['roles.update-permissions', $role->id]]) !!}

{{ trans('permission.permissions') }}

{!! FormField::checkboxes('permission', $permissions->lists('label','id')->all(), ['value' => $role->permissions,'label'=>false,'list_style' => 'unstyled']) !!}
{!! Form::close() !!} @endif
@forelse($roles as $key => $role) @empty @endforelse
{{ trans('app.table_no') }} {{ trans('app.name') }} {{ trans('role.users_count') }} {{ trans('app.action') }}
{{ $key + 1 }} {{ $role->label }} {{ $role->users()->count() }} {!! link_to_route('roles.index','detail',['act' => 'show', 'id' => $role->id],['class'=>'btn btn-info btn-xs']) !!} {!! link_to_route('roles.index','edit',['act' => 'edit', 'id' => $role->id],['class'=>'btn btn-warning btn-xs']) !!} {!! link_to_route('roles.index','x',['act' => 'del', 'id' => $role->id],['class'=>'btn btn-danger btn-xs']) !!}
{{ trans('role.not_found') }}
@endsection