<?php
if ( ! defined( 'ABSPATH' ) ) exit;
if ( ! current_user_can( 'manage_options' ) ) return;
?>
<div class="wrap cdtv-wrap">
    <h1><?php esc_html_e( 'Settings', 'codede-table-viewer' ); ?></h1>
    <form method="post" action="options.php">
        <?php settings_fields( 'cdtv_settings' ); ?>
        <table class="form-table">
            <tr>
                <th><label for="cdtv_decimal_separator"><?php esc_html_e( 'Decimal Separator', 'codede-table-viewer' ); ?></label></th>
                <td>
                    <select name="cdtv_decimal_separator" id="cdtv_decimal_separator">
                        <option value="." <?php selected( get_option( 'cdtv_decimal_separator', '.' ), '.' ); ?>><?php esc_html_e( 'Point ( . )', 'codede-table-viewer' ); ?></option>
                        <option value="," <?php selected( get_option( 'cdtv_decimal_separator', '.' ), ',' ); ?>><?php esc_html_e( 'Comma ( , )', 'codede-table-viewer' ); ?></option>
                    </select>
                    <p class="description"><?php esc_html_e( 'Used when formatting numeric values from Excel files.', 'codede-table-viewer' ); ?></p>
                </td>
            </tr>
        </table>
        <?php submit_button(); ?>
    </form>

    <hr>
    <h2><?php esc_html_e( 'About CodeDE Table Import/Export for Excel & CSV', 'codede-table-viewer' ); ?></h2>
    <p>
        <?php
        printf(
            /* translators: %s: link to wp-code.de */
            esc_html__( 'Version %1$s — developed by %2$s', 'codede-table-viewer' ),
            esc_html( CDTV_VERSION ),
            '<a href="https://wp-code.de" target="_blank" rel="noopener">wp-code.de</a>'
        );
        ?>
    </p>
    <p>
        <a href="<?php echo esc_url( admin_url( 'admin.php?page=cdtv-upgrade' ) ); ?>" class="button button-primary">
            ⭐ <?php esc_html_e( 'Upgrade to Pro', 'codede-table-viewer' ); ?>
        </a>
    </p>
</div>
