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

    <?php
    if (have_posts()){
        the_post();
            $solutionsPageId = get_the_ID();
            $solutionsPage = get_post($solutionsPageId);

            if(get_field('icon_solution', $solutionsPageId)) $icon = get_field('icon_solution', $solutionsPageId);
            $title = $solutionsPage->post_title;
            if(get_field('excerpt_txt', $solutionsPageId)) $intro = get_field('excerpt_txt', $solutionsPageId);
            if(get_field('colorid_txt', $solutionsPageId)) $colorid_txt = get_field('colorid_txt', $solutionsPageId);
    }
    ?>

    <!-- 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', $solutionsPageId) )
                        {
                            
                            while(has_sub_field('sliders', $solutionsPageId) )
                            {
                                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>
        
        <!-- /Intro -->

        <!-- First Level Links: Begin -->
        <?php /**  Loop through First Level Links  **/

        if(get_field('links_level1', $solutionsPageId) )
        {
        ?>

            <ul class="linklist clr-<?php echo $colorid_txt; ?>">
                <?php            
                while(has_sub_field('links_level1', $solutionsPageId) )
                {
                    if(get_sub_field('link_level1_title')) $link_level1_title = get_sub_field('link_level1_title');
                    if(get_sub_field('link_level1_address')) $link_level1_address = get_sub_field('link_level1_address');
                ?>
                <li><a href="<?php echo $link_level1_address; ?>" target="_blank"><label></label><h3><?php echo $link_level1_title; ?></h3><div><span></span></div><i></i></a></li>
                <?php } //end while ?>
            </ul>

        <?php } //end if ?>
        <!-- First Level Links: End -->
        </div>
    </div>

    <!-- 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', $solutionsPageId) )
                {
                ?>

                <ul class="department-detail-ul clr-<?php echo $colorid_txt; ?>">
                    <?php
                    $counter = 0;
                    $title_insideTab_array = array();
                    $content_array = array();
                    $link_title_array = array();
                    $link_address_array = array();
                    
                    while(has_sub_field('tabs_inormation', $solutionsPageId) )
                    {
                        if(get_sub_field('title')) $title = get_sub_field('title');
                        if(get_sub_field('content')) $content[$counter] = get_sub_field('content');
                        if(get_sub_field('title')) $title_insideTab_array[$counter] = get_sub_field('title');
                        if(get_sub_field('link')){
                            $link_title_array[$counter] = array();
                            $link_address_array[$counter] = array();
                            $counter_inner = 0;
                            while(has_sub_field('link')){
                                if(get_sub_field('link_title'))  $link_title_array[$counter][$counter_inner] = get_sub_field('link_title');
                                if(get_sub_field('link_address')) $link_address_array[$counter][$counter_inner] = get_sub_field('link_address');
                                $counter_inner++;
                            }
                        }

                ?>
                    <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'; ?>">
                <div class="title-inside-tab clr-<?php echo $colorid_txt; ?>"><?php echo $title_insideTab_array[$i] ?></div>
                <?php if ( isset($content[$i]) ) echo $content[$i]; ?>

                <?php
                if(isset($link_title_array[$i])){
                    if(count($link_title_array[$i])){ ?>
                    <ul class="linklist-2">
                    <?php for($j=0; $j<count($link_title_array[$i]); $j++){?>
                        <li><a href="<?php echo $link_address_array[$i][$j] ?>" target="_blank"><i></i><h3><?php echo $link_title_array[$i][$j] ?></h3><div><span></span></div></a></li>
                    <?php } //end for ?>
                <?php } } //end if?>
              
            </div>
            <?php } ?>
        </div>
    </div>
    <!-- Tab : End -->
    <p>&nbsp;</p>


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