<?php 
    $is_cases = (isset($settings['cases']) && !empty($settings['cases']) && count($settings['cases'])) || false;
    $col_xxl = ($settings['col_xxl'] == '5') ? 'pxl5' : 12 / (int)$settings['col_xxl'];
    $col_xl = ($settings['col_xl'] == '5') ? 'pxl5' : 12 / (int)$settings['col_xl'];
    $col_lg = 12 / (int)$settings['col_lg'];
    $col_md = 12 / (int)$settings['col_md'];
    $col_sm = 12 / (int)$settings['col_sm'];
    $col_xs = 12 / (int)$settings['col_xs'];
    $grid_item = "col-xxl-{$col_xxl} col-xl-{$col_xl} col-lg-{$col_lg} col-md-{$col_md} col-sm-{$col_sm} col-{$col_xs}";

    $animate_delay = !empty($settings['pxl_animate_delay']) ? (int)$settings['pxl_animate_delay'] : 0;
?>

<?php if($is_cases) : ?>
    <div class="pxl-grid pxl-showcase pxl-showcase2">
        <div class="pxl-item--container">
            <div class="pxl-item--inner row">
                <?php foreach($settings['cases'] as $key => $case) : ?>
                    <?php 
                        $image = solarva_get_thumbnail($case['image']['id']);    
                        $link = solarva_get_link($case['link']);
                        $link2 = solarva_get_link($case['link2']);
                        $bg_url = solarva_get_thumbnail($case['bg_image']['id'], 'full', true);  
                        $coming_soon = !empty($case['is_coming_soon']) ? 'coming-soon' : '';
                        $wow_delay = $key * $animate_delay;
                    ?>
                    <div class="pxl-item--single <?php echo esc_attr($grid_item.' '.'elementor-repeater-item-' . esc_attr( $case['_id'] ).' '.$coming_soon.' '.$settings['pxl_animate']); ?>" data-wow-delay="<?php echo esc_attr($wow_delay.'ms'); ?>">
                        <div class="pxl-item--showcase">
                            <div class="pxl-item--feature" style="background-image: url('<?php echo esc_url($bg_url); ?>')">
                                <div class="pxl-item--bg"></div>
                                <div class="pxl-item--image">
                                    <?php pxl_print_html($image); ?>
                                </div>
                                <a class="pxl-item--link" <?php pxl_print_html($link); ?>></a>
                            </div>
                            <div class="pxl-item--content">
                                <?php if(!empty($coming_soon)) : ?> 
                                    <h4 class="pxl-coming-soon">
                                        <span class="coming-soon-text">
                                            <?php echo esc_attr($settings['coming_soon_text']); ?>
                                        </span>
                                    </h4>
                                <?php else: ?>
                                    <div class="pxl-item--group">
                                        <h6 class="pxl-item--title">
                                            <a class="pxl-title--link" <?php pxl_print_html($link); ?> >
                                                <span class="pxl-btn--text">
                                                    <?php echo esc_attr($case['title']); ?>
                                                </span>
                                            </a>
                                        </h6>
                                        <div class="pxl-item--subtitle">
                                            <?php echo esc_attr($case['subtitle']); ?>
                                        </div>
                                    </div>
                                    <div class="pxl-btn--group">
                                        <a class="btn pxl-item--btn pxl-item--btn1" <?php pxl_print_html($link); ?>>
                                            <span class="pxl-btn--text">
                                                <?php echo esc_attr($settings['button_text']); ?>
                                            </span>
                                        </a>
                                        <a class="btn pxl-item--btn pxl-item--btn2" <?php pxl_print_html($link2); ?>>
                                            <span class="pxl-btn--text">
                                                <?php echo esc_attr($settings['button_text2']); ?>
                                            </span>
                                        </a>
                                    </div>
                                <?php endif; ?>
                            </div>
                        </div>
                    </div>
                <?php endforeach; ?>
            </div>
        </div>
    </div>
<?php endif; ?>