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
@@ -45,6 +45,13 @@ class GetController extends Controller
->where('allowance_payouts.status', 'paid');
}, 'cash_payout_id');
// Latest paid cash payout — Rujukan / Nota for admin allowance modal ($electionId bound as int)
$eid = (int) $electionId;
$q->addSelect([
DB::raw("(SELECT ap.reference FROM allowance_payouts ap WHERE ap.voter_id = voter.id AND ap.election_id = {$eid} AND ap.method = 'cash' AND ap.status = 'paid' ORDER BY ap.id DESC LIMIT 1) as cash_payout_reference"),
DB::raw("(SELECT ap.note FROM allowance_payouts ap WHERE ap.voter_id = voter.id AND ap.election_id = {$eid} AND ap.method = 'cash' AND ap.status = 'paid' ORDER BY ap.id DESC LIMIT 1) as cash_payout_note"),
]);
$q->selectSub(function ($sq) use ($electionId) {
$sq->from('allowance_payouts')
->selectRaw('MAX(paid_at)')