<?php

namespace DropshippingExportFreeVendor;

use DropshippingExportFreeVendor\WPDesk\Library\DropshippingExport\Form\Fields\Component\PriceCompareProductFieldsComponent;
/**
 * @var \WPDesk\Forms\Field $field
 * @var \WPDesk\View\Renderer\Renderer $renderer
 * @var string $name_prefix
 * @var string $value
 *
 * @var string $template_name Real field template.
 */
?>

<table class="form-table export-data-table odd-blue" style="margin:auto">
								<tbody>
									<tr>
										<td style="width:10px;"><input type="checkbox" name="select_all_product_fields" id="select_all_product_fields" value="0"> </td>
										<td><strong><?php 
\esc_html_e('Field Name', 'dropshipping-export-free');
?></strong> </td>
										<td><strong><?php 
\esc_html_e('Woocommerce field name', 'dropshipping-export-free');
?></strong> </td>
										<td style="width:10px;"></td>
									</tr>


<?php 
$items = $field->get_items();
$single_order = isset($value) && !empty($value) && \is_array($value) ? \array_keys($value) : \array_keys($items);
\uksort($items, function ($key1, $key2) use ($single_order) {
    return \array_search($key1, $single_order, \true) > \array_search($key2, $single_order, \true) ? 1 : 0;
});
foreach ($items as $key => $item_row) {
    ?>
		<tr class="sort-item">
			<td>
			<?php 
    foreach ($item_row as $item) {
        if ($item->has_label()) {
            $renderer->output_render('label', ['field' => $item, 'renderer' => $renderer]);
            ?>
					</td><td>	
					<?php 
        }
        $val = \is_array($value) && isset($value[$key][$item->get_name()]) ? $value[$key][$item->get_name()] : $item->get_default_value();
        $item->set_attribute('id', $name_prefix . '_' . $field->get_id() . '_' . $item->get_id() . '_' . $key);
        $renderer->output_render($item->get_template_name(), ['field' => $item, 'renderer' => $renderer, 'name_prefix' => $name_prefix . '[' . $field->get_name() . '][' . $key . ']', 'value' => $val, 'multiple' => \false]);
        if (PriceCompareProductFieldsComponent::FIELD_ACTIVE === $item->get_name()) {
            ?>
					</td><td>	
					<?php 
        }
        ?>
				

			<?php 
    }
    ?>
			</td>
		</tr>
	<?php 
}
?>

								</tbody></table>
<?php 
