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

if (empty($has_compatible_fields) || empty($compatible_fields_status) || !is_array($compatible_fields_status) || empty($compatible_tabs_label) || empty($compatibles)) {
    return '';
}
?>

<!-- tabs title-->
<ul class="iwbvel-sub-tab-titles">
    <?php
    $iwbvel_i = 1;
    foreach ($compatible_fields_status as $iwbvel_key => $iwbvel_status) :
        if (!$iwbvel_status || empty($compatible_tabs_label[$iwbvel_key])) {
            continue;
        }
    ?>
        <li><a href="javascript:;" class="iwbvel-sub-tab-title <?php echo ($iwbvel_i == 1) ? 'active' : ''; ?>" data-content="<?php echo esc_attr($iwbvel_key); ?>"><?php echo esc_html($compatible_tabs_label[$iwbvel_key]); ?></a></li>
    <?php
        $iwbvel_i++;
    endforeach;
    ?>
</ul>

<!-- tabs content -->
<div class="iwbvel-sub-tab-contents">
    <?php
    $iwbvel_i = 1;
    foreach ($compatible_fields_status as $iwbvel_key => $iwbvel_status) :
        if (!$iwbvel_status || empty($compatible_tabs_label[$iwbvel_key]) || empty($compatibles[$iwbvel_key])) {
            continue;
        }
    ?>
        <div class="iwbvel-sub-tab-content" data-content="<?php echo esc_attr($iwbvel_key); ?>" style="<?php echo ($iwbvel_i == 1) ? 'display: block;' : ''; ?>">
            <?php
            foreach ($compatibles[$iwbvel_key] as $iwbvel_plugin_key => $iwbvel_data) {
                if (!$iwbvel_data['status'] || !file_exists($iwbvel_data['edit_fields'])) {
                    continue;
                }

                include $iwbvel_data['edit_fields'];
            }
            ?>
        </div>
    <?php
        $iwbvel_i++;
    endforeach;
    ?>
</div>