@extends('layouts.app')

@section('main-content')
	<div class="row">
		<div class="col-6">
			<table class="table table-bordered m-5">
				<thead>
				<tr>
					<th>ID</th>
					<th>Domain</th>
					<th>Node</th>
					<th>Active</th>
					<th>System</th>
					<th>Sysop</th>
				</tr>
				</thead>

				<tbody>
				<tr>
					<td colspan="4"><a href="{{ url('ftn/node/addedit') }}">Add New Node</a></td>
				</tr>
				@foreach (\App\Models\Node::with(['zone'])->cursor() as $oo)
					<tr>
						<td><a href="{{ url('ftn/node/addedit',[$oo->id]) }}">{{ $oo->id }}</a></td>
						<td>@if ($oo->zone_id){{ $oo->zone->name }}@else - @endif</td>
						<td>{{ $oo->ftn }}</td>
						<td>{{ $oo->active ? 'YES' : 'NO' }}</td>
						<td>{{ $oo->system }}</td>
						<td>{{ $oo->sysop }}</td>
					</tr>
				@endforeach
				</tbody>
			</table>
		</div>
	</div>
@endsection

@section('page-scripts')
	<script type="text/javascript">
		$(document).ready(function() {
			$('table tr').click(function() {
				var href = $(this).find("a").attr("href");
				if(href) {
					window.location = href;
				}
			});
		});
	</script>
@append