<?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_wc_vendors = $iwbvel_product_repository->get_wc_product_vendors();
$iwbvel_wc_vendors_options = '';
if (!empty($iwbvel_wc_vendors)) {
    foreach ($iwbvel_wc_vendors as $iwbvel_wc_vendor) {
        if ($iwbvel_wc_vendor instanceof \WP_Term) {
            $iwbvel_wc_vendors_options .= '<option value="' . esc_attr($iwbvel_wc_vendor->slug) . '">' . esc_html($iwbvel_wc_vendor->name) . '</option>';
        }
    }
}
?>

<div class="iwbvel-form-group" data-name="by">
    <strong>By WooCommerce</strong>
    <hr>
</div>
<div class="iwbvel-form-group" data-name="_wcpv_product_commission">
    <label for="iwbvel-filter-form-wc-product-commission-from"><?php esc_html_e('Product commission', 'ithemeland-bulk-variation-editing-for-woocommerce'); ?></label>
    <input class="iwbvel-input-ft" type="number" data-field="from" id="iwbvel-filter-form-wc-product-commission-from" placeholder="<?php esc_attr_e('From', 'ithemeland-bulk-variation-editing-for-woocommerce'); ?>">
    <input class="iwbvel-input-ft" type="number" data-field="to" id="iwbvel-filter-form-wc-product-commission-to" placeholder="<?php esc_attr_e('To', 'ithemeland-bulk-variation-editing-for-woocommerce'); ?>">
</div>
<div class="iwbvel-form-group" data-name="_wcpv_product_taxes">
    <label for="iwbvel-filter-form-wc-product-taxes"><?php esc_html_e('Tax handling', 'ithemeland-bulk-variation-editing-for-woocommerce'); ?></label>
    <select id="iwbvel-filter-form-wc-product-taxes" data-field="value" class="iwbvel-input-ft">
        <option value=""><?php esc_html_e('Select', 'ithemeland-bulk-variation-editing-for-woocommerce'); ?></option>
        <option value="keep-tax"><?php esc_html_e('Keep taxes', 'ithemeland-bulk-variation-editing-for-woocommerce'); ?></option>
        <option value="pass-tax"><?php esc_html_e('Pass taxes', 'ithemeland-bulk-variation-editing-for-woocommerce'); ?></option>
        <option value="split-tax"><?php esc_html_e('Split taxes', 'ithemeland-bulk-variation-editing-for-woocommerce'); ?></option>
    </select>
</div>
<div class="iwbvel-form-group" data-name="_wcpv_product_pass_shipping">
    <label for="iwbvel-filter-form-wc-pass-shipping"><?php esc_html_e('Pass shipping', 'ithemeland-bulk-variation-editing-for-woocommerce'); ?></label>
    <select id="iwbvel-filter-form-wc-pass-shipping" data-field="value" class="iwbvel-input-ft">
        <option value=""><?php esc_html_e('Select', 'ithemeland-bulk-variation-editing-for-woocommerce'); ?></option>
        <option value="yes"><?php esc_html_e('Yes', 'ithemeland-bulk-variation-editing-for-woocommerce'); ?></option>
        <option value="no"><?php esc_html_e('No', 'ithemeland-bulk-variation-editing-for-woocommerce'); ?></option>
    </select>
</div>
<div class="iwbvel-form-group" data-name="wcpv_product_vendors">
    <label for="iwbvel-filter-form-wc-vendor"><?php esc_html_e('Vendor', 'ithemeland-bulk-variation-editing-for-woocommerce'); ?></label>
    <select id="iwbvel-filter-form-wc-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-wc-vendor" data-field="value" multiple="" data-placeholder="<?php esc_attr_e('Select', 'ithemeland-bulk-variation-editing-for-woocommerce'); ?>">
        <?php echo wp_kses($iwbvel_wc_vendors_options, Sanitizer::allowed_html()); ?>
    </select>
</div>