Some datatables consistency

This commit is contained in:
Deon George
2021-08-14 11:11:20 +10:00
parent 385290d18c
commit 6db826c8a4
10 changed files with 373 additions and 131 deletions

View File

@@ -5,9 +5,15 @@
@section('content')
<div class="row">
<div class="row">
<div class="col-9">
<h2>System Users</h2>
</div>
</div>
<div class="col-9">
<p>Current Users:</p>
<table class="table monotable">
<p>This system is aware of the following users @can('admin',(new \App\Models\User))(you can <a href="{{ url('user/addedit') }}">add</a> more)@endcan:</p>
<table class="table monotable" id="user">
<thead>
<tr>
<th>ID</th>
@@ -20,11 +26,6 @@
</thead>
<tbody>
@can('admin',(new \App\Models\User))
<tr>
<td colspan="6"><a href="{{ url('user/addedit') }}">Add New User</a></td>
</tr>
@endcan
@foreach (\App\Models\User::orderBy('email')->cursor() as $oo)
<tr class="{{ $oo->admin ? 'admin' : '' }}">
<td><a href="{{ url('user/addedit',[$oo->id]) }}">{{ $oo->id }}</a></td>
@@ -42,12 +43,38 @@
@endsection
@section('page-scripts')
<script type="text/javascript">
$('table tr').click(function() {
var href = $(this).find('a').attr('href');
<link type="text/css" rel="stylesheet" href="https://cdn.datatables.net/1.10.25/css/dataTables.bootstrap5.min.css" media="screen">
<link type="text/css" rel="stylesheet" href="{{ asset('plugin/dataTables/dataTables.bootstrap5.css') }}" media="screen">
if (href)
window.location = href;
<script type="text/javascript" src="https://cdn.datatables.net/1.10.25/js/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="{{ asset('plugin/dataTables/dataTables.conditionalPaging.js') }}"></script>
<script type="text/javascript" src="https://cdn.datatables.net/1.10.25/js/dataTables.bootstrap5.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('table tr').click(function() {
var href = $(this).find('a').attr('href');
if (href)
window.location = href;
});
$('#user').DataTable({
paging: true,
pageLength: 25,
searching: true,
autoWidth: false,
conditionalPaging: {
style: 'fade',
speed: 500 // optional
},
language: {
paginate: {
previous: '&lt;&lt;',
next: '&gt;&gt;'
}
},
});
});
</script>
@append