<?php 
$pageTitle = 'Record Deposit';
include __DIR__ . '/../layouts/header.php'; 
?>

<div class="d-flex justify-content-between align-items-center mb-4">
    <h2><i class="bi bi-cash-stack me-2"></i>Deposit for <?= htmlspecialchars($client['full_name']) ?></h2>
    <a href="<?= $this->baseUrl('/clients') ?>" class="btn btn-outline-secondary">
        <i class="bi bi-arrow-left"></i> Back to Clients
    </a>
</div>

<div class="row">
    <div class="col-md-6">
        <div class="card mb-4">
            <div class="card-body">
                <h5 class="card-title">Client Information</h5>
                <table class="table table-sm">
                    <tr><th>Code:</th><td><?= htmlspecialchars($client['client_code']) ?></td></tr>
                    <tr><th>Current Balance:</th><td class="fw-bold"><?= number_format($client['balance'], 2) ?> KES</td></tr>
                    <tr><th>Overdraft Limit:</th><td><?= number_format($client['overdraft_limit'], 2) ?> KES</td></tr>
                </table>
            </div>
        </div>
    </div>
    <div class="col-md-6">
        <div class="card">
            <div class="card-body">
                <form method="post" action="<?= $this->baseUrl('/clients/' . $client['id'] . '/deposit') ?>">
                    <div class="mb-3">
                        <label class="form-label">Amount (KES) <span class="text-danger">*</span></label>
                        <input type="number" step="0.01" name="amount" class="form-control" required autofocus>
                    </div>
                    <div class="mb-3">
                        <label class="form-label">Payment Method</label>
                        <select name="payment_method" class="form-select">
                            <option value="cash">Cash</option>
                            <option value="mpesa">M-Pesa</option>
                            <option value="bank">Bank Transfer</option>
                            <option value="other">Other</option>
                        </select>
                    </div>
                    <div class="mb-3">
                        <label class="form-label">Reference</label>
                        <input type="text" name="reference" class="form-control" placeholder="e.g., M-Pesa code, cheque number">
                    </div>
                    <div class="mb-3">
                        <label class="form-label">Notes</label>
                        <textarea name="notes" class="form-control" rows="2"></textarea>
                    </div>
                    <hr>
                    <div class="d-flex gap-2">
                        <button type="submit" class="btn btn-success">
                            <i class="bi bi-check-circle"></i> Record Deposit
                        </button>
                        <a href="<?= $this->baseUrl('/clients') ?>" class="btn btn-outline-secondary">
                            <i class="bi bi-x-circle"></i> Cancel
                        </a>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>

<?php include __DIR__ . '/../layouts/footer.php'; ?>