DONE: settle disable vote for voter with saham under 500, fix issue on...
This commit is contained in:
@@ -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.',
|
||||
|
||||
Reference in New Issue
Block a user