<div class="row justify-content-center"><div class="col-lg-10"><div class="card">
    <div class="card-header"><h5 class="mb-0"><?= lang('common.create') ?> <?= lang('adv_finance.deposits') ?></h5></div>
    <div class="card-body">
        <form method="POST" action="/advanced-finance/deposits/store" data-ajax="true">
            <?= csrf_field() ?>
            <div class="row g-3">
                <div class="col-md-4"><label class="form-label">Bank Account <span class="text-danger">*</span></label><select name="bank_account_id" class="form-select" required><?php foreach($bankAccounts as $ba): ?><option value="<?= $ba['id'] ?>"><?= e($ba['bank_name_en']) ?> — <?= e($ba['account_number']) ?></option><?php endforeach; ?></select></div>
                <div class="col-md-4"><label class="form-label">Deposit Date <span class="text-danger">*</span></label><input type="date" name="deposit_date" class="form-control" value="<?= date('Y-m-d') ?>" required></div>
                <div class="col-md-4"><label class="form-label">Cash Amount <span class="text-danger">*</span></label><input type="number" name="cash_amount" class="form-control" step="0.01" value="0" required></div>
                <div class="col-12"><label class="form-label">Notes</label><textarea name="notes" class="form-control" rows="2"></textarea></div>
            </div>
            <?php if(!empty($receivedChecks)): ?>
            <h6 class="mt-4 mb-3">Include Checks</h6>
            <div class="table-responsive">
                <table class="table table-sm table-bordered">
                    <thead><tr><th><input type="checkbox" id="selectAllChecks"></th><th>Check #</th><th>Bank</th><th>Drawer</th><th>Amount</th><th>Date</th></tr></thead>
                    <tbody>
                    <?php foreach($receivedChecks as $ch): ?>
                    <tr><td><input type="checkbox" name="check_ids[]" value="<?= $ch['id'] ?>" class="check-select"></td><td><?= e($ch['check_number']) ?></td><td><?= e($ch['bank_name']) ?></td><td><?= e($ch['drawer_name']) ?></td><td><?= format_money($ch['amount']) ?></td><td><?= format_date($ch['check_date']) ?></td></tr>
                    <?php endforeach; ?>
                    </tbody>
                </table>
            </div>
            <?php endif; ?>
            <div class="mt-4 d-flex gap-2"><button type="submit" class="btn btn-primary"><i class="fas fa-save me-1"></i><?= lang('common.save') ?></button><a href="/advanced-finance/deposits" class="btn btn-secondary"><?= lang('common.cancel') ?></a></div>
        </form>
    </div>
</div></div></div>
<?php $__view->push('scripts') ?><script>
document.getElementById('selectAllChecks')?.addEventListener('change', function() {
    document.querySelectorAll('.check-select').forEach(c => c.checked = this.checked);
});
</script><?php $__view->endPush() ?>