<?php
$class = isset($args['class']) ? $args['class'] : '';
$row_class = isset($args['row_class']) ? $args['row_class'] : '';
$col_class = isset($args['col_class']) ? $args['col_class'] : '';
$inner_col_class = isset($args['inner_col_class']) ? $args['inner_col_class'] : '';
// $col_stake = isset($args['col_stake']) ? true : false;
$col_stake = isset($args['col_stake']) && $args['col_stake'] === true;
$is_card_number = $args['is_card_number'] ?? true;
?>

<section class="section magento-integration-solutions <?php echo $class;?>">
    <div class="container">
        <div class="text-cont <?php echo $col_stake == true ? 'text-center' : '';?>">
            <div class="row">
                <div class="<?php echo $col_stake == true ? 'col-12' : 'col-md-7';?>">
                    <h2 class="section-title"><?php echo get_field('supply_chain_benefits__section_heading')?></h2>
                </div>
                <div class="<?php echo $col_stake == true ? 'col-12' : 'col-md-5';?>">
                    <p class="section-content pt-0 mt-0"><?php echo get_field('supply_chain_benefits__section_text')?></p>
                </div>
            </div>
        </div>
        <div class="bg-wrapper">
            <div class="row justify-content-end wrapper">
                <div class="<?php echo $col_class ? $col_class : 'col-xl-7 col-lg-8' ?>">
                <?php if( have_rows('supply_chain_benefits__repeater') ): ?>
                    <div class="row <?php echo $row_class ? $row_class : 'gy-2 gx-2' ?>">
                    <?php $i = 1; while( have_rows('supply_chain_benefits__repeater') ): the_row(); ?>
                        <div class="<?php echo $inner_col_class ? $inner_col_class : 'col-md-6' ?>">
                            <div class="card">
									<?php if ($is_card_number !== false) : ?>
										<div class="svg-wrapper mb-3">
											<span class="number"><?php echo str_pad($i, 2, '0', STR_PAD_LEFT); ?></span>
										</div>
									<?php endif; ?>

                                <div class="d-flex gap-4 align-items-center title-box">
                                    <h3><?php echo get_sub_field('supply_chain_benefits__repeater_card_heading')?></h3>
                                </div>
                                <p class="text"><?php echo get_sub_field('supply_chain_benefits__repeater_card_text')?></p>
                            </div>
                        </div>
                        <?php $i++; endwhile; ?>
                    </div>
                    <?php endif; ?>
                </div>
            </div>
        </div>

        <?php $cta = get_field('supply_chain_benefits__section__cta');
        if($cta) :
        ?>
        <div class="text-center mt-5">
            <a href="<?php echo esc_url($cta['url'])?>" class="primary animated-cta-btn"><?php echo $cta['title'];?></a>
        </div>
        <?php endif;?>

    </div>
</section>