feat(election): add access control for election details and voting options based on user permissions.

This commit is contained in:
fsociety
2024-10-25 13:30:39 +02:00
parent 3936165a0e
commit 421d60e42b
8 changed files with 1049 additions and 926 deletions

View File

@@ -1,6 +1,5 @@
export default (livewireComponent) => ({ export default (livewireComponent) => ({
isAllowed: livewireComponent.entangle('isAllowed', true),
signThisEvent: livewireComponent.entangle('signThisEvent'), signThisEvent: livewireComponent.entangle('signThisEvent'),
showLog: livewireComponent.entangle('showLog', true), showLog: livewireComponent.entangle('showLog', true),

View File

@@ -54,20 +54,36 @@ $saveElection = function ($index) {
<x-layouts.app title="{{ __('Wahlen') }}"> <x-layouts.app title="{{ __('Wahlen') }}">
@volt @volt
<div x-cloak class="relative flex h-full" x-show="isAllowed" x-data="{isAllowed: $wire.entangle('isAllowed').live}"> <div>
@foreach($elections as $election) @if($isAllowed)
<div class="w-full sm:w-1/3 p-4"> <div class="relative flex h-full">
<div class="shadow-lg rounded-lg overflow-hidden"> @foreach($elections as $election)
{{ $election['year'] }} <div class="w-full sm:w-1/3 p-4">
</div> <div class="shadow-lg rounded-lg overflow-hidden">
<div class="shadow-lg rounded-lg overflow-hidden"> {{ $election['year'] }}
<x-textarea wire:model="elections.{{ $loop->index }}.candidates" rows="25" label="candidates" placeholder="" /> </div>
</div> <div class="shadow-lg rounded-lg overflow-hidden">
<div class="py-2"> <x-textarea wire:model="elections.{{ $loop->index }}.candidates" rows="25"
<x-button label="Speichern" wire:click="saveElection({{ $loop->index }})"/> label="candidates" placeholder=""/>
</div>
<div class="py-2">
<x-button label="Speichern" wire:click="saveElection({{ $loop->index }})"/>
</div>
</div>
@endforeach
</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">Einstellungen</h3>
<p class="mt-1 max-w">
Du bist nicht berechtigt, die Einstellungen zu bearbeiten.
</p>
</div>
</div> </div>
</div> </div>
@endforeach @endif
</div> </div>
@endvolt @endvolt
</x-layouts.app> </x-layouts.app>

View File

@@ -48,8 +48,23 @@ on([
<x-layouts.app title="{{ __('Mitglieder') }}"> <x-layouts.app title="{{ __('Mitglieder') }}">
@volt @volt
<div class="px-4 sm:px-6 lg:px-8 py-8 w-full max-w-9xl mx-auto" x-show="isAllowed" x-data="{isAllowed: $wire.entangle('isAllowed').live}" x-cloak> <div>
<livewire:einundzwanzig-pleb-table/> @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>
@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">Mitglieder</h3>
<p class="mt-1 max-w">
Du bist nicht berechtigt, Mitglieder zu bearbeiten.
</p>
</div>
</div>
</div>
@endif
</div> </div>
@endvolt @endvolt
</x-layouts.app> </x-layouts.app>

View File

@@ -112,189 +112,213 @@ $handleNotApprove = function () {
?> ?>
<x-layouts.app :seo="new SEOData(title: 'Unterstützung für: ' . $projectProposal->name,description: str($projectProposal->description)->limit(100, '...', true), image: $projectProposal->getFirstMediaUrl('main'))"> <x-layouts.app
:seo="new SEOData(title: 'Unterstützung für: ' . $projectProposal->name,description: str($projectProposal->description)->limit(100, '...', true), image: $projectProposal->getFirstMediaUrl('main'))">
@volt @volt
<div class="px-4 sm:px-6 lg:px-8 py-8 w-full" x-data="nostrDefault(@this)" x-cloak <div>
x-show="isAllowed"> @if($isAllowed)
<div class="px-4 sm:px-6 lg:px-8 py-8 w-full">
<!-- Page content --> <!-- Page content -->
<div class="max-w-5xl mx-auto flex flex-col lg:flex-row lg:space-x-8 xl:space-x-16"> <div class="max-w-5xl mx-auto flex flex-col lg:flex-row lg:space-x-8 xl:space-x-16">
<!-- Content --> <!-- Content -->
<div> <div>
<div class="mb-6"> <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" <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="{{ route('association.projectSupport') }}" href="{{ route('association.projectSupport') }}"
> >
<svg class="fill-current text-gray-400 dark:text-gray-500 mr-2" width="7" height="12" <svg class="fill-current text-gray-400 dark:text-gray-500 mr-2" width="7" height="12"
viewBox="0 0 7 12"> viewBox="0 0 7 12">
<path d="M5.4.6 6.8 2l-4 4 4 4-1.4 1.4L0 6z"></path> <path d="M5.4.6 6.8 2l-4 4 4 4-1.4 1.4L0 6z"></path>
</svg> </svg>
<span>Zurück zur Übersicht</span> <span>Zurück zur Übersicht</span>
</a> </a>
</div>
<div class="text-sm font-semibold text-violet-500 uppercase mb-2">
{{ $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">
{{ $projectProposal->name }}
</h1>
<x-markdown>
{!! $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="{{ $projectProposal->einundzwanzigPleb->profile->picture }}"
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">{{ $projectProposal->einundzwanzigPleb->profile->name }}</div>
</div> </div>
</div> <div class="text-sm font-semibold text-violet-500 uppercase mb-2">
<!-- Right side --> {{ $projectProposal->created_at->translatedFormat('d.m.Y') }}
<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="{{ $projectProposal->website }}"><span>Webseite</span></a>
</div> </div>
<div <header class="mb-4">
class="text-xs inline-flex font-medium uppercase bg-green-500/20 text-green-700 rounded-full text-center px-2.5 py-1"> <!-- Title -->
{{ number_format($projectProposal->support_in_sats, 0, ',', '.') }} Sats <h1 class="text-2xl md:text-3xl text-gray-800 dark:text-gray-100 font-bold mb-2">
</div> {{ $projectProposal->name }}
</div> </h1>
</div> <x-markdown>
{!! $projectProposal->description !!}
</x-markdown>
</header>
<figure class="mb-6"> <div class="space-y-3 sm:flex sm:items-center sm:justify-between sm:space-y-0 mb-6">
<img class="rounded-sm h-48" src="{{ $projectProposal->getFirstMediaUrl('main') }}" alt="Meetup"> <!-- Author -->
</figure> <div class="flex items-center sm:mr-4">
<a class="block mr-2 shrink-0" href="#0">
<hr class="my-6 border-t border-gray-100 dark:border-gray-700/60"> <img class="rounded-full"
src="{{ $projectProposal->einundzwanzigPleb->profile->picture }}"
<!-- Reasons --> width="32" height="32" alt="User 04">
<div>
<h2 class="text-xl leading-snug text-gray-800 dark:text-gray-100 font-bold mb-2">
Ablehnungen ({{ count($reasons) }})
</h2>
<ul class="space-y-5 my-6">
@foreach($reasons as $reason)
<li class="flex items-start">
<a class="block mr-3 shrink-0" href="#0">
<img class="rounded-full" src="{{ $reason->einundzwanzigPleb->profile->picture }}"
width="32" height="32"
alt="{{ $reason->einundzwanzigPleb->profile->name }}">
</a> </a>
<div class="grow"> <div class="text-sm whitespace-nowrap">Eingereicht von
<div class="text-sm font-semibold text-gray-800 dark:text-gray-100 mb-2"> <div
{{ $reason->einundzwanzigPleb->profile->name }} class="font-semibold text-gray-800 dark:text-gray-100">{{ $projectProposal->einundzwanzigPleb->profile->name }}</div>
</div>
<div class="italic">{{ $reason->reason }}</div>
</div> </div>
</li> </div>
@endforeach <!-- Right side -->
</ul> <div class="flex flex-wrap items-center sm:justify-end space-x-2">
</div> <!-- Tags -->
<div
</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="{{ $projectProposal->website }}"><span>Webseite</span></a>
<!-- Sidebar --> </div>
<div class="space-y-4"> <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">
<!-- 1st block --> {{ number_format($projectProposal->support_in_sats, 0, ',', '.') }} Sats
<div class="bg-white dark:bg-gray-800 p-5 shadow-sm rounded-xl lg:w-72 xl:w-80"> </div>
@if(!$ownVoteExists) </div>
<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>
<x-textarea wire:model="form.reason" label="Grund für deine Ablehnung"/>
</div> </div>
@else
<div class="space-y-2">
<p>Du hast bereits abgestimmt.</p>
</div>
@endif
</div>
<!-- 2nd block --> <figure class="mb-6">
<div class="bg-white dark:bg-gray-800 p-5 shadow-sm rounded-xl lg:w-72 xl:w-80"> <img class="rounded-sm h-48" src="{{ $projectProposal->getFirstMediaUrl('main') }}"
<div class="flex justify-between space-x-1 mb-5"> alt="Meetup">
<div class="text-sm text-gray-800 dark:text-gray-100 font-semibold"> </figure>
Zustimmungen des Vorstands ({{ count($boardVotes) }})
</div> <hr class="my-6 border-t border-gray-100 dark:border-gray-700/60">
</div>
<ul class="space-y-3"> <!-- Reasons -->
@foreach($boardVotes as $vote) <div>
<li> <h2 class="text-xl leading-snug text-gray-800 dark:text-gray-100 font-bold mb-2">
<div class="flex justify-between"> Ablehnungen ({{ count($reasons) }})
<div class="grow flex items-center"> </h2>
<div class="relative mr-3"> <ul class="space-y-5 my-6">
<img class="w-8 h-8 rounded-full" @foreach($reasons as $reason)
src="{{ $vote->einundzwanzigPleb->profile->picture }}" width="32" <li class="flex items-start">
height="32" alt="{{ $vote->einundzwanzigPleb->profile->name }}"> <a class="block mr-3 shrink-0" href="#0">
<img class="rounded-full"
src="{{ $reason->einundzwanzigPleb->profile->picture }}"
width="32" height="32"
alt="{{ $reason->einundzwanzigPleb->profile->name }}">
</a>
<div class="grow">
<div class="text-sm font-semibold text-gray-800 dark:text-gray-100 mb-2">
{{ $reason->einundzwanzigPleb->profile->name }}
</div>
<div class="italic">{{ $reason->reason }}</div>
</div> </div>
<div class="truncate"> </li>
@endforeach
</ul>
</div>
</div>
<!-- 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">
@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>
<x-textarea wire:model="form.reason" label="Grund für deine Ablehnung"/>
</div>
@else
<div class="space-y-2">
<p>Du hast bereits abgestimmt.</p>
</div>
@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 ({{ count($boardVotes) }})
</div>
</div>
<ul class="space-y-3">
@foreach($boardVotes as $vote)
<li>
<div class="flex justify-between">
<div class="grow flex items-center">
<div class="relative mr-3">
<img class="w-8 h-8 rounded-full"
src="{{ $vote->einundzwanzigPleb->profile->picture }}"
width="32"
height="32"
alt="{{ $vote->einundzwanzigPleb->profile->name }}">
</div>
<div class="truncate">
<span class="text-sm font-medium text-gray-800 dark:text-gray-100"> <span class="text-sm font-medium text-gray-800 dark:text-gray-100">
{{ $vote->einundzwanzigPleb->profile->name }} {{ $vote->einundzwanzigPleb->profile->name }}
</span> </span>
</div>
</div>
</div> </div>
</div> </li>
</div> @endforeach
</li> </ul>
@endforeach
</ul>
</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 ({{ count($otherVotes) }})
</div> </div>
</div>
<ul class="space-y-3"> <!-- 3rd block -->
@foreach($otherVotes as $vote) <div class="bg-white dark:bg-gray-800 p-5 shadow-sm rounded-xl lg:w-72 xl:w-80">
<li> <div class="flex justify-between space-x-1 mb-5">
<div class="flex items-center justify-between"> <div class="text-sm text-gray-800 dark:text-gray-100 font-semibold">
<div class="grow flex items-center"> Zustimmungen der übrigen Mitglieder ({{ count($otherVotes) }})
<div class="relative mr-3"> </div>
<img class="w-8 h-8 rounded-full" </div>
src="{{ $vote->einundzwanzigPleb->profile->picture }}" width="32" <ul class="space-y-3">
height="32" alt="{{ $vote->einundzwanzigPleb->profile->name }}"> @foreach($otherVotes as $vote)
</div> <li>
<div class="truncate"> <div class="flex items-center justify-between">
<div class="grow flex items-center">
<div class="relative mr-3">
<img class="w-8 h-8 rounded-full"
src="{{ $vote->einundzwanzigPleb->profile->picture }}"
width="32"
height="32"
alt="{{ $vote->einundzwanzigPleb->profile->name }}">
</div>
<div class="truncate">
<span <span
class="text-sm font-medium text-gray-800 dark:text-gray-100"> class="text-sm font-medium text-gray-800 dark:text-gray-100">
{{ $vote->einundzwanzigPleb->profile->name }} {{ $vote->einundzwanzigPleb->profile->name }}
</span> </span>
</div>
</div>
</div> </div>
</div> </li>
</div> @endforeach
</li> </ul>
@endforeach </div>
</ul>
</div>
</div> </div>
</div> </div>
@else
</div> <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.
</p>
</div>
</div>
</div>
@endif
</div> </div>
@endvolt @endvolt
</x-layouts.app> </x-layouts.app>

View File

@@ -72,72 +72,86 @@ $save = function () {
<x-layouts.app title="{{ $projectProposal->name }}"> <x-layouts.app title="{{ $projectProposal->name }}">
@volt @volt
<div x-cloak x-show="isAllowed" class="px-4 sm:px-6 lg:px-8 py-8 w-full max-w-9xl mx-auto" <div>
x-data="nostrDefault(@this)"> @if($isAllowed)
<form class="space-y-8 divide-y divide-gray-700 pb-24"> <div class="px-4 sm:px-6 lg:px-8 py-8 w-full max-w-9xl mx-auto">
<div class="space-y-8 divide-y divide-gray-700 sm:space-y-5"> <form class="space-y-8 divide-y divide-gray-700 pb-24">
<div class="mt-6 sm:mt-5 space-y-6 sm:space-y-5"> <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')"> <x-input.group :for=" md5('image')" :label="__('Bild')">
<div class="py-4"> <div class="py-4">
@if ($image && method_exists($image, 'temporaryUrl') && str($image->getMimeType())->contains(['image/jpeg','image/jpg', 'image/png', 'image/gif', 'image/svg+xml', 'image/webp'])) @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> <div class="text-gray-200">{{ __('Preview') }}:</div>
<img class="h-48 object-contain" src="{{ $image->temporaryUrl() }}"> <img class="h-48 object-contain" src="{{ $image->temporaryUrl() }}">
@endif @endif
@if (isset($projectProposal) && $projectProposal->getFirstMediaUrl('main')) @if (isset($projectProposal) && $projectProposal->getFirstMediaUrl('main'))
<div class="text-gray-200">{{ __('Current picture') }}:</div> <div class="text-gray-200">{{ __('Current picture') }}:</div>
<img class="h-48 object-contain" src="{{ $projectProposal->getFirstMediaUrl('main') }}"> <img class="h-48 object-contain" src="{{ $projectProposal->getFirstMediaUrl('main') }}">
@endif @endif
</div>
<input class="text-gray-200" type="file" wire:model="image">
@error('image') <span class="text-red-500">{{ $message }}</span> @enderror
</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>
{{ __('Beschreibung') }}
</div>
<div
class="text-amber-500 text-xs py-2">{{ __('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">{{ __('Für Bilder in Markdown verwende bitte z.B. Imgur oder einen anderen Anbieter.') }}</div>
<x-input.simple-mde model="form.description"/>
@error('form.description') <span
class="text-red-500 py-2">{{ $message }}</span> @enderror
</x-input.group>
<x-input.group :for="md5('save')" label="">
<x-button secondary :href="route('association.projectSupport')">
<i class="fa fa-thin fa-arrow-left"></i>
{{ __('Zurück') }}
</x-button>
<x-button primary wire:click="save">
<i class="fa fa-thin fa-save"></i>
{{ __('Speichern') }}
</x-button>
</x-input.group>
</div> </div>
<input class="text-gray-200" type="file" wire:model="image"> </div>
@error('image') <span class="text-red-500">{{ $message }}</span> @enderror </form>
</x-input.group> </div>
@else
<x-input.group :for="md5('form.name')" :label="__('Name')"> <div class="px-4 sm:px-6 lg:px-8 py-8 w-full max-w-9xl mx-auto">
<x-input autocomplete="off" wire:model.debounce="form.name" <div class="bg-white dark:bg-[#1B1B1B] shadow overflow-hidden sm:rounded-lg">
:placeholder="__('Name')"/> <div class="px-4 py-5 sm:px-6">
</x-input.group> <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">
<x-input.group :for="md5('form.website')" :label="__('Webseite des Projekts')"> Du bist nicht berechtigt, die Projekt-Unterstützungen zu bearbeiten.
<x-input autocomplete="off" wire:model.debounce="form.website" </p>
:placeholder="__('Website')" </div>
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>
{{ __('Beschreibung') }}
</div>
<div
class="text-amber-500 text-xs py-2">{{ __('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">{{ __('Für Bilder in Markdown verwende bitte z.B. Imgur oder einen anderen Anbieter.') }}</div>
<x-input.simple-mde model="form.description"/>
@error('form.description') <span
class="text-red-500 py-2">{{ $message }}</span> @enderror
</x-input.group>
<x-input.group :for="md5('save')" label="">
<x-button secondary :href="route('association.projectSupport')">
<i class="fa fa-thin fa-arrow-left"></i>
{{ __('Zurück') }}
</x-button>
<x-button primary wire:click="save">
<i class="fa fa-thin fa-save"></i>
{{ __('Speichern') }}
</x-button>
</x-input.group>
</div> </div>
</div> </div>
</form> @endif
</div> </div>
@endvolt @endvolt
</x-layouts.app> </x-layouts.app>

View File

@@ -64,72 +64,88 @@ $save = function () {
<x-layouts.app title="Neuer Vorschlag für eine Unterstützung"> <x-layouts.app title="Neuer Vorschlag für eine Unterstützung">
@volt @volt
<div x-cloak x-show="isAllowed" class="px-4 sm:px-6 lg:px-8 py-8 w-full max-w-9xl mx-auto" <div>
x-data="nostrDefault(@this)"> @if($isAllowed)
<form class="space-y-8 divide-y divide-gray-700 pb-24"> <div class="px-4 sm:px-6 lg:px-8 py-8 w-full max-w-9xl mx-auto">
<div class="space-y-8 divide-y divide-gray-700 sm:space-y-5"> <form class="space-y-8 divide-y divide-gray-700 pb-24">
<div class="mt-6 sm:mt-5 space-y-6 sm:space-y-5"> <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')"> <x-input.group :for=" md5('image')" :label="__('Bild')">
<div class="py-4"> <div class="py-4">
@if ($image && method_exists($image, 'temporaryUrl') && str($image->getMimeType())->contains(['image/jpeg','image/jpg', 'image/png', 'image/gif', 'image/svg+xml', 'image/webp'])) @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> <div class="text-gray-200">{{ __('Preview') }}:</div>
<img class="h-48 object-contain" src="{{ $image->temporaryUrl() }}"> <img class="h-48 object-contain" src="{{ $image->temporaryUrl() }}">
@endif @endif
@if (isset($projectProposal) && $projectProposal->getFirstMediaUrl('main')) @if (isset($projectProposal) && $projectProposal->getFirstMediaUrl('main'))
<div class="text-gray-200">{{ __('Current picture') }}:</div> <div class="text-gray-200">{{ __('Current picture') }}:</div>
<img class="h-48 object-contain" src="{{ $projectProposal->getFirstMediaUrl('main') }}"> <img class="h-48 object-contain"
@endif src="{{ $projectProposal->getFirstMediaUrl('main') }}">
@endif
</div>
<input class="text-gray-200" type="file" wire:model="image">
@error('image') <span class="text-red-500">{{ $message }}</span> @enderror
</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>
{{ __('Beschreibung') }}
</div>
<div
class="text-amber-500 text-xs py-2">{{ __('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">{{ __('Für Bilder in Markdown verwende bitte z.B. Imgur oder einen anderen Anbieter.') }}</div>
<x-input.simple-mde model="form.description"/>
@error('form.description') <span
class="text-red-500 py-2">{{ $message }}</span> @enderror
</x-input.group>
<x-input.group :for="md5('save')" label="">
<x-button secondary :href="route('association.projectSupport')">
<i class="fa fa-thin fa-arrow-left"></i>
{{ __('Zurück') }}
</x-button>
<x-button primary wire:click="save">
<i class="fa fa-thin fa-save"></i>
{{ __('Save') }}
</x-button>
</x-input.group>
</div> </div>
<input class="text-gray-200" type="file" wire:model="image"> </div>
@error('image') <span class="text-red-500">{{ $message }}</span> @enderror </form>
</x-input.group> </div>
@else
<x-input.group :for="md5('form.name')" :label="__('Name')"> <div class="px-4 sm:px-6 lg:px-8 py-8 w-full max-w-9xl mx-auto">
<x-input autocomplete="off" wire:model.debounce="form.name" <div class="bg-white dark:bg-[#1B1B1B] shadow overflow-hidden sm:rounded-lg">
:placeholder="__('Name')"/> <div class="px-4 py-5 sm:px-6">
</x-input.group> <h3 class="text-lg font-medium leading-6 text-gray-900 dark:text-gray-200">
Projekt-Unterstützung</h3>
<x-input.group :for="md5('form.website')" :label="__('Webseite des Projekts')"> <p class="mt-1 max-w">
<x-input autocomplete="off" wire:model.debounce="form.website" Du bist nicht berechtigt, die Projekt-Unterstützungen zu bearbeiten.
:placeholder="__('Website')" </p>
description="Eine valide URL beginnt immer mit https://" </div>
/>
</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>
{{ __('Beschreibung') }}
</div>
<div
class="text-amber-500 text-xs py-2">{{ __('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">{{ __('Für Bilder in Markdown verwende bitte z.B. Imgur oder einen anderen Anbieter.') }}</div>
<x-input.simple-mde model="form.description"/>
@error('form.description') <span
class="text-red-500 py-2">{{ $message }}</span> @enderror
</x-input.group>
<x-input.group :for="md5('save')" label="">
<x-button secondary :href="route('association.projectSupport')">
<i class="fa fa-thin fa-arrow-left"></i>
{{ __('Zurück') }}
</x-button>
<x-button primary wire:click="save">
<i class="fa fa-thin fa-save"></i>
{{ __('Save') }}
</x-button>
</x-input.group>
</div> </div>
</div> </div>
</form> @endif
</div> </div>
@endvolt @endvolt
</x-layouts.app> </x-layouts.app>

View File

@@ -73,146 +73,164 @@ $delete = function ($id) {
:seo="new \RalphJSmit\Laravel\SEO\Support\SEOData(title: 'Projekt Unterstützungen', description: 'Einundzwanzig Projektunterstützungen')" :seo="new \RalphJSmit\Laravel\SEO\Support\SEOData(title: 'Projekt Unterstützungen', description: 'Einundzwanzig Projektunterstützungen')"
> >
@volt @volt
<div class="px-4 sm:px-6 lg:px-8 py-8 w-full max-w-9xl mx-auto" x-data="nostrDefault(@this)" x-cloak <div>
x-show="show"> @if($isAllowed)
<div class="px-4 sm:px-6 lg:px-8 py-8 w-full max-w-9xl mx-auto">
<!-- Page header --> <!-- Page header -->
<div class="sm:flex sm:justify-between sm:items-center mb-5"> <div class="sm:flex sm:justify-between sm:items-center mb-5">
<!-- Left: Title --> <!-- Left: Title -->
<div class="mb-4 sm:mb-0"> <div class="mb-4 sm:mb-0">
<h1 class="text-2xl md:text-3xl text-gray-800 dark:text-gray-100 font-bold"> <h1 class="text-2xl md:text-3xl text-gray-800 dark:text-gray-100 font-bold">
Einundzwanzig Projektunterstützungen Einundzwanzig Projektunterstützungen
</h1> </h1>
</div> </div>
<!-- Right: Actions --> <!-- Right: Actions -->
<div class="grid grid-cols-1 sm:grid-cols-2 justify-start sm:justify-end gap-2"> <div class="grid grid-cols-1 sm:grid-cols-2 justify-start sm:justify-end gap-2">
<!-- Search form --> <!-- Search form -->
<form class="relative"> <form class="relative">
<x-input type="search" wire:model.live.debounce="search" <x-input type="search" wire:model.live.debounce="search"
placeholder="Suche…"/> placeholder="Suche…"/>
</form> </form>
<!-- Add meetup button --> <!-- Add meetup button -->
@if($currentPleb && $currentPleb->association_status->value > 2) @if($currentPleb && $currentPleb->association_status->value > 2)
<x-button :href="route('association.projectSupport.create')" icon="plus" <x-button :href="route('association.projectSupport.create')" icon="plus"
label="Projekt einreichen"/> label="Projekt einreichen"/>
@endif @endif
</div> </div>
</div> </div>
<!-- Filters --> <!-- Filters -->
{{--<div class="mb-5"> {{--<div class="mb-5">
<ul class="flex flex-wrap -m-1"> <ul class="flex flex-wrap -m-1">
<li class="m-1"> <li class="m-1">
<button class="inline-flex items-center justify-center text-sm font-medium leading-5 rounded-full px-3 py-1 border border-transparent shadow-sm bg-gray-900 dark:bg-gray-100 text-white dark:text-gray-800 transition">View All</button> <button class="inline-flex items-center justify-center text-sm font-medium leading-5 rounded-full px-3 py-1 border border-transparent shadow-sm bg-gray-900 dark:bg-gray-100 text-white dark:text-gray-800 transition">View All</button>
</li> </li>
<li class="m-1"> <li class="m-1">
<button class="inline-flex items-center justify-center text-sm font-medium leading-5 rounded-full px-3 py-1 border border-gray-200 dark:border-gray-700/60 hover:border-gray-300 dark:hover:border-gray-600 shadow-sm bg-white dark:bg-gray-800 text-gray-500 dark:text-gray-400 transition">Online</button> <button class="inline-flex items-center justify-center text-sm font-medium leading-5 rounded-full px-3 py-1 border border-gray-200 dark:border-gray-700/60 hover:border-gray-300 dark:hover:border-gray-600 shadow-sm bg-white dark:bg-gray-800 text-gray-500 dark:text-gray-400 transition">Online</button>
</li> </li>
<li class="m-1"> <li class="m-1">
<button class="inline-flex items-center justify-center text-sm font-medium leading-5 rounded-full px-3 py-1 border border-gray-200 dark:border-gray-700/60 hover:border-gray-300 dark:hover:border-gray-600 shadow-sm bg-white dark:bg-gray-800 text-gray-500 dark:text-gray-400 transition">Local</button> <button class="inline-flex items-center justify-center text-sm font-medium leading-5 rounded-full px-3 py-1 border border-gray-200 dark:border-gray-700/60 hover:border-gray-300 dark:hover:border-gray-600 shadow-sm bg-white dark:bg-gray-800 text-gray-500 dark:text-gray-400 transition">Local</button>
</li> </li>
<li class="m-1"> <li class="m-1">
<button class="inline-flex items-center justify-center text-sm font-medium leading-5 rounded-full px-3 py-1 border border-gray-200 dark:border-gray-700/60 hover:border-gray-300 dark:hover:border-gray-600 shadow-sm bg-white dark:bg-gray-800 text-gray-500 dark:text-gray-400 transition">This Week</button> <button class="inline-flex items-center justify-center text-sm font-medium leading-5 rounded-full px-3 py-1 border border-gray-200 dark:border-gray-700/60 hover:border-gray-300 dark:hover:border-gray-600 shadow-sm bg-white dark:bg-gray-800 text-gray-500 dark:text-gray-400 transition">This Week</button>
</li> </li>
<li class="m-1"> <li class="m-1">
<button class="inline-flex items-center justify-center text-sm font-medium leading-5 rounded-full px-3 py-1 border border-gray-200 dark:border-gray-700/60 hover:border-gray-300 dark:hover:border-gray-600 shadow-sm bg-white dark:bg-gray-800 text-gray-500 dark:text-gray-400 transition">This Month</button> <button class="inline-flex items-center justify-center text-sm font-medium leading-5 rounded-full px-3 py-1 border border-gray-200 dark:border-gray-700/60 hover:border-gray-300 dark:hover:border-gray-600 shadow-sm bg-white dark:bg-gray-800 text-gray-500 dark:text-gray-400 transition">This Month</button>
</li> </li>
<li class="m-1"> <li class="m-1">
<button class="inline-flex items-center justify-center text-sm font-medium leading-5 rounded-full px-3 py-1 border border-gray-200 dark:border-gray-700/60 hover:border-gray-300 dark:hover:border-gray-600 shadow-sm bg-white dark:bg-gray-800 text-gray-500 dark:text-gray-400 transition">Following</button> <button class="inline-flex items-center justify-center text-sm font-medium leading-5 rounded-full px-3 py-1 border border-gray-200 dark:border-gray-700/60 hover:border-gray-300 dark:hover:border-gray-600 shadow-sm bg-white dark:bg-gray-800 text-gray-500 dark:text-gray-400 transition">Following</button>
</li> </li>
</ul> </ul>
</div>--}} </div>--}}
<div class="text-sm text-gray-500 dark:text-gray-400 italic mb-4">{{ count($projects) }} Projekte</div> <div class="text-sm text-gray-500 dark:text-gray-400 italic mb-4">{{ count($projects) }} Projekte</div>
<!-- Content --> <!-- Content -->
<div class="grid xl:grid-cols-2 gap-6 mb-8"> <div class="grid xl:grid-cols-2 gap-6 mb-8">
@foreach($projects as $project) @foreach($projects as $project)
<article <article
wire:key="project_{{ $project->id }}" wire:key="project_{{ $project->id }}"
class="flex bg-white dark:bg-gray-800 shadow-sm rounded-xl overflow-hidden"> class="flex bg-white dark:bg-gray-800 shadow-sm rounded-xl overflow-hidden">
<!-- Image --> <!-- Image -->
<a class="relative block w-24 sm:w-56 xl:sidebar-expanded:w-40 2xl:sidebar-expanded:w-56 shrink-0" <a class="relative block w-24 sm:w-56 xl:sidebar-expanded:w-40 2xl:sidebar-expanded:w-56 shrink-0"
href="{{ route('association.projectSupport.item', ['projectProposal' => $project]) }}"> href="{{ route('association.projectSupport.item', ['projectProposal' => $project]) }}">
<img class="absolute object-cover object-center w-full h-full" <img class="absolute object-cover object-center w-full h-full"
src="{{ $project->getFirstMediaUrl('main') }}" alt="Meetup 01"> src="{{ $project->getFirstMediaUrl('main') }}" alt="Meetup 01">
<button class="absolute top-0 right-0 mt-4 mr-4"> <button class="absolute top-0 right-0 mt-4 mr-4">
<img class="rounded-full h-8 w-8" src="{{ $project->einundzwanzigPleb->profile->picture }}" <img class="rounded-full h-8 w-8"
alt=""> src="{{ $project->einundzwanzigPleb->profile->picture }}"
</button> alt="">
</a> </button>
<!-- Content -->
<div class="grow p-5 flex flex-col">
<div class="grow">
<div class="text-sm font-semibold text-amber-500 uppercase mb-2">
Eingereicht von: {{ $project->einundzwanzigPleb->profile->name }}
</div>
<a class="inline-flex mb-2">
<h3 class="text-lg font-bold text-gray-800 dark:text-gray-100">
{{ $project->name }}
</h3>
</a> </a>
<div class="text-sm line-clamp-6"> <!-- Content -->
{!! strip_tags($project->description) !!} <div class="grow p-5 flex flex-col">
</div> <div class="grow">
</div> <div class="text-sm font-semibold text-amber-500 uppercase mb-2">
<!-- Footer --> Eingereicht von: {{ $project->einundzwanzigPleb->profile->name }}
<div class="flex justify-between items-center mt-3"> </div>
<!-- Tag --> <a class="inline-flex mb-2">
<div <h3 class="text-lg font-bold text-gray-800 dark:text-gray-100">
class="text-xs inline-flex items-center font-bold border border-gray-200 dark:border-gray-700/60 text-gray-600 dark:text-gray-200 rounded-full text-center px-2.5 py-1"> {{ $project->name }}
<span>{{ number_format($project->support_in_sats, 0, ',', '.') }} Sats</span> </h3>
</div> </a>
<div <div class="text-sm line-clamp-6">
class="text-xs inline-flex items-center font-bold border border-gray-200 dark:border-gray-700/60 text-gray-600 dark:text-gray-200 rounded-full text-center px-2.5 py-1"> {!! strip_tags($project->description) !!}
<a href="{{ $project->website }}" target="_blank">Webseite</a>
</div>
<!-- Avatars -->
@if($project->votes->where('value', true)->count() > 0)
<div class="flex items-center space-x-2">
<div class="text-xs font-medium text-gray-400 dark:text-gray-300 italic">
Anzahl der Unterstützer: +{{ $project->votes->where('value', true)->count() }}
</div> </div>
</div> </div>
@endif <!-- Footer -->
</div> <div class="flex justify-between items-center mt-3">
<div class="flex flex-col sm:flex-row justify-between items-center mt-3 space-y-2 sm:space-y-0"> <!-- Tag -->
@if( <div
($currentPleb && $currentPleb->id === $project->einundzwanzig_pleb_id) class="text-xs inline-flex items-center font-bold border border-gray-200 dark:border-gray-700/60 text-gray-600 dark:text-gray-200 rounded-full text-center px-2.5 py-1">
|| ($currentPleb && in_array($currentPleb->npub, config('einundzwanzig.config.current_board'), true)) <span>{{ number_format($project->support_in_sats, 0, ',', '.') }} Sats</span>
) </div>
<x-button <div
icon="trash" class="text-xs inline-flex items-center font-bold border border-gray-200 dark:border-gray-700/60 text-gray-600 dark:text-gray-200 rounded-full text-center px-2.5 py-1">
xs <a href="{{ $project->website }}" target="_blank">Webseite</a>
negative </div>
wire:click="confirmDelete({{ $project->id }})" <!-- Avatars -->
label="Löschen"/> @if($project->votes->where('value', true)->count() > 0)
<x-button <div class="flex items-center space-x-2">
icon="pencil" <div class="text-xs font-medium text-gray-400 dark:text-gray-300 italic">
xs Anzahl der Unterstützer:
secondary +{{ $project->votes->where('value', true)->count() }}
:href="route('association.projectSupport.edit', ['projectProposal' => $project])" </div>
label="Editieren"/> </div>
@endif @endif
@if($currentPleb && $currentPleb->association_status->value > 2) </div>
<x-button <div
icon="folder-open" class="flex flex-col sm:flex-row justify-between items-center mt-3 space-y-2 sm:space-y-0">
xs @if(
:href="route('association.projectSupport.item', ['projectProposal' => $project])" ($currentPleb && $currentPleb->id === $project->einundzwanzig_pleb_id)
label="Öffnen"/> || ($currentPleb && in_array($currentPleb->npub, config('einundzwanzig.config.current_board'), true))
@endif )
</div> <x-button
icon="trash"
xs
negative
wire:click="confirmDelete({{ $project->id }})"
label="Löschen"/>
<x-button
icon="pencil"
xs
secondary
:href="route('association.projectSupport.edit', ['projectProposal' => $project])"
label="Editieren"/>
@endif
@if($currentPleb && $currentPleb->association_status->value > 2)
<x-button
icon="folder-open"
xs
:href="route('association.projectSupport.item', ['projectProposal' => $project])"
label="Öffnen"/>
@endif
</div>
</div>
</article>
@endforeach
</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">
Projektunterstützungen</h3>
<p class="mt-1 max-w">
Du bist nicht berechtigt, die Projektunterstützungen einzusehen.
</p>
</div> </div>
</article> </div>
@endforeach </div>
@endif
</div>
</div> </div>
@endvolt @endvolt
</x-layouts.app> </x-layouts.app>