voting added

This commit is contained in:
HolgerHatGarKeineNode
2023-03-11 10:42:09 +01:00
parent 135d9fc1eb
commit 79b0f44143
2 changed files with 15 additions and 9 deletions

View File

@@ -58,7 +58,7 @@ class ProjectProposalVoting extends Component
$this->vote->value = true; $this->vote->value = true;
$this->vote->save(); $this->vote->save();
return to_route('project.voting.projectFunding', return to_route('voting.projectFunding',
['projectProposal' => $this->projectProposal, 'fromUrl' => $this->fromUrl]); ['projectProposal' => $this->projectProposal, 'fromUrl' => $this->fromUrl]);
} }
@@ -69,7 +69,7 @@ class ProjectProposalVoting extends Component
$this->vote->value = false; $this->vote->value = false;
$this->vote->save(); $this->vote->save();
return to_route('project.voting.projectFunding', return to_route('voting.projectFunding',
['projectProposal' => $this->projectProposal, 'fromUrl' => $this->fromUrl]); ['projectProposal' => $this->projectProposal, 'fromUrl' => $this->fromUrl]);
} }

View File

@@ -7,6 +7,7 @@
<div class="pb-5 flex flex-row justify-between"> <div class="pb-5 flex flex-row justify-between">
<h3 class="text-lg font-medium leading-6 text-gray-200">{{ __('Voting') }} <h3 class="text-lg font-medium leading-6 text-gray-200">{{ __('Voting') }}
: {{ $projectProposal->name }}</h3> : {{ $projectProposal->name }}</h3>
<img class="h-32" src="{{ $projectProposal->getFirstMediaUrl('main') }}" alt="{{ $projectProposal->name }}">
<div class="flex flex-row space-x-2 items-center"> <div class="flex flex-row space-x-2 items-center">
<div> <div>
<x-button :href="$fromUrl"> <x-button :href="$fromUrl">
@@ -41,7 +42,8 @@
<div class="text-gray-200">{{ $projectProposal->user->name }}</div> <div class="text-gray-200">{{ $projectProposal->user->name }}</div>
</div> </div>
<div class="flex space-x-1 text-sm text-gray-300"> <div class="flex space-x-1 text-sm text-gray-300">
<span class="font-bold">{{ __('This project requires') }} </span><span class="font-bold text-amber-500">{{ number_format($projectProposal->support_in_sats, 0, ',', '.') }} {{ __('sats') }}</span> <span class="font-bold">{{ __('This project requires') }} </span><span
class="font-bold text-amber-500">{{ number_format($projectProposal->support_in_sats, 0, ',', '.') }} {{ __('sats') }}</span>
</div> </div>
</div> </div>
</div> </div>
@@ -145,13 +147,15 @@
@foreach($entitledVoters as $voter) @foreach($entitledVoters as $voter)
@php @php
$vote = $voter->votes->first(); $vote = $voter->votes->first();
if (!$voter->votes->first()) { if (!$vote) {
$text = __('not voted yet'); $text = __('not voted yet');
} elseif (!$vote->value) { } elseif ($vote && !$vote->value) {
$text = __('Reason') . ': ' . $voter->votes->first()?->reason; $text = __('Reason') . ': ' . $voter->votes->first()?->reason;
} else {
$text = '';
} }
@endphp @endphp
<li class="flex py-4"> <li class="flex py-4" wire:key="entitled_vote_{{ $voter->id }}">
<img class="h-10 w-10 rounded-full" src="{{ $voter->profile_photo_url }}" <img class="h-10 w-10 rounded-full" src="{{ $voter->profile_photo_url }}"
alt=""> alt="">
<div class="ml-3"> <div class="ml-3">
@@ -184,13 +188,15 @@
@foreach($otherVoters as $voter) @foreach($otherVoters as $voter)
@php @php
$vote = $voter->votes->first(); $vote = $voter->votes->first();
if (!$voter->votes->first()) { if (!$vote) {
$text = __('not voted yet'); $text = __('not voted yet');
} elseif (!$vote->value) { } elseif ($vote && !$vote->value) {
$text = __('Reason') . ': ' . $voter->votes->first()?->reason; $text = __('Reason') . ': ' . $voter->votes->first()?->reason;
} else {
$text = '';
} }
@endphp @endphp
<li class="flex py-4"> <li class="flex py-4" wire:key="other_vote_{{ $voter->id }}">
<img class="h-10 w-10 rounded-full" src="{{ $voter->profile_photo_url }}" <img class="h-10 w-10 rounded-full" src="{{ $voter->profile_photo_url }}"
alt=""> alt="">
<div class="ml-3"> <div class="ml-3">