diff --git a/app/Http/Controllers/SystemController.php b/app/Http/Controllers/SystemController.php index 43e7225..8baf1bc 100644 --- a/app/Http/Controllers/SystemController.php +++ b/app/Http/Controllers/SystemController.php @@ -3,6 +3,7 @@ namespace App\Http\Controllers; use Illuminate\Http\Request; +use Illuminate\Support\Arr; use App\Models\{Address,System,Zone}; use App\Rules\{FidoInteger,TwoByteInteger}; @@ -312,6 +313,47 @@ class SystemController extends Controller return redirect()->to(sprintf('ftn/system/addedit/%d',$o->id)); } + /** + * Move address to another system + * + * @param Request $request + * @param System $so + * @param Address $o + * @throws \Illuminate\Auth\Access\AuthorizationException + */ + public function mov_address(Request $request,System $so,Address $o) + { + // Quick check that this address belongs to this system + if ($so->addresses->search(function($item) use ($o) { return $item->id == $o->id; }) === FALSE) + abort(404); + + if ($request->post()) { + $this->authorize('admin',$o); + + $validated = $request->validate([ + 'system_id' => 'required|exists:systems,id', + 'remove' => 'nullable|boolean', + 'remsess' => 'nullable|boolean|exclude_if:remove,1', + ]); + + $o->system_id = $validated['system_id']; + $o->save(); + + if (Arr::get($validated,'remove')) { + $so->sessions()->detach($o->zone); + $so->delete(); + + } elseif (Arr::get($validated,'remsess')) { + $so->sessions()->detach($o->zone); + } + + return redirect()->to('ftn/system/addedit/'.$validated['system_id']); + } + + return view('system.moveaddr') + ->with('o',$o); + } + public function ours() { return view('system.ours'); diff --git a/public/oldschool/css/main.css b/public/oldschool/css/main.css index 3dd0718..798b72d 100644 --- a/public/oldschool/css/main.css +++ b/public/oldschool/css/main.css @@ -398,6 +398,9 @@ ul#searchbar li i { margin-bottom: 16px; } +.actions { + width: 1%; +} dl { margin:1em -1px 0 1px } @@ -488,7 +491,9 @@ label.list-group-item { background-color: inherit; color: inherit; } - +.nowrap { + white-space: nowrap; +} p { margin:0 0 1em; padding:0; @@ -631,7 +636,7 @@ tbody { .monotable tbody td { padding-left:1.5ch!important; padding-right:1.5ch!important; - vertical-align:middle!important + vertical-align:top; } .monotable tbody tr:first-child td { padding-top:9px!important diff --git a/resources/views/setup.blade.php b/resources/views/setup.blade.php index 0a99ef4..91bd719 100644 --- a/resources/views/setup.blade.php +++ b/resources/views/setup.blade.php @@ -45,7 +45,7 @@ use App\Models\Setup; @if(! $o->system_id) Add a NEW System @else - Edit System + Edit System @endif diff --git a/resources/views/system/addedit.blade.php b/resources/views/system/addedit.blade.php index 13aa32b..2433473 100644 --- a/resources/views/system/addedit.blade.php +++ b/resources/views/system/addedit.blade.php @@ -4,6 +4,10 @@ @if($o->exists) Update @else Add @endif System @endsection +@php +use App\Http\Controllers\DomainController as DC; +@endphp + @section('content') @if ($o->exists)