User register system, minor cosmetic changes, start of user authorisation
This commit is contained in:
parent
a0db589dc5
commit
3c8895a238
@ -3,8 +3,11 @@
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\ViewErrorBag;
|
||||
|
||||
use App\Models\{Address,Echoarea,System,SystemZone,Zone};
|
||||
use App\Rules\{FidoInteger,TwoByteInteger};
|
||||
@ -284,6 +287,19 @@ class SystemController extends Controller
|
||||
->with('o',$o);
|
||||
}
|
||||
|
||||
/**
|
||||
* Systems with no owners
|
||||
*/
|
||||
public function api_orphan(Request $request): Collection
|
||||
{
|
||||
return System::select(['id','name'])
|
||||
->leftjoin('system_user',['system_user.system_id'=>'systems.id'])
|
||||
->whereNull('user_id')
|
||||
->where('systems.name','ilike','%'.$request->term.'%')
|
||||
->orderBy('name')
|
||||
->get();
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete address assigned to a host
|
||||
*
|
||||
@ -356,6 +372,11 @@ class SystemController extends Controller
|
||||
->with('echoareas',$eo);
|
||||
}
|
||||
|
||||
public function home()
|
||||
{
|
||||
return view('system.home');
|
||||
}
|
||||
|
||||
/**
|
||||
* Move address to another system
|
||||
*
|
||||
@ -424,8 +445,33 @@ class SystemController extends Controller
|
||||
return redirect()->to(sprintf('ftn/system/addedit/%d',$o->system_id));
|
||||
}
|
||||
|
||||
public function home()
|
||||
/**
|
||||
* register system
|
||||
*/
|
||||
public function system_register(Request $request)
|
||||
{
|
||||
return view('system.home');
|
||||
$o = System::findOrNew($request->system_id);
|
||||
|
||||
if (! $o->exist) {
|
||||
$o->sysop = Auth::user()->name;
|
||||
|
||||
foreach (['name','zt_id','location','mailer_type','mailer_address','mailer_port','phone','method','address','port'] as $item)
|
||||
if ($request->{$item})
|
||||
$o->{$item} = $request->{$item};
|
||||
|
||||
$o->active = TRUE;
|
||||
}
|
||||
|
||||
if ($request->post('submit')) {
|
||||
Auth::user()->systems()->save($o);
|
||||
|
||||
// @todo if the system already exists and part of one of our nextworks, we'll need to send the registration email to confirm the address.
|
||||
// @todo mark the system (or addresses) as "pending" at this stage until it is confirmed
|
||||
return redirect()->to(url('ftn/system/addedit',$o->id));
|
||||
}
|
||||
|
||||
return view('system.widget.form-system')
|
||||
->with('o',$o)
|
||||
->with('errors',new ViewErrorBag);
|
||||
}
|
||||
}
|
||||
|
@ -57,4 +57,9 @@ class UserController extends Controller
|
||||
{
|
||||
return view('user.home');
|
||||
}
|
||||
|
||||
public function register()
|
||||
{
|
||||
return view('user/system/register');
|
||||
}
|
||||
}
|
||||
|
24
app/Policies/SystemPolicy.php
Normal file
24
app/Policies/SystemPolicy.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Policies;
|
||||
|
||||
use Illuminate\Auth\Access\HandlesAuthorization;
|
||||
|
||||
use App\Models\{System,User};
|
||||
|
||||
class SystemPolicy
|
||||
{
|
||||
use HandlesAuthorization;
|
||||
|
||||
/**
|
||||
* Determine whether the user can update the model.
|
||||
*
|
||||
* @param \App\Models\User $user
|
||||
* @param \App\Models\System $system
|
||||
* @return \Illuminate\Auth\Access\Response|bool
|
||||
*/
|
||||
public function update(User $user, System $system)
|
||||
{
|
||||
return (! $system->exists) || $system->users->contains($user) || $user->isAdmin();
|
||||
}
|
||||
}
|
@ -15,7 +15,7 @@ class AuthServiceProvider extends ServiceProvider
|
||||
* @var array
|
||||
*/
|
||||
protected $policies = [
|
||||
'App\Model' => 'App\Policies\ModelPolicy',
|
||||
//'App\Model' => 'App\Policies\ModelPolicy',
|
||||
];
|
||||
|
||||
/**
|
||||
|
5
public/oldschool/css/main.css
vendored
5
public/oldschool/css/main.css
vendored
@ -404,9 +404,7 @@ ul#searchbar li i {
|
||||
content:"\2666\a0\A0";
|
||||
color:#0a0
|
||||
}
|
||||
#content ul ul li::before {
|
||||
content:"\25CB\A0\A0"!important
|
||||
}
|
||||
|
||||
#content ul li:last-child {
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
@ -488,6 +486,7 @@ form div.row {
|
||||
margin-top:1em
|
||||
}
|
||||
.greyframe>div.row:last-child,
|
||||
.greyframe>div>div.row:last-child,
|
||||
.greyframe>form>div.row:last-child {
|
||||
padding-bottom: 15px;
|
||||
}
|
||||
|
@ -51,7 +51,7 @@
|
||||
</div>
|
||||
</div>
|
||||
@else
|
||||
<p>You are not linked to any BBS systems.</p>
|
||||
<p>You are not linked to any BBS systems. Start <a href="{{ url('user/system/register') }}">here</a> to link to your first.</p>
|
||||
@endif
|
||||
</div>
|
||||
@endsection
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
<!-- CSS only -->
|
||||
<link type="text/css" rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css" integrity="sha384-+0n0xVW2eSR5OomGNYDnhzAbDsOXxcvSN1TPprVMTNDbiYZCxYbOOl7+AMvyTG2x" crossorigin="anonymous">
|
||||
<link type="text/css" rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.5.0/font/bootstrap-icons.css">
|
||||
<link type="text/css" rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.7.0/font/bootstrap-icons.css">
|
||||
|
||||
<link type="text/css" rel="stylesheet" href="{{ asset('oldschool/css/main.css') }}" media="screen">
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('htmlheader_title')
|
||||
@if($o->exists) Update @else Add @endif System
|
||||
@can('admin',$o) @if($o->exists) Update @else Add @endif @endcan System
|
||||
@endsection
|
||||
|
||||
@php
|
||||
|
@ -8,196 +8,9 @@
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="greyframe titledbox shadow0xb0">
|
||||
<h2 class="cap">@if($o->exists) Update @else Add @endif System</h2>
|
||||
<h2 class="cap">@can('update',$o) @if($o->exists) Update @else Add @endif @endif System</h2>
|
||||
|
||||
<div class="row">
|
||||
<!-- Name -->
|
||||
<div class="col-4">
|
||||
<label for="name" class="form-label">Name</label>
|
||||
<div class="input-group has-validation">
|
||||
<span class="input-group-text"><i class="bi bi-tag-fill"></i></span>
|
||||
<input type="text" class="form-control @error('name') is-invalid @enderror" id="name" placeholder="Name" name="name" value="{{ old('name',$o->name) }}" required @cannot('admin',$o)disabled @endcannot autofocus>
|
||||
<span class="invalid-feedback" role="alert">
|
||||
@error('name')
|
||||
{{ $message }}
|
||||
@else
|
||||
A name is required.
|
||||
@enderror
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Active -->
|
||||
<div class="col-2">
|
||||
<label for="active" class="form-label">Active</label>
|
||||
<div class="input-group">
|
||||
<div class="btn-group" role="group">
|
||||
<input type="radio" class="btn-check" name="active" id="active_yes" value="1" required @cannot('admin',$o)disabled @endcannot @if(old('active',$o->active))checked @endif>
|
||||
<label class="btn btn-outline-success" for="active_yes">Yes</label>
|
||||
|
||||
<input type="radio" class="btn-check btn-danger" name="active" id="active_no" value="0" required @cannot('admin',$o)disabled @endcannot @if(! old('active',$o->active))checked @endif>
|
||||
<label class="btn btn-outline-danger" for="active_no">No</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- ZeroTier ID -->
|
||||
<div class="offset-3 col-3">
|
||||
<label for="zt_id" class="form-label">ZeroTier ID</label>
|
||||
<div class="input-group has-validation">
|
||||
<span class="input-group-text"><i class="bi bi-shield-lock-fill"></i></span>
|
||||
<input type="text" class="form-control @error('zt_id') is-invalid @enderror" id="zt_id" placeholder="ZeroTier" name="zt_id" value="{{ old('zt_id',$o->zt_id) }}" @cannot('admin',$o)disabled @endcannot>
|
||||
<span class="invalid-feedback" role="alert">
|
||||
@error('zt_id')
|
||||
{{ $message }}
|
||||
@enderror
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<!-- Sysop -->
|
||||
<div class="col-4">
|
||||
<label for="sysop" class="form-label">Sysop</label>
|
||||
<div class="input-group has-validation">
|
||||
<span class="input-group-text"><i class="bi bi-globe"></i></span>
|
||||
<input type="text" class="form-control @error('sysop') is-invalid @enderror" id="sysop" placeholder="Sysop" name="sysop" value="{{ old('sysop',$o->sysop) }}" required @cannot('admin',$o)disabled @endcannot autocomplete="name">
|
||||
<span class="invalid-feedback" role="alert">
|
||||
@error('sysop')
|
||||
{{ $message }}
|
||||
@else
|
||||
A Sysop's name is required.
|
||||
@enderror
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Location -->
|
||||
<div class="col-8">
|
||||
<label for="location" class="form-label">Location</label>
|
||||
<div class="input-group has-validation">
|
||||
<span class="input-group-text"><i class="bi bi-globe"></i></span>
|
||||
<input type="text" class="form-control @error('location') is-invalid @enderror" id="location" placeholder="Location" name="location" value="{{ old('location',$o->location) }}" required @cannot('admin',$o)disabled @endcannot>
|
||||
<span class="invalid-feedback" role="alert">
|
||||
@error('location')
|
||||
{{ $message }}
|
||||
@else
|
||||
System location is required.
|
||||
@enderror
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<!-- Mailer Details -->
|
||||
<div class="col-12">
|
||||
<h4>Mailer Details</h4>
|
||||
|
||||
<div class="pt-0 row">
|
||||
<div class="col-4">
|
||||
<label for="method" class="form-label">Connection Method</label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text"><i class="bi bi-wifi"></i></span>
|
||||
<select class="form-select @error('method') is-invalid @enderror" id="mailer_type" name="mailer_type" @cannot('admin',$o)disabled @endcannot>
|
||||
<option></option>
|
||||
<option value="{{ Setup::O_BINKP }}" @if(old('mailer_type',$o->mailer_type) == Setup::O_BINKP)selected @endif}}>BINKP</option>
|
||||
<option value="{{ Setup::O_EMSI }}" @if(old('mailer_type',$o->mailer_type) == Setup::O_EMSI)selected @endif}}>EMSI</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-8">
|
||||
<label for="address" class="form-label">Address</label>
|
||||
<div class="input-group has-validation">
|
||||
<span class="input-group-text"><i class="bi bi-globe"></i></span>
|
||||
<input type="text" class="w-75 form-control @error('mailer_address') is-invalid @enderror" id="mailer_address" placeholder="FQDN" name="mailer_address" value="{{ old('mailer_address',$o->mailer_address) }}" @cannot('admin',$o)disabled @endcannot>
|
||||
<input type="text" class="form-control @error('mailer_port') is-invalid @enderror" id="mailer_port" placeholder="Port" name="mailer_port" value="{{ old('mailer_port',$o->mailer_port) }}" @cannot('admin',$o)disabled @endcannot>
|
||||
<span class="invalid-feedback" role="alert">
|
||||
@error('mailer_address')
|
||||
{{ $message }}
|
||||
@enderror
|
||||
@error('mailer_port')
|
||||
{{ $message }}
|
||||
@enderror
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="pt-0 row">
|
||||
<div class="col-4">
|
||||
<label for="phone" class="form-label">Phone</label>
|
||||
<div class="input-group has-validation">
|
||||
<span class="input-group-text"><i class="bi bi-telephone-fill"></i></span>
|
||||
<input type="text" class="form-control @error('phone') is-invalid @enderror" id="phone" placeholder="Phone" name="phone" value="{{ old('phone',$o->phone) }}" @cannot('admin',$o)disabled @endcannot>
|
||||
<span class="invalid-feedback" role="alert">
|
||||
@error('phone')
|
||||
{{ $message }}
|
||||
@enderror
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<!-- BBS Details -->
|
||||
<div class="col-12">
|
||||
<h4>BBS Details</h4>
|
||||
|
||||
<div class="pt-0 row">
|
||||
<div class="col-4">
|
||||
<label for="method" class="form-label">Connection Method</label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text"><i class="bi bi-wifi"></i></span>
|
||||
<select class="form-select @error('method') is-invalid @enderror" id="method" name="method" @cannot('admin',$o)disabled @endcannot>
|
||||
<option></option>
|
||||
<option value="23" @if(old('method',$o->method) == 23)selected @endif}}>Telnet</option>
|
||||
<option value="22" @if(old('method',$o->method) == 22)selected @endif}}>SSH</option>
|
||||
<option value="519" @if(old('method',$o->method) == 519)selected @endif}}>Rlogin</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-8">
|
||||
<label for="address" class="form-label">Address</label>
|
||||
<div class="input-group has-validation">
|
||||
<span class="input-group-text"><i class="bi bi-globe"></i></span>
|
||||
<input type="text" class="w-75 form-control @error('address') is-invalid @enderror" id="address" placeholder="FQDN" name="address" value="{{ old('address',$o->address) }}" @cannot('admin',$o)disabled @endcannot>
|
||||
<input type="text" class="form-control @error('port') is-invalid @enderror" id="port" placeholder="Port" name="port" value="{{ old('port',$o->port) }}" @cannot('admin',$o)disabled @endcannot>
|
||||
<span class="invalid-feedback" role="alert">
|
||||
@error('address')
|
||||
{{ $message }}
|
||||
@enderror
|
||||
@error('port')
|
||||
{{ $message }}
|
||||
@enderror
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<!-- Notes -->
|
||||
<div class="col-12">
|
||||
<label for="notes" class="form-label">Notes</label>
|
||||
<textarea class="form-control" rows=3 name="notes" placeholder="Notes..." @cannot('admin',$o)disabled @endcannot>{{ old('notes',$o->notes) }}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<a href="{{ url('ftn/system') }}" class="btn btn-danger">Cancel</a>
|
||||
@can('admin',$o)
|
||||
<button type="submit" name="submit" class="btn btn-success float-end">@if ($o->exists)Save @else Add @endif</button>
|
||||
@endcan
|
||||
</div>
|
||||
</div>
|
||||
@include('system.widget.form-system')
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -28,13 +28,13 @@
|
||||
</div>
|
||||
|
||||
<span class="col-6 mt-auto mx-auto text-center align-bottom">
|
||||
@if($errors->count())
|
||||
@if($errors->count())
|
||||
<span class="btn btn-sm btn-danger" role="alert">
|
||||
There were errors with the submission.
|
||||
@dump($errors)
|
||||
</span>
|
||||
There were errors with the submission.
|
||||
@dump($errors)
|
||||
</span>
|
||||
@endif
|
||||
</span>
|
||||
</span>
|
||||
|
||||
@can('admin',$o)
|
||||
<div class="col-2">
|
||||
|
206
resources/views/system/widget/form-system.blade.php
Normal file
206
resources/views/system/widget/form-system.blade.php
Normal file
@ -0,0 +1,206 @@
|
||||
@php
|
||||
use App\Models\Setup;
|
||||
@endphp
|
||||
|
||||
<div class="row">
|
||||
<!-- Name -->
|
||||
<div class="col-4">
|
||||
<label for="name" class="form-label">Name</label>
|
||||
<div class="input-group has-validation">
|
||||
<span class="input-group-text"><i class="bi bi-tag-fill"></i></span>
|
||||
<input type="text" class="form-control @error('name') is-invalid @enderror" id="name" placeholder="Name" name="name" value="{{ old('name',$o->name) }}" required @cannot('update',$o)disabled @endcannot autofocus>
|
||||
<span class="invalid-feedback" role="alert">
|
||||
@error('name')
|
||||
{{ $message }}
|
||||
@else
|
||||
A name is required.
|
||||
@enderror
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Active -->
|
||||
<div class="col-2">
|
||||
@if($o->exists)
|
||||
@can('admin',$o)
|
||||
<label for="active" class="form-label">Active</label>
|
||||
<div class="input-group">
|
||||
<div class="btn-group" role="group">
|
||||
<input type="radio" class="btn-check" name="active" id="active_yes" value="1" required @if(old('active',$o->active))checked @endif>
|
||||
<label class="btn btn-outline-success" for="active_yes">Yes</label>
|
||||
|
||||
<input type="radio" class="btn-check btn-danger" name="active" id="active_no" value="0" required @if(! old('active',$o->active))checked @endif>
|
||||
<label class="btn btn-outline-danger" for="active_no">No</label>
|
||||
</div>
|
||||
</div>
|
||||
@endcan
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<!-- ZeroTier ID -->
|
||||
<div class="offset-3 col-3">
|
||||
<label for="zt_id" class="form-label">ZeroTier ID</label>
|
||||
<div class="input-group has-validation">
|
||||
<span class="input-group-text"><i class="bi bi-shield-lock-fill"></i></span>
|
||||
<input type="text" class="form-control @error('zt_id') is-invalid @enderror" id="zt_id" placeholder="ZeroTier" name="zt_id" value="{{ old('zt_id',$o->zt_id) }}" @cannot('update',$o)disabled @endcannot>
|
||||
<span class="invalid-feedback" role="alert">
|
||||
@error('zt_id')
|
||||
{{ $message }}
|
||||
@enderror
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<!-- Sysop -->
|
||||
<div class="col-4">
|
||||
<label for="sysop" class="form-label">Sysop</label>
|
||||
<div class="input-group has-validation">
|
||||
<span class="input-group-text"><i class="bi bi-globe"></i></span>
|
||||
<input type="text" class="form-control @error('sysop') is-invalid @enderror" id="sysop" placeholder="Sysop" name="sysop" value="{{ old('sysop',$o->sysop) }}" required @cannot('admin',$o)disabled @endcannot autocomplete="name">
|
||||
<span class="invalid-feedback" role="alert">
|
||||
@error('sysop')
|
||||
{{ $message }}
|
||||
@else
|
||||
A Sysop's name is required.
|
||||
@enderror
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Location -->
|
||||
<div class="col-8">
|
||||
<label for="location" class="form-label">Location</label>
|
||||
<div class="input-group has-validation">
|
||||
<span class="input-group-text"><i class="bi bi-globe"></i></span>
|
||||
<input type="text" class="form-control @error('location') is-invalid @enderror" id="location" placeholder="Location" name="location" value="{{ old('location',$o->location) }}" required @cannot('update',$o)disabled @endcannot>
|
||||
<span class="invalid-feedback" role="alert">
|
||||
@error('location')
|
||||
{{ $message }}
|
||||
@else
|
||||
System location is required.
|
||||
@enderror
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<!-- Mailer Details -->
|
||||
<div class="col-12">
|
||||
<h4>Mailer Details</h4>
|
||||
|
||||
<div class="pt-0 row">
|
||||
<div class="col-4">
|
||||
<label for="method" class="form-label">Connection Method</label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text"><i class="bi bi-wifi"></i></span>
|
||||
<select class="form-select @error('method') is-invalid @enderror" id="mailer_type" name="mailer_type" @cannot('update',$o)disabled @endcannot>
|
||||
<option></option>
|
||||
<option value="{{ Setup::O_BINKP }}" @if(old('mailer_type',$o->mailer_type) == Setup::O_BINKP)selected @endif>BINKP</option>
|
||||
<option value="{{ Setup::O_EMSI }}" @if(old('mailer_type',$o->mailer_type) == Setup::O_EMSI)selected @endif>EMSI</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-8">
|
||||
<label for="address" class="form-label">Address</label>
|
||||
<div class="input-group has-validation">
|
||||
<span class="input-group-text"><i class="bi bi-globe"></i></span>
|
||||
<input type="text" class="w-75 form-control @error('mailer_address') is-invalid @enderror" id="mailer_address" placeholder="FQDN" name="mailer_address" value="{{ old('mailer_address',$o->mailer_address) }}" @cannot('update',$o)disabled @endcannot>
|
||||
<input type="text" class="form-control @error('mailer_port') is-invalid @enderror" id="mailer_port" placeholder="Port" name="mailer_port" value="{{ old('mailer_port',$o->mailer_port) }}" @cannot('update',$o)disabled @endcannot>
|
||||
<span class="invalid-feedback" role="alert">
|
||||
@error('mailer_address')
|
||||
{{ $message }}
|
||||
@enderror
|
||||
@error('mailer_port')
|
||||
{{ $message }}
|
||||
@enderror
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="pt-0 row">
|
||||
<div class="col-4">
|
||||
<label for="phone" class="form-label">Phone</label>
|
||||
<div class="input-group has-validation">
|
||||
<span class="input-group-text"><i class="bi bi-telephone-fill"></i></span>
|
||||
<input type="text" class="form-control @error('phone') is-invalid @enderror" id="phone" placeholder="Phone" name="phone" value="{{ old('phone',$o->phone) }}" @cannot('update',$o)disabled @endcannot>
|
||||
<span class="invalid-feedback" role="alert">
|
||||
@error('phone')
|
||||
{{ $message }}
|
||||
@enderror
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<!-- BBS Details -->
|
||||
<div class="col-12">
|
||||
<h4>BBS Details</h4>
|
||||
|
||||
<div class="pt-0 row">
|
||||
<div class="col-4">
|
||||
<label for="method" class="form-label">Connection Method</label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text"><i class="bi bi-wifi"></i></span>
|
||||
<select class="form-select @error('method') is-invalid @enderror" id="method" name="method" @cannot('update',$o)disabled @endcannot>
|
||||
<option></option>
|
||||
<option value="23" @if(old('method',$o->method) == 23)selected @endif>Telnet</option>
|
||||
<option value="22" @if(old('method',$o->method) == 22)selected @endif>SSH</option>
|
||||
<option value="519" @if(old('method',$o->method) == 519)selected @endif>Rlogin</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-8">
|
||||
<label for="address" class="form-label">Address</label>
|
||||
<div class="input-group has-validation">
|
||||
<span class="input-group-text"><i class="bi bi-globe"></i></span>
|
||||
<input type="text" class="w-75 form-control @error('address') is-invalid @enderror" id="address" placeholder="FQDN" name="address" value="{{ old('address',$o->address) }}" @cannot('update',$o)disabled @endcannot>
|
||||
<input type="text" class="form-control @error('port') is-invalid @enderror" id="port" placeholder="Port" name="port" value="{{ old('port',$o->port) }}" @cannot('update',$o)disabled @endcannot>
|
||||
<span class="invalid-feedback" role="alert">
|
||||
@error('address')
|
||||
{{ $message }}
|
||||
@enderror
|
||||
@error('port')
|
||||
{{ $message }}
|
||||
@enderror
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@can('admin',$o)
|
||||
<div class="row">
|
||||
<!-- Notes -->
|
||||
<div class="col-12">
|
||||
<label for="notes" class="form-label">Notes</label>
|
||||
<textarea class="form-control" rows=3 name="notes" placeholder="Notes...">{{ old('notes',$o->notes) }}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
@endcan
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
@if($o->exists)
|
||||
@can('update',$o)
|
||||
<a href="{{ url('ftn/system') }}" class="btn btn-danger">Cancel</a>
|
||||
<button type="submit" name="submit" class="btn btn-success float-end">@if ($o->exists)Save @else Add @endif</button>
|
||||
@else
|
||||
<input type="hidden" name="system_id" value="{{ $o->id }}">
|
||||
<span><small><strong>NOTE:</strong> You'll be able to update these details after registration is completed.</small></span>
|
||||
<button type="submit" class="btn btn-success float-end" name="submit" value="register">Register</button>
|
||||
@endcan
|
||||
@else
|
||||
<button type="submit" class="btn btn-success float-end" name="submit" value="register">Register</button>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
185
resources/views/user/system/register.blade.php
Normal file
185
resources/views/user/system/register.blade.php
Normal file
@ -0,0 +1,185 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('htmlheader_title')
|
||||
Register System
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
<form class="row g-0 needs-validation" method="post" autocomplete="off" novalidate>
|
||||
@csrf
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="greyframe titledbox shadow0xb0">
|
||||
<h2 class="cap">Register System</h2>
|
||||
|
||||
<div id="register">
|
||||
<div class="row">
|
||||
<div class="col-4">
|
||||
<label for="system" class="form-label">BBS Name</label>
|
||||
<div class="input-group has-validation">
|
||||
<span class="input-group-text"><i class="bi bi-pc"></i></span>
|
||||
<input type="text" style="z-index: 0" class="form-control col-11 @error('zone_id') is-invalid @enderror" id="system" placeholder="BBS Name" name="system" value="{{ old('system') }}" required autofocus>
|
||||
<span id="search-icon" style="width: 0;"><i style="border-radius: 50%;" class="spinner-border spinner-border-sm text-dark d-none"></i></span>
|
||||
<div id="system_search_results"></div>
|
||||
<span class="invalid-feedback" role="alert">
|
||||
@error('zone_id')
|
||||
{{ $message }}
|
||||
@else
|
||||
BBS Name is required.
|
||||
@enderror
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12 pb-2">
|
||||
<button type="button" name="submit" class="btn btn-success">Next</button><span id="next" class="m-2"><i class="spinner-border spinner-border-sm text-light d-none"></i></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
@endsection
|
||||
|
||||
@section('page-css')
|
||||
<style>
|
||||
input#system + span {
|
||||
left: -1.5em;
|
||||
top: 0.5em;
|
||||
position:relative
|
||||
}
|
||||
div#system_search_results ul {
|
||||
color:#eeeeee;
|
||||
background-color:#292929;
|
||||
font-size: .85rem;
|
||||
padding: 0 5px 0 5px;
|
||||
z-index: 99;
|
||||
top: -0.5em;
|
||||
left: 31em !important;
|
||||
}
|
||||
div#system_search_results ul li.dropdown-header {
|
||||
display: block;
|
||||
color: #fff !important;
|
||||
}
|
||||
div#system_search_results ul li,
|
||||
div#system_search_results ul li a {
|
||||
display: block;
|
||||
color: #aaa !important;
|
||||
margin: 0 !important;
|
||||
border: 0 !important;
|
||||
width: inherit;
|
||||
text-indent: 0 !important;
|
||||
padding-left: 0 !important;
|
||||
}
|
||||
div#system_search_results ul li:hover {
|
||||
padding-left: 0;
|
||||
text-indent: 0;
|
||||
}
|
||||
div#system_search_results ul li:before {
|
||||
content:""!important
|
||||
}
|
||||
</style>
|
||||
@append
|
||||
@section('page-scripts')
|
||||
<script>
|
||||
var system_id;
|
||||
|
||||
$(document).ready(function() {
|
||||
$('input[id=system]').typeahead({
|
||||
autoSelect: false,
|
||||
scrollHeight: 10,
|
||||
theme: 'bootstrap5',
|
||||
delay: 500,
|
||||
minLength: 2,
|
||||
items: {{ $search_limit ?? 5 }},
|
||||
fitToElement: false,
|
||||
selectOnBlur: false,
|
||||
appendTo: "#system_search_results",
|
||||
source: function (query,process) {
|
||||
systemsearch('{{ url('api/systems/orphan') }}',query,process);
|
||||
},
|
||||
|
||||
matcher: function () { return true; },
|
||||
|
||||
// Disable sorting and just return the items (items should by the ajax method)
|
||||
sorter: function(items) {
|
||||
return items;
|
||||
},
|
||||
|
||||
updater: function (item) {
|
||||
system_id = item.id;
|
||||
return item.name;
|
||||
},
|
||||
})
|
||||
.on('keyup keypress', function(event) {
|
||||
var key = event.keyCode || event.which;
|
||||
if (key === 13) {
|
||||
event.preventDefault();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
$('button[name=submit]').on('click',function() {
|
||||
icon = $(this).parent().find('i');
|
||||
|
||||
if (! $('#system').val())
|
||||
return;
|
||||
|
||||
$.ajax({
|
||||
url : '{{ url('user/system/register') }}',
|
||||
type : 'POST',
|
||||
data : { system_id: system_id,system_name: $('#system').val() },
|
||||
dataType : 'html',
|
||||
async : true,
|
||||
cache : false,
|
||||
beforeSend : function() {
|
||||
icon.removeClass('d-none');
|
||||
},
|
||||
success : function(data) {
|
||||
// if json is null, means no match, won't do again.
|
||||
if(data==null || (data.length===0)) return;
|
||||
|
||||
$('#register').empty().append(data);
|
||||
},
|
||||
complete : function() {
|
||||
//icon.addClass('d-none');
|
||||
}
|
||||
})
|
||||
})
|
||||
});
|
||||
|
||||
var c=0;
|
||||
var systemsearch = _.debounce(function(url,query,process,icon){
|
||||
icon = $('#search-icon').find('i');
|
||||
|
||||
$.ajax({
|
||||
url : url,
|
||||
type : 'GET',
|
||||
data : 'term=' + query,
|
||||
dataType : 'JSON',
|
||||
async : true,
|
||||
cache : false,
|
||||
beforeSend : function() {
|
||||
if (c++ == 0) {
|
||||
icon.removeClass('d-none');
|
||||
}
|
||||
},
|
||||
success : function(data) {
|
||||
// if json is null, means no match, won't do again.
|
||||
if(data==null || (data.length===0)) return;
|
||||
|
||||
process(data);
|
||||
},
|
||||
complete : function() {
|
||||
if (--c == 0) {
|
||||
icon.addClass('d-none');
|
||||
}
|
||||
}
|
||||
})
|
||||
}, 500);
|
||||
</script>
|
||||
@append
|
@ -146,10 +146,10 @@
|
||||
<input type="text" class="form-control @error('zt_ipv6_mask') is-invalid @enderror" id="zt_ipv6_mask" placeholder="112" name="zt_ipv6_mask" value="{{ old('zt_ipv6_mask',$o->zt_ipv6_mask) }}" @cannot('admin',$o)disabled @endcannot>
|
||||
<span class="invalid-feedback" role="alert">
|
||||
@error('zt_ipv6')
|
||||
{{ $message }}
|
||||
{{ $message }}
|
||||
@enderror
|
||||
@error('zt_ipv6_mask')
|
||||
{{ $message }}
|
||||
{{ $message }}
|
||||
@enderror
|
||||
</span>
|
||||
</div>
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
use App\Http\Controllers\{DomainController,ZoneController};
|
||||
use App\Http\Controllers\{DomainController,SystemController,ZoneController};
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
@ -18,6 +18,7 @@ use App\Http\Controllers\{DomainController,ZoneController};
|
||||
Route::middleware(['auth:api'])->group(function () {
|
||||
Route::get('regions/{o}',[DomainController::class,'api_regions']);
|
||||
Route::get('hosts/{o}/{region}',[DomainController::class,'api_hosts']);
|
||||
Route::get('systems/orphan',[SystemController::class,'api_orphan']);
|
||||
Route::get('hubs/{o}/{host}',[DomainController::class,'api_hubs']);
|
||||
Route::post('default/{o}',[ZoneController::class,'api_default']);
|
||||
});
|
||||
|
@ -81,6 +81,9 @@ Route::middleware(['verified','activeuser'])->group(function () {
|
||||
Route::get('ftn/zone',[ZoneController::class,'home']);
|
||||
Route::match(['get','post'],'ftn/zone/addedit/{o?}',[ZoneController::class,'add_edit'])
|
||||
->where('o','[0-9]+');
|
||||
|
||||
Route::get('user/system/register',[UserController::class,'register']);
|
||||
Route::post('user/system/register',[SystemController::class,'system_register']);
|
||||
});
|
||||
|
||||
Route::get('network/{o}',[HomeController::class,'network']);
|
||||
|
Loading…
Reference in New Issue
Block a user