<div class="content-wrapper android-agent-transactions"><main class="agt-main"><header class="agt-heading"><div><span>Agent Ledger</span><h1>حركات المعتمدين</h1><p>آخر 200 حركة رصيد مرتبطة بالمعتمدين والمشتركين.</p></div><div><i class="fa fa-book"></i></div></header><nav class="agt-nav"><a href="agents_portal_preview.php"><i class="fa fa-eye"></i><span>المعاينة</span></a><a href="agents.php"><i class="fa fa-users"></i><span>المعتمدون</span></a><a href="agents_activity.php"><i class="fa fa-history"></i><span>السجل</span></a><a class="is-active" href="agent_transactions.php"><i class="fa fa-book"></i><span>الحركات</span></a></nav><section class="agt-list"><?php $transactionCount=0; while($transaction=$rs->fetch_assoc()): $transactionCount++; $createdByThisAgent=($transaction['created_by_type']??'')==='agent'&&(int)($transaction['created_by_id']??0)===(int)$transaction['agent_id']; $sourceLabel=$createdByThisAgent?'أضافه هذا المعتمد':((($transaction['created_by_type']??'')==='agent')?'أضافه معتمد آخر':'من النسخة الرئيسية'); ?><article class="agt-card <?= $transaction['direction']==='DEBIT'?'is-debit':'is-credit' ?>"><header><div><span>حركة #<?= (int)$transaction['id'] ?> · <?= h($transaction['entry_type']) ?></span><h2><?= h($transaction['agent_name']??'—') ?></h2></div><strong dir="ltr"><?= number_format((float)$transaction['amount'],2) ?></strong></header><div class="agt-data"><span><small>المشترك</small><b><?= $transaction['subscriber_id']?h($transaction['subscriber_name']?:'#'.(int)$transaction['subscriber_id']):'—' ?></b></span><span><small>المصدر</small><b><?= h($sourceLabel) ?></b></span><span><small>الاتجاه</small><b><?= h($transaction['direction']) ?></b></span><span><small>الرصيد بعد</small><b dir="ltr"><?= number_format((float)$transaction['balance_after'],2) ?></b></span><span class="is-wide"><small>الوقت</small><b dir="ltr"><?= h($transaction['occurred_at']??'—') ?></b></span></div><?php if($transaction['description']): ?><p><?= h($transaction['description']) ?></p><?php endif; ?></article><?php endwhile; ?><?php if(!$transactionCount): ?><div class="agt-empty">لا توجد حركات.</div><?php endif; ?></section></main></div>
