diff --git a/resources/views/pages/association/news/index.blade.php b/resources/views/pages/association/news/index.blade.php index f84ecc4..5be9d42 100644 --- a/resources/views/pages/association/news/index.blade.php +++ b/resources/views/pages/association/news/index.blade.php @@ -8,6 +8,7 @@ use swentel\nostr\Message\RequestMessage; use swentel\nostr\Relay\Relay; use swentel\nostr\Request\Request; use swentel\nostr\Subscription\Subscription; +use WireUi\Actions\Notification as WireNotification; use function Laravel\Folio\{middleware, name}; use function Livewire\Volt\{state, mount, on, computed, form, usesFileUploads}; @@ -65,6 +66,28 @@ $save = function () { ->addMedia($this->file->getRealPath()) ->toMediaCollection('pdf'); + $this->form->reset(); + $this->file = null; + + $this->news = \App\Models\Notification::query()->get(); +}; + +$delete = function($id) { + $notification = new WireNotification($this); + $notification->confirm([ + 'title' => 'Post löschen', + 'message' => 'Bist du sicher, dass du diesen Post löschen möchtest?', + 'accept' => [ + 'label' => 'Ja, löschen', + 'method' => 'deleteNow', + 'params' => $id, + ], + ]); +}; + +$deleteNow = function($id) { + $notification = \App\Models\Notification::query()->find($id); + $notification->delete(); $this->news = \App\Models\Notification::query()->get(); }; @@ -111,7 +134,7 @@ $save = function () {