Added Zones, authorisation on edits, validation enhancements

This commit is contained in:
Deon George
2021-06-18 23:01:41 +10:00
parent 491d3d55c3
commit 416e79164e
14 changed files with 511 additions and 107 deletions

View File

@@ -3,38 +3,68 @@
FTN Zones
@endsection
@section('main-content')
@section('content')
<div class="row">
<div class="col-12">
<h2>About FTN Zones</h2>
<p>In FTN network addresses, a zone is the 3rd dimension and used when a system supports 3D (or better) addressing, ie: <strong class="highlight">zone</strong>:hub/host.point@domain.</p>
<p>Zones are used with domains to uniquely identify a FTN network. Within an FTN network there can be multiple zones with the same domain.</p>
<p>It is rare that a domain has multiple zones - unless it grows quite large. Zones can also be used to group systems into a common boundary.</p>
</div>
</div>
<div class="row">
<div class="col-6">
<table class="table table-bordered m-5">
<thead>
<tr>
<th>ID</th>
<th>Active</th>
<th>Zone</th>
<th>Domain</th>
</tr>
</thead>
<p>This system is aware of the following zones in each domain:</p>
<tbody>
<tr>
<td colspan="4"><a href="{{ url('ftn/zone/addedit') }}">Add New Zone</a></td>
</tr>
@foreach (\App\Models\Zone::cursor() as $oo)
@if (\App\Models\Zone::count() == 0)
@can('admin',(new \App\Models\Zone))
<p>There are no zones setup, to <a href="{{ url('ftn/zone/addedit') }}">set up your first</a>.</p>
@else
<p class="pad">There are no zones - you need to ask an admin to create one for you.</p>
@endcan
@else
@can('admin',(new \App\Models\Domain))
<p>You can <a href="{{ url('ftn/zone/addedit') }}">Add New Zone</a>.</p>
@endcan
<table class="table monotable" id="zones">
<thead>
<tr>
<td><a href="{{ url('ftn/zone/addedit',[$oo->id]) }}">{{ $oo->zone_id }}</a></td>
<td>{{ $oo->active ? 'YES' : 'NO' }}</td>
<td>{{ $oo->name }}</td>
<td>{{ $oo->domain->name }}</td>
<th>Domain</th>
<th>Zone</th>
<th>Active</th>
<th>Systems</th>
</tr>
@endforeach
</tbody>
</table>
</thead>
<tbody>
@foreach (\App\Models\Zone::with(['domain'])->cursor() as $oo)
<tr>
<td>{{ $oo->domain->name }}</td>
<td><a href="{{ url('ftn/zone/addedit',[$oo->id]) }}">{{ $oo->zone_id }}</a></td>
<td>{{ $oo->active ? 'YES' : 'NO' }}</td>
<td>-</td>
</tr>
@endforeach
</tbody>
</table>
@endif
</div>
</div>
@endsection
@section('page-scripts')
{{--
<link href="https://cdn.datatables.net/1.10.25/css/jquery.dataTables.min.css" rel="stylesheet" media="screen" type="text/css">
<link href="https://cdn.datatables.net/rowgroup/1.1.2/css/rowGroup.dataTables.min.css" rel="stylesheet" media="screen" type="text/css">
--}}
<link href="https://cdn.datatables.net/1.10.25/css/dataTables.bootstrap5.min.css" rel="stylesheet" media="screen" type="text/css">
<link href="{{ asset('plugin/dataTables/dataTables.bootstrap5.css') }}" rel="stylesheet" media="screen" type="text/css">
<script src="https://cdn.datatables.net/1.10.25/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/rowgroup/1.1.2/js/dataTables.rowGroup.min.js"></script>
<script 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() {
@@ -43,6 +73,20 @@
window.location = href;
}
});
$('#zones').DataTable({
paging: false,
searching: true,
rowGroup: {
dataSrc: [0],
},
columnDefs: [
{
targets: [0],
visible: false,
},
],
});
});
</script>
@append