Updated IPs index

Updated IPs index
This commit is contained in:
cp6 2022-02-21 14:47:13 +11:00
parent 2257d758c3
commit 136119affe

View File

@ -1,4 +1,7 @@
@section('title') {{'IP Addresses'}} @endsection @section('title') {{'IP Addresses'}} @endsection
@section('css_links')
<link rel="stylesheet" href="{{ asset('css/datatables.bootstrap.min.css') }}">
@endsection
@section('style') @section('style')
<x-modal-style></x-modal-style> <x-modal-style></x-modal-style>
@endsection @endsection
@ -16,7 +19,7 @@
<a href="{{ route('IPs.create') }}" class="btn btn-primary mb-3">Add IP</a> <a href="{{ route('IPs.create') }}" class="btn btn-primary mb-3">Add IP</a>
<x-success-alert></x-success-alert> <x-success-alert></x-success-alert>
<div class="table-responsive"> <div class="table-responsive">
<table class="table table-bordered"> <table class="table table-bordered" id="ips-table">
<thead class="table-light"> <thead class="table-light">
<tr> <tr>
<th class="text-nowrap">Type</th> <th class="text-nowrap">Type</th>
@ -25,23 +28,21 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@if(!empty($dn)) @if(!empty($ips))
@foreach($dn as $dns) @foreach($ips as $ip)
<tr> <tr>
<td class="text-nowrap">{{ $dns->is_ipv4}}</td> <td class="text-nowrap">@if ($ip->is_ipv4 === 1)
<td class="text-nowrap">{{ $dns->address}}</td> IPv4
@else
IPv6
@endif</td>
<td class="text-nowrap">{{ $ip->address}}</td>
<td class="text-nowrap"> <td class="text-nowrap">
<form action="{{ route('IPs.destroy', $dns->id) }}" method="POST"> <form action="{{ route('IPs.destroy', $ip->id) }}" method="POST">
<a href="{{ route('IPs.show', $dns->id) }}"
class="text-body mx-1">
<i class="fas fa-eye" title="view"></i></a>
<a href="{{ route('IPs.edit', $dns->id) }}"
class="text-body mx-1">
<i class="fas fa-pen" title="edit"></i></a>
@csrf @csrf
@method('DELETE') @method('DELETE')
<i class="fas fa-trash text-danger ms-3" @click="modalForm" <i class="fas fa-trash text-danger ms-3" @click="modalForm"
id="btn-{{$dns->hostname}}" title="{{$dns->id}}"></i> id="btn-{{$ip->hostname}}" title="{{$ip->id}}"></i>
</form> </form>
</td> </td>
</tr> </tr>
@ -62,7 +63,24 @@
</p> </p>
@endif @endif
</div> </div>
<x-datatables-assets></x-datatables-assets>
<script type="text/javascript">
$(document).ready(function () {
$('#ips-table').DataTable({
"pageLength": 15,
"lengthMenu": [5, 10, 15, 25, 30, 50, 75, 100],
"columnDefs": [
{"orderable": false, "targets": 1}
],
"initComplete": function () {
$('.dataTables_length,.dataTables_filter').addClass('mb-2');
$('.dataTables_paginate').addClass('mt-2');
$('.dataTables_info').addClass('mt-2 text-muted ');
}
});
});
</script>
<x-modal-delete-script> <x-modal-delete-script>
<x-slot name="uri">ips</x-slot> <x-slot name="uri">IPs</x-slot>
</x-modal-delete-script> </x-modal-delete-script>
</x-app-layout> </x-app-layout>