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

use iwbvel\classes\helpers\Sanitizer;
use iwbvel\classes\repositories\Product;

$iwbvel_product_repository = Product::get_instance();
$iwbvel_yith_vendors = $iwbvel_product_repository->get_yith_vendors();
$iwbvel_yith_vendors_options = '';
if (!empty($iwbvel_yith_vendors)) {
    foreach ($iwbvel_yith_vendors as $iwbvel_yith_vendor) {
        if ($iwbvel_yith_vendor instanceof \WP_Term) {
            $iwbvel_yith_vendors_options .= '<option value="' . esc_attr($iwbvel_yith_vendor->slug) . '">' . esc_html($iwbvel_yith_vendor->name) . '</option>';
        }
    }
}
?>

<div class="iwbvel-form-group" data-name="by">
    <strong>By Yith</strong>
    <hr>
</div>
<div class="iwbvel-form-group" data-name="_product_commission">
    <label for="iwbvel-filter-form-yith-product-commission-from"><?php esc_html_e('Product commission', 'ithemeland-bulk-variation-editing-for-woocommerce'); ?></label>
    <input type="number" data-field="from" class="iwbvel-input-ft" id="iwbvel-filter-form-yith-product-commission-from" placeholder="<?php esc_attr_e('From', 'ithemeland-bulk-variation-editing-for-woocommerce'); ?>">
    <input type="number" data-field="to" class="iwbvel-input-ft" id="iwbvel-filter-form-yith-product-commission-to" placeholder="<?php esc_attr_e('To', 'ithemeland-bulk-variation-editing-for-woocommerce'); ?>">
</div>
<div class="iwbvel-form-group" data-name="yith_shop_vendor">
    <label for="iwbvel-filter-form-yith-vendor"><?php esc_html_e('Product vendor', 'ithemeland-bulk-variation-editing-for-woocommerce'); ?></label>
    <select id="iwbvel-filter-form-yith-vendor-operator" data-field="operator">
        <option value="or"><?php esc_html_e('OR', 'ithemeland-bulk-variation-editing-for-woocommerce'); ?></option>
        <option value="not_in"><?php esc_html_e('NOT IN', 'ithemeland-bulk-variation-editing-for-woocommerce'); ?></option>
    </select>
    <select class="iwbvel-select2" id="iwbvel-filter-form-yith-vendor" data-field="value" multiple="" data-placeholder="<?php esc_attr_e('Select', 'ithemeland-bulk-variation-editing-for-woocommerce'); ?>">
        <?php echo wp_kses($iwbvel_yith_vendors_options, Sanitizer::allowed_html()); ?>
    </select>
</div>