@extends('user.layouts.app') @section('title','Election') @section('page-title','Election Voting') @section('page-subtitle','Cast your vote for eligible elections') @section('content') @if(session('success'))
{{ session('success') }}
@endif @if(session('error'))
{{ session('error') }}
@endif @if(session('info'))
{{ session('info') }}
@endif @forelse($elections as $election) @php $voter = $voterRecords->get($election->id); $otpLocked = $voter && $voter->otp_locked_until && $voter->otp_locked_until->isFuture(); $cooldownRemaining = 0; if ($voter && $voter->otp_last_sent_at) { $nextAllowed = $voter->otp_last_sent_at->copy()->addSeconds($otpSettings->resend_cooldown_seconds); $cooldownRemaining = $nextAllowed->isFuture() ? (int) $nextAllowed->diffInSeconds(now()) : 0; } @endphp
{{ $election->title }}

{{ $election->conference?->name }} · {{ $election->election_year }}

{{ $election->start_time?->format('M d, Y H:i') }} — {{ $election->end_time?->format('M d, Y H:i') }}
@if($voter?->voting_status === 'voted') Voted @elseif($election->isOpen() && $voter) Open @else {{ ucfirst($election->status) }} @endif
@if($voter && $voter->voting_status !== 'voted' && $election->isOpen()) @if($election->otp_required)
OTP Verification Required
@if($otpLocked)

Too many failed attempts. Try again after {{ $voter->otp_locked_until->format('M d, Y H:i') }}.

@else

Request a one-time code via: @forelse($enabledChannels as $channel) {{ strtoupper($channel) }} @empty No channels configured — contact admin. @endforelse

@if($enabledChannels->isNotEmpty())
@csrf
@if($cooldownRemaining > 0) Wait {{ $cooldownRemaining }}s before resending. @elseif($voter->otp_last_sent_at) Last sent {{ $voter->otp_last_sent_at->diffForHumans() }}. Expires in {{ $otpSettings->expiry_minutes }} min. @endif @endif @endif
@endif
@csrf @if($election->otp_required && ! $otpLocked)
isEmpty())>
Enter the code sent to your registered contact details.
@endif @foreach($election->positions as $position)
@foreach($position->candidates->where('status', 'active') as $candidate)
@endforeach
@endforeach
@elseif(!$voter)

You are not eligible to vote in this election.

@elseif($voter->voting_status === 'voted')

You have already voted. Thank you for participating.

@else

Voting is not currently open.

@endif
@empty

No active elections at this time.

@endforelse @endsection