voting added

This commit is contained in:
HolgerHatGarKeineNode
2023-03-10 23:19:13 +01:00
parent d5015130b1
commit 0ae23e0314
3 changed files with 118 additions and 94 deletions

View File

@@ -8,6 +8,7 @@ use App\Models\User;
use App\Models\Vote; use App\Models\Vote;
use Illuminate\Validation\Rule; use Illuminate\Validation\Rule;
use Livewire\Component; use Livewire\Component;
use RalphJSmit\Laravel\SEO\Support\SEOData;
class ProjectProposalVoting extends Component class ProjectProposalVoting extends Component
{ {
@@ -49,6 +50,9 @@ class ProjectProposalVoting extends Component
$this->vote->project_proposal_id = $this->projectProposal->id; $this->vote->project_proposal_id = $this->projectProposal->id;
$this->vote->value = false; $this->vote->value = false;
} }
if (!$this->fromUrl) {
$this->fromUrl = url()->previous();
}
} }
public function yes() public function yes()
@@ -102,6 +106,12 @@ class ProjectProposalVoting extends Component
}) })
->orderByDesc('votes_count') ->orderByDesc('votes_count')
->get(), ->get(),
])->layout('layouts.app', [
'SEOData' => new SEOData(
title: __('Project Proposal'),
description: __('Submit a project proposal and let the community vote on it through the elected voters. All other community members can also vote.'),
image: asset('img/voting.jpg')
),
]); ]);
} }
} }

BIN
public/img/voting.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 107 KiB

View File

@@ -19,8 +19,21 @@
<form class="space-y-8 divide-y divide-gray-700 pb-24"> <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="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"> <div class="grid grid-cols-1 sm:grid-cols-2 gap-2">
<div>
<div class="border-b border-gray-200 bg-dark px-4 py-5 sm:px-6">
<h3 class="text-base font-semibold leading-6 text-gray-200">{{ __('Description') }}</h3>
</div>
<div class="prose prose-invert leading-normal">
<x-markdown>
{!! $projectProposal->description !!}
</x-markdown>
</div>
</div>
<div class="sm:mt-5 space-y-6 sm:space-y-5">
<div class="w-full flex space-x-4"> <div class="w-full flex space-x-4">
<x-button lg primary wire:click="yes"> <x-button lg primary wire:click="yes">
Yes, support it! Yes, support it!
@@ -58,7 +71,7 @@
get options() { get options() {
return { return {
theme: { palette: 'palette3' }, theme: { palette: 'palette3' },
chart: { type: 'bar', toolbar: true, height: 350, stacked: true, stackType: '100%'}, chart: { type: 'bar', toolbar: true, height: 200, stacked: true, stackType: '100%'},
xaxis: { categories: this.labels }, xaxis: { categories: this.labels },
plotOptions: { bar: { horizontal: true } }, plotOptions: { bar: { horizontal: true } },
series: [ series: [
@@ -161,6 +174,7 @@
</div> </div>
</div> </div>
</div>
</div> </div>
</div> </div>