DONE: settle disable vote for voter with saham under 500, fix issue on...

This commit is contained in:
ISMAIL MASSERAN
2026-04-19 07:52:11 +00:00
parent ed369aec46
commit f5b831a857
9 changed files with 285 additions and 24 deletions
@@ -48,9 +48,21 @@ class ClaimCodeController extends Controller
], 422);
}
// Must have voted
$hasVoted = Result::where('election_id', $electionId)->where('voter_id', $voterId)->exists();
if (!$hasVoted) {
// Tunai: normally must have voted; exception — fizikal hadir & layak mesyuarat tetapi tidak dibenarkan
// mengundi kerana saham < RM500 (same rule as voter UI).
$kehadiran = (int) $voter->kehadiran;
$saham = (float) $voter->saham;
$canVoteBySaham = $saham >= 500.0;
$canProceedToVote = $kehadiran !== 0
&& ($kehadiran !== 1 || $voter->fizikal_registration_verified_at !== null);
$eligibleClaimCashWithoutVote = $method === 'cash'
&& $kehadiran === 1
&& $canProceedToVote
&& !$canVoteBySaham;
if (!$hasVoted && !$eligibleClaimCashWithoutVote) {
return response()->json([
'status' => 'failed',
'message' => 'Sila undi terlebih dahulu sebelum menuntut elaun.',