<!-- $o=Service\Broadband::class -->

<div class="card">
	<x-ribbons.change :change="$o->service->is_pending_change"/>
	<x-ribbons.pending :pending="$o->service->is_pending_active"/>

	<div class="card-header bg-gray-dark">
		<h3 class="card-title">Broadband Details</h3>
	</div>

	<div class="card-body bg-gray-dark">
		<table class="table table-sm">
			<tr>
				<th>Address</th>
				<td>{{ $o->service_address }}</td>
			</tr>
			<tr>
				<th>Service Number</th>
				<td>{{ $o->service_number }}</td>
			</tr>
			@if($o->pppoe)
				<tr>
					<th>Service Username</th>
					<td>{{ $o->service_username }}</td>
				</tr>
				<tr>
					<th>Service Password</th>
					<td>{{ $o->service_password }}</td>
				</tr>
			@else
				<tr>
					<th>Service Type</th>
					<td>Layer 2</td>
				</tr>
			@endif
			@if($o->connect_at)
				<tr>
					<th>Connected</th>
					<td>{{ $o->connect_at->format('Y-m-d') }}</td>
				</tr>
			@endif
			@if($x=$o->technology)
				<tr>
					<th>Technology</th>
					<td>{{ $x }}</td>
				</tr>
			@endif
			<tr>
				<th>Speed</th>
				<td>{{ $o->supplied()->speed }} Mbps</td>
			</tr>
			<!-- @todo -->
			<tr>
				<th>Traffic</th>
				<td>{{ $o->service->offering->allowance_string() }} GB</td>
			</tr>
			<tr>
				<th>IP4 Address</th>
				<td>{{ $o->ipaddress ?: 'Dynamic' }}</td>
			</tr>
			<tr>
				<th>IP6 Address</th>
				<td>{{ $o->ip6address ?: '-' }}</td>
			</tr>
			@if ($o->in_contract)
				<tr>
					<th>Contract</th>
					<td>{{ $o->contract_term }} months</td>
				</tr>
				<tr>
					<th>Contract End</th>
					<td>{{ $o->service_expire->format('Y-m-d') }} <small>({{ $o->service_expire->diffForHumans() }})</small></td>
				</tr>
			@endif
			<tr>
				<th>Cancel Notice</th>
				<td>1 month @if($o->in_contract)<small>(after {{ $o->service_expire->subMonth()->format('Y-m-d') }})</small>@endif</td>
			</tr>

			@if(($x=$o->service->changes()->where('service__change.active',TRUE)->where('complete',FALSE)->get()->pop()))
				<tr>
					<th>Pending Plan Change</th>
					<td>{{ $x->name }}</td>
				</tr>
				<tr>
					<th>Pending Submitted</th>
					<td>{{ $x->pivot->ordered_at }}</td>
				</tr>
				@if($x->pivot->effective_at)
					<tr>
						<th>Pending Active</th>
						<td>{{ $x->pivot->effective_at }}</td>
					</tr>
				@endif
			@endif
		</table>
	</div>
</div>