-
- Formular
-
-
-
+
+
+
+
+
+ Formular
+
Name
-
-
- Beschreibung
-
-
+ Website
+
+
+
+ Unterstützung (Sats)
+
+
+
+
+
+
+ @if($isAdmin)
+
+
Admin Felder
+
+
+ Akzeptiert
+
+
+
+ Sats bezahlt
+
+
+
+ @endif
+
+
+ Speichern
+
-
- Speichern
-
-
-
+
+
-
-
-
-
- Information
-
-
+
+
+
+ Information
+
Fülle das Formular aus, um eine neue Projektförderung anzulegen.
-
+
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 24a7119..0034bd3 100644
--- a/resources/views/livewire/association/project-support/form/edit.blade.php
+++ b/resources/views/livewire/association/project-support/form/edit.blade.php
@@ -9,16 +9,23 @@ use Livewire\Component;
new
#[Layout('layouts.app')]
#[Title('Projektförderung bearbeiten')]
-class extends Component {
+class extends Component
+{
public ProjectProposal $project;
public array $form = [
'name' => '',
'description' => '',
+ 'support_in_sats' => '',
+ 'website' => '',
+ 'accepted' => false,
+ 'sats_paid' => 0,
];
public bool $isAllowed = false;
+ public bool $isAdmin = false;
+
public function mount($projectProposal): void
{
$this->project = ProjectProposal::query()->where('slug', $projectProposal)->firstOrFail();
@@ -38,8 +45,16 @@ class extends Component {
$this->form = [
'name' => $this->project->name,
'description' => $this->project->description,
+ 'support_in_sats' => (string) $this->project->support_in_sats,
+ 'website' => $this->project->website ?? '',
+ 'accepted' => (bool) $this->project->accepted,
+ 'sats_paid' => $this->project->sats_paid,
];
}
+
+ if ($currentPleb && in_array($currentPleb->npub, config('einundzwanzig.config.current_board'), true)) {
+ $this->isAdmin = true;
+ }
}
}
@@ -48,11 +63,17 @@ class extends Component {
$this->validate([
'form.name' => 'required|string|max:255',
'form.description' => 'required|string',
+ 'form.support_in_sats' => 'required|integer|min:0',
+ 'form.website' => 'required|url|max:255',
]);
$this->project->update([
'name' => $this->form['name'],
'description' => $this->form['description'],
+ 'support_in_sats' => (int) $this->form['support_in_sats'],
+ 'website' => $this->form['website'],
+ 'accepted' => $this->isAdmin ? (bool) $this->form['accepted'] : $this->project->accepted,
+ 'sats_paid' => $this->isAdmin ? $this->form['sats_paid'] : $this->project->sats_paid,
]);
$this->redirectRoute('association.projectSupport.item', $this->project);
@@ -72,47 +93,70 @@ class extends Component {