<div class="wrap chainpay-admin">
    <h1><?php echo isset($license) ? 'Edit License' : 'Create License'; ?></h1>
    
    <form method="post" action="">
        <?php wp_nonce_field('chainpay_license_create'); ?>
        
        <table class="form-table">
            <tr>
                <th><label for="email">Email</label></th>
                <td><input type="email" name="email" id="email" class="regular-text" required></td>
            </tr>
            <tr>
                <th><label for="domain">Domain</label></th>
                <td><input type="text" name="domain" id="domain" class="regular-text"></td>
            </tr>
            <tr>
                <th><label for="plan_id">Plan</label></th>
                <td>
                    <select name="plan_id" id="plan_id">
                        <option value="">Select Plan</option>
                        <?php
                        global $wpdb;
                        $plans = $wpdb->get_results("SELECT * FROM {$wpdb->prefix}chainpay_plans WHERE is_active = 1");
                        foreach ($plans as $plan): ?>
                            <option value="<?php echo esc_attr($plan->id); ?>"><?php echo esc_html($plan->name); ?></option>
                        <?php endforeach; ?>
                    </select>
                </td>
            </tr>
            <tr>
                <th><label for="max_domains">Max Domains</label></th>
                <td><input type="number" name="max_domains" id="max_domains" value="1" class="small-text"></td>
            </tr>
            <tr>
                <th><label for="expiration_date">Expiration Date</label></th>
                <td><input type="date" name="expiration_date" id="expiration_date" class="regular-text"></td>
            </tr>
        </table>
        
        <p class="submit">
            <input type="submit" name="create_license" class="button button-primary" value="Create License">
        </p>
    </form>
</div>
