More changes to use form.select component. Re-engineered user BBS registration

This commit is contained in:
2024-12-06 08:33:24 +11:00
parent fd780d1756
commit e7336a942b
13 changed files with 253 additions and 422 deletions

View File

@@ -1,8 +1,8 @@
<!-- $o = Setup::class -->
@php
use App\Models\Setup;
use App\Classes\Protocol\{Binkp,EMSI,DNS};
@endphp
@use(App\Classes\Protocol\Binkp)
@use(App\Classes\Protocol\EMSI)
@use(App\Models\Setup)
@use(App\Models\System)
@extends('layouts.app')
@section('htmlheader_title')
@@ -23,30 +23,12 @@ use App\Classes\Protocol\{Binkp,EMSI,DNS};
<div class="row">
<!-- System -->
<div class="col-4">
<label for="system_id" class="form-label">System</label>
<div class="input-group has-validation">
<span class="input-group-text"><i class="bi bi-tag-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()->cursor() 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 }}
@else
A system is required.
@enderror
</span>
<span class="input-helper">
@if(! $o->system_id)
Add a <a href="{{ url('system/addedit') }}">NEW System</a>
@else
<a href="{{ url('system/addedit',[$o->system_id]) }}">Edit</a> System
@endif
</span>
</div>
@php
$helper = (! $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-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])" />
</div>
<!-- System Addresses -->
@@ -301,23 +283,9 @@ use App\Classes\Protocol\{Binkp,EMSI,DNS};
@endsection
@section('page-css')
@css('select2')
<style>
#content h3 {
margin-bottom: 5px;
}
#content ul li:last-child {
margin-bottom: inherit;
}
</style>
@append
@section('page-scripts')
@js('select2')
<script type="text/javascript">
$(document).ready(function() {
$('#system_id').select2();
});
</script>
@append