@if(($x=\App\Models\Zone::active()
	->whereIn('id',$o->zones->pluck('id'))
	->whereNotIn('id',$o->sessions->pluck('id'))
	->get())->count())

	<hr>

	<form class="row g-0 needs-validation" method="post" action="{{ url('ftn/system/addsession',$o->id) }}" novalidate>
		@csrf

		<div class="row pt-0">
			<div class="col-12">
				<div class="greyframe titledbox shadow0xb0">
					<h2 class="cap">Setup Session Details</h2>

					<div class="row">
						<!-- Select Zone -->
						<div class="col-3">
							<label for="szone_id" class="form-label">Zone</label>
							<div class="input-group has-validation">
								<span class="input-group-text"><i class="bi bi-hash"></i></span>
								<select class="form-select @error('zone_id') is-invalid @enderror" id="szone_id" name="zone_id" required>
									<option></option>
									@foreach($x as $zo)
										<option value="{{ $zo->id }}" @if(old('zone_id') == $zo->id)selected @endif>{{ $zo->zone_id }} <small>({{ $zo->domain->name }})</small></option>
									@endforeach
								</select>
								<span class="invalid-feedback" role="alert">
									@error('zone_id')
										{{ $message }}
									@else
										Please select the Zone for the node's address.
									@enderror
								</span>
							</div>
						</div>

						<div class="col-9">
							<div class="row pt-0">
								<div class="col-6">
									<!-- Session -->
									<label for="sespass" class="form-label">Session Password</label>
									<div class="input-group has-validation">
										<span class="input-group-text"><i class="bi bi-lock"></i></span>
										<input type="text" style="width: 35%;" class="form-control @error('sespass') is-invalid @enderror" id="sespass" placeholder="Session" name="sespass" value="{{ old('sespass') }}" @cannot('admin',$o)disabled @endcannot required>
										<span class="invalid-feedback" role="alert">
											@error('sespass')
												{{ $message }}
											@else
												Session Password required.
											@enderror
										</span>
									</div>
								</div>

								<div class="col-5">
									<!-- Packet -->
									<label for="pktpass" class="form-label">Packet Password</label>
									<div class="input-group has-validation">
										<span class="input-group-text"><i class="bi bi-box"></i></span>
										<input type="text" style="width: 35%;" class="form-control @error('pktpass') is-invalid @enderror" id="pktpass" placeholder="Packet" name="pktpass" value="{{ old('pktpass') }}" @cannot('admin',$o)disabled @endcannot>
										<span class="invalid-feedback" role="alert">
											@error('pktpass')
												{{ $message }}
											@enderror
										</span>
									</div>
								</div>
							</div>

							<div class="row">
								<div class="col-6">
									<!-- Session -->
									<label for="fixpass" class="form-label">Areafix Password</label>
									<div class="input-group has-validation">
										<span class="input-group-text"><i class="bi bi-card-text"></i></span>
										<input type="text" style="width: 35%;" class="form-control @error('fixpass') is-invalid @enderror" id="fixpass" placeholder="Areafix" name="fixpass" value="{{ old('fixpass') }}" @cannot('admin',$o)disabled @endcannot required>
										<span class="invalid-feedback" role="alert">
											@error('fixpass')
												{{ $message }}
											@else
												Areafix password required.
											@enderror
										</span>
									</div>
								</div>

								<div class="col-5">
									<!-- Packet -->
									<label for="ticpass" class="form-label">TIC Password</label>
									<div class="input-group has-validation">
										<span class="input-group-text"><i class="bi bi-archive"></i></span>
										<input type="text" style="width: 35%;" class="form-control @error('ticpass') is-invalid @enderror" id="ticpass" placeholder="TIC" name="ticpass" value="{{ old('ticpass') }}" @cannot('admin',$o)disabled @endcannot>
										<span class="invalid-feedback" role="alert">
											@error('ticpass')
												{{ $message }}
											@enderror
										</span>
									</div>
								</div>
							</div>
						</div>

						<div class="row">
							<div class="col-2">
								<a href="{{ url('ftn/system') }}" class="btn btn-danger">Cancel</a>
							</div>

							<span class="col-6 mt-auto mx-auto text-center align-bottom">
								@if($errors->count())
									<span class="btn btn-sm btn-danger" role="alert">
										There were errors with the submission.
									</span>
								@endif
							</span>

							@can('admin',$o)
								<div class="col-2">
									<button type="submit" name="submit" class="btn btn-success float-end">Add</button>
								</div>
							@endcan
						</div>
					</div>
				</div>
			</div>
		</div>
	</form>
@endif