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

<div class="iwbvel-float-side-modal" id="iwbvel-float-side-modal-settings">
    <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('Settings', '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>
                <form action="<?php echo esc_url(admin_url('admin-post.php')); ?>" method="post" style="float: left; width: 100%; height: 100%;">
                    <?php wp_nonce_field('iwbvel_post_nonce'); ?>
                    <div class="iwbvel-float-side-modal-body">
                        <div class="iwbvel-wrap">
                            <input type="hidden" name="action" value="iwbvel_settings">
                            <div class="iwbvel-alert iwbvel-alert-default">
                                <span><?php esc_html_e('You can set bulk editor settings', 'ithemeland-bulk-variation-editing-for-woocommerce'); ?></span>
                            </div>
                            <div class="iwbvel-form-group">
                                <label for="iwbvel-settings-count-per-page"><?php esc_html_e('Count Per Page', 'ithemeland-bulk-variation-editing-for-woocommerce'); ?></label>
                                <select name="settings[count_per_page]" id="iwbvel-settings-count-per-page" title="The number of products per page">
                                    <?php
                                    if (!empty($count_per_page_items)) :
                                        foreach ($count_per_page_items as $iwbvel_count_per_page_item) :
                                    ?>
                                            <option value="<?php echo intval(esc_attr($iwbvel_count_per_page_item)); ?>" <?php if (isset($settings['count_per_page']) && $settings['count_per_page'] == intval($iwbvel_count_per_page_item)) : ?> selected <?php endif; ?>>
                                                <?php echo esc_html($iwbvel_count_per_page_item); ?>
                                            </option>
                                    <?php
                                        endforeach;
                                    endif;
                                    ?>
                                </select>
                            </div>
                            <div class="iwbvel-form-group">
                                <label for="iwbvel-settings-default-sort-by"><?php esc_html_e('Default Sort By', 'ithemeland-bulk-variation-editing-for-woocommerce'); ?></label>
                                <select id="iwbvel-settings-default-sort-by" class="iwbvel-input-md" name="settings[default_sort_by]">
                                    <option value="ID" <?php echo (isset($settings['default_sort_by']) && $settings['default_sort_by'] == 'ID') ? 'selected' : ''; ?>>
                                        <?php esc_html_e('ID', 'ithemeland-bulk-variation-editing-for-woocommerce'); ?>
                                    </option>
                                    <option value="title" <?php echo (isset($settings['default_sort_by']) && $settings['default_sort_by'] == 'title') ? 'selected' : ''; ?>>
                                        <?php esc_html_e('Title', 'ithemeland-bulk-variation-editing-for-woocommerce'); ?>
                                    </option>
                                    <option value="regular_price" <?php echo (isset($settings['default_sort_by']) && $settings['default_sort_by'] == 'regular_price') ? 'selected' : ''; ?>>
                                        <?php esc_html_e('Regular price', 'ithemeland-bulk-variation-editing-for-woocommerce'); ?>
                                    </option>
                                    <option value="sale_price" <?php echo (isset($settings['default_sort_by']) && $settings['default_sort_by'] == 'sale_price') ? 'selected' : ''; ?>>
                                        <?php esc_html_e('Sale price', 'ithemeland-bulk-variation-editing-for-woocommerce'); ?>
                                    </option>
                                    <option value="sku" <?php echo (isset($settings['default_sort_by']) && $settings['default_sort_by'] == 'sku') ? 'selected' : ''; ?>>
                                        <?php esc_html_e('SKU', 'ithemeland-bulk-variation-editing-for-woocommerce'); ?>
                                    </option>
                                    <option value="manage_stock" <?php echo (isset($settings['default_sort_by']) && $settings['default_sort_by'] == 'manage_stock') ? 'selected' : ''; ?>>
                                        <?php esc_html_e('Manage Stock', 'ithemeland-bulk-variation-editing-for-woocommerce'); ?>
                                    </option>
                                    <option value="stock_quantity" <?php echo (isset($settings['default_sort_by']) && $settings['default_sort_by'] == 'stock_quantity') ? 'selected' : ''; ?>>
                                        <?php esc_html_e('Stock Quantity', 'ithemeland-bulk-variation-editing-for-woocommerce'); ?>
                                    </option>
                                    <option value="stock_status" <?php echo (isset($settings['default_sort_by']) && $settings['default_sort_by'] == 'stock_status') ? 'selected' : ''; ?>>
                                        <?php esc_html_e('Stock Status', 'ithemeland-bulk-variation-editing-for-woocommerce'); ?>
                                    </option>
                                </select>
                            </div>
                            <div class="iwbvel-form-group">
                                <label for="iwbvel-settings-default-sort"><?php esc_html_e('Default Sort', 'ithemeland-bulk-variation-editing-for-woocommerce'); ?></label>
                                <select name="settings[default_sort]" id="iwbvel-settings-default-sort" class="iwbvel-input-md">
                                    <option value="ASC" <?php echo (isset($settings['default_sort']) && $settings['default_sort'] == 'ASC') ? 'selected' : ''; ?>>
                                        <?php esc_html_e('ASC', 'ithemeland-bulk-variation-editing-for-woocommerce'); ?>
                                    </option>
                                    <option value="DESC" <?php echo (isset($settings['default_sort']) && $settings['default_sort'] == 'DESC') ? 'selected' : ''; ?>>
                                        <?php esc_html_e('DESC', 'ithemeland-bulk-variation-editing-for-woocommerce'); ?>
                                    </option>
                                </select>
                            </div>
                            <div class="iwbvel-form-group">
                                <label for="iwbvel-settings-close-popup-after-applying"><?php esc_html_e('Close popup after applying', 'ithemeland-bulk-variation-editing-for-woocommerce'); ?></label>
                                <select name="settings[close_popup_after_applying]" id="iwbvel-settings-close-popup-after-applying" class="iwbvel-input-md">
                                    <option value="yes" <?php echo (isset($settings['close_popup_after_applying']) && $settings['close_popup_after_applying'] == 'yes') ? 'selected' : ''; ?>>
                                        <?php esc_html_e('Yes', 'ithemeland-bulk-variation-editing-for-woocommerce'); ?>
                                    </option>
                                    <option value="no" <?php echo (isset($settings['close_popup_after_applying']) && $settings['close_popup_after_applying'] == 'no') ? 'selected' : ''; ?>>
                                        <?php esc_html_e('No', 'ithemeland-bulk-variation-editing-for-woocommerce'); ?>
                                    </option>
                                </select>
                            </div>
                            <div class="iwbvel-form-group">
                                <label for="iwbvel-settings-sticky-first-columns"><?php esc_html_e("Sticky 'ID' & 'Title' Columns", 'ithemeland-bulk-variation-editing-for-woocommerce'); ?></label>
                                <select name="settings[sticky_first_columns]" id="iwbvel-settings-sticky-first-columns" class="iwbvel-input-md">
                                    <option value="yes" <?php echo (isset($settings['sticky_first_columns']) && $settings['sticky_first_columns'] == 'yes') ? 'selected' : ''; ?>>
                                        <?php esc_html_e('Yes', 'ithemeland-bulk-variation-editing-for-woocommerce'); ?>
                                    </option>
                                    <option value="no" <?php echo (isset($settings['sticky_first_columns']) && $settings['sticky_first_columns'] == 'no') ? 'selected' : ''; ?>>
                                        <?php esc_html_e('No', 'ithemeland-bulk-variation-editing-for-woocommerce'); ?>
                                    </option>
                                </select>
                            </div>
                            <div class="iwbvel-form-group">
                                <label for="iwbvel-settings-display-full-columns-title"><?php esc_html_e('Display Columns Label', 'ithemeland-bulk-variation-editing-for-woocommerce'); ?></label>
                                <select name="settings[display_full_columns_title]" id="iwbvel-settings-display-full-columns-title" class="iwbvel-input-md">
                                    <option value="yes" <?php echo (isset($settings['display_full_columns_title']) && $settings['display_full_columns_title'] == 'yes') ? 'selected' : ''; ?>>
                                        <?php esc_html_e('Completely', 'ithemeland-bulk-variation-editing-for-woocommerce'); ?>
                                    </option>
                                    <option value="no" <?php echo (isset($settings['display_full_columns_title']) && $settings['display_full_columns_title'] == 'no') ? 'selected' : ''; ?>>
                                        <?php esc_html_e('In short', 'ithemeland-bulk-variation-editing-for-woocommerce'); ?>
                                    </option>
                                </select>
                            </div>
                            <div class="iwbvel-form-group">
                                <label for="iwbvel-settings-display-cell-content"><?php esc_html_e('Display cell content', 'ithemeland-bulk-variation-editing-for-woocommerce'); ?></label>
                                <select name="settings[display_cell_content]" id="iwbvel-settings-display-cell-content" class="iwbvel-input-md">
                                    <option value="long" <?php echo (isset($settings['display_cell_content']) && $settings['display_cell_content'] == 'long') ? 'selected' : ''; ?>>
                                        <?php esc_html_e('Long text', 'ithemeland-bulk-variation-editing-for-woocommerce'); ?>
                                    </option>
                                    <option value="short" <?php echo (isset($settings['display_cell_content']) && $settings['display_cell_content'] == 'short') ? 'selected' : ''; ?>>
                                        <?php esc_html_e('Short text', 'ithemeland-bulk-variation-editing-for-woocommerce'); ?>
                                    </option>
                                </select>
                                <p class="iwbvel-settings-description"><?php esc_html_e("If choose 'Short text' the cell content will be trimmed", 'ithemeland-bulk-variation-editing-for-woocommerce'); ?></p>
                            </div>
                            <div class="iwbvel-form-group">
                                <label for="iwbvel-settings-enable-thumbnail-popup"><?php esc_html_e('Enable Thumbnail Popup', 'ithemeland-bulk-variation-editing-for-woocommerce'); ?></label>
                                <select name="settings[enable_thumbnail_popup]" id="iwbvel-settings-enable-thumbnail-popup" class="iwbvel-input-md">
                                    <option value="yes" <?php echo (isset($settings['enable_thumbnail_popup']) && $settings['enable_thumbnail_popup'] == 'yes') ? 'selected' : ''; ?>>
                                        <?php esc_html_e('Yes', 'ithemeland-bulk-variation-editing-for-woocommerce'); ?>
                                    </option>
                                    <option value="no" <?php echo (isset($settings['enable_thumbnail_popup']) && $settings['enable_thumbnail_popup'] == 'no') ? 'selected' : ''; ?>>
                                        <?php esc_html_e('No', 'ithemeland-bulk-variation-editing-for-woocommerce'); ?>
                                    </option>
                                </select>
                            </div>
                            <div class="iwbvel-form-group">
                                <label for="iwbvel-settings-keep-filled-data-in-bulk-edit-form"><?php esc_html_e('Keep filled data in bulk edit form', 'ithemeland-bulk-variation-editing-for-woocommerce'); ?></label>
                                <select name="settings[keep_filled_data_in_bulk_edit_form]" id="iwbvel-settings-keep-filled-data-in-bulk-edit-form" class="iwbvel-input-md">
                                    <option value="no" <?php echo (isset($settings['keep_filled_data_in_bulk_edit_form']) && $settings['keep_filled_data_in_bulk_edit_form'] == 'no') ? 'selected' : ''; ?>>
                                        <?php esc_html_e('No', 'ithemeland-bulk-variation-editing-for-woocommerce'); ?>
                                    </option>
                                    <option value="yes" <?php echo (isset($settings['keep_filled_data_in_bulk_edit_form']) && $settings['keep_filled_data_in_bulk_edit_form'] == 'yes') ? 'selected' : ''; ?>>
                                        <?php esc_html_e('Yes', 'ithemeland-bulk-variation-editing-for-woocommerce'); ?>
                                    </option>
                                </select>
                            </div>
                            <div class="iwbvel-form-group">
                                <label for="iwbvel-settings-show-only-filtered-variations"><?php esc_html_e('Show Only Filtered Variations', 'ithemeland-bulk-variation-editing-for-woocommerce'); ?></label>
                                <select name="settings[show_only_filtered_variations]" id="iwbvel-settings-show-only-filtered-variations" class="iwbvel-input-md">
                                    <option value="yes" <?php echo (isset($settings['show_only_filtered_variations']) && $settings['show_only_filtered_variations'] == 'yes') ? 'selected' : ''; ?>>
                                        <?php esc_html_e('Yes', 'ithemeland-bulk-variation-editing-for-woocommerce'); ?>
                                    </option>
                                    <option value="no" <?php echo (isset($settings['show_only_filtered_variations']) && $settings['show_only_filtered_variations'] == 'no') ? 'selected' : ''; ?>>
                                        <?php esc_html_e('No', 'ithemeland-bulk-variation-editing-for-woocommerce'); ?>
                                    </option>
                                </select>
                            </div>
                            <div class="iwbvel-form-group">
                                <label for="iwbvel-settings-enable-load-more-variations"><?php esc_html_e('Enable "Load  More" for variations', 'ithemeland-bulk-variation-editing-for-woocommerce'); ?></label>
                                <select name="settings[enable_load_more_variations]" id="iwbvel-settings-enable-load-more-variations" class="iwbvel-input-md">
                                    <option value="yes" <?php echo (isset($settings['enable_load_more_variations']) && $settings['enable_load_more_variations'] == 'yes') ? 'selected' : ''; ?>>
                                        <?php esc_html_e('Yes', 'ithemeland-bulk-variation-editing-for-woocommerce'); ?>
                                    </option>
                                    <option value="no" <?php echo (isset($settings['enable_load_more_variations']) && $settings['enable_load_more_variations'] == 'no') ? 'selected' : ''; ?>>
                                        <?php esc_html_e('No', 'ithemeland-bulk-variation-editing-for-woocommerce'); ?>
                                    </option>
                                </select>
                                <p class="iwbvel-settings-description"><?php esc_html_e('Show all of variations on table at same time', 'ithemeland-bulk-variation-editing-for-woocommerce'); ?></p>
                            </div>
                            <div class="iwbvel-form-group">
                                <label for="iwbvel-settings-enable-background-processing"><?php esc_html_e('Enable Background Processing', 'ithemeland-bulk-variation-editing-for-woocommerce'); ?></label>
                                <select name="settings[enable_background_processing]" id="iwbvel-settings-enable-background-processing" class="iwbvel-input-md">
                                    <option value="no" <?php echo (isset($settings['enable_background_processing']) && $settings['enable_background_processing'] == 'no') ? 'selected' : ''; ?>>
                                        <?php esc_html_e('No', 'ithemeland-bulk-variation-editing-for-woocommerce'); ?>
                                    </option>
                                    <option value="yes" <?php echo (isset($settings['enable_background_processing']) && $settings['enable_background_processing'] == 'yes') ? 'selected' : ''; ?>>
                                        <?php esc_html_e('Yes', 'ithemeland-bulk-variation-editing-for-woocommerce'); ?>
                                    </option>
                                </select>
                                <p class="iwbvel-settings-description">If you enable this option, all the heavy and time-consuming operations are executed as Background Processing until the end, and you are safe from the <strong>"Error 524: A Timeout Occurred"</strong> message.
                                    <br>
                                    Note) You will not be able to access other parts of the plugin while the operation is running.
                                </p>
                            </div>
                        </div>
                    </div>
                    <div class="iwbvel-float-side-modal-footer">
                        <button type="submit" class="iwbvel-button iwbvel-button-blue">
                            <img src="<?php echo esc_url(IWBVEL_IMAGES_URL . 'save.svg'); ?>" alt="">
                            <span><?php esc_html_e('Save Changes', 'ithemeland-bulk-variation-editing-for-woocommerce'); ?></span>
                        </button>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>