157 lines
7.1 KiB
PHP
157 lines
7.1 KiB
PHP
<!-- $o=Zone::class-->
|
|
@use(App\Models\Domain)
|
|
@use(App\Models\System)
|
|
|
|
@extends('layouts.app')
|
|
|
|
@section('htmlheader_title')
|
|
@if($o->exists) Update @else Add @endif Zone
|
|
@endsection
|
|
|
|
@section('content')
|
|
<form class="needs-validation" method="post" autocomplete="off" novalidate>
|
|
@csrf
|
|
|
|
<div class="row">
|
|
<div class="col-12">
|
|
<div class="greyframe titledbox shadow0xb0">
|
|
<h2 class="cap">@if($o->exists) Update @else Add @endif Zone</h2>
|
|
|
|
<div class="row">
|
|
<div class="col-2">
|
|
<label for="zone" class="form-label">Zone</label>
|
|
<div class="input-group has-validation">
|
|
<span class="input-group-text"><i class="bi bi-hash"></i></span>
|
|
<input type="text" class="form-control @error('zone_id') is-invalid @enderror" id="zone" placeholder="Zone" name="zone_id" value="{{ old('zone_id',$o->zone_id) }}" required @cannot('admin',$o)disabled @endcannot autofocus>
|
|
<span class="invalid-feedback" role="alert">
|
|
@error('zone_id')
|
|
{{ $message }}
|
|
@else
|
|
A zone number is required.
|
|
@enderror
|
|
</span>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="col-3">
|
|
@php
|
|
$helper = (! $o->domain_id)
|
|
? sprintf('Add a <a href="%s">NEW Domain</a>',url('domain/addedit'))
|
|
: sprintf('<a href="%s">Edit</a> Domain',url('domain/addedit',[$o->domain_id]));
|
|
@endphp
|
|
<x-form.select name="domain_id" icon="bi-tag-fill" label="Domain" :helper="$helper" feedback="A domain is required" :value="$o->domain_id" :options="Domain::select(['id','name'])->active()->orderBy('name')->cursor()->map(fn($item)=>['id'=>$item->id,'value'=>$item->name])" required/>
|
|
</div>
|
|
|
|
<div class="offset-1 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>
|
|
|
|
<div class="col-2">
|
|
<label for="default" class="form-label">Default</label>
|
|
<div class="input-group has-validation">
|
|
<div class="btn-group @error('default') is-invalid @enderror" role="group">
|
|
<input type="radio" class="btn-check " name="default" id="default_yes" value="1" required @cannot('admin',$o)disabled @endcannot @if(old('default',$o->default))checked @endif>
|
|
<label class="btn btn-outline-success" for="default_yes">Yes</label>
|
|
|
|
<input type="radio" class="btn-check btn-danger" name="default" id="default_no" value="0" required @cannot('admin',$o)disabled @endcannot @if(! old('default',$o->default))checked @endif>
|
|
<label class="btn btn-outline-danger" for="default_no">No</label>
|
|
</div>
|
|
<span class="invalid-feedback" role="alert">
|
|
@error('default')
|
|
{{ $message }}
|
|
@enderror
|
|
</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row">
|
|
<div class="col-4">
|
|
@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-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>
|
|
</div>
|
|
|
|
<div class="row">
|
|
<div class="col-3">
|
|
<label for="zt_id" class="form-label">ZeroTier Network 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 class="col-4">
|
|
<label for="zt_ipv4" class="form-label">ZeroTier IPv4 Network</label>
|
|
<div class="input-group has-validation">
|
|
<span class="input-group-text"><i class="bi bi-share-fill"></i></span>
|
|
<input type="text" style="width: 55%;" class="form-control @error('zt_ipv4') is-invalid @enderror" id="zt_ipv4" placeholder="10.0.0.0" name="zt_ipv4" value="{{ old('zt_ipv4',$o->zt_ipv4) }}" @cannot('admin',$o)disabled @endcannot>
|
|
<span class="input-group-text">/</span>
|
|
<input type="text" class="form-control @error('zt_ipv4_mask') is-invalid @enderror" id="zt_ipv4_mask" placeholder="24" name="zt_ipv4_mask" value="{{ old('zt_ipv4_mask',$o->zt_ipv4_mask) }}" @cannot('admin',$o)disabled @endcannot>
|
|
<span class="invalid-feedback" role="alert">
|
|
@error('zt_ipv4')
|
|
{{ $message }}
|
|
@enderror
|
|
@error('zt_ipv4_mask')
|
|
{{ $message }}
|
|
@enderror
|
|
</span>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="col-5">
|
|
<label for="zt_ipv6" class="form-label">ZeroTier IPv6 Network</label>
|
|
<div class="input-group has-validation">
|
|
<span class="input-group-text"><i class="bi bi-broadcast-pin"></i></span>
|
|
<input type="text" style="width: 60%;" class="form-control @error('zt_ipv6') is-invalid @enderror" id="zt_ipv6" placeholder="fd00:f1d0:0000:0000:0000:0000:0000:0000" name="zt_ipv6" value="{{ old('zt_ipv6',$o->zt_ipv6) }}" @cannot('admin',$o)disabled @endcannot>
|
|
<span class="input-group-text">/</span>
|
|
<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 }}
|
|
@enderror
|
|
@error('zt_ipv6_mask')
|
|
{{ $message }}
|
|
@enderror
|
|
</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row">
|
|
<div class="col-12">
|
|
<x-form.notes name="notes" label="Notes" rows=3 placeholder="Notes..." :value="$o->notes" :disabled="Gate::denies('admin',$o)"/>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row">
|
|
<div class="col-12">
|
|
<a href="{{ url('zone') }}" 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>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
@endsection |