Work on registration of existing systems to users
This commit is contained in:
@@ -13,7 +13,10 @@
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<p>This system is aware of the following systems @can('create',(new \App\Models\System))(you can <a href="{{ url('ftn/system/addedit') }}">add</a> more)@endcan:</p>
|
||||
<p>This system is aware of the following systems
|
||||
@can('create',(new \App\Models\System))(you can <a href="{{ url('user/system/register') }}">register</a> more):@endcan
|
||||
@can('admin',(new \App\Models\System))(you can <a href="{{ url('ftn/system/addedit') }}">add</a> more):@endcan
|
||||
</p>
|
||||
|
||||
@if (\App\Models\System::active()->count() == 0)
|
||||
@can('create',(new \App\Models\System))
|
||||
@@ -39,7 +42,7 @@
|
||||
<tbody>
|
||||
@foreach (\App\Models\System::active()->with(['addresses.zone.domain'])->get() as $oo)
|
||||
<tr>
|
||||
<td><a href="{{ url('ftn/system/addedit',[$oo->id]) }}">{{ $oo->id }}</a></td>
|
||||
<td><a href="{{ url('ftn/system/addedit',[$oo->id]) }}" @cannot('update',$oo)class="disabled" @endcannot>{{ $oo->id }}</a></td>
|
||||
<td>{{ $oo->name }} @if(! $oo->active)<span class="float-end"><small>[i]</small></span>@endif</td>
|
||||
<td>{{ $oo->sysop }}</td>
|
||||
<td>{{ $oo->location }}</td>
|
||||
@@ -72,7 +75,7 @@
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$('table tr').click(function() {
|
||||
var href = $(this).find('a').attr('href');
|
||||
var href = $(this).find('a:not(.disabled)').attr('href');
|
||||
|
||||
if (href)
|
||||
window.location = href;
|
||||
|
178
resources/views/user/link.blade.php
Normal file
178
resources/views/user/link.blade.php
Normal file
@@ -0,0 +1,178 @@
|
||||
@extends('layouts.app')
|
||||
@section('htmlheader_title')
|
||||
Link
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
<form class="row g-0 needs-validation" method="post" novalidate>
|
||||
@csrf
|
||||
|
||||
<input type="hidden" id="address_id" name="address_id">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="greyframe titledbox shadow0xb0">
|
||||
<h2 class="cap">Enter your Link code</h2>
|
||||
|
||||
<!-- ADDRESS -->
|
||||
<div class="row" style="z-index: 2;">
|
||||
<div class="col-4">
|
||||
<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="form-control @error('address_id') is-invalid @enderror" id="address" placeholder="Address" name="address" value="{{ old('address') }}" required autofocus autocomplete="off">
|
||||
<span id="search-icon" style="z-index: 4;width: 0;"><i style="border-radius: 50%;" class="spinner-border spinner-border-sm text-dark d-none"></i></span>
|
||||
<div id="address_search_results"></div>
|
||||
<span class="invalid-feedback" role="alert">
|
||||
@error('address_id')
|
||||
{{ $message }}
|
||||
@else
|
||||
A address is required.
|
||||
@enderror
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- CODE -->
|
||||
<div class="row">
|
||||
<div class="col-4">
|
||||
<label for="code" class="form-label">Code</label>
|
||||
<div class="input-group has-validation">
|
||||
<span class="input-group-text"><i class="bi bi-fingerprint"></i></span>
|
||||
<input type="text" class="form-control @error('code') is-invalid @enderror" id="code" placeholder="Code" name="code" value="{{ old('code') }}" required>
|
||||
<span class="invalid-feedback" role="alert">
|
||||
@error('code')
|
||||
{{ $message }}
|
||||
@else
|
||||
A code is required.
|
||||
@enderror
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<a href="{{ url('home') }}" class="btn btn-danger">Cancel</a>
|
||||
<button type="submit" name="submit" class="btn btn-success float-end">Validate</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
@endsection
|
||||
|
||||
@section('page-css')
|
||||
<style>
|
||||
input#address + span {
|
||||
left: -1.5em;
|
||||
top: 0.5em;
|
||||
position:relative
|
||||
}
|
||||
div#address_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#address_search_results ul li.dropdown-header {
|
||||
display: block;
|
||||
color: #fff !important;
|
||||
}
|
||||
div#address_search_results ul li,
|
||||
div#address_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#address_search_results ul li:hover {
|
||||
padding-left: 0;
|
||||
text-indent: 0;
|
||||
}
|
||||
div#address_search_results ul li:before {
|
||||
content:""!important
|
||||
}
|
||||
</style>
|
||||
@append
|
||||
@section('page-scripts')
|
||||
<script type="text/javascript">
|
||||
|
||||
var address_id;
|
||||
var addresssearch = _.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);
|
||||
|
||||
$(document).ready(function() {
|
||||
$('input[id=address]').typeahead({
|
||||
autoSelect: false,
|
||||
scrollHeight: 10,
|
||||
theme: 'bootstrap5',
|
||||
delay: 500,
|
||||
minLength: 3,
|
||||
items: {{ $search_limit ?? 5 }},
|
||||
fitToElement: false,
|
||||
selectOnBlur: false,
|
||||
appendTo: "#address_search_results",
|
||||
source: function (query,process) {
|
||||
addresssearch('{{ url('api/addresses/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) {
|
||||
console.log(item);
|
||||
$('#address_id').val(item.id);
|
||||
console.log($('#address_id'));
|
||||
return item.name;
|
||||
},
|
||||
})
|
||||
.on('keyup keypress', function(event) {
|
||||
var key = event.keyCode || event.which;
|
||||
if (key === 13) {
|
||||
event.preventDefault();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endsection
|
@@ -119,7 +119,7 @@
|
||||
$.ajax({
|
||||
url : '{{ url('user/system/register') }}',
|
||||
type : 'POST',
|
||||
data : { system_id: system_id,name: $('#name').val(),action: 'create',old: {!! json_encode(old()) !!} },
|
||||
data : { system_id: system_id,name: $('#name').val(),action: 'register',old: {!! json_encode(old()) !!} },
|
||||
dataType : 'json',
|
||||
async : true,
|
||||
cache : false,
|
||||
|
@@ -0,0 +1,13 @@
|
||||
<!-- $o = System::class -->
|
||||
<form class="row g-0 needs-validation" method="post" autocomplete="off" novalidate>
|
||||
@csrf
|
||||
|
||||
@if($validate->count())
|
||||
<p>OK, here's what we are going to do. I'm going to send you a routed netmail with a code - please follow the instructions
|
||||
in that netmail.</p>
|
||||
<p>Once the code is validated, this system will be assigned to you.</p>
|
||||
@else
|
||||
<p>I cant validate that <strong class="highlight">{{ $o->name }}</strong> is your system, we share now common zones.</p>
|
||||
<p>You might want to talk to an admin.</p>
|
||||
@endif
|
||||
</form>
|
Reference in New Issue
Block a user