<?php
use WpBookingHotel\Language\Text;
use WpBookingHotel\Utilities\Utility;
defined('_WPBOOKINGHOTEL_EXEC') or die;
extract($displayData);

WpBookingHotelHtmlBackend::load_jquery_library('select2');



$id_by_name = "element_field_". $name;
$data = $displayData['field']->getForm()->getData();
$args = array();
$products = wc_get_products($args);
?>
    <div id="<?php echo (esc_attr($id_by_name)) ?>" class="<?php echo (esc_attr($class)); ?> field-opensourcelinkid">
        <div class="wrapper-field-opensourcelinkid">
            <select name="<?php echo (esc_attr($name)); ?>" required="<?php echo (esc_attr($required)) ?>"
                    class="open-source-link">
                <option value=""><?php esc_html_e('Select product','wpbookinghotel') ?></option>
				<?php foreach ($products as $product) { ?>
                    <option <?php echo ($product->get_id() == $value ? ' selected ' : null) ?>
                            value="<?php echo (esc_attr($product->get_id())); ?>"><?php esc_html_e($product->get_name(),'wpbookinghotel'); ?></option>
				<?php } ?>
            </select>
        </div>
    </div>
<?php
$doc = Factory::getDocument();
$doc->addScriptApplySelector('.field-opensourcelinkid','field_opensourcelinkid',array(
        "step"=>  (int)$step,
        "tool_check"=>  json_encode(array_reverse($toolChecked)),
    )
    ,'admin/nb_apps/nb_woobooking/layouts/WooBooking/form/field/opensourcelinkid/opensourcelinkid.jquery.js');