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

<div class="iwbvel-float-side-modal" id="iwbvel-float-side-modal-meta-fields">
    <div class="iwbvel-float-side-modal-container">
        <div class="iwbvel-float-side-modal-box">
            <div class="iwbvel-float-side-modal-content">
                <div class="iwbvel-float-side-modal-title">
                    <h2><?php esc_html_e('Meta Fields', 'ithemeland-bulk-variation-editing-for-woocommerce'); ?></h2>
                    <button type="button" class="iwbvel-float-side-modal-close" data-toggle="float-side-modal-close">
                        <i class="iwbvel-icon-x"></i>
                    </button>
                </div>
                <div class="iwbvel-float-side-modal-body">
                    <div class="iwbvel-wrap">
                        <div class="iwbvel-alert iwbvel-alert-default">
                            <span><?php esc_html_e('You can add new products meta fields in two ways: 1- Individually 2- Get from other product.', 'ithemeland-bulk-variation-editing-for-woocommerce'); ?></span>
                        </div>
                        <?php if (!defined('IWBVE_ACTIVE') || !IWBVE_ACTIVE) : ?>
                            <?php include IWBVEL_VIEWS_DIR . 'alerts/warning-active-pro.php' ?>
                        <?php endif; ?>
                        <div class="iwbvel-meta-fields-left">
                            <div class="iwbvel-meta-fields-manual">
                                <label for="iwbvel-meta-fields-manual_key_name"><?php esc_html_e('Manually', 'ithemeland-bulk-variation-editing-for-woocommerce'); ?></label>
                                <div class="iwbvel-meta-fields-manual-field">
                                    <input <?php echo !defined('IWBVE_ACTIVE') || !IWBVE_ACTIVE ? 'disabled="disabled"' : ''; ?> type="text" id="iwbvel-meta-fields-manual_key_name" placeholder="<?php esc_attr_e('Enter Meta Key ...', 'ithemeland-bulk-variation-editing-for-woocommerce'); ?>">
                                    <button <?php echo !defined('IWBVE_ACTIVE') || !IWBVE_ACTIVE ? 'disabled="disabled"' : ''; ?> type="button" class="iwbvel-button iwbvel-button-square iwbvel-button-blue" id="iwbvel-add-meta-field-manual" disabled>
                                        <i class="iwbvel-icon-plus1 iwbvel-m0"></i>
                                    </button>
                                    <div class="iwbvel-add-meta-field-message"></div>
                                </div>
                            </div>
                            <div class="iwbvel-meta-fields-automatic">
                                <label for="iwbvel-add-meta-fields-product-id"><?php esc_html_e('Automatically From product', 'ithemeland-bulk-variation-editing-for-woocommerce'); ?></label>
                                <div class="iwbvel-meta-fields-automatic-field">
                                    <input <?php echo !defined('IWBVE_ACTIVE') || !IWBVE_ACTIVE ? 'disabled="disabled"' : ''; ?> type="text" id="iwbvel-add-meta-fields-product-id" placeholder="<?php esc_attr_e('Enter Product ID ...', 'ithemeland-bulk-variation-editing-for-woocommerce'); ?>">
                                    <button <?php echo !defined('IWBVE_ACTIVE') || !IWBVE_ACTIVE ? 'disabled="disabled"' : ''; ?> type="button" class="iwbvel-button iwbvel-button-square iwbvel-button-blue" id="iwbvel-get-meta-fields-by-product-id">
                                        <i class="iwbvel-icon-plus1 iwbvel-m0"></i>
                                    </button>
                                </div>
                            </div>
                            <?php if (class_exists('ACF')) : ?>
                                <div class="iwbvel-meta-fields-acf">
                                    <label for="iwbvel-add-meta-fields-acf"><?php esc_html_e('ACF PLugin Fields', 'ithemeland-bulk-variation-editing-for-woocommerce'); ?></label>
                                    <div class="iwbvel-meta-fields-acf-field">
                                        <select <?php echo !defined('IWBVE_ACTIVE') || !IWBVE_ACTIVE ? 'disabled="disabled"' : ''; ?> id="iwbvel-add-meta-fields-acf" class="iwbvel-select2"></select>
                                        <button <?php echo !defined('IWBVE_ACTIVE') || !IWBVE_ACTIVE ? 'disabled="disabled"' : ''; ?> type="button" class="iwbvel-button iwbvel-button-square iwbvel-button-blue" id="iwbvel-add-acf-meta-field">
                                            <i class="iwbvel-icon-plus1 iwbvel-m0"></i>
                                        </button>
                                    </div>
                                </div>
                            <?php endif; ?>
                        </div>
                        <form action="<?php echo esc_url(admin_url('admin-post.php')); ?>" method="post">
                            <?php wp_nonce_field('iwbvel_post_nonce'); ?>
                            <input type="hidden" name="action" value="iwbvel_meta_fields">
                            <div class="iwbvel-meta-fields-right" id="iwbvel-meta-fields-items">
                                <div id="iwbvel-meta-fields-loading">
                                    <img src="<?php echo esc_url(IWBVEL_IMAGES_URL . 'loading-2.gif'); ?>" width="20" height="20" alt="Loading ...">
                                </div>

                                <p class="iwbvel-meta-fields-empty-text" style="display: none;">
                                    <?php esc_html_e("Please add your meta key manually", 'ithemeland-bulk-variation-editing-for-woocommerce'); ?>
                                    <br>
                                    <?php esc_html_e("OR", 'ithemeland-bulk-variation-editing-for-woocommerce'); ?>
                                    <br>
                                    <?php esc_html_e("From another product", 'ithemeland-bulk-variation-editing-for-woocommerce'); ?>
                                </p>

                                <div class="iwbvel-meta-fields-items"></div>

                                <div class="droppable-helper"></div>
                            </div>
                            <div class="iwbvel-meta-fields-buttons">
                                <div class="iwbvel-meta-fields-buttons-left">
                                    <button <?php echo !defined('IWBVE_ACTIVE') || !IWBVE_ACTIVE ? 'disabled="disabled"' : ''; ?> type="submit" value="1" name="save_meta_fields" class="iwbvel-button iwbvel-button-lg iwbvel-button-blue">
                                        <img src="<?php echo esc_url(IWBVEL_IMAGES_URL . 'save.svg'); ?>" alt="">
                                        <span><?php esc_html_e('Save Fields', 'ithemeland-bulk-variation-editing-for-woocommerce'); ?></span>
                                    </button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>