Refactor Role form
This commit is contained in:
@ -19,7 +19,47 @@
|
||||
|
||||
{{ Form::textareaGroup('description', trans('general.description')) }}
|
||||
|
||||
{{ Form::checkboxGroup('permissions', trans_choice('general.permissions', 2), $permissions, 'display_name') }}
|
||||
<div id="role-permissions" class="col-md-12">
|
||||
<label for="permissions" class="control-label">{{trans_choice('general.permissions', 2)}}</label>
|
||||
|
||||
<br>
|
||||
|
||||
<span class="permission-select-button">{{trans('general.select_all')}}</span> |
|
||||
<span class="permission-unselect-button">{{trans('general.remove_selections')}}</span>
|
||||
<div class="nav-tabs-custom">
|
||||
<ul class="nav nav-tabs">
|
||||
@foreach($names as $name)
|
||||
<li @php echo ($name == 'read') ? 'class="active"' : ''; @endphp><a href="#tab-{{ $name }}" data-toggle="tab" aria-expanded="false">{{ ucwords($name) }}</a></li>
|
||||
@endforeach
|
||||
</ul>
|
||||
|
||||
<div class="tab-content">
|
||||
@foreach($permissions as $code => $code_permissions)
|
||||
<div class="tab-pane in @php echo ($code == 'read') ? 'active' : ''; @endphp" id="tab-{{ $code }}">
|
||||
<div class="permission-button-group">
|
||||
<span class="permission-select-button">{{trans('general.select_all')}}</span> |
|
||||
<span class="permission-unselect-button">{{trans('general.remove_selections')}}</span>
|
||||
</div>
|
||||
|
||||
@stack('permissions_input_start')
|
||||
|
||||
<div class="form-group col-md-12 {{ $errors->has('permissions') ? 'has-error' : '' }}">
|
||||
<label class="input-checkbox"></label>
|
||||
<br/>
|
||||
@foreach($code_permissions as $item)
|
||||
<div class="col-md-3">
|
||||
<label class="input-checkbox">{{ Form::checkbox('permissions' . '[]', $item->id) }} {{ $item->display_name }}</label>
|
||||
</div>
|
||||
@endforeach
|
||||
{!! $errors->first('permissions', '<p class="help-block">:message</p>') !!}
|
||||
</div>
|
||||
|
||||
@stack('permissions_input_end')
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.box-body -->
|
||||
|
||||
@ -33,3 +73,31 @@
|
||||
{!! Form::close() !!}
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('js')
|
||||
<script src="{{ asset('vendor/almasaeed2010/adminlte/plugins/iCheck/icheck.min.js') }}"></script>
|
||||
@endpush
|
||||
|
||||
@push('css')
|
||||
<link rel="stylesheet" href="{{ asset('vendor/almasaeed2010/adminlte/plugins/iCheck/square/green.css') }}">
|
||||
@endpush
|
||||
|
||||
@push('scripts')
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
$('input[type=checkbox]').iCheck({
|
||||
checkboxClass: 'icheckbox_square-green',
|
||||
radioClass: 'iradio_square-green',
|
||||
increaseArea: '20%' // optional
|
||||
});
|
||||
|
||||
$('.permission-select-button').on('click', function (event) {
|
||||
$(this).parent().parent().find('input[type=checkbox]').iCheck('check');
|
||||
});
|
||||
|
||||
$('.permission-unselect-button').on('click', function (event) {
|
||||
$(this).parent().parent().find('input[type=checkbox]').iCheck('uncheck');
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
|
Reference in New Issue
Block a user