<?php $pageTitle='Validation Queue';require __DIR__.'/../lib/bootstrap.php';require_login(array('operator','admin'));if(isset($_GET['approve'])){db_exec("UPDATE rate_quotes SET status='approved',approved_by=?,approved_at=NOW() WHERE id=?",array(user()['id'],(int)$_GET['approve']));redirect('operations/queue.php');}if(isset($_GET['reject'])){db_exec("UPDATE rate_quotes SET status='rejected',approved_by=?,approved_at=NOW() WHERE id=?",array(user()['id'],(int)$_GET['reject']));redirect('operations/queue.php');}$rows=db_all("SELECT r.*,s.name source_name FROM rate_quotes r JOIN rate_sources s ON s.id=r.source_id WHERE r.status='pending' ORDER BY r.id DESC");require __DIR__.'/../blocks/app-header.php';require __DIR__.'/../blocks/dashboard-open.php';?><div class="dash-head"><h1>Validation queue</h1></div><div class="card" style="padding:0"><table class="comparison-table"><thead><tr><th>Source</th><th>Pair</th><th>Rate</th><th>Amount received</th><th>Flag</th><th>Action</th></tr></thead><tbody><?php foreach($rows as $r):?><tr><td><?=e($r['source_name'])?></td><td><?=e($r['from_currency'].' → '.$r['to_currency'])?></td><td><?=e($r['rate'])?></td><td><?=e($r['recipient_amount'])?></td><td><?=e($r['validation_note'])?></td><td><a href="?approve=<?=e($r['id'])?>">Approve</a> · <a href="?reject=<?=e($r['id'])?>">Reject</a></td></tr><?php endforeach;?></tbody></table></div><?php require __DIR__.'/../blocks/dashboard-close.php';require __DIR__.'/../blocks/app-footer.php';?>