<?php get_header();
$imgs = get_field('act_imgs');
$slider = false;
if(count($imgs)>1){
    $slider = true;
    $img_main = false;
}else{
    $slider = false;
    $thumb_id = get_post_thumbnail_id();
    $thumb_url = wp_get_attachment_image_src($thumb_id,'large', true);
    $img_main = $thumb_url[0];
}
?>
<?php
include 'inc/header.php';
if(get_field('content')) {
    $blocs = get_field('content');
    foreach ($blocs as $bloc) {

        switch ($bloc['acf_fc_layout']) {
            case 'bloc_txt':
                $tpl = 'bloc_txt';
                break;
            case 'bloc_txt_img':
                $tpl = 'bloc_txt_img';
                break;
            case 'bloc_txt_2_columns':
                $tpl = 'bloc_txt_2_columns';
                break;
        }
        include 'inc/content/' . $tpl . '.php';

    }
}
?>
<div class="container p-5">
    <div class="row">
        <div class=" col-12 col-lg-6 offset-lg-3 pdt_img">
            <?php if(!$slider){ ?>
                <img src="<?php echo $img_main['sizes']['large'];?>" alt="" class="img-fluid">
                <?php
            }else{
                echo '  <div class="slider_pdt">';
                foreach ($imgs as $img){
                    echo '<div class="item text-center">
                        <img class="img-fluid" alt="'.$img['alt'].'" src="'.$img['sizes']['large'].'">
                    </div>';
                }
                echo '</div>';
            }
            ?>
        </div>
    </div>
    <div class="row">
        <div class="col-12">
            <p class="mt-5 text-center">
                <a href="<?php echo get_permalink(409);?>" class="arrow_link bg-beige white montserrat bold btn btn-lg">Je demande un devis</a>
            </p>
        </div>
    </div>
</div>
<?php get_footer(); ?>
