diff --git a/app/Models/ProjectProposal.php b/app/Models/ProjectProposal.php index 7ff5921..e4a468a 100644 --- a/app/Models/ProjectProposal.php +++ b/app/Models/ProjectProposal.php @@ -64,7 +64,7 @@ class ProjectProposal extends Model implements HasMedia $this ->addMediaCollection('main') ->singleFile() - ->useFallbackUrl(asset('img/einundzwanzig.png')); + ->useFallbackUrl(asset('einundzwanzig-alpha.jpg')); } public function einundzwanzigPleb(): BelongsTo diff --git a/resources/views/components/input/simple-mde.blade.php b/resources/views/components/input/simple-mde.blade.php index 7a26046..7af96d5 100644 --- a/resources/views/components/input/simple-mde.blade.php +++ b/resources/views/components/input/simple-mde.blade.php @@ -1,55 +1,43 @@ -@props(['model']) -
fn() => $projectProposal, + 'image', + 'isAllowed' => false, + 'currentPubkey' => null, + 'currentPleb' => null, ]); +mount(function ($projectProposal) { + $this->form->fill($projectProposal->toArray()); + $this->image = $projectProposal->getFirstMedia('main'); +}); + +usesFileUploads(); + +on([ + 'nostrLoggedIn' => function ($pubkey) { + $this->currentPubkey = $pubkey; + $this->currentPleb = \App\Models\EinundzwanzigPleb::query()->where('pubkey', $pubkey)->first(); + if ($this->currentPleb->association_status->value < 3) { + return $this->js('alert("Du bist hierzu nicht berechtigt.")'); + } + $this->isAllowed = true; + }, + 'nostrLoggedOut' => function () { + $this->isAllowed = false; + $this->currentPubkey = null; + $this->currentPleb = null; + }, +]); + +$save = function () { + $this->form->validate(); + + $this->projectProposal->update([ + ...$this->form->except('id', 'slug'), + 'einundzwanzig_pleb_id' => $this->currentPleb->id, + ]); + + return redirect()->route('association.projectSupport'); +}; + ?> - + @volt -
- @dd($projectProposal) +
+
+
+
+ + +
+ @if ($image && str($image->getMimeType())->contains(['image/jpeg','image/jpg', 'image/png', 'image/gif', 'image/svg+xml', 'image/webp'])) +
{{ __('Preview') }}:
+ + @endif + @if (isset($projectProposal) && $projectProposal->getFirstMediaUrl('main')) +
{{ __('Current picture') }}:
+ + @endif +
+ + @error('image') {{ $message }} @enderror +
+ + + + + + + + + + + + + + + +
+ {{ __('Beschreibung') }} +
+
{{ __('Bitte verfasse einen ausführlichen und verständlichen Antragstext, damit die Abstimmung über eine mögliche Förderung erfolgen kann.') }}
+
+
{{ __('Für Bilder in Markdown verwende bitte z.B. Imgur oder einen anderen Anbieter.') }}
+ + @error('form.description') {{ $message }} @enderror +
+ + + + + {{ __('Zurück') }} + + + + {{ __('Speichern') }} + + +
+
+
@endvolt diff --git a/resources/views/pages/association/project-support/form/create.blade.php b/resources/views/pages/association/project-support/form/create.blade.php index 34e32e0..aa8064a 100644 --- a/resources/views/pages/association/project-support/form/create.blade.php +++ b/resources/views/pages/association/project-support/form/create.blade.php @@ -55,7 +55,7 @@ $save = function () { ?> - + @volt
@@ -109,6 +109,10 @@ $save = function () { + + + {{ __('Zurück') }} + {{ __('Save') }} diff --git a/resources/views/pages/association/project-support/index.blade.php b/resources/views/pages/association/project-support/index.blade.php index 8ce2c34..2d38612 100644 --- a/resources/views/pages/association/project-support/index.blade.php +++ b/resources/views/pages/association/project-support/index.blade.php @@ -7,6 +7,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; use function Laravel\Folio\{middleware}; use function Laravel\Folio\name; @@ -44,11 +45,35 @@ on([ }, ]); +$confirmDelete = function ($id) { + $notification = new Notification($this); + $notification->confirm([ + 'title' => 'Projektunterstützung löschen', + 'message' => 'Bist du sicher, dass du diese Projektunterstützung löschen möchtest?', + 'accept' => [ + 'label' => 'Ja, löschen', + 'method' => 'delete', + 'params' => $id, + ], + ]); +}; + +$delete = function ($id) { + \App\Models\ProjectProposal::query()->findOrFail($id)->delete(); + $this->projects = \App\Models\ProjectProposal::query() + ->with([ + 'einundzwanzigPleb.profile', + 'votes', + ]) + ->get(); +}; + ?> @volt -
+
@@ -149,6 +174,17 @@ on([
@endif
+
+ @if($currentPleb && $currentPleb->id === $project->einundzwanzig_pleb_id) + + + @endif +
@endforeach