<?php

if( !defined( 'ABSPATH' ) ) {
    die('You cannot be here');
}
if( eprc_get_plugin_options('easy_pricing_plugin_active') ): ?>

<div class='container'>
    <?php
        $pricing_plans = eprc_get_plugin_options('pricing_plans');
        if (is_array($pricing_plans)) {
        foreach($pricing_plans as $index => $plan):
    ?>
    <div class="plan">
        <?php if(isset($plan['price'])): ?>
        <div>
            <span class="plan-price">
                <?php echo esc_html($plan['price']);?>
            </span>
            <span class="per-month">/month</span>
         </div>
        <?php endif; ?>

        <?php if(isset($plan['title'])): ?>
        <div class="plan-title">
            <?php echo esc_html($plan['title']); ?>
        </div>
        <?php endif; ?>

        <?php if(isset($plan['description'])): ?>
        <div    >
            <?php echo esc_html($plan['description']); ?>
        </div>
        <?php endif; ?>

        <ul class="bullet-points">
            <?php foreach($plan['bullet_points'] as $bullet_point): ?>
            <li>
                <?php echo esc_html($bullet_point['bullet_point']); ?>
            </li>
            <?php endforeach; ?>
        </ul>

        <div class="buy-now">
            <!-- Added a data-plan-index attribute to each button -->
                <button type="button" data-plan-index="<?php echo esc_attr($index); ?>">Buy Now</button>
        </div>
    </div>
    <?php endforeach;
    }
    ?>
</div>

<?php else:?>
    <p>The Pricing Plan is not active. Please activate the plugin</p>
<?php endif;?>
