🛠️ Refactor and streamline Blade templates for project support and elections, including improved conditionals and structure cleanup

🛠️ Replace `shell_exec` with `Process` in Changelog Livewire component for safer command execution
This commit is contained in:
HolgerHatGarKeineNode
2026-01-17 23:54:06 +01:00
parent 0abbe69868
commit a73587b9e8
12 changed files with 475 additions and 599 deletions

View File

@@ -4,7 +4,9 @@ namespace App\Livewire\Association\Election;
use App\Models\EinundzwanzigPleb;
use App\Models\Election;
use App\Models\Profile;
use App\Support\NostrAuth;
use Livewire\Attributes\Computed;
use Livewire\Component;
use swentel\nostr\Event\Event as NostrEvent;
use swentel\nostr\Filter\Filter;
@@ -39,12 +41,149 @@ final class Show extends Component
public bool $isNotClosed = true;
public array $positions = [
'presidency' => ['icon' => 'fa-crown', 'title' => 'Präsidium'],
'board' => ['icon' => 'fa-users', 'title' => 'Vizepräsidium'],
];
protected $listeners = [
'nostrLoggedIn' => 'handleNostrLoggedIn',
'nostrLoggedOut' => 'handleNostrLoggedOut',
'echo:votes,.newVote' => 'handleNewVote',
];
#[Computed]
public function loadedEvents(): array
{
return collect($this->events)
->map(function ($event) {
$profile = Profile::query()
->where('pubkey', $event['pubkey'])
->first()
?->toArray();
$votedFor = Profile::query()
->where('pubkey', str($event['content'])->before(',')->toString())
->first()
?->toArray();
return [
'id' => $event['id'],
'kind' => $event['kind'],
'content' => $event['content'],
'pubkey' => $event['pubkey'],
'tags' => $event['tags'],
'created_at' => $event['created_at'],
'profile' => $profile,
'votedFor' => $votedFor,
'type' => str($event['content'])->after(',')->toString(),
];
})
->sortByDesc('created_at')
->unique(fn ($event) => $event['pubkey'].$event['type'])
->values()
->toArray();
}
#[Computed]
public function loadedBoardEvents(): array
{
return collect($this->boardEvents)
->map(function ($event) {
$profile = Profile::query()
->where('pubkey', $event['pubkey'])
->first()
?->toArray();
$votedFor = Profile::query()
->where('pubkey', str($event['content'])->before(',')->toString())
->first()
?->toArray();
return [
'id' => $event['id'],
'kind' => $event['kind'],
'content' => $event['content'],
'pubkey' => $event['pubkey'],
'tags' => $event['tags'],
'created_at' => $event['created_at'],
'profile' => $profile,
'votedFor' => $votedFor,
'type' => str($event['content'])->after(',')->toString(),
];
})
->sortByDesc('created_at')
->values()
->toArray();
}
#[Computed]
public function electionConfig(): array
{
$loadedEvents = $this->loadedEvents();
return collect(json_decode($this->election->candidates, true, 512, JSON_THROW_ON_ERROR))
->map(function ($c) use ($loadedEvents) {
$candidates = Profile::query()
->whereIn('pubkey', $c['c'])
->get()
->map(function ($p) use ($loadedEvents, $c) {
$votedClass = ' bg-green-500/20 text-green-700';
$notVotedClass = ' bg-gray-500/20 text-gray-100';
$hasVoted = $loadedEvents
->filter(fn ($e) => $e['type'] === $c['type'] && $e['pubkey'] === $this->currentPubkey)
->firstWhere('votedFor.pubkey', $p->pubkey);
return [
'pubkey' => $p->pubkey,
'name' => $p->name,
'picture' => $p->picture,
'votedClass' => $hasVoted ? $votedClass : $notVotedClass,
];
});
return [
'type' => $c['type'],
'c' => $c['c'],
'candidates' => $candidates,
];
})
->toArray();
}
#[Computed]
public function electionConfigBoard(): array
{
$loadedBoardEvents = $this->loadedBoardEvents();
return collect(json_decode($this->election->candidates, true, 512, JSON_THROW_ON_ERROR))
->map(function ($c) use ($loadedBoardEvents) {
$candidates = Profile::query()
->whereIn('pubkey', $c['c'])
->get()
->map(function ($p) use ($loadedBoardEvents, $c) {
$votedClass = ' bg-green-500/20 text-green-700';
$notVotedClass = ' bg-gray-500/20 text-gray-100';
$hasVoted = $loadedBoardEvents
->filter(fn ($e) => $e['type'] === $c['type'] && $e['pubkey'] === $this->currentPubkey)
->firstWhere('votedFor.pubkey', $p->pubkey);
return [
'pubkey' => $p->pubkey,
'name' => $p->name,
'picture' => $p->picture,
'votedClass' => $hasVoted ? $votedClass : $notVotedClass,
'hasVoted' => $hasVoted,
];
});
return [
'type' => $c['type'],
'c' => $c['c'],
'candidates' => $candidates,
];
})
->toArray();
}
public function mount(Election $election): void
{
$this->election = $election;

View File

@@ -2,6 +2,7 @@
namespace App\Livewire;
use Illuminate\Support\Facades\Process;
use Livewire\Component;
final class Changelog extends Component
@@ -10,7 +11,9 @@ final class Changelog extends Component
public function mount(): void
{
$output = shell_exec('git log -n1000 --pretty=format:"%H|%s|%an|%ad" --date=format:"%Y-%m-%d %H:%M:%S"');
$process = Process::fromShellCommandline('git log -n1000 --pretty=format:"%H|%s|%an|%ad" --date=format:"%Y-%m-%d %H:%M:%S"');
$process->run();
$output = $process->getOutput();
$lines = explode("\n", trim($output));
$entries = [];

View File

@@ -1,12 +1,12 @@
<div>
<?php
@php
$positions = [
'presidency' => ['icon' => 'fa-crown', 'title' => 'Präsidium'],
'board' => ['icon' => 'fa-users', 'title' => 'Vorstandsmitglieder'],
];
?>
@endphp
<?php if ($isAllowed): ?>
@if($isAllowed)
<div class="px-4 sm:px-6 lg:px-8 py-8 w-full max-w-9xl mx-auto" x-data="electionAdminCharts()">
@@ -16,16 +16,16 @@
<!-- Left: Title -->
<div class="mb-4 sm:mb-0">
<h1 class="text-2xl md:text-3xl text-gray-800 dark:text-gray-100 font-bold">
Wahl des Vorstands <?php echo e($election->year); ?>
Wahl des Vorstands {{ $election->year }}
</h1>
</div>
</div>
<?php
@php
$president = $positions['presidency'];
$board = $positions['board'];
?>
@endphp
<!-- Cards -->
<div class="grid gap-y-4">
@@ -33,11 +33,11 @@
class="flex flex-col bg-white dark:bg-gray-800 shadow-sm rounded-xl">
<header class="px-5 py-4 border-b border-gray-100 dark:border-gray-700/60">
<h2 class="font-semibold text-gray-800 dark:text-gray-100"><i
class="fa-sharp-duotone fa-solid <?php echo e($president['icon']); ?> w-5 h-5 fill-current text-white mr-4"></i><?php echo e($president['title']); ?>
class="fa-sharp-duotone fa-solid {{ $president['icon'] }} w-5 h-5 fill-current text-white mr-4"></i>{{ $president['title'] }}
</h2>
</header>
<div class="grow">
<!-- Change the height attribute to adjust the chart height -->
<!-- Change| height attribute to adjust chart height -->
<canvas x-ref="chart_presidency" width="724" height="288"
style="display: block; box-sizing: border-box; height: 288px; width: 724px;"></canvas>
</div>
@@ -46,11 +46,11 @@
class="flex flex-col bg-white dark:bg-gray-800 shadow-sm rounded-xl">
<header class="px-5 py-4 border-b border-gray-100 dark:border-gray-700/60">
<h2 class="font-semibold text-gray-800 dark:text-gray-100"><i
class="fa-sharp-duotone fa-solid <?php echo e($board['icon']); ?> w-5 h-5 fill-current text-white mr-4"></i><?php echo e($board['title']); ?>
class="fa-sharp-duotone fa-solid {{ $board['icon'] }} w-5 h-5 fill-current text-white mr-4"></i>{{ $board['title'] }}
</h2>
</header>
<div class="grow">
<!-- Change the height attribute to adjust the chart height -->
<!-- Change| height attribute to adjust chart height -->
<canvas x-ref="chart_board" width="724" height="288"
style="display: block; box-sizing: border-box; height: 288px; width: 724px;"></canvas>
</div>
@@ -59,7 +59,7 @@
</div>
<?php else: ?>
@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">
@@ -70,5 +70,5 @@
</div>
</div>
</div>
<?php endif; ?>
@endif
</div>

View File

@@ -1,23 +1,23 @@
<x-layouts.app title="{{ __('Wahlen') }}">
<div>
<?php if($isAllowed): ?>
@if($isAllowed)
<div class="relative flex h-full">
<?php foreach($elections as $election): ?>
<div class="w-full sm:w-1/3 p-4">
@foreach($elections as $election)
<div class="w-full sm:w-1/3 p-4" wire:key="election-{{ $loop->index }}">
<div class="shadow-lg rounded-lg overflow-hidden">
<?php echo e($election['year']); ?>
{{ $election['year'] }}
</div>
<div class="shadow-lg rounded-lg overflow-hidden">
<x-textarea wire:model="elections.<?php echo e($loop->index); ?>.candidates" rows="25"
<x-textarea wire:model="elections.{{ $loop->index }}.candidates" rows="25"
label="candidates" placeholder=""/>
</div>
<div class="py-2">
<x-button label="Speichern" wire:click="saveElection(<?php echo e($loop->index); ?>)"/>
<x-button label="Speichern" wire:click="saveElection({{ $loop->index }})" wire:loading.attr="disabled"/>
</div>
</div>
<?php endforeach; ?>
@endforeach
</div>
<?php else: ?>
@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">
@@ -28,6 +28,6 @@
</div>
</div>
</div>
<?php endif; ?>
@endif
</div>
</x-layouts.app>

View File

@@ -2,68 +2,10 @@
:seo="new \RalphJSmit\Laravel\SEO\Support\SEOData(title: 'Wahlen ' . $election->year, description: 'Wahlen des Vereins im Jahr ' . $election->year)"
>
<div>
<?php if($isAllowed): ?>
@if($isAllowed)
<div x-cloak class="relative flex h-full" x-data="nostrApp(@this)"
wire:poll.600000ms="checkElection">
<?php
$positions = [
'presidency' => ['icon' => 'fa-crown', 'title' => 'Präsidium'],
'board' => ['icon' => 'fa-users', 'title' => 'Vizepräsidium'],
];
$loadedEvents = collect($events)
->map(function($event) {
$profile = \App\Models\Profile::query()
->where('pubkey', $event['pubkey'])
->first()
?->toArray();
$votedFor = \App\Models\Profile::query()
->where('pubkey', str($event['content'])->before(',')->toString())
->first()
?->toArray();
return [
'id' => $event['id'],
'kind' => $event['kind'],
'content' => $event['content'],
'pubkey' => $event['pubkey'],
'tags' => $event['tags'],
'created_at' => $event['created_at'],
'profile' => $profile,
'votedFor' => $votedFor,
'type' => str($event['content'])->after(',')->toString(),
];
})
->sortByDesc('created_at')
->unique(fn ($event) => $event['pubkey'] . $event['type'])
->values();
$loadedBoardEvents = collect($boardEvents)
->map(function($event) {
$profile = \App\Models\Profile::query()
->where('pubkey', $event['pubkey'])
->first()
?->toArray();
$votedFor = \App\Models\Profile::query()
->where('pubkey', str($event['content'])->before(',')->toString())
->first()
?->toArray();
return [
'id' => $event['id'],
'kind' => $event['kind'],
'content' => $event['content'],
'pubkey' => $event['pubkey'],
'tags' => $event['tags'],
'created_at' => $event['created_at'],
'profile' => $profile,
'votedFor' => $votedFor,
'type' => str($event['content'])->after(',')->toString(),
];
})
->sortByDesc('created_at')
->values();
?>
<!-- Inbox sidebar -->
<div id="inbox-sidebar"
class="absolute z-20 top-0 bottom-0 w-full md:w-auto md:static md:top-auto md:bottom-auto -mr-px md:translate-x-0 transition-transform duration-200 ease-in-out"
@@ -154,11 +96,11 @@
Plebs
</div>
<ul class="mb-6">
<?php foreach($plebs as $pleb): ?>
@foreach($plebs as $pleb)
<li class="-mx-2">
<div class="flex w-full p-2 rounded text-left">
<img class="w-8 h-8 rounded-full mr-2 bg-black"
src="<?php echo e($pleb['profile']['picture'] ?? 'https://robohash.org/test'); ?>"
src="{{ $pleb['profile']['picture'] ?? 'https://robohash.org/test' }}"
onerror="this.onerror=null; this.src='https://robohash.org/test';"
width="32"
height="32"
@@ -167,34 +109,34 @@
<div class="flex items-center justify-between mb-1.5">
<div class="truncate">
<span
class="text-sm font-semibold text-gray-800 dark:text-gray-100 truncate"><?php echo e($pleb['profile']['name'] ?? $pleb['pubkey']); ?></span>
class="text-sm font-semibold text-gray-800 dark:text-gray-100 truncate">{{ $pleb['profile']['name'] ?? $pleb['pubkey'] }}</span>
</div>
<div class="text-xs text-gray-500 font-medium">
<x-badge
color="<?php echo e(\App\Enums\AssociationStatus::from($pleb['association_status'])->color()); ?>"
label="<?php echo e(\App\Enums\AssociationStatus::from($pleb['association_status'])->label()); ?>"/>
:color="\App\Enums\AssociationStatus::from($pleb['association_status'])->color()"
:label="\App\Enums\AssociationStatus::from($pleb['association_status'])->label()"/>
</div>
</div>
<div
class="text-xs font-medium text-gray-800 dark:text-gray-100 truncate mb-0.5">
<div class="flex items-center space-x-2 h-5">
<?php foreach($positions as $name => $p): ?>
<?php
$votedResult = $loadedEvents->filter(fn ($e) => $e['pubkey'] === $pleb['pubkey'])->firstWhere('type', $name);
?>
@foreach($positions as $name => $p)
@php
$votedResult = $this->loadedEvents->filter(fn ($e) => $e['pubkey'] === $pleb['pubkey'])->firstWhere('type', $name);
@endphp
<div class="flex space-x-2"
wire:key="p_<?php echo e($name); ?>">
<?php if($votedResult): ?>
<i class="fa-sharp-duotone fa-solid <?php echo e($p['icon']); ?> w-4 h-4 fill-current text-green-500"></i>
<?php endif; ?>
wire:key="p_{{ $name }}">
@if($votedResult)
<i class="fa-sharp-duotone fa-solid {{ $p['icon'] }} w-4 h-4 fill-current text-green-500"></i>
@endif
</div>
<?php endforeach; ?>
@endforeach
</div>
</div>
</div>
</div>
</li>
<?php endforeach; ?>
@endforeach
</ul>
</div>
</div>
@@ -204,64 +146,7 @@
</div>
<!-- Inbox body -->
<?php if($currentPubkey): ?>
<?php
$electionConfig = collect(json_decode($election->candidates, true, 512, JSON_THROW_ON_ERROR))
->map(function ($c) use ($loadedEvents, $currentPubkey) {
$candidates = \App\Models\Profile::query()
->whereIn('pubkey', $c['c'])
->get()
->map(function ($p) use ($loadedEvents, $c, $currentPubkey) {
$votedClass = ' bg-green-500/20 text-green-700';
$notVotedClass = ' bg-gray-500/20 text-gray-100';
$hasVoted = $loadedEvents
->filter(fn($e) => $e['type'] === $c['type'] && $e['pubkey'] === $currentPubkey)
->firstWhere('votedFor.pubkey', $p->pubkey);
return [
'pubkey' => $p->pubkey,
'name' => $p->name,
'picture' => $p->picture,
'votedClass' => $hasVoted ? $votedClass : $notVotedClass,
];
});
return [
'type' => $c['type'],
'c' => $c['c'],
'candidates' => $candidates,
];
});
$electionConfigBoard = collect(json_decode($election->candidates, true, 512, JSON_THROW_ON_ERROR))
->map(function ($c) use ($loadedBoardEvents, $currentPubkey) {
$candidates = \App\Models\Profile::query()
->whereIn('pubkey', $c['c'])
->get()
->map(function ($p) use ($loadedBoardEvents, $c, $currentPubkey) {
$votedClass = ' bg-green-500/20 text-green-700';
$notVotedClass = ' bg-gray-500/20 text-gray-100';
$hasVoted = $loadedBoardEvents
->filter(fn($e) => $e['type'] === $c['type'] && $e['pubkey'] === $currentPubkey)
->firstWhere('votedFor.pubkey', $p->pubkey);
return [
'pubkey' => $p->pubkey,
'name' => $p->name,
'picture' => $p->picture,
'votedClass' => $hasVoted ? $votedClass : $notVotedClass,
'hasVoted' => $hasVoted,
];
});
return [
'type' => $c['type'],
'c' => $c['c'],
'candidates' => $candidates,
];
});
?>
@if($currentPubkey)
<div class="grow flex flex-col md:translate-x-0 transition-transform duration-300 ease-in-out"
:class="inboxSidebarOpen ? 'translate-x-1/3' : 'translate-x-0'">
@@ -272,12 +157,12 @@
<div
class="flex flex-col space-y-2 sm:space-y-0 sm:flex-row justify-between items-center w-full">
<div>
<?php if($isNotClosed): ?>
@if($isNotClosed)
<x-badge success
label="Die Wahl ist geöffnet bis zum <?php echo e($election->end_time?->timezone('Europe/Berlin')->format('d.m.Y H:i')); ?>"/>
<?php else: ?>
label="Die Wahl ist geöffnet bis zum {{ $election->end_time?->timezone('Europe/Berlin')->format('d.m.Y H:i') }}"/>
@else
<x-badge negative label="Die Wahl ist geschlossen"/>
<?php endif; ?>
@endif
</div>
<div>
<x-button secondary
@@ -311,52 +196,49 @@
<h1 class="text-xl leading-snug text-gray-800 dark:text-gray-100 font-bold mb-1 sm:mb-0 ml-2">
Wahl des Präsidiums
</h1>
<?php
$president = $positions['presidency'];
$board = $positions['board'];
?>
<div class="grid sm:grid-cols-2 gap-6">
<div
class="bg-white dark:bg-gray-800 shadow-sm rounded-xl">
<div class="flex flex-col h-full p-5">
<header>
<div class="flex items-center justify-between">
<i class="fa-sharp-duotone fa-solid <?php echo e($president['icon']); ?> w-9 h-9 fill-current text-white"></i>
<i class="fa-sharp-duotone fa-solid {{ $positions['presidency']['icon'] }} w-9 h-9 fill-current text-white"></i>
</div>
</header>
<div class="grow mt-2">
<div
class="inline-flex text-gray-800 dark:text-gray-100 hover:text-gray-900 dark:hover:text-white mb-1">
<h2 class="text-xl leading-snug font-semibold"><?php echo e($president['title']); ?></h2>
<h2 class="text-xl leading-snug font-semibold">{{ $positions['presidency']['title'] }}</h2>
</div>
<div class="text-sm">
<?php
$votedResult = $loadedEvents->filter(fn ($event) => $event['pubkey'] === $currentPubkey)->firstWhere('type', 'presidency');
?>
<?php if($votedResult): ?>
<span>Du hast "<?php echo e($votedResult['votedFor']['name'] ?? 'error'); ?>" gewählt</span>
<?php else: ?>
@php
$votedResult = $this->loadedEvents->filter(fn ($event) => $event['pubkey'] === $currentPubkey)->firstWhere('type', 'presidency');
$votedName = $votedResult['votedFor']['name'] ?? 'error';
@endphp
@if($votedResult)
<span>Du hast "{{ $votedName }}" gewählt</span>
@else
<span>Wähle deinen Kandidaten für das Präsidium.</span>
<?php endif; ?>
@endif
</div>
</div>
<footer class="mt-5">
<div class="grid sm:grid-cols-2 gap-2">
<?php foreach($electionConfig->firstWhere('type', 'presidency')['candidates'] ?? [] as $c): ?>
@foreach($this->electionConfig->firstWhere('type', 'presidency')['candidates'] ?? [] as $c)
<div
<?php if($isNotClosed): ?>wire:click="vote('<?php echo e($c['pubkey']); ?>', 'presidency')"
<?php endif; ?>
class="<?php echo e($c['votedClass']); ?> cursor-pointer text-xs inline-flex font-medium rounded-full text-center px-2.5 py-1">
@if($isNotClosed)wire:click="vote('{{ $c['pubkey'] }}', 'presidency')"
@endif
class="{{ $c['votedClass'] }} cursor-pointer text-xs inline-flex font-medium rounded-full text-center px-2.5 py-1">
<div class="flex items-center">
<img class="w-6 h-6 rounded-full mr-2 bg-black"
src="<?php echo e($c['picture'] ?? 'https://robohash.org/' . $c['pubkey']); ?>"
onerror="this.onerror=null; this.src='https://robohash.org/<?php echo e($c['pubkey']); ?>';"
src="{{ $c['picture'] ?? 'https://robohash.org/' . $c['pubkey'] }}"
onerror="this.onerror=null; this.src='https://robohash.org/{{ $c['pubkey'] }}';"
width="24" height="24"
alt="<?php echo e($c['name']); ?>"/>
<?php echo e($c['name']); ?>
alt="{{ $c['name'] }}"/>
{{ $c['name'] }}
</div>
</div>
<?php endforeach; ?>
@endforeach
</div>
</footer>
</div>
@@ -378,21 +260,21 @@
</div>
<footer class="mt-5">
<div class="grid sm:grid-cols-4 gap-2">
<?php foreach($electionConfigBoard->firstWhere('type', 'board')['candidates'] ?? [] as $c): ?>
@foreach($this->electionConfigBoard->firstWhere('type', 'board')['candidates'] ?? [] as $c)
<div
<?php if($isNotClosed && !$c['hasVoted']): ?>wire:click="vote('<?php echo e($c['pubkey']); ?>', 'board', true)"
<?php endif; ?>
class="<?php echo e($c['votedClass']); ?> cursor-pointer text-xs inline-flex font-medium rounded-full text-center px-2.5 py-1">
@if($isNotClosed && !$c['hasVoted'])wire:click="vote('{{ $c['pubkey'] }}', 'board', true)"
@endif
class="{{ $c['votedClass'] }} cursor-pointer text-xs inline-flex font-medium rounded-full text-center px-2.5 py-1">
<div class="flex items-center">
<img class="w-6 h-6 rounded-full mr-2 bg-black"
src="<?php echo e($c['picture'] ?? 'https://robohash.org/' . $c['pubkey']); ?>"
onerror="this.onerror=null; this.src='https://robohash.org/<?php echo e($c['pubkey']); ?>';"
src="{{ $c['picture'] ?? 'https://robohash.org/' . $c['pubkey'] }}"
onerror="this.onerror=null; this.src='https://robohash.org/{{ $c['pubkey'] }}';"
width="24" height="24"
alt="<?php echo e($c['name']); ?>"/>
<?php echo e($c['name']); ?>
alt="{{ $c['name'] }}"/>
{{ $c['name'] }}
</div>
</div>
<?php endforeach; ?>
@endforeach
</div>
</footer>
</div>
@@ -408,7 +290,7 @@
<div class="bg-white dark:bg-gray-800 shadow-sm rounded-xl mb-8">
<header class="px-5 py-4">
<h2 class="font-semibold text-gray-800 dark:text-gray-100">Präsidium Log <span
class="text-gray-400 dark:text-gray-500 font-medium"><?php echo e($loadedEvents->count()); ?></span>
class="text-gray-400 dark:text-gray-500 font-medium">{{ count($this->loadedEvents) }}</span>
</h2>
</header>
<div>
@@ -442,29 +324,29 @@
</thead>
<!-- Table body -->
<tbody class="text-sm">
<?php foreach($loadedEvents as $event): ?>
@foreach($this->loadedEvents as $event)
<tr>
<td class="px-2 first:pl-5 last:pr-5 py-3 whitespace-nowrap">
<div
class="font-medium"><?php echo e(\Illuminate\Support\Str::limit($event['id'], 10)); ?></div>
class="font-medium">{{ Str::limit($event['id'], 10) }}</div>
</td>
<td class="px-2 first:pl-5 last:pr-5 py-3 whitespace-nowrap">
<div><?php echo e($event['kind']); ?></div>
<div>{{ $event['kind'] }}</div>
</td>
<td class="px-2 first:pl-5 last:pr-5 py-3 whitespace-nowrap">
<div><?php echo e($event['profile']['name'] ?? ''); ?></div>
<div>{{ $event['profile']['name'] ?? '' }}</div>
</td>
<td class="px-2 first:pl-5 last:pr-5 py-3 whitespace-nowrap">
<div><?php echo e($event['created_at']); ?></div>
<div>{{ $event['created_at'] }}</div>
</td>
<td class="px-2 first:pl-5 last:pr-5 py-3 whitespace-nowrap">
<div><?php echo e($event['votedFor']['name'] ?? ''); ?></div>
<div>{{ $event['votedFor']['name'] ?? '' }}</div>
</td>
<td class="px-2 first:pl-5 last:pr-5 py-3 whitespace-nowrap">
<div><?php echo e($event['type']); ?></div>
<div>{{ $event['type'] }}</div>
</td>
</tr>
<?php endforeach; ?>
@endforeach
</tbody>
</table>
</div>
@@ -475,7 +357,7 @@
<div class="bg-white dark:bg-gray-800 shadow-sm rounded-xl mb-8">
<header class="px-5 py-4">
<h2 class="font-semibold text-gray-800 dark:text-gray-100">Board Log <span
class="text-gray-400 dark:text-gray-500 font-medium"><?php echo e($loadedBoardEvents->count()); ?></span>
class="text-gray-400 dark:text-gray-500 font-medium">{{ count($this->loadedBoardEvents) }}</span>
</h2>
</header>
<div>
@@ -509,29 +391,29 @@
</thead>
<!-- Table body -->
<tbody class="text-sm">
<?php foreach($loadedBoardEvents as $event): ?>
@foreach($this->loadedBoardEvents as $event)
<tr>
<td class="px-2 first:pl-5 last:pr-5 py-3 whitespace-nowrap">
<div
class="font-medium"><?php echo e(\Illuminate\Support\Str::limit($event['id'], 10)); ?></div>
class="font-medium">{{ Str::limit($event['id'], 10) }}</div>
</td>
<td class="px-2 first:pl-5 last:pr-5 py-3 whitespace-nowrap">
<div><?php echo e($event['kind']); ?></div>
<div>{{ $event['kind'] }}</div>
</td>
<td class="px-2 first:pl-5 last:pr-5 py-3 whitespace-nowrap">
<div><?php echo e($event['profile']['name'] ?? ''); ?></div>
<div>{{ $event['profile']['name'] ?? '' }}</div>
</td>
<td class="px-2 first:pl-5 last:pr-5 py-3 whitespace-nowrap">
<div><?php echo e($event['created_at']); ?></div>
<div>{{ $event['created_at'] }}</div>
</td>
<td class="px-2 first:pl-5 last:pr-5 py-3 whitespace-nowrap">
<div><?php echo e($event['votedFor']['name'] ?? ''); ?></div>
<div>{{ $event['votedFor']['name'] ?? '' }}</div>
</td>
<td class="px-2 first:pl-5 last:pr-5 py-3 whitespace-nowrap">
<div><?php echo e($event['type']); ?></div>
<div>{{ $event['type'] }}</div>
</td>
</tr>
<?php endforeach; ?>
@endforeach
</tbody>
</table>
</div>
@@ -542,10 +424,10 @@
</div>
</div>
<?php endif; ?>
@endif
</div>
<?php else: ?>
@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">
@@ -556,7 +438,7 @@
</div>
</div>
</div>
<?php endif; ?>
@endif
</div>
</x-layouts.app>

View File

@@ -1,10 +1,10 @@
<x-layouts.app title="{{ __('Mitglieder') }}">
<div>
<?php if($isAllowed): ?>
@if($isAllowed)
<div class="px-4 sm:px-6 lg:px-8 py-8 w-full max-w-9xl mx-auto">
<livewire:einundzwanzig-pleb-table/>
</div>
<?php else: ?>
@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">
@@ -15,6 +15,6 @@
</div>
</div>
</div>
<?php endif; ?>
@endif
</div>
</x-layouts.app>

View File

@@ -2,7 +2,7 @@
:seo="new \RalphJSmit\Laravel\SEO\Support\SEOData(title: 'News', description: 'Die News des Vereins.')"
>
<div>
<?php if($isAllowed): ?>
@if($isAllowed)
<div class="px-4 sm:px-6 lg:px-8 py-8 md:py-0 w-full max-w-9xl mx-auto">
<div class="xl:flex">
@@ -26,7 +26,6 @@
</div>
<!-- Links -->
<div
class="flex flex-nowrap overflow-x-scroll no-scrollbar md:block md:overflow-auto px-4 md:space-y-3 -mx-4">
@@ -37,17 +36,17 @@
Menu
</div>
<ul class="flex flex-nowrap md:block mr-3 md:mr-0">
<?php foreach(\App\Enums\NewsCategory::selectOptions() as $category): ?>
@foreach(\App\Enums\NewsCategory::selectOptions() as $category)
<li class="mr-0.5 md:mr-0 md:mb-0.5"
wire:key="category_<?php echo e($category['value']); ?>">
wire:key="category_{{ $category['value'] }}">
<div
class="flex items-center px-2.5 py-2 rounded-lg whitespace-nowrap bg-white dark:bg-gray-800">
<i class="fa-sharp-duotone fa-solid fa-<?php echo e($category['icon']); ?> shrink-0 fill-current text-amber-500 mr-2"></i>
<i class="fa-sharp-duotone fa-solid fa-{{ $category['icon'] }} shrink-0 fill-current text-amber-500 mr-2"></i>
<span
class="text-sm font-medium text-amber-500"><?php echo e($category['label']); ?></span>
class="text-sm font-medium text-amber-500">{{ $category['label'] }}</span>
</div>
</li>
<?php endforeach; ?>
@endforeach
</ul>
</div>
</div>
@@ -60,27 +59,25 @@
<div class="md:py-8">
<div class="space-y-2">
<?php $__empty_1 = true; ?>
<?php foreach($news as $post): ?>
<?php $__empty_1 = false; ?>
<article wire:key="post_<?php echo e($post->id); ?>"
@forelse($news as $post)
<article wire:key="post_{{ $post->id }}"
class="bg-white dark:bg-gray-800 shadow-sm rounded-xl p-5">
<div class="flex flex-start space-x-4">
<!-- Avatar -->
<div class="shrink-0 mt-1.5">
<img class="w-8 h-8 rounded-full"
src="<?php echo e($post->einundzwanzigPleb->profile?->picture ?? asset('einundzwanzig-alpha.jpg')); ?>"
src="{{ $post->einundzwanzigPleb->profile?->picture ?? asset('einundzwanzig-alpha.jpg') }}"
width="32" height="32"
alt="<?php echo e($post->einundzwanzigPleb->profile?->name); ?>">
alt="{{ $post->einundzwanzigPleb->profile?->name }}">
</div>
<!-- Content -->
<div class="grow">
<!-- Title -->
<h2 class="font-semibold text-gray-800 dark:text-gray-100 mb-2">
<?php echo e($post->name); ?>
{{ $post->name }}
</h2>
<p class="mb-6">
<?php echo e($post->description); ?>
{{ $post->description }}
</p>
<!-- Footer -->
<footer class="flex flex-wrap text-sm">
@@ -95,14 +92,14 @@
<path
d="M15.686 5.708 10.291.313c-.4-.4-.999-.4-1.399 0s-.4 1 0 1.399l.6.6-6.794 3.696-1-1C1.299 4.61.7 4.61.3 5.009c-.4.4-.4 1 0 1.4l1.498 1.498 2.398 2.398L.6 14.001 2 15.4l3.696-3.697L9.692 15.7c.5.5 1.199.2 1.398 0 .4-.4.4-1 0-1.4l-.999-.998 3.697-6.695.6.6c.599.6 1.199.2 1.398 0 .3-.4.3-1.1-.1-1.499Zm-7.193 6.095L4.196 7.507l6.695-3.697 1.298 1.299-3.696 6.694Z"></path>
</svg>
<?php echo e($post->einundzwanzigPleb->profile->name); ?>
{{ $post->einundzwanzigPleb->profile->name }}
</div>
</div>
</div>
<div
class="flex items-center after:block after:content-['·'] last:after:content-[''] after:text-sm after:text-gray-400 dark:after:text-gray-600 after:px-2">
<span
class="text-gray-500"><?php echo e($post->created_at->format('d.m.Y')); ?></span>
class="text-gray-500">{{ $post->created_at->format('d.m.Y') }}</span>
</div>
</footer>
</div>
@@ -114,21 +111,21 @@
:href="url()->temporarySignedRoute('dl', now()->addMinutes(30), ['media' => $post->getFirstMedia('pdf')])"
label="Öffnen"
primary icon="cloud-arrow-down"/>
<?php if($canEdit): ?>
@if($canEdit)
<x-button
xs
wire:click="delete(<?php echo e($post->id); ?>)"
wire:click="delete({{ $post->id }})"
wire:loading.attr="disabled"
label="Löschen"
negative icon="trash"/>
<?php endif; ?>
@endif
</div>
</article>
<?php endforeach; ?>
<?php if($__empty_1): ?>
@empty
<article class="bg-white dark:bg-gray-800 shadow-sm rounded-xl p-5">
<p>Keine News vorhanden.</p>
</article>
<?php endif; ?>
@endforelse
</div>
</div>
@@ -145,27 +142,20 @@
<!-- Blocks -->
<div class="space-y-4">
<?php if($canEdit): ?>
@if($canEdit)
<div class="bg-white dark:bg-gray-800 p-4 rounded-xl">
<div
class="text-xs font-semibold text-gray-400 dark:text-gray-500 uppercase mb-4">
News anlegen
</div>
<div class="mt-4 flex flex-col space-y-2">
<div>
<div wire:dirty>
<input class="text-gray-200" type="file" wire:model="file">
<?php $__errorArgs = ['file'];
$__bag = $errors->getBag($__errorProps ?? 'default');
if ($__bag->has($__errorArgs)) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs); ?>
<span class="text-red-500"><?php echo e($message); ?></span>
<?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
@error('file')
<span class="text-red-500">{{ $message }}</span>
@enderror
</div>
<div>
<div wire:dirty>
<x-native-select
wire:model="form.category"
label="Kategorie"
@@ -174,10 +164,10 @@ unset($__errorArgs, $__bag); ?>
option-label="label" option-value="value"
/>
</div>
<div>
<div wire:dirty>
<x-input label="Titel" wire:model="form.name"/>
</div>
<div>
<div wire:dirty>
<x-textarea
description="optional"
label="Beschreibung" wire:model="form.description"/>
@@ -189,7 +179,7 @@ unset($__errorArgs, $__bag); ?>
</button>
</div>
</div>
<?php endif; ?>
@endif
</div>
</div>
@@ -199,7 +189,7 @@ unset($__errorArgs, $__bag); ?>
</div>
</div>
<?php else: ?>
@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">
@@ -212,6 +202,6 @@ unset($__errorArgs, $__bag); ?>
</div>
</div>
</div>
<?php endif; ?>
@endif
</div>
</x-layouts.app>

View File

@@ -199,7 +199,7 @@
<div class="sm:flex sm:items-center space-y-4 sm:space-y-0 sm:space-x-4 mt-5">
<div class="sm:w-1/2 flex flex-col space-y-2">
<div class="flex items-center space-x-2">
<div>
<div wire:dirty>
<x-checkbox wire:model="form.check"
label="Ich stimme den Vereins-Statuten zu"/>
</div>
@@ -240,6 +240,7 @@
class="flex flex-col sm:flex-row space-y-2 sm:space-y-0 sm:space-x-2 text-amber-500">
<x-toggle xl warning
wire:model.live="no"
wire:dirty
label="NEIN">
<x-slot name="description">
<span class="py-2 text-amber-500">Ich informiere mich selbst in der News Sektion und gebe keine E-Mail Adresse raus.</span>
@@ -249,8 +250,8 @@
@if($showEmail)
<div wire:key="showEmail"
class="flex flex-col sm:flex-row space-y-2 sm:space-y-0 sm:space-x-2">
<x-input wire:model.live.debounce="fax" label="Fax-Nummer"/>
<x-input wire:model.live.debounce="email"
<x-input wire:model.live.debounce="fax" wire:dirty label="Fax-Nummer"/>
<x-input wire:model.live.debounce="email" wire:dirty
label="E-Mail Adresse"/>
</div>
<div wire:key="showSave" class="flex space-x-2 mt-2">

View File

@@ -1,102 +1,74 @@
<x-layouts.app title="Neuer Vorschlag für eine Unterstützung">
<x-layouts.app title="{{ __('Projektförderung anlegen') }}">
<div>
<?php if($isAllowed): ?>
@if($isAllowed)
<div class="px-4 sm:px-6 lg:px-8 py-8 w-full max-w-9xl mx-auto">
<form class="space-y-8 divide-y divide-gray-700 pb-24">
<div class="space-y-8 divide-y divide-gray-700 sm:space-y-5">
<div class="mt-6 sm:mt-5 space-y-6 sm:space-y-5">
<x-input.group :for=" md5('image')" :label="__('Bild')">
<div class="py-4">
<?php if ($image && method_exists($image, 'temporaryUrl') && str($image->getMimeType())->contains(['image/jpeg','image/jpg', 'image/png', 'image/gif', 'image/svg+xml', 'image/webp'])): ?>
<div class="text-gray-200">{{ __('Preview') }}:</div>
<img class="h-48 object-contain" src="<?php echo e($image->temporaryUrl()); ?>">
<?php endif; ?>
<?php if (isset($projectProposal) && $projectProposal->getFirstMediaUrl('main')): ?>
<div class="text-gray-200">{{ __('Current picture') }}:</div>
<img class="h-48 object-contain"
src="<?php echo e($projectProposal->getFirstMediaUrl('main')); ?>">
<?php endif; ?>
</div>
<input class="text-gray-200" type="file" wire:model="image">
<?php $__errorArgs = ['image'];
$__bag = $errors->getBag($__errorProps ?? 'default');
if ($__bag->has($__errorArgs)) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs); ?>
<span class="text-red-500"><?php echo e($message); ?></span>
<?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
</x-input.group>
<x-input.group :for="md5('form.name')" :label="__('Name')">
<x-input autocomplete="off" wire:model.debounce="form.name"
:placeholder="__('Name')"/>
</x-input.group>
<x-input.group :for="md5('form.website')" :label="__('Webseite des Projekts')">
<x-input autocomplete="off" wire:model.debounce="form.website"
:placeholder="__('Website')"
description="Eine valide URL beginnt immer mit https://"
/>
</x-input.group>
<x-input.group :for="md5('form.name')" :label="__('Beabsichtigte Unterstützung in Sats')">
<x-input type="number" autocomplete="off" wire:model.debounce="form.support_in_sats"
:placeholder="__('Beabsichtigte Unterstützung in Sats')"/>
</x-input.group>
<x-input.group :for="md5('form.description')">
<x-slot name="label">
<div>
<?php echo e(__('Beschreibung')); ?>
</div>
<div
class="text-amber-500 text-xs py-2"><?php echo e(__('Bitte verfasse einen ausführlichen und verständlichen Antragstext, damit die Abstimmung über eine mögliche Förderung erfolgen kann.')); ?></div>
</x-slot>
<div
class="text-amber-500 text-xs py-2"><?php echo e(__('Für Bilder in Markdown verwende bitte z.B. Imgur oder einen anderen Anbieter.')); ?></div>
<x-input.simple-mde model="form.description"/>
<?php $__errorArgs = ['form.description'];
$__bag = $errors->getBag($__errorProps ?? 'default');
if ($__bag->has($__errorArgs)) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs); ?>
<span class="text-red-500 py-2"><?php echo e($message); ?></span>
<?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
</x-input.group>
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 anlegen
</h1>
</div>
</div>
<x-input.group :for="md5('save')" label="">
<x-button secondary :href="route('association.projectSupport')">
<i class="fa fa-thin fa-arrow-left"></i>
<?php echo e(__('Zurück')); ?>
</x-button>
<x-button primary wire:click="save">
<i class="fa fa-thin fa-save"></i>
<?php echo e(__('Save')); ?>
</x-button>
</x-input.group>
<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="save"
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>
</form>
</div>
<?php 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">
Projekt-Unterstützung</h3>
<p class="mt-1 max-w">
Du bist nicht berechtigt, die Projekt-Unterstützungen zu bearbeiten.
<!-- 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">
Fülle das Formular aus, um eine neue Projektförderung anzulegen.
</p>
</div>
</div>
</div>
<?php endif; ?>
</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, eine Projektförderung anzulegen.
</p>
</div>
</div>
</div>
@endif
</div>
</x-layouts.app>

View File

@@ -1,111 +1,74 @@
<x-layouts.app title="<?php echo e($projectProposal->name); ?>">
<x-layouts.app title="{{ __('Projektförderung bearbeiten') }}">
<div>
<?php if($isAllowed): ?>
@if($isAllowed)
<div class="px-4 sm:px-6 lg:px-8 py-8 w-full max-w-9xl mx-auto">
<form class="space-y-8 divide-y divide-gray-700 pb-24">
<div class="space-y-8 divide-y divide-gray-700 sm:space-y-5">
<div class="mt-6 sm:mt-5 space-y-6 sm:space-y-5">
<x-input.group :for=" md5('image')" :label="__('Bild')">
<div class="py-4">
<?php if ($image && method_exists($image, 'temporaryUrl') && str($image->getMimeType())->contains(['image/jpeg','image/jpg', 'image/png', 'image/gif', 'image/svg+xml', 'image/webp'])): ?>
<div class="text-gray-200">{{ __('Preview') }}:</div>
<img class="h-48 object-contain" src="<?php echo e($image->temporaryUrl()); ?>">
<?php endif; ?>
<?php if (isset($projectProposal) && $projectProposal->getFirstMediaUrl('main')): ?>
<div class="text-gray-200">{{ __('Current picture') }}:</div>
<img class="h-48 object-contain"
src="<?php echo e($projectProposal->getFirstMediaUrl('main')); ?>">
<?php endif; ?>
</div>
<input class="text-gray-200" type="file" wire:model="image">
<?php $__errorArgs = ['image'];
$__bag = $errors->getBag($__errorProps ?? 'default');
if ($__bag->has($__errorArgs)) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs); ?>
<span class="text-red-500"><?php echo e($message); ?></span>
<?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
</x-input.group>
<x-input.group :for="md5('form.name')" :label="__('Name')">
<x-input autocomplete="off" wire:model.debounce="form.name"
:placeholder="__('Name')"/>
</x-input.group>
<x-input.group :for="md5('form.website')" :label="__('Webseite des Projekts')">
<x-input autocomplete="off" wire:model.debounce="form.website"
:placeholder="__('Website')"
description="Eine valide URL beginnt immer mit https://"
/>
</x-input.group>
<x-input.group :for="md5('form.name')" :label="__('Beabsichtigte Unterstützung in Sats')">
<x-input type="number" autocomplete="off" wire:model.debounce="form.support_in_sats"
:placeholder="__('Beabsichtigte Unterstützung in Sats')"/>
</x-input.group>
<x-input.group :for="md5('form.accepted')" :label="__('Wurde angenommen')">
<x-checkbox autocomplete="off" wire:model.debounce="form.accepted"/>
</x-input.group>
<x-input.group :for="md5('form.sats_paid')" :label="__('Letztendlich bezahlte Satoshis')">
<x-input autocomplete="off" wire:model.debounce="form.sats_paid"
:placeholder="__('Satoshi-Anzahl')"/>
</x-input.group>
<x-input.group :for="md5('form.description')">
<x-slot name="label">
<div>
<?php echo e(__('Beschreibung')); ?>
</div>
<div
class="text-amber-500 text-xs py-2"><?php echo e(__('Bitte verfasse einen ausführlichen und verständlichen Antragstext, damit die Abstimmung über eine mögliche Förderung erfolgen kann.')); ?></div>
</x-slot>
<div
class="text-amber-500 text-xs py-2"><?php echo e(__('Für Bilder in Markdown verwende bitte z.B. Imgur oder einen anderen Anbieter.')); ?></div>
<x-input.simple-mde model="form.description"/>
<?php $__errorArgs = ['form.description'];
$__bag = $errors->getBag($__errorProps ?? 'default');
if ($__bag->has($__errorArgs)) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs); ?>
<span class="text-red-500 py-2"><?php echo e($message); ?></span>
<?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
</x-input.group>
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>
<x-input.group :for="md5('save')" label="">
<x-button secondary :href="route('association.projectSupport')">
<i class="fa fa-thin fa-arrow-left"></i>
<?php echo e(__('Zurück')); ?>
</x-button>
<x-button primary wire:click="save">
<i class="fa fa-thin fa-save"></i>
<?php echo e(__('Speichern')); ?>
</x-button>
</x-input.group>
<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>
</form>
</div>
<?php 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">
Projekt-Unterstützung</h3>
<p class="mt-1 max-w">
Du bist nicht berechtigt, die Projekt-Unterstützungen zu bearbeiten.
<!-- 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>
<?php endif; ?>
</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>
</x-layouts.app>

View File

@@ -1,157 +1,85 @@
<x-layouts.app
:seo="new SEOData(title: 'Unterstützung für: ' . $projectProposal->name, description: $projectProposal->accepted ? 'Wurde mit ' . number_format($projectProposal->sats_paid, 0, ',', '.') . ' Satoshis unterstützt!' :str($projectProposal->description)->limit(100, '...', true), image: $projectProposal->getFirstMediaUrl('main'))">
:seo="new \RalphJSmit\Laravel\SEO\Support\SEOData(title: 'Projektförderung ' . $project->name, description: $project->description)"
>
<div>
<?php if($projectProposal->accepted || $isAllowed): ?>
<div class="px-4 sm:px-6 lg:px-8 py-8 w-full">
<!-- Page content -->
<div class="max-w-5xl mx-auto flex flex-col lg:flex-row lg:space-x-8 xl:space-x-16">
<!-- Content -->
<div>
<div class="mb-6">
<a class="btn-sm px-3 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"
href="<?php echo e(route('association.projectSupport')); ?>"
>
<svg class="fill-current text-gray-400 dark:text-gray-500 mr-2" width="7" height="12"
viewBox="0 0 7 12">
<path d="M5.4.6 6.8 2l-4 4 4 4-1.4 1.4L0 6z"></path>
</svg>
<span>Zurück zur Übersicht</span>
</a>
</div>
<div class="text-sm font-semibold text-violet-500 uppercase mb-2">
<?php echo e($projectProposal->created_at->translatedFormat('d.m.Y')); ?>
</div>
<header class="mb-4">
<!-- Title -->
<h1 class="text-2xl md:text-3xl text-gray-800 dark:text-gray-100 font-bold mb-2">
<?php echo e($projectProposal->name); ?>
</h1>
<x-markdown>
<?php echo $projectProposal->description; ?>
</x-markdown>
</header>
<div class="space-y-3 sm:flex sm:items-center sm:justify-between sm:space-y-0 mb-6">
<!-- Author -->
<div class="flex items-center sm:mr-4">
<a class="block mr-2 shrink-0" href="#0">
<img class="rounded-full"
src="<?php echo e($projectProposal->einundzwanzigPleb->profile?->picture ?? asset('einundzwanzig-alpha.jpg')); ?>"
width="32" height="32" alt="User 04">
</a>
<div class="text-sm whitespace-nowrap">Eingereicht von
<div
class="font-semibold text-gray-800 dark:text-gray-100"><?php echo e($projectProposal->einundzwanzigPleb?->profile->name ?? str($projectProposal->einundzwanzigPleb->npub)->limit(32)); ?></div>
</div>
</div>
<!-- Right side -->
<div class="flex flex-wrap items-center sm:justify-end space-x-2">
<!-- Tags -->
<div
class="text-xs inline-flex items-center font-medium border border-gray-200 dark:border-gray-700/60 text-gray-600 dark:text-gray-400 rounded-full text-center px-2.5 py-1">
<a target="_blank" href="<?php echo e($projectProposal->website); ?>"><span>Webseite</span></a>
</div>
<div
class="text-xs inline-flex font-medium uppercase bg-green-500/20 text-green-700 rounded-full text-center px-2.5 py-1">
<?php echo e(number_format($projectProposal->support_in_sats, 0, ',', '.')); ?> Sats
</div>
</div>
</div>
<figure class="mb-6">
<img class="rounded-sm h-48" src="<?php echo e($projectProposal->getFirstMediaUrl('main')); ?>"
alt="Picture">
</figure>
<hr class="my-6 border-t border-gray-100 dark:border-gray-700/60">
</div>
<?php if($isAllowed && !$projectProposal->accepted): ?>
<!-- Sidebar -->
<div class="space-y-4">
<!-- 1st block -->
<div class="bg-white dark:bg-gray-800 p-5 shadow-sm rounded-xl lg:w-72 xl:w-80">
<?php if(!$ownVoteExists): ?>
<div class="space-y-2">
<button
wire:click="approve"
class="btn w-full bg-gray-900 text-gray-100 hover:bg-gray-800 dark:bg-gray-100 dark:text-gray-800 dark:hover:bg-white">
<i class="fill-current shrink-0 fa-sharp-duotone fa-solid fa-thumbs-up"></i>
<span class="ml-1">Zustimmen</span>
</button>
<button
wire:click="notApprove"
class="btn w-full bg-red-900 text-red-100 hover:bg-red-800 dark:bg-red-100 dark:text-red-800 dark:hover:bg-red-400">
<i class="fill-current shrink-0 fa-sharp-duotone fa-solid fa-thumbs-down"></i>
<span class="ml-1">Ablehnen</span>
</button>
</div>
<?php else: ?>
<div class="space-y-2">
<p>Du hast bereits abgestimmt.</p>
</div>
<?php endif; ?>
</div>
<!-- 2nd block -->
<div class="bg-white dark:bg-gray-800 p-5 shadow-sm rounded-xl lg:w-72 xl:w-80">
<div class="flex justify-between space-x-1 mb-5">
<div class="text-sm text-gray-800 dark:text-gray-100 font-semibold">
Zustimmungen des Vorstands (<?php echo e(count($boardVotes->where('value', 1))); ?>)
</div>
</div>
</div>
<!-- 2nd block -->
<div class="bg-white dark:bg-gray-800 p-5 shadow-sm rounded-xl lg:w-72 xl:w-80">
<div class="flex justify-between space-x-1 mb-5">
<div class="text-sm text-gray-800 dark:text-gray-100 font-semibold">
Ablehnungen des Vorstands (<?php echo e(count($boardVotes->where('value', 0))); ?>)
</div>
</div>
</div>
<!-- 3rd block -->
<div class="bg-white dark:bg-gray-800 p-5 shadow-sm rounded-xl lg:w-72 xl:w-80">
<div class="flex justify-between space-x-1 mb-5">
<div class="text-sm text-gray-800 dark:text-gray-100 font-semibold">
Zustimmungen der übrigen Mitglieder (<?php echo e(count($otherVotes->where('value', 1))); ?>)
</div>
</div>
</div>
<!-- 3rd block -->
<div class="bg-white dark:bg-gray-800 p-5 shadow-sm rounded-xl lg:w-72 xl:w-80">
<div class="flex justify-between space-x-1 mb-5">
<div class="text-sm text-gray-800 dark:text-gray-100 font-semibold">
Ablehnungen der übrigen Mitglieder (<?php echo e(count($otherVotes->where('value', 0))); ?>)
</div>
</div>
</div>
</div>
<?php endif; ?>
</div>
</div>
<?php else: ?>
@if($isAllowed)
<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">
Projekt-Unterstützung
</h3>
<p class="mt-1 max-w">
Du bist nicht berechtigt, die Projekt-Unterstützungen einzusehen.
<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>
<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>
<?php endif; ?>
</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>
</x-layouts.app>

View File

@@ -23,9 +23,7 @@
<div>
Beschreibung: {{ $event['content'] }}
</div>
<div>
@dump($event)
</div>
</div>
</div>
</li>