Enabled address undelete and purge, now showing systems deleted messages
This commit is contained in:
parent
739955d374
commit
5957a25044
@ -517,6 +517,46 @@ class SystemController extends Controller
|
||||
return redirect()->to(sprintf('ftn/system/addedit/%d',$o->system_id));
|
||||
}
|
||||
|
||||
/**
|
||||
* Recover a deleted address
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
*/
|
||||
public function rec_address(int $id)
|
||||
{
|
||||
$o = Address::onlyTrashed()->findOrFail($id);
|
||||
|
||||
// @todo This should be admin of the zone
|
||||
$this->authorize('admin',$o);
|
||||
session()->flash('accordion','address');
|
||||
|
||||
$o->restore();
|
||||
|
||||
return redirect()->to(sprintf('ftn/system/addedit/%d',$o->system_id));
|
||||
}
|
||||
|
||||
/**
|
||||
* Recover a deleted address
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
*/
|
||||
public function pur_address(int $id)
|
||||
{
|
||||
$o = Address::onlyTrashed()->findOrFail($id);
|
||||
|
||||
// @todo This should be admin of the zone
|
||||
$this->authorize('admin',$o);
|
||||
session()->flash('accordion','address');
|
||||
|
||||
$o->forceDelete();
|
||||
|
||||
return redirect()->to(sprintf('ftn/system/addedit/%d',$o->system_id));
|
||||
}
|
||||
|
||||
/**
|
||||
* register system
|
||||
*/
|
||||
|
@ -35,6 +35,7 @@ class System extends Model
|
||||
public function addresses()
|
||||
{
|
||||
return $this->hasMany(Address::class)
|
||||
->withTrashed()
|
||||
->FTNorder();
|
||||
}
|
||||
|
||||
|
5
public/css/fixes.css
vendored
5
public/css/fixes.css
vendored
@ -58,3 +58,8 @@ ol {
|
||||
#content ul:not(.pagination) li p {
|
||||
margin-left: -1ch;
|
||||
}
|
||||
|
||||
.trashed {
|
||||
text-decoration: line-through;
|
||||
color: #3f6982;
|
||||
}
|
@ -107,19 +107,24 @@
|
||||
<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>{{ $oo->ftn }}</td>
|
||||
<td @if($oo->trashed()) class="trashed" @endif>{{ $oo->ftn }}</td>
|
||||
<td>{{ $oo->active ? 'YES' : 'NO' }}</td>
|
||||
<td>{{ $oo->role_name }}</td>
|
||||
<td class="nowrap actions">
|
||||
@can('admin',$oo)
|
||||
<a href="{{ url('ftn/system/susaddress',[$oo->id]) }}" title="@if($oo->active)Pause @else Activate @endif Address"><i class="bi @if($oo->active)bi-pause-circle-fill @else bi-play-circle-fill @endif"></i></a>
|
||||
{{--
|
||||
@if (! $oo->role & (Address::NODE_ZC|Address::NODE_RC|Address::NODE_NC))
|
||||
<a href="{{ url('ftn/system/modaddress',[$oo->id]) }}" title="Modify Address" class="modify"><i class="bi bi-pen-fill"></i></a>
|
||||
@endif
|
||||
--}}
|
||||
<a href="{{ url('ftn/system/movaddress',[$o->id,$oo->id]) }}" title="Move Address to another System"><i class="bi bi-arrow-right-square-fill"></i></a>
|
||||
<a href="{{ url('ftn/system/deladdress',[$oo->id]) }}" title="Delete Address" class="delete"><i class="bi bi-trash-fill"></i></a>
|
||||
@if($oo->trashed())
|
||||
<a href="{{ url('ftn/system/recaddress',[$oo->id]) }}" title="Restore Address"><i class="bi bi-bandaid-fill"></i></a>
|
||||
<a href="{{ url('ftn/system/puraddress',[$oo->id]) }}" title="Purge Address" class="purge"><i class="bi bi-scissors"></i></a>
|
||||
@else
|
||||
<a href="{{ url('ftn/system/susaddress',[$oo->id]) }}" title="@if($oo->active)Pause @else Activate @endif Address"><i class="bi @if($oo->active)bi-pause-circle-fill @else bi-play-circle-fill @endif"></i></a>
|
||||
<a href="{{ url('ftn/system/movaddress',[$o->id,$oo->id]) }}" title="Move Address to another System"><i class="bi bi-arrow-right-square-fill"></i></a>
|
||||
<a href="{{ url('ftn/system/deladdress',[$oo->id]) }}" title="Delete Address"><i class="bi bi-trash-fill"></i></a>
|
||||
@endif
|
||||
@endcan
|
||||
</td>
|
||||
</tr>
|
||||
@ -183,7 +188,7 @@
|
||||
{{--
|
||||
<a href="{{ url('ftn/system/modsession',[$oo->id]) }}" title="Modify Details" class="modify"><i class="bi bi-pen-fill"></i></a>
|
||||
--}}
|
||||
<a href="{{ url('ftn/system/delsession',[$o->id,$oo->id]) }}" title="Delete Details" class="delete"><i class="bi bi-trash-fill"></i></a>
|
||||
<a href="{{ url('ftn/system/delsession',[$o->id,$oo->id]) }}" title="Delete Details" class="purge"><i class="bi bi-trash-fill"></i></a>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
@ -380,7 +385,7 @@
|
||||
@endif
|
||||
</div>
|
||||
|
||||
@include('widgets.modal_delete')
|
||||
@include('widgets.modal_purge')
|
||||
@endsection
|
||||
|
||||
@section('page-scripts')
|
||||
|
@ -1,16 +1,16 @@
|
||||
<div class="modal fade" id="confirm-delete" tabindex="-1">
|
||||
<div class="modal fade" id="confirm-purge" tabindex="-1">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header bg-danger">
|
||||
<h5 class="modal-title">WARNING: Deleting record</h5>
|
||||
<h5 class="modal-title">WARNING: Purging record</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p>This action is irreversible. Are you sure, your sure, that you want to delete it?</p>
|
||||
<p>This action is irreversible. Are you sure, your sure, that you want to purge it?</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
|
||||
<a type="button" class="btn btn-danger btn-ok">Delete</a>
|
||||
<a type="button" class="btn btn-danger btn-ok">Purge</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -18,12 +18,12 @@
|
||||
|
||||
@section('page-scripts')
|
||||
<script>
|
||||
var confirmdelete = new bootstrap.Modal(document.getElementById('confirm-delete'), {});
|
||||
var confirmpurge = new bootstrap.Modal(document.getElementById('confirm-purge'), {});
|
||||
|
||||
$(document).ready(function() {
|
||||
$('.delete').click(function(e) {
|
||||
confirmdelete.show();
|
||||
$('#confirm-delete').find('.btn-ok').attr('href',e.currentTarget.href);
|
||||
$('.purge').click(function(e) {
|
||||
confirmpurge.show();
|
||||
$('#confirm-purge').find('.btn-ok').attr('href',e.currentTarget.href);
|
||||
return false;
|
||||
});
|
||||
});
|
@ -78,6 +78,10 @@ Route::middleware(['auth','verified','activeuser'])->group(function () {
|
||||
Route::match(['get','post'],'ftn/system/movaddress/{so}/{o}',[SystemController::class,'mov_address'])
|
||||
->where('so','[0-9]+')
|
||||
->where('o','[0-9]+');
|
||||
Route::get('ftn/system/recaddress/{id}',[SystemController::class,'rec_address'])
|
||||
->where('o','[0-9]+');
|
||||
Route::get('ftn/system/puraddress/{id}',[SystemController::class,'pur_address'])
|
||||
->where('o','[0-9]+');
|
||||
Route::get('ftn/system/susaddress/{o}',[SystemController::class,'sus_address'])
|
||||
->where('o','[0-9]+');
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user