[WIP] Setup of skeleton
This commit is contained in:
74
resources/views/users/roles/create.blade.php
Normal file
74
resources/views/users/roles/create.blade.php
Normal file
@@ -0,0 +1,74 @@
|
||||
@extends('layout.index', [
|
||||
'title' => __('boilerplate::role.title'),
|
||||
'subtitle' => __('boilerplate::role.create.title'),
|
||||
'breadcrumb' => [
|
||||
__('boilerplate::role.title') => 'boilerplate.roles.index',
|
||||
__('boilerplate::role.create.title')
|
||||
]
|
||||
])
|
||||
|
||||
@include('boilerplate::load.icheck')
|
||||
|
||||
@section('content')
|
||||
{{ Form::open(['route' => 'boilerplate.roles.store', 'autocomplete' => 'off']) }}
|
||||
<div class="row">
|
||||
<div class="col-sm-12 mbl">
|
||||
<a href="{{ route("boilerplate.roles.index") }}" class="btn btn-default">
|
||||
{{ __('boilerplate::role.list.title') }}
|
||||
</a>
|
||||
<span class="btn-group pull-right">
|
||||
<button type="submit" class="btn btn-primary">
|
||||
{{ __('boilerplate::role.savebutton') }}
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-5">
|
||||
<div class="box box-primary">
|
||||
<div class="box-header">
|
||||
<h3 class="box-title">{{ __('boilerplate::role.parameters') }}</h3>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
<div class="form-group {{ $errors->has('display_name') ? 'has-error' : '' }}">
|
||||
{{ Form::label('display_name', __('boilerplate::role.label')) }}
|
||||
{{ Form::text('display_name', old('display_name'), ['class' => 'form-control', 'autofocus']) }}
|
||||
{!! $errors->first('display_name','<p class="text-danger"><strong>:message</strong></p>') !!}
|
||||
</div>
|
||||
<div class="form-group {{ $errors->has('description') ? 'has-error' : '' }}">
|
||||
{{ Form::label('description', __('boilerplate::role.description')) }}
|
||||
{{ Form::text('description', old('description'), ['class' => 'form-control']) }}
|
||||
{!! $errors->first('description','<p class="text-danger"><strong>:message</strong></p>') !!}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@if(count($permissions) > 0)
|
||||
<div class="col-md-7">
|
||||
<div class="box box-info">
|
||||
<div class="box-header">
|
||||
<h3 class="box-title">{{ __('boilerplate::role.permissions') }}</h3>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
<table class="table table-hover table-striped table-condensed">
|
||||
<tbody>
|
||||
@foreach($permissions as $permission)
|
||||
<tr>
|
||||
<td style="width:25px;">
|
||||
{{ Form::checkbox('permission['.$permission->id.']', 1, old('permission['.$permission->id.']'), ['id' => 'permission_'.$permission->id, 'class' => 'icheck']) }}
|
||||
</td>
|
||||
<td>
|
||||
{{ Form::label('permission_'.$permission->id, $permission->display_name, ['class' => 'mbn']) }}<br />
|
||||
<small>{{ __($permission->description) }}</small>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
{{ Form::close() }}
|
||||
@endsection
|
||||
78
resources/views/users/roles/edit.blade.php
Normal file
78
resources/views/users/roles/edit.blade.php
Normal file
@@ -0,0 +1,78 @@
|
||||
@extends('layout.index', [
|
||||
'title' => __('boilerplate::role.title'),
|
||||
'subtitle' => __('boilerplate::role.edit.title'),
|
||||
'breadcrumb' => [
|
||||
__('boilerplate::role.title') => 'boilerplate.roles.index',
|
||||
__('boilerplate::role.edit.title')
|
||||
]
|
||||
])
|
||||
|
||||
@include('boilerplate::load.icheck')
|
||||
|
||||
@section('content')
|
||||
{{ Form::open(['route' => ['boilerplate.roles.update', $role->id], 'method' => 'put', 'autocomplete' => 'off']) }}
|
||||
<div class="row">
|
||||
<div class="col-sm-12 mbl">
|
||||
<a href="{{ route("boilerplate.roles.index") }}" class="btn btn-default">
|
||||
{{ __('boilerplate::role.list.title') }}
|
||||
</a>
|
||||
<span class="btn-group pull-right">
|
||||
<button type="submit" class="btn btn-primary">
|
||||
{{ __('boilerplate::role.savebutton') }}
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-5">
|
||||
<div class="box box-primary">
|
||||
<div class="box-header">
|
||||
<h3 class="box-title">{{ __('boilerplate::role.parameters') }}</h3>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
{!! $errors->first('name','<p class="text-danger"><strong>:message</strong></p>') !!}
|
||||
<div class="form-group {{ $errors->has('display_name') ? 'has-error' : '' }}">
|
||||
{{ Form::label('display_name', __('boilerplate::role.label')) }}
|
||||
{{ Form::text('display_name', old('display_name', $role->display_name), ['class' => 'form-control', 'autofocus']) }}
|
||||
{!! $errors->first('display_name','<p class="text-danger"><strong>:message</strong></p>') !!}
|
||||
</div>
|
||||
<div class="form-group {{ $errors->has('description') ? 'has-error' : '' }}">
|
||||
{{ Form::label('description', __('boilerplate::role.description')) }}
|
||||
{{ Form::text('description', old('description', $role->description), ['class' => 'form-control']) }}
|
||||
{!! $errors->first('description','<p class="text-danger"><strong>:message</strong></p>') !!}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@if(count($permissions) > 0)
|
||||
<div class="col-md-7">
|
||||
<div class="box box-info">
|
||||
<div class="box-header">
|
||||
<h3 class="box-title">{{ __('boilerplate::role.permissions') }}</h3>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
<table class="table table-hover table-striped table-condensed">
|
||||
<tbody>
|
||||
@foreach($permissions as $permission)
|
||||
<tr>
|
||||
<td style="width:25px;">
|
||||
@if($role->id == 1)
|
||||
<input type="checkbox" checked disabled class="icheck"/>
|
||||
@else
|
||||
{{ Form::checkbox('permission['.$permission->id.']', 1, old('permission['.$permission->id.']', $role->permissions()->where(['id' => $permission->id])->count()), ['id' => 'permission_'.$permission->id, 'class' => 'icheck']) }}
|
||||
@endif
|
||||
</td>
|
||||
<td>
|
||||
{{ Form::label('permission_'.$permission->id, $permission->display_name, ['class' => 'mbn']) }}<br />
|
||||
<small>{{ $permission->description }}</small>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
{{ Form::close() }}
|
||||
@endsection
|
||||
95
resources/views/users/roles/list.blade.php
Normal file
95
resources/views/users/roles/list.blade.php
Normal file
@@ -0,0 +1,95 @@
|
||||
@extends('boilerplate::layout.index', [
|
||||
'title' => __('boilerplate::role.title'),
|
||||
'subtitle' => __('boilerplate::role.list.title'),
|
||||
'breadcrumb' => [__('boilerplate::role.title')]
|
||||
])
|
||||
|
||||
@section('content')
|
||||
<div class="row">
|
||||
<div class="col-sm-12 mbl">
|
||||
<span class="pull-right">
|
||||
<a href="{{ route("boilerplate.roles.create") }}" class="btn btn-primary">{{ __('boilerplate::role.create.title') }}</a>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box">
|
||||
<div class="box-header">
|
||||
<h3 class="box-title">{{ __('boilerplate::role.list.title') }}</h3>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
<table class="table table-striped table-hover va-middle" id="roles-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{{ __('boilerplate::role.label') }}</th>
|
||||
<th>{{ __('boilerplate::role.description') }}</th>
|
||||
<th>{{ __('boilerplate::role.permissions') }}</th>
|
||||
<th>{{ __('boilerplate::role.list.nbusers') }}</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($roles as $role)
|
||||
<tr>
|
||||
<td>
|
||||
<strong>{{ $role->display_name }}</strong>
|
||||
</td>
|
||||
<td>
|
||||
{{ $role->description }}<br />
|
||||
</td>
|
||||
<td>
|
||||
{!! $role->permissions->implode('display_name', ', ') !!}
|
||||
</td>
|
||||
<td>
|
||||
{{ $role->getNbUsers() }}
|
||||
</td>
|
||||
<td>
|
||||
<a href="{{ route('boilerplate.roles.edit', $role->id) }}" class="btn btn-sm btn-primary">
|
||||
<span class="fa fa-pencil"></span>
|
||||
</a>
|
||||
@if($role->name !== 'admin' &&
|
||||
!(config('boilerplate.auth.register') && $role->name === config('boilerplate.auth.register_role')) &&
|
||||
$role->getNbUsers() === 0)
|
||||
<a href="{{ route('boilerplate.roles.destroy', $role->id) }}" class="btn btn-sm btn-danger destroy">
|
||||
<span class="fa fa-trash"></span>
|
||||
</a>
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@include('boilerplate::load.datatables')
|
||||
|
||||
@push('js')
|
||||
<script>
|
||||
$(function () {
|
||||
|
||||
$('#roles-table').dataTable();
|
||||
|
||||
$('#roles-table').on('click', '.destroy', function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
var href = $(this).attr('href');
|
||||
var line = $(this).closest('tr');
|
||||
|
||||
bootbox.confirm("{{ __('boilerplate::role.list.confirmdelete') }}", function (result) {
|
||||
if (result === false) return;
|
||||
|
||||
$.ajax({
|
||||
url: href,
|
||||
method: 'delete',
|
||||
headers: {'X-CSRF-TOKEN': '{{ csrf_token() }}'},
|
||||
success: function(){
|
||||
line.remove();
|
||||
growl("{{ __('boilerplate::role.list.deletesuccess') }}", 'success');
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
Reference in New Issue
Block a user