<?php
$col_xs = $widget->get_setting('col_xs', '');
$col_sm = $widget->get_setting('col_sm', '');
$col_md = $widget->get_setting('col_md', '');
$col_lg = $widget->get_setting('col_lg', '');
$col_xl = $widget->get_setting('col_xl', '');

$col_xl = 12 / intval($col_xl);
$col_lg = 12 / intval($col_lg);
$col_md = 12 / intval($col_md); 
$col_sm = 12 / intval($col_sm);
$col_xs = 12 / intval($col_xs);

$grid_sizer = "col-xl-{$col_xl} col-lg-{$col_lg} col-md-{$col_md} col-sm-{$col_sm} col-{$col_xs}";
$item_class = "pxl-grid-item col-xl-{$col_xl} col-lg-{$col_lg} col-md-{$col_md} col-sm-{$col_sm} col-{$col_xs}";
$html_id = pxl_get_element_id($settings);
?>
<?php if(isset($settings['box']) && !empty($settings['box']) && count($settings['box'])): ?>
<div class="pxl-grid pxl-box-grid pxl-box-grid1" data-layout="<?php echo esc_attr($settings['data_layout']); ?>">
    <div class="container">
        <div class="pxl-grid-inner pxl-grid-masonry row" data-gutter="15">
            <?php foreach ($settings['box'] as $key => $value):
                $title = isset($value['title']) ? $value['title'] : '';
                $number = isset($value['number']) ? $value['number'] : '';
                $desc = isset($value['desc']) ? $value['desc'] : '';
                $image = isset($value['image']) ? $value['image'] : '';
                ?>
                <div id="<?php echo esc_attr($html_id.$key); ?>" class="<?php echo esc_attr($item_class); ?>" style="background-image: url(<?php echo esc_attr($value['image']['url']); ?>);">
                    <div class="pxl-item-box">
                        <div class="wrap-inner-content">
                            <div class="pxl-item--inner">
                                <div class="pxl-inner-content">
                                    <span class="pxl-item--title">
                                        <?php echo pxl_print_html($title); ?>
                                    </span>
                                    <span class="pxl-item--number">
                                        <?php echo pxl_print_html($number); ?>
                                    </span>
                                </div>
                                <div class="pxl-item--content">
                                    <?php echo pxl_print_html($desc); ?>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            <?php endforeach; ?>
            <div class="grid-sizer <?php echo esc_attr($grid_sizer); ?>"></div>
        </div>
    </div>
    <div class="pxl-inner-change">
        <div class="bgr-change"></div>
    </div>
</div>
<?php endif; ?>
