Minor optimisations when editing and viewing domains

This commit is contained in:
2024-11-05 00:28:34 +11:00
parent dc2e84386f
commit 60ea0afc98
6 changed files with 91 additions and 73 deletions

View File

@@ -1,14 +1,12 @@
@use(App\Models\Echoarea)
<!-- $o=Domain::class -->
@extends('layouts.app')
@section('htmlheader_title')
@if($o->exists) Update @else Add @endif Domain
@endsection
@php
use App\Models\Echoarea;
@endphp
@section('content')
<form class="needs-validation" method="post" novalidate>
@csrf
@@ -107,16 +105,18 @@ use App\Models\Echoarea;
</div>
<div class="col-2">
<label class="form-label">Applications</label>
<div class="input-group">
<div class="btn-group" role="group">
<input type="radio" class="btn-check" name="accept_app" id="accept_app_yes" value="1" required @cannot('admin',$o)disabled @endcannot @if(old('accept_app',$o->accept_app))checked @endif>
<label class="btn btn-outline-success" for="accept_app_yes">Yes</label>
@if ($o->isManaged())
<label class="form-label">Applications</label>
<div class="input-group">
<div class="btn-group" role="group">
<input type="radio" class="btn-check" name="accept_app" id="accept_app_yes" value="1" required @cannot('admin',$o)disabled @endcannot @if(old('accept_app',$o->accept_app))checked @endif>
<label class="btn btn-outline-success" for="accept_app_yes">Yes</label>
<input type="radio" class="btn-check btn-danger" name="accept_app" id="accept_app_no" value="0" required @cannot('admin',$o)disabled @endcannot @if(! old('accept_app',$o->accept_app))checked @endif>
<label class="btn btn-outline-danger" for="accept_app_no">No</label>
<input type="radio" class="btn-check btn-danger" name="accept_app" id="accept_app_no" value="0" required @cannot('admin',$o)disabled @endcannot @if(! old('accept_app',$o->accept_app))checked @endif>
<label class="btn btn-outline-danger" for="accept_app_no">No</label>
</div>
</div>
</div>
@endif
</div>
@if ($o->nodelist_filename)
@@ -136,22 +136,24 @@ use App\Models\Echoarea;
<div class="col-8">
</div>
<div class="col-4">
<label for="nodestatus_id" class="form-label">Echoarea Node Status</label>
<div class="input-group has-validation">
<span class="input-group-text"><i class="bi bi-journal-text"></i></span>
<select style="width: 80%;" class="form-select @error('nodestatus_id') is-invalid @enderror" id="nodestatus_id" name="nodestatus_id" @cannot('admin',$o)disabled @endcannot>
<option value="">&nbsp;</option>
@foreach (Echoarea::active()->where('domain_id',$o->id)->orderBy('description')->cursor() as $oo)
<option value="{{ $oo->id }}" @if(old('nodestatus_id',$o->nodestatus_id)==$oo->id)selected @endif>{{ $oo->description }}</option>
@endforeach
</select>
<span class="invalid-feedback" role="alert">
@error('nodestatus_id')
{{ $message }}
@enderror
</span>
<span class="input-helper">Add a <a href="{{ url('echoarea/addedit') }}">NEW Echoarea</a>. This echoarea is used to send node status messages.</span>
</div>
@if ($o->isManaged())
<label for="nodestatus_id" class="form-label">Echoarea Node Status</label>
<div class="input-group has-validation">
<span class="input-group-text"><i class="bi bi-journal-text"></i></span>
<select style="width: 80%;" class="form-select @error('nodestatus_id') is-invalid @enderror" id="nodestatus_id" name="nodestatus_id" @cannot('admin',$o)disabled @endcannot>
<option value="">&nbsp;</option>
@foreach (Echoarea::active()->where('domain_id',$o->id)->orderBy('description')->cursor() as $oo)
<option value="{{ $oo->id }}" @if(old('nodestatus_id',$o->nodestatus_id)==$oo->id)selected @endif>{{ $oo->description }}</option>
@endforeach
</select>
<span class="invalid-feedback" role="alert">
@error('nodestatus_id')
{{ $message }}
@enderror
</span>
<span class="input-helper">Add a <a href="{{ url('echoarea/addedit') }}">NEW Echoarea</a>. This echoarea is used to send node status messages.</span>
</div>
@endif
</div>
</div>

View File

@@ -1,3 +1,4 @@
@use(App\Models\Address)
@use(Illuminate\Mail\Markdown)
<!-- $o=Domain::class -->
@@ -176,7 +177,7 @@
</div>
<!-- Sign up -->
@if ($o->can_accept_app)
@if ($o->can_accept_app && ($x=Auth::user()->systems->filter(fn($item)=>$item->address && (! $item->inDomain($o))))->count())
<div class="accordion-item">
<h3 class="accordion-header">
<span class="accordion-button collapsed" id="signup" data-bs-toggle="collapse" data-bs-target="#collapse_signup" aria-expanded="false" aria-controls="collapse_signup">Join Network</span>
@@ -184,7 +185,10 @@
<div id="collapse_signup" class="accordion-collapse collapse" aria-labelledby="signup" data-bs-parent="#accordion_homepage">
<div class="accordion-body">
<p>Your system(s) <strong class="highlight">{!! $o->userHasSystemsNotInNet(Auth::user())->pluck('name')->join('</strong>, <strong class="highlight">') !!}</strong> can join this network.</p>
<p>Your system(s) <strong class="highlight">{!! $x->pluck('name')->sort()->join('</strong>, <strong class="highlight">') !!}</strong> can join this network.</p>
@if (($x=Auth::user()->systems->filter(fn($item)=>(! $item->address) && (! $item->inDomain($o))))->count())
<p><small>Your other systems(s) <strong class="highlight">{!! $x->pluck('name')->sort()->join('</strong>, <strong class="highlight">') !!}</strong> cant use this process, because they are missing network details.</small></p>
@endif
<p>
If you want to join it/them to this network, make sure:
</p>
@@ -206,7 +210,7 @@
<li>Enjoy!</li>
</ul>
<button class="btn btn-success">Lets Do It</button>
<button class="btn btn-success">Lets Do It</button> <small><-- NOT READY YET</small>
</div>
</div>
</div>

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')
@@ -212,7 +212,7 @@
</thead>
<tbody>
@foreach ($o->sessions->sortBy('zone_id') as $oo)
@foreach ($o->sessions as $oo)
<tr>
<td>{{ $oo->zone_id }}<span>@</span>{{ $oo->domain->name }}</td>
<td style="text-align: center;">