<?php $pageTitle='Quote Requests';require __DIR__.'/../lib/bootstrap.php';require_login(array('business'));if($_SERVER['REQUEST_METHOD']==='POST'&&verify_csrf()){db_exec('INSERT INTO quote_requests(user_id,from_currency,to_currency,amount,needed_by,purpose,status,created_at) VALUES(?,?,?,?,?,? ,"open",NOW())',array(user()['id'],$_POST['from_currency'],$_POST['to_currency'],(float)$_POST['amount'],$_POST['needed_by'],trim($_POST['purpose'])));flash('success','Quote request submitted to the marketplace.');redirect('business/requests.php');}$rows=db_all('SELECT * FROM quote_requests WHERE user_id=? ORDER BY id DESC',array(user()['id']));require __DIR__.'/../blocks/app-header.php';require __DIR__.'/../blocks/dashboard-open.php';?><div class="dash-head"><h1>Commercial quote requests</h1></div><div class="grid grid-3"><div class="card"><h3>New request</h3><form method="post"><?=csrf_field()?><div class="form-row"><div class="form-group"><label>From</label><input class="form-control" name="from_currency" value="USD" required></div><div class="form-group"><label>To</label><input class="form-control" name="to_currency" value="NGN" required></div></div><div class="form-group"><label>Amount</label><input class="form-control" type="number" min="1" name="amount" required></div><div class="form-group"><label>Needed by</label><input class="form-control" type="date" name="needed_by" required></div><div class="form-group"><label>Purpose</label><textarea class="form-control" name="purpose" required></textarea></div><button class="orange-btn">Submit request</button></form></div><div class="card" style="grid-column:span 2"><h3>Your requests</h3><?php if(!$rows):?><p class="muted">No requests yet.</p><?php endif;foreach($rows as $r):?><p><strong><?=e($r['from_currency'].' → '.$r['to_currency'].' '.number_format($r['amount'],2))?></strong><br><span class="badge"><?=e($r['status'])?></span> Needed <?=e($r['needed_by'])?></p><?php endforeach;?></div></div><?php require __DIR__.'/../blocks/dashboard-close.php';require __DIR__.'/../blocks/app-footer.php';?>