feat: add voting feature toggle

This commit introduces a new feature toggle 'voting' to enable/disable voting. It also includes minor formatting adjustments in election admin blade files.
This commit is contained in:
fsociety
2024-09-30 20:27:18 +02:00
parent 265ed40839
commit 4568d9e402
3 changed files with 17 additions and 16 deletions

View File

@@ -14,6 +14,8 @@ return [
| |
*/ */
'voting' => env('ENABLE_VOTING', false),
'relay' => env('NOSTR_RELAY'), 'relay' => env('NOSTR_RELAY'),
'nostr' => env('NOSTR_P'), 'nostr' => env('NOSTR_P'),

View File

@@ -44,7 +44,7 @@ mount(function () {
->get() ->get()
->toArray(); ->toArray();
$this->loadEvents(); $this->loadEvents();
if ($this->election->end_time->isPast()) { if ($this->election->end_time->isPast() || !config('services.voting')) {
$this->isNotClosed = false; $this->isNotClosed = false;
} }
}); });

View File

@@ -191,22 +191,21 @@ $loadEvents = function () {
<!-- Cards --> <!-- Cards -->
<div class="grid grid-cols-12 gap-6"> <div class="grid grid-cols-12 gap-6">
@foreach($positions as $key => $position)
@foreach($positions as $key => $position) <div wire:key="pos_{{ $key }}" wire:ignore
<div wire:key="pos_{{ $key }}" wire:ignore class="flex flex-col col-span-full sm:col-span-6 bg-white dark:bg-gray-800 shadow-sm rounded-xl">
class="flex flex-col col-span-full sm:col-span-6 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">
<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
<h2 class="font-semibold text-gray-800 dark:text-gray-100"><i class="fa-sharp-duotone fa-solid {{ $position['icon'] }} w-5 h-5 fill-current text-white mr-4"></i>{{ $position['title'] }}
class="fa-sharp-duotone fa-solid {{ $position['icon'] }} w-5 h-5 fill-current text-white mr-4"></i>{{ $position['title'] }} </h2>
</h2> </header>
</header> <div class="grow">
<div class="grow"> <!-- Change the height attribute to adjust the chart height -->
<!-- Change the height attribute to adjust the chart height --> <canvas x-ref="chart_{{ $key }}" width="724" height="288"
<canvas x-ref="chart_{{ $key }}" width="724" height="288" style="display: block; box-sizing: border-box; height: 288px; width: 724px;"></canvas>
style="display: block; box-sizing: border-box; height: 288px; width: 724px;"></canvas> </div>
</div> </div>
</div> @endforeach
@endforeach
</div> </div>