diff --git a/resources/views/components/project-card.blade.php b/resources/views/components/project-card.blade.php
index b5475e9..6d47ff8 100644
--- a/resources/views/components/project-card.blade.php
+++ b/resources/views/components/project-card.blade.php
@@ -81,33 +81,31 @@
@endif
-
- @if(
- ($currentPleb && $currentPleb->id === $project->einundzwanzig_pleb_id)
- || ($currentPleb && in_array($currentPleb->npub, config('einundzwanzig.config.current_board'), true))
- )
-
-
- Löschen
-
-
-
- Editieren
-
- @endif
+
+ @if(
+ ($currentPleb && $currentPleb->id === $project->einundzwanzig_pleb_id)
+ || ($currentPleb && in_array($currentPleb->npub, config('einundzwanzig.config.current_board'), true))
+ )
+
+ Löschen
+
+
+
+ Editieren
+
+ @endif
@if(($currentPleb && $currentPleb->association_status->value > 2) || $project->accepted)
Öffnen
diff --git a/resources/views/livewire/association/project-support/form/edit.blade.php b/resources/views/livewire/association/project-support/form/edit.blade.php
index 25d26d1..24a7119 100644
--- a/resources/views/livewire/association/project-support/form/edit.blade.php
+++ b/resources/views/livewire/association/project-support/form/edit.blade.php
@@ -19,9 +19,9 @@ class extends Component {
public bool $isAllowed = false;
- public function mount(ProjectProposal $project): void
+ public function mount($projectProposal): void
{
- $this->project = $project;
+ $this->project = ProjectProposal::query()->where('slug', $projectProposal)->firstOrFail();
if (NostrAuth::check()) {
$currentPubkey = NostrAuth::pubkey();
@@ -30,14 +30,14 @@ class extends Component {
if (
(
$currentPleb
- && $currentPleb->id === $project->einundzwanzig_pleb_id
+ && $currentPleb->id === $this->project->einundzwanzig_pleb_id
)
|| in_array($currentPleb->npub, config('einundzwanzig.config.current_board'))
) {
$this->isAllowed = true;
$this->form = [
- 'name' => $project->name,
- 'description' => $project->description,
+ 'name' => $this->project->name,
+ 'description' => $this->project->description,
];
}
}
diff --git a/resources/views/livewire/association/project-support/index.blade.php b/resources/views/livewire/association/project-support/index.blade.php
index 8f2cd59..8297e94 100644
--- a/resources/views/livewire/association/project-support/index.blade.php
+++ b/resources/views/livewire/association/project-support/index.blade.php
@@ -22,9 +22,12 @@ new class extends Component {
public ?EinundzwanzigPleb $currentPleb = null;
+ public ?ProjectProposal $projectToDelete = null;
+
protected $listeners = [
'nostrLoggedIn' => 'handleNostrLoggedIn',
'nostrLoggedOut' => 'handleNostrLoggedOut',
+ 'confirmDeleteProject' => 'confirmDeleteProject',
];
public function mount(): void
@@ -76,9 +79,9 @@ new class extends Component {
$this->currentPleb = null;
}
- public function confirmDelete($id): void
+ public function confirmDeleteProject($id): void
{
- $this->confirmDeleteId = $id;
+ $this->projectToDelete = ProjectProposal::query()->findOrFail($id);
Flux::modal('delete-project')->show();
}
@@ -89,10 +92,13 @@ new class extends Component {
public function delete(): void
{
- ProjectProposal::query()->findOrFail($this->confirmDeleteId)->delete();
- Flux::toast('Projektunterstützung gelöscht.');
- $this->loadProjects();
- Flux::modals()->close();
+ if ($this->projectToDelete) {
+ $this->projectToDelete->delete();
+ Flux::toast('Projektunterstützung gelöscht.');
+ $this->loadProjects();
+ Flux::modals()->close();
+ $this->projectToDelete = null;
+ }
}
};
@@ -158,33 +164,33 @@ new class extends Component {
-
{{ $projects->count() }} Projekte
+
{{ $projects->count() }} Projekte
-
-
- @foreach($this->projects as $project)
-
- @endforeach
-
+
+
+ @foreach($this->projects as $project)
+
+ @endforeach
+
-
-
-
-
-
Projektunterstützung löschen
-
- Bist du sicher, dass du diese Projektunterstützung löschen möchtest?
- Diese Aktion kann nicht rückgängig gemacht werden.
-
-
-
-
-
- Abbrechen
-
- Ja, löschen
-
-
-
-
+
+