<div class="row justify-content-center"><div class="col-lg-8"><div class="card">
    <div class="card-header"><h5 class="mb-0"><i class="fas fa-money-check me-2"></i><?= lang('adv_finance.register_check') ?></h5></div>
    <div class="card-body">
        <form method="POST" action="/advanced-finance/checks/store" data-ajax="true">
            <?= csrf_field() ?>
            <div class="row g-3">
                <div class="col-md-4"><label class="form-label">Check # <span class="text-danger">*</span></label><input type="text" name="check_number" class="form-control" required><div class="invalid-feedback" data-field="check_number"></div></div>
                <div class="col-md-4"><label class="form-label">Bank <span class="text-danger">*</span></label><input type="text" name="bank_name" class="form-control" required><div class="invalid-feedback" data-field="bank_name"></div></div>
                <div class="col-md-4"><label class="form-label">Branch</label><input type="text" name="branch" class="form-control"></div>
                <div class="col-md-6"><label class="form-label">Drawer Name <span class="text-danger">*</span></label><input type="text" name="drawer_name" class="form-control" required><div class="invalid-feedback" data-field="drawer_name"></div></div>
                <div class="col-md-3"><label class="form-label">Amount <span class="text-danger">*</span></label><input type="number" name="amount" class="form-control" step="0.01" required><div class="invalid-feedback" data-field="amount"></div></div>
                <div class="col-md-3"><label class="form-label">Currency <span class="text-danger">*</span></label><select name="currency_id" class="form-select" required><?php foreach($currencies as $c): ?><option value="<?= $c['id'] ?>" <?= $c['is_default'] ? 'selected' : '' ?>><?= e($c['currency_code']) ?></option><?php endforeach; ?></select></div>
                <div class="col-md-4"><label class="form-label">Check Date <span class="text-danger">*</span></label><input type="date" name="check_date" class="form-control" required></div>
                <div class="col-md-4"><label class="form-label">Receive Date <span class="text-danger">*</span></label><input type="date" name="receive_date" class="form-control" value="<?= date('Y-m-d') ?>" required></div>
                <div class="col-md-4"><label class="form-label">Member</label><select name="member_id" class="form-select select2-ajax" data-url="/advanced-finance/api/member-search"></select></div>
                <div class="col-md-6"><label class="form-label">Bank Account</label><select name="bank_account_id" class="form-select"><option value="">—</option><?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-6"><label class="form-label">Account #</label><input type="text" name="account_number" class="form-control"></div>
                <div class="col-12"><label class="form-label">Notes</label><textarea name="notes" class="form-control" rows="2"></textarea></div>
            </div>
            <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/checks" class="btn btn-secondary"><?= lang('common.cancel') ?></a>
            </div>
        </form>
    </div>
</div></div></div>
<?php $__view->push('scripts') ?><script>document.addEventListener('DOMContentLoaded', function() { AdvFinance.initMemberSelect('.select2-ajax'); });</script><?php $__view->endPush() ?>