<div class="row">
    <div class="col-lg-8">
        <div class="card glass-card">
            <div class="card-header"><h5 class="card-title">Edit Membership</h5></div>
            <div class="card-body">
                <form method="POST" action="<?= url('loyalty/memberships/update/' . $m->id) ?>" class="needs-validation" novalidate>
                    <?= csrf_field() ?>
                    <div class="row">
                        <div class="col-md-6 mb-3">
                            <label class="form-label">Customer</label>
                            <input type="text" class="form-control" value="<?= e($m->customer_name ?? '') ?>" disabled>
                        </div>
                        <div class="col-md-6 mb-3">
                            <label class="form-label">Plan Name <span class="text-danger">*</span></label>
                            <input type="text" name="plan_name" class="form-control" required value="<?= e($m->plan_name) ?>">
                        </div>
                        <div class="col-md-6 mb-3">
                            <label class="form-label">Start Date <span class="text-danger">*</span></label>
                            <input type="date" name="start_date" class="form-control" required value="<?= $m->start_date ?>">
                        </div>
                        <div class="col-md-6 mb-3">
                            <label class="form-label">End Date</label>
                            <input type="date" name="end_date" class="form-control" value="<?= $m->end_date ?? '' ?>">
                        </div>
                        <div class="col-md-6 mb-3">
                            <label class="form-label">Status</label>
                            <select name="status" class="form-select">
                                <option value="active" <?= $m->status === 'active' ? 'selected' : '' ?>>Active</option>
                                <option value="expired" <?= $m->status === 'expired' ? 'selected' : '' ?>>Expired</option>
                                <option value="cancelled" <?= $m->status === 'cancelled' ? 'selected' : '' ?>>Cancelled</option>
                            </select>
                        </div>
                    </div>
                    <button type="submit" class="btn btn-gold"><i class="fas fa-save me-1"></i>Update Membership</button>
                    <a href="<?= url('loyalty/memberships') ?>" class="btn btn-ghost ms-2">Cancel</a>
                </form>
            </div>
        </div>
    </div>
</div>
