2021-08-25 12:13:49 +00:00
|
|
|
@if(($x=\App\Models\Domain::active()
|
|
|
|
->select('domains.*')
|
|
|
|
->join('zones',['zones.domain_id'=>'domains.id'])
|
|
|
|
->whereIn('zone_id',$o->sessions->pluck('zone_id'))
|
|
|
|
->get())->count())
|
|
|
|
|
|
|
|
<form class="row g-0 needs-validation" method="post" action="{{ url('ftn/system/echoarea',$o->id) }}" novalidate>
|
|
|
|
@csrf
|
|
|
|
|
|
|
|
<div class="row pt-0">
|
|
|
|
<div class="col-12">
|
|
|
|
<div class="greyframe titledbox shadow0xb0">
|
|
|
|
<div class="row">
|
|
|
|
<!-- Select Domain -->
|
|
|
|
<div class="col-3">
|
2022-11-01 11:24:36 +00:00
|
|
|
<label for="echoarea_domain_id" class="form-label">Network</label>
|
2021-08-25 12:13:49 +00:00
|
|
|
<div class="input-group has-validation">
|
|
|
|
<span class="input-group-text"><i class="bi bi-hash"></i></span>
|
2022-11-01 11:24:36 +00:00
|
|
|
<select class="form-select @error('domain_id') is-invalid @enderror" id="echoarea_domain_id" name="domain_id" required>
|
2021-08-25 12:13:49 +00:00
|
|
|
<option></option>
|
|
|
|
@foreach($x as $do)
|
|
|
|
<option value="{{ $do->id }}" @if(old('domain_id') == $do->id)selected @endif>{{ $do->id }} <small>({{ $do->name }})</small></option>
|
|
|
|
@endforeach
|
|
|
|
</select>
|
|
|
|
<span class="invalid-feedback" role="alert">
|
|
|
|
@error('domain_id')
|
|
|
|
{{ $message }}
|
|
|
|
@enderror
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2022-01-04 13:34:33 +00:00
|
|
|
<!-- Select Address -->
|
|
|
|
<div class="col-3">
|
2022-11-01 11:24:36 +00:00
|
|
|
<div class="d-none" id="echoarea_address-select">
|
|
|
|
<label for="echoarea_address_id" class="form-label">Address</label>
|
2022-01-04 13:34:33 +00:00
|
|
|
<div class="input-group">
|
|
|
|
<span class="input-group-text"><i class="bi bi-hash"></i></span>
|
2022-11-01 11:24:36 +00:00
|
|
|
<select class="form-select" id="echoarea_address_id" name="address_id" required>
|
2022-01-04 13:34:33 +00:00
|
|
|
<option></option>
|
|
|
|
</select>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<!-- Summary of Addresses -->
|
|
|
|
<div class="offset-3 col-3" id="echoarea-summary">
|
2021-08-25 12:13:49 +00:00
|
|
|
<table class="table monotable">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>Network</th>
|
|
|
|
<th class="text-end">Areas</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
|
|
|
|
<tbody>
|
|
|
|
@foreach ($o->echoareas()->with(['domain'])->get()->groupBy('domain_id') as $oo)
|
|
|
|
<tr>
|
|
|
|
<td>{{ $oo->first()->domain->name }}</td>
|
|
|
|
<td class="text-end">{{ $oo->count() }}</td>
|
|
|
|
</tr>
|
|
|
|
@endforeach
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2022-11-20 00:47:46 +00:00
|
|
|
@if($errors->count())
|
|
|
|
<div class="row">
|
|
|
|
<span class="btn btn-sm btn-danger" role="alert" style="text-align: left;">
|
|
|
|
There were errors with the submission.
|
|
|
|
<ul>
|
|
|
|
@foreach ($errors->all() as $error)
|
|
|
|
<li>{{ $error }}</li>
|
|
|
|
@endforeach
|
|
|
|
</ul>
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
@endif
|
|
|
|
|
2021-08-25 12:13:49 +00:00
|
|
|
<div class="row">
|
|
|
|
<div class="col-12 d-none" id="echoarea-select"></div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
@endif
|
|
|
|
|
|
|
|
@section('page-scripts')
|
|
|
|
<script type="text/javascript" src="{{ asset('plugin/checkboxes/jquery.checkboxes-1.2.2.min.js') }}"></script>
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
$(document).ready(function() {
|
2022-11-01 11:24:36 +00:00
|
|
|
$('#echoarea_domain_id').on('change',function() {
|
2022-01-04 13:34:33 +00:00
|
|
|
if (! $(this).val()) {
|
|
|
|
$('#echoarea-summary').removeClass('d-none');
|
2022-11-01 11:24:36 +00:00
|
|
|
$('#echoarea_address-select').addClass('d-none');
|
2022-01-04 13:34:33 +00:00
|
|
|
return;
|
|
|
|
} else {
|
2022-11-01 11:24:36 +00:00
|
|
|
$('#echoarea_address-select').removeClass('d-none');
|
2022-01-04 13:34:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
var item = this;
|
|
|
|
icon = $(item).parent().find('i');
|
|
|
|
|
|
|
|
$.ajax({
|
|
|
|
type: 'POST',
|
|
|
|
data: {domain_id: $(item).val()},
|
|
|
|
beforeSend: function() {
|
|
|
|
icon.addClass('spinner-grow spinner-grow-sm');
|
|
|
|
},
|
|
|
|
success: function(data) {
|
|
|
|
icon.removeClass('spinner-grow spinner-grow-sm');
|
2022-11-01 11:24:36 +00:00
|
|
|
$('#echoarea_address_id')
|
2022-01-04 13:34:33 +00:00
|
|
|
.empty()
|
|
|
|
.append($('<option>'))
|
|
|
|
.append(data.map(function(item) {
|
|
|
|
return $('<option>').val(item.id).text(item.value);
|
|
|
|
}));
|
|
|
|
},
|
|
|
|
error: function(e) {
|
|
|
|
icon.removeClass('spinner-grow spinner-grow-sm');
|
|
|
|
|
|
|
|
if (e.status != 412)
|
|
|
|
alert('That didnt work? Please try again....');
|
|
|
|
},
|
|
|
|
url: '{{ url('api/system/address',[$o->id]) }}',
|
|
|
|
cache: false
|
|
|
|
})
|
|
|
|
});
|
|
|
|
|
2022-11-01 11:24:36 +00:00
|
|
|
$('#echoarea_address_id').on('change',function() {
|
2021-08-25 12:13:49 +00:00
|
|
|
if (! $(this).val()) {
|
|
|
|
$('#echoarea-summary').removeClass('d-none');
|
|
|
|
$('#echoarea-select').addClass('d-none');
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($('#echoarea-select').hasClass('d-none')) {
|
|
|
|
$('#echoarea-select').removeClass('d-none');
|
|
|
|
$('#echoarea-summary').addClass('d-none');
|
|
|
|
}
|
|
|
|
|
|
|
|
var item = this;
|
|
|
|
icon = $(item).parent().find('i');
|
|
|
|
|
|
|
|
$.ajax({
|
|
|
|
type: 'GET',
|
2022-01-04 13:34:33 +00:00
|
|
|
data: {address_id: $(item).val()},
|
2021-08-25 12:13:49 +00:00
|
|
|
beforeSend: function() {
|
|
|
|
icon.addClass('spinner-grow spinner-grow-sm');
|
|
|
|
},
|
|
|
|
success: function(data) {
|
|
|
|
icon.removeClass('spinner-grow spinner-grow-sm');
|
|
|
|
$('#echoarea-select').empty().append(data);
|
|
|
|
$('#echoareas').checkboxes('range',true);
|
|
|
|
},
|
|
|
|
error: function(e) {
|
|
|
|
icon.removeClass('spinner-grow spinner-grow-sm');
|
|
|
|
|
|
|
|
if (e.status != 412)
|
|
|
|
alert('That didnt work? Please try again....');
|
|
|
|
},
|
|
|
|
url: '{{ url('ftn/system/echoarea',[$o->id]) }}',
|
|
|
|
cache: false
|
|
|
|
})
|
|
|
|
});
|
2022-01-04 13:34:33 +00:00
|
|
|
});
|
2021-08-25 12:13:49 +00:00
|
|
|
</script>
|
|
|
|
@append
|