@extends('layouts.app')
@section('htmlheader_title')
	Connectable Systems
@endsection

@section('content')
	<div class="row pt-0">
		<div class="col-12">
			<h2>List of Connectable Systems</h2>

			<p>Here is a list of systems that can be connected to.</p>
		</div>

		<div class="col-12 pt-2">
			<table class="table monotable">
				<thead>
				<tr>
					<th class="w-25">System</th>
					<th class="w-50">Connection Details</th>
					<th>FTN Networks</th>
				</tr>
				</thead>
				<tbody>
				@foreach (\App\Models\System::active()->whereNotNull('method')->orderBy('name')->with(['addresses.zone.domain'])->get() as $o)
					<tr>
						<td>{{ $o->name }}</td>
						<td>
							@switch($o->method)
								@case(23)<a href="telnet://{{ $o->address }}:{{ $o->port }}">Telnet</a> [telnet://{{ $o->address }}:{{ $o->port }}]@break
								@case(22)<a href="ssh://{{ $o->address }}:{{ $o->port }}">SSH</a> [ssh://{{ $o->address }}:{{ $o->port }}]@break
								@case(519)<a href="rlogin://{{ $o->address }}:{{ $o->port }}">rlogin [rlogin://{{ $o->address }}:{{ $o->port }}]</a>@break
								@default No details
							@endswitch
						</td>
						<td>{{ $o->addresses->pluck('zone.domain.name')->unique()->sort()->join(', ') }}</td>
					</tr>
				@endforeach
				</tbody>
			</table>
		</div>
	</div>
@endsection