<?php
/**
 * Template Name: Services
 *
 */
get_header();
$parent = get_field('page_parente');
?>
<div class="container">
    <div class="row">
        <div class="col-lg-12 accroche">
            <?php
            $titreDelaPage = get_field('titre_de_la_page');
            if(!empty($titreDelaPage)){
                echo $titreDelaPage;
            }else{
            ?>
            <h1><?php the_title();?><span class="barre"></span><span class="bxllie"><?php echo $parent['label'];?></h1>
            <?php
            }
            ?>
        </div>
    </div>
</div>
<div class="container">
    <div class="row slider">
        <?php
        $sliderContenu = get_field('slider');
        if(!empty($sliderContenu)):
        ?>
        <div class="col-12 sliderLarge">
            <div class="single-item">
            <?php
            // check if the repeater field has rows of data
            if( have_rows('slider') ):
                // loop through the rows of data
                while ( have_rows('slider') ) : the_row();
                    // display a sub field value
                    $image = get_sub_field('image_slider');
                    //print_r($image);
                    ?>
                    <div><img src='<?php echo $image['url']?>' alt="<?php echo $image['alt']?>"></div>
                    <?php
                endwhile;
            else :
                // no rows found
            endif;
            ?>
            </div>
        </div>
        <?php
        endif;
        ?>
          <?php
        $sliderContenuSmall = get_field('slider_mobile');
        if(!empty($sliderContenuSmall)):
        ?>
        <div class="col-12 sliderSmall">
            <div class="single-item">
            <?php
            // check if the repeater field has rows of data
            if( have_rows('slider_mobile') ):
            // loop through the rows of data
                while ( have_rows('slider_mobile') ) : the_row();
                    // display a sub field value
                    $image = get_sub_field('image_slider_mobile');
                    //print_r($image);
                    ?>
                    <div><img src='<?php echo $image['url']?>' alt="<?php echo $image['alt']?>"></div>
                    <?php
                endwhile;
            else :
            // no rows found
            endif;
            ?>
            </div>
        </div>
        <?php
        endif;
        ?>
    </div>
</div>
<div class="container">
        <div class="row">
        <div class="offset-lg-4 col-lg-1">
            <div class="circleTop"></div>
        </div>
    </div>
</div>
<div class="container methodo">
    <div class="row">
        <div class="offset-lg-4 col-lg-8">
            <h3><?php echo get_field('mise_en_bouche');?></h3>
        </div>
        <?php
        // check if the repeater field has rows of data
        if( have_rows('methodologie') ):
            // loop through the rows of data
            $i = 1;
            while ( have_rows('methodologie') ) : the_row();
               ?>
               <div class="col-lg-4 marge<?php echo $i;?>">
                   <h2><?php echo get_sub_field('titre_de_letape');?></h2>
                   <div class="contenu"><?php echo get_sub_field('texte_de_letape');?></div>
               </div>
               <?php
               $i++;
            endwhile;
        else :
            // no rows found
        endif;
        ?>
    </div>
</div>
<div class="container contenuDeLaPage">
    <div class="row">
        <div class="col-lg-1"><div class="circleTop"></div></div>
    </div>
    <div class="row">
    <?php
    if( have_rows('contenu_de_la_page') ):
        while ( have_rows('contenu_de_la_page') ) : the_row();
            ?>
            <div class="col-lg-12">
                <h2><?php echo get_sub_field('titre_de_la_section');?></h2>
            </div>
            <div class="col-lg-12 spacer"></div>
            <?php
            echo get_sub_field('contenu_de_la_section');
        endwhile;
    else :
    endif;
    ?>
    </div>
</div>
<div class="container article">
    <div class="row">
        <div class="offset-lg-8 col-lg-1"><div class="circleTop"></div></div>
        <div class="offset-lg-4 col-lg-8"><p class="plus">Vous voulez en savoir plus ?</p></div>
    </div>
    <div class="row listeArticle">
    <?php
                $catBlog = get_field('domaine');
                //print_r($catBlog);
                $args = array (
                    'posts_per_page' => 3,
                    'cat' => $catBlog
                );
                $query = new WP_Query( $args );
                $i=1;
                if ($query->have_posts()) :
                while ($query->have_posts()) : $query->the_post();
                /*
                $cats = get_the_category();
                foreach ($cats as $cat) {
                    if($cat->slug == 'web-design')
                    {
                        $classColor = 'webDesign';
                    }elseif($cat->slug == 'studio-graphique')
                    {
                        $classColor = 'studioGraphique';
                    }elseif($cat->slug == 'agence-web')
                    {
                        $classColor = 'agenceWeb';
                    }elseif($cat->slug == 'production-audiovisuelle')
                    {
                        $classColor = 'productionAudiovisuelle';
                    }elseif($cat->slug == 'inbound-marketing')
                    {
                        $classColor = 'inboundMarketing';
                    }elseif($cat->slug == 'formations-sur-mesure')
                    {
                        $classColor = 'formationSurMesure';
                    }
                }
                */
                ?>
                <div class="col-lg-4 <?php  if($i<4){ }else{ echo('espacement'); }?> <?php echo $classColor; ?>">
                    <div class="articleItem">
                        <a target="_blank" href="<?php the_permalink()?>">
                        <h2 class='titreArticle'><?php the_title();?></h2>
                        <p><?php the_excerpt();?></p>
                        </a>
                    </div>
                </div>
                <?php
                $i++;
                endwhile;
                endif;
    ?>
    </div>
</div>
<div class="container menuContainer">
    <div class="row">
        <div class="col-lg-1"><div class="circleTop"></div></div>
        <div class="col-lg-12"><h2>Intéressé par un autre service ?</h2></div>
    </div>
    <div class="row">
        <div class="col-lg-3 nosMenu agenceWeb">
            <a href="<?php echo home_url()?>/agence-web-bruxelles-liege/"><h3 class="nomMenu">Agence web</h3></a>
        <?php
            wp_nav_menu( array(
                'menu'           => 'Agence web - beta',
            ) );
            ?>
        </div>
        <div class="col-lg-3 nosMenu studioGraphique">
            <a href="<?php home_url();?>/studio-graphique-bruxelles-liege"><h3 class="nomMenu">Studio graphique</h3></a>
        <?php
            wp_nav_menu( array(
                'menu'           => 'Studio graphique - beta',
            ) );
            ?>
        </div>
        <div class="col-lg-3 nosMenu">
            <div class="menu-haut productionAudiovisuelle">
            <a href="<?php home_url();?>/production-audiovisuelle-bruxelles-liege"><h3 class="nomMenu">Production audiovisuelle</h3></a>
            <?php
            wp_nav_menu( array(
                'menu'           => 'Production audiovisuelle - beta',
            ) );
            ?>
            </div>
            <div class="menu-bas inboundMarketing">
            <a href="<?php echo home_url()?>/inbound-marketing-bruxelles-liege"><h3 class="nomMenu">Inbound marketing</h3></a>
            <?php
            wp_nav_menu( array(
                'menu'           => 'Inbound marketing - beta',
            ) );
            ?>
            </div>
        </div>
        <div class="col-lg-3 nosMenu">
        <div class="menu-haut formationSurMesure">
        <h3 class="nomMenu">Formations sur mesure</h3>
        <?php

            wp_nav_menu( array(
                'menu'           => 'Formation sur mesure - beta',
            ) );

            ?>
        </div>
        </div>
    </div>
</div>
<div class="container devis">
    <div class="row">
        <div class="offset-lg-5 col-lg-1"><div class="circleTop"></div></div>
        <div class="offset-lg-4 col-lg-8">
            <a href="<?php echo home_url();?>/contactez-nous/"><h2 class="texteDevis">Un p’tit devis ? C’est par ici !</h2></a>
        </div>
        <div class="col-12"><div class="circleCenter"></div></div>
    </div>
</div>
<?php get_footer();?>
