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

<div class="iwbvel-float-side-modal" id="iwbvel-float-side-modal-history">
    <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('History', '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('List of your changes and possible to roll back to the previous data', '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-history-filter">
                            <div class="iwbvel-history-filter-fields">
                                <div class="iwbvel-history-filter-field-item">
                                    <label for="iwbvel-history-filter-operation"><?php esc_html_e('Operation', 'ithemeland-bulk-variation-editing-for-woocommerce'); ?></label>
                                    <select <?php echo !defined('IWBVE_ACTIVE') || !IWBVE_ACTIVE ? 'disabled="disabled"' : ''; ?> id="iwbvel-history-filter-operation">
                                        <option value=""><?php esc_html_e('Select', 'ithemeland-bulk-variation-editing-for-woocommerce'); ?></option>
                                        <?php
                                        if (!empty($iwbvel_history_types = \iwbvel\classes\repositories\history\History_Main::get_operation_types())) :
                                            foreach ($iwbvel_history_types as $iwbvel_history_type_key => $iwbvel_history_type_label) :
                                        ?>
                                                <option value="<?php echo esc_attr($iwbvel_history_type_key); ?>"><?php echo esc_html($iwbvel_history_type_label); ?></option>
                                        <?php
                                            endforeach;
                                        endif;
                                        ?>
                                    </select>
                                </div>
                                <div class="iwbvel-history-filter-field-item">
                                    <label for="iwbvel-history-filter-author"><?php esc_html_e('Author', 'ithemeland-bulk-variation-editing-for-woocommerce'); ?></label>
                                    <select id="iwbvel-history-filter-author" class="iwbvel-select2-users"></select>
                                </div>
                                <div class="iwbvel-history-filter-field-item">
                                    <label for="iwbvel-history-filter-fields"><?php esc_html_e('Fields', 'ithemeland-bulk-variation-editing-for-woocommerce'); ?></label>
                                    <input type="text" id="iwbvel-history-filter-fields" placeholder="for example: ID">
                                </div>
                                <div class="iwbvel-history-filter-field-item iwbvel-history-filter-field-date">
                                    <label><?php esc_html_e('Date', 'ithemeland-bulk-variation-editing-for-woocommerce'); ?></label>
                                    <input type="text" id="iwbvel-history-filter-date-from" class="iwbvel-datepicker iwbvel-date-from" data-to-id="iwbvel-history-filter-date-to" placeholder="<?php esc_html_e('From ...', 'ithemeland-bulk-variation-editing-for-woocommerce'); ?>">
                                    <input type="text" id="iwbvel-history-filter-date-to" class="iwbvel-datepicker" placeholder="<?php esc_attr_e('To ...', 'ithemeland-bulk-variation-editing-for-woocommerce'); ?>">
                                </div>
                            </div>
                            <div class="iwbvel-history-filter-buttons">
                                <div class="iwbvel-history-filter-buttons-left">
                                    <button <?php echo (!defined('IWBVE_ACTIVE') || !IWBVE_ACTIVE) ? 'disabled="disabled"' : ''; ?> type="button" class="iwbvel-button iwbvel-button-lg iwbvel-button-blue" id="iwbvel-history-filter-apply">
                                        <i class="iwbvel-icon-filter1"></i>
                                        <span><?php esc_html_e('Apply Filters', 'ithemeland-bulk-variation-editing-for-woocommerce'); ?></span>
                                    </button>
                                    <button <?php echo (!defined('IWBVE_ACTIVE') || !IWBVE_ACTIVE) ? 'disabled="disabled"' : ''; ?> type="button" class="iwbvel-button iwbvel-button-lg iwbvel-button-gray" id="iwbvel-history-filter-reset">
                                        <i class="iwbvel-icon-rotate-cw"></i>
                                        <span><?php esc_html_e('Reset Filters', 'ithemeland-bulk-variation-editing-for-woocommerce'); ?></span>
                                    </button>
                                </div>
                                <div class="iwbvel-history-filter-buttons-right">
                                    <form action="<?php echo esc_url(admin_url('admin-post.php')); ?>" method="post" id="iwbvel-history-clear-all">
                                        <?php wp_nonce_field('iwbvel_post_nonce'); ?>
                                        <input <?php echo (!defined('IWBVE_ACTIVE') || !IWBVE_ACTIVE) ? 'disabled="disabled"' : ''; ?> type="hidden" name="action" value="iwbvel_clear_all_history">
                                        <button <?php echo (!defined('IWBVE_ACTIVE') || !IWBVE_ACTIVE) ? 'disabled="disabled"' : ''; ?> type="button" name="clear_all" value="1" id="iwbvel-history-clear-all-btn" class="iwbvel-button iwbvel-button-lg iwbvel-button-red">
                                            <i class="iwbvel-icon-trash-2"></i>
                                            <span><?php esc_html_e('Clear History', 'ithemeland-bulk-variation-editing-for-woocommerce'); ?></span>
                                        </button>
                                    </form>
                                </div>
                            </div>
                        </div>
                        <div class="iwbvel-history-items">
                            <h3><?php esc_html_e('Column(s)', 'ithemeland-bulk-variation-editing-for-woocommerce'); ?></h3>
                            <form action="<?php echo esc_url(admin_url('admin-post.php')); ?>" method="post" id="iwbvel-history-items">
                                <?php wp_nonce_field('iwbvel_post_nonce'); ?>
                                <input type="hidden" name="action" value="iwbvel_history_action">
                                <input type="hidden" name="" value="" id="iwbvel-history-clicked-id">
                                <div class="iwbvel-table-border-radius">
                                    <table>
                                        <thead>
                                            <tr>
                                                <th>#</th>
                                                <th><?php esc_html_e('History Name', 'ithemeland-bulk-variation-editing-for-woocommerce'); ?></th>
                                                <th><?php esc_html_e('Author', 'ithemeland-bulk-variation-editing-for-woocommerce'); ?></th>
                                                <th class="iwbvel-mw125"><?php esc_html_e('Date Modified', 'ithemeland-bulk-variation-editing-for-woocommerce'); ?></th>
                                                <th class="iwbvel-mw250"><?php esc_html_e('Actions', 'ithemeland-bulk-variation-editing-for-woocommerce'); ?></th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                            <tr>
                                                <td colspan="5" style="text-align: center;"><img src="<?php echo esc_url(IWBVEL_IMAGES_URL . 'loading-2.gif'); ?>" alt="Loading ..." width="22" height="22"></td>
                                            </tr>
                                        </tbody>
                                    </table>
                                </div>
                                <div class="iwbvel-history-pagination-container"></div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>