Enable setting autohold and address validation in web UI
This commit is contained in:
@@ -118,7 +118,7 @@
|
||||
<tbody>
|
||||
@foreach ($o->addresses->sortBy(function($item) { return sprintf('%04x%04x%04x%04x%04x',$item->zone->zone_id,$item->region_id,$item->host_id,$item->node_id,$item->point_id); }) as $oo)
|
||||
<tr>
|
||||
<td @if($oo->trashed()) class="trashed" @elseif (! $oo->active) class="inactive" @endif>{{ $oo->ftn }}<span class="float-end"><i title="@if($oo->validated)Mail flowing @else Mail held @endif" class="bi @if($oo->validated)bi-activity @else bi-radioactive @endif"></i></span></td>
|
||||
<td @if($oo->trashed()) class="trashed" @elseif (! $oo->active) class="inactive" @endif>{{ $oo->ftn }}<span class="float-end"><data value="{{ $oo->id }}:{{ $oo->validated ? 1 : 0 }}" class="validated"><i title="@if($oo->validated)Mail flowing @else Mail held @endif" @class(['bi','bi-activity'=>$oo->validated,'bi-radioactive'=>(! $oo->validated)])></i></data></span></td>
|
||||
<td>{{ $oo->active ? 'YES' : 'NO' }}</td>
|
||||
<td class="text-end">{{ $oo->security }}</td>
|
||||
<td>{{ $oo->role_name }}</td>
|
||||
@@ -693,6 +693,54 @@
|
||||
cache: false
|
||||
})
|
||||
});
|
||||
$('data.validated').on('click',function(item) {
|
||||
that = $(this);
|
||||
var values = item.delegateTarget.value.split(':');
|
||||
var icon = that.find('i');
|
||||
|
||||
if (values[1] === '1') {
|
||||
$.ajax({
|
||||
url: '/address/api/validated/off',
|
||||
type: 'POST',
|
||||
dataType: 'json',
|
||||
data : {id: values[0]},
|
||||
beforeSend: function() {
|
||||
that.addClass('spinner-grow spinner-grow-sm')
|
||||
},
|
||||
complete: function() {
|
||||
that.removeClass('spinner-grow spinner-grow-sm')
|
||||
},
|
||||
success: function(data) {
|
||||
icon.removeClass('bi-activity')
|
||||
.addClass('bi-radioactive');
|
||||
|
||||
that.attr('value',values[0]+':'+0);
|
||||
},
|
||||
cache: false
|
||||
});
|
||||
|
||||
} else {
|
||||
$.ajax({
|
||||
url: '/address/api/validated/on',
|
||||
type: 'POST',
|
||||
dataType: 'json',
|
||||
data : {id: values[0]},
|
||||
beforeSend: function() {
|
||||
that.addClass('spinner-grow spinner-grow-sm')
|
||||
},
|
||||
complete: function() {
|
||||
that.removeClass('spinner-grow spinner-grow-sm')
|
||||
},
|
||||
success: function(data) {
|
||||
icon.removeClass('bi-radioactive')
|
||||
.addClass('bi-activity');
|
||||
|
||||
that.attr('value',values[0]+':'+1);
|
||||
},
|
||||
cache: false
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@append
|
@@ -297,6 +297,11 @@
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-6">
|
||||
<label for="passkey" class="form-label">Auto Hold</label>
|
||||
<button id="autohold" @class(['btn','btn-danger'=>$o->autohold,'btn-success'=>(! $o->autohold)])><i @class(['bi-toggle-on'=>$o->autohold,'bi-toggle-off'=>(! $o->autohold)])></i></button>
|
||||
</div>
|
||||
</div>
|
||||
@endcan
|
||||
|
||||
@@ -440,6 +445,57 @@
|
||||
$('#heartbeat_option').addClass('d-none');
|
||||
console.log('hold');
|
||||
})
|
||||
$("#autohold").on('click',function(item) {
|
||||
var that = $(this)
|
||||
var icon = that.find('i');
|
||||
|
||||
if (icon.hasClass('bi-toggle-on')) {
|
||||
$.ajax({
|
||||
url: '/system/api/autohold/off',
|
||||
type: 'POST',
|
||||
dataType: 'json',
|
||||
data : {id: {{ $o->id }}},
|
||||
beforeSend: function() {
|
||||
icon.addClass('spinner-grow spinner-grow-sm')
|
||||
},
|
||||
complete: function() {
|
||||
icon.removeClass('spinner-grow spinner-grow-sm')
|
||||
},
|
||||
success: function(data) {
|
||||
icon.removeClass('bi-toggle-on')
|
||||
.addClass('bi-toggle-off')
|
||||
|
||||
that.removeClass('btn-danger')
|
||||
.addClass('btn-success')
|
||||
},
|
||||
cache: false
|
||||
});
|
||||
|
||||
} else {
|
||||
$.ajax({
|
||||
url: '/system/api/autohold/on',
|
||||
type: 'POST',
|
||||
dataType: 'json',
|
||||
data : {id: {{ $o->id }}},
|
||||
beforeSend: function() {
|
||||
icon.addClass('spinner-grow spinner-grow-sm')
|
||||
},
|
||||
complete: function() {
|
||||
icon.removeClass('spinner-grow spinner-grow-sm')
|
||||
},
|
||||
success: function(data) {
|
||||
icon.removeClass('bi-toggle-off')
|
||||
.addClass('bi-toggle-on');
|
||||
|
||||
that.removeClass('btn-success')
|
||||
.addClass('btn-danger')
|
||||
},
|
||||
cache: false
|
||||
});
|
||||
}
|
||||
|
||||
return false;
|
||||
})
|
||||
})
|
||||
</script>
|
||||
@append
|
Reference in New Issue
Block a user