<div class="row justify-content-center"><div class="col-lg-8"><div class="card">
    <div class="card-header"><h6 class="mb-0"><?= e($wo['write_off_number']) ?></h6></div>
    <div class="card-body">
        <table class="table table-sm">
            <tr><th>Member</th><td><?= e($wo['member_name']) ?> (<?= e($wo['membership_number']) ?>)</td></tr>
            <tr><th>Invoice</th><td><?= e($wo['invoice_number'] ?? '—') ?></td></tr>
            <tr><th>Amount</th><td class="fw-bold"><?= format_money($wo['amount']) ?></td></tr>
            <tr><th>Reason</th><td><?= e($wo['reason']) ?></td></tr>
            <tr><th>Status</th><td><?= status_badge($wo['status']) ?></td></tr>
        </table>
        <div class="d-flex gap-2 mt-3">
            <?php if($wo['status'] === 'pending' && auth_can('refunds.approve')): ?>
            <form method="POST" action="/advanced-finance/write-offs/<?= $wo['id'] ?>/approve" data-ajax="true"><?= csrf_field() ?><button class="btn btn-success btn-sm"><i class="fas fa-check me-1"></i><?= lang('adv_finance.approve') ?></button></form>
            <?php endif; ?>
            <?php if($wo['status'] === 'approved' && auth_can('gl.manage')): ?>
            <form method="POST" action="/advanced-finance/write-offs/<?= $wo['id'] ?>/post" data-ajax="true"><?= csrf_field() ?><button class="btn btn-primary btn-sm"><i class="fas fa-book me-1"></i><?= lang('adv_finance.post') ?></button></form>
            <?php endif; ?>
        </div>
    </div>
</div></div></div>