<?php get_header('insidepages'); ?>

    <?php
    if (have_posts()){
        the_post();
            $principalPageId = get_the_ID();
            $principalPage = get_post($principalPageId);

            if(get_field('icon_principal', $principalPageId)) $icon = get_field('icon_principal', $principalPageId);
            $title = $principalPage->post_title;
            if(get_field('excerpt_txt', $principalPageId)) $intro = get_field('excerpt_txt', $principalPageId);
            if(get_field('colorid_txt', $principalPageId)) $colorid_txt = get_field('colorid_txt', $principalPageId);
    }
    ?>

    <!-- Banner : Begin -->
    <div class="row no-margin slider">
        <div class="rounded">
            <div class="bannercontainer">
                <div class="banner" style="visibility:hidden">
                    <ul>
                        <!-- Slides : Begin -->
                        <?php
                        /*
                        *  Loop through Slider Repeater fields (From another $post ID)
                        */

                        if(get_field('sliders', $principalPageId) )
                        {
                            
                            while(has_sub_field('sliders', $principalPageId) )
                            {
                                if(get_sub_field('image_banner')) $image = get_sub_field('image_banner');

                        ?>
                                
                        <li data-transition="fade">
                            <img src="<?php echo $image; ?>" alt="" />
                            <div class="all-container row no-margin clr-<?php echo $colorid_txt ?>">
                                    <div class="container">
                                        <span class="caption sfl" data-speed="600" data-start="500" data-easing="easeIn"><img  src="<?php echo $icon; ?>" alt=""/></span>
                                        <h3 class="caption fade sfr" data-speed="600" data-start="600" data-easing="easeIn"><?php echo $title; ?></h3>
                                    </div>
                            </div>
                        </li>
                        
                        <?php
                            }
                        }
                        ?>
                    </ul>
                </div>
            </div>
        </div>
    </div>
    <!--  Banner : End -->



    <!-- Intro -->
    <div class="row no-margin">
        <div class="container margin_T_80 theme-padding"> 
            <p class="txt_al_j">
            <?php echo $intro; ?><br /><br />
            </p>
        </div>
    </div>
    <!-- /Intro -->

    <!-- Tab -->
    <div class="row no-margin">
        <div class="container  theme-padding tab-warpper">
            <div class="col-md-4 col-sm-5 no-padding">
                
                <!-- Tab : Begin -->
                
                <?php /**  Loop through Tab  **/

                if(get_field('tabs_inormation', $principalPageId) )
                {
                ?>

                <ul class="department-detail-ul clr-<?php echo $colorid_txt ?>">
                    <?php
                    $counter = 0;
                    $content_array = array();
                    
                    while(has_sub_field('tabs_inormation', $principalPageId) )
                    {
                        if(get_sub_field('title')) $title = get_sub_field('title');
                        if(get_sub_field('content')) $content[$counter] = get_sub_field('content');

                ?>
                    <li class="cat<?php echo $counter+1; if($counter==0) echo ' active'; ?>"><i></i><h3><?php echo $title; ?></h3><span></span></li>        
                    <?php 
                    $counter++;
                    } ?>

                </ul>
                <?php } ?>
            </div>

            <?php
            for($i=0; $i<=$counter; $i++)
            {
            ?>

            <div class="col-md-8 col-sm-7 tab-item tab<?php echo $i+1; ?> clr-<?php echo $colorid_txt ?> <?php if($i==0) echo ' active'; ?>">
                <?php if ( isset($content[$i]) ) echo $content[$i]; ?>
            </div>
            <?php } ?>
        </div>
    </div>
    <!-- Tab : End -->
    <p>&nbsp;</p>


<?php get_footer('services'); ?>