Home screen improvements, testing for role, work on user/account models

This commit is contained in:
Deon George
2022-04-21 14:41:26 +10:00
parent 40d12b906b
commit 796c72dd09
18 changed files with 528 additions and 241 deletions

View File

@@ -4,21 +4,29 @@
</div>
<div class="card-body">
@if ($user->all_accounts()->count())
<table class="table table-striped table-hover" id="accounts" style="width: 100%;">
@if ($user->accounts->count())
<table class="table table-striped table-hover" id="accounts">
<thead>
<tr>
<th>Profile</th>
<th>Name</th>
<th>Active</th>
<th>Services</th>
<th class="text-right">Services</th>
</tr>
</thead>
<tbody>
@foreach ($user->accounts as $ao)
<tr>
<td><a href="{{ url('r/switch/start',$ao->user_id) }}"><i class="fas fa-external-link-alt"></i></a></td>
<td>{{ $ao->name }}</td>
<td class="text-right">{{ $ao->services->where('active',TRUE)->count() }} <small>/{{ $ao->services->count() }}</small></td>
</tr>
@endforeach
</tbody>
<tfoot>
<tr>
<th>Count {{ $user->all_accounts()->count() }}</th>
<th colspan="3">&nbsp;</th>
<th>Count {{ $user->accounts->count() }}</th>
<th colspan="2">&nbsp;</th>
</tr>
</tfoot>
</table>
@@ -35,21 +43,12 @@
<script type="text/javascript">
$(document).ready(function() {
$('#accounts').DataTable( {
ajax: {
url: "/api/r/accounts"
},
columns: [
{ data: "switch_url" },
{ data: "name" },
{ data: "active_display" },
{ data: "services_count_html" }
],
$('#accounts').DataTable({
language: {
emptyTable: "No Active Clients"
},
order: [1, 'asc'],
pageLength: 25
order: [1,'asc'],
pageLength: 10
});
$('#accounts tbody').on('click','tr', function () {