<?php
$class = isset($args['class']) ? $args['class'] : '';
$category = isset($args['category']) ? $args['category'] : '';
$query_args = array(
    'post_type'           => 'industry',
    'post_status'         => 'publish',
    'ignore_sticky_posts' => 1,
    'posts_per_page'      => -1,
    'orderby'             => 'menu_order',
    'order'               => 'ASC',
    'tax_query'           => array(array(
        'taxonomy' => 'industry_categories',
        'field'    => 'slug',
        'terms'    => $category ? $category : 'all',
        'operator' => 'IN'
    ))
);

$industries = new WP_Query($query_args);

?>


<?php if ($industries->have_posts()) : ?>

<section class="section industry-specific-solutions <?php echo $class?>">
    <div class="container-fluid">
       <div class="row gy-4 gy-lg-0">
           <div class="col-xl-6">
               <div class="text-cont">
                    <h2 class="section-title mb-5">
                        <?php echo get_field('industry_solutions_heading'); ?>
                    </h2>
                    <p class="section-content"><?php echo get_field('industry_solutions_description'); ?></p>
                    <?php $cta = get_field('industry_solutions_cta'); 
                    if($cta):
                    ?>
                    <a href="<?php echo esc_url($cta['url']); ?>" class="purple-outline-btn animated-btn mt-4" <?php echo is_modal_link($cta['url']); ?>><?php echo $cta['title']; ?></a>
                    <?php endif; ?>
                    <div class="slide-owl-nav d-none d-xl-flex">
                        <button class="slide-prev-button" aria-label="prev button">
                            <img src='<?php echo get_template_directory_uri(); ?>/assets/img/left-arrow.webp' alt="prev button image" width="22" height="15">
                        </button>
                        <button class="slide-next-button" aria-label="next button">
                            <img src='<?php echo get_template_directory_uri(); ?>/assets/img/right-arrow.webp' alt="next button image" width="22" height="15">
                        </button>
                    </div>
               </div>
           </div>
           <div class="col-xl-6 pr-md-0">
               <div class="owl-carousel owl-theme industry-specific-slider">
                        <?php while ($industries->have_posts()) : $industries->the_post(); ?>
                            <div class="item">
                                <div class="card h-100">
                                    <img src="<?php echo get_field('industry_image'); ?>" alt="<?php echo strip_tags(get_the_title()); ?>" class="img-fluid">
                                    <div class="content-wrapper">
                                        <div class="text-content">
                                            <h3><?php echo get_the_title(); ?></h3>
                                            <span>
                                                <?php echo get_field('svgicon'); ?>
												<?php if(get_field('industry_icon')):?>
												<img src="<?php echo get_field('industry_icon')?>" alt="card icon" width="100" height="100" loading="lazy" decoding="async" class="img-fluid">
												<?php endif; ?>
                                            </span>
                                        </div>
                                        <div class="hover-content">
                                            <div class="text-cont">
                                                <h3><?php echo get_the_title(); ?></h3>
                                                <span>
                                                    <?php echo get_field('svgicon'); ?>
													<?php if(get_field('industry_icon')):?>
													<img src="<?php echo get_field('industry_icon')?>" alt="card icon" width="100" height="100" loading="lazy" decoding="async" class="img-fluid visible">
													<?php endif; ?>
                                                </span>
                                            </div>
                                            <?php echo wpautop( get_the_content() ); ?>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <?php endwhile; ?>
                            <?php wp_reset_postdata(); ?>
               </div>
               <div class="slide-owl-nav d-xl-none d-flex">
                   <button class="slide-prev-button" aria-label="prev button">
                       <img src='<?php echo get_template_directory_uri(); ?>/assets/img/left-arrow.webp' alt="prev button image" width="22" height="15">
                   </button>
                   <button class="slide-next-button" aria-label="next button">
                       <img src='<?php echo get_template_directory_uri(); ?>/assets/img/right-arrow.webp' alt="next button image" width="22" height="15">
                   </button>
               </div>
           </div>
       </div>
    </div>
</section>

<?php endif; ?>