fn() => $projectProposal, 'isAllowed' => false, 'currentPubkey' => null, 'currentPleb' => null, 'reasons' => fn() => $this->getReasons(), 'ownVoteExists' => false, 'boardVotes' => fn() => $this->getBoardVotes(), 'otherVotes' => fn() => $this->getOtherVotes(), ]); on([ 'nostrLoggedIn' => fn($pubkey) => $this->handleNostrLoggedIn($pubkey), 'nostrLoggedOut' => fn() => $this->handleNostrLoggedOut(), ]); $approve = fn() => $this->handleApprove(); $notApprove = fn() => $this->handleNotApprove(); $getReasons = function () { return Vote::query() ->where('project_proposal_id', $this->projectProposal->id) ->where('value', false) ->get(); }; $getBoardVotes = function () { return Vote::query() ->where('project_proposal_id', $this->projectProposal->id) ->whereHas('einundzwanzigPleb', fn($q) => $q->whereIn('npub', config('einundzwanzig.config.current_board'))) ->where('value', true) ->get(); }; $getOtherVotes = function () { return Vote::query() ->where('project_proposal_id', $this->projectProposal->id) ->whereDoesntHave( 'einundzwanzigPleb', fn($q) => $q->whereIn('npub', config('einundzwanzig.config.current_board')) ) ->where('value', true) ->get(); }; $handleNostrLoggedIn = function ($pubkey) { $this->currentPubkey = $pubkey; $this->currentPleb = \App\Models\EinundzwanzigPleb::query()->where('pubkey', $pubkey)->first(); if ($this->currentPleb->association_status->value < 2) { return $this->js('alert("Du bist hierzu nicht berechtigt.")'); } $this->isAllowed = true; $this->ownVoteExists = Vote::query() ->where('project_proposal_id', $this->projectProposal->id) ->where('einundzwanzig_pleb_id', $this->currentPleb->id) ->exists(); }; $handleNostrLoggedOut = function () { $this->isAllowed = false; $this->currentPubkey = null; $this->currentPleb = null; }; $handleApprove = function () { Vote::query()->updateOrCreate([ 'project_proposal_id' => $this->projectProposal->id, 'einundzwanzig_pleb_id' => $this->currentPleb->id, ], [ 'value' => true, ]); $this->form->reset(); $this->ownVoteExists = true; $this->boardVotes = $this->getBoardVotes(); $this->otherVotes = $this->getOtherVotes(); }; $handleNotApprove = function () { $this->form->validate(); Vote::query()->updateOrCreate([ 'project_proposal_id' => $this->projectProposal->id, 'einundzwanzig_pleb_id' => $this->currentPleb->id, ], [ 'value' => false, 'reason' => $this->form->reason, ]); $this->form->reset(); $this->ownVoteExists = true; $this->reasons = $this->getReasons(); }; ?> @volt
@if($isAllowed)
{{ $projectProposal->created_at->translatedFormat('d.m.Y') }}

{{ $projectProposal->name }}

{!! $projectProposal->description !!}
User 04
Eingereicht von
{{ $projectProposal->einundzwanzigPleb->profile->name }}
{{ number_format($projectProposal->support_in_sats, 0, ',', '.') }} Sats
Meetup

Ablehnungen ({{ count($reasons) }})

    @foreach($reasons as $reason)
  • {{ $reason->einundzwanzigPleb->profile->name }}
    {{ $reason->einundzwanzigPleb->profile->name }}
    {{ $reason->reason }}
  • @endforeach
@if(!$ownVoteExists)
@else

Du hast bereits abgestimmt.

@endif
Zustimmungen des Vorstands ({{ count($boardVotes) }})
    @foreach($boardVotes as $vote)
  • {{ $vote->einundzwanzigPleb->profile->name }}
    {{ $vote->einundzwanzigPleb->profile->name }}
  • @endforeach
Zustimmungen der übrigen Mitglieder ({{ count($otherVotes) }})
    @foreach($otherVotes as $vote)
  • {{ $vote->einundzwanzigPleb->profile->name }}
    {{ $vote->einundzwanzigPleb->profile->name }}
  • @endforeach
@else

Projekt-Unterstützung

Du bist nicht berechtigt, die Projekt-Unterstützungen einzusehen.

@endif
@endvolt