From 3fb0b1d5b81a523206285ab954b7334df7b45fd1 Mon Sep 17 00:00:00 2001 From: fsociety Date: Fri, 25 Oct 2024 15:15:07 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=86=95=20feat(news):=20add=20delete=20con?= =?UTF-8?q?firmation=20for=20news=20posts=20in=20the=20association=20news?= =?UTF-8?q?=20index=20page?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/association/news/index.blade.php | 35 +++++++++++++++++-- 1 file changed, 32 insertions(+), 3 deletions(-) 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 () {