diff --git a/app/Http/Controllers/SystemController.php b/app/Http/Controllers/SystemController.php index 2ece69a..132b8a3 100644 --- a/app/Http/Controllers/SystemController.php +++ b/app/Http/Controllers/SystemController.php @@ -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 */ diff --git a/app/Models/System.php b/app/Models/System.php index f27d163..1d21cee 100644 --- a/app/Models/System.php +++ b/app/Models/System.php @@ -35,6 +35,7 @@ class System extends Model public function addresses() { return $this->hasMany(Address::class) + ->withTrashed() ->FTNorder(); } diff --git a/public/css/fixes.css b/public/css/fixes.css index 7bb1cca..544d054 100644 --- a/public/css/fixes.css +++ b/public/css/fixes.css @@ -57,4 +57,9 @@ ol { /* Fix markdown parser that renders
*/ #content ul:not(.pagination) li p { margin-left: -1ch; +} + +.trashed { + text-decoration: line-through; + color: #3f6982; } \ No newline at end of file diff --git a/resources/views/system/addedit.blade.php b/resources/views/system/addedit.blade.php index 5fdb39d..b603c5a 100644 --- a/resources/views/system/addedit.blade.php +++ b/resources/views/system/addedit.blade.php @@ -107,19 +107,24 @@
@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)