Complete implement of select2 component, and replaced existing use of select2. Also deprecated CustomBlade definitions of select2/simplemde
All checks were successful
Create Docker Image / Build Docker Image (x86_64) (push) Successful in 43s
Create Docker Image / Build Docker Image (arm64) (push) Successful in 1m34s
Create Docker Image / Final Docker Image Manifest (push) Successful in 11s

This commit is contained in:
Deon George 2024-12-06 14:44:19 +11:00
parent e3c45dfd3d
commit e9b5783945
20 changed files with 118 additions and 255 deletions

View File

@ -20,12 +20,13 @@ class PageAssets
'datatables' => [
'base' => [
'css' => [
'//cdn.datatables.net/2.1.2/css/dataTables.bootstrap4.css',
'//cdn.datatables.net/1.10.25/css/dataTables.bootstrap5.css',
//'//cdn.datatables.net/2.1.2/css/dataTables.dataTables.min.css',
'/plugin/dataTables/dataTables.bootstrap5.css',
],
'js' => [
'//cdn.datatables.net/2.1.2/js/dataTables.min.js',
'//cdn.datatables.net/2.1.2/js/dataTables.bootstrap4.min.js',
'//cdn.datatables.net/1.10.25/js/jquery.dataTables.min.js',
'//cdn.datatables.net/1.10.25/js/dataTables.bootstrap5.min.js',
],
],
'buttons' => [
@ -42,7 +43,8 @@ class PageAssets
],
'conditionalpaging' => [
'js' => [
'//cdn.datatables.net/plug-ins/2.0.5/features/conditionalPaging/dataTables.conditionalPaging.min.js',
//'//cdn.datatables.net/plug-ins/2.0.5/features/conditionalPaging/dataTables.conditionalPaging.min.js',
'/plugin/dataTables/dataTables.conditionalPaging.js',
],
],
'fixedheader' => [
@ -69,13 +71,13 @@ class PageAssets
],
'rowgroup' => [
'css' => [
'//cdn.datatables.net/rowgroup/1.5.0/css/rowGroup.bootstrap4.min.css',
'//cdn.datatables.net/rowgroup/1.1.2/css/rowGroup.bootstrap4.min.css',
//'//cdn.datatables.net/rowgroup/1.5.0/css/rowGroup.dataTables.min.css',
],
'js' => [
'//cdn.datatables.net/rowgroup/1.5.0/js/dataTables.rowGroup.min.js',
'//cdn.datatables.net/rowgroup/1.1.2/js/dataTables.rowGroup.min.js',
//'//cdn.datatables.net/rowgroup/1.5.0/js/rowGroup.dataTables.min.js',
'//cdn.datatables.net/rowgroup/1.5.0/js/rowGroup.bootstrap4.min.js',
'//cdn.datatables.net/rowgroup/1.1.2/js/rowGroup.bootstrap5.min.js',
],
],
'searchpanes' => [

View File

@ -684,9 +684,16 @@ class SystemController extends Controller
$this->authorize('update_nn',$o);
session()->flash('accordion','session');
// Remove the subscription to file/echo areas for each address affected
foreach ($o->akas->where('zone_id',$zo->id) as $ao) {
$ao->echoareas()->detach();
$ao->fileareas()->detach();
}
$o->sessions()->detach($zo);
return redirect()->to(sprintf('system/addedit/%d',$o->id));
return redirect()
->to(sprintf('system/addedit/%d',$o->id));
}
// @todo Can this be consolidated with system_register()

View File

@ -118,7 +118,8 @@ class System extends Model
->select(['zones.id','zones.zone_id','domain_id','zones.active'])
->join('domains',['domains.id'=>'zones.domain_id'])
->withPivot(['sespass','pktpass','ticpass','fixpass','zt_ipv4','zt_ipv6','default'])
->orderBy('domains.name');
->orderBy('domains.name')
->dontCache();
}
/**

View File

@ -32,14 +32,6 @@ class CustomBladeServiceProvider extends ServiceProvider
'<link type="text/css" rel="stylesheet" href="https://cdn.datatables.net/1.10.25/css/dataTables.bootstrap5.min.css" media="screen">'.
'<link type="text/css" rel="stylesheet" href="'.asset('plugin/dataTables/dataTables.bootstrap5.css').'" media="screen">';
case 'select2':
return
'<link type="text/css" rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.13/css/select2.min.css">';
case 'simplemde':
return
'<link type="text/css" rel="stylesheet" href="https://cdn.jsdelivr.net/simplemde/latest/simplemde.min.css">';
default:
throw new \Exception('Unknown CSS: '.$expression);
}
@ -63,15 +55,6 @@ class CustomBladeServiceProvider extends ServiceProvider
'<script type="text/javascript" src="https://code.highcharts.com/modules/export-data.js"></script>'.
'<script type="text/javascript" src="https://code.highcharts.com/themes/dark-unica.js"></script>';
case 'select2':
return
'<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.13/js/select2.min.js"></script>'.
'<script type="text/javascript" src="'.asset('plugin/select2/fix-autofocus.js').'"></script>';
case 'simplemde':
return
'<script type="text/javascript" src="https://cdn.jsdelivr.net/simplemde/latest/simplemde.min.js"></script>';
default:
throw new \Exception('Unknown JS: '.$expression);
}

View File

@ -1,6 +1,6 @@
<div class="form-group">
@if(isset($label))
<label {{ $attributes->only(['class'])->merge(['class'=>'form-label']) }} for="{{ $id ?? $name }}">{{ $label }}</label>
<label {{ $attributes->only(['class'])->merge(['class'=>'form-label']) }} for="{{ $id ?? $name }}">{!! html_entity_decode($label) !!}</label>
@endisset
<div class="input-group has-validation">
@if(isset($icon) || isset($prepend))

View File

@ -1,6 +1,6 @@
<x-form.base {{ $attributes }}>
<input type="hidden" id="{{ $name }}_disabled" name="{{ $name }}" value="" disabled>
<select style="width: 80%" class="form-select @error((! empty($old)) ? $old : $name) is-invalid @enderror" id="{{ $id ?? $name }}" name="{{ $name }}" @required(isset($required)) @disabled(isset($disabled) && $disabled)>
<select style="width: 80%" class="form-select @error((! empty($old)) ? $old : $name) is-invalid @enderror" id="{{ $id ?? $name }}" name="{{ $name }}" @required(isset($required) && $required) @disabled(isset($disabled) && $disabled)>
@if(empty($value) || isset($addnew) || isset($choose))
<option value=""></option>
@isset($addnew)

View File

@ -1,3 +1,4 @@
<!-- $o=Echoarea::class -->
@use(App\Models\Domain)
@extends('layouts.app')
@ -17,24 +18,12 @@
<div class="row">
<div class="col-3">
<label for="domain" class="form-label">Domain</label>
<div class="input-group has-validation">
<span class="input-group-text"><i class="bi bi-tag-fill"></i></span>
<select class="form-select @error('domain_id') is-invalid @enderror" id="domain" name="domain_id" required @cannot('admin',$o)disabled @endcannot>
<option value="">&nbsp;</option>
@foreach (Domain::active()->orderBy('name')->cursor() as $oo)
<option value="{{ $oo->id }}" @if(old('domain_id',$o->domain_id)==$oo->id)selected @endif>{{ $oo->name }}</option>
@endforeach
</select>
<span class="invalid-feedback" role="alert">
@error('domain_id')
{{ $message }}
@else
A domain is required.
@enderror
</span>
<span class="input-helper">Add a <a href="{{ url('domain/addedit') }}">NEW Domain</a></span>
</div>
@php
$helper = (! $o->domain_id)
? sprintf('Add a <a href="%s">NEW Domain</a>',url('domain/addedit'))
: NULL;
@endphp
<x-form.select name="domain_id" icon="bi-tag-fill" label="Domain" feedback="Domain is required" :helper="$helper" :value="$o->domain_id" :options="Domain::active()->orderBy('name')->cursor()->map(fn($item)=>['id'=>$item->id,'value'=>$item->name])" required/>
</div>
<div class="col-3">
@ -170,7 +159,7 @@
<div class="col-12">
<h3>Exporting to the following adresses:</h3>
<table class="table monotable" id="system">
<table class="table monotable" id="systems">
<thead>
<tr>
<th>System</th>
@ -185,7 +174,7 @@
@foreach ($o->addresses as $ao)
<tr>
<td><a href="{{ url('system/addedit',[$ao->system_id]) }}">{{ $ao->system->full_name($ao) }}</a> @auth<span class="float-end"><small>@if($ao->is_hosted)<sup>{{ $ao->is_default ? '**' : '*' }}</sup>@elseif($ao->system->setup)<sup class="success">+</sup>@endif[{{ $ao->system_id }}]</small></span>@endauth</td>
<td>{{ $ao->ftn_3d }}</td>
<td>{{ $ao->ftn4d }}</td>
<td>{{ $ao->system->last_seen?->format('Y-m-d H:i') ?: '-' }}</td>
<td>{{ ($x=$o->waiting($ao))->count() ? $x->first()->datetime->format('Y-m-d H:i') : '-' }}</td>
<td class="text-end">{{ number_format($x->count()) }}</td>
@ -199,3 +188,23 @@
@endcan
</form>
@endsection
@pa(datatables,conditionalpaging)
@section('page-scripts')
<script type="text/javascript">
$(document).ready(function() {
$('#systems').DataTable({
paging: true,
pageLength: 25,
searching: true,
ordering: true,
order: [1,'asc'],
conditionalPaging: {
style: 'fade',
speed: 500 // optional
},
});
});
</script>
@append

View File

@ -1,6 +1,7 @@
<!-- $o=Filearea::class -->
@use(App\Models\Domain)
@use(App\Classes\FTN\Message)
@extends('layouts.app')
@section('htmlheader_title')
@ -18,24 +19,12 @@
<div class="row">
<div class="col-3">
<label for="domain" class="form-label">Domain</label>
<div class="input-group has-validation">
<span class="input-group-text"><i class="bi bi-tag-fill"></i></span>
<select class="form-select @error('domain_id') is-invalid @enderror" id="domain" name="domain_id" required @cannot('admin',$o)disabled @endcannot>
<option value="">&nbsp;</option>
@foreach (Domain::active()->orderBy('name')->cursor() as $oo)
<option value="{{ $oo->id }}" @if(old('domain_id',$o->domain_id)==$oo->id)selected @endif>{{ $oo->name }}</option>
@endforeach
</select>
<span class="invalid-feedback" role="alert">
@error('domain_id')
{{ $message }}
@else
A domain is required.
@enderror
</span>
<span class="input-helper">Add a <a href="{{ url('domain/addedit') }}">NEW Domain</a></span>
</div>
@php
$helper = (! $o->domain_id)
? sprintf('Add a <a href="%s">NEW Domain</a>',url('domain/addedit'))
: NULL;
@endphp
<x-form.select name="domain_id" icon="bi-tag-fill" label="Domain" feedback="Domain is required" :helper="$helper" :value="$o->domain_id" :options="Domain::active()->orderBy('name')->cursor()->map(fn($item)=>['id'=>$item->id,'value'=>$item->name])" required/>
</div>
<div class="col-4">
@ -157,6 +146,8 @@
</div>
</div>
<!-- @todo Show exported systems and files waiting -->
<div class="row">
<div class="col-12">
@if ($o->files->count())
@ -191,13 +182,9 @@
</form>
@endsection
@section('page-css')
@css('datatables')
@append
@pa(datatables,conditionalpaging)
@section('page-scripts')
@js('datatables')
<script type="text/javascript">
$(document).ready(function() {
$('#files').DataTable({

View File

@ -28,7 +28,7 @@
? sprintf('Add a <a href="%s">NEW System"</a>',url('system/addedit'))
: sprintf('<a href="%s">Edit</a> System',url('system/addedit',[$o->system_id]));
@endphp
<x-form.select name="system_id" icon="bi-tag-fill" label="System" feedback="A system is required" placeholder="Select System" :helper="$helper" :required="true" :value="$o->system_id" :options="System::select(['id','name'])->active()->cursor()->map(fn($item,$key)=>['id'=>$item->id,'value'=>$item->name])" />
<x-form.select name="system_id" icon="bi-tag-fill" label="System" feedback="A system is required" placeholder="Select System" :helper="$helper" :value="$o->system_id" :options="System::select(['id','name'])->active()->cursor()->map(fn($item)=>['id'=>$item->id,'value'=>$item->name])" required/>
</div>
<!-- System Addresses -->

View File

@ -1,8 +1,8 @@
<!-- $o=System::class -->
@use(App\Models\Address)
@use(App\Models\Echomail)
@use(App\Models\File)
@use(App\Models\Netmail)
<!-- $o=System::class -->
@extends('layouts.app')

View File

@ -1,3 +1,5 @@
<!-- $ao=Address::class -->
<!-- $o=System::class -->
@extends('layouts.app')
@section('htmlheader_title')
@ -18,69 +20,33 @@
<div class="row pt-0">
<div class="col-2">
<label for="to" class="form-label">To</label>
<div class="input-group">
<span class="input-group-text"><i class="bi bi-ui-radios"></i></span>
<select class="form-select @error('to') is-invalid @enderror" id="to" name="to">
@foreach (config('fido.areafilefix') as $name)
<option value="{{ $name }}" @if(old('to' === $name ))selected @endif>{{ $name }}</option>
@endforeach
</select>
<span class="invalid-feedback" role="alert">
@error('to')
{{ $message }}
@enderror
</span>
</div>
<x-form.select name="to" icon="bi-robot" label="To" feedback="To name required" :value="($x=collect(config('fido.areafilefix')))->first()" :options="$x->map(fn($item)=>['id'=>$item,'value'=>$item])" required/>
</div>
<div class="offset-2 col-3">
<label for="tftn_id" class="form-label">Address</label>
<div class="input-group">
<span class="input-group-text"><i class="bi bi-ui-radios"></i></span>
<select class="form-select @error('tftn_id') is-invalid @enderror" id="tftn_id" name="tftn_id">
@foreach ($o->akas->where('zone_id',$zo->id) as $ao)
<option value="{{ $ao->id }}" @if(old('tftn_id' === $ao->id))selected @endif>{{ $ao->ftn }}</option>
@endforeach
</select>
<span class="invalid-feedback" role="alert">
@error('tftn_id')
{{ $message }}
@enderror
</span>
</div>
<x-form.select name="tftn_id" icon="bi-ui-radios" label="Uplink Address" feedback="Uplink address required" :value="($x=collect(config('fido.areafilefix')))->first()" :options="$o->akas->where('zone_id',$zo->id)->map(fn($item)=>['id'=>$item->id,'value'=>$item->ftn])" required/>
</div>
</div>
<div class="row">
<!-- SUBJECT -->
<div class="col-3">
<label for="subject" class="form-label">Subject</label>
<div class="input-group">
<span class="input-group-text @error('subject') is-invalid @enderror"><i class="bi bi-wifi"></i></span>
<input type="text" class="form-control" id="subject" placeholder="Areafix Password" name="subject" value="{{ old('subject',$ao->pass_fix) }}">
<div class="input-group has-validation">
<span class="input-group-text @error('subject') is-invalid @enderror"><i class="bi bi-pass"></i></span>
<input type="text" class="form-control" id="subject" placeholder="Areafix Password" name="subject" value="{{ old('subject',$ao->pass_fix) }}" required>
<span class="invalid-feedback" role="alert">
@error('subject')
{{ $message }}
@else
Area/filefix password is required
@enderror
</span>
</div>
</div>
<div class="offset-1 col-3">
<label for="fftn_id" class="form-label">From</label>
<div class="input-group">
<span class="input-group-text"><i class="bi bi-ui-radios"></i></span>
<select class="form-select @error('fftn_id') is-invalid @enderror" id="fftn_id" name="fftn_id">
@foreach ($setup->system->akas->where('zone_id',$zo->id) as $ao)
<option value="{{ $ao->id }}" @if(old('fftn_id' === $ao->id))selected @endif>{{ $ao->ftn }}</option>
@endforeach
</select>
<span class="invalid-feedback" role="alert">
@error('fftn_id')
{{ $message }}
@enderror
</span>
</div>
<x-form.select name="fftn_id" icon="bi-ui-radios" label="Our address" feedback="Our address required" :value="$ao->id" :options="$setup->system->akas->where('zone_id',$zo->id)->map(fn($item)=>['id'=>$item->id,'value'=>$item->ftn])" required/>
</div>
</div>
@ -88,10 +54,12 @@
<!-- Message -->
<div class="col-12">
<label for="msg" class="form-label">Message</label>
<textarea class="form-control @error('msg') is-invalid @enderror" rows=10 name="msg" placeholder="Message...">{{ old('msg') }}</textarea>
<textarea class="form-control @error('msg') is-invalid @enderror" rows=10 name="msg" placeholder="Message..." required>{{ old('msg') }}</textarea>
<span class="invalid-feedback" role="alert">
@error('msg')
{{ $message }}
@else
Area/filefix commands are required
@enderror
</span>
</div>
@ -104,13 +72,3 @@
</div>
</form>
@endsection
@section('page-css')
@append
@section('page-scripts')
<script type="text/javascript">
$(document).ready(function() {
});
</script>
@append

View File

@ -1,3 +1,6 @@
<!-- $o=Address::class -->
@use(App\Models\System)
@extends('layouts.app')
@section('htmlheader_title')
@ -22,26 +25,11 @@ Move Address
<div class="row">
<!-- Choose System -->
<div class="col-4">
<label for="system_id" class="form-label">Move <strong class="highlight">{{ $o->ftn }}</strong> to system:</label>
<div class="input-group has-validation">
<span class="input-group-text"><i class="bi bi-display-fill"></i></span>
<select style="width: 80%;" class="form-select @error('system_id') is-invalid @enderror" id="system_id" name="system_id" required @cannot('admin',$o)disabled @endcannot>
<option value="">&nbsp;</option>
@foreach (\App\Models\System::active()->where('id','<>',$o->system_id)->cursor() as $oo)
<option value="{{ $oo->id }}" @if(old('system_id')==$oo->id)selected @endif>{{ $oo->name }}</option>
@endforeach
</select>
<span class="invalid-feedback" role="alert">
@error('system_id')
{{ $message }}
@else
Please select the System that should have the address.
@enderror
</span>
<span class="input-helper">
Add a <a href="{{ url('system/addedit') }}">NEW System</a>
</span>
</div>
@php
$helper = sprintf('Add a <a href="%s">NEW System</a>',url('system/addedit'));
$label = sprintf('Move <strong class="highlight">%s</strong> to system',$o->ftn);
@endphp
<x-form.select name="system_id" icon="bi-envelope-at-fill" :label="$label" placeholder="Select System" feedback="System is required" :helper="$helper" :value="$o->system_id" :options="System::select(['id','name'])->active()->where('id','<>',$o->system_id)->cursor()->map(fn($item)=>['id'=>$item->id,'value'=>$item->name])" required/>
</div>
<div class="col-3">
@ -109,16 +97,9 @@ Move Address
</form>
@endsection
@section('page-css')
@css('select2')
@append
@section('page-scripts')
@js('select2')
<script type="text/javascript">
$(document).ready(function() {
$('#system_id').select2();
@if ($o->is_hosted)
$('#remove_yes').on('change',function() {
if (! $('#session-remove').hasClass('d-none'))

View File

@ -10,22 +10,22 @@
<div class="row">
<!-- Select Zone -->
<div class="col-3">
<x-form.select name="zone_id" icon="bi-hash" label="Zone" :options="Zone::select(['id','zone_id','domain_id'])->active()->domainZoneOrder()->with(['domain'])->cursor()->map(fn($item,$key)=>['id'=>$item->id,'value'=>sprintf('%d [%s]',$item->zone_id,$item->domain->name)])" required="true" />
<x-form.select name="zone_id" icon="bi-hash" label="Zone" :options="Zone::select(['id','zone_id','domain_id'])->active()->domainZoneOrder()->with(['domain'])->cursor()->map(fn($item)=>['id'=>$item->id,'value'=>sprintf('%d [%s]',$item->zone_id,$item->domain->name)])" required/>
</div>
<!-- Select Region -->
<div class="col-3 d-none" id="region-select">
<x-form.select name="region_id" icon="bi-geo" label="Region" :required="true" />
<x-form.select name="region_id" icon="bi-geo" label="Region" required/>
</div>
<!-- Select Host -->
<div class="col-3 d-none" id="host-select">
<x-form.select name="host_id" icon="bi-diagram-3-fill" label="Host" />
<x-form.select name="host_id" icon="bi-diagram-3-fill" label="Host"/>
</div>
<!-- Select Hub -->
<div class="col-3 d-none" id="hub-select">
<x-form.select name="hub_id" icon="bi-diagram-2-fill" label="Hub" />
<x-form.select name="hub_id" icon="bi-diagram-2-fill" label="Hub"/>
</div>
</div>

View File

@ -7,33 +7,13 @@
<div class="row">
<!-- Select Domain -->
<div class="col-3">
<label for="echoarea_domain_id" class="form-label">Network</label>
<div class="input-group has-validation">
<span class="input-group-text"><i class="bi bi-hash"></i></span>
<select class="form-select @error('domain_id') is-invalid @enderror" id="echoarea_domain_id" name="domain_id" required>
<option></option>
@foreach($o->sessions as $zo)
<option value="{{ $zo->domain_id }}" @if(old('domain_id') == $zo->domain_id)selected @endif>{{ $zo->zone_id }} <small>({{ $zo->domain->name }})</small></option>
@endforeach
</select>
<span class="invalid-feedback" role="alert">
@error('domain_id')
{{ $message }}
@enderror
</span>
</div>
<x-form.select id="echoarea_domain_id" name="domain_id" icon="bi-hash" label="Network" :options="$o->sessions->map(fn($item)=>['id'=>$item->domain_id,'value'=>sprintf('%s (%s)',$item->zone_id,$item->domain->name)])"/>
</div>
<!-- Select Address -->
<div class="col-3">
<div class="d-none" id="echoarea_address-select">
<label for="echoarea_address_id" class="form-label">Address</label>
<div class="input-group">
<span class="input-group-text"><i class="bi bi-hash"></i></span>
<select class="form-select" id="echoarea_address_id" name="address_id" required>
<option></option>
</select>
</div>
<x-form.select id="echoarea_address_id" name="address_id" icon="bi-hash" label="Address"/>
</div>
</div>
@ -86,10 +66,15 @@
<script type="text/javascript">
$(document).ready(function() {
$('#echoarea_domain_id').on('change',function() {
if (! $('#echoarea-select').hasClass('d-none'))
$('#echoarea-select').addClass('d-none');
if (! $(this).val()) {
$('#echoarea-summary').removeClass('d-none');
$('#echoarea_address-select').addClass('d-none');
return;
} else {
$('#echoarea_address-select').removeClass('d-none');
}

View File

@ -7,33 +7,13 @@
<div class="row">
<!-- Select Domain -->
<div class="col-3">
<label for="domain_id" class="form-label">Network</label>
<div class="input-group has-validation">
<span class="input-group-text"><i class="bi bi-hash"></i></span>
<select class="form-select @error('domain_id') is-invalid @enderror" id="filearea_domain_id" name="domain_id" required>
<option></option>
@foreach($o->sessions as $zo)
<option value="{{ $zo->domain_id }}" @if(old('domain_id') == $zo->domain_id)selected @endif>{{ $zo->zone_id }} <small>({{ $zo->domain->name }})</small></option>
@endforeach
</select>
<span class="invalid-feedback" role="alert">
@error('domain_id')
{{ $message }}
@enderror
</span>
</div>
<x-form.select id="filearea_domain_id" name="domain_id" icon="bi-hash" label="Network" :options="$o->sessions->map(fn($item)=>['id'=>$item->domain_id,'value'=>sprintf('%s (%s)',$item->zone_id,$item->domain->name)])"/>
</div>
<!-- Select Address -->
<div class="col-3">
<div class="d-none" id="filearea_address-select">
<label for="filearea_address_id" class="form-label">Address</label>
<div class="input-group">
<span class="input-group-text"><i class="bi bi-hash"></i></span>
<select class="form-select" id="filearea_address_id" name="address_id" required>
<option></option>
</select>
</div>
<x-form.select id="filearea_address_id" name="address_id" icon="bi-hash" label="Address"/>
</div>
</div>
@ -73,10 +53,16 @@
<script type="text/javascript">
$(document).ready(function() {
$('#filearea_domain_id').on('change',function() {
console.log('closing filearea-select');
if (! $('#filearea-select').hasClass('d-none'))
$('#filearea-select').addClass('d-none');
if (! $(this).val()) {
$('#filearea-summary').removeClass('d-none');
$('#filearea_address-select').addClass('d-none');
return;
} else {
$('#filearea_address-select').removeClass('d-none');
}

View File

@ -1,9 +1,8 @@
<!-- $o = System::class -->
@php
use App\Models\Zone;
@endphp
@use(App\Models\Zone)
@if(($x=Zone::active()
@if(($zones=Zone::select(['id','domain_id','zone_id'])
->active()
->whereIn('id',$o->addresses->pluck('zone.id'))
->whereNotIn('id',$o->sessions->pluck('id'))
->with(['domain'])
@ -20,29 +19,13 @@ use App\Models\Zone;
<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>
<x-form.select id="szone_id" name="zone_id" icon="bi-hash" label="Zone" feedback="Our address required" value="x" :options="$zones->map(fn($item)=>['id'=>$item->id,'value'=>sprintf('%s (%s)',$item->zone_id,$item->domain->name)])" required/>
</div>
<div class="col-9">
<div class="row pt-0">
<!-- Session -->
<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>
@ -57,8 +40,8 @@ use App\Models\Zone;
</div>
</div>
<!-- Packet -->
<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>
@ -75,8 +58,8 @@ use App\Models\Zone;
</div>
<div class="row">
<!-- Areafix -->
<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>
@ -91,8 +74,8 @@ use App\Models\Zone;
</div>
</div>
<!-- TIC -->
<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>

View File

@ -174,7 +174,7 @@
<!-- Mail Packet -->
<div class="col-4">
<x-form.select name="pkt_type" icon="bi-ui-radios" label="Mail Packet" feedback="Set a packet type" :value="$o->pkt_type ?: config('fido.packet_default')" :options="collect(Packet::PACKET_TYPES)->map(fn($item,$key)=>['id'=>$key,'value'=>$key])" required="true" :disabled="Gate::denies('update_nn',$o)"/>
<x-form.select name="pkt_type" icon="bi-ui-radios" label="Mail Packet" feedback="Set a packet type" :value="$o->pkt_type ?: config('fido.packet_default')" :options="collect(Packet::PACKET_TYPES)->map(fn($item,$key)=>['id'=>$key,'value'=>$key])" required :disabled="Gate::denies('update_nn',$o)"/>
</div>
<!-- Packet Msgs -->

View File

@ -48,21 +48,7 @@
<!-- Forward Netmail -->
@can('admin',$o)
<div class="col-4">
<label for="system_id" class="form-label">Forward Netmails</label>
<div class="input-group has-validation">
<span class="input-group-text"><i class="bi bi-envelope-at-fill"></i></span>
<select style="width: 80%;" class="form-select @error('system_id') is-invalid @enderror" id="system_id" name="system_id">
<option value="">&nbsp;</option>
@foreach ($o->systems as $oo)
<option value="{{ $oo->id }}" @if(old('system_id',$o->system_id)==$oo->id)selected @endif>{{ $oo->name }}</option>
@endforeach
</select>
<span class="invalid-feedback" role="alert">
@error('system_id')
{{ $message }}
@enderror
</span>
</div>
<x-form.select name="system_id" icon="bi-envelope-at-fill" label="Forward Netmails" placeholder="Select System" :value="$o->system_id" :options="$o->systems->map(fn($item)=>['id'=>$item->id,'value'=>$item->name])"/>
</div>
@endcan
</div>
@ -195,8 +181,6 @@
@endsection
@section('page-css')
@css('select2')
<style>
#content h3 {
margin-bottom: 5px;
@ -208,8 +192,6 @@
@append
@section('page-scripts')
@js('select2')
<!-- Passkeys -->
<script type='text/javascript' src='{{ asset('/passkey/passkey.js') }}'></script>
@ -224,7 +206,6 @@
<script type="text/javascript">
$(document).ready(function() {
$('#system_id').select2();
$('#passkey').on('click',function(item) {
if (passkey_debug)
console.log('Passkey: Create Click');

View File

@ -26,7 +26,7 @@
->whereRaw('id NOT IN (SELECT system_id FROM "system_user")')
->cursor())
<x-form.select name="system_id" icon="bi-laptop-fill" label="BBS Name" placeholder="See if your BBS exists, otherwise add it" feedback="BBS Name is required" helper="Enter your BBS name and press NEXT" :addvalues="true" :options="$options->map(fn($item,$key)=>['id'=>$item->id,'value'=>$item->name])" required/>
<x-form.select name="system_id" icon="bi-laptop-fill" label="BBS Name" placeholder="See if your BBS exists, otherwise add it" feedback="BBS Name is required" helper="Enter your BBS name and press NEXT" :addvalues="true" :options="$options->map(fn($item)=>['id'=>$item->id,'value'=>$item->name])" required/>
</div>
</div>

View File

@ -78,8 +78,8 @@
<div class="col-4">
@php
$helper = (! $o->system_id)
? sprintf('Add a <a href="%s">NEW System</a>',url('domain/addedit'))
: sprintf('<a href="%s">Edit</a> System',url('domain/addedit',[$o->system_id]));
? sprintf('Add a <a href="%s">NEW System</a>',url('system/addedit'))
: sprintf('<a href="%s">Edit</a> System',url('system/addedit',[$o->system_id]));
@endphp
<x-form.select name="system_id" icon="bi-laptop-fill" label="System" feedback="A system is required" :helper="sprintf('%s. This system is the primary mailer/tosser responsible for the zone.',$helper)" :value="$o->system_id" :options="System::select(['id','name'])->active()->orderBy('name')->cursor()->map(fn($item)=>['id'=>$item->id,'value'=>$item->name])" required/>
</div>