<?php if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly ?>

<?php
    use EHxMe\Helpers\Helper;
    use EHxMe\Shortcodes\CustomFormShortcode;
?>

<div class="ehx-alert-element d-none">
    <div class="ehx-alert ehx-alert-primary text-center rounded-0" role="alert" id="ehx-alert-message">
        <i>&quest;</i>
        <span><?php esc_html_e('Item added to cart successfully', 'ehx-members'); ?></span>
    </div>
    <div class="ehx-alert-close">&#10006;</div>
</div>

<div class="ehx-container">
    <div class="ehx-content">

        <!-- Registration form -->
        <form action="#" method="POST" class="ehxme-form" id="ehxme_form_submit">

            <input type="hidden" name="shortcode_id" value="<?php echo esc_html($shortcode_id); ?>">
            <input type="hidden" name="action" value="<?php echo esc_html(CustomFormShortcode::NONCE_ACTION); ?>">
            <?php wp_nonce_field(CustomFormShortcode::NONCE_ACTION, Helper::NONCE_NAME); ?>

            <?php if($atts['type'] == 'reset'): ?>
                <input type="hidden" name="email" value="<?php echo esc_attr($validate['email']); ?>">
                <input type="hidden" name="token" value="<?php echo esc_attr($validate['token']); ?>">
            <?php endif ?>

            <div class="ehx-user-details">
                <?php
                    if($atts['type'] == 'reset') {
                        CustomFormShortcode::inputField(label: esc_html__('Password', 'ehx-members'), for: 'password', type: 'password', placeholder: esc_html__('Enter new password', 'ehx-members'));
                        CustomFormShortcode::inputField(label: esc_html__('Confirm Password', 'ehx-members'), for: 'confirm_password', type: 'password', placeholder: esc_html__('Enter confirm password', 'ehx-members'));
                    }
                    else {
                        CustomFormShortcode::inputField(label: esc_html__('Email', 'ehx-members'), for: 'email', type: 'email', placeholder: esc_html__('Enter valid email', 'ehx-members'));
                    }
                ?>
            </div>

            <!-- Submit button -->
            <div>
                <button type="submit" class="ehx-button" data-submit="<?php esc_html_e('Please Wait...', 'ehx-members') ?>">
                    <div class="ehx-btn-loader" id="ehx-loader"></div>
                    <span id="ehx-btn-text"><?php esc_html_e('Submit', 'ehx-members') ?></span>
                </button>
            </div>
        </form>

    </div>
</div>