mirror of
https://github.com/HolgerHatGarKeineNode/einundzwanzig-nostr.git
synced 2026-01-25 04:13:17 +00:00
✨ Add reusable Blade components for inputs and layouts: FilePond, navigation groups, and notification buttons
This commit is contained in:
@@ -1,4 +1,53 @@
|
||||
<x-layouts.app title="{{ __('Projektförderung anlegen') }}">
|
||||
<?php
|
||||
|
||||
use App\Models\ProjectProposal;
|
||||
use App\Support\NostrAuth;
|
||||
use Livewire\Component;
|
||||
use Livewire\Attributes\Layout;
|
||||
use Livewire\Attributes\Title;
|
||||
|
||||
new
|
||||
#[Layout('layouts.app')]
|
||||
#[Title('Projektförderung anlegen')]
|
||||
class extends Component {
|
||||
public array $form = [
|
||||
'name' => '',
|
||||
'description' => '',
|
||||
];
|
||||
|
||||
public bool $isAllowed = false;
|
||||
|
||||
public function mount(): void
|
||||
{
|
||||
if (NostrAuth::check()) {
|
||||
$currentPubkey = NostrAuth::pubkey();
|
||||
$currentPleb = \App\Models\EinundzwanzigPleb::query()->where('pubkey', $currentPubkey)->first();
|
||||
|
||||
if ($currentPleb && $currentPleb->association_status->value > 1 && $currentPleb->paymentEvents()->where('year', date('Y'))->where('paid', true)->exists()) {
|
||||
$this->isAllowed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function save(): void
|
||||
{
|
||||
$this->validate([
|
||||
'form.name' => 'required|string|max:255',
|
||||
'form.description' => 'required|string',
|
||||
]);
|
||||
|
||||
ProjectProposal::query()->create([
|
||||
'name' => $this->form['name'],
|
||||
'description' => $this->form['description'],
|
||||
'einundzwanzig_pleb_id' => \App\Models\EinundzwanzigPleb::query()->where('pubkey', NostrAuth::pubkey())->first()->id,
|
||||
]);
|
||||
|
||||
$this->redirectRoute('association.projectSupport');
|
||||
}
|
||||
};
|
||||
?>
|
||||
|
||||
<x-layouts.app>
|
||||
<div>
|
||||
@if($isAllowed)
|
||||
<div class="px-4 sm:px-6 lg:px-8 py-8 w-full max-w-9xl mx-auto">
|
||||
|
||||
@@ -1,74 +1,128 @@
|
||||
<x-layouts.app title="{{ __('Projektförderung bearbeiten') }}">
|
||||
<div>
|
||||
@if($isAllowed)
|
||||
<div class="px-4 sm:px-6 lg:px-8 py-8 w-full max-w-9xl mx-auto">
|
||||
<div
|
||||
class="flex flex-col md:flex-row items-center mb-6 space-y-4 md:space-y-0 md:space-x-4">
|
||||
<div class="flex items-center justify-between w-full">
|
||||
<h1 class="text-2xl md:text-3xl text-gray-800 dark:text-gray-100 font-bold">
|
||||
Projektförderung bearbeiten
|
||||
</h1>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
<div class="md:flex">
|
||||
<!-- Left column -->
|
||||
<div class="w-full md:w-60 mb-4 md:mb-0">
|
||||
<div
|
||||
class="bg-white dark:bg-gray-800 shadow-sm rounded-xl p-5">
|
||||
<h2 class="text-lg font-semibold text-gray-800 dark:text-gray-100 mb-4">
|
||||
Formular
|
||||
</h2>
|
||||
<div class="space-y-4">
|
||||
<div wire:dirty>
|
||||
<x-input label="Name" wire:model="form.name"/>
|
||||
@error('form.name')
|
||||
<span class="text-red-500">{{ $message }}</span>
|
||||
@enderror
|
||||
</div>
|
||||
<div wire:dirty>
|
||||
<x-textarea label="Beschreibung" wire:model="form.description"/>
|
||||
@error('form.description')
|
||||
<span class="text-red-500">{{ $message }}</span>
|
||||
@enderror
|
||||
</div>
|
||||
<button
|
||||
wire:click="update"
|
||||
wire:loading.attr="disabled"
|
||||
class="w-full btn-sm bg-white dark:bg-gray-800 border-gray-200 dark:border-gray-700/60 hover:border-gray-300 dark:hover:border-gray-600 text-gray-800 dark:text-gray-300">
|
||||
Speichern
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
use App\Models\ProjectProposal;
|
||||
use App\Support\NostrAuth;
|
||||
use Livewire\Attributes\Layout;
|
||||
use Livewire\Attributes\Title;
|
||||
use Livewire\Component;
|
||||
|
||||
<!-- Right column -->
|
||||
<div class="flex-1 md:ml-8">
|
||||
<div
|
||||
class="bg-white dark:bg-gray-800 shadow-sm rounded-xl p-5">
|
||||
<h2 class="text-lg font-semibold text-gray-800 dark:text-gray-100 mb-4">
|
||||
Information
|
||||
</h2>
|
||||
<p class="text-sm text-gray-800 dark:text-gray-100">
|
||||
Bearbeite die Projektförderung und speichere deine Änderungen.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
new
|
||||
#[Layout('layouts.app')]
|
||||
#[Title('Projektförderung bearbeiten')]
|
||||
class extends Component {
|
||||
public ProjectProposal $project;
|
||||
|
||||
public array $form = [
|
||||
'name' => '',
|
||||
'description' => '',
|
||||
];
|
||||
|
||||
public bool $isAllowed = false;
|
||||
|
||||
public function mount(ProjectProposal $project): void
|
||||
{
|
||||
$this->project = $project;
|
||||
|
||||
if (NostrAuth::check()) {
|
||||
$currentPubkey = NostrAuth::pubkey();
|
||||
$currentPleb = \App\Models\EinundzwanzigPleb::query()->where('pubkey', $currentPubkey)->first();
|
||||
|
||||
if ($currentPleb && $currentPleb->id === $project->einundzwanzig_pleb_id) {
|
||||
$this->isAllowed = true;
|
||||
$this->form = [
|
||||
'name' => $project->name,
|
||||
'description' => $project->description,
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function update(): void
|
||||
{
|
||||
$this->validate([
|
||||
'form.name' => 'required|string|max:255',
|
||||
'form.description' => 'required|string',
|
||||
]);
|
||||
|
||||
$this->project->update([
|
||||
'name' => $this->form['name'],
|
||||
'description' => $this->form['description'],
|
||||
]);
|
||||
|
||||
$this->redirectRoute('association.projectSupport.item', $this->project);
|
||||
}
|
||||
};
|
||||
?>
|
||||
|
||||
<div>
|
||||
@if($isAllowed)
|
||||
<div class="px-4 sm:px-6 lg:px-8 py-8 w-full max-w-9xl mx-auto">
|
||||
<div
|
||||
class="flex flex-col md:flex-row items-center mb-6 space-y-4 md:space-y-0 md:space-x-4">
|
||||
<div class="flex items-center justify-between w-full">
|
||||
<h1 class="text-2xl md:text-3xl text-gray-800 dark:text-gray-100 font-bold">
|
||||
Projektförderung bearbeiten
|
||||
</h1>
|
||||
</div>
|
||||
</div>
|
||||
@else
|
||||
<div class="px-4 sm:px-6 lg:px-8 py-8 w-full max-w-9xl mx-auto">
|
||||
<div class="bg-white dark:bg-[#1B1B1B] shadow overflow-hidden sm:rounded-lg">
|
||||
<div class="px-4 py-5 sm:px-6">
|
||||
<h3 class="text-lg font-medium leading-6 text-gray-900 dark:text-gray-200">
|
||||
Projektförderung
|
||||
</h3>
|
||||
<p class="mt-1 max-w">
|
||||
Du bist nicht berechtigt, die Projektförderung zu bearbeiten.
|
||||
|
||||
<div class="md:flex">
|
||||
<!-- Left column -->
|
||||
<div class="w-full md:w-60 mb-4 md:mb-0">
|
||||
<div
|
||||
class="bg-white dark:bg-gray-800 shadow-sm rounded-xl p-5">
|
||||
<h2 class="text-lg font-semibold text-gray-800 dark:text-gray-100 mb-4">
|
||||
Formular
|
||||
</h2>
|
||||
<div class="space-y-4">
|
||||
<div wire:dirty>
|
||||
<x-input label="Name" wire:model="form.name"/>
|
||||
@error('form.name')
|
||||
<span class="text-red-500">{{ $message }}</span>
|
||||
@enderror
|
||||
</div>
|
||||
<div wire:dirty>
|
||||
<x-textarea label="Beschreibung" wire:model="form.description"/>
|
||||
@error('form.description')
|
||||
<span class="text-red-500">{{ $message }}</span>
|
||||
@enderror
|
||||
</div>
|
||||
<button
|
||||
wire:click="update"
|
||||
wire:loading.attr="disabled"
|
||||
class="w-full btn-sm bg-white dark:bg-gray-800 border-gray-200 dark:border-gray-700/60 hover:border-gray-300 dark:hover:border-gray-600 text-gray-800 dark:text-gray-300">
|
||||
Speichern
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Right column -->
|
||||
<div class="flex-1 md:ml-8">
|
||||
<div
|
||||
class="bg-white dark:bg-gray-800 shadow-sm rounded-xl p-5">
|
||||
<h2 class="text-lg font-semibold text-gray-800 dark:text-gray-100 mb-4">
|
||||
Information
|
||||
</h2>
|
||||
<p class="text-sm text-gray-800 dark:text-gray-100">
|
||||
Bearbeite die Projektförderung und speichere deine Änderungen.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
</x-layouts.app>
|
||||
</div>
|
||||
@else
|
||||
<div class="px-4 sm:px-6 lg:px-8 py-8 w-full max-w-9xl mx-auto">
|
||||
<div class="bg-white dark:bg-[#1B1B1B] shadow overflow-hidden sm:rounded-lg">
|
||||
<div class="px-4 py-5 sm:px-6">
|
||||
<h3 class="text-lg font-medium leading-6 text-gray-900 dark:text-gray-200">
|
||||
Projektförderung
|
||||
</h3>
|
||||
<p class="mt-1 max-w">
|
||||
Du bist nicht berechtigt, die Projektförderung zu bearbeiten.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
@@ -97,14 +97,6 @@ new class extends Component {
|
||||
$this->loadProjects();
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.association.project-support')
|
||||
->layout('layouts.app')
|
||||
->with([
|
||||
'seo' => new \RalphJSmit\Laravel\SEO\Support\SEOData(title: 'Projekt Unterstützungen', description: 'Einundzwanzig Projektunterstützungen')
|
||||
]);
|
||||
}
|
||||
};
|
||||
?>
|
||||
|
||||
|
||||
@@ -1,85 +1,107 @@
|
||||
<x-layouts.app
|
||||
:seo="new \RalphJSmit\Laravel\SEO\Support\SEOData(title: 'Projektförderung ' . $project->name, description: $project->description)"
|
||||
>
|
||||
<div>
|
||||
@if($isAllowed)
|
||||
<div class="px-4 sm:px-6 lg:px-8 py-8 w-full max-w-9xl mx-auto">
|
||||
<div
|
||||
class="flex flex-col md:flex-row items-center mb-6 space-y-4 md:space-y-0 md:space-x-4">
|
||||
<div class="flex items-center justify-between w-full">
|
||||
<h1 class="text-2xl md:text-3xl text-gray-800 dark:text-gray-100 font-bold">
|
||||
{{ $project->name }}
|
||||
</h1>
|
||||
<div>
|
||||
@if($project->status === 'pending')
|
||||
<x-badge info label="Pending"/>
|
||||
@elseif($project->status === 'active')
|
||||
<x-badge success label="Active"/>
|
||||
@else
|
||||
<x-badge neutral label="Archiviert"/>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
<div class="md:flex">
|
||||
<!-- Left column -->
|
||||
<div class="w-full md:w-60 mb-4 md:mb-0">
|
||||
<div
|
||||
class="bg-white dark:bg-gray-800 shadow-sm rounded-xl p-5">
|
||||
<h2 class="text-lg font-semibold text-gray-800 dark:text-gray-100 mb-4">
|
||||
Details
|
||||
</h2>
|
||||
<dl class="space-y-3">
|
||||
<div>
|
||||
<dt class="text-xs font-semibold text-gray-500 uppercase mb-1">Status</dt>
|
||||
<dd class="text-sm text-gray-800 dark:text-gray-100">
|
||||
@if($project->status === 'pending')
|
||||
Ausstehend
|
||||
@elseif($project->status === 'active')
|
||||
Aktiv
|
||||
@else
|
||||
Archiviert
|
||||
@endif
|
||||
</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt class="text-xs font-semibold text-gray-500 uppercase mb-1">Erstellt am</dt>
|
||||
<dd class="text-sm text-gray-800 dark:text-gray-100">
|
||||
{{ $project->created_at->format('d.m.Y') }}
|
||||
</dd>
|
||||
</div>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
use App\Models\ProjectProposal;
|
||||
use App\Support\NostrAuth;
|
||||
use Livewire\Component;
|
||||
use Livewire\Attributes\Layout;
|
||||
use Livewire\Attributes\Title;
|
||||
|
||||
<!-- Right column -->
|
||||
<div class="flex-1 md:ml-8">
|
||||
<div
|
||||
class="bg-white dark:bg-gray-800 shadow-sm rounded-xl p-5">
|
||||
<h2 class="text-lg font-semibold text-gray-800 dark:text-gray-100 mb-4">
|
||||
Beschreibung
|
||||
</h2>
|
||||
<p class="text-sm text-gray-800 dark:text-gray-100">
|
||||
{{ $project->description ?? 'Keine Beschreibung' }}
|
||||
</p>
|
||||
</div>
|
||||
new
|
||||
#[Layout('layouts.app')]
|
||||
#[Title('Projektförderung ')]
|
||||
class extends Component {
|
||||
public ProjectProposal $project;
|
||||
|
||||
public bool $isAllowed = false;
|
||||
|
||||
public function mount(ProjectProposal $project): void
|
||||
{
|
||||
$this->project = $project;
|
||||
if (NostrAuth::check()) {
|
||||
$this->isAllowed = true;
|
||||
}
|
||||
}
|
||||
};
|
||||
?>
|
||||
|
||||
<div>
|
||||
@if($isAllowed)
|
||||
<div class="px-4 sm:px-6 lg:px-8 py-8 w-full max-w-9xl mx-auto">
|
||||
<div
|
||||
class="flex flex-col md:flex-row items-center mb-6 space-y-4 md:space-y-0 md:space-x-4">
|
||||
<div class="flex items-center justify-between w-full">
|
||||
<h1 class="text-2xl md:text-3xl text-gray-800 dark:text-gray-100 font-bold">
|
||||
{{ $project->name }}
|
||||
</h1>
|
||||
<div>
|
||||
@if($project->status === 'pending')
|
||||
<x-badge info label="Pending"/>
|
||||
@elseif($project->status === 'active')
|
||||
<x-badge success label="Active"/>
|
||||
@else
|
||||
<x-badge neutral label="Archiviert"/>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@else
|
||||
<div class="px-4 sm:px-6 lg:px-8 py-8 w-full max-w-9xl mx-auto">
|
||||
<div class="bg-white dark:bg-[#1B1B1B] shadow overflow-hidden sm:rounded-lg">
|
||||
<div class="px-4 py-5 sm:px-6">
|
||||
<h3 class="text-lg font-medium leading-6 text-gray-900 dark:text-gray-200">
|
||||
Projektförderung
|
||||
</h3>
|
||||
<p class="mt-1 max-w">
|
||||
Du bist nicht berechtigt, die Projektförderung einzusehen.
|
||||
|
||||
<div class="md:flex">
|
||||
<!-- Left column -->
|
||||
<div class="w-full md:w-60 mb-4 md:mb-0">
|
||||
<div
|
||||
class="bg-white dark:bg-gray-800 shadow-sm rounded-xl p-5">
|
||||
<h2 class="text-lg font-semibold text-gray-800 dark:text-gray-100 mb-4">
|
||||
Details
|
||||
</h2>
|
||||
<dl class="space-y-3">
|
||||
<div>
|
||||
<dt class="text-xs font-semibold text-gray-500 uppercase mb-1">Status</dt>
|
||||
<dd class="text-sm text-gray-800 dark:text-gray-100">
|
||||
@if($project->status === 'pending')
|
||||
Ausstehend
|
||||
@elseif($project->status === 'active')
|
||||
Aktiv
|
||||
@else
|
||||
Archiviert
|
||||
@endif
|
||||
</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt class="text-xs font-semibold text-gray-500 uppercase mb-1">Erstellt am</dt>
|
||||
<dd class="text-sm text-gray-800 dark:text-gray-100">
|
||||
{{ $project->created_at->format('d.m.Y') }}
|
||||
</dd>
|
||||
</div>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Right column -->
|
||||
<div class="flex-1 md:ml-8">
|
||||
<div
|
||||
class="bg-white dark:bg-gray-800 shadow-sm rounded-xl p-5">
|
||||
<h2 class="text-lg font-semibold text-gray-800 dark:text-gray-100 mb-4">
|
||||
Beschreibung
|
||||
</h2>
|
||||
<p class="text-sm text-gray-800 dark:text-gray-100">
|
||||
{{ $project->description ?? 'Keine Beschreibung' }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
</x-layouts.app>
|
||||
</div>
|
||||
@else
|
||||
<div class="px-4 sm:px-6 lg:px-8 py-8 w-full max-w-9xl mx-auto">
|
||||
<div class="bg-white dark:bg-[#1B1B1B] shadow overflow-hidden sm:rounded-lg">
|
||||
<div class="px-4 py-5 sm:px-6">
|
||||
<h3 class="text-lg font-medium leading-6 text-gray-900 dark:text-gray-200">
|
||||
Projektförderung
|
||||
</h3>
|
||||
<p class="mt-1 max-w">
|
||||
Du bist nicht berechtigt, die Projektförderung einzusehen.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user